@composio/client 2.0.0-rc.16 → 2.0.0-rc.17

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 (170) hide show
  1. package/README.md +40 -0
  2. package/dist/{api-key-revocation-CvGpd3Rw.mjs → api-key-revocation-lc3308Ao.mjs} +1 -1
  3. package/dist/{auth-C0IYTv5D.mjs → auth-DkGiEaxg.mjs} +1 -1
  4. package/dist/{auth-configs-COmbnKYx.mjs → auth-configs-DbxqGahP.mjs} +1 -1
  5. package/dist/{clanker-hE4FKPjg.mjs → clanker-fK9cAkTz.mjs} +1 -1
  6. package/dist/{cli-CuFaxvp4.mjs → cli-K1MskpaR.mjs} +2 -2
  7. package/dist/{connected-accounts-BmbcAhdS.mjs → connected-accounts-Bfl7_SY_.mjs} +1 -1
  8. package/dist/{consumer-BaJgJBXQ.mjs → consumer-5o2zMQwr.mjs} +2 -2
  9. package/dist/{custom-DbEv7dUC.mjs → custom-8rs-sHnb.mjs} +1 -1
  10. package/dist/{custom-DIJbIQGR.mjs → custom-wEkSiPHn.mjs} +1 -1
  11. package/dist/effect.d.mts +19 -6
  12. package/dist/effect.mjs +21 -7
  13. package/dist/{files-Cw6ulQZy.mjs → files-BPKJXlpc.mjs} +1 -1
  14. package/dist/{files-RPz_Fvnz.mjs → files-BjPFzRnM.mjs} +1 -1
  15. package/dist/{generate-DZXuXtYM.mjs → generate-DDHNgbPS.mjs} +1 -1
  16. package/dist/{generated-deprecated-inputs-B6o8D8ub.mjs → generated-deprecated-inputs--L5LHDO_.mjs} +1 -1
  17. package/dist/{generated-operations-DrhN6W_k.mjs → generated-operations-D1e__yar.mjs} +160 -27
  18. package/dist/index.d.mts +3 -3
  19. package/dist/index.mjs +28 -24
  20. package/dist/{keyring-CmnkWH5K.mjs → keyring-Dkm6DQIp.mjs} +1 -1
  21. package/dist/{link-C0KzTJBI.mjs → link-BBU-J5L_.mjs} +1 -1
  22. package/dist/{logs-Bj5MAt8z.mjs → logs-CuuysWk1.mjs} +3 -3
  23. package/dist/{manage-DDFmGWNH.mjs → manage-B1R7I3ZM.mjs} +1 -1
  24. package/dist/{mcp-DXmBAF09.mjs → mcp-C3beSy48.mjs} +3 -3
  25. package/dist/{org-D4J-n07N.mjs → org-B13XOuKh.mjs} +6 -6
  26. package/dist/{owner-CfjgcAcM.mjs → owner-BAr5uwk3.mjs} +1 -1
  27. package/dist/{project-Dw9JLelr.mjs → project-BbCgXD83.mjs} +1 -1
  28. package/dist/{project-CnOrdnOM.mjs → project-C30H_5b6.mjs} +1 -1
  29. package/dist/{project-CLrBv6tJ.mjs → project-CDm8tjUw.mjs} +1 -1
  30. package/dist/{project-7LL6W_tc.mjs → project-DF5KclHm.mjs} +1 -1
  31. package/dist/{realtime-DQ_gT0q7.mjs → realtime-6LigMh83.mjs} +1 -1
  32. package/dist/resources/api-key-revocation.d.mts +1 -1
  33. package/dist/resources/api-key-revocation.mjs +1 -1
  34. package/dist/resources/auth/auth.d.mts +1 -1
  35. package/dist/resources/auth/auth.mjs +1 -1
  36. package/dist/resources/auth/index.d.mts +1 -1
  37. package/dist/resources/auth/index.mjs +2 -2
  38. package/dist/resources/auth/session.d.mts +1 -1
  39. package/dist/resources/auth/session.mjs +1 -1
  40. package/dist/resources/auth-configs.d.mts +1 -1
  41. package/dist/resources/auth-configs.mjs +1 -1
  42. package/dist/resources/auth.d.mts +1 -1
  43. package/dist/resources/auth.mjs +2 -2
  44. package/dist/resources/cli/cli.d.mts +1 -1
  45. package/dist/resources/cli/cli.mjs +1 -1
  46. package/dist/resources/cli/index.d.mts +1 -1
  47. package/dist/resources/cli/index.mjs +2 -2
  48. package/dist/resources/cli/realtime.d.mts +1 -1
  49. package/dist/resources/cli/realtime.mjs +1 -1
  50. package/dist/resources/cli.d.mts +1 -1
  51. package/dist/resources/cli.mjs +2 -2
  52. package/dist/resources/connected-accounts.d.mts +1 -1
  53. package/dist/resources/connected-accounts.mjs +1 -1
  54. package/dist/resources/custom.d.mts +1 -1
  55. package/dist/resources/custom.mjs +1 -1
  56. package/dist/resources/files.d.mts +1 -1
  57. package/dist/resources/files.mjs +1 -1
  58. package/dist/resources/index.d.mts +1 -1
  59. package/dist/resources/index.mjs +13 -13
  60. package/dist/resources/keyring.d.mts +1 -1
  61. package/dist/resources/keyring.mjs +1 -1
  62. package/dist/resources/link.d.mts +1 -1
  63. package/dist/resources/link.mjs +1 -1
  64. package/dist/resources/logs/index.d.mts +1 -1
  65. package/dist/resources/logs/index.mjs +3 -3
  66. package/dist/resources/logs/logs.d.mts +1 -1
  67. package/dist/resources/logs/logs.mjs +1 -1
  68. package/dist/resources/logs/tools.d.mts +1 -1
  69. package/dist/resources/logs/tools.mjs +1 -1
  70. package/dist/resources/logs/triggers.d.mts +1 -1
  71. package/dist/resources/logs/triggers.mjs +1 -1
  72. package/dist/resources/logs.d.mts +1 -1
  73. package/dist/resources/logs.mjs +3 -3
  74. package/dist/resources/mcp/custom.d.mts +1 -1
  75. package/dist/resources/mcp/custom.mjs +1 -1
  76. package/dist/resources/mcp/generate.d.mts +1 -1
  77. package/dist/resources/mcp/generate.mjs +1 -1
  78. package/dist/resources/mcp/index.d.mts +1 -1
  79. package/dist/resources/mcp/index.mjs +3 -3
  80. package/dist/resources/mcp/mcp.d.mts +1 -1
  81. package/dist/resources/mcp/mcp.mjs +1 -1
  82. package/dist/resources/mcp.d.mts +1 -1
  83. package/dist/resources/mcp.mjs +3 -3
  84. package/dist/resources/org/clanker.d.mts +1 -1
  85. package/dist/resources/org/clanker.mjs +1 -1
  86. package/dist/resources/org/consumer/consumer.d.mts +1 -1
  87. package/dist/resources/org/consumer/consumer.mjs +1 -1
  88. package/dist/resources/org/consumer/index.d.mts +1 -1
  89. package/dist/resources/org/consumer/index.mjs +2 -2
  90. package/dist/resources/org/consumer/project.d.mts +1 -1
  91. package/dist/resources/org/consumer/project.mjs +1 -1
  92. package/dist/resources/org/consumer.d.mts +1 -1
  93. package/dist/resources/org/consumer.mjs +2 -2
  94. package/dist/resources/org/index.d.mts +1 -1
  95. package/dist/resources/org/index.mjs +6 -6
  96. package/dist/resources/org/org.d.mts +1 -1
  97. package/dist/resources/org/org.mjs +1 -1
  98. package/dist/resources/org/owner/index.d.mts +1 -1
  99. package/dist/resources/org/owner/index.mjs +2 -2
  100. package/dist/resources/org/owner/owner.d.mts +1 -1
  101. package/dist/resources/org/owner/owner.mjs +1 -1
  102. package/dist/resources/org/owner/project.d.mts +1 -1
  103. package/dist/resources/org/owner/project.mjs +1 -1
  104. package/dist/resources/org/owner.d.mts +1 -1
  105. package/dist/resources/org/owner.mjs +2 -2
  106. package/dist/resources/org/project.d.mts +1 -1
  107. package/dist/resources/org/project.mjs +1 -1
  108. package/dist/resources/org/usage.d.mts +1 -1
  109. package/dist/resources/org/usage.mjs +1 -1
  110. package/dist/resources/org.d.mts +1 -1
  111. package/dist/resources/org.mjs +6 -6
  112. package/dist/resources/project/index.d.mts +1 -1
  113. package/dist/resources/project/index.mjs +1 -1
  114. package/dist/resources/project/project.d.mts +1 -1
  115. package/dist/resources/project/project.mjs +1 -1
  116. package/dist/resources/project/usage.d.mts +1 -1
  117. package/dist/resources/project/usage.mjs +1 -1
  118. package/dist/resources/project.d.mts +1 -1
  119. package/dist/resources/project.mjs +1 -1
  120. package/dist/resources/session-configs.d.mts +1 -1
  121. package/dist/resources/session-configs.mjs +1 -1
  122. package/dist/resources/tool-router/index.d.mts +1 -1
  123. package/dist/resources/tool-router/index.mjs +2 -2
  124. package/dist/resources/tool-router/session/files.d.mts +1 -1
  125. package/dist/resources/tool-router/session/files.mjs +1 -1
  126. package/dist/resources/tool-router/session/index.d.mts +1 -1
  127. package/dist/resources/tool-router/session/index.mjs +2 -2
  128. package/dist/resources/tool-router/session/session.d.mts +1 -1
  129. package/dist/resources/tool-router/session/session.mjs +1 -1
  130. package/dist/resources/tool-router/session.d.mts +1 -1
  131. package/dist/resources/tool-router/session.mjs +2 -2
  132. package/dist/resources/tool-router/tool-router.d.mts +1 -1
  133. package/dist/resources/tool-router/tool-router.mjs +1 -1
  134. package/dist/resources/tool-router.d.mts +1 -1
  135. package/dist/resources/tool-router.mjs +2 -2
  136. package/dist/resources/toolkits.d.mts +1 -1
  137. package/dist/resources/toolkits.mjs +1 -1
  138. package/dist/resources/tools.d.mts +1 -1
  139. package/dist/resources/tools.mjs +1 -1
  140. package/dist/resources/trigger-instances/index.d.mts +1 -1
  141. package/dist/resources/trigger-instances/index.mjs +2 -2
  142. package/dist/resources/trigger-instances/manage.d.mts +1 -1
  143. package/dist/resources/trigger-instances/manage.mjs +1 -1
  144. package/dist/resources/trigger-instances/trigger-instances.d.mts +1 -1
  145. package/dist/resources/trigger-instances/trigger-instances.mjs +1 -1
  146. package/dist/resources/trigger-instances.d.mts +1 -1
  147. package/dist/resources/trigger-instances.mjs +2 -2
  148. package/dist/resources/triggers-types.d.mts +1 -1
  149. package/dist/resources/triggers-types.mjs +1 -1
  150. package/dist/resources/webhook-endpoints.d.mts +1 -1
  151. package/dist/resources/webhook-endpoints.mjs +1 -1
  152. package/dist/resources/webhook-subscriptions.d.mts +1 -1
  153. package/dist/resources/webhook-subscriptions.mjs +1 -1
  154. package/dist/{session-Bmbv2Y2h.mjs → session-DEfDnHZZ.mjs} +2 -2
  155. package/dist/{session-CtO_BX-m.mjs → session-Dm8WtF4I.mjs} +1 -1
  156. package/dist/{session-configs-C_A0gUf5.d.mts → session-configs-nA6TL_i4.d.mts} +33 -2
  157. package/dist/{tool-router-BICZScC1.mjs → tool-router-6l_dREjC.mjs} +1 -1
  158. package/dist/{toolkits-Cj8oNvQi.mjs → toolkits-Mn_uLV98.mjs} +1 -1
  159. package/dist/{tools-C-2Nsm32.mjs → tools-btk0mzFP.mjs} +1 -1
  160. package/dist/{tools-BiyVpJSA.mjs → tools-z-PjBsf7.mjs} +1 -1
  161. package/dist/{trigger-instances-0GIUz_qu.mjs → trigger-instances-PQaObQQy.mjs} +2 -2
  162. package/dist/{triggers-types-BkigxzlE.mjs → triggers-types-KoRbT0k5.mjs} +1 -1
  163. package/dist/{triggers-DWnL3gjv.mjs → triggers-y0mi0XzT.mjs} +1 -1
  164. package/dist/{usage-RRYqkjLH.mjs → usage-B2Z947BK.mjs} +1 -1
  165. package/dist/{usage-D9XlIZBX.mjs → usage-DvjkSmpI.mjs} +1 -1
  166. package/dist/version-DUxhnnPj.d.mts +4 -0
  167. package/dist/{webhook-endpoints-x3UiV7uH.mjs → webhook-endpoints-kf4Jj2Mz.mjs} +1 -1
  168. package/dist/{webhook-subscriptions-_7MTwe1s.mjs → webhook-subscriptions-DcYN8qo1.mjs} +1 -1
  169. package/package.json +2 -2
  170. package/dist/version-BkHUhokz.d.mts +0 -4
