@composio/core 0.27.0 → 0.28.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 (47) hide show
  1. package/dist/{CustomTool-CqPoLUD6.d.mts → CustomTool-DyypijT6.d.mts} +2 -2
  2. package/dist/{Telemetry-41JkqpZ7.mjs → Telemetry-D2PJwXKx.mjs} +1 -1
  3. package/dist/{composio-BUa10iB3.d.mts → composio-CwHMpKXb.d.mts} +704 -26
  4. package/dist/{customTool.types-gX421uPT.d.mts → customTool.types-DoItUHkO.d.mts} +11 -10
  5. package/dist/docs/reference/sdk-reference/typescript/session.mdx +3 -3
  6. package/dist/experimental/index.d.mts +2 -2
  7. package/dist/{fileUtils.node-DNLhLg0W.mjs → fileUtils.node-ILI1IjnZ.mjs} +4 -3
  8. package/dist/index.d.mts +4 -4
  9. package/dist/index.mjs +2107 -1977
  10. package/dist/models/Files.node.mjs +2 -2
  11. package/dist/sensitiveFileUploadPaths-BaEORC7-.mjs +588 -0
  12. package/dist/{types-DXxfzBX3.d.mts → types-DWZWePfZ.d.mts} +2 -2
  13. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  14. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  15. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  16. package/dist/utils/modifiers/FileToolModifier.node.mjs +1 -1
  17. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  18. package/package.json +7 -6
  19. package/src/lib/toolRouterParams.ts +28 -33
  20. package/src/lib/toolRouterSessionDelete.ts +1 -10
  21. package/src/models/ConnectedAccounts.ts +1 -1
  22. package/src/models/CustomTool.ts +1 -1
  23. package/src/models/CustomToolkits.ts +114 -8
  24. package/src/models/Experimental.ts +1 -1
  25. package/src/models/MCP.ts +1 -2
  26. package/src/models/SessionConfigs.ts +11 -3
  27. package/src/models/SessionContext.ts +4 -4
  28. package/src/models/ToolRouter.ts +2 -3
  29. package/src/models/ToolRouterSession.ts +17 -16
  30. package/src/models/Tools.ts +3 -3
  31. package/src/models/Triggers.ts +12 -5
  32. package/src/models/inlineCustomToolsPayload.ts +3 -3
  33. package/src/models/proxyParamsTransform.ts +1 -1
  34. package/src/types/customTool.types.ts +13 -5
  35. package/src/types/customToolkits.types.ts +89 -9
  36. package/src/types/sessionConfigs.types.ts +21 -7
  37. package/src/types/toolRouter.types.ts +14 -7
  38. package/src/types/triggers.types.ts +14 -0
  39. package/src/utils/fileUtils.node.ts +5 -2
  40. package/src/utils/mime.ts +347 -1
  41. package/src/utils/transformers/connectedAccounts.ts +2 -7
  42. package/src/utils/transformers/customToolkits.ts +78 -9
  43. package/src/utils/transformers/sessionConfigs.ts +3 -3
  44. package/src/utils/transformers/toolRouterResponseTransform.ts +23 -75
  45. package/src/utils/transformers/toolkits.ts +7 -13
  46. package/src/utils/transformers/triggers.ts +28 -18
  47. package/dist/sensitiveFileUploadPaths-BlLp-Yo2.mjs +0 -189
@@ -1,5 +1,5 @@
1
- import { t as telemetry } from "../Telemetry-41JkqpZ7.mjs";
2
- import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-DNLhLg0W.mjs";
1
+ import { t as telemetry } from "../Telemetry-D2PJwXKx.mjs";
2
+ import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-ILI1IjnZ.mjs";
3
3
 
4
4
  //#region src/models/Files.node.ts
