@composio/client 2.0.0-rc.9 → 2.0.1

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 (563) hide show
  1. package/LICENSE +202 -0
  2. package/MIGRATION.md +164 -0
  3. package/README.md +503 -39
  4. package/dist/{session-configs-DC9dblKH.d.mts → _internal-tzmCmYGo.d.mts} +2495 -1747
  5. package/dist/_internal-u674nU6P.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/create-toolkit.d.mts +13 -0
  179. package/dist/effect/schemas/custom/create-toolkit.mjs +21 -0
  180. package/dist/effect/schemas/custom/delete-toolkit.d.mts +12 -0
  181. package/dist/effect/schemas/custom/delete-toolkit.mjs +17 -0
  182. package/dist/effect/schemas/custom/sync.d.mts +10 -0
  183. package/dist/effect/schemas/custom/sync.mjs +21 -0
  184. package/dist/effect/schemas/custom/update-toolkits.d.mts +8 -0
  185. package/dist/effect/schemas/custom/update-toolkits.mjs +8 -0
  186. package/dist/effect/schemas/custom/upsert.d.mts +8 -0
  187. package/dist/effect/schemas/custom/upsert.mjs +11 -0
  188. package/dist/effect/schemas/files/create-presigned-url.d.mts +15 -0
  189. package/dist/effect/schemas/files/create-presigned-url.mjs +15 -0
  190. package/dist/effect/schemas/files/list.d.mts +18 -0
  191. package/dist/effect/schemas/files/list.mjs +20 -0
  192. package/dist/effect/schemas/keyring/list-transfer-keys.d.mts +17 -0
  193. package/dist/effect/schemas/keyring/list-transfer-keys.mjs +19 -0
  194. package/dist/effect/schemas/link/create.d.mts +19 -0
  195. package/dist/effect/schemas/link/create.mjs +18 -0
  196. package/dist/effect/schemas/logs/create-tool-execution.d.mts +25 -0
  197. package/dist/effect/schemas/logs/create-tool-execution.mjs +39 -0
  198. package/dist/effect/schemas/logs/retrieve-tool-execution.d.mts +37 -0
  199. package/dist/effect/schemas/logs/retrieve-tool-execution.mjs +51 -0
  200. package/dist/effect/schemas/mcp/create-instance.d.mts +12 -0
  201. package/dist/effect/schemas/mcp/create-instance.mjs +29 -0
  202. package/dist/effect/schemas/mcp/create.d.mts +23 -0
  203. package/dist/effect/schemas/mcp/create.mjs +67 -0
  204. package/dist/effect/schemas/mcp/custom/create.d.mts +17 -0
  205. package/dist/effect/schemas/mcp/custom/create.mjs +48 -0
  206. package/dist/effect/schemas/mcp/delete-instance.d.mts +9 -0
  207. package/dist/effect/schemas/mcp/delete-instance.mjs +11 -0
  208. package/dist/effect/schemas/mcp/delete.d.mts +9 -0
  209. package/dist/effect/schemas/mcp/delete.mjs +17 -0
  210. package/dist/effect/schemas/mcp/generate/url.d.mts +10 -0
  211. package/dist/effect/schemas/mcp/generate/url.mjs +21 -0
  212. package/dist/effect/schemas/mcp/list-instances.d.mts +18 -0
  213. package/dist/effect/schemas/mcp/list-instances.mjs +56 -0
  214. package/dist/effect/schemas/mcp/list.d.mts +27 -0
  215. package/dist/effect/schemas/mcp/list.mjs +19 -0
  216. package/dist/effect/schemas/mcp/retrieve-app.d.mts +27 -0
  217. package/dist/effect/schemas/mcp/retrieve-app.mjs +19 -0
  218. package/dist/effect/schemas/mcp/retrieve.d.mts +24 -0
  219. package/dist/effect/schemas/mcp/retrieve.mjs +68 -0
  220. package/dist/effect/schemas/mcp/update.d.mts +24 -0
  221. package/dist/effect/schemas/mcp/update.mjs +68 -0
  222. package/dist/effect/schemas/org/list.d.mts +17 -0
  223. package/dist/effect/schemas/org/list.mjs +22 -0
  224. package/dist/effect/schemas/org/owner/project/create.d.mts +10 -0
  225. package/dist/effect/schemas/org/owner/project/create.mjs +22 -0
  226. package/dist/effect/schemas/org/owner/project/delete.d.mts +9 -0
  227. package/dist/effect/schemas/org/owner/project/delete.mjs +17 -0
  228. package/dist/effect/schemas/org/owner/project/list.d.mts +27 -0
  229. package/dist/effect/schemas/org/owner/project/list.mjs +15 -0
  230. package/dist/effect/schemas/org/owner/project/regenerate-api-key.d.mts +14 -0
  231. package/dist/effect/schemas/org/owner/project/regenerate-api-key.mjs +31 -0
  232. package/dist/effect/schemas/org/owner/project/retrieve.d.mts +27 -0
  233. package/dist/effect/schemas/org/owner/project/retrieve.mjs +93 -0
  234. package/dist/effect/schemas/org/project/list.d.mts +27 -0
  235. package/dist/effect/schemas/org/project/list.mjs +15 -0
  236. package/dist/effect/schemas/org/usage/retrieve-summary.d.mts +13 -0
  237. package/dist/effect/schemas/org/usage/retrieve-summary.mjs +15 -0
  238. package/dist/effect/schemas/org/usage/retrieve.d.mts +16 -0
  239. package/dist/effect/schemas/org/usage/retrieve.mjs +18 -0
  240. package/dist/effect/schemas/project/usage/retrieve-summary.d.mts +13 -0
  241. package/dist/effect/schemas/project/usage/retrieve-summary.mjs +15 -0
  242. package/dist/effect/schemas/project/usage/retrieve.d.mts +16 -0
  243. package/dist/effect/schemas/project/usage/retrieve.mjs +18 -0
  244. package/dist/effect/schemas/session-configs/list.d.mts +15 -0
  245. package/dist/effect/schemas/session-configs/list.mjs +26 -0
  246. package/dist/effect/schemas/session-configs/retrieve.d.mts +45 -0
  247. package/dist/effect/schemas/session-configs/retrieve.mjs +103 -0
  248. package/dist/effect/schemas/tool-router/session/attach.d.mts +157 -0
  249. package/dist/effect/schemas/tool-router/session/attach.mjs +30 -0
  250. package/dist/effect/schemas/tool-router/session/config-history.d.mts +122 -0
  251. package/dist/effect/schemas/tool-router/session/config-history.mjs +8 -0
  252. package/dist/effect/schemas/tool-router/session/create.d.mts +157 -0
  253. package/dist/effect/schemas/tool-router/session/create.mjs +45 -0
  254. package/dist/effect/schemas/tool-router/session/delete.d.mts +9 -0
  255. package/dist/effect/schemas/tool-router/session/delete.mjs +18 -0
  256. package/dist/effect/schemas/tool-router/session/execute-meta.d.mts +75 -0
  257. package/dist/effect/schemas/tool-router/session/execute-meta.mjs +17 -0
  258. package/dist/effect/schemas/tool-router/session/execute.d.mts +75 -0
  259. package/dist/effect/schemas/tool-router/session/execute.mjs +17 -0
  260. package/dist/effect/schemas/tool-router/session/files/create-download-url.d.mts +11 -0
  261. package/dist/effect/schemas/tool-router/session/files/create-download-url.mjs +13 -0
  262. package/dist/effect/schemas/tool-router/session/files/create-upload-url.d.mts +11 -0
  263. package/dist/effect/schemas/tool-router/session/files/create-upload-url.mjs +13 -0
  264. package/dist/effect/schemas/tool-router/session/files/delete.d.mts +9 -0
  265. package/dist/effect/schemas/tool-router/session/files/delete.mjs +11 -0
  266. package/dist/effect/schemas/tool-router/session/files/list.d.mts +14 -0
  267. package/dist/effect/schemas/tool-router/session/files/list.mjs +16 -0
  268. package/dist/effect/schemas/tool-router/session/link.d.mts +18 -0
  269. package/dist/effect/schemas/tool-router/session/link.mjs +25 -0
  270. package/dist/effect/schemas/tool-router/session/patch.d.mts +157 -0
  271. package/dist/effect/schemas/tool-router/session/patch.mjs +30 -0
  272. package/dist/effect/schemas/tool-router/session/proxy-execute.d.mts +52 -0
  273. package/dist/effect/schemas/tool-router/session/proxy-execute.mjs +15 -0
  274. package/dist/effect/schemas/tool-router/session/retrieve.d.mts +157 -0
  275. package/dist/effect/schemas/tool-router/session/retrieve.mjs +30 -0
  276. package/dist/effect/schemas/tool-router/session/search.d.mts +80 -0
  277. package/dist/effect/schemas/tool-router/session/search.mjs +78 -0
  278. package/dist/effect/schemas/tool-router/session/toolkits.d.mts +33 -0
  279. package/dist/effect/schemas/tool-router/session/toolkits.mjs +8 -0
  280. package/dist/effect/schemas/tool-router/session/tools.d.mts +56 -0
  281. package/dist/effect/schemas/tool-router/session/tools.mjs +8 -0
  282. package/dist/effect/schemas/toolkits/list.d.mts +42 -0
  283. package/dist/effect/schemas/toolkits/list.mjs +15 -0
  284. package/dist/effect/schemas/toolkits/recommend-scopes.d.mts +19 -0
  285. package/dist/effect/schemas/toolkits/recommend-scopes.mjs +21 -0
  286. package/dist/effect/schemas/toolkits/retrieve-categories.d.mts +15 -0
  287. package/dist/effect/schemas/toolkits/retrieve-categories.mjs +23 -0
  288. package/dist/effect/schemas/toolkits/retrieve-changelog.d.mts +16 -0
  289. package/dist/effect/schemas/toolkits/retrieve-changelog.mjs +16 -0
  290. package/dist/effect/schemas/toolkits/retrieve-multi.d.mts +42 -0
  291. package/dist/effect/schemas/toolkits/retrieve-multi.mjs +15 -0
  292. package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.d.mts +15 -0
  293. package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.mjs +17 -0
  294. package/dist/effect/schemas/toolkits/retrieve.d.mts +110 -0
  295. package/dist/effect/schemas/toolkits/retrieve.mjs +202 -0
  296. package/dist/effect/schemas/tools/execute.d.mts +12 -0
  297. package/dist/effect/schemas/tools/execute.mjs +35 -0
  298. package/dist/effect/schemas/tools/get-input.d.mts +9 -0
  299. package/dist/effect/schemas/tools/get-input.mjs +22 -0
  300. package/dist/effect/schemas/tools/list.d.mts +56 -0
  301. package/dist/effect/schemas/tools/list.mjs +8 -0
  302. package/dist/effect/schemas/tools/proxy.d.mts +16 -0
  303. package/dist/effect/schemas/tools/proxy.mjs +36 -0
  304. package/dist/effect/schemas/tools/retrieve-enum.d.mts +6 -0
  305. package/dist/effect/schemas/tools/retrieve-enum.mjs +8 -0
  306. package/dist/effect/schemas/tools/retrieve-required-scopes.d.mts +22 -0
  307. package/dist/effect/schemas/tools/retrieve-required-scopes.mjs +33 -0
  308. package/dist/effect/schemas/tools/retrieve.d.mts +50 -0
  309. package/dist/effect/schemas/tools/retrieve.mjs +8 -0
  310. package/dist/effect/schemas/trigger-instances/list-active.d.mts +37 -0
  311. package/dist/effect/schemas/trigger-instances/list-active.mjs +49 -0
  312. package/dist/effect/schemas/trigger-instances/manage/delete.d.mts +8 -0
  313. package/dist/effect/schemas/trigger-instances/manage/delete.mjs +11 -0
  314. package/dist/effect/schemas/trigger-instances/manage/update.d.mts +8 -0
  315. package/dist/effect/schemas/trigger-instances/manage/update.mjs +8 -0
  316. package/dist/effect/schemas/trigger-instances/upsert.d.mts +11 -0
  317. package/dist/effect/schemas/trigger-instances/upsert.mjs +22 -0
  318. package/dist/effect/schemas/triggers-types/list.d.mts +28 -0
  319. package/dist/effect/schemas/triggers-types/list.mjs +90 -0
  320. package/dist/effect/schemas/triggers-types/retrieve-enum.d.mts +6 -0
  321. package/dist/effect/schemas/triggers-types/retrieve-enum.mjs +8 -0
  322. package/dist/effect/schemas/triggers-types/retrieve.d.mts +22 -0
  323. package/dist/effect/schemas/triggers-types/retrieve.mjs +84 -0
  324. package/dist/effect/schemas/webhook-endpoints/create.d.mts +13 -0
  325. package/dist/effect/schemas/webhook-endpoints/create.mjs +15 -0
  326. package/dist/effect/schemas/webhook-endpoints/list.d.mts +12 -0
  327. package/dist/effect/schemas/webhook-endpoints/list.mjs +12 -0
  328. package/dist/effect/schemas/webhook-endpoints/replace.d.mts +13 -0
  329. package/dist/effect/schemas/webhook-endpoints/replace.mjs +15 -0
  330. package/dist/effect/schemas/webhook-endpoints/retrieve.d.mts +13 -0
  331. package/dist/effect/schemas/webhook-endpoints/retrieve.mjs +15 -0
  332. package/dist/effect/schemas/webhook-endpoints/update.d.mts +13 -0
  333. package/dist/effect/schemas/webhook-endpoints/update.mjs +15 -0
  334. package/dist/effect/schemas/webhook-subscriptions/create.d.mts +14 -0
  335. package/dist/effect/schemas/webhook-subscriptions/create.mjs +23 -0
  336. package/dist/effect/schemas/webhook-subscriptions/delete.d.mts +8 -0
  337. package/dist/effect/schemas/webhook-subscriptions/delete.mjs +8 -0
  338. package/dist/effect/schemas/webhook-subscriptions/list-event-types.d.mts +12 -0
  339. package/dist/effect/schemas/webhook-subscriptions/list-event-types.mjs +16 -0
  340. package/dist/effect/schemas/webhook-subscriptions/list.d.mts +20 -0
  341. package/dist/effect/schemas/webhook-subscriptions/list.mjs +29 -0
  342. package/dist/effect/schemas/webhook-subscriptions/retrieve.d.mts +14 -0
  343. package/dist/effect/schemas/webhook-subscriptions/retrieve.mjs +23 -0
  344. package/dist/effect/schemas/webhook-subscriptions/rotate-secret.d.mts +9 -0
  345. package/dist/effect/schemas/webhook-subscriptions/rotate-secret.mjs +14 -0
  346. package/dist/effect/schemas/webhook-subscriptions/update.d.mts +14 -0
  347. package/dist/effect/schemas/webhook-subscriptions/update.mjs +23 -0
  348. package/dist/effect/schemas.d.mts +9933 -0
  349. package/dist/effect/schemas.mjs +134 -0
  350. package/dist/effect.d.mts +509 -0
  351. package/dist/effect.mjs +1642 -0
  352. package/dist/environments-B7_vTiMY.d.mts +19 -0
  353. package/dist/environments-C4RXCqEC.mjs +230 -0
  354. package/dist/{error-DLB1uKM3.mjs → error-Bw7_G2NZ.mjs} +16 -8
  355. package/dist/{generated-operations-BDdFa2UY.mjs → generated-operations-D0eOQLVJ.mjs} +629 -275
  356. package/dist/index.d.mts +3 -5
  357. package/dist/index.mjs +132 -425
  358. package/dist/internal.d.mts +9 -0
  359. package/dist/internal.mjs +1 -0
  360. package/dist/pagination-rules-CMnBwktJ.mjs +36 -0
  361. package/dist/pagination.mjs +5 -9
  362. package/dist/resources/_internal/_internal.d.mts +2 -0
  363. package/dist/resources/_internal/_internal.mjs +16 -0
  364. package/dist/resources/_internal/cli/cli.d.mts +2 -0
  365. package/dist/resources/_internal/cli/cli.mjs +33 -0
  366. package/dist/resources/_internal/cli/realtime.d.mts +2 -0
  367. package/dist/resources/_internal/cli/realtime.mjs +20 -0
  368. package/dist/resources/_internal/cli.d.mts +2 -0
  369. package/dist/resources/_internal/cli.mjs +1 -0
  370. package/dist/resources/_internal/consumer/consumer.d.mts +2 -0
  371. package/dist/resources/_internal/consumer/consumer.mjs +8 -0
  372. package/dist/resources/_internal/consumer/permissions.d.mts +2 -0
  373. package/dist/resources/_internal/consumer/permissions.mjs +14 -0
  374. package/dist/resources/_internal/consumer.d.mts +2 -0
  375. package/dist/resources/_internal/consumer.mjs +1 -0
  376. package/dist/resources/_internal/logs/logs.d.mts +2 -0
  377. package/dist/resources/_internal/logs/logs.mjs +12 -0
  378. package/dist/resources/_internal/logs/tools.d.mts +2 -0
  379. package/dist/resources/_internal/logs/tools.mjs +24 -0
  380. package/dist/resources/_internal/logs/triggers.d.mts +2 -0
  381. package/dist/resources/_internal/logs/triggers.mjs +20 -0
  382. package/dist/resources/_internal/logs.d.mts +2 -0
  383. package/dist/resources/_internal/logs.mjs +1 -0
  384. package/dist/resources/_internal/org/consumer/consumer.d.mts +2 -0
  385. package/dist/resources/_internal/org/consumer/consumer.mjs +26 -0
  386. package/dist/resources/_internal/org/consumer/project.d.mts +2 -0
  387. package/dist/resources/_internal/org/consumer/project.mjs +15 -0
  388. package/dist/resources/_internal/org/consumer.d.mts +2 -0
  389. package/dist/resources/_internal/org/consumer.mjs +1 -0
  390. package/dist/resources/_internal/org/org.d.mts +2 -0
  391. package/dist/resources/_internal/org/org.mjs +8 -0
  392. package/dist/resources/_internal/org.d.mts +2 -0
  393. package/dist/resources/_internal/org.mjs +1 -0
  394. package/dist/resources/_internal.d.mts +2 -0
  395. package/dist/resources/_internal.mjs +1 -0
  396. package/dist/resources/api-key-revocation.d.mts +2 -2
  397. package/dist/resources/api-key-revocation.mjs +13 -2
  398. package/dist/resources/auth/auth.d.mts +2 -2
  399. package/dist/resources/auth/auth.mjs +7 -2
  400. package/dist/resources/auth/session.d.mts +2 -2
  401. package/dist/resources/auth/session.mjs +10 -2
  402. package/dist/resources/auth-configs.d.mts +2 -2
  403. package/dist/resources/auth-configs.mjs +45 -2
  404. package/dist/resources/auth.d.mts +2 -2
  405. package/dist/resources/auth.mjs +1 -5
  406. package/dist/resources/connected-accounts.d.mts +2 -2
  407. package/dist/resources/connected-accounts.mjs +70 -2
  408. package/dist/resources/custom.d.mts +2 -2
  409. package/dist/resources/custom.mjs +43 -2
  410. package/dist/resources/files.d.mts +2 -2
  411. package/dist/resources/files.mjs +22 -2
  412. package/dist/resources/keyring.d.mts +2 -2
  413. package/dist/resources/keyring.mjs +10 -2
  414. package/dist/resources/link.d.mts +2 -2
  415. package/dist/resources/link.mjs +13 -2
  416. package/dist/resources/logs/logs.d.mts +2 -2
  417. package/dist/resources/logs/logs.mjs +19 -2
  418. package/dist/resources/logs.d.mts +2 -2
  419. package/dist/resources/logs.mjs +1 -6
  420. package/dist/resources/mcp/custom.d.mts +2 -2
  421. package/dist/resources/mcp/custom.mjs +13 -2
  422. package/dist/resources/mcp/generate.d.mts +2 -2
  423. package/dist/resources/mcp/generate.mjs +13 -2
  424. package/dist/resources/mcp/mcp.d.mts +2 -2
  425. package/dist/resources/mcp/mcp.mjs +67 -2
  426. package/dist/resources/mcp.d.mts +2 -2
  427. package/dist/resources/mcp.mjs +1 -6
  428. package/dist/resources/org/org.d.mts +2 -2
  429. package/dist/resources/org/org.mjs +21 -2
  430. package/dist/resources/org/owner/owner.d.mts +2 -2
  431. package/dist/resources/org/owner/owner.mjs +7 -2
  432. package/dist/resources/org/owner/project.d.mts +2 -2
  433. package/dist/resources/org/owner/project.mjs +37 -2
  434. package/dist/resources/org/owner.d.mts +2 -2
  435. package/dist/resources/org/owner.mjs +1 -5
  436. package/dist/resources/org/project.d.mts +2 -2
  437. package/dist/resources/org/project.mjs +13 -2
  438. package/dist/resources/org/usage.d.mts +2 -2
  439. package/dist/resources/org/usage.mjs +22 -2
  440. package/dist/resources/org.d.mts +2 -2
  441. package/dist/resources/org.mjs +1 -9
  442. package/dist/resources/project/project.d.mts +2 -2
  443. package/dist/resources/project/project.mjs +7 -2
  444. package/dist/resources/project/usage.d.mts +2 -2
  445. package/dist/resources/project/usage.mjs +22 -2
  446. package/dist/resources/project.d.mts +2 -3
  447. package/dist/resources/project.mjs +1 -5
  448. package/dist/resources/session-configs.d.mts +2 -2
  449. package/dist/resources/session-configs.mjs +8 -12
  450. package/dist/resources/tool-router/session/files.d.mts +2 -2
  451. package/dist/resources/tool-router/session/files.mjs +40 -2
  452. package/dist/resources/tool-router/session/session.d.mts +2 -2
  453. package/dist/resources/tool-router/session/session.mjs +95 -2
  454. package/dist/resources/tool-router/session.d.mts +2 -2
  455. package/dist/resources/tool-router/session.mjs +1 -5
  456. package/dist/resources/tool-router/tool-router.d.mts +2 -2
  457. package/dist/resources/tool-router/tool-router.mjs +7 -2
  458. package/dist/resources/tool-router.d.mts +2 -2
  459. package/dist/resources/tool-router.mjs +1 -5
  460. package/dist/resources/toolkits.d.mts +2 -2
  461. package/dist/resources/toolkits.mjs +55 -2
  462. package/dist/resources/tools.d.mts +2 -2
  463. package/dist/resources/tools.mjs +56 -2
  464. package/dist/resources/trigger-instances/manage.d.mts +2 -2
  465. package/dist/resources/trigger-instances/manage.mjs +19 -2
  466. package/dist/resources/trigger-instances/trigger-instances.d.mts +2 -2
  467. package/dist/resources/trigger-instances/trigger-instances.mjs +24 -2
  468. package/dist/resources/trigger-instances.d.mts +2 -2
  469. package/dist/resources/trigger-instances.mjs +1 -5
  470. package/dist/resources/triggers-types.d.mts +2 -2
  471. package/dist/resources/triggers-types.mjs +26 -2
  472. package/dist/resources/webhook-endpoints.d.mts +2 -2
  473. package/dist/resources/webhook-endpoints.mjs +40 -2
  474. package/dist/resources/webhook-subscriptions.d.mts +2 -2
  475. package/dist/resources/webhook-subscriptions.mjs +45 -2
  476. package/package.json +42 -34
  477. package/dist/api-key-revocation-C9gI3mxD.mjs +0 -25
  478. package/dist/auth-configs-AfPOIrp_.mjs +0 -54
  479. package/dist/auth-mNBmShhc.mjs +0 -17
  480. package/dist/clanker-DuDWRKms.mjs +0 -24
  481. package/dist/cli-BL3iy1cn.mjs +0 -45
  482. package/dist/config-BLBbhLe1.mjs +0 -10
  483. package/dist/config-DnyMhILW.d.mts +0 -9
  484. package/dist/connected-accounts-CDAYy93Y.mjs +0 -82
  485. package/dist/consumer-xMnRU0C0.mjs +0 -34
  486. package/dist/custom-CG287eyS.mjs +0 -24
  487. package/dist/custom-D5-KtFkx.mjs +0 -31
  488. package/dist/files-7nQzcAPu.mjs +0 -49
  489. package/dist/files-DfXyjBsv.mjs +0 -31
  490. package/dist/generate-Deely-Rs.mjs +0 -24
  491. package/dist/keyring-BU1WNke6.mjs +0 -17
  492. package/dist/link-BgM_kX73.mjs +0 -23
  493. package/dist/logs-CvGKikGY.mjs +0 -38
  494. package/dist/manage-D3woWCHa.mjs +0 -28
  495. package/dist/mcp-C9lPgg0I.mjs +0 -91
  496. package/dist/migration-CBhnoN-Y.mjs +0 -10
  497. package/dist/migration-CKGKuRO3.d.mts +0 -9
  498. package/dist/org-D490cmfQ.mjs +0 -45
  499. package/dist/owner-DUnkjEA9.mjs +0 -17
  500. package/dist/project-61Vi9ABS.mjs +0 -47
  501. package/dist/project-BmLu0B1A.mjs +0 -22
  502. package/dist/project-BoZ_FkAd.mjs +0 -25
  503. package/dist/project-DJCRMUWP.mjs +0 -29
  504. package/dist/realtime-D92CAeH1.mjs +0 -28
  505. package/dist/resources/auth/index.d.mts +0 -2
  506. package/dist/resources/auth/index.mjs +0 -4
  507. package/dist/resources/cli/cli.d.mts +0 -2
  508. package/dist/resources/cli/cli.mjs +0 -3
  509. package/dist/resources/cli/index.d.mts +0 -2
  510. package/dist/resources/cli/index.mjs +0 -4
  511. package/dist/resources/cli/realtime.d.mts +0 -2
  512. package/dist/resources/cli/realtime.mjs +0 -3
  513. package/dist/resources/cli.d.mts +0 -2
  514. package/dist/resources/cli.mjs +0 -5
  515. package/dist/resources/index.d.mts +0 -3
  516. package/dist/resources/index.mjs +0 -16
  517. package/dist/resources/logs/index.d.mts +0 -2
  518. package/dist/resources/logs/index.mjs +0 -5
  519. package/dist/resources/logs/tools.d.mts +0 -2
  520. package/dist/resources/logs/tools.mjs +0 -3
  521. package/dist/resources/logs/triggers.d.mts +0 -2
  522. package/dist/resources/logs/triggers.mjs +0 -3
  523. package/dist/resources/mcp/index.d.mts +0 -2
  524. package/dist/resources/mcp/index.mjs +0 -5
  525. package/dist/resources/migration.d.mts +0 -2
  526. package/dist/resources/migration.mjs +0 -3
  527. package/dist/resources/org/clanker.d.mts +0 -2
  528. package/dist/resources/org/clanker.mjs +0 -3
  529. package/dist/resources/org/consumer/consumer.d.mts +0 -2
  530. package/dist/resources/org/consumer/consumer.mjs +0 -3
  531. package/dist/resources/org/consumer/index.d.mts +0 -2
  532. package/dist/resources/org/consumer/index.mjs +0 -4
  533. package/dist/resources/org/consumer/project.d.mts +0 -2
  534. package/dist/resources/org/consumer/project.mjs +0 -3
  535. package/dist/resources/org/consumer.d.mts +0 -2
  536. package/dist/resources/org/consumer.mjs +0 -5
  537. package/dist/resources/org/index.d.mts +0 -2
  538. package/dist/resources/org/index.mjs +0 -8
  539. package/dist/resources/org/owner/index.d.mts +0 -2
  540. package/dist/resources/org/owner/index.mjs +0 -4
  541. package/dist/resources/project/config.d.mts +0 -2
  542. package/dist/resources/project/config.mjs +0 -3
  543. package/dist/resources/project/index.d.mts +0 -3
  544. package/dist/resources/project/index.mjs +0 -4
  545. package/dist/resources/tool-router/index.d.mts +0 -2
  546. package/dist/resources/tool-router/index.mjs +0 -4
  547. package/dist/resources/tool-router/session/index.d.mts +0 -2
  548. package/dist/resources/tool-router/session/index.mjs +0 -4
  549. package/dist/resources/trigger-instances/index.d.mts +0 -2
  550. package/dist/resources/trigger-instances/index.mjs +0 -4
  551. package/dist/session-CuxeTn6B.mjs +0 -22
  552. package/dist/session-Ko7BIjgq.mjs +0 -110
  553. package/dist/tool-router-CBKKosNd.mjs +0 -14
  554. package/dist/toolkits-3DF2HJzj.mjs +0 -62
  555. package/dist/tools-CHZz5vhP.mjs +0 -33
  556. package/dist/tools-CZ866I6_.mjs +0 -68
  557. package/dist/trigger-instances-Db9jhHWY.mjs +0 -35
  558. package/dist/triggers-CDhM0b24.mjs +0 -28
  559. package/dist/triggers-types-C6SEunIK.mjs +0 -34
  560. package/dist/usage-7j_ne9rG.mjs +0 -31
  561. package/dist/usage-CE6S407C.mjs +0 -31
  562. package/dist/webhook-endpoints-DWS1Ycp6.mjs +0 -51
  563. package/dist/webhook-subscriptions-DgL5Qp1f.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
