@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.
Files changed (193) hide show
  1. package/dist/BaseProvider-BBnsv9kS.d.mts +29425 -0
  2. package/dist/{BaseProvider-CVbQxTNa.d.cts → BaseProvider-Brb3o86-.d.mts} +91 -44
  3. package/dist/CustomTool-D9qwyMrv.mjs +468 -0
  4. package/dist/{CustomTool-C-IUByoU.d.cts → CustomTool-Dmi6ti3I.d.mts} +2 -4
  5. package/dist/{CustomTool-CChQSp44.d.mts → CustomTool-DrJpOhY2.d.mts} +2 -4
  6. package/dist/{FileModifierErrors-C7z16Dfi.mjs → FileModifierErrors-3fSwIWoa.mjs} +35 -36
  7. package/dist/{Telemetry-DQax33Gh.mjs → Telemetry-DhGI_J4G.mjs} +15 -15
  8. package/dist/{composio-pcA13w87.d.cts → composio-DHIKRdeG.d.mts} +641 -380
  9. package/dist/{composio-BlASKqjQ.d.mts → composio-vMwhASRc.d.mts} +1390 -1129
  10. package/dist/{customTool.types-QtkAZQma.d.cts → customTool.types-CKH2R2ia.d.mts} +487 -189
  11. package/dist/{customTool.types-DLIORcYN.d.mts → customTool.types-DXin7Cfc.d.mts} +924 -626
  12. package/dist/docs/error-consistency.md +97 -0
  13. package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +306 -0
  14. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +205 -0
  15. package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +488 -0
  16. package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +94 -0
  17. package/dist/docs/reference/sdk-reference/typescript/index.mdx +67 -0
  18. package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +304 -0
  19. package/dist/docs/reference/sdk-reference/typescript/meta.json +17 -0
  20. package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +107 -0
  21. package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +163 -0
  22. package/dist/docs/reference/sdk-reference/typescript/session.mdx +229 -0
  23. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +131 -0
  24. package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +169 -0
  25. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +453 -0
  26. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +434 -0
  27. package/dist/{CustomTool-D5s-aADw.mjs → errors-DSIlYfl5.mjs} +72 -459
  28. package/dist/experimental/index.d.mts +2 -3
  29. package/dist/experimental/index.mjs +1 -3
  30. package/dist/{fileUtils.node-Dq7ebZPC.mjs → fileUtils.node-BiO1JQsJ.mjs} +26 -25
  31. package/dist/index.d.mts +1708 -2400
  32. package/dist/index.mjs +2632 -2006
  33. package/dist/jsonSchema-CFKdONpP.mjs +251 -0
  34. package/dist/models/Files.node.d.mts +1 -2
  35. package/dist/models/Files.node.mjs +3 -4
  36. package/dist/models/Files.workerd.d.mts +0 -1
  37. package/dist/platform/node.d.mts +1 -2
  38. package/dist/platform/workerd.d.mts +1 -2
  39. package/dist/{chunk-CWQeghP5.mjs → rolldown-runtime-w6R9maHv.mjs} +3 -5
  40. package/dist/{types-J2KCXP8R.d.mts → types-D4Id3wXA.d.mts} +2 -3
  41. package/dist/{types-DRG5qLxI.d.cts → types-qTbYYBJw.d.mts} +2 -3
  42. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -4
  43. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -4
  44. package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +3 -0
  45. package/dist/utils/json-schema.d.mts +2 -0
  46. package/dist/utils/json-schema.mjs +3 -0
  47. package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -1
  48. package/dist/utils/modifiers/FileToolModifier.node.mjs +44 -24
  49. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -1
  50. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
  51. package/docs/error-consistency.md +97 -0
  52. package/package.json +40 -88
  53. package/src/composio.ts +509 -0
  54. package/src/errors/AuthConfigErrors.ts +23 -0
  55. package/src/errors/ComposioError.ts +408 -0
  56. package/src/errors/ConnectedAccountsErrors.ts +158 -0
  57. package/src/errors/ConnectionRequestErrors.ts +32 -0
  58. package/src/errors/FileModifierErrors.ts +100 -0
  59. package/src/errors/PusherErrors.ts +28 -0
  60. package/src/errors/RemoteFileErrors.ts +62 -0
  61. package/src/errors/SDKErrors.ts +92 -0
  62. package/src/errors/ToolErrors.ts +244 -0
  63. package/src/errors/ToolkitErrors.ts +39 -0
  64. package/src/errors/TriggerErrors.ts +120 -0
  65. package/src/errors/ValidationErrors.ts +99 -0
  66. package/src/errors/index.ts +41 -0
  67. package/src/experimental/index.ts +28 -0
  68. package/src/index.ts +64 -0
  69. package/src/lib/toolRouterConstants.ts +1 -0
  70. package/src/lib/toolRouterParams.ts +306 -0
  71. package/src/models/AuthConfigs.ts +398 -0
  72. package/src/models/AuthScheme.ts +206 -0
  73. package/src/models/ConnectedAccounts.ts +735 -0
  74. package/src/models/ConnectionRequest.ts +150 -0
  75. package/src/models/CustomTool.ts +676 -0
  76. package/src/models/Experimental.ts +202 -0
  77. package/src/models/Files.node.ts +93 -0
  78. package/src/models/Files.workerd.ts +49 -0
  79. package/src/models/MCP.ts +478 -0
  80. package/src/models/RemoteFile.ts +172 -0
  81. package/src/models/SessionContext.ts +147 -0
  82. package/src/models/Sessions.ts +21 -0
  83. package/src/models/ToolRouter.ts +391 -0
  84. package/src/models/ToolRouterSession.ts +827 -0
  85. package/src/models/ToolRouterSessionFileMount.ts +389 -0
  86. package/src/models/Toolkits.ts +412 -0
  87. package/src/models/Tools.ts +1260 -0
  88. package/src/models/Triggers.ts +1381 -0
  89. package/src/models/customToolExecution.ts +118 -0
  90. package/src/models/inlineCustomToolsPayload.ts +17 -0
  91. package/src/models/proxyParamsTransform.ts +26 -0
  92. package/src/provider/BaseProvider.ts +138 -0
  93. package/src/provider/ComposioProvider.ts +29 -0
  94. package/src/provider/OpenAIProvider.ts +547 -0
  95. package/src/services/internal/InternalService.ts +50 -0
  96. package/src/services/internal/InternalService.types.ts +14 -0
  97. package/src/services/pusher/Pusher.ts +230 -0
  98. package/src/services/telemetry/TelemetryService.ts +48 -0
  99. package/src/services/telemetry/TelemetryService.types.ts +67 -0
  100. package/src/telemetry/BatchProcessor.ts +77 -0
  101. package/src/telemetry/README.md +123 -0
  102. package/src/telemetry/Telemetry.ts +356 -0
  103. package/src/types/ToolRouterSessionFilesMount.types.ts +96 -0
  104. package/src/types/authConfigs.types.ts +174 -0
  105. package/src/types/composio.types.ts +1 -0
  106. package/src/types/connectedAccountAuthStates.types.ts +852 -0
  107. package/src/types/connectedAccounts.types.ts +395 -0
  108. package/src/types/connectionRequest.types.ts +16 -0
  109. package/src/types/customTool.types.ts +261 -0
  110. package/{dist/files.types-lo4zZd87.d.cts → src/types/files.types.ts} +3 -5
  111. package/src/types/mcp.experimental.types.ts +163 -0
  112. package/src/types/mcp.types.ts +362 -0
  113. package/src/types/modifiers.types.ts +663 -0
  114. package/src/types/org.types.ts +0 -0
  115. package/src/types/provider.types.ts +41 -0
  116. package/src/types/pusher.types.ts +18 -0
  117. package/src/types/requestOptions.types.ts +62 -0
  118. package/src/types/telemetry.types.ts +89 -0
  119. package/src/types/tool.types.ts +408 -0
  120. package/src/types/toolRouter.types.ts +761 -0
  121. package/src/types/toolkit.types.ts +130 -0
  122. package/src/types/triggers.types.ts +401 -0
  123. package/src/types/webhookEvents.types.ts +219 -0
  124. package/src/utils/buffer.ts +30 -0
  125. package/src/utils/cancellation.ts +22 -0
  126. package/src/utils/config-defaults/ConfigDefaults.node.ts +7 -0
  127. package/src/utils/config-defaults/ConfigDefaults.workerd.ts +10 -0
  128. package/src/utils/config-defaults/index.ts +1 -0
  129. package/src/utils/config-defaults/types.ts +14 -0
  130. package/src/utils/constants.ts +22 -0
  131. package/src/utils/crypto.ts +34 -0
  132. package/src/utils/env.ts +34 -0
  133. package/src/utils/fileDirs.ts +81 -0
  134. package/src/utils/fileUtils.node.ts +458 -0
  135. package/src/utils/json-schema.ts +1 -0
  136. package/src/utils/jsonSchema.ts +355 -0
  137. package/src/utils/logger.ts +99 -0
  138. package/src/utils/mime.ts +75 -0
  139. package/src/utils/modifiers/FileToolModifier.node.ts +477 -0
  140. package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +132 -0
  141. package/src/utils/modifiers/FileToolModifier.workerd.ts +51 -0
  142. package/src/utils/pagination.ts +73 -0
  143. package/src/utils/pusher.ts +286 -0
  144. package/src/utils/schemaPropertyKeys.ts +433 -0
  145. package/src/utils/sdk.ts +110 -0
  146. package/src/utils/sensitiveFileUploadPaths.node.ts +105 -0
  147. package/src/utils/session.ts +114 -0
  148. package/src/utils/toolArguments.ts +73 -0
  149. package/src/utils/toolkitVersion.ts +26 -0
  150. package/src/utils/transform.ts +42 -0
  151. package/src/utils/transformers/authConfigs.ts +107 -0
  152. package/src/utils/transformers/connectedAccounts.ts +119 -0
  153. package/src/utils/transformers/mcp.ts +164 -0
  154. package/src/utils/transformers/toolRouterResponseTransform.ts +160 -0
  155. package/src/utils/transformers/toolkits.ts +100 -0
  156. package/src/utils/transformers/triggers.ts +118 -0
  157. package/src/utils/uploadDirAllowlist.node.ts +178 -0
  158. package/src/utils/uuid.ts +7 -0
  159. package/src/utils/version.ts +58 -0
  160. package/src/utils/zodSchema.ts +90 -0
  161. package/dist/BaseProvider-BvHvJLXc.d.mts +0 -29378
  162. package/dist/CustomTool-D3-NreIm.cjs +0 -1341
  163. package/dist/FileModifierErrors-BYJBHiay.cjs +0 -554
  164. package/dist/FileToolModifier.utils.neutral-DSBQs9-i.cjs +0 -96
  165. package/dist/Telemetry-BQ_pl5AK.cjs +0 -360
  166. package/dist/buffer-BjWptbNH.cjs +0 -63
  167. package/dist/chunk-CQwRTUmo.cjs +0 -53
  168. package/dist/experimental/index.cjs +0 -5
  169. package/dist/experimental/index.d.cts +0 -3
  170. package/dist/fileUtils.node-DtnSRMWa.cjs +0 -462
  171. package/dist/index.cjs +0 -8523
  172. package/dist/index.d.cts +0 -6065
  173. package/dist/models/Files.node.cjs +0 -55
  174. package/dist/models/Files.node.d.cts +0 -56
  175. package/dist/models/Files.workerd.cjs +0 -29
  176. package/dist/models/Files.workerd.d.cts +0 -13
  177. package/dist/platform/node.cjs +0 -55
  178. package/dist/platform/node.d.cts +0 -11
  179. package/dist/platform/workerd.cjs +0 -42
  180. package/dist/platform/workerd.d.cts +0 -12
  181. package/dist/types-pDNm1lYs.d.cts +0 -69
  182. package/dist/utils/config-defaults/ConfigDefaults.node.cjs +0 -10
  183. package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +0 -7
  184. package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +0 -10
  185. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +0 -7
  186. package/dist/utils/modifiers/FileToolModifier.node.cjs +0 -224
  187. package/dist/utils/modifiers/FileToolModifier.node.d.cts +0 -22
  188. package/dist/utils/modifiers/FileToolModifier.workerd.cjs +0 -27
  189. package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +0 -20
  190. /package/dist/{FileToolModifier.utils.neutral-BpSceNK8.mjs → FileToolModifier.utils.neutral-B5rT711M.mjs} +0 -0
  191. /package/dist/{buffer-yOtEsT4J.mjs → buffer-PcbMMsgm.mjs} +0 -0
  192. /package/dist/{files.types-BXDWA_zS.d.mts → files.types-DeMC_mAW.d.mts} +0 -0
  193. /package/dist/{types-HpJQ8K9l.d.mts → types-DdoCRzLj.d.mts} +0 -0
