@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.
Files changed (85) hide show
  1. package/README.md +25 -0
  2. package/dist/{CustomTool-BYHB7sPs.mjs → CustomTool-9Vlb4XaS.mjs} +12 -14
  3. package/dist/{CustomTool-DyypijT6.d.mts → CustomTool-Dzk3iqfP.d.mts} +10 -11
  4. package/dist/FileModifierErrors-WrqokuIF.mjs +199 -0
  5. package/dist/{FileToolModifier.utils.neutral-DWFpnsj2.mjs → FileToolModifier.utils.neutral-BQP85ZJj.mjs} +1 -2
  6. package/dist/{SsrfErrors-DiQldIdC.mjs → SsrfErrors-BSVMW915.mjs} +49 -26
  7. package/dist/{Telemetry-D2PJwXKx.mjs → Telemetry-a7SOQXcg.mjs} +6 -10
  8. package/dist/{composio-CwHMpKXb.d.mts → composio-DaokW5sV.d.mts} +220 -254
  9. package/dist/{customTool.types-DoItUHkO.d.mts → customTool.types-CpJbzxT6.d.mts} +255 -274
  10. package/dist/docs/error-consistency.md +3 -3
  11. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +2 -1
  12. package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +2 -2
  13. package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +88 -10
  14. package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +1 -1
  15. package/dist/docs/reference/sdk-reference/typescript/index.mdx +1 -1
  16. package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +1 -1
  17. package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +1 -1
  18. package/dist/docs/reference/sdk-reference/typescript/session.mdx +48 -10
  19. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +6 -6
  20. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +4 -4
  21. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +5 -1
  22. package/dist/{errors-Cly0vXFh.mjs → errors-xC13uvaA.mjs} +116 -135
  23. package/dist/experimental/index.d.mts +17 -3
  24. package/dist/experimental/index.mjs +1 -1
  25. package/dist/{fileUtils.node-ILI1IjnZ.mjs → fileUtils.node-CAwIbWYH.mjs} +6 -8
  26. package/dist/{files.types-DeMC_mAW.d.mts → files.types-Dg6HcEzs.d.mts} +0 -2
  27. package/dist/index.d.mts +73 -78
  28. package/dist/index.mjs +393 -290
  29. package/dist/{cancellation-ZoRh6EJQ.mjs → jsonSchema-Cc4EtHRw.mjs} +5 -22
  30. package/dist/models/Files.node.d.mts +32 -13
  31. package/dist/models/Files.node.mjs +36 -19
  32. package/dist/models/Files.workerd.d.mts +8 -3
  33. package/dist/models/Files.workerd.mjs +1 -2
  34. package/dist/platform/node.d.mts +2 -4
  35. package/dist/platform/node.mjs +15 -16
  36. package/dist/platform/workerd.d.mts +2 -4
  37. package/dist/platform/workerd.mjs +1 -2
  38. package/dist/requestOptions.types-DWrTcbss.d.mts +38 -0
  39. package/dist/rolldown-runtime-ad2WFvuA.mjs +17 -0
  40. package/dist/{sensitiveFileUploadPaths-BaEORC7-.mjs → sensitiveFileUploadPaths-CSyJ3Ku8.mjs} +22 -12
  41. package/dist/{ssrfGuard.node-BZ270bcu.mjs → ssrfGuard.node-CdIkwqVu.mjs} +3 -5
  42. package/dist/{types-DWZWePfZ.d.mts → types-DQdUb7OG.d.mts} +2 -4
  43. package/dist/{types-DuVZKrXO.d.mts → types-Ds6XbK1m.d.mts} +0 -2
  44. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +2 -4
  45. package/dist/utils/config-defaults/ConfigDefaults.node.mjs +1 -2
  46. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +2 -4
  47. package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +1 -2
  48. package/dist/utils/modifiers/FileToolModifier.node.d.mts +2 -4
  49. package/dist/utils/modifiers/FileToolModifier.node.mjs +7 -8
  50. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +2 -4
  51. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +2 -3
  52. package/dist/utils/ssrfGuard.node.d.mts +1 -3
  53. package/dist/utils/ssrfGuard.node.mjs +1 -1
  54. package/dist/utils/ssrfGuard.workerd.d.mts +1 -3
  55. package/dist/utils/ssrfGuard.workerd.mjs +2 -3
  56. package/docs/error-consistency.md +3 -3
  57. package/package.json +12 -13
  58. package/src/composio.ts +12 -0
  59. package/src/errors/ComposioError.ts +40 -16
  60. package/src/errors/ConnectedAccountsErrors.ts +2 -2
  61. package/src/errors/ToolErrors.ts +177 -28
  62. package/src/errors/apiErrorDetails.ts +40 -0
  63. package/src/experimental/index.ts +6 -1
  64. package/src/lib/toolRouterParams.ts +40 -0
  65. package/src/models/ConnectedAccounts.ts +2 -2
  66. package/src/models/ConnectionRequest.ts +44 -32
  67. package/src/models/CustomTool.ts +25 -30
  68. package/src/models/CustomToolkits.ts +16 -22
  69. package/src/models/Experimental.ts +2 -7
  70. package/src/models/Files.node.ts +68 -37
  71. package/src/models/RemoteFile.ts +22 -16
  72. package/src/models/SessionContext.ts +6 -7
  73. package/src/models/ToolRouter.ts +24 -14
  74. package/src/models/ToolRouterSession.ts +38 -31
  75. package/src/models/Tools.ts +274 -30
  76. package/src/models/Triggers.ts +8 -2
  77. package/src/types/customTool.types.ts +49 -28
  78. package/src/types/customToolkits.types.ts +7 -12
  79. package/src/types/toolRouter.types.ts +39 -17
  80. package/src/utils/cancellation.ts +5 -1
  81. package/src/utils/rateLimit.ts +25 -0
  82. package/src/utils/transformers/customToolkits.ts +2 -2
  83. package/dist/FileModifierErrors-CdGSABoq.mjs +0 -97
  84. package/dist/rolldown-runtime-w6R9maHv.mjs +0 -18
  85. package/src/models/inlineCustomToolsPayload.ts +0 -17
