@composio/core 0.31.0 → 0.33.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 (92) hide show
  1. package/dist/{CustomTool-9Vlb4XaS.mjs → CustomTool-B4dQn2M5.mjs} +1 -1
  2. package/dist/{CustomTool-Ds5aLDth.d.mts → CustomTool-C2kvAvzk.d.mts} +1 -1
  3. package/dist/{FileModifierErrors-WrqokuIF.mjs → FileModifierErrors-D-AKc3ds.mjs} +1 -1
  4. package/dist/{SsrfErrors-BSVMW915.mjs → SsrfErrors-BekZPeWY.mjs} +59 -12
  5. package/dist/{Telemetry-a7SOQXcg.mjs → Telemetry-CcCuFVUb.mjs} +2 -2
  6. package/dist/composio-BqE615oV.d.mts +20365 -0
  7. package/dist/{customTool.types-DHxXBU6E.d.mts → customTool.types-DnyEZmlx.d.mts} +510 -33
  8. package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +20 -12
  9. package/dist/docs/reference/sdk-reference/typescript/composio.mdx +28 -10
  10. package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +96 -40
  11. package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +8 -6
  12. package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +4 -3
  13. package/dist/docs/reference/sdk-reference/typescript/index.mdx +4 -2
  14. package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +6 -3
  15. package/dist/docs/reference/sdk-reference/typescript/logs.mdx +5 -3
  16. package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +53 -42
  17. package/dist/docs/reference/sdk-reference/typescript/meta.json +1 -0
  18. package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +5 -14
  19. package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +5 -3
  20. package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +7 -5
  21. package/dist/docs/reference/sdk-reference/typescript/session-webhooks.mdx +64 -0
  22. package/dist/docs/reference/sdk-reference/typescript/session.mdx +16 -16
  23. package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +36 -8
  24. package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +14 -11
  25. package/dist/docs/reference/sdk-reference/typescript/tools.mdx +16 -18
  26. package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +42 -30
  27. package/dist/docs/reference/sdk-reference/typescript/usage.mdx +6 -4
  28. package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +9 -7
  29. package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +13 -9
  30. package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +3 -1
  31. package/dist/{errors-xC13uvaA.mjs → errors-CtIKA9BH.mjs} +2 -2
  32. package/dist/experimental/index.d.mts +2 -2
  33. package/dist/experimental/index.mjs +1 -1
  34. package/dist/{fileUtils.node-CAwIbWYH.mjs → fileUtils.node-DPMtE0ER.mjs} +7 -71
  35. package/dist/index.d.mts +7 -245
  36. package/dist/index.mjs +573 -251
  37. package/dist/jsonSchema-CDHLYm7d.d.mts +237 -0
  38. package/dist/{jsonSchema-Cc4EtHRw.mjs → jsonSchema-CfZwBS13.mjs} +7 -3
  39. package/dist/models/Files.node.mjs +3 -3
  40. package/dist/{sensitiveFileUploadPaths-CSyJ3Ku8.mjs → sensitiveFileUploadPaths-6NcnFSyX.mjs} +82 -85
  41. package/dist/{ssrfGuard.node-CdIkwqVu.mjs → ssrfGuard.node-B749ae5Q.mjs} +1 -1
  42. package/dist/{types-DcdZy5Nc.d.mts → types-Cwr_Makk.d.mts} +2 -2
  43. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  44. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  45. package/dist/utils/json-schema.d.mts +2 -1
  46. package/dist/utils/json-schema.mjs +2 -1
  47. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  48. package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
  49. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  50. package/dist/utils/ssrfGuard.node.mjs +1 -1
  51. package/dist/utils/ssrfGuard.workerd.mjs +1 -1
  52. package/package.json +6 -6
  53. package/src/composio.ts +26 -7
  54. package/src/errors/ComposioError.ts +3 -2
  55. package/src/index.ts +19 -0
  56. package/src/lib/toolRouterParams.ts +38 -14
  57. package/src/models/AuthConfigs.ts +10 -3
  58. package/src/models/ConnectedAccounts.ts +101 -28
  59. package/src/models/CustomTool.ts +0 -10
  60. package/src/models/Keyring.ts +2 -1
  61. package/src/models/MCP.ts +43 -35
  62. package/src/models/SessionWebhooks.ts +136 -0
  63. package/src/models/ToolRouter.ts +39 -4
  64. package/src/models/ToolRouterSession.ts +2 -2
  65. package/src/models/ToolRouterSessionFileMount.ts +3 -1
  66. package/src/models/Toolkits.ts +1 -0
  67. package/src/models/Tools.ts +4 -8
  68. package/src/models/Triggers.ts +48 -213
  69. package/src/models/Webhooks.ts +2 -0
  70. package/src/provider/ComposioProvider.ts +0 -1
  71. package/src/telemetry/BatchProcessor.ts +1 -1
  72. package/src/telemetry/Telemetry.ts +1 -1
  73. package/src/types/connectedAccountAuthStates.types.ts +0 -1
  74. package/src/types/connectedAccounts.types.ts +59 -1
  75. package/src/types/provider.types.ts +0 -1
  76. package/src/types/sessionWebhooks.types.ts +292 -0
  77. package/src/types/toolRouter.types.ts +35 -5
  78. package/src/types/triggers.types.ts +4 -0
  79. package/src/utils/crypto.ts +6 -5
  80. package/src/utils/env.ts +2 -5
  81. package/src/utils/fileUtils.node.ts +5 -86
  82. package/src/utils/json-schema.ts +6 -0
  83. package/src/utils/jsonSchema.ts +17 -4
  84. package/src/utils/logger.ts +19 -9
  85. package/src/utils/mime.ts +25 -385
  86. package/src/utils/mimeTables.generated.ts +356 -0
  87. package/src/utils/pusher.ts +5 -2
  88. package/src/utils/readResponseBody.ts +30 -17
  89. package/src/utils/transformers/authConfigs.ts +0 -1
  90. package/src/utils/userCallback.ts +3 -1
  91. package/src/utils/webhookVerification.ts +211 -0
  92. package/dist/composio-Ba89XGHL.d.mts +0 -9736
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { _ as getEnvsWithPrefix, d as DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID, f as IS_DEVELOPMENT_OR_CI, g as getEnvVariable, h as constants_exports, i as apiErrorSuggestedFixes, l as COMPOSIO_DIR, m as USER_DATA_FILE_NAME, n as SsrfErrorCodes, o as withApiErrorMessage, p as TEMP_FILES_DIRECTORY_NAME, r as ComposioError, s as logger, t as ComposioBlockedInternalUrlError, u as DEFAULT_BASE_URL } from "./SsrfErrors-BSVMW915.mjs";
2
- import { a as omitNullToolArguments, i as jsonSchemaToZodSchema, n as dereferenceJsonSchema, o as removeNonRequiredProperties, r as ensureObjectTypeOnProperties, s as toStrictJsonSchema, t as deduplicateJsonSchemaRequiredArrays } from "./jsonSchema-Cc4EtHRw.mjs";
3
- import { $ as ComposioAuthConfigNotFoundError, A as ComposioToolFetchRateLimitError, B as ConnectionRequestFailedError, C as ComposioInvalidExecuteFunctionError, D as ComposioToolExecutionError, E as ComposioProviderNotDefinedError, F as handleToolExecutionError, G as ComposioConnectedAccountRevocationNotSupportedError, H as ComposioAclOnlyForSharedError, I as isComposioRateLimitError, J as ComposioMultipleConnectedAccountsError, K as ComposioFailedToCreateConnectedAccountLink, L as getRetryAfterSeconds, M as ComposioToolSchemaInvalidError, N as ComposioToolVersionRequiredError, O as ComposioToolExecutionRateLimitError, P as ToolErrorCodes, Q as AuthConfigErrorCodes, R as isRateLimitResponse, S as ComposioGlobalExecuteToolFnNotSetError, T as ComposioInvalidToolArgumentsError, U as ComposioConnectedAccountNotFoundError, V as ConnectionRequestTimeoutError, W as ComposioConnectedAccountNotRevokableError, X as ComposioSharedConnectionNotAccessibleError, Y as ComposioSharedAccessDeniedError, Z as ConnectedAccountErrorCodes, _ as ValidationError, a as RemoteFileDownloadError, b as ComposioToolkitNotFoundError, c as ComposioFailedToGetSDKRealtimeCredentialsError, d as ComposioTriggerTypeNotFoundError, f as ComposioWebhookPayloadError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, i as ToolRouterErrorCodes, j as ComposioToolNotFoundError, k as ComposioToolFetchError, l as ComposioFailedToSubscribeToPusherChannelError, m as TriggerErrorCodes, n as ComposioSessionConfigConflictError, o as RemoteFileErrorCodes, p as ComposioWebhookSignatureVerificationError, q as ComposioLegacyConnectedAccountsEndpointRetiredError, r as ComposioToolInputRequiredError, s as ComposioFailedToCreatePusherClientError, t as ComposioMCPDestinationError, u as ComposioFailedToUnsubscribeFromPusherChannelError, v as ValidationErrorCodes, w as ComposioInvalidModifierError, x as ToolkitErrorCodes, y as ComposioToolkitFetchError, z as ConnectionRequestErrorCodes } from "./errors-xC13uvaA.mjs";
4
- import { t as telemetry } from "./Telemetry-a7SOQXcg.mjs";
1
+ import { _ as constants_exports, c as invokeUserCallback, d as COMPOSIO_DIR, f as DEFAULT_BASE_URL, g as USER_DATA_FILE_NAME, h as TEMP_FILES_DIRECTORY_NAME, i as apiErrorSuggestedFixes, l as logger, m as IS_DEVELOPMENT_OR_CI, n as SsrfErrorCodes, o as withApiErrorMessage, p as DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID, r as ComposioError, s as describeThrown, t as ComposioBlockedInternalUrlError, v as getEnvVariable, y as getEnvsWithPrefix } from "./SsrfErrors-BekZPeWY.mjs";
2
+ import { a as omitNullToolArguments, i as jsonSchemaToZodSchema, n as dereferenceJsonSchema, o as removeNonRequiredProperties, r as ensureObjectTypeOnProperties, s as toStrictJsonSchema, t as deduplicateJsonSchemaRequiredArrays } from "./jsonSchema-CfZwBS13.mjs";
3
+ import { $ as ComposioAuthConfigNotFoundError, A as ComposioToolFetchRateLimitError, B as ConnectionRequestFailedError, C as ComposioInvalidExecuteFunctionError, D as ComposioToolExecutionError, E as ComposioProviderNotDefinedError, F as handleToolExecutionError, G as ComposioConnectedAccountRevocationNotSupportedError, H as ComposioAclOnlyForSharedError, I as isComposioRateLimitError, J as ComposioMultipleConnectedAccountsError, K as ComposioFailedToCreateConnectedAccountLink, L as getRetryAfterSeconds, M as ComposioToolSchemaInvalidError, N as ComposioToolVersionRequiredError, O as ComposioToolExecutionRateLimitError, P as ToolErrorCodes, Q as AuthConfigErrorCodes, R as isRateLimitResponse, S as ComposioGlobalExecuteToolFnNotSetError, T as ComposioInvalidToolArgumentsError, U as ComposioConnectedAccountNotFoundError, V as ConnectionRequestTimeoutError, W as ComposioConnectedAccountNotRevokableError, X as ComposioSharedConnectionNotAccessibleError, Y as ComposioSharedAccessDeniedError, Z as ConnectedAccountErrorCodes, _ as ValidationError, a as RemoteFileDownloadError, b as ComposioToolkitNotFoundError, c as ComposioFailedToGetSDKRealtimeCredentialsError, d as ComposioTriggerTypeNotFoundError, f as ComposioWebhookPayloadError, g as JsonSchemaToZodError, h as JsonSchemaRefResolutionError, i as ToolRouterErrorCodes, j as ComposioToolNotFoundError, k as ComposioToolFetchError, l as ComposioFailedToSubscribeToPusherChannelError, m as TriggerErrorCodes, n as ComposioSessionConfigConflictError, o as RemoteFileErrorCodes, p as ComposioWebhookSignatureVerificationError, q as ComposioLegacyConnectedAccountsEndpointRetiredError, r as ComposioToolInputRequiredError, s as ComposioFailedToCreatePusherClientError, t as ComposioMCPDestinationError, u as ComposioFailedToUnsubscribeFromPusherChannelError, v as ValidationErrorCodes, w as ComposioInvalidModifierError, x as ToolkitErrorCodes, y as ComposioToolkitFetchError, z as ConnectionRequestErrorCodes } from "./errors-CtIKA9BH.mjs";
4
+ import { t as telemetry } from "./Telemetry-CcCuFVUb.mjs";
5
5
  import { n as dropEmptyFileUploads, o as isPlainObject, s as schemaHasFileUploadable } from "./FileToolModifier.utils.neutral-BQP85ZJj.mjs";
6
- import { c as arrayBufferToBase64, d as withCancellation, f as getRandomShortId, i as getExtensionFromMimeType, n as assertSafeFileUploadPath, o as MAX_URL_UPLOAD_SIZE_BYTES, r as isBlockedSensitiveFileUploadPath, s as readResponseBodyWithLimit, t as BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS } from "./sensitiveFileUploadPaths-CSyJ3Ku8.mjs";
7
- import { a as ComposioSensitiveFilePathBlockedError, c as ComposioNoAPIKeyError, d as SDKErrorCodes, f as isRequestAbortError, i as ComposioFileUploadPathNotAllowedError, l as ComposioRequestCancelledError, n as ComposioFileUploadAbortedError, o as FileModifierErrorCodes, r as ComposioFileUploadError, s as ComposioAPIKeyKindError, t as ComposioFileNotFoundError, u as ComposioScopeConfigError } from "./FileModifierErrors-WrqokuIF.mjs";
8
- import { a as createCustomToolkit, c as getPreloadedCustomToolSlugs, d as CreateCustomToolBaseSchema, f as CreateCustomToolkitBaseSchema, i as createCustomTool, l as serializeCustomToolkits, n as buildCustomToolsMap, o as findCustomToolMapEntryByFinalSlug, p as CustomToolSlugSchema, r as buildCustomToolsMapFromResponse, s as findCustomToolMapEntryByToolkitAndOriginalSlug, t as assertNoCustomToolSlugsInPreload, u as serializeCustomTools } from "./CustomTool-9Vlb4XaS.mjs";
6
+ import { c as readBodyWithLimit, i as getExtensionFromMimeType, l as readResponseBodyWithLimit, m as getRandomShortId, n as assertSafeFileUploadPath, o as MAX_URL_UPLOAD_SIZE_BYTES, p as withCancellation, r as isBlockedSensitiveFileUploadPath, s as assertValidBodyLimit, t as BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, u as arrayBufferToBase64 } from "./sensitiveFileUploadPaths-6NcnFSyX.mjs";
7
+ import { a as ComposioSensitiveFilePathBlockedError, c as ComposioNoAPIKeyError, d as SDKErrorCodes, f as isRequestAbortError, i as ComposioFileUploadPathNotAllowedError, l as ComposioRequestCancelledError, n as ComposioFileUploadAbortedError, o as FileModifierErrorCodes, r as ComposioFileUploadError, s as ComposioAPIKeyKindError, t as ComposioFileNotFoundError, u as ComposioScopeConfigError } from "./FileModifierErrors-D-AKc3ds.mjs";
8
+ import { a as createCustomToolkit, c as getPreloadedCustomToolSlugs, d as CreateCustomToolBaseSchema, f as CreateCustomToolkitBaseSchema, i as createCustomTool, l as serializeCustomToolkits, n as buildCustomToolsMap, o as findCustomToolMapEntryByFinalSlug, p as CustomToolSlugSchema, r as buildCustomToolsMapFromResponse, s as findCustomToolMapEntryByToolkitAndOriginalSlug, t as assertNoCustomToolSlugsInPreload, u as serializeCustomTools } from "./CustomTool-B4dQn2M5.mjs";
9
9
  import ComposioClient, { APIError, Auth, BadRequestError, ConflictError, createFetchTransport } from "@composio/client";