@@ -0,0 +1,97 @@
1
+ # Error Class Consistency in Composio SDK
2
+
3
+ This document outlines the standardized pattern for error classes in the Composio SDK.
4
+
5
+ ## Standardized Error Class Pattern
6
+
7
+ All error classes in the Composio SDK follow this standard pattern:
8
+
9
+ ```typescript
10
+ export class SomeSpecificError extends ComposioError {
11
+ constructor(
12
+ message: string = 'Default error message',
13
+ options: Omit<ComposioErrorOptions, 'code'> = {}
14
+ ) {
15
+ super(message, {
16
+ ...options,
17
+ code: ERROR_CODE_CONSTANT,
18
+ possibleFixes: options.possibleFixes || [
19
+ 'Default fix suggestion 1',
20
+ 'Default fix suggestion 2',
21
+ ],
22
+ });
23
+ this.name = 'SomeSpecificError';
24
+ }
25
+ }
26
+ ```
27
+
28
+ ## Key Standardization Points
29
+
30
+ 1. **Message Parameter**: All constructors accept a message string with a default value.
31
+ 2. **Options Object**: All constructors take an options object (rather than individual properties).
32
+ 3. **Default Values**: Default values are provided for both the message and options parameters.
33
+ 4. **Preserving Options**: All options are preserved with `...options` and only specific properties are overridden.
34
+ 5. **Default Fixes**: Default `possibleFixes` are provided but can be overridden.
35
+ 6. **Name Property**: Each error class sets its `name` property to match the class name.
36
+
37
+ ## Special Cases
38
+
39
+ Some error classes have specific requirements:
40
+
41
+ 1. **ValidationError**: Accepts a `zodError` in the options.
42
+
43
+ ```typescript
44
+ new ValidationError('Message', { cause: someZodError });
45
+ ```
46
+
47
+ 2. **ComposioToolExecutionError**: Accepts an `originalError` in the options.
48
+ ```typescript
49
+ new ComposioToolExecutionError('Message', { originalError: someError });
50
+ ```
51
+
52
+ ## Using Error Classes
53
+
54
+ ```typescript
55
+ // Basic usage
56
+ throw new ComposioNoAPIKeyError();
57
+
58
+ // With custom message
59
+ throw new ComposioToolNotFoundError('Could not find the specified tool');
60
+
61
+ // With additional options
62
+ throw new ComposioConnectedAccountNotFoundError('Account not found', {
63
+ meta: {
64
+ accountId: '12345',
65
+ userId: 'user123',
66
+ },
67
+ });
68
+
69
+ // Special cases
70
+ try {
71
+ // Some code that might throw
72
+ } catch (error) {
73
+ // Handle tool execution errors
74
+ throw new ComposioToolExecutionError('Tool failed', {
75
+ originalError: error,
76
+ meta: { toolId: 'some-tool' },
77
+ });
78
+
79
+ // Handle validation errors
80
+ throw new ValidationError('Validation failed', {
81
+ zodError: someZodError,
82
+ });
83
+ }
84
+ ```
85
+
86
+ ## Utility Methods
87
+
88
+ All error classes inherit these helpful methods from `ComposioError`:
89
+
90
+ 1. **toString()**: Returns a formatted string representation
91
+ 2. **prettyPrint()**: Prints a formatted error message to the console
92
+ 3. **toJSON()**: Returns a JSON representation of the error
93
+
94
+ ## Static Factory Methods
95
+
96
+ 1. **ComposioError.createAndPrint()**: Creates and prints an error in one step
97
+ 2. **ComposioError.handle()**: Generic error handler for any error type
@@ -0,0 +1,306 @@
1
+ ---
2
+ title: "AuthConfigs"
3
+ description: "AuthConfigs class This class is used to manage authentication configurations in the Composio SDK. Auth configs are used to configure authentication providers and settings."
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ Access this class through the `composio.authConfigs` property:
9
+
10
+ ```typescript
11
+ const composio = new Composio({ apiKey: 'your-api-key' });
12
+ const result = await composio.authConfigs.list();
13
+ ```
14
+
15
+ ## Methods
16
+
17
+ ### create()
18
+
19
+ Create a new auth config
20
+
21
+ ```typescript
22
+ async create(toolkit: string, options: CreateAuthConfigParams, requestOptions?: ComposioRequestOptions): Promise<CreateAuthConfigResponse>
23
+ ```
24
+
25
+ **Parameters**
26
+
27
+ | Name | Type | Description |
28
+ |------|------|-------------|
29
+ | `toolkit` | `string` | Unique identifier of the toolkit |
30
+ | `options` | `CreateAuthConfigParams` | Options for creating a new auth config |
31
+ | `requestOptions?` | `ComposioRequestOptions` | |
32
+
33
+ **Returns**
34
+
35
+ `Promise<CreateAuthConfigResponse>` — Created auth config
36
+
37
+ **Example**
38
+
39
+ ```typescript
40
+ const authConfig = await authConfigs.create('my-toolkit', {
41
+ type: AuthConfigTypes.CUSTOM,
42
+ name: 'My Custom Auth Config',
43
+ authScheme: AuthSchemeTypes.API_KEY,
44
+ credentials: {
45
+ apiKey: '1234567890',
46
+ },
47
+ });
48
+ ```
49
+
50
+ ---
51
+
52
+ ### delete()
53
+
54
+ Deletes an authentication configuration.
55
+
56
+ This method permanently removes an auth config from the Composio platform.
57
+ This action cannot be undone and will prevent any connected accounts that use
58
+ this auth config from functioning.
59
+
60
+ ```typescript
61
+ async delete(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigDeleteResponse>
62
+ ```
63
+
64
+ **Parameters**
65
+
66
+ | Name | Type | Description |
67
+ |------|------|-------------|
68
+ | `nanoid` | `string` | The unique identifier of the auth config to delete |
69
+ | `requestOptions?` | `ComposioRequestOptions` | |
70
+
71
+ **Returns**
72
+
73
+ `Promise<AuthConfigDeleteResponse>` — The deletion response
74
+
75
+ **Example**
76
+
77
+ ```typescript
78
+ // Delete an auth config
79
+ await composio.authConfigs.delete('auth_abc123');
80
+ ```
81
+
82
+ ---
83
+
84
+ ### disable()
85
+
86
+ Disables an authentication configuration.
87
+
88
+ This is a convenience method that calls updateStatus with 'DISABLED'.
89
+ When disabled, the auth config cannot be used to create new connected accounts
90
+ or authenticate with third-party services, but existing connections may continue to work.
91
+
92
+ ```typescript
93
+ async disable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateStatusResponse>
94
+ ```
95
+
96
+ **Parameters**
97
+
98
+ | Name | Type | Description |
99
+ |------|------|-------------|
100
+ | `nanoid` | `string` | The unique identifier of the auth config to disable |
101
+ | `requestOptions?` | `ComposioRequestOptions` | |
102
+
103
+ **Returns**
104
+
105
+ `Promise<AuthConfigUpdateStatusResponse>` — The updated auth config details
106
+
107
+ **Example**
108
+
109
+ ```typescript
110
+ // Disable an auth config
111
+ await composio.authConfigs.disable('auth_abc123');
112
+ ```
113
+
114
+ ---
115
+
116
+ ### enable()
117
+
118
+ Enables an authentication configuration.
119
+
120
+ This is a convenience method that calls updateStatus with 'ENABLED'.
121
+ When enabled, the auth config can be used to create new connected accounts
122
+ and authenticate with third-party services.
123
+
124
+ ```typescript
125
+ async enable(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateStatusResponse>
126
+ ```
127
+
128
+ **Parameters**
129
+
130
+ | Name | Type | Description |
131
+ |------|------|-------------|
132
+ | `nanoid` | `string` | The unique identifier of the auth config to enable |
133
+ | `requestOptions?` | `ComposioRequestOptions` | |
134
+
135
+ **Returns**
136
+
137
+ `Promise<AuthConfigUpdateStatusResponse>` — The updated auth config details
138
+
139
+ **Example**
140
+
141
+ ```typescript
142
+ // Enable an auth config
143
+ await composio.authConfigs.enable('auth_abc123');
144
+ ```
145
+
146
+ ---
147
+
148
+ ### get()
149
+
150
+ Retrieves a specific authentication configuration by its ID.
151
+
152
+ This method fetches detailed information about a single auth config
153
+ and transforms the response to the SDK's standardized format.
154
+
155
+ ```typescript
156
+ async get(nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigRetrieveResponse>
157
+ ```
158
+
159
+ **Parameters**
160
+
161
+ | Name | Type | Description |
162
+ |------|------|-------------|
163
+ | `nanoid` | `string` | The unique identifier of the auth config to retrieve |
164
+ | `requestOptions?` | `ComposioRequestOptions` | |
165
+
166
+ **Returns**
167
+
168
+ `Promise<AuthConfigRetrieveResponse>` — The auth config details
169
+
170
+ **Example**
171
+
172
+ ```typescript
173
+ // Get an auth config by ID
174
+ const authConfig = await composio.authConfigs.get('auth_abc123');
175
+ console.log(authConfig.name); // e.g., 'GitHub Auth'
176
+ console.log(authConfig.toolkit.slug); // e.g., 'github'
177
+ ```
178
+
179
+ ---
180
+
181
+ ### list()
182
+
183
+ Lists authentication configurations based on provided filter criteria.
184
+
185
+ This method retrieves auth configs from the Composio API, transforms them to the SDK format,
186
+ and supports filtering by various parameters.
187
+
188
+ ```typescript
189
+ async list(query?: AuthConfigListParams, requestOptions?: ComposioRequestOptions): Promise<AuthConfigListResponse>
190
+ ```
191
+
192
+ **Parameters**
193
+
194
+ | Name | Type | Description |
195
+ |------|------|-------------|
196
+ | `query?` | `AuthConfigListParams` | Optional query parameters for filtering auth configs |
197
+ | `requestOptions?` | `ComposioRequestOptions` | |
198
+
199
+ **Returns**
200
+
201
+ `Promise<AuthConfigListResponse>` — A paginated list of auth configurations
202
+
203
+ **Example**
204
+
205
+ ```typescript
206
+ // List all auth configs
207
+ const allConfigs = await composio.authConfigs.list();
208
+
209
+ // List auth configs for a specific toolkit
210
+ const githubConfigs = await composio.authConfigs.list({
211
+ toolkit: 'github'
212
+ });
213
+
214
+ // Search auth configs by name or id
215
+ const searchedConfigs = await composio.authConfigs.list({
216
+ search: 'github',
217
+ showDisabled: true
218
+ });
219
+
220
+ // List Composio-managed auth configs
221
+ const managedConfigs = await composio.authConfigs.list({
222
+ isComposioManaged: true
223
+ });
224
+ ```
225
+
226
+ ---
227
+
228
+ ### update()
229
+
230
+ Updates an existing authentication configuration.
231
+
232
+ This method allows you to modify properties of an auth config such as credentials,
233
+ scopes, or tool restrictions. The update type (custom or default) determines which
234
+ fields can be updated.
235
+
236
+ ```typescript
237
+ async update(nanoid: string, data: AuthConfigUpdateParams, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateResponse>
238
+ ```
239
+
240
+ **Parameters**
241
+
242
+ | Name | Type | Description |
243
+ |------|------|-------------|
244
+ | `nanoid` | `string` | The unique identifier of the auth config to update |
245
+ | `data` | `AuthConfigUpdateParams` | The data to update, which can be either custom or default type |
246
+ | `requestOptions?` | `ComposioRequestOptions` | |
247
+
248
+ **Returns**
249
+
250
+ `Promise<AuthConfigUpdateResponse>` — The updated auth config
251
+
252
+ **Example**
253
+
254
+ ```typescript
255
+ // Update a custom auth config with new credentials
256
+ const updatedConfig = await composio.authConfigs.update('auth_abc123', {
257
+ type: 'custom',
258
+ credentials: {
259
+ apiKey: 'new-api-key-value'
260
+ }
261
+ });
262
+
263
+ // Update a default auth config with new scopes
264
+ const updatedConfig = await composio.authConfigs.update('auth_abc123', {
265
+ type: 'default',
266
+ scopes: ['read:user', 'repo']
267
+ });
268
+ ```
269
+
270
+ ---
271
+
272
+ ### updateStatus()
273
+
274
+ Updates the status of an authentication configuration.
275
+
276
+ This method allows you to enable or disable an auth config. When disabled,
277
+ the auth config cannot be used to create new connected accounts or authenticate
278
+ with third-party services.
279
+
280
+ ```typescript
281
+ async updateStatus(status: 'ENABLED' | 'DISABLED', nanoid: string, requestOptions?: ComposioRequestOptions): Promise<AuthConfigUpdateStatusResponse>
282
+ ```
283
+
284
+ **Parameters**
285
+
286
+ | Name | Type | Description |
287
+ |------|------|-------------|
288
+ | `status` | `'ENABLED' \| 'DISABLED'` | The status to set ('ENABLED' or 'DISABLED') |
289
+ | `nanoid` | `string` | The unique identifier of the auth config |
290
+ | `requestOptions?` | `ComposioRequestOptions` | |
291
+
292
+ **Returns**
293
+
294
+ `Promise<AuthConfigUpdateStatusResponse>` — The updated auth config details
295
+
296
+ **Example**
297
+
298
+ ```typescript
299
+ // Disable an auth config
300
+ await composio.authConfigs.updateStatus('DISABLED', 'auth_abc123');
301
+
302
+ // Enable an auth config
303
+ await composio.authConfigs.updateStatus('ENABLED', 'auth_abc123');
304
+ ```
305
+
306
+ ---
@@ -0,0 +1,205 @@
1
+ ---
2
+ title: "Composio"
3
+ description: "This is the core class for Composio. It is used to initialize the Composio SDK and provide a global configuration."
4
+ ---
5
+
6
+ ## Constructor
7
+
8
+ ### constructor()
9
+
10
+ Creates a new instance of the Composio SDK.
11
+
12
+ The constructor initializes the SDK with the provided configuration options,
13
+ sets up the API client, and initializes all core models (tools, toolkits, etc.).
14
+
15
+ ```typescript
16
+ constructor(config?: ComposioConfig): Composio
17
+ ```
18
+
19
+ **Parameters**
20
+
21
+ | Name | Type | Description |
22
+ |------|------|-------------|
23
+ | `config?` | `ComposioConfig` | Configuration options for the Composio SDK |
24
+
25
+ **Returns**
26
+
27
+ `Composio`
28
+
29
+ **Example**
30
+
31
+ ```typescript
32
+ // Initialize with default configuration
33
+ const composio = new Composio();
34
+
35
+ // Initialize with custom API key and base URL
36
+ const composio = new Composio({
37
+ apiKey: 'your-api-key',
38
+ baseURL: 'https://api.composio.dev'
39
+ });
40
+
41
+ // Initialize with custom provider
42
+ const composio = new Composio({
43
+ apiKey: 'your-api-key',
44
+ provider: new CustomProvider()
45
+ });
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Properties
51
+
52
+ | Name | Type | Description |
53
+ |------|------|-------------|
54
+ | `authConfigs` | `AuthConfigs` | Manage authentication configurations for toolkits |
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.
57
+ Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools
58
+ should be exposed directly; see `ToolRouterCreateSessionConfig`. |
59
+ | `experimental` | `Experimental` | Experimental SDK methods whose shape may change in future releases.
60
+ Prefer domain-specific mounts (for example
61
+ `composio.connectedAccounts.updateAcl(...)`) when available; this
62
+ namespace keeps compatibility aliases while APIs are experimental.
63
+ Stateless experimental factories (e.g. `experimental_createTool`) stay
64
+ at the top level. |
65
+ | `files` | `Files` | Upload and download files |
66
+ | `mcp` | `MCP` | Model Context Protocol server management. |
67
+ | `provider` | `TProvider` | The tool provider instance used for wrapping tools in framework-specific formats |
68
+ | `sessions` | `Sessions` | Create and reuse Composio sessions.
69
+
70
+ Prefer `composio.sessions.create(...)` for new code. The top-level
71
+ `composio.create(...)` method is kept as an alias. |
72
+ | `toolkits` | `Toolkits` | Retrieve toolkit metadata and authorize user connections |
73
+ | `toolRouter` | `ToolRouter` | Legacy alias for `composio.sessions`. |
74
+ | `tools` | `Tools` | List, retrieve, and execute tools |
75
+ | `triggers` | `Triggers` | Manage webhook triggers and event subscriptions |
76
+ | `use` | `(id: string, options: \{ customToolkits?: CustomToolkit[]; customTools?: CustomTool[]; mcp: true \}, requestOptions: ComposioRequestOptions) => Promise<Session>` | Use an existing tool router session |
77
+
78
+ ## Methods
79
+
80
+ ### createSession() (deprecated)
81
+
82
+ <Callout type="warn" title="Deprecated">
83
+ Will be removed in a future version of the SDK. Instead, construct a new
84
+ instance directly with the headers you need: `new Composio(\{ ...existingConfig, defaultHeaders \})`.
85
+ For one-off overrides, pass per-call `requestOptions` where supported.
86
+ </Callout>
87
+
88
+ Creates a new instance of the Composio SDK with custom request options while preserving the existing configuration.
89
+ This method is particularly useful when you need to:
90
+ - Add custom headers for specific requests
91
+ - Track request contexts with unique identifiers
92
+ - Override default request behavior for a subset of operations
93
+
94
+ The new instance inherits all configuration from the parent instance (apiKey, baseURL, provider, etc.)
95
+ but allows you to specify custom request options that will be used for all API calls made through this session.
96
+
97
+ ```typescript
98
+ createSession(options?: { headers?: ComposioRequestHeaders }): Composio
99
+ ```
100
+
101
+ **Parameters**
102
+
103
+ | Name | Type |
104
+ |------|------|
105
+ | `options?` | `\{ headers?: ComposioRequestHeaders \}` |
106
+
107
+ **Returns**
108
+
109
+ `Composio` — A new Composio instance with the custom request options applied.
110
+
111
+ **Example**
112
+
113
+ ```typescript
114
+ // Create a base Composio instance
115
+ const composio = new Composio({
116
+ apiKey: 'your-api-key'
117
+ });
118
+
119
+ // Create a session with request tracking headers
120
+ const composioWithCustomHeaders = composio.createSession({
121
+ headers: {
122
+ 'x-request-id': '1234567890',
123
+ 'x-correlation-id': 'session-abc-123',
124
+ 'x-custom-header': 'custom-value'
125
+ }
126
+ });
127
+
128
+ // Use the session for making API calls with the custom headers
129
+ await composioWithCustomHeaders.tools.list();
130
+ ```
131
+
132
+ ---
133
+
134
+ ### flush()
135
+
136
+ Flush any pending telemetry and wait for it to complete.
137
+
138
+ In Node.js-compatible environments, telemetry is automatically flushed on process exit.
139
+ However, in environments like Cloudflare Workers that don't support process exit events,
140
+ you should call this method manually to ensure all telemetry is sent.
141
+
142
+ ```typescript
143
+ async flush(): Promise<void>
144
+ ```
145
+
146
+ **Returns**
147
+
148
+ `Promise<void>` — A promise that resolves when all pending telemetry has been sent.
149
+
150
+ **Example**
151
+
152
+ ```typescript
153
+ // In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
154
+ export default {
155
+ async fetch(request: Request, env: Env, ctx: ExecutionContext) {
156
+ const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
157
+
158
+ // Do your work...
159
+ const result = await composio.tools.execute(...);
160
+
161
+ // Ensure telemetry flushes before worker terminates
162
+ ctx.waitUntil(composio.flush());
163
+
164
+ return new Response(JSON.stringify(result));
165
+ }
166
+ };
167
+ ```
168
+
169
+ ---
170
+
171
+ ### getClient()
172
+
173
+ Get the Composio SDK client.
174
+
175
+ ```typescript
176
+ getClient(): ComposioClient
177
+ ```
178
+
179
+ **Returns**
180
+
181
+ `ComposioClient` — The Composio API client.
182
+
183
+ ---
184
+
185
+ ### getConfig()
186
+
187
+ Get the configuration SDK is initialized with.
188
+
189
+ Returns a frozen shallow clone — the SDK has already snapshotted
190
+ configuration values such as `dangerouslyAllowAutoUploadDownloadFiles`,
191
+ `fileUploadDirs`, and `fileDownloadDir` into its internal models, so
192
+ mutating the live config object would silently no-op. Freezing makes
193
+ that contract visible at the call site instead of letting the mutation
194
+ appear successful.
195
+
196
+ ```typescript
197
+ getConfig(): Readonly<ComposioConfig>
198
+ ```
199
+
200
+ **Returns**
201
+
202
+ `Readonly<ComposioConfig>` — The frozen configuration
203
+ the SDK is initialized with.
204
+
205
+ ---