@composio/core 0.18.0 → 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-C4tv-GL1.mjs → CustomTool-BMlZfJVz.mjs} +16 -6
- package/dist/{CustomTool-BKhHv2hJ.d.mts → CustomTool-CB5vm1Jc.d.mts} +1 -1
- package/dist/{FileModifierErrors-B8V8_3VE.mjs → FileModifierErrors-BqFmpRsm.mjs} +1 -1
- package/dist/{FileToolModifier.utils.neutral-D_YkHwZP.mjs → FileToolModifier.utils.neutral-DWFpnsj2.mjs} +4 -2
- package/dist/{SsrfErrors-DNJt57GL.mjs → SsrfErrors-C91YhASE.mjs} +137 -13
- package/dist/{Telemetry-CBtSnWrm.mjs → Telemetry-HlftxMx6.mjs} +2 -34
- package/dist/{cancellation-jUVItfHw.mjs → cancellation-CXpfmiVo.mjs} +7 -5
- package/dist/{composio-CldtZUyC.d.mts → composio-DLGaeN70.d.mts} +333 -32
- package/dist/{customTool.types-DC5fPOOi.d.mts → customTool.types-BAmEh3MB.d.mts} +131 -38
- 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 +50 -6
- 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-DyZt79fi.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-BwpUOF0s.mjs → fileUtils.node-L7XD8UPr.mjs} +11 -9
- package/dist/index.d.mts +164 -104
- package/dist/index.mjs +382 -153
- 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-B0w8dqpv.mjs → sensitiveFileUploadPaths-B6pBt9lO.mjs} +10 -7
- package/dist/{ssrfGuard.node-DlxO8uzr.mjs → ssrfGuard.node-B9xQB4za.mjs} +197 -30
- package/dist/{types-BgsRW-XH.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 +26 -8
- package/src/errors/ToolErrors.ts +24 -0
- package/src/index.ts +4 -0
- package/src/models/CustomTool.ts +41 -6
- package/src/models/MCP.ts +29 -15
- package/src/models/RemoteFile.ts +54 -36
- package/src/models/ToolRouter.ts +1 -0
- package/src/models/ToolRouterSession.ts +115 -13
- package/src/models/Toolkits.ts +1 -2
- package/src/models/Tools.ts +55 -25
- package/src/models/Triggers.ts +22 -2
- package/src/services/pusher/Pusher.ts +29 -10
- package/src/telemetry/redact.ts +133 -6
- package/src/types/toolRouter.types.ts +54 -3
- package/src/types/toolkit.types.ts +17 -0
- package/src/utils/fileUtils.node.ts +10 -2
- package/src/utils/jsonSchema.ts +4 -1
- package/src/utils/logger.ts +6 -6
- package/src/utils/pinnedDispatcher.node.ts +109 -13
- package/src/utils/sdk.ts +1 -1
- package/src/utils/ssrfGuard.node.ts +153 -27
- package/src/utils/ssrfGuard.workerd.ts +15 -1
- package/src/utils/transformers/toolkits.ts +79 -2
|
@@ -30267,6 +30267,8 @@ declare class RemoteFile {
|
|
|
30267
30267
|
static parse(data: unknown): RemoteFile;
|
|
30268
30268
|
/** Filename extracted from the mount path (e.g. "report.pdf" from "output/report.pdf") */
|
|
30269
30269
|
get filename(): string;
|
|
30270
|
+
private downloadError;
|
|
30271
|
+
private downloadBytes;
|
|
30270
30272
|
/**
|
|
30271
30273
|
* Fetches the file content as a buffer.
|
|
30272
30274
|
* @returns The file content as a Uint8Array
|
|
@@ -30788,9 +30790,12 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30788
30790
|
} | {
|
|
30789
30791
|
enable: string[];
|
|
30790
30792
|
} | undefined;
|
|
30791
|
-
|
|
30793
|
+
preload?: {
|
|
30794
|
+
tools?: string[] | "all" | undefined;
|
|
30795
|
+
} | undefined;
|
|
30792
30796
|
sessionPreset?: "direct_tools" | undefined;
|
|
30793
30797
|
mcp?: boolean | undefined;
|
|
30798
|
+
authConfigs?: Record<string, string> | undefined;
|
|
30794
30799
|
connectedAccounts?: Record<string, string | string[]> | undefined;
|
|
30795
30800
|
manageConnections?: boolean | {
|
|
30796
30801
|
enable?: boolean | undefined;
|
|
@@ -30814,9 +30819,6 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30814
30819
|
maxAccountsPerToolkit?: number | undefined;
|
|
30815
30820
|
requireExplicitSelection?: boolean | undefined;
|
|
30816
30821
|
} | undefined;
|
|
30817
|
-
preload?: {
|
|
30818
|
-
tools?: string[] | "all" | undefined;
|
|
30819
|
-
} | undefined;
|
|
30820
30822
|
experimental?: {
|
|
30821
30823
|
assistivePrompt?: {
|
|
30822
30824
|
userTimezone?: string | undefined;
|
|
@@ -30844,9 +30846,12 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30844
30846
|
} | {
|
|
30845
30847
|
enable: string[];
|
|
30846
30848
|
} | undefined;
|
|
30847
|
-
|
|
30849
|
+
preload?: {
|
|
30850
|
+
tools?: string[] | "all" | undefined;
|
|
30851
|
+
} | undefined;
|
|
30848
30852
|
sessionPreset?: "direct_tools" | undefined;
|
|
30849
30853
|
mcp?: boolean | undefined;
|
|
30854
|
+
authConfigs?: Record<string, string> | undefined;
|
|
30850
30855
|
connectedAccounts?: Record<string, string | string[]> | undefined;
|
|
30851
30856
|
manageConnections?: boolean | {
|
|
30852
30857
|
enable?: boolean | undefined;
|
|
@@ -30870,9 +30875,6 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30870
30875
|
maxAccountsPerToolkit?: number | undefined;
|
|
30871
30876
|
requireExplicitSelection?: boolean | undefined;
|
|
30872
30877
|
} | undefined;
|
|
30873
|
-
preload?: {
|
|
30874
|
-
tools?: string[] | "all" | undefined;
|
|
30875
|
-
} | undefined;
|
|
30876
30878
|
experimental?: {
|
|
30877
30879
|
assistivePrompt?: {
|
|
30878
30880
|
userTimezone?: string | undefined;
|
|
@@ -30900,9 +30902,12 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30900
30902
|
} | {
|
|
30901
30903
|
enable: string[];
|
|
30902
30904
|
} | undefined;
|
|
30903
|
-
|
|
30905
|
+
preload?: {
|
|
30906
|
+
tools?: string[] | "all" | undefined;
|
|
30907
|
+
} | undefined;
|
|
30904
30908
|
sessionPreset?: "direct_tools" | undefined;
|
|
30905
30909
|
mcp?: boolean | undefined;
|
|
30910
|
+
authConfigs?: Record<string, string> | undefined;
|
|
30906
30911
|
connectedAccounts?: Record<string, string | string[]> | undefined;
|
|
30907
30912
|
manageConnections?: boolean | {
|
|
30908
30913
|
enable?: boolean | undefined;
|
|
@@ -30926,9 +30931,6 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30926
30931
|
maxAccountsPerToolkit?: number | undefined;
|
|
30927
30932
|
requireExplicitSelection?: boolean | undefined;
|
|
30928
30933
|
} | undefined;
|
|
30929
|
-
preload?: {
|
|
30930
|
-
tools?: string[] | "all" | undefined;
|
|
30931
|
-
} | undefined;
|
|
30932
30934
|
experimental?: {
|
|
30933
30935
|
assistivePrompt?: {
|
|
30934
30936
|
userTimezone?: string | undefined;
|
|
@@ -30956,9 +30958,12 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30956
30958
|
} | {
|
|
30957
30959
|
enable: string[];
|
|
30958
30960
|
} | undefined;
|
|
30959
|
-
|
|
30961
|
+
preload?: {
|
|
30962
|
+
tools?: string[] | "all" | undefined;
|
|
30963
|
+
} | undefined;
|
|
30960
30964
|
sessionPreset?: "direct_tools" | undefined;
|
|
30961
30965
|
mcp?: boolean | undefined;
|
|
30966
|
+
authConfigs?: Record<string, string> | undefined;
|
|
30962
30967
|
connectedAccounts?: Record<string, string | string[]> | undefined;
|
|
30963
30968
|
manageConnections?: boolean | {
|
|
30964
30969
|
enable?: boolean | undefined;
|
|
@@ -30982,9 +30987,6 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
30982
30987
|
maxAccountsPerToolkit?: number | undefined;
|
|
30983
30988
|
requireExplicitSelection?: boolean | undefined;
|
|
30984
30989
|
} | undefined;
|
|
30985
|
-
preload?: {
|
|
30986
|
-
tools?: string[] | "all" | undefined;
|
|
30987
|
-
} | undefined;
|
|
30988
30990
|
experimental?: {
|
|
30989
30991
|
assistivePrompt?: {
|
|
30990
30992
|
userTimezone?: string | undefined;
|
|
@@ -31012,9 +31014,12 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
31012
31014
|
} | {
|
|
31013
31015
|
enable: string[];
|
|
31014
31016
|
} | undefined;
|
|
31015
|
-
|
|
31017
|
+
preload?: {
|
|
31018
|
+
tools?: string[] | "all" | undefined;
|
|
31019
|
+
} | undefined;
|
|
31016
31020
|
sessionPreset?: "direct_tools" | undefined;
|
|
31017
31021
|
mcp?: boolean | undefined;
|
|
31022
|
+
authConfigs?: Record<string, string> | undefined;
|
|
31018
31023
|
connectedAccounts?: Record<string, string | string[]> | undefined;
|
|
31019
31024
|
manageConnections?: boolean | {
|
|
31020
31025
|
enable?: boolean | undefined;
|
|
@@ -31038,9 +31043,6 @@ declare const ToolRouterCreateSessionConfigSchema: z.ZodEffects<z.ZodEffects<z.Z
|
|
|
31038
31043
|
maxAccountsPerToolkit?: number | undefined;
|
|
31039
31044
|
requireExplicitSelection?: boolean | undefined;
|
|
31040
31045
|
} | undefined;
|
|
31041
|
-
preload?: {
|
|
31042
|
-
tools?: string[] | "all" | undefined;
|
|
31043
|
-
} | undefined;
|
|
31044
31046
|
experimental?: {
|
|
31045
31047
|
assistivePrompt?: {
|
|
31046
31048
|
userTimezone?: string | undefined;
|
|
@@ -31671,7 +31673,9 @@ type ToolRouterSessionSearchFn = (params: {
|
|
|
31671
31673
|
type ToolRouterSessionExecuteFn = (toolSlug: string, arguments_?: Record<string, unknown>, options?: ToolRouterSessionExecuteOptions) => Promise<ToolRouterSessionExecuteResponse>;
|
|
31672
31674
|
interface ToolRouterSessionExecuteOptions {
|
|
31673
31675
|
/**
|
|
31674
|
-
* 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.
|
|
31675
31679
|
* Meta/helper tools either ignore this top-level field or define
|
|
31676
31680
|
* their own account-selection fields, for example
|
|
31677
31681
|
* COMPOSIO_MULTI_EXECUTE_TOOL.tools[].account.
|
|
@@ -31681,7 +31685,15 @@ interface ToolRouterSessionExecuteOptions {
|
|
|
31681
31685
|
type ToolRouterSessionPreloadConfig = SessionCreateResponse.Config.Preload;
|
|
31682
31686
|
type ToolRouterSessionWorkbenchConfig = SessionCreateResponse.Config.Workbench;
|
|
31683
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;
|
|
31684
31694
|
interface ToolRouterSessionMetadata {
|
|
31695
|
+
/** Present on every session built from an API response; the constructor synthesises a minimal config when absent. */
|
|
31696
|
+
config?: ToolRouterSessionConfig;
|
|
31685
31697
|
preload?: ToolRouterSessionPreloadConfig;
|
|
31686
31698
|
workbench?: ToolRouterSessionWorkbenchConfig;
|
|
31687
31699
|
configVersion?: number;
|
|
@@ -31898,6 +31910,9 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
31898
31910
|
} | {
|
|
31899
31911
|
enable: string[];
|
|
31900
31912
|
} | undefined;
|
|
31913
|
+
preload?: {
|
|
31914
|
+
tools?: string[] | "all" | undefined;
|
|
31915
|
+
} | undefined;
|
|
31901
31916
|
authConfigs?: Record<string, string> | undefined;
|
|
31902
31917
|
connectedAccounts?: Record<string, string[]> | undefined;
|
|
31903
31918
|
manageConnections?: boolean | {
|
|
@@ -31922,9 +31937,6 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
31922
31937
|
maxAccountsPerToolkit?: number | undefined;
|
|
31923
31938
|
requireExplicitSelection?: boolean | undefined;
|
|
31924
31939
|
} | null | undefined;
|
|
31925
|
-
preload?: {
|
|
31926
|
-
tools?: string[] | "all" | undefined;
|
|
31927
|
-
} | undefined;
|
|
31928
31940
|
}, {
|
|
31929
31941
|
tags?: ("readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint")[] | {
|
|
31930
31942
|
disable?: ("readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint")[] | undefined;
|
|
@@ -31945,6 +31957,9 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
31945
31957
|
} | {
|
|
31946
31958
|
enable: string[];
|
|
31947
31959
|
} | undefined;
|
|
31960
|
+
preload?: {
|
|
31961
|
+
tools?: string[] | "all" | undefined;
|
|
31962
|
+
} | undefined;
|
|
31948
31963
|
authConfigs?: Record<string, string> | undefined;
|
|
31949
31964
|
connectedAccounts?: Record<string, string | string[]> | undefined;
|
|
31950
31965
|
manageConnections?: boolean | {
|
|
@@ -31969,9 +31984,6 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
31969
31984
|
maxAccountsPerToolkit?: number | undefined;
|
|
31970
31985
|
requireExplicitSelection?: boolean | undefined;
|
|
31971
31986
|
} | null | undefined;
|
|
31972
|
-
preload?: {
|
|
31973
|
-
tools?: string[] | "all" | undefined;
|
|
31974
|
-
} | undefined;
|
|
31975
31987
|
}>, {
|
|
31976
31988
|
tags?: ("readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint")[] | {
|
|
31977
31989
|
disable?: ("readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint")[] | undefined;
|
|
@@ -31992,6 +32004,9 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
31992
32004
|
} | {
|
|
31993
32005
|
enable: string[];
|
|
31994
32006
|
} | undefined;
|
|
32007
|
+
preload?: {
|
|
32008
|
+
tools?: string[] | "all" | undefined;
|
|
32009
|
+
} | undefined;
|
|
31995
32010
|
authConfigs?: Record<string, string> | undefined;
|
|
31996
32011
|
connectedAccounts?: Record<string, string[]> | undefined;
|
|
31997
32012
|
manageConnections?: boolean | {
|
|
@@ -32016,9 +32031,6 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
32016
32031
|
maxAccountsPerToolkit?: number | undefined;
|
|
32017
32032
|
requireExplicitSelection?: boolean | undefined;
|
|
32018
32033
|
} | null | undefined;
|
|
32019
|
-
preload?: {
|
|
32020
|
-
tools?: string[] | "all" | undefined;
|
|
32021
|
-
} | undefined;
|
|
32022
32034
|
}, {
|
|
32023
32035
|
tags?: ("readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint")[] | {
|
|
32024
32036
|
disable?: ("readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint")[] | undefined;
|
|
@@ -32039,6 +32051,9 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
32039
32051
|
} | {
|
|
32040
32052
|
enable: string[];
|
|
32041
32053
|
} | undefined;
|
|
32054
|
+
preload?: {
|
|
32055
|
+
tools?: string[] | "all" | undefined;
|
|
32056
|
+
} | undefined;
|
|
32042
32057
|
authConfigs?: Record<string, string> | undefined;
|
|
32043
32058
|
connectedAccounts?: Record<string, string | string[]> | undefined;
|
|
32044
32059
|
manageConnections?: boolean | {
|
|
@@ -32063,12 +32078,9 @@ declare const ToolRouterUpdateSessionConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
32063
32078
|
maxAccountsPerToolkit?: number | undefined;
|
|
32064
32079
|
requireExplicitSelection?: boolean | undefined;
|
|
32065
32080
|
} | null | undefined;
|
|
32066
|
-
preload?: {
|
|
32067
|
-
tools?: string[] | "all" | undefined;
|
|
32068
|
-
} | undefined;
|
|
32069
32081
|
}>;
|
|
32070
32082
|
type ToolRouterUpdateSessionConfig = z.infer<typeof ToolRouterUpdateSessionConfigSchema>;
|
|
32071
|
-
type ToolRouterSessionUpdateFn = (config: ToolRouterUpdateSessionConfig) => Promise<
|
|
32083
|
+
type ToolRouterSessionUpdateFn = (config: ToolRouterUpdateSessionConfig) => Promise<ToolRouterSessionConfig>;
|
|
32072
32084
|
declare const ToolRouterSessionDeleteResponseSchema: z.ZodObject<{
|
|
32073
32085
|
sessionId: z.ZodString;
|
|
32074
32086
|
deleted: z.ZodLiteral<true>;
|
|
@@ -32081,10 +32093,89 @@ declare const ToolRouterSessionDeleteResponseSchema: z.ZodObject<{
|
|
|
32081
32093
|
}>;
|
|
32082
32094
|
type ToolRouterSessionDeleteResponse = z.infer<typeof ToolRouterSessionDeleteResponseSchema>;
|
|
32083
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>;
|
|
32084
32169
|
/** Session type returned by ToolRouter.create() and ToolRouter.use() */
|
|
32085
32170
|
interface Session<TToolCollection, TTool, TProvider extends BaseComposioProvider<TToolCollection, TTool, unknown>> {
|
|
32086
32171
|
sessionId: string;
|
|
32087
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;
|
|
32088
32179
|
/** Stored preload configuration for this session. */
|
|
32089
32180
|
preload: ToolRouterSessionPreloadConfig;
|
|
32090
32181
|
/**
|
|
@@ -32105,12 +32196,14 @@ interface Session<TToolCollection, TTool, TProvider extends BaseComposioProvider
|
|
|
32105
32196
|
warnings: ToolRouterSessionWarning[];
|
|
32106
32197
|
tools: ToolRouterToolsFn<TToolCollection, TTool, TProvider>;
|
|
32107
32198
|
authorize: ToolRouterAuthorizeFn;
|
|
32199
|
+
/** Ensure a toolkit has an active connection, linking and waiting only when needed. */
|
|
32200
|
+
ensureConnected: ToolRouterSessionEnsureConnectedFn;
|
|
32108
32201
|
toolkits: ToolRouterToolkitsFn;
|
|
32109
32202
|
/** Search for tools by semantic use case */
|
|
32110
32203
|
search: ToolRouterSessionSearchFn;
|
|
32111
32204
|
/** Execute a tool within the session */
|
|
32112
32205
|
execute: ToolRouterSessionExecuteFn;
|
|
32113
|
-
/** 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`. */
|
|
32114
32207
|
update: ToolRouterSessionUpdateFn;
|
|
32115
32208
|
/** Delete the session. Deleted sessions are no longer retrievable or executable. */
|
|
32116
32209
|
delete: ToolRouterSessionDeleteFn;
|
|
@@ -32193,13 +32286,13 @@ declare const CreateCustomToolBaseSchema: z$1.ZodObject<{
|
|
|
32193
32286
|
}, "strip", z$1.ZodTypeAny, {
|
|
32194
32287
|
name: string;
|
|
32195
32288
|
description: string;
|
|
32196
|
-
preload?: boolean | undefined;
|
|
32197
32289
|
extendsToolkit?: string | undefined;
|
|
32290
|
+
preload?: boolean | undefined;
|
|
32198
32291
|
}, {
|
|
32199
32292
|
name: string;
|
|
32200
32293
|
description: string;
|
|
32201
|
-
preload?: boolean | undefined;
|
|
32202
32294
|
extendsToolkit?: string | undefined;
|
|
32295
|
+
preload?: boolean | undefined;
|
|
32203
32296
|
}>;
|
|
32204
32297
|
/** Options for creating a custom tool via `createCustomTool()`. */
|
|
32205
32298
|
type CreateCustomToolParams<T extends AnyZodSchema> = z$1.infer<typeof CreateCustomToolBaseSchema> & {
|
|
@@ -32330,4 +32423,4 @@ type CustomToolResponse = SessionCreateResponse.Experimental.CustomTool;
|
|
|
32330
32423
|
/** Custom toolkit as returned in the session create response (has prefixed slugs + original_slugs). */
|
|
32331
32424
|
type CustomToolkitResponse = SessionCreateResponse.Experimental.CustomToolkit;
|
|
32332
32425
|
//#endregion
|
|
32333
|
-
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,13 +111,55 @@ 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.
|
|
116
158
|
|
|
117
|
-
For custom tools, accepts the
|
|
118
|
-
|
|
119
|
-
|
|
159
|
+
For custom tools, accepts the full slug (e.g. "LOCAL_GREP") or the
|
|
160
|
+
original slug (e.g. "GREP") when that original slug is unique across
|
|
161
|
+
the session's custom tools and toolkits. Custom tools are executed
|
|
162
|
+
in-process; remote tools are sent to the Composio backend.
|
|
120
163
|
|
|
121
164
|
```typescript
|
|
122
165
|
async execute(toolSlug: string, arguments_?: Record<string, unknown>, options?: ToolRouterSessionExecuteOptions, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionExecuteResponse>
|
|
@@ -232,10 +275,11 @@ async tools(modifiers?: SessionMetaToolOptions, requestOptions?: ComposioRequest
|
|
|
232
275
|
|
|
233
276
|
Partially update the session configuration.
|
|
234
277
|
Only the fields provided will be changed; omitted fields are preserved.
|
|
235
|
-
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`.
|
|
236
280
|
|
|
237
281
|
```typescript
|
|
238
|
-
async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<
|
|
282
|
+
async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionConfig>
|
|
239
283
|
```
|
|
240
284
|
|
|
241
285
|
**Parameters**
|
|
@@ -247,6 +291,6 @@ async update(config: ToolRouterUpdateSessionConfig, requestOptions?: ComposioReq
|
|
|
247
291
|
|
|
248
292
|
**Returns**
|
|
249
293
|
|
|
250
|
-
`Promise<
|
|
294
|
+
`Promise<ToolRouterSessionConfig>`
|
|
251
295
|
|
|
252
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
|
|