@composio/core 0.14.0 → 0.14.1

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 (41) hide show
  1. package/dist/{BaseProvider-lCxnjFKQ.d.mts → BaseProvider-Dc5yKZhk.d.mts} +81 -82
  2. package/dist/{CustomTool-CmokRT9q.d.mts → CustomTool-4nVuwLzO.d.mts} +1 -2
  3. package/dist/{CustomTool-C_5NvBsX.mjs → CustomTool-l-j5HtEf.mjs} +1 -1
  4. package/dist/FileModifierErrors-B8V8_3VE.mjs +97 -0
  5. package/dist/{SsrfErrors-BQRozkeU.mjs → SsrfErrors-DNJt57GL.mjs} +5 -98
  6. package/dist/{Telemetry-llfvticE.mjs → Telemetry-CF0rNHu2.mjs} +2 -2
  7. package/dist/{cancellation-W65QRyj2.mjs → cancellation-BbJ-UQ__.mjs} +2 -2
  8. package/dist/{composio-6C8kHtqc.d.mts → composio-ChU3eD9F.d.mts} +260 -257
  9. package/dist/{customTool.types-kFhNYuzh.d.mts → customTool.types-CX2-LbfI.d.mts} +142 -109
  10. package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +2 -0
  11. package/dist/{errors-B165yJUQ.mjs → errors-BcEUHZbq.mjs} +2 -1
  12. package/dist/experimental/index.d.mts +2 -2
  13. package/dist/experimental/index.mjs +1 -1
  14. package/dist/{fileUtils.node-iPFi2o4i.mjs → fileUtils.node-DOkW4PBg.mjs} +5 -153
  15. package/dist/index.d.mts +1585 -753
  16. package/dist/index.mjs +14 -10
  17. package/dist/models/Files.node.d.mts +2 -11
  18. package/dist/models/Files.node.mjs +2 -2
  19. package/dist/models/Files.workerd.d.mts +0 -1
  20. package/dist/platform/node.d.mts +0 -1
  21. package/dist/platform/workerd.d.mts +0 -1
  22. package/dist/platform/workerd.mjs +27 -3
  23. package/dist/{sensitiveFileUploadPaths-B1OLsd8F.mjs → sensitiveFileUploadPaths-C43dHP7S.mjs} +52 -2
  24. package/dist/{types-yCrveqAj.d.mts → types-D5N60gUD.d.mts} +2 -3
  25. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -2
  26. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -2
  27. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -2
  28. package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -4
  29. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -2
  30. package/dist/utils/ssrfGuard.node.d.mts +22 -0
  31. package/dist/utils/ssrfGuard.node.mjs +152 -0
  32. package/dist/utils/ssrfGuard.workerd.d.mts +9 -0
  33. package/dist/utils/ssrfGuard.workerd.mjs +17 -0
  34. package/package.json +14 -9
  35. package/src/errors/SsrfErrors.ts +4 -3
  36. package/src/models/ToolRouterSessionFileMount.ts +7 -3
  37. package/src/platform/workerd.ts +30 -3
  38. package/src/utils/fileUtils.node.ts +2 -2
  39. package/src/utils/readResponseBody.ts +63 -0
  40. package/src/utils/ssrfGuard.node.ts +6 -6
  41. package/src/utils/ssrfGuard.workerd.ts +19 -0
@@ -347,109 +347,16 @@ var ComposioError$1 = class ComposioError$1 extends Error {
347
347
  }
348
348
  };
349
349
 
