@composio/core 0.28.0 → 0.30.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 +25 -0
- package/dist/{CustomTool-BYHB7sPs.mjs → CustomTool-9Vlb4XaS.mjs} +12 -14
- package/dist/{CustomTool-DyypijT6.d.mts → CustomTool-Dzk3iqfP.d.mts} +10 -11
- package/dist/FileModifierErrors-WrqokuIF.mjs +199 -0
- package/dist/{FileToolModifier.utils.neutral-DWFpnsj2.mjs → FileToolModifier.utils.neutral-BQP85ZJj.mjs} +1 -2
- package/dist/{SsrfErrors-DiQldIdC.mjs → SsrfErrors-BSVMW915.mjs} +49 -26
- package/dist/{Telemetry-D2PJwXKx.mjs → Telemetry-a7SOQXcg.mjs} +6 -10
- package/dist/{composio-CwHMpKXb.d.mts → composio-DaokW5sV.d.mts} +220 -254
- package/dist/{customTool.types-DoItUHkO.d.mts → customTool.types-CpJbzxT6.d.mts} +255 -274
- package/dist/docs/error-consistency.md +3 -3
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +2 -1
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +2 -2
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +88 -10
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +1 -1
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +48 -10
- 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-xC13uvaA.mjs} +116 -135
- package/dist/experimental/index.d.mts +17 -3
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-ILI1IjnZ.mjs → fileUtils.node-CAwIbWYH.mjs} +6 -8
- package/dist/{files.types-DeMC_mAW.d.mts → files.types-Dg6HcEzs.d.mts} +0 -2
- package/dist/index.d.mts +73 -78
- package/dist/index.mjs +393 -290
- package/dist/{cancellation-ZoRh6EJQ.mjs → jsonSchema-Cc4EtHRw.mjs} +5 -22
- package/dist/models/Files.node.d.mts +32 -13
- package/dist/models/Files.node.mjs +36 -19
- package/dist/models/Files.workerd.d.mts +8 -3
- package/dist/models/Files.workerd.mjs +1 -2
- package/dist/platform/node.d.mts +2 -4
- package/dist/platform/node.mjs +15 -16
- package/dist/platform/workerd.d.mts +2 -4
- package/dist/platform/workerd.mjs +1 -2
- package/dist/requestOptions.types-DWrTcbss.d.mts +38 -0
- package/dist/rolldown-runtime-ad2WFvuA.mjs +17 -0
- package/dist/{sensitiveFileUploadPaths-BaEORC7-.mjs → sensitiveFileUploadPaths-CSyJ3Ku8.mjs} +22 -12
- package/dist/{ssrfGuard.node-BZ270bcu.mjs → ssrfGuard.node-CdIkwqVu.mjs} +3 -5
- package/dist/{types-DWZWePfZ.d.mts → types-DQdUb7OG.d.mts} +2 -4
- package/dist/{types-DuVZKrXO.d.mts → types-Ds6XbK1m.d.mts} +0 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +2 -4
- package/dist/utils/config-defaults/ConfigDefaults.node.mjs +1 -2
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +2 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +1 -2
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +2 -4
- package/dist/utils/modifiers/FileToolModifier.node.mjs +7 -8
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +2 -4
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +2 -3
- package/dist/utils/ssrfGuard.node.d.mts +1 -3
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.d.mts +1 -3
- package/dist/utils/ssrfGuard.workerd.mjs +2 -3
- package/docs/error-consistency.md +3 -3
- package/package.json +12 -13
- package/src/composio.ts +12 -0
- package/src/errors/ComposioError.ts +40 -16
- package/src/errors/ConnectedAccountsErrors.ts +2 -2
- package/src/errors/ToolErrors.ts +177 -28
- package/src/errors/apiErrorDetails.ts +40 -0
- package/src/experimental/index.ts +6 -1
- package/src/lib/toolRouterParams.ts +40 -0
- package/src/models/ConnectedAccounts.ts +2 -2
- package/src/models/ConnectionRequest.ts +44 -32
- package/src/models/CustomTool.ts +25 -30
- package/src/models/CustomToolkits.ts +16 -22
- package/src/models/Experimental.ts +2 -7
- package/src/models/Files.node.ts +68 -37
- package/src/models/RemoteFile.ts +22 -16
- package/src/models/SessionContext.ts +6 -7
- package/src/models/ToolRouter.ts +24 -14
- package/src/models/ToolRouterSession.ts +38 -31
- package/src/models/Tools.ts +274 -30
- package/src/models/Triggers.ts +8 -2
- package/src/types/customTool.types.ts +49 -28
- package/src/types/customToolkits.types.ts +7 -12
- package/src/types/toolRouter.types.ts +39 -17
- package/src/utils/cancellation.ts +5 -1
- package/src/utils/rateLimit.ts +25 -0
- package/src/utils/transformers/customToolkits.ts +2 -2
- package/dist/FileModifierErrors-CdGSABoq.mjs +0 -97
- package/dist/rolldown-runtime-w6R9maHv.mjs +0 -18
- package/src/models/inlineCustomToolsPayload.ts +0 -17
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Full documentation lives at [docs.composio.dev](https://docs.composio.dev). This
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
+
You need **Node.js 22.22.3 or newer**. The SDK is **ESM-only**: use `import` rather than CommonJS `require()`, and set `"type": "module"` in your project's `package.json`. See the [SDK quickstart](https://docs.composio.dev/docs/quickstart) for framework setup.
|
|
10
|
+
|
|
9
11
|
```bash
|
|
10
12
|
npm install @composio/core
|
|
11
13
|
```
|
|
@@ -34,6 +36,29 @@ const session = await composio.use(sessionId);
|
|
|
34
36
|
|
|
35
37
|
See [what a session is](https://docs.composio.dev/docs/how-composio-works) and [configuring sessions](https://docs.composio.dev/docs/configuring-sessions) for restricting toolkits, auth configs, and connected accounts.
|
|
36
38
|
|
|
39
|
+
## Execution results
|
|
40
|
+
|
|
41
|
+
`session.execute(toolSlug, arguments)` returns a plain `ToolRouterSessionExecuteResponse` object:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const result = await session.execute('COMPOSIO_SEARCH_TOOLS', {
|
|
45
|
+
queries: [{ use_case: 'find recent emails' }],
|
|
46
|
+
});
|
|
47
|
+
if (result.resultType === 'completed') {
|
|
48
|
+
console.log(result.data);
|
|
49
|
+
} else { // 'failed' or 'blocked', even if error is empty
|
|
50
|
+
console.error(result.resultType, result.error);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Read `resultType`, not `successful`, on a session result. It also includes `data`, `error`, and `logId`; serialize with `JSON.stringify(result)`. A direct session call has no model tool-call ID, so keep that ID separately when constructing provider messages.
|
|
55
|
+
|
|
56
|
+
`composio.tools.execute(toolSlug, { arguments, userId })` and `afterExecute` modifiers instead use `ToolExecuteResponse` objects with a `successful` boolean. Check `result.successful` there. Session provider adapters derive it from `resultType === 'completed'`. An `afterExecute` modifier receives `{ toolSlug, toolkitSlug, result }` and returns the result. Calling `session.execute` directly doesn't run callbacks supplied to `session.tools()`.
|
|
57
|
+
|
|
58
|
+
Transport/authentication errors and requests for user input can throw instead of returning a tool result. Handle authentication recovery separately from returned failures. A non-throwing call, empty error, or log ID isn't proof of a provider-side action. Check the explicit outcome and tool-specific `data`; retry and idempotency policy stays in your application.
|
|
59
|
+
|
|
60
|
+
Provider helpers serialize differently. The Anthropic `executeToolCall` returns a JSON string; `handleToolCalls` returns correlated `user` messages containing `tool_result` blocks. These payload projections aren't the session/modifier outcome contract. See the provider package's execution contract before using a helper result to make application decisions.
|
|
61
|
+
|
|
37
62
|
## Providers
|
|
38
63
|
|
|
39
64
|
A provider formats session tools for your agent framework and wires up execution:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as ValidationError } from "./errors-xC13uvaA.mjs";
|
|
2
2
|
import { z as z$1 } from "zod/v3";
|
|
3
3
|
import * as z4 from "zod/v4";
|
|
4
4
|
import * as zodToJsonSchema from "zod-to-json-schema";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/types/customTool.types.ts
|
|
7
7
|
/**
|
|
8
8
|
* Zod schema for validating a custom tool slug.
|
|
9
9
|
* Alphanumeric, underscores, and hyphens only. No `LOCAL_` or `COMPOSIO_` prefix.
|
|
@@ -37,8 +37,7 @@ const CreateCustomToolkitBaseSchema = z$1.object({
|
|
|
37
37
|
preload: z$1.boolean().optional().describe("When true, include tools from this custom toolkit in session.tools(). Tool-level preload values override this default.")
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
//#region src/utils/zodSchema.ts
|
|
40
|
+
// src/utils/zodSchema.ts
|
|
42
41
|
const getZodDef = (value) => typeof value === "object" && value !== null ? value._def : void 0;
|
|
43
42
|
const isZodV4Schema = (schema) => typeof getZodDef(schema)?.type === "string";
|
|
44
43
|
const stripSchemaKeyword = (schema) => {
|
|
@@ -73,8 +72,7 @@ const zodObjectSchemaToJsonSchema = (schema, name = "schema", mode = "input") =>
|
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
//#region src/models/CustomTool.ts
|
|
75
|
+
// src/models/CustomTool.ts
|
|
78
76
|
/**
|
|
79
77
|
* @fileoverview Factory functions for creating custom tools and toolkits.
|
|
80
78
|
*
|
|
@@ -120,10 +118,10 @@ function validateSlugLength(toolSlug, toolkitSlug, context) {
|
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
/**
|
|
123
|
-
* Create a
|
|
121
|
+
* Create a local tool for use in tool router sessions.
|
|
124
122
|
*
|
|
125
123
|
* The returned object is a lightweight reference containing the tool's metadata
|
|
126
|
-
* and execute function. Pass it to `composio.create(userId, { experimental: {
|
|
124
|
+
* and execute function. Pass it to `composio.create(userId, { experimental: { localTools: [...] } })`
|
|
127
125
|
* to bind it to a session.
|
|
128
126
|
*
|
|
129
127
|
* Just return the result data from `execute`, or throw an error.
|
|
@@ -136,7 +134,7 @@ function validateSlugLength(toolSlug, toolkitSlug, context) {
|
|
|
136
134
|
*
|
|
137
135
|
* @param slug - Unique tool identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
138
136
|
* @param options - Tool definition including name, schema, and execute function
|
|
139
|
-
* @returns A
|
|
137
|
+
* @returns A LocalTool to pass to session creation
|
|
140
138
|
*
|
|
141
139
|
* @example Standalone tool (no auth)
|
|
142
140
|
* ```typescript
|
|
@@ -188,7 +186,8 @@ function createCustomTool(slug, options) {
|
|
|
188
186
|
};
|
|
189
187
|
}
|
|
190
188
|
/**
|
|
191
|
-
* Create a
|
|
189
|
+
* Create a toolkit that groups related local tools. Pass it to
|
|
190
|
+
* `composio.create(userId, { experimental: { localToolkits: [...] } })`.
|
|
192
191
|
*
|
|
193
192
|
* Tools passed here must NOT have `extendsToolkit` set — they inherit the toolkit identity instead.
|
|
194
193
|
*
|
|
@@ -198,7 +197,7 @@ function createCustomTool(slug, options) {
|
|
|
198
197
|
*
|
|
199
198
|
* @param slug - Unique toolkit identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
200
199
|
* @param options - Toolkit definition including name, description, and tools
|
|
201
|
-
* @returns A
|
|
200
|
+
* @returns A LocalToolkit to pass to session creation
|
|
202
201
|
*
|
|
203
202
|
* @example
|
|
204
203
|
* ```typescript
|
|
@@ -442,8 +441,8 @@ function findCustomToolMapEntryByToolkitAndOriginalSlug(customToolsMap, toolkit,
|
|
|
442
441
|
/**
|
|
443
442
|
* Reject legacy attempts to preload custom tools through top-level preload.tools.
|
|
444
443
|
*
|
|
445
|
-
* Custom tool direct exposure is controlled by
|
|
446
|
-
*
|
|
444
|
+
* Custom tool direct exposure is controlled by LocalTool.preload /
|
|
445
|
+
* LocalToolkit.preload so it follows the current SDK-provided custom
|
|
447
446
|
* definitions instead of stale session config.
|
|
448
447
|
*
|
|
449
448
|
* @internal
|
|
@@ -476,5 +475,4 @@ function getPreloadedCustomToolSlugs(customToolsMap, defaultPreload = false) {
|
|
|
476
475
|
return customToolSlugs;
|
|
477
476
|
}
|
|
478
477
|
|
|
479
|
-
//#endregion
|
|
480
478
|
export { createCustomToolkit as a, getPreloadedCustomToolSlugs as c, CreateCustomToolBaseSchema as d, CreateCustomToolkitBaseSchema as f, createCustomTool as i, serializeCustomToolkits as l, buildCustomToolsMap as n, findCustomToolMapEntryByFinalSlug as o, CustomToolSlugSchema as p, buildCustomToolsMapFromResponse as r, findCustomToolMapEntryByToolkitAndOriginalSlug as s, assertNoCustomToolSlugsInPreload as t, serializeCustomTools as u };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
//#region src/models/CustomTool.d.ts
|
|
1
|
+
import { S as LocalTool, o as CreateLocalToolParams, s as CreateLocalToolkitParams, t as AnyZodSchema, w as LocalToolkit } from "./customTool.types-CpJbzxT6.mjs";
|
|
2
|
+
import "@composio/client/resources/tool-router/session";
|
|
4
3
|
/**
|
|
5
|
-
* Create a
|
|
4
|
+
* Create a local tool for use in tool router sessions.
|
|
6
5
|
*
|
|
7
6
|
* The returned object is a lightweight reference containing the tool's metadata
|
|
8
|
-
* and execute function. Pass it to `composio.create(userId, { experimental: {
|
|
7
|
+
* and execute function. Pass it to `composio.create(userId, { experimental: { localTools: [...] } })`
|
|
9
8
|
* to bind it to a session.
|
|
10
9
|
*
|
|
11
10
|
* Just return the result data from `execute`, or throw an error.
|
|
@@ -18,7 +17,7 @@ import { SessionCreateResponse } from "@composio/client/resources/tool-router/se
|
|
|
18
17
|
*
|
|
19
18
|
* @param slug - Unique tool identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
20
19
|
* @param options - Tool definition including name, schema, and execute function
|
|
21
|
-
* @returns A
|
|
20
|
+
* @returns A LocalTool to pass to session creation
|
|
22
21
|
*
|
|
23
22
|
* @example Standalone tool (no auth)
|
|
24
23
|
* ```typescript
|
|
@@ -45,9 +44,10 @@ import { SessionCreateResponse } from "@composio/client/resources/tool-router/se
|
|
|
45
44
|
* });
|
|
46
45
|
* ```
|
|
47
46
|
*/
|
|
48
|
-
declare function createCustomTool<T extends AnyZodSchema>(slug: string, options:
|
|
47
|
+
declare function createCustomTool<T extends AnyZodSchema>(slug: string, options: CreateLocalToolParams<T>): LocalTool;
|
|
49
48
|
/**
|
|
50
|
-
* Create a
|
|
49
|
+
* Create a toolkit that groups related local tools. Pass it to
|
|
50
|
+
* `composio.create(userId, { experimental: { localToolkits: [...] } })`.
|
|
51
51
|
*
|
|
52
52
|
* Tools passed here must NOT have `extendsToolkit` set — they inherit the toolkit identity instead.
|
|
53
53
|
*
|
|
@@ -57,7 +57,7 @@ declare function createCustomTool<T extends AnyZodSchema>(slug: string, options:
|
|
|
57
57
|
*
|
|
58
58
|
* @param slug - Unique toolkit identifier (alphanumeric, underscores, hyphens; no LOCAL_ or COMPOSIO_ prefix)
|
|
59
59
|
* @param options - Toolkit definition including name, description, and tools
|
|
60
|
-
* @returns A
|
|
60
|
+
* @returns A LocalToolkit to pass to session creation
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```typescript
|
|
@@ -68,6 +68,5 @@ declare function createCustomTool<T extends AnyZodSchema>(slug: string, options:
|
|
|
68
68
|
* });
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
declare function createCustomToolkit(slug: string, options:
|
|
72
|
-
//#endregion
|
|
71
|
+
declare function createCustomToolkit(slug: string, options: CreateLocalToolkitParams): LocalToolkit;
|
|
73
72
|
export { createCustomToolkit as n, createCustomTool as t };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { r as ComposioError$1 } from "./SsrfErrors-BSVMW915.mjs";
|
|
2
|
+
import { APIUserAbortError } from "@composio/client";
|
|
3
|
+
|
|
4
|
+
// src/errors/SDKErrors.ts
|
|
5
|
+
const SDKErrorCodes = {
|
|
6
|
+
NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED",
|
|
7
|
+
API_KEY_KIND_MISMATCH: "API_KEY_KIND_MISMATCH",
|
|
8
|
+
SCOPE_CONFIG_INVALID: "SCOPE_CONFIG_INVALID",
|
|
9
|
+
REQUEST_CANCELLED: "REQUEST_CANCELLED"
|
|
10
|
+
};
|
|
11
|
+
var ComposioNoAPIKeyError = class extends ComposioError$1 {
|
|
12
|
+
constructor(message = "No Composio API key provided", options = {}) {
|
|
13
|
+
const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
|
|
14
|
+
super(message, {
|
|
15
|
+
...options,
|
|
16
|
+
code: SDKErrorCodes.NO_API_KEY_PROVIDED,
|
|
17
|
+
cause: options.cause || defaultCause,
|
|
18
|
+
possibleFixes: options.possibleFixes || [
|
|
19
|
+
"Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
|
|
20
|
+
"To get an API key, please sign up at https://composio.dev/signup",
|
|
21
|
+
"You can also use the Composio CLI to create a project and get an API key"
|
|
22
|
+
],
|
|
23
|
+
statusCode: 401
|
|
24
|
+
});
|
|
25
|
+
this.name = "ComposioNoAPIKeyError";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when the organization/project scope of an SDK instance is
|
|
30
|
+
* inconsistent: only one of `orgId` / `projectId` was supplied, or a scope
|
|
31
|
+
* option disagrees with the same header placed in `defaultHeaders`.
|
|
32
|
+
*/
|
|
33
|
+
var ComposioScopeConfigError = class extends ComposioError$1 {
|
|
34
|
+
constructor(message = "Invalid organization/project scope configuration", options = {}) {
|
|
35
|
+
super(message, {
|
|
36
|
+
...options,
|
|
37
|
+
code: SDKErrorCodes.SCOPE_CONFIG_INVALID,
|
|
38
|
+
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"]
|
|
39
|
+
});
|
|
40
|
+
this.name = "ComposioScopeConfigError";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when the only API key the SDK could find is a Composio user key
|
|
45
|
+
* (`uak_...`, as stored by `composio login`) rather than a project key.
|
|
46
|
+
* User keys authenticate a person, not a project, so the SDK refuses to send
|
|
47
|
+
* one as `x-api-key`. The error never includes the key value.
|
|
48
|
+
*/
|
|
49
|
+
var ComposioAPIKeyKindError = class extends ComposioError$1 {
|
|
50
|
+
constructor(message = "The stored Composio API key is a user API key, not a project API key", options = {}) {
|
|
51
|
+
super(message, {
|
|
52
|
+
...options,
|
|
53
|
+
code: SDKErrorCodes.API_KEY_KIND_MISMATCH,
|
|
54
|
+
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",
|
|
55
|
+
possibleFixes: options.possibleFixes || [
|
|
56
|
+
"Pass a project API key via `apiKey` or the COMPOSIO_API_KEY environment variable",
|
|
57
|
+
"Create a project API key in the Composio dashboard at https://platform.composio.dev",
|
|
58
|
+
"To authenticate with the user API key instead, pass `apiKey: null` together with `userApiKey`"
|
|
59
|
+
],
|
|
60
|
+
statusCode: 401
|
|
61
|
+
});
|
|
62
|
+
this.name = "ComposioAPIKeyKindError";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Thrown when an SDK call is cancelled via the caller-supplied `AbortSignal`.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* try {
|
|
71
|
+
* await composio.tools.execute(slug, body, { signal: AbortSignal.timeout(5_000) });
|
|
72
|
+
* } catch (err) {
|
|
73
|
+
* if (err instanceof ComposioRequestCancelledError) return;
|
|
74
|
+
* throw err;
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
var ComposioRequestCancelledError = class extends ComposioError$1 {
|
|
79
|
+
constructor(message = "Request was cancelled by the caller", options = {}) {
|
|
80
|
+
super(message, {
|
|
81
|
+
...options,
|
|
82
|
+
code: SDKErrorCodes.REQUEST_CANCELLED,
|
|
83
|
+
possibleFixes: options.possibleFixes ?? ["This error is expected when you abort the request via AbortController. Handle it in your catch block to distinguish caller-initiated cancellation from other failures."]
|
|
84
|
+
});
|
|
85
|
+
this.name = "ComposioRequestCancelledError";
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* `APIUserAbortError` has `.name === "Error"` at runtime (doesn't override it),
|
|
90
|
+
* so we fall back to `constructor.name` for dual-package-hazard cases.
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
function isRequestAbortError(error) {
|
|
94
|
+
return _isRequestAbortErrorAt(error, 0);
|
|
95
|
+
}
|
|
96
|
+
function _isRequestAbortErrorAt(error, depth) {
|
|
97
|
+
if (depth > 5) return false;
|
|
98
|
+
if (error instanceof APIUserAbortError) return true;
|
|
99
|
+
if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") return true;
|
|
100
|
+
if (!(error instanceof Error)) return false;
|
|
101
|
+
if (error.constructor.name === "APIUserAbortError" || error.name === "AbortError" || error.name === "APIUserAbortError") return true;
|
|
102
|
+
if ("cause" in error && error.cause !== void 0 && error.cause !== null) return _isRequestAbortErrorAt(error.cause, depth + 1);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/errors/FileModifierErrors.ts
|
|
107
|
+
const FileModifierErrorCodes = {
|
|
108
|
+
FILE_UPLOAD_FAILED: "FILE_UPLOAD_FAILED",
|
|
109
|
+
SENSITIVE_FILE_PATH_BLOCKED: "SENSITIVE_FILE_PATH_BLOCKED",
|
|
110
|
+
FILE_UPLOAD_ABORTED: "FILE_UPLOAD_ABORTED",
|
|
111
|
+
FILE_UPLOAD_PATH_NOT_ALLOWED: "FILE_UPLOAD_PATH_NOT_ALLOWED",
|
|
112
|
+
FILE_NOT_FOUND: "FILE_NOT_FOUND"
|
|
113
|
+
};
|
|
114
|
+
var ComposioFileUploadError = class extends ComposioError$1 {
|
|
115
|
+
constructor(message = "Failed to upload file", options = {}) {
|
|
116
|
+
super(message, {
|
|
117
|
+
...options,
|
|
118
|
+
code: options.code ?? FileModifierErrorCodes.FILE_UPLOAD_FAILED,
|
|
119
|
+
possibleFixes: options.possibleFixes || ["Check if the file exists in the location provided"]
|
|
120
|
+
});
|
|
121
|
+
this.name = "ComposioFileUploadError";
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Thrown when a local file path is refused before upload (sensitive directory or
|
|
126
|
+
* credential-like file name). Subclass of {@link ComposioFileUploadError} so existing
|
|
127
|
+
* `instanceof ComposioFileUploadError` handlers still apply.
|
|
128
|
+
*/
|
|
129
|
+
var ComposioSensitiveFilePathBlockedError = class extends ComposioFileUploadError {
|
|
130
|
+
constructor(message, options = {}) {
|
|
131
|
+
super(message, {
|
|
132
|
+
...options,
|
|
133
|
+
code: FileModifierErrorCodes.SENSITIVE_FILE_PATH_BLOCKED,
|
|
134
|
+
possibleFixes: options.possibleFixes ?? [
|
|
135
|
+
"Use a file outside ~/.ssh, ~/.aws, and other credential locations",
|
|
136
|
+
"Set sensitiveFileUploadProtection: false only if you understand the risk",
|
|
137
|
+
"Add path segments to block with fileUploadPathDenySegments"
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
this.name = "ComposioSensitiveFilePathBlockedError";
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Thrown when a `beforeFileUpload` hook returns `false`.
|
|
145
|
+
*/
|
|
146
|
+
var ComposioFileUploadAbortedError = class extends ComposioFileUploadError {
|
|
147
|
+
constructor(message, options = {}) {
|
|
148
|
+
super(message, {
|
|
149
|
+
...options,
|
|
150
|
+
code: FileModifierErrorCodes.FILE_UPLOAD_ABORTED,
|
|
151
|
+
possibleFixes: options.possibleFixes ?? ["Change beforeFileUpload to return a file path to upload, or allow the upload to proceed"]
|
|
152
|
+
});
|
|
153
|
+
this.name = "ComposioFileUploadAbortedError";
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Thrown when automatic file upload during tool execution is attempted from a path
|
|
158
|
+
* that is outside the configured {@link ComposioConfig.fileUploadDirs} allowlist.
|
|
159
|
+
*
|
|
160
|
+
* This only fires for auto-upload (enabled via
|
|
161
|
+
* `dangerouslyAllowAutoUploadDownloadFiles: true`). Manual `composio.files.upload()`
|
|
162
|
+
* calls are never subject to this check.
|
|
163
|
+
*/
|
|
164
|
+
var ComposioFileUploadPathNotAllowedError = class extends ComposioFileUploadError {
|
|
165
|
+
constructor(message, options = {}) {
|
|
166
|
+
super(message, {
|
|
167
|
+
...options,
|
|
168
|
+
code: FileModifierErrorCodes.FILE_UPLOAD_PATH_NOT_ALLOWED,
|
|
169
|
+
possibleFixes: options.possibleFixes ?? [
|
|
170
|
+
"Move the file under one of the directories in `fileUploadDirs`",
|
|
171
|
+
"Stage the file under the default upload dir (`~/.composio/temp`)",
|
|
172
|
+
"Add the containing directory to `fileUploadDirs` when constructing Composio",
|
|
173
|
+
"Pass the file by URL or as a File/Blob object instead of a filesystem path"
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
this.name = "ComposioFileUploadPathNotAllowedError";
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Thrown when a local file path passed for upload does not exist on disk.
|
|
181
|
+
* Provides extra debugging context (resolved absolute path, cwd, allowlist state)
|
|
182
|
+
* to help the caller distinguish between "typo" and "not-allowlisted" failures.
|
|
183
|
+
*/
|
|
184
|
+
var ComposioFileNotFoundError = class extends ComposioFileUploadError {
|
|
185
|
+
constructor(message, options = {}) {
|
|
186
|
+
super(message, {
|
|
187
|
+
...options,
|
|
188
|
+
code: FileModifierErrorCodes.FILE_NOT_FOUND,
|
|
189
|
+
possibleFixes: options.possibleFixes ?? [
|
|
190
|
+
"Double-check the path for typos",
|
|
191
|
+
"Remember relative paths are resolved against process.cwd() at upload time",
|
|
192
|
+
"Verify the file exists and the process has read permission"
|
|
193
|
+
]
|
|
194
|
+
});
|
|
195
|
+
this.name = "ComposioFileNotFoundError";
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export { ComposioSensitiveFilePathBlockedError as a, ComposioNoAPIKeyError as c, SDKErrorCodes as d, isRequestAbortError as f, ComposioFileUploadPathNotAllowedError as i, ComposioRequestCancelledError as l, ComposioFileUploadAbortedError as n, FileModifierErrorCodes as o, ComposioFileUploadError as r, ComposioAPIKeyKindError as s, ComposioFileNotFoundError as t, ComposioScopeConfigError as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/modifiers/FileToolModifier.utils.neutral.ts
|
|
2
2
|
function isPlainObject(val) {
|
|
3
3
|
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
4
4
|
}
|
|
@@ -186,5 +186,4 @@ const walkFileUploadableLeaves = async (value, schema, leaf) => {
|
|
|
186
186
|
*/
|
|
187
187
|
const dropEmptyFileUploads = (args, schema) => walkFileUploadableLeaves(args, schema, async (value) => isEmptyFileValue(value) ? DELETE_VALUE : value);
|
|
188
188
|
|
|
189
|
-
//#endregion
|
|
190
189
|
export { isEmptyFileValue as a, transformProperties as c, getSchemaVariants as i, walkFileUploadableLeaves as l, dropEmptyFileUploads as n, isPlainObject as o, findSchemaVariantWithFileProperty as r, schemaHasFileUploadable as s, DELETE_VALUE as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
2
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.mjs";
|
|
2
|
+
import { APIError } from "@composio/client";
|
|
3
3
|
import { ZodError } from "zod/v3";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/utils/env.ts
|
|
7
7
|
const getEnvVariable = (name, defaultValue = void 0) => {
|
|
8
8
|
try {
|
|
9
9
|
return process.env[name] || defaultValue;
|
|
@@ -30,8 +30,7 @@ const getEnvsWithPrefix = (prefix) => {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
//#region src/utils/constants.ts
|
|
33
|
+
// src/utils/constants.ts
|
|
35
34
|
var constants_exports = /* @__PURE__ */ __exportAll({
|
|
36
35
|
CLIENT_PUSHER_KEY: () => CLIENT_PUSHER_KEY,
|
|
37
36
|
COMPOSIO_DIR: () => COMPOSIO_DIR,
|
|
@@ -55,8 +54,7 @@ const COMPOSIO_LOG_LEVEL = getEnvVariable("COMPOSIO_LOG_LEVEL");
|
|
|
55
54
|
const IS_DEVELOPMENT_OR_CI = getEnvVariable("DEVELOPMENT") || getEnvVariable("CI") || false;
|
|
56
55
|
const DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID = "files";
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
//#region src/telemetry/redact.ts
|
|
57
|
+
// src/telemetry/redact.ts
|
|
60
58
|
/**
|
|
61
59
|
* Best-effort redaction of secrets from free-form error text before it is sent
|
|
62
60
|
* to the telemetry endpoint.
|
|
@@ -174,8 +172,7 @@ const redactSensitiveText = (input) => {
|
|
|
174
172
|
return output.replace(SECRET_PAIR_UNQUOTED, `$1$2${REDACTED}`);
|
|
175
173
|
};
|
|
176
174
|
|
|
177
|
-
|
|
178
|
-
//#region src/utils/logger.ts
|
|
175
|
+
// src/utils/logger.ts
|
|
179
176
|
const LOG_LEVELS = {
|
|
180
177
|
silent: -1,
|
|
181
178
|
error: 0,
|
|
@@ -246,8 +243,29 @@ var Logger = class {
|
|
|
246
243
|
};
|
|
247
244
|
const logger = new Logger();
|
|
248
245
|
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
// src/errors/apiErrorDetails.ts
|
|
247
|
+
const ANSI_ESCAPE = /\u001b(?:\[[0-?]*[ -/]*[@-~]|\][^\u0007\u001b]*(?:\u0007|\u001b\\)|[@-_])/g;
|
|
248
|
+
const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g;
|
|
249
|
+
/** Make a server-controlled string safe to print in a terminal or a single log line. */
|
|
250
|
+
const sanitizeApiErrorText = (value) => value.replace(ANSI_ESCAPE, " ").replace(CONTROL_CHARACTERS, " ").replace(/\s+/g, " ").trim();
|
|
251
|
+
/**
|
|
252
|
+
* Prefix a message with the API's own message, when the response carried one.
|
|
253
|
+
* `fallback` is the underlying error's message for failures without an HTTP
|
|
254
|
+
* response, such as a timeout or a connection error.
|
|
255
|
+
*/
|
|
256
|
+
const withApiErrorMessage = (message, details, fallback) => {
|
|
257
|
+
const reason = details?.message ?? fallback;
|
|
258
|
+
const safeReason = reason ? sanitizeApiErrorText(reason) : "";
|
|
259
|
+
return safeReason ? `${message}: ${safeReason}` : message;
|
|
260
|
+
};
|
|
261
|
+
/** The API's `suggested_fix` as a one-item list, or nothing so the caller's default applies. */
|
|
262
|
+
const apiErrorSuggestedFixes = (details) => {
|
|
263
|
+
const fix = details?.suggested_fix;
|
|
264
|
+
const safeFix = fix ? sanitizeApiErrorText(fix) : "";
|
|
265
|
+
return safeFix ? [safeFix] : void 0;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/errors/ComposioError.ts
|
|
251
269
|
/**
|
|
252
270
|
* @fileoverview Error class for Composio.
|
|
253
271
|
*
|
|
@@ -261,7 +279,7 @@ const logger = new Logger();
|
|
|
261
279
|
/**
|
|
262
280
|
* Base error class for all Composio errors
|
|
263
281
|
*/
|
|
264
|
-
var ComposioError
|
|
282
|
+
var ComposioError = class ComposioError extends Error {
|
|
265
283
|
/** @readonly Error name */
|
|
266
284
|
name = "ComposioError";
|
|
267
285
|
code;
|
|
@@ -275,12 +293,17 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
275
293
|
constructor(message, options = {}) {
|
|
276
294
|
super(message);
|
|
277
295
|
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
278
|
-
const
|
|
296
|
+
const apiCause = options.cause instanceof APIError ? options.cause : void 0;
|
|
297
|
+
const statusCode = options.statusCode ?? apiCause?.status;
|
|
298
|
+
const requestId = options.requestId ?? apiCause?.requestId;
|
|
299
|
+
const apiErrorCode = options.apiErrorCode ?? apiCause?.details?.code;
|
|
279
300
|
this.code = `TS-SDK::${options.code}`;
|
|
280
301
|
this.possibleFixes = options.possibleFixes;
|
|
281
302
|
this.definePropertyIfExists("statusCode", statusCode);
|
|
303
|
+
this.definePropertyIfExists("requestId", requestId);
|
|
304
|
+
this.definePropertyIfExists("apiErrorCode", apiErrorCode);
|
|
282
305
|
this.definePropertyIfExists("cause", options.cause);
|
|
283
|
-
const combinedStack = options.cause instanceof Error ? ComposioError
|
|
306
|
+
const combinedStack = options.cause instanceof Error ? ComposioError.combineStackTraces(options.cause.stack, this.stack) : options.stack ?? this.stack;
|
|
284
307
|
this.definePropertyIfExists("stack", combinedStack);
|
|
285
308
|
if (options.meta && Object.keys(options.meta).length > 0) this.definePropertyIfExists("meta", options.meta);
|
|
286
309
|
}
|
|
@@ -324,13 +347,14 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
324
347
|
name: this.name,
|
|
325
348
|
message: this.message
|
|
326
349
|
};
|
|
327
|
-
const { cause, code, stack, statusCode, meta, possibleFixes } = this;
|
|
350
|
+
const { cause, code, stack, statusCode, apiErrorCode, meta, possibleFixes } = this;
|
|
328
351
|
if (cause !== void 0) {
|
|
329
352
|
const rawCause = cause;
|
|
330
|
-
data.cause = rawCause instanceof Error ? rawCause.message : String(rawCause);
|
|
353
|
+
data.cause = rawCause instanceof APIError ? sanitizeApiErrorText(rawCause.message) : rawCause instanceof Error ? rawCause.message : sanitizeApiErrorText(String(rawCause));
|
|
331
354
|
}
|
|
332
355
|
if (code) data.code = code;
|
|
333
356
|
if (statusCode !== void 0) data.statusCode = statusCode;
|
|
357
|
+
if (apiErrorCode !== void 0) data.apiErrorCode = apiErrorCode;
|
|
334
358
|
if (meta) data.meta = meta;
|
|
335
359
|
if (possibleFixes) data.possibleFixes = possibleFixes;
|
|
336
360
|
if (includeStack && stack) {
|
|
@@ -354,6 +378,7 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
354
378
|
let output = "\n" + pc.bgRed(pc.white(pc.bold(" ERROR "))) + " " + pc.white(pc.bold(data.message)) + "\n";
|
|
355
379
|
if (data.code) output += pc.yellow(`Error Code: ${data.code}`) + "\n";
|
|
356
380
|
if (data.statusCode !== void 0) output += pc.yellow(`Status: ${data.statusCode}`) + "\n";
|
|
381
|
+
if (data.apiErrorCode !== void 0) output += pc.yellow(`API Error Code: ${data.apiErrorCode}`) + "\n";
|
|
357
382
|
if (data.cause) {
|
|
358
383
|
output += pc.gray("Reason:") + "\n";
|
|
359
384
|
output += " " + pc.white(data.cause) + "\n";
|
|
@@ -382,7 +407,7 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
382
407
|
* @returns The created error instance
|
|
383
408
|
*/
|
|
384
409
|
static createAndPrint(message, options = {}, includeStack = false) {
|
|
385
|
-
const error = new ComposioError
|
|
410
|
+
const error = new ComposioError(message, options);
|
|
386
411
|
error.prettyPrint(includeStack);
|
|
387
412
|
return error;
|
|
388
413
|
}
|
|
@@ -394,7 +419,7 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
394
419
|
*/
|
|
395
420
|
static handle(error, options = {}) {
|
|
396
421
|
const { includeStack = false, exitProcess = false } = options;
|
|
397
|
-
if (error instanceof ComposioError
|
|
422
|
+
if (error instanceof ComposioError) error.prettyPrint(includeStack);
|
|
398
423
|
else if (error instanceof ZodError) this.handleZodError(error, includeStack);
|
|
399
424
|
else if (error instanceof Error) this.handleStandardError(error, includeStack);
|
|
400
425
|
else this.handleUnknownError(error);
|
|
@@ -418,9 +443,9 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
418
443
|
* @private
|
|
419
444
|
*/
|
|
420
445
|
static throwError(error) {
|
|
421
|
-
if (error instanceof ComposioError
|
|
422
|
-
else if (error instanceof Error) throw new ComposioError
|
|
423
|
-
else throw new ComposioError
|
|
446
|
+
if (error instanceof ComposioError) throw error;
|
|
447
|
+
else if (error instanceof Error) throw new ComposioError(error.message, { cause: error });
|
|
448
|
+
else throw new ComposioError(String(error));
|
|
424
449
|
}
|
|
425
450
|
/**
|
|
426
451
|
* Helper method to handle Zod validation errors
|
|
@@ -482,8 +507,7 @@ var ComposioError$1 = class ComposioError$1 extends Error {
|
|
|
482
507
|
}
|
|
483
508
|
};
|
|
484
509
|
|
|
485
|
-
|
|
486
|
-
//#region src/errors/SsrfErrors.ts
|
|
510
|
+
// src/errors/SsrfErrors.ts
|
|
487
511
|
const SsrfErrorCodes = { BLOCKED_INTERNAL_URL: "BLOCKED_INTERNAL_URL" };
|
|
488
512
|
/**
|
|
489
513
|
* Thrown when a URL file input resolves to a private, loopback, link-local, or
|
|
@@ -493,7 +517,7 @@ const SsrfErrorCodes = { BLOCKED_INTERNAL_URL: "BLOCKED_INTERNAL_URL" };
|
|
|
493
517
|
* (SSRF) probe of internal infrastructure such as cloud metadata endpoints
|
|
494
518
|
* (`169.254.169.254`).
|
|
495
519
|
*/
|
|
496
|
-
var ComposioBlockedInternalUrlError = class extends ComposioError
|
|
520
|
+
var ComposioBlockedInternalUrlError = class extends ComposioError {
|
|
497
521
|
constructor(message = "Refusing to fetch an internal or non-public URL", options = {}) {
|
|
498
522
|
const { url, resolvedIp, meta: optionsMeta, ...rest } = options;
|
|
499
523
|
const meta = {
|
|
@@ -515,5 +539,4 @@ var ComposioBlockedInternalUrlError = class extends ComposioError$1 {
|
|
|
515
539
|
}
|
|
516
540
|
};
|
|
517
541
|
|
|
518
|
-
|
|
519
|
-
export { redactSensitiveText as a, DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID as c, USER_DATA_FILE_NAME as d, constants_exports as f, logger as i, IS_DEVELOPMENT_OR_CI as l, getEnvsWithPrefix as m, SsrfErrorCodes as n, COMPOSIO_DIR as o, getEnvVariable as p, ComposioError$1 as r, DEFAULT_BASE_URL as s, ComposioBlockedInternalUrlError as t, TEMP_FILES_DIRECTORY_NAME as u };
|
|
542
|
+
export { getEnvsWithPrefix as _, sanitizeApiErrorText as a, redactSensitiveText as c, DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID as d, IS_DEVELOPMENT_OR_CI as f, getEnvVariable as g, constants_exports as h, apiErrorSuggestedFixes as i, COMPOSIO_DIR as l, USER_DATA_FILE_NAME as m, SsrfErrorCodes as n, withApiErrorMessage as o, TEMP_FILES_DIRECTORY_NAME as p, ComposioError as r, logger as s, ComposioBlockedInternalUrlError as t, DEFAULT_BASE_URL as u };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as redactSensitiveText, g as getEnvVariable, r as ComposioError$1, s as logger } from "./SsrfErrors-BSVMW915.mjs";
|
|
2
|
+
import { p as getRandomUUID } from "./sensitiveFileUploadPaths-CSyJ3Ku8.mjs";
|
|
3
3
|
import { ComposioError } from "@composio/client";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/types/telemetry.types.ts
|
|
6
6
|
const TELEMETRY_EVENTS = {
|
|
7
7
|
SDK_INITIALIZED: "SDK_INITIALIZED",
|
|
8
8
|
SDK_METHOD_INVOKED: "SDK_METHOD_INVOKED",
|
|
@@ -10,8 +10,7 @@ const TELEMETRY_EVENTS = {
|
|
|
10
10
|
CLI_INVOKED: "CLI_INVOKED"
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
//#region src/telemetry/BatchProcessor.ts
|
|
13
|
+
// src/telemetry/BatchProcessor.ts
|
|
15
14
|
var BatchProcessor = class {
|
|
16
15
|
batch = [];
|
|
17
16
|
time;
|
|
@@ -61,8 +60,7 @@ var BatchProcessor = class {
|
|
|
61
60
|
}
|
|
62
61
|
};
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
//#region src/services/telemetry/TelemetryService.ts
|
|
63
|
+
// src/services/telemetry/TelemetryService.ts
|
|
66
64
|
const TELEMETRY_URL = "https://telemetry.composio.dev/v1";
|
|
67
65
|
const TELEMETRY_TIMEOUT_MS = 3e3;
|
|
68
66
|
var TelemetryService = class {
|
|
@@ -115,8 +113,7 @@ var TelemetryService = class {
|
|
|
115
113
|
}
|
|
116
114
|
};
|
|
117
115
|
|
|
118
|
-
|
|
119
|
-
//#region src/telemetry/Telemetry.ts
|
|
116
|
+
// src/telemetry/Telemetry.ts
|
|
120
117
|
/**
|
|
121
118
|
* The Telemetry class is used to log the telemetry for any given instance which extends InstrumentedInstance.
|
|
122
119
|
*
|
|
@@ -367,5 +364,4 @@ var TelemetryTransport = class {
|
|
|
367
364
|
};
|
|
368
365
|
const telemetry = new TelemetryTransport();
|
|
369
366
|
|
|
370
|
-
//#endregion
|
|
371
367
|
export { telemetry as t };
|