@composio/core 0.18.1 → 1.0.0-beta.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 (69) hide show
  1. package/dist/{CustomTool-Bz0f52QR.mjs → CustomTool-CM-roKk7.mjs} +1 -1
  2. package/dist/{CustomTool-VRfWzMix.d.mts → CustomTool-yMQjEyMz.d.mts} +1 -1
  3. package/dist/{FileModifierErrors-CwB-Inm9.mjs → FileModifierErrors-CdGSABoq.mjs} +1 -1
  4. package/dist/{FileToolModifier.utils.neutral-D_YkHwZP.mjs → FileToolModifier.utils.neutral-DWFpnsj2.mjs} +4 -2
  5. package/dist/{SsrfErrors-xhdVE4yw.mjs → SsrfErrors-DiQldIdC.mjs} +32 -17
  6. package/dist/{Telemetry-Dw9W5RSp.mjs → Telemetry-JRJJYS4I.mjs} +2 -2
  7. package/dist/{cancellation-P5YUlcfz.mjs → cancellation-BEpFk2S8.mjs} +7 -5
  8. package/dist/{composio-Cb3d1jFe.d.mts → composio-BVNJTVYa.d.mts} +2449 -118
  9. package/dist/{customTool.types-B6ej_8XZ.d.mts → customTool.types-CY5SXFfF.d.mts} +118 -5
  10. package/dist/{errors-Ue9wMrPK.mjs → errors-CvZjP9CH.mjs} +39 -4
  11. package/dist/experimental/index.d.mts +2 -2
  12. package/dist/experimental/index.mjs +1 -1
  13. package/dist/{fileUtils.node-KE5Fa-af.mjs → fileUtils.node-HQsywtTj.mjs} +8 -6
  14. package/dist/index.d.mts +292 -140
  15. package/dist/index.mjs +1914 -160
  16. package/dist/models/Files.node.d.mts +2 -3
  17. package/dist/models/Files.node.mjs +2 -2
  18. package/dist/models/Files.workerd.d.mts +2 -3
  19. package/dist/platform/node.d.mts +2 -3
  20. package/dist/platform/workerd.d.mts +2 -3
  21. package/dist/{sensitiveFileUploadPaths-QN7w4n8v.mjs → sensitiveFileUploadPaths-BlLp-Yo2.mjs} +10 -7
  22. package/dist/{ssrfGuard.node-BLX6b-Rf.mjs → ssrfGuard.node-BK50mYTq.mjs} +94 -8
  23. package/dist/{types-CGdgK442.d.mts → types-CqGfjlZg.d.mts} +2 -2
  24. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +3 -4
  25. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +3 -4
  26. package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -4
  27. package/dist/utils/modifiers/FileToolModifier.node.mjs +6 -6
  28. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -4
  29. package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
  30. package/dist/utils/ssrfGuard.node.d.mts +7 -7
  31. package/dist/utils/ssrfGuard.node.mjs +1 -1
  32. package/dist/utils/ssrfGuard.workerd.d.mts +3 -4
  33. package/dist/utils/ssrfGuard.workerd.mjs +1 -1
  34. package/package.json +7 -7
  35. package/src/composio.ts +86 -2
  36. package/src/errors/ConnectedAccountsErrors.ts +47 -0
  37. package/src/index.ts +15 -0
  38. package/src/models/ConnectedAccounts.ts +118 -2
  39. package/src/models/CustomToolkits.ts +169 -0
  40. package/src/models/Experimental.ts +27 -0
  41. package/src/models/Keyring.ts +65 -0
  42. package/src/models/Logs.ts +101 -0
  43. package/src/models/ToolRouterSession.ts +51 -0
  44. package/src/models/Toolkits.ts +180 -0
  45. package/src/models/Tools.ts +3 -1
  46. package/src/models/Triggers.ts +2 -87
  47. package/src/models/Usage.ts +119 -0
  48. package/src/models/Webhooks.ts +520 -0
  49. package/src/types/authConfigs.types.ts +2 -0
  50. package/src/types/connectedAccounts.types.ts +54 -0
  51. package/src/types/customToolkits.types.ts +102 -0
  52. package/src/types/keyring.types.ts +32 -0
  53. package/src/types/logs.types.ts +108 -0
  54. package/src/types/toolRouter.types.ts +49 -1
  55. package/src/types/toolkit.types.ts +131 -0
  56. package/src/types/usage.types.ts +81 -0
  57. package/src/types/webhooks.types.ts +143 -0
  58. package/src/utils/constants.ts +1 -5
  59. package/src/utils/jsonSchema.ts +4 -1
  60. package/src/utils/logger.ts +39 -7
  61. package/src/utils/ssrfGuard.node.ts +98 -7
  62. package/src/utils/transformers/connectedAccounts.ts +37 -2
  63. package/src/utils/transformers/customToolkits.ts +98 -0
  64. package/src/utils/transformers/keyring.ts +24 -0
  65. package/src/utils/transformers/logs.ts +85 -0
  66. package/src/utils/transformers/toolkits.ts +100 -1
  67. package/src/utils/transformers/triggers.ts +2 -2
  68. package/src/utils/transformers/usage.ts +77 -0
  69. package/src/utils/transformers/webhooks.ts +139 -0
