@composio/client 2.0.0-rc.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (559) hide show
  1. package/LICENSE +202 -0
  2. package/MIGRATION.md +164 -0
  3. package/README.md +499 -39
  4. package/dist/{session-configs-DC9dblKH.d.mts → _internal-BBZ8gsxI.d.mts} +2297 -1749
  5. package/dist/_internal-C4YQE9nG.d.mts +281 -0
  6. package/dist/effect/internal.d.mts +9 -0
  7. package/dist/effect/internal.mjs +1 -0
  8. package/dist/effect/schemas/_internal/cli/create-codact-failure.d.mts +9 -0
  9. package/dist/effect/schemas/_internal/cli/create-codact-failure.mjs +17 -0
  10. package/dist/effect/schemas/_internal/cli/create-session.d.mts +12 -0
  11. package/dist/effect/schemas/_internal/cli/create-session.mjs +26 -0
  12. package/dist/effect/schemas/_internal/cli/get-session.d.mts +18 -0
  13. package/dist/effect/schemas/_internal/cli/get-session.mjs +48 -0
  14. package/dist/effect/schemas/_internal/cli/realtime/auth.d.mts +9 -0
  15. package/dist/effect/schemas/_internal/cli/realtime/auth.mjs +11 -0
  16. package/dist/effect/schemas/_internal/cli/realtime/credentials.d.mts +10 -0
  17. package/dist/effect/schemas/_internal/cli/realtime/credentials.mjs +12 -0
  18. package/dist/effect/schemas/_internal/consumer/permissions/resolve.d.mts +13 -0
  19. package/dist/effect/schemas/_internal/consumer/permissions/resolve.mjs +20 -0
  20. package/dist/effect/schemas/_internal/logs/tools/list-fields.d.mts +13 -0
  21. package/dist/effect/schemas/_internal/logs/tools/list-fields.mjs +13 -0
  22. package/dist/effect/schemas/_internal/logs/tools/list.d.mts +28 -0
  23. package/dist/effect/schemas/_internal/logs/tools/list.mjs +33 -0
  24. package/dist/effect/schemas/_internal/logs/tools/retrieve.d.mts +60 -0
  25. package/dist/effect/schemas/_internal/logs/tools/retrieve.mjs +74 -0
  26. package/dist/effect/schemas/_internal/logs/triggers/list.d.mts +34 -0
  27. package/dist/effect/schemas/_internal/logs/triggers/list.mjs +12 -0
  28. package/dist/effect/schemas/_internal/logs/triggers/retrieve.d.mts +33 -0
  29. package/dist/effect/schemas/_internal/logs/triggers/retrieve.mjs +9 -0
  30. package/dist/effect/schemas/_internal/org/consumer/list-connected-toolkits.d.mts +8 -0
  31. package/dist/effect/schemas/_internal/org/consumer/list-connected-toolkits.mjs +8 -0
  32. package/dist/effect/schemas/_internal/org/consumer/project/resolve.d.mts +20 -0
  33. package/dist/effect/schemas/_internal/org/consumer/project/resolve.mjs +31 -0
  34. package/dist/effect/schemas/_internal/org/consumer/retrieve-config.d.mts +10 -0
  35. package/dist/effect/schemas/_internal/org/consumer/retrieve-config.mjs +18 -0
  36. package/dist/effect/schemas/api-key-revocation/create.d.mts +8 -0
  37. package/dist/effect/schemas/api-key-revocation/create.mjs +8 -0
  38. package/dist/effect/schemas/auth/session/retrieve-info.d.mts +56 -0
  39. package/dist/effect/schemas/auth/session/retrieve-info.mjs +174 -0
  40. package/dist/effect/schemas/auth-configs/create.d.mts +16 -0
  41. package/dist/effect/schemas/auth-configs/create.mjs +22 -0
  42. package/dist/effect/schemas/auth-configs/delete.d.mts +10 -0
  43. package/dist/effect/schemas/auth-configs/delete.mjs +15 -0
  44. package/dist/effect/schemas/auth-configs/list.d.mts +55 -0
  45. package/dist/effect/schemas/auth-configs/list.mjs +67 -0
  46. package/dist/effect/schemas/auth-configs/retrieve.d.mts +49 -0
  47. package/dist/effect/schemas/auth-configs/retrieve.mjs +61 -0
  48. package/dist/effect/schemas/auth-configs/update-status.d.mts +9 -0
  49. package/dist/effect/schemas/auth-configs/update-status.mjs +11 -0
  50. package/dist/effect/schemas/auth-configs/update.d.mts +9 -0
  51. package/dist/effect/schemas/auth-configs/update.mjs +11 -0
  52. package/dist/effect/schemas/components/auth-config-retrieve-response-expected-input-fields.d.mts +17 -0
  53. package/dist/effect/schemas/components/auth-config-retrieve-response-expected-input-fields.mjs +22 -0
  54. package/dist/effect/schemas/components/auth-config-retrieve-response-tool-access-config.d.mts +9 -0
  55. package/dist/effect/schemas/components/auth-config-retrieve-response-tool-access-config.mjs +20 -0
  56. package/dist/effect/schemas/components/block-reason.d.mts +12 -0
  57. package/dist/effect/schemas/components/block-reason.mjs +14 -0
  58. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option1.d.mts +31 -0
  59. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option1.mjs +33 -0
  60. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option4.d.mts +33 -0
  61. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option4.mjs +35 -0
  62. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option5.d.mts +32 -0
  63. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option5.mjs +34 -0
  64. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1.d.mts +179 -0
  65. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1.mjs +113 -0
  66. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option10.d.mts +168 -0
  67. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option10.mjs +104 -0
  68. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option11.d.mts +140 -0
  69. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option11.mjs +76 -0
  70. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option12.d.mts +162 -0
  71. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option12.mjs +12 -0
  72. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option13.d.mts +202 -0
  73. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option13.mjs +130 -0
  74. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option14.d.mts +193 -0
  75. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option14.mjs +211 -0
  76. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option15.d.mts +176 -0
  77. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option15.mjs +86 -0
  78. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option1.d.mts +33 -0
  79. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option1.mjs +35 -0
  80. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option5.d.mts +35 -0
  81. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option5.mjs +37 -0
  82. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option6.d.mts +34 -0
  83. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option6.mjs +36 -0
  84. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2.d.mts +231 -0
  85. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2.mjs +160 -0
  86. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option2.d.mts +31 -0
  87. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option2.mjs +33 -0
  88. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option6.d.mts +31 -0
  89. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option6.mjs +33 -0
  90. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3.d.mts +171 -0
  91. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3.mjs +108 -0
  92. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option4.d.mts +139 -0
  93. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option4.mjs +74 -0
  94. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option5.d.mts +136 -0
  95. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option5.mjs +72 -0
  96. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option6.d.mts +139 -0
  97. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option6.mjs +98 -0
  98. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7-val.d.mts +159 -0
  99. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7-val.mjs +69 -0
  100. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7.d.mts +162 -0
  101. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7.mjs +12 -0
  102. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option8.d.mts +162 -0
  103. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option8.mjs +12 -0
  104. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option9.d.mts +167 -0
  105. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option9.mjs +101 -0
  106. package/dist/effect/schemas/components/connected-account-retrieve-response-state.d.mts +2443 -0
  107. package/dist/effect/schemas/components/connected-account-retrieve-response-state.mjs +42 -0
  108. package/dist/effect/schemas/components/deprecated-toolkit-info.d.mts +8 -0
  109. package/dist/effect/schemas/components/deprecated-toolkit-info.mjs +12 -0
  110. package/dist/effect/schemas/components/execute-blocked.d.mts +30 -0
  111. package/dist/effect/schemas/components/execute-blocked.mjs +24 -0
  112. package/dist/effect/schemas/components/execute-completed.d.mts +24 -0
  113. package/dist/effect/schemas/components/execute-completed.mjs +29 -0
  114. package/dist/effect/schemas/components/execute-failed.d.mts +24 -0
  115. package/dist/effect/schemas/components/execute-failed.mjs +29 -0
  116. package/dist/effect/schemas/components/execute-requires-user-input.d.mts +15 -0
  117. package/dist/effect/schemas/components/execute-requires-user-input.mjs +16 -0
  118. package/dist/effect/schemas/components/hook-result.d.mts +13 -0
  119. package/dist/effect/schemas/components/hook-result.mjs +15 -0
  120. package/dist/effect/schemas/components/instant-account.d.mts +12 -0
  121. package/dist/effect/schemas/components/instant-account.mjs +15 -0
  122. package/dist/effect/schemas/components/mcp-create-response-commands.d.mts +10 -0
  123. package/dist/effect/schemas/components/mcp-create-response-commands.mjs +24 -0
  124. package/dist/effect/schemas/components/mcp-list-response-items.d.mts +23 -0
  125. package/dist/effect/schemas/components/mcp-list-response-items.mjs +96 -0
  126. package/dist/effect/schemas/components/project-list-response-data.d.mts +21 -0
  127. package/dist/effect/schemas/components/project-list-response-data.mjs +74 -0
  128. package/dist/effect/schemas/components/proxy-execute-blocked.d.mts +24 -0
  129. package/dist/effect/schemas/components/proxy-execute-blocked.mjs +18 -0
  130. package/dist/effect/schemas/components/proxy-execute-completed.d.mts +25 -0
  131. package/dist/effect/schemas/components/proxy-execute-completed.mjs +38 -0
  132. package/dist/effect/schemas/components/session-create-response-config.d.mts +112 -0
  133. package/dist/effect/schemas/components/session-create-response-config.mjs +167 -0
  134. package/dist/effect/schemas/components/session-create-response-experimental-custom-toolkits.d.mts +20 -0
  135. package/dist/effect/schemas/components/session-create-response-experimental-custom-toolkits.mjs +25 -0
  136. package/dist/effect/schemas/components/session-create-response-warnings.d.mts +9 -0
  137. package/dist/effect/schemas/components/session-create-response-warnings.mjs +25 -0
  138. package/dist/effect/schemas/components/session-link-response-experimental.d.mts +13 -0
  139. package/dist/effect/schemas/components/session-link-response-experimental.mjs +18 -0
  140. package/dist/effect/schemas/components/session-retrieve-response-experimental.d.mts +37 -0
  141. package/dist/effect/schemas/components/session-retrieve-response-experimental.mjs +27 -0
  142. package/dist/effect/schemas/components/tool-details.d.mts +51 -0
  143. package/dist/effect/schemas/components/tool-details.mjs +144 -0
  144. package/dist/effect/schemas/components/tool-pricing.d.mts +9 -0
  145. package/dist/effect/schemas/components/tool-pricing.mjs +14 -0
  146. package/dist/effect/schemas/components/tool-router-session-v31-config-history-list-response.d.mts +123 -0
  147. package/dist/effect/schemas/components/tool-router-session-v31-config-history-list-response.mjs +178 -0
  148. package/dist/effect/schemas/components/tool-router-toolkits-list-response.d.mts +34 -0
  149. package/dist/effect/schemas/components/tool-router-toolkits-list-response.mjs +45 -0
  150. package/dist/effect/schemas/components/tool.d.mts +51 -0
  151. package/dist/effect/schemas/components/tool.mjs +144 -0
  152. package/dist/effect/schemas/components/toolkit-list-response-items.d.mts +36 -0
  153. package/dist/effect/schemas/components/toolkit-list-response-items.mjs +101 -0
  154. package/dist/effect/schemas/components/tools-paginated.d.mts +57 -0
  155. package/dist/effect/schemas/components/tools-paginated.mjs +15 -0
  156. package/dist/effect/schemas/components/trigger-retrieve-response-log.d.mts +31 -0
  157. package/dist/effect/schemas/components/trigger-retrieve-response-log.mjs +39 -0
  158. package/dist/effect/schemas/components/user-input-request.d.mts +11 -0
  159. package/dist/effect/schemas/components/user-input-request.mjs +19 -0
  160. package/dist/effect/schemas/connected-accounts/complete-auth.d.mts +9 -0
  161. package/dist/effect/schemas/connected-accounts/complete-auth.mjs +11 -0
  162. package/dist/effect/schemas/connected-accounts/create.d.mts +2457 -0
  163. package/dist/effect/schemas/connected-accounts/create.mjs +58 -0
  164. package/dist/effect/schemas/connected-accounts/delete.d.mts +9 -0
  165. package/dist/effect/schemas/connected-accounts/delete.mjs +17 -0
  166. package/dist/effect/schemas/connected-accounts/list.d.mts +2480 -0
  167. package/dist/effect/schemas/connected-accounts/list.mjs +84 -0
  168. package/dist/effect/schemas/connected-accounts/patch.d.mts +10 -0
  169. package/dist/effect/schemas/connected-accounts/patch.mjs +19 -0
  170. package/dist/effect/schemas/connected-accounts/refresh.d.mts +10 -0
  171. package/dist/effect/schemas/connected-accounts/refresh.mjs +27 -0
  172. package/dist/effect/schemas/connected-accounts/retrieve.d.mts +2477 -0
  173. package/dist/effect/schemas/connected-accounts/retrieve.mjs +81 -0
  174. package/dist/effect/schemas/connected-accounts/revoke.d.mts +12 -0
  175. package/dist/effect/schemas/connected-accounts/revoke.mjs +35 -0
  176. package/dist/effect/schemas/connected-accounts/update-status.d.mts +8 -0
  177. package/dist/effect/schemas/connected-accounts/update-status.mjs +11 -0
  178. package/dist/effect/schemas/custom/delete-toolkit.d.mts +12 -0
  179. package/dist/effect/schemas/custom/delete-toolkit.mjs +17 -0
  180. package/dist/effect/schemas/custom/sync.d.mts +10 -0
  181. package/dist/effect/schemas/custom/sync.mjs +21 -0
  182. package/dist/effect/schemas/custom/upsert.d.mts +8 -0
  183. package/dist/effect/schemas/custom/upsert.mjs +11 -0
  184. package/dist/effect/schemas/files/create-presigned-url.d.mts +15 -0
  185. package/dist/effect/schemas/files/create-presigned-url.mjs +15 -0
  186. package/dist/effect/schemas/files/list.d.mts +18 -0
  187. package/dist/effect/schemas/files/list.mjs +20 -0
  188. package/dist/effect/schemas/keyring/list-transfer-keys.d.mts +17 -0
  189. package/dist/effect/schemas/keyring/list-transfer-keys.mjs +19 -0
  190. package/dist/effect/schemas/link/create.d.mts +19 -0
  191. package/dist/effect/schemas/link/create.mjs +18 -0
  192. package/dist/effect/schemas/logs/create-tool-execution.d.mts +25 -0
  193. package/dist/effect/schemas/logs/create-tool-execution.mjs +39 -0
  194. package/dist/effect/schemas/logs/retrieve-tool-execution.d.mts +37 -0
  195. package/dist/effect/schemas/logs/retrieve-tool-execution.mjs +51 -0
  196. package/dist/effect/schemas/mcp/create-instance.d.mts +12 -0
  197. package/dist/effect/schemas/mcp/create-instance.mjs +29 -0
  198. package/dist/effect/schemas/mcp/create.d.mts +23 -0
  199. package/dist/effect/schemas/mcp/create.mjs +67 -0
  200. package/dist/effect/schemas/mcp/custom/create.d.mts +17 -0
  201. package/dist/effect/schemas/mcp/custom/create.mjs +48 -0
  202. package/dist/effect/schemas/mcp/delete-instance.d.mts +9 -0
  203. package/dist/effect/schemas/mcp/delete-instance.mjs +11 -0
  204. package/dist/effect/schemas/mcp/delete.d.mts +9 -0
  205. package/dist/effect/schemas/mcp/delete.mjs +17 -0
  206. package/dist/effect/schemas/mcp/generate/url.d.mts +10 -0
  207. package/dist/effect/schemas/mcp/generate/url.mjs +21 -0
  208. package/dist/effect/schemas/mcp/list-instances.d.mts +18 -0
  209. package/dist/effect/schemas/mcp/list-instances.mjs +56 -0
  210. package/dist/effect/schemas/mcp/list.d.mts +27 -0
  211. package/dist/effect/schemas/mcp/list.mjs +19 -0
  212. package/dist/effect/schemas/mcp/retrieve-app.d.mts +27 -0
  213. package/dist/effect/schemas/mcp/retrieve-app.mjs +19 -0
  214. package/dist/effect/schemas/mcp/retrieve.d.mts +24 -0
  215. package/dist/effect/schemas/mcp/retrieve.mjs +68 -0
  216. package/dist/effect/schemas/mcp/update.d.mts +24 -0
  217. package/dist/effect/schemas/mcp/update.mjs +68 -0
  218. package/dist/effect/schemas/org/list.d.mts +17 -0
  219. package/dist/effect/schemas/org/list.mjs +22 -0
  220. package/dist/effect/schemas/org/owner/project/create.d.mts +10 -0
  221. package/dist/effect/schemas/org/owner/project/create.mjs +22 -0
  222. package/dist/effect/schemas/org/owner/project/delete.d.mts +9 -0
  223. package/dist/effect/schemas/org/owner/project/delete.mjs +17 -0
  224. package/dist/effect/schemas/org/owner/project/list.d.mts +27 -0
  225. package/dist/effect/schemas/org/owner/project/list.mjs +15 -0
  226. package/dist/effect/schemas/org/owner/project/regenerate-api-key.d.mts +14 -0
  227. package/dist/effect/schemas/org/owner/project/regenerate-api-key.mjs +31 -0
  228. package/dist/effect/schemas/org/owner/project/retrieve.d.mts +27 -0
  229. package/dist/effect/schemas/org/owner/project/retrieve.mjs +93 -0
  230. package/dist/effect/schemas/org/project/list.d.mts +27 -0
  231. package/dist/effect/schemas/org/project/list.mjs +15 -0
  232. package/dist/effect/schemas/org/usage/retrieve-summary.d.mts +13 -0
  233. package/dist/effect/schemas/org/usage/retrieve-summary.mjs +15 -0
  234. package/dist/effect/schemas/org/usage/retrieve.d.mts +16 -0
  235. package/dist/effect/schemas/org/usage/retrieve.mjs +18 -0
  236. package/dist/effect/schemas/project/usage/retrieve-summary.d.mts +13 -0
  237. package/dist/effect/schemas/project/usage/retrieve-summary.mjs +15 -0
  238. package/dist/effect/schemas/project/usage/retrieve.d.mts +16 -0
  239. package/dist/effect/schemas/project/usage/retrieve.mjs +18 -0
  240. package/dist/effect/schemas/session-configs/list.d.mts +15 -0
  241. package/dist/effect/schemas/session-configs/list.mjs +26 -0
  242. package/dist/effect/schemas/session-configs/retrieve.d.mts +45 -0
  243. package/dist/effect/schemas/session-configs/retrieve.mjs +103 -0
  244. package/dist/effect/schemas/tool-router/session/attach.d.mts +157 -0
  245. package/dist/effect/schemas/tool-router/session/attach.mjs +30 -0
  246. package/dist/effect/schemas/tool-router/session/config-history.d.mts +122 -0
  247. package/dist/effect/schemas/tool-router/session/config-history.mjs +8 -0
  248. package/dist/effect/schemas/tool-router/session/create.d.mts +157 -0
  249. package/dist/effect/schemas/tool-router/session/create.mjs +45 -0
  250. package/dist/effect/schemas/tool-router/session/delete.d.mts +9 -0
  251. package/dist/effect/schemas/tool-router/session/delete.mjs +18 -0
  252. package/dist/effect/schemas/tool-router/session/execute-meta.d.mts +75 -0
  253. package/dist/effect/schemas/tool-router/session/execute-meta.mjs +17 -0
  254. package/dist/effect/schemas/tool-router/session/execute.d.mts +75 -0
  255. package/dist/effect/schemas/tool-router/session/execute.mjs +17 -0
  256. package/dist/effect/schemas/tool-router/session/files/create-download-url.d.mts +11 -0
  257. package/dist/effect/schemas/tool-router/session/files/create-download-url.mjs +13 -0
  258. package/dist/effect/schemas/tool-router/session/files/create-upload-url.d.mts +11 -0
  259. package/dist/effect/schemas/tool-router/session/files/create-upload-url.mjs +13 -0
  260. package/dist/effect/schemas/tool-router/session/files/delete.d.mts +9 -0
  261. package/dist/effect/schemas/tool-router/session/files/delete.mjs +11 -0
  262. package/dist/effect/schemas/tool-router/session/files/list.d.mts +14 -0
  263. package/dist/effect/schemas/tool-router/session/files/list.mjs +16 -0
  264. package/dist/effect/schemas/tool-router/session/link.d.mts +18 -0
  265. package/dist/effect/schemas/tool-router/session/link.mjs +25 -0
  266. package/dist/effect/schemas/tool-router/session/patch.d.mts +157 -0
  267. package/dist/effect/schemas/tool-router/session/patch.mjs +30 -0
  268. package/dist/effect/schemas/tool-router/session/proxy-execute.d.mts +52 -0
  269. package/dist/effect/schemas/tool-router/session/proxy-execute.mjs +15 -0
  270. package/dist/effect/schemas/tool-router/session/retrieve.d.mts +157 -0
  271. package/dist/effect/schemas/tool-router/session/retrieve.mjs +30 -0
  272. package/dist/effect/schemas/tool-router/session/search.d.mts +80 -0
  273. package/dist/effect/schemas/tool-router/session/search.mjs +78 -0
  274. package/dist/effect/schemas/tool-router/session/toolkits.d.mts +33 -0
  275. package/dist/effect/schemas/tool-router/session/toolkits.mjs +8 -0
  276. package/dist/effect/schemas/tool-router/session/tools.d.mts +56 -0
  277. package/dist/effect/schemas/tool-router/session/tools.mjs +8 -0
  278. package/dist/effect/schemas/toolkits/list.d.mts +42 -0
  279. package/dist/effect/schemas/toolkits/list.mjs +15 -0
  280. package/dist/effect/schemas/toolkits/recommend-scopes.d.mts +19 -0
  281. package/dist/effect/schemas/toolkits/recommend-scopes.mjs +21 -0
  282. package/dist/effect/schemas/toolkits/retrieve-categories.d.mts +15 -0
  283. package/dist/effect/schemas/toolkits/retrieve-categories.mjs +23 -0
  284. package/dist/effect/schemas/toolkits/retrieve-changelog.d.mts +16 -0
  285. package/dist/effect/schemas/toolkits/retrieve-changelog.mjs +16 -0
  286. package/dist/effect/schemas/toolkits/retrieve-multi.d.mts +42 -0
  287. package/dist/effect/schemas/toolkits/retrieve-multi.mjs +15 -0
  288. package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.d.mts +15 -0
  289. package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.mjs +17 -0
  290. package/dist/effect/schemas/toolkits/retrieve.d.mts +110 -0
  291. package/dist/effect/schemas/toolkits/retrieve.mjs +202 -0
  292. package/dist/effect/schemas/tools/execute.d.mts +12 -0
  293. package/dist/effect/schemas/tools/execute.mjs +35 -0
  294. package/dist/effect/schemas/tools/get-input.d.mts +9 -0
  295. package/dist/effect/schemas/tools/get-input.mjs +22 -0
  296. package/dist/effect/schemas/tools/list.d.mts +56 -0
  297. package/dist/effect/schemas/tools/list.mjs +8 -0
  298. package/dist/effect/schemas/tools/proxy.d.mts +16 -0
  299. package/dist/effect/schemas/tools/proxy.mjs +36 -0
  300. package/dist/effect/schemas/tools/retrieve-enum.d.mts +6 -0
  301. package/dist/effect/schemas/tools/retrieve-enum.mjs +8 -0
  302. package/dist/effect/schemas/tools/retrieve-required-scopes.d.mts +22 -0
  303. package/dist/effect/schemas/tools/retrieve-required-scopes.mjs +33 -0
  304. package/dist/effect/schemas/tools/retrieve.d.mts +50 -0
  305. package/dist/effect/schemas/tools/retrieve.mjs +8 -0
  306. package/dist/effect/schemas/trigger-instances/list-active.d.mts +37 -0
  307. package/dist/effect/schemas/trigger-instances/list-active.mjs +49 -0
  308. package/dist/effect/schemas/trigger-instances/manage/delete.d.mts +8 -0
  309. package/dist/effect/schemas/trigger-instances/manage/delete.mjs +11 -0
  310. package/dist/effect/schemas/trigger-instances/manage/update.d.mts +8 -0
  311. package/dist/effect/schemas/trigger-instances/manage/update.mjs +8 -0
  312. package/dist/effect/schemas/trigger-instances/upsert.d.mts +11 -0
  313. package/dist/effect/schemas/trigger-instances/upsert.mjs +22 -0
  314. package/dist/effect/schemas/triggers-types/list.d.mts +28 -0
  315. package/dist/effect/schemas/triggers-types/list.mjs +90 -0
  316. package/dist/effect/schemas/triggers-types/retrieve-enum.d.mts +6 -0
  317. package/dist/effect/schemas/triggers-types/retrieve-enum.mjs +8 -0
  318. package/dist/effect/schemas/triggers-types/retrieve.d.mts +22 -0
  319. package/dist/effect/schemas/triggers-types/retrieve.mjs +84 -0
  320. package/dist/effect/schemas/webhook-endpoints/create.d.mts +13 -0
  321. package/dist/effect/schemas/webhook-endpoints/create.mjs +15 -0
  322. package/dist/effect/schemas/webhook-endpoints/list.d.mts +12 -0
  323. package/dist/effect/schemas/webhook-endpoints/list.mjs +12 -0
  324. package/dist/effect/schemas/webhook-endpoints/replace.d.mts +13 -0
  325. package/dist/effect/schemas/webhook-endpoints/replace.mjs +15 -0
  326. package/dist/effect/schemas/webhook-endpoints/retrieve.d.mts +13 -0
  327. package/dist/effect/schemas/webhook-endpoints/retrieve.mjs +15 -0
  328. package/dist/effect/schemas/webhook-endpoints/update.d.mts +13 -0
  329. package/dist/effect/schemas/webhook-endpoints/update.mjs +15 -0
  330. package/dist/effect/schemas/webhook-subscriptions/create.d.mts +14 -0
  331. package/dist/effect/schemas/webhook-subscriptions/create.mjs +23 -0
  332. package/dist/effect/schemas/webhook-subscriptions/delete.d.mts +8 -0
  333. package/dist/effect/schemas/webhook-subscriptions/delete.mjs +8 -0
  334. package/dist/effect/schemas/webhook-subscriptions/list-event-types.d.mts +12 -0
  335. package/dist/effect/schemas/webhook-subscriptions/list-event-types.mjs +16 -0
  336. package/dist/effect/schemas/webhook-subscriptions/list.d.mts +20 -0
  337. package/dist/effect/schemas/webhook-subscriptions/list.mjs +29 -0
  338. package/dist/effect/schemas/webhook-subscriptions/retrieve.d.mts +14 -0
  339. package/dist/effect/schemas/webhook-subscriptions/retrieve.mjs +23 -0
  340. package/dist/effect/schemas/webhook-subscriptions/rotate-secret.d.mts +9 -0
  341. package/dist/effect/schemas/webhook-subscriptions/rotate-secret.mjs +14 -0
  342. package/dist/effect/schemas/webhook-subscriptions/update.d.mts +14 -0
  343. package/dist/effect/schemas/webhook-subscriptions/update.mjs +23 -0
  344. package/dist/effect/schemas.d.mts +9922 -0
  345. package/dist/effect/schemas.mjs +132 -0
  346. package/dist/effect.d.mts +505 -0
  347. package/dist/effect.mjs +1632 -0
  348. package/dist/environments-BFGXNbF0.mjs +230 -0
  349. package/dist/environments-cVbMu7FC.d.mts +19 -0
  350. package/dist/{error-DLB1uKM3.mjs → error-Bw7_G2NZ.mjs} +16 -8
  351. package/dist/{generated-operations-DVRtlxnl.mjs → generated-operations-DXMQK5w5.mjs} +642 -243
  352. package/dist/index.d.mts +3 -5
  353. package/dist/index.mjs +132 -429
  354. package/dist/internal.d.mts +9 -0
  355. package/dist/internal.mjs +1 -0
  356. package/dist/pagination-rules-CMnBwktJ.mjs +36 -0
  357. package/dist/pagination.mjs +5 -9
  358. package/dist/resources/_internal/_internal.d.mts +2 -0
  359. package/dist/resources/_internal/_internal.mjs +16 -0
  360. package/dist/resources/_internal/cli/cli.d.mts +2 -0
  361. package/dist/resources/_internal/cli/cli.mjs +33 -0
  362. package/dist/resources/_internal/cli/realtime.d.mts +2 -0
  363. package/dist/resources/_internal/cli/realtime.mjs +20 -0
  364. package/dist/resources/_internal/cli.d.mts +2 -0
  365. package/dist/resources/_internal/cli.mjs +1 -0
  366. package/dist/resources/_internal/consumer/consumer.d.mts +2 -0
  367. package/dist/resources/_internal/consumer/consumer.mjs +8 -0
  368. package/dist/resources/_internal/consumer/permissions.d.mts +2 -0
  369. package/dist/resources/_internal/consumer/permissions.mjs +14 -0
  370. package/dist/resources/_internal/consumer.d.mts +2 -0
  371. package/dist/resources/_internal/consumer.mjs +1 -0
  372. package/dist/resources/_internal/logs/logs.d.mts +2 -0
  373. package/dist/resources/_internal/logs/logs.mjs +12 -0
  374. package/dist/resources/_internal/logs/tools.d.mts +2 -0
  375. package/dist/resources/_internal/logs/tools.mjs +24 -0
  376. package/dist/resources/_internal/logs/triggers.d.mts +2 -0
  377. package/dist/resources/_internal/logs/triggers.mjs +20 -0
  378. package/dist/resources/_internal/logs.d.mts +2 -0
  379. package/dist/resources/_internal/logs.mjs +1 -0
  380. package/dist/resources/_internal/org/consumer/consumer.d.mts +2 -0
  381. package/dist/resources/_internal/org/consumer/consumer.mjs +26 -0
  382. package/dist/resources/_internal/org/consumer/project.d.mts +2 -0
  383. package/dist/resources/_internal/org/consumer/project.mjs +15 -0
  384. package/dist/resources/_internal/org/consumer.d.mts +2 -0
  385. package/dist/resources/_internal/org/consumer.mjs +1 -0
  386. package/dist/resources/_internal/org/org.d.mts +2 -0
  387. package/dist/resources/_internal/org/org.mjs +8 -0
  388. package/dist/resources/_internal/org.d.mts +2 -0
  389. package/dist/resources/_internal/org.mjs +1 -0
  390. package/dist/resources/_internal.d.mts +2 -0
  391. package/dist/resources/_internal.mjs +1 -0
  392. package/dist/resources/api-key-revocation.d.mts +2 -2
  393. package/dist/resources/api-key-revocation.mjs +13 -2
  394. package/dist/resources/auth/auth.d.mts +2 -2
  395. package/dist/resources/auth/auth.mjs +7 -2
  396. package/dist/resources/auth/session.d.mts +2 -2
  397. package/dist/resources/auth/session.mjs +10 -2
  398. package/dist/resources/auth-configs.d.mts +2 -2
  399. package/dist/resources/auth-configs.mjs +45 -2
  400. package/dist/resources/auth.d.mts +2 -2
  401. package/dist/resources/auth.mjs +1 -5
  402. package/dist/resources/connected-accounts.d.mts +2 -2
  403. package/dist/resources/connected-accounts.mjs +70 -2
  404. package/dist/resources/custom.d.mts +2 -2
  405. package/dist/resources/custom.mjs +29 -2
  406. package/dist/resources/files.d.mts +2 -2
  407. package/dist/resources/files.mjs +22 -2
  408. package/dist/resources/keyring.d.mts +2 -2
  409. package/dist/resources/keyring.mjs +10 -2
  410. package/dist/resources/link.d.mts +2 -2
  411. package/dist/resources/link.mjs +13 -2
  412. package/dist/resources/logs/logs.d.mts +2 -2
  413. package/dist/resources/logs/logs.mjs +19 -2
  414. package/dist/resources/logs.d.mts +2 -2
  415. package/dist/resources/logs.mjs +1 -6
  416. package/dist/resources/mcp/custom.d.mts +2 -2
  417. package/dist/resources/mcp/custom.mjs +13 -2
  418. package/dist/resources/mcp/generate.d.mts +2 -2
  419. package/dist/resources/mcp/generate.mjs +13 -2
  420. package/dist/resources/mcp/mcp.d.mts +2 -2
  421. package/dist/resources/mcp/mcp.mjs +67 -2
  422. package/dist/resources/mcp.d.mts +2 -2
  423. package/dist/resources/mcp.mjs +1 -6
  424. package/dist/resources/org/org.d.mts +2 -2
  425. package/dist/resources/org/org.mjs +21 -2
  426. package/dist/resources/org/owner/owner.d.mts +2 -2
  427. package/dist/resources/org/owner/owner.mjs +7 -2
  428. package/dist/resources/org/owner/project.d.mts +2 -2
  429. package/dist/resources/org/owner/project.mjs +37 -2
  430. package/dist/resources/org/owner.d.mts +2 -2
  431. package/dist/resources/org/owner.mjs +1 -5
  432. package/dist/resources/org/project.d.mts +2 -2
  433. package/dist/resources/org/project.mjs +13 -2
  434. package/dist/resources/org/usage.d.mts +2 -2
  435. package/dist/resources/org/usage.mjs +22 -2
  436. package/dist/resources/org.d.mts +2 -2
  437. package/dist/resources/org.mjs +1 -9
  438. package/dist/resources/project/project.d.mts +2 -2
  439. package/dist/resources/project/project.mjs +7 -2
  440. package/dist/resources/project/usage.d.mts +2 -2
  441. package/dist/resources/project/usage.mjs +22 -2
  442. package/dist/resources/project.d.mts +2 -3
  443. package/dist/resources/project.mjs +1 -5
  444. package/dist/resources/session-configs.d.mts +2 -2
  445. package/dist/resources/session-configs.mjs +8 -12
  446. package/dist/resources/tool-router/session/files.d.mts +2 -2
  447. package/dist/resources/tool-router/session/files.mjs +40 -2
  448. package/dist/resources/tool-router/session/session.d.mts +2 -2
  449. package/dist/resources/tool-router/session/session.mjs +95 -2
  450. package/dist/resources/tool-router/session.d.mts +2 -2
  451. package/dist/resources/tool-router/session.mjs +1 -5
  452. package/dist/resources/tool-router/tool-router.d.mts +2 -2
  453. package/dist/resources/tool-router/tool-router.mjs +7 -2
  454. package/dist/resources/tool-router.d.mts +2 -2
  455. package/dist/resources/tool-router.mjs +1 -5
  456. package/dist/resources/toolkits.d.mts +2 -2
  457. package/dist/resources/toolkits.mjs +51 -2
  458. package/dist/resources/tools.d.mts +2 -2
  459. package/dist/resources/tools.mjs +56 -2
  460. package/dist/resources/trigger-instances/manage.d.mts +2 -2
  461. package/dist/resources/trigger-instances/manage.mjs +19 -2
  462. package/dist/resources/trigger-instances/trigger-instances.d.mts +2 -2
  463. package/dist/resources/trigger-instances/trigger-instances.mjs +24 -2
  464. package/dist/resources/trigger-instances.d.mts +2 -2
  465. package/dist/resources/trigger-instances.mjs +1 -5
  466. package/dist/resources/triggers-types.d.mts +2 -2
  467. package/dist/resources/triggers-types.mjs +26 -2
  468. package/dist/resources/webhook-endpoints.d.mts +2 -2
  469. package/dist/resources/webhook-endpoints.mjs +40 -2
  470. package/dist/resources/webhook-subscriptions.d.mts +2 -2
  471. package/dist/resources/webhook-subscriptions.mjs +45 -2
  472. package/package.json +42 -34
  473. package/dist/api-key-revocation--5qqPnDz.mjs +0 -25
  474. package/dist/auth-_btgyN8t.mjs +0 -17
  475. package/dist/auth-configs-lkRDnT-a.mjs +0 -54
  476. package/dist/clanker-DBfYfkSH.mjs +0 -24
  477. package/dist/cli-Ckmt28-b.mjs +0 -45
  478. package/dist/config-BLBbhLe1.mjs +0 -10
  479. package/dist/config-DnyMhILW.d.mts +0 -9
  480. package/dist/connected-accounts-BJ5Ms_qb.mjs +0 -82
  481. package/dist/consumer--h4l55c3.mjs +0 -34
  482. package/dist/custom-CA8Amqss.mjs +0 -24
  483. package/dist/custom-CFKQnTel.mjs +0 -31
  484. package/dist/files-BP4vVrwo.mjs +0 -49
  485. package/dist/files-DG9Gc9CB.mjs +0 -31
  486. package/dist/generate-CGElZfOL.mjs +0 -24
  487. package/dist/keyring-DaSYpy6j.mjs +0 -17
  488. package/dist/link-DUiP6kjL.mjs +0 -23
  489. package/dist/logs-e4Kf3pcP.mjs +0 -38
  490. package/dist/manage-DTaRdqWV.mjs +0 -28
  491. package/dist/mcp-DxX8J9j8.mjs +0 -91
  492. package/dist/migration-CBhnoN-Y.mjs +0 -10
  493. package/dist/migration-CKGKuRO3.d.mts +0 -9
  494. package/dist/org-BIGutZCA.mjs +0 -45
  495. package/dist/owner-YrMH9R90.mjs +0 -17
  496. package/dist/project-B59Fh0L9.mjs +0 -47
  497. package/dist/project-D2NT5pmv.mjs +0 -29
  498. package/dist/project-DGE_op-j.mjs +0 -22
  499. package/dist/project-DWBDOy0X.mjs +0 -25
  500. package/dist/realtime-BFjIp94B.mjs +0 -28
  501. package/dist/resources/auth/index.d.mts +0 -2
  502. package/dist/resources/auth/index.mjs +0 -4
  503. package/dist/resources/cli/cli.d.mts +0 -2
  504. package/dist/resources/cli/cli.mjs +0 -3
  505. package/dist/resources/cli/index.d.mts +0 -2
  506. package/dist/resources/cli/index.mjs +0 -4
  507. package/dist/resources/cli/realtime.d.mts +0 -2
  508. package/dist/resources/cli/realtime.mjs +0 -3
  509. package/dist/resources/cli.d.mts +0 -2
  510. package/dist/resources/cli.mjs +0 -5
  511. package/dist/resources/index.d.mts +0 -3
  512. package/dist/resources/index.mjs +0 -16
  513. package/dist/resources/logs/index.d.mts +0 -2
  514. package/dist/resources/logs/index.mjs +0 -5
  515. package/dist/resources/logs/tools.d.mts +0 -2
  516. package/dist/resources/logs/tools.mjs +0 -3
  517. package/dist/resources/logs/triggers.d.mts +0 -2
  518. package/dist/resources/logs/triggers.mjs +0 -3
  519. package/dist/resources/mcp/index.d.mts +0 -2
  520. package/dist/resources/mcp/index.mjs +0 -5
  521. package/dist/resources/migration.d.mts +0 -2
  522. package/dist/resources/migration.mjs +0 -3
  523. package/dist/resources/org/clanker.d.mts +0 -2
  524. package/dist/resources/org/clanker.mjs +0 -3
  525. package/dist/resources/org/consumer/consumer.d.mts +0 -2
  526. package/dist/resources/org/consumer/consumer.mjs +0 -3
  527. package/dist/resources/org/consumer/index.d.mts +0 -2
  528. package/dist/resources/org/consumer/index.mjs +0 -4
  529. package/dist/resources/org/consumer/project.d.mts +0 -2
  530. package/dist/resources/org/consumer/project.mjs +0 -3
  531. package/dist/resources/org/consumer.d.mts +0 -2
  532. package/dist/resources/org/consumer.mjs +0 -5
  533. package/dist/resources/org/index.d.mts +0 -2
  534. package/dist/resources/org/index.mjs +0 -8
  535. package/dist/resources/org/owner/index.d.mts +0 -2
  536. package/dist/resources/org/owner/index.mjs +0 -4
  537. package/dist/resources/project/config.d.mts +0 -2
  538. package/dist/resources/project/config.mjs +0 -3
  539. package/dist/resources/project/index.d.mts +0 -3
  540. package/dist/resources/project/index.mjs +0 -4
  541. package/dist/resources/tool-router/index.d.mts +0 -2
  542. package/dist/resources/tool-router/index.mjs +0 -4
  543. package/dist/resources/tool-router/session/index.d.mts +0 -2
  544. package/dist/resources/tool-router/session/index.mjs +0 -4
  545. package/dist/resources/trigger-instances/index.d.mts +0 -2
  546. package/dist/resources/trigger-instances/index.mjs +0 -4
  547. package/dist/session-B9FZU6oA.mjs +0 -22
  548. package/dist/session-DtXQM3G3.mjs +0 -110
  549. package/dist/tool-router-CTH_fcxP.mjs +0 -14
  550. package/dist/toolkits-CxXj47JG.mjs +0 -62
  551. package/dist/tools-B9zq-uPU.mjs +0 -68
  552. package/dist/tools-BpRusMHS.mjs +0 -33
  553. package/dist/trigger-instances-DSk1vemj.mjs +0 -35
  554. package/dist/triggers-DRn4adsh.mjs +0 -28
  555. package/dist/triggers-types-Cgh-mvOz.mjs +0 -34
  556. package/dist/usage-B6pidrAI.mjs +0 -31
  557. package/dist/usage-B8p0O_pg.mjs +0 -31
  558. package/dist/webhook-endpoints-D4uTri1P.mjs +0 -51
  559. package/dist/webhook-subscriptions-DYxSYlZP.mjs +0 -55
