@composio/core 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{CustomTool-fYEFjSLM.mjs → CustomTool-B-_VjWpy.mjs} +1 -1
  2. package/dist/{CustomTool-B3m-188G.d.mts → CustomTool-CKBCElpT.d.mts} +1 -1
  3. package/dist/{Telemetry-JRJJYS4I.mjs → Telemetry-41JkqpZ7.mjs} +3 -2
  4. package/dist/{cancellation-Dwa9lGHA.mjs → cancellation-DV8CIi52.mjs} +1 -1
  5. package/dist/{composio-B36OXii1.d.mts → composio-C-418N1P.d.mts} +542 -168
  6. package/dist/{customTool.types-C436M_D0.d.mts → customTool.types-CK408sI-.d.mts} +522 -66
  7. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +2 -1
  8. package/dist/docs/reference/sdk-reference/typescript/index.mdx +1 -0
  9. package/dist/docs/reference/sdk-reference/typescript/meta.json +1 -0
  10. package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +83 -0
  11. package/dist/docs/reference/sdk-reference/typescript/session.mdx +29 -20
  12. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +10 -4
  13. package/dist/{errors-D_A4b2c2.mjs → errors-Dyiu3ifQ.mjs} +10 -6
  14. package/dist/experimental/index.d.mts +2 -2
  15. package/dist/experimental/index.mjs +1 -1
  16. package/dist/index.d.mts +40 -28
  17. package/dist/index.mjs +6815 -6571
  18. package/dist/models/Files.node.mjs +1 -1
  19. package/dist/{types-Br3GBya5.d.mts → types-RpMRVn4D.d.mts} +2 -2
  20. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  21. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  22. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  23. package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
  24. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  25. package/package.json +5 -3
  26. package/src/composio.ts +8 -0
  27. package/src/errors/ToolRouterErrors.ts +10 -6
  28. package/src/index.ts +2 -0
  29. package/src/lib/sessionConfigConflict.ts +43 -0
  30. package/src/lib/toolRouterParams.ts +43 -10
  31. package/src/lib/toolRouterSourceSessionConfig.ts +12 -0
  32. package/src/models/AuthConfigs.ts +0 -9
  33. package/src/models/ConnectionRequest.ts +21 -18
  34. package/src/models/Logs.ts +2 -2
  35. package/src/models/RemoteFile.ts +25 -8
  36. package/src/models/SessionConfigs.ts +117 -0
  37. package/src/models/ToolRouter.ts +23 -5
  38. package/src/models/ToolRouterSession.ts +49 -24
  39. package/src/models/Tools.ts +7 -5
  40. package/src/models/Usage.ts +2 -1
  41. package/src/provider/OpenAIProvider.ts +0 -283
  42. package/src/telemetry/Telemetry.ts +4 -2
  43. package/src/types/logs.types.ts +9 -1
  44. package/src/types/sessionConfigs.types.ts +81 -0
  45. package/src/types/tool.types.ts +3 -1
  46. package/src/types/toolRouter.types.ts +177 -13
  47. package/src/types/usage.types.ts +2 -0
  48. package/src/utils/safePath.ts +172 -0
  49. package/src/utils/transformers/logs.ts +3 -2
  50. package/src/utils/transformers/sessionConfigs.ts +54 -0
  51. package/src/utils/transformers/toolRouterResponseTransform.ts +24 -0
  52. package/src/utils/transformers/usage.ts +4 -0
