@composio/core 0.9.0 → 0.10.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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-CQwRTUmo.cjs');
2
2
  const require_FileModifierErrors = require('./FileModifierErrors-BYJBHiay.cjs');
3
- const require_CustomTool = require('./CustomTool-Dj4fNvsu.cjs');
3
+ const require_CustomTool = require('./CustomTool-CQ_YjABZ.cjs');
4
4
  const require_Telemetry = require('./Telemetry-Dm-0sewu.cjs');
5
5
  const require_buffer = require('./buffer-BjWptbNH.cjs');
6
6
  const require_FileToolModifier_utils_neutral = require('./FileToolModifier.utils.neutral-Dfwqgimk.cjs');
@@ -1039,6 +1039,79 @@ const ConnectedAccountStatusSchema = zod_v3.z.enum([
1039
1039
  ConnectedAccountStatuses.INACTIVE,
1040
1040
  ConnectedAccountStatuses.REVOKED
1041
1041
  ]);
1042
+ /**
1043
+ * Sharing model for a connected account.
1044
+ *
1045
+ * - `PRIVATE` (default): only the owning `userId` can use the connection.
1046
+ * - `SHARED`: can be used by other `userId`s, but only when the connection
1047
+ * is explicitly pinned in a tool-router session's config and only when
1048
+ * the requesting `userId` passes the connection's ACL (see
1049
+ * `allowAllUsers` / `allowedUserIds` / `notAllowedUserIds`).
1050
+ */
1051
+ const ConnectedAccountTypes = {
1052
+ PRIVATE: "PRIVATE",
1053
+ SHARED: "SHARED"
1054
+ };
1055
+ const ConnectedAccountTypeSchema = zod_v3.z.enum([ConnectedAccountTypes.PRIVATE, ConnectedAccountTypes.SHARED]);
1056
+ /**
1057
+ * Per-user access control for a SHARED connected account. Ignored for
1058
+ * PRIVATE.
1059
+ *
1060
+ * Pass `aclConfigForShared` on create / PATCH to grant access; omit it
1061
+ * to leave the ACL unchanged (on PATCH) or to keep the default
1062
+ * deny-by-default state (on create). On responses, the field is
1063
+ * `undefined` when the caller isn't authorised to see the ACL —
1064
+ * distinguish that from an empty/default state explicitly.
1065
+ *
1066
+ * Resolution rule (deny wins):
1067
+ * 1. requesting `userId` in `notAllowedUserIds` → DENY
1068
+ * 2. `allowAllUsers === true` → ALLOW
1069
+ * 3. requesting `userId` in `allowedUserIds` → ALLOW
1070
+ * 4. otherwise → DENY (deny-by-default)
1071
+ *
1072
+ * Default state (block omitted or `{}`) means only the connection's
1073
+ * creator can use it. The creator must grant access explicitly.
1074
+ *
1075
+ * Limits: each list accepts up to 1000 entries; each `userId` is
1076
+ * 1..256 characters.
1077
+ */
1078
+ const ACL_LIST_MAX_LENGTH = 1e3;
1079
+ const aclUserIdString = zod_v3.z.string().min(1).max(256);
1080
+ const ConnectedAccountAclConfigSchema = zod_v3.z.object({
1081
+ allowAllUsers: zod_v3.z.boolean().optional().describe("When true, any `userId` may use this SHARED connection (subject to the deny list). Default false."),
1082
+ allowedUserIds: zod_v3.z.array(aclUserIdString).max(ACL_LIST_MAX_LENGTH).optional().describe("Explicit list of `userId` strings allowed to use this SHARED connection. Default []."),
1083
+ notAllowedUserIds: zod_v3.z.array(aclUserIdString).max(ACL_LIST_MAX_LENGTH).optional().describe("Explicit list of `userId` strings denied access. Wins over allow on conflict. Default [].")
1084
+ });
1085
+ /**
1086
+ * Resolved ACL as it appears on responses. All three fields are populated
1087
+ * when the field is visible; the field itself is `undefined` for callers
1088
+ * not authorised to see it.
1089
+ */
1090
+ const ConnectedAccountAclConfigResponseSchema = zod_v3.z.object({
1091
+ allowAllUsers: zod_v3.z.boolean(),
1092
+ allowedUserIds: zod_v3.z.array(zod_v3.z.string()),
1093
+ notAllowedUserIds: zod_v3.z.array(zod_v3.z.string())
1094
+ });
1095
+ /**
1096
+ * Experimental options for SHARED connections, passed at create / link time.
1097
+ *
1098
+ * **Experimental — shape may change in future releases.** Wrapped under a
1099
+ * dedicated `experimental` block on every input and response so the
1100
+ * experimental status is visible at every call site.
1101
+ */
1102
+ const ConnectedAccountExperimentalSchema = zod_v3.z.object({
1103
+ accountType: ConnectedAccountTypeSchema.optional(),
1104
+ aclConfigForShared: ConnectedAccountAclConfigSchema.optional()
1105
+ });
1106
+ /**
1107
+ * Resolved experimental block on retrieve / list responses. `accountType`
1108
+ * is always present when the block is; `aclConfigForShared` is only
1109
+ * present when the caller is authorised to see the ACL.
1110
+ */
1111
+ const ConnectedAccountExperimentalResponseSchema = zod_v3.z.object({
1112
+ accountType: ConnectedAccountTypeSchema.optional(),
1113
+ aclConfigForShared: ConnectedAccountAclConfigResponseSchema.optional()
1114
+ });
1042
1115
  const CreateConnectedAccountParamsSchema = zod_v3.z.object({
1043
1116
  authConfig: zod_v3.z.object({ id: zod_v3.z.string() }),
1044
1117
  connection: zod_v3.z.object({
@@ -1091,7 +1164,8 @@ const ConnectedAccountRetrieveResponseSchema = zod_v3.z.object({
1091
1164
  testRequestEndpoint: zod_v3.z.string().optional(),
1092
1165
  isDisabled: zod_v3.z.boolean(),
1093
1166
  createdAt: zod_v3.z.string(),
1094
- updatedAt: zod_v3.z.string()
1167
+ updatedAt: zod_v3.z.string(),
1168
+ experimental: ConnectedAccountExperimentalResponseSchema.optional()
1095
1169
  });
1096
1170
  const ConnectedAccountListParamsSchema = zod_v3.z.object({
1097
1171
  authConfigIds: zod_v3.z.array(zod_v3.z.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
@@ -1100,7 +1174,12 @@ const ConnectedAccountListParamsSchema = zod_v3.z.object({
1100
1174
  orderBy: zod_v3.z.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
1101
1175
  statuses: zod_v3.z.array(ConnectedAccountStatusSchema).nullable().optional().describe("The statuses of the connected accounts"),
1102
1176
  toolkitSlugs: zod_v3.z.array(zod_v3.z.string()).nullable().optional().describe("The toolkit slugs of the connected accounts"),
1103
- userIds: zod_v3.z.array(zod_v3.z.string()).nullable().optional().describe("The user ids of the connected accounts")
1177
+ userIds: zod_v3.z.array(zod_v3.z.string()).nullable().optional().describe("The user ids of the connected accounts"),
1178
+ accountType: zod_v3.z.enum([
1179
+ "PRIVATE",
1180
+ "SHARED",
1181
+ "ALL"
1182
+ ]).optional()
1104
1183
  });
1105
1184
  const ConnectedAccountListResponseSchema = zod_v3.z.object({
1106
1185
  items: zod_v3.z.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
@@ -1110,7 +1189,8 @@ const ConnectedAccountListResponseSchema = zod_v3.z.object({
1110
1189
  const CreateConnectedAccountLinkOptionsSchema = zod_v3.z.object({
1111
1190
  callbackUrl: zod_v3.z.string().optional(),
1112
1191
  alias: zod_v3.z.string().optional(),
1113
- allowMultiple: zod_v3.z.boolean().optional()
1192
+ allowMultiple: zod_v3.z.boolean().optional(),
1193
+ experimental: ConnectedAccountExperimentalSchema.optional()
1114
1194
  });
1115
1195
  const CreateConnectedAccountLinkResponseSchema = zod_v3.z.object({ redirectUrl: zod_v3.z.string() });
1116
1196
  const ConnectedAccountRefreshOptionsSchema = zod_v3.z.object({
@@ -1118,6 +1198,19 @@ const ConnectedAccountRefreshOptionsSchema = zod_v3.z.object({
1118
1198
  validateCredentials: zod_v3.z.boolean().optional()
1119
1199
  });
1120
1200
  const UpdateConnectedAccountParamsSchema = zod_v3.z.object({ enabled: zod_v3.z.boolean() });
1201
+ /**
1202
+ * Params for `composio.connectedAccounts.updateAcl()`. Mirrors the inner
1203
+ * shape of the wire's `acl_config_for_shared` block — the SDK adds the
1204
+ * outer nesting at the boundary, so callers pass the three fields flat.
1205
+ *
1206
+ * PATCH-style semantics — omit a field to leave it unchanged; pass an
1207
+ * empty array to clear an allow/deny list. Raises
1208
+ * `ComposioAclOnlyForSharedError` on a PRIVATE connection.
1209
+ *
1210
+ * Each field is optional, but at least one must be provided — passing an
1211
+ * empty object is rejected as a no-op.
1212
+ */
1213
+ const UpdateConnectedAccountAclParamsSchema = ConnectedAccountAclConfigSchema.refine((acl) => acl.allowAllUsers !== void 0 || acl.allowedUserIds !== void 0 || acl.notAllowedUserIds !== void 0, { message: "At least one of allowAllUsers, allowedUserIds, or notAllowedUserIds must be provided" });
1121
1214
 
1122
1215
  //#endregion
1123
1216
  //#region src/utils/transform.ts
@@ -1179,7 +1272,15 @@ function transformConnectedAccountResponse(response) {
1179
1272
  isDisabled: response$1.is_disabled,
1180
1273
  createdAt: response$1.created_at,
1181
1274
  updatedAt: response$1.updated_at,
1182
- testRequestEndpoint: response$1.test_request_endpoint
1275
+ testRequestEndpoint: response$1.test_request_endpoint,
1276
+ experimental: responseWithLabels.experimental ? {
1277
+ accountType: responseWithLabels.experimental.account_type,
1278
+ aclConfigForShared: responseWithLabels.experimental.acl_config_for_shared ? {
1279
+ allowAllUsers: responseWithLabels.experimental.acl_config_for_shared.allow_all_users,
1280
+ allowedUserIds: responseWithLabels.experimental.acl_config_for_shared.allowed_user_ids,
1281
+ notAllowedUserIds: responseWithLabels.experimental.acl_config_for_shared.not_allowed_user_ids
1282
+ } : void 0
1283
+ } : void 0
1183
1284
  }));
1184
1285
  }
1185
1286
  /**
@@ -2786,6 +2887,132 @@ function createConnectionRequest(client, connectedAccountId, status, redirectUrl
2786
2887
  };
2787
2888
  }
2788
2889
 
2890
+ //#endregion
2891
+ //#region src/models/Experimental.ts
2892
+ /**
2893
+ * @fileoverview The `composio.experimental` namespace. Houses experimental
2894
+ * SDK methods whose shape may change in future releases.
2895
+ *
2896
+ * For experimental stateless factories (e.g. `experimental_createTool`),
2897
+ * see the top-level `experimental_*` exports from `@composio/core`.
2898
+ * Anything that takes a Composio client and performs I/O belongs here.
2899
+ */
2900
+ /**
2901
+ * Server-side 400 message the API uses to reject ACL writes against a
2902
+ * PRIVATE connection. Substring-matched in `updateAcl` here, and in the
2903
+ * sibling `connectedAccounts.link()` / `session.authorize()` call sites
2904
+ * — kept as a single constant so a server-side message tweak only
2905
+ * requires one edit.
2906
+ */
2907
+ const ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT = "acl_config_for_shared is only valid on SHARED";
2908
+ /**
2909
+ * Serialise the SDK's `aclConfigForShared` (camelCase) to the wire's
2910
+ * `acl_config_for_shared` block. Returns `undefined` when the caller
2911
+ * didn't pass anything (PATCH-style "don't touch ACL"); returns `{}`
2912
+ * when the caller passed an explicit empty object.
2913
+ */
2914
+ function serializeAclConfigForWire(acl) {
2915
+ if (acl === void 0) return void 0;
2916
+ return {
2917
+ ...acl.allowAllUsers !== void 0 && { allow_all_users: acl.allowAllUsers },
2918
+ ...acl.allowedUserIds !== void 0 && { allowed_user_ids: acl.allowedUserIds },
2919
+ ...acl.notAllowedUserIds !== void 0 && { not_allowed_user_ids: acl.notAllowedUserIds }
2920
+ };
2921
+ }
2922
+ /**
2923
+ * Serialise the SDK's `experimental` options block (camelCase) to the
2924
+ * wire's `experimental` block (snake_case). Used by both
2925
+ * `connectedAccounts.link()` and `session.authorize()`. Returns
2926
+ * `undefined` when the caller didn't pass the block at all.
2927
+ */
2928
+ function serializeExperimentalForWire(experimental) {
2929
+ if (experimental === void 0) return void 0;
2930
+ const aclWire = serializeAclConfigForWire(experimental.aclConfigForShared);
2931
+ const wire = {};
2932
+ if (experimental.accountType !== void 0) wire.account_type = experimental.accountType;
2933
+ if (aclWire !== void 0) wire.acl_config_for_shared = aclWire;
2934
+ return wire;
2935
+ }
2936
+ /**
2937
+ * `composio.experimental` namespace. Mirrors the Python SDK's
2938
+ * `composio.experimental` mount, with one method per experimental
2939
+ * surface. **Shape may change in future releases.**
2940
+ */
2941
+ var Experimental = class {
2942
+ client;
2943
+ constructor(client) {
2944
+ this.client = client;
2945
+ require_Telemetry.telemetry.instrument(this, "Experimental");
2946
+ }
2947
+ /**
2948
+ * Update the per-user ACL on a SHARED connected account.
2949
+ * **Experimental — shape may change in future releases.**
2950
+ *
2951
+ * Only meaningful for SHARED connections — calling this on a PRIVATE
2952
+ * connection raises `ComposioAclOnlyForSharedError` (400). ACL writes
2953
+ * require the connection's creator or an API key.
2954
+ *
2955
+ * PATCH semantics: omit a field to leave it unchanged; pass an empty
2956
+ * array to clear an allow/deny list. At least one field must be
2957
+ * provided.
2958
+ *
2959
+ * Resolution rule (deny wins):
2960
+ * 1. requesting `userId` in `notAllowedUserIds` → DENY
2961
+ * 2. `allowAllUsers === true` → ALLOW
2962
+ * 3. requesting `userId` in `allowedUserIds` → ALLOW
2963
+ * 4. otherwise → DENY
2964
+ *
2965
+ * @example
2966
+ * ```typescript
2967
+ * import { Composio } from '@composio/core';
2968
+ *
2969
+ * const composio = new Composio({ apiKey: '...' });
2970
+ *
2971
+ * // Allow every userId to use this connection
2972
+ * await composio.experimental.updateAcl('ca_abc', { allowAllUsers: true });
2973
+ *
2974
+ * // Everyone except a specific user
2975
+ * await composio.experimental.updateAcl('ca_abc', {
2976
+ * allowAllUsers: true,
2977
+ * notAllowedUserIds: ['user_bob'],
2978
+ * });
2979
+ *
2980
+ * // Targeted allow
2981
+ * await composio.experimental.updateAcl('ca_abc', {
2982
+ * allowedUserIds: ['user_alice', 'user_bob'],
2983
+ * });
2984
+ *
2985
+ * // Revoke a previously-granted allow list (back to deny-by-default)
2986
+ * await composio.experimental.updateAcl('ca_abc', { allowedUserIds: [] });
2987
+ * ```
2988
+ *
2989
+ * **Empty-array semantics — read carefully.** Passing `[]` for either
2990
+ * list **replaces** the list, it does not extend it:
2991
+ *
2992
+ * - `allowedUserIds: []` → revoke all previously-granted user IDs (state
2993
+ * reverts to deny-by-default unless `allowAllUsers` is true).
2994
+ * - `notAllowedUserIds: []` → **clears the deny list**, which silently
2995
+ * re-grants access to users you previously blocked. Always pair an
2996
+ * empty deny list with a deliberate audit of the allow side.
2997
+ *
2998
+ * @returns The PATCH response (`{ id, status, success }`). To read
2999
+ * the updated ACL block, call
3000
+ * `composio.connectedAccounts.get(nanoid)` after the promise
3001
+ * resolves and inspect `account.experimental?.aclConfigForShared`.
3002
+ */
3003
+ async updateAcl(nanoid, params) {
3004
+ const parsedParams = UpdateConnectedAccountAclParamsSchema.safeParse(params);
3005
+ if (!parsedParams.success) throw new require_CustomTool.ValidationError("Failed to parse connected account ACL update params", { cause: parsedParams.error });
3006
+ const body = { experimental: { acl_config_for_shared: serializeAclConfigForWire(parsedParams.data) } };
3007
+ try {
3008
+ return await this.client.connectedAccounts.patch(nanoid, body);
3009
+ } catch (error) {
3010
+ if (error instanceof _composio_client.BadRequestError && typeof error.message === "string" && error.message.includes(ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT)) throw new require_CustomTool.ComposioAclOnlyForSharedError(error.message, { cause: error });
3011
+ throw error;
3012
+ }
3013
+ }
3014
+ };
3015
+
2789
3016
  //#endregion
2790
3017
  //#region src/models/ConnectedAccounts.ts
2791
3018
  /**
@@ -2795,11 +3022,6 @@ function createConnectionRequest(client, connectedAccountId, status, redirectUrl
2795
3022
  * @date 2025-05-05
2796
3023
  * @module ConnectedAccounts
2797
3024
  */
2798
- const LEGACY_RETIRING_OAUTH_SCHEMES = new Set([
2799
- "OAUTH1",
2800
- "OAUTH2",
2801
- "DCR_OAUTH"
2802
- ]);
2803
3025
  let _legacyInitiateWarningEmitted = false;
2804
3026
  /**
2805
3027
  * ConnectedAccounts class
@@ -2849,7 +3071,8 @@ var ConnectedAccounts = class {
2849
3071
  order_by: parsedQuery.data.orderBy,
2850
3072
  statuses: parsedQuery.data.statuses,
2851
3073
  toolkit_slugs: parsedQuery.data.toolkitSlugs,
2852
- user_ids: parsedQuery.data.userIds
3074
+ user_ids: parsedQuery.data.userIds,
3075
+ ...parsedQuery.data.accountType !== void 0 && { account_type: parsedQuery.data.accountType }
2853
3076
  };
2854
3077
  }
2855
3078
  return transformConnectedAccountListResponse(await this.client.connectedAccounts.list(rawQuery));
@@ -2940,16 +3163,21 @@ var ConnectedAccounts = class {
2940
3163
  }
2941
3164
  };
2942
3165
  let response;
3166
+ let httpResponse;
2943
3167
  try {
2944
- response = await this.client.connectedAccounts.create(createParams);
3168
+ const apiCall = this.client.connectedAccounts.create(createParams);
3169
+ if (typeof apiCall.withResponse === "function") {
3170
+ const resolved = await apiCall.withResponse();
3171
+ response = resolved.data;
3172
+ httpResponse = resolved.response;
3173
+ } else response = await apiCall;
2945
3174
  } catch (error) {
2946
3175
  if (error instanceof _composio_client.BadRequestError && typeof error.message === "string" && error.message.includes("no longer supported") && error.message.includes("/api/v3/connected_accounts/link")) throw new require_CustomTool.ComposioLegacyConnectedAccountsEndpointRetiredError(error.message, { cause: error });
2947
3176
  throw error;
2948
3177
  }
2949
- const responseAuthScheme = response.connectionData?.authScheme;
2950
- if (!_legacyInitiateWarningEmitted && typeof responseAuthScheme === "string" && LEGACY_RETIRING_OAUTH_SCHEMES.has(responseAuthScheme)) {
3178
+ if (!_legacyInitiateWarningEmitted && httpResponse?.headers.get("Deprecation")) {
2951
3179
  _legacyInitiateWarningEmitted = true;
2952
- require_FileModifierErrors.logger_default.warn("[Deprecation] composio.connectedAccounts.initiate() will stop working for Composio-managed OAuth auth configs on 2026-05-08 (new orgs) and 2026-07-03 (all orgs). If this auth config is Composio-managed, switch to composio.connectedAccounts.link() before then. Custom auth configs are unaffected. See https://docs.composio.dev/docs/changelog/2026/04/24");
3180
+ require_FileModifierErrors.logger_default.warn("[Deprecation] composio.connectedAccounts.initiate() will stop working for this auth config on or before 2026-07-03 (see Sunset header on the response). Switch to composio.connectedAccounts.link() — same return shape, same allowMultiple semantics. https://docs.composio.dev/docs/changelog/2026/04/24");
2953
3181
  }
2954
3182
  const redirectUrl = typeof response.connectionData?.val?.redirectUrl === "string" ? response.connectionData.val.redirectUrl : null;
2955
3183
  return createConnectionRequest(this.client, response.id, response.connectionData.val.status, redirectUrl);
@@ -2999,15 +3227,20 @@ var ConnectedAccounts = class {
2999
3227
  });
3000
3228
  if (existing.items.length > 0 && !requestOptions.data.allowMultiple) throw new require_CustomTool.ComposioMultipleConnectedAccountsError(`Multiple connected accounts found for user ${userId} in auth config ${authConfigId}. Please use the allowMultiple option to allow multiple connected accounts.`);
3001
3229
  else if (existing.items.length > 0) require_FileModifierErrors.logger_default.warn(`[Warn:AllowMultiple] Multiple connected accounts found for user ${userId} in auth config ${authConfigId}`);
3230
+ const opts = requestOptions.data;
3231
+ const experimentalWire = serializeExperimentalForWire(opts.experimental);
3232
+ const body = {
3233
+ auth_config_id: authConfigId,
3234
+ user_id: userId,
3235
+ ...opts.callbackUrl !== void 0 && { callback_url: opts.callbackUrl },
3236
+ ...opts.alias !== void 0 && { alias: opts.alias },
3237
+ ...experimentalWire !== void 0 && { experimental: experimentalWire }
3238
+ };
3002
3239
  try {
3003
- const response = await this.client.link.create({
3004
- auth_config_id: authConfigId,
3005
- user_id: userId,
3006
- ...requestOptions?.data.callbackUrl && { callback_url: requestOptions.data.callbackUrl },
3007
- ...requestOptions?.data.alias != null && { alias: requestOptions.data.alias }
3008
- });
3240
+ const response = await this.client.link.create(body);
3009
3241
  return createConnectionRequest(this.client, response.connected_account_id, ConnectedAccountStatuses.INITIATED, response.redirect_url);
3010
3242
  } catch (error) {
3243
+ if (error instanceof _composio_client.BadRequestError && typeof error.message === "string" && error.message.includes(ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT)) throw new require_CustomTool.ComposioAclOnlyForSharedError(error.message, { cause: error });
3011
3244
  throw new require_CustomTool.ComposioFailedToCreateConnectedAccountLink("Failed to create connected account link", { cause: error });
3012
3245
  }
3013
3246
  }
@@ -3164,7 +3397,10 @@ var ConnectedAccounts = class {
3164
3397
  return this.client.connectedAccounts.updateStatus(nanoid, { enabled: false });
3165
3398
  }
3166
3399
  /**
3167
- * Update a connected account's alias and/or credentials.
3400
+ * Enable or disable a connected account. Accepts `{ enabled: boolean }`.
3401
+ *
3402
+ * For ACL writes on SHARED connections, see
3403
+ * `composio.experimental.updateAcl()`.
3168
3404
  *
3169
3405
  * @param {string} nanoid - The unique identifier of the connected account
3170
3406
  * @param {UpdateConnectedAccountParams} params - The update parameters
@@ -5489,7 +5725,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
5489
5725
 
5490
5726
  //#endregion
5491
5727
  //#region package.json
5492
- var version = "0.9.0";
5728
+ var version = "0.10.0";
5493
5729
 
5494
5730
  //#endregion
5495
5731
  //#region src/utils/session.ts
@@ -6642,6 +6878,19 @@ var SessionContextImpl = class {
6642
6878
  //#region src/models/ToolRouterSession.ts
6643
6879
  const COMPOSIO_MULTI_EXECUTE_TOOL = "COMPOSIO_MULTI_EXECUTE_TOOL";
6644
6880
  const DIRECT_CUSTOM_TOOL_DESCRIPTION_PREFIX = "[Direct tool - call directly, no search needed beforehand.]";
6881
+ /**
6882
+ * Options accepted by {@link ToolRouterSession.authorize}.
6883
+ *
6884
+ * Validated at the SDK boundary so callers get clear `ValidationError`s for
6885
+ * oversized ACL lists or invalid `userId`s — same caps as the equivalent
6886
+ * `composio.connectedAccounts.link()` path (≤1000 entries per list, each
6887
+ * `userId` 1..256 characters).
6888
+ */
6889
+ const AuthorizeOptionsSchema = zod_v3.z.object({
6890
+ callbackUrl: zod_v3.z.string().optional(),
6891
+ alias: zod_v3.z.string().optional(),
6892
+ experimental: ConnectedAccountExperimentalSchema.optional()
6893
+ });
6645
6894
  var ToolRouterSession = class {
6646
6895
  sessionId;
6647
6896
  mcp;
@@ -6789,13 +7038,36 @@ var ToolRouterSession = class {
6789
7038
  /**
6790
7039
  * Initiate an authorization flow for a toolkit.
6791
7040
  * Returns a ConnectionRequest with a redirect URL for the user.
7041
+ *
7042
+ * Pass `experimental: { accountType: 'SHARED', aclConfigForShared }` to
7043
+ * create a SHARED connection with a per-user ACL in one flow. Default
7044
+ * behaviour (omit the block) creates a PRIVATE connection.
7045
+ *
7046
+ * Experimental — shape may change in future releases.
7047
+ *
7048
+ * `aclConfigForShared` is validated against the same caps as
7049
+ * `composio.connectedAccounts.link()` (≤1000 entries per list, each
7050
+ * `userId` 1..256 characters). Invalid input throws `ValidationError`
7051
+ * at the SDK boundary.
6792
7052
  */
6793
7053
  async authorize(toolkit, options) {
6794
- const response = await this.client.toolRouter.session.link(this.sessionId, {
7054
+ const requestOptions = AuthorizeOptionsSchema.safeParse(options ?? {});
7055
+ if (!requestOptions.success) throw new require_CustomTool.ValidationError("Failed to parse tool router authorize options", { cause: requestOptions.error });
7056
+ const opts = requestOptions.data;
7057
+ const experimentalWire = serializeExperimentalForWire(opts.experimental);
7058
+ const body = {
6795
7059
  toolkit,
6796
- ...options?.callbackUrl && { callback_url: options.callbackUrl },
6797
- ...options?.alias != null && { alias: options.alias }
6798
- });
7060
+ ...opts.callbackUrl !== void 0 && { callback_url: opts.callbackUrl },
7061
+ ...opts.alias !== void 0 && { alias: opts.alias },
7062
+ ...experimentalWire !== void 0 && { experimental: experimentalWire }
7063
+ };
7064
+ let response;
7065
+ try {
7066
+ response = await this.client.toolRouter.session.link(this.sessionId, body);
7067
+ } catch (error) {
7068
+ if (error instanceof _composio_client.BadRequestError && typeof error.message === "string" && error.message.includes(ACL_ONLY_FOR_SHARED_ERROR_FRAGMENT)) throw new require_CustomTool.ComposioAclOnlyForSharedError(error.message, { cause: error });
7069
+ throw error;
7070
+ }
6799
7071
  return createConnectionRequest(this.client, response.connected_account_id, ConnectedAccountStatuses.INITIATED, response.redirect_url);
6800
7072
  }
6801
7073
  /**
@@ -7217,6 +7489,14 @@ var Composio = class Composio {
7217
7489
  authConfigs;
7218
7490
  /** Manage authenticated connections */
7219
7491
  connectedAccounts;
7492
+ /**
7493
+ * Experimental SDK methods whose shape may change in future releases.
7494
+ * Houses stateful operations like {@link Experimental.updateAcl} that
7495
+ * take a client and perform I/O. Stateless experimental factories
7496
+ * (e.g. `experimental_createTool`) stay at the top level.
7497
+ * @experimental
7498
+ */
7499
+ experimental;
7220
7500
  /** Model Context Protocol server management */
7221
7501
  mcp;
7222
7502
  /**
@@ -7332,6 +7612,7 @@ var Composio = class Composio {
7332
7612
  fileDownloadDir: this.config.fileDownloadDir
7333
7613
  });
7334
7614
  this.connectedAccounts = new ConnectedAccounts(this.client);
7615
+ this.experimental = new Experimental(this.client);
7335
7616
  this.toolRouter = new ToolRouter(this.client, this.config);
7336
7617
  /**
7337
7618
  * Initialize tool router methods
@@ -8127,6 +8408,7 @@ exports.BaseAgenticProvider = BaseAgenticProvider;
8127
8408
  exports.BaseNonAgenticProvider = BaseNonAgenticProvider;
8128
8409
  exports.BillcomAuthConnectionDataSchema = BillcomAuthConnectionDataSchema;
8129
8410
  exports.Composio = Composio;
8411
+ exports.ComposioAclOnlyForSharedError = require_CustomTool.ComposioAclOnlyForSharedError;
8130
8412
  exports.ComposioAuthConfigNotFoundError = require_CustomTool.ComposioAuthConfigNotFoundError;
8131
8413
  exports.ComposioConnectedAccountNotFoundError = require_CustomTool.ComposioConnectedAccountNotFoundError;
8132
8414
  exports.ComposioCustomCreateResponseSchema = ComposioCustomCreateResponseSchema;
@@ -8156,6 +8438,8 @@ exports.ComposioNoAPIKeyError = require_CustomTool.ComposioNoAPIKeyError;
8156
8438
  exports.ComposioProvider = ComposioProvider;
8157
8439
  exports.ComposioProviderNotDefinedError = require_CustomTool.ComposioProviderNotDefinedError;
8158
8440
  exports.ComposioSensitiveFilePathBlockedError = require_FileModifierErrors.ComposioSensitiveFilePathBlockedError;
8441
+ exports.ComposioSharedAccessDeniedError = require_CustomTool.ComposioSharedAccessDeniedError;
8442
+ exports.ComposioSharedConnectionNotAccessibleError = require_CustomTool.ComposioSharedConnectionNotAccessibleError;
8159
8443
  exports.ComposioToolExecutionError = require_CustomTool.ComposioToolExecutionError;
8160
8444
  exports.ComposioToolNotFoundError = require_CustomTool.ComposioToolNotFoundError;
8161
8445
  exports.ComposioToolVersionRequiredError = require_CustomTool.ComposioToolVersionRequiredError;
@@ -8164,14 +8448,20 @@ exports.ComposioToolkitNotFoundError = require_CustomTool.ComposioToolkitNotFoun
8164
8448
  exports.ComposioTriggerTypeNotFoundError = require_CustomTool.ComposioTriggerTypeNotFoundError;
8165
8449
  exports.ComposioWebhookPayloadError = require_CustomTool.ComposioWebhookPayloadError;
8166
8450
  exports.ComposioWebhookSignatureVerificationError = require_CustomTool.ComposioWebhookSignatureVerificationError;
8451
+ exports.ConnectedAccountAclConfigResponseSchema = ConnectedAccountAclConfigResponseSchema;
8452
+ exports.ConnectedAccountAclConfigSchema = ConnectedAccountAclConfigSchema;
8167
8453
  exports.ConnectedAccountAuthConfigSchema = ConnectedAccountAuthConfigSchema;
8168
8454
  exports.ConnectedAccountErrorCodes = require_CustomTool.ConnectedAccountErrorCodes;
8455
+ exports.ConnectedAccountExperimentalResponseSchema = ConnectedAccountExperimentalResponseSchema;
8456
+ exports.ConnectedAccountExperimentalSchema = ConnectedAccountExperimentalSchema;
8169
8457
  exports.ConnectedAccountListParamsSchema = ConnectedAccountListParamsSchema;
8170
8458
  exports.ConnectedAccountListResponseSchema = ConnectedAccountListResponseSchema;
8171
8459
  exports.ConnectedAccountRefreshOptionsSchema = ConnectedAccountRefreshOptionsSchema;
8172
8460
  exports.ConnectedAccountRetrieveResponseSchema = ConnectedAccountRetrieveResponseSchema;
8173
8461
  exports.ConnectedAccountStatusSchema = ConnectedAccountStatusSchema;
8174
8462
  exports.ConnectedAccountStatuses = ConnectedAccountStatuses;
8463
+ exports.ConnectedAccountTypeSchema = ConnectedAccountTypeSchema;
8464
+ exports.ConnectedAccountTypes = ConnectedAccountTypes;
8175
8465
  exports.ConnectionDataSchema = ConnectionDataSchema;
8176
8466
  exports.ConnectionExpiredEventSchema = ConnectionExpiredEventSchema;
8177
8467
  exports.ConnectionRequestErrorCodes = require_CustomTool.ConnectionRequestErrorCodes;
@@ -8197,6 +8487,7 @@ exports.CustomOauth1ConnectionDataSchema = CustomOauth1ConnectionDataSchema;
8197
8487
  exports.CustomOauth2ConnectionDataSchema = CustomOauth2ConnectionDataSchema;
8198
8488
  exports.CustomToolSlugSchema = require_CustomTool.CustomToolSlugSchema;
8199
8489
  exports.DefaultCreateConnectedAccountParamsSchema = DefaultCreateConnectedAccountParamsSchema;
8490
+ exports.Experimental = Experimental;
8200
8491
  exports.FileDeleteResponseSchema = FileDeleteResponseSchema;
8201
8492
  exports.FileListResponseSchema = FileListResponseSchema;
8202
8493
  exports.FileModifierErrorCodes = require_FileModifierErrors.FileModifierErrorCodes;
@@ -8313,6 +8604,7 @@ exports.TriggerSubscribeParamSchema = TriggerSubscribeParamSchema;
8313
8604
  exports.TriggerTypeSchema = TriggerTypeSchema;
8314
8605
  exports.TriggersTypeListParamsSchema = TriggersTypeListParamsSchema;
8315
8606
  exports.TriggersTypeListResponseSchema = TriggersTypeListResponseSchema;
8607
+ exports.UpdateConnectedAccountAclParamsSchema = UpdateConnectedAccountAclParamsSchema;
8316
8608
  exports.UpdateConnectedAccountParamsSchema = UpdateConnectedAccountParamsSchema;
8317
8609
  exports.ValidationError = require_CustomTool.ValidationError;
8318
8610
  exports.ValidationErrorCodes = require_CustomTool.ValidationErrorCodes;