@devries-cameron20 / composio Mirror · read-only / commits / 42ebff3f6
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 21:00 UTC

feat(connected-accounts): namespace SHARED-connection surface under experimental

Aligns the TypeScript SDK with the experimental wire shape used by Shared Connections. The flat accountType / aclConfigForShared options on connectedAccounts.link() and session.authorize() have moved under a single experimental block, and connectedAccounts.updateAcl() has moved off the class onto a top-level experimental_updateAcl(composio, id, opts) export — same precedent as experimental_createTool / experimental_createToolkit. The experimental namespace is the signal that the shape may change in future releases. Pinning a SHARED connection in a session config and direct execute by connectedAccountId are unchanged — only the connection-create / patch / authorize surfaces are namespaced. Also surfaces the accountType filter on connectedAccounts.list() so SHARED connections can be listed without dropping to the raw client. The wire keeps this as a flat query param, so the SDK keeps it flat too. @composio/client bumped from 0.1.0-alpha.71 -> 0.1.0-alpha.72 so the generated typed client carries the Experimental namespaces for link.create, toolRouter.session.link, and connectedAccounts.patch. Caller migration: // before await composio.connectedAccounts.link('user_id', 'auth_config_id', { accountType: 'SHARED', aclConfigForShared: { allowAllUsers: true }, }); await composio.connectedAccounts.updateAcl('ca_abc', { allowAllUsers: true }); await session.authorize('github', { accountType: 'SHARED', aclConfigForShared: { allowAllUsers: true }, }); // after await composio.connectedAccounts.link('user_id', 'auth_config_id', { experimental: { accountType: 'SHARED', aclConfigForShared: { allowAllUsers: true }, }, }); await experimental_updateAcl(composio, 'ca_abc', { allowAllUsers: true }); await session.authorize('github', { experimental: { accountType: 'SHARED', aclConfigForShared: { allowAllUsers: true }, }, }); // new — list SHARED connections const shared = await composio.connectedAccounts.list({ accountType: 'SHARED', userIds: ['user_creator'], }); Tests cover: experimental block forwarding (link + authorize), no-op when omitted, empty-array preservation, typed error mapping for the PRIVATE-with-ACL case, experimental_updateAcl body construction + deny-list handling + ValidationError when no fields are provided, and list(accountType: 'SHARED') flat-filter delegation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

