@composio/core 0.27.0 → 0.28.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.
Files changed (47) hide show
  1. package/dist/{CustomTool-CqPoLUD6.d.mts → CustomTool-DyypijT6.d.mts} +2 -2
  2. package/dist/{Telemetry-41JkqpZ7.mjs → Telemetry-D2PJwXKx.mjs} +1 -1
  3. package/dist/{composio-BUa10iB3.d.mts → composio-CwHMpKXb.d.mts} +704 -26
  4. package/dist/{customTool.types-gX421uPT.d.mts → customTool.types-DoItUHkO.d.mts} +11 -10
  5. package/dist/docs/reference/sdk-reference/typescript/session.mdx +3 -3
  6. package/dist/experimental/index.d.mts +2 -2
  7. package/dist/{fileUtils.node-DNLhLg0W.mjs → fileUtils.node-ILI1IjnZ.mjs} +4 -3
  8. package/dist/index.d.mts +4 -4
  9. package/dist/index.mjs +2107 -1977
  10. package/dist/models/Files.node.mjs +2 -2
  11. package/dist/sensitiveFileUploadPaths-BaEORC7-.mjs +588 -0
  12. package/dist/{types-DXxfzBX3.d.mts → types-DWZWePfZ.d.mts} +2 -2
  13. package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
  14. package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
  15. package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
  16. package/dist/utils/modifiers/FileToolModifier.node.mjs +1 -1
  17. package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
  18. package/package.json +7 -6
  19. package/src/lib/toolRouterParams.ts +28 -33
  20. package/src/lib/toolRouterSessionDelete.ts +1 -10
  21. package/src/models/ConnectedAccounts.ts +1 -1
  22. package/src/models/CustomTool.ts +1 -1
  23. package/src/models/CustomToolkits.ts +114 -8
  24. package/src/models/Experimental.ts +1 -1
  25. package/src/models/MCP.ts +1 -2
  26. package/src/models/SessionConfigs.ts +11 -3
  27. package/src/models/SessionContext.ts +4 -4
  28. package/src/models/ToolRouter.ts +2 -3
  29. package/src/models/ToolRouterSession.ts +17 -16
  30. package/src/models/Tools.ts +3 -3
  31. package/src/models/Triggers.ts +12 -5
  32. package/src/models/inlineCustomToolsPayload.ts +3 -3
  33. package/src/models/proxyParamsTransform.ts +1 -1
  34. package/src/types/customTool.types.ts +13 -5
  35. package/src/types/customToolkits.types.ts +89 -9
  36. package/src/types/sessionConfigs.types.ts +21 -7
  37. package/src/types/toolRouter.types.ts +14 -7
  38. package/src/types/triggers.types.ts +14 -0
  39. package/src/utils/fileUtils.node.ts +5 -2
  40. package/src/utils/mime.ts +347 -1
  41. package/src/utils/transformers/connectedAccounts.ts +2 -7
  42. package/src/utils/transformers/customToolkits.ts +78 -9
  43. package/src/utils/transformers/sessionConfigs.ts +3 -3
  44. package/src/utils/transformers/toolRouterResponseTransform.ts +23 -75
  45. package/src/utils/transformers/toolkits.ts +7 -13
  46. package/src/utils/transformers/triggers.ts +28 -18
  47. package/dist/sensitiveFileUploadPaths-BlLp-Yo2.mjs +0 -189
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "engines": {
5
5
  "node": ">=22.22.3"
6
6
  },
7
- "version": "0.27.0",
7
+ "version": "0.28.0",
8
8
  "description": "",
9
9
  "main": "dist/index.mjs",
10
10
  "publishConfig": {
@@ -111,31 +111,32 @@
111
111
  ],
112
112
  "license": "ISC",
113
113
  "devDependencies": {
114
- "@hono/node-server": "^2.1.4",
114
+ "@hono/node-server": "^2.1.5",
115
115
  "@type-challenges/utils": "^0.1.1",
116
116
  "@types/semver": "^7.8.0",
117
117
  "ajv": "^8.20.0",
118
118
  "fast-check": "^4.10.2",
119
119
  "hono": "^4.13.13",
120
+ "mime": "^4.1.1",
120
121
  "tsdown": "^0.23.1",
121
122
  "tsx": "^4.23.15",
122
123
  "typedoc": "^0.28.20",
123
124
  "typescript": "npm:@typescript/typescript6@^6.0.2",
124
- "vitest": "^5.0.3",
125
+ "vitest": "^5.0.5",
125
126
  "zod": "^4.5.4"
126
127
  },