@@ -1,9 +1,9 @@
1
- import { i as logger } from "./SsrfErrors-DiQldIdC.mjs";
2
- import { S as JsonSchemaToZodError, _ as ComposioRequestCancelledError, b as isRequestAbortError, x as JsonSchemaRefResolutionError } from "./errors-Cly0vXFh.mjs";
3
- import { o as isPlainObject } from "./FileToolModifier.utils.neutral-DWFpnsj2.mjs";
1
+ import { g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError } from "./errors-xC13uvaA.mjs";
2
+ import { s as logger } from "./SsrfErrors-BSVMW915.mjs";
3
+ import { o as isPlainObject } from "./FileToolModifier.utils.neutral-BQP85ZJj.mjs";
4
4
  import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
5
5
 
6
- //#region src/utils/jsonSchema.ts
6
+ // src/utils/jsonSchema.ts
7
7
  const MAX_REF_CHAIN_DEPTH = 100;
8
8
  const MAX_NODE_DEPTH = 512;
9
9
  const MAX_NULL_CHECK_DEPTH = 64;
@@ -870,21 +870,4 @@ function omitNulls(value, schema, root, depth, acceptsNull) {
870
870
  return clone;
871
871
  }
872
872
 
873
- //#endregion
874
- //#region src/utils/cancellation.ts
875
- /** @internal */
876
- async function withCancellation(call, signal) {
877
- try {
878
- return await call();
879
- } catch (error) {
880
- if (signal?.aborted && isRequestAbortError(error)) {
881
- const underlyingMessage = error instanceof Error ? error.message : "";
882
- const message = underlyingMessage ? `Request was cancelled by the caller: ${underlyingMessage}` : "Request was cancelled by the caller";
883
- throw new ComposioRequestCancelledError(message, { cause: error instanceof Error ? error : void 0 });
884
- }
885
- throw error;
886
- }
887
- }
888
-
889
- //#endregion
890
- export { jsonSchemaToZodSchema as a, toStrictJsonSchema as c, ensureObjectTypeOnProperties as i, deduplicateJsonSchemaRequiredArrays as n, omitNullToolArguments as o, dereferenceJsonSchema as r, removeNonRequiredProperties as s, withCancellation as t };
873
+ export { omitNullToolArguments as a, jsonSchemaToZodSchema as i, dereferenceJsonSchema as n, removeNonRequiredProperties as o, ensureObjectTypeOnProperties as r, toStrictJsonSchema as s, deduplicateJsonSchemaRequiredArrays as t };
@@ -1,6 +1,13 @@
1
- import { n as FileUploadData, t as FileDownloadData } from "../files.types-DeMC_mAW.mjs";
1
+ /**
2
+ * @fileoverview Files class for Composio SDK, used to manage files.
3
+ *
4
+ * @author Musthaq Ahamad <musthaq@composio.dev>
5
+ * @date 2025-06-23
6
+ * @module Files
7
+ */
8
+ import { n as FileUploadData, t as FileDownloadData } from "../files.types-Dg6HcEzs.mjs";
9
+ import { t as ComposioRequestOptions } from "../requestOptions.types-DWrTcbss.mjs";
2
10
  import ComposioClient from "@composio/client";