5
5
  var Files = class {
@@ -0,0 +1,588 @@
1
+ import { a as ComposioSensitiveFilePathBlockedError } from "./FileModifierErrors-CdGSABoq.mjs";
2
+ import { platform } from "#platform";
3
+
4
+ //#region src/utils/uuid.ts
5
+ function getRandomUUID() {
6
+ return globalThis.crypto.randomUUID();
7
+ }
8
+ function getRandomShortId() {
9
+ return getRandomUUID().slice(0, 8).replace(/-/g, "");
10
+ }
11
+
12
+ //#endregion
13
+ //#region src/utils/buffer.ts
14
+ /**
15
+ * Convert ArrayBuffer to base64.
16
+ */
17
+ function arrayBufferToBase64(buffer) {
18
+ const bytes = new Uint8Array(buffer);
19
+ let binary = "";
20
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
21
+ return btoa(binary);
22
+ }
23
+ const base64ToUint8Array = (base64) => {
24
+ const binary = atob(base64);
25
+ const bytes = new Uint8Array(binary.length);
26
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
27
+ return bytes;
28
+ };
29
+ const uint8ArrayToBase64 = (bytes) => {
30
+ let binary = "";
31
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
32
+ return btoa(binary);
33
+ };
34
+
35
+ //#endregion
36
+ //#region src/utils/readResponseBody.ts
37
+ /** Maximum size accepted for files fetched from user-supplied URLs (100 MiB). */
38
+ const MAX_URL_UPLOAD_SIZE_BYTES = 104857600;
39
+ const sizeLimitError = (actualSize, maxBytes) => /* @__PURE__ */ new Error(`File size (${actualSize} bytes) exceeds maximum allowed size (${maxBytes} bytes)`);
40
+ /**
41
+ * Read a fetch response without allowing an untrusted server to exhaust memory.
42
+ *
43
+ * `Content-Length` is checked as an early rejection, but the streamed byte
44
+ * count is authoritative because the header can be absent or dishonest.
45
+ */
46
+ const readResponseBodyWithLimit = async (response, maxBytes = MAX_URL_UPLOAD_SIZE_BYTES) => {
47
+ if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) throw new RangeError("maxBytes must be a non-negative safe integer");
48
+ const contentLength = response.headers.get("content-length")?.trim();
49
+ if (contentLength && /^\d+$/.test(contentLength)) {
50
+ const declaredSize = Number(contentLength);
51
+ if (!Number.isSafeInteger(declaredSize) || declaredSize > maxBytes) {
52
+ const error = sizeLimitError(declaredSize, maxBytes);
53
+ await response.body?.cancel(error).catch(() => void 0);
54
+ throw error;
55
+ }
56
+ }
57
+ if (!response.body) return /* @__PURE__ */ new Uint8Array();
58
+ const reader = response.body.getReader();
59
+ const chunks = [];
60
+ let totalBytes = 0;
61
+ try {
62
+ while (true) {
63
+ const { done, value } = await reader.read();
64
+ if (done) break;
65
+ if (!value || value.byteLength === 0) continue;
66
+ totalBytes += value.byteLength;
67
+ if (totalBytes > maxBytes) {
68
+ await reader.cancel(sizeLimitError(totalBytes, maxBytes));
69
+ throw sizeLimitError(totalBytes, maxBytes);
70
+ }
71
+ chunks.push(value);
72
+ }
73
+ } finally {
74
+ reader.releaseLock();
75
+ }
76
+ const body = new Uint8Array(totalBytes);
77
+ let offset = 0;
78
+ for (const chunk of chunks) {
79
+ body.set(chunk, offset);
80
+ offset += chunk.byteLength;
81
+ }
82
+ return body;
83
+ };
84
+
85
+ //#endregion
86
+ //#region src/utils/mime.ts
87
+ /**
88
+ * Maps MIME types to file extensions.
89
+ * Used when deriving filenames from content-type headers (e.g. for URLs without path segments).
90
+ */
91
+ function getExtensionFromMimeType(mimeType) {
92
+ const mimeToExt = {
93
+ "text/plain": "txt",
94
+ "text/html": "html",
95
+ "text/css": "css",
96
+ "text/csv": "csv",
97
+ "text/javascript": "js",
98
+ "application/json": "json",
99
+ "application/xml": "xml",
100
+ "application/pdf": "pdf",
101
+ "application/zip": "zip",
102
+ "application/x-zip-compressed": "zip",
103
+ "application/gzip": "gz",
104
+ "application/octet-stream": "bin",
105
+ "application/x-tar": "tar",
106
+ "application/msword": "doc",
107
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
108
+ "application/vnd.ms-excel": "xls",
109
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
110
+ "application/vnd.ms-powerpoint": "ppt",
111
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
112
+ "image/jpeg": "jpg",
113
+ "image/jpg": "jpg",
114
+ "image/png": "png",
115
+ "image/gif": "gif",
116
+ "image/svg+xml": "svg",
117
+ "image/webp": "webp",
118
+ "image/bmp": "bmp",
119
+ "image/tiff": "tiff",
120
+ "audio/mpeg": "mp3",
121
+ "audio/wav": "wav",
122
+ "audio/ogg": "ogg",
123
+ "video/mp4": "mp4",
124
+ "video/mpeg": "mpeg",
125
+ "video/quicktime": "mov",
126
+ "video/x-msvideo": "avi",
127
+ "video/webm": "webm"
128
+ };
129
+ const cleanMimeType = mimeType.split(";")[0].toLowerCase().trim();
130
+ if (Object.hasOwn(mimeToExt, cleanMimeType)) return mimeToExt[cleanMimeType];
131
+ const parts = cleanMimeType.split("/");
132
+ if (parts.length === 2) {
133
+ const subtype = parts[1].toLowerCase();
134
+ if (subtype.includes("+")) {
135
+ const plusParts = subtype.split("+");
136
+ const prefix = plusParts[0];
137
+ const suffix = plusParts[plusParts.length - 1];
138
+ if ([
139
+ "svg",
140
+ "atom",
141
+ "rss"
142
+ ].includes(prefix)) return prefix;
143
+ if ([
144
+ "json",
145
+ "xml",
146
+ "yaml",
147
+ "zip",
148
+ "gzip"
149
+ ].includes(suffix)) return suffix;
150
+ return suffix;
151
+ }
152
+ return subtype || "txt";
153
+ }
154
+ return "bin";
155
+ }
156
+ const DEFAULT_MIME_TYPE = "application/octet-stream";
157
+ const MIME_TYPES_BY_EXTENSION = {
158
+ "3g2": "video/3gpp2",
159
+ "3gp": "video/3gpp",
160
+ "3gpp": "video/3gpp",
161
+ "7z": "application/x-7z-compressed",
162
+ aab: "application/x-authorware-bin",
163
+ aac: "audio/aac",
164
+ aam: "application/x-authorware-map",
165
+ aas: "application/x-authorware-seg",
166
+ adts: "audio/aac",
167
+ ai: "application/postscript",
168
+ aif: "audio/x-aiff",
169
+ aifc: "audio/x-aiff",
170
+ aiff: "audio/x-aiff",
171
+ arc: "application/x-freearc",
172
+ arj: "application/x-arj",
173
+ asf: "video/x-ms-asf",
174
+ asm: "text/x-asm",
175
+ asx: "video/x-ms-asf",
176
+ au: "audio/basic",
177
+ avi: "video/x-msvideo",
178
+ avif: "image/avif",
179
+ bat: "application/x-msdownload",
180
+ bcpio: "application/x-bcpio",
181
+ bmp: "image/bmp",
182
+ book: "application/vnd.framemaker",
183
+ boz: "application/x-bzip2",
184
+ bz: "application/x-bzip",
185
+ bz2: "application/x-bzip2",
186
+ c: "text/x-c",
187
+ cat: "application/vnd.ms-pki.seccat",
188
+ cc: "text/x-c",
189
+ cco: "application/x-cocoa",
190
+ cdf: "application/x-netcdf",
191
+ cer: "application/pkix-cert",
192
+ chat: "application/x-chat",
193
+ class: "application/java-vm",
194
+ com: "application/x-msdownload",
195
+ conf: "text/plain",
196
+ cpio: "application/x-cpio",
197
+ cpp: "text/x-c",
198
+ cpt: "application/mac-compactpro",
199
+ crl: "application/pkix-crl",
200
+ crt: "application/x-x509-ca-cert",
201
+ csh: "application/x-csh",
202
+ css: "text/css",
203
+ csv: "text/csv",
204
+ cxx: "text/x-c",
205
+ dcr: "application/x-director",
206
+ def: "text/plain",
207
+ der: "application/x-x509-ca-cert",
208
+ dir: "application/x-director",
209
+ doc: "application/msword",
210
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
211
+ dot: "application/msword",
212
+ dp: "application/vnd.osgi.dp",
213
+ dvi: "application/x-dvi",
214
+ dwf: "model/vnd.dwf",
215
+ dwg: "image/vnd.dwg",
216
+ dxf: "image/vnd.dxf",
217
+ dxr: "application/x-director",
218
+ eml: "message/rfc822",
219
+ eot: "application/vnd.ms-fontobject",
220
+ eps: "application/postscript",
221
+ epub: "application/epub+zip",
222
+ etx: "text/x-setext",
223
+ evy: "application/x-envoy",
224
+ f: "text/x-fortran",
225
+ f77: "text/x-fortran",
226
+ f90: "text/x-fortran",
227
+ fdf: "application/fdf",
228
+ flac: "audio/x-flac",
229
+ fli: "video/x-fli",
230
+ flo: "application/vnd.micrografx.flo",
231
+ flx: "text/vnd.fmi.flexstor",
232
+ for: "text/x-fortran",
233
+ fpx: "image/vnd.fpx",
234
+ g3: "image/g3fax",
235
+ gif: "image/gif",
236
+ gtar: "application/x-gtar",
237
+ gz: "application/gzip",
238
+ h: "text/x-c",
239
+ hdf: "application/x-hdf",
240
+ heic: "image/heic",
241
+ heif: "image/heif",
242
+ hh: "text/x-c",
243
+ hlp: "application/winhlp",
244
+ hpgl: "application/vnd.hp-hpgl",
245
+ hqx: "application/mac-binhex40",
246
+ htc: "text/x-component",
247
+ htm: "text/html",
248
+ html: "text/html",
249
+ ice: "x-conference/x-cooltalk",
250
+ ico: "image/vnd.microsoft.icon",
251
+ ics: "text/calendar",
252
+ ief: "image/ief",
253
+ iges: "model/iges",
254
+ igs: "model/iges",
255
+ jam: "application/vnd.jam",
256
+ java: "text/x-java-source",
257
+ jfif: "image/pjpeg",
258
+ jpe: "image/jpeg",
259
+ jpeg: "image/jpeg",
260
+ jpg: "image/jpeg",
261
+ js: "text/javascript",
262
+ json: "application/json",
263
+ kar: "audio/midi",
264
+ key: "application/vnd.apple.keynote",
265
+ latex: "application/x-latex",
266
+ lha: "application/x-lzh-compressed",
267
+ list: "text/plain",
268
+ log: "text/plain",
269
+ lzh: "application/x-lzh-compressed",
270
+ m1v: "video/mpeg",
271
+ m2a: "audio/mpeg",
272
+ m2v: "video/mpeg",
273
+ m3u: "audio/x-mpegurl",
274
+ m3u8: "application/vnd.apple.mpegurl",
275
+ m4a: "audio/mp4",
276
+ man: "text/troff",
277
+ map: "application/json",
278
+ mcd: "application/vnd.mcd",
279
+ md: "text/markdown",
280
+ me: "text/troff",
281
+ mht: "message/rfc822",
282
+ mhtml: "message/rfc822",
283
+ mid: "audio/midi",
284
+ midi: "audio/midi",
285
+ mif: "application/vnd.mif",
286
+ mime: "message/rfc822",
287
+ mjs: "text/javascript",
288
+ mka: "audio/x-matroska",
289
+ mkv: "video/x-matroska",
290
+ mov: "video/quicktime",
291
+ movie: "video/x-sgi-movie",
292
+ mp2: "audio/mpeg",
293
+ mp3: "audio/mpeg",
294
+ mp4: "video/mp4",
295
+ mpc: "application/vnd.mophun.certificate",
296
+ mpe: "video/mpeg",
297
+ mpeg: "video/mpeg",
298
+ mpg: "video/mpeg",
299
+ mpga: "audio/mpeg",
300
+ mpp: "application/dash-patch+xml",
301
+ mpt: "application/vnd.ms-project",
302
+ mrc: "application/marc",
303
+ ms: "text/troff",
304
+ nc: "application/x-netcdf",
305
+ nsc: "application/x-conference",
306
+ numbers: "application/vnd.apple.numbers",
307
+ obj: "model/obj",
308
+ oda: "application/oda",
309
+ odg: "application/vnd.oasis.opendocument.graphics",
310
+ odp: "application/vnd.oasis.opendocument.presentation",
311
+ ods: "application/vnd.oasis.opendocument.spreadsheet",
312
+ odt: "application/vnd.oasis.opendocument.text",
313
+ ogg: "audio/ogg",
314
+ opus: "audio/ogg",
315
+ otf: "font/otf",
316
+ p: "text/x-pascal",
317
+ p10: "application/pkcs10",
318
+ p12: "application/x-pkcs12",
319
+ p7c: "application/pkcs7-mime",
320
+ p7m: "application/pkcs7-mime",
321
+ p7r: "application/x-pkcs7-certreqresp",
322
+ p7s: "application/pkcs7-signature",
323
+ pages: "application/vnd.apple.pages",
324
+ pas: "text/x-pascal",
325
+ pbm: "image/x-portable-bitmap",
326
+ pcl: "application/vnd.hp-pcl",
327
+ pct: "image/x-pict",
328
+ pcx: "image/vnd.zbrush.pcx",
329
+ pdb: "application/vnd.palm",
330
+ pdf: "application/pdf",
331
+ pfx: "application/x-pkcs12",
332
+ pgm: "image/x-portable-graymap",
333
+ pic: "image/x-pict",
334
+ pl: "application/x-perl",
335
+ pm: "application/x-perl",
336
+ png: "image/png",
337
+ pnm: "image/x-portable-anymap",
338
+ pot: "application/vnd.ms-powerpoint",
339
+ ppm: "image/x-portable-pixmap",
340
+ pps: "application/vnd.ms-powerpoint",
341
+ ppt: "application/vnd.ms-powerpoint",
342
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
343
+ pre: "application/vnd.lotus-freelance",
344
+ ps: "application/postscript",
345
+ psd: "image/vnd.adobe.photoshop",
346
+ pyo: "model/vnd.pytha.pyox",
347
+ qt: "video/quicktime",
348
+ ra: "audio/x-pn-realaudio",
349
+ ram: "audio/x-pn-realaudio",
350
+ rar: "application/vnd.rar",
351
+ ras: "image/x-cmu-raster",
352
+ rdf: "application/rdf+xml",
353
+ rgb: "image/x-rgb",
354
+ rm: "application/vnd.rn-realmedia",
355
+ rmi: "audio/midi",
356
+ rmp: "audio/x-pn-realaudio-plugin",
357
+ rng: "application/xml",
358
+ roff: "text/troff",
359
+ rpm: "application/x-redhat-package-manager",
360
+ rtf: "application/rtf",
361
+ rtx: "text/richtext",
362
+ s: "text/x-asm",
363
+ s3m: "audio/s3m",
364
+ scm: "application/vnd.lotus-screencam",
365
+ sdp: "application/sdp",
366
+ sea: "application/x-sea",
367
+ sgm: "text/sgml",
368
+ sgml: "text/sgml",
369
+ sh: "application/x-sh",
370
+ shar: "application/x-shar",
371
+ shtml: "text/html",
372
+ sid: "image/x-mrsid-image",
373
+ sit: "application/x-stuffit",
374
+ skd: "application/vnd.koan",
375
+ skm: "application/vnd.koan",
376
+ skp: "application/vnd.koan",
377
+ skt: "application/vnd.koan",
378
+ smi: "application/smil+xml",
379
+ smil: "application/smil+xml",
380
+ snd: "audio/basic",
381
+ spc: "application/x-pkcs7-certificates",
382
+ spl: "application/x-futuresplash",
383
+ src: "application/x-wais-source",
384
+ step: "model/step",
385
+ stl: "model/stl",
386
+ stp: "model/step",
387
+ sv4cpio: "application/x-sv4cpio",
388
+ sv4crc: "application/x-sv4crc",
389
+ svg: "image/svg+xml",
390
+ swf: "application/x-shockwave-flash",
391
+ t: "text/troff",
392
+ tar: "application/x-tar",
393
+ tcl: "application/x-tcl",
394
+ tex: "application/x-tex",
395
+ texi: "application/x-texinfo",
396
+ texinfo: "application/x-texinfo",
397
+ text: "text/plain",
398
+ tif: "image/tiff",
399
+ tiff: "image/tiff",
400
+ tr: "text/troff",
401
+ ts: "video/mp2t",
402
+ tsv: "text/tab-separated-values",
403
+ txt: "text/plain",
404
+ uri: "text/uri-list",
405
+ uris: "text/uri-list",
406
+ ustar: "application/x-ustar",
407
+ uu: "text/x-uuencode",
408
+ vcd: "application/x-cdlink",
409
+ vcf: "text/x-vcard",
410
+ vcs: "text/x-vcalendar",
411
+ viv: "video/vnd.vivo",
412
+ vox: "application/x-authorware-bin",
413
+ vrml: "model/vrml",
414
+ vsd: "application/vnd.visio",
415
+ vst: "application/vnd.visio",
416
+ vsw: "application/vnd.visio",
417
+ wasm: "application/wasm",
418
+ wav: "audio/wav",
419
+ wbmp: "image/vnd.wap.wbmp",
420
+ webm: "video/webm",
421
+ webmanifest: "application/manifest+json",
422
+ webp: "image/webp",
423
+ wmf: "image/wmf",
424
+ wml: "text/vnd.wap.wml",
425
+ wmlc: "application/vnd.wap.wmlc",
426
+ wmls: "text/vnd.wap.wmlscript",
427
+ wmlsc: "application/vnd.wap.wmlscriptc",
428
+ woff: "font/woff",
429
+ woff2: "font/woff2",
430
+ wpd: "application/vnd.wordperfect",
431
+ wri: "application/x-mswrite",
432
+ wrl: "model/vrml",
433
+ wsc: "message/vnd.wfa.wsc",
434
+ wsdl: "application/wsdl+xml",
435
+ xbm: "image/x-xbitmap",
436
+ xif: "image/vnd.xiff",
437
+ xla: "application/vnd.ms-excel",
438
+ xlc: "application/vnd.ms-excel",
439
+ xlm: "application/vnd.ms-excel",
440
+ xls: "application/vnd.ms-excel",
441
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
442
+ xlt: "application/vnd.ms-excel",
443
+ xlw: "application/vnd.ms-excel",
444
+ xm: "audio/xm",
445
+ xml: "application/xml",
446
+ xpm: "image/x-xpixmap",
447
+ xsl: "application/xml",
448
+ xul: "application/vnd.mozilla.xul+xml",
449
+ xwd: "image/x-xwindowdump",
450
+ xyz: "chemical/x-xyz",
451
+ yaml: "text/yaml",
452
+ yml: "text/yaml",
453
+ zip: "application/zip",
454
+ "3gpp2": "audio/3gpp2",
455
+ ass: "audio/aac",
456
+ h5: "application/x-hdf5",
457
+ ksh: "text/plain",
458
+ loas: "audio/aac",
459
+ mpa: "video/mpeg",
460
+ nws: "message/rfc822",
461
+ ppa: "application/vnd.ms-powerpoint",
462
+ pwz: "application/vnd.ms-powerpoint",
463
+ py: "text/x-python",
464
+ pyc: "application/x-python-code",
465
+ tgz: "application/gzip",
466
+ wiz: "application/msword",
467
+ xlb: "application/vnd.ms-excel",
468
+ xpdl: "application/xml"
469
+ };
470
+ /**
471
+ * The MIME type of a file, from its name's extension; `application/octet-stream`
472
+ * when the extension is missing or unknown. Accepts a bare name or a path.
473
+ *
474
+ * @example getMimeTypeFromFileName('/tmp/deck.pptx') // 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
475
+ */
476
+ const getMimeTypeFromFileName = (fileName) => {
477
+ const baseName = fileName.split(/[\\/]/).pop() ?? "";
478
+ const dot = baseName.lastIndexOf(".");
479
+ if (dot <= 0) return DEFAULT_MIME_TYPE;
480
+ const extension = baseName.slice(dot + 1).toLowerCase();
481
+ return Object.hasOwn(MIME_TYPES_BY_EXTENSION, extension) ? MIME_TYPES_BY_EXTENSION[extension] : DEFAULT_MIME_TYPE;
482
+ };
483
+
484
+ //#endregion
485
+ //#region src/utils/sensitiveFileUploadPaths.ts
486
+ /**
487
+ * Blocks accidental upload of local files from well-known secret/credential locations
488
+ * during auto file upload (and {@link getFileDataAfterUploadingToS3}).
489
+ *
490
+ * This is the single canonical guard shared by the core SDK and downstream
491
+ * packages (e.g. `@composio/cli`). Filesystem access goes through the `#platform`
492
+ * abstraction so this module stays free of static `node:*` imports and is safe to
493
+ * re-export from the package root (edge/workerd builds included).
494
+ */
495
+ /**
496
+ * Path segments (a single path component) that indicate a sensitive directory when
497
+ * they appear anywhere in a resolved local path. Matching follows the case sensitivity
498
+ * of the filesystem containing that path.
499
+ */
500
+ const BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS = [
501
+ ".ssh",
502
+ ".aws",
503
+ ".azure",
504
+ ".gnupg",
505
+ ".kube",
506
+ ".docker",
507
+ ".claude",
508
+ ".password-store",
509
+ "keychains"
510
+ ];
511
+ const SECRET_LIKE_BASENAME = /^(\.env(\.|$)|\.netrc$|\.pgpass$)/i;
512
+ /** Default SSH private key basenames (public keys like id_rsa.pub are allowed). */
513
+ const DEFAULT_PRIVATE_KEY_BASENAME = /^id_(rsa|ed25519|ecdsa|dsa|ecdsa_sk)(\.old)?$/i;
514
+ const splitSegments = (aPath) => aPath.split(/[/\\]+/).filter(Boolean);
515
+ /**
516
+ * Returns normalized path segments, resolving symlinks when the path exists.
517
+ *
518
+ * Both the written path and the symlink-resolved one are returned, because a
519
+ * denied segment can be hidden by a symlink in either direction:
520
+ *
521
+ * - `~/innocent-name` -> `~/nested/.aws/creds` hides `.aws` from the written
522
+ * path, so the denylist has to see the resolved one.
523
+ * - `~/.claude` -> `/state/claude` hides `.claude` from the *resolved* path,
524
+ * so the denylist also has to see the written one. Dotfile managers
525
+ * (chezmoi, stow, yadm) and containerised home directories produce exactly
526
+ * this layout.
527
+ *
528
+ * Matching only the resolved path silently turns the denylist off for the
529
+ * second case.
530
+ */
531
+ function normalizePath(filePath) {
532
+ const absolute = platform.resolvePath(filePath);
533
+ let resolved = absolute;
534
+ try {
535
+ if (platform.existsSync(absolute)) resolved = platform.realpathSync(absolute);
536
+ } catch {}
537
+ return {
538
+ resolvedPath: resolved,
539
+ segments: splitSegments(resolved),
540
+ writtenSegments: splitSegments(absolute)
541
+ };
542
+ }
543
+ /**
544
+ * True if the path is under a built-in or extra deny segment, or the basename
545
+ * looks like an env / netrc / default SSH private key name.
546
+ */
547
+ function isBlockedSensitiveFileUploadPath(filePath, additionalDenySegments) {
548
+ return getSensitiveFileUploadPathBlockReason(filePath, additionalDenySegments) != null;
549
+ }
550
+ function getSensitiveFileUploadPathBlockReason(filePath, additionalDenySegments) {
551
+ const { resolvedPath, segments, writtenSegments } = normalizePath(filePath);
552
+ const isCaseSensitive = platform.isFileSystemCaseSensitive?.(resolvedPath) ?? true;
553
+ const normalizeSegment = (segment) => isCaseSensitive ? segment : segment.toLowerCase();
554
+ const deny = new Set([...BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, ...(additionalDenySegments ?? []).map((s) => s.trim()).filter(Boolean)].map(normalizeSegment));
555
+ for (const candidate of [segments, writtenSegments]) {
556
+ const segmentsForMatch = isCaseSensitive ? candidate : candidate.map(normalizeSegment);
557
+ for (let i = 0; i < candidate.length; i++) if (deny.has(segmentsForMatch[i])) return `path segment "${candidate[i]}" is in the sensitive file upload denylist`;
558
+ }
559
+ const basenames = [segments.at(-1), writtenSegments.at(-1)].filter((name) => !!name);
560
+ for (const basename of basenames) {
561
+ if (SECRET_LIKE_BASENAME.test(basename) || DEFAULT_PRIVATE_KEY_BASENAME.test(basename)) return `file name "${basename}" looks like a credential, env, or private key file`;
562
+ if (basename.toLowerCase() === "credentials") return "file name \"credentials\" is often used for cloud/API credential stores";
563
+ }
564
+ return null;
565
+ }
566
+ /**
567
+ * Default remediation hint appended to the block message. Assumes an SDK caller
568
+ * that exposes `sensitiveFileUploadProtection`. Callers without such an opt-out
569
+ * (e.g. `@composio/cli`) should pass their own `remediation` so the message does
570
+ * not advertise an option the caller cannot honor.
571
+ */
572
+ const DEFAULT_REMEDIATION = "To upload from this path anyway, set sensitiveFileUploadProtection: false on Composio (not recommended) or use a copy outside sensitive locations.";
573
+ /**
574
+ * @throws {ComposioSensitiveFilePathBlockedError} if the path is not allowed
575
+ */
576
+ function assertSafeFileUploadPath(filePath, options) {
577
+ const reason = getSensitiveFileUploadPathBlockReason(filePath, options?.additionalDenySegments);
578
+ if (reason) {
579
+ const remediation = options?.remediation ?? DEFAULT_REMEDIATION;
580
+ throw new ComposioSensitiveFilePathBlockedError(`Refusing to upload: ${reason}. ${remediation}`, { meta: {
581
+ filePath,
582
+ reason
583
+ } });
584
+ }
585
+ }
586
+
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 };
@@ -1,5 +1,5 @@
1
- import { Tr as BaseComposioProvider } from "./customTool.types-gX421uPT.mjs";
2
- import { n as ComposioConfig } from "./composio-BUa10iB3.mjs";
1
+ import { Tr as BaseComposioProvider } from "./customTool.types-DoItUHkO.mjs";
2
+ import { n as ComposioConfig } from "./composio-CwHMpKXb.mjs";
3
3
  //#region src/utils/config-defaults/types.d.ts
