@devries-cameron20 / composio Mirror · read-only / commits / f6368e0ef
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 07:15 UTC

fix(core): accept experimental in the session authorize type (#4665)

This PR: - fixes #4286: the Slack setup example passes an `experimental` option supported at runtime but missing from `ToolRouterAuthorizeFn`. - adds `experimental?: ConnectedAccountExperimental` to the public options type and a regression type test; includes a patch changeset for `@composio/core`. - verifies the actual Slack example source and reproduces TS2353 when only the type fix is removed. - passes `mise exec -- pnpm --filter @composio/core typecheck`. - passes `mise exec -- pnpm --filter @composio/core exec vitest run test/core/session.test.ts`: 49 tests. Updated with current `next`; the runtime and example remain unchanged. Co-authored-by: jkomyno <alberto@composio.dev>

Tarun Vashishtha committed Nov 2, 2026 at 04:09 UTC f6368e0ef52c694d7efb4fd720e41f0109a2b65b
3 files changed +14 -1
.changeset/session-authorize-experimental-type.md new
+5
@@ -0,0 +1,5 @@
1 +---
2 +'@composio/core': patch
3 +---
4 +
5 +Add the missing `experimental` option to the `ToolRouterAuthorizeFn` type. `session.authorize()` already accepted `experimental: { accountType, aclConfigForShared }` at runtime, but sessions returned by `composio.create()` and `composio.use()` rejected it at compile time.
ts/packages/core/src/types/toolRouter.types.ts
+2 -1
@@ -5,6 +5,7 @@ import { ConnectionRequest } from './connectionRequest.types';
5 import type { ComposioRequestOptions } from './requestOptions.types';
6 import type { ToolRouterSessionFilesMount } from '../models/ToolRouterSessionFileMount';
7 import { ConnectedAccountExperimentalSchema } from './connectedAccounts.types';
8 +import type { ConnectedAccountExperimental } from './connectedAccounts.types';
9 import type {
10 SessionConfigHistoryResponse,
11 SessionCreateResponse,
@@ -715,7 +716,7 @@ export type ToolRouterToolsFn<
716
717 export type ToolRouterAuthorizeFn = (
718 toolkit: string,
718 - options?: { callbackUrl?: string; alias?: string }
719 + options?: { callbackUrl?: string; alias?: string; experimental?: ConnectedAccountExperimental }
720 ) => Promise<ConnectionRequest>;
721
722 export const ToolRouterToolkitsOptionsSchema = z.object({
ts/packages/core/type-tests/sessions-mcp.test-d.ts
+7
@@ -71,7 +71,14 @@ async function updateContract(): Promise<void> {
71 await session.update({ expectedConfigVersion: true });
72 }
73
74 +// `authorize()` accepts the `experimental` block for SHARED connections (#4286).
75 +async function authorizeExperimental(): Promise<void> {
76 + const session = await composio.create('user_123');
77 + await session.authorize('slackbot', { experimental: { accountType: 'SHARED' } });
78 +}
79 +
80 void createGating;
81 void useGating;
82 void requestOptionsArg;
83 void updateContract;
84 +void authorizeExperimental;