@composio/core 0.19.0 → 0.21.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-BMlZfJVz.mjs → CustomTool-B-_VjWpy.mjs} +1 -1
- package/dist/{CustomTool-CB5vm1Jc.d.mts → CustomTool-BHOYxLZX.d.mts} +1 -1
- package/dist/{FileModifierErrors-BqFmpRsm.mjs → FileModifierErrors-CdGSABoq.mjs} +1 -1
- package/dist/{SsrfErrors-C91YhASE.mjs → SsrfErrors-DiQldIdC.mjs} +18 -7
- package/dist/{Telemetry-HlftxMx6.mjs → Telemetry-JRJJYS4I.mjs} +2 -2
- package/dist/{cancellation-CXpfmiVo.mjs → cancellation-DV8CIi52.mjs} +2 -2
- package/dist/{composio-DLGaeN70.d.mts → composio-BTZsFajb.d.mts} +3149 -117
- package/dist/{customTool.types-BAmEh3MB.d.mts → customTool.types-D_w21L56.d.mts} +784 -56
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +10 -10
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +7 -3
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +101 -18
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +123 -0
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +9 -2
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +8 -0
- package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +56 -0
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +78 -0
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +15 -15
- package/dist/docs/reference/sdk-reference/typescript/meta.json +9 -1
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +83 -0
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +10 -10
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +86 -27
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +26 -6
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +149 -12
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +18 -18
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +25 -25
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +78 -0
- package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +162 -0
- package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +218 -0
- package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +20 -0
- package/dist/{errors-BuEKehbI.mjs → errors-Dyiu3ifQ.mjs} +127 -4
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-L7XD8UPr.mjs → fileUtils.node-DNLhLg0W.mjs} +4 -4
- package/dist/index.d.mts +281 -55
- package/dist/index.mjs +3552 -949
- package/dist/models/Files.node.mjs +2 -2
- package/dist/{sensitiveFileUploadPaths-B6pBt9lO.mjs → sensitiveFileUploadPaths-BlLp-Yo2.mjs} +1 -1
- package/dist/{ssrfGuard.node-B9xQB4za.mjs → ssrfGuard.node-BZ270bcu.mjs} +1 -1
- package/dist/{types-CxLPO0Xq.d.mts → types-CgRsUGqm.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.mjs +1 -1
- package/package.json +4 -2
- package/src/composio.ts +215 -10
- package/src/errors/ConnectedAccountsErrors.ts +47 -0
- package/src/errors/SDKErrors.ts +52 -0
- package/src/errors/ToolRouterErrors.ts +61 -0
- package/src/errors/index.ts +3 -0
- package/src/index.ts +13 -0
- package/src/lib/sessionConfigConflict.ts +43 -0
- package/src/lib/toolRouterMcp.ts +132 -0
- package/src/lib/toolRouterParams.ts +149 -37
- package/src/lib/toolRouterSourceSessionConfig.ts +12 -0
- package/src/models/ConnectedAccounts.ts +118 -2
- package/src/models/CustomToolkits.ts +169 -0
- package/src/models/Experimental.ts +27 -0
- package/src/models/Keyring.ts +65 -0
- package/src/models/Logs.ts +101 -0
- package/src/models/RemoteFile.ts +25 -8
- package/src/models/SessionConfigs.ts +117 -0
- package/src/models/ToolRouter.ts +61 -17
- package/src/models/ToolRouterSession.ts +149 -14
- package/src/models/Toolkits.ts +180 -0
- package/src/models/Tools.ts +10 -6
- package/src/models/Triggers.ts +3 -88
- package/src/models/Usage.ts +119 -0
- package/src/models/Webhooks.ts +520 -0
- package/src/services/pusher/Pusher.ts +17 -6
- package/src/types/authConfigs.types.ts +2 -0
- package/src/types/connectedAccounts.types.ts +54 -0
- package/src/types/customToolkits.types.ts +102 -0
- package/src/types/keyring.types.ts +32 -0
- package/src/types/logs.types.ts +108 -0
- package/src/types/sessionConfigs.types.ts +81 -0
- package/src/types/tool.types.ts +2 -0
- package/src/types/toolRouter.types.ts +352 -16
- package/src/types/toolkit.types.ts +144 -0
- package/src/types/usage.types.ts +81 -0
- package/src/types/webhooks.types.ts +143 -0
- package/src/utils/constants.ts +1 -5
- package/src/utils/logger.ts +39 -7
- package/src/utils/safePath.ts +172 -0
- package/src/utils/sdk.ts +385 -22
- package/src/utils/transformers/connectedAccounts.ts +37 -2
- package/src/utils/transformers/customToolkits.ts +98 -0
- package/src/utils/transformers/keyring.ts +24 -0
- package/src/utils/transformers/logs.ts +85 -0
- package/src/utils/transformers/sessionConfigs.ts +54 -0
- package/src/utils/transformers/toolRouterResponseTransform.ts +6 -0
- package/src/utils/transformers/toolkits.ts +106 -3
- package/src/utils/transformers/triggers.ts +2 -2
- package/src/utils/transformers/usage.ts +77 -0
- package/src/utils/transformers/webhooks.ts +139 -0
|
@@ -4,8 +4,11 @@ import { SessionMetaToolOptions } from './modifiers.types';
|
|
|
4
4
|
import { ConnectionRequest } from './connectionRequest.types';
|
|
5
5
|
import type { ComposioRequestOptions } from './requestOptions.types';
|
|
6
6
|
import type { ToolRouterSessionFilesMount } from '../models/ToolRouterSessionFileMount';
|
|
7
|
-
import type { SessionCreateResponse } from '@composio/client/resources/tool-router/session/session.mjs';
|
|
8
7
|
import { ConnectedAccountExperimentalSchema } from './connectedAccounts.types';
|
|
8
|
+
import type {
|
|
9
|
+
SessionConfigHistoryResponse,
|
|
10
|
+
SessionCreateResponse,
|
|
11
|
+
} from '@composio/client/resources/tool-router/session/session.mjs';
|
|
9
12
|
import type {
|
|
10
13
|
CustomTool,
|
|
11
14
|
CustomToolkit,
|
|
@@ -14,6 +17,7 @@ import type {
|
|
|
14
17
|
RegisteredCustomToolkit,
|
|
15
18
|
} from './customTool.types';
|
|
16
19
|
import { PRELOAD_TOOLS_ALL } from '../lib/toolRouterConstants';
|
|
20
|
+
import { addSessionConfigConflictIssue } from '../lib/sessionConfigConflict';
|
|
17
21
|
|
|
18
22
|
export const SessionPreset = {
|
|
19
23
|
DIRECT_TOOLS: 'direct_tools',
|
|
@@ -104,6 +108,34 @@ export const ToolRouterToolkitsEnabledConfigSchema = z
|
|
|
104
108
|
})
|
|
105
109
|
.strict();
|
|
106
110
|
|
|
111
|
+
/** Experimental premium usage policy for a Session. */
|
|
112
|
+
export const ToolRouterPremiumUsageSchema = z.union([
|
|
113
|
+
z.literal(false),
|
|
114
|
+
z
|
|
115
|
+
.object({
|
|
116
|
+
toolkits: z
|
|
117
|
+
.union([ToolRouterToolkitsEnabledConfigSchema, ToolRouterToolkitsDisabledConfigSchema])
|
|
118
|
+
.optional(),
|
|
119
|
+
tools: z
|
|
120
|
+
.record(
|
|
121
|
+
z.string(),
|
|
122
|
+
z.union([
|
|
123
|
+
z.object({ enable: z.array(z.string()) }).strict(),
|
|
124
|
+
z.object({ disable: z.array(z.string()) }).strict(),
|
|
125
|
+
])
|
|
126
|
+
)
|
|
127
|
+
.optional(),
|
|
128
|
+
/**
|
|
129
|
+
* Return the actual premium charge in Session tool responses. Controls
|
|
130
|
+
* visibility only; on update, any policy object still re-enables premium
|
|
131
|
+
* usage on a Session set to `false`.
|
|
132
|
+
*/
|
|
133
|
+
returnPremiumCharge: z.boolean().optional(),
|
|
134
|
+
})
|
|
135
|
+
.strict(),
|
|
136
|
+
]);
|
|
137
|
+
export type ToolRouterPremiumUsage = z.infer<typeof ToolRouterPremiumUsageSchema>;
|
|
138
|
+
|
|
107
139
|
export const ToolRouterManageConnectionsConfigSchema = z.object({
|
|
108
140
|
enable: z
|
|
109
141
|
.boolean()
|
|
@@ -214,7 +246,7 @@ const ToolRouterCreateSessionConfigBaseSchema = z
|
|
|
214
246
|
.boolean()
|
|
215
247
|
.optional()
|
|
216
248
|
.describe(
|
|
217
|
-
'When true, the returned session surfaces its hosted MCP endpoint (`session.mcp.url` / `session.mcp.headers`) in the type. The endpoint exists on every session at runtime regardless of this flag, but is only typed when `mcp: true` is passed. Default native tools (`session.tools()`) are unaffected. See https://docs.composio.dev/docs/sessions-via-mcp'
|
|
249
|
+
'When true, the returned session surfaces its hosted MCP endpoint (`session.mcp.url` / `session.mcp.headers`) in the type, and an MCP URL that is not on the API base URL origin throws `ComposioMCPDestinationError` instead of leaving `session.mcp.headers` empty with a warning. The endpoint exists on every session at runtime regardless of this flag, but is only typed when `mcp: true` is passed. Default native tools (`session.tools()`) are unaffected. See https://docs.composio.dev/docs/sessions-via-mcp'
|
|
218
250
|
),
|
|
219
251
|
|
|
220
252
|
tools: z
|
|
@@ -233,6 +265,10 @@ const ToolRouterCreateSessionConfigBaseSchema = z
|
|
|
233
265
|
.optional()
|
|
234
266
|
.describe('The toolkits to use in the tool router session'),
|
|
235
267
|
|
|
268
|
+
premiumUsage: ToolRouterPremiumUsageSchema.optional().describe(
|
|
269
|
+
'Experimental premium usage policy. Omission permits eligible tools when the project allows premium usage; false disables it for this Session.'
|
|
270
|
+
),
|
|
271
|
+
|
|
236
272
|
authConfigs: z
|
|
237
273
|
.record(z.string(), z.string())
|
|
238
274
|
.describe(
|
|
@@ -321,12 +357,32 @@ const ToolRouterCreateSessionConfigBaseSchema = z
|
|
|
321
357
|
.describe(
|
|
322
358
|
'Custom toolkits to include in this session. Created via createCustomToolkit() from @composio/core/experimental.'
|
|
323
359
|
),
|
|
360
|
+
sessionConfigId: z
|
|
361
|
+
.string()
|
|
362
|
+
.min(1)
|
|
363
|
+
.optional()
|
|
364
|
+
.describe(
|
|
365
|
+
'ID of a saved Session config (`sc_…`) to apply when the session is created. Cannot be combined with toolkits, tools, tags, customTools or customToolkits.'
|
|
366
|
+
),
|
|
324
367
|
})
|
|
325
368
|
.optional()
|
|
326
369
|
.describe('Experimental features configuration - not stable, may be modified or removed'),
|
|
327
370
|
})
|
|
328
371
|
.partial()
|
|
329
372
|
.superRefine((config, ctx) => {
|
|
373
|
+
// "Provided" means `!== undefined`, so empty arrays conflict too.
|
|
374
|
+
if (config.experimental?.sessionConfigId !== undefined) {
|
|
375
|
+
addSessionConfigConflictIssue(
|
|
376
|
+
ctx,
|
|
377
|
+
[
|
|
378
|
+
config.toolkits !== undefined && 'toolkits',
|
|
379
|
+
config.tools !== undefined && 'tools',
|
|
380
|
+
config.tags !== undefined && 'tags',
|
|
381
|
+
config.experimental.customTools !== undefined && 'experimental.customTools',
|
|
382
|
+
config.experimental.customToolkits !== undefined && 'experimental.customToolkits',
|
|
383
|
+
].filter((field): field is string => field !== false)
|
|
384
|
+
);
|
|
385
|
+
}
|
|
330
386
|
if (config.sandbox !== undefined && config.workbench !== undefined) {
|
|
331
387
|
ctx.addIssue({
|
|
332
388
|
code: z.ZodIssueCode.custom,
|
|
@@ -370,6 +426,7 @@ export const ToolRouterCreateSessionConfigSchema = z
|
|
|
370
426
|
* @param {Array<'readOnlyHint' | 'destructiveHint' | 'idempotentHint' | 'openWorldHint'>} tags - Global tags to filter tools by behavior
|
|
371
427
|
* @param {Record<string, string>} authConfigs - The auth configs to use in the tool router session
|
|
372
428
|
* @param {Record<string, string | string[]>} connectedAccounts - The connected accounts to use in the tool router session. A single string is coerced to a single-element array before being sent to the backend.
|
|
429
|
+
* @param {ToolRouterPremiumUsage} [premiumUsage] - Experimental premium usage policy. The project must allow premium usage.
|
|
373
430
|
* @param {ToolRouterConfigManageConnectionsSchema | boolean} manageConnections - The config for the manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually. If set to an object, you can configure the manage connections settings.
|
|
374
431
|
* @param {boolean} [manageConnections.enable] - Whether to use tools to manage connections in the tool router session @default true
|
|
375
432
|
* @param {string} [manageConnections.callbackUrl] - The callback url to use in the tool router session
|
|
@@ -385,8 +442,39 @@ export const ToolRouterCreateSessionConfigSchema = z
|
|
|
385
442
|
* @param {boolean} [multiAccount.requireExplicitSelection] - When true, require explicit account selection when multiple accounts are connected
|
|
386
443
|
* @param {object} [preload] - Tools to preload into session.tools() and the MCP tool list
|
|
387
444
|
* @param {string[] | 'all'} [preload.tools] - Tool slugs to preload, or "all" to preload every app tool allowed by the session filters. "all" requires a positive filter such as toolkits, tools, or tags; the backend validates and caps the final tool set.
|
|
445
|
+
* @param {object} [experimental] - Experimental features configuration. Not stable; may change or be removed.
|
|
446
|
+
* @param {string} [experimental.sessionConfigId] - ID of a saved Session config (`sc_…`) to apply at creation; see `composio.sessionConfigs`. Cannot be combined with `toolkits`, `tools`, `tags`, `experimental.customTools` or `experimental.customToolkits`. Per-session fields such as `authConfigs`, `connectedAccounts`, `manageConnections`, `sandbox`, `multiAccount` and `preload` stay allowed.
|
|
388
447
|
*/
|
|
389
|
-
export type ToolRouterCreateSessionConfig =
|
|
448
|
+
export type ToolRouterCreateSessionConfig =
|
|
449
|
+
InlineAccessCreateSessionConfig | SavedConfigCreateSessionConfig;
|
|
450
|
+
|
|
451
|
+
type ParsedCreateSessionConfig = z.infer<typeof ToolRouterCreateSessionConfigSchema>;
|
|
452
|
+
type ParsedCreateSessionExperimental = NonNullable<ParsedCreateSessionConfig['experimental']>;
|
|
453
|
+
|
|
454
|
+
/** Create input that sets access inline and applies no saved Session config. */
|
|
455
|
+
type InlineAccessCreateSessionConfig = Omit<ParsedCreateSessionConfig, 'experimental'> & {
|
|
456
|
+
experimental?: Omit<ParsedCreateSessionExperimental, 'sessionConfigId'> & {
|
|
457
|
+
sessionConfigId?: never;
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
/** Create input that takes its access policy from a saved Session config. */
|
|
462
|
+
type SavedConfigCreateSessionConfig = Omit<
|
|
463
|
+
ParsedCreateSessionConfig,
|
|
464
|
+
'toolkits' | 'tools' | 'tags' | 'experimental'
|
|
465
|
+
> & {
|
|
466
|
+
toolkits?: never;
|
|
467
|
+
tools?: never;
|
|
468
|
+
tags?: never;
|
|
469
|
+
experimental: Omit<
|
|
470
|
+
ParsedCreateSessionExperimental,
|
|
471
|
+
'sessionConfigId' | 'customTools' | 'customToolkits'
|
|
472
|
+
> & {
|
|
473
|
+
sessionConfigId: string;
|
|
474
|
+
customTools?: never;
|
|
475
|
+
customToolkits?: never;
|
|
476
|
+
};
|
|
477
|
+
};
|
|
390
478
|
|
|
391
479
|
export const ToolkitConnectionStateSchema = z
|
|
392
480
|
.object({
|
|
@@ -520,6 +608,8 @@ const ToolRouterSessionSearchToolkitConnectionStatusSchema = z.object({
|
|
|
520
608
|
statusMessage: z.string(),
|
|
521
609
|
connectionDetails: z.record(z.string(), z.unknown()).optional(),
|
|
522
610
|
currentUserInfo: z.record(z.string(), z.unknown()).optional(),
|
|
611
|
+
/** Present when the toolkit runs on a Composio hosted account; only these tools run on it. */
|
|
612
|
+
hostedAccount: z.object({ allowedToolSlugs: z.array(z.string()) }).optional(),
|
|
523
613
|
});
|
|
524
614
|
|
|
525
615
|
export const ToolRouterSessionSearchResponseSchema = z.object({
|
|
@@ -540,6 +630,8 @@ export const ToolRouterSessionExecuteResponseSchema = z.object({
|
|
|
540
630
|
data: z.record(z.string(), z.unknown()),
|
|
541
631
|
error: z.string().nullable(),
|
|
542
632
|
logId: z.string(),
|
|
633
|
+
/** Actual premium usage charge when the Session opts into returning it. */
|
|
634
|
+
premiumCharge: z.unknown().optional(),
|
|
543
635
|
});
|
|
544
636
|
export type ToolRouterSessionExecuteResponse = z.infer<
|
|
545
637
|
typeof ToolRouterSessionExecuteResponseSchema
|
|
@@ -577,6 +669,14 @@ export interface SessionExperimental {
|
|
|
577
669
|
* File mount operations (list, upload, download, delete) for the session's virtual filesystem.
|
|
578
670
|
*/
|
|
579
671
|
files: ToolRouterSessionFilesMount;
|
|
672
|
+
/**
|
|
673
|
+
* The last saved Session config applied to this session, set from the
|
|
674
|
+
* create, `use()` and `update()` responses. Later inline access updates
|
|
675
|
+
* keep it. It reflects the last response this object saw: an update from
|
|
676
|
+
* another process leaves it stale until `sessions.use()`.
|
|
677
|
+
* @experimental
|
|
678
|
+
*/
|
|
679
|
+
sourceSessionConfig?: { id: string };
|
|
580
680
|
}
|
|
581
681
|
|
|
582
682
|
export type ToolRouterSessionSearchFn = (params: {
|
|
@@ -652,20 +752,139 @@ export type ToolRouterSessionProxyExecuteFn = (
|
|
|
652
752
|
params: SessionProxyExecuteParams
|
|
653
753
|
) => Promise<ToolRouterSessionProxyExecuteResponse>;
|
|
654
754
|
|
|
755
|
+
/**
|
|
756
|
+
* `manageConnections` shape accepted by `session.update()`. Unlike the create
|
|
757
|
+
* schema, `callbackUrl: null` removes the stored callback URL while leaving
|
|
758
|
+
* the sibling connection settings untouched.
|
|
759
|
+
*/
|
|
760
|
+
export const ToolRouterUpdateManageConnectionsSchema = z
|
|
761
|
+
.object({
|
|
762
|
+
enable: z
|
|
763
|
+
.boolean()
|
|
764
|
+
.optional()
|
|
765
|
+
.describe(
|
|
766
|
+
'Whether to use tools to manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually'
|
|
767
|
+
),
|
|
768
|
+
callbackUrl: z
|
|
769
|
+
.string()
|
|
770
|
+
.nullable()
|
|
771
|
+
.optional()
|
|
772
|
+
.describe(
|
|
773
|
+
'The callback url to use in the tool router session. `null` removes the stored callback url; sibling settings are untouched'
|
|
774
|
+
),
|
|
775
|
+
waitForConnections: z
|
|
776
|
+
.boolean()
|
|
777
|
+
.optional()
|
|
778
|
+
.describe(
|
|
779
|
+
'Whether to wait for users to finish authenticating connections before proceeding to the next step. Defaults to false, if set to true, a wait for connections tool call will happen and finish when the connections are ready'
|
|
780
|
+
),
|
|
781
|
+
enableConnectionRemoval: z
|
|
782
|
+
.boolean()
|
|
783
|
+
.nullable()
|
|
784
|
+
.optional()
|
|
785
|
+
.describe(
|
|
786
|
+
'Whether the session exposes the connection removal tool. `null` removes the stored override'
|
|
787
|
+
),
|
|
788
|
+
})
|
|
789
|
+
.strict();
|
|
790
|
+
export type ToolRouterUpdateManageConnectionsConfig = z.infer<
|
|
791
|
+
typeof ToolRouterUpdateManageConnectionsSchema
|
|
792
|
+
>;
|
|
793
|
+
|
|
794
|
+
const ToolRouterElicitationDefaultSchema = z.enum([
|
|
795
|
+
'allow_all',
|
|
796
|
+
'ask_every_call',
|
|
797
|
+
'ask_once_per_session',
|
|
798
|
+
]);
|
|
799
|
+
const ToolRouterElicitationOverrideSchema = z.enum([
|
|
800
|
+
'always_allow',
|
|
801
|
+
'always_deny',
|
|
802
|
+
'ask_once',
|
|
803
|
+
'ask_always',
|
|
804
|
+
]);
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* `experimental` block accepted by `session.update()`. Each leaf follows the
|
|
808
|
+
* PATCH contract of the API: omit to keep the stored value, `null` to remove
|
|
809
|
+
* it, a value to replace it.
|
|
810
|
+
*/
|
|
811
|
+
export const ToolRouterUpdateExperimentalSchema = z
|
|
812
|
+
.object({
|
|
813
|
+
permissions: z
|
|
814
|
+
.object({
|
|
815
|
+
default: ToolRouterElicitationDefaultSchema,
|
|
816
|
+
overrides: z.record(z.string(), ToolRouterElicitationOverrideSchema).optional(),
|
|
817
|
+
})
|
|
818
|
+
.strict()
|
|
819
|
+
.nullable()
|
|
820
|
+
.optional()
|
|
821
|
+
.describe('Per-tool elicitation permission config. `null` removes the stored block'),
|
|
822
|
+
linkUrlOverwrite: z
|
|
823
|
+
.string()
|
|
824
|
+
.nullable()
|
|
825
|
+
.optional()
|
|
826
|
+
.describe(
|
|
827
|
+
'Base URL override for connection link redirects. `null` removes the stored override'
|
|
828
|
+
),
|
|
829
|
+
fastMode: z
|
|
830
|
+
.boolean()
|
|
831
|
+
.nullable()
|
|
832
|
+
.optional()
|
|
833
|
+
.describe('Fast search mode. `null` removes the stored override'),
|
|
834
|
+
submitFeedback: z
|
|
835
|
+
.object({ enable: z.boolean() })
|
|
836
|
+
.strict()
|
|
837
|
+
.nullable()
|
|
838
|
+
.optional()
|
|
839
|
+
.describe(
|
|
840
|
+
'Exposes the COMPOSIO_SUBMIT_FEEDBACK helper tool. `null` removes the stored block'
|
|
841
|
+
),
|
|
842
|
+
sessionConfigId: z
|
|
843
|
+
.string()
|
|
844
|
+
.min(1)
|
|
845
|
+
.optional()
|
|
846
|
+
.describe(
|
|
847
|
+
"Apply the latest active saved Session config (`sc_…`) from this project to this session. Replaces the session's toolkit, tool and tag access and cannot be combined with toolkits, tools or tags"
|
|
848
|
+
),
|
|
849
|
+
})
|
|
850
|
+
.strict();
|
|
851
|
+
export type ToolRouterUpdateExperimentalConfig = z.infer<typeof ToolRouterUpdateExperimentalSchema>;
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* Options for `session.update()`. For every policy block, omitting the key
|
|
855
|
+
* preserves the stored value and `null` removes the stored override (which can
|
|
856
|
+
* increase access: `toolkits: null` restores the unrestricted default, unlike
|
|
857
|
+
* `toolkits: []`, which denies every app toolkit).
|
|
858
|
+
*/
|
|
655
859
|
export const ToolRouterUpdateSessionConfigSchema = z
|
|
656
860
|
.object({
|
|
861
|
+
premiumUsage: ToolRouterPremiumUsageSchema.optional().describe(
|
|
862
|
+
'Experimental premium usage policy. False disables it. Any supplied object, even one that only sets returnPremiumCharge, re-enables it. Omitted subfields keep their stored values.'
|
|
863
|
+
),
|
|
657
864
|
toolkits: z
|
|
658
865
|
.union([
|
|
659
866
|
ToolRouterToolkitsParamSchema,
|
|
660
867
|
ToolRouterToolkitsDisabledConfigSchema,
|
|
661
868
|
ToolRouterToolkitsEnabledConfigSchema,
|
|
662
869
|
])
|
|
663
|
-
.
|
|
870
|
+
.nullable()
|
|
871
|
+
.optional()
|
|
872
|
+
.describe(
|
|
873
|
+
'Toolkit policy. An empty allowlist (`[]` or `{ enable: [] }`) is sent as-is and denies every app toolkit; `null` removes the stored policy and restores the unrestricted default'
|
|
874
|
+
),
|
|
664
875
|
tools: z
|
|
665
876
|
.record(z.string(), z.union([ToolRouterToolsParamSchema, ToolRouterConfigToolsSchema]))
|
|
666
|
-
.
|
|
667
|
-
|
|
668
|
-
|
|
877
|
+
.nullable()
|
|
878
|
+
.optional()
|
|
879
|
+
.describe('Replaces the entire stored tools map; `null` removes the override'),
|
|
880
|
+
tags: ToolRouterConfigTagsSchema.nullable()
|
|
881
|
+
.optional()
|
|
882
|
+
.describe('Replaces the global tag policy; `null` removes the override'),
|
|
883
|
+
authConfigs: z
|
|
884
|
+
.record(z.string(), z.string())
|
|
885
|
+
.nullable()
|
|
886
|
+
.optional()
|
|
887
|
+
.describe('Replaces the entire stored auth config map; `null` removes the override'),
|
|
669
888
|
connectedAccounts: z
|
|
670
889
|
.record(z.string(), z.union([z.string(), z.array(z.string())]))
|
|
671
890
|
.transform(rec => {
|
|
@@ -675,9 +894,11 @@ export const ToolRouterUpdateSessionConfigSchema = z
|
|
|
675
894
|
}
|
|
676
895
|
return out;
|
|
677
896
|
})
|
|
678
|
-
.
|
|
897
|
+
.nullable()
|
|
898
|
+
.optional()
|
|
899
|
+
.describe('Replaces the entire stored connected accounts map; `null` removes the override'),
|
|
679
900
|
manageConnections: z
|
|
680
|
-
.union([z.boolean(),
|
|
901
|
+
.union([z.boolean(), ToolRouterUpdateManageConnectionsSchema])
|
|
681
902
|
.nullable()
|
|
682
903
|
.optional(),
|
|
683
904
|
sandbox: ToolRouterSandboxConfigSchema.partial().nullable().optional(),
|
|
@@ -685,20 +906,62 @@ export const ToolRouterUpdateSessionConfigSchema = z
|
|
|
685
906
|
multiAccount: z
|
|
686
907
|
.object({
|
|
687
908
|
enable: z.boolean().optional(),
|
|
688
|
-
maxAccountsPerToolkit: z
|
|
909
|
+
maxAccountsPerToolkit: z
|
|
910
|
+
.number()
|
|
911
|
+
.int()
|
|
912
|
+
.min(2)
|
|
913
|
+
.max(10)
|
|
914
|
+
.nullable()
|
|
915
|
+
.optional()
|
|
916
|
+
.describe('`null` removes the stored maximum so the default applies again'),
|
|
689
917
|
requireExplicitSelection: z.boolean().optional(),
|
|
690
918
|
})
|
|
691
919
|
.nullable()
|
|
692
|
-
.optional()
|
|
920
|
+
.optional()
|
|
921
|
+
.describe('`null` removes the session override; the mode then resolves to disabled'),
|
|
693
922
|
preload: z
|
|
694
923
|
.object({
|
|
695
924
|
tools: z.union([z.array(z.string()), z.literal('all')]).optional(),
|
|
696
925
|
})
|
|
697
926
|
.strict()
|
|
698
|
-
.
|
|
927
|
+
.nullable()
|
|
928
|
+
.optional()
|
|
929
|
+
.describe('Replaces the stored preload; `null` removes it'),
|
|
930
|
+
search: z
|
|
931
|
+
.object({ enable: z.boolean().optional() })
|
|
932
|
+
.strict()
|
|
933
|
+
.nullable()
|
|
934
|
+
.optional()
|
|
935
|
+
.describe('Replaces the search block; `null` removes it and restores the defaults'),
|
|
936
|
+
execute: z
|
|
937
|
+
.object({ enableMultiExecute: z.boolean().optional() })
|
|
938
|
+
.strict()
|
|
939
|
+
.nullable()
|
|
940
|
+
.optional()
|
|
941
|
+
.describe('Replaces the execute block; `null` removes it and restores the defaults'),
|
|
942
|
+
experimental: ToolRouterUpdateExperimentalSchema.nullable()
|
|
943
|
+
.optional()
|
|
944
|
+
.describe('Experimental settings; `null` removes the stored block'),
|
|
945
|
+
expectedConfigVersion: z
|
|
946
|
+
.union([z.number().int().positive(), z.literal(false)])
|
|
947
|
+
.optional()
|
|
948
|
+
.describe(
|
|
949
|
+
'Precondition sent as `expected_config_version`. A positive integer (for example `session.configVersion`) makes the update conditional, so a concurrent change surfaces as ComposioSessionConfigConflictError instead of being overwritten; the API must support the field. Omitted or `false`: no precondition (last writer wins)'
|
|
950
|
+
),
|
|
699
951
|
})
|
|
700
952
|
.partial()
|
|
701
953
|
.superRefine((config, ctx) => {
|
|
954
|
+
// "Provided" means `!== undefined`, so `null` conflicts too.
|
|
955
|
+
if (config.experimental?.sessionConfigId !== undefined) {
|
|
956
|
+
addSessionConfigConflictIssue(
|
|
957
|
+
ctx,
|
|
958
|
+
[
|
|
959
|
+
config.toolkits !== undefined && 'toolkits',
|
|
960
|
+
config.tools !== undefined && 'tools',
|
|
961
|
+
config.tags !== undefined && 'tags',
|
|
962
|
+
].filter((field): field is string => field !== false)
|
|
963
|
+
);
|
|
964
|
+
}
|
|
702
965
|
if (config.sandbox !== undefined && config.workbench !== undefined) {
|
|
703
966
|
ctx.addIssue({
|
|
704
967
|
code: z.ZodIssueCode.custom,
|
|
@@ -709,7 +972,35 @@ export const ToolRouterUpdateSessionConfigSchema = z
|
|
|
709
972
|
}
|
|
710
973
|
});
|
|
711
974
|
|
|
712
|
-
|
|
975
|
+
/**
|
|
976
|
+
* Options for `session.update()`. `experimental.sessionConfigId` applies a
|
|
977
|
+
* saved Session config and cannot be combined with `toolkits`, `tools` or
|
|
978
|
+
* `tags` (including `null`).
|
|
979
|
+
*/
|
|
980
|
+
export type ToolRouterUpdateSessionConfig =
|
|
981
|
+
InlineAccessUpdateSessionConfig | SavedConfigUpdateSessionConfig;
|
|
982
|
+
|
|
983
|
+
type ParsedUpdateSessionConfig = z.infer<typeof ToolRouterUpdateSessionConfigSchema>;
|
|
984
|
+
type ParsedUpdateSessionExperimental = NonNullable<ParsedUpdateSessionConfig['experimental']>;
|
|
985
|
+
|
|
986
|
+
/** Update input that sets access inline and applies no saved Session config. */
|
|
987
|
+
type InlineAccessUpdateSessionConfig = Omit<ParsedUpdateSessionConfig, 'experimental'> & {
|
|
988
|
+
experimental?:
|
|
989
|
+
(Omit<ParsedUpdateSessionExperimental, 'sessionConfigId'> & { sessionConfigId?: never }) | null;
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
/** Update input that applies a saved Session config. */
|
|
993
|
+
type SavedConfigUpdateSessionConfig = Omit<
|
|
994
|
+
ParsedUpdateSessionConfig,
|
|
995
|
+
'toolkits' | 'tools' | 'tags' | 'experimental'
|
|
996
|
+
> & {
|
|
997
|
+
toolkits?: never;
|
|
998
|
+
tools?: never;
|
|
999
|
+
tags?: never;
|
|
1000
|
+
experimental: Omit<ParsedUpdateSessionExperimental, 'sessionConfigId'> & {
|
|
1001
|
+
sessionConfigId: string;
|
|
1002
|
+
};
|
|
1003
|
+
};
|
|
713
1004
|
|
|
714
1005
|
export type ToolRouterSessionUpdateFn = (
|
|
715
1006
|
config: ToolRouterUpdateSessionConfig
|
|
@@ -721,6 +1012,49 @@ export const ToolRouterSessionDeleteResponseSchema = z.object({
|
|
|
721
1012
|
});
|
|
722
1013
|
export type ToolRouterSessionDeleteResponse = z.infer<typeof ToolRouterSessionDeleteResponseSchema>;
|
|
723
1014
|
|
|
1015
|
+
/**
|
|
1016
|
+
* Options for `session.listConfigHistory()`.
|
|
1017
|
+
*/
|
|
1018
|
+
export const ToolRouterSessionListConfigHistoryOptionsSchema = z.object({
|
|
1019
|
+
/** Cursor from a previous response's `nextCursor`. */
|
|
1020
|
+
cursor: z.string().optional(),
|
|
1021
|
+
/** Number of items per page, max allowed is 100. */
|
|
1022
|
+
limit: z.number().optional(),
|
|
1023
|
+
});
|
|
1024
|
+
export type ToolRouterSessionListConfigHistoryOptions = z.infer<
|
|
1025
|
+
typeof ToolRouterSessionListConfigHistoryOptionsSchema
|
|
1026
|
+
>;
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* The session configuration at one version, as stored by the API. This is
|
|
1030
|
+
* the wire shape (snake_case), typed from the generated client.
|
|
1031
|
+
*/
|
|
1032
|
+
export type ToolRouterSessionConfigHistoryConfig = SessionConfigHistoryResponse.Item.Config;
|
|
1033
|
+
|
|
1034
|
+
export type ToolRouterSessionConfigHistoryItem = {
|
|
1035
|
+
/** The config version this entry represents. */
|
|
1036
|
+
version: number;
|
|
1037
|
+
/** ISO timestamp — for archived rows, when the version was superseded by an update. */
|
|
1038
|
+
createdAt: string;
|
|
1039
|
+
/** True only for the live (current) config, present on the first page. */
|
|
1040
|
+
isCurrent: boolean;
|
|
1041
|
+
/** The session configuration at this version. */
|
|
1042
|
+
config: ToolRouterSessionConfigHistoryConfig;
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
export type ToolRouterSessionListConfigHistoryResponse = {
|
|
1046
|
+
items: ToolRouterSessionConfigHistoryItem[];
|
|
1047
|
+
nextCursor: string | null;
|
|
1048
|
+
totalPages: number;
|
|
1049
|
+
currentPage: number;
|
|
1050
|
+
totalItems: number;
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
export type ToolRouterSessionListConfigHistoryFn = (
|
|
1054
|
+
options?: ToolRouterSessionListConfigHistoryOptions,
|
|
1055
|
+
requestOptions?: ComposioRequestOptions
|
|
1056
|
+
) => Promise<ToolRouterSessionListConfigHistoryResponse>;
|
|
1057
|
+
|
|
724
1058
|
export type ToolRouterSessionDeleteFn = (
|
|
725
1059
|
requestOptions?: ComposioRequestOptions
|
|
726
1060
|
) => Promise<ToolRouterSessionDeleteResponse>;
|
|
@@ -763,9 +1097,9 @@ export interface Session<
|
|
|
763
1097
|
sessionId: string;
|
|
764
1098
|
mcp: ToolRouterMCPServerConfig;
|
|
765
1099
|
/**
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
* `
|
|
1100
|
+
* The session's current configuration (policy snapshot and runtime
|
|
1101
|
+
* settings). Refreshed in place by `update()`. For saved, reusable Session
|
|
1102
|
+
* configs, see `composio.sessionConfigs`.
|
|
769
1103
|
*/
|
|
770
1104
|
config: ToolRouterSessionConfig;
|
|
771
1105
|
/** Stored preload configuration for this session. */
|
|
@@ -799,6 +1133,8 @@ export interface Session<
|
|
|
799
1133
|
update: ToolRouterSessionUpdateFn;
|
|
800
1134
|
/** Delete the session. Deleted sessions are no longer retrievable or executable. */
|
|
801
1135
|
delete: ToolRouterSessionDeleteFn;
|
|
1136
|
+
/** Page through the session's configuration history (newest first). */
|
|
1137
|
+
listConfigHistory: ToolRouterSessionListConfigHistoryFn;
|
|
802
1138
|
/** Proxy an API call through Composio's auth layer using the session's connected account */
|
|
803
1139
|
proxyExecute: ToolRouterSessionProxyExecuteFn;
|
|
804
1140
|
/** List custom tools registered in this session, with their final slugs and schemas */
|
|
@@ -18,6 +18,14 @@ export type ToolkitMangedByEnum = z.infer<typeof ToolkitMangedByEnumSchema>;
|
|
|
18
18
|
export type ToolkitSortByEnum = z.infer<typeof ToolkitSortByEnumSchema>;
|
|
19
19
|
export type ToolkitListParams = z.infer<typeof ToolkitsListParamsSchema>;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Toolkit getMany params — the slugs to fetch plus the same filters `list`
|
|
23
|
+
* accepts.
|
|
24
|
+
*/
|
|
25
|
+
export const ToolkitGetManySlugsSchema = z.array(z.string().min(1)).min(1);
|
|
26
|
+
export const ToolkitsGetManyParamsSchema = ToolkitsListParamsSchema;
|
|
27
|
+
export type ToolkitGetManyParams = z.infer<typeof ToolkitsGetManyParamsSchema>;
|
|
28
|
+
|
|
21
29
|
/**
|
|
22
30
|
* Toolkits response
|
|
23
31
|
*/
|
|
@@ -78,6 +86,13 @@ export const ToolkitAuthFieldSchema = z.object({
|
|
|
78
86
|
* further documenting its semantics.
|
|
79
87
|
*/
|
|
80
88
|
legacyTemplateName: z.string().optional(),
|
|
89
|
+
/**
|
|
90
|
+
* Whether the hosted connect flow shows this field to the end user, mapped
|
|
91
|
+
* from `user_visible`. A field with `false` is never required: its `default`
|
|
92
|
+
* applies unless the auth config supplies a value. Absent when the API omits
|
|
93
|
+
* the flag.
|
|
94
|
+
*/
|
|
95
|
+
userVisible: z.boolean().optional(),
|
|
81
96
|
});
|
|
82
97
|
export const ToolkitAuthConfigDetailsSchema = z.object({
|
|
83
98
|
name: z.string(),
|
|
@@ -87,6 +102,12 @@ export const ToolkitAuthConfigDetailsSchema = z.object({
|
|
|
87
102
|
* authentication method, e.g. `https://github.com/settings/tokens`.
|
|
88
103
|
*/
|
|
89
104
|
authHintUrl: z.string().nullable().optional(),
|
|
105
|
+
/**
|
|
106
|
+
* OAuth scopes always requested for this auth method regardless of the
|
|
107
|
+
* tool-specific scopes, such as token refresh (`offline_access`) and identity
|
|
108
|
+
* scopes. Mapped from `required_scopes`; absent when the API omits it.
|
|
109
|
+
*/
|
|
110
|
+
requiredScopes: z.array(z.string()).optional(),
|
|
90
111
|
fields: z.object({
|
|
91
112
|
authConfigCreation: z.object({
|
|
92
113
|
optional: z.array(ToolkitAuthFieldSchema),
|
|
@@ -138,6 +159,129 @@ export type ToolkitRetrieveCategoriesResponse = z.infer<
|
|
|
138
159
|
typeof ToolkitRetrieveCategoriesResponseSchema
|
|
139
160
|
>;
|
|
140
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Toolkit changelog response
|
|
164
|
+
*/
|
|
165
|
+
export const ToolkitVersionChangelogSchema = z.object({
|
|
166
|
+
version: z.string(),
|
|
167
|
+
changelog: z.string(),
|
|
168
|
+
});
|
|
169
|
+
export const ToolkitChangelogItemSchema = z.object({
|
|
170
|
+
slug: z.string(),
|
|
171
|
+
name: z.string(),
|
|
172
|
+
displayName: z.string(),
|
|
173
|
+
/** Most recent versions first; the API returns up to the last 10 per toolkit. */
|
|
174
|
+
versions: z.array(ToolkitVersionChangelogSchema),
|
|
175
|
+
});
|
|
176
|
+
export const ToolkitChangelogResponseSchema = z.object({
|
|
177
|
+
items: z.array(ToolkitChangelogItemSchema),
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
export type ToolkitVersionChangelog = z.infer<typeof ToolkitVersionChangelogSchema>;
|
|
181
|
+
export type ToolkitChangelogItem = z.infer<typeof ToolkitChangelogItemSchema>;
|
|
182
|
+
export type ToolkitChangelogResponse = z.infer<typeof ToolkitChangelogResponseSchema>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Params for `composio.toolkits.recommendScopes()`.
|
|
186
|
+
* **Experimental — shape may change in future releases.**
|
|
187
|
+
*/
|
|
188
|
+
export const ToolkitRecommendScopesParamsSchema = z.object({
|
|
189
|
+
/** Tool slugs to cover. Pass `[]` to cover every tool in the toolkit. */
|
|
190
|
+
tools: z.array(z.string()),
|
|
191
|
+
/** Auth scheme the connection will use. The API defaults to `OAUTH2`. */
|
|
192
|
+
authScheme: AuthSchemeEnum.optional(),
|
|
193
|
+
/** Toolkit version to compute from. The API defaults to the latest published version. */
|
|
194
|
+
toolkitVersion: z.string().min(1).optional(),
|
|
195
|
+
/**
|
|
196
|
+
* Context the scopes will be granted in, as dimension → selected value,
|
|
197
|
+
* for example `{ account_type: 'Google Workspace' }`. Discover the
|
|
198
|
+
* dimensions with `composio.toolkits.listGrantContexts()`.
|
|
199
|
+
*/
|
|
200
|
+
grantContext: z.record(z.string(), z.string()).optional(),
|
|
201
|
+
/** Scopes the recommendation must include, whether or not the tools need them. */
|
|
202
|
+
include: z.array(z.string()).optional(),
|
|
203
|
+
/** Scopes the recommendation must not include; the API picks documented alternatives or fails. */
|
|
204
|
+
exclude: z.array(z.string()).optional(),
|
|
205
|
+
/** Scopes your OAuth app can request. The recommendation never goes outside this list. */
|
|
206
|
+
availableScopes: z.array(z.string()).optional(),
|
|
207
|
+
});
|
|
208
|
+
export type ToolkitRecommendScopesParams = z.infer<typeof ToolkitRecommendScopesParamsSchema>;
|
|
209
|
+
|
|
210
|
+
export const ToolkitConditionalScopeSchema = z.object({
|
|
211
|
+
/** The scope needed only when the `when` guard matches. */
|
|
212
|
+
scope: z.string(),
|
|
213
|
+
/** Input field name → qualifying values. Any value matches within a field; all fields must match. */
|
|
214
|
+
when: z.record(z.string(), z.array(z.string())),
|
|
215
|
+
/** Tool slugs that need this scope under the guard. */
|
|
216
|
+
for: z.array(z.string()),
|
|
217
|
+
});
|
|
218
|
+
export type ToolkitConditionalScope = z.infer<typeof ToolkitConditionalScopeSchema>;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Response of `composio.toolkits.recommendScopes()`.
|
|
222
|
+
* **Experimental — shape may change in future releases.**
|
|
223
|
+
*/
|
|
224
|
+
export const ToolkitRecommendScopesResponseSchema = z.object({
|
|
225
|
+
/** Auth scheme the recommendation was computed under. */
|
|
226
|
+
authScheme: z.string(),
|
|
227
|
+
/** Concrete toolkit version the answer was computed from; pass it back as `toolkitVersion` to pin. */
|
|
228
|
+
toolkitVersion: z.string(),
|
|
229
|
+
/** The effective grant context: the toolkit default overlaid with your overrides. */
|
|
230
|
+
grantContext: z.record(z.string(), z.string()),
|
|
231
|
+
scopes: z.object({
|
|
232
|
+
/** Narrowest documented option per requirement. */
|
|
233
|
+
leastPrivilege: z.array(z.string()),
|
|
234
|
+
/** Smallest scope set covering all requirements. */
|
|
235
|
+
fewest: z.array(z.string()),
|
|
236
|
+
/**
|
|
237
|
+
* Scopes needed only for particular call-time inputs. Both lists above
|
|
238
|
+
* already include them, so a caller that knows its inputs may drop the rest.
|
|
239
|
+
*/
|
|
240
|
+
conditional: z.array(ToolkitConditionalScopeSchema),
|
|
241
|
+
}),
|
|
242
|
+
});
|
|
243
|
+
export type ToolkitRecommendScopesResponse = z.infer<typeof ToolkitRecommendScopesResponseSchema>;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Params for `composio.toolkits.listGrantContexts()`.
|
|
247
|
+
* **Experimental — shape may change in future releases.**
|
|
248
|
+
*/
|
|
249
|
+
export const ToolkitListGrantContextsParamsSchema = z.object({
|
|
250
|
+
/** Auth scheme the connection will use. The API defaults to `OAUTH2`. */
|
|
251
|
+
authScheme: AuthSchemeEnum.optional(),
|
|
252
|
+
/** Toolkit version to read the scope catalog from. The API defaults to the latest published version. */
|
|
253
|
+
toolkitVersion: z.string().min(1).optional(),
|
|
254
|
+
});
|
|
255
|
+
export type ToolkitListGrantContextsParams = z.infer<typeof ToolkitListGrantContextsParamsSchema>;
|
|
256
|
+
|
|
257
|
+
export const ToolkitGrantContextDimensionSchema = z.object({
|
|
258
|
+
/** Dimension name to use as a `grantContext` key. */
|
|
259
|
+
dimension: z.string(),
|
|
260
|
+
/** What the dimension means and when to pass it. */
|
|
261
|
+
description: z.string(),
|
|
262
|
+
/** Values the dimension can take. */
|
|
263
|
+
values: z.array(z.string()),
|
|
264
|
+
});
|
|
265
|
+
export type ToolkitGrantContextDimension = z.infer<typeof ToolkitGrantContextDimensionSchema>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Response of `composio.toolkits.listGrantContexts()`.
|
|
269
|
+
* **Experimental — shape may change in future releases.**
|
|
270
|
+
*/
|
|
271
|
+
export const ToolkitListGrantContextsResponseSchema = z.object({
|
|
272
|
+
/** Auth scheme whose scope catalog the dimensions were read from. */
|
|
273
|
+
authScheme: z.string(),
|
|
274
|
+
/** Concrete toolkit version the answer was computed from. */
|
|
275
|
+
toolkitVersion: z.string(),
|
|
276
|
+
/** Dimensions the toolkit accepts in `grantContext`; empty when no scope depends on one. */
|
|
277
|
+
grantContextDimensions: z.array(ToolkitGrantContextDimensionSchema),
|
|
278
|
+
/** The grant context assumed when you pass none. */
|
|
279
|
+
defaultGrantContext: z.record(z.string(), z.string()),
|
|
280
|
+
});
|
|
281
|
+
export type ToolkitListGrantContextsResponse = z.infer<
|
|
282
|
+
typeof ToolkitListGrantContextsResponseSchema
|
|
283
|
+
>;
|
|
284
|
+
|
|
141
285
|
export const ToolkitAuthFieldsResponseSchema = z.array(
|
|
142
286
|
ToolkitAuthFieldSchema.extend({
|
|
143
287
|
required: z.boolean().optional(),
|