10
10
  import { FileToolModifier } from "#file_tool_modifier";
11
11
  import z, { z as z$1 } from "zod/v3";
@@ -639,7 +639,6 @@ const SamlConnectionDataSchema = z$1.discriminatedUnion("status", [
639
639
  expired_at: z$1.string().optional()
640
640
  }).catchall(z$1.unknown())
641
641
  ]);
642
- BaseSchemeRaw.catchall(z$1.unknown());
643
642
  const DcrOauthInitiatingSchema = BaseSchemeRaw.extend({ status: z$1.literal(ConnectionStatuses.INITIALIZING) }).catchall(z$1.unknown());
644
643
  const DcrOauthConnectionDataSchema = z$1.discriminatedUnion("status", [
645
644
  DcrOauthInitiatingSchema,
@@ -1567,7 +1566,7 @@ var Tools = class {
1567
1566
  * bare TypeError from deep inside Zod.
1568
1567
  */
1569
1568
  warnMalformedToolParameters(tool, error, droppedSides) {
1570
- const slug = String(tool.slug ?? "");
1569
+ const slug = typeof tool.slug === "string" ? tool.slug : "";
1571
1570
  if (slug && this.warnedMalformedToolParametersSlugs.has(slug)) return;
1572
1571
  if (slug) this.warnedMalformedToolParametersSlugs.add(slug);
1573
1572
  const inputFailed = droppedSides.includes("inputParameters");
@@ -1726,12 +1725,6 @@ var Tools = class {
1726
1725
  * tools: ['GITHUB_GET_REPOS', 'HACKERNEWS_GET_USER']
1727
1726
  * });
1728
1727
  *
1729
- * // Get tools from specific toolkits
1730
- * const githubTools = await composio.tools.getRawComposioTools({
1731
- * toolkits: ['github'],
1732
- * limit: 10
1733
- * });
1734
- *
1735
1728
  * // Get tools with schema transformation
1736
1729
  * const customizedTools = await composio.tools.getRawComposioTools({
1737
1730
  * toolkits: ['github'],
@@ -2139,6 +2132,8 @@ var Tools = class {
2139
2132
  *
2140
2133
  * @example Execute with SDK-level toolkit versions configuration
2141
2134
  * ```typescript
2135
+ * import { Composio } from '@composio/core';
2136
+ *
2142
2137
  * // If toolkitVersions are set during Composio initialization, no need to pass version
2143
2138
  * const composio = new Composio({ toolkitVersions: { github: '20250909_00' } });
2144
2139
  * const result = await composio.tools.execute('GITHUB_GET_REPOS', {
@@ -2261,7 +2256,7 @@ var Tools = class {
2261
2256
  * ```typescript
2262
2257
  * // Get all available tools as an enum
2263
2258
  * const toolsEnum = await composio.tools.getToolsEnum();
2264
- * console.log(toolsEnum.items);
2259
+ * console.log(toolsEnum); // ['GITHUB_GET_REPOS', ...]
2265
2260
  * ```
2266
2261
  */
2267
2262
  async getToolsEnum(requestOptions) {
@@ -2765,15 +2760,19 @@ var AuthConfigs = class {
2765
2760
  * @returns {Promise<CreateAuthConfigResponse>} Created auth config
2766
2761
  *
2767
2762
  * @example
2763
+ * import { AuthConfigTypes } from '@composio/core';
2764
+ *
2768
2765
  * // Use a specific Composio-managed app; omit managedAppId for the toolkit's default
2769
2766
  * const { composioManagedAuth } = await composio.toolkits.get('slack');
2770
- * const slackAuthConfig = await authConfigs.create('slack', {
2767
+ * const slackAuthConfig = await composio.authConfigs.create('slack', {
2771
2768
  * type: AuthConfigTypes.COMPOSIO_MANAGED,
2772
2769
  * managedAppId: composioManagedAuth?.find(app => !app.isDefault)?.managedAppId,
2773
2770
  * });
2774
2771
  *
2775
2772
  * @example
2776
- * const authConfig = await authConfigs.create('my-toolkit', {
2773
+ * import { AuthConfigTypes, AuthSchemeTypes } from '@composio/core';
2774
+ *
2775
+ * const authConfig = await composio.authConfigs.create('my-toolkit', {
2777
2776
  * type: AuthConfigTypes.CUSTOM,
2778
2777
  * name: 'My Custom Auth Config',
2779
2778
  * authScheme: AuthSchemeTypes.API_KEY,
@@ -2857,11 +2856,14 @@ var AuthConfigs = class {
2857
2856
  * apiKey: 'new-api-key-value'
2858
2857
  * }
2859
2858
  * });
2859
+ * ```
2860
2860
  *
2861
+ * @example
2862
+ * ```typescript
2861
2863
  * // Update a default auth config with new scopes
2862
2864
  * const updatedConfig = await composio.authConfigs.update('auth_abc123', {
2863
2865
  * type: 'default',
2864
- * scopes: ['read:user', 'repo']
2866
+ * scopes: 'read:user,repo'
2865
2867
  * });
2866
2868
  * ```
2867
2869
  */
@@ -3204,6 +3206,38 @@ const ConnectedAccountRefreshOptionsSchema = z$1.object({
3204
3206
  validateCredentials: z$1.boolean().optional()
3205
3207
  });
3206
3208
  const UpdateConnectedAccountParamsSchema = z$1.object({ enabled: z$1.boolean() });
3209
+ const credentialField = z$1.string().nullable().optional();
3210
+ const PatchConnectedAccountParamsSchema = z$1.object({
3211
+ alias: z$1.string().optional(),
3212
+ connection: z$1.object({ state: z$1.object({
3213
+ authScheme: z$1.enum([
3214
+ "BEARER_TOKEN",
3215
+ "API_KEY",
3216
+ "BASIC",
3217
+ "BASIC_WITH_JWT",
3218
+ "GOOGLE_SERVICE_ACCOUNT",
3219
+ "SERVICE_ACCOUNT"
3220
+ ]),
3221
+ val: z$1.object({
3222
+ token: credentialField,
3223
+ generic_api_key: credentialField,
3224
+ api_key: credentialField,
3225
+ bearer_token: credentialField,
3226
+ basic_encoded: credentialField,
3227
+ generic_token: credentialField,
3228
+ api_key_prefix: credentialField,
3229
+ generic_secret: credentialField,
3230
+ generic_id: credentialField,
3231
+ user_agent: credentialField,
3232
+ username: credentialField,
3233
+ password: credentialField,
3234
+ credentials_json: credentialField,
3235
+ application_id: credentialField,
3236
+ installation_id: credentialField,
3237
+ private_key: credentialField
3238
+ }).strict()
3239
+ }).strict() }).strict().optional()
3240
+ }).strict().refine((params) => params.alias !== void 0 || params.connection !== void 0, { message: "At least one of alias or connection must be provided" });
3207
3241
  /**
3208
3242
  * Params for `composio.connectedAccounts.updateAcl()`. Mirrors the inner
3209
3243
  * shape of the wire's `acl_config_for_shared` block — the SDK adds the
@@ -4195,6 +4229,13 @@ var Experimental = class {
4195
4229
  * @date 2025-05-05
4196
4230
  * @module ConnectedAccounts
4197
4231
  */
4232
+ const UpdateRequestSchema = z$1.union([PatchConnectedAccountParamsSchema.transform((body) => ({
4233
+ endpoint: "patch",
4234
+ body
4235
+ })), UpdateConnectedAccountParamsSchema.strict().transform((body) => ({
4236
+ endpoint: "status",
4237
+ body
4238
+ }))]);
4198
4239
  let _legacyInitiateWarningEmitted = false;
4199
4240
  /**
4200
4241
  * ConnectedAccounts class
@@ -4279,6 +4320,8 @@ var ConnectedAccounts = class {
4279
4320
  *
4280
4321
  * @example
4281
4322
  * ```typescript
4323
+ * import { AuthScheme } from '@composio/core';
4324
+ *
4282
4325
  * // For OAuth2 authentication
4283
4326
  * const connectionRequest = await composio.connectedAccounts.initiate(
4284
4327
  * 'user_123',
@@ -4291,17 +4334,27 @@ var ConnectedAccounts = class {
4291
4334
  * })
4292
4335
  * }
4293
4336
  * );
4337
+ * ```
4338
+ *
4339
+ * @example
4340
+ * ```typescript
4341
+ * import { AuthScheme } from '@composio/core';
4294
4342
  *
4295
4343
  * // For API Key authentication
4296
4344
  * const connectionRequest = await composio.connectedAccounts.initiate(
4297
4345
  * 'user_123',
4298
4346
  * 'auth_config_123',
4299
4347
  * {
4300
- * config: AuthScheme.ApiKey({
4348
+ * config: AuthScheme.APIKey({
4301
4349
  * api_key: 'your_api_key'
4302
4350
  * })
4303
4351
  * }
4304
4352
  * );
4353
+ * ```
4354
+ *
4355
+ * @example
4356
+ * ```typescript
4357
+ * import { AuthScheme } from '@composio/core';
4305
4358
  *
4306
4359
  * // For Basic authentication
4307
4360
  * const connectionRequest = await composio.connectedAccounts.initiate(
@@ -4437,7 +4490,10 @@ var ConnectedAccounts = class {
4437
4490
  * ```typescript
4438
4491
  * // Wait for a connection to complete with default timeout
4439
4492
  * const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc');
4493
+ * ```
4440
4494
  *
4495
+ * @example
4496
+ * ```typescript
4441
4497
  * // Wait with a custom timeout of 2 minutes
4442
4498
  * const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc', 120000);
4443
4499
  * ```
@@ -4573,11 +4629,16 @@ var ConnectedAccounts = class {
4573
4629
  *
4574
4630
  * @example
4575
4631
  * ```typescript
4576
- * // In your verifier route, after authenticating the user:
4577
- * const { connectedAccountId, toolkitSlug } = await composio.connectedAccounts.completeAuth({
4578
- * userId: 'user_123',
4579
- * sessionUri, // the session URI from the verifier redirect
4580
- * });
4632
+ * // Your verifier route, after authenticating the user
4633
+ * export async function GET(request: Request) {
4634
+ * // The session URI arrives as the `session_uri` query parameter of the verifier redirect
4635
+ * const sessionUri = new URL(request.url).searchParams.get('session_uri') ?? '';
4636
+ * const { connectedAccountId, toolkitSlug } = await composio.connectedAccounts.completeAuth({
4637
+ * userId: 'user_123',
4638
+ * sessionUri,
4639
+ * });
4640
+ * return new Response(`Connected ${toolkitSlug}: ${connectedAccountId}`);
4641
+ * }
4581
4642
  * ```
4582
4643
  */
4583
4644
  async completeAuth(params, requestOptions) {
@@ -4602,10 +4663,9 @@ var ConnectedAccounts = class {
4602
4663
  * enabled: true
4603
4664
  * });
4604
4665
  *
4605
- * // Disable a connected account with a reason
4666
+ * // Disable a connected account
4606
4667
  * const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
4607
- * enabled: false,
4608
- * reason: 'Token expired'
4668
+ * enabled: false
4609
4669
  * });
4610
4670
  * ```
4611
4671
  */
@@ -4621,7 +4681,7 @@ var ConnectedAccounts = class {
4621
4681
  * ```typescript
4622
4682
  * // Enable a previously disabled connected account
4623
4683
  * const enabledAccount = await composio.connectedAccounts.enable('conn_abc123');
4624
- * console.log(enabledAccount.isDisabled); // false
4684
+ * console.log(enabledAccount.success); // true
4625
4685
  * ```
4626
4686
  */
4627
4687
  async enable(nanoid, requestOptions) {
@@ -4636,13 +4696,7 @@ var ConnectedAccounts = class {
4636
4696
  * ```typescript
4637
4697
  * // Disable a connected account
4638
4698
  * const disabledAccount = await composio.connectedAccounts.disable('conn_abc123');
4639
- * console.log(disabledAccount.isDisabled); // true
4640
- *
4641
- * // You can also use updateStatus with a reason
4642
- * // const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
4643
- * // enabled: false,
4644
- * // reason: 'No longer needed'
4645
- * // });
4699
+ * console.log(disabledAccount.success); // true
4646
4700
  * ```
4647
4701
  */
4648
4702
  async disable(nanoid, requestOptions) {
@@ -4681,25 +4735,15 @@ var ConnectedAccounts = class {
4681
4735
  async updateAcl(nanoid, params) {
4682
4736
  return updateConnectedAccountAcl(this.client, nanoid, params);
4683
4737
  }
4684
- /**
4685
- * Enable or disable a connected account. Accepts `{ enabled: boolean }`.
4686
- *
4687
- * Use `updateAcl()` for ACL writes on SHARED connections.
4688
- *
4689
- * @param {string} nanoid - The unique identifier of the connected account
4690
- * @param {UpdateConnectedAccountParams} params - The update parameters
4691
- * @returns {Promise<ConnectedAccountUpdateStatusResponse>} The update response
4692
- *
4693
- * @example
4694
- * ```typescript
4695
- * // Disable an account
4696
- * await composio.connectedAccounts.update('ca_abc123', { enabled: false });
4697
- * ```
4698
- */
4699
4738
  async update(nanoid, params, requestOptions) {
4700
- const parsedParams = UpdateConnectedAccountParamsSchema.safeParse(params);
4739
+ const parsedParams = UpdateRequestSchema.safeParse(params);
4701
4740
  if (!parsedParams.success) throw new ValidationError("Failed to parse connected account update params", { cause: parsedParams.error });
4702
- return withCancellation(() => this.client.connectedAccounts.updateStatus(nanoid, parsedParams.data, requestOptions), requestOptions?.signal);
4741
+ const request = parsedParams.data;
4742
+ if (request.endpoint === "status") {
4743
+ logger.warn("connectedAccounts.update({ enabled }) is deprecated; use connectedAccounts.enable() or connectedAccounts.disable() instead.");
4744
+ return withCancellation(() => this.client.connectedAccounts.updateStatus(nanoid, request.body, requestOptions), requestOptions?.signal);
4745
+ }
4746
+ return withCancellation(() => this.client.connectedAccounts.patch(nanoid, request.body, requestOptions), requestOptions?.signal);
4703
4747
  }
4704
4748
  };
4705
4749
 
@@ -5134,6 +5178,7 @@ var Toolkits = class {
5134
5178
  *
5135
5179
  * @example
5136
5180
  * ```typescript
5181
+ * const userId = 'user_123';
5137
5182
  * const connectionRequest = await composio.toolkits.authorize(userId, 'github');
5138
5183
  * ```
5139
5184
  *
@@ -5391,7 +5436,9 @@ const VerifyWebhookParamsSchema = z$1.object({
5391
5436
  * Set to 0 to disable timestamp validation.
5392
5437
  * @default 300 (5 minutes)
5393
5438
  */
5394
- tolerance: z$1.number().optional().default(300)
5439
+ tolerance: z$1.number().optional().default(300),
5440
+ /** Maximum UTF-8 size of the supplied payload in bytes. */
5441
+ maxBodyBytes: z$1.number().int().nonnegative().safe().optional()
5395
5442
  });
5396
5443
 
5397
5444
  // src/types/webhooks.types.ts
@@ -5637,6 +5684,8 @@ var WebhookSubscriptions = class {
5637
5684
  *
5638
5685
  * @example
5639
5686
  * ```typescript
5687
+ * const APP_URL = 'https://your-app.com';
5688
+ *
5640
5689
  * const subscription = await composio.webhooks.subscriptions.set({
5641
5690
  * webhookUrl: `${APP_URL}/webhooks/composio`,
5642
5691
  * enabledEvents: ['composio.trigger.message', 'composio.connected_account.expired'],
@@ -5896,46 +5945,6 @@ var InternalService = class {
5896
5945
  }
5897
5946
  };
5898
5947
 
5899
- // src/utils/userCallback.ts
5900
- /**
5901
- * Describes a thrown or rejected value for a log line without ever throwing.
5902
- *
5903
- * The logger serializes object arguments with `JSON.stringify`, which turns an `Error` into `{}`
5904
- * and throws on a circular value, so callers log this string instead of the raw value.
5905
- * `JSON.stringify` and `String()` can both throw (a circular value, an object without a
5906
- * prototype), so each is tried in turn.
5907
- */
5908
- function describeThrown(value) {
5909
- try {
5910
- if (value instanceof Error) return value.message;
5911
- if (typeof value === "object" && value !== null) return JSON.stringify(value) ?? String(value);
5912
- return String(value);
5913
- } catch {
5914
- try {
5915
- return String(value);
5916
- } catch {
5917
- return "[unprintable value]";
5918
- }
5919
- }
5920
- }
5921
- /**
5922
- * Calls a user-supplied event callback so that neither a synchronous throw nor a rejected promise
5923
- * escapes into the event emitter that invoked it. Failures are logged after `label`.
5924
- *
5925
- * pusher-js does not catch listener exceptions, and nothing awaits the promise an `async`
5926
- * listener returns, so an escaped failure would end a Node process.
5927
- */
5928
- function invokeUserCallback(label, callback) {
5929
- const logFailure = (error) => {
5930
- logger.error(label, describeThrown(error));
5931
- };
5932
- try {
5933
- Promise.resolve(callback()).catch(logFailure);
5934
- } catch (error) {
5935
- logFailure(error);
5936
- }
5937
- }
5938
-
5939
5948
  // src/utils/sdk.ts
5940
5949
  /**
5941
5950
  * Header that carries a Composio user API key (`uak_...`) instead of a project
@@ -6635,14 +6644,12 @@ function transformTriggerInstanceListActiveResponse(response) {
6635
6644
  * Computes HMAC-SHA256 using Web Crypto API
6636
6645
  */
6637
6646
  async function hmacSha256Base64(secret, message) {
6638
- const encoder = new TextEncoder();
6639
- const keyData = encoder.encode(secret);
6647
+ const keyData = new TextEncoder().encode(secret);
6640
6648
  const key = await globalThis.crypto.subtle.importKey("raw", keyData, {
6641
6649
  name: "HMAC",
6642
6650
  hash: "SHA-256"
6643
6651
  }, false, ["sign"]);
6644
- const signatureData = encoder.encode(message);
6645
- const signatureBuffer = await globalThis.crypto.subtle.sign("HMAC", key, signatureData);
6652
+ const signatureBuffer = await globalThis.crypto.subtle.sign("HMAC", key, message);
6646
6653
  return arrayBufferToBase64(signatureBuffer);
6647
6654
  }
6648
6655
  /**
@@ -6655,36 +6662,56 @@ function timingSafeEqual(a, b) {
6655
6662
  return result === 0;
6656
6663
  }
6657
6664
 
6658
- // src/models/Triggers.ts
6665
+ // src/utils/webhookVerification.ts
6666
+ const DEFAULT_WEBHOOK_BODY_LIMIT_BYTES = 10485760;
6659
6667
  /**
6660
- * Safely converts a value to a string, returning the default if the value is null, undefined, or empty.
6661
- * This prevents runtime crashes when calling string methods like `.toLowerCase()` on non-string values.
6662
- * @private
6663
- */
6664
- const toStringOrDefault = (value, defaultValue) => {
6665
- if (value === null || value === void 0) return defaultValue;
6666
- const str = String(value);
6667
- return str.length > 0 ? str : defaultValue;
6668
- };
6669
- /**
6670
- * The signature header names Composio sends with every webhook delivery.
6671
- * @private
6668
+ * The signature header names Composio sends with every webhook request.
6672
6669
  */
6673
6670
  const WEBHOOK_HEADERS = {
6674
6671
  id: "webhook-id",
6675
6672
  timestamp: "webhook-timestamp",
6676
6673
  signature: "webhook-signature"
6677
6674
  };
6675
+ const isFetchRequest = (request) => typeof Request !== "undefined" && request instanceof Request;
6678
6676
  /**
6679
- * Returns true if the value is a Fetch API `Request`.
6680
- * @private
6677
+ * Coerces an already-buffered request body into the string expected by
6678
+ * signature verification.
6681
6679
  */
6682
- const isFetchRequest = (request) => typeof Request !== "undefined" && request instanceof Request;
6680
+ const bodyToString = (body) => {
6681
+ if (typeof body === "string") return body;
6682
+ if (body === null || body === void 0) return "";
6683
+ if (typeof body === "object") return JSON.stringify(body);
6684
+ return describeThrown(body);
6685
+ };
6686
+ const webhookBodyLimitError = (maxBytes) => new ComposioWebhookPayloadError(`Webhook payload exceeds the ${maxBytes}-byte limit`);
6687
+ const assertWebhookBodySize = (body, maxBytes) => {
6688
+ assertValidBodyLimit(maxBytes);
6689
+ if (body.length > maxBytes || typeof body === "string" && new TextEncoder().encode(body).byteLength > maxBytes) throw webhookBodyLimitError(maxBytes);
6690
+ };
6691
+ /**
6692
+ * Reads the raw body and the headers from either request shape: a Fetch API
6693
+ * `Request`, or a plain `{ body, headers }` object.
6694
+ */
6695
+ const readWebhookRequest = async (request, maxBytes = DEFAULT_WEBHOOK_BODY_LIMIT_BYTES) => {
6696
+ if (isFetchRequest(request)) {
6697
+ if (request.bodyUsed) throw new TypeError("Webhook request body has already been read");
6698
+ const bytes = await readBodyWithLimit(request, maxBytes, () => webhookBodyLimitError(maxBytes));
6699
+ return {
6700
+ body: new TextDecoder().decode(bytes),
6701
+ headers: request.headers
6702
+ };
6703
+ }
6704
+ const body = request.body instanceof Uint8Array ? request.body : bodyToString(request.body);
6705
+ assertWebhookBodySize(body, maxBytes);
6706
+ return {
6707
+ body: typeof body === "string" ? body : new TextDecoder().decode(body),
6708
+ headers: request.headers
6709
+ };
6710
+ };
6683
6711
  /**
6684
6712
  * Reads a single header value case-insensitively from either a `Headers`
6685
6713
  * instance or a plain record (where values may be `string | string[]`).
6686
6714
  * Returns `undefined` when the header is missing.
6687
- * @private
6688
6715
  */
6689
6716
  const getHeader = (headers, name) => {
6690
6717
  if (typeof Headers !== "undefined" && headers instanceof Headers) return headers.get(name) ?? void 0;
@@ -6697,16 +6724,56 @@ const getHeader = (headers, name) => {
6697
6724
  }
6698
6725
  };
6699
6726
  /**
6700
- * Coerces an object request body (string, Buffer/Uint8Array, or already-parsed
6701
- * value) into the raw string form expected by signature verification.
6727
+ * Verifies the HMAC-SHA256 signature of a webhook payload.
6728
+ * The signature format used by Composio is: `v1,base64EncodedSignature`
6729
+ * The signing input is the UTF-8 prefix `${msgId}.${timestamp}.` followed by
6730
+ * the original payload bytes.
6731
+ */
6732
+ async function verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret) {
6733
+ if (payload.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook payload was provided.");
6734
+ if (signature.length === 0) throw new ComposioWebhookSignatureVerificationError("No signature header value was provided. Please pass the value of the 'webhook-signature' header.");
6735
+ if (secret.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook secret was provided. You can find your webhook secret in your Composio dashboard.");
6736
+ if (webhookId.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook ID was provided. Please pass the value of the 'webhook-id' header.");
6737
+ if (webhookTimestamp.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook timestamp was provided. Please pass the value of the 'webhook-timestamp' header.");
6738
+ const signatures = signature.split(" ");
6739
+ const v1Signatures = [];
6740
+ for (const sig of signatures) {
6741
+ const [version, value] = sig.split(",");
6742
+ if (version === "v1" && value) v1Signatures.push(value);
6743
+ }
6744
+ if (v1Signatures.length === 0) throw new ComposioWebhookSignatureVerificationError("No valid v1 signature found in the webhook-signature header. Expected format: 'v1,base64EncodedSignature'");
6745
+ const encoder = new TextEncoder();
6746
+ const prefix = `${webhookId}.${webhookTimestamp}.`;
6747
+ let toSign;
6748
+ if (typeof payload === "string") toSign = encoder.encode(prefix + payload);
6749
+ else {
6750
+ const prefixBytes = encoder.encode(prefix);
6751
+ toSign = new Uint8Array(prefixBytes.length + payload.length);
6752
+ toSign.set(prefixBytes);
6753
+ toSign.set(payload, prefixBytes.length);
6754
+ }
6755
+ const expectedSignature = await hmacSha256Base64(secret, toSign);
6756
+ if (!v1Signatures.some((candidate) => timingSafeEqual(candidate, expectedSignature))) throw new ComposioWebhookSignatureVerificationError("The signature provided is invalid. Please ensure you are using the correct webhook secret.");
6757
+ }
6758
+ /**
6759
+ * Validates that the webhook timestamp is within the allowed tolerance
6760
+ */
6761
+ function validateWebhookTimestamp(webhookTimestamp, tolerance) {
6762
+ const timestampSeconds = parseInt(webhookTimestamp, 10);
6763
+ if (Number.isNaN(timestampSeconds)) throw new ComposioWebhookPayloadError(`Invalid webhook timestamp: ${webhookTimestamp}. Expected Unix timestamp in seconds.`);
6764
+ const webhookTimeMs = timestampSeconds * 1e3;
6765
+ const timeDifference = Math.abs(Date.now() - webhookTimeMs);
6766
+ if (timeDifference > tolerance * 1e3) throw new ComposioWebhookSignatureVerificationError(`The webhook timestamp is outside the allowed tolerance. The webhook was sent ${Math.round(timeDifference / 1e3)} seconds ago, but the maximum allowed age is ${tolerance} seconds.`);
6767
+ }
6768
+
6769
+ // src/models/Triggers.ts
6770
+ /**
6771
+ * Normalizes string and numeric identifiers, falling back for empty or malformed values.
6702
6772
  * @private
6703
6773
  */
6704
- const bodyToString = (body) => {
6705
- if (typeof body === "string") return body;
6706
- if (body instanceof Uint8Array) return new TextDecoder().decode(body);
6707
- if (body === null || body === void 0) return "";
6708
- if (typeof body === "object") return JSON.stringify(body);
6709
- return String(body);
6774
+ const toStringOrDefault = (value, defaultValue) => {
6775
+ const str = typeof value === "string" || typeof value === "number" ? String(value) : "";
6776
+ return str.length > 0 ? str : defaultValue;
6710
6777
  };
6711
6778
  /**
6712
6779
  * Trigger (Instance) class
@@ -6736,6 +6803,8 @@ var Triggers = class {
6736
6803
  *
6737
6804
  * @example
6738
6805
  * ```ts
6806
+ * const APP_URL = 'https://your-app.com';
6807
+ *
6739
6808
  * await composio.triggers.setWebhookSubscription({
6740
6809
  * webhookUrl: `${APP_URL}/webhooks/composio`,
6741
6810
  * });
@@ -6755,7 +6824,7 @@ var Triggers = class {
6755
6824
  *
6756
6825
  * @example
6757
6826
  * ```ts
6758
- * const triggers = await triggers.listActive({
6827
+ * const activeTriggers = await composio.triggers.listActive({
6759
6828
  * authConfigIds: ['123'],
6760
6829
  * connectedAccountIds: ['456'],
6761
6830
  * });
@@ -6955,10 +7024,9 @@ var Triggers = class {
6955
7024
  *
6956
7025
  * @example
6957
7026
  * ```ts
6958
- *
6959
- * triggers.subscribe((data) => {
7027
+ * await composio.triggers.subscribe((data) => {
6960
7028
  * console.log(data);
6961
- * }, );
7029
+ * });
6962
7030
  * ```
6963
7031
  */
6964
7032
  async subscribe(fn, filters = {}, onSubscriptionError) {
@@ -7064,11 +7132,11 @@ var Triggers = class {
7064
7132
  *
7065
7133
  * @example
7066
7134
  * ```ts
7067
- * composio.trigger.subscribe((data) => {
7135
+ * await composio.triggers.subscribe((data) => {
7068
7136
  * console.log(data);
7069
7137
  * });
7070
7138
  *
7071
- * await triggers.unsubscribe();
7139
+ * await composio.triggers.unsubscribe();
7072
7140
  * ```
7073
7141
  */
7074
7142
  async unsubscribe() {
@@ -7087,18 +7155,22 @@ var Triggers = class {
7087
7155
  * Next.js Pages Router `req`). The signature headers (`webhook-id`,
7088
7156
  * `webhook-timestamp`, `webhook-signature`) are read case-insensitively.
7089
7157
  *
7158
+ * Configure a request body limit in your server or framework as well,
7159
+ * especially if it buffers the body before calling this method.
7160
+ *
7090
7161
  * @param {WebhookRequestLike} request - The incoming webhook HTTP request
7091
7162
  * @param {ParseWebhookOptions} [options] - Parse options
7092
7163
  * @param {string} [options.verifySecret] - Webhook secret; when set, the signature is verified
7093
7164
  * @param {number} [options.tolerance=300] - Max webhook age in seconds (only used when verifying)
7165
+ * @param {number} [options.maxBodyBytes=10485760] - Max request body size in bytes (10 MiB)
7094
7166
  * @returns {Promise<VerifyWebhookResult>} The parsed (and optionally verified) webhook payload
7095
7167
  *
7096
7168
  * @throws {ValidationError} If `verifySecret` is set but the signature headers are missing
7097
7169
  * @throws {ComposioWebhookSignatureVerificationError} If signature verification fails
7098
- * @throws {ComposioWebhookPayloadError} If the payload cannot be parsed
7170
+ * @throws {ComposioWebhookPayloadError} If the payload exceeds the limit or cannot be parsed
7099
7171
  *
7100
7172
  * @example
7101
- * ```ts
7173
+ * ```ts nocheck="Express route handler; the checker has no express types"
7102
7174
  * // Express with express.raw (verify the signature)
7103
7175
  * app.post('/webhooks/composio', express.raw({ type: 'application/json' }), async (req, res) => {
7104
7176
  * try {
@@ -7136,7 +7208,10 @@ var Triggers = class {
7136
7208
  * return new Response('Unauthorized', { status: 401 });
7137
7209
  * }
7138
7210
  * }
7211
+ * ```
7139
7212
  *
7213
+ * @example
7214
+ * ```ts
7140
7215
  * // Next.js App Router — parse only (no verification)
7141
7216
  * export async function POST(request: Request) {
7142
7217
  * const result = await composio.triggers.parse(request);
@@ -7146,15 +7221,7 @@ var Triggers = class {
7146
7221
  * ```
7147
7222
  */
7148
7223
  async parse(request, options) {
7149
- let body;
7150
- let headers;
7151
- if (isFetchRequest(request)) {
7152
- body = await request.text();
7153
- headers = request.headers;
7154
- } else {
7155
- body = bodyToString(request.body);
7156
- headers = request.headers;
7157
- }
7224
+ const { body, headers } = await readWebhookRequest(request, options?.maxBodyBytes);
7158
7225
  const verifySecret = options?.verifySecret;
7159
7226
  if (options === void 0 || !("verifySecret" in options)) {
7160
7227
  const { version, rawPayload, normalizedPayload } = this.parseWebhookPayload(body);
@@ -7195,6 +7262,9 @@ var Triggers = class {
7195
7262
  * The signature is computed as: `HMAC-SHA256(${webhookId}.${webhookTimestamp}.${payload}, secret)`
7196
7263
  * and is expected in the format: `v1,base64EncodedSignature`
7197
7264
  *
7265
+ * For a Fetch API `Request`, use {@link parse} to enforce a limit while reading
7266
+ * the body. Set a server request limit if you buffer the payload yourself.
7267
+ *
7198
7268
  * @param {VerifyWebhookParams} params - The verification parameters
7199
7269
  * @param {string} params.payload - The raw webhook payload as a string (request body)
7200
7270
  * @param {string} params.signature - The signature from the 'webhook-signature' header
@@ -7202,6 +7272,7 @@ var Triggers = class {
7202
7272
  * @param {string} params.webhookId - The webhook ID from the 'webhook-id' header
7203
7273
  * @param {string} params.webhookTimestamp - The timestamp from the 'webhook-timestamp' header (Unix seconds)
7204
7274
  * @param {number} [params.tolerance=300] - Maximum allowed age of the webhook in seconds (default: 5 minutes). Set to 0 to disable timestamp validation.
7275
+ * @param {number} [params.maxBodyBytes] - Max UTF-8 size of the supplied payload
7205
7276
  * @returns {VerifyWebhookResult} The verified and parsed webhook payload with version information
7206
7277
  *
7207
7278
  * @throws {ValidationError} If the parameters are invalid
@@ -7210,26 +7281,26 @@ var Triggers = class {
7210
7281
  *
7211
7282
  * @example
7212
7283
  * ```ts
7213
- * // In an Express.js webhook handler
7214
- * app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
7284
+ * // In a webhook route that receives a Fetch API Request (Next.js App Router, Hono, Remix)
7285
+ * export async function POST(request: Request) {
7215
7286
  * try {
7216
7287
  * const result = await composio.triggers.verifyWebhook({
7217
- * payload: req.body.toString(),
7218
- * signature: req.headers['webhook-signature'] as string,
7219
- * webhookId: req.headers['webhook-id'] as string,
7220
- * webhookTimestamp: req.headers['webhook-timestamp'] as string,
7288
+ * payload: await request.text(),
7289
+ * signature: request.headers.get('webhook-signature') ?? '',
7290
+ * id: request.headers.get('webhook-id') ?? '',
7291
+ * timestamp: request.headers.get('webhook-timestamp') ?? '',
7221
7292
  * secret: process.env.COMPOSIO_WEBHOOK_SECRET!,
7222
7293
  * });
7223
7294
  *
7224
7295
  * // Process the verified payload
7225
7296
  * console.log('Webhook version:', result.version);
7226
7297
  * console.log('Received trigger:', result.payload.triggerSlug);
7227
- * res.status(200).send('OK');
7298
+ * return new Response('OK', { status: 200 });
7228
7299
  * } catch (error) {
7229
7300
  * console.error('Webhook verification failed:', error);
7230
- * res.status(401).send('Unauthorized');
7301
+ * return new Response('Unauthorized', { status: 401 });
7231
7302
  * }
7232
- * });
7303
+ * }
7233
7304
  * ```
7234
7305
  */
7235
7306
  async verifyWebhook(params) {
@@ -7247,9 +7318,10 @@ var Triggers = class {
7247
7318
  if (missingParams.length > 0) throw new ValidationError(`Missing required parameters: ${missingParams.join(", ")}. Extract these values from the HTTP request headers and body.`, { cause: parsedParams.error });
7248
7319
  throw new ValidationError("Invalid parameters passed to verifyWebhook", { cause: parsedParams.error });
7249
7320
  }
7250
- const { payload, signature, secret, id: webhookId, timestamp: webhookTimestamp, tolerance } = parsedParams.data;
7251
- if (tolerance > 0) this.validateWebhookTimestamp(webhookTimestamp, tolerance);
7252
- await this.verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret);
7321
+ const { payload, signature, secret, id: webhookId, timestamp: webhookTimestamp, tolerance, maxBodyBytes } = parsedParams.data;
7322
+ if (maxBodyBytes !== void 0) assertWebhookBodySize(payload, maxBodyBytes);
7323
+ if (tolerance > 0) validateWebhookTimestamp(webhookTimestamp, tolerance);
7324
+ await verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret);
7253
7325
  const { version, rawPayload, normalizedPayload } = this.parseWebhookPayload(payload);
7254
7326
  return {
7255
7327
  version,
@@ -7270,7 +7342,7 @@ var Triggers = class {
7270
7342
  }
7271
7343
  const result = this.tryParseVersionedPayload(jsonPayload);
7272
7344
  if (result.ok) {
7273
- const { ok, ...rest } = result;
7345
+ const { ok: _ok, ...rest } = result;
7274
7346
  return rest;
7275
7347
  }
7276
7348
  const { v1Error, v2Error, v3Error } = result;
@@ -7404,45 +7476,6 @@ var Triggers = class {
7404
7476
  }
7405
7477
  };
7406
7478
  }
7407
- /**
7408
- * Verifies the HMAC-SHA256 signature of a webhook payload.
7409
- * The signature format used by Composio is: `v1,base64EncodedSignature`
7410
- * The signing input is: `${msgId}.${timestamp}.${payload}`
7411
- * @private
7412
- */
7413
- async verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret) {
7414
- if (payload.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook payload was provided.");
7415
- if (signature.length === 0) throw new ComposioWebhookSignatureVerificationError("No signature header value was provided. Please pass the value of the 'webhook-signature' header.");
7416
- if (secret.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook secret was provided. You can find your webhook secret in your Composio dashboard.");
7417
- if (webhookId.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook ID was provided. Please pass the value of the 'webhook-id' header.");
7418
- if (webhookTimestamp.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook timestamp was provided. Please pass the value of the 'webhook-timestamp' header.");
7419
- const signatures = signature.split(" ");
7420
- const v1Signatures = [];
7421
- for (const sig of signatures) {
7422
- const [version, value] = sig.split(",");
7423
- if (version === "v1" && value) v1Signatures.push(value);
7424
- }
7425
- if (v1Signatures.length === 0) throw new ComposioWebhookSignatureVerificationError("No valid v1 signature found in the webhook-signature header. Expected format: 'v1,base64EncodedSignature'");
7426
- const toSign = `${webhookId}.${webhookTimestamp}.${payload}`;
7427
- const expectedSignature = await hmacSha256Base64(secret, toSign);
7428
- let isValid = false;
7429
- for (const providedSignature of v1Signatures) if (timingSafeEqual(providedSignature, expectedSignature)) {
7430
- isValid = true;
7431
- break;
7432
- }
7433
- if (!isValid) throw new ComposioWebhookSignatureVerificationError("The signature provided is invalid. Please ensure you are using the correct webhook secret.");
7434
- }
7435
- /**
7436
- * Validates that the webhook timestamp is within the allowed tolerance
7437
- * @private
7438
- */
7439
- validateWebhookTimestamp(webhookTimestamp, tolerance) {
7440
- const timestampSeconds = parseInt(webhookTimestamp, 10);
7441
- if (Number.isNaN(timestampSeconds)) throw new ComposioWebhookPayloadError(`Invalid webhook timestamp: ${webhookTimestamp}. Expected Unix timestamp in seconds.`);
7442
- const webhookTimeMs = timestampSeconds * 1e3;
7443
- const timeDifference = Math.abs(Date.now() - webhookTimeMs);
7444
- if (timeDifference > tolerance * 1e3) throw new ComposioWebhookSignatureVerificationError(`The webhook timestamp is outside the allowed tolerance. The webhook was sent ${Math.round(timeDifference / 1e3)} seconds ago, but the maximum allowed age is ${tolerance} seconds.`);
7445
- }
7446
7479
  };
7447
7480
 
7448
7481
  // src/types/mcp.experimental.types.ts
@@ -7591,18 +7624,19 @@ var MCP = class {
7591
7624
  *
7592
7625
  * @example
7593
7626
  * ```typescript
7594
- * const server = await composio.mcpConfig.create("personal-mcp-server", {
7627
+ * const server = await composio.mcp.create("personal-mcp-server", {
7595
7628
  * toolkits: ["github", "slack"],
7596
- * allowedTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"],
7629
+ * allowedTools: ["GITHUB_CREATE_AN_ISSUE", "SLACK_SEND_MESSAGE"],
7597
7630
  * manuallyManageConnections: false
7598
- * }
7599
7631
  * });
7632
+ * ```
7600
7633
  *
7601
- * const server = await composio.mcpConfig.create("personal-mcp-server", {
7634
+ * @example
7635
+ * ```typescript
7636
+ * const server = await composio.mcp.create("personal-mcp-server", {
7602
7637
  * toolkits: [{ toolkit: "gmail", authConfigId: "ac_243434343" }],
7603
7638
  * allowedTools: ["GMAIL_FETCH_EMAILS"],
7604
7639
  * manuallyManageConnections: false
7605
- * }
7606
7640
  * });
7607
7641
  * ```
7608
7642
  */
@@ -7653,22 +7687,31 @@ var MCP = class {
7653
7687
  *
7654
7688
  * @example
7655
7689
  * ```typescript
7656
- * // List all MCP servers
7657
- * const allServers = await composio.experimental.mcp.list({});
7690
+ * // List the first page of MCP servers
7691
+ * const allServers = await composio.mcp.list({ page: 1, limit: 10, toolkits: [], authConfigs: [] });
7658
7692
  *
7659
7693
  * // List with pagination
7660
- * const pagedServers = await composio.experimental.mcp.list({
7694
+ * const pagedServers = await composio.mcp.list({
7661
7695
  * page: 2,
7662
- * limit: 5
7696
+ * limit: 5,
7697
+ * toolkits: [],
7698
+ * authConfigs: []
7663
7699
  * });
7664
7700
  *
7665
7701
  * // Filter by toolkit
7666
- * const githubServers = await composio.experimental.mcp.list({
7667
- * toolkits: ['github', 'slack']
7702
+ * const githubServers = await composio.mcp.list({
7703
+ * page: 1,
7704
+ * limit: 10,
7705
+ * toolkits: ['github', 'slack'],
7706
+ * authConfigs: []
7668
7707
  * });
7669
7708
  *
7670
7709
  * // Filter by name
7671
- * const namedServers = await composio.experimental.mcp.list({
7710
+ * const namedServers = await composio.mcp.list({
7711
+ * page: 1,
7712
+ * limit: 10,
7713
+ * toolkits: [],
7714
+ * authConfigs: [],
7672
7715
  * name: 'personal'
7673
7716
  * });
7674
7717
  * ```
@@ -7708,7 +7751,7 @@ var MCP = class {
7708
7751
  * @example
7709
7752
  * ```typescript
7710
7753
  * // Get a specific MCP server by ID
7711
- * const server = await composio.experimental.mcp.get("mcp_12345");
7754
+ * const server = await composio.mcp.get("mcp_12345");
7712
7755
  *
7713
7756
  * console.log(server.name); // "My Personal MCP Server"
7714
7757
  * console.log(server.allowedTools); // ["GITHUB_CREATE_AN_ISSUE", "SLACK_SEND_MESSAGE"]
@@ -7737,7 +7780,7 @@ var MCP = class {
7737
7780
  * @example
7738
7781
  * ```typescript
7739
7782
  * // Delete an MCP server by ID
7740
- * const result = await composio.experimental.mcp.delete("mcp_12345");
7783
+ * const result = await composio.mcp.delete("mcp_12345");
7741
7784
  *
7742
7785
  * if (result.deleted) {
7743
7786
  * console.log(`Server ${result.id} has been successfully deleted`);
@@ -7747,15 +7790,15 @@ var MCP = class {
7747
7790
  *
7748
7791
  * // Example with error handling
7749
7792
  * try {
7750
- * const result = await composio.experimental.mcp.delete("mcp_12345");
7793
+ * const result = await composio.mcp.delete("mcp_12345");
7751
7794
  * console.log("Deletion successful:", result);
7752
7795
  * } catch (error) {
7753
- * console.error("Failed to delete MCP server:", error.message);
7796
+ * console.error("Failed to delete MCP server:", error);
7754
7797
  * }
7755
7798
  *
7756
7799
  * // Delete and verify from list
7757
- * await composio.experimental.mcp.delete("mcp_12345");
7758
- * const servers = await composio.experimental.mcp.list({});
7800
+ * await composio.mcp.delete("mcp_12345");
7801
+ * const servers = await composio.mcp.list({ page: 1, limit: 10, toolkits: [], authConfigs: [] });
7759
7802
  * const serverExists = servers.items.some(server => server.id === "mcp_12345");
7760
7803
  * console.log("Server still exists:", serverExists); // Should be false
7761
7804
  * ```
@@ -7783,34 +7826,32 @@ var MCP = class {
7783
7826
  * @example
7784
7827
  * ```typescript
7785
7828
  * // Update server name only
7786
- * const updatedServer = await composio.experimental.mcp.update("mcp_12345", {
7829
+ * const updatedServer = await composio.mcp.update("mcp_12345", {
7787
7830
  * name: "My Updated MCP Server"
7788
7831
  * });
7789
7832
  *
7790
7833
  * // Update toolkits and tools
7791
- * const serverWithNewTools = await composio.experimental.mcp.update("mcp_12345", {
7834
+ * const serverWithNewTools = await composio.mcp.update("mcp_12345", {
7792
7835
  * toolkits: [
7793
- * {
7794
- * toolkit: "github",
7795
- * authConfigId: "auth_abc123",
7796
- * allowedTools: ["GITHUB_CREATE_AN_ISSUE", "GITHUB_LIST_REPOS"]
7797
- * },
7798
- * {
7799
- * toolkit: "slack",
7800
- * authConfigId: "auth_xyz789",
7801
- * allowedTools: ["SLACK_SEND_MESSAGE", "SLACK_LIST_CHANNELS"]
7802
- * }
7836
+ * { toolkit: "github", authConfigId: "auth_abc123" },
7837
+ * { toolkit: "slack", authConfigId: "auth_xyz789" }
7838
+ * ],
7839
+ * allowedTools: [
7840
+ * "GITHUB_CREATE_AN_ISSUE",
7841
+ * "GITHUB_LIST_REPOS",
7842
+ * "SLACK_SEND_MESSAGE",
7843
+ * "SLACK_LIST_CHANNELS"
7803
7844
  * ]
7804
7845
  * });
7805
7846
  *
7806
7847
  * // Update connection management setting
7807
- * const serverWithManualAuth = await composio.experimental.mcp.update("mcp_12345", {
7848
+ * const serverWithManualAuth = await composio.mcp.update("mcp_12345", {
7808
7849
  * name: "Manual Auth Server",
7809
7850
  * manuallyManageConnections: true
7810
7851
  * });
7811
7852
  *
7812
7853
  * // Complete update example
7813
- * const fullyUpdatedServer = await composio.experimental.mcp.update("mcp_12345", {
7854
+ * const fullyUpdatedServer = await composio.mcp.update("mcp_12345", {
7814
7855
  * name: "Production MCP Server",
7815
7856
  * toolkits: [
7816
7857
  * {
@@ -7818,7 +7859,7 @@ var MCP = class {
7818
7859
  * authConfigId: "auth_gmail_prod",
7819
7860
  * }
7820
7861
  * ],
7821
- * allowedTools: ["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"]
7862
+ * allowedTools: ["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"],
7822
7863
  * manuallyManageConnections: false
7823
7864
  * });
7824
7865
  *
@@ -7861,10 +7902,10 @@ var MCP = class {
7861
7902
  *
7862
7903
  * @example
7863
7904
  * ```typescript
7864
- * import { Composio } from "@composio/code";
7905
+ * import { Composio } from "@composio/core";
7865
7906
  *
7866
7907
  * const composio = new Composio();
7867
- * const mcp = await composio.experimental.mcp.generate("default", "<mcp_config_id>");
7908
+ * const mcp = await composio.mcp.generate("default", "<mcp_config_id>");
7868
7909
  * ```
7869
7910
  *
7870
7911
  * @param userId {string} external user id from your database for whom you want the server for
@@ -8323,6 +8364,16 @@ const ToolRouterHookPromptInjectionCheckHandlerSchema = z.object({
8323
8364
  type: z.literal("prompt_injection_check"),
8324
8365
  action: z.literal("block")
8325
8366
  }).strict();
8367
+ /**
8368
+ * Sends the call to the project's session webhook URL and waits for your
8369
+ * endpoint's answer: let it run, block it, or change it. Read the request in
8370
+ * your endpoint with `composio.sessions.webhooks.parse()`.
8371
+ */
8372
+ const ToolRouterHookWebhookHandlerSchema = z.object({
8373
+ type: z.literal("webhook"),
8374
+ fallbackAction: z.enum(["block", "continue"]).describe("What happens to the call when your endpoint times out, can't be reached, or sends an answer that can't be read."),
8375
+ timeoutMs: z.number().int().optional().describe("How long to wait for your endpoint to answer, in milliseconds. Defaults to 3000.")
8376
+ }).strict();
8326
8377
  const toolRouterHookIdentityFields = {
8327
8378
  id: z.string().describe("Unique within the session. Shows up in results and logs."),
8328
8379
  name: z.string().optional().describe("A readable name. The agent sees it when this hook blocks a call."),
@@ -8331,16 +8382,21 @@ const toolRouterHookIdentityFields = {
8331
8382
  /**
8332
8383
  * A hook on a session's tool calls. A `before_execute` hook can block a call
8333
8384
  * before it runs; an `after_execute` hook can block its result before the
8334
- * agent sees it.
8385
+ * agent sees it. A hook with a `webhook` handler can also change the call or
8386
+ * its result.
8335
8387
  */
8336
8388
  const ToolRouterHookSchema = z.discriminatedUnion("type", [z.object({
8337
8389
  type: z.literal("before_execute"),
8338
8390
  ...toolRouterHookIdentityFields,
8339
- handler: ToolRouterHookConditionCheckHandlerSchema
8391
+ handler: z.discriminatedUnion("type", [ToolRouterHookConditionCheckHandlerSchema, ToolRouterHookWebhookHandlerSchema])
8340
8392
  }).strict(), z.object({
8341
8393
  type: z.literal("after_execute"),
8342
8394
  ...toolRouterHookIdentityFields,
8343
- handler: z.discriminatedUnion("type", [ToolRouterHookConditionCheckHandlerSchema, ToolRouterHookPromptInjectionCheckHandlerSchema])
8395
+ handler: z.discriminatedUnion("type", [
8396
+ ToolRouterHookConditionCheckHandlerSchema,
8397
+ ToolRouterHookPromptInjectionCheckHandlerSchema,
8398
+ ToolRouterHookWebhookHandlerSchema
8399
+ ])
8344
8400
  }).strict()]);
8345
8401
  const ToolRouterCreateSessionConfigBaseSchema = z.object({
8346
8402
  sessionPreset: z.literal(SessionPreset.DIRECT_TOOLS).optional().describe("Shortcut to expose every tool allowed by the session filters directly in session.tools() and the MCP tool list. This disables meta tools by default (search, multi-execute, manage-connections, and workbench). Use when all tools are known upfront and helper/meta tools are not needed. Without this preset, ToolRouter uses its default configuration with meta tools enabled."),
@@ -8519,8 +8575,9 @@ const ToolRouterSessionSearchResponseSchema = z.object({
8519
8575
  });
8520
8576
  /**
8521
8577
  * What one session hook decided about a call. `unavailable` means the hook
8522
- * could not be evaluated (for example it timed out); it does not block the
8523
- * call.
8578
+ * could not be evaluated (for example it timed out), and `detail` says why
8579
+ * when the API gives a reason. An unavailable hook does not block the call,
8580
+ * unless it has a `webhook` handler with `fallbackAction: 'block'`.
8524
8581
  */
8525
8582
  const ToolRouterHookResultSchema = z.discriminatedUnion("status", [z.object({
8526
8583
  id: z.string().describe("The hook id"),
@@ -8528,7 +8585,8 @@ const ToolRouterHookResultSchema = z.discriminatedUnion("status", [z.object({
8528
8585
  outcome: z.enum(["continue", "block"]).describe("What the hook decided")
8529
8586
  }), z.object({
8530
8587
  id: z.string().describe("The hook id"),
8531
- status: z.literal("unavailable")
8588
+ status: z.literal("unavailable"),
8589
+ detail: z.string().optional().describe("Why the hook could not be evaluated")
8532
8590
  })]);
8533
8591
  /**
8534
8592
  * Why a session hook blocked a call. `request_blocked`: a `before_execute` hook
@@ -8590,7 +8648,7 @@ const SessionProxyExecuteParamsSchema = z.object({
8590
8648
  * the sibling connection settings untouched.
8591
8649
  */
8592
8650
  const ToolRouterUpdateManageConnectionsSchema = z.object({
8593
- enable: z.boolean().optional().describe("Whether to use tools to manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually"),
8651
+ enable: z.boolean().nullable().optional().describe("Whether to expose connection management tools in the session. Pass null to restore the default (true)."),
8594
8652
  callbackUrl: z.string().nullable().optional().describe("The callback url to use in the tool router session. `null` removes the stored callback url; sibling settings are untouched"),
8595
8653
  waitForConnections: z.boolean().optional().describe("Whether to wait for users to finish authenticating connections before proceeding to the next step. Defaults to false, if set to true, a wait for connections tool call will happen and finish when the connections are ready"),
8596
8654
  enableConnectionRemoval: z.boolean().nullable().optional().describe("Whether the session exposes the connection removal tool. `null` removes the stored override")
@@ -8968,9 +9026,10 @@ var Keyring = class {
8968
9026
  * @returns {Promise<KeyringTransferKeysResponse>} The active key ID and every accepted public JWK, newest first
8969
9027
  *
8970
9028
  * @example
8971
- * ```typescript
9029
+ * ```typescript nocheck="Seals with the jose library, whose types the checker does not load"
8972
9030
  * import { CompactEncrypt, importJWK } from 'jose';
8973
9031
  *
9032
+ * const secret = 'my-client-secret';
8974
9033
  * const { activeKid, keys } = await composio.keyring.listTransferKeys();
8975
9034
  * const jwk = keys.find(key => key.kid === activeKid)!;
8976
9035
  * const sealed = await new CompactEncrypt(new TextEncoder().encode(secret))
@@ -9285,7 +9344,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
9285
9344
  };
9286
9345
 
9287
9346
  // package.json
9288
- var version = "0.31.0";
9347
+ var version = "0.33.0";
9289
9348
 
9290
9349
  // src/utils/session.ts
9291
9350
  /**
@@ -9413,13 +9472,14 @@ const transformToolRouterSandboxParams = (params) => {
9413
9472
  sandbox_size: params.sandboxSize
9414
9473
  };
9415
9474
  };
9416
- /**
9417
- * `hooks` as sent on create and update: `appliesTo` becomes `applies_to`.
9418
- * Create and patch take the same hook shape.
9419
- */
9420
- const transformToolRouterHooksParams = (hooks) => hooks.map(({ appliesTo, ...hook }) => ({
9475
+ const transformToolRouterHooksParams = (hooks) => hooks.map(({ appliesTo, handler, ...hook }) => ({
9421
9476
  ...hook,
9422
- applies_to: appliesTo
9477
+ applies_to: appliesTo,
9478
+ handler: handler.type === "webhook" ? {
9479
+ type: handler.type,
9480
+ fallback_action: handler.fallbackAction,
9481
+ ...handler.timeoutMs !== void 0 && { timeout_ms: handler.timeoutMs }
9482
+ } : handler
9423
9483
  }));
9424
9484
  /** `proxy_execute` as sent on create and update: a boolean becomes `{ enable }`. */
9425
9485
  const transformToolRouterProxyExecuteParams = (config) => typeof config === "boolean" ? { enable: config } : config;
@@ -10163,12 +10223,14 @@ var ToolRouterSessionFilesMount = class {
10163
10223
  * @example
10164
10224
  * ```typescript
10165
10225
  * // From native File (e.g. from input[type=file])
10166
- * await session.experimental.files.upload(fileInput.files[0]);
10226
+ * const file = new File(['hello world'], 'hello.txt', { type: 'text/plain' });
10227
+ * await session.experimental.files.upload(file);
10167
10228
  * ```
10168
10229
  *
10169
10230
  * @example
10170
10231
  * ```typescript
10171
10232
  * // From raw buffer
10233
+ * const buffer = new TextEncoder().encode(JSON.stringify({ hello: 'world' }));
10172
10234
  * await session.experimental.files.upload(buffer, { remotePath: 'data.json', mimetype: 'application/json' });
10173
10235
  * ```
10174
10236
  */
@@ -10753,7 +10815,7 @@ var ToolRouterSession = class {
10753
10815
  *
10754
10816
  * @example
10755
10817
  * ```typescript
10756
- * const session = await composio.sessions.create({ toolkits: ['github'] });
10818
+ * const session = await composio.sessions.create('user_123', { toolkits: ['github'] });
10757
10819
  * const { wasConnected, connectedAccount } = await session.ensureConnected('github');
10758
10820
  * if (!wasConnected) console.log('Newly linked:', connectedAccount?.id);
10759
10821
  * ```
@@ -11076,7 +11138,7 @@ var ToolRouterSession = class {
11076
11138
  };
11077
11139
  const obj = item;
11078
11140
  return {
11079
- tool_slug: String(obj.tool_slug ?? ""),
11141
+ tool_slug: typeof obj.tool_slug === "string" ? obj.tool_slug : "",
11080
11142
  arguments: obj.arguments ?? {}
11081
11143
  };
11082
11144
  }
@@ -11179,6 +11241,240 @@ var ToolRouterSession = class {
11179
11241
  }
11180
11242
  };
11181
11243
 
11244
+ // src/types/sessionWebhooks.types.ts
11245
+ const SessionWebhookEventTypes = {
11246
+ BEFORE_EXECUTE: "composio.session_hook.before_execute",
11247
+ AFTER_EXECUTE: "composio.session_hook.after_execute"
11248
+ };
11249
+ const SessionWebhookMetadataSchema = z$1.object({
11250
+ /** ID of the project */
11251
+ project_id: z$1.string(),
11252
+ /** ID of the session the call was made in */
11253
+ session_id: z$1.string(),
11254
+ /** ID of the user the session belongs to */
11255
+ user_id: z$1.string(),
11256
+ /** ID of the hook that sent this event, as set on the session */
11257
+ hook_id: z$1.string(),
11258
+ /**
11259
+ * ID of the call. The `before_execute` and `after_execute` events for one
11260
+ * call carry the same ID. Omitted by an API version that predates it.
11261
+ */
11262
+ tool_call_id: z$1.string().optional()
11263
+ }).passthrough();
11264
+ const SessionWebhookToolCallSchema = z$1.object({
11265
+ /** Slug of the toolkit (for example `gmail`) */
11266
+ toolkit_slug: z$1.string(),
11267
+ /** Slug of the tool (for example `GMAIL_SEND_EMAIL`) */
11268
+ tool_slug: z$1.string(),
11269
+ /** Version of the toolkit the tool runs from */
11270
+ toolkit_version: z$1.string(),
11271
+ /** ID of the connected account the call uses. Omitted when the call doesn't use one. */
11272
+ connected_account_id: z$1.string().optional(),
11273
+ /** The arguments the tool is called with */
11274
+ arguments: z$1.record(z$1.unknown())
11275
+ }).passthrough();
11276
+ const SessionWebhookToolResponseSchema = z$1.object({
11277
+ /** The data the tool returned */
11278
+ data: z$1.record(z$1.unknown()),
11279
+ /** Error message when the tool failed, otherwise null */
11280
+ error: z$1.string().nullable()
11281
+ }).passthrough();
11282
+ const SessionWebhookHttpMethodSchema = z$1.enum([
11283
+ "GET",
11284
+ "POST",
11285
+ "PUT",
11286
+ "DELETE",
11287
+ "PATCH",
11288
+ "HEAD"
11289
+ ]);
11290
+ const SessionWebhookHttpParameterSchema = z$1.object({
11291
+ /** Header or query parameter name */
11292
+ name: z$1.string(),
11293
+ /** Header or query parameter value */
11294
+ value: z$1.string(),
11295
+ /** Whether the parameter is a header or a query parameter */
11296
+ type: z$1.enum(["header", "query"])
11297
+ }).passthrough();
11298
+ const BinaryBodyUrlSchema = z$1.object({
11299
+ url: z$1.string(),
11300
+ content_type: z$1.string().optional(),
11301
+ base64: z$1.never().optional()
11302
+ });
11303
+ const BinaryBodyBase64Schema = z$1.object({
11304
+ base64: z$1.string(),
11305
+ content_type: z$1.string().optional(),
11306
+ url: z$1.never().optional()
11307
+ });
11308
+ const BinaryBodySchema = z$1.union([BinaryBodyUrlSchema.passthrough(), BinaryBodyBase64Schema.passthrough()]);
11309
+ const SessionWebhookHttpRequestSchema = z$1.object({
11310
+ /** Slug of the toolkit whose API is called (for example `github`) */
11311
+ toolkit_slug: z$1.string(),
11312
+ /** ID of the connected account the call uses. Omitted when the call doesn't use one. */
11313
+ connected_account_id: z$1.string().optional(),
11314
+ method: SessionWebhookHttpMethodSchema,
11315
+ /** The endpoint as the agent gave it: a path relative to the toolkit's API base URL, or a full URL */
11316
+ endpoint: z$1.string(),
11317
+ /** Headers and query parameters the agent added. The credentials Composio adds are not included. */
11318
+ parameters: z$1.array(SessionWebhookHttpParameterSchema),
11319
+ /** The request body. Omitted when there is none or the request uploads a file. */
11320
+ body: z$1.unknown().optional(),
11321
+ /** The file the request uploads, as a URL or base64-encoded bytes. */
11322
+ binary_body: BinaryBodySchema.optional()
11323
+ }).passthrough();
11324
+ const SessionWebhookHttpResponseSchema = z$1.object({
11325
+ /** HTTP status the app's API returned */
11326
+ status: z$1.number(),
11327
+ /** Headers the app's API returned. Credential values Composio added are redacted. */
11328
+ headers: z$1.record(z$1.string()),
11329
+ /** Response body the app's API returned. Omitted when it is binary. */
11330
+ data: z$1.unknown().optional(),
11331
+ /** The file the API returned, as a temporary download link. Present when the response is binary. */
11332
+ binary_data: z$1.object({
11333
+ url: z$1.string(),
11334
+ content_type: z$1.string(),
11335
+ size: z$1.number(),
11336
+ expires_at: z$1.string().optional()
11337
+ }).passthrough().optional()
11338
+ }).passthrough();
11339
+ const sessionWebhookEnvelopeFields = {
11340
+ /** Unique event ID (`msg_<uuid>`). Also sent as the `webhook-id` header. */
11341
+ id: z$1.string(),
11342
+ /** ISO-8601 timestamp of when the event was created */
11343
+ timestamp: z$1.string(),
11344
+ metadata: SessionWebhookMetadataSchema
11345
+ };
11346
+ /**
11347
+ * Sent before a call runs. `data.type` says whether it is a tool call
11348
+ * (`tool_call`) or a proxy call (`http_request`).
11349
+ */
11350
+ const SessionWebhookBeforeExecuteEventSchema = z$1.object({
11351
+ ...sessionWebhookEnvelopeFields,
11352
+ type: z$1.literal(SessionWebhookEventTypes.BEFORE_EXECUTE),
11353
+ data: z$1.discriminatedUnion("type", [z$1.object({
11354
+ type: z$1.literal("tool_execute"),
11355
+ tool_call: SessionWebhookToolCallSchema
11356
+ }).passthrough(), z$1.object({
11357
+ type: z$1.literal("proxy_execute"),
11358
+ http_request: SessionWebhookHttpRequestSchema
11359
+ }).passthrough()])
11360
+ }).passthrough();
11361
+ /**
11362
+ * Sent after a call ran, with what it returned: `tool_response` for a tool
11363
+ * call, `http_response` for a proxy call.
11364
+ */
11365
+ const SessionWebhookAfterExecuteEventSchema = z$1.object({
11366
+ ...sessionWebhookEnvelopeFields,
11367
+ type: z$1.literal(SessionWebhookEventTypes.AFTER_EXECUTE),
11368
+ data: z$1.discriminatedUnion("type", [z$1.object({
11369
+ type: z$1.literal("tool_execute"),
11370
+ tool_call: SessionWebhookToolCallSchema,
11371
+ tool_response: SessionWebhookToolResponseSchema
11372
+ }).passthrough(), z$1.object({
11373
+ type: z$1.literal("proxy_execute"),
11374
+ http_request: SessionWebhookHttpRequestSchema,
11375
+ http_response: SessionWebhookHttpResponseSchema
11376
+ }).passthrough()])
11377
+ }).passthrough();
11378
+ /**
11379
+ * An event Composio sends to the session webhook URL, as returned by
11380
+ * `composio.sessions.webhooks.parse()`.
11381
+ */
11382
+ const SessionWebhookEventSchema = z$1.discriminatedUnion("type", [SessionWebhookBeforeExecuteEventSchema, SessionWebhookAfterExecuteEventSchema]);
11383
+
11384
+ // src/models/SessionWebhooks.ts
11385
+ /**
11386
+ * @fileoverview The `composio.sessions.webhooks` namespace: reading the events
11387
+ * Composio sends to a project's session webhook URL.
11388
+ *
11389
+ * @module SessionWebhooks
11390
+ */
11391
+ const DEFAULT_TOLERANCE_SECONDS = 300;
11392
+ /**
11393
+ * `composio.sessions.webhooks` — for the endpoint at a project's session
11394
+ * webhook URL, which answers session hooks that have a `webhook` handler.
11395
+ */
11396
+ var SessionWebhooks = class {
11397
+ constructor() {
11398
+ telemetry.instrument(this, "SessionWebhooks");
11399
+ }
11400
+ /**
11401
+ * Verify and parse an event Composio sent to the session webhook URL.
11402
+ *
11403
+ * Composio sends one before or after each tool or proxy call that a hook
11404
+ * with a `webhook` handler applies to, and waits for the endpoint's answer.
11405
+ * The signature is always verified, with the project's session webhook
11406
+ * secret. The event is returned as Composio sent it, with the field names of
11407
+ * the webhook reference.
11408
+ *
11409
+ * Pass the raw, unparsed request body: the signature covers its exact bytes.
11410
+ *
11411
+ * @param {ParseSessionWebhookParams} params - The request and how to verify it
11412
+ * @param {string | Uint8Array} params.body - The raw request body
11413
+ * @param {Headers | Record<string, string | string[] | undefined>} params.headers - The request headers
11414
+ * @param {string} params.verifySecret - The project's session webhook secret
11415
+ * @param {number} [params.tolerance=300] - Max event age in seconds. Set to 0 to disable the check.
11416
+ * @returns {Promise<SessionWebhookEvent>} The verified event
11417
+ *
11418
+ * @throws {ValidationError} If `verifySecret` is empty or the signature headers are missing
11419
+ * @throws {ComposioWebhookSignatureVerificationError} If signature verification fails
11420
+ * @throws {ComposioWebhookPayloadError} If the body is not a session webhook event
11421
+ *
11422
+ * @example
11423
+ * ```ts
11424
+ * // Next.js App Router, at the project's session webhook URL
11425
+ * export async function POST(request: Request) {
11426
+ * const hook = await composio.sessions.webhooks.parse({
11427
+ * body: await request.text(),
11428
+ * headers: request.headers,
11429
+ * verifySecret: process.env.COMPOSIO_SESSION_WEBHOOK_SECRET!,
11430
+ * });
11431
+ *
11432
+ * // Keep a confidential project out of every call and every result
11433
+ * if (JSON.stringify(hook.data).includes('Project Titan')) {
11434
+ * return Response.json({ action: 'block', message: 'Project Titan is confidential' });
11435
+ * }
11436
+ * return Response.json({ action: 'continue' });
11437
+ * }
11438
+ * ```
11439
+ */
11440
+ async parse(params) {
11441
+ const { body: rawBody, headers, verifySecret: secret } = params;
11442
+ if (!secret) throw new ValidationError("Cannot verify session webhook: 'verifySecret' is empty — your COMPOSIO_SESSION_WEBHOOK_SECRET is likely unset. Set it to the project's session webhook secret from the Composio dashboard.");
11443
+ const id = getHeader(headers, WEBHOOK_HEADERS.id);
11444
+ const timestamp = getHeader(headers, WEBHOOK_HEADERS.timestamp);
11445
+ const signature = getHeader(headers, WEBHOOK_HEADERS.signature);
11446
+ if (!id || !timestamp || !signature) {
11447
+ const missing = [
11448
+ !id ? `'${WEBHOOK_HEADERS.id}'` : void 0,
11449
+ !timestamp ? `'${WEBHOOK_HEADERS.timestamp}'` : void 0,
11450
+ !signature ? `'${WEBHOOK_HEADERS.signature}'` : void 0
11451
+ ].filter((header) => header !== void 0);
11452
+ throw new ValidationError(`Cannot verify session webhook: missing signature header(s) ${missing.join(", ")}. Pass the raw, unparsed request body and ensure the Composio signature headers (${WEBHOOK_HEADERS.id}, ${WEBHOOK_HEADERS.timestamp}, ${WEBHOOK_HEADERS.signature}) are forwarded to sessions.webhooks.parse().`);
11453
+ }
11454
+ const tolerance = params.tolerance ?? DEFAULT_TOLERANCE_SECONDS;
11455
+ if (tolerance > 0) validateWebhookTimestamp(timestamp, tolerance);
11456
+ const body = typeof rawBody === "string" ? rawBody : new Uint8Array(rawBody);
11457
+ await verifyWebhookSignature(id, timestamp, body, signature, secret);
11458
+ let json;
11459
+ try {
11460
+ const text = typeof body === "string" ? body : new TextDecoder("utf-8", {
11461
+ fatal: true,
11462
+ ignoreBOM: true
11463
+ }).decode(body);
11464
+ json = JSON.parse(text);
11465
+ } catch {
11466
+ throw new ComposioWebhookPayloadError("Failed to parse session webhook payload as JSON");
11467
+ }
11468
+ const event = SessionWebhookEventSchema.safeParse(json);
11469
+ if (!event.success) {
11470
+ const fields = [...new Set(event.error.issues.map((issue) => issue.path.join(".")))].sort();
11471
+ const isAnotherPayload = fields.includes("") || fields.includes("type");
11472
+ throw new ComposioWebhookPayloadError(isAnotherPayload ? `Payload is not a session webhook event. Expected a '${SessionWebhookEventTypes.BEFORE_EXECUTE}' or '${SessionWebhookEventTypes.AFTER_EXECUTE}' event.` : `Session webhook event has missing or invalid fields: ${fields.join(", ")}`);
11473
+ }
11474
+ return event.data;
11475
+ }
11476
+ };
11477
+
11182
11478
  // src/models/ToolRouter.ts
11183
11479
  function getSessionMetadata(session) {
11184
11480
  return {
@@ -11206,9 +11502,15 @@ function prepareInlineCustomTools(options) {
11206
11502
  var ToolRouter = class {
11207
11503
  client;
11208
11504
  config;
11505
+ /**
11506
+ * Read the events Composio sends to the project's session webhook URL, for
11507
+ * session hooks with a `webhook` handler.
11508
+ */
11509
+ webhooks;
11209
11510
  constructor(client, config) {
11210
11511
  this.client = client;
11211
11512
  this.config = config;
11513
+ this.webhooks = new SessionWebhooks();
11212
11514
  telemetry.instrument(this, "ToolRouter");
11213
11515
  }
11214
11516
  /**
@@ -11739,19 +12041,31 @@ var Composio = class Composio {
11739
12041
  *
11740
12042
  * @example
11741
12043
  * ```typescript
12044
+ * import { Composio } from '@composio/core';
12045
+ *
11742
12046
  * // Initialize with default configuration
11743
12047
  * const composio = new Composio();
12048
+ * ```
12049
+ *
12050
+ * @example
12051
+ * ```typescript
12052
+ * import { Composio } from '@composio/core';
11744
12053
  *
11745
12054
  * // Initialize with custom API key and base URL
11746
12055
  * const composio = new Composio({
11747
12056
  * apiKey: 'your-api-key',
11748
12057
  * baseURL: 'https://api.composio.dev'
11749
12058
  * });
12059
+ * ```
12060
+ *
12061
+ * @example
12062
+ * ```typescript
12063
+ * import { Composio, OpenAIProvider } from '@composio/core';
11750
12064
  *
11751
- * // Initialize with custom provider
12065
+ * // Initialize with an explicit provider
11752
12066
  * const composio = new Composio({
11753
12067
  * apiKey: 'your-api-key',
11754
- * provider: new CustomProvider()
12068
+ * provider: new OpenAIProvider()
11755
12069
  * });
11756
12070
  * ```
11757
12071
  */
@@ -11907,6 +12221,8 @@ var Composio = class Composio {
11907
12221
  *
11908
12222
  * @example
11909
12223
  * ```typescript
12224
+ * import { Composio } from '@composio/core';
12225
+ *
11910
12226
  * // Create a base Composio instance
11911
12227
  * const composio = new Composio({
11912
12228
  * apiKey: 'your-api-key'
@@ -11922,7 +12238,7 @@ var Composio = class Composio {
11922
12238
  * });
11923
12239
  *
11924
12240
  * // Use the session for making API calls with the custom headers
11925
- * await composioWithCustomHeaders.tools.list();
12241
+ * await composioWithCustomHeaders.tools.getRawComposioTools({ toolkits: ['github'] });
11926
12242
  * ```
11927
12243
  */
11928
12244
  createSession(options) {
@@ -11941,14 +12257,20 @@ var Composio = class Composio {
11941
12257
  * @returns {Promise<void>} A promise that resolves when all pending telemetry has been sent.
11942
12258
  *
11943
12259
  * @example
11944
- * ```typescript
12260
+ * ```typescript nocheck="Cloudflare Worker handler; the checker has no Workers Env or ExecutionContext types"
12261
+ * import { Composio } from '@composio/core';
12262
+ *
11945
12263
  * // In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
11946
12264
  * export default {
11947
12265
  * async fetch(request: Request, env: Env, ctx: ExecutionContext) {
11948
12266
  * const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
11949
12267
  *
11950
12268
  * // Do your work...
11951
- * const result = await composio.tools.execute(...);
12269
+ * const result = await composio.tools.execute('GITHUB_GET_REPOS', {
12270
+ * userId: 'user_123',
12271
+ * version: '20250909_00',
12272
+ * arguments: { owner: 'composio' },
12273
+ * });
11952
12274
  *
11953
12275
  * // Ensure telemetry flushes before worker terminates
11954
12276
  * ctx.waitUntil(composio.flush());
@@ -12754,4 +13076,4 @@ const ComposioMcpUpdateResponseSchema = z$1.object({
12754
13076
  tools: z$1.array(z$1.string()).optional()
12755
13077
  });
12756
13078
 
12757
- export { AuthConfigCreationToolAccessConfigSchema, AuthConfigErrorCodes, AuthConfigListParamsSchema, AuthConfigListResponseSchema, AuthConfigRetrieveResponseSchema, AuthConfigToolAccessConfigSchema, AuthConfigTypes, AuthConfigUpdateParamsSchema, AuthCustomConfigUpdateParamsSchema, AuthDefaultConfigUpdateParamsSchema, AuthScheme, AuthSchemeEnum, AuthSchemeTypes, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, BaseAgenticProvider, BaseNonAgenticProvider, BillcomAuthConnectionDataSchema, Composio, ComposioAPIKeyKindError, ComposioAclOnlyForSharedError, ComposioAuthConfigNotFoundError, ComposioBlockedInternalUrlError, ComposioConnectedAccountNotFoundError, ComposioConnectedAccountNotRevokableError, ComposioConnectedAccountRevocationNotSupportedError, ComposioCustomCreateResponseSchema, ComposioError, ComposioFailedToCreateConnectedAccountLink, ComposioFailedToCreatePusherClientError, ComposioFailedToGetSDKRealtimeCredentialsError, ComposioFailedToSubscribeToPusherChannelError, ComposioFailedToUnsubscribeFromPusherChannelError, ComposioFileNotFoundError, ComposioFileUploadAbortedError, ComposioFileUploadError, ComposioFileUploadPathNotAllowedError, ComposioGenerateURLParamsSchema, ComposioGenerateURLResponseSchema, ComposioGlobalExecuteToolFnNotSetError, ComposioInvalidExecuteFunctionError, ComposioInvalidModifierError, ComposioInvalidToolArgumentsError, ComposioLegacyConnectedAccountsEndpointRetiredError, ComposioMCPDestinationError, ComposioMcpDeleteResponseSchema, ComposioMcpListResponseSchema, ComposioMcpRetrieveResponseSchema, ComposioMcpUpdateResponseSchema, ComposioMultipleConnectedAccountsError, ComposioNoAPIKeyError, ComposioProvider, ComposioProviderNotDefinedError, ComposioRequestCancelledError, ComposioScopeConfigError, ComposioSensitiveFilePathBlockedError, ComposioSessionConfigConflictError, ComposioSharedAccessDeniedError, ComposioSharedConnectionNotAccessibleError, ComposioToolExecutionError, ComposioToolExecutionRateLimitError, ComposioToolFetchError, ComposioToolFetchRateLimitError, ComposioToolInputRequiredError, ComposioToolNotFoundError, ComposioToolSchemaInvalidError, ComposioToolVersionRequiredError, ComposioToolkitFetchError, ComposioToolkitNotFoundError, ComposioTriggerTypeNotFoundError, ComposioWebhookPayloadError, ComposioWebhookSignatureVerificationError, ConnectedAccountAclConfigResponseSchema, ConnectedAccountAclConfigSchema, ConnectedAccountAuthConfigSchema, ConnectedAccountCompleteAuthParamsSchema, ConnectedAccountCompleteAuthResponseSchema, ConnectedAccountErrorCodes, ConnectedAccountExperimentalResponseSchema, ConnectedAccountExperimentalSchema, ConnectedAccountListParamsSchema, ConnectedAccountListResponseSchema, ConnectedAccountRefreshOptionsSchema, ConnectedAccountRetrieveResponseSchema, ConnectedAccountRevokeResponseSchema, ConnectedAccountRevokedTokenSchema, ConnectedAccountStatusSchema, ConnectedAccountStatuses, ConnectedAccountTypeSchema, ConnectedAccountTypes, ConnectionDataSchema, ConnectionExpiredEventSchema, ConnectionRequestErrorCodes, ConnectionRequestFailedError, ConnectionRequestTimeoutError, ConnectionStatus, ConnectionStatuses, CreateAuthConfigParamsSchema, CreateAuthConfigResponseSchema, CreateComposioManagedAuthConfigParamsSchema, CreateConnectedAccountLinkOptionsSchema, CreateConnectedAccountLinkResponseSchema, CreateConnectedAccountOptionsSchema, CreateConnectedAccountParamsSchema, CreateConnectedAccountResponseSchema, CreateCustomAuthConfigParamsSchema, CreateCustomToolBaseSchema, CreateCustomToolkitBaseSchema, CustomAuthParamsSchema, CustomConnectionDataSchema, CustomCreateResponseSchema, CustomOauth1ConnectionDataSchema, CustomOauth2ConnectionDataSchema, CustomToolSlugSchema, CustomToolkitAuthSchemeSchema, CustomToolkitCreateParamsSchema, CustomToolkitCreateResponseSchema, CustomToolkitDeleteResponseSchema, CustomToolkitSyncParamsSchema, CustomToolkitSyncResponseSchema, CustomToolkitUpdateParamsSchema, CustomToolkitUpdateResponseSchema, CustomToolkitUpsertParamsSchema, CustomToolkitUpsertResponseSchema, CustomToolkits, DefaultCreateConnectedAccountParamsSchema, DefaultWebhookSubscriptionEvents, Experimental, FileDeleteResponseSchema, FileListResponseSchema, FileModifierErrorCodes, GenerateURLParamsSchema, GenerateURLResponseSchema, IncomingTriggerPayloadSchema, JSONSchemaPropertySchema, JsonSchemaRefResolutionError, JsonSchemaToZodError, Keyring, KeyringTransferKeySchema, KeyringTransferKeysResponseSchema, LogSearchFilterFieldSchema, LogSearchFilterOperatorSchema, LogSearchFilterSchema, LogSearchParamsSchema, LogSearchResponseSchema, LogSearchTimeRangeSchema, Logs, MAX_URL_UPLOAD_SIZE_BYTES, MCP, MCPAuthOptionsSchema, MCPGenerateURLParamsSchema, MCPGetServerParamsSchema, MCPMultiAppServerSchema, MCPServerCreateResponseSchema, MCPServerListResponseSchema, MCPServerSchema, MCPServerTypeSchema, MCPServerUpdateParamsSchema, MCPSingleAppServerSchema, MCPToolkitConfigSchema, MCPToolkitConfigsArraySchema, McpDeleteResponseSchema, McpListResponseSchema, McpRetrieveResponseSchema, McpUpdateResponseSchema, Oauth1ActiveConnectionDataSchema, Oauth1ConnectionDataSchema, Oauth1ExpiredConnectionDataSchema, Oauth1FailedConnectionDataSchema, Oauth1InactiveConnectionDataSchema, Oauth1InitiatedConnectionDataSchema, Oauth1InitiatingConnectionDataSchema, Oauth2ActiveConnectionDataSchema, Oauth2ConnectionDataSchema, Oauth2ExpiredConnectionDataSchema, Oauth2FailedConnectionDataSchema, Oauth2InactiveConnectionDataSchema, Oauth2InitiatedConnectionDataSchema, Oauth2InitiatingConnectionDataSchema, Oauth2RevokedConnectionDataSchema, OpenAIProvider, RedirectableAuthSchemeSchema, RemoteFile, RemoteFileDataSchema, RemoteFileDownloadError, RemoteFileErrorCodes, SDKErrorCodes, SandboxSizeSchema, SessionConfigListParamsSchema, SessionConfigListResponseSchema, SessionConfigPolicySchema, SessionConfigSchema, SessionConfigSummarySchema, SessionConfigs, SessionPreset, SessionProxyExecuteParamsSchema, Sessions, SetWebhookSubscriptionParamsSchema, SingleConnectedAccountDetailedResponseSchema, SsrfErrorCodes, ToolErrorCodes, ToolExecuteMetaParamsSchema, ToolExecuteParamsSchema, ToolExecuteResponseSchema, ToolExecutionLogDetailSchema, ToolExecutionLogLevelSchema, ToolExecutionLogMetadataSchema, ToolExecutionLogParentSchema, ToolExecutionLogSchema, ToolExecutionLogStatusSchema, ToolKitItemSchema, ToolKitListResponseSchema, ToolKitMetaSchema, ToolListParamsSchema, ToolListResponseSchema, ToolProxyParamsSchema, ToolRouterBlockReasonSchema, ToolRouterConfigManageConnectionsSchema, ToolRouterConfigTagsSchema, ToolRouterConfigToolsSchema, ToolRouterCreateSessionConfigSchema, ToolRouterErrorCodes, ToolRouterHookAppliesToSchema, ToolRouterHookConditionCheckHandlerSchema, ToolRouterHookPromptInjectionCheckHandlerSchema, ToolRouterHookResultSchema, ToolRouterHookSchema, ToolRouterInstantSchema, ToolRouterMCPServerConfigSchema, ToolRouterManageConnectionsConfigSchema, ToolRouterProxyExecuteConfigSchema, ToolRouterProxyExecuteSchema, ToolRouterSandboxConfigSchema, ToolRouterSession, ToolRouterSessionDeleteResponseSchema, ToolRouterSessionEnsureConnectedOptionsSchema, ToolRouterSessionExecuteResponseSchema, ToolRouterSessionFilesMountDeleteOptionsSchema, ToolRouterSessionFilesMountDownloadOptionsSchema, ToolRouterSessionFilesMountListOptionsSchema, ToolRouterSessionFilesMountUploadOptionsSchema, ToolRouterSessionListConfigHistoryOptionsSchema, ToolRouterSessionSearchResponseSchema, ToolRouterTagsEnableDisableSchema, ToolRouterTagsParamSchema, ToolRouterToolkitsDisabledConfigSchema, ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsOptionsSchema, ToolRouterToolkitsParamSchema, ToolRouterToolsParamSchema, ToolRouterUpdateExperimentalSchema, ToolRouterUpdateManageConnectionsSchema, ToolRouterUpdateSessionConfigSchema, ToolSchema, ToolkitAuthConfigDetailsSchema, ToolkitAuthFieldSchema, ToolkitAuthFieldsResponseSchema, ToolkitCategorySchema, ToolkitChangelogItemSchema, ToolkitChangelogResponseSchema, ToolkitComposioManagedAuthSchema, ToolkitConditionalScopeSchema, ToolkitConnectionStateSchema, ToolkitConnectionsDetailsSchema, ToolkitErrorCodes, ToolkitGetManySlugsSchema, ToolkitGrantContextDimensionSchema, ToolkitLatestVersionSchema, ToolkitListGrantContextsParamsSchema, ToolkitListGrantContextsResponseSchema, ToolkitMangedByEnumSchema, ToolkitRecommendScopesParamsSchema, ToolkitRecommendScopesResponseSchema, ToolkitRetrieveCategoriesResponseSchema, ToolkitRetrieveResponseSchema, ToolkitSchema, ToolkitSortByEnumSchema, ToolkitVersionChangelogSchema, ToolkitVersionParamSchema, ToolkitVersionSchema, ToolkitVersionsSchema, ToolkitsGetManyParamsSchema, ToolkitsListParamsSchema, TriggerErrorCodes, TriggerInstanceListActiveParamsSchema, TriggerInstanceListActiveResponseItemSchema, TriggerInstanceListActiveResponseSchema, TriggerInstanceManageDeleteResponseSchema, TriggerInstanceManageUpdateParamsSchema, TriggerInstanceManageUpdateResponseSchema, TriggerInstanceTypeSchema, TriggerInstanceUpsertParamsSchema, TriggerInstanceUpsertResponseSchema, TriggerStatusEnum, TriggerStatuses, TriggerSubscribeParamSchema, TriggerTypeSchema, TriggersTypeListParamsSchema, TriggersTypeListResponseSchema, UpdateConnectedAccountAclParamsSchema, UpdateConnectedAccountParamsSchema, Usage, UsageBreakdownGroupSchema, UsageBreakdownParamsSchema, UsageBreakdownResponseSchema, UsageEntitySummarySchema, UsageFiltersSchema, UsageOrderBySchema, UsageOrderDirectionSchema, UsageSummaryParamsSchema, UsageSummaryResponseSchema, ValidationError, ValidationErrorCodes, VerifyWebhookParamsSchema, WebhookConnectedAccountAuthConfigSchema, WebhookConnectionMetadataSchema, WebhookConnectionStateSchema, WebhookEndpointCreateParamsSchema, WebhookEndpointListItemSchema, WebhookEndpointListParamsSchema, WebhookEndpointListResponseSchema, WebhookEndpointReplaceParamsSchema, WebhookEndpointSchema, WebhookEndpointUpdateParamsSchema, WebhookEndpoints, WebhookEventSchema, WebhookEventTypes, WebhookPayloadSchema, WebhookPayloadV1Schema, WebhookPayloadV2Schema, WebhookPayloadV3Schema, WebhookSubscriptionDeleteResponseSchema, WebhookSubscriptionEventTypeSchema, WebhookSubscriptionEventTypesResponseSchema, WebhookSubscriptionListParamsSchema, WebhookSubscriptionListResponseSchema, WebhookSubscriptionRotateSecretResponseSchema, WebhookSubscriptionSchema, WebhookSubscriptionSetParamsSchema, WebhookSubscriptionUpdateParamsSchema, WebhookSubscriptions, WebhookTriggerPayloadV3Schema, WebhookVersionSchema, WebhookVersions, Webhooks, assertSafeFileUploadPath, constants_exports as constants, createConnectionRequest, deduplicateJsonSchemaRequiredArrays, dereferenceJsonSchema, ensureObjectTypeOnProperties, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit, getExtensionFromMimeType, handleToolExecutionError, isBlockedSensitiveFileUploadPath, isComposioRateLimitError, isRequestAbortError, jsonSchemaToZodSchema, logger, mappingHasRenames, normalizeToolArguments, omitNullToolArguments, readResponseBodyWithLimit, removeNonRequiredProperties, restoreOriginalKeys, sanitizeSchemaPropertyKeys, telemetry, toStrictJsonSchema };
13079
+ export { AuthConfigCreationToolAccessConfigSchema, AuthConfigErrorCodes, AuthConfigListParamsSchema, AuthConfigListResponseSchema, AuthConfigRetrieveResponseSchema, AuthConfigToolAccessConfigSchema, AuthConfigTypes, AuthConfigUpdateParamsSchema, AuthCustomConfigUpdateParamsSchema, AuthDefaultConfigUpdateParamsSchema, AuthScheme, AuthSchemeEnum, AuthSchemeTypes, BUILTIN_FILE_UPLOAD_PATH_DENY_SEGMENTS, BaseAgenticProvider, BaseNonAgenticProvider, BillcomAuthConnectionDataSchema, Composio, ComposioAPIKeyKindError, ComposioAclOnlyForSharedError, ComposioAuthConfigNotFoundError, ComposioBlockedInternalUrlError, ComposioConnectedAccountNotFoundError, ComposioConnectedAccountNotRevokableError, ComposioConnectedAccountRevocationNotSupportedError, ComposioCustomCreateResponseSchema, ComposioError, ComposioFailedToCreateConnectedAccountLink, ComposioFailedToCreatePusherClientError, ComposioFailedToGetSDKRealtimeCredentialsError, ComposioFailedToSubscribeToPusherChannelError, ComposioFailedToUnsubscribeFromPusherChannelError, ComposioFileNotFoundError, ComposioFileUploadAbortedError, ComposioFileUploadError, ComposioFileUploadPathNotAllowedError, ComposioGenerateURLParamsSchema, ComposioGenerateURLResponseSchema, ComposioGlobalExecuteToolFnNotSetError, ComposioInvalidExecuteFunctionError, ComposioInvalidModifierError, ComposioInvalidToolArgumentsError, ComposioLegacyConnectedAccountsEndpointRetiredError, ComposioMCPDestinationError, ComposioMcpDeleteResponseSchema, ComposioMcpListResponseSchema, ComposioMcpRetrieveResponseSchema, ComposioMcpUpdateResponseSchema, ComposioMultipleConnectedAccountsError, ComposioNoAPIKeyError, ComposioProvider, ComposioProviderNotDefinedError, ComposioRequestCancelledError, ComposioScopeConfigError, ComposioSensitiveFilePathBlockedError, ComposioSessionConfigConflictError, ComposioSharedAccessDeniedError, ComposioSharedConnectionNotAccessibleError, ComposioToolExecutionError, ComposioToolExecutionRateLimitError, ComposioToolFetchError, ComposioToolFetchRateLimitError, ComposioToolInputRequiredError, ComposioToolNotFoundError, ComposioToolSchemaInvalidError, ComposioToolVersionRequiredError, ComposioToolkitFetchError, ComposioToolkitNotFoundError, ComposioTriggerTypeNotFoundError, ComposioWebhookPayloadError, ComposioWebhookSignatureVerificationError, ConnectedAccountAclConfigResponseSchema, ConnectedAccountAclConfigSchema, ConnectedAccountAuthConfigSchema, ConnectedAccountCompleteAuthParamsSchema, ConnectedAccountCompleteAuthResponseSchema, ConnectedAccountErrorCodes, ConnectedAccountExperimentalResponseSchema, ConnectedAccountExperimentalSchema, ConnectedAccountListParamsSchema, ConnectedAccountListResponseSchema, ConnectedAccountRefreshOptionsSchema, ConnectedAccountRetrieveResponseSchema, ConnectedAccountRevokeResponseSchema, ConnectedAccountRevokedTokenSchema, ConnectedAccountStatusSchema, ConnectedAccountStatuses, ConnectedAccountTypeSchema, ConnectedAccountTypes, ConnectionDataSchema, ConnectionExpiredEventSchema, ConnectionRequestErrorCodes, ConnectionRequestFailedError, ConnectionRequestTimeoutError, ConnectionStatus, ConnectionStatuses, CreateAuthConfigParamsSchema, CreateAuthConfigResponseSchema, CreateComposioManagedAuthConfigParamsSchema, CreateConnectedAccountLinkOptionsSchema, CreateConnectedAccountLinkResponseSchema, CreateConnectedAccountOptionsSchema, CreateConnectedAccountParamsSchema, CreateConnectedAccountResponseSchema, CreateCustomAuthConfigParamsSchema, CreateCustomToolBaseSchema, CreateCustomToolkitBaseSchema, CustomAuthParamsSchema, CustomConnectionDataSchema, CustomCreateResponseSchema, CustomOauth1ConnectionDataSchema, CustomOauth2ConnectionDataSchema, CustomToolSlugSchema, CustomToolkitAuthSchemeSchema, CustomToolkitCreateParamsSchema, CustomToolkitCreateResponseSchema, CustomToolkitDeleteResponseSchema, CustomToolkitSyncParamsSchema, CustomToolkitSyncResponseSchema, CustomToolkitUpdateParamsSchema, CustomToolkitUpdateResponseSchema, CustomToolkitUpsertParamsSchema, CustomToolkitUpsertResponseSchema, CustomToolkits, DefaultCreateConnectedAccountParamsSchema, DefaultWebhookSubscriptionEvents, Experimental, FileDeleteResponseSchema, FileListResponseSchema, FileModifierErrorCodes, GenerateURLParamsSchema, GenerateURLResponseSchema, IncomingTriggerPayloadSchema, JSONSchemaPropertySchema, JsonSchemaRefResolutionError, JsonSchemaToZodError, Keyring, KeyringTransferKeySchema, KeyringTransferKeysResponseSchema, LogSearchFilterFieldSchema, LogSearchFilterOperatorSchema, LogSearchFilterSchema, LogSearchParamsSchema, LogSearchResponseSchema, LogSearchTimeRangeSchema, Logs, MAX_URL_UPLOAD_SIZE_BYTES, MCP, MCPAuthOptionsSchema, MCPGenerateURLParamsSchema, MCPGetServerParamsSchema, MCPMultiAppServerSchema, MCPServerCreateResponseSchema, MCPServerListResponseSchema, MCPServerSchema, MCPServerTypeSchema, MCPServerUpdateParamsSchema, MCPSingleAppServerSchema, MCPToolkitConfigSchema, MCPToolkitConfigsArraySchema, McpDeleteResponseSchema, McpListResponseSchema, McpRetrieveResponseSchema, McpUpdateResponseSchema, Oauth1ActiveConnectionDataSchema, Oauth1ConnectionDataSchema, Oauth1ExpiredConnectionDataSchema, Oauth1FailedConnectionDataSchema, Oauth1InactiveConnectionDataSchema, Oauth1InitiatedConnectionDataSchema, Oauth1InitiatingConnectionDataSchema, Oauth2ActiveConnectionDataSchema, Oauth2ConnectionDataSchema, Oauth2ExpiredConnectionDataSchema, Oauth2FailedConnectionDataSchema, Oauth2InactiveConnectionDataSchema, Oauth2InitiatedConnectionDataSchema, Oauth2InitiatingConnectionDataSchema, Oauth2RevokedConnectionDataSchema, OpenAIProvider, PatchConnectedAccountParamsSchema, RedirectableAuthSchemeSchema, RemoteFile, RemoteFileDataSchema, RemoteFileDownloadError, RemoteFileErrorCodes, SDKErrorCodes, SandboxSizeSchema, SessionConfigListParamsSchema, SessionConfigListResponseSchema, SessionConfigPolicySchema, SessionConfigSchema, SessionConfigSummarySchema, SessionConfigs, SessionPreset, SessionProxyExecuteParamsSchema, SessionWebhookEventTypes, SessionWebhooks, Sessions, SetWebhookSubscriptionParamsSchema, SingleConnectedAccountDetailedResponseSchema, SsrfErrorCodes, ToolErrorCodes, ToolExecuteMetaParamsSchema, ToolExecuteParamsSchema, ToolExecuteResponseSchema, ToolExecutionLogDetailSchema, ToolExecutionLogLevelSchema, ToolExecutionLogMetadataSchema, ToolExecutionLogParentSchema, ToolExecutionLogSchema, ToolExecutionLogStatusSchema, ToolKitItemSchema, ToolKitListResponseSchema, ToolKitMetaSchema, ToolListParamsSchema, ToolListResponseSchema, ToolProxyParamsSchema, ToolRouterBlockReasonSchema, ToolRouterConfigManageConnectionsSchema, ToolRouterConfigTagsSchema, ToolRouterConfigToolsSchema, ToolRouterCreateSessionConfigSchema, ToolRouterErrorCodes, ToolRouterHookAppliesToSchema, ToolRouterHookConditionCheckHandlerSchema, ToolRouterHookPromptInjectionCheckHandlerSchema, ToolRouterHookResultSchema, ToolRouterHookSchema, ToolRouterHookWebhookHandlerSchema, ToolRouterInstantSchema, ToolRouterMCPServerConfigSchema, ToolRouterManageConnectionsConfigSchema, ToolRouterProxyExecuteConfigSchema, ToolRouterProxyExecuteSchema, ToolRouterSandboxConfigSchema, ToolRouterSession, ToolRouterSessionDeleteResponseSchema, ToolRouterSessionEnsureConnectedOptionsSchema, ToolRouterSessionExecuteResponseSchema, ToolRouterSessionFilesMountDeleteOptionsSchema, ToolRouterSessionFilesMountDownloadOptionsSchema, ToolRouterSessionFilesMountListOptionsSchema, ToolRouterSessionFilesMountUploadOptionsSchema, ToolRouterSessionListConfigHistoryOptionsSchema, ToolRouterSessionSearchResponseSchema, ToolRouterTagsEnableDisableSchema, ToolRouterTagsParamSchema, ToolRouterToolkitsDisabledConfigSchema, ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsOptionsSchema, ToolRouterToolkitsParamSchema, ToolRouterToolsParamSchema, ToolRouterUpdateExperimentalSchema, ToolRouterUpdateManageConnectionsSchema, ToolRouterUpdateSessionConfigSchema, ToolSchema, ToolkitAuthConfigDetailsSchema, ToolkitAuthFieldSchema, ToolkitAuthFieldsResponseSchema, ToolkitCategorySchema, ToolkitChangelogItemSchema, ToolkitChangelogResponseSchema, ToolkitComposioManagedAuthSchema, ToolkitConditionalScopeSchema, ToolkitConnectionStateSchema, ToolkitConnectionsDetailsSchema, ToolkitErrorCodes, ToolkitGetManySlugsSchema, ToolkitGrantContextDimensionSchema, ToolkitLatestVersionSchema, ToolkitListGrantContextsParamsSchema, ToolkitListGrantContextsResponseSchema, ToolkitMangedByEnumSchema, ToolkitRecommendScopesParamsSchema, ToolkitRecommendScopesResponseSchema, ToolkitRetrieveCategoriesResponseSchema, ToolkitRetrieveResponseSchema, ToolkitSchema, ToolkitSortByEnumSchema, ToolkitVersionChangelogSchema, ToolkitVersionParamSchema, ToolkitVersionSchema, ToolkitVersionsSchema, ToolkitsGetManyParamsSchema, ToolkitsListParamsSchema, TriggerErrorCodes, TriggerInstanceListActiveParamsSchema, TriggerInstanceListActiveResponseItemSchema, TriggerInstanceListActiveResponseSchema, TriggerInstanceManageDeleteResponseSchema, TriggerInstanceManageUpdateParamsSchema, TriggerInstanceManageUpdateResponseSchema, TriggerInstanceTypeSchema, TriggerInstanceUpsertParamsSchema, TriggerInstanceUpsertResponseSchema, TriggerStatusEnum, TriggerStatuses, TriggerSubscribeParamSchema, TriggerTypeSchema, TriggersTypeListParamsSchema, TriggersTypeListResponseSchema, UpdateConnectedAccountAclParamsSchema, UpdateConnectedAccountParamsSchema, Usage, UsageBreakdownGroupSchema, UsageBreakdownParamsSchema, UsageBreakdownResponseSchema, UsageEntitySummarySchema, UsageFiltersSchema, UsageOrderBySchema, UsageOrderDirectionSchema, UsageSummaryParamsSchema, UsageSummaryResponseSchema, ValidationError, ValidationErrorCodes, VerifyWebhookParamsSchema, WebhookConnectedAccountAuthConfigSchema, WebhookConnectionMetadataSchema, WebhookConnectionStateSchema, WebhookEndpointCreateParamsSchema, WebhookEndpointListItemSchema, WebhookEndpointListParamsSchema, WebhookEndpointListResponseSchema, WebhookEndpointReplaceParamsSchema, WebhookEndpointSchema, WebhookEndpointUpdateParamsSchema, WebhookEndpoints, WebhookEventSchema, WebhookEventTypes, WebhookPayloadSchema, WebhookPayloadV1Schema, WebhookPayloadV2Schema, WebhookPayloadV3Schema, WebhookSubscriptionDeleteResponseSchema, WebhookSubscriptionEventTypeSchema, WebhookSubscriptionEventTypesResponseSchema, WebhookSubscriptionListParamsSchema, WebhookSubscriptionListResponseSchema, WebhookSubscriptionRotateSecretResponseSchema, WebhookSubscriptionSchema, WebhookSubscriptionSetParamsSchema, WebhookSubscriptionUpdateParamsSchema, WebhookSubscriptions, WebhookTriggerPayloadV3Schema, WebhookVersionSchema, WebhookVersions, Webhooks, assertSafeFileUploadPath, constants_exports as constants, createConnectionRequest, deduplicateJsonSchemaRequiredArrays, dereferenceJsonSchema, ensureObjectTypeOnProperties, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit, getExtensionFromMimeType, handleToolExecutionError, isBlockedSensitiveFileUploadPath, isComposioRateLimitError, isRequestAbortError, jsonSchemaToZodSchema, logger, mappingHasRenames, normalizeToolArguments, omitNullToolArguments, readResponseBodyWithLimit, removeNonRequiredProperties, restoreOriginalKeys, sanitizeSchemaPropertyKeys, telemetry, toStrictJsonSchema };