@composio/core 0.27.0 → 0.29.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/README.md +2 -0
- package/dist/{CustomTool-BYHB7sPs.mjs → CustomTool-Bd1KdWvo.mjs} +9 -8
- package/dist/{CustomTool-CqPoLUD6.d.mts → CustomTool-CMW-d2ZN.d.mts} +10 -9
- package/dist/{Telemetry-41JkqpZ7.mjs → Telemetry-D2PJwXKx.mjs} +1 -1
- package/dist/{cancellation-ZoRh6EJQ.mjs → cancellation-BoJjs34Y.mjs} +1 -1
- package/dist/{composio-BUa10iB3.d.mts → composio-D5UV5HXN.d.mts} +799 -100
- package/dist/{customTool.types-gX421uPT.d.mts → customTool.types-B9fs34dv.d.mts} +105 -60
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +2 -2
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +86 -3
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +51 -13
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +6 -6
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +4 -4
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +5 -1
- package/dist/{errors-Cly0vXFh.mjs → errors-BK6Xc7Ia.mjs} +65 -1
- package/dist/experimental/index.d.mts +3 -3
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-DNLhLg0W.mjs → fileUtils.node-ILI1IjnZ.mjs} +4 -3
- package/dist/index.d.mts +46 -16
- package/dist/index.mjs +2973 -2778
- package/dist/models/Files.node.mjs +2 -2
- package/dist/sensitiveFileUploadPaths-BaEORC7-.mjs +588 -0
- package/dist/{types-DXxfzBX3.d.mts → types-CaP2SytR.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +3 -3
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/package.json +7 -6
- package/src/errors/ToolErrors.ts +73 -1
- package/src/experimental/index.ts +6 -1
- package/src/lib/toolRouterParams.ts +68 -33
- package/src/lib/toolRouterSessionDelete.ts +1 -10
- package/src/models/ConnectedAccounts.ts +3 -3
- package/src/models/ConnectionRequest.ts +38 -34
- package/src/models/CustomTool.ts +26 -31
- package/src/models/CustomToolkits.ts +116 -10
- package/src/models/Experimental.ts +1 -1
- package/src/models/MCP.ts +1 -2
- package/src/models/SessionConfigs.ts +11 -3
- package/src/models/SessionContext.ts +4 -4
- package/src/models/ToolRouter.ts +26 -17
- package/src/models/ToolRouterSession.ts +39 -24
- package/src/models/Tools.ts +60 -14
- package/src/models/Triggers.ts +12 -5
- package/src/models/inlineCustomToolsPayload.ts +3 -3
- package/src/models/proxyParamsTransform.ts +1 -1
- package/src/types/customTool.types.ts +62 -33
- package/src/types/customToolkits.types.ts +91 -11
- package/src/types/sessionConfigs.types.ts +21 -7
- package/src/types/toolRouter.types.ts +53 -24
- package/src/types/triggers.types.ts +14 -0
- package/src/utils/fileUtils.node.ts +5 -2
- package/src/utils/mime.ts +347 -1
- package/src/utils/rateLimit.ts +25 -0
- package/src/utils/transformers/connectedAccounts.ts +2 -7
- package/src/utils/transformers/customToolkits.ts +79 -10
- package/src/utils/transformers/sessionConfigs.ts +3 -3
- package/src/utils/transformers/toolRouterResponseTransform.ts +23 -75
- package/src/utils/transformers/toolkits.ts +7 -13
- package/src/utils/transformers/triggers.ts +28 -18
- package/dist/sensitiveFileUploadPaths-BlLp-Yo2.mjs +0 -189
|
@@ -7,7 +7,7 @@ description: "A Composio session — the object returned by `composio.sessions.c
|
|
|
7
7
|
|
|
8
8
|
| Name | Type | Description |
|
|
9
9
|
|------|------|-------------|
|
|
10
|
-
| `config` | `
|
|
10
|
+
| `config` | `\{ auth_configs?: object; connected_accounts?: object; execute: \{ enable_multi_execute?: boolean \}; hooks?: \{ applies_to: 'all' \| \{ toolkits: ... \}; handler: \{ action: 'block'; condition: string; type: 'condition_check' \}; id: string; name?: string; type: 'before_execute' \} \| \{ applies_to: 'all' \| \{ toolkits: ... \}; handler: \{ action: ...; condition: ...; type: ... \} \| \{ action: ...; type: ... \}; id: string; name?: string; type: 'after_execute' \}[]; instant: false \| \{ return_instant_charge: boolean; return_prices_in_search: boolean; toolkits?: \{ enabled: ...[] \} \| \{ disabled: ...[] \}; tools?: object \}; manage_connections?: \{ callback_url?: string; enable_connection_removal?: boolean; enable_wait_for_connections?: boolean; enabled?: boolean \}; multi_account?: \{ enable?: boolean; max_accounts_per_toolkit?: number; require_explicit_selection?: boolean \}; preload: \{ tools: string[] \| 'all' \}; proxy_execute?: \{ enable: boolean \}; search: \{ enable?: boolean \}; tags?: \{ disabled?: 'readOnlyHint' \| 'createHint' \| 'updateHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[]; enabled?: 'readOnlyHint' \| 'createHint' \| 'updateHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[]; require_approval?: 'readOnlyHint' \| 'createHint' \| 'updateHint' \| 'destructiveHint' \| 'idempotentHint' \| 'openWorldHint'[] \}; toolkits?: \{ enabled: string[]; require_approval?: string[] \} \| \{ disabled: string[]; require_approval?: string[] \} \| \{ require_approval: string[] \}; tools?: object; user_id: string; workbench?: \{ auto_offload_threshold?: number; enable?: boolean; proxy_execution_enabled?: boolean; sandbox_size?: 'standard' \| 'medium' \| 'large' \| 'xlarge'; tool_execution_enabled?: boolean \} \}` | The session's current configuration (policy snapshot and runtime settings). Refreshed in place by `update()`. For saved, reusable Session configs, see `composio.sessionConfigs`. |
|
|
11
11
|
| `configVersion` | `number` | Version of the server-side configuration this object last observed. Refreshed in place by `update()`. Pass it as `expectedConfigVersion` to make an update conditional. |
|
|
12
12
|
| `experimental` | `SessionExperimental` | |
|
|
13
13
|
| `mcp` | `\{ headers?: Record<string, string>; type: 'http' \| 'sse'; url: string \}` | Hosted MCP endpoint (`session.mcp.url` / `session.mcp.headers`). Exists on every session at runtime, but only surfaced in the type when the session is created with `\{ mcp: true \}` (which returns `Session`); the default `SessionWithoutMcp` omits `mcp`, so MCP is an explicit opt-in. See https://docs.composio.dev/docs/sessions-via-mcp |
|
|
@@ -52,28 +52,30 @@ async authorize(toolkit: string, options?: { callbackUrl?: string; alias?: strin
|
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
55
|
-
### customToolkits()
|
|
55
|
+
### customToolkits() (deprecated)
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
<Callout type="warn" title="Deprecated">
|
|
58
|
+
Use `localToolkits()` instead.
|
|
59
|
+
</Callout>
|
|
59
60
|
|
|
60
61
|
```typescript
|
|
61
|
-
customToolkits():
|
|
62
|
+
customToolkits(): RegisteredLocalToolkit[]
|
|
62
63
|
```
|
|
63
64
|
|
|
64
65
|
**Returns**
|
|
65
66
|
|
|
66
|
-
`
|
|
67
|
+
`RegisteredLocalToolkit[]`
|
|
67
68
|
|
|
68
69
|
---
|
|
69
70
|
|
|
70
|
-
### customTools()
|
|
71
|
+
### customTools() (deprecated)
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
<Callout type="warn" title="Deprecated">
|
|
74
|
+
Use `localTools()` instead.
|
|
75
|
+
</Callout>
|
|
74
76
|
|
|
75
77
|
```typescript
|
|
76
|
-
customTools(options?: { toolkit?: string }):
|
|
78
|
+
customTools(options?: { toolkit?: string }): RegisteredLocalTool[]
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
**Parameters**
|
|
@@ -84,7 +86,7 @@ customTools(options?: { toolkit?: string }): RegisteredCustomTool[]
|
|
|
84
86
|
|
|
85
87
|
**Returns**
|
|
86
88
|
|
|
87
|
-
`
|
|
89
|
+
`RegisteredLocalTool[]`
|
|
88
90
|
|
|
89
91
|
---
|
|
90
92
|
|
|
@@ -176,7 +178,7 @@ async execute(toolSlug: string, arguments_?: Record<string, unknown>, options?:
|
|
|
176
178
|
|
|
177
179
|
**Returns**
|
|
178
180
|
|
|
179
|
-
`Promise<ToolRouterSessionExecuteResponse>` — The tool execution result
|
|
181
|
+
`Promise<ToolRouterSessionExecuteResponse>` — The tool execution result. `resultType: 'blocked'` means a session hook blocked the call; `error` then holds the hook's message
|
|
180
182
|
|
|
181
183
|
---
|
|
182
184
|
|
|
@@ -247,6 +249,42 @@ console.log(items[1].config.toolkits);
|
|
|
247
249
|
|
|
248
250
|
---
|
|
249
251
|
|
|
252
|
+
### localToolkits()
|
|
253
|
+
|
|
254
|
+
List all toolkits of local tools registered in this session.
|
|
255
|
+
Returns toolkits with their tools showing final slugs.
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
localToolkits(): RegisteredLocalToolkit[]
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Returns**
|
|
262
|
+
|
|
263
|
+
`RegisteredLocalToolkit[]` — Array of registered toolkits of local tools
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
### localTools()
|
|
268
|
+
|
|
269
|
+
List all local tools registered in this session.
|
|
270
|
+
Returns tools with their final slugs, schemas, and resolved toolkit.
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
localTools(options?: { toolkit?: string }): RegisteredLocalTool[]
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Parameters**
|
|
277
|
+
|
|
278
|
+
| Name | Type |
|
|
279
|
+
|------|------|
|
|
280
|
+
| `options?` | `\{ toolkit?: string \}` |
|
|
281
|
+
|
|
282
|
+
**Returns**
|
|
283
|
+
|
|
284
|
+
`RegisteredLocalTool[]` — Array of registered local tools
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
250
288
|
### proxyExecute()
|
|
251
289
|
|
|
252
290
|
Proxy an API call through Composio's auth layer using the session's connected account.
|
|
@@ -265,7 +303,7 @@ async proxyExecute(params: SessionProxyExecuteParams, requestOptions?: ComposioR
|
|
|
265
303
|
|
|
266
304
|
**Returns**
|
|
267
305
|
|
|
268
|
-
`Promise<ToolRouterSessionProxyExecuteResponse>` — The proxied API response with status, data,
|
|
306
|
+
`Promise<ToolRouterSessionProxyExecuteResponse>` — The proxied API response with status, data and headers (`resultType: 'completed'`), or `resultType: 'blocked'` with the hook's message when a session hook blocked the request
|
|
269
307
|
|
|
270
308
|
---
|
|
271
309
|
|
|
@@ -74,8 +74,8 @@ const session = await composio.sessions.create('user_123', {
|
|
|
74
74
|
toolkits: ['gmail'],
|
|
75
75
|
manageConnections: true,
|
|
76
76
|
experimental: {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
localTools: [myLocalTool],
|
|
78
|
+
localToolkits: [myLocalToolkit],
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
|
|
@@ -126,7 +126,7 @@ origins is logged, so native tools keep working.
|
|
|
126
126
|
**Overload 1**
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
129
|
-
async use(id: string, options:
|
|
129
|
+
async use(id: string, options: LocalToolsOptions & { mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
**Parameters**
|
|
@@ -134,7 +134,7 @@ async use(id: string, options: { customTools?: CustomTool[]; customToolkits?: Cu
|
|
|
134
134
|
| Name | Type | Description |
|
|
135
135
|
|------|------|-------------|
|
|
136
136
|
| `id` | `string` | \{string\} The id of the session to use |
|
|
137
|
-
| `options` |
|
|
137
|
+
| `options` | `LocalToolsOptions & \{ mcp: true \}` | \{object\} Optional session reuse options |
|
|
138
138
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
139
139
|
|
|
140
140
|
**Returns**
|
|
@@ -144,7 +144,7 @@ async use(id: string, options: { customTools?: CustomTool[]; customToolkits?: Cu
|
|
|
144
144
|
**Overload 2**
|
|
145
145
|
|
|
146
146
|
```typescript
|
|
147
|
-
async use(id: string, options?:
|
|
147
|
+
async use(id: string, options?: LocalToolsOptions & { mcp?: boolean }, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
**Parameters**
|
|
@@ -152,7 +152,7 @@ async use(id: string, options?: { customTools?: CustomTool[]; customToolkits?: C
|
|
|
152
152
|
| Name | Type | Description |
|
|
153
153
|
|------|------|-------------|
|
|
154
154
|
| `id` | `string` | \{string\} The id of the session to use |
|
|
155
|
-
| `options?` |
|
|
155
|
+
| `options?` | `LocalToolsOptions & \{ mcp?: boolean \}` | \{object\} Optional session reuse options |
|
|
156
156
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
157
157
|
|
|
158
158
|
**Returns**
|
|
@@ -225,8 +225,8 @@ Retrieves a specific tool by its slug from the Composio API.
|
|
|
225
225
|
This method fetches a single tool in raw format without provider-specific wrapping,
|
|
226
226
|
providing direct access to the tool's schema and metadata. Tool versions are controlled
|
|
227
227
|
at the Composio SDK initialization level through the `toolkitVersions` configuration.
|
|
228
|
-
|
|
229
|
-
Tool Router session, then use `session.tools()`, `session.
|
|
228
|
+
Experimental local tools are session-scoped; attach them when creating or reusing a
|
|
229
|
+
Tool Router session, then use `session.tools()`, `session.localTools()`, or
|
|
230
230
|
`session.execute()`.
|
|
231
231
|
|
|
232
232
|
```typescript
|
|
@@ -288,9 +288,9 @@ console.log({
|
|
|
288
288
|
Lists Composio API tools available to the SDK.
|
|
289
289
|
|
|
290
290
|
This method fetches remote Composio tools from the API in raw format. The response can be
|
|
291
|
-
filtered and modified as needed.
|
|
291
|
+
filtered and modified as needed. Experimental local tools are session-scoped; attach
|
|
292
292
|
them when creating or reusing a Tool Router session, then use `session.tools()`,
|
|
293
|
-
`session.
|
|
293
|
+
`session.localTools()`, or `session.execute()`.
|
|
294
294
|
It provides access to the underlying tool data without provider-specific wrapping.
|
|
295
295
|
|
|
296
296
|
```typescript
|
|
@@ -19,6 +19,9 @@ const result = await composio.triggers.list();
|
|
|
19
19
|
Create a new trigger instance for a user
|
|
20
20
|
If the connected account id is not provided, the first connected account for the user and toolkit will be used
|
|
21
21
|
|
|
22
|
+
For a trigger that supports both webhook and polling, `body.type` picks one; omit it to let Composio choose.
|
|
23
|
+
`body.pollingInterval` sets the minutes between polls and wins over `triggerConfig.interval`.
|
|
24
|
+
|
|
22
25
|
```typescript
|
|
23
26
|
async create(userId: string, slug: string, body?: TriggerInstanceUpsertParams, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceUpsertResponse>
|
|
24
27
|
```
|
|
@@ -34,7 +37,8 @@ async create(userId: string, slug: string, body?: TriggerInstanceUpsertParams, r
|
|
|
34
37
|
|
|
35
38
|
**Returns**
|
|
36
39
|
|
|
37
|
-
`Promise<TriggerInstanceUpsertResponse>` — The
|
|
40
|
+
`Promise<TriggerInstanceUpsertResponse>` — The trigger instance, with the type it uses, why it polls
|
|
41
|
+
when it fell back from a webhook, and its polling interval
|
|
38
42
|
|
|
39
43
|
---
|
|
40
44
|
|
|
@@ -198,6 +198,27 @@ var ConnectionRequestFailedError = class extends ComposioError$1 {
|
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/utils/rateLimit.ts
|
|
203
|
+
/** Whether a client error is the API rejecting the request with a 429. */
|
|
204
|
+
function isRateLimitResponse(error) {
|
|
205
|
+
return error instanceof APIError && error.status === 429;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Seconds a 429 asks the caller to wait, from its `Retry-After` header (seconds or an HTTP date).
|
|
209
|
+
* Undefined when the header is missing or unreadable.
|
|
210
|
+
*
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
function getRetryAfterSeconds(error) {
|
|
214
|
+
const value = error.headers?.get("retry-after")?.trim();
|
|
215
|
+
if (!value) return;
|
|
216
|
+
const seconds = Number(value);
|
|
217
|
+
if (Number.isFinite(seconds)) return seconds >= 0 ? seconds : void 0;
|
|
218
|
+
const date = Date.parse(value);
|
|
219
|
+
return Number.isNaN(date) ? void 0 : Math.max(0, (date - Date.now()) / 1e3);
|
|
220
|
+
}
|
|
221
|
+
|
|
201
222
|
//#endregion
|
|
202
223
|
//#region src/errors/ToolErrors.ts
|
|
203
224
|
const ToolErrorCodes = {
|
|
@@ -250,6 +271,32 @@ var ComposioToolFetchError = class extends ComposioError$1 {
|
|
|
250
271
|
this.name = "ComposioToolFetchError";
|
|
251
272
|
}
|
|
252
273
|
};
|
|
274
|
+
/** Error options for a 429. Leaves out an unknown wait, as `ComposioError` does for unset fields. */
|
|
275
|
+
const rateLimitOptions = (cause, meta) => {
|
|
276
|
+
const retryAfterSeconds = getRetryAfterSeconds(cause);
|
|
277
|
+
return {
|
|
278
|
+
retryAfterSeconds,
|
|
279
|
+
cause,
|
|
280
|
+
statusCode: 429,
|
|
281
|
+
meta: retryAfterSeconds === void 0 ? meta : {
|
|
282
|
+
...meta,
|
|
283
|
+
retryAfterSeconds
|
|
284
|
+
},
|
|
285
|
+
possibleFixes: [retryAfterSeconds === void 0 ? "Wait before retrying" : `Wait ${Math.ceil(retryAfterSeconds)} seconds, then retry`, "Reduce how many requests your organization sends per minute"]
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* A tool schema fetch rejected with a 429. It is a `ComposioToolFetchError`, so existing handlers
|
|
290
|
+
* still catch it. Use `isComposioRateLimitError` to catch rate limits from fetching and executing.
|
|
291
|
+
*/
|
|
292
|
+
var ComposioToolFetchRateLimitError = class extends ComposioToolFetchError {
|
|
293
|
+
constructor(message, cause, meta = {}) {
|
|
294
|
+
const { retryAfterSeconds, ...options } = rateLimitOptions(cause, meta);
|
|
295
|
+
super(message, options);
|
|
296
|
+
if (retryAfterSeconds !== void 0) this.retryAfterSeconds = retryAfterSeconds;
|
|
297
|
+
this.name = "ComposioToolFetchRateLimitError";
|
|
298
|
+
}
|
|
299
|
+
};
|
|
253
300
|
var ComposioInvalidModifierError = class extends ComposioError$1 {
|
|
254
301
|
constructor(message = "Invalid modifier", options = {}) {
|
|
255
302
|
super(message, {
|
|
@@ -271,6 +318,22 @@ var ComposioToolExecutionError = class extends ComposioError$1 {
|
|
|
271
318
|
this.name = "ComposioToolExecutionError";
|
|
272
319
|
}
|
|
273
320
|
};
|
|
321
|
+
/**
|
|
322
|
+
* A tool execution rejected with a 429. It is a `ComposioToolExecutionError`, so existing handlers
|
|
323
|
+
* still catch it. Use `isComposioRateLimitError` to catch rate limits from fetching and executing.
|
|
324
|
+
*/
|
|
325
|
+
var ComposioToolExecutionRateLimitError = class extends ComposioToolExecutionError {
|
|
326
|
+
constructor(message, cause, meta = {}) {
|
|
327
|
+
const { retryAfterSeconds, ...options } = rateLimitOptions(cause, meta);
|
|
328
|
+
super(message, options);
|
|
329
|
+
if (retryAfterSeconds !== void 0) this.retryAfterSeconds = retryAfterSeconds;
|
|
330
|
+
this.name = "ComposioToolExecutionRateLimitError";
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
/** Whether an error from fetching or executing a tool is the API rejecting the request with a 429. */
|
|
334
|
+
function isComposioRateLimitError(error) {
|
|
335
|
+
return error instanceof ComposioToolFetchRateLimitError || error instanceof ComposioToolExecutionRateLimitError;
|
|
336
|
+
}
|
|
274
337
|
var ComposioInvalidToolArgumentsError = class extends ComposioError$1 {
|
|
275
338
|
constructor(message = "Invalid tool arguments", options = {}) {
|
|
276
339
|
super(message, {
|
|
@@ -387,6 +450,7 @@ const handleToolExecutionError = (tool, actualError) => {
|
|
|
387
450
|
const errorMessage = errorBody?.error?.message;
|
|
388
451
|
if (errorCode && ERROR_CODE_HANDLERS.has(errorCode)) return ERROR_CODE_HANDLERS.get(errorCode)(errorMessage || "An error occurred");
|
|
389
452
|
}
|
|
453
|
+
if (isRateLimitResponse(actualError)) return new ComposioToolExecutionRateLimitError(`Rate limited while executing the tool ${tool}`, actualError, { slug: tool });
|
|
390
454
|
return new ComposioToolExecutionError(`Error executing the tool ${tool}`, {
|
|
391
455
|
cause: actualError,
|
|
392
456
|
possibleFixes: ["Ensure the tool slug is correct and the input arguments for the tool is valid"]
|
|
@@ -793,4 +857,4 @@ var ComposioToolInputRequiredError = class extends ComposioError$1 {
|
|
|
793
857
|
};
|
|
794
858
|
|
|
795
859
|
//#endregion
|
|
796
|
-
export {
|
|
860
|
+
export { ComposioMultipleConnectedAccountsError as $, ComposioInvalidModifierError as A, handleToolExecutionError as B, ValidationError as C, ToolkitErrorCodes as D, ComposioToolkitNotFoundError as E, ComposioToolFetchError as F, ConnectionRequestFailedError as G, getRetryAfterSeconds as H, ComposioToolFetchRateLimitError as I, ComposioConnectedAccountNotFoundError as J, ConnectionRequestTimeoutError as K, ComposioToolNotFoundError as L, ComposioProviderNotDefinedError as M, ComposioToolExecutionError as N, ComposioGlobalExecuteToolFnNotSetError as O, ComposioToolExecutionRateLimitError as P, ComposioLegacyConnectedAccountsEndpointRetiredError as Q, ComposioToolVersionRequiredError as R, JsonSchemaToZodError as S, ComposioToolkitFetchError as T, isRateLimitResponse as U, isComposioRateLimitError as V, ConnectionRequestErrorCodes as W, ComposioConnectedAccountRevocationNotSupportedError as X, ComposioConnectedAccountNotRevokableError as Y, ComposioFailedToCreateConnectedAccountLink as Z, ComposioRequestCancelledError as _, RemoteFileDownloadError as a, isRequestAbortError as b, ComposioFailedToGetSDKRealtimeCredentialsError as c, ComposioTriggerTypeNotFoundError as d, ComposioSharedAccessDeniedError as et, ComposioWebhookPayloadError as f, ComposioNoAPIKeyError as g, ComposioAPIKeyKindError as h, ToolRouterErrorCodes as i, ComposioAuthConfigNotFoundError as it, ComposioInvalidToolArgumentsError as j, ComposioInvalidExecuteFunctionError as k, ComposioFailedToSubscribeToPusherChannelError as l, TriggerErrorCodes as m, ComposioSessionConfigConflictError as n, ConnectedAccountErrorCodes as nt, RemoteFileErrorCodes as o, ComposioWebhookSignatureVerificationError as p, ComposioAclOnlyForSharedError as q, ComposioToolInputRequiredError as r, AuthConfigErrorCodes as rt, ComposioFailedToCreatePusherClientError as s, ComposioMCPDestinationError as t, ComposioSharedConnectionNotAccessibleError as tt, ComposioFailedToUnsubscribeFromPusherChannelError as u, ComposioScopeConfigError as v, ValidationErrorCodes as w, JsonSchemaRefResolutionError as x, SDKErrorCodes as y, ToolErrorCodes as z };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-
|
|
3
|
-
export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type SessionContext, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
1
|
+
import { C as LocalToolExecuteFn, S as LocalTool, a as CreateCustomToolkitParams, c as CustomTool, k as SessionContext, m as CustomToolkit, o as CreateLocalToolParams, r as CreateCustomToolParams, s as CreateLocalToolkitParams, u as CustomToolExecuteFn, w as LocalToolkit } from "../customTool.types-B9fs34dv.mjs";
|
|
2
|
+
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-CMW-d2ZN.mjs";
|
|
3
|
+
export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CreateLocalToolParams, type CreateLocalToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type LocalTool, type LocalToolExecuteFn, type LocalToolkit, type SessionContext, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-
|
|
1
|
+
import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-Bd1KdWvo.mjs";
|
|
2
2
|
|
|
3
3
|
export { createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as logger, o as COMPOSIO_DIR, u as TEMP_FILES_DIRECTORY_NAME } from "./SsrfErrors-DiQldIdC.mjs";
|
|
2
2
|
import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-CdGSABoq.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as getMimeTypeFromFileName, d as getRandomShortId, l as base64ToUint8Array, n as assertSafeFileUploadPath, s as readResponseBodyWithLimit, u as uint8ArrayToBase64 } from "./sensitiveFileUploadPaths-BaEORC7-.mjs";
|
|
4
4
|
import { r as ssrfSafeFetch } from "./ssrfGuard.node-BZ270bcu.mjs";
|
|
5
5
|
import { platform } from "#platform";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -176,6 +176,7 @@ const getExtensionFromMimeType = (mimeType) => {
|
|
|
176
176
|
"text/plain": "txt",
|
|
177
177
|
"text/html": "html",
|
|
178
178
|
"text/css": "css",
|
|
179
|
+
"text/csv": "csv",
|
|
179
180
|
"text/javascript": "js",
|
|
180
181
|
"application/json": "json",
|
|
181
182
|
"application/xml": "xml",
|
|
@@ -208,7 +209,7 @@ const getExtensionFromMimeType = (mimeType) => {
|
|
|
208
209
|
"video/webm": "webm"
|
|
209
210
|
};
|
|
210
211
|
const cleanMimeType = mimeType.split(";")[0].toLowerCase().trim();
|
|
211
|
-
if (mimeToExt
|
|
212
|
+
if (Object.hasOwn(mimeToExt, cleanMimeType)) return mimeToExt[cleanMimeType];
|
|
212
213
|
const parts = cleanMimeType.split("/");
|
|
213
214
|
if (parts.length === 2) {
|
|
214
215
|
const cleanSubtype = parts[1].toLowerCase();
|
|
@@ -244,7 +245,7 @@ const readFileContent = async (filePath) => {
|
|
|
244
245
|
return {
|
|
245
246
|
fileName: generateTimestampedFilename(filePath.split(".").pop() || "txt"),
|
|
246
247
|
content: content instanceof Uint8Array ? uint8ArrayToBase64(content) : uint8ArrayToBase64(new TextEncoder().encode(content)),
|
|
247
|
-
mimeType:
|
|
248
|
+
mimeType: getMimeTypeFromFileName(filePath)
|
|
248
249
|
};
|
|
249
250
|
} catch (error) {
|
|
250
251
|
throw new Error(`Error reading file at ${filePath}: ${error}`);
|