@composio/core 0.19.0 → 0.21.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 (97) hide show
  1. package/dist/{CustomTool-BMlZfJVz.mjs → CustomTool-B-_VjWpy.mjs} +1 -1
  2. package/dist/{CustomTool-CB5vm1Jc.d.mts → CustomTool-BHOYxLZX.d.mts} +1 -1
  3. package/dist/{FileModifierErrors-BqFmpRsm.mjs → FileModifierErrors-CdGSABoq.mjs} +1 -1
  4. package/dist/{SsrfErrors-C91YhASE.mjs → SsrfErrors-DiQldIdC.mjs} +18 -7
  5. package/dist/{Telemetry-HlftxMx6.mjs → Telemetry-JRJJYS4I.mjs} +2 -2
  6. package/dist/{cancellation-CXpfmiVo.mjs → cancellation-DV8CIi52.mjs} +2 -2
  7. package/dist/{composio-DLGaeN70.d.mts → composio-BTZsFajb.d.mts} +3149 -117
  8. package/dist/{customTool.types-BAmEh3MB.d.mts → customTool.types-D_w21L56.d.mts} +784 -56
  9. package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +10 -10
  10. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +7 -3
  11. package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +101 -18
  12. package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +123 -0
  13. package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +9 -2
  14. package/dist/docs/reference/sdk-reference/typescript/index.mdx +8 -0
  15. package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +56 -0
  16. package/dist/docs/reference/sdk-reference/typescript/logs.mdx +78 -0
  17. package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +15 -15
  18. package/dist/docs/reference/sdk-reference/typescript/meta.json +9 -1
  19. package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +83 -0
  20. package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +10 -10
  21. package/dist/docs/reference/sdk-reference/typescript/session.mdx +86 -27
  22. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +26 -6
  23. package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +149 -12
  24. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +18 -18
  25. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +25 -25
  26. package/dist/docs/reference/sdk-reference/typescript/usage.mdx +78 -0
  27. package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +162 -0
  28. package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +218 -0
  29. package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +20 -0
  30. package/dist/{errors-BuEKehbI.mjs → errors-Dyiu3ifQ.mjs} +127 -4
  31. package/dist/experimental/index.d.mts +2 -2
  32. package/dist/experimental/index.mjs +1 -1
  33. package/dist/{fileUtils.node-L7XD8UPr.mjs → fileUtils.node-DNLhLg0W.mjs} +4 -4
  34. package/dist/index.d.mts +281 -55
  35. package/dist/index.mjs +3552 -949
  36. package/dist/models/Files.node.mjs +2 -2
  37. package/dist/{sensitiveFileUploadPaths-B6pBt9lO.mjs → sensitiveFileUploadPaths-BlLp-Yo2.mjs} +1 -1
  38. package/dist/{ssrfGuard.node-B9xQB4za.mjs → ssrfGuard.node-BZ270bcu.mjs} +1 -1
  39. package/dist/{types-CxLPO0Xq.d.mts → types-CgRsUGqm.d.mts} +2 -2
  40. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  41. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  42. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  43. package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
  44. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  45. package/dist/utils/ssrfGuard.node.mjs +1 -1
  46. package/dist/utils/ssrfGuard.workerd.mjs +1 -1
  47. package/package.json +4 -2
  48. package/src/composio.ts +215 -10
  49. package/src/errors/ConnectedAccountsErrors.ts +47 -0
  50. package/src/errors/SDKErrors.ts +52 -0
  51. package/src/errors/ToolRouterErrors.ts +61 -0
  52. package/src/errors/index.ts +3 -0
  53. package/src/index.ts +13 -0
  54. package/src/lib/sessionConfigConflict.ts +43 -0
  55. package/src/lib/toolRouterMcp.ts +132 -0
  56. package/src/lib/toolRouterParams.ts +149 -37
  57. package/src/lib/toolRouterSourceSessionConfig.ts +12 -0
  58. package/src/models/ConnectedAccounts.ts +118 -2
  59. package/src/models/CustomToolkits.ts +169 -0
  60. package/src/models/Experimental.ts +27 -0
  61. package/src/models/Keyring.ts +65 -0
  62. package/src/models/Logs.ts +101 -0
  63. package/src/models/RemoteFile.ts +25 -8
  64. package/src/models/SessionConfigs.ts +117 -0
  65. package/src/models/ToolRouter.ts +61 -17
  66. package/src/models/ToolRouterSession.ts +149 -14
  67. package/src/models/Toolkits.ts +180 -0
  68. package/src/models/Tools.ts +10 -6
  69. package/src/models/Triggers.ts +3 -88
  70. package/src/models/Usage.ts +119 -0
  71. package/src/models/Webhooks.ts +520 -0
  72. package/src/services/pusher/Pusher.ts +17 -6
  73. package/src/types/authConfigs.types.ts +2 -0
  74. package/src/types/connectedAccounts.types.ts +54 -0
  75. package/src/types/customToolkits.types.ts +102 -0
  76. package/src/types/keyring.types.ts +32 -0
  77. package/src/types/logs.types.ts +108 -0
  78. package/src/types/sessionConfigs.types.ts +81 -0
  79. package/src/types/tool.types.ts +2 -0
  80. package/src/types/toolRouter.types.ts +352 -16
  81. package/src/types/toolkit.types.ts +144 -0
  82. package/src/types/usage.types.ts +81 -0
  83. package/src/types/webhooks.types.ts +143 -0
  84. package/src/utils/constants.ts +1 -5
  85. package/src/utils/logger.ts +39 -7
  86. package/src/utils/safePath.ts +172 -0
  87. package/src/utils/sdk.ts +385 -22
  88. package/src/utils/transformers/connectedAccounts.ts +37 -2
  89. package/src/utils/transformers/customToolkits.ts +98 -0
  90. package/src/utils/transformers/keyring.ts +24 -0
  91. package/src/utils/transformers/logs.ts +85 -0
  92. package/src/utils/transformers/sessionConfigs.ts +54 -0
  93. package/src/utils/transformers/toolRouterResponseTransform.ts +6 -0
  94. package/src/utils/transformers/toolkits.ts +106 -3
  95. package/src/utils/transformers/triggers.ts +2 -2
  96. package/src/utils/transformers/usage.ts +77 -0
  97. package/src/utils/transformers/webhooks.ts +139 -0
