@composio/core 0.18.1 → 0.19.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-Bz0f52QR.mjs → CustomTool-BMlZfJVz.mjs} +1 -1
- package/dist/{CustomTool-VRfWzMix.d.mts → CustomTool-CB5vm1Jc.d.mts} +1 -1
- package/dist/{FileModifierErrors-CwB-Inm9.mjs → FileModifierErrors-BqFmpRsm.mjs} +1 -1
- package/dist/{FileToolModifier.utils.neutral-D_YkHwZP.mjs → FileToolModifier.utils.neutral-DWFpnsj2.mjs} +4 -2
- package/dist/{SsrfErrors-xhdVE4yw.mjs → SsrfErrors-C91YhASE.mjs} +14 -10
- package/dist/{Telemetry-Dw9W5RSp.mjs → Telemetry-HlftxMx6.mjs} +2 -2
- package/dist/{cancellation-P5YUlcfz.mjs → cancellation-CXpfmiVo.mjs} +7 -5
- package/dist/{composio-Cb3d1jFe.d.mts → composio-DLGaeN70.d.mts} +327 -26
- package/dist/{customTool.types-B6ej_8XZ.d.mts → customTool.types-BAmEh3MB.d.mts} +95 -4
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +2 -2
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +3 -13
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +46 -3
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +4 -4
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +33 -23
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +3 -2
- package/dist/{errors-Ue9wMrPK.mjs → errors-BuEKehbI.mjs} +23 -3
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-KE5Fa-af.mjs → fileUtils.node-L7XD8UPr.mjs} +8 -6
- package/dist/index.d.mts +160 -101
- package/dist/index.mjs +336 -127
- package/dist/models/Files.node.d.mts +2 -3
- package/dist/models/Files.node.mjs +2 -2
- package/dist/models/Files.workerd.d.mts +2 -3
- package/dist/platform/node.d.mts +2 -3
- package/dist/platform/workerd.d.mts +2 -3
- package/dist/{sensitiveFileUploadPaths-QN7w4n8v.mjs → sensitiveFileUploadPaths-B6pBt9lO.mjs} +10 -7
- package/dist/{ssrfGuard.node-BLX6b-Rf.mjs → ssrfGuard.node-B9xQB4za.mjs} +104 -14
- package/dist/{types-CGdgK442.d.mts → types-CxLPO0Xq.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +3 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.node.mjs +6 -6
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +3 -4
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/dist/utils/ssrfGuard.node.d.mts +19 -10
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.d.mts +12 -4
- package/dist/utils/ssrfGuard.workerd.mjs +2 -2
- package/package.json +8 -8
- package/src/errors/ToolErrors.ts +24 -0
- package/src/index.ts +4 -0
- package/src/models/MCP.ts +29 -15
- package/src/models/ToolRouter.ts +1 -0
- package/src/models/ToolRouterSession.ts +106 -9
- package/src/models/Toolkits.ts +1 -2
- package/src/models/Tools.ts +55 -25
- package/src/models/Triggers.ts +7 -2
- package/src/services/pusher/Pusher.ts +29 -10
- package/src/types/toolRouter.types.ts +54 -3
- package/src/types/toolkit.types.ts +17 -0
- package/src/utils/jsonSchema.ts +4 -1
- package/src/utils/ssrfGuard.node.ts +127 -13
- package/src/utils/ssrfGuard.workerd.ts +11 -1
- package/src/utils/transformers/toolkits.ts +79 -2
|
@@ -31673,7 +31673,9 @@ type ToolRouterSessionSearchFn = (params: {
|
|
|
31673
31673
|
type ToolRouterSessionExecuteFn = (toolSlug: string, arguments_?: Record<string, unknown>, options?: ToolRouterSessionExecuteOptions) => Promise<ToolRouterSessionExecuteResponse>;
|
|
31674
31674
|
interface ToolRouterSessionExecuteOptions {
|
|
31675
31675
|
/**
|
|
31676
|
-
* Account identifier for direct app tool execution
|
|
31676
|
+
* Account identifier for direct app tool execution. Accepted on every project:
|
|
31677
|
+
* in multi-account sessions it picks the account; on single-account projects it
|
|
31678
|
+
* must match one of the session's active connections for the toolkit.
|
|
31677
31679
|
* Meta/helper tools either ignore this top-level field or define
|
|
31678
31680
|
* their own account-selection fields, for example
|
|
31679
31681
|
* COMPOSIO_MULTI_EXECUTE_TOOL.tools[].account.
|
|
@@ -31683,7 +31685,15 @@ interface ToolRouterSessionExecuteOptions {
|
|
|
31683
31685
|
type ToolRouterSessionPreloadConfig = SessionCreateResponse.Config.Preload;
|
|
31684
31686
|
type ToolRouterSessionWorkbenchConfig = SessionCreateResponse.Config.Workbench;
|
|
31685
31687
|
type ToolRouterSessionWarning = SessionCreateResponse.Warning;
|
|
31688
|
+
/**
|
|
31689
|
+
* Server-side session configuration as returned by the API: toolkit and tool
|
|
31690
|
+
* allowlists, tags, auth configs, connected accounts, manage_connections,
|
|
31691
|
+
* preload, sandbox (`workbench`), search and execute settings.
|
|
31692
|
+
*/
|
|
31693
|
+
type ToolRouterSessionConfig = SessionCreateResponse.Config;
|
|
31686
31694
|
interface ToolRouterSessionMetadata {
|
|
31695
|
+
/** Present on every session built from an API response; the constructor synthesises a minimal config when absent. */
|
|
31696
|
+
config?: ToolRouterSessionConfig;
|
|
31687
31697
|
preload?: ToolRouterSessionPreloadConfig;
|
|
31688
31698
|
workbench?: ToolRouterSessionWorkbenchConfig;
|
|
31689
31699
|
configVersion?: number;
|
|
@@ -32070,7 +32080,7 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
32070
32080
|
} | null | undefined;
|
|
32071
32081
|
}>;
|
|
32072
32082
|
type ToolRouterUpdateSessionConfig = z.infer<typeof ToolRouterUpdateSessionConfigSchema>;
|
|
32073
|
-
type ToolRouterSessionUpdateFn = (config: ToolRouterUpdateSessionConfig) => Promise<
|
|
32083
|
+
type ToolRouterSessionUpdateFn = (config: ToolRouterUpdateSessionConfig) => Promise<ToolRouterSessionConfig>;
|
|
32074
32084
|
declare const ToolRouterSessionDeleteResponseSchema: z.ZodObject<{
|
|
32075
32085
|
sessionId: z.ZodString;
|
|
32076
32086
|
deleted: z.ZodLiteral<true>;
|
|
@@ -32083,10 +32093,89 @@ declare const ToolRouterSessionDeleteResponseSchema: z.ZodObject<{
|
|
|
32083
32093
|
}>;
|
|
32084
32094
|
type ToolRouterSessionDeleteResponse = z.infer<typeof ToolRouterSessionDeleteResponseSchema>;
|
|
32085
32095
|
type ToolRouterSessionDeleteFn = (requestOptions?: ComposioRequestOptions) => Promise<ToolRouterSessionDeleteResponse>;
|
|
32096
|
+
declare const ToolRouterSessionEnsureConnectedOptionsSchema: z.ZodObject<{
|
|
32097
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
32098
|
+
alias: z.ZodOptional<z.ZodString>;
|
|
32099
|
+
experimental: z.ZodOptional<z.ZodObject<{
|
|
32100
|
+
accountType: z.ZodOptional<z.ZodEnum<["PRIVATE", "SHARED"]>>;
|
|
32101
|
+
aclConfigForShared: z.ZodOptional<z.ZodObject<{
|
|
32102
|
+
allowAllUsers: z.ZodOptional<z.ZodBoolean>;
|
|
32103
|
+
allowedUserIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
32104
|
+
notAllowedUserIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
32105
|
+
}, "strip", z.ZodTypeAny, {
|
|
32106
|
+
allowAllUsers?: boolean | undefined;
|
|
32107
|
+
allowedUserIds?: string[] | undefined;
|
|
32108
|
+
notAllowedUserIds?: string[] | undefined;
|
|
32109
|
+
}, {
|
|
32110
|
+
allowAllUsers?: boolean | undefined;
|
|
32111
|
+
allowedUserIds?: string[] | undefined;
|
|
32112
|
+
notAllowedUserIds?: string[] | undefined;
|
|
32113
|
+
}>>;
|
|
32114
|
+
}, "strip", z.ZodTypeAny, {
|
|
32115
|
+
accountType?: "PRIVATE" | "SHARED" | undefined;
|
|
32116
|
+
aclConfigForShared?: {
|
|
32117
|
+
allowAllUsers?: boolean | undefined;
|
|
32118
|
+
allowedUserIds?: string[] | undefined;
|
|
32119
|
+
notAllowedUserIds?: string[] | undefined;
|
|
32120
|
+
} | undefined;
|
|
32121
|
+
}, {
|
|
32122
|
+
accountType?: "PRIVATE" | "SHARED" | undefined;
|
|
32123
|
+
aclConfigForShared?: {
|
|
32124
|
+
allowAllUsers?: boolean | undefined;
|
|
32125
|
+
allowedUserIds?: string[] | undefined;
|
|
32126
|
+
notAllowedUserIds?: string[] | undefined;
|
|
32127
|
+
} | undefined;
|
|
32128
|
+
}>>;
|
|
32129
|
+
/** Max time to wait for a newly-initiated connection to become active, in milliseconds. Defaults to 60000. */
|
|
32130
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
32131
|
+
}, "strip", z.ZodTypeAny, {
|
|
32132
|
+
callbackUrl?: string | undefined;
|
|
32133
|
+
experimental?: {
|
|
32134
|
+
accountType?: "PRIVATE" | "SHARED" | undefined;
|
|
32135
|
+
aclConfigForShared?: {
|
|
32136
|
+
allowAllUsers?: boolean | undefined;
|
|
32137
|
+
allowedUserIds?: string[] | undefined;
|
|
32138
|
+
notAllowedUserIds?: string[] | undefined;
|
|
32139
|
+
} | undefined;
|
|
32140
|
+
} | undefined;
|
|
32141
|
+
alias?: string | undefined;
|
|
32142
|
+
timeout?: number | undefined;
|
|
32143
|
+
}, {
|
|
32144
|
+
callbackUrl?: string | undefined;
|
|
32145
|
+
experimental?: {
|
|
32146
|
+
accountType?: "PRIVATE" | "SHARED" | undefined;
|
|
32147
|
+
aclConfigForShared?: {
|
|
32148
|
+
allowAllUsers?: boolean | undefined;
|
|
32149
|
+
allowedUserIds?: string[] | undefined;
|
|
32150
|
+
notAllowedUserIds?: string[] | undefined;
|
|
32151
|
+
} | undefined;
|
|
32152
|
+
} | undefined;
|
|
32153
|
+
alias?: string | undefined;
|
|
32154
|
+
timeout?: number | undefined;
|
|
32155
|
+
}>;
|
|
32156
|
+
type ToolRouterSessionEnsureConnectedOptions = z.infer<typeof ToolRouterSessionEnsureConnectedOptionsSchema>;
|
|
32157
|
+
type ToolRouterSessionEnsureConnectedResult = {
|
|
32158
|
+
/** Canonical slug of the toolkit this call ensured. */
|
|
32159
|
+
toolkit: string;
|
|
32160
|
+
/** True when the session already had an active connection (or a no-auth toolkit) — no link was created. */
|
|
32161
|
+
wasConnected: boolean;
|
|
32162
|
+
/** The active connected account backing the toolkit. Omitted for no-auth toolkits. */
|
|
32163
|
+
connectedAccount?: {
|
|
32164
|
+
id: string;
|
|
32165
|
+
status: string;
|
|
32166
|
+
};
|
|
32167
|
+
};
|
|
32168
|
+
type ToolRouterSessionEnsureConnectedFn = (toolkit: string, options?: ToolRouterSessionEnsureConnectedOptions, requestOptions?: ComposioRequestOptions) => Promise<ToolRouterSessionEnsureConnectedResult>;
|
|
32086
32169
|
/** Session type returned by ToolRouter.create() and ToolRouter.use() */
|
|
32087
32170
|
interface Session<TToolCollection, TTool, TProvider extends BaseComposioProvider<TToolCollection, TTool, unknown>> {
|
|
32088
32171
|
sessionId: string;
|
|
32089
32172
|
mcp: ToolRouterMCPServerConfig;
|
|
32173
|
+
/**
|
|
32174
|
+
* Server-side session configuration (toolkit/tool allowlists, tags, preload,
|
|
32175
|
+
* sandbox, manage_connections) as returned by the API. Refreshed in place by
|
|
32176
|
+
* `update()`.
|
|
32177
|
+
*/
|
|
32178
|
+
config: ToolRouterSessionConfig;
|
|
32090
32179
|
/** Stored preload configuration for this session. */
|
|
32091
32180
|
preload: ToolRouterSessionPreloadConfig;
|
|
32092
32181
|
/**
|
|
@@ -32107,12 +32196,14 @@ interface Session<TToolCollection, TTool, TProvider extends BaseComposioProvider
|
|
|
32107
32196
|
warnings: ToolRouterSessionWarning[];
|
|
32108
32197
|
tools: ToolRouterToolsFn<TToolCollection, TTool, TProvider>;
|
|
32109
32198
|
authorize: ToolRouterAuthorizeFn;
|
|
32199
|
+
/** Ensure a toolkit has an active connection, linking and waiting only when needed. */
|
|
32200
|
+
ensureConnected: ToolRouterSessionEnsureConnectedFn;
|
|
32110
32201
|
toolkits: ToolRouterToolkitsFn;
|
|
32111
32202
|
/** Search for tools by semantic use case */
|
|
32112
32203
|
search: ToolRouterSessionSearchFn;
|
|
32113
32204
|
/** Execute a tool within the session */
|
|
32114
32205
|
execute: ToolRouterSessionExecuteFn;
|
|
32115
|
-
/** Update the session configuration. Mutates this session in-place
|
|
32206
|
+
/** Update the session configuration. Mutates this session in-place and resolves to the updated `config`. */
|
|
32116
32207
|
update: ToolRouterSessionUpdateFn;
|
|
32117
32208
|
/** Delete the session. Deleted sessions are no longer retrievable or executable. */
|
|
32118
32209
|
delete: ToolRouterSessionDeleteFn;
|
|
@@ -32332,4 +32423,4 @@ type CustomToolResponse = SessionCreateResponse.Experimental.CustomTool;
|
|
|
32332
32423
|
/** Custom toolkit as returned in the session create response (has prefixed slugs + original_slugs). */
|
|
32333
32424
|
type CustomToolkitResponse = SessionCreateResponse.Experimental.CustomToolkit;
|
|
32334
32425
|
//#endregion
|
|
32335
|
-
export {
|
|
32426
|
+
export { ToolRouterSessionEnsureConnectedResult as $, Tool as $i, GenerateURLResponseSchema as $n, CustomOauth1ConnectionData as $r, ConnectedAccountAuthConfig as $t, SessionProxyExecuteParams as A, Oauth2InitiatingConnectionDataSchema as Ai, CreateConnectedAccountResponseSchema as An, McpServerCreateResponse as Ar, ToolkitConnectionsDetailsSchema as At, ToolRouterCreateSessionConfigSchema as B, SessionMetaToolOptions as Bi, ComposioGenerateURLParamsSchema as Bn, ExecuteToolFnOptions as Br, ToolRouterSessionFilesMountDownloadOptions as Bt, MCPServerType as C, ToolkitVersions as Ca, Oauth2FailedConnectionData as Ci, CreateConnectedAccountLinkResponse as Cn, MCPToolkitConfigsArraySchema as Cr, ToolRouterToolsParam as Ct, Session as D, Oauth2InitiatedConnectionData as Di, CreateConnectedAccountParams as Dn, McpListResponseSchema as Dr, ToolkitConnectionState as Dt, SandboxSizeSchema as E, Oauth2InactiveConnectionDataSchema as Ei, CreateConnectedAccountOptionsSchema as En, McpListResponse as Er, ToolRouterUpdateSessionConfigSchema as Et, ToolRouterConfigTags as F, BeforeFileUploadSource as Fi, UpdateConnectedAccountParamsSchema as Fn, McpUpdateResponseSchema as Fr, FileListResponseSchema as Ft, ToolRouterSandboxConfigSchema as G, beforeExecuteMetaModifier as Gi, ComposioMcpUpdateResponseSchema as Gn, BaseConnectionFields as Gr, ToolRouterSessionFilesMountUploadOptionsSchema as Gt, ToolRouterMCPServerConfigSchema as H, TransformToolSchemaModifier as Hi, ComposioMcpDeleteResponseSchema as Hn, Provider as Hr, ToolRouterSessionFilesMountListOptions as Ht, ToolRouterConfigTagsSchema as I, ExecuteToolModifiers as Ii, BaseAgenticProvider as In, McpUrlResponse as Ir, RemoteFileData as It, ToolRouterSessionDeleteResponse as J, CustomAuthParams as Ji, CustomCreateResponseSchema as Jn, ConnectionDataSchema as Jr, ConnectionRequestState as Jt, ToolRouterSessionConfig as K, beforeExecuteModifier as Ki, ConnectionStatus as Kn, BillcomAuthConnectionDataSchema as Kr, ComposioRequestOptions as Kt, ToolRouterConfigTools as L, MetaToolArguments as Li, BaseComposioProvider as Ln, McpUrlResponseCamelCase as Lr, RemoteFileDataSchema as Lt, SessionWithoutMcp as M, Oauth2RevokedConnectionDataSchema as Mi, UpdateConnectedAccountAclParams as Mn, McpServerUrlInfo as Mr, FileDeleteResponse as Mt, ToolRouterAuthorizeFn as N, RedirectableAuthSchemeSchema as Ni, UpdateConnectedAccountAclParamsSchema as Nn, McpToolkitConnectionStatus as Nr, FileDeleteResponseSchema as Nt, SessionExperimental as O, Oauth2InitiatedConnectionDataSchema as Oi, CreateConnectedAccountParamsSchema as On, McpRetrieveResponse as Or, ToolkitConnectionStateSchema as Ot, ToolRouterConfigManageConnectionsSchema as P, AgenticToolOptions as Pi, UpdateConnectedAccountParams as Pn, McpUpdateResponse as Pr, FileListResponse as Pt, ToolRouterSessionEnsureConnectedOptionsSchema as Q, SchemaModifierOptions as Qi, GenerateURLResponse$1 as Qn, CustomConnectionDataSchema as Qr, ConnectedAccountAclConfigSchema as Qt, ToolRouterConfigToolsSchema as R, ProviderOptions as Ri, BaseNonAgenticProvider as Rn, McpUserConnectionStatus as Rr, ToolRouterSessionFilesMountDeleteOptions as Rt, SessionContext as S, ToolkitVersionSchema as Sa, Oauth2ExpiredConnectionDataSchema as Si, CreateConnectedAccountLinkOptionsSchema as Sn, MCPToolkitConfigSchema as Sr, ToolRouterToolsFn as St, SandboxSize as T, Oauth2InactiveConnectionData as Ti, CreateConnectedAccountOptions as Tn, McpDeleteResponseSchema as Tr, ToolRouterUpdateSessionConfig as Tt, ToolRouterManageConnectionsConfigSchema as U, afterExecuteMetaModifier as Ui, ComposioMcpListResponseSchema as Un, ToolCallExecutionTarget as Ur, ToolRouterSessionFilesMountListOptionsSchema as Ut, ToolRouterMCPServerConfig as V, ToolOptions as Vi, ComposioGenerateURLResponseSchema as Vn, GlobalExecuteToolFn as Vr, ToolRouterSessionFilesMountDownloadOptionsSchema as Vt, ToolRouterSandboxConfig as W, afterExecuteModifier as Wi, ComposioMcpRetrieveResponseSchema as Wn, ToolCallSession as Wr, ToolRouterSessionFilesMountUploadOptions as Wt, ToolRouterSessionEnsureConnectedFn as X, JSONSchemaProperty as Xi, GenerateURLParams as Xn, ConnectionStatuses as Xr, ConnectedAccountAclConfigResponse as Xt, ToolRouterSessionDeleteResponseSchema as Y, CustomAuthParamsSchema as Yi, CustomCreateResponseValidated as Yn, ConnectionStatusEnum as Yr, ConnectedAccountAclConfig as Yt, ToolRouterSessionEnsureConnectedOptions as Z, JSONSchemaPropertySchema as Zi, GenerateURLParamsSchema as Zn, CustomConnectionData as Zr, ConnectedAccountAclConfigResponseSchema as Zt, CustomToolsMapEntry as _, ToolkitLatestVersionSchema as _a, Oauth2ActiveConnectionData as _i, ConnectedAccountStatuses as _n, MCPServerUpdateParams as _r, ToolRouterToolkitsEnabledConfigSchema as _t, CreateCustomToolkitParams as a, ToolExecuteResponseSchema as aa, Oauth1ConnectionData as ai, ConnectedAccountListParams as an, MCPGenerateURLParamsSchema as ar, ToolRouterSessionPreloadConfig as at, RegisteredCustomTool as b, ToolkitVersionParam as ba, Oauth2ConnectionDataSchema as bi, ConnectedAccountTypes as bn, MCPSingleAppServerSchema as br, ToolRouterToolkitsOptionsSchema as bt, CustomToolExecuteFn as c, ToolListParamsSchema as ca, Oauth1ExpiredConnectionDataSchema as ci, ConnectedAccountListResponseItem as cn, MCPInstanceParams as cr, ToolRouterSessionSearchFn as ct, CustomToolWireDefinition as d, ToolProxyParams as da, Oauth1InactiveConnectionData as di, ConnectedAccountRefreshOptionsSchema as dn, MCPServer as dr, ToolRouterSessionUpdateFn as dt, ToolExecuteMetaParams as ea, CustomOauth1ConnectionDataSchema as ei, ConnectedAccountAuthConfigSchema as en, GenerateURLResponseValidated as er, ToolRouterSessionExecuteFn as et, CustomToolkit as f, ToolProxyParamsSchema as fa, Oauth1InactiveConnectionDataSchema as fi, ConnectedAccountRetrieveResponse as fn, MCPServerCreateResponse as fr, ToolRouterSessionWarning as ft, CustomToolsMap as g, ToolkitLatestVersion as ga, Oauth1InitiatingConnectionDataSchema as gi, ConnectedAccountStatusSchema as gn, MCPServerSchema as gr, ToolRouterToolkitsDisabledConfigSchema as gt, CustomToolkitWireDefinition as h, Toolkit as ha, Oauth1InitiatingConnectionData as hi, ConnectedAccountStatusEnum as hn, MCPServerListResponseSchema as hr, ToolRouterTagsParamSchema as ht, CreateCustomToolkitBaseSchema as i, ToolExecuteResponse as ia, Oauth1ActiveConnectionDataSchema as ii, ConnectedAccountExperimentalSchema as in, MCPGenerateURLParams as ir, ToolRouterSessionMetadata as it, SessionProxyExecuteParamsSchema as j, Oauth2RevokedConnectionData as ji, DefaultCreateConnectedAccountParamsSchema as jn, McpServerGetResponse as jr, RemoteFile as jt, SessionPreset as k, Oauth2InitiatingConnectionData as ki, CreateConnectedAccountResponse as kn, McpRetrieveResponseSchema as kr, ToolkitConnectionsDetails as kt, CustomToolResponse as l, ToolListResponse as la, Oauth1FailedConnectionData as li, ConnectedAccountListResponseSchema as ln, MCPMultiAppServer as lr, ToolRouterSessionSearchResponse as lt, CustomToolkitResponse as m, ToolSchema as ma, Oauth1InitiatedConnectionDataSchema as mi, ConnectedAccountStatus as mn, MCPServerListResponse as mr, ToolRouterTagsEnableDisableSchema as mt, CreateCustomToolBaseSchema as n, ToolExecuteParams as na, CustomOauth2ConnectionDataSchema as ni, ConnectedAccountExperimentalResponse as nn, MCPAuthOptionsSchema as nr, ToolRouterSessionExecuteResponse as nt, CustomTool as o, ToolList as oa, Oauth1ConnectionDataSchema as oi, ConnectedAccountListParamsSchema as on, MCPGetServerParams as or, ToolRouterSessionProxyExecuteFn as ot, CustomToolkitDefinition as p, ToolRetrievalOptions as pa, Oauth1InitiatedConnectionData as pi, ConnectedAccountRetrieveResponseSchema as pn, MCPServerCreateResponseSchema as pr, ToolRouterSessionWorkbenchConfig as pt, ToolRouterSessionDeleteFn as q, beforeFileUploadModifier as qi, CustomCreateResponse$1 as qn, ConnectionData as qr, ConnectionRequest as qt, CreateCustomToolParams as r, ToolExecuteParamsSchema as ra, Oauth1ActiveConnectionData as ri, ConnectedAccountExperimentalResponseSchema as rn, MCPCreateMethodResponse as rr, ToolRouterSessionExecuteResponseSchema as rt, CustomToolDefinition as s, ToolListParams as sa, Oauth1ExpiredConnectionData as si, ConnectedAccountListResponse as sn, MCPGetServerParamsSchema as sr, ToolRouterSessionProxyExecuteResponse as st, AnyZodSchema as t, ToolExecuteMetaParamsSchema as ta, CustomOauth2ConnectionData as ti, ConnectedAccountExperimental as tn, MCPAuthOptions as tr, ToolRouterSessionExecuteOptions as tt, CustomToolSlugSchema as u, ToolListResponseSchema as ua, Oauth1FailedConnectionDataSchema as ui, ConnectedAccountRefreshOptions as un, MCPMultiAppServerSchema as ur, ToolRouterSessionSearchResponseSchema as ut, InferZodSchema as v, ToolkitSchema as va, Oauth2ActiveConnectionDataSchema as vi, ConnectedAccountType as vn, MCPServerUpdateParamsSchema as vr, ToolRouterToolkitsFn as vt, MCPServerTypeSchema as w, ToolkitVersionsSchema as wa, Oauth2FailedConnectionDataSchema as wi, CreateConnectedAccountLinkResponseSchema as wn, McpDeleteResponse as wr, ToolRouterToolsParamSchema as wt, RegisteredCustomToolkit as x, ToolkitVersionParamSchema as xa, Oauth2ExpiredConnectionData as xi, CreateConnectedAccountLinkOptions as xn, MCPToolkitConfig as xr, ToolRouterToolkitsParamSchema as xt, InlineCustomToolsWirePayload as y, ToolkitVersion as ya, Oauth2ConnectionData as yi, ConnectedAccountTypeSchema as yn, MCPSingleAppServer as yr, ToolRouterToolkitsOptions as yt, ToolRouterCreateSessionConfig as z, SessionExecuteMetaModifiers as zi, ComposioCustomCreateResponseSchema as zn, ExecuteToolFn as zr, ToolRouterSessionFilesMountDeleteOptionsSchema as zt };
|
|
@@ -19,7 +19,7 @@ const result = await composio.authConfigs.list();
|
|
|
19
19
|
Create a new auth config
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
async create(toolkit: string, options
|
|
22
|
+
async create(toolkit: string, options?: CreateAuthConfigParams, requestOptions?: ComposioRequestOptions): Promise<CreateAuthConfigResponse>
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
**Parameters**
|
|
@@ -27,7 +27,7 @@ async create(toolkit: string, options: CreateAuthConfigParams, requestOptions?:
|
|
|
27
27
|
| Name | Type | Description |
|
|
28
28
|
|------|------|-------------|
|
|
29
29
|
| `toolkit` | `string` | Unique identifier of the toolkit |
|
|
30
|
-
| `options
|
|
30
|
+
| `options?` | `CreateAuthConfigParams` | Options for creating a new auth config |
|
|
31
31
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
32
32
|
|
|
33
33
|
**Returns**
|
|
@@ -53,22 +53,12 @@ const composio = new Composio({
|
|
|
53
53
|
|------|------|-------------|
|
|
54
54
|
| `authConfigs` | `AuthConfigs` | Manage authentication configurations for toolkits |
|
|
55
55
|
| `connectedAccounts` | `ConnectedAccounts` | Manage authenticated connections |
|
|
56
|
-
| `create` | `(userId: string, config: \{ authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string \| ...[]>; experimental?: \{ assistivePrompt?: \{ userTimezone?: string \}; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] \}; manageConnections?: boolean \| \{ callbackUrl?: string; enable?: boolean; waitForConnections?: boolean \}; mcp?: boolean; multiAccount?: \{ enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean \}; preload?: \{ tools?: ...[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: ... \| ... \| ... \| ...[] \| \{ disable?: ...[]; enable?: ...[] \}; toolkits?: string[] \| \{ disable: ...[] \} \| \{ enable: ...[] \}; tools?: Record<string, ...[] \| \{ enable: ... \} \| \{ disable: ... \} \| \{ tags: ... \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \} & \{ mcp: true \}, requestOptions: ComposioRequestOptions) => Promise<Session>` | Creates a new tool router session for a user.
|
|
57
|
-
|
|
58
|
-
should be exposed directly; see `ToolRouterCreateSessionConfig`. |
|
|
59
|
-
| `experimental` | `Experimental` | Experimental SDK methods whose shape may change in future releases.
|
|
60
|
-
Prefer domain-specific mounts (for example
|
|
61
|
-
`composio.connectedAccounts.updateAcl(...)`) when available; this
|
|
62
|
-
namespace keeps compatibility aliases while APIs are experimental.
|
|
63
|
-
Stateless experimental factories (e.g. `experimental_createTool`) stay
|
|
64
|
-
at the top level. |
|
|
56
|
+
| `create` | `(userId: string, config: \{ authConfigs?: Record<string, string>; connectedAccounts?: Record<string, string \| ...[]>; experimental?: \{ assistivePrompt?: \{ userTimezone?: string \}; customToolkits?: CustomToolkit[]; customTools?: CustomTool[] \}; manageConnections?: boolean \| \{ callbackUrl?: string; enable?: boolean; waitForConnections?: boolean \}; mcp?: boolean; multiAccount?: \{ enable: boolean; maxAccountsPerToolkit?: number; requireExplicitSelection?: boolean \}; preload?: \{ tools?: ...[] \| 'all' \}; sandbox?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \}; sessionPreset?: 'direct_tools'; tags?: ... \| ... \| ... \| ...[] \| \{ disable?: ...[]; enable?: ...[] \}; toolkits?: string[] \| \{ disable: ...[] \} \| \{ enable: ...[] \}; tools?: Record<string, ...[] \| \{ enable: ... \} \| \{ disable: ... \} \| \{ tags: ... \}>; workbench?: \{ autoOffloadThreshold?: number; enable: boolean; enableProxyExecution?: boolean; sandboxSize?: 'standard' \| 'medium' \| 'large' \| 'xlarge' \} \} & \{ mcp: true \}, requestOptions: ComposioRequestOptions) => Promise<Session>` | Creates a new tool router session for a user. Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools should be exposed directly; see `ToolRouterCreateSessionConfig`. |
|
|
57
|
+
| `experimental` | `Experimental` | Experimental SDK methods whose shape may change in future releases. Prefer domain-specific mounts (for example `composio.connectedAccounts.updateAcl(...)`) when available; this namespace keeps compatibility aliases while APIs are experimental. Stateless experimental factories (e.g. `experimental_createTool`) stay at the top level. |
|
|
65
58
|
| `files` | `Files` | Upload and download files |
|
|
66
59
|
| `mcp` | `MCP` | Model Context Protocol server management. |
|
|
67
60
|
| `provider` | `TProvider` | The tool provider instance used for wrapping tools in framework-specific formats |
|
|
68
|
-
| `sessions` | `Sessions` | Create and reuse Composio sessions.
|
|
69
|
-
|
|
70
|
-
Prefer `composio.sessions.create(...)` for new code. The top-level
|
|
71
|
-
`composio.create(...)` method is kept as an alias. |
|
|
61
|
+
| `sessions` | `Sessions` | Create and reuse Composio sessions. Prefer `composio.sessions.create(...)` for new code. The top-level `composio.create(...)` method is kept as an alias. |
|
|
72
62
|
| `toolkits` | `Toolkits` | Retrieve toolkit metadata and authorize user connections |
|
|
73
63
|
| `toolRouter` | `ToolRouter` | Legacy alias for `composio.sessions`. |
|
|
74
64
|
| `tools` | `Tools` | List, retrieve, and execute tools |
|
|
@@ -7,6 +7,7 @@ description: "A Composio session — the object returned by `composio.sessions.c
|
|
|
7
7
|
|
|
8
8
|
| Name | Type | Description |
|
|
9
9
|
|------|------|-------------|
|
|
10
|
+
| `config` | `Config` | Server-side session configuration (toolkit/tool allowlists, tags, preload, sandbox, manage_connections) as returned by the API. Refreshed in place by `update()`. |
|
|
10
11
|
| `configVersion` | `number` | |
|
|
11
12
|
| `experimental` | `SessionExperimental` | |
|
|
12
13
|
| `mcp` | `\{ headers?: Record<string, string>; type: 'http' \| 'sse'; url: string \}` | Hosted MCP endpoint (`session.mcp.url` / `session.mcp.headers`). Exists on every session at runtime, but only surfaced in the type when the session is created with `\{ mcp: true \}` (which returns `Session`); the default `SessionWithoutMcp` omits `mcp`, so MCP is an explicit opt-in. See https://docs.composio.dev/docs/sessions-via-mcp |
|
|
@@ -110,6 +111,47 @@ async delete(requestOptions?: ComposioRequestOptions): Promise<ToolRouterSession
|
|
|
110
111
|
|
|
111
112
|
---
|
|
112
113
|
|
|
114
|
+
### ensureConnected()
|
|
115
|
+
|
|
116
|
+
Ensure a toolkit has an active connection in this session, reconciling
|
|
117
|
+
`authorize()`/`session.link` with the session's active connection state.
|
|
118
|
+
|
|
119
|
+
If the session already resolves an ACTIVE connection (or the toolkit is
|
|
120
|
+
no-auth), this returns immediately without creating a link — unlike
|
|
121
|
+
`authorize()`, which always starts a new link flow, even when one is
|
|
122
|
+
already connected. Otherwise it starts the authorization flow and waits
|
|
123
|
+
for the new connection to become ACTIVE.
|
|
124
|
+
|
|
125
|
+
For interactive flows that should surface the redirect URL instead of
|
|
126
|
+
blocking, use `authorize()` and its `waitForConnection()` directly.
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
async ensureConnected(toolkit: string, options?: ToolRouterSessionEnsureConnectedOptions, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionEnsureConnectedResult>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Parameters**
|
|
133
|
+
|
|
134
|
+
| Name | Type | Description |
|
|
135
|
+
|------|------|-------------|
|
|
136
|
+
| `toolkit` | `string` | The toolkit slug to ensure a connection for (e.g. 'github') |
|
|
137
|
+
| `options?` | `ToolRouterSessionEnsureConnectedOptions` | Optional authorization options plus `timeout` (ms to wait for a newly-initiated connection, default 60000) |
|
|
138
|
+
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
139
|
+
|
|
140
|
+
**Returns**
|
|
141
|
+
|
|
142
|
+
`Promise<ToolRouterSessionEnsureConnectedResult>` — The toolkit's canonical slug, whether it was already connected,
|
|
143
|
+
and the active connected account (omitted for no-auth toolkits)
|
|
144
|
+
|
|
145
|
+
**Example**
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
const session = await composio.sessions.create({ toolkits: ['github'] });
|
|
149
|
+
const { wasConnected, connectedAccount } = await session.ensureConnected('github');
|
|
150
|
+
if (!wasConnected) console.log('Newly linked:', connectedAccount?.id);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
113
155
|
### execute()
|
|
114
156
|
|
|
115
157
|
Execute a tool within the session.
|
|
@@ -233,10 +275,11 @@ async tools(modifiers?: SessionMetaToolOptions, requestOptions?: ComposioRequest
|
|
|
233
275
|
|
|
234
276
|
Partially update the session configuration.
|
|
235
277
|
Only the fields provided will be changed; omitted fields are preserved.
|
|
236
|
-
Mutates this session's `configVersion`, `preload`,
|
|
278
|
+
Mutates this session's `config`, `configVersion`, `preload`, `sandbox`,
|
|
279
|
+
and `warnings` in-place, and resolves to the updated session `config`.
|
|
237
280
|
|
|
238
281
|
```typescript
|
|
239
|
-
async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<
|
|
282
|
+
async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionConfig>
|
|
240
283
|
```
|
|
241
284
|
|
|
242
285
|
**Parameters**
|
|
@@ -248,6 +291,6 @@ async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioReq
|
|
|
248
291
|
|
|
249
292
|
**Returns**
|
|
250
293
|
|
|
251
|
-
`Promise<
|
|
294
|
+
`Promise<ToolRouterSessionConfig>`
|
|
252
295
|
|
|
253
296
|
---
|
|
@@ -98,7 +98,7 @@ console.log(githubToolkit.authConfigDetails); // Authentication configuration de
|
|
|
98
98
|
Retrieves the fields required for creating an auth config for a toolkit.
|
|
99
99
|
|
|
100
100
|
```typescript
|
|
101
|
-
async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options
|
|
101
|
+
async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
**Parameters**
|
|
@@ -107,7 +107,7 @@ async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeTyp
|
|
|
107
107
|
|------|------|-------------|
|
|
108
108
|
| `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
|
|
109
109
|
| `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
|
|
110
|
-
| `options
|
|
110
|
+
| `options?` | `\{ requiredOnly?: boolean \}` | |
|
|
111
111
|
|
|
112
112
|
**Returns**
|
|
113
113
|
|
|
@@ -120,7 +120,7 @@ async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeTyp
|
|
|
120
120
|
Retrieves the fields required for initiating a connected account for a toolkit.
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
|
-
async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options
|
|
123
|
+
async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
**Parameters**
|
|
@@ -129,7 +129,7 @@ async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthS
|
|
|
129
129
|
|------|------|-------------|
|
|
130
130
|
| `toolkitSlug` | `string` | The slug of the toolkit to retrieve the fields for |
|
|
131
131
|
| `authScheme` | `AuthSchemeType` | The auth scheme to retrieve the fields for |
|
|
132
|
-
| `options
|
|
132
|
+
| `options?` | `\{ requiredOnly?: boolean \}` | |
|
|
133
133
|
|
|
134
134
|
**Returns**
|
|
135
135
|
|
|
@@ -44,6 +44,10 @@ async execute(slug: string, body: ToolExecuteParams, options?: ExecuteToolModifi
|
|
|
44
44
|
**Example**
|
|
45
45
|
|
|
46
46
|
```typescript
|
|
47
|
+
// Look up the tool's current version once, then pin that string in your code or config
|
|
48
|
+
const { version } = await composio.tools.getRawComposioToolBySlug('GITHUB_GET_REPOS');
|
|
49
|
+
console.log(version); // e.g. '20250909_00'
|
|
50
|
+
|
|
47
51
|
const result = await composio.tools.execute('GITHUB_GET_REPOS', {
|
|
48
52
|
userId: 'default',
|
|
49
53
|
version: '20250909_00',
|
|
@@ -180,9 +184,10 @@ const emailTools = await composio.tools.get('default', {
|
|
|
180
184
|
|
|
181
185
|
### getInput()
|
|
182
186
|
|
|
183
|
-
|
|
187
|
+
Generates arguments for a tool from a natural-language description of the task.
|
|
184
188
|
|
|
185
|
-
|
|
189
|
+
Composio uses an LLM to fill the tool's input parameters from `text`. Review the
|
|
190
|
+
generated arguments before passing them to `tools.execute()`.
|
|
186
191
|
|
|
187
192
|
```typescript
|
|
188
193
|
async getInput(slug: string, body: ToolGetInputParams, requestOptions?: ComposioRequestOptions): Promise<ToolGetInputResponse>
|
|
@@ -192,22 +197,23 @@ async getInput(slug: string, body: ToolGetInputParams, requestOptions?: Composio
|
|
|
192
197
|
|
|
193
198
|
| Name | Type | Description |
|
|
194
199
|
|------|------|-------------|
|
|
195
|
-
| `slug` | `string` | The
|
|
196
|
-
| `body` | `ToolGetInputParams` | The
|
|
200
|
+
| `slug` | `string` | The slug of the tool to generate arguments for |
|
|
201
|
+
| `body` | `ToolGetInputParams` | The generation request |
|
|
197
202
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
198
203
|
|
|
199
204
|
**Returns**
|
|
200
205
|
|
|
201
|
-
`Promise<ToolGetInputResponse>` — The
|
|
206
|
+
`Promise<ToolGetInputResponse>` — The generated `arguments`, or an `error` when generation fails
|
|
202
207
|
|
|
203
208
|
**Example**
|
|
204
209
|
|
|
205
210
|
```typescript
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
const { arguments: args, error } = await composio.tools.getInput('GITHUB_CREATE_ISSUE', {
|
|
212
|
+
text: 'Open an issue in composiohq/composio titled "Docs typo" describing the broken link',
|
|
213
|
+
version: '20250909_00',
|
|
209
214
|
});
|
|
210
|
-
|
|
215
|
+
if (error) throw new Error(error);
|
|
216
|
+
console.log(args); // { owner: 'composiohq', repo: 'composio', title: 'Docs typo', ... }
|
|
211
217
|
```
|
|
212
218
|
|
|
213
219
|
---
|
|
@@ -415,10 +421,16 @@ console.log(toolsEnum.items);
|
|
|
415
421
|
|
|
416
422
|
### proxyExecute()
|
|
417
423
|
|
|
418
|
-
|
|
424
|
+
Sends an HTTP request to a toolkit's API, authenticated as a connected account.
|
|
425
|
+
|
|
426
|
+
Use it to call an endpoint that no predefined tool covers. Composio injects the
|
|
427
|
+
connected account's credentials on the server side.
|
|
419
428
|
|
|
420
|
-
|
|
421
|
-
|
|
429
|
+
A relative `endpoint` is appended to the toolkit's base URL, and that base URL can
|
|
430
|
+
already include a path. Google Calendar's base URL is
|
|
431
|
+
`https://www.googleapis.com/calendar/v3`, so pass `/users/me/calendarList`, not
|
|
432
|
+
`/calendar/v3/users/me/calendarList` (which resolves to `/calendar/v3/calendar/v3/...`
|
|
433
|
+
and returns a 404 from Google). An absolute URL on the same domain is sent as-is.
|
|
422
434
|
|
|
423
435
|
```typescript
|
|
424
436
|
async proxyExecute(body: ToolProxyParams, requestOptions?: ComposioRequestOptions): Promise<ToolProxyResponse>
|
|
@@ -428,26 +440,24 @@ async proxyExecute(body: ToolProxyParams, requestOptions?: ComposioRequestOption
|
|
|
428
440
|
|
|
429
441
|
| Name | Type | Description |
|
|
430
442
|
|------|------|-------------|
|
|
431
|
-
| `body` | `ToolProxyParams` | The
|
|
443
|
+
| `body` | `ToolProxyParams` | The proxy request |
|
|
432
444
|
| `requestOptions?` | `ComposioRequestOptions` | |
|
|
433
445
|
|
|
434
446
|
**Returns**
|
|
435
447
|
|
|
436
|
-
`Promise<ToolProxyResponse>` — The
|
|
448
|
+
`Promise<ToolProxyResponse>` — The upstream status, headers, and parsed body
|
|
437
449
|
|
|
438
450
|
**Example**
|
|
439
451
|
|
|
440
452
|
```typescript
|
|
441
|
-
//
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
method: 'GET'
|
|
448
|
-
}
|
|
453
|
+
// Google Calendar's base URL is https://www.googleapis.com/calendar/v3
|
|
454
|
+
const { status, data } = await composio.tools.proxyExecute({
|
|
455
|
+
endpoint: '/users/me/calendarList',
|
|
456
|
+
method: 'GET',
|
|
457
|
+
connectedAccountId: 'ca_...',
|
|
458
|
+
parameters: [{ in: 'query', name: 'maxResults', value: 10 }],
|
|
449
459
|
});
|
|
450
|
-
console.log(
|
|
460
|
+
console.log(status, data);
|
|
451
461
|
```
|
|
452
462
|
|
|
453
463
|
---
|
|
@@ -311,7 +311,7 @@ await composio.triggers.setWebhookSubscription({
|
|
|
311
311
|
Subscribe to all the triggers
|
|
312
312
|
|
|
313
313
|
```typescript
|
|
314
|
-
async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters:
|
|
314
|
+
async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters?: TriggerSubscribeParams, onSubscriptionError?: (data: Record<string, unknown>) => void): Promise<void>
|
|
315
315
|
```
|
|
316
316
|
|
|
317
317
|
**Parameters**
|
|
@@ -319,7 +319,8 @@ async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters: TriggerSub
|
|
|
319
319
|
| Name | Type | Description |
|
|
320
320
|
|------|------|-------------|
|
|
321
321
|
| `fn` | `(_data: IncomingTriggerPayload) => void` | The function to call when a trigger is received |
|
|
322
|
-
| `filters
|
|
322
|
+
| `filters?` | `TriggerSubscribeParams` | The filters to apply to the triggers |
|
|
323
|
+
| `onSubscriptionError?` | `(data: Record<string, unknown>) => void` | Optional callback invoked with the raw Pusher payload when the underlying subscription fails (for example on auth or permission rejection). The subscribe promise still resolves; this is the only programmatic signal of the failure. Errors thrown from — or promises rejected by — the callback are contained and logged. |
|
|
323
324
|
|
|
324
325
|
**Returns**
|
|
325
326
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as ComposioError$1 } from "./SsrfErrors-
|
|
2
|
-
import "./FileModifierErrors-
|
|
1
|
+
import { r as ComposioError$1 } from "./SsrfErrors-C91YhASE.mjs";
|
|
2
|
+
import "./FileModifierErrors-BqFmpRsm.mjs";
|
|
3
3
|
import { APIError, APIUserAbortError } from "@composio/client";
|
|
4
4
|
import { ZodError } from "zod/v3";
|
|
5
5
|
|
|
@@ -168,6 +168,7 @@ var ConnectionRequestFailedError = class extends ComposioError$1 {
|
|
|
168
168
|
const ToolErrorCodes = {
|
|
169
169
|
TOOLSET_NOT_DEFINED: "TOOLSET_NOT_DEFINED",
|
|
170
170
|
TOOL_NOT_FOUND: "TOOL_NOT_FOUND",
|
|
171
|
+
TOOL_FETCH_ERROR: "TOOL_FETCH_ERROR",
|
|
171
172
|
INVALID_MODIFIER: "INVALID_MODIFIER",
|
|
172
173
|
TOOL_EXECUTION_ERROR: "TOOL_EXECUTION_ERROR",
|
|
173
174
|
INVALID_TOOL_ARGUMENTS: "INVALID_TOOL_ARGUMENTS",
|
|
@@ -195,6 +196,25 @@ var ComposioToolNotFoundError = class extends ComposioError$1 {
|
|
|
195
196
|
this.name = "ComposioToolNotFoundError";
|
|
196
197
|
}
|
|
197
198
|
};
|
|
199
|
+
/**
|
|
200
|
+
* Error thrown when a tool schema could not be fetched for a reason other than
|
|
201
|
+
* the tool not existing (for example an invalid API key, a server error, or a
|
|
202
|
+
* network failure). The underlying client error is preserved as `cause`.
|
|
203
|
+
*/
|
|
204
|
+
var ComposioToolFetchError = class extends ComposioError$1 {
|
|
205
|
+
constructor(message = "Failed to fetch tool", options = {}) {
|
|
206
|
+
super(message, {
|
|
207
|
+
...options,
|
|
208
|
+
code: ToolErrorCodes.TOOL_FETCH_ERROR,
|
|
209
|
+
possibleFixes: options.possibleFixes || [
|
|
210
|
+
"Ensure the tool slug is valid",
|
|
211
|
+
"Ensure you are using the correct API key",
|
|
212
|
+
"Ensure you are using the correct API endpoint / Base URL and it is working"
|
|
213
|
+
]
|
|
214
|
+
});
|
|
215
|
+
this.name = "ComposioToolFetchError";
|
|
216
|
+
}
|
|
217
|
+
};
|
|
198
218
|
var ComposioInvalidModifierError = class extends ComposioError$1 {
|
|
199
219
|
constructor(message = "Invalid modifier", options = {}) {
|
|
200
220
|
super(message, {
|
|
@@ -618,4 +638,4 @@ var RemoteFileDownloadError = class extends ComposioError$1 {
|
|
|
618
638
|
};
|
|
619
639
|
|
|
620
640
|
//#endregion
|
|
621
|
-
export {
|
|
641
|
+
export { ComposioToolVersionRequiredError as A, ComposioMultipleConnectedAccountsError as B, ComposioInvalidExecuteFunctionError as C, ComposioToolExecutionError as D, ComposioProviderNotDefinedError as E, ConnectionRequestTimeoutError as F, ComposioAuthConfigNotFoundError as G, ComposioSharedConnectionNotAccessibleError as H, ComposioAclOnlyForSharedError as I, ComposioConnectedAccountNotFoundError as L, handleToolExecutionError as M, ConnectionRequestErrorCodes as N, ComposioToolFetchError as O, ConnectionRequestFailedError as P, ComposioFailedToCreateConnectedAccountLink as R, ComposioGlobalExecuteToolFnNotSetError as S, ComposioInvalidToolArgumentsError as T, ConnectedAccountErrorCodes as U, ComposioSharedAccessDeniedError as V, AuthConfigErrorCodes as W, ValidationError as _, ComposioFailedToSubscribeToPusherChannelError as a, ComposioToolkitNotFoundError as b, ComposioWebhookPayloadError as c, ComposioNoAPIKeyError as d, ComposioRequestCancelledError as f, JsonSchemaToZodError as g, JsonSchemaRefResolutionError as h, ComposioFailedToGetSDKRealtimeCredentialsError as i, ToolErrorCodes as j, ComposioToolNotFoundError as k, ComposioWebhookSignatureVerificationError as l, isRequestAbortError as m, RemoteFileErrorCodes as n, ComposioFailedToUnsubscribeFromPusherChannelError as o, SDKErrorCodes as p, ComposioFailedToCreatePusherClientError as r, ComposioTriggerTypeNotFoundError as s, RemoteFileDownloadError as t, TriggerErrorCodes as u, ValidationErrorCodes as v, ComposioInvalidModifierError as w, ToolkitErrorCodes as x, ComposioToolkitFetchError as y, ComposioLegacyConnectedAccountsEndpointRetiredError as z };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as SessionContext, a as CreateCustomToolkitParams, c as CustomToolExecuteFn, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams } from "../customTool.types-
|
|
2
|
-
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-
|
|
1
|
+
import { S as SessionContext, a as CreateCustomToolkitParams, c as CustomToolExecuteFn, f as CustomToolkit, o as CustomTool, r as CreateCustomToolParams } from "../customTool.types-BAmEh3MB.mjs";
|
|
2
|
+
import { n as createCustomToolkit, t as createCustomTool } from "../CustomTool-CB5vm1Jc.mjs";
|
|
3
3
|
export { type CreateCustomToolParams, type CreateCustomToolkitParams, type CustomTool, type CustomToolExecuteFn, type CustomToolkit, type SessionContext, createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-
|
|
1
|
+
import { a as createCustomToolkit, i as createCustomTool } from "../CustomTool-BMlZfJVz.mjs";
|
|
2
2
|
|
|
3
3
|
export { createCustomTool as experimental_createTool, createCustomToolkit as experimental_createToolkit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as TEMP_FILES_DIRECTORY_NAME, i as logger, o as COMPOSIO_DIR } from "./SsrfErrors-
|
|
2
|
-
import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-
|
|
3
|
-
import {
|
|
4
|
-
import { r as ssrfSafeFetch } from "./ssrfGuard.node-
|
|
1
|
+
import { d as TEMP_FILES_DIRECTORY_NAME, i as logger, o as COMPOSIO_DIR } from "./SsrfErrors-C91YhASE.mjs";
|
|
2
|
+
import { i as ComposioFileUploadPathNotAllowedError, t as ComposioFileNotFoundError } from "./FileModifierErrors-BqFmpRsm.mjs";
|
|
3
|
+
import { a as readResponseBodyWithLimit, c as uint8ArrayToBase64, l as getRandomShortId, n as assertSafeFileUploadPath, s as base64ToUint8Array } from "./sensitiveFileUploadPaths-B6pBt9lO.mjs";
|
|
4
|
+
import { r as ssrfSafeFetch } from "./ssrfGuard.node-B9xQB4za.mjs";
|
|
5
5
|
import { platform } from "#platform";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
@@ -302,8 +302,10 @@ const readFile = async (file, signal) => {
|
|
|
302
302
|
content: uint8ArrayToBase64(new Uint8Array(content)),
|
|
303
303
|
mimeType: file.type
|
|
304
304
|
};
|
|
305
|
-
} else if (typeof file === "string")
|
|
306
|
-
|
|
305
|
+
} else if (typeof file === "string") {
|
|
306
|
+
if (isHttpUrl(file)) return await readFileContentFromURL(file, signal);
|
|
307
|
+
else return await readFileContent(file);
|
|
308
|
+
}
|
|
307
309
|
throw new Error("Invalid file type");
|
|
308
310
|
};
|
|
309
311
|
const getFileDataAfterUploadingToS3 = async (file, { toolSlug, toolkitSlug, client, sensitiveFileUploadProtection, fileUploadPathDenySegments, fileUploadAllowlist, signal }) => {
|