- /**
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
88
  /**
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,18 +190,14 @@ 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
203
  * Whether two absolute http(s) URLs share an origin, by the same test
@@ -333,34 +209,6 @@ const sameOrigin = (a, b) => {
333
209
  return origin !== void 0 && origin === parseHTTPURL(b)?.origin;
334
210
  };
335
211
  /**
336
- * The credential headers a *caller* can place that are not the one this client
337
- * attaches — `x-api-key` is excluded because a caller setting it is overriding
338
- * the client's own value in the same slot, which is pinned Stainless behaviour,
339
- * not a second credential.
340
- */
341
- const FOREIGN_CREDENTIAL_HEADERS = ["x-user-api-key", "x-org-api-key"];
342
- /**
343
- * Whether the caller has placed a credential of their own, in which case the
344
- * client must not add one beside it.
345
- *
346
- * Not a courtesy: this API answers a request carrying two credential headers
347
- * with `401 HTTP_Unauthorized`, so attaching `x-api-key` next to a caller's
348
- * `x-user-api-key` does not weaken the call, it *breaks* it. Three released
349
- * methods make that reachable without any `defaultHeaders` at all —
350
- * `cli.createCodactFailure`, `org.consumer.project.resolve` and
351
- * `org.consumer.listConnectedToolkits` declare `x-user-api-key` as a `required`
352
- * header parameter, which the generator folds into their params object. Calling
353
- * them the way their signature asks for returned 401 until this rule existed.
354
- *
355
- * Header merging is replayed rather than approximated, because a later source
356
- * may carry `null` to delete what an earlier one set (`buildHeaders`).
357
- */
358
- const callerPlacedCredential = (sources) => {
359
- if (!sources.some(Boolean)) return false;
360
- const headers = buildHeaders(sources);
361
- return FOREIGN_CREDENTIAL_HEADERS.some((name) => headers.has(name));
362
- };
363
- /**
364
212
  * Header names that carry a credential and must not survive an origin change.
365
213
  *
366
214
  * The first three are what `fetch` itself would have stripped had it been
@@ -374,9 +222,9 @@ const callerPlacedCredential = (sources) => {
374
222
  *
375
223
  * `x-user-api-key` and `x-org-api-key` are the spec's other two credential
376
224
  * schemes (`UserApiKeyAuth`, `OrgApiKeyAuth`), and they belong here for the same
377
- * reason `x-api-key` does — the kernel attaches all three (wayfinder ticket 48)
225
+ * reason `x-api-key` does — the kernel attaches all three
378
226
  * and a caller can place the latter two directly besides. They were listed here
379
- * one ticket *before* the attachment work, because omitting them cost more than
227
+ * *before* the attachment work, because omitting them cost more than
380
228
  * a missed withdrawal: {@link carriesCredentials} answered `false` for a request
381
229
  * carrying only one of them, so `request.ts` classified it as credential-free
382
230
  * and handed the whole chain to `fetch` at `redirect: 'follow'` — the exact leak
@@ -433,6 +281,188 @@ const withdrawCredentials = (headers) => {
433
281
  */