3
- //#region src/models/Files.node.d.ts
4
11
  export declare class Files {
5
12
  private readonly client;
6
13
  private readonly fileOptions;
@@ -16,30 +23,42 @@ export declare class Files {
16
23
  * @param {File | string} params.file - The path to the file to upload, a URL of the file, or a File object.
17
24
  * @param {string} params.toolSlug - The slug of the tool that is uploading the file.
18
25
  * @param {string} params.toolkitSlug - The slug of the toolkit that is uploading the file.
26
+ * @param {ComposioRequestOptions} [requestOptions] - Optional request options. `signal` cancels
27
+ * the file read from a URL, the presigned-URL request, and the S3 transfer; the call then
28
+ * rejects with {@link ComposioRequestCancelledError}.
19
29
  * @returns {Promise<FileUploadData>} The uploaded file data.
20
30
  *
21
31
  * @example
22
32
  *
23
- * const fileData = await composio.files.upload({
24
- * file: 'path/to/file.pdf',
25
- * toolSlug: 'google_drive_upload',
26
- * toolkitSlug: 'google_drive'
27
- * });
33
+ * const fileData = await composio.files.upload(
34
+ * {
35
+ * file: 'path/to/file.pdf',
36
+ * toolSlug: 'google_drive_upload',
37
+ * toolkitSlug: 'google_drive',
38
+ * },
39
+ * { signal: AbortSignal.timeout(30_000) }
40
+ * );
28
41
  * */
29
42
  upload({ file, toolSlug, toolkitSlug }: {
30
43
  file: File | string;
31
44
  toolSlug: string;
32
45
  toolkitSlug: string;
33
- }): Promise<FileUploadData>;
46
+ }, requestOptions?: ComposioRequestOptions): Promise<FileUploadData>;
34
47
  /**
35
48
  * Download a file from S3 and return the file data.
36
- * @param s3key - The S3 key of the file to download.
37
- * @returns The file data.
49
+ *
50
+ * @param params - The download parameters.
51
+ * @param {string} params.s3Url - The S3 URL of the file to download.
52
+ * @param {string} params.toolSlug - The slug of the tool the file belongs to, used as the file name prefix.
53
+ * @param {string} params.mimeType - The MIME type of the file, used to pick the file extension.
54
+ * @param {ComposioRequestOptions} [requestOptions] - Optional request options. `signal` cancels
55
+ * the download before the file is written; the call then rejects with
56
+ * {@link ComposioRequestCancelledError}.
57
+ * @returns {Promise<FileDownloadData>} The downloaded file data.
38
58
  */
39
59
  download({ toolSlug, s3Url, mimeType }: {
40
60
  s3Url: string;
41
61
  toolSlug: string;
42
62
  mimeType: string;
43
- }): Promise<FileDownloadData>;
44
- }
45
- //#endregion
63
+ }, requestOptions?: ComposioRequestOptions): Promise<FileDownloadData>;
64
+ }
@@ -1,7 +1,8 @@
1
- import { t as telemetry } from "../Telemetry-D2PJwXKx.mjs";
2
- import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-ILI1IjnZ.mjs";
1
+ import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-CAwIbWYH.mjs";
2
+ import { d as withCancellation } from "../sensitiveFileUploadPaths-CSyJ3Ku8.mjs";
3
+ import { t as telemetry } from "../Telemetry-a7SOQXcg.mjs";
3
4
 