@@ -1,74 +1,5 @@
1
- import { i as APIUserAbortError, n as APIConnectionTimeoutError, s as ComposioError, t as APIConnectionError } from "./error-DLB1uKM3.mjs";
1
+ import { i as APIUserAbortError, n as APIConnectionTimeoutError, s as ComposioError, t as APIConnectionError } from "./error-Bw7_G2NZ.mjs";
2
2
 
3
- //#region src/compat/headers.ts
4
- const hasEntries = (value) => typeof value === "object" && value !== null && "append" in value && typeof value.append === "function" && "delete" in value && typeof value.delete === "function" && "entries" in value && typeof value.entries === "function" && "get" in value && typeof value.get === "function";
5
- const isHeaders = (value) => value instanceof Headers || hasEntries(value);
6
- const isNullableHeadersLike = (headers) => {
7
- if (!("values" in headers) || !isHeaders(headers.values) || !("nulls" in headers)) return false;
8
- const nulls = headers.nulls;
9
- return typeof nulls === "object" && nulls !== null && Symbol.iterator in nulls;
10
- };
11
- /**
12
- * Iterates every supported input while preserving explicit deletions. Plain
13
- * objects replace an older value for a key; tuple inputs append duplicate
14
- * values, matching the published client.
15
- */
16
- function* iterateHeaders(headers) {
17
- if (!headers) return;
18
- if (isNullableHeadersLike(headers)) {
19
- yield* headers.values.entries();
20
- for (const name of headers.nulls) yield [name, null];
21
- return;
22
- }
23
- const shouldReplace = !isHeaders(headers) && !Array.isArray(headers);
24
- const entries = isHeaders(headers) ? headers.entries() : Array.isArray(headers) ? headers : Object.entries(headers);
25
- for (const entry of entries) {
26
- const name = entry[0];
27
- if (typeof name !== "string") throw new TypeError("expected header name to be a string");
28
- const rawValue = entry[1];
29
- const values = Array.isArray(rawValue) ? rawValue : [rawValue];
30
- let replaced = false;
31
- for (const value of values) {
32
- if (value === void 0) continue;
33
- if (shouldReplace && !replaced) {
34
- replaced = true;
35
- yield [name, null];
36
- }
37
- yield [name, value];
38
- }
39
- }
40
- }
41
- /** Merge sources while retaining names explicitly deleted by the last source. */
42
- const mergeHeaders = (sources) => {
43
- const values = new Headers();
44
- const nulls = /* @__PURE__ */ new Set();
45
- for (const source of sources) {
46
- if (!source) continue;
47
- const seen = /* @__PURE__ */ new Set();
48
- for (const [name, value] of iterateHeaders(source)) {
49
- const lowerName = name.toLowerCase();
50
- if (!seen.has(lowerName)) {
51
- values.delete(name);
52
- seen.add(lowerName);
53
- }
54
- if (value === null) {
55
- values.delete(name);
56
- nulls.add(lowerName);
57
- } else {
58
- values.append(name, value);
59
- nulls.delete(lowerName);
60
- }
61
- }
62
- }
63
- return {
64
- values,
65
- nulls
66
- };
67
- };
68
- /** Merge sources into the native header collection sent to fetch. */
69
- const buildHeaders = (sources) => mergeHeaders(sources).values;
70
-
71
- //#endregion
72
3
  //#region src/compat/credentials.ts