434
282
  const carriesCredentials = (headers) => CREDENTIAL_HEADERS.some((name) => headers.has(name));
435
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
+
436
466
  //#endregion
437
467
  //#region src/compat/deprecation.ts
438
468
  /**
@@ -903,45 +933,298 @@ const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen,
903
933
  }
904
934
  };
905
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
+
906
1009
  //#endregion
907
1010
  //#region src/version.ts
908
- const VERSION = "2.0.0-rc.9";
1011
+ const VERSION = "2.0.1";
909
1012
 
910
1013
  //#endregion
911
- //#region src/compat/telemetry.ts
1014
+ //#region src/compat/identity.ts
912
1015
  /**
913
- * The runtime label and version, first match wins. Workers and Vercel Edge are
914
- * checked before Node because `nodejs_compat` and edge polyfills can expose
915
- * `process.versions.node`; neither reports a version, so a polyfilled Node
916
- * version is never sent as theirs.
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.
917
1068
  */
918
1069
  const detectRuntime = () => {
919
1070
  const g = globalThis;
920
- if (g.Bun !== void 0) return ["bun", g.Bun.version];
921
- if (g.Deno !== void 0) return ["deno", g.Deno.version?.deno];
922
- if (g.navigator?.userAgent === "Cloudflare-Workers" || g.caches !== void 0 && g.WebSocketPair !== void 0) return ["cloudflare", void 0];
923
- if (g.EdgeRuntime !== void 0) return ["vercel_edge", void 0];
924
- if (typeof process !== "undefined" && process.versions?.node) return ["nodejs", process.versions.node];
925
- if (typeof g.ServiceWorkerGlobalScope === "function" && globalThis instanceof g.ServiceWorkerGlobalScope) return ["service_worker", void 0];
926
- if (g.WorkerGlobalScope !== void 0 && typeof g.importScripts === "function") return ["web_worker", void 0];
927
- if (g.navigator?.product === "ReactNative") return ["react_native", void 0];
928
- if (g.window !== void 0 && g.document !== void 0) return ["browser", void 0];
1071
+ for (const [key, label, detect] of RUNTIMES) if (detect(g)) return [label, g.process?.versions?.[key]];
929
1072
  return ["unknown", void 0];
930
1073
  };
