@composio/core 0.11.0 → 0.13.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.
- package/dist/BaseProvider-BBnsv9kS.d.mts +29425 -0
- package/dist/{BaseProvider-CVbQxTNa.d.cts → BaseProvider-Brb3o86-.d.mts} +91 -44
- package/dist/CustomTool-D9qwyMrv.mjs +468 -0
- package/dist/{CustomTool-C-IUByoU.d.cts → CustomTool-Dmi6ti3I.d.mts} +2 -4
- package/dist/{CustomTool-CChQSp44.d.mts → CustomTool-DrJpOhY2.d.mts} +2 -4
- package/dist/{FileModifierErrors-C7z16Dfi.mjs → FileModifierErrors-3fSwIWoa.mjs} +35 -36
- package/dist/{Telemetry-DQax33Gh.mjs → Telemetry-DhGI_J4G.mjs} +15 -15
- package/dist/{composio-pcA13w87.d.cts → composio-DHIKRdeG.d.mts} +641 -380
- package/dist/{composio-BlASKqjQ.d.mts → composio-vMwhASRc.d.mts} +1390 -1129
- package/dist/{customTool.types-QtkAZQma.d.cts → customTool.types-CKH2R2ia.d.mts} +487 -189
- package/dist/{customTool.types-DLIORcYN.d.mts → customTool.types-DXin7Cfc.d.mts} +924 -626
- package/dist/docs/error-consistency.md +97 -0
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +306 -0
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +205 -0
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +488 -0
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +94 -0
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +67 -0
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +304 -0
- package/dist/docs/reference/sdk-reference/typescript/meta.json +17 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +107 -0
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +163 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +229 -0
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +131 -0
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +169 -0
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +453 -0
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +434 -0
- package/dist/{CustomTool-D5s-aADw.mjs → errors-DSIlYfl5.mjs} +72 -459
- package/dist/experimental/index.d.mts +2 -3
- package/dist/experimental/index.mjs +1 -3
- package/dist/{fileUtils.node-Dq7ebZPC.mjs → fileUtils.node-BiO1JQsJ.mjs} +26 -25
- package/dist/index.d.mts +1708 -2400
- package/dist/index.mjs +2632 -2006
- package/dist/jsonSchema-CFKdONpP.mjs +251 -0
- package/dist/models/Files.node.d.mts +1 -2
- package/dist/models/Files.node.mjs +3 -4
- package/dist/models/Files.workerd.d.mts +0 -1
- package/dist/platform/node.d.mts +1 -2
- package/dist/platform/workerd.d.mts +1 -2
- package/dist/{chunk-CWQeghP5.mjs → rolldown-runtime-w6R9maHv.mjs} +3 -5
- package/dist/{types-J2KCXP8R.d.mts → types-D4Id3wXA.d.mts} +2 -3
- package/dist/{types-DRG5qLxI.d.cts → types-qTbYYBJw.d.mts} +2 -3
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +3 -0
- package/dist/utils/json-schema.d.mts +2 -0
- package/dist/utils/json-schema.mjs +3 -0
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +44 -24
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/docs/error-consistency.md +97 -0
- package/package.json +40 -88
- package/src/composio.ts +509 -0
- package/src/errors/AuthConfigErrors.ts +23 -0
- package/src/errors/ComposioError.ts +408 -0
- package/src/errors/ConnectedAccountsErrors.ts +158 -0
- package/src/errors/ConnectionRequestErrors.ts +32 -0
- package/src/errors/FileModifierErrors.ts +100 -0
- package/src/errors/PusherErrors.ts +28 -0
- package/src/errors/RemoteFileErrors.ts +62 -0
- package/src/errors/SDKErrors.ts +92 -0
- package/src/errors/ToolErrors.ts +244 -0
- package/src/errors/ToolkitErrors.ts +39 -0
- package/src/errors/TriggerErrors.ts +120 -0
- package/src/errors/ValidationErrors.ts +99 -0
- package/src/errors/index.ts +41 -0
- package/src/experimental/index.ts +28 -0
- package/src/index.ts +64 -0
- package/src/lib/toolRouterConstants.ts +1 -0
- package/src/lib/toolRouterParams.ts +306 -0
- package/src/models/AuthConfigs.ts +398 -0
- package/src/models/AuthScheme.ts +206 -0
- package/src/models/ConnectedAccounts.ts +735 -0
- package/src/models/ConnectionRequest.ts +150 -0
- package/src/models/CustomTool.ts +676 -0
- package/src/models/Experimental.ts +202 -0
- package/src/models/Files.node.ts +93 -0
- package/src/models/Files.workerd.ts +49 -0
- package/src/models/MCP.ts +478 -0
- package/src/models/RemoteFile.ts +172 -0
- package/src/models/SessionContext.ts +147 -0
- package/src/models/Sessions.ts +21 -0
- package/src/models/ToolRouter.ts +391 -0
- package/src/models/ToolRouterSession.ts +827 -0
- package/src/models/ToolRouterSessionFileMount.ts +389 -0
- package/src/models/Toolkits.ts +412 -0
- package/src/models/Tools.ts +1260 -0
- package/src/models/Triggers.ts +1381 -0
- package/src/models/customToolExecution.ts +118 -0
- package/src/models/inlineCustomToolsPayload.ts +17 -0
- package/src/models/proxyParamsTransform.ts +26 -0
- package/src/provider/BaseProvider.ts +138 -0
- package/src/provider/ComposioProvider.ts +29 -0
- package/src/provider/OpenAIProvider.ts +547 -0
- package/src/services/internal/InternalService.ts +50 -0
- package/src/services/internal/InternalService.types.ts +14 -0
- package/src/services/pusher/Pusher.ts +230 -0
- package/src/services/telemetry/TelemetryService.ts +48 -0
- package/src/services/telemetry/TelemetryService.types.ts +67 -0
- package/src/telemetry/BatchProcessor.ts +77 -0
- package/src/telemetry/README.md +123 -0
- package/src/telemetry/Telemetry.ts +356 -0
- package/src/types/ToolRouterSessionFilesMount.types.ts +96 -0
- package/src/types/authConfigs.types.ts +174 -0
- package/src/types/composio.types.ts +1 -0
- package/src/types/connectedAccountAuthStates.types.ts +852 -0
- package/src/types/connectedAccounts.types.ts +395 -0
- package/src/types/connectionRequest.types.ts +16 -0
- package/src/types/customTool.types.ts +261 -0
- package/{dist/files.types-lo4zZd87.d.cts → src/types/files.types.ts} +3 -5
- package/src/types/mcp.experimental.types.ts +163 -0
- package/src/types/mcp.types.ts +362 -0
- package/src/types/modifiers.types.ts +663 -0
- package/src/types/org.types.ts +0 -0
- package/src/types/provider.types.ts +41 -0
- package/src/types/pusher.types.ts +18 -0
- package/src/types/requestOptions.types.ts +62 -0
- package/src/types/telemetry.types.ts +89 -0
- package/src/types/tool.types.ts +408 -0
- package/src/types/toolRouter.types.ts +761 -0
- package/src/types/toolkit.types.ts +130 -0
- package/src/types/triggers.types.ts +401 -0
- package/src/types/webhookEvents.types.ts +219 -0
- package/src/utils/buffer.ts +30 -0
- package/src/utils/cancellation.ts +22 -0
- package/src/utils/config-defaults/ConfigDefaults.node.ts +7 -0
- package/src/utils/config-defaults/ConfigDefaults.workerd.ts +10 -0
- package/src/utils/config-defaults/index.ts +1 -0
- package/src/utils/config-defaults/types.ts +14 -0
- package/src/utils/constants.ts +22 -0
- package/src/utils/crypto.ts +34 -0
- package/src/utils/env.ts +34 -0
- package/src/utils/fileDirs.ts +81 -0
- package/src/utils/fileUtils.node.ts +458 -0
- package/src/utils/json-schema.ts +1 -0
- package/src/utils/jsonSchema.ts +355 -0
- package/src/utils/logger.ts +99 -0
- package/src/utils/mime.ts +75 -0
- package/src/utils/modifiers/FileToolModifier.node.ts +477 -0
- package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +132 -0
- package/src/utils/modifiers/FileToolModifier.workerd.ts +51 -0
- package/src/utils/pagination.ts +73 -0
- package/src/utils/pusher.ts +286 -0
- package/src/utils/schemaPropertyKeys.ts +433 -0
- package/src/utils/sdk.ts +110 -0
- package/src/utils/sensitiveFileUploadPaths.node.ts +105 -0
- package/src/utils/session.ts +114 -0
- package/src/utils/toolArguments.ts +73 -0
- package/src/utils/toolkitVersion.ts +26 -0
- package/src/utils/transform.ts +42 -0
- package/src/utils/transformers/authConfigs.ts +107 -0
- package/src/utils/transformers/connectedAccounts.ts +119 -0
- package/src/utils/transformers/mcp.ts +164 -0
- package/src/utils/transformers/toolRouterResponseTransform.ts +160 -0
- package/src/utils/transformers/toolkits.ts +100 -0
- package/src/utils/transformers/triggers.ts +118 -0
- package/src/utils/uploadDirAllowlist.node.ts +178 -0
- package/src/utils/uuid.ts +7 -0
- package/src/utils/version.ts +58 -0
- package/src/utils/zodSchema.ts +90 -0
- package/dist/BaseProvider-BvHvJLXc.d.mts +0 -29378
- package/dist/CustomTool-D3-NreIm.cjs +0 -1341
- package/dist/FileModifierErrors-BYJBHiay.cjs +0 -554
- package/dist/FileToolModifier.utils.neutral-DSBQs9-i.cjs +0 -96
- package/dist/Telemetry-BQ_pl5AK.cjs +0 -360
- package/dist/buffer-BjWptbNH.cjs +0 -63
- package/dist/chunk-CQwRTUmo.cjs +0 -53
- package/dist/experimental/index.cjs +0 -5
- package/dist/experimental/index.d.cts +0 -3
- package/dist/fileUtils.node-DtnSRMWa.cjs +0 -462
- package/dist/index.cjs +0 -8523
- package/dist/index.d.cts +0 -6065
- package/dist/models/Files.node.cjs +0 -55
- package/dist/models/Files.node.d.cts +0 -56
- package/dist/models/Files.workerd.cjs +0 -29
- package/dist/models/Files.workerd.d.cts +0 -13
- package/dist/platform/node.cjs +0 -55
- package/dist/platform/node.d.cts +0 -11
- package/dist/platform/workerd.cjs +0 -42
- package/dist/platform/workerd.d.cts +0 -12
- package/dist/types-pDNm1lYs.d.cts +0 -69
- package/dist/utils/config-defaults/ConfigDefaults.node.cjs +0 -10
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +0 -7
- package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +0 -10
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +0 -7
- package/dist/utils/modifiers/FileToolModifier.node.cjs +0 -224
- package/dist/utils/modifiers/FileToolModifier.node.d.cts +0 -22
- package/dist/utils/modifiers/FileToolModifier.workerd.cjs +0 -27
- package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +0 -20
- /package/dist/{FileToolModifier.utils.neutral-BpSceNK8.mjs → FileToolModifier.utils.neutral-B5rT711M.mjs} +0 -0
- /package/dist/{buffer-yOtEsT4J.mjs → buffer-PcbMMsgm.mjs} +0 -0
- /package/dist/{files.types-BXDWA_zS.d.mts → files.types-DeMC_mAW.d.mts} +0 -0
- /package/dist/{types-HpJQ8K9l.d.mts → types-DdoCRzLj.d.mts} +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Session"
|
|
3
|
+
description: "A Composio session — the object returned by `composio.sessions.create(...)` and `composio.sessions.use(...)` (also reachable via the top-level `composio.create(...)` / `composio.use(...)` aliases). This is the canonical session surface. Use it to fetch session-scoped tools, authorize toolkits, search, and execute tools. The public return type is `Session` (with `mcp` surfaced, returned when `{ mcp: true }` is passed) or `SessionWithoutMcp` (the default, with `mcp` omitted from the type); this class is the concrete runtime form behind both."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
| Name | Type | Description |
|
|
9
|
+
|------|------|-------------|
|
|
10
|
+
| `configVersion` | `number` | |
|
|
11
|
+
| `experimental` | `SessionExperimental` | |
|
|
12
|
+
| `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 |
|
|
13
|
+
| `preload` | `Preload` | |
|
|
14
|
+
| `sandbox` | `Workbench` | Resolved sandbox (code-execution) config returned by the API. `enable` defaults to `true` server-side. |
|
|
15
|
+
| `sessionId` | `string` | |
|
|
16
|
+
| `warnings` | `Warning[]` | |
|
|
17
|
+
|
|
18
|
+
## Methods
|
|
19
|
+
|
|
20
|
+
### authorize()
|
|
21
|
+
|
|
22
|
+
Initiate an authorization flow for a toolkit.
|
|
23
|
+
Returns a ConnectionRequest with a redirect URL for the user.
|
|
24
|
+
|
|
25
|
+
Pass `experimental: { accountType: 'SHARED', aclConfigForShared }` to
|
|
26
|
+
create a SHARED connection with a per-user ACL in one flow. Default
|
|
27
|
+
behaviour (omit the block) creates a PRIVATE connection.
|
|
28
|
+
|
|
29
|
+
Experimental — shape may change in future releases.
|
|
30
|
+
|
|
31
|
+
`aclConfigForShared` is validated against the same caps as
|
|
32
|
+
`composio.connectedAccounts.link()` (≤1000 entries per list, each
|
|
33
|
+
`userId` 1..256 characters). Invalid input throws `ValidationError`
|
|
34
|
+
at the SDK boundary.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
async authorize(toolkit: string, options?: { callbackUrl?: string; alias?: string; experimental?: { accountType?: ConnectedAccountType; aclConfigForShared?: ConnectedAccountAclConfig; }; }, requestOptions?: ComposioRequestOptions): Promise<ConnectionRequest>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Parameters**
|
|
41
|
+
|
|
42
|
+
| Name | Type |
|
|
43
|
+
|------|------|
|
|
44
|
+
| `toolkit` | `string` |
|
|
45
|
+
| `options?` | `\{ callbackUrl?: string; alias?: string; experimental?: \{ accountType?: ConnectedAccountType; aclConfigForShared?: ConnectedAccountAclConfig; \}; \}` |
|
|
46
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
47
|
+
|
|
48
|
+
**Returns**
|
|
49
|
+
|
|
50
|
+
`Promise<ConnectionRequest>`
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### customToolkits()
|
|
55
|
+
|
|
56
|
+
List all custom toolkits registered in this session.
|
|
57
|
+
Returns toolkits with their tools showing final slugs.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
customToolkits(): RegisteredCustomToolkit[]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Returns**
|
|
64
|
+
|
|
65
|
+
`RegisteredCustomToolkit[]` — Array of registered custom toolkits
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### customTools()
|
|
70
|
+
|
|
71
|
+
List all custom tools registered in this session.
|
|
72
|
+
Returns tools with their final slugs, schemas, and resolved toolkit.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
customTools(options?: { toolkit?: string }): RegisteredCustomTool[]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Parameters**
|
|
79
|
+
|
|
80
|
+
| Name | Type |
|
|
81
|
+
|------|------|
|
|
82
|
+
| `options?` | `\{ toolkit?: string \}` |
|
|
83
|
+
|
|
84
|
+
**Returns**
|
|
85
|
+
|
|
86
|
+
`RegisteredCustomTool[]` — Array of registered custom tools
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### execute()
|
|
91
|
+
|
|
92
|
+
Execute a tool within the session.
|
|
93
|
+
|
|
94
|
+
For custom tools, accepts the original slug (e.g. "GREP") or the
|
|
95
|
+
full slug (e.g. "LOCAL_GREP"). Custom tools are executed in-process;
|
|
96
|
+
remote tools are sent to the Composio backend.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
async execute(toolSlug: string, arguments_?: Record<string, unknown>, options?: ToolRouterSessionExecuteOptions, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionExecuteResponse>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Parameters**
|
|
103
|
+
|
|
104
|
+
| Name | Type | Description |
|
|
105
|
+
|------|------|-------------|
|
|
106
|
+
| `toolSlug` | `string` | The tool slug to execute |
|
|
107
|
+
| `arguments_?` | `Record<string, unknown>` | Optional tool arguments |
|
|
108
|
+
| `options?` | `ToolRouterSessionExecuteOptions` | Optional execution options |
|
|
109
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
110
|
+
|
|
111
|
+
**Returns**
|
|
112
|
+
|
|
113
|
+
`Promise<ToolRouterSessionExecuteResponse>` — The tool execution result
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### proxyExecute()
|
|
118
|
+
|
|
119
|
+
Proxy an API call through Composio's auth layer using the session's connected account.
|
|
120
|
+
The backend resolves the connected account from the toolkit within the session.
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
async proxyExecute(params: SessionProxyExecuteParams, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionProxyExecuteResponse>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Parameters**
|
|
127
|
+
|
|
128
|
+
| Name | Type | Description |
|
|
129
|
+
|------|------|-------------|
|
|
130
|
+
| `params` | `SessionProxyExecuteParams` | Proxy request parameters (toolkit, endpoint, method, body, headers/query params) |
|
|
131
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
132
|
+
|
|
133
|
+
**Returns**
|
|
134
|
+
|
|
135
|
+
`Promise<ToolRouterSessionProxyExecuteResponse>` — The proxied API response with status, data, headers
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### search()
|
|
140
|
+
|
|
141
|
+
Search for tools by semantic use case.
|
|
142
|
+
Returns relevant tools for the given query with schemas and guidance.
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
async search(params: { query: string; toolkits?: string[]; }, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionSearchResponse>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Parameters**
|
|
149
|
+
|
|
150
|
+
| Name | Type |
|
|
151
|
+
|------|------|
|
|
152
|
+
| `params` | `\{ query: string; toolkits?: string[]; \}` |
|
|
153
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
154
|
+
|
|
155
|
+
**Returns**
|
|
156
|
+
|
|
157
|
+
`Promise<ToolRouterSessionSearchResponse>`
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### toolkits()
|
|
162
|
+
|
|
163
|
+
Query the connection state of toolkits in the session.
|
|
164
|
+
Supports pagination and filtering by toolkit slugs.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
async toolkits(options?: ToolRouterToolkitsOptions, requestOptions?: ComposioRequestOptions): Promise<{ cursor: string | undefined; items: { connection?: { authConfig?: ... | ...; connectedAccount?: { id: ...; status: ... }; isActive: boolean }; isNoAuth: boolean; logo?: string; name: string; slug: string }[]; totalPages: number }>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Parameters**
|
|
171
|
+
|
|
172
|
+
| Name | Type |
|
|
173
|
+
|------|------|
|
|
174
|
+
| `options?` | `ToolRouterToolkitsOptions` |
|
|
175
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
176
|
+
|
|
177
|
+
**Returns**
|
|
178
|
+
|
|
179
|
+
`Promise<\{ cursor: string \| undefined; items: \{ connection?: \{ authConfig?: ... \| ...; connectedAccount?: \{ id: ...; status: ... \}; isActive: boolean \}; isNoAuth: boolean; logo?: string; name: string; slug: string \}[]; totalPages: number \}>`
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### tools()
|
|
184
|
+
|
|
185
|
+
Get the tools available in the session, formatted for your AI framework.
|
|
186
|
+
Requires a provider to be configured in the Composio constructor.
|
|
187
|
+
|
|
188
|
+
When custom tools are bound to the session, execution of COMPOSIO_MULTI_EXECUTE_TOOL
|
|
189
|
+
is intercepted: local tools are executed in-process, remote tools are sent to the backend.
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
async tools(modifiers?: SessionMetaToolOptions, requestOptions?: ComposioRequestOptions): Promise<ReturnType<TProvider['wrapTools']>>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Parameters**
|
|
196
|
+
|
|
197
|
+
| Name | Type |
|
|
198
|
+
|------|------|
|
|
199
|
+
| `modifiers?` | `SessionMetaToolOptions` |
|
|
200
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
201
|
+
|
|
202
|
+
**Returns**
|
|
203
|
+
|
|
204
|
+
`Promise<ReturnType<TProvider['wrapTools']>>`
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### update()
|
|
209
|
+
|
|
210
|
+
Partially update the session configuration.
|
|
211
|
+
Only the fields provided will be changed; omitted fields are preserved.
|
|
212
|
+
Mutates this session's `configVersion`, `preload`, and `warnings` in-place.
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<void>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Parameters**
|
|
219
|
+
|
|
220
|
+
| Name | Type |
|
|
221
|
+
|------|------|
|
|
222
|
+
| `config` | `ToolRouterUpdateSessionConfig` |
|
|
223
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
224
|
+
|
|
225
|
+
**Returns**
|
|
226
|
+
|
|
227
|
+
`Promise<void>`
|
|
228
|
+
|
|
229
|
+
---
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Sessions"
|
|
3
|
+
description: "First-class API for creating and reusing Composio sessions. `composio.sessions.create(...)` is the canonical session creation entrypoint. The top-level `composio.create(...)` method remains as a backwards-compatible alias for `composio.sessions.create(...)`."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Access this class through the `composio.sessions` property:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
+
const result = await composio.sessions.list();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### create()
|
|
18
|
+
|
|
19
|
+
Creates a new tool router session for a user.
|
|
20
|
+
Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools
|
|
21
|
+
should be exposed directly; see `ToolRouterCreateSessionConfig`.
|
|
22
|
+
|
|
23
|
+
**Overload 1**
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
async create(userId: string, config: ToolRouterCreateSessionConfig & { mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Parameters**
|
|
30
|
+
|
|
31
|
+
| Name | Type | Description |
|
|
32
|
+
|------|------|-------------|
|
|
33
|
+
| `userId` | `string` | \{string\} The user id to create the session for |
|
|
34
|
+
| `config` | `ToolRouterCreateSessionConfig & \{ mcp: true \}` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
|
|
35
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
36
|
+
|
|
37
|
+
**Returns**
|
|
38
|
+
|
|
39
|
+
`Promise<Session<TToolCollection, TTool, TProvider>>` — The tool router session
|
|
40
|
+
|
|
41
|
+
**Overload 2**
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
async create(userId: string, config?: ToolRouterCreateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Parameters**
|
|
48
|
+
|
|
49
|
+
| Name | Type | Description |
|
|
50
|
+
|------|------|-------------|
|
|
51
|
+
| `userId` | `string` | \{string\} The user id to create the session for |
|
|
52
|
+
| `config?` | `ToolRouterCreateSessionConfig` | \{ToolRouterCreateSessionConfig\} The config for the tool router session |
|
|
53
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
54
|
+
|
|
55
|
+
**Returns**
|
|
56
|
+
|
|
57
|
+
`Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>` — The tool router session
|
|
58
|
+
|
|
59
|
+
**Example**
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { Composio } from '@composio/core';
|
|
63
|
+
|
|
64
|
+
const composio = new Composio();
|
|
65
|
+
|
|
66
|
+
const session = await composio.sessions.create('user_123', {
|
|
67
|
+
toolkits: ['gmail'],
|
|
68
|
+
manageConnections: true,
|
|
69
|
+
experimental: {
|
|
70
|
+
customTools: [myCustomTool],
|
|
71
|
+
customToolkits: [myToolkit],
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### use()
|
|
79
|
+
|
|
80
|
+
Use an existing session
|
|
81
|
+
|
|
82
|
+
**Overload 1**
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
async use(id: string, options: { customTools?: CustomTool[]; customToolkits?: CustomToolkit[]; mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Parameters**
|
|
89
|
+
|
|
90
|
+
| Name | Type | Description |
|
|
91
|
+
|------|------|-------------|
|
|
92
|
+
| `id` | `string` | \{string\} The id of the session to use |
|
|
93
|
+
| `options` | `\{ customTools?: CustomTool[]; customToolkits?: CustomToolkit[]; mcp: true \}` | |
|
|
94
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
95
|
+
|
|
96
|
+
**Returns**
|
|
97
|
+
|
|
98
|
+
`Promise<Session<TToolCollection, TTool, TProvider>>` — The tool router session
|
|
99
|
+
|
|
100
|
+
**Overload 2**
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
async use(id: string, options?: { customTools?: CustomTool[]; customToolkits?: CustomToolkit[]; mcp?: boolean }, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Parameters**
|
|
107
|
+
|
|
108
|
+
| Name | Type | Description |
|
|
109
|
+
|------|------|-------------|
|
|
110
|
+
| `id` | `string` | \{string\} The id of the session to use |
|
|
111
|
+
| `options?` | `\{ customTools?: CustomTool[]; customToolkits?: CustomToolkit[]; mcp?: boolean \}` | |
|
|
112
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
113
|
+
|
|
114
|
+
**Returns**
|
|
115
|
+
|
|
116
|
+
`Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>` — The tool router session
|
|
117
|
+
|
|
118
|
+
**Example**
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { Composio } from '@composio/core';
|
|
122
|
+
|
|
123
|
+
const composio = new Composio();
|
|
124
|
+
const id = 'session_123';
|
|
125
|
+
const session = await composio.sessions.use(id);
|
|
126
|
+
|
|
127
|
+
console.log(session.mcp.url);
|
|
128
|
+
console.log(session.mcp.headers);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Toolkits"
|
|
3
|
+
description: "Toolkits class Toolkits are a collection of tools that can be used to perform various tasks. This is similar/replacement of `apps` in the Composio API."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Access this class through the `composio.toolkits` property:
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
+
const result = await composio.toolkits.list();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### authorize()
|
|
18
|
+
|
|
19
|
+
Authorizes a user to use a toolkit.
|
|
20
|
+
This method will create an auth config if one doesn't exist and initiate a connection request.
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
async authorize(userId: string, toolkitSlug: string, authConfigId?: string, requestOptions?: ComposioRequestOptions): Promise<ConnectionRequest>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Parameters**
|
|
27
|
+
|
|
28
|
+
| Name | Type | Description |
|
|
29
|
+
|------|------|-------------|
|
|
30
|
+
| `userId` | `string` | The user id of the user to authorize |
|
|
31
|
+
| `toolkitSlug` | `string` | The slug of the toolkit to authorize |
|
|
32
|
+
| `authConfigId?` | `string` | |
|
|
33
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
34
|
+
|
|
35
|
+
**Returns**
|
|
36
|
+
|
|
37
|
+
`Promise<ConnectionRequest>` — The connection request object
|
|
38
|
+
|
|
39
|
+
**Example**
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### get()
|
|
48
|
+
|
|
49
|
+
Retrieves a specific toolkit by its slug identifier.
|
|
50
|
+
|
|
51
|
+
**Overload 1**
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
async get(slug: string, requestOptions?: ComposioRequestOptions): Promise<ToolkitRetrieveResponse>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Parameters**
|
|
58
|
+
|
|
59
|
+
| Name | Type | Description |
|
|
60
|
+
|------|------|-------------|
|
|
61
|
+
| `slug` | `string` | The unique slug identifier of the toolkit to retrieve |
|
|
62
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
63
|
+
|
|
64
|
+
**Returns**
|
|
65
|
+
|
|
66
|
+
`Promise<ToolkitRetrieveResponse>` — The toolkit object with detailed information
|
|
67
|
+
|
|
68
|
+
**Overload 2**
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
async get(query?: ToolkitListParams, requestOptions?: ComposioRequestOptions): Promise<ToolKitListResponse>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Parameters**
|
|
75
|
+
|
|
76
|
+
| Name | Type | Description |
|
|
77
|
+
|------|------|-------------|
|
|
78
|
+
| `query?` | `ToolkitListParams` | The query parameters to filter toolkits |
|
|
79
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
80
|
+
|
|
81
|
+
**Returns**
|
|
82
|
+
|
|
83
|
+
`Promise<ToolKitListResponse>` — A paginated list of toolkits matching the query criteria
|
|
84
|
+
|
|
85
|
+
**Example**
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// Get a specific toolkit
|
|
89
|
+
const githubToolkit = await composio.toolkits.get('github');
|
|
90
|
+
console.log(githubToolkit.name); // GitHub
|
|
91
|
+
console.log(githubToolkit.authConfigDetails); // Authentication configuration details
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### getAuthConfigCreationFields()
|
|
97
|
+
|
|
98
|
+
Retrieves the fields required for creating an auth config for a toolkit.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Parameters**
|
|
105
|
+
|
|
106
|
+
| Name | Type | Description |
|
|
107
|
+
|------|------|-------------|
|
|
108
|
+
| `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
|
|
109
|
+
| `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
|
|
110
|
+
| `options` | `\{ requiredOnly?: boolean \}` | |
|
|
111
|
+
|
|
112
|
+
**Returns**
|
|
113
|
+
|
|
114
|
+
`Promise<ToolkitAuthFieldsResponse>` — The fields required for creating an auth config
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### getConnectedAccountInitiationFields()
|
|
119
|
+
|
|
120
|
+
Retrieves the fields required for initiating a connected account for a toolkit.
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Parameters**
|
|
127
|
+
|
|
128
|
+
| Name | Type | Description |
|
|
129
|
+
|------|------|-------------|
|
|
130
|
+
| `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
|
|
131
|
+
| `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
|
|
132
|
+
| `options` | `\{ requiredOnly?: boolean \}` | |
|
|
133
|
+
|
|
134
|
+
**Returns**
|
|
135
|
+
|
|
136
|
+
`Promise<ToolkitAuthFieldsResponse>` — The fields required for initiating a connected account
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### listCategories()
|
|
141
|
+
|
|
142
|
+
Retrieves all toolkit categories available in the Composio SDK.
|
|
143
|
+
|
|
144
|
+
This method fetches the complete list of categories from the Composio API
|
|
145
|
+
and transforms the response to use camelCase property naming.
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
async listCategories(requestOptions?: ComposioRequestOptions): Promise<ToolkitRetrieveCategoriesResponse>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Parameters**
|
|
152
|
+
|
|
153
|
+
| Name | Type |
|
|
154
|
+
|------|------|
|
|
155
|
+
| `requestOptions?` | `ComposioRequestOptions` |
|
|
156
|
+
|
|
157
|
+
**Returns**
|
|
158
|
+
|
|
159
|
+
`Promise<ToolkitRetrieveCategoriesResponse>` — The list of toolkit categories
|
|
160
|
+
|
|
161
|
+
**Example**
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
// Get all toolkit categories
|
|
165
|
+
const categories = await composio.toolkits.listCategories();
|
|
166
|
+
console.log(categories.items); // Array of category objects
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|