@@ -1,7 +1,7 @@
1
1
  import { n as FileUploadData, t as FileDownloadData } from "../files.types-DeMC_mAW.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
  //#region src/models/Files.node.d.ts
4
- declare class Files {
4
+ export declare class Files {
5
5
  private readonly client;
6
6
  private readonly fileOptions;
7
7
  constructor(client: ComposioClient, fileOptions?: {
@@ -42,5 +42,4 @@ declare class Files {
42
42
  mimeType: string;
43
43
  }): Promise<FileDownloadData>;
44
44
  }
45
- //#endregion
46
- export { Files };
45
+ //#endregion
@@ -1,5 +1,5 @@
1
- import { t as telemetry } from "../Telemetry-Dw9W5RSp.mjs";
2
- import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-KE5Fa-af.mjs";
1
+ import { t as telemetry } from "../Telemetry-JRJJYS4I.mjs";
2
+ import { n as getFileDataAfterUploadingToS3, t as downloadFileFromS3 } from "../fileUtils.node-HQsywtTj.mjs";
3
3
 
4
4
  //#region src/models/Files.node.ts
5
5
  var Files = class {
@@ -4,8 +4,7 @@ import ComposioClient from "@composio/client";
4
4
  * Files class for Cloudflare Workers / Edge runtimes.
5
5
  * All methods throw an error indicating that file operations are not supported.
6
6
  */
7
- declare class Files {
7
+ export declare class Files {
8
8
  constructor(_client: ComposioClient);
9
9
  }
10
- //#endregion
11
- export { Files };
10
+ //#endregion
@@ -4,6 +4,5 @@ import { t as Platform } from "../types-D5A2wzBl.mjs";
4
4
  * Node.js platform implementation.
5
5
  * Provides full file system and OS operations using Node.js built-in modules.
6
6
  */
7
- declare const platform: Platform;
8
- //#endregion
9
- export { platform };
7
+ export declare const platform: Platform;
8
+ //#endregion
@@ -5,6 +5,5 @@ import { t as Platform } from "../types-D5A2wzBl.mjs";
5
5
  * Provides stub implementations for file system operations that are unavailable in edge runtimes.
6
6
  * All file system operations gracefully return null/empty values or throw descriptive errors.
7
7
  */
8
- declare const platform: Platform;
9
- //#endregion
10
- export { platform };
8
+ export declare const platform: Platform;
9
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { a as ComposioSensitiveFilePathBlockedError } from "./FileModifierErrors-CwB-Inm9.mjs";
1
+ import { a as ComposioSensitiveFilePathBlockedError } from "./FileModifierErrors-CdGSABoq.mjs";
2
2
  import { platform } from "#platform";
3
3
 
4
4
  //#region src/utils/uuid.ts
@@ -35,7 +35,7 @@ const uint8ArrayToBase64 = (bytes) => {
35
35
  //#endregion
36
36
  //#region src/utils/readResponseBody.ts
37
37
  /** Maximum size accepted for files fetched from user-supplied URLs (100 MiB). */
38
- const MAX_URL_UPLOAD_SIZE_BYTES = 100 * 1024 * 1024;
38
+ const MAX_URL_UPLOAD_SIZE_BYTES = 104857600;
39
39
  const sizeLimitError = (actualSize, maxBytes) => /* @__PURE__ */ new Error(`File size (${actualSize} bytes) exceeds maximum allowed size (${maxBytes} bytes)`);
40
40
  /**
41
41
  * Read a fetch response without allowing an untrusted server to exhaust memory.
@@ -176,11 +176,14 @@ const DEFAULT_REMEDIATION = "To upload from this path anyway, set sensitiveFileU
176
176
  */
177
177
  function assertSafeFileUploadPath(filePath, options) {
178
178
  const reason = getSensitiveFileUploadPathBlockReason(filePath, options?.additionalDenySegments);
179
- if (reason) throw new ComposioSensitiveFilePathBlockedError(`Refusing to upload: ${reason}. ${options?.remediation ?? DEFAULT_REMEDIATION}`, { meta: {
180
- filePath,
181
- reason
182
- } });
179
+ if (reason) {
180
+ const remediation = options?.remediation ?? DEFAULT_REMEDIATION;
181
+ throw new ComposioSensitiveFilePathBlockedError(`Refusing to upload: ${reason}. ${remediation}`, { meta: {
182
+ filePath,
183
+ reason
184
+ } });
185
+ }
183
186
  }
184
187
 
185
188
  //#endregion
186
- export { arrayBufferToBase64 as a, getRandomShortId as c, readResponseBodyWithLimit as i, getRandomUUID as l, assertSafeFileUploadPath as n, base64ToUint8Array as o, isBlockedSensitiveFileUploadPath as r, uint8ArrayToBase64 as s, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS as t };
189
+ export { readResponseBodyWithLimit as a, uint8ArrayToBase64 as c, MAX_URL_UPLOAD_SIZE_BYTES as i, getRandomShortId as l, assertSafeFileUploadPath as n, arrayBufferToBase64 as o, isBlockedSensitiveFileUploadPath as r, base64ToUint8Array as s, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS as t, getRandomUUID as u };
@@ -1,4 +1,4 @@
1
- import { t as ComposioBlockedInternalUrlError } from "./SsrfErrors-xhdVE4yw.mjs";
1
+ import { t as ComposioBlockedInternalUrlError } from "./SsrfErrors-DiQldIdC.mjs";
2
2
  import { lookup } from "node:dns/promises";
3
3
  import { isIP } from "node:net";
4
4
  import { request } from "node:http";
@@ -199,6 +199,81 @@ const hasCustomGlobalDispatcher = () => {
199
199
  */
200
200
  const MAX_REDIRECTS = 5;
201
201
  /**
202
+ * The Fetch standard's "redirect status" set. A 3xx outside it is not a
203
+ * redirect to follow even when it carries a `location` — `304 Not Modified`
204
+ * and `305 Use Proxy` most of all, and following those would replay the
205
+ * request against a target the caller never asked for. The Python guard
206
+ * follows the same set (`_REDIRECT_STATUS_CODES`).
207
+ */
208
+ const REDIRECT_STATUS_CODES = /* @__PURE__ */ new Set([
209
+ 301,
210
+ 302,
211
+ 303,
212
+ 307,
213
+ 308
214
+ ]);
215
+ /**
216
+ * Headers that describe a request body, so they have to go when the body does:
217
+ * the Fetch standard's "request-body-header name" set, plus the two the Python
218
+ * guard also drops because `requests` recomputes them from the body it sends.
219
+ */
220
+ const BODY_HEADERS = [
221
+ "content-encoding",
222
+ "content-language",
223
+ "content-length",
224
+ "content-location",
225
+ "content-type",
226
+ "transfer-encoding"
227
+ ];
228
+ /**
229
+ * The method the hop after a redirect uses, or `null` to replay as-is. A
230
+ * returned method also means the request body goes.
231
+ *
232
+ * These are the Fetch standard's redirect rules, which following redirects by
233
+ * hand (`redirect: 'manual'`) means `fetch` never applies for us: `303` points
234
+ * at a result URL that has no use for the original body, so every method loses
235
+ * it and everything but `HEAD` becomes a `GET`; `301`/`302` do the same to a
236
+ * `POST` only; `307`/`308` replay both. Without this, a `303` answering an
237
+ * upload would PUT the payload again at a URL that expects a GET. The Python
238
+ * guard applies the same rules in `safe_request`.
239
+ */
240
+ const redirectRewrite = (status, method) => {
241
+ if (status === 303) return method === "HEAD" ? "HEAD" : "GET";
242
+ if ((status === 301 || status === 302) && method === "POST") return "GET";
243
+ return null;
244
+ };
245
+ /**
246
+ * Headers that carry a credential for the origin the request was addressed
247
+ * to, so they must not follow a redirect to a different origin. The Fetch
248
+ * standard strips `Authorization` on a cross-origin redirect; `Cookie` and
249
+ * `Proxy-Authorization` go with it the way `requests` and curl drop them on a
250
+ * host change. `redirect: 'manual'` means `fetch` never applies that rule for
251
+ * us either. The Python guard drops the same three (`_CREDENTIAL_HEADERS`).
252
+ */
253
+ const CREDENTIAL_HEADERS = [
254
+ "authorization",
255
+ "cookie",
256
+ "proxy-authorization"
257
+ ];
258
+ const applyRedirectSemantics = (init, status, fromUrl, toUrl) => {
259
+ const method = redirectRewrite(status, (init.method ?? "GET").toUpperCase());
260
+ const crossOrigin = new URL(fromUrl).origin !== new URL(toUrl).origin;
261
+ if (method === null && !crossOrigin) return init;
262
+ const headers = new Headers(init.headers);
263
+ if (method !== null) for (const name of BODY_HEADERS) headers.delete(name);
264
+ if (crossOrigin) for (const name of CREDENTIAL_HEADERS) headers.delete(name);
265
+ if (method === null) return {
266
+ ...init,
267
+ headers
268
+ };
269
+ return {
270
+ ...init,
271
+ method,
272
+ body: void 0,
273
+ headers
274
+ };
275
+ };
276
+ /**
202
277
  * Whether the runtime would route `url` through an env proxy the SDK cannot
203
278
  * see into. Bun honors proxy environment variables automatically. Node's
204
279
  * built-in `fetch` requires the `NODE_USE_ENV_PROXY` opt-in (Node >= 24), so
@@ -228,6 +303,7 @@ const IPV4_BLOCKED_CIDRS = [
228
303
  ["172.16.0.0", 12],
229
304
  ["192.0.0.0", 24],
230
305
  ["192.0.2.0", 24],
306
+ ["192.88.99.0", 24],
231
307
  ["192.168.0.0", 16],
232
308
  ["198.18.0.0", 15],
233
309
  ["198.51.100.0", 24],
@@ -276,8 +352,14 @@ const isBlockedIpv6 = (ip) => {
276
352
  const isMappedOrCompat = h[0] === 0 && h[1] === 0 && h[2] === 0 && h[3] === 0 && h[4] === 0 && (h[5] === 65535 || h[5] === 0);
277
353
  const isNat64 = h[0] === 100 && h[1] === 65435 && h[2] === 0 && h[3] === 0 && h[4] === 0 && h[5] === 0;
278
354
  if (isMappedOrCompat || isNat64) return isBlockedIpv4Long((h[6] << 16 >>> 0 | h[7]) >>> 0);
355
+ if (h[0] === 8193 && (h[1] & 65024) === 0) return true;
356
+ if (h[0] === 8193 && h[1] === 3512) return true;
357
+ if (h[0] === 8194) return true;
358
+ if (h[0] === 100 && h[1] === 65435 && h[2] === 1) return true;
359
+ if (h[0] === 256 && h[1] === 0 && h[2] === 0 && h[3] === 0) return true;
279
360
  if ((h[0] & 65024) === 64512) return true;
280
361
  if ((h[0] & 65472) === 65152) return true;
362
+ if ((h[0] & 65472) === 65216) return true;
281
363
  if ((h[0] & 65280) === 65280) return true;
282
364
  return false;
283
365
  };
@@ -331,7 +413,8 @@ const assertSafeFetchTarget = async (rawUrl) => {
331
413
  * connects to the address it validated, and re-validates and re-pins every
332
414
  * redirect hop (redirects are followed manually up to {@link MAX_REDIRECTS}).
333
415
  * Intermediate redirect bodies are cancelled; non-redirect responses are
334
- * returned unchanged.
416
+ * returned unchanged. Each hop carries the method, body, and credential headers
417
+ * the Fetch standard says it should — see {@link applyRedirectSemantics}.
335
418
  *
336
419
  * A hop whose effective dispatcher is a configured route (caller-supplied
337
420
  * `init.dispatcher`, non-stock global dispatcher, env-proxy mode) is *not*
@@ -339,22 +422,23 @@ const assertSafeFetchTarget = async (rawUrl) => {
339
422
  */
340
423
  const ssrfSafeFetch = async (rawUrl, init = {}, maxRedirects = MAX_REDIRECTS) => {
341
424
  let currentUrl = rawUrl;
425
+ let currentInit = init;
342
426
  for (let hop = 0; hop <= maxRedirects; hop++) {
343
427
  const addresses = await assertSafeFetchTarget(currentUrl);
344
428
  const isBun = typeof process.versions.bun === "string";
345
- const respectConfiguredRoute = init.dispatcher !== void 0 || envProxyApplies(new URL(currentUrl), isBun) || hasCustomGlobalDispatcher();
429
+ const respectConfiguredRoute = currentInit.dispatcher !== void 0 || envProxyApplies(new URL(currentUrl), isBun) || hasCustomGlobalDispatcher();
346
430
  const dispatcher = respectConfiguredRoute || isBun ? void 0 : await createPinnedDispatcher(addresses);
347
431
  let response;
348
432
  try {
349
433
  if (isBun && !respectConfiguredRoute) response = await pinnedHttpFetch(currentUrl, {
350
- ...init,
434
+ ...currentInit,
351
435
  redirect: "manual"
352
436
  }, addresses);
353
437
  else response = await fetch(currentUrl, dispatcher === void 0 ? {
354
- ...init,
438
+ ...currentInit,
355
439
  redirect: "manual"
356
440
  } : {
357
- ...init,
441
+ ...currentInit,
358
442
  redirect: "manual",
359
443
  dispatcher
360
444
  });
@@ -363,9 +447,11 @@ const ssrfSafeFetch = async (rawUrl, init = {}, maxRedirects = MAX_REDIRECTS) =>
363
447
  throw error;
364
448
  }
365
449
  if (dispatcher !== void 0) dispatcher.close().catch(() => void 0);
366
- if (!(response.status >= 300 && response.status < 400 && response.headers.has("location"))) return response;
450
+ if (!(REDIRECT_STATUS_CODES.has(response.status) && response.headers.has("location"))) return response;
367
451
  await response.body?.cancel().catch(() => void 0);
368
- currentUrl = new URL(response.headers.get("location"), currentUrl).toString();
452
+ const nextUrl = new URL(response.headers.get("location"), currentUrl).toString();
453
+ currentInit = applyRedirectSemantics(currentInit, response.status, currentUrl, nextUrl);
454
+ currentUrl = nextUrl;
369
455
  }
370
456
  throw new ComposioBlockedInternalUrlError(`Refusing to fetch: too many redirects (max ${maxRedirects})`, { url: rawUrl });
371
457
  };
@@ -1,5 +1,5 @@
1
- import { Mn as BaseComposioProvider } from "./customTool.types-B6ej_8XZ.mjs";
2
- import { n as ComposioConfig } from "./composio-Cb3d1jFe.mjs";
1
+ import { Kn as BaseComposioProvider } from "./customTool.types-CY5SXFfF.mjs";
2
+ import { n as ComposioConfig } from "./composio-BVNJTVYa.mjs";
3
3
  //#region src/utils/config-defaults/types.d.ts
4
4
  /**
5
5
  * Configuration defaults for Composio.
@@ -1,5 +1,4 @@
1
- import { t as ConfigDefaults } from "../../types-CGdgK442.mjs";
1
+ import { t as ConfigDefaults } from "../../types-CqGfjlZg.mjs";
2
2
  //#region src/utils/config-defaults/ConfigDefaults.node.d.ts
3
- declare const CONFIG_DEFAULTS: ConfigDefaults;
4
- //#endregion
5
- export { CONFIG_DEFAULTS };
3
+ export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
+ //#endregion
@@ -1,5 +1,4 @@
1
- import { t as ConfigDefaults } from "../../types-CGdgK442.mjs";
1
+ import { t as ConfigDefaults } from "../../types-CqGfjlZg.mjs";
2
2
  //#region src/utils/config-defaults/ConfigDefaults.workerd.d.ts
3
- declare const CONFIG_DEFAULTS: ConfigDefaults;
4
- //#endregion
5
- export { CONFIG_DEFAULTS };
3
+ export declare const CONFIG_DEFAULTS: ConfigDefaults;
4
+ //#endregion
@@ -1,7 +1,7 @@
1
- import { $i as ToolExecuteResponse, Ji as Tool, Zi as ToolExecuteParams } from "../../customTool.types-B6ej_8XZ.mjs";
1
+ import { ca as Tool, da as ToolExecuteParams, pa as ToolExecuteResponse } from "../../customTool.types-CY5SXFfF.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
  //#region src/utils/modifiers/FileToolModifier.node.d.ts
4
- declare class FileToolModifier {
4
+ export declare class FileToolModifier {
5
5
  private client;
6
6
  private fileUploadPathOptions;
7
7
  constructor(client: ComposioClient, fileUploadPathOptions?: FileToolModifier['fileUploadPathOptions']);
@@ -19,5 +19,4 @@ declare class FileToolModifier {
19
19
  signal?: AbortSignal;
20
20
  }): Promise<ToolExecuteResponse>;
21
21
  }
22
- //#endregion
23
- export { FileToolModifier };
22
+ //#endregion
@@ -1,9 +1,9 @@
1
- import { i as logger } from "../../SsrfErrors-xhdVE4yw.mjs";
2
- import { f as ComposioRequestCancelledError } from "../../errors-Ue9wMrPK.mjs";
3
- import { a as ComposioSensitiveFilePathBlockedError, i as ComposioFileUploadPathNotAllowedError, n as ComposioFileUploadAbortedError, r as ComposioFileUploadError, t as ComposioFileNotFoundError } from "../../FileModifierErrors-CwB-Inm9.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-D_YkHwZP.mjs";
5
- import { r as dereferenceJsonSchema, t as withCancellation } from "../../cancellation-P5YUlcfz.mjs";
6
- import { n as getFileDataAfterUploadingToS3, r as isHttpUrl, t as downloadFileFromS3 } from "../../fileUtils.node-KE5Fa-af.mjs";
1
+ import { i as logger } from "../../SsrfErrors-DiQldIdC.mjs";
2
+ import { f as ComposioRequestCancelledError } from "../../errors-CvZjP9CH.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-BEpFk2S8.mjs";
6
+ import { n as getFileDataAfterUploadingToS3, r as isHttpUrl, t as downloadFileFromS3 } from "../../fileUtils.node-HQsywtTj.mjs";
7
7
 
8
8
  //#region src/utils/modifiers/FileToolModifier.node.ts
9
9
  /**
@@ -1,7 +1,7 @@
1
- import { $i as ToolExecuteResponse, Ji as Tool, Zi as ToolExecuteParams } from "../../customTool.types-B6ej_8XZ.mjs";
1
+ import { ca as Tool, da as ToolExecuteParams, pa as ToolExecuteResponse } from "../../customTool.types-CY5SXFfF.mjs";
2
2
  import ComposioClient from "@composio/client";
3
3
  //#region src/utils/modifiers/FileToolModifier.workerd.d.ts
4
- declare class FileToolModifier {
4
+ export declare class FileToolModifier {
5
5
  constructor(_client: ComposioClient);
6
6
  modifyToolSchema(schema: Tool): Promise<Tool>;
7
7
  fileUploadModifier(_tool: Tool, _options: {
@@ -17,5 +17,4 @@ declare class FileToolModifier {
17
17
  signal?: AbortSignal;
18
18
  }): Promise<ToolExecuteResponse>;
19
19
  }
20
- //#endregion
21
- export { FileToolModifier };
20
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { c as transformProperties } from "../../FileToolModifier.utils.neutral-D_YkHwZP.mjs";
1
+ import { c as transformProperties } from "../../FileToolModifier.utils.neutral-DWFpnsj2.mjs";
2
2
 
3
3
  //#region 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).";
@@ -4,7 +4,7 @@
4
4
  * non-publicly-routable address. Fails closed (returns `true`) for anything that
5
5
  * is not a valid IPv4/IPv6 literal.
6
6
  */
7
- declare const isBlockedIp: (ip: string) => boolean;
7
+ export declare const isBlockedIp: (ip: string) => boolean;
8
8
  /**
9
9
  * Validate a single URL: it must be http(s), its host must resolve, and every
10
10
  * resolved address must be publicly routable. Throws
@@ -14,19 +14,20 @@ declare const isBlockedIp: (ip: string) => boolean;
14
14
  * must connect to *those* rather than let the client resolve the hostname
15
15
  * again; see {@link ssrfSafeFetch}.
16
16
  */
17
- declare const assertSafeFetchTarget: (rawUrl: string) => Promise<string[]>;
17
+ export declare const assertSafeFetchTarget: (rawUrl: string) => Promise<string[]>;
18
18
  /**
19
19
  * Drop-in replacement for `fetch` that blocks SSRF. Validates the target, then
20
20
  * connects to the address it validated, and re-validates and re-pins every
21
21
  * redirect hop (redirects are followed manually up to {@link MAX_REDIRECTS}).
22
22
  * Intermediate redirect bodies are cancelled; non-redirect responses are
23
- * returned unchanged.
23
+ * returned unchanged. Each hop carries the method, body, and credential headers
24
+ * the Fetch standard says it should — see {@link applyRedirectSemantics}.
24
25
  *
25
26
  * A hop whose effective dispatcher is a configured route (caller-supplied
26
27
  * `init.dispatcher`, non-stock global dispatcher, env-proxy mode) is *not*
27
28
  * pinned — see the module residual above.
28
29
  */
29
- declare const ssrfSafeFetch: (rawUrl: string, init?: RequestInit, maxRedirects?: number) => Promise<Response>;
30
+ export declare const ssrfSafeFetch: (rawUrl: string, init?: RequestInit, maxRedirects?: number) => Promise<Response>;
30
31
  /**
31
32
  * {@link ssrfSafeFetch} for call sites that must keep working on every runtime.
32
33
  *
@@ -36,6 +37,5 @@ declare const ssrfSafeFetch: (rawUrl: string, init?: RequestInit, maxRedirects?:
36
37
  * feature from Workers rather than close a hole reachable there. On Node this
37
38
  * is the full guard; only the edge build differs.
38
39
  */
39
- declare const ssrfSafeFetchWhereSupported: (rawUrl: string, init?: RequestInit, maxRedirects?: number) => Promise<Response>;
40
- //#endregion
41
- export { assertSafeFetchTarget, isBlockedIp, ssrfSafeFetch, ssrfSafeFetchWhereSupported };
40
+ export declare const ssrfSafeFetchWhereSupported: (rawUrl: string, init?: RequestInit, maxRedirects?: number) => Promise<Response>;
41
+ //#endregion
@@ -1,3 +1,3 @@
1
- import { i as ssrfSafeFetchWhereSupported, n as isBlockedIp, r as ssrfSafeFetch, t as assertSafeFetchTarget } from "../ssrfGuard.node-BLX6b-Rf.mjs";
1
+ import { i as ssrfSafeFetchWhereSupported, n as isBlockedIp, r as ssrfSafeFetch, t as assertSafeFetchTarget } from "../ssrfGuard.node-BK50mYTq.mjs";
2
2
 
3
3
  export { assertSafeFetchTarget, isBlockedIp, ssrfSafeFetch, ssrfSafeFetchWhereSupported };
@@ -4,7 +4,7 @@
4
4
  * hostname is publicly routable before connecting. Fail closed instead of
5
5
  * falling back to an unguarded fetch.
6
6
  */
7
- declare const ssrfSafeFetch: (rawUrl: string, _init?: RequestInit, _maxRedirects?: number) => Promise<Response>;
7
+ export declare const ssrfSafeFetch: (rawUrl: string, _init?: RequestInit, _maxRedirects?: number) => Promise<Response>;
8
8
  /**
9
9
  * Unguarded `fetch`, for the call sites that must keep working here.
10
10
  *
@@ -16,6 +16,5 @@ declare const ssrfSafeFetch: (rawUrl: string, _init?: RequestInit, _maxRedirects
16
16
  * check, and its `fetch` does not originate inside the caller's network. The
17
17
  * Node build applies the full guard.
18
18
  */
19
- declare const ssrfSafeFetchWhereSupported: (rawUrl: string, init?: RequestInit) => Promise<Response>;
20
- //#endregion
21
- export { ssrfSafeFetch, ssrfSafeFetchWhereSupported };
19
+ export declare const ssrfSafeFetchWhereSupported: (rawUrl: string, init?: RequestInit) => Promise<Response>;
20
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { t as ComposioBlockedInternalUrlError } from "../SsrfErrors-xhdVE4yw.mjs";
1
+ import { t as ComposioBlockedInternalUrlError } from "../SsrfErrors-DiQldIdC.mjs";
2
2
 
3
3
  //#region src/utils/ssrfGuard.workerd.ts
4
4
  /**
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "engines": {
5
5
  "node": ">=22.22.3"
6
6
  },
7
- "version": "0.18.1",
7
+ "version": "1.0.0-beta.1",
8
8
  "description": "",
9
9
  "main": "dist/index.mjs",
10
10
  "publishConfig": {
@@ -112,27 +112,27 @@
112
112
  "devDependencies": {
113
113
  "@type-challenges/utils": "^0.1.1",
114
114
  "@types/semver": "^7.8.0",
115
- "tsdown": "^0.22.14",
116
- "tsx": "^4.23.12",
115
+ "tsdown": "^0.23.0",
116
+ "tsx": "^4.23.13",
117
117
  "typedoc": "^0.28.20",
118
118
  "typescript": "npm:@typescript/typescript6@^6.0.2",
119
119
  "vitest": "^4.1.11",
120
- "zod": "^4.4.3"
120
+ "zod": "^4.5.4"
121
121
  },
122
122
  "peerDependencies": {
123
123
  "zod": ">=3.25.76 <5"
124
124
  },
125
125
  "dependencies": {
126
- "@composio/client": "0.1.0-alpha.76",
126
+ "@composio/client": "2.0.0-rc.7",
127
127
  "@types/json-schema": "^7.0.15",
128
128
  "is-fs-case-sensitive": "^2.0.0",
129
- "openai": "^7.2.0",
129
+ "openai": "^7.10.0",
130
130
  "picocolors": "^1.1.1",
131
131
  "pusher-js": "^8.6.0",
132
132
  "semver": "^7.8.5",
133
133
  "undici": "^7.29.0",
134
134
  "zod-to-json-schema": "^3.25.2",
135
- "@composio/json-schema-to-zod": "0.3.2"
135
+ "@composio/json-schema-to-zod": "0.3.3-beta.0"
136
136
  },
137
137
  "gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
138
138
  "repository": {
package/src/composio.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { BaseComposioProvider } from './provider/BaseProvider';
2
2
  import ComposioClient from '@composio/client';
3
+ import type { Logger as ClientLogger, LogLevel as ClientLogLevel } from '@composio/client';
3
4
  import { Tools } from './models/Tools';
4
5
  import { Toolkits } from './models/Toolkits';
5
6
  import { Triggers } from './models/Triggers';
@@ -7,10 +8,14 @@ import { AuthConfigs } from './models/AuthConfigs';
7
8
  import { ConnectedAccounts } from './models/ConnectedAccounts';
8
9
  import { Experimental } from './models/Experimental';
9
10
  import { MCP } from './models/MCP';
11
+ import { Webhooks } from './models/Webhooks';
12
+ import { Logs } from './models/Logs';
13
+ import { Keyring } from './models/Keyring';
10
14
  import { telemetry } from './telemetry/Telemetry';
11
15
  import { getSDKConfig, getToolkitVersionsFromEnv } from './utils/sdk';
12
16
  import logger from './utils/logger';
13
- import { COMPOSIO_LOG_LEVEL, IS_DEVELOPMENT_OR_CI } from './utils/constants';
17
+ import type { ComposioLogger, LogLevel } from './utils/logger';
18
+ import { IS_DEVELOPMENT_OR_CI } from './utils/constants';
14
19
  import { checkForLatestVersionFromNPM } from './utils/version';
15
20
  import { OpenAIProvider } from './provider/OpenAIProvider';
16
21
  import { version } from '../package.json';
@@ -156,6 +161,68 @@ export type ComposioConfig<
156
161
  * ```
157
162
  */
158
163
  toolkitVersions?: ToolkitVersionParam;
164
+ /**
165
+ * Destination for SDK log output. Messages are formatted and have
166
+ * credential-shaped values redacted before they reach the sink, so any
167
+ * object with `error`/`warn`/`info`/`debug` methods works (`console`, pino,
168
+ * winston, ...).
169
+ *
170
+ * Runtime deprecation warnings raised by the underlying API client (response
171
+ * `Deprecation`/`Sunset` headers and deprecated request inputs) are routed
172
+ * through this logger as well.
173
+ *
174
+ * The SDK logger is process-wide: configuring it on one `Composio` instance
175
+ * affects every instance, and the last configured instance wins.
176
+ *
177
+ * @default console
178
+ * @example
179
+ * ```typescript
180
+ * const composio = new Composio({
181
+ * apiKey: 'your-api-key',
182
+ * logger: pino(),
183
+ * logLevel: 'warn',
184
+ * });
185
+ * ```
186
+ */
187
+ logger?: ComposioLogger;
188
+ /**
189
+ * Minimum level to emit: `'silent' | 'error' | 'warn' | 'info' | 'debug'`.
190
+ * Takes precedence over the `COMPOSIO_LOG_LEVEL` environment variable.
191
+ * Also gates the API client's runtime deprecation warnings (`'silent'` turns
192
+ * them off). The client's per-request lifecycle logs are emitted at
193
+ * `'debug'` only.
194
+ *
195
+ * Like `logger`, this applies process-wide and the last configured instance
196
+ * wins. The API client's own level is fixed when each instance is created.
197
+ *
198
+ * @default 'info' (or `COMPOSIO_LOG_LEVEL` when set)
199
+ */
200
+ logLevel?: LogLevel;
201
+ };
202
+
203
+ /**
204
+ * Level for the API client given the SDK level. The client logs each request's
205
+ * lifecycle at `info`, which is debug-grade for SDK users, so the client stays
206
+ * at `warn` unless the SDK is at `debug`. The client's `LogLevel` has
207
+ * `'off'` where the SDK has `'silent'`.
208
+ */
209
+ const toClientLogLevel = (level: LogLevel): ClientLogLevel => {
210
+ if (level === 'silent') return 'off';
211
+ if (level === 'info') return 'warn';
212
+ return level;
213
+ };
214
+
215
+ /**
216
+ * Forwards the API client's log records to the SDK singleton so they pick up
217
+ * the SDK's formatting, redaction, and configured sink. Methods are looked up
218
+ * at call time so a later `logger.configure()` is honoured. The client's
219
+ * `info` records (per-request lifecycle) are forwarded as SDK `debug`.
220
+ */
221
+ const clientLoggerAdapter: ClientLogger = {
222
+ error: (...args) => logger.error(...args),
223
+ warn: (...args) => logger.warn(...args),
224
+ info: (...args) => logger.debug(...args),
225
+ debug: (...args) => logger.debug(...args),
159
226
  };
160
227
 
161
228
  /**
@@ -195,6 +262,15 @@ export class Composio<
195
262
  authConfigs: AuthConfigs;
196
263
  /** Manage authenticated connections */
197
264
  connectedAccounts: ConnectedAccounts;
265
+ /**
266
+ * Manage the project's webhook subscription (`webhooks.subscriptions`) and
267
+ * inbound per-toolkit webhook endpoints (`webhooks.endpoints`).
268
+ */
269
+ webhooks: Webhooks;
270
+ /** Search and inspect tool-execution logs */
271
+ logs: Logs;
272
+ /** Public transfer keys of the organization's customer-managed keyring */
273
+ keyring: Keyring;
198
274
  /**
199
275
  * Experimental SDK methods whose shape may change in future releases.
200
276
  * Prefer domain-specific mounts (for example
@@ -307,6 +383,10 @@ export class Composio<
307
383
  config?.apiKey
308
384
  );
309
385
 
386
+ if (config?.logger !== undefined || config?.logLevel !== undefined) {
387
+ logger.configure({ level: config.logLevel, sink: config.logger });
388
+ }
389
+
310
390
  if (IS_DEVELOPMENT_OR_CI) {
311
391
  logger.debug(`Initializing Composio w API Key: [REDACTED] and baseURL: ${baseURLParsed}`);
312
392
  }
@@ -346,7 +426,8 @@ export class Composio<
346
426
  apiKey: apiKeyParsed,
347
427
  baseURL: baseURLParsed,
348
428
  defaultHeaders: defaultHeaders,
349
- logLevel: COMPOSIO_LOG_LEVEL,
429
+ logger: clientLoggerAdapter,
430
+ logLevel: toClientLogLevel(logger.getLevel()),
350
431
  });
351
432
 
352
433
  this.tools = new Tools(this.client, this.config);
@@ -360,6 +441,9 @@ export class Composio<
360
441
  fileDownloadDir: this.config.fileDownloadDir,
361
442
  });
362
443
  this.connectedAccounts = new ConnectedAccounts(this.client);
444
+ this.webhooks = new Webhooks(this.client);
445
+ this.logs = new Logs(this.client);
446
+ this.keyring = new Keyring(this.client);
363
447
  this.experimental = new Experimental(this.client);
364
448
  this.sessions = new Sessions(this.client, this.config);
365
449
  this.toolRouter = this.sessions;