@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
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How end users authenticate to a custom toolkit.
|
|
5
|
+
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
6
|
+
*/
|
|
7
|
+
export const CustomToolkitAuthSchemeSchema = z.discriminatedUnion('mode', [
|
|
8
|
+
z.object({ mode: z.literal('NO_AUTH') }),
|
|
9
|
+
z.object({
|
|
10
|
+
mode: z.literal('API_KEY'),
|
|
11
|
+
/**
|
|
12
|
+
* Headers sent with each request. Write `{{generic_api_key}}` where the
|
|
13
|
+
* end user's API key goes, for example
|
|
14
|
+
* `{ Authorization: 'Bearer {{generic_api_key}}' }`.
|
|
15
|
+
*/
|
|
16
|
+
headers: z.record(z.string(), z.string()),
|
|
17
|
+
/** End-user copy for the API key input on the connect page. */
|
|
18
|
+
apiKeyField: z
|
|
19
|
+
.object({
|
|
20
|
+
displayName: z.string().min(1).max(100).optional(),
|
|
21
|
+
description: z.string().min(1).max(500).optional(),
|
|
22
|
+
})
|
|
23
|
+
.optional(),
|
|
24
|
+
}),
|
|
25
|
+
z.object({
|
|
26
|
+
mode: z.literal('DCR_OAUTH'),
|
|
27
|
+
/**
|
|
28
|
+
* Where to fetch the full auth scheme, usually the
|
|
29
|
+
* `/.well-known/oauth-authorization-server` path of your MCP URL.
|
|
30
|
+
*/
|
|
31
|
+
discoveryUrl: z.string().url(),
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
34
|
+
export type CustomToolkitAuthScheme = z.infer<typeof CustomToolkitAuthSchemeSchema>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Params for `composio.experimental.customToolkits.upsert()`.
|
|
38
|
+
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
39
|
+
*/
|
|
40
|
+
export const CustomToolkitUpsertParamsSchema = z.object({
|
|
41
|
+
/**
|
|
42
|
+
* Letters, digits, underscores or spaces, up to 30 characters. The API
|
|
43
|
+
* prefixes it with `CUSTOM_` and turns spaces into underscores.
|
|
44
|
+
*/
|
|
45
|
+
slug: z
|
|
46
|
+
.string()
|
|
47
|
+
.min(1)
|
|
48
|
+
.max(30)
|
|
49
|
+
.regex(/^[a-zA-Z0-9_\s]+$/),
|
|
50
|
+
toolkitConfig: z.object({
|
|
51
|
+
/** Human-readable toolkit name. */
|
|
52
|
+
name: z.string().min(1).max(200),
|
|
53
|
+
/** The app URL. For an MCP app, the MCP server URL. */
|
|
54
|
+
appUrl: z.string().url(),
|
|
55
|
+
/** Square PNG or JPEG logo (256-1024px, max 3MB), base64-encoded. Defaults to the Composio logo. */
|
|
56
|
+
logoFile: z
|
|
57
|
+
.object({
|
|
58
|
+
content: z.string().min(1),
|
|
59
|
+
mimeType: z.enum(['image/png', 'image/jpeg']),
|
|
60
|
+
})
|
|
61
|
+
.optional(),
|
|
62
|
+
/** At least one scheme. The schemes cannot change once the toolkit exists. */
|
|
63
|
+
authSchemes: z.array(CustomToolkitAuthSchemeSchema).min(1),
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
export type CustomToolkitUpsertParams = z.infer<typeof CustomToolkitUpsertParamsSchema>;
|
|
67
|
+
|
|
68
|
+
export const CustomToolkitUpsertResponseSchema = z.object({
|
|
69
|
+
/** Slug of the created or updated toolkit. */
|
|
70
|
+
slug: z.string(),
|
|
71
|
+
});
|
|
72
|
+
export type CustomToolkitUpsertResponse = z.infer<typeof CustomToolkitUpsertResponseSchema>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Params for `composio.experimental.customToolkits.sync()`.
|
|
76
|
+
* **Experimental — custom toolkits are in pilot; shape may change.**
|
|
77
|
+
*/
|
|
78
|
+
export const CustomToolkitSyncParamsSchema = z.object({
|
|
79
|
+
/** Connected account to use when fetching the remote tool definitions. */
|
|
80
|
+
connectedAccountId: z.string().optional(),
|
|
81
|
+
});
|
|
82
|
+
export type CustomToolkitSyncParams = z.infer<typeof CustomToolkitSyncParamsSchema>;
|
|
83
|
+
|
|
84
|
+
export const CustomToolkitSyncResponseSchema = z.object({
|
|
85
|
+
slug: z.string(),
|
|
86
|
+
/** Toolkit version after the sync. */
|
|
87
|
+
version: z.string(),
|
|
88
|
+
/** Number of tools synced. */
|
|
89
|
+
syncedCount: z.number(),
|
|
90
|
+
});
|
|
91
|
+
export type CustomToolkitSyncResponse = z.infer<typeof CustomToolkitSyncResponseSchema>;
|
|
92
|
+
|
|
93
|
+
export const CustomToolkitDeleteResponseSchema = z.object({
|
|
94
|
+
/** Slug of the deleted toolkit. */
|
|
95
|
+
slug: z.string(),
|
|
96
|
+
deleted: z.boolean(),
|
|
97
|
+
/** Background jobs revoking the credentials of the toolkit's connected accounts. */
|
|
98
|
+
revokeJobIds: z.array(z.string()),
|
|
99
|
+
authConfigsDeleted: z.number(),
|
|
100
|
+
connectedAccountsDeleted: z.number(),
|
|
101
|
+
});
|
|
102
|
+
export type CustomToolkitDeleteResponse = z.infer<typeof CustomToolkitDeleteResponseSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A public JWK a secret can be sealed to. Fields keep their JWK names so a
|
|
5
|
+
* key can be handed straight to WebCrypto or a JOSE library.
|
|
6
|
+
*/
|
|
7
|
+
export const KeyringTransferKeySchema = z.object({
|
|
8
|
+
/** Key type. Always `RSA`. */
|
|
9
|
+
kty: z.string(),
|
|
10
|
+
/** RSA modulus, base64url-encoded. */
|
|
11
|
+
n: z.string(),
|
|
12
|
+
/** RSA public exponent, base64url-encoded. */
|
|
13
|
+
e: z.string(),
|
|
14
|
+
/** Key-management algorithm for the JWE (`RSA-OAEP-256`). Pair it with `A256GCM` content encryption. */
|
|
15
|
+
alg: z.string(),
|
|
16
|
+
/** Key use. Always `enc`. */
|
|
17
|
+
use: z.string(),
|
|
18
|
+
/** Key identifier. Put it in the JWE protected header. */
|
|
19
|
+
kid: z.string(),
|
|
20
|
+
});
|
|
21
|
+
export type KeyringTransferKey = z.infer<typeof KeyringTransferKeySchema>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Response of `composio.keyring.listTransferKeys()`.
|
|
25
|
+
*/
|
|
26
|
+
export const KeyringTransferKeysResponseSchema = z.object({
|
|
27
|
+
/** The `kid` of the key to seal new secrets to. */
|
|
28
|
+
activeKid: z.string(),
|
|
29
|
+
/** Every currently accepted transfer key, newest first. */
|
|
30
|
+
keys: z.array(KeyringTransferKeySchema),
|
|
31
|
+
});
|
|
32
|
+
export type KeyringTransferKeysResponse = z.infer<typeof KeyringTransferKeysResponseSchema>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fields a tool-execution log search can filter on.
|
|
5
|
+
*/
|
|
6
|
+
export const LogSearchFilterFieldSchema = z.enum([
|
|
7
|
+
'tool_slug',
|
|
8
|
+
'toolkit_slug',
|
|
9
|
+
'connected_account_id',
|
|
10
|
+
'auth_config_id',
|
|
11
|
+
'status',
|
|
12
|
+
'user_id',
|
|
13
|
+
'session_id',
|
|
14
|
+
'sandbox_id',
|
|
15
|
+
'request_id',
|
|
16
|
+
'log_id',
|
|
17
|
+
]);
|
|
18
|
+
export type LogSearchFilterField = z.infer<typeof LogSearchFilterFieldSchema>;
|
|
19
|
+
|
|
20
|
+
export const LogSearchFilterOperatorSchema = z.enum(['==', '!=', 'contains', 'not_contains']);
|
|
21
|
+
export type LogSearchFilterOperator = z.infer<typeof LogSearchFilterOperatorSchema>;
|
|
22
|
+
|
|
23
|
+
export const LogSearchFilterSchema = z.object({
|
|
24
|
+
field: LogSearchFilterFieldSchema,
|
|
25
|
+
operator: LogSearchFilterOperatorSchema,
|
|
26
|
+
value: z.string(),
|
|
27
|
+
});
|
|
28
|
+
export type LogSearchFilter = z.infer<typeof LogSearchFilterSchema>;
|
|
29
|
+
|
|
30
|
+
export const LogSearchTimeRangeSchema = z.object({
|
|
31
|
+
/** Start time in epoch milliseconds (inclusive). */
|
|
32
|
+
from: z.number(),
|
|
33
|
+
/** End time in epoch milliseconds. */
|
|
34
|
+
to: z.number(),
|
|
35
|
+
});
|
|
36
|
+
export type LogSearchTimeRange = z.infer<typeof LogSearchTimeRangeSchema>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Params for `composio.logs.search()`.
|
|
40
|
+
*/
|
|
41
|
+
export const LogSearchParamsSchema = z.object({
|
|
42
|
+
limit: z.number().optional(),
|
|
43
|
+
cursor: z.string().nullable().optional(),
|
|
44
|
+
filters: z.array(LogSearchFilterSchema).optional(),
|
|
45
|
+
timeRange: LogSearchTimeRangeSchema.optional(),
|
|
46
|
+
});
|
|
47
|
+
export type LogSearchParams = z.infer<typeof LogSearchParamsSchema>;
|
|
48
|
+
|
|
49
|
+
export const ToolExecutionLogStatusSchema = z.enum(['success', 'failed']);
|
|
50
|
+
export const ToolExecutionLogLevelSchema = z.enum(['info', 'error', 'warn']);
|
|
51
|
+
|
|
52
|
+
export const ToolExecutionLogParentSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
logId: z.string(),
|
|
55
|
+
toolSlug: z.string(),
|
|
56
|
+
})
|
|
57
|
+
.nullable();
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A tool-execution log entry as returned by `composio.logs.search()`.
|
|
61
|
+
*/
|
|
62
|
+
export const ToolExecutionLogSchema = z.object({
|
|
63
|
+
id: z.string(),
|
|
64
|
+
/** ISO 8601 timestamp. */
|
|
65
|
+
timestamp: z.string(),
|
|
66
|
+
/** Log event type, e.g. `tool.execution`. */
|
|
67
|
+
type: z.string(),
|
|
68
|
+
status: ToolExecutionLogStatusSchema,
|
|
69
|
+
level: ToolExecutionLogLevelSchema,
|
|
70
|
+
message: z.string().optional(),
|
|
71
|
+
metadata: z.record(z.string(), z.unknown()),
|
|
72
|
+
metrics: z.record(z.string(), z.unknown()),
|
|
73
|
+
parent: ToolExecutionLogParentSchema,
|
|
74
|
+
});
|
|
75
|
+
export type ToolExecutionLog = z.infer<typeof ToolExecutionLogSchema>;
|
|
76
|
+
|
|
77
|
+
export const LogSearchResponseSchema = z.object({
|
|
78
|
+
logs: z.array(ToolExecutionLogSchema),
|
|
79
|
+
nextCursor: z.string().nullable(),
|
|
80
|
+
});
|
|
81
|
+
export type LogSearchResponse = z.infer<typeof LogSearchResponseSchema>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A single tool-execution log with its full detail, as returned by
|
|
85
|
+
* `composio.logs.get()`.
|
|
86
|
+
*/
|
|
87
|
+
export const ToolExecutionLogDetailSchema = ToolExecutionLogSchema.extend({
|
|
88
|
+
timings: z
|
|
89
|
+
.object({
|
|
90
|
+
/** Epoch milliseconds. */
|
|
91
|
+
startTime: z.number(),
|
|
92
|
+
/** Epoch milliseconds. */
|
|
93
|
+
endTime: z.number(),
|
|
94
|
+
})
|
|
95
|
+
.optional(),
|
|
96
|
+
context: z.object({
|
|
97
|
+
sessionId: z.string().optional(),
|
|
98
|
+
traceId: z.string().optional(),
|
|
99
|
+
requestId: z.string().optional(),
|
|
100
|
+
}),
|
|
101
|
+
source: z.object({
|
|
102
|
+
host: z.string().optional(),
|
|
103
|
+
framework: z.string().optional(),
|
|
104
|
+
language: z.string().optional(),
|
|
105
|
+
}),
|
|
106
|
+
data: z.record(z.string(), z.unknown()),
|
|
107
|
+
});
|
|
108
|
+
export type ToolExecutionLogDetail = z.infer<typeof ToolExecutionLogDetailSchema>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod/v3';
|
|
2
|
+
import { ToolRouterTagsParamSchema } from './toolRouter.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Params for `composio.sessionConfigs.list()`. The backend owns the defaults:
|
|
6
|
+
* active configs only, 20 per page, at most 100.
|
|
7
|
+
*/
|
|
8
|
+
export const SessionConfigListParamsSchema = z.object({
|
|
9
|
+
/** Case-insensitive substring match against the config name. */
|
|
10
|
+
search: z.string().optional(),
|
|
11
|
+
/** `true` returns only archived configs. Omitted returns active configs. */
|
|
12
|
+
archived: z.boolean().optional(),
|
|
13
|
+
/** Page size. The backend defaults to 20 and caps it at 100. */
|
|
14
|
+
limit: z.number().optional(),
|
|
15
|
+
/** `nextCursor` from a previous page. */
|
|
16
|
+
cursor: z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
export type SessionConfigListParams = z.infer<typeof SessionConfigListParamsSchema>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A saved Session config as listed by `composio.sessionConfigs.list()`.
|
|
22
|
+
*/
|
|
23
|
+
export const SessionConfigSummarySchema = z.object({
|
|
24
|
+
/** Stable `sc_…` identifier. */
|
|
25
|
+
id: z.string(),
|
|
26
|
+
/** Project-unique display name. */
|
|
27
|
+
name: z.string(),
|
|
28
|
+
archived: z.boolean(),
|
|
29
|
+
/** ISO 8601 timestamp. */
|
|
30
|
+
createdAt: z.string(),
|
|
31
|
+
/** ISO 8601 timestamp. */
|
|
32
|
+
updatedAt: z.string(),
|
|
33
|
+
});
|
|
34
|
+
export type SessionConfigSummary = z.infer<typeof SessionConfigSummarySchema>;
|
|
35
|
+
|
|
36
|
+
export const SessionConfigListResponseSchema = z.object({
|
|
37
|
+
items: z.array(SessionConfigSummarySchema),
|
|
38
|
+
/** Cursor for the next page, or `null` on the last page. */
|
|
39
|
+
nextCursor: z.string().nullable(),
|
|
40
|
+
});
|
|
41
|
+
export type SessionConfigListResponse = z.infer<typeof SessionConfigListResponseSchema>;
|
|
42
|
+
|
|
43
|
+
const SessionConfigTagPolicySchema = z.object({
|
|
44
|
+
enable: z.array(ToolRouterTagsParamSchema.element).optional(),
|
|
45
|
+
disable: z.array(ToolRouterTagsParamSchema.element).optional(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The access policy stored in a saved Session config, in the backend's
|
|
50
|
+
* `enable`/`disable` shape. Toolkit slug keys and tag names are kept exactly
|
|
51
|
+
* as the backend sends them.
|
|
52
|
+
*/
|
|
53
|
+
export const SessionConfigPolicySchema = z.object({
|
|
54
|
+
toolkits: z
|
|
55
|
+
.union([z.object({ enable: z.array(z.string()) }), z.object({ disable: z.array(z.string()) })])
|
|
56
|
+
.optional(),
|
|
57
|
+
/** Per-toolkit tool policy, keyed by toolkit slug. */
|
|
58
|
+
tools: z
|
|
59
|
+
.record(
|
|
60
|
+
z.string(),
|
|
61
|
+
z.union([
|
|
62
|
+
z.object({ enable: z.array(z.string()) }),
|
|
63
|
+
z.object({ disable: z.array(z.string()) }),
|
|
64
|
+
z.object({ tags: SessionConfigTagPolicySchema }),
|
|
65
|
+
])
|
|
66
|
+
)
|
|
67
|
+
.optional(),
|
|
68
|
+
/** Global tag policy. */
|
|
69
|
+
tags: SessionConfigTagPolicySchema.optional(),
|
|
70
|
+
});
|
|
71
|
+
export type SessionConfigPolicy = z.infer<typeof SessionConfigPolicySchema>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A saved Session config with its description and access policy, as returned
|
|
75
|
+
* by `composio.sessionConfigs.get()`.
|
|
76
|
+
*/
|
|
77
|
+
export const SessionConfigSchema = SessionConfigSummarySchema.extend({
|
|
78
|
+
description: z.string().nullable(),
|
|
79
|
+
config: SessionConfigPolicySchema,
|
|
80
|
+
});
|
|
81
|
+
export type SessionConfig = z.infer<typeof SessionConfigSchema>;
|
package/src/types/tool.types.ts
CHANGED
|
@@ -407,6 +407,8 @@ export const ToolExecuteResponseSchema = z.object({
|
|
|
407
407
|
successful: z.boolean(),
|
|
408
408
|
logId: z.string().optional(),
|
|
409
409
|
sessionInfo: z.unknown().optional(),
|
|
410
|
+
/** Actual premium usage charge when the Session opts into returning it. */
|
|
411
|
+
premiumCharge: z.unknown().optional(),
|
|
410
412
|
});
|
|
411
413
|
export type ToolExecuteResponse = z.infer<typeof ToolExecuteResponseSchema>;
|
|
412
414
|
|