931
- /** Caller headers override these defaults, including the calling SDK's identity. */
932
- const clientTelemetryHeaders = () => {
933
- const [runtime, version] = detectRuntime();
934
- const headers = {
935
- "x-client-provenance": "@composio/client",
936
- "x-client-version": VERSION,
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 = {
937
1129
  "x-client-library": "@composio/client",
938
1130
  "x-client-library-version": VERSION,
939
1131
  "x-client-language": "typescript",
940
- "x-client-runtime": runtime,
941
- "x-runtime": runtime
1132
+ "x-client-runtime": runtime
942
1133
  };
943
- if (version) headers["x-runtime-version"] = version;
944
- return headers;
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
+ } };
945
1228
  };
946
1229
 
947
1230
  //#endregion
@@ -972,20 +1255,25 @@ const clientTelemetryHeaders = () => {
972
1255
  * regression that measures fine and reports nothing.
973
1256
  */
974
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");
975
1260
  /**
976
- * 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.
977
1263
  *
978
1264
  * Called with the freshly built literal — never with the caller's own object —
979
1265
  * and *after* the caller's options have been spread into it, so a caller
980
1266
  * cannot pre-empt the descriptor: the write happens last, and the key it
981
1267
  * writes to is not one a caller can name.
982
1268
  */
983
- const withOperation = (operation, options) => {
1269
+ const withOperation = (operation, options, headers) => {
984
1270
  options[OPERATION] = operation;
1271
+ if (headers !== void 0) options[OPERATION_HEADERS] = headers;
985
1272
  return options;
986
1273
  };
987
1274
  /** The operation a generated call recorded, or `undefined` for a raw one. */
988
1275
  const readOperation = (options) => options[OPERATION];
1276
+ const readOperationHeaders = (options) => options[OPERATION_HEADERS];
989
1277
  /** A request label safe to print: dynamic path values and URL secrets are excluded. */
990
1278
  const printableURL = (url, operation) => `${new URL(url).origin}${operation?.path ?? "/<custom>"}`;
991
1279
  const emitLog = (config, level, message, metadata) => {
@@ -1044,7 +1332,7 @@ const path = (statics, ...params) => {
1044
1332
  * empty values, and plain-object values expanded qs-style into bracket
1045
1333
  * notation (`toolkit_versions[github]=v1`, the whole key percent-encoded) —
1046
1334
  * pinned differentially against Stainless via `tools.retrieve`'s object
1047
- * `toolkit_versions` param (wayfinder ticket 23).
1335
+ * `toolkit_versions` param.
1048
1336
  */
1049
1337
  const stringifyQuery = (query) => {
1050
1338
  const parts = [];
@@ -1073,7 +1361,6 @@ const buildURL = (config, options) => {
1073
1361
  const url = new URL(base + joined);
1074
1362
  const query = {
1075
1363
  ...Object.fromEntries(url.searchParams),
1076
- ...config.defaultQuery,
1077
1364
  ...options.query
1078
1365
  };
1079
1366
  const search = stringifyQuery(query);
@@ -1122,6 +1409,19 @@ const RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
1122
1409
  409,
1123
1410
  429
1124
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
+ };
1125
1425
  const shouldRetryResponse = (response) => {
1126
1426
  const explicit = response.headers.get("x-should-retry");
1127
1427
  if (explicit === "true") return true;
@@ -1174,7 +1474,7 @@ const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
1174
1474
  * kernel refuses is one the platform would have refused too.
1175
1475
  */
1176
1476
  const MAX_REDIRECTS = 20;
1177
- 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.`;
1178
1478
  /**
1179
1479
  * The one environment-dependent behavior in the kernel, stated rather than
1180
1480
  * degraded into — and narrowed to the case where safety cannot be proved.
@@ -1203,7 +1503,7 @@ const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times;
1203
1503
  * What is left is a *credentialed* request that redirects in a browser. It
1204
1504
  * gets a named error rather than a silent leak — and on this API that is very
1205
1505
  * nearly unreachable: the only redirects the platform serves are same-origin
1206
- * edge normalizations (wayfinder ticket 40 records the recon), and `buildURL`
1506
+ * edge normalizations, and `buildURL`
1207
1507
  * cannot construct a URL that triggers one.
1208
1508
  */
1209
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.";
@@ -1249,24 +1549,27 @@ const kernelInternals = { sleep };
1249
1549
  * The headers for one hop, built fresh from the URL that hop is going to.
1250
1550
  *
1251
1551
  * This is where rule 3 mostly stops needing machinery of its own: the
1252
- * credential is re-derived per hop from the *request* URL rather than carried
1253
- * along from the last one, so a hop that leaves the configured API origin
1254
- * 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
1255
1555
  * caller's own credential headers, which are legitimate on the URL the caller
1256
1556
  * chose and are dropped once the *server* has chosen one.
1257
1557
  *
1258
- * The client's identity headers follow the same per-hop rule: they describe
1259
- * this client to its own API, so a hop off the configured origin (a presigned
1260
- * storage URL, a redirect target) goes without them.
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.
1261
1561
  */
1262
- const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
1263
- const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL, config.allowedHTTPOrigin);
1264
- const identity = sameOrigin(config.baseURL, requestURL) ? clientTelemetryHeaders() : void 0;
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;
1265
1567
  if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers && options.idempotencyKey === void 0) {
1266
1568
  const direct = new Headers({
1267
1569
  ...identity,
1268
1570
  accept: "application/json",
1269
- "user-agent": config.userAgent
1571
+ "user-agent": config.userAgent,
1572
+ ...scope
1270
1573
  });
1271
1574
  if (credential !== null) direct.set(credential.name, credential.value);
1272
1575
  return direct;
@@ -1279,6 +1582,7 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
1279
1582
  "user-agent": config.userAgent
1280
1583
  },
1281
1584
  credential === null ? void 0 : { [credential.name]: credential.value },
1585
+ scope,
1282
1586
  config.defaultHeaders,
1283
1587
  bodyHeaders,
1284
1588
  options.headers
@@ -1286,28 +1590,25 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
1286
1590
  if (withdrawn) withdrawCredentials(headers);
1287
1591
  return headers;
1288
1592
  };
1289
- /**
1290
- * The credential class this logical request authenticates with, decided once
1291
- * from the operation the *caller* invoked.
1292
- *
1293
- * Deliberately not re-derived per redirect hop. A hop's URL was chosen by the
1294
- * server, so matching it back to a template would let the server's choice
1295
- * change which of the caller's credentials goes out; the operation the caller
1296
- * asked for is the honest answer for the whole chain, and rule 3 already
1297
- * withdraws everything once a hop leaves the origin.
1298
- *
1299
- * `operation` is the match `makeRequest` already computed for the static
1300
- * deprecated-input check, threaded in rather than re-derived: the two
1301
- * features need the same fact, so `matchOperation` runs once per logical call
1302
- * regardless of which of them a given client configuration actually uses.
1303
- * With only `apiKey` set the scheme answer is still `ApiKeyAuth` down every
1304
- * branch of {@link selectScheme}, so an existing caller's requests stay
1305
- * byte-identical by construction; what changed is that the match itself is no
1306
- * longer skippable, because the deprecated-input warning needs it too.
1307
- */
1308
- const schemeForRequest = (config, operation) => {
1309
- if (!hasAlternateCredential(config.credentials)) return "ApiKeyAuth";
1310
- 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);
1311
1612
  };
1312
1613
  /**
1313
1614
  * One attempt: the request, plus however many redirects it takes to land on a
@@ -1323,29 +1624,26 @@ const schemeForRequest = (config, operation) => {
1323
1624
  * Everything the server chose is re-derived rather than carried: the headers
1324
1625
  * (see `buildRequestHeaders`), the method and body (fetch's own 301/302/303
1325
1626
  * rewrite), and the query, which is left to the `Location` URL because the
1326
- * server picked it. `config.defaultQuery` is applied to the URL the caller
1327
- * asked for, not to the one it was sent to.
1627
+ * server picked it.
1328
1628
  */
1329
- const dispatchWithRedirects = async (config, options, initialURL, initialBody, initialBodyHeaders, signal, scheme) => {
1629
+ const dispatchWithRedirects = async (config, options, initialURL, initialBody, initialBodyHeaders, signal, call) => {
1330
1630
  let url = initialURL;
1331
1631
  let method = options.method.toUpperCase();
1332
1632
  let body = initialBody;
1333
1633
  let bodyHeaders = initialBodyHeaders;
1334
1634
  let withdrawn = false;
1335
- const callerPlaced = callerPlacedCredential([config.defaultHeaders, options.headers]);
1336
1635
  for (let hop = 0;; hop++) {
1337
- const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme, callerPlaced);
1636
+ const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, call);
1338
1637
  const delegated = hop === 0 && !carriesCredentials(headers);
1339
1638
  const init = {
1340
1639
  method,
1341
1640
  headers,
1342
1641
  ...body !== void 0 ? { body } : {},
1343
- ...config.fetchOptions,
1344
- ...options.fetchOptions,
1345
1642
  redirect: delegated ? "follow" : "manual",
1346
1643
  signal
1347
1644
  };
1348
- 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);
1349
1647
  if (delegated) return response;
1350
1648
  if (isOpaqueRedirect(response)) throw new APIConnectionError({ message: OPAQUE_REDIRECT });
1351
1649
  if (!REDIRECT_STATUSES.has(response.status)) return response;
@@ -1353,7 +1651,7 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
1353
1651
  if (location === null) return response;
1354
1652
  const target = resolveLocation(location, url);
1355
1653
  if (target === null) return response;
1356
- if (hop >= MAX_REDIRECTS) throw new APIConnectionError({ message: TOO_MANY_REDIRECTS });
1654
+ if (hop >= 20) throw new APIConnectionError({ message: TOO_MANY_REDIRECTS });
1357
1655
  response.body?.cancel().catch(() => void 0);
1358
1656
  if (target.origin !== new URL(url).origin) withdrawn = true;
1359
1657
  if (rewriteForRedirect(response.status, method)) {
@@ -1374,15 +1672,15 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
1374
1672
  *
1375
1673
  * Redirects are followed inside an attempt by `dispatchWithRedirects`, so the
1376
1674
  * single response exit below still fires `onResponse` **once per logical
1377
- * call** rather than once per hop — the once-per-call guarantee ticket 34
1378
- * 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
1379
1677
  * final hop's, so `response.url` is still "the URL this response came from",
1380
1678
  * which is what `deprecation.ts` resolves relative `Link` targets against.
1381
1679
  */
1382
1680
  async function makeRequest(config, options) {
1681
+ assertNoReservedHeaders(options.headers, config.reserved, "headers");
1383
1682
  if (options.timeout !== void 0) validatePositiveInteger("timeout", options.timeout);
1384
- const maxRetries = options.maxRetries ?? config.maxRetries;
1385
- validatePositiveInteger("maxRetries", maxRetries);
1683
+ const maxRetries = resolveMaxRetries(options.method, config.maxRetries, options.maxRetries);
1386
1684
  const timeout = options.timeout ?? config.timeout;
1387
1685
  const { url, query } = buildURL(config, options);
1388
1686
  const { body, bodyHeaders } = buildBody(options);
@@ -1395,7 +1693,14 @@ async function makeRequest(config, options) {
1395
1693
  url: printableURL(url, operation),
1396
1694
  maxAttempts: maxRetries + 1
1397
1695
  };
1398
- 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
+ };
1399
1704
  if (config.onRequest !== void 0 && (threaded === void 0 || threaded.hasDeprecatedInputs === true)) config.onRequest(operation, query, options.body, buildHeaders([config.defaultHeaders, options.headers]));
1400
1705
  for (let numRetries = 0;; numRetries++) {
1401
1706
  if (userSignal?.aborted) throw new APIUserAbortError();
@@ -1413,7 +1718,7 @@ async function makeRequest(config, options) {
1413
1718
  const timer = setTimeout(abort, timeout);
1414
1719
  let result;
1415
1720
  try {
1416
- result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, scheme);
1721
+ result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, call);
1417
1722
  } catch (cause) {
1418
1723
  if (cause instanceof ComposioError) {
1419
1724
  if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
@@ -1578,13 +1883,18 @@ const GENERATED_OPERATIONS = [
1578
1883
  {
1579
1884
  method: "get",
1580
1885
  path: "/api/v3.1/cli/get-session",
1581
- chain: ["cli", "getSession"],
1886
+ chain: [
1887
+ "_internal",
1888
+ "cli",
1889
+ "getSession"
1890
+ ],
1582
1891
  schemes: ["no_auth"]
1583
1892
  },
1584
1893
  {
1585
1894
  method: "get",
1586
1895
  path: "/api/v3.1/cli/realtime/credentials",
1587
1896
  chain: [
1897
+ "_internal",
1588
1898
  "cli",
1589
1899
  "realtime",
1590
1900
  "credentials"
@@ -1612,6 +1922,7 @@ const GENERATED_OPERATIONS = [
1612
1922
  method: "get",
1613
1923
  path: "/api/v3.1/internal/action_execution/fields",
1614
1924
  chain: [
1925
+ "_internal",
1615
1926
  "logs",
1616
1927
  "tools",
1617
1928
  "listFields"
@@ -1621,6 +1932,7 @@ const GENERATED_OPERATIONS = [
1621
1932
  method: "get",
1622
1933
  path: "/api/v3.1/internal/action_execution/log/{id}",
1623
1934
  chain: [
1935
+ "_internal",
1624
1936
  "logs",
1625
1937
  "tools",
1626
1938
  "retrieve"
@@ -1630,6 +1942,7 @@ const GENERATED_OPERATIONS = [
1630
1942
  method: "get",
1631
1943
  path: "/api/v3.1/internal/trigger/log/{id}",
1632
1944
  chain: [
1945
+ "_internal",
1633
1946
  "logs",
1634
1947
  "triggers",
1635
1948
  "retrieve"
@@ -1665,15 +1978,28 @@ const GENERATED_OPERATIONS = [
1665
1978
  path: "/api/v3.1/mcp/{id}",
1666
1979
  chain: ["mcp", "retrieve"]
1667
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
+ },
1668
1992
  {
1669
1993
  method: "get",
1670
1994
  path: "/api/v3.1/org/consumer/connected_toolkits",
1671
1995
  chain: [
1996
+ "_internal",
1672
1997
  "org",
1673
1998
  "consumer",
1674
1999
  "listConnectedToolkits"
1675
2000
  ],
1676
- schemes: ["UserApiKeyAuth"]
2001
+ schemes: ["UserApiKeyAuth"],
2002
+ requiredHeaders: ["x-user-api-key", "x-org-id"]
1677
2003
  },
1678
2004
  {
1679
2005
  method: "get",
@@ -1773,7 +2099,8 @@ const GENERATED_OPERATIONS = [
1773
2099
  method: "get",
1774
2100
  path: "/api/v3.1/toolkits",
1775
2101
  chain: ["toolkits", "list"],
1776
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2102
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2103
+ hasDeprecatedInputs: true
1777
2104
  },
1778
2105
  {
1779
2106
  method: "get",
@@ -1887,6 +2214,12 @@ const GENERATED_OPERATIONS = [
1887
2214
  path: "/api/v3.1/connected_accounts/{nanoid}",
1888
2215
  chain: ["connectedAccounts", "patch"]
1889
2216
  },
2217
+ {
2218
+ method: "patch",
2219
+ path: "/api/v3.1/custom/toolkits/{slug}",
2220
+ chain: ["custom", "updateToolkits"],
2221
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2222
+ },
1890
2223
  {
1891
2224
  method: "patch",
1892
2225
  path: "/api/v3.1/mcp/{id}",
@@ -1936,19 +2269,29 @@ const GENERATED_OPERATIONS = [
1936
2269
  {
1937
2270
  method: "post",
1938
2271
  path: "/api/v3.1/cli/codact_failures",
1939
- chain: ["cli", "createCodactFailure"],
1940
- schemes: ["UserApiKeyAuth"]
2272
+ chain: [
2273
+ "_internal",
2274
+ "cli",
2275
+ "createCodactFailure"
2276
+ ],
2277
+ schemes: ["UserApiKeyAuth"],
2278
+ requiredHeaders: ["x-user-api-key"]
1941
2279
  },
1942
2280
  {
1943
2281
  method: "post",
1944
2282
  path: "/api/v3.1/cli/create-session",
1945
- chain: ["cli", "createSession"],
2283
+ chain: [
2284
+ "_internal",
2285
+ "cli",
2286
+ "createSession"
2287
+ ],
1946
2288
  schemes: ["no_auth"]
1947
2289
  },
1948
2290
  {
1949
2291
  method: "post",
1950
2292
  path: "/api/v3.1/cli/realtime/auth",
1951
2293
  chain: [
2294
+ "_internal",
1952
2295
  "cli",
1953
2296
  "realtime",
1954
2297
  "auth"
@@ -1981,6 +2324,23 @@ const GENERATED_OPERATIONS = [
1981
2324
  path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
1982
2325
  chain: ["connectedAccounts", "revoke"]
1983
2326
  },
2327
+ {
2328
+ method: "post",
2329
+ path: "/api/v3.1/consumer/permissions/resolve",
2330
+ chain: [
2331
+ "_internal",
2332
+ "consumer",
2333
+ "permissions",
2334
+ "resolve"
2335
+ ],
2336
+ schemes: ["UserApiKeyAuth", "ApiKeyAuth"]
2337
+ },
2338
+ {
2339
+ method: "post",
2340
+ path: "/api/v3.1/custom/toolkits",
2341
+ chain: ["custom", "createToolkit"],
2342
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2343
+ },
1984
2344
  {
1985
2345
  method: "post",
1986
2346
  path: "/api/v3.1/custom/toolkits/sync",
@@ -2002,6 +2362,7 @@ const GENERATED_OPERATIONS = [
2002
2362
  method: "post",
2003
2363
  path: "/api/v3.1/internal/action_execution/logs",
2004
2364
  chain: [
2365
+ "_internal",
2005
2366
  "logs",
2006
2367
  "tools",
2007
2368
  "list"
@@ -2011,6 +2372,7 @@ const GENERATED_OPERATIONS = [
2011
2372
  method: "post",
2012
2373
  path: "/api/v3.1/internal/trigger/logs",
2013
2374
  chain: [
2375
+ "_internal",
2014
2376
  "logs",
2015
2377
  "triggers",
2016
2378
  "list"
@@ -2042,33 +2404,26 @@ const GENERATED_OPERATIONS = [
2042
2404
  "mcp",
2043
2405
  "generate",
2044
2406
  "url"
2045
- ]
2407
+ ],
2408
+ hasDeprecatedInputs: true
2046
2409
  },
2047
2410
  {
2048
2411
  method: "post",
2049
2412
  path: "/api/v3.1/mcp/servers/{serverId}/instances",
2050
2413
  chain: ["mcp", "createInstance"]
2051
2414
  },
2052
- {
2053
- method: "post",
2054
- path: "/api/v3.1/org/clanker/create_claim",
2055
- chain: [
2056
- "org",
2057
- "clanker",
2058
- "createClaim"
2059
- ],
2060
- schemes: ["OrgApiKeyAuth"]
2061
- },
2062
2415
  {
2063
2416
  method: "post",
2064
2417
  path: "/api/v3.1/org/consumer/project/resolve",
2065
2418
  chain: [
2419
+ "_internal",
2066
2420
  "org",
2067
2421
  "consumer",
2068
2422
  "project",
2069
2423
  "resolve"
2070
2424
  ],
2071
- schemes: ["UserApiKeyAuth"]
2425
+ schemes: ["UserApiKeyAuth"],
2426
+ requiredHeaders: ["x-user-api-key", "x-org-id"]
2072
2427
  },
2073
2428
  {
2074
2429
  method: "post",
@@ -2155,8 +2510,7 @@ const GENERATED_OPERATIONS = [
2155
2510
  "toolRouter",
2156
2511
  "session",
2157
2512
  "execute"
2158
- ],
2159
- schemes: ["ApiKeyAuth", "workbench_access_key"]
2513
+ ]
2160
2514
  },
2161
2515
  {
2162
2516
  method: "post",
@@ -2308,4 +2662,4 @@ const generatedOperation = (chainKey) => {
2308
2662
  };
2309
2663
 
2310
2664
  //#endregion
2311
- export { path as a, withOperation as c, inspectDeprecation as d, assertCredentialTransport as f, makeRequest as i, VERSION as l, mergeHeaders as m, generatedOperation as n, readOperation as o, parseHTTPURL as p, castToError as r, safeJSON as s, GENERATED_OPERATIONS as t, inspectDeprecatedInputs as u };
2665
+ 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 };