350
- //#endregion
351
- //#region src/errors/FileModifierErrors.ts
352
- const FileModifierErrorCodes = {
353
- FILE_UPLOAD_FAILED: "FILE_UPLOAD_FAILED",
354
- SENSITIVE_FILE_PATH_BLOCKED: "SENSITIVE_FILE_PATH_BLOCKED",
355
- FILE_UPLOAD_ABORTED: "FILE_UPLOAD_ABORTED",
356
- FILE_UPLOAD_PATH_NOT_ALLOWED: "FILE_UPLOAD_PATH_NOT_ALLOWED",
357
- FILE_NOT_FOUND: "FILE_NOT_FOUND"
358
- };
359
- var ComposioFileUploadError = class extends ComposioError$1 {
360
- constructor(message = "Failed to upload file", options = {}) {
361
- super(message, {
362
- ...options,
363
- code: options.code ?? FileModifierErrorCodes.FILE_UPLOAD_FAILED,
364
- possibleFixes: options.possibleFixes || ["Check if the file exists in the location provided"]
365
- });
366
- this.name = "ComposioFileUploadError";
367
- }
368
- };
369
- /**
370
- * Thrown when a local file path is refused before upload (sensitive directory or
371
- * credential-like file name). Subclass of {@link ComposioFileUploadError} so existing
372
- * `instanceof ComposioFileUploadError` handlers still apply.
373
- */
374
- var ComposioSensitiveFilePathBlockedError = class extends ComposioFileUploadError {
375
- constructor(message, options = {}) {
376
- super(message, {
377
- ...options,
378
- code: FileModifierErrorCodes.SENSITIVE_FILE_PATH_BLOCKED,
379
- possibleFixes: options.possibleFixes ?? [
380
- "Use a file outside ~/.ssh, ~/.aws, and other credential locations",
381
- "Set sensitiveFileUploadProtection: false only if you understand the risk",
382
- "Add path segments to block with fileUploadPathDenySegments"
383
- ]
384
- });
385
- this.name = "ComposioSensitiveFilePathBlockedError";
386
- }
387
- };
388
- /**
389
- * Thrown when a `beforeFileUpload` hook returns `false`.
390
- */
391
- var ComposioFileUploadAbortedError = class extends ComposioFileUploadError {
392
- constructor(message, options = {}) {
393
- super(message, {
394
- ...options,
395
- code: FileModifierErrorCodes.FILE_UPLOAD_ABORTED,
396
- possibleFixes: options.possibleFixes ?? ["Change beforeFileUpload to return a file path to upload, or allow the upload to proceed"]
397
- });
398
- this.name = "ComposioFileUploadAbortedError";
399
- }
400
- };
401
- /**
402
- * Thrown when automatic file upload during tool execution is attempted from a path
403
- * that is outside the configured {@link ComposioConfig.fileUploadDirs} allowlist.
404
- *
405
- * This only fires for auto-upload (enabled via
406
- * `dangerouslyAllowAutoUploadDownloadFiles: true`). Manual `composio.files.upload()`
407
- * calls are never subject to this check.
408
- */
409
- var ComposioFileUploadPathNotAllowedError = class extends ComposioFileUploadError {
410
- constructor(message, options = {}) {
411
- super(message, {
412
- ...options,
413
- code: FileModifierErrorCodes.FILE_UPLOAD_PATH_NOT_ALLOWED,
414
- possibleFixes: options.possibleFixes ?? [
415
- "Move the file under one of the directories in `fileUploadDirs`",
416
- "Stage the file under the default upload dir (`~/.composio/temp`)",
417
- "Add the containing directory to `fileUploadDirs` when constructing Composio",
418
- "Pass the file by URL or as a File/Blob object instead of a filesystem path"
419
- ]
420
- });
421
- this.name = "ComposioFileUploadPathNotAllowedError";
422
- }
423
- };
424
- /**
425
- * Thrown when a local file path passed for upload does not exist on disk.
426
- * Provides extra debugging context (resolved absolute path, cwd, allowlist state)
427
- * to help the caller distinguish between "typo" and "not-allowlisted" failures.
428
- */
429
- var ComposioFileNotFoundError = class extends ComposioFileUploadError {
430
- constructor(message, options = {}) {
431
- super(message, {
432
- ...options,
433
- code: FileModifierErrorCodes.FILE_NOT_FOUND,
434
- possibleFixes: options.possibleFixes ?? [
435
- "Double-check the path for typos",
436
- "Remember relative paths are resolved against process.cwd() at upload time",
437
- "Verify the file exists and the process has read permission"
438
- ]
439
- });
440
- this.name = "ComposioFileNotFoundError";
441
- }
442
- };
443
-
444
350
  //#endregion
