@composio/core 0.31.0 → 0.32.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 (84) hide show
  1. package/dist/{CustomTool-9Vlb4XaS.mjs → CustomTool-B4dQn2M5.mjs} +1 -1
  2. package/dist/{CustomTool-Ds5aLDth.d.mts → CustomTool-CBx9kzea.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-BWKZmDxM.mjs} +2 -2
  6. package/dist/composio-CPf6NHnB.d.mts +20334 -0
  7. package/dist/{customTool.types-DHxXBU6E.d.mts → customTool.types-BSbIG1OG.d.mts} +291 -68
  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 +44 -32
  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-BJUYMEph.mjs} +7 -7
  35. package/dist/index.d.mts +6 -11
  36. package/dist/index.mjs +526 -233
  37. package/dist/{jsonSchema-Cc4EtHRw.mjs → jsonSchema-BZoXGUCr.mjs} +2 -2
  38. package/dist/models/Files.node.mjs +3 -3
  39. package/dist/{sensitiveFileUploadPaths-CSyJ3Ku8.mjs → sensitiveFileUploadPaths-CcbMAYCC.mjs} +21 -15
  40. package/dist/{ssrfGuard.node-CdIkwqVu.mjs → ssrfGuard.node-B749ae5Q.mjs} +1 -1
  41. package/dist/{types-DcdZy5Nc.d.mts → types-ns3Q_WrP.d.mts} +2 -2
  42. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  43. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  44. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  45. package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
  46. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  47. package/dist/utils/ssrfGuard.node.mjs +1 -1
  48. package/dist/utils/ssrfGuard.workerd.mjs +1 -1
  49. package/package.json +2 -2
  50. package/src/composio.ts +26 -7
  51. package/src/errors/ComposioError.ts +3 -2
  52. package/src/index.ts +19 -0
  53. package/src/lib/toolRouterParams.ts +38 -14
  54. package/src/models/AuthConfigs.ts +10 -3
  55. package/src/models/ConnectedAccounts.ts +30 -17
  56. package/src/models/CustomTool.ts +0 -10
  57. package/src/models/Keyring.ts +2 -1
  58. package/src/models/MCP.ts +43 -35
  59. package/src/models/SessionWebhooks.ts +136 -0
  60. package/src/models/ToolRouter.ts +39 -4
  61. package/src/models/ToolRouterSession.ts +2 -2
  62. package/src/models/ToolRouterSessionFileMount.ts +3 -1
  63. package/src/models/Toolkits.ts +1 -0
  64. package/src/models/Tools.ts +4 -8
  65. package/src/models/Triggers.ts +48 -213
  66. package/src/models/Webhooks.ts +2 -0
  67. package/src/provider/ComposioProvider.ts +0 -1
  68. package/src/telemetry/BatchProcessor.ts +1 -1
  69. package/src/telemetry/Telemetry.ts +1 -1
  70. package/src/types/connectedAccountAuthStates.types.ts +0 -1
  71. package/src/types/provider.types.ts +0 -1
  72. package/src/types/sessionWebhooks.types.ts +292 -0
  73. package/src/types/toolRouter.types.ts +33 -4
  74. package/src/types/triggers.types.ts +4 -0
  75. package/src/utils/crypto.ts +6 -5
  76. package/src/utils/env.ts +2 -5
  77. package/src/utils/fileUtils.node.ts +4 -3
  78. package/src/utils/logger.ts +19 -9
  79. package/src/utils/pusher.ts +5 -2
  80. package/src/utils/readResponseBody.ts +30 -17
  81. package/src/utils/transformers/authConfigs.ts +0 -1
  82. package/src/utils/userCallback.ts +3 -1
  83. package/src/utils/webhookVerification.ts +211 -0
  84. 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-BZoXGUCr.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-BWKZmDxM.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-CcbMAYCC.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
  */
@@ -4279,6 +4281,8 @@ var ConnectedAccounts = class {
4279
4281
  *
4280
4282
  * @example
4281
4283
  * ```typescript
4284
+ * import { AuthScheme } from '@composio/core';
4285
+ *
4282
4286
  * // For OAuth2 authentication
4283
4287
  * const connectionRequest = await composio.connectedAccounts.initiate(
4284
4288
  * 'user_123',
@@ -4291,17 +4295,27 @@ var ConnectedAccounts = class {
4291
4295
  * })
4292
4296
  * }
4293
4297
  * );
4298
+ * ```
4299
+ *
4300
+ * @example
4301
+ * ```typescript
4302
+ * import { AuthScheme } from '@composio/core';
4294
4303
  *
4295
4304
  * // For API Key authentication
4296
4305
  * const connectionRequest = await composio.connectedAccounts.initiate(
4297
4306
  * 'user_123',
4298
4307
  * 'auth_config_123',
4299
4308
  * {
4300
- * config: AuthScheme.ApiKey({
4309
+ * config: AuthScheme.APIKey({
4301
4310
  * api_key: 'your_api_key'
4302
4311
  * })
4303
4312
  * }
4304
4313
  * );
4314
+ * ```
4315
+ *
4316
+ * @example
4317
+ * ```typescript
4318
+ * import { AuthScheme } from '@composio/core';
4305
4319
  *
4306
4320
  * // For Basic authentication
4307
4321
  * const connectionRequest = await composio.connectedAccounts.initiate(
@@ -4437,7 +4451,10 @@ var ConnectedAccounts = class {
4437
4451
  * ```typescript
4438
4452
  * // Wait for a connection to complete with default timeout
4439
4453
  * const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc');
4454
+ * ```
4440
4455
  *
4456
+ * @example
4457
+ * ```typescript
4441
4458
  * // Wait with a custom timeout of 2 minutes
4442
4459
  * const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc', 120000);
4443
4460
  * ```
@@ -4573,11 +4590,16 @@ var ConnectedAccounts = class {
4573
4590
  *
4574
4591
  * @example
4575
4592
  * ```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
- * });
4593
+ * // Your verifier route, after authenticating the user
4594
+ * export async function GET(request: Request) {
4595
+ * // The session URI arrives as the `session_uri` query parameter of the verifier redirect
4596
+ * const sessionUri = new URL(request.url).searchParams.get('session_uri') ?? '';
4597
+ * const { connectedAccountId, toolkitSlug } = await composio.connectedAccounts.completeAuth({
4598
+ * userId: 'user_123',
4599
+ * sessionUri,
4600
+ * });
4601
+ * return new Response(`Connected ${toolkitSlug}: ${connectedAccountId}`);
4602
+ * }
4581
4603
  * ```
4582
4604
  */
4583
4605
  async completeAuth(params, requestOptions) {
@@ -4602,10 +4624,9 @@ var ConnectedAccounts = class {
4602
4624
  * enabled: true
4603
4625
  * });
4604
4626
  *
4605
- * // Disable a connected account with a reason
4627
+ * // Disable a connected account
4606
4628
  * const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
4607
- * enabled: false,
4608
- * reason: 'Token expired'
4629
+ * enabled: false
4609
4630
  * });
4610
4631
  * ```
4611
4632
  */
@@ -4621,7 +4642,7 @@ var ConnectedAccounts = class {
4621
4642
  * ```typescript
4622
4643
  * // Enable a previously disabled connected account
4623
4644
  * const enabledAccount = await composio.connectedAccounts.enable('conn_abc123');
4624
- * console.log(enabledAccount.isDisabled); // false
4645
+ * console.log(enabledAccount.success); // true
4625
4646
  * ```
4626
4647
  */
4627
4648
  async enable(nanoid, requestOptions) {
@@ -4636,13 +4657,7 @@ var ConnectedAccounts = class {
4636
4657
  * ```typescript
4637
4658
  * // Disable a connected account
4638
4659
  * 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
- * // });
4660
+ * console.log(disabledAccount.success); // true
4646
4661
  * ```
4647
4662
  */
4648
4663
  async disable(nanoid, requestOptions) {
@@ -5134,6 +5149,7 @@ var Toolkits = class {
5134
5149
  *
5135
5150
  * @example
5136
5151
  * ```typescript
5152
+ * const userId = 'user_123';
5137
5153
  * const connectionRequest = await composio.toolkits.authorize(userId, 'github');
5138
5154
  * ```
5139
5155
  *
@@ -5391,7 +5407,9 @@ const VerifyWebhookParamsSchema = z$1.object({
5391
5407
  * Set to 0 to disable timestamp validation.
5392
5408
  * @default 300 (5 minutes)
5393
5409
  */
5394
- tolerance: z$1.number().optional().default(300)
5410
+ tolerance: z$1.number().optional().default(300),
5411
+ /** Maximum UTF-8 size of the supplied payload in bytes. */
5412
+ maxBodyBytes: z$1.number().int().nonnegative().safe().optional()
5395
5413
  });
5396
5414
 
5397
5415
  // src/types/webhooks.types.ts
@@ -5637,6 +5655,8 @@ var WebhookSubscriptions = class {
5637
5655
  *
5638
5656
  * @example
5639
5657
  * ```typescript
5658
+ * const APP_URL = 'https://your-app.com';
5659
+ *
5640
5660
  * const subscription = await composio.webhooks.subscriptions.set({
5641
5661
  * webhookUrl: `${APP_URL}/webhooks/composio`,
5642
5662
  * enabledEvents: ['composio.trigger.message', 'composio.connected_account.expired'],
@@ -5896,46 +5916,6 @@ var InternalService = class {
5896
5916
  }
5897
5917
  };
5898
5918
 
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
5919
  // src/utils/sdk.ts
5940
5920
  /**
5941
5921
  * Header that carries a Composio user API key (`uak_...`) instead of a project
@@ -6635,14 +6615,12 @@ function transformTriggerInstanceListActiveResponse(response) {
6635
6615
  * Computes HMAC-SHA256 using Web Crypto API
6636
6616
  */
6637
6617
  async function hmacSha256Base64(secret, message) {
6638
- const encoder = new TextEncoder();
6639
- const keyData = encoder.encode(secret);
6618
+ const keyData = new TextEncoder().encode(secret);
6640
6619
  const key = await globalThis.crypto.subtle.importKey("raw", keyData, {
6641
6620
  name: "HMAC",
6642
6621
  hash: "SHA-256"
6643
6622
  }, false, ["sign"]);
6644
- const signatureData = encoder.encode(message);
6645
- const signatureBuffer = await globalThis.crypto.subtle.sign("HMAC", key, signatureData);
6623
+ const signatureBuffer = await globalThis.crypto.subtle.sign("HMAC", key, message);
6646
6624
  return arrayBufferToBase64(signatureBuffer);
6647
6625
  }
6648
6626
  /**
@@ -6655,36 +6633,56 @@ function timingSafeEqual(a, b) {
6655
6633
  return result === 0;
6656
6634
  }
6657
6635
 
6658
- // src/models/Triggers.ts
6636
+ // src/utils/webhookVerification.ts
6637
+ const DEFAULT_WEBHOOK_BODY_LIMIT_BYTES = 10485760;
6659
6638
  /**
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
6639
+ * The signature header names Composio sends with every webhook request.
6672
6640
  */
6673
6641
  const WEBHOOK_HEADERS = {
6674
6642
  id: "webhook-id",
6675
6643
  timestamp: "webhook-timestamp",
6676
6644
  signature: "webhook-signature"
6677
6645
  };
6646
+ const isFetchRequest = (request) => typeof Request !== "undefined" && request instanceof Request;
6678
6647
  /**
6679
- * Returns true if the value is a Fetch API `Request`.
6680
- * @private
6648
+ * Coerces an already-buffered request body into the string expected by
6649
+ * signature verification.
6681
6650
  */
6682
- const isFetchRequest = (request) => typeof Request !== "undefined" && request instanceof Request;
6651
+ const bodyToString = (body) => {
6652
+ if (typeof body === "string") return body;
6653
+ if (body === null || body === void 0) return "";
6654
+ if (typeof body === "object") return JSON.stringify(body);
6655
+ return describeThrown(body);
6656
+ };
6657
+ const webhookBodyLimitError = (maxBytes) => new ComposioWebhookPayloadError(`Webhook payload exceeds the ${maxBytes}-byte limit`);
6658
+ const assertWebhookBodySize = (body, maxBytes) => {
6659
+ assertValidBodyLimit(maxBytes);
6660
+ if (body.length > maxBytes || typeof body === "string" && new TextEncoder().encode(body).byteLength > maxBytes) throw webhookBodyLimitError(maxBytes);
6661
+ };
6662
+ /**
6663
+ * Reads the raw body and the headers from either request shape: a Fetch API
6664
+ * `Request`, or a plain `{ body, headers }` object.
6665
+ */
6666
+ const readWebhookRequest = async (request, maxBytes = DEFAULT_WEBHOOK_BODY_LIMIT_BYTES) => {
6667
+ if (isFetchRequest(request)) {
6668
+ if (request.bodyUsed) throw new TypeError("Webhook request body has already been read");
6669
+ const bytes = await readBodyWithLimit(request, maxBytes, () => webhookBodyLimitError(maxBytes));
6670
+ return {
6671
+ body: new TextDecoder().decode(bytes),
6672
+ headers: request.headers
6673
+ };
6674
+ }
6675
+ const body = request.body instanceof Uint8Array ? request.body : bodyToString(request.body);
6676
+ assertWebhookBodySize(body, maxBytes);
6677
+ return {
6678
+ body: typeof body === "string" ? body : new TextDecoder().decode(body),
6679
+ headers: request.headers
6680
+ };
6681
+ };
6683
6682
  /**
6684
6683
  * Reads a single header value case-insensitively from either a `Headers`
6685
6684
  * instance or a plain record (where values may be `string | string[]`).
6686
6685
  * Returns `undefined` when the header is missing.
6687
- * @private
6688
6686
  */
6689
6687
  const getHeader = (headers, name) => {
6690
6688
  if (typeof Headers !== "undefined" && headers instanceof Headers) return headers.get(name) ?? void 0;
@@ -6697,16 +6695,56 @@ const getHeader = (headers, name) => {
6697
6695
  }
6698
6696
  };
6699
6697
  /**
6700
- * Coerces an object request body (string, Buffer/Uint8Array, or already-parsed
6701
- * value) into the raw string form expected by signature verification.
6698
+ * Verifies the HMAC-SHA256 signature of a webhook payload.
6699
+ * The signature format used by Composio is: `v1,base64EncodedSignature`
6700
+ * The signing input is the UTF-8 prefix `${msgId}.${timestamp}.` followed by
6701
+ * the original payload bytes.
6702
+ */
6703
+ async function verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret) {
6704
+ if (payload.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook payload was provided.");
6705
+ if (signature.length === 0) throw new ComposioWebhookSignatureVerificationError("No signature header value was provided. Please pass the value of the 'webhook-signature' header.");
6706
+ if (secret.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook secret was provided. You can find your webhook secret in your Composio dashboard.");
6707
+ if (webhookId.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook ID was provided. Please pass the value of the 'webhook-id' header.");
6708
+ if (webhookTimestamp.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook timestamp was provided. Please pass the value of the 'webhook-timestamp' header.");
6709
+ const signatures = signature.split(" ");
6710
+ const v1Signatures = [];
6711
+ for (const sig of signatures) {
6712
+ const [version, value] = sig.split(",");
6713
+ if (version === "v1" && value) v1Signatures.push(value);
6714
+ }
6715
+ if (v1Signatures.length === 0) throw new ComposioWebhookSignatureVerificationError("No valid v1 signature found in the webhook-signature header. Expected format: 'v1,base64EncodedSignature'");
6716
+ const encoder = new TextEncoder();
6717
+ const prefix = `${webhookId}.${webhookTimestamp}.`;
6718
+ let toSign;
6719
+ if (typeof payload === "string") toSign = encoder.encode(prefix + payload);
6720
+ else {
6721
+ const prefixBytes = encoder.encode(prefix);
6722
+ toSign = new Uint8Array(prefixBytes.length + payload.length);
6723
+ toSign.set(prefixBytes);
6724
+ toSign.set(payload, prefixBytes.length);
6725
+ }
6726
+ const expectedSignature = await hmacSha256Base64(secret, toSign);
6727
+ if (!v1Signatures.some((candidate) => timingSafeEqual(candidate, expectedSignature))) throw new ComposioWebhookSignatureVerificationError("The signature provided is invalid. Please ensure you are using the correct webhook secret.");
6728
+ }
6729
+ /**
6730
+ * Validates that the webhook timestamp is within the allowed tolerance
6731
+ */
6732
+ function validateWebhookTimestamp(webhookTimestamp, tolerance) {
6733
+ const timestampSeconds = parseInt(webhookTimestamp, 10);
6734
+ if (Number.isNaN(timestampSeconds)) throw new ComposioWebhookPayloadError(`Invalid webhook timestamp: ${webhookTimestamp}. Expected Unix timestamp in seconds.`);
6735
+ const webhookTimeMs = timestampSeconds * 1e3;
6736
+ const timeDifference = Math.abs(Date.now() - webhookTimeMs);
6737
+ 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.`);
6738
+ }
6739
+
6740
+ // src/models/Triggers.ts
6741
+ /**
6742
+ * Normalizes string and numeric identifiers, falling back for empty or malformed values.
6702
6743
  * @private
6703
6744
  */
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);
6745
+ const toStringOrDefault = (value, defaultValue) => {
6746
+ const str = typeof value === "string" || typeof value === "number" ? String(value) : "";
6747
+ return str.length > 0 ? str : defaultValue;
6710
6748
  };
6711
6749
  /**
6712
6750
  * Trigger (Instance) class
@@ -6736,6 +6774,8 @@ var Triggers = class {
6736
6774
  *
6737
6775
  * @example
6738
6776
  * ```ts
6777
+ * const APP_URL = 'https://your-app.com';
6778
+ *
6739
6779
  * await composio.triggers.setWebhookSubscription({
6740
6780
  * webhookUrl: `${APP_URL}/webhooks/composio`,
6741
6781
  * });
@@ -6755,7 +6795,7 @@ var Triggers = class {
6755
6795
  *
6756
6796
  * @example
6757
6797
  * ```ts
6758
- * const triggers = await triggers.listActive({
6798
+ * const activeTriggers = await composio.triggers.listActive({
6759
6799
  * authConfigIds: ['123'],
6760
6800
  * connectedAccountIds: ['456'],
6761
6801
  * });
@@ -6955,10 +6995,9 @@ var Triggers = class {
6955
6995
  *
6956
6996
  * @example
6957
6997
  * ```ts
6958
- *
6959
- * triggers.subscribe((data) => {
6998
+ * await composio.triggers.subscribe((data) => {
6960
6999
  * console.log(data);
6961
- * }, );
7000
+ * });
6962
7001
  * ```
6963
7002
  */
6964
7003
  async subscribe(fn, filters = {}, onSubscriptionError) {
@@ -7064,11 +7103,11 @@ var Triggers = class {
7064
7103
  *
7065
7104
  * @example
7066
7105
  * ```ts
7067
- * composio.trigger.subscribe((data) => {
7106
+ * await composio.triggers.subscribe((data) => {
7068
7107
  * console.log(data);
7069
7108
  * });
7070
7109
  *
7071
- * await triggers.unsubscribe();
7110
+ * await composio.triggers.unsubscribe();
7072
7111
  * ```
7073
7112
  */
7074
7113
  async unsubscribe() {
@@ -7087,18 +7126,22 @@ var Triggers = class {
7087
7126
  * Next.js Pages Router `req`). The signature headers (`webhook-id`,
7088
7127
  * `webhook-timestamp`, `webhook-signature`) are read case-insensitively.
7089
7128
  *
7129
+ * Configure a request body limit in your server or framework as well,
7130
+ * especially if it buffers the body before calling this method.
7131
+ *
7090
7132
  * @param {WebhookRequestLike} request - The incoming webhook HTTP request
7091
7133
  * @param {ParseWebhookOptions} [options] - Parse options
7092
7134
  * @param {string} [options.verifySecret] - Webhook secret; when set, the signature is verified
7093
7135
  * @param {number} [options.tolerance=300] - Max webhook age in seconds (only used when verifying)
7136
+ * @param {number} [options.maxBodyBytes=10485760] - Max request body size in bytes (10 MiB)
7094
7137
  * @returns {Promise<VerifyWebhookResult>} The parsed (and optionally verified) webhook payload
7095
7138
  *
7096
7139
  * @throws {ValidationError} If `verifySecret` is set but the signature headers are missing
7097
7140
  * @throws {ComposioWebhookSignatureVerificationError} If signature verification fails
7098
- * @throws {ComposioWebhookPayloadError} If the payload cannot be parsed
7141
+ * @throws {ComposioWebhookPayloadError} If the payload exceeds the limit or cannot be parsed
7099
7142
  *
7100
7143
  * @example
7101
- * ```ts
7144
+ * ```ts nocheck="Express route handler; the checker has no express types"
7102
7145
  * // Express with express.raw (verify the signature)
7103
7146
  * app.post('/webhooks/composio', express.raw({ type: 'application/json' }), async (req, res) => {
7104
7147
  * try {
@@ -7136,7 +7179,10 @@ var Triggers = class {
7136
7179
  * return new Response('Unauthorized', { status: 401 });
7137
7180
  * }
7138
7181
  * }
7182
+ * ```
7139
7183
  *
7184
+ * @example
7185
+ * ```ts
7140
7186
  * // Next.js App Router — parse only (no verification)
7141
7187
  * export async function POST(request: Request) {
7142
7188
  * const result = await composio.triggers.parse(request);
@@ -7146,15 +7192,7 @@ var Triggers = class {
7146
7192
  * ```
7147
7193
  */
7148
7194
  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
- }
7195
+ const { body, headers } = await readWebhookRequest(request, options?.maxBodyBytes);
7158
7196
  const verifySecret = options?.verifySecret;
7159
7197
  if (options === void 0 || !("verifySecret" in options)) {
7160
7198
  const { version, rawPayload, normalizedPayload } = this.parseWebhookPayload(body);
@@ -7195,6 +7233,9 @@ var Triggers = class {
7195
7233
  * The signature is computed as: `HMAC-SHA256(${webhookId}.${webhookTimestamp}.${payload}, secret)`
7196
7234
  * and is expected in the format: `v1,base64EncodedSignature`
7197
7235
  *
7236
+ * For a Fetch API `Request`, use {@link parse} to enforce a limit while reading
7237
+ * the body. Set a server request limit if you buffer the payload yourself.
7238
+ *
7198
7239
  * @param {VerifyWebhookParams} params - The verification parameters
7199
7240
  * @param {string} params.payload - The raw webhook payload as a string (request body)
7200
7241
  * @param {string} params.signature - The signature from the 'webhook-signature' header
@@ -7202,6 +7243,7 @@ var Triggers = class {
7202
7243
  * @param {string} params.webhookId - The webhook ID from the 'webhook-id' header
7203
7244
  * @param {string} params.webhookTimestamp - The timestamp from the 'webhook-timestamp' header (Unix seconds)
7204
7245
  * @param {number} [params.tolerance=300] - Maximum allowed age of the webhook in seconds (default: 5 minutes). Set to 0 to disable timestamp validation.
7246
+ * @param {number} [params.maxBodyBytes] - Max UTF-8 size of the supplied payload
7205
7247
  * @returns {VerifyWebhookResult} The verified and parsed webhook payload with version information
7206
7248
  *
7207
7249
  * @throws {ValidationError} If the parameters are invalid
@@ -7210,26 +7252,26 @@ var Triggers = class {
7210
7252
  *
7211
7253
  * @example
7212
7254
  * ```ts
7213
- * // In an Express.js webhook handler
7214
- * app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
7255
+ * // In a webhook route that receives a Fetch API Request (Next.js App Router, Hono, Remix)
7256
+ * export async function POST(request: Request) {
7215
7257
  * try {
7216
7258
  * 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,
7259
+ * payload: await request.text(),
7260
+ * signature: request.headers.get('webhook-signature') ?? '',
7261
+ * id: request.headers.get('webhook-id') ?? '',
7262
+ * timestamp: request.headers.get('webhook-timestamp') ?? '',
7221
7263
  * secret: process.env.COMPOSIO_WEBHOOK_SECRET!,
7222
7264
  * });
7223
7265
  *
7224
7266
  * // Process the verified payload
7225
7267
  * console.log('Webhook version:', result.version);
7226
7268
  * console.log('Received trigger:', result.payload.triggerSlug);
7227
- * res.status(200).send('OK');
7269
+ * return new Response('OK', { status: 200 });
7228
7270
  * } catch (error) {
7229
7271
  * console.error('Webhook verification failed:', error);
7230
- * res.status(401).send('Unauthorized');
7272
+ * return new Response('Unauthorized', { status: 401 });
7231
7273
  * }
7232
- * });
7274
+ * }
7233
7275
  * ```
7234
7276
  */
7235
7277
  async verifyWebhook(params) {
@@ -7247,9 +7289,10 @@ var Triggers = class {
7247
7289
  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
7290
  throw new ValidationError("Invalid parameters passed to verifyWebhook", { cause: parsedParams.error });
7249
7291
  }
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);
7292
+ const { payload, signature, secret, id: webhookId, timestamp: webhookTimestamp, tolerance, maxBodyBytes } = parsedParams.data;
7293
+ if (maxBodyBytes !== void 0) assertWebhookBodySize(payload, maxBodyBytes);
7294
+ if (tolerance > 0) validateWebhookTimestamp(webhookTimestamp, tolerance);
7295
+ await verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret);
7253
7296
  const { version, rawPayload, normalizedPayload } = this.parseWebhookPayload(payload);
7254
7297
  return {
7255
7298
  version,
@@ -7270,7 +7313,7 @@ var Triggers = class {
7270
7313
  }
7271
7314
  const result = this.tryParseVersionedPayload(jsonPayload);
7272
7315
  if (result.ok) {
7273
- const { ok, ...rest } = result;
7316
+ const { ok: _ok, ...rest } = result;
7274
7317
  return rest;
7275
7318
  }
7276
7319
  const { v1Error, v2Error, v3Error } = result;
@@ -7404,45 +7447,6 @@ var Triggers = class {
7404
7447
  }
7405
7448
  };
7406
7449
  }
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
7450
  };
7447
7451
 
7448
7452
  // src/types/mcp.experimental.types.ts
@@ -7591,18 +7595,19 @@ var MCP = class {
7591
7595
  *
7592
7596
  * @example
7593
7597
  * ```typescript
7594
- * const server = await composio.mcpConfig.create("personal-mcp-server", {
7598
+ * const server = await composio.mcp.create("personal-mcp-server", {
7595
7599
  * toolkits: ["github", "slack"],
7596
- * allowedTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"],
7600
+ * allowedTools: ["GITHUB_CREATE_AN_ISSUE", "SLACK_SEND_MESSAGE"],
7597
7601
  * manuallyManageConnections: false
7598
- * }
7599
7602
  * });
7603
+ * ```
7600
7604
  *
7601
- * const server = await composio.mcpConfig.create("personal-mcp-server", {
7605
+ * @example
7606
+ * ```typescript
7607
+ * const server = await composio.mcp.create("personal-mcp-server", {
7602
7608
  * toolkits: [{ toolkit: "gmail", authConfigId: "ac_243434343" }],
7603
7609
  * allowedTools: ["GMAIL_FETCH_EMAILS"],
7604
7610
  * manuallyManageConnections: false
7605
- * }
7606
7611
  * });
7607
7612
  * ```
7608
7613
  */
@@ -7653,22 +7658,31 @@ var MCP = class {
7653
7658
  *
7654
7659
  * @example
7655
7660
  * ```typescript
7656
- * // List all MCP servers
7657
- * const allServers = await composio.experimental.mcp.list({});
7661
+ * // List the first page of MCP servers
7662
+ * const allServers = await composio.mcp.list({ page: 1, limit: 10, toolkits: [], authConfigs: [] });
7658
7663
  *
7659
7664
  * // List with pagination
7660
- * const pagedServers = await composio.experimental.mcp.list({
7665
+ * const pagedServers = await composio.mcp.list({
7661
7666
  * page: 2,
7662
- * limit: 5
7667
+ * limit: 5,
7668
+ * toolkits: [],
7669
+ * authConfigs: []
7663
7670
  * });
7664
7671
  *
7665
7672
  * // Filter by toolkit
7666
- * const githubServers = await composio.experimental.mcp.list({
7667
- * toolkits: ['github', 'slack']
7673
+ * const githubServers = await composio.mcp.list({
7674
+ * page: 1,
7675
+ * limit: 10,
7676
+ * toolkits: ['github', 'slack'],
7677
+ * authConfigs: []
7668
7678
  * });
7669
7679
  *
7670
7680
  * // Filter by name
7671
- * const namedServers = await composio.experimental.mcp.list({
7681
+ * const namedServers = await composio.mcp.list({
7682
+ * page: 1,
7683
+ * limit: 10,
7684
+ * toolkits: [],
7685
+ * authConfigs: [],
7672
7686
  * name: 'personal'
7673
7687
  * });
7674
7688
  * ```
@@ -7708,7 +7722,7 @@ var MCP = class {
7708
7722
  * @example
7709
7723
  * ```typescript
7710
7724
  * // Get a specific MCP server by ID
7711
- * const server = await composio.experimental.mcp.get("mcp_12345");
7725
+ * const server = await composio.mcp.get("mcp_12345");
7712
7726
  *
7713
7727
  * console.log(server.name); // "My Personal MCP Server"
7714
7728
  * console.log(server.allowedTools); // ["GITHUB_CREATE_AN_ISSUE", "SLACK_SEND_MESSAGE"]
@@ -7737,7 +7751,7 @@ var MCP = class {
7737
7751
  * @example
7738
7752
  * ```typescript
7739
7753
  * // Delete an MCP server by ID
7740
- * const result = await composio.experimental.mcp.delete("mcp_12345");
7754
+ * const result = await composio.mcp.delete("mcp_12345");
7741
7755
  *
7742
7756
  * if (result.deleted) {
7743
7757
  * console.log(`Server ${result.id} has been successfully deleted`);
@@ -7747,15 +7761,15 @@ var MCP = class {
7747
7761
  *
7748
7762
  * // Example with error handling
7749
7763
  * try {
7750
- * const result = await composio.experimental.mcp.delete("mcp_12345");
7764
+ * const result = await composio.mcp.delete("mcp_12345");
7751
7765
  * console.log("Deletion successful:", result);
7752
7766
  * } catch (error) {
7753
- * console.error("Failed to delete MCP server:", error.message);
7767
+ * console.error("Failed to delete MCP server:", error);
7754
7768
  * }
7755
7769
  *
7756
7770
  * // Delete and verify from list
7757
- * await composio.experimental.mcp.delete("mcp_12345");
7758
- * const servers = await composio.experimental.mcp.list({});
7771
+ * await composio.mcp.delete("mcp_12345");
7772
+ * const servers = await composio.mcp.list({ page: 1, limit: 10, toolkits: [], authConfigs: [] });
7759
7773
  * const serverExists = servers.items.some(server => server.id === "mcp_12345");
7760
7774
  * console.log("Server still exists:", serverExists); // Should be false
7761
7775
  * ```
@@ -7783,34 +7797,32 @@ var MCP = class {
7783
7797
  * @example
7784
7798
  * ```typescript
7785
7799
  * // Update server name only
7786
- * const updatedServer = await composio.experimental.mcp.update("mcp_12345", {
7800
+ * const updatedServer = await composio.mcp.update("mcp_12345", {
7787
7801
  * name: "My Updated MCP Server"
7788
7802
  * });
7789
7803
  *
7790
7804
  * // Update toolkits and tools
7791
- * const serverWithNewTools = await composio.experimental.mcp.update("mcp_12345", {
7805
+ * const serverWithNewTools = await composio.mcp.update("mcp_12345", {
7792
7806
  * 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
- * }
7807
+ * { toolkit: "github", authConfigId: "auth_abc123" },
7808
+ * { toolkit: "slack", authConfigId: "auth_xyz789" }
7809
+ * ],
7810
+ * allowedTools: [
7811
+ * "GITHUB_CREATE_AN_ISSUE",
7812
+ * "GITHUB_LIST_REPOS",
7813
+ * "SLACK_SEND_MESSAGE",
7814
+ * "SLACK_LIST_CHANNELS"
7803
7815
  * ]
7804
7816
  * });
7805
7817
  *
7806
7818
  * // Update connection management setting
7807
- * const serverWithManualAuth = await composio.experimental.mcp.update("mcp_12345", {
7819
+ * const serverWithManualAuth = await composio.mcp.update("mcp_12345", {
7808
7820
  * name: "Manual Auth Server",
7809
7821
  * manuallyManageConnections: true
7810
7822
  * });
7811
7823
  *
7812
7824
  * // Complete update example
7813
- * const fullyUpdatedServer = await composio.experimental.mcp.update("mcp_12345", {
7825
+ * const fullyUpdatedServer = await composio.mcp.update("mcp_12345", {
7814
7826
  * name: "Production MCP Server",
7815
7827
  * toolkits: [
7816
7828
  * {
@@ -7818,7 +7830,7 @@ var MCP = class {
7818
7830
  * authConfigId: "auth_gmail_prod",
7819
7831
  * }
7820
7832
  * ],
7821
- * allowedTools: ["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"]
7833
+ * allowedTools: ["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"],
7822
7834
  * manuallyManageConnections: false
7823
7835
  * });
7824
7836
  *
@@ -7861,10 +7873,10 @@ var MCP = class {
7861
7873
  *
7862
7874
  * @example
7863
7875
  * ```typescript
7864
- * import { Composio } from "@composio/code";
7876
+ * import { Composio } from "@composio/core";
7865
7877
  *
7866
7878
  * const composio = new Composio();
7867
- * const mcp = await composio.experimental.mcp.generate("default", "<mcp_config_id>");
7879
+ * const mcp = await composio.mcp.generate("default", "<mcp_config_id>");
7868
7880
  * ```
7869
7881
  *
7870
7882
  * @param userId {string} external user id from your database for whom you want the server for
@@ -8323,6 +8335,16 @@ const ToolRouterHookPromptInjectionCheckHandlerSchema = z.object({
8323
8335
  type: z.literal("prompt_injection_check"),
8324
8336
  action: z.literal("block")
8325
8337
  }).strict();
8338
+ /**
8339
+ * Sends the call to the project's session webhook URL and waits for your
8340
+ * endpoint's answer: let it run, block it, or change it. Read the request in
8341
+ * your endpoint with `composio.sessions.webhooks.parse()`.
8342
+ */
8343
+ const ToolRouterHookWebhookHandlerSchema = z.object({
8344
+ type: z.literal("webhook"),
8345
+ 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."),
8346
+ timeoutMs: z.number().int().optional().describe("How long to wait for your endpoint to answer, in milliseconds. Defaults to 3000.")
8347
+ }).strict();
8326
8348
  const toolRouterHookIdentityFields = {
8327
8349
  id: z.string().describe("Unique within the session. Shows up in results and logs."),
8328
8350
  name: z.string().optional().describe("A readable name. The agent sees it when this hook blocks a call."),
@@ -8331,16 +8353,21 @@ const toolRouterHookIdentityFields = {
8331
8353
  /**
8332
8354
  * A hook on a session's tool calls. A `before_execute` hook can block a call
8333
8355
  * before it runs; an `after_execute` hook can block its result before the
8334
- * agent sees it.
8356
+ * agent sees it. A hook with a `webhook` handler can also change the call or
8357
+ * its result.
8335
8358
  */
8336
8359
  const ToolRouterHookSchema = z.discriminatedUnion("type", [z.object({
8337
8360
  type: z.literal("before_execute"),
8338
8361
  ...toolRouterHookIdentityFields,
8339
- handler: ToolRouterHookConditionCheckHandlerSchema
8362
+ handler: z.discriminatedUnion("type", [ToolRouterHookConditionCheckHandlerSchema, ToolRouterHookWebhookHandlerSchema])
8340
8363
  }).strict(), z.object({
8341
8364
  type: z.literal("after_execute"),
8342
8365
  ...toolRouterHookIdentityFields,
8343
- handler: z.discriminatedUnion("type", [ToolRouterHookConditionCheckHandlerSchema, ToolRouterHookPromptInjectionCheckHandlerSchema])
8366
+ handler: z.discriminatedUnion("type", [
8367
+ ToolRouterHookConditionCheckHandlerSchema,
8368
+ ToolRouterHookPromptInjectionCheckHandlerSchema,
8369
+ ToolRouterHookWebhookHandlerSchema
8370
+ ])
8344
8371
  }).strict()]);
8345
8372
  const ToolRouterCreateSessionConfigBaseSchema = z.object({
8346
8373
  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 +8546,9 @@ const ToolRouterSessionSearchResponseSchema = z.object({
8519
8546
  });
8520
8547
  /**
8521
8548
  * 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.
8549
+ * could not be evaluated (for example it timed out), and `detail` says why
8550
+ * when the API gives a reason. An unavailable hook does not block the call,
8551
+ * unless it has a `webhook` handler with `fallbackAction: 'block'`.
8524
8552
  */
8525
8553
  const ToolRouterHookResultSchema = z.discriminatedUnion("status", [z.object({
8526
8554
  id: z.string().describe("The hook id"),
@@ -8528,7 +8556,8 @@ const ToolRouterHookResultSchema = z.discriminatedUnion("status", [z.object({
8528
8556
  outcome: z.enum(["continue", "block"]).describe("What the hook decided")
8529
8557
  }), z.object({
8530
8558
  id: z.string().describe("The hook id"),
8531
- status: z.literal("unavailable")
8559
+ status: z.literal("unavailable"),
8560
+ detail: z.string().optional().describe("Why the hook could not be evaluated")
8532
8561
  })]);
8533
8562
  /**
8534
8563
  * Why a session hook blocked a call. `request_blocked`: a `before_execute` hook
@@ -8968,9 +8997,10 @@ var Keyring = class {
8968
8997
  * @returns {Promise<KeyringTransferKeysResponse>} The active key ID and every accepted public JWK, newest first
8969
8998
  *
8970
8999
  * @example
8971
- * ```typescript
9000
+ * ```typescript nocheck="Seals with the jose library, whose types the checker does not load"
8972
9001
  * import { CompactEncrypt, importJWK } from 'jose';
8973
9002
  *
9003
+ * const secret = 'my-client-secret';
8974
9004
  * const { activeKid, keys } = await composio.keyring.listTransferKeys();
8975
9005
  * const jwk = keys.find(key => key.kid === activeKid)!;
8976
9006
  * const sealed = await new CompactEncrypt(new TextEncoder().encode(secret))
@@ -9285,7 +9315,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
9285
9315
  };
9286
9316
 
9287
9317
  // package.json
9288
- var version = "0.31.0";
9318
+ var version = "0.32.0";
9289
9319
 
9290
9320
  // src/utils/session.ts
9291
9321
  /**
@@ -9413,13 +9443,14 @@ const transformToolRouterSandboxParams = (params) => {
9413
9443
  sandbox_size: params.sandboxSize
9414
9444
  };
9415
9445
  };
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 }) => ({
9446
+ const transformToolRouterHooksParams = (hooks) => hooks.map(({ appliesTo, handler, ...hook }) => ({
9421
9447
  ...hook,
9422
- applies_to: appliesTo
9448
+ applies_to: appliesTo,
9449
+ handler: handler.type === "webhook" ? {
9450
+ type: handler.type,
9451
+ fallback_action: handler.fallbackAction,
9452
+ ...handler.timeoutMs !== void 0 && { timeout_ms: handler.timeoutMs }
9453
+ } : handler
9423
9454
  }));
9424
9455
  /** `proxy_execute` as sent on create and update: a boolean becomes `{ enable }`. */
9425
9456
  const transformToolRouterProxyExecuteParams = (config) => typeof config === "boolean" ? { enable: config } : config;
@@ -10163,12 +10194,14 @@ var ToolRouterSessionFilesMount = class {
10163
10194
  * @example
10164
10195
  * ```typescript
10165
10196
  * // From native File (e.g. from input[type=file])
10166
- * await session.experimental.files.upload(fileInput.files[0]);
10197
+ * const file = new File(['hello world'], 'hello.txt', { type: 'text/plain' });
10198
+ * await session.experimental.files.upload(file);
10167
10199
  * ```
10168
10200
  *
10169
10201
  * @example
10170
10202
  * ```typescript
10171
10203
  * // From raw buffer
10204
+ * const buffer = new TextEncoder().encode(JSON.stringify({ hello: 'world' }));
10172
10205
  * await session.experimental.files.upload(buffer, { remotePath: 'data.json', mimetype: 'application/json' });
10173
10206
  * ```
10174
10207
  */
@@ -10753,7 +10786,7 @@ var ToolRouterSession = class {
10753
10786
  *
10754
10787
  * @example
10755
10788
  * ```typescript
10756
- * const session = await composio.sessions.create({ toolkits: ['github'] });
10789
+ * const session = await composio.sessions.create('user_123', { toolkits: ['github'] });
10757
10790
  * const { wasConnected, connectedAccount } = await session.ensureConnected('github');
10758
10791
  * if (!wasConnected) console.log('Newly linked:', connectedAccount?.id);
10759
10792
  * ```
@@ -11076,7 +11109,7 @@ var ToolRouterSession = class {
11076
11109
  };
11077
11110
  const obj = item;
11078
11111
  return {
11079
- tool_slug: String(obj.tool_slug ?? ""),
11112
+ tool_slug: typeof obj.tool_slug === "string" ? obj.tool_slug : "",
11080
11113
  arguments: obj.arguments ?? {}
11081
11114
  };
11082
11115
  }
@@ -11179,6 +11212,240 @@ var ToolRouterSession = class {
11179
11212
  }
11180
11213
  };
11181
11214
 
11215
+ // src/types/sessionWebhooks.types.ts
11216
+ const SessionWebhookEventTypes = {
11217
+ BEFORE_EXECUTE: "composio.session_hook.before_execute",
11218
+ AFTER_EXECUTE: "composio.session_hook.after_execute"
11219
+ };
11220
+ const SessionWebhookMetadataSchema = z$1.object({
11221
+ /** ID of the project */
11222
+ project_id: z$1.string(),
11223
+ /** ID of the session the call was made in */
11224
+ session_id: z$1.string(),
11225
+ /** ID of the user the session belongs to */
11226
+ user_id: z$1.string(),
11227
+ /** ID of the hook that sent this event, as set on the session */
11228
+ hook_id: z$1.string(),
11229
+ /**
11230
+ * ID of the call. The `before_execute` and `after_execute` events for one
11231
+ * call carry the same ID. Omitted by an API version that predates it.
11232
+ */
11233
+ tool_call_id: z$1.string().optional()
11234
+ }).passthrough();
11235
+ const SessionWebhookToolCallSchema = z$1.object({
11236
+ /** Slug of the toolkit (for example `gmail`) */
11237
+ toolkit_slug: z$1.string(),
11238
+ /** Slug of the tool (for example `GMAIL_SEND_EMAIL`) */
11239
+ tool_slug: z$1.string(),
11240
+ /** Version of the toolkit the tool runs from */
11241
+ toolkit_version: z$1.string(),
11242
+ /** ID of the connected account the call uses. Omitted when the call doesn't use one. */
11243
+ connected_account_id: z$1.string().optional(),
11244
+ /** The arguments the tool is called with */
11245
+ arguments: z$1.record(z$1.unknown())
11246
+ }).passthrough();
11247
+ const SessionWebhookToolResponseSchema = z$1.object({
11248
+ /** The data the tool returned */
11249
+ data: z$1.record(z$1.unknown()),
11250
+ /** Error message when the tool failed, otherwise null */
11251
+ error: z$1.string().nullable()
11252
+ }).passthrough();
11253
+ const SessionWebhookHttpMethodSchema = z$1.enum([
11254
+ "GET",
11255
+ "POST",
11256
+ "PUT",
11257
+ "DELETE",
11258
+ "PATCH",
11259
+ "HEAD"
11260
+ ]);
11261
+ const SessionWebhookHttpParameterSchema = z$1.object({
11262
+ /** Header or query parameter name */
11263
+ name: z$1.string(),
11264
+ /** Header or query parameter value */
11265
+ value: z$1.string(),
11266
+ /** Whether the parameter is a header or a query parameter */
11267
+ type: z$1.enum(["header", "query"])
11268
+ }).passthrough();
11269
+ const BinaryBodyUrlSchema = z$1.object({
11270
+ url: z$1.string(),
11271
+ content_type: z$1.string().optional(),
11272
+ base64: z$1.never().optional()
11273
+ });
11274
+ const BinaryBodyBase64Schema = z$1.object({
11275
+ base64: z$1.string(),
11276
+ content_type: z$1.string().optional(),
11277
+ url: z$1.never().optional()
11278
+ });
11279
+ const BinaryBodySchema = z$1.union([BinaryBodyUrlSchema.passthrough(), BinaryBodyBase64Schema.passthrough()]);
11280
+ const SessionWebhookHttpRequestSchema = z$1.object({
11281
+ /** Slug of the toolkit whose API is called (for example `github`) */
11282
+ toolkit_slug: z$1.string(),
11283
+ /** ID of the connected account the call uses. Omitted when the call doesn't use one. */
11284
+ connected_account_id: z$1.string().optional(),
11285
+ method: SessionWebhookHttpMethodSchema,
11286
+ /** The endpoint as the agent gave it: a path relative to the toolkit's API base URL, or a full URL */
11287
+ endpoint: z$1.string(),
11288
+ /** Headers and query parameters the agent added. The credentials Composio adds are not included. */
11289
+ parameters: z$1.array(SessionWebhookHttpParameterSchema),
11290
+ /** The request body. Omitted when there is none or the request uploads a file. */
11291
+ body: z$1.unknown().optional(),
11292
+ /** The file the request uploads, as a URL or base64-encoded bytes. */
11293
+ binary_body: BinaryBodySchema.optional()
11294
+ }).passthrough();
11295
+ const SessionWebhookHttpResponseSchema = z$1.object({
11296
+ /** HTTP status the app's API returned */
11297
+ status: z$1.number(),
11298
+ /** Headers the app's API returned. Credential values Composio added are redacted. */
11299
+ headers: z$1.record(z$1.string()),
11300
+ /** Response body the app's API returned. Omitted when it is binary. */
11301
+ data: z$1.unknown().optional(),
11302
+ /** The file the API returned, as a temporary download link. Present when the response is binary. */
11303
+ binary_data: z$1.object({
11304
+ url: z$1.string(),
11305
+ content_type: z$1.string(),
11306
+ size: z$1.number(),
11307
+ expires_at: z$1.string().optional()
11308
+ }).passthrough().optional()
11309
+ }).passthrough();
11310
+ const sessionWebhookEnvelopeFields = {
11311
+ /** Unique event ID (`msg_<uuid>`). Also sent as the `webhook-id` header. */
11312
+ id: z$1.string(),
11313
+ /** ISO-8601 timestamp of when the event was created */
11314
+ timestamp: z$1.string(),
11315
+ metadata: SessionWebhookMetadataSchema
11316
+ };
11317
+ /**
11318
+ * Sent before a call runs. `data.type` says whether it is a tool call
11319
+ * (`tool_call`) or a proxy call (`http_request`).
11320
+ */
11321
+ const SessionWebhookBeforeExecuteEventSchema = z$1.object({
11322
+ ...sessionWebhookEnvelopeFields,
11323
+ type: z$1.literal(SessionWebhookEventTypes.BEFORE_EXECUTE),
11324
+ data: z$1.discriminatedUnion("type", [z$1.object({
11325
+ type: z$1.literal("tool_execute"),
11326
+ tool_call: SessionWebhookToolCallSchema
11327
+ }).passthrough(), z$1.object({
11328
+ type: z$1.literal("proxy_execute"),
11329
+ http_request: SessionWebhookHttpRequestSchema
11330
+ }).passthrough()])
11331
+ }).passthrough();
11332
+ /**
11333
+ * Sent after a call ran, with what it returned: `tool_response` for a tool
11334
+ * call, `http_response` for a proxy call.
11335
+ */
11336
+ const SessionWebhookAfterExecuteEventSchema = z$1.object({
11337
+ ...sessionWebhookEnvelopeFields,
11338
+ type: z$1.literal(SessionWebhookEventTypes.AFTER_EXECUTE),
11339
+ data: z$1.discriminatedUnion("type", [z$1.object({
11340
+ type: z$1.literal("tool_execute"),
11341
+ tool_call: SessionWebhookToolCallSchema,
11342
+ tool_response: SessionWebhookToolResponseSchema
11343
+ }).passthrough(), z$1.object({
11344
+ type: z$1.literal("proxy_execute"),
11345
+ http_request: SessionWebhookHttpRequestSchema,
11346
+ http_response: SessionWebhookHttpResponseSchema
11347
+ }).passthrough()])
11348
+ }).passthrough();
11349
+ /**
11350
+ * An event Composio sends to the session webhook URL, as returned by
11351
+ * `composio.sessions.webhooks.parse()`.
11352
+ */
11353
+ const SessionWebhookEventSchema = z$1.discriminatedUnion("type", [SessionWebhookBeforeExecuteEventSchema, SessionWebhookAfterExecuteEventSchema]);
11354
+
11355
+ // src/models/SessionWebhooks.ts
11356
+ /**
11357
+ * @fileoverview The `composio.sessions.webhooks` namespace: reading the events
11358
+ * Composio sends to a project's session webhook URL.
11359
+ *
11360
+ * @module SessionWebhooks
11361
+ */
11362
+ const DEFAULT_TOLERANCE_SECONDS = 300;
11363
+ /**
11364
+ * `composio.sessions.webhooks` — for the endpoint at a project's session
11365
+ * webhook URL, which answers session hooks that have a `webhook` handler.
11366
+ */
11367
+ var SessionWebhooks = class {
11368
+ constructor() {
11369
+ telemetry.instrument(this, "SessionWebhooks");
11370
+ }
11371
+ /**
11372
+ * Verify and parse an event Composio sent to the session webhook URL.
11373
+ *
11374
+ * Composio sends one before or after each tool or proxy call that a hook
11375
+ * with a `webhook` handler applies to, and waits for the endpoint's answer.
11376
+ * The signature is always verified, with the project's session webhook
11377
+ * secret. The event is returned as Composio sent it, with the field names of
11378
+ * the webhook reference.
11379
+ *
11380
+ * Pass the raw, unparsed request body: the signature covers its exact bytes.
11381
+ *
11382
+ * @param {ParseSessionWebhookParams} params - The request and how to verify it
11383
+ * @param {string | Uint8Array} params.body - The raw request body
11384
+ * @param {Headers | Record<string, string | string[] | undefined>} params.headers - The request headers
11385
+ * @param {string} params.verifySecret - The project's session webhook secret
11386
+ * @param {number} [params.tolerance=300] - Max event age in seconds. Set to 0 to disable the check.
11387
+ * @returns {Promise<SessionWebhookEvent>} The verified event
11388
+ *
11389
+ * @throws {ValidationError} If `verifySecret` is empty or the signature headers are missing
11390
+ * @throws {ComposioWebhookSignatureVerificationError} If signature verification fails
11391
+ * @throws {ComposioWebhookPayloadError} If the body is not a session webhook event
11392
+ *
11393
+ * @example
11394
+ * ```ts
11395
+ * // Next.js App Router, at the project's session webhook URL
11396
+ * export async function POST(request: Request) {
11397
+ * const hook = await composio.sessions.webhooks.parse({
11398
+ * body: await request.text(),
11399
+ * headers: request.headers,
11400
+ * verifySecret: process.env.COMPOSIO_SESSION_WEBHOOK_SECRET!,
11401
+ * });
11402
+ *
11403
+ * // Keep a confidential project out of every call and every result
11404
+ * if (JSON.stringify(hook.data).includes('Project Titan')) {
11405
+ * return Response.json({ action: 'block', message: 'Project Titan is confidential' });
11406
+ * }
11407
+ * return Response.json({ action: 'continue' });
11408
+ * }
11409
+ * ```
11410
+ */
11411
+ async parse(params) {
11412
+ const { body: rawBody, headers, verifySecret: secret } = params;
11413
+ 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.");
11414
+ const id = getHeader(headers, WEBHOOK_HEADERS.id);
11415
+ const timestamp = getHeader(headers, WEBHOOK_HEADERS.timestamp);
11416
+ const signature = getHeader(headers, WEBHOOK_HEADERS.signature);
11417
+ if (!id || !timestamp || !signature) {
11418
+ const missing = [
11419
+ !id ? `'${WEBHOOK_HEADERS.id}'` : void 0,
11420
+ !timestamp ? `'${WEBHOOK_HEADERS.timestamp}'` : void 0,
11421
+ !signature ? `'${WEBHOOK_HEADERS.signature}'` : void 0
11422
+ ].filter((header) => header !== void 0);
11423
+ 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().`);
11424
+ }
11425
+ const tolerance = params.tolerance ?? DEFAULT_TOLERANCE_SECONDS;
11426
+ if (tolerance > 0) validateWebhookTimestamp(timestamp, tolerance);
11427
+ const body = typeof rawBody === "string" ? rawBody : new Uint8Array(rawBody);
11428
+ await verifyWebhookSignature(id, timestamp, body, signature, secret);
11429
+ let json;
11430
+ try {
11431
+ const text = typeof body === "string" ? body : new TextDecoder("utf-8", {
11432
+ fatal: true,
11433
+ ignoreBOM: true
11434
+ }).decode(body);
11435
+ json = JSON.parse(text);
11436
+ } catch {
11437
+ throw new ComposioWebhookPayloadError("Failed to parse session webhook payload as JSON");
11438
+ }
11439
+ const event = SessionWebhookEventSchema.safeParse(json);
11440
+ if (!event.success) {
11441
+ const fields = [...new Set(event.error.issues.map((issue) => issue.path.join(".")))].sort();
11442
+ const isAnotherPayload = fields.includes("") || fields.includes("type");
11443
+ 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(", ")}`);
11444
+ }
11445
+ return event.data;
11446
+ }
11447
+ };
11448
+
11182
11449
  // src/models/ToolRouter.ts
11183
11450
  function getSessionMetadata(session) {
11184
11451
  return {
@@ -11206,9 +11473,15 @@ function prepareInlineCustomTools(options) {
11206
11473
  var ToolRouter = class {
11207
11474
  client;
11208
11475
  config;
11476
+ /**
11477
+ * Read the events Composio sends to the project's session webhook URL, for
11478
+ * session hooks with a `webhook` handler.
11479
+ */
11480
+ webhooks;
11209
11481
  constructor(client, config) {
11210
11482
  this.client = client;
11211
11483
  this.config = config;
11484
+ this.webhooks = new SessionWebhooks();
11212
11485
  telemetry.instrument(this, "ToolRouter");
11213
11486
  }
11214
11487
  /**
@@ -11739,19 +12012,31 @@ var Composio = class Composio {
11739
12012
  *
11740
12013
  * @example
11741
12014
  * ```typescript
12015
+ * import { Composio } from '@composio/core';
12016
+ *
11742
12017
  * // Initialize with default configuration
11743
12018
  * const composio = new Composio();
12019
+ * ```
12020
+ *
12021
+ * @example
12022
+ * ```typescript
12023
+ * import { Composio } from '@composio/core';
11744
12024
  *
11745
12025
  * // Initialize with custom API key and base URL
11746
12026
  * const composio = new Composio({
11747
12027
  * apiKey: 'your-api-key',
11748
12028
  * baseURL: 'https://api.composio.dev'
11749
12029
  * });
12030
+ * ```
11750
12031
  *
11751
- * // Initialize with custom provider
12032
+ * @example
12033
+ * ```typescript
12034
+ * import { Composio, OpenAIProvider } from '@composio/core';
12035
+ *
12036
+ * // Initialize with an explicit provider
11752
12037
  * const composio = new Composio({
11753
12038
  * apiKey: 'your-api-key',
11754
- * provider: new CustomProvider()
12039
+ * provider: new OpenAIProvider()
11755
12040
  * });
11756
12041
  * ```
11757
12042
  */
@@ -11907,6 +12192,8 @@ var Composio = class Composio {
11907
12192
  *
11908
12193
  * @example
11909
12194
  * ```typescript
12195
+ * import { Composio } from '@composio/core';
12196
+ *
11910
12197
  * // Create a base Composio instance
11911
12198
  * const composio = new Composio({
11912
12199
  * apiKey: 'your-api-key'
@@ -11922,7 +12209,7 @@ var Composio = class Composio {
11922
12209
  * });
11923
12210
  *
11924
12211
  * // Use the session for making API calls with the custom headers
11925
- * await composioWithCustomHeaders.tools.list();
12212
+ * await composioWithCustomHeaders.tools.getRawComposioTools({ toolkits: ['github'] });
11926
12213
  * ```
11927
12214
  */
11928
12215
  createSession(options) {
@@ -11941,14 +12228,20 @@ var Composio = class Composio {
11941
12228
  * @returns {Promise<void>} A promise that resolves when all pending telemetry has been sent.
11942
12229
  *
11943
12230
  * @example
11944
- * ```typescript
12231
+ * ```typescript nocheck="Cloudflare Worker handler; the checker has no Workers Env or ExecutionContext types"
12232
+ * import { Composio } from '@composio/core';
12233
+ *
11945
12234
  * // In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
11946
12235
  * export default {
11947
12236
  * async fetch(request: Request, env: Env, ctx: ExecutionContext) {
11948
12237
  * const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
11949
12238
  *
11950
12239
  * // Do your work...
11951
- * const result = await composio.tools.execute(...);
12240
+ * const result = await composio.tools.execute('GITHUB_GET_REPOS', {
12241
+ * userId: 'user_123',
12242
+ * version: '20250909_00',
12243
+ * arguments: { owner: 'composio' },
12244
+ * });
11952
12245
  *
11953
12246
  * // Ensure telemetry flushes before worker terminates
11954
12247
  * ctx.waitUntil(composio.flush());
@@ -12754,4 +13047,4 @@ const ComposioMcpUpdateResponseSchema = z$1.object({
12754
13047
  tools: z$1.array(z$1.string()).optional()
12755
13048
  });
12756
13049
 
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 };
13050
+ 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, 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 };