@@ -0,0 +1,162 @@
1
+ ---
2
+ title: "WebhookEndpoints"
3
+ description: "`composio.webhooks.endpoints` — inbound webhook endpoints. Each endpoint is the ingress URL Composio exposes for one toolkit + OAuth app pair, which you register with the third-party provider so it can push events to Composio."
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ Access this class through the `composio.webhookEndpoints` property:
9
+
10
+ ```typescript
11
+ const composio = new Composio({ apiKey: 'your-api-key' });
12
+ const result = await composio.webhookEndpoints.list();
13
+ ```
14
+
15
+ ## Methods
16
+
17
+ ### create()
18
+
19
+ Create a webhook endpoint for a toolkit + OAuth app pair. Returns the
20
+ existing endpoint when one already exists for that pair.
21
+
22
+ ```typescript
23
+ async create(params: { clientId: string; toolkitSlug: string }, requestOptions?: ComposioRequestOptions): Promise<...>
24
+ ```
25
+
26
+ **Parameters**
27
+
28
+ | Name | Type | Description |
29
+ |------|------|-------------|
30
+ | `params` | `\{ clientId: string; toolkitSlug: string \}` | `toolkitSlug` and `clientId` |
31
+ | `requestOptions?` | `ComposioRequestOptions` | |
32
+
33
+ **Returns**
34
+
35
+ `Promise<...>` — The endpoint; register `webhookUrl` with the provider
36
+
37
+ **Example**
38
+
39
+ ```typescript
40
+ const endpoint = await composio.webhooks.endpoints.create({
41
+ toolkitSlug: 'slack',
42
+ clientId: 'my-slack-app-client-id',
43
+ });
44
+ ```
45
+
46
+ ---
47
+
48
+ ### get()
49
+
50
+ Retrieve a webhook endpoint by its nano id.
51
+
52
+ ```typescript
53
+ async get(nanoId: string, requestOptions?: ComposioRequestOptions): Promise<...>
54
+ ```
55
+
56
+ **Parameters**
57
+
58
+ | Name | Type | Description |
59
+ |------|------|-------------|
60
+ | `nanoId` | `string` | The endpoint nano id (e.g. `we_abc123`) |
61
+ | `requestOptions?` | `ComposioRequestOptions` | |
62
+
63
+ **Returns**
64
+
65
+ `Promise<...>` — The endpoint, with secret setup values masked
66
+
67
+ **Example**
68
+
69
+ ```typescript
70
+ const endpoint = await composio.webhooks.endpoints.get('we_abc123');
71
+ console.log(endpoint.webhookUrl);
72
+ ```
73
+
74
+ ---
75
+
76
+ ### list()
77
+
78
+ List webhook endpoints, optionally filtered by toolkit.
79
+
80
+ ```typescript
81
+ async list(query?: { toolkitSlug?: string }, requestOptions?: ComposioRequestOptions): Promise<{ items: { clientId: string | null; id: string; toolkitSlug: string }[] }>
82
+ ```
83
+
84
+ **Parameters**
85
+
86
+ | Name | Type | Description |
87
+ |------|------|-------------|
88
+ | `query?` | `\{ toolkitSlug?: string \}` | Optional `toolkitSlug` filter |
89
+ | `requestOptions?` | `ComposioRequestOptions` | |
90
+
91
+ **Returns**
92
+
93
+ `Promise<\{ items: \{ clientId: string \| null; id: string; toolkitSlug: string \}[] \}>` — The endpoints
94
+
95
+ **Example**
96
+
97
+ ```typescript
98
+ const { items } = await composio.webhooks.endpoints.list({ toolkitSlug: 'slack' });
99
+ ```
100
+
101
+ ---
102
+
103
+ ### replace()
104
+
105
+ Replace the setup fields of a webhook endpoint. All required setup fields
106
+ for the toolkit must be provided — this is the initial configuration.
107
+
108
+ ```typescript
109
+ async replace(nanoId: string, params: { data: Record<string, string> }, requestOptions?: ComposioRequestOptions): Promise<...>
110
+ ```
111
+
112
+ **Parameters**
113
+
114
+ | Name | Type | Description |
115
+ |------|------|-------------|
116
+ | `nanoId` | `string` | The endpoint nano id |
117
+ | `params` | `\{ data: Record<string, string> \}` | `data` with every required setup field |
118
+ | `requestOptions?` | `ComposioRequestOptions` | |
119
+
120
+ **Returns**
121
+
122
+ `Promise<...>` — The configured endpoint
123
+
124
+ **Example**
125
+
126
+ ```typescript
127
+ await composio.webhooks.endpoints.replace('we_abc123', {
128
+ data: { signing_secret: process.env.SLACK_SIGNING_SECRET! },
129
+ });
130
+ ```
131
+
132
+ ---
133
+
134
+ ### update()
135
+
136
+ Merge setup fields into a webhook endpoint. Omitted fields are preserved.
137
+
138
+ ```typescript
139
+ async update(nanoId: string, params: { data: Record<string, string> }, requestOptions?: ComposioRequestOptions): Promise<...>
140
+ ```
141
+
142
+ **Parameters**
143
+
144
+ | Name | Type | Description |
145
+ |------|------|-------------|
146
+ | `nanoId` | `string` | The endpoint nano id |
147
+ | `params` | `\{ data: Record<string, string> \}` | `data` with the fields to change |
148
+ | `requestOptions?` | `ComposioRequestOptions` | |
149
+
150
+ **Returns**
151
+
152
+ `Promise<...>` — The updated endpoint
153
+
154
+ **Example**
155
+
156
+ ```typescript
157
+ await composio.webhooks.endpoints.update('we_abc123', {
158
+ data: { signing_secret: 'rotated-secret' },
159
+ });
160
+ ```
161
+
162
+ ---
@@ -0,0 +1,218 @@
1
+ ---
2
+ title: "WebhookSubscriptions"
3
+ description: "`composio.webhooks.subscriptions` — the project's outbound webhook subscription. The API allows one subscription per project; every response includes the signing `secret` used to verify deliveries with `composio.triggers.verifyWebhook()` / `composio.triggers.parse()`."
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ Access this class through the `composio.webhookSubscriptions` property:
9
+
10
+ ```typescript
11
+ const composio = new Composio({ apiKey: 'your-api-key' });
12
+ const result = await composio.webhookSubscriptions.list();
13
+ ```
14
+
15
+ ## Methods
16
+
17
+ ### delete()
18
+
19
+ Delete a webhook subscription. Deliveries stop immediately.
20
+
21
+ ```typescript
22
+ async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<{ success: boolean }>
23
+ ```
24
+
25
+ **Parameters**
26
+
27
+ | Name | Type | Description |
28
+ |------|------|-------------|
29
+ | `id` | `string` | The subscription id |
30
+ | `requestOptions?` | `ComposioRequestOptions` | |
31
+
32
+ **Returns**
33
+
34
+ `Promise<\{ success: boolean \}>` — `\{ success \}`
35
+
36
+ **Example**
37
+
38
+ ```typescript
39
+ await composio.webhooks.subscriptions.delete('whs_abc123');
40
+ ```
41
+
42
+ ---
43
+
44
+ ### get()
45
+
46
+ Retrieve a webhook subscription by id.
47
+
48
+ ```typescript
49
+ async get(id: string, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
50
+ ```
51
+
52
+ **Parameters**
53
+
54
+ | Name | Type | Description |
55
+ |------|------|-------------|
56
+ | `id` | `string` | The subscription id |
57
+ | `requestOptions?` | `ComposioRequestOptions` | |
58
+
59
+ **Returns**
60
+
61
+ `Promise<WebhookSubscription>` — The subscription, including its signing secret
62
+
63
+ **Example**
64
+
65
+ ```typescript
66
+ const subscription = await composio.webhooks.subscriptions.get('whs_abc123');
67
+ console.log(subscription.enabledEvents);
68
+ ```
69
+
70
+ ---
71
+
72
+ ### list()
73
+
74
+ List the project's webhook subscriptions.
75
+
76
+ ```typescript
77
+ async list(query?: { cursor?: string; limit?: number }, requestOptions?: ComposioRequestOptions): Promise<{ currentPage: number; items: { createdAt?: string; enabledEvents: string[]; id: string; secret?: string; updatedAt?: string; version: 'V1' | 'V2' | 'V3'; webhookUrl: string }[]; nextCursor: string | null; totalItems: number; totalPages: number }>
78
+ ```
79
+
80
+ **Parameters**
81
+
82
+ | Name | Type | Description |
83
+ |------|------|-------------|
84
+ | `query?` | `\{ cursor?: string; limit?: number \}` | Pagination options |
85
+ | `requestOptions?` | `ComposioRequestOptions` | |
86
+
87
+ **Returns**
88
+
89
+ `Promise<\{ currentPage: number; items: \{ createdAt?: string; enabledEvents: string[]; id: string; secret?: string; updatedAt?: string; version: 'V1' \| 'V2' \| 'V3'; webhookUrl: string \}[]; nextCursor: string \| null; totalItems: number; totalPages: number \}>` — Paginated subscriptions
90
+
91
+ **Example**
92
+
93
+ ```typescript
94
+ const { items } = await composio.webhooks.subscriptions.list();
95
+ console.log(items[0]?.webhookUrl);
96
+ ```
97
+
98
+ ---
99
+
100
+ ### listEventTypes()
101
+
102
+ List the event types a subscription can enable, with the payload
103
+ versions each one supports.
104
+
105
+ ```typescript
106
+ async listEventTypes(requestOptions?: ComposioRequestOptions): Promise<{ items: { description: string; eventType: string; supportedVersions: ... | ... | ...[] }[] }>
107
+ ```
108
+
109
+ **Parameters**
110
+
111
+ | Name | Type |
112
+ |------|------|
113
+ | `requestOptions?` | `ComposioRequestOptions` |
114
+
115
+ **Returns**
116
+
117
+ `Promise<\{ items: \{ description: string; eventType: string; supportedVersions: ... \| ... \| ...[] \}[] \}>` — The available event types
118
+
119
+ **Example**
120
+
121
+ ```typescript
122
+ const { items } = await composio.webhooks.subscriptions.listEventTypes();
123
+ console.log(items.map(item => item.eventType));
124
+ ```
125
+
126
+ ---
127
+
128
+ ### rotateSecret()
129
+
130
+ Rotate the signing secret of a webhook subscription. The previous secret
131
+ stops validating, so update your verifier with the returned `secret`.
132
+
133
+ ```typescript
134
+ async rotateSecret(id: string, requestOptions?: ComposioRequestOptions): Promise<{ id: string; secret: string }>
135
+ ```
136
+
137
+ **Parameters**
138
+
139
+ | Name | Type | Description |
140
+ |------|------|-------------|
141
+ | `id` | `string` | The subscription id |
142
+ | `requestOptions?` | `ComposioRequestOptions` | |
143
+
144
+ **Returns**
145
+
146
+ `Promise<\{ id: string; secret: string \}>` — `\{ id, secret \}`
147
+
148
+ **Example**
149
+
150
+ ```typescript
151
+ const { secret } = await composio.webhooks.subscriptions.rotateSecret('whs_abc123');
152
+ ```
153
+
154
+ ---
155
+
156
+ ### set()
157
+
158
+ Create or update the project webhook subscription.
159
+
160
+ If a subscription already exists it is updated in place, otherwise a new
161
+ one is created. By default this subscribes to V3 trigger message events.
162
+
163
+ ```typescript
164
+ async set(params: { enabledEvents?: string[]; version?: 'V1' | 'V2' | 'V3'; webhookUrl: string }, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
165
+ ```
166
+
167
+ **Parameters**
168
+
169
+ | Name | Type | Description |
170
+ |------|------|-------------|
171
+ | `params` | `\{ enabledEvents?: string[]; version?: 'V1' \| 'V2' \| 'V3'; webhookUrl: string \}` | `webhookUrl`, optional `enabledEvents` and `version` |
172
+ | `requestOptions?` | `ComposioRequestOptions` | |
173
+
174
+ **Returns**
175
+
176
+ `Promise<WebhookSubscription>` — The resulting subscription
177
+
178
+ **Example**
179
+
180
+ ```typescript
181
+ const subscription = await composio.webhooks.subscriptions.set({
182
+ webhookUrl: `${APP_URL}/webhooks/composio`,
183
+ enabledEvents: ['composio.trigger.message', 'composio.connected_account.expired'],
184
+ });
185
+ process.env.COMPOSIO_WEBHOOK_SECRET = subscription.secret;
186
+ ```
187
+
188
+ ---
189
+
190
+ ### update()
191
+
192
+ Update an existing webhook subscription. Only the provided fields change.
193
+
194
+ ```typescript
195
+ async update(id: string, params: { enabledEvents?: string[]; version?: 'V1' | 'V2' | 'V3'; webhookUrl?: string }, requestOptions?: ComposioRequestOptions): Promise<WebhookSubscription>
196
+ ```
197
+
198
+ **Parameters**
199
+
200
+ | Name | Type | Description |
201
+ |------|------|-------------|
202
+ | `id` | `string` | The subscription id |
203
+ | `params` | `\{ enabledEvents?: string[]; version?: 'V1' \| 'V2' \| 'V3'; webhookUrl?: string \}` | Fields to update |
204
+ | `requestOptions?` | `ComposioRequestOptions` | |
205
+
206
+ **Returns**
207
+
208
+ `Promise<WebhookSubscription>` — The updated subscription
209
+
210
+ **Example**
211
+
212
+ ```typescript
213
+ await composio.webhooks.subscriptions.update('whs_abc123', {
214
+ enabledEvents: ['composio.trigger.message'],
215
+ });
216
+ ```
217
+
218
+ ---
@@ -0,0 +1,20 @@
1
+ ---
2
+ title: "Webhooks"
3
+ description: "`composio.webhooks` namespace. - `subscriptions`: the project's outbound webhook subscription (where Composio delivers trigger and lifecycle events). - `endpoints`: inbound ingress URLs for third-party providers, one per toolkit + OAuth app pair."
4
+ ---
5
+
6
+ ## Usage
7
+
8
+ Access this class through the `composio.webhooks` property:
9
+
10
+ ```typescript
11
+ const composio = new Composio({ apiKey: 'your-api-key' });
12
+ const result = await composio.webhooks.list();
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ | Name | Type | Description |
18
+ |------|------|-------------|
19
+ | `endpoints` | `WebhookEndpoints` | Manage inbound webhook endpoints per toolkit + OAuth app. |
20
+ | `subscriptions` | `WebhookSubscriptions` | Manage the project's outbound webhook subscription. |
@@ -1,5 +1,5 @@
1
- import { r as ComposioError$1 } from "./SsrfErrors-C91YhASE.mjs";
2
- import "./FileModifierErrors-BqFmpRsm.mjs";
1
+ import { r as ComposioError$1 } from "./SsrfErrors-DiQldIdC.mjs";
2
+ import "./FileModifierErrors-CdGSABoq.mjs";
3
3
  import { APIError, APIUserAbortError } from "@composio/client";
4
4
  import { ZodError } from "zod/v3";
5
5
 
@@ -29,7 +29,9 @@ const ConnectedAccountErrorCodes = {
29
29
  LEGACY_CONNECTED_ACCOUNTS_ENDPOINT_RETIRED: "LEGACY_CONNECTED_ACCOUNTS_ENDPOINT_RETIRED",
30
30
  SHARED_ACCESS_DENIED: "SHARED_ACCESS_DENIED",
31
31
  ACL_ONLY_FOR_SHARED: "ACL_ONLY_FOR_SHARED",
32
- SHARED_CONNECTION_NOT_ACCESSIBLE: "SHARED_CONNECTION_NOT_ACCESSIBLE"
32
+ SHARED_CONNECTION_NOT_ACCESSIBLE: "SHARED_CONNECTION_NOT_ACCESSIBLE",
33
+ REVOCATION_NOT_SUPPORTED: "CONNECTED_ACCOUNT_REVOCATION_NOT_SUPPORTED",
34
+ NOT_REVOKABLE: "CONNECTED_ACCOUNT_NOT_REVOKABLE"
33
35
  };
34
36
  var ComposioConnectedAccountNotFoundError = class extends ComposioError$1 {
35
37
  constructor(message = "Connected account not found", options = {}) {
@@ -137,6 +139,39 @@ var ComposioLegacyConnectedAccountsEndpointRetiredError = class extends Composio
137
139
  this.name = "ComposioLegacyConnectedAccountsEndpointRetiredError";
138
140
  }
139
141
  };
142
+ /**
143
+ * Thrown by `composio.connectedAccounts.revoke()` when the toolkit behind the
144
+ * connection does not support programmatic revocation at the provider (API
145
+ * 400).
146
+ */
147
+ var ComposioConnectedAccountRevocationNotSupportedError = class extends ComposioError$1 {
148
+ constructor(message = "This toolkit does not support programmatic revocation of connected accounts", options = {}) {
149
+ super(message, {
150
+ ...options,
151
+ code: ConnectedAccountErrorCodes.REVOCATION_NOT_SUPPORTED,
152
+ statusCode: 400,
153
+ possibleFixes: options.possibleFixes || ["Revoke the grant from the provider's own settings page, then disable or delete the connected account with composio.connectedAccounts.disable() / delete()."]
154
+ });
155
+ this.name = "ComposioConnectedAccountRevocationNotSupportedError";
156
+ }
157
+ };
158
+ /**
159
+ * Thrown by `composio.connectedAccounts.revoke()` when the connection is not
160
+ * in a state that can be revoked (API 409), for example it never completed
161
+ * authentication. Revoking an already revoked connection is not an error: it
162
+ * returns an empty `revokedTokens` list.
163
+ */
164
+ var ComposioConnectedAccountNotRevokableError = class extends ComposioError$1 {
165
+ constructor(message = "The connected account is not in a revokable state", options = {}) {
166
+ super(message, {
167
+ ...options,
168
+ code: ConnectedAccountErrorCodes.NOT_REVOKABLE,
169
+ statusCode: 409,
170
+ possibleFixes: options.possibleFixes || ["Check the connection status with composio.connectedAccounts.get(); only ACTIVE connections can be revoked."]
171
+ });
172
+ this.name = "ComposioConnectedAccountNotRevokableError";
173
+ }
174
+ };
140
175
 
141
176
  //#endregion
142
177
  //#region src/errors/ConnectionRequestErrors.ts
@@ -455,6 +490,8 @@ var JsonSchemaRefResolutionError = class extends ComposioError$1 {
455
490
  //#region src/errors/SDKErrors.ts
456
491
  const SDKErrorCodes = {
457
492
  NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED",
493
+ API_KEY_KIND_MISMATCH: "API_KEY_KIND_MISMATCH",
494
+ SCOPE_CONFIG_INVALID: "SCOPE_CONFIG_INVALID",
458
495
  REQUEST_CANCELLED: "REQUEST_CANCELLED"
459
496
  };
460
497
  var ComposioNoAPIKeyError = class extends ComposioError$1 {
@@ -475,6 +512,43 @@ var ComposioNoAPIKeyError = class extends ComposioError$1 {
475
512
  }
476
513
  };
477
514
  /**
515
+ * Thrown when the organization/project scope of an SDK instance is
516
+ * inconsistent: only one of `orgId` / `projectId` was supplied, or a scope
517
+ * option disagrees with the same header placed in `defaultHeaders`.
518
+ */
519
+ var ComposioScopeConfigError = class extends ComposioError$1 {
520
+ constructor(message = "Invalid organization/project scope configuration", options = {}) {
521
+ super(message, {
522
+ ...options,
523
+ code: SDKErrorCodes.SCOPE_CONFIG_INVALID,
524
+ possibleFixes: options.possibleFixes || ["Pass both `orgId` and `projectId` (the organization and consumer project nano IDs), or neither", "Supply the scope through the options or through the `x-org-id` / `x-project-id` default headers, not both with different values"]
525
+ });
526
+ this.name = "ComposioScopeConfigError";
527
+ }
528
+ };
529
+ /**
530
+ * Thrown when the only API key the SDK could find is a Composio user key
531
+ * (`uak_...`, as stored by `composio login`) rather than a project key.
532
+ * User keys authenticate a person, not a project, so the SDK refuses to send
533
+ * one as `x-api-key`. The error never includes the key value.
534
+ */
535
+ var ComposioAPIKeyKindError = class extends ComposioError$1 {
536
+ constructor(message = "The stored Composio API key is a user API key, not a project API key", options = {}) {
537
+ super(message, {
538
+ ...options,
539
+ code: SDKErrorCodes.API_KEY_KIND_MISMATCH,
540
+ cause: options.cause || "The user config file holds a user API key written by the Composio CLI; it cannot authenticate SDK requests as a project",
541
+ possibleFixes: options.possibleFixes || [
542
+ "Pass a project API key via `apiKey` or the COMPOSIO_API_KEY environment variable",
543
+ "Create a project API key in the Composio dashboard at https://platform.composio.dev",
544
+ "To authenticate with the user API key instead, pass `apiKey: null` together with `userApiKey`"
545
+ ],
546
+ statusCode: 401
547
+ });
548
+ this.name = "ComposioAPIKeyKindError";
549
+ }
550
+ };
551
+ /**
478
552
  * Thrown when an SDK call is cancelled via the caller-supplied `AbortSignal`.
479
553
  *
480
554
  * @example
@@ -638,4 +712,53 @@ var RemoteFileDownloadError = class extends ComposioError$1 {
638
712
  };
639
713
 
640
714
  //#endregion
641
- export { ComposioToolVersionRequiredError as A, ComposioMultipleConnectedAccountsError as B, ComposioInvalidExecuteFunctionError as C, ComposioToolExecutionError as D, ComposioProviderNotDefinedError as E, ConnectionRequestTimeoutError as F, ComposioAuthConfigNotFoundError as G, ComposioSharedConnectionNotAccessibleError as H, ComposioAclOnlyForSharedError as I, ComposioConnectedAccountNotFoundError as L, handleToolExecutionError as M, ConnectionRequestErrorCodes as N, ComposioToolFetchError as O, ConnectionRequestFailedError as P, ComposioFailedToCreateConnectedAccountLink as R, ComposioGlobalExecuteToolFnNotSetError as S, ComposioInvalidToolArgumentsError as T, ConnectedAccountErrorCodes as U, ComposioSharedAccessDeniedError as V, AuthConfigErrorCodes as W, ValidationError as _, ComposioFailedToSubscribeToPusherChannelError as a, ComposioToolkitNotFoundError as b, ComposioWebhookPayloadError as c, ComposioNoAPIKeyError as d, ComposioRequestCancelledError as f, JsonSchemaToZodError as g, JsonSchemaRefResolutionError as h, ComposioFailedToGetSDKRealtimeCredentialsError as i, ToolErrorCodes as j, ComposioToolNotFoundError as k, ComposioWebhookSignatureVerificationError as l, isRequestAbortError as m, RemoteFileErrorCodes as n, ComposioFailedToUnsubscribeFromPusherChannelError as o, SDKErrorCodes as p, ComposioFailedToCreatePusherClientError as r, ComposioTriggerTypeNotFoundError as s, RemoteFileDownloadError as t, TriggerErrorCodes as u, ValidationErrorCodes as v, ComposioInvalidModifierError as w, ToolkitErrorCodes as x, ComposioToolkitFetchError as y, ComposioLegacyConnectedAccountsEndpointRetiredError as z };
715
+ //#region src/errors/ToolRouterErrors.ts
716
+ const ToolRouterErrorCodes = {
717
+ MCP_DESTINATION_REJECTED: "MCP_DESTINATION_REJECTED",
718
+ SESSION_CONFIG_CONFLICT: "SESSION_CONFIG_CONFLICT"
719
+ };
720
+ /**
721
+ * Thrown when a session's hosted MCP endpoint is not a destination the SDK
722
+ * will hand the session credential to. The SDK only attaches its credential
723
+ * and scope headers when the MCP URL shares the origin of the API base URL
724
+ * the session was created against. The error is raised only when the caller
725
+ * asked for the endpoint with `mcp: true`; otherwise the session is returned
726
+ * with empty `mcp.headers` and a warning is logged instead. The error names
727
+ * both origins and never includes a credential value.
728
+ */
729
+ var ComposioMCPDestinationError = class extends ComposioError$1 {
730
+ constructor(message = "The session MCP endpoint is not a trusted destination for the session credential", options = {}) {
731
+ super(message, {
732
+ ...options,
733
+ code: ToolRouterErrorCodes.MCP_DESTINATION_REJECTED,
734
+ possibleFixes: options.possibleFixes ?? ["Point `baseURL` at the API origin that serves the session MCP endpoint; a custom base URL yields a matching MCP origin"]
735
+ });
736
+ this.name = "ComposioMCPDestinationError";
737
+ }
738
+ };
739
+ /**
740
+ * Thrown when a session update is rejected with HTTP 409 because the session
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.
750
+ */
751
+ var ComposioSessionConfigConflictError = class extends ComposioError$1 {
752
+ constructor(message = "The session configuration changed since it was last read; re-fetch the session and retry the update", options = {}) {
753
+ super(message, {
754
+ ...options,
755
+ code: ToolRouterErrorCodes.SESSION_CONFIG_CONFLICT,
756
+ statusCode: 409,
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)"]
758
+ });
759
+ this.name = "ComposioSessionConfigConflictError";
760
+ }
761
+ };
762
+
763
+ //#endregion
764
+ export { ComposioInvalidToolArgumentsError as A, ConnectionRequestTimeoutError as B, ValidationErrorCodes as C, ComposioGlobalExecuteToolFnNotSetError as D, ToolkitErrorCodes as E, ComposioToolVersionRequiredError as F, ComposioFailedToCreateConnectedAccountLink as G, ComposioConnectedAccountNotFoundError as H, ToolErrorCodes as I, ComposioSharedAccessDeniedError as J, ComposioLegacyConnectedAccountsEndpointRetiredError as K, handleToolExecutionError as L, ComposioToolExecutionError as M, ComposioToolFetchError as N, ComposioInvalidExecuteFunctionError as O, ComposioToolNotFoundError as P, ComposioAuthConfigNotFoundError as Q, ConnectionRequestErrorCodes as R, ValidationError as S, ComposioToolkitNotFoundError as T, ComposioConnectedAccountNotRevokableError as U, ComposioAclOnlyForSharedError as V, ComposioConnectedAccountRevocationNotSupportedError as W, ConnectedAccountErrorCodes as X, ComposioSharedConnectionNotAccessibleError as Y, AuthConfigErrorCodes as Z, ComposioScopeConfigError as _, RemoteFileErrorCodes as a, JsonSchemaRefResolutionError as b, ComposioFailedToSubscribeToPusherChannelError as c, ComposioWebhookPayloadError as d, ComposioWebhookSignatureVerificationError as f, ComposioRequestCancelledError as g, ComposioNoAPIKeyError as h, RemoteFileDownloadError as i, ComposioProviderNotDefinedError as j, ComposioInvalidModifierError as k, ComposioFailedToUnsubscribeFromPusherChannelError as l, ComposioAPIKeyKindError as m, ComposioSessionConfigConflictError as n, ComposioFailedToCreatePusherClientError as o, TriggerErrorCodes as p, ComposioMultipleConnectedAccountsError as q, ToolRouterErrorCodes as r, ComposioFailedToGetSDKRealtimeCredentialsError as s, ComposioMCPDestinationError as t, ComposioTriggerTypeNotFoundError as u, SDKErrorCodes as v, ComposioToolkitFetchError as w, JsonSchemaToZodError as x, isRequestAbortError as y, ConnectionRequestFailedError as z };
@@ -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-BAmEh3MB.mjs";
2
- import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-CB5vm1Jc.mjs";
1
+ import { S as SessionContext, a as CreateCustomToolkitParams, c as CustomToolExecuteFn, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams } from "../customTool.types-D_w21L56.mjs";
2
+ import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-BHOYxLZX.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-BMlZfJVz.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 };
@@ -1,7 +1,7 @@
1
- import { d as TEMP_FILES_DIRECTORY_NAME, i as logger, o as COMPOSIO_DIR } from "./SsrfErrors-C91YhASE.mjs";
2
- import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-BqFmpRsm.mjs";
3
- import { a as readResponseBodyWithLimit, c as uint8ArrayToBase64, l as getRandomShortId, n as assertSafeFileUploadPath, s as base64ToUint8Array } from "./sensitiveFileUploadPaths-B6pBt9lO.mjs";
4
- import { r as ssrfSafeFetch } from "./ssrfGuard.node-B9xQB4za.mjs";
1
+ import { i as logger, o as COMPOSIO_DIR, u as TEMP_FILES_DIRECTORY_NAME } from "./SsrfErrors-DiQldIdC.mjs";
2
+ import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-CdGSABoq.mjs";
3
+ import { a as readResponseBodyWithLimit, c as uint8ArrayToBase64, l as getRandomShortId, n as assertSafeFileUploadPath, s as base64ToUint8Array } from "./sensitiveFileUploadPaths-BlLp-Yo2.mjs";
4
+ import { r as ssrfSafeFetch } from "./ssrfGuard.node-BZ270bcu.mjs";
5
5
  import { platform } from "#platform";
6
6
  import fs from "node:fs";
7
7
  import * as path from "node:path";