package/README.md CHANGED
@@ -432,6 +432,37 @@ decodes, then with the loader table and every schema it reaches.
432
432
  of which 2.1 MB and 328 files are `dist/effect/schemas*`, against 1.1 MB in 176 files for
433
433
  `2.0.0-rc.11` as published. None of it is on the root entry's import path.
434
434
 
435
+ ### Identify the calling product
436
+
437
+ A product built on the client passes `identity` instead of setting headers by hand. The root client
438
+ and `./effect` take the same option:
439
+
440
+ ```ts
441
+ const composio = new Composio({
442
+ apiKey,
443
+ identity: { product: '@composio/core', version: '0.9.0', source: 'TYPESCRIPT_SDK', framework: 'openai' },
444
+ })
445
+ ```
446
+
447
+ | Header | Sent from | Without `identity` |
448
+ | --- | --- | --- |
449
+ | `x-client-provenance`, `x-client-version` | `product`, `version` | the package name and version |
450
+ | `x-sdk-version` | `version` | not sent |
451
+ | `x-source`, `x-framework` | `source`, `framework` | not sent |
452
+ | `x-runtime` | `runtime`, else the detected runtime | the detected runtime |
453
+ | `x-client-runtime`, `x-runtime-version` | the detected runtime | the detected runtime |
454
+ | `x-client-library`, `x-client-library-version`, `x-client-language` | the package | the package |
455
+
456
+ The three library headers are the package's own: `defaultHeaders`, `COMPOSIO_CUSTOM_HEADERS` and a
457
+ call's `headers` cannot set or delete them. Once `identity` is set, the same holds for every header
458
+ in the table. A refused name fails construction (`ComposioError`, or `ConfigurationError` on
459
+ `./effect`), or the call before anything is sent. Identity values must be non-empty printable ASCII
460
+ with no surrounding whitespace, and are sent to the configured API origin only.
461
+
462
+ The detected runtime is one of `nodejs`, `bun`, `deno`, `cloudflare`, `vercel_edge`, `netlify`,
463
+ `fastly` or `unknown`, checked in [`std-env`](https://github.com/unjs/std-env)'s order; the
464
+ Python client always reports `python`.
465
+
435
466
  ## Upgrade from Stainless 0.1.x to 2.0
436
467
 
437
468
  By default, the 2.0 client refuses to send credentials over plain HTTP unless the hostname is
@@ -457,6 +488,15 @@ The opt-in records the resolved scheme, hostname, and port. Mutating `baseURL` c
457
488
  and `withOptions({ baseURL: ... })` requires `allowInsecureHTTP: true` again when the origin
458
489
  changes. Redirects to another origin remain credential-free.
459
490
 
491
+ ### Changed in 2.0.0-rc.17
492
+
493
+ `defaultHeaders`, `COMPOSIO_CUSTOM_HEADERS` and per-call `headers` refuse the library headers
494
+ (`x-client-library`, `x-client-library-version`, `x-client-language`), and refuse every identity
495
+ header once `identity` is set. A wrapper that set its product headers through `defaultHeaders`
496
+ moves them into `identity` (see [Identify the calling product](#identify-the-calling-product)).
497
+ Python takes `identity=ClientIdentity(...)` under the same rule. The type surface is unchanged
498
+ apart from the added option, so the release declares no ledger entry.
499
+
460
500
  ### Removed in 2.0.0-rc.16
461
501
 
462
502
  Each row is a declared entry in `packages/codegen/assignability-ledger.json`, the list of what a
@@ -1,4 +1,4 @@
1
- import { b as withOperation, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/api-key-revocation.ts
4
4
  const OP_CREATE = generatedOperation("apiKeyRevocation.create");
@@ -1,4 +1,4 @@
1
- import { t as Session } from "./session-CtO_BX-m.mjs";
1
+ import { t as Session } from "./session-Dm8WtF4I.mjs";
2
2
 
3
3
  //#region src/compat/resources/auth/auth.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/auth-configs.ts
4
4
  const OP_CREATE = generatedOperation("authConfigs.create");
@@ -1,4 +1,4 @@
1
- import { b as withOperation, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/org/clanker.ts
4
4
  const OP_CREATE_CLAIM = generatedOperation("org.clanker.createClaim");
@@ -1,5 +1,5 @@
1
- import { N as mergeHeaders, b as withOperation, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
2
- import { t as Realtime } from "./realtime-DQ_gT0q7.mjs";
1
+ import { F as mergeHeaders, b as withOperation, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
+ import { t as Realtime } from "./realtime-6LigMh83.mjs";
3
3
 
4
4
  //#region src/compat/resources/cli/cli.ts
5
5
  const OP_CREATE_CODACT_FAILURE = generatedOperation("cli.createCodactFailure");
@@ -1,4 +1,4 @@
1
- import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/connected-accounts.ts
4
4
  const OP_CREATE = generatedOperation("connectedAccounts.create");
@@ -1,5 +1,5 @@
1
- import { N as mergeHeaders, b as withOperation, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
2
- import { t as Project } from "./project-7LL6W_tc.mjs";
1
+ import { F as mergeHeaders, b as withOperation, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
+ import { t as Project } from "./project-DF5KclHm.mjs";
3
3
 
4
4
  //#region src/compat/resources/org/consumer/consumer.ts
5
5
  const OP_LIST_CONNECTED_TOOLKITS = generatedOperation("org.consumer.listConnectedToolkits");
@@ -1,4 +1,4 @@
1
- import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/custom.ts
4
4
  const OP_DELETE_TOOLKIT = generatedOperation("custom.deleteToolkit");
@@ -1,4 +1,4 @@
1
- import { b as withOperation, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/mcp/custom.ts
4
4
  const OP_CREATE = generatedOperation("mcp.custom.create");
package/dist/effect.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as ProjectRegenerateAPIKeyResponse, $n as ToolkitRetrieveChangelogResponse, $r as SessionCreateResponse, $t as McpCreateInstanceParams, A as ClankerCreateClaimResponse, An as TriggersTypeListParams, Ar as FileListResponse$1, At as LogRetrieveToolExecutionResponse, B as ConsumerListConnectedToolkitsParams, Bn as AuthConfigListParams, Br as ToolRetrieveEnumResponse, Ci as FileDeleteResponse, Cn as TriggerInstanceUpsertParams, Cr as ConnectedAccountRevokeResponse, D as OrgListResponse, Dn as ManageDeleteResponse, Dr as FileCreatePresignedURLParams, Dt as UsageRetrieveSummaryResponse, E as OrgListParams, Et as UsageRetrieveSummaryParams, F as UsageRetrieveSummaryResponse$1, Fi as APIErrorBody, Fr as ToolGetInputResponse, Ft as ToolRetrieveResponse$1, Gn as AuthConfigUpdateStatusParams, Gt as CliCreateSessionResponse, Hn as AuthConfigRetrieveResponse, Hr as ToolRetrieveRequiredScopesParams, Ht as CliCreateCodactFailureParams, In as AuthConfigCreateParams, Ir as ToolListParams, J as ProjectCreateResponse, Jn as ToolkitListParams, Jr as SessionAttachParams, Kn as AuthConfigUpdateStatusResponse, Kt as CliGetSessionParams, L as ProjectListParams$1, Ln as AuthConfigCreateResponse, Lr as ToolListResponse, Lt as TriggerListParams, M as UsageRetrieveParams$1, Mn as TriggersTypeRetrieveEnumResponse, Mr as ToolExecuteParams, Mt as ToolListFieldsResponse, N as UsageRetrieveResponse$1, Nn as TriggersTypeRetrieveParams, Nr as ToolExecuteResponse, Nt as ToolListParams$1, On as ManageUpdateParams, Or as FileCreatePresignedURLResponse, Ot as LogCreateToolExecutionParams, P as UsageRetrieveSummaryParams$1, Pn as TriggersTypeRetrieveResponse, Pr as ToolGetInputParams, Pt as ToolListResponse$1, Q as ProjectListResponse, Qn as ToolkitRetrieveCategoriesResponse, Qr as SessionCreateParams, R as ProjectListResponse$1, Rn as AuthConfigDeleteParams, Rr as ToolProxyParams, Rt as TriggerListResponse, Si as FileDeleteParams, Sn as TriggerInstanceListActiveResponse, Sr as ConnectedAccountRetrieveResponse, Ti as FileListResponse, Tr as ConnectedAccountUpdateStatusResponse, Tt as UsageRetrieveResponse, U as ProjectResolveParams, Un as AuthConfigUpdateParams, Ur as ToolRetrieveRequiredScopesResponse, Ut as CliCreateCodactFailureResponse, V as ConsumerListConnectedToolkitsResponse, Vn as AuthConfigListResponse, Vr as ToolRetrieveParams, W as ProjectResolveResponse, Wn as AuthConfigUpdateResponse, Wr as ToolRetrieveResponse, Wt as CliCreateSessionParams, X as ProjectDeleteResponse, Xn as ToolkitRecommendScopesParams, Xr as SessionConfigHistoryParams, Xt as RealtimeAuthResponse, Y as ProjectDeleteParams, Yn as ToolkitListResponse, Yr as SessionAttachResponse, Yt as RealtimeAuthParams, Z as ProjectListParams, Zn as ToolkitRecommendScopesResponse, Zr as SessionConfigHistoryResponse, Zt as RealtimeCredentialsResponse, _ as CustomUpsertParams, _i as SessionToolsResponse, _n as GenerateURLResponse, _r as ConnectedAccountListResponse, _t as WebhookSubscriptionRetrieveResponse, ai as SessionLinkParams, an as McpDeleteResponse, ar as ToolkitRetrieveScopesGrantContextResponse, at as WebhookEndpointReplaceParams, b as ApiKeyRevocationCreateParams, bi as FileCreateUploadURLParams, bn as CustomCreateResponse, br as ConnectedAccountRefreshParams, bt as WebhookSubscriptionUpdateResponse, ci as SessionPatchResponse, cn as McpListParams, cr as LinkCreateParams, ct as WebhookEndpointUpdateParams, d as KeyringListTransferKeysResponse, di as SessionRetrieveResponse, dn as McpRetrieveAppResponse, dr as ConnectedAccountCompleteAuthResponse, dt as WebhookSubscriptionCreateParams, ei as SessionDeleteResponse, en as McpCreateInstanceResponse, er as ToolkitRetrieveMultiParams, et as ProjectRetrieveResponse, fi as SessionSearchParams, fn as McpRetrieveResponse, fr as ConnectedAccountCreateParams, ft as WebhookSubscriptionCreateResponse, g as CustomSyncResponse, gi as SessionToolsParams, gn as GenerateURLParams, gr as ConnectedAccountListParams, gt as WebhookSubscriptionListResponse, h as CustomSyncParams, hi as SessionToolkitsResponse, hr as ConnectedAccountDeleteResponse, ht as WebhookSubscriptionListParams, i as SessionConfigsRetrieveResponse, ii as SessionExecuteResponse, in as McpDeleteInstanceResponse, ir as ToolkitRetrieveScopesGrantContextParams, it as WebhookEndpointListResponse, ji as HeadersLike, jn as TriggersTypeListResponse, k as ClankerCreateClaimParams, kn as ManageUpdateResponse, kr as FileListParams$1, kt as LogCreateToolExecutionResponse, li as SessionProxyExecuteParams, ln as McpListResponse, lr as LinkCreateResponse, lt as WebhookEndpointUpdateResponse, m as CustomDeleteToolkitResponse, mi as SessionToolkitsParams, mn as McpUpdateResponse, mr as ConnectedAccountDeleteParams, mt as WebhookSubscriptionListEventTypesResponse, n as SessionConfigsListParams, ni as SessionExecuteMetaResponse, nn as McpCreateResponse, nr as ToolkitRetrieveParams, nt as WebhookEndpointCreateResponse, oi as SessionLinkResponse, on as McpListInstancesParams, ot as WebhookEndpointReplaceResponse, p as CustomDeleteToolkitParams, pi as SessionSearchResponse, pn as McpUpdateParams, pr as ConnectedAccountCreateResponse, pt as WebhookSubscriptionDeleteResponse, q as ProjectCreateParams, qt as CliGetSessionResponse, r as SessionConfigsListResponse, ri as SessionExecuteParams, rn as McpDeleteInstanceParams, rr as ToolkitRetrieveResponse, rt as WebhookEndpointListParams, si as SessionPatchParams, sn as McpListInstancesResponse, st as WebhookEndpointRetrieveResponse, ti as SessionExecuteMetaParams, tn as McpCreateParams, tr as ToolkitRetrieveMultiResponse, tt as WebhookEndpointCreateParams, ui as SessionProxyExecuteResponse, un as McpRetrieveAppParams, ur as ConnectedAccountCompleteAuthParams, v as CustomUpsertResponse, vi as FileCreateDownloadURLParams, vr as ConnectedAccountPatchParams, vt as WebhookSubscriptionRotateSecretResponse, w as SessionRetrieveInfoResponse, wi as FileListParams, wn as TriggerInstanceUpsertResponse, wr as ConnectedAccountUpdateStatusParams, wt as UsageRetrieveParams, x as ApiKeyRevocationCreateResponse, xi as FileCreateUploadURLResponse, xn as TriggerInstanceListActiveParams, xr as ConnectedAccountRefreshResponse, yi as FileCreateDownloadURLResponse, yn as CustomCreateParams, yr as ConnectedAccountPatchResponse, yt as WebhookSubscriptionUpdateParams, zn as AuthConfigDeleteResponse, zr as ToolProxyResponse, zt as TriggerRetrieveResponse } from "./session-configs-C_A0gUf5.mjs";
2
- import { t as VERSION } from "./version-BkHUhokz.mjs";
1
+ import { $ as ProjectRegenerateAPIKeyResponse, $n as ToolkitRetrieveChangelogResponse, $r as SessionCreateResponse, $t as McpCreateInstanceParams, A as ClankerCreateClaimResponse, An as TriggersTypeListParams, Ar as FileListResponse$1, At as LogRetrieveToolExecutionResponse, B as ConsumerListConnectedToolkitsParams, Bn as AuthConfigListParams, Br as ToolRetrieveEnumResponse, Ci as FileDeleteResponse, Cn as TriggerInstanceUpsertParams, Cr as ConnectedAccountRevokeResponse, D as OrgListResponse, Dn as ManageDeleteResponse, Dr as FileCreatePresignedURLParams, Dt as UsageRetrieveSummaryResponse, E as OrgListParams, Et as UsageRetrieveSummaryParams, F as UsageRetrieveSummaryResponse$1, Fr as ToolGetInputResponse, Ft as ToolRetrieveResponse$1, Gn as AuthConfigUpdateStatusParams, Gt as CliCreateSessionResponse, Hn as AuthConfigRetrieveResponse, Hr as ToolRetrieveRequiredScopesParams, Ht as CliCreateCodactFailureParams, Ii as APIErrorBody, In as AuthConfigCreateParams, Ir as ToolListParams, J as ProjectCreateResponse, Jn as ToolkitListParams, Jr as SessionAttachParams, Kn as AuthConfigUpdateStatusResponse, Kt as CliGetSessionParams, L as ProjectListParams$1, Ln as AuthConfigCreateResponse, Lr as ToolListResponse, Lt as TriggerListParams, M as UsageRetrieveParams$1, Mi as HeadersLike, Mn as TriggersTypeRetrieveEnumResponse, Mr as ToolExecuteParams, Mt as ToolListFieldsResponse, N as UsageRetrieveResponse$1, Nn as TriggersTypeRetrieveParams, Nr as ToolExecuteResponse, Nt as ToolListParams$1, On as ManageUpdateParams, Or as FileCreatePresignedURLResponse, Ot as LogCreateToolExecutionParams, P as UsageRetrieveSummaryParams$1, Pn as TriggersTypeRetrieveResponse, Pr as ToolGetInputParams, Pt as ToolListResponse$1, Q as ProjectListResponse, Qn as ToolkitRetrieveCategoriesResponse, Qr as SessionCreateParams, R as ProjectListResponse$1, Rn as AuthConfigDeleteParams, Rr as ToolProxyParams, Rt as TriggerListResponse, Si as FileDeleteParams, Sn as TriggerInstanceListActiveResponse, Sr as ConnectedAccountRetrieveResponse, Ti as FileListResponse, Tr as ConnectedAccountUpdateStatusResponse, Tt as UsageRetrieveResponse, U as ProjectResolveParams, Un as AuthConfigUpdateParams, Ur as ToolRetrieveRequiredScopesResponse, Ut as CliCreateCodactFailureResponse, V as ConsumerListConnectedToolkitsResponse, Vn as AuthConfigListResponse, Vr as ToolRetrieveParams, W as ProjectResolveResponse, Wn as AuthConfigUpdateResponse, Wr as ToolRetrieveResponse, Wt as CliCreateSessionParams, X as ProjectDeleteResponse, Xn as ToolkitRecommendScopesParams, Xr as SessionConfigHistoryParams, Xt as RealtimeAuthResponse, Y as ProjectDeleteParams, Yn as ToolkitListResponse, Yr as SessionAttachResponse, Yt as RealtimeAuthParams, Z as ProjectListParams, Zn as ToolkitRecommendScopesResponse, Zr as SessionConfigHistoryResponse, Zt as RealtimeCredentialsResponse, _ as CustomUpsertParams, _i as SessionToolsResponse, _n as GenerateURLResponse, _r as ConnectedAccountListResponse, _t as WebhookSubscriptionRetrieveResponse, ai as SessionLinkParams, an as McpDeleteResponse, ar as ToolkitRetrieveScopesGrantContextResponse, at as WebhookEndpointReplaceParams, b as ApiKeyRevocationCreateParams, bi as FileCreateUploadURLParams, bn as CustomCreateResponse, br as ConnectedAccountRefreshParams, bt as WebhookSubscriptionUpdateResponse, ci as SessionPatchResponse, cn as McpListParams, cr as LinkCreateParams, ct as WebhookEndpointUpdateParams, d as KeyringListTransferKeysResponse, di as SessionRetrieveResponse, dn as McpRetrieveAppResponse, dr as ConnectedAccountCompleteAuthResponse, dt as WebhookSubscriptionCreateParams, ei as SessionDeleteResponse, en as McpCreateInstanceResponse, er as ToolkitRetrieveMultiParams, et as ProjectRetrieveResponse, fi as SessionSearchParams, fn as McpRetrieveResponse, fr as ConnectedAccountCreateParams, ft as WebhookSubscriptionCreateResponse, g as CustomSyncResponse, gi as SessionToolsParams, gn as GenerateURLParams, gr as ConnectedAccountListParams, gt as WebhookSubscriptionListResponse, h as CustomSyncParams, hi as SessionToolkitsResponse, hr as ConnectedAccountDeleteResponse, ht as WebhookSubscriptionListParams, i as SessionConfigsRetrieveResponse, ii as SessionExecuteResponse, in as McpDeleteInstanceResponse, ir as ToolkitRetrieveScopesGrantContextParams, it as WebhookEndpointListResponse, ji as ClientIdentity, jn as TriggersTypeListResponse, k as ClankerCreateClaimParams, kn as ManageUpdateResponse, kr as FileListParams$1, kt as LogCreateToolExecutionResponse, li as SessionProxyExecuteParams, ln as McpListResponse, lr as LinkCreateResponse, lt as WebhookEndpointUpdateResponse, m as CustomDeleteToolkitResponse, mi as SessionToolkitsParams, mn as McpUpdateResponse, mr as ConnectedAccountDeleteParams, mt as WebhookSubscriptionListEventTypesResponse, n as SessionConfigsListParams, ni as SessionExecuteMetaResponse, nn as McpCreateResponse, nr as ToolkitRetrieveParams, nt as WebhookEndpointCreateResponse, oi as SessionLinkResponse, on as McpListInstancesParams, ot as WebhookEndpointReplaceResponse, p as CustomDeleteToolkitParams, pi as SessionSearchResponse, pn as McpUpdateParams, pr as ConnectedAccountCreateResponse, pt as WebhookSubscriptionDeleteResponse, q as ProjectCreateParams, qt as CliGetSessionResponse, r as SessionConfigsListResponse, ri as SessionExecuteParams, rn as McpDeleteInstanceParams, rr as ToolkitRetrieveResponse, rt as WebhookEndpointListParams, si as SessionPatchParams, sn as McpListInstancesResponse, st as WebhookEndpointRetrieveResponse, ti as SessionExecuteMetaParams, tn as McpCreateParams, tr as ToolkitRetrieveMultiResponse, tt as WebhookEndpointCreateParams, ui as SessionProxyExecuteResponse, un as McpRetrieveAppParams, ur as ConnectedAccountCompleteAuthParams, v as CustomUpsertResponse, vi as FileCreateDownloadURLParams, vr as ConnectedAccountPatchParams, vt as WebhookSubscriptionRotateSecretResponse, w as SessionRetrieveInfoResponse, wi as FileListParams, wn as TriggerInstanceUpsertResponse, wr as ConnectedAccountUpdateStatusParams, wt as UsageRetrieveParams, x as ApiKeyRevocationCreateResponse, xi as FileCreateUploadURLResponse, xn as TriggerInstanceListActiveParams, xr as ConnectedAccountRefreshResponse, yi as FileCreateDownloadURLResponse, yn as CustomCreateParams, yr as ConnectedAccountPatchResponse, yt as WebhookSubscriptionUpdateParams, zn as AuthConfigDeleteResponse, zr as ToolProxyResponse, zt as TriggerRetrieveResponse } from "./session-configs-nA6TL_i4.mjs";
2
+ import { t as VERSION } from "./version-DUxhnnPj.mjs";
3
3
  import { Context, Effect, Layer, Redacted, Stream } from "effect";
4
4
  import * as HttpClient from "effect/http/HttpClient";
5
5
  import * as Schema from "effect/Schema";
@@ -651,7 +651,19 @@ interface ClientSettings {
651
651
  * origin. The permission is limited to the resolved scheme, host, and port.
652
652
  */
653
653
  readonly allowInsecureHTTP?: boolean | undefined;
654
- /** Headers sent on every request; per-call headers win, `null` deletes. */
654
+ /**
655
+ * The calling product, sent as the product headers (`x-client-provenance`,
656
+ * `x-client-version`, `x-sdk-version`, `x-source`, `x-framework`,
657
+ * `x-runtime`). With it set, neither `defaultHeaders` nor a call's `headers`
658
+ * may name an identity header; without it the client reports itself.
659
+ */
660
+ readonly identity?: ClientIdentity | undefined;
661
+ /**
662
+ * Headers sent on every request; per-call headers win, `null` deletes. The
663
+ * library headers (`x-client-library`, `x-client-library-version`,
664
+ * `x-client-language`) are the client's own and are refused here, as is
665
+ * every identity header once `identity` is set.
666
+ */
655
667
  readonly defaultHeaders?: HeadersLike;
656
668
  /**
657
669
  * Maximum retries for temporary failures of a call whose method is
@@ -728,8 +740,9 @@ declare class ComposioClient extends ComposioClient_base {}
728
740
  * Reads no environment variable.
729
741
  *
730
742
  * @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
731
- * credential cannot be sent as a header, or the client is to decode and was
732
- * given no schemas.
743
+ * credential cannot be sent as a header, `identity` is invalid or
744
+ * `defaultHeaders` names an identity header, or the client is to decode and
745
+ * was given no schemas.
733
746
  */
734
747
  declare const make: (options: ComposioClientOptions, httpClient: HttpClient.HttpClient) => ComposioClientShape;
735
748
  /**
@@ -753,4 +766,4 @@ declare const layerFetch: (options?: ComposioClientOptions) => Layer.Layer<Compo
753
766
  */
754
767
  declare const layerConfig: (options?: ComposioClientOptions) => Layer.Layer<ComposioClient, ConfigurationError, HttpClient.HttpClient>;
755
768
  //#endregion
756
- export { APIConnectionError, APIConnectionTimeoutError, APIError, type APIErrorBody, type APIErrorFields, type APIStatusError, AuthenticationError, BadRequestError, ComposioClient, type ComposioClientOptions, type ComposioClientShape, type ComposioError, ConfigurationError, ConflictError, type Credential, DecodeError, type DecodeIssue, type DeprecationNotices, type HeadersLike, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, type RawBodyRequestOptions, type RawRequestOptions, type RequestOptions, type SchemaLoaders, type Tracing, UnprocessableEntityError, VERSION, isAPIError, isComposioError, layer, layerConfig, layerFetch, make };
769
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, type APIErrorBody, type APIErrorFields, type APIStatusError, AuthenticationError, BadRequestError, type ClientIdentity, ComposioClient, type ComposioClientOptions, type ComposioClientShape, type ComposioError, ConfigurationError, ConflictError, type Credential, DecodeError, type DecodeIssue, type DeprecationNotices, type HeadersLike, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, type RawBodyRequestOptions, type RawRequestOptions, type RequestOptions, type SchemaLoaders, type Tracing, UnprocessableEntityError, VERSION, isAPIError, isComposioError, layer, layerConfig, layerFetch, make };
package/dist/effect.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { h as makeAPIErrorMessage, m as errorDetails, s as ComposioError } from "./error-D9cG225M.mjs";
2
- import { A as parseHTTPURL, C as inspectDeprecatedInputs, D as assertCredentialTransport, E as SCHEME_HEADERS, M as buildHeaders, N as mergeHeaders, O as callerPlacedCredential, S as VERSION, T as matchOperation, _ as schemeForRequest, a as TOO_MANY_REDIRECTS, c as buildURL, d as path, f as printableURL, g as safeJSON, h as rewriteForRedirect, i as REDIRECT_STATUSES, j as resolveHTTPURL, k as carriesCredentials, m as retryDelayMillis, n as generatedOperation, o as buildBody, r as OPAQUE_REDIRECT, s as buildRequestHeaders, t as GENERATED_OPERATIONS, v as shouldRetryResponse, w as inspectDeprecation, y as validatePositiveInteger } from "./generated-operations-DrhN6W_k.mjs";
3
- import { r as classifySuccessBody, t as GENERATED_DEPRECATED_INPUTS } from "./generated-deprecated-inputs-B6o8D8ub.mjs";
2
+ import { A as callerPlacedCredential, C as resolveIdentity, D as matchOperation, E as inspectDeprecation, F as mergeHeaders, M as parseHTTPURL, N as resolveHTTPURL, O as SCHEME_HEADERS, P as buildHeaders, S as assertNoReservedHeaders, T as inspectDeprecatedInputs, _ as schemeForRequest, a as TOO_MANY_REDIRECTS, c as buildURL, d as path, f as printableURL, g as safeJSON, h as rewriteForRedirect, i as REDIRECT_STATUSES, j as carriesCredentials, k as assertCredentialTransport, m as retryDelayMillis, n as generatedOperation, o as buildBody, r as OPAQUE_REDIRECT, s as buildRequestHeaders, t as GENERATED_OPERATIONS, v as shouldRetryResponse, w as VERSION, y as validatePositiveInteger } from "./generated-operations-D1e__yar.mjs";
3
+ import { r as classifySuccessBody, t as GENERATED_DEPRECATED_INPUTS } from "./generated-deprecated-inputs--L5LHDO_.mjs";
4
4
  import { i as standardNextCursor, n as assertPageItems, r as isFinalCursor, t as assertCursorAdvanced } from "./pagination-rules-uMUdPq_7.mjs";
5
5
  import { Config, Context, Data, Effect, Exit, Layer, Match, Option, Predicate, Redacted, Result, Stream, Tracer } from "effect";
6
6
  import * as FetchHttpClient from "effect/http/FetchHttpClient";
@@ -383,6 +383,7 @@ const substitute = (template, params) => {
383
383
  const hopHeaders = (prepared, hop) => buildRequestHeaders(prepared.headerConfig, { headers: prepared.callHeaders }, hop.url, hop.bodyHeaders, hop.withdrawn, prepared.scheme, prepared.callerPlaced);
384
384
  const prepare = (kernel, call) => {
385
385
  const callHeaders = call.headers();
386
+ assertNoReservedHeaders(callHeaders, kernel.identity, "headers");
386
387
  const path = call.path();
387
388
  if (call.options?.timeout !== void 0) validatePositiveInteger("timeout", call.options.timeout);
388
389
  const resolvedRetries = call.options?.maxRetries ?? kernel.maxRetries;
@@ -411,7 +412,8 @@ const prepare = (kernel, call) => {
411
412
  credentials,
412
413
  allowedHTTPOrigin: kernel.allowedHTTPOrigin,
413
414
  userAgent: kernel.userAgent,
414
- defaultHeaders: kernel.defaultHeaders
415
+ defaultHeaders: kernel.defaultHeaders,
416
+ identity: kernel.identity
415
417
  },
416
418
  callHeaders,
417
419
  scheme: schemeForRequest({ credentials }, call.operation),
@@ -1489,6 +1491,15 @@ const hold = (credential) => {
1489
1491
  const resolveKernel = (options, httpClient) => {
1490
1492
  const baseURL = options.baseURL || DEFAULT_BASE_URL;
1491
1493
  if (options.decode === true && options.schemas === void 0) return Result.fail(new ConfigurationError({ message: SCHEMAS_MISSING }));
1494
+ const identity = Result.try({
1495
+ try: () => {
1496
+ const resolved = resolveIdentity(options.identity);
1497
+ assertNoReservedHeaders(options.defaultHeaders, resolved, "defaultHeaders");
1498
+ return resolved;
1499
+ },
1500
+ catch: configurationErrorFrom
1501
+ });
1502
+ if (Result.isFailure(identity)) return Result.fail(identity.failure);
1492
1503
  const kernel = {
1493
1504
  httpClient,
1494
1505
  baseURL,
@@ -1498,6 +1509,7 @@ const resolveKernel = (options, httpClient) => {
1498
1509
  allowedHTTPOrigin: options.allowInsecureHTTP ? parseHTTPURL(baseURL)?.origin ?? null : null,
1499
1510
  userAgent: `Composio/JS ${VERSION}`,
1500
1511
  defaultHeaders: options.defaultHeaders,
1512
+ identity: identity.success,
1501
1513
  maxRetries: options.maxRetries ?? DEFAULT_MAX_RETRIES,
1502
1514
  timeout: options.timeout ?? DEFAULT_TIMEOUT,
1503
1515
  tracing: options.tracing ?? "off",
@@ -1528,8 +1540,9 @@ const fromKernel = (kernel) => ({
1528
1540
  * are built over it, and it is not part of the entry's exports.
1529
1541
  *
1530
1542
  * @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
1531
- * credential cannot be sent as a header, or the client is to decode and was
1532
- * given no schemas.
1543
+ * credential cannot be sent as a header, `identity` is invalid or
1544
+ * `defaultHeaders` names an identity header, or the client is to decode and
1545
+ * was given no schemas.
1533
1546
  */
1534
1547
  const makeKernel = (options, httpClient) => Result.getOrThrow(resolveKernel(options, httpClient));
1535
1548
  /**
@@ -1537,8 +1550,9 @@ const makeKernel = (options, httpClient) => Result.getOrThrow(resolveKernel(opti
1537
1550
  * Reads no environment variable.
1538
1551
  *
1539
1552
  * @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
1540
- * credential cannot be sent as a header, or the client is to decode and was
1541
- * given no schemas.
1553
+ * credential cannot be sent as a header, `identity` is invalid or
1554
+ * `defaultHeaders` names an identity header, or the client is to decode and
1555
+ * was given no schemas.
1542
1556
  */
1543
1557
  const make = (options, httpClient) => fromKernel(makeKernel(options, httpClient));
1544
1558
  /**
@@ -1,4 +1,4 @@
1
- import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, d as path, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/tool-router/session/files.ts
4
4
  const OP_LIST = generatedOperation("toolRouter.session.files.list");
@@ -1,4 +1,4 @@
1
- import { b as withOperation, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/files.ts
4
4
  const OP_LIST = generatedOperation("files.list");
@@ -1,4 +1,4 @@
1
- import { b as withOperation, n as generatedOperation } from "./generated-operations-DrhN6W_k.mjs";
1
+ import { b as withOperation, n as generatedOperation } from "./generated-operations-D1e__yar.mjs";
2
2
 
3
3
  //#region src/compat/resources/mcp/generate.ts
4
4
  const OP_URL = generatedOperation("mcp.generate.url");
@@ -1,5 +1,5 @@
1
1
  import { r as APIError } from "./error-D9cG225M.mjs";
2
- import { g as safeJSON, l as castToError } from "./generated-operations-DrhN6W_k.mjs";
2
+ import { g as safeJSON, l as castToError } from "./generated-operations-D1e__yar.mjs";
3
3
 
4
4
  //#region src/compat/api-promise.ts
5
5
  /**
@@ -67,6 +67,10 @@ const mergeHeaders = (sources) => {
67
67
  };
68
68
  /** Merge sources into the native header collection sent to fetch. */
69
69
  const buildHeaders = (sources) => mergeHeaders(sources).values;
70
+ /** Every header name a source mentions, lowercased, a `null` deletion included. */
71
+ function* headerNames(headers) {
72
+ for (const [name] of iterateHeaders(headers)) yield name.toLowerCase();
73
+ }
70
74
 
71
75
  //#endregion
72
76
  //#region src/compat/credentials.ts
@@ -905,43 +909,171 @@ const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen,
905
909
 
906
910
  //#endregion
907
911
  //#region src/version.ts
908
- const VERSION = "2.0.0-rc.16";
912
+ const VERSION = "2.0.0-rc.17";
909
913
 
910
914
  //#endregion
911
- //#region src/compat/telemetry.ts
915
+ //#region src/compat/identity.ts
916
+ /**
917
+ * The runtime keys `std-env` detects, in its order, each with the label this
918
+ * client sends as `x-client-runtime`. Ported from std-env 4.3.0
919
+ * (https://github.com/unjs/std-env, MIT) rather than imported: std-env reads
920
+ * `process.env` when it is imported, which throws under Deno without
921
+ * `--allow-env`, and this needs only the runtime check.
922
+ *
923
+ * The labels are the ones released clients already send and the platform
924
+ * already normalizes (`nodejs`, `cloudflare`, `vercel_edge`, ...), so a
925
+ * dashboard groups old and new traffic together. Edge runtimes come before
926
+ * Node because `nodejs_compat` and edge polyfills expose `process.versions.node`.
927
+ */
928
+ const RUNTIMES = [
929
+ [
930
+ "netlify",
931
+ "netlify",
932
+ (g) => "Netlify" in g
933
+ ],
934
+ [
935
+ "edge-light",
936
+ "vercel_edge",
937
+ (g) => "EdgeRuntime" in g
938
+ ],
939
+ [
940
+ "workerd",
941
+ "cloudflare",
942
+ (g) => g.navigator?.userAgent === "Cloudflare-Workers"
943
+ ],
944
+ [
945
+ "fastly",
946
+ "fastly",
947
+ (g) => "fastly" in g
948
+ ],
949
+ [
950
+ "deno",
951
+ "deno",
952
+ (g) => "Deno" in g
953
+ ],
954
+ [
955
+ "bun",
956
+ "bun",
957
+ (g) => "Bun" in g
958
+ ],
959
+ [
960
+ "node",
961
+ "nodejs",
962
+ (g) => Boolean(g.process?.versions?.node)
963
+ ]
964
+ ];
912
965
  /**
913
- * The runtime label and version, first match wins. Workers and Vercel Edge are
914
- * checked before Node because `nodejs_compat` and edge polyfills can expose
915
- * `process.versions.node`; neither reports a version, so a polyfilled Node
916
- * version is never sent as theirs.
966
+ * The runtime label and its version. The version is `process.versions[key]`,
967
+ * which Node, Bun and Deno each set for themselves; an edge runtime reports
968
+ * none, so a polyfilled Node version is never sent as its own.
917
969
  */
918
970
  const detectRuntime = () => {
919
971
  const g = globalThis;
920
- if (g.Bun !== void 0) return ["bun", g.Bun.version];
921
- if (g.Deno !== void 0) return ["deno", g.Deno.version?.deno];
922
- if (g.navigator?.userAgent === "Cloudflare-Workers" || g.caches !== void 0 && g.WebSocketPair !== void 0) return ["cloudflare", void 0];
923
- if (g.EdgeRuntime !== void 0) return ["vercel_edge", void 0];
924
- if (typeof process !== "undefined" && process.versions?.node) return ["nodejs", process.versions.node];
925
- if (typeof g.ServiceWorkerGlobalScope === "function" && globalThis instanceof g.ServiceWorkerGlobalScope) return ["service_worker", void 0];
926
- if (g.WorkerGlobalScope !== void 0 && typeof g.importScripts === "function") return ["web_worker", void 0];
927
- if (g.navigator?.product === "ReactNative") return ["react_native", void 0];
928
- if (g.window !== void 0 && g.document !== void 0) return ["browser", void 0];
972
+ for (const [key, label, detect] of RUNTIMES) if (detect(g)) return [label, g.process?.versions?.[key]];
929
973
  return ["unknown", void 0];
930
974
  };
931
- /** Caller headers override these defaults, including the calling SDK's identity. */
932
- const clientTelemetryHeaders = () => {
933
- const [runtime, version] = detectRuntime();
934
- const headers = {
935
- "x-client-provenance": "@composio/client",
936
- "x-client-version": VERSION,
975
+ /** The library sending the request. Never caller-settable, with or without an identity. */
976
+ const PACKAGE_HEADERS = [
977
+ "x-client-library",
978
+ "x-client-library-version",
979
+ "x-client-language"
980
+ ];
981
+ /**
982
+ * The calling product and its runtime. Reserved once a client has an
983
+ * `identity`; without one they default to the package and stay
984
+ * caller-settable, which is how a wrapper identified itself before `identity`.
985
+ */
986
+ const PRODUCT_HEADERS = [
987
+ "x-client-provenance",
988
+ "x-client-version",
989
+ "x-sdk-version",
990
+ "x-source",
991
+ "x-framework",
992
+ "x-runtime",
993
+ "x-client-runtime",
994
+ "x-runtime-version"
995
+ ];
996
+ const PACKAGE_RESERVED = new Set(PACKAGE_HEADERS);
997
+ const IDENTITY_RESERVED = /* @__PURE__ */ new Set([...PACKAGE_HEADERS, ...PRODUCT_HEADERS]);
998
+ /** Printable ASCII with no leading or trailing whitespace: what every runtime's `Headers` sends unchanged. */
999
+ const HEADER_SAFE = /^[\x21-\x7e](?:[\x20-\x7e]*[\x21-\x7e])?$/;
1000
+ const IDENTITY_FIELDS = [
1001
+ "product",
1002
+ "version",
1003
+ "source",
1004
+ "framework",
1005
+ "runtime"
1006
+ ];
1007
+ const REQUIRED_FIELDS = /* @__PURE__ */ new Set(["product", "version"]);
1008
+ const validateIdentity = (identity) => {
1009
+ if (typeof identity !== "object" || identity === null) throw new ComposioError("`identity` must be an object with a `product` and a `version`.");
1010
+ const fields = identity;
1011
+ for (const field of IDENTITY_FIELDS) {
1012
+ const value = fields[field];
1013
+ if (value === void 0 && !REQUIRED_FIELDS.has(field)) continue;
1014
+ if (typeof value !== "string" || !HEADER_SAFE.test(value)) throw new ComposioError(`\`identity.${field}\` must be a non-empty string of printable ASCII with no leading or trailing whitespace.`);
1015
+ }
1016
+ return identity;
1017
+ };
1018
+ /**
1019
+ * Validates `identity` and resolves the headers it owns, once per client.
1020
+ *
1021
+ * Without an identity the client reports itself, as it always has. With one,
1022
+ * the product fields replace the package's; the runtime the package detected
1023
+ * stays in `x-client-runtime` and `x-runtime-version` either way, since
1024
+ * `identity.runtime` is the legacy `x-runtime` label and the platform does not
1025
+ * read the two as aliases.
1026
+ */
1027
+ const resolveIdentity = (identity) => {
1028
+ const [runtime, runtimeVersion] = detectRuntime();
1029
+ const library = {
937
1030
  "x-client-library": "@composio/client",
938
1031
  "x-client-library-version": VERSION,
939
1032
  "x-client-language": "typescript",
940
- "x-client-runtime": runtime,
941
- "x-runtime": runtime
1033
+ "x-client-runtime": runtime
942
1034
  };
943
- if (version) headers["x-runtime-version"] = version;
944
- return headers;
1035
+ if (identity === void 0) {
1036
+ const headers = {
1037
+ "x-client-provenance": "@composio/client",
1038
+ "x-client-version": VERSION,
1039
+ ...library,
1040
+ "x-runtime": runtime
1041
+ };
1042
+ if (runtimeVersion) headers["x-runtime-version"] = runtimeVersion;
1043
+ return {
1044
+ headers,
1045
+ reserved: PACKAGE_RESERVED
1046
+ };
1047
+ }
1048
+ const valid = validateIdentity(identity);
1049
+ const headers = {
1050
+ "x-client-provenance": valid.product,
1051
+ "x-client-version": valid.version,
1052
+ ...library,
1053
+ "x-runtime": valid.runtime ?? runtime
1054
+ };
1055
+ if (runtimeVersion) headers["x-runtime-version"] = runtimeVersion;
1056
+ headers["x-sdk-version"] = valid.version;
1057
+ if (valid.source !== void 0) headers["x-source"] = valid.source;
1058
+ if (valid.framework !== void 0) headers["x-framework"] = valid.framework;
1059
+ return {
1060
+ headers,
1061
+ reserved: IDENTITY_RESERVED
1062
+ };
1063
+ };
1064
+ /**
1065
+ * Refuses a generic header source that names an identity header, whether it
1066
+ * sets one or deletes one with `null`. Constructor validation runs it over
1067
+ * `defaultHeaders`; request validation over a call's `headers`, before any
1068
+ * network work.
1069
+ */
1070
+ const assertNoReservedHeaders = (headers, identity, option) => {
1071
+ if (!headers) return;
1072
+ for (const name of headerNames(headers)) {
1073
+ if (!identity.reserved.has(name)) continue;
1074
+ const owner = PACKAGE_RESERVED.has(name) ? "the client" : "`identity`";
1075
+ throw new ComposioError(`The \`${name}\` header is set by ${owner} and cannot be passed in \`${option}\`.` + (owner === "`identity`" ? "" : " Pass `identity` to describe the calling product."));
1076
+ }
945
1077
  };
946
1078
 
947
1079
  //#endregion
@@ -1298,7 +1430,7 @@ const kernelInternals = { sleep };
1298
1430
  */
1299
1431
  const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
1300
1432
  const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL, config.allowedHTTPOrigin);
1301
- const identity = sameOrigin(config.baseURL, requestURL) ? clientTelemetryHeaders() : void 0;
1433
+ const identity = sameOrigin(config.baseURL, requestURL) ? config.identity.headers : void 0;
1302
1434
  if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers && options.idempotencyKey === void 0) {
1303
1435
  const direct = new Headers({
1304
1436
  ...identity,
@@ -1415,6 +1547,7 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
1415
1547
  * which is what `deprecation.ts` resolves relative `Link` targets against.
1416
1548
  */
1417
1549
  async function makeRequest(config, options) {
1550
+ assertNoReservedHeaders(options.headers, config.identity, "headers");
1418
1551
  if (options.timeout !== void 0) validatePositiveInteger("timeout", options.timeout);
1419
1552
  const maxRetries = options.maxRetries ?? config.maxRetries;
1420
1553
  validatePositiveInteger("maxRetries", maxRetries);
@@ -2345,4 +2478,4 @@ const generatedOperation = (chainKey) => {
2345
2478
  };
2346
2479
 
2347
2480
  //#endregion
2348
- export { parseHTTPURL as A, inspectDeprecatedInputs as C, assertCredentialTransport as D, SCHEME_HEADERS as E, buildHeaders as M, mergeHeaders as N, callerPlacedCredential as O, VERSION as S, matchOperation as T, schemeForRequest as _, TOO_MANY_REDIRECTS as a, withOperation as b, buildURL as c, path as d, printableURL as f, safeJSON as g, rewriteForRedirect as h, REDIRECT_STATUSES as i, resolveHTTPURL as j, carriesCredentials as k, castToError as l, retryDelayMillis as m, generatedOperation as n, buildBody as o, readOperation as p, OPAQUE_REDIRECT as r, buildRequestHeaders as s, GENERATED_OPERATIONS as t, makeRequest as u, shouldRetryResponse as v, inspectDeprecation as w, createFetchTransport as x, validatePositiveInteger as y };
2481
+ export { callerPlacedCredential as A, resolveIdentity as C, matchOperation as D, inspectDeprecation as E, mergeHeaders as F, parseHTTPURL as M, resolveHTTPURL as N, SCHEME_HEADERS as O, buildHeaders as P, assertNoReservedHeaders as S, inspectDeprecatedInputs as T, schemeForRequest as _, TOO_MANY_REDIRECTS as a, withOperation as b, buildURL as c, path as d, printableURL as f, safeJSON as g, rewriteForRedirect as h, REDIRECT_STATUSES as i, carriesCredentials as j, assertCredentialTransport as k, castToError as l, retryDelayMillis as m, generatedOperation as n, buildBody as o, readOperation as p, OPAQUE_REDIRECT as r, buildRequestHeaders as s, GENERATED_OPERATIONS as t, makeRequest as u, shouldRetryResponse as v, VERSION as w, createFetchTransport as x, validatePositiveInteger as y };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { $r as SessionCreateResponse, Ai as createFetchTransport, Bi as ConflictError, Ci as FileDeleteResponse, Di as RequestOptions, Ei as Files, Fi as APIErrorBody, Gi as UnprocessableEntityError, Hi as NotFoundError, Ii as APIUserAbortError, Jr as SessionAttachParams, Ki as APIPromise, Kr as ToolRouter, Li as AuthenticationError, Mi as APIConnectionError, Ni as APIConnectionTimeoutError, Oi as FetchTransportDefaults, Pi as APIError, Qr as SessionCreateParams, Ri as BadRequestError, Si as FileDeleteParams, Ti as FileListResponse, Ui as PermissionDeniedError, Vi as InternalServerError, Wi as RateLimitError, Xr as SessionConfigHistoryParams, Yr as SessionAttachResponse, Zr as SessionConfigHistoryResponse, _i as SessionToolsResponse, a as ClientOptions, ai as SessionLinkParams, bi as FileCreateUploadURLParams, c as LogLevel, ci as SessionPatchResponse, di as SessionRetrieveResponse, ei as SessionDeleteResponse, fi as SessionSearchParams, gi as SessionToolsParams, hi as SessionToolkitsResponse, ii as SessionExecuteResponse, ki as Transport, l as Logger, li as SessionProxyExecuteParams, mi as SessionToolkitsParams, ni as SessionExecuteMetaResponse, o as Composio, oi as SessionLinkResponse, pi as SessionSearchResponse, qr as Session, ri as SessionExecuteParams, s as EnvironmentMap, si as SessionPatchParams, ti as SessionExecuteMetaParams, ui as SessionProxyExecuteResponse, vi as FileCreateDownloadURLParams, wi as FileListParams, xi as FileCreateUploadURLResponse, yi as FileCreateDownloadURLResponse, zi as ComposioError } from "./session-configs-C_A0gUf5.mjs";
2
- import { t as VERSION } from "./version-BkHUhokz.mjs";
3
- export { APIConnectionError, APIConnectionTimeoutError, APIError, type APIErrorBody, APIPromise, APIUserAbortError, AuthenticationError, BadRequestError, type ClientOptions, Composio, Composio as default, ComposioError, ConflictError, type EnvironmentMap, type FetchTransportDefaults, type FileCreateDownloadURLParams, type FileCreateDownloadURLResponse, type FileCreateUploadURLParams, type FileCreateUploadURLResponse, type FileDeleteParams, type FileDeleteResponse, type FileListParams, type FileListResponse, Files, InternalServerError, type LogLevel, type Logger, NotFoundError, PermissionDeniedError, RateLimitError, type RequestOptions, Session, type SessionAttachParams, type SessionAttachResponse, type SessionConfigHistoryParams, type SessionConfigHistoryResponse, type SessionCreateParams, type SessionCreateResponse, type SessionDeleteResponse, type SessionExecuteMetaParams, type SessionExecuteMetaResponse, type SessionExecuteParams, type SessionExecuteResponse, type SessionLinkParams, type SessionLinkResponse, type SessionPatchParams, type SessionPatchResponse, type SessionProxyExecuteParams, type SessionProxyExecuteResponse, type SessionRetrieveResponse, type SessionSearchParams, type SessionSearchResponse, type SessionToolkitsParams, type SessionToolkitsResponse, type SessionToolsParams, type SessionToolsResponse, ToolRouter, type Transport, UnprocessableEntityError, VERSION, createFetchTransport };
1
+ import { $r as SessionCreateResponse, Ai as createFetchTransport, Bi as ComposioError, Ci as FileDeleteResponse, Di as RequestOptions, Ei as Files, Fi as APIError, Gi as RateLimitError, Hi as InternalServerError, Ii as APIErrorBody, Jr as SessionAttachParams, Ki as UnprocessableEntityError, Kr as ToolRouter, Li as APIUserAbortError, Ni as APIConnectionError, Oi as FetchTransportDefaults, Pi as APIConnectionTimeoutError, Qr as SessionCreateParams, Ri as AuthenticationError, Si as FileDeleteParams, Ti as FileListResponse, Ui as NotFoundError, Vi as ConflictError, Wi as PermissionDeniedError, Xr as SessionConfigHistoryParams, Yr as SessionAttachResponse, Zr as SessionConfigHistoryResponse, _i as SessionToolsResponse, a as ClientOptions, ai as SessionLinkParams, bi as FileCreateUploadURLParams, c as LogLevel, ci as SessionPatchResponse, di as SessionRetrieveResponse, ei as SessionDeleteResponse, fi as SessionSearchParams, gi as SessionToolsParams, hi as SessionToolkitsResponse, ii as SessionExecuteResponse, ji as ClientIdentity, ki as Transport, l as Logger, li as SessionProxyExecuteParams, mi as SessionToolkitsParams, ni as SessionExecuteMetaResponse, o as Composio, oi as SessionLinkResponse, pi as SessionSearchResponse, qi as APIPromise, qr as Session, ri as SessionExecuteParams, s as EnvironmentMap, si as SessionPatchParams, ti as SessionExecuteMetaParams, ui as SessionProxyExecuteResponse, vi as FileCreateDownloadURLParams, wi as FileListParams, xi as FileCreateUploadURLResponse, yi as FileCreateDownloadURLResponse, zi as BadRequestError } from "./session-configs-nA6TL_i4.mjs";
2
+ import { t as VERSION } from "./version-DUxhnnPj.mjs";
3
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, type APIErrorBody, APIPromise, APIUserAbortError, AuthenticationError, BadRequestError, type ClientIdentity, type ClientOptions, Composio, Composio as default, ComposioError, ConflictError, type EnvironmentMap, type FetchTransportDefaults, type FileCreateDownloadURLParams, type FileCreateDownloadURLResponse, type FileCreateUploadURLParams, type FileCreateUploadURLResponse, type FileDeleteParams, type FileDeleteResponse, type FileListParams, type FileListResponse, Files, InternalServerError, type LogLevel, type Logger, NotFoundError, PermissionDeniedError, RateLimitError, type RequestOptions, Session, type SessionAttachParams, type SessionAttachResponse, type SessionConfigHistoryParams, type SessionConfigHistoryResponse, type SessionCreateParams, type SessionCreateResponse, type SessionDeleteResponse, type SessionExecuteMetaParams, type SessionExecuteMetaResponse, type SessionExecuteParams, type SessionExecuteResponse, type SessionLinkParams, type SessionLinkResponse, type SessionPatchParams, type SessionPatchResponse, type SessionProxyExecuteParams, type SessionProxyExecuteResponse, type SessionRetrieveResponse, type SessionSearchParams, type SessionSearchResponse, type SessionToolkitsParams, type SessionToolkitsResponse, type SessionToolsParams, type SessionToolsResponse, ToolRouter, type Transport, UnprocessableEntityError, VERSION, createFetchTransport };