127
128
  "peerDependencies": {
128
129
  "zod": ">=3.25.76 <5"
129
130
  },
130
131
  "dependencies": {
131
- "@composio/client": "2.0.0-rc.19",
132
+ "@composio/client": "2.0.1",
132
133
  "@types/json-schema": "^7.0.15",
133
134
  "is-fs-case-sensitive": "^2.0.0",
134
- "openai": "^7.32.0",
135
+ "openai": "^7.39.0",
135
136
  "picocolors": "^1.1.1",
136
137
  "pusher-js": "^8.6.0",
137
138
  "semver": "^7.8.5",
138
- "undici": "^7.30.0",
139
+ "undici": "^7.30.1",
139
140
  "zod-to-json-schema": "^3.25.2",
140
141
  "@composio/json-schema-to-zod": "0.4.0"
141
142
  },
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SessionCreateParams,
3
3
  SessionPatchParams,
4
- } from '@composio/client/resources/tool-router/session/session.mjs';
4
+ } from '@composio/client/resources/tool-router/session';
5
5
  import {
6
6
  ToolRouterConfigTags,
7
7
  ToolRouterConfigTools,
@@ -85,7 +85,9 @@ export const transformToolRouterToolsParams = (
85
85
 
86
86
  export const transformToolRouterTagsParams = (
87
87
  params?: ToolRouterConfigTags
88
- ): SessionCreateParams.Tags['tags'] | undefined => {
88
+ ):
89
+ | Extract<NonNullable<SessionCreateParams['tools']>[string], { tags: unknown }>['tags']
90
+ | undefined => {
89
91
  if (!params) {
90
92
  return undefined;
91
93
  }
@@ -102,7 +104,7 @@ export const transformToolRouterTagsParams = (
102
104
 
103
105
  export const transformToolRouterManageConnectionsParams = (
104
106
  params?: boolean | z.infer<typeof ToolRouterConfigManageConnectionsSchema>
105
- ): SessionCreateParams.ManageConnections => {
107
+ ): NonNullable<SessionCreateParams['manage_connections']> => {
106
108
  if (params === undefined) {
107
109
  // Default case when params is undefined
108
110
  return {
@@ -145,7 +147,7 @@ export const resolveToolRouterSandboxConfig = (
145
147
 
146
148
  export const transformToolRouterSandboxParams = (
147
149
  params?: ParsedCreateSessionConfig['sandbox'] | ParsedCreateSessionConfig['workbench']
148
- ): SessionCreateParams.Workbench | undefined => {
150
+ ): NonNullable<SessionCreateParams['workbench']> | undefined => {
149
151
  if (!params) {
150
152
  return undefined;
151
153
  }
@@ -165,54 +167,48 @@ export const transformToolRouterWorkbenchParams = transformToolRouterSandboxPara
165
167
  * PATCH-safe variant of transformToolRouterManageConnectionsParams.
166
168
  * Does NOT apply defaults — only includes fields explicitly present in the input.
167
169
  */
168
- /** Widens the listed keys of a generated request type so `null` can travel on the wire. */
170
+ /**
171
+ * Widens the listed keys of a generated request type so `null` can travel on
172
+ * the wire. The spec does not mark these nullable until ComposioHQ/platform#13157
173
+ * lands.
174
+ */
169
175
  type WithNull<T, K extends keyof T> = Omit<T, K> & { [P in K]?: NonNullable<T[P]> | null };
170
176
 
171
177
  /**
172
178
  * `manage_connections` as sent by `session.update()`. Only the supplied
173
- * subfields travel; `callback_url: null` removes the stored callback, which
174
- * the generated client types as string-only.
179
+ * subfields travel; `callback_url: null` removes the stored callback.
175
180
  */
176
181
  export type SessionPatchManageConnectionsBody = WithNull<
177
- SessionPatchParams.ManageConnections,
182
+ NonNullable<SessionPatchParams['manage_connections']>,
178
183
  'callback_url'
179
184
  >;
180
185
 
181
186
  /** `multi_account` as sent by `session.update()`; `null` removes the stored maximum. */
182
187
  export type SessionPatchMultiAccountBody = WithNull<
183
- SessionPatchParams.MultiAccount,
188
+ NonNullable<SessionPatchParams['multi_account']>,
184
189
  'max_accounts_per_toolkit'
185
190
  >;
186
191
 
187
192
  /** `experimental` as sent by `session.update()`; `null` removes a stored leaf. */
188
193
  export type SessionPatchExperimentalBody = WithNull<
189
- SessionPatchParams.Experimental,
194
+ NonNullable<SessionPatchParams['experimental']>,
190
195
  'permissions' | 'link_url_overwrite' | 'fast_mode' | 'submit_feedback'
191
196
  >;
192
197
 
193
- /** A hook as the API takes it, in snake_case. The generated client does not type `hooks` yet. */
194
- export type SessionHookBody = {
195
- type: 'before_execute' | 'after_execute';
196
- id: string;
197
- name?: string;
198
- applies_to: 'all' | { toolkits: string[] };
199
- handler:
200
- | { type: 'condition_check'; condition: string; action: 'block' }
201
- | { type: 'prompt_injection_check'; action: 'block' };
202
- };
203
-
204
- /** Request body of `sessions.create()`: the generated `SessionCreateParams` plus `hooks`. */
205
- export type SessionCreateBody = SessionCreateParams & { hooks?: SessionHookBody[] };
206
-
207
- /** `hooks` as sent on create and update: `appliesTo` becomes `applies_to`. */
208
- export const transformToolRouterHooksParams = (hooks: ToolRouterHook[]): SessionHookBody[] =>
198
+ /**
199
+ * `hooks` as sent on create and update: `appliesTo` becomes `applies_to`.
200
+ * Create and patch take the same hook shape.
201
+ */
202
+ export const transformToolRouterHooksParams = (
203
+ hooks: ToolRouterHook[]
204
+ ): NonNullable<SessionCreateParams['hooks']> =>
209
205
  hooks.map(({ appliesTo, ...hook }) => ({ ...hook, applies_to: appliesTo }));
210
206
 
211
207
  /**
212
208
  * Request body of `session.update()`. Extends the generated `SessionPatchParams`
213
- * with the nullable policy blocks (`null` removes the stored override), `hooks`
214
- * and the `expected_config_version` root precondition, none of which the
215
- * generated client types yet.
209
+ * with the nullable policy blocks (`null` removes the stored override) and the
210
+ * `expected_config_version` root precondition, which the spec does not declare
211
+ * until ComposioHQ/platform#13157 lands.
216
212
  */
217
213
  export type SessionPatchBody = Omit<
218
214
  WithNull<
@@ -224,7 +220,6 @@ export type SessionPatchBody = Omit<
224
220
  manage_connections?: SessionPatchManageConnectionsBody | null;
225
221
  multi_account?: SessionPatchMultiAccountBody | null;
226
222
  experimental?: SessionPatchExperimentalBody | null;
227
- hooks?: SessionHookBody[] | null;
228
223
  expected_config_version?: number;
229
224
  };
230
225
 
@@ -312,7 +307,7 @@ const transformToolRouterUpdateExperimentalParams = (
312
307
  */
313
308
  export const transformToolRouterUpdateSandboxParams = (
314
309
  params: Partial<ToolRouterSandboxConfig>
315
- ): SessionPatchParams.Workbench => {
310
+ ): NonNullable<SessionPatchParams['workbench']> => {
316
311
  const result: Record<string, unknown> = {};
317
312
  if (params.enable !== undefined) {
318
313
  result.enable = params.enable;
@@ -326,7 +321,7 @@ export const transformToolRouterUpdateSandboxParams = (
326
321
  if (params.sandboxSize !== undefined) {
327
322
  result.sandbox_size = params.sandboxSize;
328
323
  }
329
- return result as SessionPatchParams.Workbench;
324
+ return result as NonNullable<SessionPatchParams['workbench']>;
330
325
  };
331
326
 
332
327
  /** @deprecated Renamed — use `transformToolRouterUpdateSandboxParams` instead. `workbench` is a backwards-compatible alias for `sandbox`. */
@@ -334,7 +329,7 @@ export const transformToolRouterUpdateWorkbenchParams = transformToolRouterUpdat
334
329
 
335
330
  export const transformToolRouterMultiAccountParams = (
336
331
  params?: ParsedCreateSessionConfig['multiAccount']
337
- ): SessionCreateParams.MultiAccount | undefined => {
332
+ ): NonNullable<SessionCreateParams['multi_account']> | undefined => {
338
333
  if (!params) {
339
334
  return undefined;
340
335
  }
@@ -4,22 +4,13 @@ import type { ToolRouterSessionDeleteResponse } from '../types/toolRouter.types'
4
4
  import { ToolRouterSessionDeleteResponseSchema } from '../types/toolRouter.types';
5
5
  import { withCancellation } from '../utils/cancellation';
6
6
 
7
- type ToolRouterSessionDeleteWireResponse = {
8
- session_id: string;
9
- deleted: true;
10
- };
11
-
12
7
  export async function deleteToolRouterSession(
13
8
  client: ComposioClient,
14
9
  sessionId: string,
15
10
  requestOptions?: ComposioRequestOptions
16
11
  ): Promise<ToolRouterSessionDeleteResponse> {
17
12
  const response = await withCancellation(
18
- () =>
19
- client.delete<ToolRouterSessionDeleteWireResponse>(
20
- `/api/v3.1/tool_router/session/${encodeURIComponent(sessionId)}`,
21
- requestOptions
22
- ),
13
+ () => client.toolRouter.session.delete(sessionId, requestOptions),
23
14
  requestOptions?.signal
24
15
  );
25
16
 
@@ -253,7 +253,7 @@ export class ConnectedAccounts {
253
253
  connection: {
254
254
  callback_url: options?.callbackUrl,
255
255
  user_id: userId,
256
- state: state as ConnectedAccountCreateParamsRaw.Connection['state'],
256
+ state: state as NonNullable<ConnectedAccountCreateParamsRaw['connection']>['state'],
257
257
  ...(options?.alias != null && { alias: options.alias }),
258
258
  },
259
259
  };
@@ -37,7 +37,7 @@ import {
37
37
  import type {
38
38
  SessionCreateResponse,
39
39
  SessionRetrieveResponse,
40
- } from '@composio/client/resources/tool-router/session/session.mjs';
40
+ } from '@composio/client/resources/tool-router/session';
41
41
  import { ValidationError } from '../errors';
42
42
  import { PRELOAD_TOOLS_ALL } from '../lib/toolRouterConstants';
43
43
  import {
@@ -7,10 +7,16 @@
7
7
  */
8
8
  import ComposioClient from '@composio/client';
9
9
  import {
10
+ CustomToolkitCreateParams,
11
+ CustomToolkitCreateParamsSchema,
12
+ CustomToolkitCreateResponse,
10
13
  CustomToolkitDeleteResponse,
11
14
  CustomToolkitSyncParams,
12
15
  CustomToolkitSyncParamsSchema,
13
16
  CustomToolkitSyncResponse,
17
+ CustomToolkitUpdateParams,
18
+ CustomToolkitUpdateParamsSchema,
19
+ CustomToolkitUpdateResponse,
14
20
  CustomToolkitUpsertParams,
15
21
  CustomToolkitUpsertParamsSchema,
16
22
  CustomToolkitUpsertResponse,
@@ -19,14 +25,24 @@ import { ComposioRequestOptions } from '../types/requestOptions.types';
19
25
  import { ValidationError } from '../errors/ValidationErrors';
20
26
  import { telemetry } from '../telemetry/Telemetry';
21
27
  import { withCancellation } from '../utils/cancellation';
28
+ import logger from '../utils/logger';
22
29
  import {
30
+ transformCustomToolkitCreateParams,
31
+ transformCustomToolkitCreateResponse,
23
32
  transformCustomToolkitDeleteResponse,
24
33
  transformCustomToolkitSyncParams,
25
34
  transformCustomToolkitSyncResponse,
35
+ transformCustomToolkitUpdateParams,
36
+ transformCustomToolkitUpdateResponse,
26
37
  transformCustomToolkitUpsertParams,
27
38
  transformCustomToolkitUpsertResponse,
28
39
  } from '../utils/transformers/customToolkits';
29
40
 
41
+ const UPSERT_DEPRECATION =
42
+ '[Deprecation] composio.experimental.customToolkits.upsert() is deprecated. ' +
43
+ 'Use create() for a new toolkit and update(slug, ...) to change its name, logo or API key field.';
44
+ let _upsertDeprecationWarned = false;
45
+
30
46
  /**
31
47
  * `composio.experimental.customToolkits` — toolkits your project registers
32
48
  * from its own app or MCP server, with their own auth configs and connected
@@ -38,15 +54,13 @@ import {
38
54
  *
39
55
  * @example
40
56
  * ```typescript
41
- * const { slug } = await composio.experimental.customToolkits.upsert({
42
- * slug: 'MY_TOOLKIT',
43
- * toolkitConfig: {
44
- * name: 'My Toolkit',
45
- * appUrl: 'https://mcp.example.com/mcp',
46
- * authSchemes: [{ mode: 'DCR_OAUTH', discoveryUrl: 'https://mcp.example.com/.well-known/oauth-authorization-server' }],
47
- * },
57
+ * const { slug } = await composio.experimental.customToolkits.create({
58
+ * name: 'My Toolkit',
59
+ * appUrl: 'https://mcp.example.com/mcp',
60
+ * authSchemes: [{ mode: 'DCR_OAUTH', discoveryUrl: 'https://mcp.example.com/.well-known/oauth-authorization-server' }],
61
+ * userId: 'all',
48
62
  * });
49
- * await composio.experimental.customToolkits.sync(slug);
63
+ * await composio.experimental.customToolkits.update(slug, { name: 'My Renamed Toolkit' });
50
64
  * ```
51
65
  */
52
66
  export class CustomToolkits {
@@ -57,6 +71,90 @@ export class CustomToolkits {
57
71
  telemetry.instrument(this, 'CustomToolkits');
58
72
  }
59
73
 
74
+ /**
75
+ * Creates a custom MCP toolkit and returns its generated slug.
76
+ * **Experimental — custom toolkits are in pilot; shape may change.**
77
+ *
78
+ * Set `userId` to `'all'` to share the toolkit with every user in the
79
+ * project, or to a user ID to make it private to that user. `appUrl`,
80
+ * `authSchemes` and `userId` cannot change later: delete and re-create the
81
+ * toolkit instead. For a private toolkit, `connectLink` is where to send
82
+ * that user to connect.
83
+ *
84
+ * @param {CustomToolkitCreateParams} params - The toolkit to create
85
+ * @returns {Promise<CustomToolkitCreateResponse>} The toolkit's slug and, for a private toolkit, a connect link
86
+ * @throws {ValidationError} If the params fail validation
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * const { slug, connectLink } = await composio.experimental.customToolkits.create({
91
+ * name: 'Internal API',
92
+ * appUrl: 'https://mcp.internal.example.com/mcp',
93
+ * authSchemes: [
94
+ * { mode: 'API_KEY', headers: { Authorization: 'Bearer {{generic_api_key}}' } },
95
+ * ],
96
+ * userId: 'user_123',
97
+ * });
98
+ * ```
99
+ */
100
+ async create(
101
+ params: CustomToolkitCreateParams,
102
+ requestOptions?: ComposioRequestOptions
103
+ ): Promise<CustomToolkitCreateResponse> {
104
+ const parsedParams = CustomToolkitCreateParamsSchema.safeParse(params);
105
+ if (!parsedParams.success) {
106
+ throw new ValidationError('Failed to parse custom toolkit create params', {
107
+ cause: parsedParams.error,
108
+ });
109
+ }
110
+ const body = transformCustomToolkitCreateParams(parsedParams.data);
111
+ const result = await withCancellation(
112
+ () => this.client.custom.createToolkit(body, requestOptions),
113
+ requestOptions?.signal
114
+ );
115
+ return transformCustomToolkitCreateResponse(result);
116
+ }
117
+
118
+ /**
119
+ * Updates a custom toolkit's name, logo or API key field copy. Omitted
120
+ * fields keep their current value.
121
+ * **Experimental — custom toolkits are in pilot; shape may change.**
122
+ *
123
+ * On a project with 2FA enabled, updating a private toolkit requires the
124
+ * `userId` it is private to.
125
+ *
126
+ * @param {string} slug - The custom toolkit slug returned by `create()`
127
+ * @param {CustomToolkitUpdateParams} params - At least one of `name`, `logoFile`, `apiKeyField`
128
+ * @returns {Promise<CustomToolkitUpdateResponse>} `{ success: true }`
129
+ * @throws {ValidationError} If the params fail validation
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * await composio.experimental.customToolkits.update('CUSTOM_INTERNAL_API_K7F2Q', {
134
+ * name: 'Internal API (prod)',
135
+ * userId: 'user_123',
136
+ * });
137
+ * ```
138
+ */
139
+ async update(
140
+ slug: string,
141
+ params: CustomToolkitUpdateParams,
142
+ requestOptions?: ComposioRequestOptions
143
+ ): Promise<CustomToolkitUpdateResponse> {
144
+ const parsedParams = CustomToolkitUpdateParamsSchema.safeParse(params);
145
+ if (!parsedParams.success) {
146
+ throw new ValidationError('Failed to parse custom toolkit update params', {
147
+ cause: parsedParams.error,
148
+ });
149
+ }
150
+ const body = transformCustomToolkitUpdateParams(parsedParams.data);
151
+ const result = await withCancellation(
152
+ () => this.client.custom.updateToolkits(slug, body, requestOptions),
153
+ requestOptions?.signal
154
+ );
155
+ return transformCustomToolkitUpdateResponse(result);
156
+ }
157
+
60
158
  /**
61
159
  * Creates a custom toolkit, or updates its display metadata (name, API key
62
160
  * field copy) when the project already owns a toolkit with this slug.
@@ -83,11 +181,19 @@ export class CustomToolkits {
83
181
  * },
84
182
  * });
85
183
  * ```
184
+ *
185
+ * @deprecated Use `create()` for a new toolkit and `update(slug, ...)` to change
186
+ * its name, logo or API key field. `create()` generates the slug, so store the
187
+ * slug it returns.
86
188
  */
87
189
  async upsert(
88
190
  params: CustomToolkitUpsertParams,
89
191
  requestOptions?: ComposioRequestOptions
90
192
  ): Promise<CustomToolkitUpsertResponse> {
193
+ if (!_upsertDeprecationWarned) {
194
+ _upsertDeprecationWarned = true;
195
+ logger.warn(UPSERT_DEPRECATION);
196
+ }
91
197
  const parsedParams = CustomToolkitUpsertParamsSchema.safeParse(params);
92
198
  if (!parsedParams.success) {
93
199
  throw new ValidationError('Failed to parse custom toolkit upsert params', {
@@ -144,7 +144,7 @@ export class Experimental {
144
144
  usage: Usage;
145
145
 
146
146
  /**
147
- * Register and manage project-owned custom toolkits (`upsert()` / `sync()` / `delete()`).
147
+ * Register and manage project-owned custom toolkits (`create()` / `update()` / `sync()` / `delete()`).
148
148
  * **Experimental — custom toolkits are in pilot; shape may change.**
149
149
  *
150
150
  * @example
package/src/models/MCP.ts CHANGED
@@ -20,8 +20,7 @@ import {
20
20
  import { MCPServerInstanceSchema } from '../types/mcp.experimental.types';
21
21
  import { ValidationError } from '../errors/ValidationErrors';
22
22
  import { transform } from '../utils/transform';
23
- import { McpUpdateResponse } from '@composio/client/resources.js';
24
- import { McpRetrieveResponse } from '@composio/client/resources';
23
+ import type { McpRetrieveResponse, McpUpdateResponse } from '@composio/client/resources/mcp';
25
24
  import { ComposioRequestOptions } from '../types/requestOptions.types';
26
25
  import { withCancellation } from '../utils/cancellation';
27
26
  import logger from '../utils/logger';
@@ -15,6 +15,7 @@ import { ComposioRequestOptions } from '../types/requestOptions.types';
15
15
  import { ValidationError } from '../errors/ValidationErrors';
16
16
  import { telemetry } from '../telemetry/Telemetry';
17
17
  import { withCancellation } from '../utils/cancellation';
18
+ import logger from '../utils/logger';
18
19
  import {
19
20
  transformSessionConfig,
20
21
  transformSessionConfigListResponse,
@@ -33,7 +34,7 @@ import {
33
34
  *
34
35
  * @example
35
36
  * ```typescript
36
- * const { items } = await composio.sessionConfigs.list({ search: 'support' });
37
+ * const { items } = await composio.sessionConfigs.list();
37
38
  * const sessionConfig = await composio.sessionConfigs.get(items[0].id);
38
39
  * const session = await composio.sessions.create('user_123', {
39
40
  * experimental: { sessionConfigId: sessionConfig.id },
@@ -56,7 +57,8 @@ export class SessionConfigs {
56
57
  *
57
58
  * Requires Session configs to be enabled for the project.
58
59
  *
59
- * @param {SessionConfigListParams} [params] - `search`, `archived`, `limit` and `cursor`
60
+ * @param {SessionConfigListParams} [params] - `archived`, `limit` and `cursor`; the
61
+ * deprecated `search` is ignored
60
62
  * @returns {Promise<SessionConfigListResponse>} Config summaries and the next cursor
61
63
  * @throws {ValidationError} If the params fail validation
62
64
  *
@@ -80,8 +82,14 @@ export class SessionConfigs {
80
82
  cause: parsedParams.error,
81
83
  });
82
84
  }
85
+ const { search, ...query } = parsedParams.data;
86
+ if (search !== undefined) {
87
+ logger.warn(
88
+ 'sessionConfigs.list(): the Composio API no longer accepts `search`; the option is ignored.'
89
+ );
90
+ }
83
91
  const result = await withCancellation(
84
- () => this.client.sessionConfigs.list(parsedParams.data, requestOptions),
92
+ () => this.client.sessionConfigs.list(query, requestOptions),
85
93
  requestOptions?.signal
86
94
  );
87
95
  return transformSessionConfigListResponse(result);
@@ -27,7 +27,7 @@ import {
27
27
  transformExecuteResponse,
28
28
  transformProxyExecuteResponse,
29
29
  } from '../utils/transformers/toolRouterResponseTransform';
30
- import type { SessionExecuteParams } from '@composio/client/resources/tool-router/session/session.mjs';
30
+ import type { SessionExecuteParams } from '@composio/client/resources/tool-router/session';
31
31
  import { inlineCustomToolsExperimental } from './inlineCustomToolsPayload';
32
32
  import { withCancellation } from '../utils/cancellation';
33
33
  import { withoutRetries } from '../utils/retries';
@@ -97,9 +97,9 @@ export class SessionContextImpl implements SessionContext {
97
97
  tool_slug: toolSlug,
98
98
  arguments: arguments_,
99
99
  };
100
- const experimental = inlineCustomToolsExperimental<SessionExecuteParams.Experimental>(
101
- this.inlineCustomToolsPayload
102
- );
100
+ const experimental = inlineCustomToolsExperimental<
101
+ NonNullable<SessionExecuteParams['experimental']>
102
+ >(this.inlineCustomToolsPayload);
103
103
  if (experimental) {
104
104
  executeParams.experimental = experimental;
105
105
  }
@@ -37,7 +37,7 @@ import {
37
37
  SessionCreateParams,
38
38
  SessionCreateResponse,
39
39
  SessionRetrieveResponse,
40
- } from '@composio/client/resources/tool-router/session/session.mjs';
40
+ } from '@composio/client/resources/tool-router/session';
41
41
  import type {
42
42
  CustomTool,
43
43
  CustomToolkit,
@@ -53,7 +53,6 @@ import {
53
53
  transformToolRouterInstantParams,
54
54
  transformToolRouterProxyExecuteParams,
55
55
  transformToolRouterHooksParams,
56
- type SessionCreateBody,
57
56
  resolveToolRouterSandboxConfig,
58
57
  } from '../lib/toolRouterParams';
59
58
  import { PRELOAD_TOOLS_ALL } from '../lib/toolRouterConstants';
@@ -277,7 +276,7 @@ export class ToolRouter<
277
276
  ])
278
277
  );
279
278
 
280
- const payload: SessionCreateBody = {
279
+ const payload: SessionCreateParams = {
281
280
  user_id: userId,
282
281
  auth_configs: routerConfig.authConfigs,
283
282
  connected_accounts: connectedAccountsPayload,
@@ -79,7 +79,7 @@ import type {
79
79
  SessionPatchParams,
80
80
  SessionPatchResponse,
81
81
  SessionSearchParams,
82
- } from '@composio/client/resources/tool-router/session/session.mjs';
82
+ } from '@composio/client/resources/tool-router/session';
83
83
  import { SessionProxyExecuteParamsSchema } from '../types/toolRouter.types';
84
84
  import { SessionContextImpl } from './SessionContext';
85
85
  import {
@@ -484,7 +484,7 @@ export class ToolRouterSession<
484
484
  ...(opts.callbackUrl !== undefined && { callback_url: opts.callbackUrl }),
485
485
  ...(opts.alias !== undefined && { alias: opts.alias }),
486
486
  ...(experimentalWire !== undefined && {
487
- experimental: experimentalWire as SessionLinkParams.Experimental,
487
+ experimental: experimentalWire as NonNullable<SessionLinkParams['experimental']>,
488
488
  }),
489
489
  };
490
490
 
@@ -667,9 +667,9 @@ export class ToolRouterSession<
667
667
  },
668
668
  requestOptions?: ComposioRequestOptions
669
669
  ): Promise<ToolRouterSessionSearchResponse> {
670
- const experimental = inlineCustomToolsExperimental<SessionSearchParams.Experimental>(
671
- this.inlineCustomToolsPayload
672
- );
670
+ const experimental = inlineCustomToolsExperimental<
671
+ NonNullable<SessionSearchParams['experimental']>
672
+ >(this.inlineCustomToolsPayload);
673
673
  const searchParams = {
674
674
  queries: [{ use_case: params.query }],
675
675
  ...(params.toolkits?.length ? { toolkits: params.toolkits } : {}),
@@ -738,9 +738,9 @@ export class ToolRouterSession<
738
738
  if (options?.account) {
739
739
  executeParams.account = options.account;
740
740
  }
741
- const experimental = inlineCustomToolsExperimental<SessionExecuteParams.Experimental>(
742
- this.inlineCustomToolsPayload
743
- );
741
+ const experimental = inlineCustomToolsExperimental<
742
+ NonNullable<SessionExecuteParams['experimental']>
743
+ >(this.inlineCustomToolsPayload);
744
744
  if (experimental) {
745
745
  executeParams.experimental = experimental;
746
746
  }
@@ -790,9 +790,9 @@ export class ToolRouterSession<
790
790
  arguments: arguments_ ?? {},
791
791
  ...inputResponseParams(options),
792
792
  };
793
- const experimental = inlineCustomToolsExperimental<SessionExecuteMetaParams.Experimental>(
794
- this.inlineCustomToolsPayload
795
- );
793
+ const experimental = inlineCustomToolsExperimental<
794
+ NonNullable<SessionExecuteMetaParams['experimental']>
795
+ >(this.inlineCustomToolsPayload);
796
796
  if (experimental) {
797
797
  executeMetaParams.experimental = experimental;
798
798
  }
@@ -896,8 +896,9 @@ export class ToolRouterSession<
896
896
  () =>
897
897
  this.client.toolRouter.session.patch(
898
898
  this.sessionId,
899
- // The generated client does not type `expected_config_version` or
900
- // the nullable policy blocks; the body is serialized as-is.
899
+ // `expected_config_version` and the nullable policy blocks are not in
900
+ // the spec until ComposioHQ/platform#13157 lands; the body is
901
+ // serialized as-is.
901
902
  body as SessionPatchParams,
902
903
  { ...requestOptions, maxRetries: 0 }
903
904
  ),
@@ -1010,9 +1011,9 @@ export class ToolRouterSession<
1010
1011
  tool?: Tool
1011
1012
  ): Promise<ToolExecuteResponse> {
1012
1013
  const body = { sessionId: this.sessionId, arguments: input };
1013
- const experimental = inlineCustomToolsExperimental<SessionExecuteParams.Experimental>(
1014
- this.inlineCustomToolsPayload
1015
- );
1014
+ const experimental = inlineCustomToolsExperimental<
1015
+ NonNullable<SessionExecuteParams['experimental']>
1016
+ >(this.inlineCustomToolsPayload);
1016
1017
  if (experimental) {
1017
1018
  return ToolsModel.executeSessionTool(toolSlug, body, modifiers, tool, { experimental });
1018
1019
  }
@@ -52,7 +52,7 @@ import { telemetry } from '../telemetry/Telemetry';
52
52
  import type { ComposioConfig } from '../composio';
53
53
  import { getToolkitVersion } from '../utils/toolkitVersion';
54
54
  import { handleToolExecutionError } from '../errors/ToolErrors';
55
- import type { SessionExecuteParams } from '@composio/client/resources/tool-router/session/session.mjs';
55
+ import type { SessionExecuteParams } from '@composio/client/resources/tool-router/session';
56
56
  import { CONFIG_DEFAULTS } from '../utils/config-defaults';
57
57
  import { resolveEffectiveUploadAllowlist } from '../utils/fileDirs';
58
58
  import {
@@ -72,7 +72,7 @@ import { ComposioRequestCancelledError } from '../errors/SDKErrors';
72
72
  const TOOL_ROUTER_SESSION_TOOLS_PAGE_LIMIT = 500;
73
73
 
74
74
  type ToolRouterSessionExecuteOptions = {
75
- experimental?: SessionExecuteParams.Experimental;
75
+ experimental?: NonNullable<SessionExecuteParams['experimental']>;
76
76
  };
77
77
 
78
78
  type RawToolParameters =
@@ -1362,7 +1362,7 @@ export class Tools<
1362
1362
  }
1363
1363
  // convert the headers and query to the composio format
1364
1364
  // { name: string, type: 'header' | 'query', value: string }
1365
- const parameters: ComposioToolProxyParams.Parameter[] = [];
1365
+ const parameters: NonNullable<ComposioToolProxyParams['parameters']>[number][] = [];
1366
1366
  const parameterTypes = {
1367
1367
  header: 'header',
1368
1368
  query: 'query',