@composio/core 0.10.0 → 0.12.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 (69) hide show
  1. package/dist/{tool.types-CwbAy9l_.d.cts → BaseProvider-BBnsv9kS.d.mts} +23683 -23635
  2. package/dist/CustomTool-DEB4BQPl.mjs +468 -0
  3. package/dist/{CustomTool-aber890o.d.cts → CustomTool-DH18rVQu.d.mts} +2 -4
  4. package/dist/{FileModifierErrors-C7z16Dfi.mjs → FileModifierErrors-3fSwIWoa.mjs} +35 -36
  5. package/dist/{FileToolModifier.utils.neutral-B7P7wn-b.mjs → FileToolModifier.utils.neutral-B5rT711M.mjs} +1 -7
  6. package/dist/{Telemetry-kgWlkavX.mjs → Telemetry-DhGI_J4G.mjs} +48 -23
  7. package/dist/{composio-CSMCZZgj.d.cts → composio-CHnEggnv.d.mts} +433 -435
  8. package/dist/{customTool.types-BzEWHa0w.d.cts → customTool.types-DpIdOJjL.d.mts} +177 -236
  9. package/dist/{CustomTool-D7-1S2at.mjs → errors-D5f4pfvI.mjs} +132 -519
  10. package/dist/experimental/index.d.mts +2 -3
  11. package/dist/experimental/index.mjs +1 -3
  12. package/dist/{fileUtils.node-Dq7ebZPC.mjs → fileUtils.node-BiO1JQsJ.mjs} +26 -25
  13. package/dist/index.d.mts +2034 -2356
  14. package/dist/index.mjs +2546 -2335
  15. package/dist/jsonSchema-daqF3S3d.mjs +251 -0
  16. package/dist/models/Files.node.d.mts +1 -2
  17. package/dist/models/Files.node.mjs +3 -4
  18. package/dist/models/Files.workerd.d.mts +0 -1
  19. package/dist/platform/node.d.mts +1 -2
  20. package/dist/platform/workerd.d.mts +1 -2
  21. package/dist/{chunk-CWQeghP5.mjs → rolldown-runtime-w6R9maHv.mjs} +3 -5
  22. package/dist/{types-DE7O6Z6S.d.cts → types-CaI5Z4PA.d.mts} +2 -3
  23. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -4
  24. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -4
  25. package/dist/utils/config-defaults/ConfigDefaults.workerd.mjs +3 -0
  26. package/dist/utils/json-schema.d.mts +2 -0
  27. package/dist/utils/json-schema.mjs +3 -0
  28. package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -1
  29. package/dist/utils/modifiers/FileToolModifier.node.mjs +81 -44
  30. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -1
  31. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
  32. package/package.json +48 -88
  33. package/dist/CustomTool-CQ_YjABZ.cjs +0 -1341
  34. package/dist/CustomTool-DJUGNOer.d.mts +0 -76
  35. package/dist/FileModifierErrors-BYJBHiay.cjs +0 -554
  36. package/dist/FileToolModifier.utils.neutral-Dfwqgimk.cjs +0 -102
  37. package/dist/Telemetry-Dm-0sewu.cjs +0 -335
  38. package/dist/buffer-BjWptbNH.cjs +0 -63
  39. package/dist/chunk-CQwRTUmo.cjs +0 -53
  40. package/dist/composio-DRl6WCI9.d.mts +0 -5484
  41. package/dist/customTool.types-CMOMgxoM.d.mts +0 -2513
  42. package/dist/experimental/index.cjs +0 -5
  43. package/dist/experimental/index.d.cts +0 -3
  44. package/dist/fileUtils.node-DtnSRMWa.cjs +0 -462
  45. package/dist/files.types-lo4zZd87.d.cts +0 -17
  46. package/dist/index.cjs +0 -8637
  47. package/dist/index.d.cts +0 -5672
  48. package/dist/models/Files.node.cjs +0 -55
  49. package/dist/models/Files.node.d.cts +0 -56
  50. package/dist/models/Files.workerd.cjs +0 -29
  51. package/dist/models/Files.workerd.d.cts +0 -13
  52. package/dist/platform/node.cjs +0 -55
  53. package/dist/platform/node.d.cts +0 -11
  54. package/dist/platform/workerd.cjs +0 -42
  55. package/dist/platform/workerd.d.cts +0 -12
  56. package/dist/tool.types-CB_4JKhV.d.mts +0 -29377
  57. package/dist/types-BTOPdg4d.d.mts +0 -13
  58. package/dist/types-pDNm1lYs.d.cts +0 -69
  59. package/dist/utils/config-defaults/ConfigDefaults.node.cjs +0 -10
  60. package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +0 -7
  61. package/dist/utils/config-defaults/ConfigDefaults.workerd.cjs +0 -10
  62. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +0 -7
  63. package/dist/utils/modifiers/FileToolModifier.node.cjs +0 -207
  64. package/dist/utils/modifiers/FileToolModifier.node.d.cts +0 -22
  65. package/dist/utils/modifiers/FileToolModifier.workerd.cjs +0 -27
  66. package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +0 -20
  67. /package/dist/{buffer-yOtEsT4J.mjs → buffer-PcbMMsgm.mjs} +0 -0
  68. /package/dist/{files.types-BXDWA_zS.d.mts → files.types-DeMC_mAW.d.mts} +0 -0
  69. /package/dist/{types-HpJQ8K9l.d.mts → types-DdoCRzLj.d.mts} +0 -0