73
4
  /**
74
5
  * The credential transport boundary.
@@ -83,15 +14,15 @@ const buildHeaders = (sources) => mergeHeaders(sources).values;
83
14
  * measured property of the API (two credential headers on one request is a
84
15
  * 401, even where either alone is a 200), so the four rules below are all
85
16
  * stated about *the* credential a request carries, and {@link selectScheme}
86
- * decides which one that is. See wayfinder ticket 48 and §4 of
17
+ * decides which one that is. See §4 of
87
18
  * `docs/research/drop-in-contract.md`.
88
19
  * 1. **A credentialed API origin must use HTTPS.** Plain `http:` is permitted
89
20
  * only for loopback development endpoints, or for the exact origin a
90
21
  * caller opts into with `allowInsecureHTTP` or
91
22
  * `COMPOSIO_ALLOW_INSECURE_HTTP=1`.
92
23
  * Enforced by {@link assertCredentialTransport} at construction and again
93
- * by {@link credentialForRequest} at dispatch, because `apiKey` and
94
- * `baseURL` are both public mutable fields on the client.
24
+ * by {@link credentialForRequest} at dispatch, because `baseURL` is a
25
+ * public mutable field on the client.
95
26
  * 2. **The credential is attached only to requests whose origin matches the
96
27
  * configured API origin.** {@link credentialForRequest} returns `null`
97
28
  * off-origin, and the header is simply not sent.
@@ -137,7 +68,7 @@ const buildHeaders = (sources) => mergeHeaders(sources).values;
137
68
  * Deliberate, and sanctioned by the design record: the published Stainless
138
69
  * client enforces none of this. Redirect *following* is no longer part of the
139
70
  * divergence — both clients follow — but what rides along on the hop is. See
140
- * §4 of `docs/research/drop-in-contract.md` and wayfinder ticket 40.
71
+ * §4 of `docs/research/drop-in-contract.md`.
141
72
  */