445
351
  //#region src/errors/SsrfErrors.ts
446
352
  const SsrfErrorCodes = { BLOCKED_INTERNAL_URL: "BLOCKED_INTERNAL_URL" };
447
353
  /**
448
354
  * Thrown when a URL file input resolves to a private, loopback, link-local, or
449
355
  * otherwise internal address, or points at a non-http(s) scheme. Guards against
450
- * turning `composio.files.upload(url)` (and automatic upload during tool
451
- * execution) into a server-side request forgery (SSRF) probe of internal
452
- * infrastructure such as cloud metadata endpoints (`169.254.169.254`).
356
+ * turning URL-based file uploads (including Tool Router session files and
357
+ * automatic upload during tool execution) into a server-side request forgery
358
+ * (SSRF) probe of internal infrastructure such as cloud metadata endpoints
359
+ * (`169.254.169.254`).
453
360
  */
454
361
  var ComposioBlockedInternalUrlError = class extends ComposioError$1 {
455
362
  constructor(message = "Refusing to fetch an internal or non-public URL", options = {}) {
@@ -474,4 +381,4 @@ var ComposioBlockedInternalUrlError = class extends ComposioError$1 {
474
381
  };
475
382
 
476
383
  //#endregion
477
- export { USER_DATA_FILE_NAME as _, ComposioFileUploadError as a, getEnvsWithPrefix as b, FileModifierErrorCodes as c, COMPOSIO_DIR as d, COMPOSIO_LOG_LEVEL as f, TEMP_FILES_DIRECTORY_NAME as g, IS_DEVELOPMENT_OR_CI as h, ComposioFileUploadAbortedError as i, ComposioError$1 as l, DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID as m, SsrfErrorCodes as n, ComposioFileUploadPathNotAllowedError as o, DEFAULT_BASE_URL as p, ComposioFileNotFoundError as r, ComposioSensitiveFilePathBlockedError as s, ComposioBlockedInternalUrlError as t, logger as u, constants_exports as v, getEnvVariable as y };
384
+ export { COMPOSIO_DIR 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_LOG_LEVEL as o, getEnvVariable as p, ComposioError$1 as r, DEFAULT_BASE_URL as s, ComposioBlockedInternalUrlError as t, TEMP_FILES_DIRECTORY_NAME as u };
@@ -1,5 +1,5 @@
1
- import { l as ComposioError$1, u as logger, y as getEnvVariable } from "./SsrfErrors-BQRozkeU.mjs";
2
- import { c as getRandomUUID } from "./sensitiveFileUploadPaths-B1OLsd8F.mjs";
1
+ import { i as logger, p as getEnvVariable, r as ComposioError$1 } from "./SsrfErrors-DNJt57GL.mjs";
2
+ import { l as getRandomUUID } from "./sensitiveFileUploadPaths-C43dHP7S.mjs";
3
3
  import { ComposioError } from "@composio/client";
4
4
 
5
5
  //#region src/types/telemetry.types.ts
@@ -1,5 +1,5 @@
1
- import { u as logger } from "./SsrfErrors-BQRozkeU.mjs";
2
- import { f as ComposioRequestCancelledError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, m as isRequestAbortError } from "./errors-B165yJUQ.mjs";
1
+ import { i as logger } from "./SsrfErrors-DNJt57GL.mjs";
2
+ import { f as ComposioRequestCancelledError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, m as isRequestAbortError } from "./errors-BcEUHZbq.mjs";
3
3
  import { t as isPlainObject } from "./FileToolModifier.utils.neutral-B5rT711M.mjs";
4
4
  import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
5
5