venkat82 committed May 13, 2026 at 16:16 UTC 42ebff3f6bdf7971466dfb8449bd743f29c7e79c
10 files changed +503 -218
.changeset/connected-accounts-experimental-ts.md new
+49
@@ -0,0 +1,49 @@
1 +---
2 +'@composio/core': minor
3 +---
4 +
5 +feat(connected-accounts): namespace SHARED-connection surface under `experimental`
6 +
7 +Aligns the TypeScript SDK with the experimental wire shape used by Shared Connections. The flat `accountType` / `aclConfigForShared` options on `connectedAccounts.link()` and `session.authorize()` have moved under a single `experimental` block, and `connectedAccounts.updateAcl()` has moved off the class onto a top-level `experimental_updateAcl(composio, id, opts)` export — same precedent as `experimental_createTool` / `experimental_createToolkit`.
8 +
9 +The `experimental` namespace is the signal that the shape may change in future releases. Pinning a SHARED connection in a session config (`connectedAccounts: { gmail: [...] }`) and direct execute by `connectedAccountId` are unchanged — only the connection-create / patch / authorize surfaces are namespaced.
10 +
11 +Also surfaces the `accountType` filter on `connectedAccounts.list()` so SHARED connections can be listed without dropping to the raw client. The wire keeps this as a flat query param, so the SDK keeps it flat too.
12 +
13 +`@composio/client` bumped from `0.1.0-alpha.71` → `0.1.0-alpha.72` so the generated typed client carries the `Experimental` namespaces for `link.create`, `toolRouter.session.link`, and `connectedAccounts.patch`.
14 +
15 +Caller migration:
16 +
17 +```typescript
18 +// before
19 +await composio.connectedAccounts.link('user_id', 'auth_config_id', {
20 + accountType: 'SHARED',
21 + aclConfigForShared: { allowAllUsers: true },
22 +});
23 +await composio.connectedAccounts.updateAcl('ca_abc', { allowAllUsers: true });
24 +await session.authorize('github', {
25 + accountType: 'SHARED',
26 + aclConfigForShared: { allowAllUsers: true },
27 +});
28 +
29 +// after
30 +await composio.connectedAccounts.link('user_id', 'auth_config_id', {
31 + experimental: {
32 + accountType: 'SHARED',
33 + aclConfigForShared: { allowAllUsers: true },
34 + },
35 +});
36 +await experimental_updateAcl(composio, 'ca_abc', { allowAllUsers: true });
37 +await session.authorize('github', {
38 + experimental: {
39 + accountType: 'SHARED',
40 + aclConfigForShared: { allowAllUsers: true },
41 + },
42 +});
43 +
44 +// new — list SHARED connections
45 +const shared = await composio.connectedAccounts.list({
46 + accountType: 'SHARED',
47 + userIds: ['user_creator'],
48 +});
49 +```
pnpm-lock.yaml
+73 -21
@@ -25,8 +25,8 @@ catalogs:
25 specifier: ^4.20250917.0
26 version: 4.20260218.0
27 '@composio/client':
28 - specifier: 0.1.0-alpha.71
29 - version: 0.1.0-alpha.71
28 + specifier: 0.1.0-alpha.72
29 + version: 0.1.0-alpha.72
30 '@effect/cli':
31 specifier: ^0.73.2
32 version: 0.73.2
@@ -722,16 +722,16 @@ importers:
722 version: link:../../packages/providers/llamaindex
723 '@llamaindex/openai':
724 specifier: ^0.4.20
725 - version: 0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.20.0)(zod@4.3.6)
725 + version: 0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.20.0)(zod@3.25.76)
726 '@llamaindex/workflow':
727 specifier: ^1.1.24
728 - version: 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
728 + version: 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
729 dotenv:
730 specifier: ^16.4.1
731 version: 16.6.1
732 llamaindex:
733 specifier: ^0.12.0
734 - version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
734 + version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@3.25.76)
735 devDependencies:
736 '@types/bun':
737 specifier: ^1.2.9
@@ -1079,7 +1079,7 @@ importers:
1079 version: link:../cli-local-tools
1080 '@composio/client':
1081 specifier: 'catalog:'
1082 - version: 0.1.0-alpha.71
1082 + version: 0.1.0-alpha.72
1083 '@composio/core':
1084 specifier: workspace:*
1085 version: link:../core
@@ -1249,7 +1249,7 @@ importers:
1249 dependencies:
1250 '@composio/client':
1251 specifier: 'catalog:'
1252 - version: 0.1.0-alpha.71
1252 + version: 0.1.0-alpha.72
1253 '@composio/json-schema-to-zod':
1254 specifier: workspace:*
1255 version: link:../json-schema-to-zod
@@ -1422,7 +1422,7 @@ importers:
1422 dependencies:
1423 llamaindex:
1424 specifier: ^0.12.0
1425 - version: 0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
1425 + version: 0.12.1(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6)
1426 devDependencies:
1427 '@composio/core':
1428 specifier: workspace:*
@@ -1912,8 +1912,8 @@ packages:
1912 resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
1913 engines: {node: '>=0.1.90'}
1914
1915 - '@composio/client@0.1.0-alpha.71':
1916 - resolution: {integrity: sha512-6h1IPMbXIx5PjaU0T+a1MNnKHL/pPP7+X2nNQaler5XoENANWGm4mYePjR+7Cgtw1j6X2QkCmRLuX5q9c0INvQ==}
1915 + '@composio/client@0.1.0-alpha.72':
1916 + resolution: {integrity: sha512-2WYXgdlMvhoaJCsaSfyMAYGQ2tS5l2Fqdh2cMRqNi8NybIoOkFZy2ApBJJOoQwqfpUr41VymMW6FtiNQm7JavQ==}
1917
1918 '@cspotcode/source-map-support@0.8.1':
1919 resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
@@ -7286,7 +7286,7 @@ snapshots:
7286 '@colors/colors@1.5.0':
7287 optional: true
7288
7289 - '@composio/client@0.1.0-alpha.71': {}
7289 + '@composio/client@0.1.0-alpha.72': {}
7290
7291 '@cspotcode/source-map-support@0.8.1':
7292 dependencies:
@@ -8059,26 +8059,43 @@ snapshots:
8059 tree-sitter: 0.22.4
8060 web-tree-sitter: 0.24.7
8061
8062 - '@llamaindex/openai@0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.20.0)(zod@4.3.6)':
8062 + '@llamaindex/openai@0.4.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(ws@8.20.0)(zod@3.25.76)':
8063 dependencies:
8064 '@llamaindex/core': 0.6.22
8065 '@llamaindex/env': 0.1.30
8066 - openai: 5.23.2(ws@8.20.0)(zod@4.3.6)
8066 + openai: 5.23.2(ws@8.20.0)(zod@3.25.76)
8067 transitivePeerDependencies:
8068 - ws
8069 - zod
8070
8071 - '@llamaindex/workflow-core@1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)':
8071 + '@llamaindex/workflow-core@1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)':
8072 optionalDependencies:
8073 - '@modelcontextprotocol/sdk': 1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6)
8073 + '@modelcontextprotocol/sdk': 1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76)
8074 hono: 4.11.9
8075 + zod: 3.25.76
8076 +
8077 + '@llamaindex/workflow-core@1.3.3(zod@4.3.6)':
8078 + optionalDependencies:
8079 zod: 4.3.6
8080
8077 - '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)':
8081 + '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)':
8082 dependencies:
8083 '@llamaindex/core': 0.6.22
8084 '@llamaindex/env': 0.1.30
8081 - '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
8085 + '@llamaindex/workflow-core': 1.3.3(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
8086 + transitivePeerDependencies:
8087 + - '@modelcontextprotocol/sdk'
8088 + - hono
8089 + - next
8090 + - p-retry
8091 + - rxjs
8092 + - zod
8093 +
8094 + '@llamaindex/workflow@1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(zod@4.3.6)':
8095 + dependencies:
8096 + '@llamaindex/core': 0.6.22
8097 + '@llamaindex/env': 0.1.30
8098 + '@llamaindex/workflow-core': 1.3.3(zod@4.3.6)
8099 transitivePeerDependencies:
8100 - '@modelcontextprotocol/sdk'
8101 - hono
@@ -9104,6 +9121,14 @@ snapshots:
9121 optionalDependencies:
9122 vite: 7.3.1(@types/node@22.19.11)(tsx@4.21.0)(yaml@2.8.2)
9123
9124 + '@vitest/mocker@3.2.4(vite@7.3.1(@types/node@24.10.13)(tsx@4.21.0)(yaml@2.8.2))':
9125 + dependencies:
9126 + '@vitest/spy': 3.2.4
9127 + estree-walker: 3.0.3
9128 + magic-string: 0.30.21
9129 + optionalDependencies:
9130 + vite: 7.3.1(@types/node@24.10.13)(tsx@4.21.0)(yaml@2.8.2)
9131 +
9132 '@vitest/pretty-format@3.2.4':
9133 dependencies:
9134 tinyrainbow: 2.0.0
@@ -9133,7 +9158,7 @@ snapshots:
9158 sirv: 3.0.2
9159 tinyglobby: 0.2.15
9160 tinyrainbow: 2.0.0
9136 - vitest: 3.2.4(@types/node@22.19.11)(@vitest/ui@3.2.4)(tsx@4.21.0)(yaml@2.8.2)
9161 + vitest: 3.2.4(@types/node@24.10.13)(@vitest/ui@3.2.4)(tsx@4.21.0)(yaml@2.8.2)
9162
9163 '@vitest/utils@3.2.4':
9164 dependencies:
@@ -10585,12 +10610,34 @@ snapshots:
10610 rfdc: 1.4.1
10611 wrap-ansi: 9.0.2
10612
10588 - llamaindex@0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6):
10613 + llamaindex@0.12.1(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@3.25.76):
10614 dependencies:
10615 '@llamaindex/core': 0.6.22
10616 '@llamaindex/env': 0.1.30
10617 '@llamaindex/node-parser': 2.0.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)
10593 - '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@4.3.6))(hono@4.11.9)(zod@4.3.6)
10618 + '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(@modelcontextprotocol/sdk@1.26.0(@cfworker/json-schema@4.1.1)(zod@3.25.76))(hono@4.11.9)(zod@3.25.76)
10619 + '@types/lodash': 4.17.23
10620 + '@types/node': 24.10.13
10621 + lodash: 4.17.23
10622 + magic-bytes.js: 1.13.0
10623 + transitivePeerDependencies:
10624 + - '@huggingface/transformers'
10625 + - '@modelcontextprotocol/sdk'
10626 + - gpt-tokenizer
10627 + - hono
10628 + - next
10629 + - p-retry
10630 + - rxjs
10631 + - tree-sitter
10632 + - web-tree-sitter
10633 + - zod
10634 +
10635 + llamaindex@0.12.1(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)(zod@4.3.6):
10636 + dependencies:
10637 + '@llamaindex/core': 0.6.22
10638 + '@llamaindex/env': 0.1.30
10639 + '@llamaindex/node-parser': 2.0.22(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(tree-sitter@0.22.4)(web-tree-sitter@0.24.7)
10640 + '@llamaindex/workflow': 1.1.24(@llamaindex/core@0.6.22)(@llamaindex/env@0.1.30)(zod@4.3.6)
10641 '@types/lodash': 4.17.23
10642 '@types/node': 24.10.13
10643 lodash: 4.17.23
@@ -10874,6 +10921,11 @@ snapshots:
10921 is-inside-container: 1.0.0
10922 wsl-utils: 0.1.0
10923
10924 + openai@5.23.2(ws@8.20.0)(zod@3.25.76):
10925 + optionalDependencies:
10926 + ws: 8.20.0
10927 + zod: 3.25.76
10928 +
10929 openai@5.23.2(ws@8.20.0)(zod@4.3.6):
10930 optionalDependencies:
10931 ws: 8.20.0
@@ -11972,7 +12024,7 @@ snapshots:
12024 dependencies:
12025 '@types/chai': 5.2.3
12026 '@vitest/expect': 3.2.4
11975 - '@vitest/mocker': 3.2.4(vite@7.3.1(@types/node@22.19.11)(tsx@4.21.0)(yaml@2.8.2))
12027 + '@vitest/mocker': 3.2.4(vite@7.3.1(@types/node@24.10.13)(tsx@4.21.0)(yaml@2.8.2))
12028 '@vitest/pretty-format': 3.2.4
12029 '@vitest/runner': 3.2.4
12030 '@vitest/snapshot': 3.2.4
pnpm-workspace.yaml
+1 -1
@@ -22,7 +22,7 @@ catalog:
22 '@clack/prompts': '^1.0.1'
23 '@cloudflare/vitest-pool-workers': ^0.9.2
24 '@cloudflare/workers-types': ^4.20250917.0
25 - '@composio/client': 0.1.0-alpha.71
25 + '@composio/client': 0.1.0-alpha.72
26 '@effect/cli': ^0.73.2
27 '@effect/eslint-plugin': ^0.3.2
28 '@effect/language-service': ^0.74.0
ts/packages/core/src/index.ts
+3
@@ -38,5 +38,8 @@ export { default as logger } from './utils/logger';
38 export { createCustomTool as experimental_createTool } from './models/CustomTool';
39 export { createCustomToolkit as experimental_createToolkit } from './models/CustomTool';
40
41 +// Experimental shared connected accounts — shape may change in future releases
42 +export { experimental_updateAcl } from './models/ConnectedAccounts';
43 +
44 // Error handling exports
45 export * from './errors';
ts/packages/core/src/models/ConnectedAccounts.ts
+112 -81
@@ -64,7 +64,7 @@ let _legacyInitiateWarningEmitted = false;
64 * deny-by-default, but the explicit form preserves the caller's intent
65 * in network traces.
66 */
67 -function serializeAclConfigForWire(
67 +export function serializeAclConfigForWire(
68 acl:
69 | {
70 allowAllUsers?: boolean;
@@ -72,7 +72,7 @@ function serializeAclConfigForWire(
72 notAllowedUserIds?: string[];
73 }
74 | undefined
75 -): LinkCreateParams.ACLConfigForShared | undefined {
75 +): LinkCreateParams.Experimental.ACLConfigForShared | undefined {
76 if (acl === undefined) return undefined;
77 return {
78 ...(acl.allowAllUsers !== undefined && { allow_all_users: acl.allowAllUsers }),
@@ -81,6 +81,26 @@ function serializeAclConfigForWire(
81 };
82 }
83
84 +/**
85 + * Serialise the SDK's `experimental` block (camelCase) into the wire's
86 + * `experimental` block (snake_case). Returns `undefined` when the caller
87 + * didn't pass anything.
88 + */
89 +function serializeExperimentalForWire(
90 + experimental: import('../types/connectedAccounts.types').ConnectedAccountExperimental | undefined
91 +): LinkCreateParams.Experimental | undefined {
92 + if (experimental === undefined) return undefined;
93 + const aclWire = serializeAclConfigForWire(experimental.aclConfigForShared);
94 + const wire: LinkCreateParams.Experimental = {};
95 + if (experimental.accountType !== undefined) {
96 + wire.account_type = experimental.accountType;
97 + }
98 + if (aclWire !== undefined) {
99 + wire.acl_config_for_shared = aclWire;
100 + }
101 + return wire;
102 +}
103 +
104 /**
105 * ConnectedAccounts class
106 *
@@ -141,6 +161,9 @@ export class ConnectedAccounts {
161 statuses: parsedQuery.data.statuses as ConnectedAccountListParamsRaw['statuses'],
162 toolkit_slugs: parsedQuery.data.toolkitSlugs,
163 user_ids: parsedQuery.data.userIds,
164 + ...(parsedQuery.data.accountType !== undefined && {
165 + account_type: parsedQuery.data.accountType,
166 + }),
167 };
168 }
169
@@ -398,14 +421,13 @@ export class ConnectedAccounts {
421 }
422
423 const opts = requestOptions.data;
401 - const aclWire = serializeAclConfigForWire(opts.aclConfigForShared);
424 + const experimentalWire = serializeExperimentalForWire(opts.experimental);
425 const body: LinkCreateParams = {
426 auth_config_id: authConfigId,
427 user_id: userId,
428 ...(opts.callbackUrl !== undefined && { callback_url: opts.callbackUrl }),
429 ...(opts.alias !== undefined && { alias: opts.alias }),
407 - ...(opts.accountType !== undefined && { account_type: opts.accountType }),
408 - ...(aclWire !== undefined && { acl_config_for_shared: aclWire }),
430 + ...(experimentalWire !== undefined && { experimental: experimentalWire }),
431 };
432
433 try {
@@ -617,7 +639,8 @@ export class ConnectedAccounts {
639 /**
640 * Enable or disable a connected account. Accepts `{ enabled: boolean }`.
641 *
620 - * For ACL writes on SHARED connections, see {@link updateAcl}.
642 + * For ACL writes on SHARED connections, see `experimental_updateAcl`
643 + * exported at the top level of `@composio/core`.
644 *
645 * @param {string} nanoid - The unique identifier of the connected account
646 * @param {UpdateConnectedAccountParams} params - The update parameters
@@ -642,85 +665,93 @@ export class ConnectedAccounts {
665
666 return this.client.connectedAccounts.updateStatus(nanoid, parsedParams.data);
667 }
668 +}
669
646 - /**
647 - * Update the per-user ACL on a SHARED connected account.
648 - *
649 - * Only meaningful for SHARED connections — calling this on a PRIVATE
650 - * connection raises `ComposioAclOnlyForSharedError` (400). ACL writes
651 - * require the connection's creator or an API key; alias edits via
652 - * {@link update} are governed separately.
653 - *
654 - * PATCH semantics: omit a field to leave it unchanged; pass an empty array
655 - * to clear an allow/deny list. At least one field must be provided.
656 - *
657 - * Resolution rule (deny wins):
658 - * 1. requesting `userId` in `notAllowedUserIds` → DENY
659 - * 2. `allowAllUsers === true` → ALLOW
660 - * 3. requesting `userId` in `allowedUserIds` → ALLOW
661 - * 4. otherwise → DENY
662 - *
663 - * @example
664 - * ```typescript
665 - * // Allow every userId to use this connection
666 - * await composio.connectedAccounts.updateAcl('ca_abc', { allowAllUsers: true });
667 - *
668 - * // Everyone except a specific user
669 - * await composio.connectedAccounts.updateAcl('ca_abc', {
670 - * allowAllUsers: true,
671 - * notAllowedUserIds: ['user_bob'],
672 - * });
673 - *
674 - * // Targeted allow
675 - * await composio.connectedAccounts.updateAcl('ca_abc', {
676 - * allowedUserIds: ['user_alice', 'user_bob'],
677 - * });
678 - *
679 - * // Revoke a previously-granted allow list (back to deny-by-default)
680 - * await composio.connectedAccounts.updateAcl('ca_abc', { allowedUserIds: [] });
681 - * ```
682 - *
683 - * **Empty-array semantics — read carefully.** Passing `[]` for either
684 - * list **replaces** the list, it does not extend it:
685 - *
686 - * - `allowedUserIds: []` → revoke all previously-granted user IDs (state
687 - * reverts to deny-by-default unless `allowAllUsers` is true).
688 - * - `notAllowedUserIds: []` → **clears the deny list**, which silently
689 - * re-grants access to users you previously blocked. Always pair an
690 - * empty deny list with a deliberate audit of the allow side.
691 - *
692 - * @returns The PATCH response (`{ id, status, success }`). To read the
693 - * updated `aclConfigForShared` block, call `get(nanoid)` after the
694 - * promise resolves.
695 - */
696 - async updateAcl(
697 - nanoid: string,
698 - params: UpdateConnectedAccountAclParams
699 - ): Promise<ConnectedAccountPatchResponse> {
700 - const parsedParams = UpdateConnectedAccountAclParamsSchema.safeParse(params);
701 - if (!parsedParams.success) {
702 - throw new ValidationError('Failed to parse connected account ACL update params', {
703 - cause: parsedParams.error,
704 - });
705 - }
670 +/**
671 + * Update the per-user ACL on a SHARED connected account. Experimental —
672 + * shape may change in future releases.
673 + *
674 + * Only meaningful for SHARED connections — calling this on a PRIVATE
675 + * connection raises `ComposioAclOnlyForSharedError` (400). ACL writes
676 + * require the connection's creator or an API key.
677 + *
678 + * PATCH semantics: omit a field to leave it unchanged; pass an empty array
679 + * to clear an allow/deny list. At least one field must be provided.
680 + *
681 + * Resolution rule (deny wins):
682 + * 1. requesting `userId` in `notAllowedUserIds` → DENY
683 + * 2. `allowAllUsers === true` → ALLOW
684 + * 3. requesting `userId` in `allowedUserIds` → ALLOW
685 + * 4. otherwise → DENY
686 + *
687 + * @example
688 + * ```typescript
689 + * import { Composio, experimental_updateAcl } from '@composio/core';
690 + *
691 + * const composio = new Composio({ apiKey: '...' });
692 + *
693 + * // Allow every userId to use this connection
694 + * await experimental_updateAcl(composio, 'ca_abc', { allowAllUsers: true });
695 + *
696 + * // Everyone except a specific user
697 + * await experimental_updateAcl(composio, 'ca_abc', {
698 + * allowAllUsers: true,
699 + * notAllowedUserIds: ['user_bob'],
700 + * });
701 + *
702 + * // Targeted allow
703 + * await experimental_updateAcl(composio, 'ca_abc', {
704 + * allowedUserIds: ['user_alice', 'user_bob'],
705 + * });
706 + *
707 + * // Revoke a previously-granted allow list (back to deny-by-default)
708 + * await experimental_updateAcl(composio, 'ca_abc', { allowedUserIds: [] });
709 + * ```
710 + *
711 + * **Empty-array semantics — read carefully.** Passing `[]` for either
712 + * list **replaces** the list, it does not extend it:
713 + *
714 + * - `allowedUserIds: []` → revoke all previously-granted user IDs (state
715 + * reverts to deny-by-default unless `allowAllUsers` is true).
716 + * - `notAllowedUserIds: []` → **clears the deny list**, which silently
717 + * re-grants access to users you previously blocked. Always pair an
718 + * empty deny list with a deliberate audit of the allow side.
719 + *
720 + * @returns The PATCH response (`{ id, status, success }`). To read the
721 + * updated ACL block, call `composio.connectedAccounts.get(nanoid)`
722 + * after the promise resolves and inspect `account.experimental?.aclConfigForShared`.
723 + */
724 +export async function experimental_updateAcl(
725 + composio: { getClient: () => ComposioClient },
726 + nanoid: string,
727 + params: UpdateConnectedAccountAclParams
728 +): Promise<ConnectedAccountPatchResponse> {
729 + const parsedParams = UpdateConnectedAccountAclParamsSchema.safeParse(params);
730 + if (!parsedParams.success) {
731 + throw new ValidationError('Failed to parse connected account ACL update params', {
732 + cause: parsedParams.error,
733 + });
734 + }
735
707 - const body: ConnectedAccountPatchParams = {
736 + const client = composio.getClient();
737 + const body: ConnectedAccountPatchParams = {
738 + experimental: {
739 acl_config_for_shared: serializeAclConfigForWire(parsedParams.data),
709 - };
740 + },
741 + };
742
711 - try {
712 - return await this.client.connectedAccounts.patch(nanoid, body);
713 - } catch (error) {
714 - // Same ACL-on-PRIVATE rejection the create path can hit — surface
715 - // it as a typed error.
716 - if (
717 - error instanceof BadRequestError &&
718 - typeof error.message === 'string' &&
719 - error.message.includes('acl_config_for_shared is only valid on SHARED')
720 - ) {
721 - throw new ComposioAclOnlyForSharedError(error.message, { cause: error });
722 - }
723 - throw error;
743 + try {
744 + return await client.connectedAccounts.patch(nanoid, body);
745 + } catch (error) {
746 + // Same ACL-on-PRIVATE rejection the create path can hit — surface
747 + // it as a typed error.
748 + if (
749 + error instanceof BadRequestError &&
750 + typeof error.message === 'string' &&
751 + error.message.includes('acl_config_for_shared is only valid on SHARED')
752 + ) {
753 + throw new ComposioAclOnlyForSharedError(error.message, { cause: error });
754 }
755 + throw error;
756 }
757 }
ts/packages/core/src/models/ToolRouterSession.ts
+34 -17
@@ -83,8 +83,12 @@ export const DIRECT_CUSTOM_TOOL_DESCRIPTION_PREFIX =
83 const AuthorizeOptionsSchema = z.object({
84 callbackUrl: z.string().optional(),
85 alias: z.string().optional(),
86 - accountType: ConnectedAccountTypeSchema.optional(),
87 - aclConfigForShared: ConnectedAccountAclConfigSchema.optional(),
86 + experimental: z
87 + .object({
88 + accountType: ConnectedAccountTypeSchema.optional(),
89 + aclConfigForShared: ConnectedAccountAclConfigSchema.optional(),
90 + })
91 + .optional(),
92 });
93
94 export class ToolRouterSession<
@@ -327,9 +331,11 @@ export class ToolRouterSession<
331 * Initiate an authorization flow for a toolkit.
332 * Returns a ConnectionRequest with a redirect URL for the user.
333 *
330 - * Use `accountType` and `aclConfigForShared` to create a SHARED connection
331 - * with a per-user ACL in one flow. Default behaviour (omit both) creates
332 - * a PRIVATE connection.
334 + * Pass `experimental: { accountType: 'SHARED', aclConfigForShared }` to
335 + * create a SHARED connection with a per-user ACL in one flow. Default
336 + * behaviour (omit the block) creates a PRIVATE connection.
337 + *
338 + * Experimental — shape may change in future releases.
339 *
340 * `aclConfigForShared` is validated against the same caps as
341 * `composio.connectedAccounts.link()` (≤1000 entries per list, each
@@ -341,8 +347,10 @@ export class ToolRouterSession<
347 options?: {
348 callbackUrl?: string;
349 alias?: string;
344 - accountType?: ConnectedAccountType;
345 - aclConfigForShared?: ConnectedAccountAclConfig;
350 + experimental?: {
351 + accountType?: ConnectedAccountType;
352 + aclConfigForShared?: ConnectedAccountAclConfig;
353 + };
354 }
355 ): Promise<ConnectionRequest> {
356 const requestOptions = AuthorizeOptionsSchema.safeParse(options ?? {});
@@ -352,26 +360,35 @@ export class ToolRouterSession<
360 });
361 }
362 const opts = requestOptions.data;
355 - const aclWire: SessionLinkParams.ACLConfigForShared | undefined =
356 - opts.aclConfigForShared === undefined
363 + const experimentalIn = opts.experimental;
364 + const aclWire: SessionLinkParams.Experimental.ACLConfigForShared | undefined =
365 + experimentalIn?.aclConfigForShared === undefined
366 ? undefined
367 : {
359 - ...(opts.aclConfigForShared.allowAllUsers !== undefined && {
360 - allow_all_users: opts.aclConfigForShared.allowAllUsers,
368 + ...(experimentalIn.aclConfigForShared.allowAllUsers !== undefined && {
369 + allow_all_users: experimentalIn.aclConfigForShared.allowAllUsers,
370 + }),
371 + ...(experimentalIn.aclConfigForShared.allowedUserIds !== undefined && {
372 + allowed_user_ids: experimentalIn.aclConfigForShared.allowedUserIds,
373 }),
362 - ...(opts.aclConfigForShared.allowedUserIds !== undefined && {
363 - allowed_user_ids: opts.aclConfigForShared.allowedUserIds,
374 + ...(experimentalIn.aclConfigForShared.notAllowedUserIds !== undefined && {
375 + not_allowed_user_ids: experimentalIn.aclConfigForShared.notAllowedUserIds,
376 }),
365 - ...(opts.aclConfigForShared.notAllowedUserIds !== undefined && {
366 - not_allowed_user_ids: opts.aclConfigForShared.notAllowedUserIds,
377 + };
378 + const experimentalWire: SessionLinkParams.Experimental | undefined =
379 + experimentalIn === undefined
380 + ? undefined
381 + : {
382 + ...(experimentalIn.accountType !== undefined && {
383 + account_type: experimentalIn.accountType,
384 }),
385 + ...(aclWire !== undefined && { acl_config_for_shared: aclWire }),
386 };
387 const body: SessionLinkParams = {
388 toolkit,
389 ...(opts.callbackUrl !== undefined && { callback_url: opts.callbackUrl }),
390 ...(opts.alias !== undefined && { alias: opts.alias }),
373 - ...(opts.accountType !== undefined && { account_type: opts.accountType }),
374 - ...(aclWire !== undefined && { acl_config_for_shared: aclWire }),
391 + ...(experimentalWire !== undefined && { experimental: experimentalWire }),
392 };
393
394 let response;
ts/packages/core/src/types/connectedAccounts.types.ts
+58 -28
@@ -77,17 +77,23 @@ export const ConnectedAccountAclConfigSchema = z.object({
77 allowAllUsers: z
78 .boolean()
79 .optional()
80 - .describe('When true, any `userId` may use this SHARED connection (subject to the deny list). Default false.'),
80 + .describe(
81 + 'When true, any `userId` may use this SHARED connection (subject to the deny list). Default false.'
82 + ),
83 allowedUserIds: z
84 .array(aclUserIdString)
85 .max(ACL_LIST_MAX_LENGTH)
86 .optional()
85 - .describe('Explicit list of `userId` strings allowed to use this SHARED connection. Default [].'),
87 + .describe(
88 + 'Explicit list of `userId` strings allowed to use this SHARED connection. Default [].'
89 + ),
90 notAllowedUserIds: z
91 .array(aclUserIdString)
92 .max(ACL_LIST_MAX_LENGTH)
93 .optional()
90 - .describe('Explicit list of `userId` strings denied access. Wins over allow on conflict. Default [].'),
94 + .describe(
95 + 'Explicit list of `userId` strings denied access. Wins over allow on conflict. Default [].'
96 + ),
97 });
98 export type ConnectedAccountAclConfig = z.infer<typeof ConnectedAccountAclConfigSchema>;
99
@@ -105,6 +111,32 @@ export type ConnectedAccountAclConfigResponse = z.infer<
111 typeof ConnectedAccountAclConfigResponseSchema
112 >;
113
114 +/**
115 + * Experimental options for SHARED connections, passed at create / link time.
116 + *
117 + * **Experimental — shape may change in future releases.** Wrapped under a
118 + * dedicated `experimental` block on every input and response so the
119 + * experimental status is visible at every call site.
120 + */
121 +export const ConnectedAccountExperimentalSchema = z.object({
122 + accountType: ConnectedAccountTypeSchema.optional(),
123 + aclConfigForShared: ConnectedAccountAclConfigSchema.optional(),
124 +});
125 +export type ConnectedAccountExperimental = z.infer<typeof ConnectedAccountExperimentalSchema>;
126 +
127 +/**
128 + * Resolved experimental block on retrieve / list responses. `accountType`
129 + * is always present when the block is; `aclConfigForShared` is only
130 + * present when the caller is authorised to see the ACL.
131 + */
132 +export const ConnectedAccountExperimentalResponseSchema = z.object({
133 + accountType: ConnectedAccountTypeSchema.optional(),
134 + aclConfigForShared: ConnectedAccountAclConfigResponseSchema.optional(),
135 +});
136 +export type ConnectedAccountExperimentalResponse = z.infer<
137 + typeof ConnectedAccountExperimentalResponseSchema
138 +>;
139 +
140 export const CreateConnectedAccountParamsSchema = z.object({
141 authConfig: z.object({
142 id: z.string(),
@@ -186,8 +218,7 @@ export const ConnectedAccountRetrieveResponseSchema: z.ZodType<{
218 isDisabled: boolean;
219 createdAt: string;
220 updatedAt: string;
189 - accountType?: ConnectedAccountType;
190 - aclConfigForShared?: ConnectedAccountAclConfigResponse;
221 + experimental?: ConnectedAccountExperimentalResponse;
222 }> = z.object({
223 id: z.string(),
224 authConfig: ConnectedAccountAuthConfigSchema,
@@ -211,13 +242,10 @@ export const ConnectedAccountRetrieveResponseSchema: z.ZodType<{
242 isDisabled: z.boolean(),
243 createdAt: z.string(),
244 updatedAt: z.string(),
214 - accountType: ConnectedAccountTypeSchema.optional(),
215 - // `aclConfigForShared` is only present on the response when the caller
216 - // is authorised to see the ACL — otherwise the block is absent and the
217 - // field is `undefined`. Callers can distinguish "I can't see the ACL"
218 - // from "ACL is the default deny-by-default state" by checking for the
219 - // presence of the field.
220 - aclConfigForShared: ConnectedAccountAclConfigResponseSchema.optional(),
245 + // Experimental — shape may change in future releases. `aclConfigForShared`
246 + // inside this block is only populated when the caller is authorised to
247 + // see the ACL.
248 + experimental: ConnectedAccountExperimentalResponseSchema.optional(),
249 });
250
251 export type ConnectedAccountRetrieveResponse = z.infer<
@@ -256,6 +284,13 @@ export const ConnectedAccountListParamsSchema = z.object({
284 .nullable()
285 .optional()
286 .describe('The user ids of the connected accounts'),
287 + /**
288 + * Experimental — shape may change in future releases. Filter by sharing
289 + * model. Default (omitted) returns PRIVATE only. Pass `'SHARED'` for only
290 + * shared accounts, or `'ALL'` for `PRIVATE` + `SHARED`. Kept flat because
291 + * the wire is a query string and can't carry nested objects.
292 + */
293 + accountType: z.enum(['PRIVATE', 'SHARED', 'ALL']).optional(),
294 });
295 export type ConnectedAccountListParams = z.infer<typeof ConnectedAccountListParamsSchema>;
296
@@ -293,24 +328,20 @@ export const CreateConnectedAccountLinkOptionsSchema = z.object({
328 */
329 allowMultiple: z.boolean().optional(),
330 /**
296 - * Sharing model for the new connection. `PRIVATE` (default) is usable only
297 - * by the owning `userId`. `SHARED` can be used by other `userId`s — but
298 - * only when the connection is explicitly pinned in a tool-router session's
299 - * config and only when the requesting `userId` passes the connection's
300 - * ACL.
301 - */
302 - accountType: ConnectedAccountTypeSchema.optional(),
303 - /**
304 - * Per-user ACL for SHARED connections. Only valid when
305 - * `accountType === 'SHARED'`; raises `ComposioAclOnlyForSharedError`
306 - * on a PRIVATE connection.
331 + * Experimental options for SHARED connections. Pass `accountType: 'SHARED'`
332 + * (and optionally `aclConfigForShared`) to create a connection that can
333 + * be reached by other `userId`s when pinned in a session.
334 *
308 - * Omit the block (or pass `{}`) to keep the deny-by-default state: only the
309 - * creator can use the connection. Grant access by setting
335 + * Experimental — shape may change in future releases.
336 + *
337 + * `aclConfigForShared` is only valid when `accountType === 'SHARED'`;
338 + * raises `ComposioAclOnlyForSharedError` on a PRIVATE connection. Omit
339 + * the inner block (or pass `{}`) to keep the deny-by-default state: only
340 + * the creator can use the connection. Grant access by setting
341 * `allowAllUsers: true` or listing user IDs in `allowedUserIds`.
342 * `notAllowedUserIds` always wins over allow.
343 */
313 - aclConfigForShared: ConnectedAccountAclConfigSchema.optional(),
344 + experimental: ConnectedAccountExperimentalSchema.optional(),
345 });
346 export type CreateConnectedAccountLinkOptions = z.infer<
347 typeof CreateConnectedAccountLinkOptionsSchema
@@ -358,8 +389,7 @@ export const UpdateConnectedAccountAclParamsSchema = ConnectedAccountAclConfigSc
389 acl.allowedUserIds !== undefined ||
390 acl.notAllowedUserIds !== undefined,
391 {
361 - message:
362 - 'At least one of allowAllUsers, allowedUserIds, or notAllowedUserIds must be provided',
392 + message: 'At least one of allowAllUsers, allowedUserIds, or notAllowedUserIds must be provided',
393 }
394 );
395 export type UpdateConnectedAccountAclParams = z.infer<typeof UpdateConnectedAccountAclParamsSchema>;
ts/packages/core/src/utils/transformers/connectedAccounts.ts
+18 -10
@@ -70,17 +70,25 @@ export function transformConnectedAccountResponse(
70 createdAt: response.created_at,
71 updatedAt: response.updated_at,
72 testRequestEndpoint: response.test_request_endpoint,
73 - accountType: responseWithLabels.account_type,
74 - // `acl_config_for_shared` is conditionally visible — the field is
75 - // absent when the caller isn't authorised to see it. Forward
76 - // `undefined` rather than synthesising defaults so callers can
77 - // distinguish "I can't see the ACL" from "ACL is the default
78 - // deny-by-default state".
79 - aclConfigForShared: responseWithLabels.acl_config_for_shared
73 + // Experimental — shape may change in future releases. Pass the
74 + // nested `experimental` block straight through; the inner
75 + // `aclConfigForShared` is conditionally visible (absent when the
76 + // caller isn't authorised to see the ACL), so distinguish "I can't
77 + // see the ACL" from "ACL is the default deny-by-default state" by
78 + // checking field presence.
79 + experimental: responseWithLabels.experimental
80 ? {
81 - allowAllUsers: responseWithLabels.acl_config_for_shared.allow_all_users,
82 - allowedUserIds: responseWithLabels.acl_config_for_shared.allowed_user_ids,
83 - notAllowedUserIds: responseWithLabels.acl_config_for_shared.not_allowed_user_ids,
81 + accountType: responseWithLabels.experimental.account_type,
82 + aclConfigForShared: responseWithLabels.experimental.acl_config_for_shared
83 + ? {
84 + allowAllUsers:
85 + responseWithLabels.experimental.acl_config_for_shared.allow_all_users,
86 + allowedUserIds:
87 + responseWithLabels.experimental.acl_config_for_shared.allowed_user_ids,
88 + notAllowedUserIds:
89 + responseWithLabels.experimental.acl_config_for_shared.not_allowed_user_ids,
90 + }
91 + : undefined,
92 }
93 : undefined,
94 }));
ts/packages/core/test/connectedAccounts/connectedAccounts.test.ts
+118 -43
@@ -1,6 +1,6 @@
1 import { describe, it, expect, vi, beforeEach } from 'vitest';
2 import { mockClient } from '../utils/mocks/client.mock';
3 -import { ConnectedAccounts } from '../../src/models/ConnectedAccounts';
3 +import { ConnectedAccounts, experimental_updateAcl } from '../../src/models/ConnectedAccounts';
4 import ComposioClient from '@composio/client';
5 import { ConnectedAccountRetrieveResponse } from '@composio/client/resources/connected-accounts.mjs';
6 import {
@@ -1521,7 +1521,7 @@ describe('ConnectedAccounts', () => {
1521 });
1522 });
1523
1524 - describe('link with accountType + ACL', () => {
1524 + describe('link with experimental block (SHARED + ACL)', () => {
1525 beforeEach(() => {
1526 extendedMockClient.connectedAccounts.list.mockResolvedValue({
1527 items: [],
@@ -1534,61 +1534,82 @@ describe('ConnectedAccounts', () => {
1534 });
1535 });
1536
1537 - it('forwards accountType=SHARED + nested aclConfigForShared to client.link.create', async () => {
1537 + it('forwards experimental block with accountType + aclConfigForShared to client.link.create', async () => {
1538 await connectedAccounts.link('user_123', 'auth_config_123', {
1539 - accountType: 'SHARED',
1540 - aclConfigForShared: {
1541 - allowAllUsers: true,
1542 - notAllowedUserIds: ['user_bob'],
1539 + experimental: {
1540 + accountType: 'SHARED',
1541 + aclConfigForShared: {
1542 + allowAllUsers: true,
1543 + notAllowedUserIds: ['user_bob'],
1544 + },
1545 },
1546 });
1547
1548 expect(extendedMockClient.link.create).toHaveBeenCalledWith({
1549 auth_config_id: 'auth_config_123',
1550 user_id: 'user_123',
1549 - account_type: 'SHARED',
1550 - acl_config_for_shared: {
1551 - allow_all_users: true,
1552 - not_allowed_user_ids: ['user_bob'],
1551 + experimental: {
1552 + account_type: 'SHARED',
1553 + acl_config_for_shared: {
1554 + allow_all_users: true,
1555 + not_allowed_user_ids: ['user_bob'],
1556 + },
1557 },
1558 });
1559 });
1560
1557 - it('omits acl_config_for_shared when aclConfigForShared is undefined', async () => {
1558 - await connectedAccounts.link('user_123', 'auth_config_123', { accountType: 'SHARED' });
1561 + it('omits the inner acl block when aclConfigForShared is undefined', async () => {
1562 + await connectedAccounts.link('user_123', 'auth_config_123', {
1563 + experimental: { accountType: 'SHARED' },
1564 + });
1565 +
1566 + const body = extendedMockClient.link.create.mock.calls[0][0];
1567 + expect(body.experimental).toEqual({ account_type: 'SHARED' });
1568 + expect('acl_config_for_shared' in body.experimental).toBe(false);
1569 + });
1570 +
1571 + it('omits the experimental block entirely when not provided', async () => {
1572 + await connectedAccounts.link('user_123', 'auth_config_123');
1573
1574 const body = extendedMockClient.link.create.mock.calls[0][0];
1561 - expect(body.account_type).toBe('SHARED');
1562 - expect('acl_config_for_shared' in body).toBe(false);
1575 + expect('experimental' in body).toBe(false);
1576 });
1577
1565 - it('serializes only the fields the caller provided (PATCH-style on inner block)', async () => {
1578 + it('serializes only the inner ACL fields the caller provided', async () => {
1579 await connectedAccounts.link('user_123', 'auth_config_123', {
1567 - accountType: 'SHARED',
1568 - aclConfigForShared: { allowedUserIds: ['user_alice'] },
1580 + experimental: {
1581 + accountType: 'SHARED',
1582 + aclConfigForShared: { allowedUserIds: ['user_alice'] },
1583 + },
1584 });
1585
1586 expect(extendedMockClient.link.create).toHaveBeenCalledWith({
1587 auth_config_id: 'auth_config_123',
1588 user_id: 'user_123',
1574 - account_type: 'SHARED',
1575 - acl_config_for_shared: { allowed_user_ids: ['user_alice'] },
1589 + experimental: {
1590 + account_type: 'SHARED',
1591 + acl_config_for_shared: { allowed_user_ids: ['user_alice'] },
1592 + },
1593 });
1594 });
1595
1596 it('preserves explicit empty arrays in the serialized body', async () => {
1597 await connectedAccounts.link('user_123', 'auth_config_123', {
1581 - accountType: 'SHARED',
1582 - aclConfigForShared: { allowedUserIds: [], notAllowedUserIds: [] },
1598 + experimental: {
1599 + accountType: 'SHARED',
1600 + aclConfigForShared: { allowedUserIds: [], notAllowedUserIds: [] },
1601 + },
1602 });
1603
1604 expect(extendedMockClient.link.create).toHaveBeenCalledWith({
1605 auth_config_id: 'auth_config_123',
1606 user_id: 'user_123',
1588 - account_type: 'SHARED',
1589 - acl_config_for_shared: {
1590 - allowed_user_ids: [],
1591 - not_allowed_user_ids: [],
1607 + experimental: {
1608 + account_type: 'SHARED',
1609 + acl_config_for_shared: {
1610 + allowed_user_ids: [],
1611 + not_allowed_user_ids: [],
1612 + },
1613 },
1614 });
1615 });
@@ -1596,13 +1617,23 @@ describe('ConnectedAccounts', () => {
1617 it('maps 400 AclOnlyForShared to ComposioAclOnlyForSharedError', async () => {
1618 extendedMockClient.link.create.mockReset();
1619 extendedMockClient.link.create.mockRejectedValueOnce(
1599 - Object.assign(new BadRequestError(400, undefined, 'acl_config_for_shared is only valid on SHARED connections.', {}), {})
1620 + Object.assign(
1621 + new BadRequestError(
1622 + 400,
1623 + undefined,
1624 + 'acl_config_for_shared is only valid on SHARED connections.',
1625 + {}
1626 + ),
1627 + {}
1628 + )
1629 );
1630
1631 await expect(
1632 connectedAccounts.link('user_123', 'auth_config_123', {
1604 - accountType: 'PRIVATE',
1605 - aclConfigForShared: { allowAllUsers: true },
1633 + experimental: {
1634 + accountType: 'PRIVATE',
1635 + aclConfigForShared: { allowAllUsers: true },
1636 + },
1637 })
1638 ).rejects.toBeInstanceOf(ComposioAclOnlyForSharedError);
1639 });
@@ -1617,23 +1648,60 @@ describe('ConnectedAccounts', () => {
1648 });
1649 });
1650
1620 - describe('updateAcl', () => {
1621 - it('serializes PATCH body with nested acl_config_for_shared', async () => {
1651 + describe('list with accountType filter', () => {
1652 + it('forwards accountType to the wire as a flat query param', async () => {
1653 + extendedMockClient.connectedAccounts.list.mockResolvedValue({
1654 + items: [],
1655 + next_cursor: null,
1656 + total_pages: 0,
1657 + });
1658 +
1659 + await connectedAccounts.list({ accountType: 'SHARED', userIds: ['user_creator'] });
1660 +
1661 + const callArg = extendedMockClient.connectedAccounts.list.mock.calls[0][0];
1662 + expect(callArg.account_type).toBe('SHARED');
1663 + expect(callArg.user_ids).toEqual(['user_creator']);
1664 + });
1665 +
1666 + it('omits account_type when accountType is not provided', async () => {
1667 + extendedMockClient.connectedAccounts.list.mockResolvedValue({
1668 + items: [],
1669 + next_cursor: null,
1670 + total_pages: 0,
1671 + });
1672 +
1673 + await connectedAccounts.list({ userIds: ['user_creator'] });
1674 +
1675 + const callArg = extendedMockClient.connectedAccounts.list.mock.calls[0][0];
1676 + expect('account_type' in callArg).toBe(false);
1677 + });
1678 + });
1679 +
1680 + describe('experimental_updateAcl', () => {
1681 + let composioHandle: { getClient: () => typeof extendedMockClient };
1682 +
1683 + beforeEach(() => {
1684 + composioHandle = { getClient: () => extendedMockClient };
1685 + });
1686 +
1687 + it('serializes PATCH body under experimental.acl_config_for_shared', async () => {
1688 extendedMockClient.connectedAccounts.patch.mockResolvedValueOnce({
1689 id: 'ca_abc',
1690 status: 'ACTIVE',
1691 success: true,
1692 });
1693
1628 - const result = await connectedAccounts.updateAcl('ca_abc', {
1694 + const result = await experimental_updateAcl(composioHandle, 'ca_abc', {
1695 allowAllUsers: true,
1696 notAllowedUserIds: ['user_bob'],
1697 });
1698
1699 expect(extendedMockClient.connectedAccounts.patch).toHaveBeenCalledWith('ca_abc', {
1634 - acl_config_for_shared: {
1635 - allow_all_users: true,
1636 - not_allowed_user_ids: ['user_bob'],
1700 + experimental: {
1701 + acl_config_for_shared: {
1702 + allow_all_users: true,
1703 + not_allowed_user_ids: ['user_bob'],
1704 + },
1705 },
1706 });
1707 expect(result).toEqual({ id: 'ca_abc', status: 'ACTIVE', success: true });
@@ -1646,10 +1714,12 @@ describe('ConnectedAccounts', () => {
1714 success: true,
1715 });
1716
1649 - await connectedAccounts.updateAcl('ca_abc', { allowedUserIds: ['user_alice'] });
1717 + await experimental_updateAcl(composioHandle, 'ca_abc', { allowedUserIds: ['user_alice'] });
1718
1719 expect(extendedMockClient.connectedAccounts.patch).toHaveBeenCalledWith('ca_abc', {
1652 - acl_config_for_shared: { allowed_user_ids: ['user_alice'] },
1720 + experimental: {
1721 + acl_config_for_shared: { allowed_user_ids: ['user_alice'] },
1722 + },
1723 });
1724 });
1725
@@ -1660,15 +1730,15 @@ describe('ConnectedAccounts', () => {
1730 success: true,
1731 });
1732
1663 - await connectedAccounts.updateAcl('ca_abc', { allowedUserIds: [] });
1733 + await experimental_updateAcl(composioHandle, 'ca_abc', { allowedUserIds: [] });
1734
1735 expect(extendedMockClient.connectedAccounts.patch).toHaveBeenCalledWith('ca_abc', {
1666 - acl_config_for_shared: { allowed_user_ids: [] },
1736 + experimental: { acl_config_for_shared: { allowed_user_ids: [] } },
1737 });
1738 });
1739
1740 it('rejects an empty params object via the refine', async () => {
1671 - await expect(connectedAccounts.updateAcl('ca_abc', {})).rejects.toMatchObject({
1741 + await expect(experimental_updateAcl(composioHandle, 'ca_abc', {})).rejects.toMatchObject({
1742 name: 'ValidationError',
1743 });
1744 expect(extendedMockClient.connectedAccounts.patch).not.toHaveBeenCalled();
@@ -1676,11 +1746,16 @@ describe('ConnectedAccounts', () => {
1746
1747 it('maps 400 AclOnlyForShared to ComposioAclOnlyForSharedError', async () => {
1748 extendedMockClient.connectedAccounts.patch.mockRejectedValueOnce(
1679 - new BadRequestError(400, undefined, 'acl_config_for_shared is only valid on SHARED connections.', {})
1749 + new BadRequestError(
1750 + 400,
1751 + undefined,
1752 + 'acl_config_for_shared is only valid on SHARED connections.',
1753 + {}
1754 + )
1755 );
1756
1757 await expect(
1683 - connectedAccounts.updateAcl('ca_abc', { allowAllUsers: true })
1758 + experimental_updateAcl(composioHandle, 'ca_abc', { allowAllUsers: true })
1759 ).rejects.toBeInstanceOf(ComposioAclOnlyForSharedError);
1760 });
1761
@@ -1689,7 +1764,7 @@ describe('ConnectedAccounts', () => {
1764 extendedMockClient.connectedAccounts.patch.mockRejectedValueOnce(otherError);
1765
1766 await expect(
1692 - connectedAccounts.updateAcl('ca_abc', { allowAllUsers: true })
1767 + experimental_updateAcl(composioHandle, 'ca_abc', { allowAllUsers: true })
1768 ).rejects.toBe(otherError);
1769 });
1770 });
ts/packages/core/test/models/toolRouter.test.ts
+37 -17
@@ -1849,38 +1849,54 @@ describe('ToolRouter', () => {
1849 expect(typeof connectionRequest.waitForConnection).toBe('function');
1850 });
1851
1852 - // authorize() validates aclConfigForShared at the SDK boundary, same
1853 - // caps as link() — 1000-entry list, 256-char user_id.
1854 - it('forwards accountType + nested acl_config_for_shared on the wire', async () => {
1852 + // authorize() validates experimental.aclConfigForShared at the SDK
1853 + // boundary — same caps as link() (1000-entry list, 256-char user_id).
1854 + it('forwards the experimental block to the wire', async () => {
1855 mockClient.toolRouter.session.link.mockResolvedValueOnce(mockLinkResponse);
1856
1857 const session = await toolRouter.create(userId);
1858 await session.authorize(toolkit, {
1859 - accountType: 'SHARED',
1860 - aclConfigForShared: {
1861 - allowAllUsers: true,
1862 - notAllowedUserIds: ['user_bob'],
1859 + experimental: {
1860 + accountType: 'SHARED',
1861 + aclConfigForShared: {
1862 + allowAllUsers: true,
1863 + notAllowedUserIds: ['user_bob'],
1864 + },
1865 },
1866 });
1867
1868 expect(mockClient.toolRouter.session.link).toHaveBeenCalledWith(sessionId, {
1869 toolkit,
1868 - account_type: 'SHARED',
1869 - acl_config_for_shared: {
1870 - allow_all_users: true,
1871 - not_allowed_user_ids: ['user_bob'],
1870 + experimental: {
1871 + account_type: 'SHARED',
1872 + acl_config_for_shared: {
1873 + allow_all_users: true,
1874 + not_allowed_user_ids: ['user_bob'],
1875 + },
1876 },
1877 });
1878 });
1879
1880 + it('omits the experimental block entirely when not provided', async () => {
1881 + mockClient.toolRouter.session.link.mockResolvedValueOnce(mockLinkResponse);
1882 +
1883 + const session = await toolRouter.create(userId);
1884 + await session.authorize(toolkit);
1885 +
1886 + const body = mockClient.toolRouter.session.link.mock.calls[0][1];
1887 + expect('experimental' in body).toBe(false);
1888 + });
1889 +
1890 it('throws ValidationError when allowedUserIds exceeds the 1000-entry cap', async () => {
1891 const session = await toolRouter.create(userId);
1892 const oversizedList = Array.from({ length: 1001 }, (_, i) => `user_${i}`);
1893
1894 await expect(
1895 session.authorize(toolkit, {
1882 - accountType: 'SHARED',
1883 - aclConfigForShared: { allowedUserIds: oversizedList },
1896 + experimental: {
1897 + accountType: 'SHARED',
1898 + aclConfigForShared: { allowedUserIds: oversizedList },
1899 + },
1900 })
1901 ).rejects.toMatchObject({ name: 'ValidationError' });
1902
@@ -1893,8 +1909,10 @@ describe('ToolRouter', () => {
1909
1910 await expect(
1911 session.authorize(toolkit, {
1896 - accountType: 'SHARED',
1897 - aclConfigForShared: { allowedUserIds: [tooLongUserId] },
1912 + experimental: {
1913 + accountType: 'SHARED',
1914 + aclConfigForShared: { allowedUserIds: [tooLongUserId] },
1915 + },
1916 })
1917 ).rejects.toMatchObject({ name: 'ValidationError' });
1918
@@ -1906,8 +1924,10 @@ describe('ToolRouter', () => {
1924
1925 await expect(
1926 session.authorize(toolkit, {
1909 - accountType: 'SHARED',
1910 - aclConfigForShared: { notAllowedUserIds: [''] },
1927 + experimental: {
1928 + accountType: 'SHARED',
1929 + aclConfigForShared: { notAllowedUserIds: [''] },
1930 + },
1931 })
1932 ).rejects.toMatchObject({ name: 'ValidationError' });
1933