142
73
  /**
143
74
  * The three credential classes this API accepts, and the header each one puts
@@ -154,70 +85,25 @@ const SCHEME_HEADERS = {
154
85
  };
155
86
  /** The scheme a request authenticates with when its operation names none. */
156
87
  const DEFAULT_SCHEME = "ApiKeyAuth";
157
- const valueFor = (scheme, credentials) => scheme === "ApiKeyAuth" ? credentials.apiKey : scheme === "UserApiKeyAuth" ? credentials.userApiKey : credentials.orgApiKey;
158
88
  /**
159
- * Whether anything beyond the project key is configured — the condition that
160
- * makes per-operation selection able to change an outcome at all.
161
- *
162
- * Load-bearing rather than an optimization. With only `apiKey` set, every
163
- * branch of {@link selectScheme} lands on `ApiKeyAuth`: it wins wherever it is
164
- * an accepted alternative, and where it is not, the alternative is unconfigured
165
- * and the fallback is `ApiKeyAuth` again. So the client that every existing
166
- * caller constructs never consults the operation table, and "an `apiKey`-only
167
- * client emits byte-identical requests on all 104 operations" is a property of
168
- * the code shape rather than a claim tests have to keep re-establishing.
169
- */
170
- const hasAlternateCredential = (credentials) => credentials.userApiKey !== null || credentials.orgApiKey !== null;
171
- /**
172
- * Which credential a request declaring `schemes` should carry.
173
- *
174
- * **Exactly one, always** — and the API says so itself. Measured against
175
- * production on 2026-08-06, `GET /toolkits` answers 200 for `x-api-key` alone
176
- * and 200 for `x-user-api-key` alone, and answers both together with
177
- * `401 HTTP_Unauthorized`:
178
- *
179
- * > Multiple authentication modes were provided. Provide exactly one
180
- * > authentication mode per request. Provided: ApiKeyAuth via x-api-key,
181
- * > UserApiKeyAuth via x-user-api-key.
182
- *
183
- * The platform names the schemes by their OpenAPI names, so this is the same
184
- * vocabulary `security` is written in rather than a coincidence of headers. It
185
- * holds for `x-api-key` + `x-org-api-key` too, and on an operation that accepts
186
- * only one of them. There is therefore no additive "send the user key as well"
187
- * model available, and the choice has to be made per request rather than
188
- * accumulated.
189
- *
190
- * The precedence exists to make the change free where it must be free:
191
- *
192
- * 1. **`ApiKeyAuth` wins wherever the operation accepts it** and an `apiKey` is
193
- * configured — 85 of the 104 operations, every wire byte preserved.
194
- * 2. Otherwise the first scheme the operation names that this client both
195
- * recognizes *and* holds a credential for. That is what makes the 16
196
- * `UserApiKeyAuth`-only and `OrgApiKeyAuth`-only operations reachable.
197
- * 3. Otherwise `ApiKeyAuth`, which is what this client did before any of this
198
- * existed. A `UserApiKeyAuth`-only operation called by a client with no user
199
- * key still sends `x-api-key` and still fails the same way — which is what
200
- * keeps `cli.realtime.auth` and `cli.realtime.credentials` pinned against
201
- * the Stainless oracle in `test/unit/differential-wire.test.ts`.
202
- *
203
- * Rule 3 is also where a scheme name this client does not know lands. Three of
204
- * them exist: `security` references `no_auth` (3 operations) and
205
- * `workbench_access_key` (1) and `components.securitySchemes` declares neither.
206
- * Those four operations receive `x-api-key` today and are differentially
207
- * pinned doing so, so resolving an unknown name to "no credential" would be a
208
- * wire change made on the strength of a spec defect. A later generator pass
209
- * must not "fix" that.
89
+ * `Auth.auto`'s choice for an operation declaring `schemes`: `ApiKeyAuth`
90
+ * wherever the operation accepts it and a project key is held, else the first
91
+ * declared scheme that is held, else `ApiKeyAuth`. An undeclared scheme name
92
+ * (`no_auth`, `workbench_access_key`) falls through to `ApiKeyAuth`, as every
93
+ * release before rc.18 sent. A request may carry only one credential: the API
94
+ * answers two with a 401.
210
95
  */