4
4
  /**
5
5
  * Configuration defaults for Composio.
@@ -1,4 +1,4 @@
1
- import { t as ConfigDefaults } from "../../types-DXxfzBX3.mjs";
1
+ import { t as ConfigDefaults } from "../../types-DWZWePfZ.mjs";
2
2
  //#region src/utils/config-defaults/ConfigDefaults.node.d.ts
3
3
  export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as ConfigDefaults } from "../../types-DXxfzBX3.mjs";
1
+ import { t as ConfigDefaults } from "../../types-DWZWePfZ.mjs";
2
2
  //#region src/utils/config-defaults/ConfigDefaults.workerd.d.ts
3
3
  export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Ka as ToolExecuteResponse, Va as Tool, Wa as ToolExecuteParams } from "../../customTool.types-gX421uPT.mjs";
1
+ import { Ka as ToolExecuteResponse, Va as Tool, Wa as ToolExecuteParams } from "../../customTool.types-DoItUHkO.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
  //#region src/utils/modifiers/FileToolModifier.node.d.ts
4
4
  export declare class FileToolModifier {
@@ -3,7 +3,7 @@ import { _ as ComposioRequestCancelledError } from "../../errors-Cly0vXFh.mjs";
3
3
  import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "../../FileModifierErrors-CdGSABoq.mjs";
4
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
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-DNLhLg0W.mjs";
6
+ import { n as getFileDataAfterUploadingToS3, r as isHttpUrl, t as downloadFileFromS3 } from "../../fileUtils.node-ILI1IjnZ.mjs";
7
7
 
8
8
  //#region src/utils/modifiers/FileToolModifier.node.ts
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { Ka as ToolExecuteResponse, Va as Tool, Wa as ToolExecuteParams } from "../../customTool.types-gX421uPT.mjs";
1
+ import { Ka as ToolExecuteResponse, Va as Tool, Wa as ToolExecuteParams } from "../../customTool.types-DoItUHkO.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
  //#region src/utils/modifiers/FileToolModifier.workerd.d.ts
4
4
  export declare class FileToolModifier {