4
- //#region src/models/Files.node.ts
5
+ // src/models/Files.node.ts
5
6
  var Files = class {
6
7
  client;
7
8
  fileOptions;
@@ -17,39 +18,55 @@ var Files = class {
17
18
  * @param {File | string} params.file - The path to the file to upload, a URL of the file, or a File object.
18
19
  * @param {string} params.toolSlug - The slug of the tool that is uploading the file.
19
20
  * @param {string} params.toolkitSlug - The slug of the toolkit that is uploading the file.
21
+ * @param {ComposioRequestOptions} [requestOptions] - Optional request options. `signal` cancels
22
+ * the file read from a URL, the presigned-URL request, and the S3 transfer; the call then
23
+ * rejects with {@link ComposioRequestCancelledError}.
20
24
  * @returns {Promise<FileUploadData>} The uploaded file data.
21
25
  *
22
26
  * @example
23
27
  *
24
- * const fileData = await composio.files.upload({
25
- * file: 'path/to/file.pdf',
26
- * toolSlug: 'google_drive_upload',
27
- * toolkitSlug: 'google_drive'
28
- * });
28
+ * const fileData = await composio.files.upload(
29
+ * {
30
+ * file: 'path/to/file.pdf',
31
+ * toolSlug: 'google_drive_upload',
32
+ * toolkitSlug: 'google_drive',
33
+ * },
34
+ * { signal: AbortSignal.timeout(30_000) }
35
+ * );
29
36
  * */
30
- async upload({ file, toolSlug, toolkitSlug }) {
31
- return await getFileDataAfterUploadingToS3(file, {
37
+ async upload({ file, toolSlug, toolkitSlug }, requestOptions) {
38
+ const signal = requestOptions?.signal;
39
+ return withCancellation(() => getFileDataAfterUploadingToS3(file, {
32
40
  toolSlug,
33
41
  toolkitSlug,
34
42
  client: this.client,
35
43
  sensitiveFileUploadProtection: this.fileOptions.sensitiveFileUploadProtection,
36
- fileUploadPathDenySegments: this.fileOptions.fileUploadPathDenySegments
37
- });
44
+ fileUploadPathDenySegments: this.fileOptions.fileUploadPathDenySegments,
45
+ signal
46
+ }), signal);
38
47
  }
39
48
  /**
40
49
  * Download a file from S3 and return the file data.
41
- * @param s3key - The S3 key of the file to download.
42
- * @returns The file data.
50
+ *
51
+ * @param params - The download parameters.
52
+ * @param {string} params.s3Url - The S3 URL of the file to download.
53
+ * @param {string} params.toolSlug - The slug of the tool the file belongs to, used as the file name prefix.
54
+ * @param {string} params.mimeType - The MIME type of the file, used to pick the file extension.
55
+ * @param {ComposioRequestOptions} [requestOptions] - Optional request options. `signal` cancels
56
+ * the download before the file is written; the call then rejects with
57
+ * {@link ComposioRequestCancelledError}.
58
+ * @returns {Promise<FileDownloadData>} The downloaded file data.
43
59
  */
44
- async download({ toolSlug, s3Url, mimeType }) {
45
- return await downloadFileFromS3({
60
+ async download({ toolSlug, s3Url, mimeType }, requestOptions) {
61
+ const signal = requestOptions?.signal;
62
+ return withCancellation(() => downloadFileFromS3({
46
63
  toolSlug,
47
64
  s3Url,
48
65
  mimeType,
49
- fileDownloadDir: this.fileOptions.fileDownloadDir
50
- });
66
+ fileDownloadDir: this.fileOptions.fileDownloadDir,
67
+ signal
68
+ }), signal);
51
69
  }
52
70
  };
53
71
 
54
- //#endregion
55
72
  export { Files };
@@ -1,10 +1,15 @@
1
+ /**
2
+ * @fileoverview Files class stub for Cloudflare Workers / Edge runtimes.
3
+ * File upload and download operations are not supported in these environments.
4
+ *
5
+ * @author Composio Team
6
+ * @module Files
7
+ */
1
8
  import ComposioClient from "@composio/client";
2
- //#region src/models/Files.workerd.d.ts
3
9
  /**
4
10
  * Files class for Cloudflare Workers / Edge runtimes.
5
11
  * All methods throw an error indicating that file operations are not supported.
6
12
  */
7
13
  export declare class Files {
8
14
  constructor(_client: ComposioClient);
9
- }
10
- //#endregion
15
+ }
@@ -1,4 +1,4 @@
1
- //#region src/models/Files.workerd.ts
1
+ // src/models/Files.workerd.ts
2
2
  const UNSUPPORTED_MESSAGE = "File operations (upload/download) are not supported in Cloudflare Workers or Edge runtimes. These operations require Node.js-specific APIs (e.g., `node:crypto`, `node:fs`) that are not available in this environment. Please use a Node.js runtime for file operations.";
3
3
  /**
4
4
  * Creates a Proxy that throws a user-friendly error when any method is accessed.
@@ -24,5 +24,4 @@ var Files = class {
24
24
  }
25
25
  };
26
26
 
27
- //#endregion
28
27
  export { Files };
@@ -1,8 +1,6 @@
1
- import { t as Platform } from "../types-DuVZKrXO.mjs";
2
- //#region src/platform/node.d.ts
1
+ import { t as Platform } from "../types-Ds6XbK1m.mjs";
3
2
  /**
4
3
  * Node.js platform implementation.
5
4
  * Provides full file system and OS operations using Node.js built-in modules.
6
5
  */
7
- export declare const platform: Platform;
8
- //#endregion
6
+ export declare const platform: Platform;
@@ -1,19 +1,19 @@
1
- import * as fs$1 from "node:fs";
1
+ import * as fs from "node:fs";
2
2
  import * as os from "node:os";
3
3
  import * as path from "node:path";
4
4
  import { isFsCaseSensitive } from "is-fs-case-sensitive";
5
5
 
6
- //#region src/platform/node.ts
6
+ // src/platform/node.ts
7
7
  const findNearestExistingDirectory = (filePath) => {
8
8
  let candidate = path.resolve(filePath);
9
9
  try {
10
- if (!fs$1.statSync(candidate).isDirectory()) candidate = path.dirname(candidate);
10
+ if (!fs.statSync(candidate).isDirectory()) candidate = path.dirname(candidate);
11
11
  } catch {
12
12
  candidate = path.dirname(candidate);
13
13
  }
14
14
  while (true) {
15
15
  try {
16
- if (fs$1.statSync(candidate).isDirectory()) return candidate;
16
+ if (fs.statSync(candidate).isDirectory()) return candidate;
17
17
  } catch {}
18
18
  const parent = path.dirname(candidate);
19
19
  if (parent === candidate) return candidate;
@@ -46,10 +46,10 @@ const platform = {
46
46
  return path.basename(filePath);
47
47
  },
48
48
  existsSync(filePath) {
49
- return fs$1.existsSync(filePath);
49
+ return fs.existsSync(filePath);
50
50
  },
51
51
  realpathSync(filePath) {
52
- return fs$1.realpathSync(filePath);
52
+ return fs.realpathSync(filePath);
53
53
  },
54
54
  isFileSystemCaseSensitive(filePath) {
55
55
  try {
@@ -59,33 +59,32 @@ const platform = {
59
59
  }
60
60
  },
61
61
  mkdirSync(dirPath) {
62
- fs$1.mkdirSync(dirPath, { recursive: true });
62
+ fs.mkdirSync(dirPath, { recursive: true });
63
63
  },
64
64
  readFileSync(filePath, encoding) {
65
65
  if (encoding === void 0) {
66
- const buf = fs$1.readFileSync(filePath, { encoding: null });
66
+ const buf = fs.readFileSync(filePath, { encoding: null });
67
67
  return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
68
68
  }
69
- return fs$1.readFileSync(filePath, { encoding });
69
+ return fs.readFileSync(filePath, { encoding });
70
70
  },
71
71
  writeFileSync(filePath, content, encoding) {
72
- if (encoding && typeof content === "string") fs$1.writeFileSync(filePath, content, { encoding });
73
- else fs$1.writeFileSync(filePath, content);
72
+ if (encoding && typeof content === "string") fs.writeFileSync(filePath, content, { encoding });
73
+ else fs.writeFileSync(filePath, content);
74
74
  },
75
75
  writeFileExclusiveSync(filePath, content) {
76
- const fd = fs$1.openSync(filePath, "wx");
76
+ const fd = fs.openSync(filePath, "wx");
77
77
  try {
78
78
  try {
79
- fs$1.writeFileSync(fd, content);
79
+ fs.writeFileSync(fd, content);
80
80
  } finally {
81
- fs$1.closeSync(fd);
81
+ fs.closeSync(fd);
82
82
  }
83
83
  } catch (error) {
84
- fs$1.rmSync(filePath, { force: true });
84
+ fs.rmSync(filePath, { force: true });
85
85
  throw error;
86
86
  }
87
87
  }
88
88
  };
89
89
 
90
- //#endregion
91
90
  export { platform };
@@ -1,9 +1,7 @@
1
- import { t as Platform } from "../types-DuVZKrXO.mjs";
2
- //#region src/platform/workerd.d.ts
1
+ import { t as Platform } from "../types-Ds6XbK1m.mjs";
3
2
  /**
4
3
  * Cloudflare Workers / Edge runtime platform implementation.
5
4
  * Provides stub implementations for file system operations that are unavailable in edge runtimes.
6
5
  * All file system operations gracefully return null/empty values or throw descriptive errors.
7
6
  */
8
- export declare const platform: Platform;
9
- //#endregion
7
+ export declare const platform: Platform;
@@ -1,4 +1,4 @@
1
- //#region src/platform/workerd.ts
1
+ // src/platform/workerd.ts
2
2
  const SLASH_CHAR_CODE = 47;
3
3
  /**
4
4
  * Trailing-slash trim without a regex. The equivalent pattern backtracks
@@ -70,5 +70,4 @@ const platform = {
70
70
  }
71
71
  };
72
72
 
73
- //#endregion
74
73
  export { platform };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Per-request transport options for cancelling an SDK call.
3
+ *
4
+ * For `tools.get` and `tools.execute`, pass `signal` directly in the
5
+ * options bag (3rd argument) alongside any modifiers or provider options.
6
+ * For other methods (e.g. `toolkits.get`, `authConfigs.list`), pass as a
7
+ * trailing argument. Forwarded to the underlying `@composio/client` request.
8
+ *
9
+ * If the underlying request is aborted via this signal, the SDK throws a
10
+ * {@link ComposioRequestCancelledError} so callers can `instanceof`-detect
11
+ * cancellation without unwrapping nested causes.
12
+ *
13
+ * @example Timeout after 5 seconds
14
+ * ```typescript
15
+ * await composio.tools.execute(
16
+ * 'HACKERNEWS_GET_FRONTPAGE',
17
+ * { userId: 'default', arguments: {} },
18
+ * { signal: AbortSignal.timeout(5_000) }
19
+ * );
20
+ * ```
21
+ *
22
+ * @example Combine signal with modifiers
23
+ * ```typescript
24
+ * await composio.tools.execute('TOOL', body, {
25
+ * signal: AbortSignal.timeout(10_000),
26
+ * beforeExecute: ({ params }) => params,
27
+ * });
28
+ * ```
29
+ */
30
+ type ComposioRequestOptions = {
31
+ /**
32
+ * An `AbortSignal` used to cancel the in-flight HTTP request. When the
33
+ * signal aborts, the underlying fetch is aborted and the SDK throws a
34
+ * {@link ComposioRequestCancelledError} (subclass of {@link ComposioError}).
35
+ */
36
+ signal?: AbortSignal;
37
+ };
38
+ export { ComposioRequestOptions as t };
@@ -0,0 +1,17 @@
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, flags) => {
4
+ let target = Object.setPrototypeOf({}, null);
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (!(flags & 1)) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return flags & 2 ? target : Object.preventExtensions(target);
15
+ };
16
+
17
+ export { __exportAll as t };
@@ -1,7 +1,7 @@
1
- import { a as ComposioSensitiveFilePathBlockedError } from "./FileModifierErrors-CdGSABoq.mjs";
1
+ import { a as ComposioSensitiveFilePathBlockedError, f as isRequestAbortError, l as ComposioRequestCancelledError } from "./FileModifierErrors-WrqokuIF.mjs";
2
2
  import { platform } from "#platform";
3
3
 
4
- //#region src/utils/uuid.ts
4
+ // src/utils/uuid.ts
5
5
  function getRandomUUID() {
6
6
  return globalThis.crypto.randomUUID();
7
7
  }
@@ -9,8 +9,22 @@ function getRandomShortId() {
9
9
  return getRandomUUID().slice(0, 8).replace(/-/g, "");
10
10
  }
11
11
 
12
- //#endregion
13
- //#region src/utils/buffer.ts
12
+ // src/utils/cancellation.ts
13
+ /** @internal */
14
+ async function withCancellation(call, signal) {
15
+ try {
16
+ return await call();
17
+ } catch (error) {
18
+ if (signal?.aborted && (isRequestAbortError(error) || error === signal.reason)) {
19
+ const underlyingMessage = error instanceof Error ? error.message : "";
20
+ const message = underlyingMessage ? `Request was cancelled by the caller: ${underlyingMessage}` : "Request was cancelled by the caller";
21
+ throw new ComposioRequestCancelledError(message, { cause: error instanceof Error ? error : void 0 });
22
+ }
23
+ throw error;
24
+ }
25
+ }
26
+
27
+ // src/utils/buffer.ts
14
28
  /**
15
29
  * Convert ArrayBuffer to base64.
16
30
  */
@@ -32,8 +46,7 @@ const uint8ArrayToBase64 = (bytes) => {
32
46
  return btoa(binary);
33
47
  };
34
48
 
35
- //#endregion
36
- //#region src/utils/readResponseBody.ts
49
+ // src/utils/readResponseBody.ts
37
50
  /** Maximum size accepted for files fetched from user-supplied URLs (100 MiB). */
38
51
  const MAX_URL_UPLOAD_SIZE_BYTES = 104857600;
39
52
  const sizeLimitError = (actualSize, maxBytes) => /* @__PURE__ */ new Error(`File size (${actualSize} bytes) exceeds maximum allowed size (${maxBytes} bytes)`);
@@ -82,8 +95,7 @@ const readResponseBodyWithLimit = async (response, maxBytes = MAX_URL_UPLOAD_SIZ
82
95
  return body;
83
96
  };
84
97
 
85
- //#endregion
86
- //#region src/utils/mime.ts
98
+ // src/utils/mime.ts
87
99
  /**
88
100
  * Maps MIME types to file extensions.
89
101
  * Used when deriving filenames from content-type headers (e.g. for URLs without path segments).
@@ -481,8 +493,7 @@ const getMimeTypeFromFileName = (fileName) => {
481
493
  return Object.hasOwn(MIME_TYPES_BY_EXTENSION, extension) ? MIME_TYPES_BY_EXTENSION[extension] : DEFAULT_MIME_TYPE;
482
494
  };
483
495
 
484
- //#endregion
485
- //#region src/utils/sensitiveFileUploadPaths.ts
496
+ // src/utils/sensitiveFileUploadPaths.ts
486
497
  /**
487
498
  * Blocks accidental upload of local files from well-known secret/credential locations
488
499
  * during auto file upload (and {@link getFileDataAfterUploadingToS3}).
@@ -584,5 +595,4 @@ function assertSafeFileUploadPath(filePath, options) {
584
595
  }
585
596
  }
586
597
 
587
- //#endregion
588
- export { getMimeTypeFromFileName as a, arrayBufferToBase64 as c, getRandomShortId as d, getRandomUUID as f, getExtensionFromMimeType as i, base64ToUint8Array as l, assertSafeFileUploadPath as n, MAX_URL_UPLOAD_SIZE_BYTES as o, isBlockedSensitiveFileUploadPath as r, readResponseBodyWithLimit as s, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS as t, uint8ArrayToBase64 as u };
598
+ export { getMimeTypeFromFileName as a, arrayBufferToBase64 as c, withCancellation as d, getRandomShortId as f, getExtensionFromMimeType as i, base64ToUint8Array as l, assertSafeFileUploadPath as n, MAX_URL_UPLOAD_SIZE_BYTES as o, getRandomUUID as p, isBlockedSensitiveFileUploadPath as r, readResponseBodyWithLimit as s, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS as t, uint8ArrayToBase64 as u };
@@ -1,11 +1,11 @@
1
- import { t as ComposioBlockedInternalUrlError } from "./SsrfErrors-DiQldIdC.mjs";
1
+ import { t as ComposioBlockedInternalUrlError } from "./SsrfErrors-BSVMW915.mjs";
2
2
  import { lookup } from "node:dns/promises";
3
3
  import { isIP } from "node:net";
4
4
  import { request } from "node:http";
5
5
  import { request as request$1 } from "node:https";
6
6
  import { Readable } from "node:stream";
7
7
 
8
- //#region src/utils/pinnedDispatcher.node.ts
8
+ // src/utils/pinnedDispatcher.node.ts
9
9
  /**
10
10
  * The `globalThis` symbols that hold the process-wide dispatcher `fetch` falls
11
11
  * back to. Every undici in the process shares them — including the one inside
@@ -165,8 +165,7 @@ const hasCustomGlobalDispatcher = () => {
165
165
  return dispatcher !== void 0 && dispatcher.constructor?.name !== "Agent";
166
166
  };
167
167
 
168
- //#endregion
169
- //#region src/utils/ssrfGuard.node.ts
168
+ // src/utils/ssrfGuard.node.ts
170
169
  /**
171
170
  * SSRF guard for user-supplied URL file inputs.
172
171
  *
@@ -470,5 +469,4 @@ const ssrfSafeFetch = async (rawUrl, init = {}, optionsOrMaxRedirects = {}) => {
470
469
  */
471
470
  const ssrfSafeFetchWhereSupported = ssrfSafeFetch;
472
471
 
473
- //#endregion
474
472
  export { ssrfSafeFetchWhereSupported as i, isBlockedIp as n, ssrfSafeFetch as r, assertSafeFetchTarget as t };
@@ -1,11 +1,9 @@
1
- import { Tr as BaseComposioProvider } from "./customTool.types-DoItUHkO.mjs";
2
- import { n as ComposioConfig } from "./composio-CwHMpKXb.mjs";
3
- //#region src/utils/config-defaults/types.d.ts
1
+ import { n as ComposioConfig } from "./composio-DaokW5sV.mjs";
2
+ import { jr as BaseComposioProvider } from "./customTool.types-CpJbzxT6.mjs";
4
3
  /**
5
4
  * Configuration defaults for Composio.
6
5
  * These are the required fields that must have default values.
7
6
  * The provider type is set to never since defaults don't include a provider instance.
8
7
  */
9
8
  type ConfigDefaults = Required<Pick<ComposioConfig<BaseComposioProvider<never, never, never>>, 'dangerouslyAllowAutoUploadDownloadFiles' | 'allowTracking' | 'toolkitVersions'>>;
10
- //#endregion
11
9
  export { ConfigDefaults as t };
@@ -1,4 +1,3 @@
1
- //#region src/platform/types.d.ts
2
1
  /**
3
2
  * Platform abstraction for file system and OS operations.
4
3
  * This interface allows different implementations for Node.js and edge runtimes (e.g., Cloudflare Workers).
@@ -84,5 +83,4 @@ interface Platform {
84
83
  readonly supportsFileSystem: boolean;
85
84
  }
86
85
  type Uint8ArrayEncoding = 'utf8';
87
- //#endregion
88
86
  export { Platform as t };
@@ -1,4 +1,2 @@
1
- import { t as ConfigDefaults } from "../../types-DWZWePfZ.mjs";
2
- //#region src/utils/config-defaults/ConfigDefaults.node.d.ts
3
- export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
- //#endregion
1
+ import { t as ConfigDefaults } from "../../types-DQdUb7OG.mjs";
2
+ export declare const CONFIG_DEFAULTS: ConfigDefaults;
@@ -1,9 +1,8 @@
1
- //#region src/utils/config-defaults/ConfigDefaults.node.ts
1
+ // src/utils/config-defaults/ConfigDefaults.node.ts
2
2
  const CONFIG_DEFAULTS = {
3
3
  dangerouslyAllowAutoUploadDownloadFiles: false,
4
4
  allowTracking: true,
5
5
  toolkitVersions: "latest"
6
6
  };
7
7
 
8
- //#endregion
9
8
  export { CONFIG_DEFAULTS };
@@ -1,4 +1,2 @@
1
- import { t as ConfigDefaults } from "../../types-DWZWePfZ.mjs";
2
- //#region src/utils/config-defaults/ConfigDefaults.workerd.d.ts
3
- export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
- //#endregion
1
+ import { t as ConfigDefaults } from "../../types-DQdUb7OG.mjs";
2
+ export declare const CONFIG_DEFAULTS: ConfigDefaults;
@@ -1,4 +1,4 @@
1
- //#region src/utils/config-defaults/ConfigDefaults.workerd.ts
1
+ // src/utils/config-defaults/ConfigDefaults.workerd.ts
2
2
  const CONFIG_DEFAULTS = {
3
3
  /**
4
4
  * We don't support auto-uploading/download files in Cloudflare Workers yet.
@@ -8,5 +8,4 @@ const CONFIG_DEFAULTS = {
8
8
  toolkitVersions: "latest"
9
9
  };
10
10
 
11
- //#endregion
12
11
  export { CONFIG_DEFAULTS };
@@ -1,6 +1,5 @@
1
- import { Ka as ToolExecuteResponse, Va as Tool, Wa as ToolExecuteParams } from "../../customTool.types-DoItUHkO.mjs";
1
+ import { Qa as ToolExecuteResponse, Xa as ToolExecuteParams, qa as Tool } from "../../customTool.types-CpJbzxT6.mjs";
2
2
  import ComposioClient from "@composio/client";
3
- //#region src/utils/modifiers/FileToolModifier.node.d.ts
4
3
  export declare class FileToolModifier {
5
4
  private client;
6
5
  private fileUploadPathOptions;
@@ -18,5 +17,4 @@ export declare class FileToolModifier {
18
17
  result: ToolExecuteResponse;
19
18
  signal?: AbortSignal;
20
19
  }): Promise<ToolExecuteResponse>;
21
- }
22
- //#endregion
20
+ }
@@ -1,11 +1,11 @@
1
- import { i as logger } from "../../SsrfErrors-DiQldIdC.mjs";
2
- import { _ as ComposioRequestCancelledError } from "../../errors-Cly0vXFh.mjs";
3
- import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "../../FileModifierErrors-CdGSABoq.mjs";
4
- import { a as isEmptyFileValue, c as transformProperties, i as getSchemaVariants, l as walkFileUploadableLeaves, o as isPlainObject, r as findSchemaVariantWithFileProperty, t as DELETE_VALUE } from "../../FileToolModifier.utils.neutral-DWFpnsj2.mjs";
5
- import { r as dereferenceJsonSchema, t as withCancellation } from "../../cancellation-ZoRh6EJQ.mjs";
6
- import { n as getFileDataAfterUploadingToS3, r as isHttpUrl, t as downloadFileFromS3 } from "../../fileUtils.node-ILI1IjnZ.mjs";
1
+ import { s as logger } from "../../SsrfErrors-BSVMW915.mjs";
2
+ import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, l as ComposioRequestCancelledError, n as ComposioFileUploadAbortedError, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "../../FileModifierErrors-WrqokuIF.mjs";
3
+ import { n as getFileDataAfterUploadingToS3, r as isHttpUrl, t as downloadFileFromS3 } from "../../fileUtils.node-CAwIbWYH.mjs";
4
+ import { a as isEmptyFileValue, c as transformProperties, i as getSchemaVariants, l as walkFileUploadableLeaves, o as isPlainObject, r as findSchemaVariantWithFileProperty, t as DELETE_VALUE } from "../../FileToolModifier.utils.neutral-BQP85ZJj.mjs";
5
+ import { n as dereferenceJsonSchema } from "../../jsonSchema-Cc4EtHRw.mjs";
6
+ import { d as withCancellation } from "../../sensitiveFileUploadPaths-CSyJ3Ku8.mjs";
7
7
 
8
- //#region src/utils/modifiers/FileToolModifier.node.ts
8
+ // src/utils/modifiers/FileToolModifier.node.ts
9
9
  /**
10
10
  * Inlines internal `$ref` pointers so the file walkers below can see the
11
11
  * `file_uploadable` / `file_downloadable` flags that live behind a
@@ -198,5 +198,4 @@ var FileToolModifier = class {
198
198
  }
199
199
  };
200
200
 
201
- //#endregion
202
201
  export { FileToolModifier };
@@ -1,6 +1,5 @@
1
- import { Ka as ToolExecuteResponse, Va as Tool, Wa as ToolExecuteParams } from "../../customTool.types-DoItUHkO.mjs";
1
+ import { Qa as ToolExecuteResponse, Xa as ToolExecuteParams, qa as Tool } from "../../customTool.types-CpJbzxT6.mjs";
2
2
  import ComposioClient from "@composio/client";
3
- //#region src/utils/modifiers/FileToolModifier.workerd.d.ts
4
3
  export declare class FileToolModifier {
5
4
  constructor(_client: ComposioClient);
6
5
  modifyToolSchema(schema: Tool): Promise<Tool>;
@@ -16,5 +15,4 @@ export declare class FileToolModifier {
16
15
  result: ToolExecuteResponse;
17
16
  signal?: AbortSignal;
18
17
  }): Promise<ToolExecuteResponse>;
19
- }
20
- //#endregion
18
+ }
@@ -1,6 +1,6 @@
1
- import { c as transformProperties } from "../../FileToolModifier.utils.neutral-DWFpnsj2.mjs";
1
+ import { c as transformProperties } from "../../FileToolModifier.utils.neutral-BQP85ZJj.mjs";
2
2
 
3
- //#region src/utils/modifiers/FileToolModifier.workerd.ts
3
+ // src/utils/modifiers/FileToolModifier.workerd.ts
4
4
  const UNSUPPORTED_MESSAGE = "File upload/download modifiers are not available on edge runtimes yet. Please set `dangerouslyAllowAutoUploadDownloadFiles: false` (or unset it; it defaults to false) or run Composio in another JS runtime (Node.js / Bun).";
5
5
  var FileToolModifier = class {
6
6
  constructor(_client) {}
@@ -23,5 +23,4 @@ var FileToolModifier = class {
23
23
  }
24
24
  };
25
25
 
26
- //#endregion
27
26
  export { FileToolModifier };