211
- const selectScheme = (schemes, credentials) => {
96
+ const selectScheme = (schemes, held) => {
212
97
  if (schemes === void 0 || schemes.length === 0) return DEFAULT_SCHEME;
213
- if (schemes.includes(DEFAULT_SCHEME) && credentials.apiKey !== null) return DEFAULT_SCHEME;
98
+ if (schemes.includes(DEFAULT_SCHEME) && held(DEFAULT_SCHEME)) return DEFAULT_SCHEME;
214
99
  for (const scheme of schemes) {
215
100
  if (!Object.hasOwn(SCHEME_HEADERS, scheme)) continue;
216
101
  const known = scheme;
217
- if (valueFor(known, credentials) !== null) return known;
102
+ if (held(known)) return known;
218
103
  }
219
104
  return DEFAULT_SCHEME;
220
105
  };
106
+ const schemeOfHeader = (name) => Object.keys(SCHEME_HEADERS).find((scheme) => SCHEME_HEADERS[scheme] === name);
221
107
  /**
222
108
  * What counts as loopback, pinned rather than assumed. `localhost` is not the
223
109
  * whole set:
@@ -271,9 +157,7 @@ const resolveHTTPURL = (target, base) => {
271
157
  /** Whether a credential may be sent to this origin at all. */
272
158
  const isCredentialSafeOrigin = (url, allowedHTTPOrigin = null) => url.protocol === "https:" || url.protocol === "http:" && (isLoopbackHostname(url.hostname) || allowedHTTPOrigin !== null && url.origin === allowedHTTPOrigin);
273
159
  const LOOPBACK_DESCRIPTION = "localhost, *.localhost, 127.0.0.0/8, [::1]";
274
- const insecureOriginMessage = (baseURL) => `Refusing to send a Composio API credential to ${baseURL}: a credentialed API origin must use HTTPS. By default, plain http:// is permitted only for loopback development endpoints (${LOOPBACK_DESCRIPTION}). Pass an https:// baseURL, use environment: 'local', set allowInsecureHTTP: true (or COMPOSIO_ALLOW_INSECURE_HTTP=1) for the configured development origin, or construct the client without credentials.`;
275
- /** Whether the client holds anything at all that rule 1 has to protect. */
276
- const anyCredential = (credentials) => credentials.apiKey !== null || hasAlternateCredential(credentials);
160
+ const insecureOriginMessage = (baseURL) => `Refusing to send a Composio API credential to ${baseURL}: a credentialed API origin must use HTTPS. By default, plain http:// is permitted only for loopback development endpoints (${LOOPBACK_DESCRIPTION}). Pass an https:// or loopback baseURL, set allowInsecureHTTP: true (or COMPOSIO_ALLOW_INSECURE_HTTP=1) for the configured development origin, or construct the client without credentials.`;
277
161
  /**
278
162
  * Rule 1 at construction time: a client that holds a credential must be
279
163
  * pointed at an origin that can carry one. Knowable before any request is
@@ -282,13 +166,9 @@ const anyCredential = (credentials) => credentials.apiKey !== null || hasAlterna
282
166
  * A `baseURL` that is not an absolute http(s) URL fails the same way — a
283
167
  * credential cannot be sent over a scheme this client does not speak, and the
284
168
  * alternative is a `TypeError` from `new URL()` one layer down.
285
- *
286
- * Every configured credential counts, not just `apiKey`: which one a given
287
- * request carries is decided per operation, so a client holding *any* of them
288
- * is a client that can put one on the wire.
289
169
  */
290
- const assertCredentialTransport = (baseURL, credentials, allowedHTTPOrigin = null) => {
291
- if (!anyCredential(credentials)) return;
170
+ const assertCredentialTransport = (baseURL, credentialed, allowedHTTPOrigin = null) => {
171
+ if (!credentialed) return;
292
172
  const url = parseHTTPURL(baseURL);
293
173
  if (url === null || !isCredentialSafeOrigin(url, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
294
174
  };
@@ -296,7 +176,7 @@ const assertCredentialTransport = (baseURL, credentials, allowedHTTPOrigin = nul
296
176
  * The credential this request may carry, or `null` for none.
297
177
  *
298
178
  * Rules 1 and 2 at dispatch time. Both re-checks are load-bearing rather than
299
- * belt-and-braces: `apiKey` and `baseURL` are public mutable fields, so the
179
+ * belt-and-braces: `baseURL` is a public mutable field, so the
300
180
  * construction-time check can be invalidated by an assignment, and the request
301
181
  * URL is *not* guaranteed to sit on the configured origin. `buildURL`
302
182
  * concatenates `baseURL + path` and the escape hatch (`client.get(path)`)
@@ -310,46 +190,23 @@ const assertCredentialTransport = (baseURL, credentials, allowedHTTPOrigin = nul
310
190
  * with credentials, so that one dies at the transport instead. httpx has no
311
191
  * such objection, which is why the Python port checks the same thing.)
312
192
  */
313
- const credentialForRequest = (baseURL, scheme, credentials, requestURL, allowedHTTPOrigin = null) => {
314
- const value = valueFor(scheme, credentials);
315
- if (value === null) return null;
193
+ const credentialForRequest = (baseURL, credential, requestURL, allowedHTTPOrigin = null) => {
194
+ if (credential === null) return null;
316
195
  const base = parseHTTPURL(baseURL);
317
196
  const target = parseHTTPURL(requestURL);
318
197
  if (base === null || target === null) return null;
319
198
  if (base.origin !== target.origin) return null;
320
199
  if (!isCredentialSafeOrigin(target, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
321
- return {
322
- name: SCHEME_HEADERS[scheme],
323
- value
324
- };
200
+ return credential;
325
201
  };
326
202
  /**
327
- * The credential headers a *caller* can place that are not the one this client
328
- * attaches — `x-api-key` is excluded because a caller setting it is overriding
329
- * the client's own value in the same slot, which is pinned Stainless behaviour,
330
- * not a second credential.
203
+ * Whether two absolute http(s) URLs share an origin, by the same test
204
+ * {@link credentialForRequest} applies. An unparseable side is never the same
205
+ * origin as anything. Python's `same_origin` is the twin.
331
206
  */
332
- const FOREIGN_CREDENTIAL_HEADERS = ["x-user-api-key", "x-org-api-key"];
333
- /**
334
- * Whether the caller has placed a credential of their own, in which case the
335
- * client must not add one beside it.
336
- *
337
- * Not a courtesy: this API answers a request carrying two credential headers
338
- * with `401 HTTP_Unauthorized`, so attaching `x-api-key` next to a caller's
339
- * `x-user-api-key` does not weaken the call, it *breaks* it. Three released
340
- * methods make that reachable without any `defaultHeaders` at all —
341
- * `cli.createCodactFailure`, `org.consumer.project.resolve` and
342
- * `org.consumer.listConnectedToolkits` declare `x-user-api-key` as a `required`
343
- * header parameter, which the generator folds into their params object. Calling
344
- * them the way their signature asks for returned 401 until this rule existed.
345
- *
346
- * Header merging is replayed rather than approximated, because a later source
347
- * may carry `null` to delete what an earlier one set (`buildHeaders`).
348
- */
349
- const callerPlacedCredential = (sources) => {
350
- if (!sources.some(Boolean)) return false;
351
- const headers = buildHeaders(sources);
352
- return FOREIGN_CREDENTIAL_HEADERS.some((name) => headers.has(name));
207
+ const sameOrigin = (a, b) => {
208
+ const origin = parseHTTPURL(a)?.origin;
209
+ return origin !== void 0 && origin === parseHTTPURL(b)?.origin;
353
210
  };
354
211
  /**
355
212
  * Header names that carry a credential and must not survive an origin change.
@@ -365,9 +222,9 @@ const callerPlacedCredential = (sources) => {
365
222
  *
366
223
  * `x-user-api-key` and `x-org-api-key` are the spec's other two credential
367
224
  * schemes (`UserApiKeyAuth`, `OrgApiKeyAuth`), and they belong here for the same
368
- * reason `x-api-key` does — the kernel attaches all three (wayfinder ticket 48)
225
+ * reason `x-api-key` does — the kernel attaches all three
369
226
  * and a caller can place the latter two directly besides. They were listed here
370
- * one ticket *before* the attachment work, because omitting them cost more than
227
+ * *before* the attachment work, because omitting them cost more than
371
228
  * a missed withdrawal: {@link carriesCredentials} answered `false` for a request
372
229
  * carrying only one of them, so `request.ts` classified it as credential-free
373
230
  * and handed the whole chain to `fetch` at `redirect: 'follow'` — the exact leak
@@ -424,6 +281,188 @@ const withdrawCredentials = (headers) => {
424
281
  */
425
282
  const carriesCredentials = (headers) => CREDENTIAL_HEADERS.some((name) => headers.has(name));
426
283
 
284
+ //#endregion
285
+ //#region src/compat/auth.ts
286
+ const NONE = Object.freeze({ mode: "none" });
287
+ const authConstructors = () => Object.freeze({
288
+ none: () => NONE,
289
+ project: (credential) => Object.freeze({
290
+ mode: "project",
291
+ credential
292
+ }),
293
+ user: (credential) => Object.freeze({
294
+ mode: "user",
295
+ credential
296
+ }),
297
+ organization: (credential) => Object.freeze({
298
+ mode: "organization",
299
+ credential
300
+ }),
301
+ auto: (credentials) => Object.freeze({
302
+ mode: "auto",
303
+ credentials: Object.freeze({ ...credentials })
304
+ })
305
+ });
306
+ const Auth = authConstructors();
307
+ const FIXED_MODES = [
308
+ "project",
309
+ "user",
310
+ "organization"
311
+ ];
312
+ const SCHEME_OF_MODE = {
313
+ project: "ApiKeyAuth",
314
+ user: "UserApiKeyAuth",
315
+ organization: "OrgApiKeyAuth"
316
+ };
317
+ const isFixedMode = (mode) => FIXED_MODES.includes(mode);
318
+ /** One credential is that fixed mode, several is `auto`, none is `none`. Shared by `fromEnv` and `layerConfig`. */
319
+ const authFromCredentials = (credentials) => {
320
+ const auth = authConstructors();
321
+ const [first, ...rest] = FIXED_MODES.filter((mode) => credentials[mode] !== void 0);
322
+ if (first === void 0) return auth.none();
323
+ if (rest.length > 0) return auth.auto(credentials);
324
+ return auth[first](credentials[first]);
325
+ };
326
+ const isSendable = (value, name = "x-api-key") => {
327
+ try {
328
+ new globalThis.Headers().set(name, value);
329
+ return true;
330
+ } catch {
331
+ return false;
332
+ }
333
+ };
334
+ const isUsableKey = (key) => typeof key === "string" && /\S/.test(key) && isSendable(key);
335
+ const unusableKeyError = (source) => new ComposioError(`${source} is not a usable key: it must be a string with a non-whitespace character and no line break, NUL or character outside Latin-1.`);
336
+ const holdCredential = (value, option, kind) => {
337
+ if (!kind.is(value)) throw new ComposioError(`\`${option}\` must be a key or a function that returns one.`);
338
+ const key = kind.keyOf(value);
339
+ if (key !== void 0 && !isUsableKey(key)) throw unusableKeyError(`\`${option}\``);
340
+ return value;
341
+ };
342
+ const holdAuto = (given, kind) => {
343
+ const credentials = {};
344
+ for (const mode of FIXED_MODES) {
345
+ const value = given?.[mode];
346
+ if (value !== void 0) credentials[SCHEME_OF_MODE[mode]] = holdCredential(value, `auth.credentials.${mode}`, kind);
347
+ }
348
+ if (Object.keys(credentials).length === 0) throw new ComposioError("`Auth.auto` needs at least one of `project`, `user` and `organization`.");
349
+ return credentials;
350
+ };
351
+ const MIGRATION = "Pass `auth`: `Auth.project(key)`, `Auth.user(key)`, `Auth.organization(key)`, `Auth.auto({ project, user, organization })` or `Auth.none()`.";
352
+ const resolveAuth = (auth, kind) => {
353
+ const value = auth;
354
+ const mode = value?.mode;
355
+ if (mode === void 0) throw new ComposioError(`\`auth\` is required. ${MIGRATION}`);
356
+ if (mode === "none") return {
357
+ mode,
358
+ credentials: {}
359
+ };
360
+ if (mode === "auto") return {
361
+ mode,
362
+ credentials: holdAuto(value?.credentials, kind)
363
+ };
364
+ if (!isFixedMode(mode)) throw new ComposioError(`\`auth.mode\` must be 'none', 'project', 'user', 'organization' or 'auto'. ${MIGRATION}`);
365
+ return {
366
+ mode,
367
+ credentials: { [SCHEME_OF_MODE[mode]]: holdCredential(value?.credential, "auth.credential", kind) }
368
+ };
369
+ };
370
+ const REMOVED_OPTIONS = {
371
+ apiKey: "Auth.project(key)",
372
+ userApiKey: "Auth.user(key)",
373
+ orgApiKey: "Auth.organization(key)"
374
+ };
375
+ const assertNoRemovedCredentialOptions = (options) => {
376
+ for (const [option, replacement] of Object.entries(REMOVED_OPTIONS)) {
377
+ if (!Object.hasOwn(options, option)) continue;
378
+ throw new ComposioError(`The \`${option}\` option was removed in 2.0.0-rc.18. Pass \`auth: ${replacement}\` instead, or \`Auth.auto({ ... })\` for per-operation selection.`);
379
+ }
380
+ };
381
+ const CREDENTIAL_HEADER_NAMES = Object.values(SCHEME_HEADERS);
382
+ const SCOPE_HEADER_NAMES = ["x-org-id", "x-project-id"];
383
+ const isScopeId = (value) => typeof value === "string" && value !== "" && value === value.trim() && isSendable(value, "x-org-id");
384
+ const scopeId = (field, value) => {
385
+ if (value === void 0) return void 0;
386
+ if (!isScopeId(value)) throw new ComposioError(`\`scope.${field}\` must be a non-empty string with no surrounding whitespace.`);
387
+ return value;
388
+ };
389
+ const resolveScope = (scope) => {
390
+ if (scope === void 0) return void 0;
391
+ if (typeof scope !== "object" || scope === null) throw new ComposioError("`scope` must be an object with an `organizationId`, a `projectId`, or both.");
392
+ const { organizationId, projectId } = scope;
393
+ const headers = {};
394
+ const org = scopeId("organizationId", organizationId);
395
+ const project = scopeId("projectId", projectId);
396
+ if (org !== void 0) headers["x-org-id"] = org;
397
+ if (project !== void 0) headers["x-project-id"] = project;
398
+ if (Object.keys(headers).length === 0) throw new ComposioError("`scope` must name an `organizationId`, a `projectId`, or both.");
399
+ return headers;
400
+ };
401
+ const assertRequiredOperationHeaders = (operation, supplied) => {
402
+ for (const name of operation?.requiredHeaders ?? []) {
403
+ if (supplied?.[name] != null) continue;
404
+ throw new ComposioError(`\`${operation?.chain.join(".")}\` requires the \`${name}\` parameter.`);
405
+ }
406
+ };
407
+ const scopeForCall = (configured, supplied) => {
408
+ const merged = { ...configured };
409
+ for (const name of SCOPE_HEADER_NAMES) {
410
+ const value = supplied?.[name];
411
+ if (value == null) continue;
412
+ const current = configured?.[name];
413
+ if (current !== void 0 && current !== value) throw new ComposioError(`The \`${name}\` parameter disagrees with the client's \`scope\`. Derive a client with \`withOptions({ scope })\` to address another one.`);
414
+ merged[name] = value;
415
+ }
416
+ return merged;
417
+ };
418
+ const operationCredential = (supplied) => {
419
+ for (const [name, value] of Object.entries(supplied ?? {})) {
420
+ const scheme = schemeOfHeader(name);
421
+ if (scheme !== void 0 && value != null) return {
422
+ scheme,
423
+ credential: value
424
+ };
425
+ }
426
+ };
427
+ const configuredScheme = (auth, operation) => {
428
+ if (auth.mode === "none") return void 0;
429
+ if (auth.mode === "auto") return selectScheme(operation?.schemes, (scheme) => auth.credentials[scheme] !== void 0);
430
+ return SCHEME_OF_MODE[auth.mode];
431
+ };
432
+ /**
433
+ * The credential one call carries: an operation credential replaces `auth`,
434
+ * and a fixed mode never reads the operation table. `null` off the API origin.
435
+ */
436
+ const chooseCredential = (auth, baseURL, requestURL, operation, supplied) => {
437
+ if (!sameOrigin(baseURL, requestURL)) return null;
438
+ const own = operationCredential(supplied);
439
+ if (own !== void 0) return own;
440
+ const scheme = configuredScheme(auth, operation);
441
+ if (scheme === void 0) return null;
442
+ const credential = auth.credentials[scheme];
443
+ return credential === void 0 ? null : {
444
+ scheme,
445
+ credential
446
+ };
447
+ };
448
+ const credentialHeader = (scheme, key) => {
449
+ const name = SCHEME_HEADERS[scheme];
450
+ if (!isUsableKey(key)) throw unusableKeyError(`The \`${name}\` credential`);
451
+ return {
452
+ name,
453
+ value: key
454
+ };
455
+ };
456
+ const providerFailed = (cause) => {
457
+ const error = new ComposioError("The `auth` credential provider failed.");
458
+ Object.defineProperty(error, "cause", {
459
+ value: cause,
460
+ configurable: true,
461
+ writable: true
462
+ });
463
+ return error;
464
+ };
465
+
427
466
  //#endregion
428
467
  //#region src/compat/deprecation.ts
429
468
  /**
@@ -894,6 +933,300 @@ const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen,
894
933
  }
895
934
  };
896
935
 
936
+ //#endregion
937
+ //#region src/compat/headers.ts
938
+ const hasEntries = (value) => typeof value === "object" && value !== null && "append" in value && typeof value.append === "function" && "delete" in value && typeof value.delete === "function" && "entries" in value && typeof value.entries === "function" && "get" in value && typeof value.get === "function";
939
+ const isHeaders = (value) => value instanceof Headers || hasEntries(value);
940
+ const isNullableHeadersLike = (headers) => {
941
+ if (!("values" in headers) || !isHeaders(headers.values) || !("nulls" in headers)) return false;
942
+ const nulls = headers.nulls;
943
+ return typeof nulls === "object" && nulls !== null && Symbol.iterator in nulls;
944
+ };
945
+ /**
946
+ * Iterates every supported input while preserving explicit deletions. Plain
947
+ * objects replace an older value for a key; tuple inputs append duplicate
948
+ * values, matching the published client.
949
+ */
950
+ function* iterateHeaders(headers) {
951
+ if (!headers) return;
952
+ if (isNullableHeadersLike(headers)) {
953
+ yield* headers.values.entries();
954
+ for (const name of headers.nulls) yield [name, null];
955
+ return;
956
+ }
957
+ const shouldReplace = !isHeaders(headers) && !Array.isArray(headers);
958
+ const entries = isHeaders(headers) ? headers.entries() : Array.isArray(headers) ? headers : Object.entries(headers);
959
+ for (const entry of entries) {
960
+ const name = entry[0];
961
+ if (typeof name !== "string") throw new TypeError("expected header name to be a string");
962
+ const rawValue = entry[1];
963
+ const values = Array.isArray(rawValue) ? rawValue : [rawValue];
964
+ let replaced = false;
965
+ for (const value of values) {
966
+ if (value === void 0) continue;
967
+ if (shouldReplace && !replaced) {
968
+ replaced = true;
969
+ yield [name, null];
970
+ }
971
+ yield [name, value];
972
+ }
973
+ }
974
+ }
975
+ /** Merge sources while retaining names explicitly deleted by the last source. */
976
+ const mergeHeaders = (sources) => {
977
+ const values = new Headers();
978
+ const nulls = /* @__PURE__ */ new Set();
979
+ for (const source of sources) {
980
+ if (!source) continue;
981
+ const seen = /* @__PURE__ */ new Set();
982
+ for (const [name, value] of iterateHeaders(source)) {
983
+ const lowerName = name.toLowerCase();
984
+ if (!seen.has(lowerName)) {
985
+ values.delete(name);
986
+ seen.add(lowerName);
987
+ }
988
+ if (value === null) {
989
+ values.delete(name);
990
+ nulls.add(lowerName);
991
+ } else {
992
+ values.append(name, value);
993
+ nulls.delete(lowerName);
994
+ }
995
+ }
996
+ }
997
+ return {
998
+ values,
999
+ nulls
1000
+ };
1001
+ };
1002
+ /** Merge sources into the native header collection sent to fetch. */
1003
+ const buildHeaders = (sources) => mergeHeaders(sources).values;
1004
+ /** Every header name a source mentions, lowercased, a `null` deletion included. */
1005
+ function* headerNames(headers) {
1006
+ for (const [name] of iterateHeaders(headers)) yield name.toLowerCase();
1007
+ }
1008
+
1009
+ //#endregion
1010
+ //#region src/version.ts
1011
+ const VERSION = "2.0.0";
1012
+
1013
+ //#endregion
1014
+ //#region src/compat/identity.ts
1015
+ /**
1016
+ * The runtime keys `std-env` detects, in its order, each with the label this
1017
+ * client sends as `x-client-runtime`. Ported from std-env 4.3.0
1018
+ * (https://github.com/unjs/std-env, MIT) rather than imported: std-env reads
1019
+ * `process.env` when it is imported, which throws under Deno without
1020
+ * `--allow-env`, and this needs only the runtime check.
1021
+ *
1022
+ * The labels are the ones released clients already send and the platform
1023
+ * already normalizes (`nodejs`, `cloudflare`, `vercel_edge`, ...), so a
1024
+ * dashboard groups old and new traffic together. Edge runtimes come before
1025
+ * Node because `nodejs_compat` and edge polyfills expose `process.versions.node`.
1026
+ */
1027
+ const RUNTIMES = [
1028
+ [
1029
+ "netlify",
1030
+ "netlify",
1031
+ (g) => "Netlify" in g
1032
+ ],
1033
+ [
1034
+ "edge-light",
1035
+ "vercel_edge",
1036
+ (g) => "EdgeRuntime" in g
1037
+ ],
1038
+ [
1039
+ "workerd",
1040
+ "cloudflare",
1041
+ (g) => g.navigator?.userAgent === "Cloudflare-Workers"
1042
+ ],
1043
+ [
1044
+ "fastly",
1045
+ "fastly",
1046
+ (g) => "fastly" in g
1047
+ ],
1048
+ [
1049
+ "deno",
1050
+ "deno",
1051
+ (g) => "Deno" in g
1052
+ ],
1053
+ [
1054
+ "bun",
1055
+ "bun",
1056
+ (g) => "Bun" in g
1057
+ ],
1058
+ [
1059
+ "node",
1060
+ "nodejs",
1061
+ (g) => Boolean(g.process?.versions?.node)
1062
+ ]
1063
+ ];
1064
+ /**
1065
+ * The runtime label and its version. The version is `process.versions[key]`,
1066
+ * which Node, Bun and Deno each set for themselves; an edge runtime reports
1067
+ * none, so a polyfilled Node version is never sent as its own.
1068
+ */
1069
+ const detectRuntime = () => {
1070
+ const g = globalThis;
1071
+ for (const [key, label, detect] of RUNTIMES) if (detect(g)) return [label, g.process?.versions?.[key]];
1072
+ return ["unknown", void 0];
1073
+ };
1074
+ /** The library sending the request. Never caller-settable, with or without an identity. */
1075
+ const PACKAGE_HEADERS = [
1076
+ "x-client-library",
1077
+ "x-client-library-version",
1078
+ "x-client-language"
1079
+ ];
1080
+ /**
1081
+ * The calling product and its runtime. Reserved once a client has an
1082
+ * `identity`; without one they default to the package and stay
1083
+ * caller-settable, which is how a wrapper identified itself before `identity`.
1084
+ */
1085
+ const PRODUCT_HEADERS = [
1086
+ "x-client-provenance",
1087
+ "x-client-version",
1088
+ "x-sdk-version",
1089
+ "x-source",
1090
+ "x-framework",
1091
+ "x-runtime",
1092
+ "x-client-runtime",
1093
+ "x-runtime-version"
1094
+ ];
1095
+ const PACKAGE_RESERVED = new Set(PACKAGE_HEADERS);
1096
+ const IDENTITY_RESERVED = /* @__PURE__ */ new Set([...PACKAGE_HEADERS, ...PRODUCT_HEADERS]);
1097
+ /** Printable ASCII with no leading or trailing whitespace: what every runtime's `Headers` sends unchanged. */
1098
+ const HEADER_SAFE = /^[\x21-\x7e](?:[\x20-\x7e]*[\x21-\x7e])?$/;
1099
+ const IDENTITY_FIELDS = [
1100
+ "product",
1101
+ "version",
1102
+ "source",
1103
+ "framework",
1104
+ "runtime"
1105
+ ];
1106
+ const REQUIRED_FIELDS = /* @__PURE__ */ new Set(["product", "version"]);
1107
+ const validateIdentity = (identity) => {
1108
+ if (typeof identity !== "object" || identity === null) throw new ComposioError("`identity` must be an object with a `product` and a `version`.");
1109
+ const fields = identity;
1110
+ for (const field of IDENTITY_FIELDS) {
1111
+ const value = fields[field];
1112
+ if (value === void 0 && !REQUIRED_FIELDS.has(field)) continue;
1113
+ 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.`);
1114
+ }
1115
+ return identity;
1116
+ };
1117
+ /**
1118
+ * Validates `identity` and resolves the headers it owns, once per client.
1119
+ *
1120
+ * Without an identity the client reports itself, as it always has. With one,
1121
+ * the product fields replace the package's; the runtime the package detected
1122
+ * stays in `x-client-runtime` and `x-runtime-version` either way, since
1123
+ * `identity.runtime` is the legacy `x-runtime` label and the platform does not
1124
+ * read the two as aliases.
1125
+ */
1126
+ const resolveIdentity = (identity) => {
1127
+ const [runtime, runtimeVersion] = detectRuntime();
1128
+ const library = {
1129
+ "x-client-library": "@composio/client",
1130
+ "x-client-library-version": VERSION,
1131
+ "x-client-language": "typescript",
1132
+ "x-client-runtime": runtime
1133
+ };
1134
+ if (identity === void 0) {
1135
+ const headers = {
1136
+ "x-client-provenance": "@composio/client",
1137
+ "x-client-version": VERSION,
1138
+ ...library,
1139
+ "x-runtime": runtime
1140
+ };
1141
+ if (runtimeVersion) headers["x-runtime-version"] = runtimeVersion;
1142
+ return {
1143
+ headers,
1144
+ reserved: PACKAGE_RESERVED
1145
+ };
1146
+ }
1147
+ const valid = validateIdentity(identity);
1148
+ const headers = {
1149
+ "x-client-provenance": valid.product,
1150
+ "x-client-version": valid.version,
1151
+ ...library,
1152
+ "x-runtime": valid.runtime ?? runtime
1153
+ };
1154
+ if (runtimeVersion) headers["x-runtime-version"] = runtimeVersion;
1155
+ headers["x-sdk-version"] = valid.version;
1156
+ if (valid.source !== void 0) headers["x-source"] = valid.source;
1157
+ if (valid.framework !== void 0) headers["x-framework"] = valid.framework;
1158
+ return {
1159
+ headers,
1160
+ reserved: IDENTITY_RESERVED
1161
+ };
1162
+ };
1163
+ /** Credential names are reserved while `auth` is not `none`, routing ids while `scope` is set. */
1164
+ const reservedHeaders = (identity, configured) => {
1165
+ const reserved = /* @__PURE__ */ new Map();
1166
+ for (const name of identity.reserved) reserved.set(name, PACKAGE_RESERVED.has(name) ? "client" : "identity");
1167
+ if (configured.auth) for (const name of CREDENTIAL_HEADER_NAMES) reserved.set(name, "auth");
1168
+ if (configured.scope) for (const name of SCOPE_HEADER_NAMES) reserved.set(name, "scope");
1169
+ return reserved;
1170
+ };
1171
+ const REMEDY = {
1172
+ client: " Pass `identity` to describe the calling product.",
1173
+ identity: "",
1174
+ auth: " Configure the credential through `auth`; derive a client with `withOptions({ auth })` for another one.",
1175
+ scope: " Configure the organization and project through `scope`; derive a client with `withOptions({ scope })` for another one."
1176
+ };
1177
+ /**
1178
+ * Refuses a generic header source that names a reserved header, whether it
1179
+ * sets one or deletes one with `null`. Constructor validation runs it over
1180
+ * `defaultHeaders`; request validation over a call's `headers`, before any
1181
+ * network work.
1182
+ */
1183
+ const assertNoReservedHeaders = (headers, reserved, option) => {
1184
+ if (!headers) return;
1185
+ for (const name of headerNames(headers)) {
1186
+ const owner = reserved.get(name);
1187
+ if (owner === void 0) continue;
1188
+ throw new ComposioError(`The \`${name}\` header is set by ${owner === "client" ? "the client" : `\`${owner}\``} and cannot be passed in \`${option}\`.${REMEDY[owner]}`);
1189
+ }
1190
+ };
1191
+
1192
+ //#endregion
1193
+ //#region src/compat/transport.ts
1194
+ const KERNEL_OWNED_KEYS = [
1195
+ "method",
1196
+ "headers",
1197
+ "body",
1198
+ "signal",
1199
+ "redirect"
1200
+ ];
1201
+ const assertSafeDefaults = (defaults) => {
1202
+ if (defaults === void 0) return;
1203
+ const owned = KERNEL_OWNED_KEYS.find((key) => key in defaults);
1204
+ if (owned !== void 0) throw new TypeError(`Fetch transport defaults cannot set kernel-owned '${owned}'`);
1205
+ };
1206
+ /**
1207
+ * Where the kernel leaves the `RequestInit` it built a `Request` from, so a
1208
+ * fetch-backed transport can call `fetch(url, init)` with the original body
1209
+ * and headers rather than `fetch(request)`. The two are the same HTTP
1210
+ * exchange; the difference is what a caller watching `fetch` sees, and every
1211
+ * consumer that stubs `globalThis.fetch` reads `calls[i][1].headers`, the
1212
+ * shape the client has sent since 0.1.x. A `Request` built elsewhere carries
1213
+ * no init and is sent as it is.
1214
+ */
1215
+ const kernelInit = Symbol("composio.kernelInit");
1216
+ /** Creates a transport backed by the supplied or global fetch function. */
1217
+ const createFetchTransport = (options = {}) => {
1218
+ assertSafeDefaults(options.defaults);
1219
+ const fetchImplementation = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
1220
+ return { send: (request) => {
1221
+ const init = request[kernelInit];
1222
+ if (init === void 0) return fetchImplementation(request, options.defaults);
1223
+ return fetchImplementation(request.url, {
1224
+ ...options.defaults,
1225
+ ...init
1226
+ });
1227
+ } };
1228
+ };
1229
+
897
1230
  //#endregion
898
1231
  //#region src/compat/request.ts
899
1232
  /**
@@ -922,20 +1255,25 @@ const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen,
922
1255
  * regression that measures fine and reports nothing.
923
1256
  */
924
1257
  const OPERATION = Symbol("composio.operation");
1258
+ /** The owned header parameters (`x-user-api-key`, `x-org-id`) a generated call supplied. */
1259
+ const OPERATION_HEADERS = Symbol("composio.operationHeaders");
925
1260
  /**
926
- * Attach a generated call's operation to the options bag it dispatches with.
1261
+ * Attach a generated call's operation, and its owned header parameters, to
1262
+ * the options bag it dispatches with.
927
1263
  *
928
1264
  * Called with the freshly built literal — never with the caller's own object —
929
1265
  * and *after* the caller's options have been spread into it, so a caller
930
1266
  * cannot pre-empt the descriptor: the write happens last, and the key it
931
1267
  * writes to is not one a caller can name.
932
1268
  */
933
- const withOperation = (operation, options) => {
1269
+ const withOperation = (operation, options, headers) => {
934
1270
  options[OPERATION] = operation;
1271
+ if (headers !== void 0) options[OPERATION_HEADERS] = headers;
935
1272
  return options;
936
1273
  };
937
1274
  /** The operation a generated call recorded, or `undefined` for a raw one. */
938
1275
  const readOperation = (options) => options[OPERATION];
1276
+ const readOperationHeaders = (options) => options[OPERATION_HEADERS];
939
1277
  /** A request label safe to print: dynamic path values and URL secrets are excluded. */
940
1278
  const printableURL = (url, operation) => `${new URL(url).origin}${operation?.path ?? "/<custom>"}`;
941
1279
  const emitLog = (config, level, message, metadata) => {
@@ -994,7 +1332,7 @@ const path = (statics, ...params) => {
994
1332
  * empty values, and plain-object values expanded qs-style into bracket
995
1333
  * notation (`toolkit_versions[github]=v1`, the whole key percent-encoded) —
996
1334
  * pinned differentially against Stainless via `tools.retrieve`'s object
997
- * `toolkit_versions` param (wayfinder ticket 23).
1335
+ * `toolkit_versions` param.
998
1336
  */
999
1337
  const stringifyQuery = (query) => {
1000
1338
  const parts = [];
@@ -1023,7 +1361,6 @@ const buildURL = (config, options) => {
1023
1361
  const url = new URL(base + joined);
1024
1362
  const query = {
1025
1363
  ...Object.fromEntries(url.searchParams),
1026
- ...config.defaultQuery,
1027
1364
  ...options.query
1028
1365
  };
1029
1366
  const search = stringifyQuery(query);
@@ -1072,6 +1409,19 @@ const RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
1072
1409
  409,
1073
1410
  429
1074
1411
  ]);
1412
+ const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
1413
+ "GET",
1414
+ "HEAD",
1415
+ "OPTIONS",
1416
+ "PUT",
1417
+ "DELETE"
1418
+ ]);
1419
+ /** Non-idempotent calls require their own retry budget: a lost response may hide a completed write. */
1420
+ const resolveMaxRetries = (method, configured, requested) => {
1421
+ const resolved = requested ?? configured;
1422
+ validatePositiveInteger("maxRetries", resolved);
1423
+ return requested !== void 0 || IDEMPOTENT_METHODS.has(method.toUpperCase()) ? resolved : 0;
1424
+ };
1075
1425
  const shouldRetryResponse = (response) => {
1076
1426
  const explicit = response.headers.get("x-should-retry");
1077
1427
  if (explicit === "true") return true;
@@ -1124,7 +1474,7 @@ const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
1124
1474
  * kernel refuses is one the platform would have refused too.
1125
1475
  */
1126
1476
  const MAX_REDIRECTS = 20;
1127
- const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times; the chain was abandoned.`;
1477
+ const TOO_MANY_REDIRECTS = `The API redirected more than ${20} times; the chain was abandoned.`;
1128
1478
  /**
1129
1479
  * The one environment-dependent behavior in the kernel, stated rather than
1130
1480
  * degraded into — and narrowed to the case where safety cannot be proved.
@@ -1153,7 +1503,7 @@ const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times;
1153
1503
  * What is left is a *credentialed* request that redirects in a browser. It
1154
1504
  * gets a named error rather than a silent leak — and on this API that is very
1155
1505
  * nearly unreachable: the only redirects the platform serves are same-origin
1156
- * edge normalizations (wayfinder ticket 40 records the recon), and `buildURL`
1506
+ * edge normalizations, and `buildURL`
1157
1507
  * cannot construct a URL that triggers one.
1158
1508
  */
1159
1509
  const OPAQUE_REDIRECT = "The API responded with a redirect that this runtime will not let the client read (an opaque redirect, in a browser). Redirects are followed only where the response can be inspected, because a credential must never cross an origin change.";
@@ -1199,18 +1549,27 @@ const kernelInternals = { sleep };
1199
1549
  * The headers for one hop, built fresh from the URL that hop is going to.
1200
1550
  *
1201
1551
  * This is where rule 3 mostly stops needing machinery of its own: the
1202
- * credential is re-derived per hop from the *request* URL rather than carried
1203
- * along from the last one, so a hop that leaves the configured API origin
1204
- * simply does not get a key. `withdrawn` covers what that cannot — the
1552
+ * credential is re-checked per hop against the *request* URL rather than
1553
+ * carried along from the last one, so a hop that leaves the configured API
1554
+ * origin simply does not get a key. `withdrawn` covers what that cannot — the
1205
1555
  * caller's own credential headers, which are legitimate on the URL the caller
1206
1556
  * chose and are dropped once the *server* has chosen one.
1557
+ *
1558
+ * The client's identity and scope headers follow the same per-hop rule: they
1559
+ * describe this client to its own API, so a hop off the configured origin (a
1560
+ * presigned storage URL, a redirect target) goes without them.
1207
1561
  */
1208
- const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
1209
- const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL, config.allowedHTTPOrigin);
1562
+ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, call) => {
1563
+ const credential = withdrawn ? null : credentialForRequest(config.baseURL, call.credential, requestURL, config.allowedHTTPOrigin);
1564
+ const own = sameOrigin(config.baseURL, requestURL);
1565
+ const identity = own ? config.identity.headers : void 0;
1566
+ const scope = own ? call.scope : void 0;
1210
1567
  if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers && options.idempotencyKey === void 0) {
1211
1568
  const direct = new Headers({
1569
+ ...identity,
1212
1570
  accept: "application/json",
1213
- "user-agent": config.userAgent
1571
+ "user-agent": config.userAgent,
1572
+ ...scope
1214
1573
  });
1215
1574
  if (credential !== null) direct.set(credential.name, credential.value);
1216
1575
  return direct;
@@ -1218,10 +1577,12 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
1218
1577
  const headers = buildHeaders([
1219
1578
  { "idempotency-key": options.idempotencyKey },
1220
1579
  {
1580
+ ...identity,
1221
1581
  accept: "application/json",
1222
1582
  "user-agent": config.userAgent
1223
1583
  },
1224
1584
  credential === null ? void 0 : { [credential.name]: credential.value },
1585
+ scope,
1225
1586
  config.defaultHeaders,
1226
1587
  bodyHeaders,
1227
1588
  options.headers
@@ -1229,28 +1590,25 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
1229
1590
  if (withdrawn) withdrawCredentials(headers);
1230
1591
  return headers;
1231
1592
  };
1232
- /**
1233
- * The credential class this logical request authenticates with, decided once
1234
- * from the operation the *caller* invoked.
1235
- *
1236
- * Deliberately not re-derived per redirect hop. A hop's URL was chosen by the
1237
- * server, so matching it back to a template would let the server's choice
1238
- * change which of the caller's credentials goes out; the operation the caller
1239
- * asked for is the honest answer for the whole chain, and rule 3 already
1240
- * withdraws everything once a hop leaves the origin.
1241
- *
1242
- * `operation` is the match `makeRequest` already computed for the static
1243
- * deprecated-input check, threaded in rather than re-derived: the two
1244
- * features need the same fact, so `matchOperation` runs once per logical call
1245
- * regardless of which of them a given client configuration actually uses.
1246
- * With only `apiKey` set the scheme answer is still `ApiKeyAuth` down every
1247
- * branch of {@link selectScheme}, so an existing caller's requests stay
1248
- * byte-identical by construction; what changed is that the match itself is no
1249
- * longer skippable, because the deprecated-input warning needs it too.
1250
- */
1251
- const schemeForRequest = (config, operation) => {
1252
- if (!hasAlternateCredential(config.credentials)) return "ApiKeyAuth";
1253
- return selectScheme(operation?.schemes, config.credentials);
1593
+ const callProvider = (provider, header) => {
1594
+ let key;
1595
+ try {
1596
+ key = provider();
1597
+ } catch (cause) {
1598
+ throw providerFailed(cause);
1599
+ }
1600
+ if (typeof key === "string") return header(key);
1601
+ return Promise.resolve(key).then(header, (cause) => {
1602
+ throw providerFailed(cause);
1603
+ });
1604
+ };
1605
+ /** Synchronous unless a provider has to be awaited, so a string key goes out in the turn the call starts. */
1606
+ const resolveCallCredential = (config, requestURL, operation, supplied) => {
1607
+ const choice = chooseCredential(config.auth, config.baseURL, requestURL, operation, supplied);
1608
+ if (choice === null) return null;
1609
+ const header = (key) => credentialHeader(choice.scheme, key);
1610
+ if (typeof choice.credential === "string") return header(choice.credential);
1611
+ return callProvider(choice.credential, header);
1254
1612
  };
1255
1613
  /**
1256
1614
  * One attempt: the request, plus however many redirects it takes to land on a
@@ -1266,29 +1624,26 @@ const schemeForRequest = (config, operation) => {
1266
1624
  * Everything the server chose is re-derived rather than carried: the headers
1267
1625
  * (see `buildRequestHeaders`), the method and body (fetch's own 301/302/303
1268
1626
  * rewrite), and the query, which is left to the `Location` URL because the
1269
- * server picked it. `config.defaultQuery` is applied to the URL the caller
1270
- * asked for, not to the one it was sent to.
1627
+ * server picked it.
1271
1628
  */
1272
- const dispatchWithRedirects = async (config, options, initialURL, initialBody, initialBodyHeaders, signal, scheme) => {
1629
+ const dispatchWithRedirects = async (config, options, initialURL, initialBody, initialBodyHeaders, signal, call) => {
1273
1630
  let url = initialURL;
1274
1631
  let method = options.method.toUpperCase();
1275
1632
  let body = initialBody;
1276
1633
  let bodyHeaders = initialBodyHeaders;
1277
1634
  let withdrawn = false;
1278
- const callerPlaced = callerPlacedCredential([config.defaultHeaders, options.headers]);
1279
1635
  for (let hop = 0;; hop++) {
1280
- const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme, callerPlaced);
1636
+ const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, call);
1281
1637
  const delegated = hop === 0 && !carriesCredentials(headers);
1282
1638
  const init = {
1283
1639
  method,
1284
1640
  headers,
1285
1641
  ...body !== void 0 ? { body } : {},
1286
- ...config.fetchOptions,
1287
- ...options.fetchOptions,
1288
1642
  redirect: delegated ? "follow" : "manual",
1289
1643
  signal
1290
1644
  };
1291
- const response = config.transport === void 0 ? await config.fetch.call(void 0, url, init) : await settleOnAbort(config.transport.send(new Request(url, init)), signal);
1645
+ const request = Object.assign(new Request(url, init), { [kernelInit]: init });
1646
+ const response = await settleOnAbort(config.transport.send(request), signal);
1292
1647
  if (delegated) return response;
1293
1648
  if (isOpaqueRedirect(response)) throw new APIConnectionError({ message: OPAQUE_REDIRECT });
1294
1649
  if (!REDIRECT_STATUSES.has(response.status)) return response;
@@ -1296,7 +1651,7 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
1296
1651
  if (location === null) return response;
1297
1652
  const target = resolveLocation(location, url);
1298
1653
  if (target === null) return response;
1299
- if (hop >= MAX_REDIRECTS) throw new APIConnectionError({ message: TOO_MANY_REDIRECTS });
1654
+ if (hop >= 20) throw new APIConnectionError({ message: TOO_MANY_REDIRECTS });
1300
1655
  response.body?.cancel().catch(() => void 0);
1301
1656
  if (target.origin !== new URL(url).origin) withdrawn = true;
1302
1657
  if (rewriteForRedirect(response.status, method)) {
@@ -1317,15 +1672,15 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
1317
1672
  *
1318
1673
  * Redirects are followed inside an attempt by `dispatchWithRedirects`, so the
1319
1674
  * single response exit below still fires `onResponse` **once per logical
1320
- * call** rather than once per hop — the once-per-call guarantee ticket 34
1321
- * built the deprecation interceptor on. The `Response` handed back is the
1675
+ * call** rather than once per hop — the once-per-call guarantee the
1676
+ * deprecation interceptor is built on. The `Response` handed back is the
1322
1677
  * final hop's, so `response.url` is still "the URL this response came from",
1323
1678
  * which is what `deprecation.ts` resolves relative `Link` targets against.
1324
1679
  */
1325
1680
  async function makeRequest(config, options) {
1681
+ assertNoReservedHeaders(options.headers, config.reserved, "headers");
1326
1682
  if (options.timeout !== void 0) validatePositiveInteger("timeout", options.timeout);
1327
- const maxRetries = options.maxRetries ?? config.maxRetries;
1328
- validatePositiveInteger("maxRetries", maxRetries);
1683
+ const maxRetries = resolveMaxRetries(options.method, config.maxRetries, options.maxRetries);
1329
1684
  const timeout = options.timeout ?? config.timeout;
1330
1685
  const { url, query } = buildURL(config, options);
1331
1686
  const { body, bodyHeaders } = buildBody(options);
@@ -1338,7 +1693,14 @@ async function makeRequest(config, options) {
1338
1693
  url: printableURL(url, operation),
1339
1694
  maxAttempts: maxRetries + 1
1340
1695
  };
1341
- const scheme = schemeForRequest(config, operation);
1696
+ const supplied = readOperationHeaders(options);
1697
+ assertRequiredOperationHeaders(threaded ?? null, supplied);
1698
+ const scope = scopeForCall(config.scope, supplied);
1699
+ const credential = resolveCallCredential(config, url, operation, supplied);
1700
+ const call = {
1701
+ scope,
1702
+ credential: credential instanceof Promise ? await credential : credential
1703
+ };
1342
1704
  if (config.onRequest !== void 0 && (threaded === void 0 || threaded.hasDeprecatedInputs === true)) config.onRequest(operation, query, options.body, buildHeaders([config.defaultHeaders, options.headers]));
1343
1705
  for (let numRetries = 0;; numRetries++) {
1344
1706
  if (userSignal?.aborted) throw new APIUserAbortError();
@@ -1356,7 +1718,7 @@ async function makeRequest(config, options) {
1356
1718
  const timer = setTimeout(abort, timeout);
1357
1719
  let result;
1358
1720
  try {
1359
- result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, scheme);
1721
+ result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, call);
1360
1722
  } catch (cause) {
1361
1723
  if (cause instanceof ComposioError) {
1362
1724
  if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
@@ -1521,13 +1883,18 @@ const GENERATED_OPERATIONS = [
1521
1883
  {
1522
1884
  method: "get",
1523
1885
  path: "/api/v3.1/cli/get-session",
1524
- chain: ["cli", "getSession"],
1886
+ chain: [
1887
+ "_internal",
1888
+ "cli",
1889
+ "getSession"
1890
+ ],
1525
1891
  schemes: ["no_auth"]
1526
1892
  },
1527
1893
  {
1528
1894
  method: "get",
1529
1895
  path: "/api/v3.1/cli/realtime/credentials",
1530
1896
  chain: [
1897
+ "_internal",
1531
1898
  "cli",
1532
1899
  "realtime",
1533
1900
  "credentials"
@@ -1555,6 +1922,7 @@ const GENERATED_OPERATIONS = [
1555
1922
  method: "get",
1556
1923
  path: "/api/v3.1/internal/action_execution/fields",
1557
1924
  chain: [
1925
+ "_internal",
1558
1926
  "logs",
1559
1927
  "tools",
1560
1928
  "listFields"
@@ -1564,6 +1932,7 @@ const GENERATED_OPERATIONS = [
1564
1932
  method: "get",
1565
1933
  path: "/api/v3.1/internal/action_execution/log/{id}",
1566
1934
  chain: [
1935
+ "_internal",
1567
1936
  "logs",
1568
1937
  "tools",
1569
1938
  "retrieve"
@@ -1573,6 +1942,7 @@ const GENERATED_OPERATIONS = [
1573
1942
  method: "get",
1574
1943
  path: "/api/v3.1/internal/trigger/log/{id}",
1575
1944
  chain: [
1945
+ "_internal",
1576
1946
  "logs",
1577
1947
  "triggers",
1578
1948
  "retrieve"
@@ -1608,15 +1978,28 @@ const GENERATED_OPERATIONS = [
1608
1978
  path: "/api/v3.1/mcp/{id}",
1609
1979
  chain: ["mcp", "retrieve"]
1610
1980
  },
1981
+ {
1982
+ method: "get",
1983
+ path: "/api/v3.1/org/consumer/config",
1984
+ chain: [
1985
+ "_internal",
1986
+ "org",
1987
+ "consumer",
1988
+ "retrieveConfig"
1989
+ ],
1990
+ schemes: ["UserApiKeyAuth"]
1991
+ },
1611
1992
  {
1612
1993
  method: "get",
1613
1994
  path: "/api/v3.1/org/consumer/connected_toolkits",
1614
1995
  chain: [
1996
+ "_internal",
1615
1997
  "org",
1616
1998
  "consumer",
1617
1999
  "listConnectedToolkits"
1618
2000
  ],
1619
- schemes: ["UserApiKeyAuth"]
2001
+ schemes: ["UserApiKeyAuth"],
2002
+ requiredHeaders: ["x-user-api-key", "x-org-id"]
1620
2003
  },
1621
2004
  {
1622
2005
  method: "get",
@@ -1716,7 +2099,8 @@ const GENERATED_OPERATIONS = [
1716
2099
  method: "get",
1717
2100
  path: "/api/v3.1/toolkits",
1718
2101
  chain: ["toolkits", "list"],
1719
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2102
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2103
+ hasDeprecatedInputs: true
1720
2104
  },
1721
2105
  {
1722
2106
  method: "get",
@@ -1879,19 +2263,29 @@ const GENERATED_OPERATIONS = [
1879
2263
  {
1880
2264
  method: "post",
1881
2265
  path: "/api/v3.1/cli/codact_failures",
1882
- chain: ["cli", "createCodactFailure"],
1883
- schemes: ["UserApiKeyAuth"]
2266
+ chain: [
2267
+ "_internal",
2268
+ "cli",
2269
+ "createCodactFailure"
2270
+ ],
2271
+ schemes: ["UserApiKeyAuth"],
2272
+ requiredHeaders: ["x-user-api-key"]
1884
2273
  },
1885
2274
  {
1886
2275
  method: "post",
1887
2276
  path: "/api/v3.1/cli/create-session",
1888
- chain: ["cli", "createSession"],
2277
+ chain: [
2278
+ "_internal",
2279
+ "cli",
2280
+ "createSession"
2281
+ ],
1889
2282
  schemes: ["no_auth"]
1890
2283
  },
1891
2284
  {
1892
2285
  method: "post",
1893
2286
  path: "/api/v3.1/cli/realtime/auth",
1894
2287
  chain: [
2288
+ "_internal",
1895
2289
  "cli",
1896
2290
  "realtime",
1897
2291
  "auth"
@@ -1924,6 +2318,17 @@ const GENERATED_OPERATIONS = [
1924
2318
  path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
1925
2319
  chain: ["connectedAccounts", "revoke"]
1926
2320
  },
2321
+ {
2322
+ method: "post",
2323
+ path: "/api/v3.1/consumer/permissions/resolve",
2324
+ chain: [
2325
+ "_internal",
2326
+ "consumer",
2327
+ "permissions",
2328
+ "resolve"
2329
+ ],
2330
+ schemes: ["UserApiKeyAuth", "ApiKeyAuth"]
2331
+ },
1927
2332
  {
1928
2333
  method: "post",
1929
2334
  path: "/api/v3.1/custom/toolkits/sync",
@@ -1945,6 +2350,7 @@ const GENERATED_OPERATIONS = [
1945
2350
  method: "post",
1946
2351
  path: "/api/v3.1/internal/action_execution/logs",
1947
2352
  chain: [
2353
+ "_internal",
1948
2354
  "logs",
1949
2355
  "tools",
1950
2356
  "list"
@@ -1954,6 +2360,7 @@ const GENERATED_OPERATIONS = [
1954
2360
  method: "post",
1955
2361
  path: "/api/v3.1/internal/trigger/logs",
1956
2362
  chain: [
2363
+ "_internal",
1957
2364
  "logs",
1958
2365
  "triggers",
1959
2366
  "list"
@@ -1985,33 +2392,26 @@ const GENERATED_OPERATIONS = [
1985
2392
  "mcp",
1986
2393
  "generate",
1987
2394
  "url"
1988
- ]
2395
+ ],
2396
+ hasDeprecatedInputs: true
1989
2397
  },
1990
2398
  {
1991
2399
  method: "post",
1992
2400
  path: "/api/v3.1/mcp/servers/{serverId}/instances",
1993
2401
  chain: ["mcp", "createInstance"]
1994
2402
  },
1995
- {
1996
- method: "post",
1997
- path: "/api/v3.1/org/clanker/create_claim",
1998
- chain: [
1999
- "org",
2000
- "clanker",
2001
- "createClaim"
2002
- ],
2003
- schemes: ["OrgApiKeyAuth"]
2004
- },
2005
2403
  {
2006
2404
  method: "post",
2007
2405
  path: "/api/v3.1/org/consumer/project/resolve",
2008
2406
  chain: [
2407
+ "_internal",
2009
2408
  "org",
2010
2409
  "consumer",
2011
2410
  "project",
2012
2411
  "resolve"
2013
2412
  ],
2014
- schemes: ["UserApiKeyAuth"]
2413
+ schemes: ["UserApiKeyAuth"],
2414
+ requiredHeaders: ["x-user-api-key", "x-org-id"]
2015
2415
  },
2016
2416
  {
2017
2417
  method: "post",
@@ -2098,8 +2498,7 @@ const GENERATED_OPERATIONS = [
2098
2498
  "toolRouter",
2099
2499
  "session",
2100
2500
  "execute"
2101
- ],
2102
- schemes: ["ApiKeyAuth", "workbench_access_key"]
2501
+ ]
2103
2502
  },
2104
2503
  {
2105
2504
  method: "post",
@@ -2251,4 +2650,4 @@ const generatedOperation = (chainKey) => {
2251
2650
  };
2252
2651
 
2253
2652
  //#endregion
2254
- export { path as a, withOperation as c, assertCredentialTransport as d, parseHTTPURL as f, makeRequest as i, inspectDeprecatedInputs as l, generatedOperation as n, readOperation as o, mergeHeaders as p, castToError as r, safeJSON as s, GENERATED_OPERATIONS as t, inspectDeprecation as u };
2653
+ export { matchOperation as A, scopeForCall as B, reservedHeaders as C, mergeHeaders as D, buildHeaders as E, authFromCredentials as F, resolveHTTPURL as G, assertCredentialTransport as H, chooseCredential as I, credentialHeader as L, assertNoRemovedCredentialOptions as M, assertRequiredOperationHeaders as N, inspectDeprecatedInputs as O, authConstructors as P, resolveAuth as R, assertNoReservedHeaders as S, VERSION as T, carriesCredentials as U, SCHEME_HEADERS as V, parseHTTPURL as W, safeJSON as _, TOO_MANY_REDIRECTS as a, withOperation as b, buildURL as c, path as d, printableURL as f, rewriteForRedirect as g, retryDelayMillis as h, REDIRECT_STATUSES as i, Auth as j, inspectDeprecation as k, castToError as l, resolveMaxRetries 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, resolveIdentity as w, createFetchTransport as x, validatePositiveInteger as y, resolveScope as z };