@@ -1,13 +0,0 @@
1
- import { q as BaseComposioProvider } from "./tool.types-CB_4JKhV.mjs";
2
- import { n as ComposioConfig } from "./composio-DRl6WCI9.mjs";
3
-
4
- //#region src/utils/config-defaults/types.d.ts
5
-
6
- /**
7
- * Configuration defaults for Composio.
8
- * These are the required fields that must have default values.
9
- * The provider type is set to never since defaults don't include a provider instance.
10
- */
11
- type ConfigDefaults = Required<Pick<ComposioConfig<BaseComposioProvider<never, never, never>>, 'dangerouslyAllowAutoUploadDownloadFiles' | 'allowTracking' | 'toolkitVersions'>>;
12
- //#endregion
13
- export { ConfigDefaults as t };
@@ -1,69 +0,0 @@
1
- //#region src/platform/types.d.ts
2
- /**
3
- * Platform abstraction for file system and OS operations.
4
- * This interface allows different implementations for Node.js and edge runtimes (e.g., Cloudflare Workers).
5
- */
6
- interface Platform {
7
- /**
8
- * Returns the user's home directory path.
9
- * @returns The home directory path, or null if unavailable (e.g., in edge runtimes).
10
- */
11
- homedir(): string | null;
12
- /**
13
- * Joins path segments into a single path.
14
- * @param paths - Path segments to join.
15
- * @returns The joined path.
16
- */
17
- joinPath(...paths: string[]): string;
18
- /**
19
- * Resolves a sequence of paths into an absolute path. On Node this is
20
- * `path.resolve`; on edge runtimes without a working directory it
21
- * normalizes/joins the segments and returns the result verbatim.
22
- */
23
- resolvePath(...paths: string[]): string;
24
- /**
25
- * Returns true if the given path is absolute.
26
- */
27
- isAbsolutePath(filePath: string): boolean;
28
- /**
29
- * Returns the last portion of a path (the filename).
30
- * @param filePath - The path to extract the basename from.
31
- * @returns The basename of the path.
32
- */
33
- basename(filePath: string): string;
34
- /**
35
- * Checks if a file or directory exists at the given path.
36
- * @param filePath - The path to check.
37
- * @returns True if the path exists, false otherwise.
38
- */
39
- existsSync(filePath: string): boolean;
40
- /**
41
- * Creates a directory at the given path, including parent directories if needed.
42
- * @param dirPath - The directory path to create.
43
- */
44
- mkdirSync(dirPath: string): void;
45
- /**
46
- * Reads a file synchronously and returns its contents.
47
- * @param filePath - The path to the file.
48
- * @param encoding - Optional encoding (e.g., 'utf8'). If not provided, returns an Uint8Array.
49
- * @returns The file contents as a string (if encoding provided) or Uint8Array.
50
- */
51
- readFileSync(filePath: string, encoding?: never): Uint8Array;
52
- readFileSync(filePath: string, encoding: Uint8ArrayEncoding): string;
53
- /**
54
- * Writes content to a file synchronously.
55
- * @param filePath - The path to the file.
56
- * @param content - The content to write (string or Uint8Array).
57
- * @param encoding - Optional encoding for string content.
58
- */
59
- writeFileSync(filePath: string, content: Uint8Array, encoding?: never): void;
60
- writeFileSync(filePath: string, content: string, encoding: Uint8ArrayEncoding): void;
61
- /**
62
- * Indicates whether this platform supports file system operations.
63
- * Edge runtimes like Cloudflare Workers return false.
64
- */
65
- readonly supportsFileSystem: boolean;
66
- }
67
- type Uint8ArrayEncoding = 'utf8';
68
- //#endregion
69
- export { Platform as t };
@@ -1,10 +0,0 @@
1
-
2
- //#region src/utils/config-defaults/ConfigDefaults.node.ts
3
- const CONFIG_DEFAULTS = {
4
- dangerouslyAllowAutoUploadDownloadFiles: false,
5
- allowTracking: true,
6
- toolkitVersions: "latest"
7
- };
8
-
9
- //#endregion
10
- exports.CONFIG_DEFAULTS = CONFIG_DEFAULTS;
@@ -1,7 +0,0 @@
1
- import "../../composio-CSMCZZgj.cjs";
2
- import { t as ConfigDefaults } from "../../types-DE7O6Z6S.cjs";
3
-
4
- //#region src/utils/config-defaults/ConfigDefaults.node.d.ts
5
- declare const CONFIG_DEFAULTS: ConfigDefaults;
6
- //#endregion
7
- export { CONFIG_DEFAULTS };
@@ -1,10 +0,0 @@
1
-
2
- //#region src/utils/config-defaults/ConfigDefaults.workerd.ts
3
- const CONFIG_DEFAULTS = {
4
- dangerouslyAllowAutoUploadDownloadFiles: false,
5
- allowTracking: true,
6
- toolkitVersions: "latest"
7
- };
8
-
9
- //#endregion
10
- exports.CONFIG_DEFAULTS = CONFIG_DEFAULTS;
@@ -1,7 +0,0 @@
1
- import "../../composio-CSMCZZgj.cjs";
2
- import { t as ConfigDefaults } from "../../types-DE7O6Z6S.cjs";
3
-
4
- //#region src/utils/config-defaults/ConfigDefaults.workerd.d.ts
5
- declare const CONFIG_DEFAULTS: ConfigDefaults;
6
- //#endregion
7
- export { CONFIG_DEFAULTS };
@@ -1,207 +0,0 @@
1
- const require_FileModifierErrors = require('../../FileModifierErrors-BYJBHiay.cjs');
2
- const require_FileToolModifier_utils_neutral = require('../../FileToolModifier.utils.neutral-Dfwqgimk.cjs');
3
- const require_fileUtils_node = require('../../fileUtils.node-DtnSRMWa.cjs');
4
-
5
- //#region src/utils/modifiers/FileToolModifier.node.ts
6
- /**
7
- * Recursively walks a runtime value and its matching JSON-Schema node,
8
- * uploading any string path whose schema node has `file_uploadable: true`.
9
- * The function returns a **new** value with all substitutions applied;
10
- * nothing is mutated in-place.
11
- */
12
- const hydrateFiles = async (value, schema, ctx) => {
13
- if (schema?.file_uploadable) {
14
- if (typeof value !== "string" && !(value instanceof File)) return value;
15
- const runBeforeFileUpload = async (path, source) => {
16
- if (!ctx.beforeFileUpload) return path;
17
- const out = await ctx.beforeFileUpload({
18
- path,
19
- source,
20
- toolSlug: ctx.toolSlug,
21
- toolkitSlug: ctx.toolkitSlug
22
- });
23
- if (out === false) throw new require_FileModifierErrors.ComposioFileUploadAbortedError("File upload was aborted because beforeFileUpload returned false.");
24
- return out;
25
- };
26
- if (typeof value === "string") {
27
- const pathOrUrl = await runBeforeFileUpload(value, value.startsWith("http") ? "url" : "path");
28
- require_FileModifierErrors.logger_default.debug(`Uploading file "${pathOrUrl}"`);
29
- return require_fileUtils_node.getFileDataAfterUploadingToS3(pathOrUrl, {
30
- toolSlug: ctx.toolSlug,
31
- toolkitSlug: ctx.toolkitSlug,
32
- client: ctx.client,
33
- sensitiveFileUploadProtection: ctx.sensitiveFileUploadProtection,
34
- fileUploadPathDenySegments: ctx.fileUploadPathDenySegments,
35
- fileUploadAllowlist: ctx.fileUploadAllowlist
36
- });
37
- }
38
- if (ctx.beforeFileUpload) {
39
- const out = await ctx.beforeFileUpload({
40
- path: value.name,
41
- source: "file",
42
- toolSlug: ctx.toolSlug,
43
- toolkitSlug: ctx.toolkitSlug
44
- });
45
- if (out === false) throw new require_FileModifierErrors.ComposioFileUploadAbortedError("File upload was aborted because beforeFileUpload returned false.");
46
- if (typeof out === "string" && out !== value.name) {
47
- require_FileModifierErrors.logger_default.debug(`Uploading file from path "${out}" (replaced File: ${value.name})`);
48
- return require_fileUtils_node.getFileDataAfterUploadingToS3(out, {
49
- toolSlug: ctx.toolSlug,
50
- toolkitSlug: ctx.toolkitSlug,
51
- client: ctx.client,
52
- sensitiveFileUploadProtection: ctx.sensitiveFileUploadProtection,
53
- fileUploadPathDenySegments: ctx.fileUploadPathDenySegments,
54
- fileUploadAllowlist: ctx.fileUploadAllowlist
55
- });
56
- }
57
- }
58
- require_FileModifierErrors.logger_default.debug(`Uploading file "${value.name}"`);
59
- return require_fileUtils_node.getFileDataAfterUploadingToS3(value, {
60
- toolSlug: ctx.toolSlug,
61
- toolkitSlug: ctx.toolkitSlug,
62
- client: ctx.client,
63
- sensitiveFileUploadProtection: ctx.sensitiveFileUploadProtection,
64
- fileUploadPathDenySegments: ctx.fileUploadPathDenySegments
65
- });
66
- }
67
- const schemaVariants = [
68
- ...schema?.anyOf ?? [],
69
- ...schema?.oneOf ?? [],
70
- ...schema?.allOf ?? []
71
- ];
72
- if (schemaVariants.length > 0) {
73
- const firstUploadableVariant = schemaVariants.find(require_FileToolModifier_utils_neutral.schemaHasFileUploadable);
74
- if (firstUploadableVariant) return hydrateFiles(value, firstUploadableVariant, ctx);
75
- }
76
- if (schema?.type === "object" && schema.properties && require_FileToolModifier_utils_neutral.isPlainObject(value)) {
77
- const transformed = {};
78
- for (const [k, v] of Object.entries(value)) transformed[k] = await hydrateFiles(v, schema.properties[k], ctx);
79
- return transformed;
80
- }
81
- if (schema?.type === "array" && schema.items && Array.isArray(value)) {
82
- const itemSchema = Array.isArray(schema.items) ? schema.items[0] : schema.items;
83
- return Promise.all(value.map((item) => hydrateFiles(item, itemSchema, ctx)));
84
- }
85
- return value;
86
- };
87
- /**
88
- * Downloads a file from S3 and returns a replacement object.
89
- */
90
- const downloadS3File = async (value, ctx) => {
91
- const { s3url, mimetype } = value;
92
- try {
93
- require_FileModifierErrors.logger_default.debug(`Downloading from S3: ${s3url}`);
94
- const dl = await require_fileUtils_node.downloadFileFromS3({
95
- toolSlug: ctx.toolSlug,
96
- s3Url: s3url,
97
- mimeType: mimetype ?? "application/octet-stream",
98
- fileDownloadDir: ctx.fileDownloadDir
99
- });
100
- require_FileModifierErrors.logger_default.debug(`Downloaded → ${dl.filePath}`);
101
- return {
102
- uri: dl.filePath,
103
- file_downloaded: dl.filePath ? true : false,
104
- s3url,
105
- mimeType: dl.mimeType
106
- };
107
- } catch (err) {
108
- require_FileModifierErrors.logger_default.error(`Download failed: ${s3url}`, { cause: err });
109
- return {
110
- uri: "",
111
- file_downloaded: false,
112
- s3url,
113
- mimeType: mimetype ?? "application/octet-stream"
114
- };
115
- }
116
- };
117
- /**
118
- * Recursively walks an arbitrary value and its matching JSON-Schema node.
119
- * Whenever it encounters an object that represents a file reference
120
- * (i.e. has an `s3url`), it downloads the file and returns a replacement:
121
- * {
122
- * uri: "<local-path>",
123
- * file_downloaded: true | false,
124
- * s3url: "<original S3 URL>",
125
- * mimeType: "<detected-or-fallback-mime-type>"
126
- * }
127
- *
128
- * The function is side-effect-free: it never mutates the input value.
129
- */
130
- const hydrateDownloads = async (value, schema, ctx) => {
131
- if (require_FileToolModifier_utils_neutral.isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
132
- if (schema?.file_downloadable && require_FileToolModifier_utils_neutral.isPlainObject(value) && typeof value.s3url === "string") return downloadS3File(value, ctx);
133
- const schemaVariants = [
134
- ...schema?.anyOf ?? [],
135
- ...schema?.oneOf ?? [],
136
- ...schema?.allOf ?? []
137
- ];
138
- if (schemaVariants.length > 0) {
139
- const downloadableVariants = schemaVariants.filter(require_FileToolModifier_utils_neutral.schemaHasFileDownloadable);
140
- let result = value;
141
- for (const variant of downloadableVariants) result = await hydrateDownloads(result, variant, ctx);
142
- if (downloadableVariants.length === 0) return hydrateDownloads(value, void 0, ctx);
143
- return result;
144
- }
145
- if (require_FileToolModifier_utils_neutral.isPlainObject(value)) {
146
- const pairs = await Promise.all(Object.entries(value).map(async ([k, v]) => [k, await hydrateDownloads(v, schema?.properties?.[k], ctx)]));
147
- return Object.fromEntries(pairs);
148
- }
149
- if (Array.isArray(value)) {
150
- const itemSchema = schema?.items ? Array.isArray(schema.items) ? schema.items[0] : schema.items : void 0;
151
- return Promise.all(value.map((item) => hydrateDownloads(item, itemSchema, ctx)));
152
- }
153
- return value;
154
- };
155
- var FileToolModifier = class {
156
- client;
157
- fileUploadPathOptions;
158
- constructor(client, fileUploadPathOptions = {}) {
159
- this.client = client;
160
- this.fileUploadPathOptions = fileUploadPathOptions;
161
- }
162
- async modifyToolSchema(schema) {
163
- if (!schema.inputParameters?.properties) return schema;
164
- const properties = require_FileToolModifier_utils_neutral.transformProperties(schema.inputParameters.properties);
165
- return {
166
- ...schema,
167
- inputParameters: {
168
- ...schema.inputParameters,
169
- properties
170
- }
171
- };
172
- }
173
- async fileUploadModifier(tool, options) {
174
- const { params, toolSlug, toolkitSlug = "unknown" } = options;
175
- const { arguments: args } = params;
176
- if (!args || typeof args !== "object") return params;
177
- try {
178
- const newArgs = await hydrateFiles(args, tool.inputParameters, {
179
- toolSlug,
180
- toolkitSlug,
181
- client: this.client,
182
- ...this.fileUploadPathOptions
183
- });
184
- return {
185
- ...params,
186
- arguments: newArgs
187
- };
188
- } catch (error) {
189
- if (error instanceof require_FileModifierErrors.ComposioSensitiveFilePathBlockedError || error instanceof require_FileModifierErrors.ComposioFileUploadAbortedError || error instanceof require_FileModifierErrors.ComposioFileUploadPathNotAllowedError || error instanceof require_FileModifierErrors.ComposioFileNotFoundError) throw error;
190
- throw new require_FileModifierErrors.ComposioFileUploadError("Failed to upload file", { cause: error });
191
- }
192
- }
193
- async fileDownloadModifier(tool, options) {
194
- const { result, toolSlug } = options;
195
- const dataWithDownloads = await hydrateDownloads(result.data, tool.outputParameters, {
196
- toolSlug,
197
- fileDownloadDir: this.fileUploadPathOptions.fileDownloadDir
198
- });
199
- return {
200
- ...result,
201
- data: dataWithDownloads
202
- };
203
- }
204
- };
205
-
206
- //#endregion
207
- exports.FileToolModifier = FileToolModifier;
@@ -1,22 +0,0 @@
1
- import { d as ToolExecuteResponse, l as ToolExecuteParams, o as Tool } from "../../tool.types-CwbAy9l_.cjs";
2
- import ComposioClient from "@composio/client";
3
-
4
- //#region src/utils/modifiers/FileToolModifier.node.d.ts
5
- declare class FileToolModifier {
6
- private client;
7
- private fileUploadPathOptions;
8
- constructor(client: ComposioClient, fileUploadPathOptions?: FileToolModifier['fileUploadPathOptions']);
9
- modifyToolSchema(schema: Tool): Promise<Tool>;
10
- fileUploadModifier(tool: Tool, options: {
11
- toolSlug: string;
12
- toolkitSlug?: string;
13
- params: ToolExecuteParams;
14
- }): Promise<ToolExecuteParams>;
15
- fileDownloadModifier(tool: Tool, options: {
16
- toolSlug: string;
17
- toolkitSlug: string;
18
- result: ToolExecuteResponse;
19
- }): Promise<ToolExecuteResponse>;
20
- }
21
- //#endregion
22
- export { FileToolModifier };
@@ -1,27 +0,0 @@
1
- const require_FileToolModifier_utils_neutral = require('../../FileToolModifier.utils.neutral-Dfwqgimk.cjs');
2
-
3
- //#region src/utils/modifiers/FileToolModifier.workerd.ts
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
- var FileToolModifier = class {
6
- constructor(_client) {}
7
- async modifyToolSchema(schema) {
8
- if (!schema.inputParameters?.properties) return schema;
9
- const properties = require_FileToolModifier_utils_neutral.transformProperties(schema.inputParameters.properties);
10
- return {
11
- ...schema,
12
- inputParameters: {
13
- ...schema.inputParameters,
14
- properties
15
- }
16
- };
17
- }
18
- async fileUploadModifier(_tool, _options) {
19
- throw new Error(UNSUPPORTED_MESSAGE);
20
- }
21
- async fileDownloadModifier(_tool, _options) {
22
- throw new Error(UNSUPPORTED_MESSAGE);
23
- }
24
- };
25
-
26
- //#endregion
27
- exports.FileToolModifier = FileToolModifier;
@@ -1,20 +0,0 @@
1
- import { d as ToolExecuteResponse, l as ToolExecuteParams, o as Tool } from "../../tool.types-CwbAy9l_.cjs";
2
- import ComposioClient from "@composio/client";
3
-
4
- //#region src/utils/modifiers/FileToolModifier.workerd.d.ts
5
- declare class FileToolModifier {
6
- constructor(_client: ComposioClient);
7
- modifyToolSchema(schema: Tool): Promise<Tool>;
8
- fileUploadModifier(_tool: Tool, _options: {
9
- toolSlug: string;
10
- toolkitSlug?: string;
11
- params: ToolExecuteParams;
12
- }): Promise<ToolExecuteParams>;
13
- fileDownloadModifier(_tool: Tool, _options: {
14
- toolSlug: string;
15
- toolkitSlug: string;
16
- result: ToolExecuteResponse;
17
- }): Promise<ToolExecuteResponse>;
18
- }
19
- //#endregion
20
- export { FileToolModifier };