@@ -53,13 +53,14 @@ const composio = new Composio({
53
53
  |------|------|-------------|
54
54
  | `authConfigs` | `AuthConfigs` | Manage authentication configurations for toolkits |
55
55
  | `connectedAccounts` | `ConnectedAccounts` | Manage authenticated connections |
56
- | `create` | `(userId: string, config: \{ authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string \| ...[]>; experimental?: \{ assistivePrompt?: \{ userTimezone?: string \}; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] \}; manageConnections?: boolean \| \{ callbackUrl?: string; enable?: boolean; waitForConnections?: boolean \}; mcp?: boolean; multiAccount?: \{ enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean \}; preload?: \{ tools?: ...[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: ... \| ... \| ... \| ...[] \| \{ disable?: ...[]; enable?: ...[] \}; toolkits?: string[] \| \{ disable: ...[] \} \| \{ enable: ...[] \}; tools?: Record<string, ...[] \| \{ enable: ... \} \| \{ disable: ... \} \| \{ tags: ... \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \} & \{ mcp: true \}, requestOptions: ComposioRequestOptions) => Promise<Session>` | Creates a new tool router session for a user. Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools should be exposed directly; see `ToolRouterCreateSessionConfig`. |
56
+ | `create` | `(...) => Promise<Session>` | Creates a new tool router session for a user. Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools should be exposed directly; see `ToolRouterCreateSessionConfig`. |
57
57
  | `experimental` | `Experimental` | Experimental SDK methods whose shape may change in future releases. Prefer domain-specific mounts (for example `composio.connectedAccounts.updateAcl(...)`) when available; this namespace keeps compatibility aliases while APIs are experimental. Stateless experimental factories (e.g. `experimental_createTool`) stay at the top level. |
58
58
  | `files` | `Files` | Upload and download files |
59
59
  | `keyring` | `Keyring` | Public transfer keys of the organization's customer-managed keyring |
60
60
  | `logs` | `Logs` | Search and inspect tool-execution logs |
61
61
  | `mcp` | `MCP` | Model Context Protocol server management. |
62
62
  | `provider` | `TProvider` | The tool provider instance used for wrapping tools in framework-specific formats |
63
+ | `sessionConfigs` | `SessionConfigs` | Read the project's saved Session configs. Apply one with `experimental.sessionConfigId` on `sessions.create()` or `session.update()`. Requires Session configs to be enabled for the project. |
63
64
  | `sessions` | `Sessions` | Create and reuse Composio sessions. Prefer `composio.sessions.create(...)` for new code. The top-level `composio.create(...)` method is kept as an alias. |
64
65
  | `toolkits` | `Toolkits` | Retrieve toolkit metadata and authorize user connections |
65
66
  | `toolRouter` | `ToolRouter` | Legacy alias for `composio.sessions`. |
@@ -26,6 +26,7 @@ description: "Complete API reference for the Composio TypeScript SDK (@composio/
26
26
  | [`Session files`](/reference/sdk-reference/typescript/session-files) | File mount for a Composio session, reached via `session.experimental.files` |
27
27
  | [`Tools`](/reference/sdk-reference/typescript/tools) | This class is used to manage tools in the Composio SDK. |
28
28
  | [`Triggers`](/reference/sdk-reference/typescript/triggers) | Trigger (Instance) class |
29
+ | [`SessionConfigs`](/reference/sdk-reference/typescript/session-configs) | `composio.sessionConfigs` — saved, reusable Session configs. |
29
30
  | [`Usage`](/reference/sdk-reference/typescript/usage) | `composio.experimental.usage` — metering for the project the API key |
30
31
  | [`WebhookEndpoints`](/reference/sdk-reference/typescript/webhook-endpoints) | `composio.webhooks.endpoints` — inbound webhook endpoints. Each endpoint is |
31
32
  | [`Webhooks`](/reference/sdk-reference/typescript/webhooks) | `composio.webhooks` namespace. |
@@ -16,6 +16,7 @@
16
16
  "session-files",
17
17
  "tools",
18
18
  "triggers",
19
+ "session-configs",
19
20
  "usage",
20
21
  "webhook-endpoints",
21
22
  "webhooks",
@@ -0,0 +1,83 @@
1
+ ---
2
+ title: "SessionConfigs"
3
+ description: "`composio.sessionConfigs` — saved, reusable Session configs. A Session config is a named access policy (`sc_…`) built in the Composio Dashboard under Sessions → Configs. Pass its id as `experimental.sessionConfigId` to `composio.sessions.create()` or `session.update()` to apply it. These endpoints require Session configs to be enabled for the project; otherwise the backend returns 403."
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ Access this class through the `composio.sessionConfigs` property:
9
+
10
+ ```typescript
11
+ const composio = new Composio({ apiKey: 'your-api-key' });
12
+ const result = await composio.sessionConfigs.list();
13
+ ```
14
+
15
+ ## Methods
16
+
17
+ ### get()
18
+
19
+ Retrieve one saved Session config with its description and access
20
+ policy. A missing or cross-project id surfaces as the backend's 404.
21
+
22
+ Requires Session configs to be enabled for the project.
23
+
24
+ ```typescript
25
+ async get(id: string, requestOptions?: ComposioRequestOptions): Promise<{ archived: boolean; config: { tags?: { disable?: ... | ... | ... | ...[]; enable?: ... | ... | ... | ...[] }; toolkits?: { enable: ...[] } | { disable: ...[] }; tools?: Record<string, { enable: ... } | { disable: ... } | { tags: ... }> }; createdAt: string; description: string | null; id: string; name: string; updatedAt: string }>
26
+ ```
27
+
28
+ **Parameters**
29
+
30
+ | Name | Type | Description |
31
+ |------|------|-------------|
32
+ | `id` | `string` | The `sc_…` id of the Session config |
33
+ | `requestOptions?` | `ComposioRequestOptions` | |
34
+
35
+ **Returns**
36
+
37
+ `Promise<\{ archived: boolean; config: \{ tags?: \{ disable?: ... \| ... \| ... \| ...[]; enable?: ... \| ... \| ... \| ...[] \}; toolkits?: \{ enable: ...[] \} \| \{ disable: ...[] \}; tools?: Record<string, \{ enable: ... \} \| \{ disable: ... \} \| \{ tags: ... \}> \}; createdAt: string; description: string \| null; id: string; name: string; updatedAt: string \}>` — The config and its policy
38
+
39
+ **Example**
40
+
41
+ ```typescript
42
+ const sessionConfig = await composio.sessionConfigs.get('sc_abc123');
43
+ console.log(sessionConfig.config.toolkits);
44
+ ```
45
+
46
+ ---
47
+
48
+ ### list()
49
+
50
+ List the project's saved Session configs with cursor pagination.
51
+
52
+ Omitting `archived` returns active configs; `archived: true` returns only
53
+ archived ones. The backend defaults `limit` to 20 and caps it at 100.
54
+
55
+ Requires Session configs to be enabled for the project.
56
+
57
+ ```typescript
58
+ async list(params?: { archived?: boolean; cursor?: string; limit?: number; search?: string }, requestOptions?: ComposioRequestOptions): Promise<{ items: { archived: boolean; createdAt: string; id: string; name: string; updatedAt: string }[]; nextCursor: string | null }>
59
+ ```
60
+
61
+ **Parameters**
62
+
63
+ | Name | Type | Description |
64
+ |------|------|-------------|
65
+ | `params?` | `\{ archived?: boolean; cursor?: string; limit?: number; search?: string \}` | `search`, `archived`, `limit` and `cursor` |
66
+ | `requestOptions?` | `ComposioRequestOptions` | |
67
+
68
+ **Returns**
69
+
70
+ `Promise<\{ items: \{ archived: boolean; createdAt: string; id: string; name: string; updatedAt: string \}[]; nextCursor: string \| null \}>` — Config summaries and the next cursor
71
+
72
+ **Example**
73
+
74
+ ```typescript
75
+ let cursor: string | undefined;
76
+ do {
77
+ const page = await composio.sessionConfigs.list({ cursor });
78
+ for (const item of page.items) console.log(item.id, item.name);
79
+ cursor = page.nextCursor ?? undefined;
80
+ } while (cursor);
81
+ ```
82
+
83
+ ---
@@ -7,8 +7,8 @@ description: "A Composio session — the object returned by `composio.sessions.c
7
7
 
8
8
  | Name | Type | Description |
9
9
  |------|------|-------------|
10
- | `config` | `Config` | Server-side session configuration (toolkit/tool allowlists, tags, preload, sandbox, manage_connections) as returned by the API. Refreshed in place by `update()`. |
11
- | `configVersion` | `number` | Version of the server-side configuration this object last observed. Refreshed in place by `update()`, which sends it as the `expected_config_version` precondition by default. |
10
+ | `config` | `Config` | The session's current configuration (policy snapshot and runtime settings). Refreshed in place by `update()`. For saved, reusable Session configs, see `composio.sessionConfigs`. |
11
+ | `configVersion` | `number` | Version of the server-side configuration this object last observed. Refreshed in place by `update()`. Pass it as `expectedConfigVersion` to make an update conditional. |
12
12
  | `experimental` | `SessionExperimental` | |
13
13
  | `mcp` | `\{ headers?: Record<string, string>; type: 'http' \| 'sse'; url: string \}` | Hosted MCP endpoint (`session.mcp.url` / `session.mcp.headers`). Exists on every session at runtime, but only surfaced in the type when the session is created with `\{ mcp: true \}` (which returns `Session`); the default `SessionWithoutMcp` omits `mcp`, so MCP is an explicit opt-in. See https://docs.composio.dev/docs/sessions-via-mcp |
14
14
  | `preload` | `\{ tools: string[] \| 'all' \}` | |
@@ -162,7 +162,7 @@ the session's custom tools and toolkits. Custom tools are executed
162
162
  in-process; remote tools are sent to the Composio backend.
163
163
 
164
164
  ```typescript
165
- async execute(toolSlug: string, arguments_?: Record<string, unknown>, options?: ToolRouterSessionExecuteOptions, requestOptions?: ComposioRequestOptions): Promise<{ data: Record<string, unknown>; error: string | null; logId: string }>
165
+ async execute(toolSlug: string, arguments_?: Record<string, unknown>, options?: ToolRouterSessionExecuteOptions, requestOptions?: ComposioRequestOptions): Promise<...>
166
166
  ```
167
167
 
168
168
  **Parameters**
@@ -176,7 +176,7 @@ async execute(toolSlug: string, arguments_?: Record<string, unknown>, options?:
176
176
 
177
177
  **Returns**
178
178
 
179
- `Promise<\{ data: Record<string, unknown>; error: string \| null; logId: string \}>` — The tool execution result
179
+ `Promise<...>` — The tool execution result
180
180
 
181
181
  ---
182
182
 
@@ -239,7 +239,7 @@ Search for tools by semantic use case.
239
239
  Returns relevant tools for the given query with schemas and guidance.
240
240
 
241
241
  ```typescript
242
- async search(params: { query: string; toolkits?: string[] }, requestOptions?: ComposioRequestOptions): Promise<{ error: string | null; nextStepsGuidance: string[]; results: { difficulty?: string; error?: string | null; executionGuidance?: string; index: number; knownPitfalls?: string[]; memory?: Record<string, ...[]>; planId?: string; primaryToolSlugs: string[]; recommendedPlanSteps?: string[]; referenceWorkbenchSnippets?: { code: ...; description: ... }[]; relatedToolSlugs: string[]; toolkits: string[]; useCase: string }[]; session: { generateId: boolean; id: string; instructions: string }; success: boolean; timeInfo: { currentTimeUtc: string; currentTimeUtcEpochSeconds: number; message: string }; toolkitConnectionStatuses: { connectionDetails?: Record<string, unknown>; currentUserInfo?: Record<string, unknown>; description: string; hasActiveConnection: boolean; statusMessage: string; toolkit: string }[]; toolSchemas: Record<string, { description?: string; hasFullSchema?: boolean; inputSchema?: Record<string, unknown>; outputSchema?: Record<string, unknown>; schemaRef?: { args: { toolSlugs: ... }; message?: string; tool: 'COMPOSIO_GET_TOOL_SCHEMAS' }; toolkit: string; toolSlug: string }> }>
242
+ async search(params: { query: string; toolkits?: string[] }, requestOptions?: ComposioRequestOptions): Promise<{ error: string | null; nextStepsGuidance: string[]; results: { difficulty?: string; error?: string | null; executionGuidance?: string; index: number; knownPitfalls?: string[]; memory?: Record<string, ...[]>; planId?: string; primaryToolSlugs: string[]; recommendedPlanSteps?: string[]; referenceWorkbenchSnippets?: { code: ...; description: ... }[]; relatedToolSlugs: string[]; toolkits: string[]; useCase: string }[]; session: { generateId: boolean; id: string; instructions: string }; success: boolean; timeInfo: { currentTimeUtc: string; currentTimeUtcEpochSeconds: number; message: string }; toolkitConnectionStatuses: { connectionDetails?: Record<string, unknown>; currentUserInfo?: Record<string, unknown>; description: string; hasActiveConnection: boolean; hostedAccount?: { allowedToolSlugs: ...[] }; statusMessage: string; toolkit: string }[]; toolSchemas: Record<string, { description?: string; hasFullSchema?: boolean; inputSchema?: Record<string, unknown>; outputSchema?: Record<string, unknown>; schemaRef?: { args: { toolSlugs: ... }; message?: string; tool: 'COMPOSIO_GET_TOOL_SCHEMAS' }; toolkit: string; toolSlug: string }> }>
243
243
  ```
244
244
 
245
245
  **Parameters**
@@ -251,7 +251,7 @@ async search(params: { query: string; toolkits?: string[] }, requestOptions?: Co
251
251
 
252
252
  **Returns**
253
253
 
254
- `Promise<\{ error: string \| null; nextStepsGuidance: string[]; results: \{ difficulty?: string; error?: string \| null; executionGuidance?: string; index: number; knownPitfalls?: string[]; memory?: Record<string, ...[]>; planId?: string; primaryToolSlugs: string[]; recommendedPlanSteps?: string[]; referenceWorkbenchSnippets?: \{ code: ...; description: ... \}[]; relatedToolSlugs: string[]; toolkits: string[]; useCase: string \}[]; session: \{ generateId: boolean; id: string; instructions: string \}; success: boolean; timeInfo: \{ currentTimeUtc: string; currentTimeUtcEpochSeconds: number; message: string \}; toolkitConnectionStatuses: \{ connectionDetails?: Record<string, unknown>; currentUserInfo?: Record<string, unknown>; description: string; hasActiveConnection: boolean; statusMessage: string; toolkit: string \}[]; toolSchemas: Record<string, \{ description?: string; hasFullSchema?: boolean; inputSchema?: Record<string, unknown>; outputSchema?: Record<string, unknown>; schemaRef?: \{ args: \{ toolSlugs: ... \}; message?: string; tool: 'COMPOSIO_GET_TOOL_SCHEMAS' \}; toolkit: string; toolSlug: string \}> \}>`
254
+ `Promise<\{ error: string \| null; nextStepsGuidance: string[]; results: \{ difficulty?: string; error?: string \| null; executionGuidance?: string; index: number; knownPitfalls?: string[]; memory?: Record<string, ...[]>; planId?: string; primaryToolSlugs: string[]; recommendedPlanSteps?: string[]; referenceWorkbenchSnippets?: \{ code: ...; description: ... \}[]; relatedToolSlugs: string[]; toolkits: string[]; useCase: string \}[]; session: \{ generateId: boolean; id: string; instructions: string \}; success: boolean; timeInfo: \{ currentTimeUtc: string; currentTimeUtcEpochSeconds: number; message: string \}; toolkitConnectionStatuses: \{ connectionDetails?: Record<string, unknown>; currentUserInfo?: Record<string, unknown>; description: string; hasActiveConnection: boolean; hostedAccount?: \{ allowedToolSlugs: ...[] \}; statusMessage: string; toolkit: string \}[]; toolSchemas: Record<string, \{ description?: string; hasFullSchema?: boolean; inputSchema?: Record<string, unknown>; outputSchema?: Record<string, unknown>; schemaRef?: \{ args: \{ toolSlugs: ... \}; message?: string; tool: 'COMPOSIO_GET_TOOL_SCHEMAS' \}; toolkit: string; toolSlug: string \}> \}>`
255
255
 
256
256
  ---
257
257
 
@@ -314,29 +314,38 @@ access: `toolkits: null` restores the unrestricted default, while
314
314
  map entirely. `manageConnections.callbackUrl: null` removes only the
315
315
  stored callback URL.
316
316
 
317
- The request carries the `configVersion` this object last observed as the
318
- `expected_config_version` precondition, so a concurrent change surfaces as
317
+ By default the request carries no precondition: the last writer wins.
318
+ Pass `expectedConfigVersion` (for example `session.configVersion`) to make
319
+ the update conditional: the API then applies it only when the stored
320
+ version still matches, and a concurrent change surfaces as
319
321
  ComposioSessionConfigConflictError (HTTP 409) instead of being
320
- overwritten. Pass `expectedConfigVersion` to send another version, or
321
- `expectedConfigVersion: false` to send no precondition (last writer
322
- wins). The PATCH is never retried by the transport, so a 409 is reported
323
- exactly once. On conflict this object is left unchanged: re-fetch the
324
- session with `sessions.use(sessionId)` and retry against the fresh
325
- `configVersion`.
326
-
327
- `config`, `configVersion`, `preload`, `sandbox` and `warnings` are
328
- refreshed in place only after a successful response, and the updated
329
- `config` is returned.
322
+ overwritten. The API must support the `expected_config_version` field;
323
+ otherwise it rejects the request with a 400. `expectedConfigVersion: false`
324
+ is the same as omitting it. The PATCH is never retried by the transport,
325
+ so a 409 is reported exactly once. On conflict this object is left
326
+ unchanged: re-fetch the session with `sessions.use(sessionId)` and retry
327
+ against the fresh `configVersion`.
328
+
329
+ `experimental.sessionConfigId` applies a saved Session config: it
330
+ replaces the session's toolkit, tool and tag access and cannot be combined
331
+ with `toolkits`, `tools` or `tags` (a `ValidationError` is thrown before
332
+ any request). A 409 while applying it means the session or the config
333
+ changed; re-fetch the session and retry. Backend 400, 403 and 404 errors,
334
+ for example for an archived or missing config, surface unchanged.
335
+
336
+ `config`, `configVersion`, `preload`, `sandbox`, `warnings` and
337
+ `experimental.sourceSessionConfig` are refreshed in place only after a
338
+ successful response, and the updated `config` is returned.
330
339
 
331
340
  ```typescript
332
- async update(config: { authConfigs?: Record<string, string> | null; connectedAccounts?: Record<string, string[]> | null; execute?: { enableMultiExecute?: boolean } | null; expectedConfigVersion?: number | false; experimental?: { fastMode?: boolean | null; linkUrlOverwrite?: string | null; permissions?: { default: ... | ... | ...; overrides?: Record<..., ...> } | null; sessionConfigId?: string; submitFeedback?: { enable: boolean } | null } | null; manageConnections?: boolean | { callbackUrl?: string | null; enable?: boolean; enableConnectionRemoval?: boolean | null; waitForConnections?: boolean } | null; multiAccount?: { enable?: boolean; maxAccountsPerToolkit?: number | null; requireExplicitSelection?: boolean } | null; preload?: { tools?: string[] | 'all' } | null; sandbox?: { autoOffloadThreshold?: number; enable?: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' } | null; search?: { enable?: boolean } | null; tags?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] | { disable?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[]; enable?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] } | null; toolkits?: string[] | { disable: string[] } | { enable: string[] } | null; tools?: Record<string, string[] | { enable: ...[] } | { disable: ...[] } | { tags: ... | ... }> | null; workbench?: { autoOffloadThreshold?: number; enable?: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' } | null }, requestOptions?: ComposioRequestOptions): Promise<Config>
341
+ async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<Config>
333
342
  ```
334
343
 
335
344
  **Parameters**
336
345
 
337
346
  | Name | Type |
338
347
  |------|------|
339
- | `config` | `\{ authConfigs?: Record<string, string> \| null; connectedAccounts?: Record<string, string[]> \| null; execute?: \{ enableMultiExecute?: boolean \} \| null; expectedConfigVersion?: number \| false; experimental?: \{ fastMode?: boolean \| null; linkUrlOverwrite?: string \| null; permissions?: \{ default: ... \| ... \| ...; overrides?: Record<..., ...> \} \| null; sessionConfigId?: string; submitFeedback?: \{ enable: boolean \} \| null \} \| null; manageConnections?: boolean \| \{ callbackUrl?: string \| null; enable?: boolean; enableConnectionRemoval?: boolean \| null; waitForConnections?: boolean \} \| null; multiAccount?: \{ enable?: boolean; maxAccountsPerToolkit?: number \| null; requireExplicitSelection?: boolean \} \| null; preload?: \{ tools?: string[] \| 'all' \} \| null; sandbox?: \{ autoOffloadThreshold?: number; enable?: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \| null; search?: \{ enable?: boolean \} \| null; tags?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \| \{ disable?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[]; enable?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \} \| null; toolkits?: string[] \| \{ disable: string[] \} \| \{ enable: string[] \} \| null; tools?: Record<string, string[] \| \{ enable: ...[] \} \| \{ disable: ...[] \} \| \{ tags: ... \| ... \}> \| null; workbench?: \{ autoOffloadThreshold?: number; enable?: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \| null \}` |
348
+ | `config` | `ToolRouterUpdateSessionConfig` |
340
349
  | `requestOptions?` | `ComposioRequestOptions` |
341
350
 
342
351
  **Returns**
@@ -30,7 +30,7 @@ origins is logged, so native tools keep working.
30
30
  **Overload 1**
31
31
 
32
32
  ```typescript
33
- async create(userId: string, config: { authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string | string[]>; experimental?: { assistivePrompt?: { userTimezone?: string }; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] }; manageConnections?: boolean | { callbackUrl?: string; enable?: boolean; waitForConnections?: boolean }; mcp?: boolean; multiAccount?: { enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean }; preload?: { tools?: string[] | 'all' }; sandbox?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' }; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] | { disable?: ... | ... | ... | ...[]; enable?: ... | ... | ... | ...[] }; toolkits?: string[] | { disable: string[] } | { enable: string[] }; tools?: Record<string, string[] | { enable: ...[] } | { disable: ...[] } | { tags: ... | ... }>; workbench?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' } } & { mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
33
+ async create(userId: string, config: ToolRouterCreateSessionConfig & { mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
34
34
  ```
35
35
 
36
36
  **Parameters**
@@ -38,7 +38,7 @@ async create(userId: string, config: { authConfigs?: Record<string, string>; con
38
38
  | Name | Type | Description |
39
39
  |------|------|-------------|
40
40
  | `userId` | `string` | \{string\} The user id to create the session for |
41
- | `config` | `\{ authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string \| string[]>; experimental?: \{ assistivePrompt?: \{ userTimezone?: string \}; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] \}; manageConnections?: boolean \| \{ callbackUrl?: string; enable?: boolean; waitForConnections?: boolean \}; mcp?: boolean; multiAccount?: \{ enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean \}; preload?: \{ tools?: string[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \| \{ disable?: ... \| ... \| ... \| ...[]; enable?: ... \| ... \| ... \| ...[] \}; toolkits?: string[] \| \{ disable: string[] \} \| \{ enable: string[] \}; tools?: Record<string, string[] \| \{ enable: ...[] \} \| \{ disable: ...[] \} \| \{ tags: ... \| ... \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \} & \{ mcp: true \}` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
41
+ | `config` | `ToolRouterCreateSessionConfig & \{ mcp: true \}` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
42
42
  | `requestOptions?` | `ComposioRequestOptions` | |
43
43
 
44
44
  **Returns**
@@ -48,7 +48,7 @@ async create(userId: string, config: { authConfigs?: Record<string, string>; con
48
48
  **Overload 2**
49
49
 
50
50
  ```typescript
51
- async create(userId: string, config?: { authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string | string[]>; experimental?: { assistivePrompt?: { userTimezone?: string }; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] }; manageConnections?: boolean | { callbackUrl?: string; enable?: boolean; waitForConnections?: boolean }; mcp?: boolean; multiAccount?: { enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean }; preload?: { tools?: string[] | 'all' }; sandbox?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' }; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] | { disable?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[]; enable?: 'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'[] }; toolkits?: string[] | { disable: string[] } | { enable: string[] }; tools?: Record<string, string[] | { enable: string[] } | { disable: string[] } | { tags: ...[] | { disable?: ...; enable?: ... } }>; workbench?: { autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' | 'medium' | 'large' | 'xlarge' } }, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
51
+ async create(userId: string, config?: ToolRouterCreateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
52
52
  ```
53
53
 
54
54
  **Parameters**
@@ -56,7 +56,7 @@ async create(userId: string, config?: { authConfigs?: Record<string, string>; co
56
56
  | Name | Type | Description |
57
57
  |------|------|-------------|
58
58
  | `userId` | `string` | \{string\} The user id to create the session for |
59
- | `config?` | `\{ authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string \| string[]>; experimental?: \{ assistivePrompt?: \{ userTimezone?: string \}; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] \}; manageConnections?: boolean \| \{ callbackUrl?: string; enable?: boolean; waitForConnections?: boolean \}; mcp?: boolean; multiAccount?: \{ enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean \}; preload?: \{ tools?: string[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \| \{ disable?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[]; enable?: 'readOnlyHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \}; toolkits?: string[] \| \{ disable: string[] \} \| \{ enable: string[] \}; tools?: Record<string, string[] \| \{ enable: string[] \} \| \{ disable: string[] \} \| \{ tags: ...[] \| \{ disable?: ...; enable?: ... \} \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \}` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
59
+ | `config?` | `ToolRouterCreateSessionConfig` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
60
60
  | `requestOptions?` | `ComposioRequestOptions` | |
61
61
 
62
62
  **Returns**
@@ -78,6 +78,12 @@ const session = await composio.sessions.create('user_123', {
78
78
  customToolkits: [myToolkit],
79
79
  },
80
80
  });
81
+
82
+ // Start from a saved Session config instead of inline access fields
83
+ const configured = await composio.sessions.create('user_123', {
84
+ authConfigs: { github: 'ac_123' },
85
+ experimental: { sessionConfigId: 'sc_123' },
86
+ });
81
87
  ```
82
88
 
83
89
  ---
@@ -738,11 +738,15 @@ var ComposioMCPDestinationError = class extends ComposioError$1 {
738
738
  };
739
739
  /**
740
740
  * Thrown when a session update is rejected with HTTP 409 because the session
741
- * configuration changed since it was last read: the `expected_config_version`
742
- * precondition (the session's last observed `configVersion` by default) is
743
- * stale. The local session object is left as it was before the call.
744
- * Re-fetch the session with `sessions.use(sessionId)` and retry the update
745
- * against the fresh `configVersion`.
741
+ * configuration changed since it was last read, for example when an
742
+ * `expectedConfigVersion` precondition passed to `update()` is stale. The
743
+ * local session object is left as it was before the call. Re-fetch the session
744
+ * with `sessions.use(sessionId)` and retry the update against the fresh
745
+ * `configVersion`.
746
+ *
747
+ * Applying a saved Session config with `experimental.sessionConfigId` can
748
+ * also conflict when the session or the config changes while the update is
749
+ * applied; `meta.sessionConfigId` then names the config.
746
750
  */
747
751
  var ComposioSessionConfigConflictError = class extends ComposioError$1 {
748
752
  constructor(message = "The session configuration changed since it was last read; re-fetch the session and retry the update", options = {}) {
@@ -750,7 +754,7 @@ var ComposioSessionConfigConflictError = class extends ComposioError$1 {
750
754
  ...options,
751
755
  code: ToolRouterErrorCodes.SESSION_CONFIG_CONFLICT,
752
756
  statusCode: 409,
753
- possibleFixes: options.possibleFixes ?? ["Re-fetch the session with `composio.sessions.use(sessionId)` to observe the current configVersion, then retry the update", "Pass `expectedConfigVersion: false` to apply the update regardless of concurrent changes (last writer wins)"]
757
+ possibleFixes: options.possibleFixes ?? ["Re-fetch the session with `composio.sessions.use(sessionId)` to observe the current configVersion, then retry the update", "Omit `expectedConfigVersion` to apply the update regardless of concurrent changes (last writer wins)"]
754
758
  });
755
759
  this.name = "ComposioSessionConfigConflictError";
756
760
  }
@@ -1,3 +1,3 @@
1
- import { S as SessionContext, a as CreateCustomToolkitParams, c as CustomToolExecuteFn, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams } from "../customTool.types-C436M_D0.mjs";
2
- import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-B3m-188G.mjs";
1
+ import { S as SessionContext, a as CreateCustomToolkitParams, c as CustomToolExecuteFn, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams } from "../customTool.types-CK408sI-.mjs";
2
+ import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-CKBCElpT.mjs";
3
3
  export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type SessionContext, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
@@ -1,3 +1,3 @@
1
- import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-fYEFjSLM.mjs";
1
+ import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-B-_VjWpy.mjs";
2
2
 
3
3
  export { createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };