@composio/core 0.30.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.
- package/dist/{CustomTool-9Vlb4XaS.mjs → CustomTool-B4dQn2M5.mjs} +1 -1
- package/dist/{CustomTool-Dzk3iqfP.d.mts → CustomTool-CBx9kzea.d.mts} +1 -1
- package/dist/{FileModifierErrors-WrqokuIF.mjs → FileModifierErrors-D-AKc3ds.mjs} +1 -1
- package/dist/{SsrfErrors-BSVMW915.mjs → SsrfErrors-BekZPeWY.mjs} +59 -12
- package/dist/{Telemetry-a7SOQXcg.mjs → Telemetry-BWKZmDxM.mjs} +2 -2
- package/dist/composio-CPf6NHnB.d.mts +20334 -0
- package/dist/{customTool.types-CpJbzxT6.d.mts → customTool.types-BSbIG1OG.d.mts} +306 -83
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +28 -11
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +28 -10
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +44 -32
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +8 -6
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +4 -3
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +4 -2
- package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +6 -3
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +54 -43
- package/dist/docs/reference/sdk-reference/typescript/meta.json +1 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +5 -14
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +7 -5
- package/dist/docs/reference/sdk-reference/typescript/session-webhooks.mdx +64 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +16 -16
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +36 -8
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +14 -11
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +18 -20
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +42 -30
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +6 -4
- package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +9 -7
- package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +13 -9
- package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +3 -1
- package/dist/{errors-xC13uvaA.mjs → errors-CtIKA9BH.mjs} +2 -2
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-CAwIbWYH.mjs → fileUtils.node-BJUYMEph.mjs} +7 -7
- package/dist/index.d.mts +10 -15
- package/dist/index.mjs +582 -242
- package/dist/{jsonSchema-Cc4EtHRw.mjs → jsonSchema-BZoXGUCr.mjs} +2 -2
- package/dist/models/Files.node.mjs +3 -3
- package/dist/{sensitiveFileUploadPaths-CSyJ3Ku8.mjs → sensitiveFileUploadPaths-CcbMAYCC.mjs} +21 -15
- package/dist/{ssrfGuard.node-CdIkwqVu.mjs → ssrfGuard.node-B749ae5Q.mjs} +1 -1
- package/dist/{types-DQdUb7OG.d.mts → types-ns3Q_WrP.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.mjs +1 -1
- package/package.json +4 -4
- package/src/composio.ts +26 -7
- package/src/errors/ComposioError.ts +3 -2
- package/src/index.ts +19 -0
- package/src/lib/toolRouterParams.ts +38 -14
- package/src/models/AuthConfigs.ts +18 -2
- package/src/models/ConnectedAccounts.ts +30 -17
- package/src/models/CustomTool.ts +0 -10
- package/src/models/Keyring.ts +2 -1
- package/src/models/MCP.ts +44 -36
- package/src/models/SessionWebhooks.ts +136 -0
- package/src/models/ToolRouter.ts +39 -4
- package/src/models/ToolRouterSession.ts +2 -2
- package/src/models/ToolRouterSessionFileMount.ts +3 -1
- package/src/models/Toolkits.ts +1 -0
- package/src/models/Tools.ts +6 -10
- package/src/models/Triggers.ts +48 -213
- package/src/models/Webhooks.ts +2 -0
- package/src/provider/ComposioProvider.ts +0 -1
- package/src/telemetry/BatchProcessor.ts +1 -1
- package/src/telemetry/Telemetry.ts +1 -1
- package/src/types/authConfigs.types.ts +14 -0
- package/src/types/connectedAccountAuthStates.types.ts +0 -1
- package/src/types/provider.types.ts +0 -1
- package/src/types/sessionWebhooks.types.ts +292 -0
- package/src/types/tool.types.ts +1 -1
- package/src/types/toolRouter.types.ts +33 -4
- package/src/types/toolkit.types.ts +21 -0
- package/src/types/triggers.types.ts +4 -0
- package/src/utils/crypto.ts +6 -5
- package/src/utils/env.ts +2 -5
- package/src/utils/fileUtils.node.ts +4 -3
- package/src/utils/logger.ts +19 -9
- package/src/utils/pusher.ts +5 -2
- package/src/utils/readResponseBody.ts +30 -17
- package/src/utils/transformers/authConfigs.ts +6 -3
- package/src/utils/transformers/toolkits.ts +7 -0
- package/src/utils/userCallback.ts +3 -1
- package/src/utils/webhookVerification.ts +211 -0
- package/dist/composio-DaokW5sV.d.mts +0 -9593
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { _ as
|
|
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-
|
|
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-
|
|
4
|
-
import { t as telemetry } from "./Telemetry-
|
|
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
|
|
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-
|
|
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-
|
|
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";
|
|
@@ -85,17 +85,29 @@ const CreateComposioManagedAuthConfigParamsSchema = z$1.object({
|
|
|
85
85
|
user_scopes: z$1.union([z$1.string(), z$1.array(z$1.string())]).optional()
|
|
86
86
|
}).passthrough().optional(),
|
|
87
87
|
toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
|
|
88
|
-
isEnabledForToolRouter: z$1.boolean().optional()
|
|
88
|
+
isEnabledForToolRouter: z$1.boolean().optional(),
|
|
89
|
+
/**
|
|
90
|
+
* The Composio-managed app to use, as `composioManagedAuth[].managedAppId`
|
|
91
|
+
* from `composio.toolkits.get(slug)`. Omit to use the toolkit's default app.
|
|
92
|
+
*/
|
|
93
|
+
managedAppId: z$1.string().optional()
|
|
89
94
|
});
|
|
90
95
|
/**
|
|
91
96
|
* Discriminated union of all possible auth config types.
|
|
92
97
|
*/
|
|
93
98
|
const CreateAuthConfigParamsSchema = z$1.discriminatedUnion("type", [CreateCustomAuthConfigParamsSchema, CreateComposioManagedAuthConfigParamsSchema]);
|
|
99
|
+
/**
|
|
100
|
+
* The Composio-managed app an auth config uses, as
|
|
101
|
+
* `composioManagedAuth[].managedAppId` from `composio.toolkits.get(slug)`.
|
|
102
|
+
* `null` when the auth config is not linked to a managed app.
|
|
103
|
+
*/
|
|
104
|
+
const AuthConfigManagedAppIdSchema = z$1.string().nullable();
|
|
94
105
|
const CreateAuthConfigResponseSchema = z$1.object({
|
|
95
106
|
id: z$1.string(),
|
|
96
107
|
authScheme: z$1.string(),
|
|
97
108
|
isComposioManaged: z$1.boolean(),
|
|
98
|
-
toolkit: z$1.string()
|
|
109
|
+
toolkit: z$1.string(),
|
|
110
|
+
managedAppId: AuthConfigManagedAppIdSchema
|
|
99
111
|
});
|
|
100
112
|
const AuthConfigRetrieveResponseSchema = z$1.object({
|
|
101
113
|
id: z$1.string(),
|
|
@@ -118,7 +130,8 @@ const AuthConfigRetrieveResponseSchema = z$1.object({
|
|
|
118
130
|
createdBy: z$1.string().optional(),
|
|
119
131
|
createdAt: z$1.string().optional(),
|
|
120
132
|
lastUpdatedAt: z$1.string().optional(),
|
|
121
|
-
toolAccessConfig: AuthConfigToolAccessConfigSchema.optional()
|
|
133
|
+
toolAccessConfig: AuthConfigToolAccessConfigSchema.optional(),
|
|
134
|
+
managedAppId: AuthConfigManagedAppIdSchema
|
|
122
135
|
});
|
|
123
136
|
const AuthConfigListParamsSchema = z$1.object({
|
|
124
137
|
cursor: z$1.string().optional(),
|
|
@@ -626,7 +639,6 @@ const SamlConnectionDataSchema = z$1.discriminatedUnion("status", [
|
|
|
626
639
|
expired_at: z$1.string().optional()
|
|
627
640
|
}).catchall(z$1.unknown())
|
|
628
641
|
]);
|
|
629
|
-
BaseSchemeRaw.catchall(z$1.unknown());
|
|
630
642
|
const DcrOauthInitiatingSchema = BaseSchemeRaw.extend({ status: z$1.literal(ConnectionStatuses.INITIALIZING) }).catchall(z$1.unknown());
|
|
631
643
|
const DcrOauthConnectionDataSchema = z$1.discriminatedUnion("status", [
|
|
632
644
|
DcrOauthInitiatingSchema,
|
|
@@ -1554,7 +1566,7 @@ var Tools = class {
|
|
|
1554
1566
|
* bare TypeError from deep inside Zod.
|
|
1555
1567
|
*/
|
|
1556
1568
|
warnMalformedToolParameters(tool, error, droppedSides) {
|
|
1557
|
-
const slug =
|
|
1569
|
+
const slug = typeof tool.slug === "string" ? tool.slug : "";
|
|
1558
1570
|
if (slug && this.warnedMalformedToolParametersSlugs.has(slug)) return;
|
|
1559
1571
|
if (slug) this.warnedMalformedToolParametersSlugs.add(slug);
|
|
1560
1572
|
const inputFailed = droppedSides.includes("inputParameters");
|
|
@@ -1713,12 +1725,6 @@ var Tools = class {
|
|
|
1713
1725
|
* tools: ['GITHUB_GET_REPOS', 'HACKERNEWS_GET_USER']
|
|
1714
1726
|
* });
|
|
1715
1727
|
*
|
|
1716
|
-
* // Get tools from specific toolkits
|
|
1717
|
-
* const githubTools = await composio.tools.getRawComposioTools({
|
|
1718
|
-
* toolkits: ['github'],
|
|
1719
|
-
* limit: 10
|
|
1720
|
-
* });
|
|
1721
|
-
*
|
|
1722
1728
|
* // Get tools with schema transformation
|
|
1723
1729
|
* const customizedTools = await composio.tools.getRawComposioTools({
|
|
1724
1730
|
* toolkits: ['github'],
|
|
@@ -1864,7 +1870,7 @@ var Tools = class {
|
|
|
1864
1870
|
* );
|
|
1865
1871
|
*
|
|
1866
1872
|
* // Access tool properties
|
|
1867
|
-
* const githubTool = await composio.tools.getRawComposioToolBySlug('
|
|
1873
|
+
* const githubTool = await composio.tools.getRawComposioToolBySlug('GITHUB_CREATE_AN_ISSUE');
|
|
1868
1874
|
* console.log({
|
|
1869
1875
|
* slug: githubTool.slug,
|
|
1870
1876
|
* name: githubTool.name,
|
|
@@ -2126,6 +2132,8 @@ var Tools = class {
|
|
|
2126
2132
|
*
|
|
2127
2133
|
* @example Execute with SDK-level toolkit versions configuration
|
|
2128
2134
|
* ```typescript
|
|
2135
|
+
* import { Composio } from '@composio/core';
|
|
2136
|
+
*
|
|
2129
2137
|
* // If toolkitVersions are set during Composio initialization, no need to pass version
|
|
2130
2138
|
* const composio = new Composio({ toolkitVersions: { github: '20250909_00' } });
|
|
2131
2139
|
* const result = await composio.tools.execute('GITHUB_GET_REPOS', {
|
|
@@ -2248,7 +2256,7 @@ var Tools = class {
|
|
|
2248
2256
|
* ```typescript
|
|
2249
2257
|
* // Get all available tools as an enum
|
|
2250
2258
|
* const toolsEnum = await composio.tools.getToolsEnum();
|
|
2251
|
-
* console.log(toolsEnum
|
|
2259
|
+
* console.log(toolsEnum); // ['GITHUB_GET_REPOS', ...]
|
|
2252
2260
|
* ```
|
|
2253
2261
|
*/
|
|
2254
2262
|
async getToolsEnum(requestOptions) {
|
|
@@ -2270,7 +2278,7 @@ var Tools = class {
|
|
|
2270
2278
|
*
|
|
2271
2279
|
* @example
|
|
2272
2280
|
* ```typescript
|
|
2273
|
-
* const { arguments: args, error } = await composio.tools.getInput('
|
|
2281
|
+
* const { arguments: args, error } = await composio.tools.getInput('GITHUB_CREATE_AN_ISSUE', {
|
|
2274
2282
|
* text: 'Open an issue in composiohq/composio titled "Docs typo" describing the broken link',
|
|
2275
2283
|
* version: '20250909_00',
|
|
2276
2284
|
* });
|
|
@@ -2450,12 +2458,28 @@ const ToolkitAuthConfigDetailsSchema = z$1.object({
|
|
|
2450
2458
|
}),
|
|
2451
2459
|
proxy: z$1.object({ baseUrl: z$1.string().optional() }).optional()
|
|
2452
2460
|
});
|
|
2461
|
+
const ToolkitManagedAuthScopesSchema = z$1.object({ available: z$1.array(z$1.string()) });
|
|
2462
|
+
/**
|
|
2463
|
+
* A Composio-managed app for a toolkit. Pass `managedAppId` to
|
|
2464
|
+
* `composio.authConfigs.create` to create an auth config on this app.
|
|
2465
|
+
*/
|
|
2466
|
+
const ToolkitComposioManagedAuthSchema = z$1.object({
|
|
2467
|
+
managedAppId: z$1.string(),
|
|
2468
|
+
/** Whether this is the app used when `managedAppId` is omitted. */
|
|
2469
|
+
isDefault: z$1.boolean(),
|
|
2470
|
+
mode: z$1.string(),
|
|
2471
|
+
scopes: ToolkitManagedAuthScopesSchema,
|
|
2472
|
+
/** Present only for Slack. */
|
|
2473
|
+
userScopes: ToolkitManagedAuthScopesSchema.optional()
|
|
2474
|
+
});
|
|
2453
2475
|
const ToolkitRetrieveResponseSchema = z$1.object({
|
|
2454
2476
|
name: z$1.string(),
|
|
2455
2477
|
slug: z$1.string(),
|
|
2456
2478
|
meta: ToolKitMetaSchema,
|
|
2457
2479
|
isLocalToolkit: z$1.boolean(),
|
|
2458
2480
|
composioManagedAuthSchemes: z$1.array(z$1.string()).optional(),
|
|
2481
|
+
/** One entry per Composio-managed app, the default first. */
|
|
2482
|
+
composioManagedAuth: z$1.array(ToolkitComposioManagedAuthSchema).optional(),
|
|
2459
2483
|
authConfigDetails: z$1.array(ToolkitAuthConfigDetailsSchema).optional(),
|
|
2460
2484
|
baseUrl: z$1.string().optional(),
|
|
2461
2485
|
getCurrentUserEndpoint: z$1.string().optional(),
|
|
@@ -2601,7 +2625,7 @@ function transform(raw) {
|
|
|
2601
2625
|
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2602
2626
|
* the data structure to match the SDK's standardized format for auth configurations.
|
|
2603
2627
|
*
|
|
2604
|
-
* @param {
|
|
2628
|
+
* @param {RawAuthConfig} authConfig - The raw retrieve response or list item to transform
|
|
2605
2629
|
* @returns {AuthConfigRetrieveResponse} The transformed auth config data
|
|
2606
2630
|
*
|
|
2607
2631
|
* @private
|
|
@@ -2628,7 +2652,8 @@ function transformAuthConfigRetrieveResponse(authConfig) {
|
|
|
2628
2652
|
toolAccessConfig: authConfig.tool_access_config ? {
|
|
2629
2653
|
toolsAvailableForExecution: authConfig.tool_access_config.tools_available_for_execution,
|
|
2630
2654
|
toolsForConnectedAccountCreation: authConfig.tool_access_config.tools_for_connected_account_creation
|
|
2631
|
-
} : void 0
|
|
2655
|
+
} : void 0,
|
|
2656
|
+
managedAppId: authConfig.managed_app_id
|
|
2632
2657
|
}));
|
|
2633
2658
|
}
|
|
2634
2659
|
/**
|
|
@@ -2665,7 +2690,8 @@ function transformCreateAuthConfigResponse(response) {
|
|
|
2665
2690
|
id: response.auth_config.id,
|
|
2666
2691
|
authScheme: response.auth_config.auth_scheme,
|
|
2667
2692
|
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2668
|
-
toolkit: response.toolkit.slug
|
|
2693
|
+
toolkit: response.toolkit.slug,
|
|
2694
|
+
managedAppId: response.auth_config.managed_app_id
|
|
2669
2695
|
}));
|
|
2670
2696
|
}
|
|
2671
2697
|
|
|
@@ -2734,7 +2760,19 @@ var AuthConfigs = class {
|
|
|
2734
2760
|
* @returns {Promise<CreateAuthConfigResponse>} Created auth config
|
|
2735
2761
|
*
|
|
2736
2762
|
* @example
|
|
2737
|
-
*
|
|
2763
|
+
* import { AuthConfigTypes } from '@composio/core';
|
|
2764
|
+
*
|
|
2765
|
+
* // Use a specific Composio-managed app; omit managedAppId for the toolkit's default
|
|
2766
|
+
* const { composioManagedAuth } = await composio.toolkits.get('slack');
|
|
2767
|
+
* const slackAuthConfig = await composio.authConfigs.create('slack', {
|
|
2768
|
+
* type: AuthConfigTypes.COMPOSIO_MANAGED,
|
|
2769
|
+
* managedAppId: composioManagedAuth?.find(app => !app.isDefault)?.managedAppId,
|
|
2770
|
+
* });
|
|
2771
|
+
*
|
|
2772
|
+
* @example
|
|
2773
|
+
* import { AuthConfigTypes, AuthSchemeTypes } from '@composio/core';
|
|
2774
|
+
*
|
|
2775
|
+
* const authConfig = await composio.authConfigs.create('my-toolkit', {
|
|
2738
2776
|
* type: AuthConfigTypes.CUSTOM,
|
|
2739
2777
|
* name: 'My Custom Auth Config',
|
|
2740
2778
|
* authScheme: AuthSchemeTypes.API_KEY,
|
|
@@ -2766,7 +2804,8 @@ var AuthConfigs = class {
|
|
|
2766
2804
|
credentials: parsedOptions.data.credentials,
|
|
2767
2805
|
name: parsedOptions.data.name,
|
|
2768
2806
|
is_enabled_for_tool_router: parsedOptions.data.isEnabledForToolRouter,
|
|
2769
|
-
tool_access_config: parsedOptions.data.toolAccessConfig ? { tools_for_connected_account_creation: parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation } : void 0
|
|
2807
|
+
tool_access_config: parsedOptions.data.toolAccessConfig ? { tools_for_connected_account_creation: parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation } : void 0,
|
|
2808
|
+
managed_app_id: parsedOptions.data.managedAppId
|
|
2770
2809
|
}
|
|
2771
2810
|
};
|
|
2772
2811
|
const result = await withCancellation(() => this.client.authConfigs.create(createBody, requestOptions), requestOptions?.signal);
|
|
@@ -2817,11 +2856,14 @@ var AuthConfigs = class {
|
|
|
2817
2856
|
* apiKey: 'new-api-key-value'
|
|
2818
2857
|
* }
|
|
2819
2858
|
* });
|
|
2859
|
+
* ```
|
|
2820
2860
|
*
|
|
2861
|
+
* @example
|
|
2862
|
+
* ```typescript
|
|
2821
2863
|
* // Update a default auth config with new scopes
|
|
2822
2864
|
* const updatedConfig = await composio.authConfigs.update('auth_abc123', {
|
|
2823
2865
|
* type: 'default',
|
|
2824
|
-
* scopes:
|
|
2866
|
+
* scopes: 'read:user,repo'
|
|
2825
2867
|
* });
|
|
2826
2868
|
* ```
|
|
2827
2869
|
*/
|
|
@@ -4239,6 +4281,8 @@ var ConnectedAccounts = class {
|
|
|
4239
4281
|
*
|
|
4240
4282
|
* @example
|
|
4241
4283
|
* ```typescript
|
|
4284
|
+
* import { AuthScheme } from '@composio/core';
|
|
4285
|
+
*
|
|
4242
4286
|
* // For OAuth2 authentication
|
|
4243
4287
|
* const connectionRequest = await composio.connectedAccounts.initiate(
|
|
4244
4288
|
* 'user_123',
|
|
@@ -4251,17 +4295,27 @@ var ConnectedAccounts = class {
|
|
|
4251
4295
|
* })
|
|
4252
4296
|
* }
|
|
4253
4297
|
* );
|
|
4298
|
+
* ```
|
|
4299
|
+
*
|
|
4300
|
+
* @example
|
|
4301
|
+
* ```typescript
|
|
4302
|
+
* import { AuthScheme } from '@composio/core';
|
|
4254
4303
|
*
|
|
4255
4304
|
* // For API Key authentication
|
|
4256
4305
|
* const connectionRequest = await composio.connectedAccounts.initiate(
|
|
4257
4306
|
* 'user_123',
|
|
4258
4307
|
* 'auth_config_123',
|
|
4259
4308
|
* {
|
|
4260
|
-
* config: AuthScheme.
|
|
4309
|
+
* config: AuthScheme.APIKey({
|
|
4261
4310
|
* api_key: 'your_api_key'
|
|
4262
4311
|
* })
|
|
4263
4312
|
* }
|
|
4264
4313
|
* );
|
|
4314
|
+
* ```
|
|
4315
|
+
*
|
|
4316
|
+
* @example
|
|
4317
|
+
* ```typescript
|
|
4318
|
+
* import { AuthScheme } from '@composio/core';
|
|
4265
4319
|
*
|
|
4266
4320
|
* // For Basic authentication
|
|
4267
4321
|
* const connectionRequest = await composio.connectedAccounts.initiate(
|
|
@@ -4397,7 +4451,10 @@ var ConnectedAccounts = class {
|
|
|
4397
4451
|
* ```typescript
|
|
4398
4452
|
* // Wait for a connection to complete with default timeout
|
|
4399
4453
|
* const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc');
|
|
4454
|
+
* ```
|
|
4400
4455
|
*
|
|
4456
|
+
* @example
|
|
4457
|
+
* ```typescript
|
|
4401
4458
|
* // Wait with a custom timeout of 2 minutes
|
|
4402
4459
|
* const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc', 120000);
|
|
4403
4460
|
* ```
|
|
@@ -4533,11 +4590,16 @@ var ConnectedAccounts = class {
|
|
|
4533
4590
|
*
|
|
4534
4591
|
* @example
|
|
4535
4592
|
* ```typescript
|
|
4536
|
-
* //
|
|
4537
|
-
*
|
|
4538
|
-
*
|
|
4539
|
-
* sessionUri
|
|
4540
|
-
* }
|
|
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
|
+
* }
|
|
4541
4603
|
* ```
|
|
4542
4604
|
*/
|
|
4543
4605
|
async completeAuth(params, requestOptions) {
|
|
@@ -4562,10 +4624,9 @@ var ConnectedAccounts = class {
|
|
|
4562
4624
|
* enabled: true
|
|
4563
4625
|
* });
|
|
4564
4626
|
*
|
|
4565
|
-
* // Disable a connected account
|
|
4627
|
+
* // Disable a connected account
|
|
4566
4628
|
* const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
4567
|
-
* enabled: false
|
|
4568
|
-
* reason: 'Token expired'
|
|
4629
|
+
* enabled: false
|
|
4569
4630
|
* });
|
|
4570
4631
|
* ```
|
|
4571
4632
|
*/
|
|
@@ -4581,7 +4642,7 @@ var ConnectedAccounts = class {
|
|
|
4581
4642
|
* ```typescript
|
|
4582
4643
|
* // Enable a previously disabled connected account
|
|
4583
4644
|
* const enabledAccount = await composio.connectedAccounts.enable('conn_abc123');
|
|
4584
|
-
* console.log(enabledAccount.
|
|
4645
|
+
* console.log(enabledAccount.success); // true
|
|
4585
4646
|
* ```
|
|
4586
4647
|
*/
|
|
4587
4648
|
async enable(nanoid, requestOptions) {
|
|
@@ -4596,13 +4657,7 @@ var ConnectedAccounts = class {
|
|
|
4596
4657
|
* ```typescript
|
|
4597
4658
|
* // Disable a connected account
|
|
4598
4659
|
* const disabledAccount = await composio.connectedAccounts.disable('conn_abc123');
|
|
4599
|
-
* console.log(disabledAccount.
|
|
4600
|
-
*
|
|
4601
|
-
* // You can also use updateStatus with a reason
|
|
4602
|
-
* // const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
4603
|
-
* // enabled: false,
|
|
4604
|
-
* // reason: 'No longer needed'
|
|
4605
|
-
* // });
|
|
4660
|
+
* console.log(disabledAccount.success); // true
|
|
4606
4661
|
* ```
|
|
4607
4662
|
*/
|
|
4608
4663
|
async disable(nanoid, requestOptions) {
|
|
@@ -4738,6 +4793,13 @@ const transformToolkitRetrieveResponse = (response) => {
|
|
|
4738
4793
|
},
|
|
4739
4794
|
isLocalToolkit: response.is_local_toolkit,
|
|
4740
4795
|
composioManagedAuthSchemes: response.composio_managed_auth_schemes,
|
|
4796
|
+
composioManagedAuth: response.composio_managed_auth?.map((app) => ({
|
|
4797
|
+
managedAppId: app.managed_app_id,
|
|
4798
|
+
isDefault: app.is_default,
|
|
4799
|
+
mode: app.mode,
|
|
4800
|
+
scopes: app.scopes,
|
|
4801
|
+
...app.user_scopes != null && { userScopes: app.user_scopes }
|
|
4802
|
+
})),
|
|
4741
4803
|
authConfigDetails: response.auth_config_details?.map((authConfig) => ({
|
|
4742
4804
|
name: authConfig.name,
|
|
4743
4805
|
mode: authConfig.mode,
|
|
@@ -5087,6 +5149,7 @@ var Toolkits = class {
|
|
|
5087
5149
|
*
|
|
5088
5150
|
* @example
|
|
5089
5151
|
* ```typescript
|
|
5152
|
+
* const userId = 'user_123';
|
|
5090
5153
|
* const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
5091
5154
|
* ```
|
|
5092
5155
|
*
|
|
@@ -5344,7 +5407,9 @@ const VerifyWebhookParamsSchema = z$1.object({
|
|
|
5344
5407
|
* Set to 0 to disable timestamp validation.
|
|
5345
5408
|
* @default 300 (5 minutes)
|
|
5346
5409
|
*/
|
|
5347
|
-
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()
|
|
5348
5413
|
});
|
|
5349
5414
|
|
|
5350
5415
|
// src/types/webhooks.types.ts
|
|
@@ -5590,6 +5655,8 @@ var WebhookSubscriptions = class {
|
|
|
5590
5655
|
*
|
|
5591
5656
|
* @example
|
|
5592
5657
|
* ```typescript
|
|
5658
|
+
* const APP_URL = 'https://your-app.com';
|
|
5659
|
+
*
|
|
5593
5660
|
* const subscription = await composio.webhooks.subscriptions.set({
|
|
5594
5661
|
* webhookUrl: `${APP_URL}/webhooks/composio`,
|
|
5595
5662
|
* enabledEvents: ['composio.trigger.message', 'composio.connected_account.expired'],
|
|
@@ -5849,46 +5916,6 @@ var InternalService = class {
|
|
|
5849
5916
|
}
|
|
5850
5917
|
};
|
|
5851
5918
|
|
|
5852
|
-
// src/utils/userCallback.ts
|
|
5853
|
-
/**
|
|
5854
|
-
* Describes a thrown or rejected value for a log line without ever throwing.
|
|
5855
|
-
*
|
|
5856
|
-
* The logger serializes object arguments with `JSON.stringify`, which turns an `Error` into `{}`
|
|
5857
|
-
* and throws on a circular value, so callers log this string instead of the raw value.
|
|
5858
|
-
* `JSON.stringify` and `String()` can both throw (a circular value, an object without a
|
|
5859
|
-
* prototype), so each is tried in turn.
|
|
5860
|
-
*/
|
|
5861
|
-
function describeThrown(value) {
|
|
5862
|
-
try {
|
|
5863
|
-
if (value instanceof Error) return value.message;
|
|
5864
|
-
if (typeof value === "object" && value !== null) return JSON.stringify(value) ?? String(value);
|
|
5865
|
-
return String(value);
|
|
5866
|
-
} catch {
|
|
5867
|
-
try {
|
|
5868
|
-
return String(value);
|
|
5869
|
-
} catch {
|
|
5870
|
-
return "[unprintable value]";
|
|
5871
|
-
}
|
|
5872
|
-
}
|
|
5873
|
-
}
|
|
5874
|
-
/**
|
|
5875
|
-
* Calls a user-supplied event callback so that neither a synchronous throw nor a rejected promise
|
|
5876
|
-
* escapes into the event emitter that invoked it. Failures are logged after `label`.
|
|
5877
|
-
*
|
|
5878
|
-
* pusher-js does not catch listener exceptions, and nothing awaits the promise an `async`
|
|
5879
|
-
* listener returns, so an escaped failure would end a Node process.
|
|
5880
|
-
*/
|
|
5881
|
-
function invokeUserCallback(label, callback) {
|
|
5882
|
-
const logFailure = (error) => {
|
|
5883
|
-
logger.error(label, describeThrown(error));
|
|
5884
|
-
};
|
|
5885
|
-
try {
|
|
5886
|
-
Promise.resolve(callback()).catch(logFailure);
|
|
5887
|
-
} catch (error) {
|
|
5888
|
-
logFailure(error);
|
|
5889
|
-
}
|
|
5890
|
-
}
|
|
5891
|
-
|
|
5892
5919
|
// src/utils/sdk.ts
|
|
5893
5920
|
/**
|
|
5894
5921
|
* Header that carries a Composio user API key (`uak_...`) instead of a project
|
|
@@ -6588,14 +6615,12 @@ function transformTriggerInstanceListActiveResponse(response) {
|
|
|
6588
6615
|
* Computes HMAC-SHA256 using Web Crypto API
|
|
6589
6616
|
*/
|
|
6590
6617
|
async function hmacSha256Base64(secret, message) {
|
|
6591
|
-
const
|
|
6592
|
-
const keyData = encoder.encode(secret);
|
|
6618
|
+
const keyData = new TextEncoder().encode(secret);
|
|
6593
6619
|
const key = await globalThis.crypto.subtle.importKey("raw", keyData, {
|
|
6594
6620
|
name: "HMAC",
|
|
6595
6621
|
hash: "SHA-256"
|
|
6596
6622
|
}, false, ["sign"]);
|
|
6597
|
-
const
|
|
6598
|
-
const signatureBuffer = await globalThis.crypto.subtle.sign("HMAC", key, signatureData);
|
|
6623
|
+
const signatureBuffer = await globalThis.crypto.subtle.sign("HMAC", key, message);
|
|
6599
6624
|
return arrayBufferToBase64(signatureBuffer);
|
|
6600
6625
|
}
|
|
6601
6626
|
/**
|
|
@@ -6608,36 +6633,56 @@ function timingSafeEqual(a, b) {
|
|
|
6608
6633
|
return result === 0;
|
|
6609
6634
|
}
|
|
6610
6635
|
|
|
6611
|
-
// src/
|
|
6612
|
-
|
|
6613
|
-
* Safely converts a value to a string, returning the default if the value is null, undefined, or empty.
|
|
6614
|
-
* This prevents runtime crashes when calling string methods like `.toLowerCase()` on non-string values.
|
|
6615
|
-
* @private
|
|
6616
|
-
*/
|
|
6617
|
-
const toStringOrDefault = (value, defaultValue) => {
|
|
6618
|
-
if (value === null || value === void 0) return defaultValue;
|
|
6619
|
-
const str = String(value);
|
|
6620
|
-
return str.length > 0 ? str : defaultValue;
|
|
6621
|
-
};
|
|
6636
|
+
// src/utils/webhookVerification.ts
|
|
6637
|
+
const DEFAULT_WEBHOOK_BODY_LIMIT_BYTES = 10485760;
|
|
6622
6638
|
/**
|
|
6623
|
-
* The signature header names Composio sends with every webhook
|
|
6624
|
-
* @private
|
|
6639
|
+
* The signature header names Composio sends with every webhook request.
|
|
6625
6640
|
*/
|
|
6626
6641
|
const WEBHOOK_HEADERS = {
|
|
6627
6642
|
id: "webhook-id",
|
|
6628
6643
|
timestamp: "webhook-timestamp",
|
|
6629
6644
|
signature: "webhook-signature"
|
|
6630
6645
|
};
|
|
6646
|
+
const isFetchRequest = (request) => typeof Request !== "undefined" && request instanceof Request;
|
|
6631
6647
|
/**
|
|
6632
|
-
*
|
|
6633
|
-
*
|
|
6648
|
+
* Coerces an already-buffered request body into the string expected by
|
|
6649
|
+
* signature verification.
|
|
6634
6650
|
*/
|
|
6635
|
-
const
|
|
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
|
+
};
|
|
6636
6682
|
/**
|
|
6637
6683
|
* Reads a single header value case-insensitively from either a `Headers`
|
|
6638
6684
|
* instance or a plain record (where values may be `string | string[]`).
|
|
6639
6685
|
* Returns `undefined` when the header is missing.
|
|
6640
|
-
* @private
|
|
6641
6686
|
*/
|
|
6642
6687
|
const getHeader = (headers, name) => {
|
|
6643
6688
|
if (typeof Headers !== "undefined" && headers instanceof Headers) return headers.get(name) ?? void 0;
|
|
@@ -6650,16 +6695,56 @@ const getHeader = (headers, name) => {
|
|
|
6650
6695
|
}
|
|
6651
6696
|
};
|
|
6652
6697
|
/**
|
|
6653
|
-
*
|
|
6654
|
-
*
|
|
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.
|
|
6655
6743
|
* @private
|
|
6656
6744
|
*/
|
|
6657
|
-
const
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
if (body === null || body === void 0) return "";
|
|
6661
|
-
if (typeof body === "object") return JSON.stringify(body);
|
|
6662
|
-
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;
|
|
6663
6748
|
};
|
|
6664
6749
|
/**
|
|
6665
6750
|
* Trigger (Instance) class
|
|
@@ -6689,6 +6774,8 @@ var Triggers = class {
|
|
|
6689
6774
|
*
|
|
6690
6775
|
* @example
|
|
6691
6776
|
* ```ts
|
|
6777
|
+
* const APP_URL = 'https://your-app.com';
|
|
6778
|
+
*
|
|
6692
6779
|
* await composio.triggers.setWebhookSubscription({
|
|
6693
6780
|
* webhookUrl: `${APP_URL}/webhooks/composio`,
|
|
6694
6781
|
* });
|
|
@@ -6708,7 +6795,7 @@ var Triggers = class {
|
|
|
6708
6795
|
*
|
|
6709
6796
|
* @example
|
|
6710
6797
|
* ```ts
|
|
6711
|
-
* const
|
|
6798
|
+
* const activeTriggers = await composio.triggers.listActive({
|
|
6712
6799
|
* authConfigIds: ['123'],
|
|
6713
6800
|
* connectedAccountIds: ['456'],
|
|
6714
6801
|
* });
|
|
@@ -6908,10 +6995,9 @@ var Triggers = class {
|
|
|
6908
6995
|
*
|
|
6909
6996
|
* @example
|
|
6910
6997
|
* ```ts
|
|
6911
|
-
*
|
|
6912
|
-
* triggers.subscribe((data) => {
|
|
6998
|
+
* await composio.triggers.subscribe((data) => {
|
|
6913
6999
|
* console.log(data);
|
|
6914
|
-
* }
|
|
7000
|
+
* });
|
|
6915
7001
|
* ```
|
|
6916
7002
|
*/
|
|
6917
7003
|
async subscribe(fn, filters = {}, onSubscriptionError) {
|
|
@@ -7017,11 +7103,11 @@ var Triggers = class {
|
|
|
7017
7103
|
*
|
|
7018
7104
|
* @example
|
|
7019
7105
|
* ```ts
|
|
7020
|
-
* composio.
|
|
7106
|
+
* await composio.triggers.subscribe((data) => {
|
|
7021
7107
|
* console.log(data);
|
|
7022
7108
|
* });
|
|
7023
7109
|
*
|
|
7024
|
-
* await triggers.unsubscribe();
|
|
7110
|
+
* await composio.triggers.unsubscribe();
|
|
7025
7111
|
* ```
|
|
7026
7112
|
*/
|
|
7027
7113
|
async unsubscribe() {
|
|
@@ -7040,18 +7126,22 @@ var Triggers = class {
|
|
|
7040
7126
|
* Next.js Pages Router `req`). The signature headers (`webhook-id`,
|
|
7041
7127
|
* `webhook-timestamp`, `webhook-signature`) are read case-insensitively.
|
|
7042
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
|
+
*
|
|
7043
7132
|
* @param {WebhookRequestLike} request - The incoming webhook HTTP request
|
|
7044
7133
|
* @param {ParseWebhookOptions} [options] - Parse options
|
|
7045
7134
|
* @param {string} [options.verifySecret] - Webhook secret; when set, the signature is verified
|
|
7046
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)
|
|
7047
7137
|
* @returns {Promise<VerifyWebhookResult>} The parsed (and optionally verified) webhook payload
|
|
7048
7138
|
*
|
|
7049
7139
|
* @throws {ValidationError} If `verifySecret` is set but the signature headers are missing
|
|
7050
7140
|
* @throws {ComposioWebhookSignatureVerificationError} If signature verification fails
|
|
7051
|
-
* @throws {ComposioWebhookPayloadError} If the payload cannot be parsed
|
|
7141
|
+
* @throws {ComposioWebhookPayloadError} If the payload exceeds the limit or cannot be parsed
|
|
7052
7142
|
*
|
|
7053
7143
|
* @example
|
|
7054
|
-
* ```ts
|
|
7144
|
+
* ```ts nocheck="Express route handler; the checker has no express types"
|
|
7055
7145
|
* // Express with express.raw (verify the signature)
|
|
7056
7146
|
* app.post('/webhooks/composio', express.raw({ type: 'application/json' }), async (req, res) => {
|
|
7057
7147
|
* try {
|
|
@@ -7089,7 +7179,10 @@ var Triggers = class {
|
|
|
7089
7179
|
* return new Response('Unauthorized', { status: 401 });
|
|
7090
7180
|
* }
|
|
7091
7181
|
* }
|
|
7182
|
+
* ```
|
|
7092
7183
|
*
|
|
7184
|
+
* @example
|
|
7185
|
+
* ```ts
|
|
7093
7186
|
* // Next.js App Router — parse only (no verification)
|
|
7094
7187
|
* export async function POST(request: Request) {
|
|
7095
7188
|
* const result = await composio.triggers.parse(request);
|
|
@@ -7099,15 +7192,7 @@ var Triggers = class {
|
|
|
7099
7192
|
* ```
|
|
7100
7193
|
*/
|
|
7101
7194
|
async parse(request, options) {
|
|
7102
|
-
|
|
7103
|
-
let headers;
|
|
7104
|
-
if (isFetchRequest(request)) {
|
|
7105
|
-
body = await request.text();
|
|
7106
|
-
headers = request.headers;
|
|
7107
|
-
} else {
|
|
7108
|
-
body = bodyToString(request.body);
|
|
7109
|
-
headers = request.headers;
|
|
7110
|
-
}
|
|
7195
|
+
const { body, headers } = await readWebhookRequest(request, options?.maxBodyBytes);
|
|
7111
7196
|
const verifySecret = options?.verifySecret;
|
|
7112
7197
|
if (options === void 0 || !("verifySecret" in options)) {
|
|
7113
7198
|
const { version, rawPayload, normalizedPayload } = this.parseWebhookPayload(body);
|
|
@@ -7148,6 +7233,9 @@ var Triggers = class {
|
|
|
7148
7233
|
* The signature is computed as: `HMAC-SHA256(${webhookId}.${webhookTimestamp}.${payload}, secret)`
|
|
7149
7234
|
* and is expected in the format: `v1,base64EncodedSignature`
|
|
7150
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
|
+
*
|
|
7151
7239
|
* @param {VerifyWebhookParams} params - The verification parameters
|
|
7152
7240
|
* @param {string} params.payload - The raw webhook payload as a string (request body)
|
|
7153
7241
|
* @param {string} params.signature - The signature from the 'webhook-signature' header
|
|
@@ -7155,6 +7243,7 @@ var Triggers = class {
|
|
|
7155
7243
|
* @param {string} params.webhookId - The webhook ID from the 'webhook-id' header
|
|
7156
7244
|
* @param {string} params.webhookTimestamp - The timestamp from the 'webhook-timestamp' header (Unix seconds)
|
|
7157
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
|
|
7158
7247
|
* @returns {VerifyWebhookResult} The verified and parsed webhook payload with version information
|
|
7159
7248
|
*
|
|
7160
7249
|
* @throws {ValidationError} If the parameters are invalid
|
|
@@ -7163,26 +7252,26 @@ var Triggers = class {
|
|
|
7163
7252
|
*
|
|
7164
7253
|
* @example
|
|
7165
7254
|
* ```ts
|
|
7166
|
-
* // In
|
|
7167
|
-
*
|
|
7255
|
+
* // In a webhook route that receives a Fetch API Request (Next.js App Router, Hono, Remix)
|
|
7256
|
+
* export async function POST(request: Request) {
|
|
7168
7257
|
* try {
|
|
7169
7258
|
* const result = await composio.triggers.verifyWebhook({
|
|
7170
|
-
* payload:
|
|
7171
|
-
* signature:
|
|
7172
|
-
*
|
|
7173
|
-
*
|
|
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') ?? '',
|
|
7174
7263
|
* secret: process.env.COMPOSIO_WEBHOOK_SECRET!,
|
|
7175
7264
|
* });
|
|
7176
7265
|
*
|
|
7177
7266
|
* // Process the verified payload
|
|
7178
7267
|
* console.log('Webhook version:', result.version);
|
|
7179
7268
|
* console.log('Received trigger:', result.payload.triggerSlug);
|
|
7180
|
-
*
|
|
7269
|
+
* return new Response('OK', { status: 200 });
|
|
7181
7270
|
* } catch (error) {
|
|
7182
7271
|
* console.error('Webhook verification failed:', error);
|
|
7183
|
-
*
|
|
7272
|
+
* return new Response('Unauthorized', { status: 401 });
|
|
7184
7273
|
* }
|
|
7185
|
-
* }
|
|
7274
|
+
* }
|
|
7186
7275
|
* ```
|
|
7187
7276
|
*/
|
|
7188
7277
|
async verifyWebhook(params) {
|
|
@@ -7200,9 +7289,10 @@ var Triggers = class {
|
|
|
7200
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 });
|
|
7201
7290
|
throw new ValidationError("Invalid parameters passed to verifyWebhook", { cause: parsedParams.error });
|
|
7202
7291
|
}
|
|
7203
|
-
const { payload, signature, secret, id: webhookId, timestamp: webhookTimestamp, tolerance } = parsedParams.data;
|
|
7204
|
-
if (
|
|
7205
|
-
|
|
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);
|
|
7206
7296
|
const { version, rawPayload, normalizedPayload } = this.parseWebhookPayload(payload);
|
|
7207
7297
|
return {
|
|
7208
7298
|
version,
|
|
@@ -7223,7 +7313,7 @@ var Triggers = class {
|
|
|
7223
7313
|
}
|
|
7224
7314
|
const result = this.tryParseVersionedPayload(jsonPayload);
|
|
7225
7315
|
if (result.ok) {
|
|
7226
|
-
const { ok, ...rest } = result;
|
|
7316
|
+
const { ok: _ok, ...rest } = result;
|
|
7227
7317
|
return rest;
|
|
7228
7318
|
}
|
|
7229
7319
|
const { v1Error, v2Error, v3Error } = result;
|
|
@@ -7357,45 +7447,6 @@ var Triggers = class {
|
|
|
7357
7447
|
}
|
|
7358
7448
|
};
|
|
7359
7449
|
}
|
|
7360
|
-
/**
|
|
7361
|
-
* Verifies the HMAC-SHA256 signature of a webhook payload.
|
|
7362
|
-
* The signature format used by Composio is: `v1,base64EncodedSignature`
|
|
7363
|
-
* The signing input is: `${msgId}.${timestamp}.${payload}`
|
|
7364
|
-
* @private
|
|
7365
|
-
*/
|
|
7366
|
-
async verifyWebhookSignature(webhookId, webhookTimestamp, payload, signature, secret) {
|
|
7367
|
-
if (payload.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook payload was provided.");
|
|
7368
|
-
if (signature.length === 0) throw new ComposioWebhookSignatureVerificationError("No signature header value was provided. Please pass the value of the 'webhook-signature' header.");
|
|
7369
|
-
if (secret.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook secret was provided. You can find your webhook secret in your Composio dashboard.");
|
|
7370
|
-
if (webhookId.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook ID was provided. Please pass the value of the 'webhook-id' header.");
|
|
7371
|
-
if (webhookTimestamp.length === 0) throw new ComposioWebhookSignatureVerificationError("No webhook timestamp was provided. Please pass the value of the 'webhook-timestamp' header.");
|
|
7372
|
-
const signatures = signature.split(" ");
|
|
7373
|
-
const v1Signatures = [];
|
|
7374
|
-
for (const sig of signatures) {
|
|
7375
|
-
const [version, value] = sig.split(",");
|
|
7376
|
-
if (version === "v1" && value) v1Signatures.push(value);
|
|
7377
|
-
}
|
|
7378
|
-
if (v1Signatures.length === 0) throw new ComposioWebhookSignatureVerificationError("No valid v1 signature found in the webhook-signature header. Expected format: 'v1,base64EncodedSignature'");
|
|
7379
|
-
const toSign = `${webhookId}.${webhookTimestamp}.${payload}`;
|
|
7380
|
-
const expectedSignature = await hmacSha256Base64(secret, toSign);
|
|
7381
|
-
let isValid = false;
|
|
7382
|
-
for (const providedSignature of v1Signatures) if (timingSafeEqual(providedSignature, expectedSignature)) {
|
|
7383
|
-
isValid = true;
|
|
7384
|
-
break;
|
|
7385
|
-
}
|
|
7386
|
-
if (!isValid) throw new ComposioWebhookSignatureVerificationError("The signature provided is invalid. Please ensure you are using the correct webhook secret.");
|
|
7387
|
-
}
|
|
7388
|
-
/**
|
|
7389
|
-
* Validates that the webhook timestamp is within the allowed tolerance
|
|
7390
|
-
* @private
|
|
7391
|
-
*/
|
|
7392
|
-
validateWebhookTimestamp(webhookTimestamp, tolerance) {
|
|
7393
|
-
const timestampSeconds = parseInt(webhookTimestamp, 10);
|
|
7394
|
-
if (Number.isNaN(timestampSeconds)) throw new ComposioWebhookPayloadError(`Invalid webhook timestamp: ${webhookTimestamp}. Expected Unix timestamp in seconds.`);
|
|
7395
|
-
const webhookTimeMs = timestampSeconds * 1e3;
|
|
7396
|
-
const timeDifference = Math.abs(Date.now() - webhookTimeMs);
|
|
7397
|
-
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.`);
|
|
7398
|
-
}
|
|
7399
7450
|
};
|
|
7400
7451
|
|
|
7401
7452
|
// src/types/mcp.experimental.types.ts
|
|
@@ -7544,18 +7595,19 @@ var MCP = class {
|
|
|
7544
7595
|
*
|
|
7545
7596
|
* @example
|
|
7546
7597
|
* ```typescript
|
|
7547
|
-
* const server = await composio.
|
|
7598
|
+
* const server = await composio.mcp.create("personal-mcp-server", {
|
|
7548
7599
|
* toolkits: ["github", "slack"],
|
|
7549
|
-
* allowedTools: ["
|
|
7600
|
+
* allowedTools: ["GITHUB_CREATE_AN_ISSUE", "SLACK_SEND_MESSAGE"],
|
|
7550
7601
|
* manuallyManageConnections: false
|
|
7551
|
-
* }
|
|
7552
7602
|
* });
|
|
7603
|
+
* ```
|
|
7553
7604
|
*
|
|
7554
|
-
*
|
|
7605
|
+
* @example
|
|
7606
|
+
* ```typescript
|
|
7607
|
+
* const server = await composio.mcp.create("personal-mcp-server", {
|
|
7555
7608
|
* toolkits: [{ toolkit: "gmail", authConfigId: "ac_243434343" }],
|
|
7556
7609
|
* allowedTools: ["GMAIL_FETCH_EMAILS"],
|
|
7557
7610
|
* manuallyManageConnections: false
|
|
7558
|
-
* }
|
|
7559
7611
|
* });
|
|
7560
7612
|
* ```
|
|
7561
7613
|
*/
|
|
@@ -7606,22 +7658,31 @@ var MCP = class {
|
|
|
7606
7658
|
*
|
|
7607
7659
|
* @example
|
|
7608
7660
|
* ```typescript
|
|
7609
|
-
* // List
|
|
7610
|
-
* const allServers = await composio.
|
|
7661
|
+
* // List the first page of MCP servers
|
|
7662
|
+
* const allServers = await composio.mcp.list({ page: 1, limit: 10, toolkits: [], authConfigs: [] });
|
|
7611
7663
|
*
|
|
7612
7664
|
* // List with pagination
|
|
7613
|
-
* const pagedServers = await composio.
|
|
7665
|
+
* const pagedServers = await composio.mcp.list({
|
|
7614
7666
|
* page: 2,
|
|
7615
|
-
* limit: 5
|
|
7667
|
+
* limit: 5,
|
|
7668
|
+
* toolkits: [],
|
|
7669
|
+
* authConfigs: []
|
|
7616
7670
|
* });
|
|
7617
7671
|
*
|
|
7618
7672
|
* // Filter by toolkit
|
|
7619
|
-
* const githubServers = await composio.
|
|
7620
|
-
*
|
|
7673
|
+
* const githubServers = await composio.mcp.list({
|
|
7674
|
+
* page: 1,
|
|
7675
|
+
* limit: 10,
|
|
7676
|
+
* toolkits: ['github', 'slack'],
|
|
7677
|
+
* authConfigs: []
|
|
7621
7678
|
* });
|
|
7622
7679
|
*
|
|
7623
7680
|
* // Filter by name
|
|
7624
|
-
* const namedServers = await composio.
|
|
7681
|
+
* const namedServers = await composio.mcp.list({
|
|
7682
|
+
* page: 1,
|
|
7683
|
+
* limit: 10,
|
|
7684
|
+
* toolkits: [],
|
|
7685
|
+
* authConfigs: [],
|
|
7625
7686
|
* name: 'personal'
|
|
7626
7687
|
* });
|
|
7627
7688
|
* ```
|
|
@@ -7661,10 +7722,10 @@ var MCP = class {
|
|
|
7661
7722
|
* @example
|
|
7662
7723
|
* ```typescript
|
|
7663
7724
|
* // Get a specific MCP server by ID
|
|
7664
|
-
* const server = await composio.
|
|
7725
|
+
* const server = await composio.mcp.get("mcp_12345");
|
|
7665
7726
|
*
|
|
7666
7727
|
* console.log(server.name); // "My Personal MCP Server"
|
|
7667
|
-
* console.log(server.allowedTools); // ["
|
|
7728
|
+
* console.log(server.allowedTools); // ["GITHUB_CREATE_AN_ISSUE", "SLACK_SEND_MESSAGE"]
|
|
7668
7729
|
* console.log(server.toolkits); // ["github", "slack"]
|
|
7669
7730
|
* console.log(server.serverInstanceCount); // 3
|
|
7670
7731
|
*
|
|
@@ -7690,7 +7751,7 @@ var MCP = class {
|
|
|
7690
7751
|
* @example
|
|
7691
7752
|
* ```typescript
|
|
7692
7753
|
* // Delete an MCP server by ID
|
|
7693
|
-
* const result = await composio.
|
|
7754
|
+
* const result = await composio.mcp.delete("mcp_12345");
|
|
7694
7755
|
*
|
|
7695
7756
|
* if (result.deleted) {
|
|
7696
7757
|
* console.log(`Server ${result.id} has been successfully deleted`);
|
|
@@ -7700,15 +7761,15 @@ var MCP = class {
|
|
|
7700
7761
|
*
|
|
7701
7762
|
* // Example with error handling
|
|
7702
7763
|
* try {
|
|
7703
|
-
* const result = await composio.
|
|
7764
|
+
* const result = await composio.mcp.delete("mcp_12345");
|
|
7704
7765
|
* console.log("Deletion successful:", result);
|
|
7705
7766
|
* } catch (error) {
|
|
7706
|
-
* console.error("Failed to delete MCP server:", error
|
|
7767
|
+
* console.error("Failed to delete MCP server:", error);
|
|
7707
7768
|
* }
|
|
7708
7769
|
*
|
|
7709
7770
|
* // Delete and verify from list
|
|
7710
|
-
* await composio.
|
|
7711
|
-
* const servers = await composio.
|
|
7771
|
+
* await composio.mcp.delete("mcp_12345");
|
|
7772
|
+
* const servers = await composio.mcp.list({ page: 1, limit: 10, toolkits: [], authConfigs: [] });
|
|
7712
7773
|
* const serverExists = servers.items.some(server => server.id === "mcp_12345");
|
|
7713
7774
|
* console.log("Server still exists:", serverExists); // Should be false
|
|
7714
7775
|
* ```
|
|
@@ -7736,34 +7797,32 @@ var MCP = class {
|
|
|
7736
7797
|
* @example
|
|
7737
7798
|
* ```typescript
|
|
7738
7799
|
* // Update server name only
|
|
7739
|
-
* const updatedServer = await composio.
|
|
7800
|
+
* const updatedServer = await composio.mcp.update("mcp_12345", {
|
|
7740
7801
|
* name: "My Updated MCP Server"
|
|
7741
7802
|
* });
|
|
7742
7803
|
*
|
|
7743
7804
|
* // Update toolkits and tools
|
|
7744
|
-
* const serverWithNewTools = await composio.
|
|
7805
|
+
* const serverWithNewTools = await composio.mcp.update("mcp_12345", {
|
|
7745
7806
|
* toolkits: [
|
|
7746
|
-
* {
|
|
7747
|
-
*
|
|
7748
|
-
*
|
|
7749
|
-
*
|
|
7750
|
-
*
|
|
7751
|
-
*
|
|
7752
|
-
*
|
|
7753
|
-
*
|
|
7754
|
-
* allowedTools: ["SLACK_SEND_MESSAGE", "SLACK_LIST_CHANNELS"]
|
|
7755
|
-
* }
|
|
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"
|
|
7756
7815
|
* ]
|
|
7757
7816
|
* });
|
|
7758
7817
|
*
|
|
7759
7818
|
* // Update connection management setting
|
|
7760
|
-
* const serverWithManualAuth = await composio.
|
|
7819
|
+
* const serverWithManualAuth = await composio.mcp.update("mcp_12345", {
|
|
7761
7820
|
* name: "Manual Auth Server",
|
|
7762
7821
|
* manuallyManageConnections: true
|
|
7763
7822
|
* });
|
|
7764
7823
|
*
|
|
7765
7824
|
* // Complete update example
|
|
7766
|
-
* const fullyUpdatedServer = await composio.
|
|
7825
|
+
* const fullyUpdatedServer = await composio.mcp.update("mcp_12345", {
|
|
7767
7826
|
* name: "Production MCP Server",
|
|
7768
7827
|
* toolkits: [
|
|
7769
7828
|
* {
|
|
@@ -7771,7 +7830,7 @@ var MCP = class {
|
|
|
7771
7830
|
* authConfigId: "auth_gmail_prod",
|
|
7772
7831
|
* }
|
|
7773
7832
|
* ],
|
|
7774
|
-
* allowedTools: ["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"]
|
|
7833
|
+
* allowedTools: ["GMAIL_SEND_EMAIL", "GMAIL_FETCH_EMAILS"],
|
|
7775
7834
|
* manuallyManageConnections: false
|
|
7776
7835
|
* });
|
|
7777
7836
|
*
|
|
@@ -7814,10 +7873,10 @@ var MCP = class {
|
|
|
7814
7873
|
*
|
|
7815
7874
|
* @example
|
|
7816
7875
|
* ```typescript
|
|
7817
|
-
* import { Composio } from "@composio/
|
|
7876
|
+
* import { Composio } from "@composio/core";
|
|
7818
7877
|
*
|
|
7819
7878
|
* const composio = new Composio();
|
|
7820
|
-
* const mcp = await composio.
|
|
7879
|
+
* const mcp = await composio.mcp.generate("default", "<mcp_config_id>");
|
|
7821
7880
|
* ```
|
|
7822
7881
|
*
|
|
7823
7882
|
* @param userId {string} external user id from your database for whom you want the server for
|
|
@@ -8276,6 +8335,16 @@ const ToolRouterHookPromptInjectionCheckHandlerSchema = z.object({
|
|
|
8276
8335
|
type: z.literal("prompt_injection_check"),
|
|
8277
8336
|
action: z.literal("block")
|
|
8278
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();
|
|
8279
8348
|
const toolRouterHookIdentityFields = {
|
|
8280
8349
|
id: z.string().describe("Unique within the session. Shows up in results and logs."),
|
|
8281
8350
|
name: z.string().optional().describe("A readable name. The agent sees it when this hook blocks a call."),
|
|
@@ -8284,16 +8353,21 @@ const toolRouterHookIdentityFields = {
|
|
|
8284
8353
|
/**
|
|
8285
8354
|
* A hook on a session's tool calls. A `before_execute` hook can block a call
|
|
8286
8355
|
* before it runs; an `after_execute` hook can block its result before the
|
|
8287
|
-
* agent sees it.
|
|
8356
|
+
* agent sees it. A hook with a `webhook` handler can also change the call or
|
|
8357
|
+
* its result.
|
|
8288
8358
|
*/
|
|
8289
8359
|
const ToolRouterHookSchema = z.discriminatedUnion("type", [z.object({
|
|
8290
8360
|
type: z.literal("before_execute"),
|
|
8291
8361
|
...toolRouterHookIdentityFields,
|
|
8292
|
-
handler: ToolRouterHookConditionCheckHandlerSchema
|
|
8362
|
+
handler: z.discriminatedUnion("type", [ToolRouterHookConditionCheckHandlerSchema, ToolRouterHookWebhookHandlerSchema])
|
|
8293
8363
|
}).strict(), z.object({
|
|
8294
8364
|
type: z.literal("after_execute"),
|
|
8295
8365
|
...toolRouterHookIdentityFields,
|
|
8296
|
-
handler: z.discriminatedUnion("type", [
|
|
8366
|
+
handler: z.discriminatedUnion("type", [
|
|
8367
|
+
ToolRouterHookConditionCheckHandlerSchema,
|
|
8368
|
+
ToolRouterHookPromptInjectionCheckHandlerSchema,
|
|
8369
|
+
ToolRouterHookWebhookHandlerSchema
|
|
8370
|
+
])
|
|
8297
8371
|
}).strict()]);
|
|
8298
8372
|
const ToolRouterCreateSessionConfigBaseSchema = z.object({
|
|
8299
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."),
|
|
@@ -8472,8 +8546,9 @@ const ToolRouterSessionSearchResponseSchema = z.object({
|
|
|
8472
8546
|
});
|
|
8473
8547
|
/**
|
|
8474
8548
|
* What one session hook decided about a call. `unavailable` means the hook
|
|
8475
|
-
* could not be evaluated (for example it timed out)
|
|
8476
|
-
* 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'`.
|
|
8477
8552
|
*/
|
|
8478
8553
|
const ToolRouterHookResultSchema = z.discriminatedUnion("status", [z.object({
|
|
8479
8554
|
id: z.string().describe("The hook id"),
|
|
@@ -8481,7 +8556,8 @@ const ToolRouterHookResultSchema = z.discriminatedUnion("status", [z.object({
|
|
|
8481
8556
|
outcome: z.enum(["continue", "block"]).describe("What the hook decided")
|
|
8482
8557
|
}), z.object({
|
|
8483
8558
|
id: z.string().describe("The hook id"),
|
|
8484
|
-
status: z.literal("unavailable")
|
|
8559
|
+
status: z.literal("unavailable"),
|
|
8560
|
+
detail: z.string().optional().describe("Why the hook could not be evaluated")
|
|
8485
8561
|
})]);
|
|
8486
8562
|
/**
|
|
8487
8563
|
* Why a session hook blocked a call. `request_blocked`: a `before_execute` hook
|
|
@@ -8921,9 +8997,10 @@ var Keyring = class {
|
|
|
8921
8997
|
* @returns {Promise<KeyringTransferKeysResponse>} The active key ID and every accepted public JWK, newest first
|
|
8922
8998
|
*
|
|
8923
8999
|
* @example
|
|
8924
|
-
* ```typescript
|
|
9000
|
+
* ```typescript nocheck="Seals with the jose library, whose types the checker does not load"
|
|
8925
9001
|
* import { CompactEncrypt, importJWK } from 'jose';
|
|
8926
9002
|
*
|
|
9003
|
+
* const secret = 'my-client-secret';
|
|
8927
9004
|
* const { activeKid, keys } = await composio.keyring.listTransferKeys();
|
|
8928
9005
|
* const jwk = keys.find(key => key.kid === activeKid)!;
|
|
8929
9006
|
* const sealed = await new CompactEncrypt(new TextEncoder().encode(secret))
|
|
@@ -9238,7 +9315,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
9238
9315
|
};
|
|
9239
9316
|
|
|
9240
9317
|
// package.json
|
|
9241
|
-
var version = "0.
|
|
9318
|
+
var version = "0.32.0";
|
|
9242
9319
|
|
|
9243
9320
|
// src/utils/session.ts
|
|
9244
9321
|
/**
|
|
@@ -9366,13 +9443,14 @@ const transformToolRouterSandboxParams = (params) => {
|
|
|
9366
9443
|
sandbox_size: params.sandboxSize
|
|
9367
9444
|
};
|
|
9368
9445
|
};
|
|
9369
|
-
|
|
9370
|
-
* `hooks` as sent on create and update: `appliesTo` becomes `applies_to`.
|
|
9371
|
-
* Create and patch take the same hook shape.
|
|
9372
|
-
*/
|
|
9373
|
-
const transformToolRouterHooksParams = (hooks) => hooks.map(({ appliesTo, ...hook }) => ({
|
|
9446
|
+
const transformToolRouterHooksParams = (hooks) => hooks.map(({ appliesTo, handler, ...hook }) => ({
|
|
9374
9447
|
...hook,
|
|
9375
|
-
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
|
|
9376
9454
|
}));
|
|
9377
9455
|
/** `proxy_execute` as sent on create and update: a boolean becomes `{ enable }`. */
|
|
9378
9456
|
const transformToolRouterProxyExecuteParams = (config) => typeof config === "boolean" ? { enable: config } : config;
|
|
@@ -10116,12 +10194,14 @@ var ToolRouterSessionFilesMount = class {
|
|
|
10116
10194
|
* @example
|
|
10117
10195
|
* ```typescript
|
|
10118
10196
|
* // From native File (e.g. from input[type=file])
|
|
10119
|
-
*
|
|
10197
|
+
* const file = new File(['hello world'], 'hello.txt', { type: 'text/plain' });
|
|
10198
|
+
* await session.experimental.files.upload(file);
|
|
10120
10199
|
* ```
|
|
10121
10200
|
*
|
|
10122
10201
|
* @example
|
|
10123
10202
|
* ```typescript
|
|
10124
10203
|
* // From raw buffer
|
|
10204
|
+
* const buffer = new TextEncoder().encode(JSON.stringify({ hello: 'world' }));
|
|
10125
10205
|
* await session.experimental.files.upload(buffer, { remotePath: 'data.json', mimetype: 'application/json' });
|
|
10126
10206
|
* ```
|
|
10127
10207
|
*/
|
|
@@ -10706,7 +10786,7 @@ var ToolRouterSession = class {
|
|
|
10706
10786
|
*
|
|
10707
10787
|
* @example
|
|
10708
10788
|
* ```typescript
|
|
10709
|
-
* const session = await composio.sessions.create({ toolkits: ['github'] });
|
|
10789
|
+
* const session = await composio.sessions.create('user_123', { toolkits: ['github'] });
|
|
10710
10790
|
* const { wasConnected, connectedAccount } = await session.ensureConnected('github');
|
|
10711
10791
|
* if (!wasConnected) console.log('Newly linked:', connectedAccount?.id);
|
|
10712
10792
|
* ```
|
|
@@ -11029,7 +11109,7 @@ var ToolRouterSession = class {
|
|
|
11029
11109
|
};
|
|
11030
11110
|
const obj = item;
|
|
11031
11111
|
return {
|
|
11032
|
-
tool_slug:
|
|
11112
|
+
tool_slug: typeof obj.tool_slug === "string" ? obj.tool_slug : "",
|
|
11033
11113
|
arguments: obj.arguments ?? {}
|
|
11034
11114
|
};
|
|
11035
11115
|
}
|
|
@@ -11132,6 +11212,240 @@ var ToolRouterSession = class {
|
|
|
11132
11212
|
}
|
|
11133
11213
|
};
|
|
11134
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
|
+
|
|
11135
11449
|
// src/models/ToolRouter.ts
|
|
11136
11450
|
function getSessionMetadata(session) {
|
|
11137
11451
|
return {
|
|
@@ -11159,9 +11473,15 @@ function prepareInlineCustomTools(options) {
|
|
|
11159
11473
|
var ToolRouter = class {
|
|
11160
11474
|
client;
|
|
11161
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;
|
|
11162
11481
|
constructor(client, config) {
|
|
11163
11482
|
this.client = client;
|
|
11164
11483
|
this.config = config;
|
|
11484
|
+
this.webhooks = new SessionWebhooks();
|
|
11165
11485
|
telemetry.instrument(this, "ToolRouter");
|
|
11166
11486
|
}
|
|
11167
11487
|
/**
|
|
@@ -11692,19 +12012,31 @@ var Composio = class Composio {
|
|
|
11692
12012
|
*
|
|
11693
12013
|
* @example
|
|
11694
12014
|
* ```typescript
|
|
12015
|
+
* import { Composio } from '@composio/core';
|
|
12016
|
+
*
|
|
11695
12017
|
* // Initialize with default configuration
|
|
11696
12018
|
* const composio = new Composio();
|
|
12019
|
+
* ```
|
|
12020
|
+
*
|
|
12021
|
+
* @example
|
|
12022
|
+
* ```typescript
|
|
12023
|
+
* import { Composio } from '@composio/core';
|
|
11697
12024
|
*
|
|
11698
12025
|
* // Initialize with custom API key and base URL
|
|
11699
12026
|
* const composio = new Composio({
|
|
11700
12027
|
* apiKey: 'your-api-key',
|
|
11701
12028
|
* baseURL: 'https://api.composio.dev'
|
|
11702
12029
|
* });
|
|
12030
|
+
* ```
|
|
12031
|
+
*
|
|
12032
|
+
* @example
|
|
12033
|
+
* ```typescript
|
|
12034
|
+
* import { Composio, OpenAIProvider } from '@composio/core';
|
|
11703
12035
|
*
|
|
11704
|
-
* // Initialize with
|
|
12036
|
+
* // Initialize with an explicit provider
|
|
11705
12037
|
* const composio = new Composio({
|
|
11706
12038
|
* apiKey: 'your-api-key',
|
|
11707
|
-
* provider: new
|
|
12039
|
+
* provider: new OpenAIProvider()
|
|
11708
12040
|
* });
|
|
11709
12041
|
* ```
|
|
11710
12042
|
*/
|
|
@@ -11860,6 +12192,8 @@ var Composio = class Composio {
|
|
|
11860
12192
|
*
|
|
11861
12193
|
* @example
|
|
11862
12194
|
* ```typescript
|
|
12195
|
+
* import { Composio } from '@composio/core';
|
|
12196
|
+
*
|
|
11863
12197
|
* // Create a base Composio instance
|
|
11864
12198
|
* const composio = new Composio({
|
|
11865
12199
|
* apiKey: 'your-api-key'
|
|
@@ -11875,7 +12209,7 @@ var Composio = class Composio {
|
|
|
11875
12209
|
* });
|
|
11876
12210
|
*
|
|
11877
12211
|
* // Use the session for making API calls with the custom headers
|
|
11878
|
-
* await composioWithCustomHeaders.tools.
|
|
12212
|
+
* await composioWithCustomHeaders.tools.getRawComposioTools({ toolkits: ['github'] });
|
|
11879
12213
|
* ```
|
|
11880
12214
|
*/
|
|
11881
12215
|
createSession(options) {
|
|
@@ -11894,14 +12228,20 @@ var Composio = class Composio {
|
|
|
11894
12228
|
* @returns {Promise<void>} A promise that resolves when all pending telemetry has been sent.
|
|
11895
12229
|
*
|
|
11896
12230
|
* @example
|
|
11897
|
-
* ```typescript
|
|
12231
|
+
* ```typescript nocheck="Cloudflare Worker handler; the checker has no Workers Env or ExecutionContext types"
|
|
12232
|
+
* import { Composio } from '@composio/core';
|
|
12233
|
+
*
|
|
11898
12234
|
* // In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
|
|
11899
12235
|
* export default {
|
|
11900
12236
|
* async fetch(request: Request, env: Env, ctx: ExecutionContext) {
|
|
11901
12237
|
* const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
|
|
11902
12238
|
*
|
|
11903
12239
|
* // Do your work...
|
|
11904
|
-
* 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
|
+
* });
|
|
11905
12245
|
*
|
|
11906
12246
|
* // Ensure telemetry flushes before worker terminates
|
|
11907
12247
|
* ctx.waitUntil(composio.flush());
|
|
@@ -12707,4 +13047,4 @@ const ComposioMcpUpdateResponseSchema = z$1.object({
|
|
|
12707
13047
|
tools: z$1.array(z$1.string()).optional()
|
|
12708
13048
|
});
|
|
12709
13049
|
|
|
12710
|
-
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, 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 };
|