@composio/client 2.0.0-rc.2 → 2.0.0-rc.21

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 (507) hide show
  1. package/README.md +629 -9
  2. package/dist/{client-D5v0_f-k.d.mts → api-key-revocation-BB3FTdR3.d.mts} +5686 -2238
  3. package/dist/effect/schemas/api-key-revocation/create.d.mts +8 -0
  4. package/dist/effect/schemas/api-key-revocation/create.mjs +8 -0
  5. package/dist/effect/schemas/auth/session/retrieve-info.d.mts +56 -0
  6. package/dist/effect/schemas/auth/session/retrieve-info.mjs +174 -0
  7. package/dist/effect/schemas/auth-configs/create.d.mts +16 -0
  8. package/dist/effect/schemas/auth-configs/create.mjs +22 -0
  9. package/dist/effect/schemas/auth-configs/delete.d.mts +10 -0
  10. package/dist/effect/schemas/auth-configs/delete.mjs +15 -0
  11. package/dist/effect/schemas/auth-configs/list.d.mts +54 -0
  12. package/dist/effect/schemas/auth-configs/list.mjs +66 -0
  13. package/dist/effect/schemas/auth-configs/retrieve.d.mts +48 -0
  14. package/dist/effect/schemas/auth-configs/retrieve.mjs +60 -0
  15. package/dist/effect/schemas/auth-configs/update-status.d.mts +9 -0
  16. package/dist/effect/schemas/auth-configs/update-status.mjs +11 -0
  17. package/dist/effect/schemas/auth-configs/update.d.mts +9 -0
  18. package/dist/effect/schemas/auth-configs/update.mjs +11 -0
  19. package/dist/effect/schemas/cli/create-codact-failure.d.mts +9 -0
  20. package/dist/effect/schemas/cli/create-codact-failure.mjs +17 -0
  21. package/dist/effect/schemas/cli/create-session.d.mts +12 -0
  22. package/dist/effect/schemas/cli/create-session.mjs +26 -0
  23. package/dist/effect/schemas/cli/get-session.d.mts +18 -0
  24. package/dist/effect/schemas/cli/get-session.mjs +48 -0
  25. package/dist/effect/schemas/cli/realtime/auth.d.mts +9 -0
  26. package/dist/effect/schemas/cli/realtime/auth.mjs +11 -0
  27. package/dist/effect/schemas/cli/realtime/credentials.d.mts +10 -0
  28. package/dist/effect/schemas/cli/realtime/credentials.mjs +12 -0
  29. package/dist/effect/schemas/components/auth-config-retrieve-response-expected-input-fields.d.mts +17 -0
  30. package/dist/effect/schemas/components/auth-config-retrieve-response-expected-input-fields.mjs +22 -0
  31. package/dist/effect/schemas/components/auth-config-retrieve-response-tool-access-config.d.mts +9 -0
  32. package/dist/effect/schemas/components/auth-config-retrieve-response-tool-access-config.mjs +20 -0
  33. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option1.d.mts +31 -0
  34. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option1.mjs +33 -0
  35. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option4.d.mts +33 -0
  36. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option4.mjs +35 -0
  37. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option5.d.mts +32 -0
  38. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1-val-option5.mjs +34 -0
  39. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1.d.mts +179 -0
  40. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option1.mjs +113 -0
  41. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option10.d.mts +168 -0
  42. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option10.mjs +104 -0
  43. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option11.d.mts +140 -0
  44. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option11.mjs +76 -0
  45. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option12.d.mts +162 -0
  46. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option12.mjs +12 -0
  47. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option13.d.mts +202 -0
  48. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option13.mjs +130 -0
  49. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option14.d.mts +193 -0
  50. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option14.mjs +211 -0
  51. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option15.d.mts +176 -0
  52. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option15.mjs +86 -0
  53. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option1.d.mts +33 -0
  54. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option1.mjs +35 -0
  55. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option5.d.mts +35 -0
  56. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option5.mjs +37 -0
  57. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option6.d.mts +34 -0
  58. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2-val-option6.mjs +36 -0
  59. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2.d.mts +231 -0
  60. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option2.mjs +160 -0
  61. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option2.d.mts +31 -0
  62. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option2.mjs +33 -0
  63. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option6.d.mts +31 -0
  64. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3-val-option6.mjs +33 -0
  65. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3.d.mts +171 -0
  66. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option3.mjs +108 -0
  67. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option4.d.mts +139 -0
  68. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option4.mjs +74 -0
  69. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option5.d.mts +136 -0
  70. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option5.mjs +72 -0
  71. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option6.d.mts +139 -0
  72. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option6.mjs +98 -0
  73. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7-val.d.mts +159 -0
  74. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7-val.mjs +69 -0
  75. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7.d.mts +162 -0
  76. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option7.mjs +12 -0
  77. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option8.d.mts +162 -0
  78. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option8.mjs +12 -0
  79. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option9.d.mts +167 -0
  80. package/dist/effect/schemas/components/connected-account-create-response-connection-data-option9.mjs +101 -0
  81. package/dist/effect/schemas/components/connected-account-retrieve-response-state.d.mts +2443 -0
  82. package/dist/effect/schemas/components/connected-account-retrieve-response-state.mjs +42 -0
  83. package/dist/effect/schemas/components/deprecated-toolkit-info.d.mts +8 -0
  84. package/dist/effect/schemas/components/deprecated-toolkit-info.mjs +12 -0
  85. package/dist/effect/schemas/components/execute-completed.d.mts +16 -0
  86. package/dist/effect/schemas/components/execute-completed.mjs +27 -0
  87. package/dist/effect/schemas/components/execute-failed.d.mts +16 -0
  88. package/dist/effect/schemas/components/execute-failed.mjs +27 -0
  89. package/dist/effect/schemas/components/execute-requires-user-input.d.mts +15 -0
  90. package/dist/effect/schemas/components/execute-requires-user-input.mjs +16 -0
  91. package/dist/effect/schemas/components/instant-account.d.mts +12 -0
  92. package/dist/effect/schemas/components/instant-account.mjs +15 -0
  93. package/dist/effect/schemas/components/mcp-create-response-commands.d.mts +10 -0
  94. package/dist/effect/schemas/components/mcp-create-response-commands.mjs +24 -0
  95. package/dist/effect/schemas/components/mcp-list-response-items.d.mts +23 -0
  96. package/dist/effect/schemas/components/mcp-list-response-items.mjs +96 -0
  97. package/dist/effect/schemas/components/project-list-response-data.d.mts +21 -0
  98. package/dist/effect/schemas/components/project-list-response-data.mjs +74 -0
  99. package/dist/effect/schemas/components/proxy-execute-completed.d.mts +17 -0
  100. package/dist/effect/schemas/components/proxy-execute-completed.mjs +36 -0
  101. package/dist/effect/schemas/components/session-create-response-config.d.mts +84 -0
  102. package/dist/effect/schemas/components/session-create-response-config.mjs +143 -0
  103. package/dist/effect/schemas/components/session-create-response-experimental-custom-toolkits.d.mts +20 -0
  104. package/dist/effect/schemas/components/session-create-response-experimental-custom-toolkits.mjs +25 -0
  105. package/dist/effect/schemas/components/session-create-response-warnings.d.mts +9 -0
  106. package/dist/effect/schemas/components/session-create-response-warnings.mjs +25 -0
  107. package/dist/effect/schemas/components/session-link-response-experimental.d.mts +13 -0
  108. package/dist/effect/schemas/components/session-link-response-experimental.mjs +18 -0
  109. package/dist/effect/schemas/components/session-retrieve-response-experimental.d.mts +37 -0
  110. package/dist/effect/schemas/components/session-retrieve-response-experimental.mjs +27 -0
  111. package/dist/effect/schemas/components/tool-details.d.mts +51 -0
  112. package/dist/effect/schemas/components/tool-details.mjs +144 -0
  113. package/dist/effect/schemas/components/tool-pricing.d.mts +9 -0
  114. package/dist/effect/schemas/components/tool-pricing.mjs +14 -0
  115. package/dist/effect/schemas/components/tool-router-session-v31-config-history-list-response.d.mts +95 -0
  116. package/dist/effect/schemas/components/tool-router-session-v31-config-history-list-response.mjs +154 -0
  117. package/dist/effect/schemas/components/tool-router-toolkits-list-response.d.mts +34 -0
  118. package/dist/effect/schemas/components/tool-router-toolkits-list-response.mjs +45 -0
  119. package/dist/effect/schemas/components/tool.d.mts +51 -0
  120. package/dist/effect/schemas/components/tool.mjs +144 -0
  121. package/dist/effect/schemas/components/toolkit-list-response-items.d.mts +36 -0
  122. package/dist/effect/schemas/components/toolkit-list-response-items.mjs +101 -0
  123. package/dist/effect/schemas/components/tools-paginated.d.mts +57 -0
  124. package/dist/effect/schemas/components/tools-paginated.mjs +15 -0
  125. package/dist/effect/schemas/components/trigger-retrieve-response-log.d.mts +31 -0
  126. package/dist/effect/schemas/components/trigger-retrieve-response-log.mjs +39 -0
  127. package/dist/effect/schemas/components/user-input-request.d.mts +11 -0
  128. package/dist/effect/schemas/components/user-input-request.mjs +19 -0
  129. package/dist/effect/schemas/connected-accounts/complete-auth.d.mts +9 -0
  130. package/dist/effect/schemas/connected-accounts/complete-auth.mjs +11 -0
  131. package/dist/effect/schemas/connected-accounts/create.d.mts +2457 -0
  132. package/dist/effect/schemas/connected-accounts/create.mjs +58 -0
  133. package/dist/effect/schemas/connected-accounts/delete.d.mts +9 -0
  134. package/dist/effect/schemas/connected-accounts/delete.mjs +17 -0
  135. package/dist/effect/schemas/connected-accounts/list.d.mts +2480 -0
  136. package/dist/effect/schemas/connected-accounts/list.mjs +84 -0
  137. package/dist/effect/schemas/connected-accounts/patch.d.mts +10 -0
  138. package/dist/effect/schemas/connected-accounts/patch.mjs +19 -0
  139. package/dist/effect/schemas/connected-accounts/refresh.d.mts +10 -0
  140. package/dist/effect/schemas/connected-accounts/refresh.mjs +27 -0
  141. package/dist/effect/schemas/connected-accounts/retrieve.d.mts +2477 -0
  142. package/dist/effect/schemas/connected-accounts/retrieve.mjs +81 -0
  143. package/dist/effect/schemas/connected-accounts/revoke.d.mts +12 -0
  144. package/dist/effect/schemas/connected-accounts/revoke.mjs +35 -0
  145. package/dist/effect/schemas/connected-accounts/update-status.d.mts +8 -0
  146. package/dist/effect/schemas/connected-accounts/update-status.mjs +11 -0
  147. package/dist/effect/schemas/custom/delete-toolkit.d.mts +12 -0
  148. package/dist/effect/schemas/custom/delete-toolkit.mjs +17 -0
  149. package/dist/effect/schemas/custom/sync.d.mts +10 -0
  150. package/dist/effect/schemas/custom/sync.mjs +21 -0
  151. package/dist/effect/schemas/custom/upsert.d.mts +8 -0
  152. package/dist/effect/schemas/custom/upsert.mjs +11 -0
  153. package/dist/effect/schemas/files/create-presigned-url.d.mts +15 -0
  154. package/dist/effect/schemas/files/create-presigned-url.mjs +15 -0
  155. package/dist/effect/schemas/files/list.d.mts +18 -0
  156. package/dist/effect/schemas/files/list.mjs +20 -0
  157. package/dist/effect/schemas/keyring/list-transfer-keys.d.mts +17 -0
  158. package/dist/effect/schemas/keyring/list-transfer-keys.mjs +19 -0
  159. package/dist/effect/schemas/link/create.d.mts +19 -0
  160. package/dist/effect/schemas/link/create.mjs +18 -0
  161. package/dist/effect/schemas/logs/create-tool-execution.d.mts +25 -0
  162. package/dist/effect/schemas/logs/create-tool-execution.mjs +39 -0
  163. package/dist/effect/schemas/logs/retrieve-tool-execution.d.mts +37 -0
  164. package/dist/effect/schemas/logs/retrieve-tool-execution.mjs +51 -0
  165. package/dist/effect/schemas/logs/tools/list-fields.d.mts +13 -0
  166. package/dist/effect/schemas/logs/tools/list-fields.mjs +13 -0
  167. package/dist/effect/schemas/logs/tools/list.d.mts +28 -0
  168. package/dist/effect/schemas/logs/tools/list.mjs +33 -0
  169. package/dist/effect/schemas/logs/tools/retrieve.d.mts +60 -0
  170. package/dist/effect/schemas/logs/tools/retrieve.mjs +74 -0
  171. package/dist/effect/schemas/logs/triggers/list.d.mts +34 -0
  172. package/dist/effect/schemas/logs/triggers/list.mjs +12 -0
  173. package/dist/effect/schemas/logs/triggers/retrieve.d.mts +33 -0
  174. package/dist/effect/schemas/logs/triggers/retrieve.mjs +9 -0
  175. package/dist/effect/schemas/mcp/create-instance.d.mts +12 -0
  176. package/dist/effect/schemas/mcp/create-instance.mjs +29 -0
  177. package/dist/effect/schemas/mcp/create.d.mts +23 -0
  178. package/dist/effect/schemas/mcp/create.mjs +67 -0
  179. package/dist/effect/schemas/mcp/custom/create.d.mts +17 -0
  180. package/dist/effect/schemas/mcp/custom/create.mjs +48 -0
  181. package/dist/effect/schemas/mcp/delete-instance.d.mts +9 -0
  182. package/dist/effect/schemas/mcp/delete-instance.mjs +11 -0
  183. package/dist/effect/schemas/mcp/delete.d.mts +9 -0
  184. package/dist/effect/schemas/mcp/delete.mjs +17 -0
  185. package/dist/effect/schemas/mcp/generate/url.d.mts +10 -0
  186. package/dist/effect/schemas/mcp/generate/url.mjs +21 -0
  187. package/dist/effect/schemas/mcp/list-instances.d.mts +18 -0
  188. package/dist/effect/schemas/mcp/list-instances.mjs +56 -0
  189. package/dist/effect/schemas/mcp/list.d.mts +27 -0
  190. package/dist/effect/schemas/mcp/list.mjs +19 -0
  191. package/dist/effect/schemas/mcp/retrieve-app.d.mts +27 -0
  192. package/dist/effect/schemas/mcp/retrieve-app.mjs +19 -0
  193. package/dist/effect/schemas/mcp/retrieve.d.mts +24 -0
  194. package/dist/effect/schemas/mcp/retrieve.mjs +68 -0
  195. package/dist/effect/schemas/mcp/update.d.mts +24 -0
  196. package/dist/effect/schemas/mcp/update.mjs +68 -0
  197. package/dist/effect/schemas/org/clanker/create-claim.d.mts +9 -0
  198. package/dist/effect/schemas/org/clanker/create-claim.mjs +14 -0
  199. package/dist/effect/schemas/org/consumer/list-connected-toolkits.d.mts +8 -0
  200. package/dist/effect/schemas/org/consumer/list-connected-toolkits.mjs +8 -0
  201. package/dist/effect/schemas/org/consumer/project/resolve.d.mts +19 -0
  202. package/dist/effect/schemas/org/consumer/project/resolve.mjs +30 -0
  203. package/dist/effect/schemas/org/list.d.mts +17 -0
  204. package/dist/effect/schemas/org/list.mjs +22 -0
  205. package/dist/effect/schemas/org/owner/project/create.d.mts +10 -0
  206. package/dist/effect/schemas/org/owner/project/create.mjs +22 -0
  207. package/dist/effect/schemas/org/owner/project/delete.d.mts +9 -0
  208. package/dist/effect/schemas/org/owner/project/delete.mjs +17 -0
  209. package/dist/effect/schemas/org/owner/project/list.d.mts +27 -0
  210. package/dist/effect/schemas/org/owner/project/list.mjs +15 -0
  211. package/dist/effect/schemas/org/owner/project/regenerate-api-key.d.mts +14 -0
  212. package/dist/effect/schemas/org/owner/project/regenerate-api-key.mjs +31 -0
  213. package/dist/effect/schemas/org/owner/project/retrieve.d.mts +27 -0
  214. package/dist/effect/schemas/org/owner/project/retrieve.mjs +93 -0
  215. package/dist/effect/schemas/org/project/list.d.mts +27 -0
  216. package/dist/effect/schemas/org/project/list.mjs +15 -0
  217. package/dist/effect/schemas/org/usage/retrieve-summary.d.mts +13 -0
  218. package/dist/effect/schemas/org/usage/retrieve-summary.mjs +15 -0
  219. package/dist/effect/schemas/org/usage/retrieve.d.mts +16 -0
  220. package/dist/effect/schemas/org/usage/retrieve.mjs +18 -0
  221. package/dist/effect/schemas/project/usage/retrieve-summary.d.mts +13 -0
  222. package/dist/effect/schemas/project/usage/retrieve-summary.mjs +15 -0
  223. package/dist/effect/schemas/project/usage/retrieve.d.mts +16 -0
  224. package/dist/effect/schemas/project/usage/retrieve.mjs +18 -0
  225. package/dist/effect/schemas/session-configs/list.d.mts +15 -0
  226. package/dist/effect/schemas/session-configs/list.mjs +26 -0
  227. package/dist/effect/schemas/session-configs/retrieve.d.mts +34 -0
  228. package/dist/effect/schemas/session-configs/retrieve.mjs +67 -0
  229. package/dist/effect/schemas/tool-router/session/attach.d.mts +129 -0
  230. package/dist/effect/schemas/tool-router/session/attach.mjs +30 -0
  231. package/dist/effect/schemas/tool-router/session/config-history.d.mts +94 -0
  232. package/dist/effect/schemas/tool-router/session/config-history.mjs +8 -0
  233. package/dist/effect/schemas/tool-router/session/create.d.mts +129 -0
  234. package/dist/effect/schemas/tool-router/session/create.mjs +45 -0
  235. package/dist/effect/schemas/tool-router/session/delete.d.mts +9 -0
  236. package/dist/effect/schemas/tool-router/session/delete.mjs +18 -0
  237. package/dist/effect/schemas/tool-router/session/execute-meta.d.mts +35 -0
  238. package/dist/effect/schemas/tool-router/session/execute-meta.mjs +15 -0
  239. package/dist/effect/schemas/tool-router/session/execute.d.mts +35 -0
  240. package/dist/effect/schemas/tool-router/session/execute.mjs +15 -0
  241. package/dist/effect/schemas/tool-router/session/files/create-download-url.d.mts +11 -0
  242. package/dist/effect/schemas/tool-router/session/files/create-download-url.mjs +13 -0
  243. package/dist/effect/schemas/tool-router/session/files/create-upload-url.d.mts +11 -0
  244. package/dist/effect/schemas/tool-router/session/files/create-upload-url.mjs +13 -0
  245. package/dist/effect/schemas/tool-router/session/files/delete.d.mts +9 -0
  246. package/dist/effect/schemas/tool-router/session/files/delete.mjs +11 -0
  247. package/dist/effect/schemas/tool-router/session/files/list.d.mts +14 -0
  248. package/dist/effect/schemas/tool-router/session/files/list.mjs +16 -0
  249. package/dist/effect/schemas/tool-router/session/link.d.mts +18 -0
  250. package/dist/effect/schemas/tool-router/session/link.mjs +25 -0
  251. package/dist/effect/schemas/tool-router/session/patch.d.mts +129 -0
  252. package/dist/effect/schemas/tool-router/session/patch.mjs +30 -0
  253. package/dist/effect/schemas/tool-router/session/proxy-execute.d.mts +26 -0
  254. package/dist/effect/schemas/tool-router/session/proxy-execute.mjs +10 -0
  255. package/dist/effect/schemas/tool-router/session/retrieve.d.mts +129 -0
  256. package/dist/effect/schemas/tool-router/session/retrieve.mjs +30 -0
  257. package/dist/effect/schemas/tool-router/session/search.d.mts +80 -0
  258. package/dist/effect/schemas/tool-router/session/search.mjs +78 -0
  259. package/dist/effect/schemas/tool-router/session/toolkits.d.mts +33 -0
  260. package/dist/effect/schemas/tool-router/session/toolkits.mjs +8 -0
  261. package/dist/effect/schemas/tool-router/session/tools.d.mts +56 -0
  262. package/dist/effect/schemas/tool-router/session/tools.mjs +8 -0
  263. package/dist/effect/schemas/toolkits/list.d.mts +42 -0
  264. package/dist/effect/schemas/toolkits/list.mjs +15 -0
  265. package/dist/effect/schemas/toolkits/recommend-scopes.d.mts +19 -0
  266. package/dist/effect/schemas/toolkits/recommend-scopes.mjs +21 -0
  267. package/dist/effect/schemas/toolkits/retrieve-categories.d.mts +15 -0
  268. package/dist/effect/schemas/toolkits/retrieve-categories.mjs +23 -0
  269. package/dist/effect/schemas/toolkits/retrieve-changelog.d.mts +16 -0
  270. package/dist/effect/schemas/toolkits/retrieve-changelog.mjs +16 -0
  271. package/dist/effect/schemas/toolkits/retrieve-multi.d.mts +42 -0
  272. package/dist/effect/schemas/toolkits/retrieve-multi.mjs +15 -0
  273. package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.d.mts +15 -0
  274. package/dist/effect/schemas/toolkits/retrieve-scopes-grant-context.mjs +17 -0
  275. package/dist/effect/schemas/toolkits/retrieve.d.mts +110 -0
  276. package/dist/effect/schemas/toolkits/retrieve.mjs +202 -0
  277. package/dist/effect/schemas/tools/execute.d.mts +12 -0
  278. package/dist/effect/schemas/tools/execute.mjs +35 -0
  279. package/dist/effect/schemas/tools/get-input.d.mts +9 -0
  280. package/dist/effect/schemas/tools/get-input.mjs +22 -0
  281. package/dist/effect/schemas/tools/list.d.mts +56 -0
  282. package/dist/effect/schemas/tools/list.mjs +8 -0
  283. package/dist/effect/schemas/tools/proxy.d.mts +16 -0
  284. package/dist/effect/schemas/tools/proxy.mjs +36 -0
  285. package/dist/effect/schemas/tools/retrieve-enum.d.mts +6 -0
  286. package/dist/effect/schemas/tools/retrieve-enum.mjs +8 -0
  287. package/dist/effect/schemas/tools/retrieve-required-scopes.d.mts +22 -0
  288. package/dist/effect/schemas/tools/retrieve-required-scopes.mjs +33 -0
  289. package/dist/effect/schemas/tools/retrieve.d.mts +50 -0
  290. package/dist/effect/schemas/tools/retrieve.mjs +8 -0
  291. package/dist/effect/schemas/trigger-instances/list-active.d.mts +34 -0
  292. package/dist/effect/schemas/trigger-instances/list-active.mjs +37 -0
  293. package/dist/effect/schemas/trigger-instances/manage/delete.d.mts +8 -0
  294. package/dist/effect/schemas/trigger-instances/manage/delete.mjs +11 -0
  295. package/dist/effect/schemas/trigger-instances/manage/update.d.mts +8 -0
  296. package/dist/effect/schemas/trigger-instances/manage/update.mjs +8 -0
  297. package/dist/effect/schemas/trigger-instances/upsert.d.mts +8 -0
  298. package/dist/effect/schemas/trigger-instances/upsert.mjs +8 -0
  299. package/dist/effect/schemas/triggers-types/list.d.mts +27 -0
  300. package/dist/effect/schemas/triggers-types/list.mjs +86 -0
  301. package/dist/effect/schemas/triggers-types/retrieve-enum.d.mts +6 -0
  302. package/dist/effect/schemas/triggers-types/retrieve-enum.mjs +8 -0
  303. package/dist/effect/schemas/triggers-types/retrieve.d.mts +21 -0
  304. package/dist/effect/schemas/triggers-types/retrieve.mjs +80 -0
  305. package/dist/effect/schemas/webhook-endpoints/create.d.mts +13 -0
  306. package/dist/effect/schemas/webhook-endpoints/create.mjs +15 -0
  307. package/dist/effect/schemas/webhook-endpoints/list.d.mts +12 -0
  308. package/dist/effect/schemas/webhook-endpoints/list.mjs +12 -0
  309. package/dist/effect/schemas/webhook-endpoints/replace.d.mts +13 -0
  310. package/dist/effect/schemas/webhook-endpoints/replace.mjs +15 -0
  311. package/dist/effect/schemas/webhook-endpoints/retrieve.d.mts +13 -0
  312. package/dist/effect/schemas/webhook-endpoints/retrieve.mjs +15 -0
  313. package/dist/effect/schemas/webhook-endpoints/update.d.mts +13 -0
  314. package/dist/effect/schemas/webhook-endpoints/update.mjs +15 -0
  315. package/dist/effect/schemas/webhook-subscriptions/create.d.mts +14 -0
  316. package/dist/effect/schemas/webhook-subscriptions/create.mjs +23 -0
  317. package/dist/effect/schemas/webhook-subscriptions/delete.d.mts +8 -0
  318. package/dist/effect/schemas/webhook-subscriptions/delete.mjs +8 -0
  319. package/dist/effect/schemas/webhook-subscriptions/list-event-types.d.mts +12 -0
  320. package/dist/effect/schemas/webhook-subscriptions/list-event-types.mjs +16 -0
  321. package/dist/effect/schemas/webhook-subscriptions/list.d.mts +20 -0
  322. package/dist/effect/schemas/webhook-subscriptions/list.mjs +29 -0
  323. package/dist/effect/schemas/webhook-subscriptions/retrieve.d.mts +14 -0
  324. package/dist/effect/schemas/webhook-subscriptions/retrieve.mjs +23 -0
  325. package/dist/effect/schemas/webhook-subscriptions/rotate-secret.d.mts +9 -0
  326. package/dist/effect/schemas/webhook-subscriptions/rotate-secret.mjs +14 -0
  327. package/dist/effect/schemas/webhook-subscriptions/update.d.mts +14 -0
  328. package/dist/effect/schemas/webhook-subscriptions/update.mjs +23 -0
  329. package/dist/effect/schemas.d.mts +9645 -0
  330. package/dist/effect/schemas.mjs +131 -0
  331. package/dist/effect.d.mts +756 -0
  332. package/dist/effect.mjs +1626 -0
  333. package/dist/environments-BXSnADKo.d.mts +19 -0
  334. package/dist/environments-CmxYUUsW.mjs +222 -0
  335. package/dist/error-Bw7_G2NZ.mjs +117 -0
  336. package/dist/{request-zLX87M09.mjs → generated-operations-BNRn8az6.mjs} +1493 -307
  337. package/dist/index.d.mts +3 -5
  338. package/dist/index.mjs +157 -1098
  339. package/dist/pagination-rules-CMnBwktJ.mjs +36 -0
  340. package/dist/pagination.d.mts +56 -0
  341. package/dist/pagination.mjs +46 -0
  342. package/dist/resources/api-key-revocation.d.mts +2 -2
  343. package/dist/resources/api-key-revocation.mjs +13 -2
  344. package/dist/resources/auth/auth.d.mts +2 -2
  345. package/dist/resources/auth/auth.mjs +7 -2
  346. package/dist/resources/auth/session.d.mts +2 -2
  347. package/dist/resources/auth/session.mjs +10 -2
  348. package/dist/resources/auth-configs.d.mts +2 -2
  349. package/dist/resources/auth-configs.mjs +45 -2
  350. package/dist/resources/auth.d.mts +2 -2
  351. package/dist/resources/auth.mjs +1 -5
  352. package/dist/resources/cli/cli.d.mts +2 -2
  353. package/dist/resources/cli/cli.mjs +32 -2
  354. package/dist/resources/cli/realtime.d.mts +2 -2
  355. package/dist/resources/cli/realtime.mjs +19 -2
  356. package/dist/resources/cli.d.mts +2 -2
  357. package/dist/resources/cli.mjs +1 -5
  358. package/dist/resources/connected-accounts.d.mts +2 -2
  359. package/dist/resources/connected-accounts.mjs +70 -2
  360. package/dist/resources/custom.d.mts +2 -0
  361. package/dist/resources/custom.mjs +30 -0
  362. package/dist/resources/files.d.mts +2 -2
  363. package/dist/resources/files.mjs +22 -2
  364. package/dist/resources/keyring.d.mts +2 -0
  365. package/dist/resources/keyring.mjs +11 -0
  366. package/dist/resources/link.d.mts +2 -2
  367. package/dist/resources/link.mjs +13 -2
  368. package/dist/resources/logs/logs.d.mts +2 -2
  369. package/dist/resources/logs/logs.mjs +23 -2
  370. package/dist/resources/logs/tools.d.mts +2 -2
  371. package/dist/resources/logs/tools.mjs +23 -2
  372. package/dist/resources/logs/triggers.d.mts +2 -2
  373. package/dist/resources/logs/triggers.mjs +19 -2
  374. package/dist/resources/logs.d.mts +2 -2
  375. package/dist/resources/logs.mjs +1 -6
  376. package/dist/resources/mcp/custom.d.mts +2 -2
  377. package/dist/resources/mcp/custom.mjs +13 -2
  378. package/dist/resources/mcp/generate.d.mts +2 -2
  379. package/dist/resources/mcp/generate.mjs +13 -2
  380. package/dist/resources/mcp/mcp.d.mts +2 -2
  381. package/dist/resources/mcp/mcp.mjs +67 -2
  382. package/dist/resources/mcp.d.mts +2 -2
  383. package/dist/resources/mcp.mjs +1 -6
  384. package/dist/resources/org/clanker.d.mts +2 -2
  385. package/dist/resources/org/clanker.mjs +13 -2
  386. package/dist/resources/org/consumer/consumer.d.mts +2 -2
  387. package/dist/resources/org/consumer/consumer.mjs +21 -2
  388. package/dist/resources/org/consumer/project.d.mts +2 -2
  389. package/dist/resources/org/consumer/project.mjs +14 -2
  390. package/dist/resources/org/consumer.d.mts +2 -2
  391. package/dist/resources/org/consumer.mjs +1 -5
  392. package/dist/resources/org/org.d.mts +2 -2
  393. package/dist/resources/org/org.mjs +25 -2
  394. package/dist/resources/org/owner/owner.d.mts +2 -2
  395. package/dist/resources/org/owner/owner.mjs +7 -2
  396. package/dist/resources/org/owner/project.d.mts +2 -2
  397. package/dist/resources/org/owner/project.mjs +37 -2
  398. package/dist/resources/org/owner.d.mts +2 -2
  399. package/dist/resources/org/owner.mjs +1 -5
  400. package/dist/resources/org/project.d.mts +2 -2
  401. package/dist/resources/org/project.mjs +13 -2
  402. package/dist/resources/org/usage.d.mts +2 -2
  403. package/dist/resources/org/usage.mjs +22 -2
  404. package/dist/resources/org.d.mts +2 -2
  405. package/dist/resources/org.mjs +1 -9
  406. package/dist/resources/project/project.d.mts +2 -2
  407. package/dist/resources/project/project.mjs +7 -2
  408. package/dist/resources/project/usage.d.mts +2 -2
  409. package/dist/resources/project/usage.mjs +22 -2
  410. package/dist/resources/project.d.mts +2 -3
  411. package/dist/resources/project.mjs +1 -5
  412. package/dist/resources/session-configs.d.mts +2 -0
  413. package/dist/resources/session-configs.mjs +20 -0
  414. package/dist/resources/tool-router/session/files.d.mts +2 -2
  415. package/dist/resources/tool-router/session/files.mjs +40 -2
  416. package/dist/resources/tool-router/session/session.d.mts +2 -2
  417. package/dist/resources/tool-router/session/session.mjs +95 -2
  418. package/dist/resources/tool-router/session.d.mts +2 -2
  419. package/dist/resources/tool-router/session.mjs +1 -5
  420. package/dist/resources/tool-router/tool-router.d.mts +2 -2
  421. package/dist/resources/tool-router/tool-router.mjs +7 -2
  422. package/dist/resources/tool-router.d.mts +2 -2
  423. package/dist/resources/tool-router.mjs +1 -5
  424. package/dist/resources/toolkits.d.mts +2 -2
  425. package/dist/resources/toolkits.mjs +51 -2
  426. package/dist/resources/tools.d.mts +2 -2
  427. package/dist/resources/tools.mjs +56 -2
  428. package/dist/resources/trigger-instances/manage.d.mts +2 -2
  429. package/dist/resources/trigger-instances/manage.mjs +19 -2
  430. package/dist/resources/trigger-instances/trigger-instances.d.mts +2 -2
  431. package/dist/resources/trigger-instances/trigger-instances.mjs +24 -2
  432. package/dist/resources/trigger-instances.d.mts +2 -2
  433. package/dist/resources/trigger-instances.mjs +1 -5
  434. package/dist/resources/triggers-types.d.mts +2 -2
  435. package/dist/resources/triggers-types.mjs +26 -2
  436. package/dist/resources/webhook-endpoints.d.mts +2 -2
  437. package/dist/resources/webhook-endpoints.mjs +40 -2
  438. package/dist/resources/webhook-subscriptions.d.mts +2 -2
  439. package/dist/resources/webhook-subscriptions.mjs +45 -2
  440. package/package.json +35 -27
  441. package/dist/api-key-revocation-BqiqlJh6.mjs +0 -24
  442. package/dist/auth-ClFXmN5T.mjs +0 -17
  443. package/dist/auth-configs-COkEdwlP.mjs +0 -48
  444. package/dist/clanker-1ptspWLR.mjs +0 -23
  445. package/dist/cli-BWTXVRT4.mjs +0 -42
  446. package/dist/config-BLBbhLe1.mjs +0 -10
  447. package/dist/config-DnyMhILW.d.mts +0 -9
  448. package/dist/connected-accounts-DK24qYIM.mjs +0 -67
  449. package/dist/consumer-Do3lg_vI.mjs +0 -33
  450. package/dist/custom-CH7n4Dyd.mjs +0 -22
  451. package/dist/files-DoNtYu2Q.mjs +0 -29
  452. package/dist/files-lfGzAnJ_.mjs +0 -45
  453. package/dist/generate-B7ClqhN0.mjs +0 -22
  454. package/dist/link-NsFv9L3R.mjs +0 -22
  455. package/dist/logs-BhCTVSZE.mjs +0 -36
  456. package/dist/manage-7vQYn-gu.mjs +0 -26
  457. package/dist/mcp-r-SWyCDh.mjs +0 -73
  458. package/dist/migration-CBhnoN-Y.mjs +0 -10
  459. package/dist/migration-CKGKuRO3.d.mts +0 -9
  460. package/dist/org-C12wx9QM.mjs +0 -44
  461. package/dist/owner-D4ghEkrK.mjs +0 -17
  462. package/dist/project-By-OBe-4.mjs +0 -28
  463. package/dist/project-Cnr9eceg.mjs +0 -24
  464. package/dist/project-DgdqyoZJ.mjs +0 -22
  465. package/dist/project-DzrdSIis.mjs +0 -42
  466. package/dist/realtime-DHJnO2Ye.mjs +0 -26
  467. package/dist/resources/auth/index.d.mts +0 -2
  468. package/dist/resources/auth/index.mjs +0 -4
  469. package/dist/resources/cli/index.d.mts +0 -2
  470. package/dist/resources/cli/index.mjs +0 -4
  471. package/dist/resources/index.d.mts +0 -3
  472. package/dist/resources/index.mjs +0 -16
  473. package/dist/resources/logs/index.d.mts +0 -2
  474. package/dist/resources/logs/index.mjs +0 -5
  475. package/dist/resources/mcp/index.d.mts +0 -2
  476. package/dist/resources/mcp/index.mjs +0 -5
  477. package/dist/resources/migration.d.mts +0 -2
  478. package/dist/resources/migration.mjs +0 -3
  479. package/dist/resources/org/consumer/index.d.mts +0 -2
  480. package/dist/resources/org/consumer/index.mjs +0 -4
  481. package/dist/resources/org/index.d.mts +0 -2
  482. package/dist/resources/org/index.mjs +0 -8
  483. package/dist/resources/org/owner/index.d.mts +0 -2
  484. package/dist/resources/org/owner/index.mjs +0 -4
  485. package/dist/resources/project/config.d.mts +0 -2
  486. package/dist/resources/project/config.mjs +0 -3
  487. package/dist/resources/project/index.d.mts +0 -3
  488. package/dist/resources/project/index.mjs +0 -4
  489. package/dist/resources/tool-router/index.d.mts +0 -2
  490. package/dist/resources/tool-router/index.mjs +0 -4
  491. package/dist/resources/tool-router/session/index.d.mts +0 -2
  492. package/dist/resources/tool-router/session/index.mjs +0 -4
  493. package/dist/resources/trigger-instances/index.d.mts +0 -2
  494. package/dist/resources/trigger-instances/index.mjs +0 -4
  495. package/dist/session-Ci0MoTTn.mjs +0 -21
  496. package/dist/session-CmqSfXtq.mjs +0 -97
  497. package/dist/tool-router-DbmIxiU5.mjs +0 -14
  498. package/dist/toolkits-BUWB3p_C.mjs +0 -43
  499. package/dist/tools-B4kHPHbe.mjs +0 -30
  500. package/dist/tools-BO1wTIiE.mjs +0 -60
  501. package/dist/trigger-instances-CoEohjcv.mjs +0 -33
  502. package/dist/triggers-BwsETpsM.mjs +0 -26
  503. package/dist/triggers-types-DmOurxxx.mjs +0 -31
  504. package/dist/usage-BJsJ4nsd.mjs +0 -29
  505. package/dist/usage-D6ahTV_Y.mjs +0 -29
  506. package/dist/webhook-endpoints-CyWYVPMe.mjs +0 -46
  507. package/dist/webhook-subscriptions-BgnCTUGn.mjs +0 -48
@@ -1,145 +1,5 @@
1
- //#region src/compat/error.ts
2
- /**
3
- * Stainless-compatible error hierarchy.
4
- *
5
- * Downstream code does `instanceof` checks and reads `status` / `error` /
6
- * `headers` on these classes (see docs/research/drop-in-contract.md §4), so
7
- * both the class names and the inheritance chain are part of the drop-in
8
- * contract: `BadRequestError extends APIError extends ComposioError extends Error`.
9
- */
10
- var ComposioError = class extends Error {};
11
- var APIError = class APIError extends ComposioError {
12
- /** HTTP status for the response that caused the error. */
13
- status;
14
- /** HTTP headers of the response that caused the error. */
15
- headers;
16
- /** JSON body of the response that caused the error. */
17
- error;
18
- constructor(status, error, message, headers) {
19
- super(APIError.makeMessage(status, error, message));
20
- this.status = status;
21
- this.headers = headers;
22
- this.error = error;
23
- }
24
- static makeMessage(status, error, message) {
25
- const errorMessage = error?.message;
26
- const msg = errorMessage ? typeof errorMessage === "string" ? errorMessage : JSON.stringify(errorMessage) : error ? JSON.stringify(error) : message;
27
- if (status && msg) return `${status} ${msg}`;
28
- if (status) return `${status} status code (no body)`;
29
- if (msg) return msg;
30
- return "(no status code or body)";
31
- }
32
- static generate(status, errorResponse, message, headers) {
33
- if (!status || !headers) return new APIConnectionError({
34
- message,
35
- cause: errorResponse
36
- });
37
- const error = errorResponse;
38
- if (status === 400) return new BadRequestError(status, error, message, headers);
39
- if (status === 401) return new AuthenticationError(status, error, message, headers);
40
- if (status === 403) return new PermissionDeniedError(status, error, message, headers);
41
- if (status === 404) return new NotFoundError(status, error, message, headers);
42
- if (status === 409) return new ConflictError(status, error, message, headers);
43
- if (status === 422) return new UnprocessableEntityError(status, error, message, headers);
44
- if (status === 429) return new RateLimitError(status, error, message, headers);
45
- if (status >= 500) return new InternalServerError(status, error, message, headers);
46
- return new APIError(status, error, message, headers);
47
- }
48
- };
49
- var APIUserAbortError = class extends APIError {
50
- constructor({ message } = {}) {
51
- super(void 0, void 0, message ?? "Request was aborted.", void 0);
52
- }
53
- };
54
- var APIConnectionError = class extends APIError {
55
- constructor({ message, cause }) {
56
- super(void 0, void 0, message ?? "Connection error.", void 0);
57
- if (cause) this.cause = cause;
58
- }
59
- };
60
- var APIConnectionTimeoutError = class extends APIConnectionError {
61
- constructor({ message } = {}) {
62
- super({ message: message ?? "Request timed out." });
63
- }
64
- };
65
- var BadRequestError = class extends APIError {};
66
- var AuthenticationError = class extends APIError {};
67
- var PermissionDeniedError = class extends APIError {};
68
- var NotFoundError = class extends APIError {};
69
- var ConflictError = class extends APIError {};
70
- var UnprocessableEntityError = class extends APIError {};
71
- var RateLimitError = class extends APIError {};
72
- var InternalServerError = class extends APIError {};
73
-
74
- //#endregion
75
- //#region src/compat/headers.ts
76
- 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";
77
- const isHeaders = (value) => value instanceof Headers || hasEntries(value);
78
- const isNullableHeadersLike = (headers) => {
79
- if (!("values" in headers) || !isHeaders(headers.values) || !("nulls" in headers)) return false;
80
- const nulls = headers.nulls;
81
- return typeof nulls === "object" && nulls !== null && Symbol.iterator in nulls;
82
- };
83
- /**
84
- * Iterates every supported input while preserving explicit deletions. Plain
85
- * objects replace an older value for a key; tuple inputs append duplicate
86
- * values, matching the published client.
87
- */
88
- function* iterateHeaders(headers) {
89
- if (!headers) return;
90
- if (isNullableHeadersLike(headers)) {
91
- yield* headers.values.entries();
92
- for (const name of headers.nulls) yield [name, null];
93
- return;
94
- }
95
- const shouldReplace = !isHeaders(headers) && !Array.isArray(headers);
96
- const entries = isHeaders(headers) ? headers.entries() : Array.isArray(headers) ? headers : Object.entries(headers);
97
- for (const entry of entries) {
98
- const name = entry[0];
99
- if (typeof name !== "string") throw new TypeError("expected header name to be a string");
100
- const rawValue = entry[1];
101
- const values = Array.isArray(rawValue) ? rawValue : [rawValue];
102
- let replaced = false;
103
- for (const value of values) {
104
- if (value === void 0) continue;
105
- if (shouldReplace && !replaced) {
106
- replaced = true;
107
- yield [name, null];
108
- }
109
- yield [name, value];
110
- }
111
- }
112
- }
113
- /** Merge sources while retaining names explicitly deleted by the last source. */
114
- const mergeHeaders = (sources) => {
115
- const values = new Headers();
116
- const nulls = /* @__PURE__ */ new Set();
117
- for (const source of sources) {
118
- const seen = /* @__PURE__ */ new Set();
119
- for (const [name, value] of iterateHeaders(source)) {
120
- const lowerName = name.toLowerCase();
121
- if (!seen.has(lowerName)) {
122
- values.delete(name);
123
- seen.add(lowerName);
124
- }
125
- if (value === null) {
126
- values.delete(name);
127
- nulls.add(lowerName);
128
- } else {
129
- values.append(name, value);
130
- nulls.delete(lowerName);
131
- }
132
- }
133
- }
134
- return {
135
- values,
136
- nulls
137
- };
138
- };
139
- /** Merge sources into the native header collection sent to fetch. */
140
- const buildHeaders = (sources) => mergeHeaders(sources).values;
1
+ import { i as APIUserAbortError, n as APIConnectionTimeoutError, s as ComposioError, t as APIConnectionError } from "./error-Bw7_G2NZ.mjs";
141
2
 
142
- //#endregion
143
3
  //#region src/compat/credentials.ts
144
4
  /**
145
5
  * The credential transport boundary.
@@ -154,14 +14,15 @@ const buildHeaders = (sources) => mergeHeaders(sources).values;
154
14
  * measured property of the API (two credential headers on one request is a
155
15
  * 401, even where either alone is a 200), so the four rules below are all
156
16
  * stated about *the* credential a request carries, and {@link selectScheme}
157
- * decides which one that is. See wayfinder ticket 48 and §4 of
17
+ * decides which one that is. See §4 of
158
18
  * `docs/research/drop-in-contract.md`.
159
19
  * 1. **A credentialed API origin must use HTTPS.** Plain `http:` is permitted
160
- * only for loopback development endpoints — which is exactly what the
161
- * sanctioned `environment: 'local'` default (`http://localhost:9900`) is.
20
+ * only for loopback development endpoints, or for the exact origin a
21
+ * caller opts into with `allowInsecureHTTP` or
22
+ * `COMPOSIO_ALLOW_INSECURE_HTTP=1`.
162
23
  * Enforced by {@link assertCredentialTransport} at construction and again
163
- * by {@link credentialForRequest} at dispatch, because `apiKey` and
164
- * `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.
165
26
  * 2. **The credential is attached only to requests whose origin matches the
166
27
  * configured API origin.** {@link credentialForRequest} returns `null`
167
28
  * off-origin, and the header is simply not sent.
@@ -207,7 +68,7 @@ const buildHeaders = (sources) => mergeHeaders(sources).values;
207
68
  * Deliberate, and sanctioned by the design record: the published Stainless
208
69
  * client enforces none of this. Redirect *following* is no longer part of the
209
70
  * divergence — both clients follow — but what rides along on the hop is. See
210
- * §4 of `docs/research/drop-in-contract.md` and wayfinder ticket 40.
71
+ * §4 of `docs/research/drop-in-contract.md`.
211
72
  */
212
73
  /**
213
74
  * The three credential classes this API accepts, and the header each one puts
@@ -224,70 +85,25 @@ const SCHEME_HEADERS = {
224
85
  };
225
86
  /** The scheme a request authenticates with when its operation names none. */
226
87
  const DEFAULT_SCHEME = "ApiKeyAuth";
227
- const valueFor = (scheme, credentials) => scheme === "ApiKeyAuth" ? credentials.apiKey : scheme === "UserApiKeyAuth" ? credentials.userApiKey : credentials.orgApiKey;
228
88
  /**
229
- * Whether anything beyond the project key is configured — the condition that
230
- * makes per-operation selection able to change an outcome at all.
231
- *
232
- * Load-bearing rather than an optimization. With only `apiKey` set, every
233
- * branch of {@link selectScheme} lands on `ApiKeyAuth`: it wins wherever it is
234
- * an accepted alternative, and where it is not, the alternative is unconfigured
235
- * and the fallback is `ApiKeyAuth` again. So the client that every existing
236
- * caller constructs never consults the operation table, and "an `apiKey`-only
237
- * client emits byte-identical requests on all 104 operations" is a property of
238
- * the code shape rather than a claim tests have to keep re-establishing.
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.
239
95
  */
240
- const hasAlternateCredential = (credentials) => credentials.userApiKey !== null || credentials.orgApiKey !== null;
241
- /**
242
- * Which credential a request declaring `schemes` should carry.
243
- *
244
- * **Exactly one, always** — and the API says so itself. Measured against
245
- * production on 2026-08-06, `GET /toolkits` answers 200 for `x-api-key` alone
246
- * and 200 for `x-user-api-key` alone, and answers both together with
247
- * `401 HTTP_Unauthorized`:
248
- *
249
- * > Multiple authentication modes were provided. Provide exactly one
250
- * > authentication mode per request. Provided: ApiKeyAuth via x-api-key,
251
- * > UserApiKeyAuth via x-user-api-key.
252
- *
253
- * The platform names the schemes by their OpenAPI names, so this is the same
254
- * vocabulary `security` is written in rather than a coincidence of headers. It
255
- * holds for `x-api-key` + `x-org-api-key` too, and on an operation that accepts
256
- * only one of them. There is therefore no additive "send the user key as well"
257
- * model available, and the choice has to be made per request rather than
258
- * accumulated.
259
- *
260
- * The precedence exists to make the change free where it must be free:
261
- *
262
- * 1. **`ApiKeyAuth` wins wherever the operation accepts it** and an `apiKey` is
263
- * configured — 85 of the 104 operations, every wire byte preserved.
264
- * 2. Otherwise the first scheme the operation names that this client both
265
- * recognizes *and* holds a credential for. That is what makes the 16
266
- * `UserApiKeyAuth`-only and `OrgApiKeyAuth`-only operations reachable.
267
- * 3. Otherwise `ApiKeyAuth`, which is what this client did before any of this
268
- * existed. A `UserApiKeyAuth`-only operation called by a client with no user
269
- * key still sends `x-api-key` and still fails the same way — which is what
270
- * keeps `cli.realtime.auth` and `cli.realtime.credentials` pinned against
271
- * the Stainless oracle in `test/unit/differential-wire.test.ts`.
272
- *
273
- * Rule 3 is also where a scheme name this client does not know lands. Three of
274
- * them exist: `security` references `no_auth` (3 operations) and
275
- * `workbench_access_key` (1) and `components.securitySchemes` declares neither.
276
- * Those four operations receive `x-api-key` today and are differentially
277
- * pinned doing so, so resolving an unknown name to "no credential" would be a
278
- * wire change made on the strength of a spec defect. A later generator pass
279
- * must not "fix" that.
280
- */
281
- const selectScheme = (schemes, credentials) => {
96
+ const selectScheme = (schemes, held) => {
282
97
  if (schemes === void 0 || schemes.length === 0) return DEFAULT_SCHEME;
283
- if (schemes.includes(DEFAULT_SCHEME) && credentials.apiKey !== null) return DEFAULT_SCHEME;
98
+ if (schemes.includes(DEFAULT_SCHEME) && held(DEFAULT_SCHEME)) return DEFAULT_SCHEME;
284
99
  for (const scheme of schemes) {
285
100
  if (!Object.hasOwn(SCHEME_HEADERS, scheme)) continue;
286
101
  const known = scheme;
287
- if (valueFor(known, credentials) !== null) return known;
102
+ if (held(known)) return known;
288
103
  }
289
104
  return DEFAULT_SCHEME;
290
105
  };
106
+ const schemeOfHeader = (name) => Object.keys(SCHEME_HEADERS).find((scheme) => SCHEME_HEADERS[scheme] === name);
291
107
  /**
292
108
  * What counts as loopback, pinned rather than assumed. `localhost` is not the
293
109
  * whole set:
@@ -339,11 +155,9 @@ const resolveHTTPURL = (target, base) => {
339
155
  }
340
156
  };
341
157
  /** Whether a credential may be sent to this origin at all. */
342
- const isCredentialSafeOrigin = (url) => url.protocol === "https:" || url.protocol === "http:" && isLoopbackHostname(url.hostname);
158
+ const isCredentialSafeOrigin = (url, allowedHTTPOrigin = null) => url.protocol === "https:" || url.protocol === "http:" && (isLoopbackHostname(url.hostname) || allowedHTTPOrigin !== null && url.origin === allowedHTTPOrigin);
343
159
  const LOOPBACK_DESCRIPTION = "localhost, *.localhost, 127.0.0.0/8, [::1]";
344
- const insecureOriginMessage = (baseURL) => `Refusing to send a Composio API credential to ${baseURL}: a credentialed API origin must use HTTPS. Plain http:// is permitted only for loopback development endpoints (${LOOPBACK_DESCRIPTION}). Pass an https:// baseURL, use environment: 'local', or construct the client without credentials.`;
345
- /** Whether the client holds anything at all that rule 1 has to protect. */
346
- 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.`;
347
161
  /**
348
162
  * Rule 1 at construction time: a client that holds a credential must be
349
163
  * pointed at an origin that can carry one. Knowable before any request is
@@ -352,21 +166,17 @@ const anyCredential = (credentials) => credentials.apiKey !== null || hasAlterna
352
166
  * A `baseURL` that is not an absolute http(s) URL fails the same way — a
353
167
  * credential cannot be sent over a scheme this client does not speak, and the
354
168
  * alternative is a `TypeError` from `new URL()` one layer down.
355
- *
356
- * Every configured credential counts, not just `apiKey`: which one a given
357
- * request carries is decided per operation, so a client holding *any* of them
358
- * is a client that can put one on the wire.
359
169
  */
360
- const assertCredentialTransport = (baseURL, credentials) => {
361
- if (!anyCredential(credentials)) return;
170
+ const assertCredentialTransport = (baseURL, credentialed, allowedHTTPOrigin = null) => {
171
+ if (!credentialed) return;
362
172
  const url = parseHTTPURL(baseURL);
363
- if (url === null || !isCredentialSafeOrigin(url)) throw new ComposioError(insecureOriginMessage(baseURL));
173
+ if (url === null || !isCredentialSafeOrigin(url, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
364
174
  };
365
175
  /**
366
176
  * The credential this request may carry, or `null` for none.
367
177
  *
368
178
  * Rules 1 and 2 at dispatch time. Both re-checks are load-bearing rather than
369
- * belt-and-braces: `apiKey` and `baseURL` are public mutable fields, so the
179
+ * belt-and-braces: `baseURL` is a public mutable field, so the
370
180
  * construction-time check can be invalidated by an assignment, and the request
371
181
  * URL is *not* guaranteed to sit on the configured origin. `buildURL`
372
182
  * concatenates `baseURL + path` and the escape hatch (`client.get(path)`)
@@ -380,45 +190,23 @@ const assertCredentialTransport = (baseURL, credentials) => {
380
190
  * with credentials, so that one dies at the transport instead. httpx has no
381
191
  * such objection, which is why the Python port checks the same thing.)
382
192
  */
383
- const credentialForRequest = (baseURL, scheme, credentials, requestURL) => {
384
- const value = valueFor(scheme, credentials);
385
- if (value === null) return null;
193
+ const credentialForRequest = (baseURL, credential, requestURL, allowedHTTPOrigin = null) => {
194
+ if (credential === null) return null;
386
195
  const base = parseHTTPURL(baseURL);
387
196
  const target = parseHTTPURL(requestURL);
388
197
  if (base === null || target === null) return null;
389
198
  if (base.origin !== target.origin) return null;
390
- if (!isCredentialSafeOrigin(target)) throw new ComposioError(insecureOriginMessage(baseURL));
391
- return {
392
- name: SCHEME_HEADERS[scheme],
393
- value
394
- };
199
+ if (!isCredentialSafeOrigin(target, allowedHTTPOrigin)) throw new ComposioError(insecureOriginMessage(baseURL));
200
+ return credential;
395
201
  };
396
202
  /**
397
- * The credential headers a *caller* can place that are not the one this client
398
- * attaches — `x-api-key` is excluded because a caller setting it is overriding
399
- * the client's own value in the same slot, which is pinned Stainless behaviour,
400
- * not a second credential.
203
+ * Whether two absolute http(s) URLs share an origin, by the same test
204
+ * {@link credentialForRequest} applies. An unparseable side is never the same
205
+ * origin as anything. Python's `same_origin` is the twin.
401
206
  */
402
- const FOREIGN_CREDENTIAL_HEADERS = ["x-user-api-key", "x-org-api-key"];
403
- /**
404
- * Whether the caller has placed a credential of their own, in which case the
405
- * client must not add one beside it.
406
- *
407
- * Not a courtesy: this API answers a request carrying two credential headers
408
- * with `401 HTTP_Unauthorized`, so attaching `x-api-key` next to a caller's
409
- * `x-user-api-key` does not weaken the call, it *breaks* it. Three released
410
- * methods make that reachable without any `defaultHeaders` at all —
411
- * `cli.createCodactFailure`, `org.consumer.project.resolve` and
412
- * `org.consumer.listConnectedToolkits` declare `x-user-api-key` as a `required`
413
- * header parameter, which the generator folds into their params object. Calling
414
- * them the way their signature asks for returned 401 until this rule existed.
415
- *
416
- * Header merging is replayed rather than approximated, because a later source
417
- * may carry `null` to delete what an earlier one set (`buildHeaders`).
418
- */
419
- const callerPlacedCredential = (sources) => {
420
- const headers = buildHeaders(sources);
421
- return FOREIGN_CREDENTIAL_HEADERS.some((name) => headers.has(name));
207
+ const sameOrigin = (a, b) => {
208
+ const origin = parseHTTPURL(a)?.origin;
209
+ return origin !== void 0 && origin === parseHTTPURL(b)?.origin;
422
210
  };
423
211
  /**
424
212
  * Header names that carry a credential and must not survive an origin change.
@@ -434,9 +222,9 @@ const callerPlacedCredential = (sources) => {
434
222
  *
435
223
  * `x-user-api-key` and `x-org-api-key` are the spec's other two credential
436
224
  * schemes (`UserApiKeyAuth`, `OrgApiKeyAuth`), and they belong here for the same
437
- * reason `x-api-key` does — the kernel attaches all three (wayfinder ticket 48)
225
+ * reason `x-api-key` does — the kernel attaches all three
438
226
  * and a caller can place the latter two directly besides. They were listed here
439
- * one ticket *before* the attachment work, because omitting them cost more than
227
+ * *before* the attachment work, because omitting them cost more than
440
228
  * a missed withdrawal: {@link carriesCredentials} answered `false` for a request
441
229
  * carrying only one of them, so `request.ts` classified it as credential-free
442
230
  * and handed the whole chain to `fetch` at `redirect: 'follow'` — the exact leak
@@ -493,6 +281,188 @@ const withdrawCredentials = (headers) => {
493
281
  */
494
282
  const carriesCredentials = (headers) => CREDENTIAL_HEADERS.some((name) => headers.has(name));
495
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
+
496
466
  //#endregion
497
467
  //#region src/compat/deprecation.ts
498
468
  /**
@@ -803,17 +773,20 @@ const isTemplateParam = (segment) => segment.startsWith("{") && segment.endsWith
803
773
  * (`/toolkits/{slug}` against `/toolkits/categories`) the literal wins, which
804
774
  * is the same most-specific-first rule the server routes by.
805
775
  *
806
- * **Known limit of recovering identity from the path.** Two accessors can emit
807
- * byte-identical requests — `client.toolkits.retrieve('categories')` and
776
+ * **Known limit of recovering identity from the path**, and who still pays
777
+ * it. Two accessors can emit byte-identical requests —
778
+ * `client.toolkits.retrieve('categories')` and
808
779
  * `client.toolkits.retrieveCategories()` both dispatch
809
780
  * `GET /api/v3.1/toolkits/categories` — so nothing observable distinguishes
810
- * them here and the literal sibling is always the one named. The warning text
811
- * can therefore name the sibling rather than the accessor the caller wrote,
812
- * and the warn-once record is charged to that same sibling. This is
813
- * inherent to reverse-matching, not a bug in the matcher: the only fix is to
814
- * thread operation identity through dispatch, which this design deliberately
815
- * declined (wayfinder ticket 34). The affected pairs are few and the
816
- * consequence is a misnamed advisory, never a wrong call.
781
+ * them here and the literal sibling is always the one named. That is inherent
782
+ * to reverse-matching, not a bug in the matcher.
783
+ *
784
+ * Generated calls no longer reach this function at all: each one carries its
785
+ * own descriptor through dispatch (`withOperation` in `request.ts`), so
786
+ * `toolkits.retrieve('categories')` is now named as itself. What is left here
787
+ * is the escape hatch — `client.get('/api/v3.1/toolkits/categories')` — whose
788
+ * identity genuinely is not knowable before runtime, and for which naming the
789
+ * literal sibling remains the honest answer.
817
790
  */
818
791
  const matchOperation = (method, path, operations) => {
819
792
  const segments = pathSegments(path);
@@ -896,10 +869,10 @@ const noticeKey = (notice) => [
896
869
  * same `Response` to `asResponse()`, `withResponse()` and the parsed path
897
870
  * alike.
898
871
  */
899
- const inspectDeprecation = ({ response, method, path, baseURL, operations, seen, warn }) => {
872
+ const inspectDeprecation = ({ response, method, path, operation: known, baseURL, operations, seen, warn }) => {
900
873
  const notice = parseDeprecation(response.headers, response.url || baseURL, baseURL);
901
874
  if (notice === null) return;
902
- const operation = matchOperation(method, path, operations);
875
+ const operation = known ?? matchOperation(method, path, operations);
903
876
  const key = `${operation === null ? `${method} ${pathSegments(path).join("/")}` : operation.chain.join(".")}${KEY_SEPARATOR}${noticeKey(notice)}`;
904
877
  if (seen.has(key)) return;
905
878
  if (seen.size >= MAX_TRACKED_NOTICES) return;
@@ -960,8 +933,347 @@ const inspectDeprecatedInputs = ({ operation, query, body, headers, table, seen,
960
933
  }
961
934
  };
962
935
 
936
+ //#endregion
937
+ //#region src/compat/headers.ts
938
+ const hasEntries = (value) => typeof value === "object" && value !== null && "append" in value && typeof value.append === "function" && "delete" in value && typeof value.delete === "function" && "entries" in value && typeof value.entries === "function" && "get" in value && typeof value.get === "function";
939
+ const isHeaders = (value) => value instanceof Headers || hasEntries(value);
940
+ const isNullableHeadersLike = (headers) => {
941
+ if (!("values" in headers) || !isHeaders(headers.values) || !("nulls" in headers)) return false;
942
+ const nulls = headers.nulls;
943
+ return typeof nulls === "object" && nulls !== null && Symbol.iterator in nulls;
944
+ };
945
+ /**
946
+ * Iterates every supported input while preserving explicit deletions. Plain
947
+ * objects replace an older value for a key; tuple inputs append duplicate
948
+ * values, matching the published client.
949
+ */
950
+ function* iterateHeaders(headers) {
951
+ if (!headers) return;
952
+ if (isNullableHeadersLike(headers)) {
953
+ yield* headers.values.entries();
954
+ for (const name of headers.nulls) yield [name, null];
955
+ return;
956
+ }
957
+ const shouldReplace = !isHeaders(headers) && !Array.isArray(headers);
958
+ const entries = isHeaders(headers) ? headers.entries() : Array.isArray(headers) ? headers : Object.entries(headers);
959
+ for (const entry of entries) {
960
+ const name = entry[0];
961
+ if (typeof name !== "string") throw new TypeError("expected header name to be a string");
962
+ const rawValue = entry[1];
963
+ const values = Array.isArray(rawValue) ? rawValue : [rawValue];
964
+ let replaced = false;
965
+ for (const value of values) {
966
+ if (value === void 0) continue;
967
+ if (shouldReplace && !replaced) {
968
+ replaced = true;
969
+ yield [name, null];
970
+ }
971
+ yield [name, value];
972
+ }
973
+ }
974
+ }
975
+ /** Merge sources while retaining names explicitly deleted by the last source. */
976
+ const mergeHeaders = (sources) => {
977
+ const values = new Headers();
978
+ const nulls = /* @__PURE__ */ new Set();
979
+ for (const source of sources) {
980
+ if (!source) continue;
981
+ const seen = /* @__PURE__ */ new Set();
982
+ for (const [name, value] of iterateHeaders(source)) {
983
+ const lowerName = name.toLowerCase();
984
+ if (!seen.has(lowerName)) {
985
+ values.delete(name);
986
+ seen.add(lowerName);
987
+ }
988
+ if (value === null) {
989
+ values.delete(name);
990
+ nulls.add(lowerName);
991
+ } else {
992
+ values.append(name, value);
993
+ nulls.delete(lowerName);
994
+ }
995
+ }
996
+ }
997
+ return {
998
+ values,
999
+ nulls
1000
+ };
1001
+ };
1002
+ /** Merge sources into the native header collection sent to fetch. */
1003
+ const buildHeaders = (sources) => mergeHeaders(sources).values;
1004
+ /** Every header name a source mentions, lowercased, a `null` deletion included. */
1005
+ function* headerNames(headers) {
1006
+ for (const [name] of iterateHeaders(headers)) yield name.toLowerCase();
1007
+ }
1008
+
1009
+ //#endregion
1010
+ //#region src/version.ts
1011
+ const VERSION = "2.0.0-rc.21";
1012
+
1013
+ //#endregion
1014
+ //#region src/compat/identity.ts
1015
+ /**
1016
+ * The runtime keys `std-env` detects, in its order, each with the label this
1017
+ * client sends as `x-client-runtime`. Ported from std-env 4.3.0
1018
+ * (https://github.com/unjs/std-env, MIT) rather than imported: std-env reads
1019
+ * `process.env` when it is imported, which throws under Deno without
1020
+ * `--allow-env`, and this needs only the runtime check.
1021
+ *
1022
+ * The labels are the ones released clients already send and the platform
1023
+ * already normalizes (`nodejs`, `cloudflare`, `vercel_edge`, ...), so a
1024
+ * dashboard groups old and new traffic together. Edge runtimes come before
1025
+ * Node because `nodejs_compat` and edge polyfills expose `process.versions.node`.
1026
+ */
1027
+ const RUNTIMES = [
1028
+ [
1029
+ "netlify",
1030
+ "netlify",
1031
+ (g) => "Netlify" in g
1032
+ ],
1033
+ [
1034
+ "edge-light",
1035
+ "vercel_edge",
1036
+ (g) => "EdgeRuntime" in g
1037
+ ],
1038
+ [
1039
+ "workerd",
1040
+ "cloudflare",
1041
+ (g) => g.navigator?.userAgent === "Cloudflare-Workers"
1042
+ ],
1043
+ [
1044
+ "fastly",
1045
+ "fastly",
1046
+ (g) => "fastly" in g
1047
+ ],
1048
+ [
1049
+ "deno",
1050
+ "deno",
1051
+ (g) => "Deno" in g
1052
+ ],
1053
+ [
1054
+ "bun",
1055
+ "bun",
1056
+ (g) => "Bun" in g
1057
+ ],
1058
+ [
1059
+ "node",
1060
+ "nodejs",
1061
+ (g) => Boolean(g.process?.versions?.node)
1062
+ ]
1063
+ ];
1064
+ /**
1065
+ * The runtime label and its version. The version is `process.versions[key]`,
1066
+ * which Node, Bun and Deno each set for themselves; an edge runtime reports
1067
+ * none, so a polyfilled Node version is never sent as its own.
1068
+ */
1069
+ const detectRuntime = () => {
1070
+ const g = globalThis;
1071
+ for (const [key, label, detect] of RUNTIMES) if (detect(g)) return [label, g.process?.versions?.[key]];
1072
+ return ["unknown", void 0];
1073
+ };
1074
+ /** The library sending the request. Never caller-settable, with or without an identity. */
1075
+ const PACKAGE_HEADERS = [
1076
+ "x-client-library",
1077
+ "x-client-library-version",
1078
+ "x-client-language"
1079
+ ];
1080
+ /**
1081
+ * The calling product and its runtime. Reserved once a client has an
1082
+ * `identity`; without one they default to the package and stay
1083
+ * caller-settable, which is how a wrapper identified itself before `identity`.
1084
+ */
1085
+ const PRODUCT_HEADERS = [
1086
+ "x-client-provenance",
1087
+ "x-client-version",
1088
+ "x-sdk-version",
1089
+ "x-source",
1090
+ "x-framework",
1091
+ "x-runtime",
1092
+ "x-client-runtime",
1093
+ "x-runtime-version"
1094
+ ];
1095
+ const PACKAGE_RESERVED = new Set(PACKAGE_HEADERS);
1096
+ const IDENTITY_RESERVED = /* @__PURE__ */ new Set([...PACKAGE_HEADERS, ...PRODUCT_HEADERS]);
1097
+ /** Printable ASCII with no leading or trailing whitespace: what every runtime's `Headers` sends unchanged. */
1098
+ const HEADER_SAFE = /^[\x21-\x7e](?:[\x20-\x7e]*[\x21-\x7e])?$/;
1099
+ const IDENTITY_FIELDS = [
1100
+ "product",
1101
+ "version",
1102
+ "source",
1103
+ "framework",
1104
+ "runtime"
1105
+ ];
1106
+ const REQUIRED_FIELDS = /* @__PURE__ */ new Set(["product", "version"]);
1107
+ const validateIdentity = (identity) => {
1108
+ if (typeof identity !== "object" || identity === null) throw new ComposioError("`identity` must be an object with a `product` and a `version`.");
1109
+ const fields = identity;
1110
+ for (const field of IDENTITY_FIELDS) {
1111
+ const value = fields[field];
1112
+ if (value === void 0 && !REQUIRED_FIELDS.has(field)) continue;
1113
+ if (typeof value !== "string" || !HEADER_SAFE.test(value)) throw new ComposioError(`\`identity.${field}\` must be a non-empty string of printable ASCII with no leading or trailing whitespace.`);
1114
+ }
1115
+ return identity;
1116
+ };
1117
+ /**
1118
+ * Validates `identity` and resolves the headers it owns, once per client.
1119
+ *
1120
+ * Without an identity the client reports itself, as it always has. With one,
1121
+ * the product fields replace the package's; the runtime the package detected
1122
+ * stays in `x-client-runtime` and `x-runtime-version` either way, since
1123
+ * `identity.runtime` is the legacy `x-runtime` label and the platform does not
1124
+ * read the two as aliases.
1125
+ */
1126
+ const resolveIdentity = (identity) => {
1127
+ const [runtime, runtimeVersion] = detectRuntime();
1128
+ const library = {
1129
+ "x-client-library": "@composio/client",
1130
+ "x-client-library-version": VERSION,
1131
+ "x-client-language": "typescript",
1132
+ "x-client-runtime": runtime
1133
+ };
1134
+ if (identity === void 0) {
1135
+ const headers = {
1136
+ "x-client-provenance": "@composio/client",
1137
+ "x-client-version": VERSION,
1138
+ ...library,
1139
+ "x-runtime": runtime
1140
+ };
1141
+ if (runtimeVersion) headers["x-runtime-version"] = runtimeVersion;
1142
+ return {
1143
+ headers,
1144
+ reserved: PACKAGE_RESERVED
1145
+ };
1146
+ }
1147
+ const valid = validateIdentity(identity);
1148
+ const headers = {
1149
+ "x-client-provenance": valid.product,
1150
+ "x-client-version": valid.version,
1151
+ ...library,
1152
+ "x-runtime": valid.runtime ?? runtime
1153
+ };
1154
+ if (runtimeVersion) headers["x-runtime-version"] = runtimeVersion;
1155
+ headers["x-sdk-version"] = valid.version;
1156
+ if (valid.source !== void 0) headers["x-source"] = valid.source;
1157
+ if (valid.framework !== void 0) headers["x-framework"] = valid.framework;
1158
+ return {
1159
+ headers,
1160
+ reserved: IDENTITY_RESERVED
1161
+ };
1162
+ };
1163
+ /** Credential names are reserved while `auth` is not `none`, routing ids while `scope` is set. */
1164
+ const reservedHeaders = (identity, configured) => {
1165
+ const reserved = /* @__PURE__ */ new Map();
1166
+ for (const name of identity.reserved) reserved.set(name, PACKAGE_RESERVED.has(name) ? "client" : "identity");
1167
+ if (configured.auth) for (const name of CREDENTIAL_HEADER_NAMES) reserved.set(name, "auth");
1168
+ if (configured.scope) for (const name of SCOPE_HEADER_NAMES) reserved.set(name, "scope");
1169
+ return reserved;
1170
+ };
1171
+ const REMEDY = {
1172
+ client: " Pass `identity` to describe the calling product.",
1173
+ identity: "",
1174
+ auth: " Configure the credential through `auth`; derive a client with `withOptions({ auth })` for another one.",
1175
+ scope: " Configure the organization and project through `scope`; derive a client with `withOptions({ scope })` for another one."
1176
+ };
1177
+ /**
1178
+ * Refuses a generic header source that names a reserved header, whether it
1179
+ * sets one or deletes one with `null`. Constructor validation runs it over
1180
+ * `defaultHeaders`; request validation over a call's `headers`, before any
1181
+ * network work.
1182
+ */
1183
+ const assertNoReservedHeaders = (headers, reserved, option) => {
1184
+ if (!headers) return;
1185
+ for (const name of headerNames(headers)) {
1186
+ const owner = reserved.get(name);
1187
+ if (owner === void 0) continue;
1188
+ throw new ComposioError(`The \`${name}\` header is set by ${owner === "client" ? "the client" : `\`${owner}\``} and cannot be passed in \`${option}\`.${REMEDY[owner]}`);
1189
+ }
1190
+ };
1191
+
1192
+ //#endregion
1193
+ //#region src/compat/transport.ts
1194
+ const KERNEL_OWNED_KEYS = [
1195
+ "method",
1196
+ "headers",
1197
+ "body",
1198
+ "signal",
1199
+ "redirect"
1200
+ ];
1201
+ const assertSafeDefaults = (defaults) => {
1202
+ if (defaults === void 0) return;
1203
+ const owned = KERNEL_OWNED_KEYS.find((key) => key in defaults);
1204
+ if (owned !== void 0) throw new TypeError(`Fetch transport defaults cannot set kernel-owned '${owned}'`);
1205
+ };
1206
+ /**
1207
+ * Where the kernel leaves the `RequestInit` it built a `Request` from, so a
1208
+ * fetch-backed transport can call `fetch(url, init)` with the original body
1209
+ * and headers rather than `fetch(request)`. The two are the same HTTP
1210
+ * exchange; the difference is what a caller watching `fetch` sees, and every
1211
+ * consumer that stubs `globalThis.fetch` reads `calls[i][1].headers`, the
1212
+ * shape the client has sent since 0.1.x. A `Request` built elsewhere carries
1213
+ * no init and is sent as it is.
1214
+ */
1215
+ const kernelInit = Symbol("composio.kernelInit");
1216
+ /** Creates a transport backed by the supplied or global fetch function. */
1217
+ const createFetchTransport = (options = {}) => {
1218
+ assertSafeDefaults(options.defaults);
1219
+ const fetchImplementation = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
1220
+ return { send: (request) => {
1221
+ const init = request[kernelInit];
1222
+ if (init === void 0) return fetchImplementation(request, options.defaults);
1223
+ return fetchImplementation(request.url, {
1224
+ ...options.defaults,
1225
+ ...init
1226
+ });
1227
+ } };
1228
+ };
1229
+
963
1230
  //#endregion
964
1231
  //#region src/compat/request.ts
1232
+ /**
1233
+ * Where a generated call records *which operation it is*.
1234
+ *
1235
+ * A resource method knows its own identity at code-generation time, and until
1236
+ * now threw it away: dispatch carried only a method and a substituted path, so
1237
+ * the kernel recovered the operation by matching that path back against all
1238
+ * 104 templates on every single request (`matchOperation`). Recovery is still
1239
+ * the right answer for an escape-hatch `client.get('/api/v3.1/…')`, whose
1240
+ * identity genuinely is not knowable until runtime — but for a generated call
1241
+ * it re-derives a fact the call site already had.
1242
+ *
1243
+ * The channel is a module-private symbol rather than a `RequestOptions`
1244
+ * property, because `RequestOptions` is the Stainless options bag and its
1245
+ * shape is the product (`test/types/*.test-d.ts` pins it structurally). A
1246
+ * symbol key is invisible to that pinning, to `Object.keys`, to
1247
+ * `JSON.stringify`, and to every serializer in this file — the descriptor
1248
+ * reaches the kernel without becoming part of any public type or any byte on
1249
+ * the wire.
1250
+ *
1251
+ * It is deliberately *enumerable*: `client.get()` re-spreads the options bag
1252
+ * into `request()`, and object spread copies enumerable own symbols. A
1253
+ * non-enumerable definition would silently drop the descriptor there and
1254
+ * degrade every generated call back to matching, which is exactly the kind of
1255
+ * regression that measures fine and reports nothing.
1256
+ */
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");
1260
+ /**
1261
+ * Attach a generated call's operation, and its owned header parameters, to
1262
+ * the options bag it dispatches with.
1263
+ *
1264
+ * Called with the freshly built literal — never with the caller's own object —
1265
+ * and *after* the caller's options have been spread into it, so a caller
1266
+ * cannot pre-empt the descriptor: the write happens last, and the key it
1267
+ * writes to is not one a caller can name.
1268
+ */
1269
+ const withOperation = (operation, options, headers) => {
1270
+ options[OPERATION] = operation;
1271
+ if (headers !== void 0) options[OPERATION_HEADERS] = headers;
1272
+ return options;
1273
+ };
1274
+ /** The operation a generated call recorded, or `undefined` for a raw one. */
1275
+ const readOperation = (options) => options[OPERATION];
1276
+ const readOperationHeaders = (options) => options[OPERATION_HEADERS];
965
1277
  /** A request label safe to print: dynamic path values and URL secrets are excluded. */
966
1278
  const printableURL = (url, operation) => `${new URL(url).origin}${operation?.path ?? "/<custom>"}`;
967
1279
  const emitLog = (config, level, message, metadata) => {
@@ -972,6 +1284,31 @@ const emitLog = (config, level, message, metadata) => {
972
1284
  const monotonicMillis = () => globalThis.performance?.now?.() ?? Date.now();
973
1285
  const elapsedMillis = (startedAt) => Math.max(0, monotonicMillis() - startedAt);
974
1286
  /**
1287
+ * Settle a dispatch when its signal aborts even if a custom transport ignores
1288
+ * the signal. The transport promise keeps a rejection handler after abort so
1289
+ * a late failure cannot become an unhandled rejection.
1290
+ */
1291
+ const settleOnAbort = (promise, signal) => new Promise((resolve, reject) => {
1292
+ let settled = false;
1293
+ const cleanup = () => signal.removeEventListener("abort", onAbort);
1294
+ const finish = (settle, value) => {
1295
+ if (settled) return;
1296
+ settled = true;
1297
+ cleanup();
1298
+ settle(value);
1299
+ };
1300
+ const fail = (reason) => {
1301
+ if (settled) return;
1302
+ settled = true;
1303
+ cleanup();
1304
+ reject(reason);
1305
+ };
1306
+ const onAbort = () => fail(/* @__PURE__ */ new Error("Request aborted"));
1307
+ promise.then((value) => finish(resolve, value), fail);
1308
+ signal.addEventListener("abort", onAbort, { once: true });
1309
+ if (signal.aborted) onAbort();
1310
+ });
1311
+ /**
975
1312
  * Percent-encode everything that isn't a RFC-3986 pchar, leaving safe chars
976
1313
  * (unreserved / sub-delims / ":" / "@") readable.
977
1314
  */
@@ -995,7 +1332,7 @@ const path = (statics, ...params) => {
995
1332
  * empty values, and plain-object values expanded qs-style into bracket
996
1333
  * notation (`toolkit_versions[github]=v1`, the whole key percent-encoded) —
997
1334
  * pinned differentially against Stainless via `tools.retrieve`'s object
998
- * `toolkit_versions` param (wayfinder ticket 23).
1335
+ * `toolkit_versions` param.
999
1336
  */
1000
1337
  const stringifyQuery = (query) => {
1001
1338
  const parts = [];
@@ -1024,7 +1361,6 @@ const buildURL = (config, options) => {
1024
1361
  const url = new URL(base + joined);
1025
1362
  const query = {
1026
1363
  ...Object.fromEntries(url.searchParams),
1027
- ...config.defaultQuery,
1028
1364
  ...options.query
1029
1365
  };
1030
1366
  const search = stringifyQuery(query);
@@ -1125,7 +1461,7 @@ const REDIRECT_STATUSES = /* @__PURE__ */ new Set([
1125
1461
  * kernel refuses is one the platform would have refused too.
1126
1462
  */
1127
1463
  const MAX_REDIRECTS = 20;
1128
- const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times; the chain was abandoned.`;
1464
+ const TOO_MANY_REDIRECTS = `The API redirected more than ${20} times; the chain was abandoned.`;
1129
1465
  /**
1130
1466
  * The one environment-dependent behavior in the kernel, stated rather than
1131
1467
  * degraded into — and narrowed to the case where safety cannot be proved.
@@ -1154,7 +1490,7 @@ const TOO_MANY_REDIRECTS = `The API redirected more than ${MAX_REDIRECTS} times;
1154
1490
  * What is left is a *credentialed* request that redirects in a browser. It
1155
1491
  * gets a named error rather than a silent leak — and on this API that is very
1156
1492
  * nearly unreachable: the only redirects the platform serves are same-origin
1157
- * edge normalizations (wayfinder ticket 40 records the recon), and `buildURL`
1493
+ * edge normalizations, and `buildURL`
1158
1494
  * cannot construct a URL that triggers one.
1159
1495
  */
1160
1496
  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.";
@@ -1200,20 +1536,40 @@ const kernelInternals = { sleep };
1200
1536
  * The headers for one hop, built fresh from the URL that hop is going to.
1201
1537
  *
1202
1538
  * This is where rule 3 mostly stops needing machinery of its own: the
1203
- * credential is re-derived per hop from the *request* URL rather than carried
1204
- * along from the last one, so a hop that leaves the configured API origin
1205
- * simply does not get a key. `withdrawn` covers what that cannot — the
1539
+ * credential is re-checked per hop against the *request* URL rather than
1540
+ * carried along from the last one, so a hop that leaves the configured API
1541
+ * origin simply does not get a key. `withdrawn` covers what that cannot — the
1206
1542
  * caller's own credential headers, which are legitimate on the URL the caller
1207
1543
  * chose and are dropped once the *server* has chosen one.
1544
+ *
1545
+ * The client's identity and scope headers follow the same per-hop rule: they
1546
+ * describe this client to its own API, so a hop off the configured origin (a
1547
+ * presigned storage URL, a redirect target) goes without them.
1208
1548
  */
1209
- const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, scheme, callerPlaced) => {
1210
- const credential = withdrawn || callerPlaced ? null : credentialForRequest(config.baseURL, scheme, config.credentials, requestURL);
1549
+ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn, call) => {
1550
+ const credential = withdrawn ? null : credentialForRequest(config.baseURL, call.credential, requestURL, config.allowedHTTPOrigin);
1551
+ const own = sameOrigin(config.baseURL, requestURL);
1552
+ const identity = own ? config.identity.headers : void 0;
1553
+ const scope = own ? call.scope : void 0;
1554
+ if (!withdrawn && bodyHeaders === void 0 && !config.defaultHeaders && !options.headers && options.idempotencyKey === void 0) {
1555
+ const direct = new Headers({
1556
+ ...identity,
1557
+ accept: "application/json",
1558
+ "user-agent": config.userAgent,
1559
+ ...scope
1560
+ });
1561
+ if (credential !== null) direct.set(credential.name, credential.value);
1562
+ return direct;
1563
+ }
1211
1564
  const headers = buildHeaders([
1565
+ { "idempotency-key": options.idempotencyKey },
1212
1566
  {
1567
+ ...identity,
1213
1568
  accept: "application/json",
1214
1569
  "user-agent": config.userAgent
1215
1570
  },
1216
1571
  credential === null ? void 0 : { [credential.name]: credential.value },
1572
+ scope,
1217
1573
  config.defaultHeaders,
1218
1574
  bodyHeaders,
1219
1575
  options.headers
@@ -1221,28 +1577,25 @@ const buildRequestHeaders = (config, options, requestURL, bodyHeaders, withdrawn
1221
1577
  if (withdrawn) withdrawCredentials(headers);
1222
1578
  return headers;
1223
1579
  };
1224
- /**
1225
- * The credential class this logical request authenticates with, decided once
1226
- * from the operation the *caller* invoked.
1227
- *
1228
- * Deliberately not re-derived per redirect hop. A hop's URL was chosen by the
1229
- * server, so matching it back to a template would let the server's choice
1230
- * change which of the caller's credentials goes out; the operation the caller
1231
- * asked for is the honest answer for the whole chain, and rule 3 already
1232
- * withdraws everything once a hop leaves the origin.
1233
- *
1234
- * `operation` is the match `makeRequest` already computed for the static
1235
- * deprecated-input check, threaded in rather than re-derived: the two
1236
- * features need the same fact, so `matchOperation` runs once per logical call
1237
- * regardless of which of them a given client configuration actually uses.
1238
- * With only `apiKey` set the scheme answer is still `ApiKeyAuth` down every
1239
- * branch of {@link selectScheme}, so an existing caller's requests stay
1240
- * byte-identical by construction; what changed is that the match itself is no
1241
- * longer skippable, because the deprecated-input warning needs it too.
1242
- */
1243
- const schemeForRequest = (config, operation) => {
1244
- if (!hasAlternateCredential(config.credentials)) return "ApiKeyAuth";
1245
- return selectScheme(operation?.schemes, config.credentials);
1580
+ const callProvider = (provider, header) => {
1581
+ let key;
1582
+ try {
1583
+ key = provider();
1584
+ } catch (cause) {
1585
+ throw providerFailed(cause);
1586
+ }
1587
+ if (typeof key === "string") return header(key);
1588
+ return Promise.resolve(key).then(header, (cause) => {
1589
+ throw providerFailed(cause);
1590
+ });
1591
+ };
1592
+ /** Synchronous unless a provider has to be awaited, so a string key goes out in the turn the call starts. */
1593
+ const resolveCallCredential = (config, requestURL, operation, supplied) => {
1594
+ const choice = chooseCredential(config.auth, config.baseURL, requestURL, operation, supplied);
1595
+ if (choice === null) return null;
1596
+ const header = (key) => credentialHeader(choice.scheme, key);
1597
+ if (typeof choice.credential === "string") return header(choice.credential);
1598
+ return callProvider(choice.credential, header);
1246
1599
  };
1247
1600
  /**
1248
1601
  * One attempt: the request, plus however many redirects it takes to land on a
@@ -1258,28 +1611,26 @@ const schemeForRequest = (config, operation) => {
1258
1611
  * Everything the server chose is re-derived rather than carried: the headers
1259
1612
  * (see `buildRequestHeaders`), the method and body (fetch's own 301/302/303
1260
1613
  * rewrite), and the query, which is left to the `Location` URL because the
1261
- * server picked it. `config.defaultQuery` is applied to the URL the caller
1262
- * asked for, not to the one it was sent to.
1614
+ * server picked it.
1263
1615
  */
1264
- const dispatchWithRedirects = async (config, options, initialURL, initialBody, initialBodyHeaders, signal, scheme) => {
1616
+ const dispatchWithRedirects = async (config, options, initialURL, initialBody, initialBodyHeaders, signal, call) => {
1265
1617
  let url = initialURL;
1266
1618
  let method = options.method.toUpperCase();
1267
1619
  let body = initialBody;
1268
1620
  let bodyHeaders = initialBodyHeaders;
1269
1621
  let withdrawn = false;
1270
- const callerPlaced = callerPlacedCredential([config.defaultHeaders, options.headers]);
1271
1622
  for (let hop = 0;; hop++) {
1272
- const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, scheme, callerPlaced);
1623
+ const headers = buildRequestHeaders(config, options, url, bodyHeaders, withdrawn, call);
1273
1624
  const delegated = hop === 0 && !carriesCredentials(headers);
1274
- const response = await config.fetch.call(void 0, url, {
1625
+ const init = {
1275
1626
  method,
1276
1627
  headers,
1277
1628
  ...body !== void 0 ? { body } : {},
1278
- ...config.fetchOptions,
1279
- ...options.fetchOptions,
1280
1629
  redirect: delegated ? "follow" : "manual",
1281
1630
  signal
1282
- });
1631
+ };
1632
+ const request = Object.assign(new Request(url, init), { [kernelInit]: init });
1633
+ const response = await settleOnAbort(config.transport.send(request), signal);
1283
1634
  if (delegated) return response;
1284
1635
  if (isOpaqueRedirect(response)) throw new APIConnectionError({ message: OPAQUE_REDIRECT });
1285
1636
  if (!REDIRECT_STATUSES.has(response.status)) return response;
@@ -1287,7 +1638,7 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
1287
1638
  if (location === null) return response;
1288
1639
  const target = resolveLocation(location, url);
1289
1640
  if (target === null) return response;
1290
- if (hop >= MAX_REDIRECTS) throw new APIConnectionError({ message: TOO_MANY_REDIRECTS });
1641
+ if (hop >= 20) throw new APIConnectionError({ message: TOO_MANY_REDIRECTS });
1291
1642
  response.body?.cancel().catch(() => void 0);
1292
1643
  if (target.origin !== new URL(url).origin) withdrawn = true;
1293
1644
  if (rewriteForRedirect(response.status, method)) {
@@ -1308,12 +1659,13 @@ const dispatchWithRedirects = async (config, options, initialURL, initialBody, i
1308
1659
  *
1309
1660
  * Redirects are followed inside an attempt by `dispatchWithRedirects`, so the
1310
1661
  * single response exit below still fires `onResponse` **once per logical
1311
- * call** rather than once per hop — the once-per-call guarantee ticket 34
1312
- * built the deprecation interceptor on. The `Response` handed back is the
1662
+ * call** rather than once per hop — the once-per-call guarantee the
1663
+ * deprecation interceptor is built on. The `Response` handed back is the
1313
1664
  * final hop's, so `response.url` is still "the URL this response came from",
1314
1665
  * which is what `deprecation.ts` resolves relative `Link` targets against.
1315
1666
  */
1316
1667
  async function makeRequest(config, options) {
1668
+ assertNoReservedHeaders(options.headers, config.reserved, "headers");
1317
1669
  if (options.timeout !== void 0) validatePositiveInteger("timeout", options.timeout);
1318
1670
  const maxRetries = options.maxRetries ?? config.maxRetries;
1319
1671
  validatePositiveInteger("maxRetries", maxRetries);
@@ -1322,14 +1674,22 @@ async function makeRequest(config, options) {
1322
1674
  const { body, bodyHeaders } = buildBody(options);
1323
1675
  const userSignal = options.signal ?? void 0;
1324
1676
  const method = options.method.toUpperCase();
1325
- const operation = matchOperation(options.method, options.path, config.operations ?? []);
1677
+ const threaded = readOperation(options);
1678
+ const operation = threaded ?? matchOperation(options.method, options.path, config.operations ?? []);
1326
1679
  const requestLog = config.onLog === void 0 ? void 0 : {
1327
1680
  method,
1328
1681
  url: printableURL(url, operation),
1329
1682
  maxAttempts: maxRetries + 1
1330
1683
  };
1331
- const scheme = schemeForRequest(config, operation);
1332
- config.onRequest?.(operation, query, options.body, buildHeaders([config.defaultHeaders, options.headers]));
1684
+ const supplied = readOperationHeaders(options);
1685
+ assertRequiredOperationHeaders(threaded ?? null, supplied);
1686
+ const scope = scopeForCall(config.scope, supplied);
1687
+ const credential = resolveCallCredential(config, url, operation, supplied);
1688
+ const call = {
1689
+ scope,
1690
+ credential: credential instanceof Promise ? await credential : credential
1691
+ };
1692
+ if (config.onRequest !== void 0 && (threaded === void 0 || threaded.hasDeprecatedInputs === true)) config.onRequest(operation, query, options.body, buildHeaders([config.defaultHeaders, options.headers]));
1333
1693
  for (let numRetries = 0;; numRetries++) {
1334
1694
  if (userSignal?.aborted) throw new APIUserAbortError();
1335
1695
  const attempt = numRetries + 1;
@@ -1346,7 +1706,7 @@ async function makeRequest(config, options) {
1346
1706
  const timer = setTimeout(abort, timeout);
1347
1707
  let result;
1348
1708
  try {
1349
- result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, scheme);
1709
+ result = await dispatchWithRedirects(config, options, url, body, bodyHeaders, controller.signal, call);
1350
1710
  } catch (cause) {
1351
1711
  if (cause instanceof ComposioError) {
1352
1712
  if (attemptLog !== void 0) emitLog(config, "info", "Request failed", {
@@ -1420,4 +1780,830 @@ async function makeRequest(config, options) {
1420
1780
  }
1421
1781
 
1422
1782
  //#endregion
1423
- export { InternalServerError as _, inspectDeprecatedInputs as a, RateLimitError as b, mergeHeaders as c, APIError as d, APIUserAbortError as f, ConflictError as g, ComposioError as h, safeJSON as i, APIConnectionError as l, BadRequestError as m, makeRequest as n, inspectDeprecation as o, AuthenticationError as p, path as r, assertCredentialTransport as s, castToError as t, APIConnectionTimeoutError as u, NotFoundError as v, UnprocessableEntityError as x, PermissionDeniedError as y };
1783
+ //#region src/compat/generated-operations.ts
1784
+ const GENERATED_OPERATIONS = [
1785
+ {
1786
+ method: "delete",
1787
+ path: "/api/v3.1/auth_configs/{nanoid}",
1788
+ chain: ["authConfigs", "delete"],
1789
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1790
+ },
1791
+ {
1792
+ method: "delete",
1793
+ path: "/api/v3.1/connected_accounts/{nanoid}",
1794
+ chain: ["connectedAccounts", "delete"],
1795
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1796
+ },
1797
+ {
1798
+ method: "delete",
1799
+ path: "/api/v3.1/custom/toolkits/{slug}",
1800
+ chain: ["custom", "deleteToolkit"],
1801
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1802
+ },
1803
+ {
1804
+ method: "delete",
1805
+ path: "/api/v3.1/mcp/servers/{serverId}/instances/{instanceId}",
1806
+ chain: ["mcp", "deleteInstance"]
1807
+ },
1808
+ {
1809
+ method: "delete",
1810
+ path: "/api/v3.1/mcp/{id}",
1811
+ chain: ["mcp", "delete"]
1812
+ },
1813
+ {
1814
+ method: "delete",
1815
+ path: "/api/v3.1/org/owner/project/{nano_id}",
1816
+ chain: [
1817
+ "org",
1818
+ "owner",
1819
+ "project",
1820
+ "delete"
1821
+ ],
1822
+ schemes: ["OrgApiKeyAuth"]
1823
+ },
1824
+ {
1825
+ method: "delete",
1826
+ path: "/api/v3.1/tool_router/session/{session_id}",
1827
+ chain: [
1828
+ "toolRouter",
1829
+ "session",
1830
+ "delete"
1831
+ ]
1832
+ },
1833
+ {
1834
+ method: "delete",
1835
+ path: "/api/v3.1/trigger_instances/manage/{triggerId}",
1836
+ chain: [
1837
+ "triggerInstances",
1838
+ "manage",
1839
+ "delete"
1840
+ ],
1841
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1842
+ },
1843
+ {
1844
+ method: "delete",
1845
+ path: "/api/v3.1/webhook_subscriptions/{id}",
1846
+ chain: ["webhookSubscriptions", "delete"]
1847
+ },
1848
+ {
1849
+ method: "get",
1850
+ path: "/api/v3.1/auth/session/info",
1851
+ chain: [
1852
+ "auth",
1853
+ "session",
1854
+ "retrieveInfo"
1855
+ ],
1856
+ schemes: ["UserApiKeyAuth"]
1857
+ },
1858
+ {
1859
+ method: "get",
1860
+ path: "/api/v3.1/auth_configs",
1861
+ chain: ["authConfigs", "list"],
1862
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
1863
+ hasDeprecatedInputs: true
1864
+ },
1865
+ {
1866
+ method: "get",
1867
+ path: "/api/v3.1/auth_configs/{nanoid}",
1868
+ chain: ["authConfigs", "retrieve"],
1869
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1870
+ },
1871
+ {
1872
+ method: "get",
1873
+ path: "/api/v3.1/cli/get-session",
1874
+ chain: ["cli", "getSession"],
1875
+ schemes: ["no_auth"]
1876
+ },
1877
+ {
1878
+ method: "get",
1879
+ path: "/api/v3.1/cli/realtime/credentials",
1880
+ chain: [
1881
+ "cli",
1882
+ "realtime",
1883
+ "credentials"
1884
+ ],
1885
+ schemes: ["UserApiKeyAuth"]
1886
+ },
1887
+ {
1888
+ method: "get",
1889
+ path: "/api/v3.1/connected_accounts",
1890
+ chain: ["connectedAccounts", "list"],
1891
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1892
+ },
1893
+ {
1894
+ method: "get",
1895
+ path: "/api/v3.1/connected_accounts/{nanoid}",
1896
+ chain: ["connectedAccounts", "retrieve"],
1897
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
1898
+ },
1899
+ {
1900
+ method: "get",
1901
+ path: "/api/v3.1/files/list",
1902
+ chain: ["files", "list"]
1903
+ },
1904
+ {
1905
+ method: "get",
1906
+ path: "/api/v3.1/internal/action_execution/fields",
1907
+ chain: [
1908
+ "logs",
1909
+ "tools",
1910
+ "listFields"
1911
+ ]
1912
+ },
1913
+ {
1914
+ method: "get",
1915
+ path: "/api/v3.1/internal/action_execution/log/{id}",
1916
+ chain: [
1917
+ "logs",
1918
+ "tools",
1919
+ "retrieve"
1920
+ ]
1921
+ },
1922
+ {
1923
+ method: "get",
1924
+ path: "/api/v3.1/internal/trigger/log/{id}",
1925
+ chain: [
1926
+ "logs",
1927
+ "triggers",
1928
+ "retrieve"
1929
+ ]
1930
+ },
1931
+ {
1932
+ method: "get",
1933
+ path: "/api/v3.1/keyring/transfer_keys",
1934
+ chain: ["keyring", "listTransferKeys"]
1935
+ },
1936
+ {
1937
+ method: "get",
1938
+ path: "/api/v3.1/logs/tool_execution/{id}",
1939
+ chain: ["logs", "retrieveToolExecution"]
1940
+ },
1941
+ {
1942
+ method: "get",
1943
+ path: "/api/v3.1/mcp/app/{appKey}",
1944
+ chain: ["mcp", "retrieveApp"]
1945
+ },
1946
+ {
1947
+ method: "get",
1948
+ path: "/api/v3.1/mcp/servers",
1949
+ chain: ["mcp", "list"]
1950
+ },
1951
+ {
1952
+ method: "get",
1953
+ path: "/api/v3.1/mcp/servers/{serverId}/instances",
1954
+ chain: ["mcp", "listInstances"]
1955
+ },
1956
+ {
1957
+ method: "get",
1958
+ path: "/api/v3.1/mcp/{id}",
1959
+ chain: ["mcp", "retrieve"]
1960
+ },
1961
+ {
1962
+ method: "get",
1963
+ path: "/api/v3.1/org/consumer/connected_toolkits",
1964
+ chain: [
1965
+ "org",
1966
+ "consumer",
1967
+ "listConnectedToolkits"
1968
+ ],
1969
+ schemes: ["UserApiKeyAuth"],
1970
+ requiredHeaders: ["x-user-api-key", "x-org-id"]
1971
+ },
1972
+ {
1973
+ method: "get",
1974
+ path: "/api/v3.1/org/list",
1975
+ chain: ["org", "list"],
1976
+ schemes: ["UserApiKeyAuth"]
1977
+ },
1978
+ {
1979
+ method: "get",
1980
+ path: "/api/v3.1/org/owner/project/list",
1981
+ chain: [
1982
+ "org",
1983
+ "owner",
1984
+ "project",
1985
+ "list"
1986
+ ],
1987
+ schemes: ["OrgApiKeyAuth"]
1988
+ },
1989
+ {
1990
+ method: "get",
1991
+ path: "/api/v3.1/org/owner/project/{nano_id}",
1992
+ chain: [
1993
+ "org",
1994
+ "owner",
1995
+ "project",
1996
+ "retrieve"
1997
+ ],
1998
+ schemes: ["OrgApiKeyAuth"]
1999
+ },
2000
+ {
2001
+ method: "get",
2002
+ path: "/api/v3.1/org/project/list",
2003
+ chain: [
2004
+ "org",
2005
+ "project",
2006
+ "list"
2007
+ ],
2008
+ schemes: ["UserApiKeyAuth"]
2009
+ },
2010
+ {
2011
+ method: "get",
2012
+ path: "/api/v3.1/session_configs",
2013
+ chain: ["sessionConfigs", "list"]
2014
+ },
2015
+ {
2016
+ method: "get",
2017
+ path: "/api/v3.1/session_configs/{session_config_id}",
2018
+ chain: ["sessionConfigs", "retrieve"]
2019
+ },
2020
+ {
2021
+ method: "get",
2022
+ path: "/api/v3.1/tool_router/session/{session_id}",
2023
+ chain: [
2024
+ "toolRouter",
2025
+ "session",
2026
+ "retrieve"
2027
+ ]
2028
+ },
2029
+ {
2030
+ method: "get",
2031
+ path: "/api/v3.1/tool_router/session/{session_id}/config_history",
2032
+ chain: [
2033
+ "toolRouter",
2034
+ "session",
2035
+ "configHistory"
2036
+ ]
2037
+ },
2038
+ {
2039
+ method: "get",
2040
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/items",
2041
+ chain: [
2042
+ "toolRouter",
2043
+ "session",
2044
+ "files",
2045
+ "list"
2046
+ ]
2047
+ },
2048
+ {
2049
+ method: "get",
2050
+ path: "/api/v3.1/tool_router/session/{session_id}/toolkits",
2051
+ chain: [
2052
+ "toolRouter",
2053
+ "session",
2054
+ "toolkits"
2055
+ ]
2056
+ },
2057
+ {
2058
+ method: "get",
2059
+ path: "/api/v3.1/tool_router/session/{session_id}/tools",
2060
+ chain: [
2061
+ "toolRouter",
2062
+ "session",
2063
+ "tools"
2064
+ ]
2065
+ },
2066
+ {
2067
+ method: "get",
2068
+ path: "/api/v3.1/toolkits",
2069
+ chain: ["toolkits", "list"],
2070
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2071
+ hasDeprecatedInputs: true
2072
+ },
2073
+ {
2074
+ method: "get",
2075
+ path: "/api/v3.1/toolkits/categories",
2076
+ chain: ["toolkits", "retrieveCategories"]
2077
+ },
2078
+ {
2079
+ method: "get",
2080
+ path: "/api/v3.1/toolkits/changelog",
2081
+ chain: ["toolkits", "retrieveChangelog"]
2082
+ },
2083
+ {
2084
+ method: "get",
2085
+ path: "/api/v3.1/toolkits/{slug}",
2086
+ chain: ["toolkits", "retrieve"],
2087
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2088
+ },
2089
+ {
2090
+ method: "get",
2091
+ path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/grant_context",
2092
+ chain: ["toolkits", "retrieveScopesGrantContext"]
2093
+ },
2094
+ {
2095
+ method: "get",
2096
+ path: "/api/v3.1/tools",
2097
+ chain: ["tools", "list"],
2098
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2099
+ hasDeprecatedInputs: true
2100
+ },
2101
+ {
2102
+ method: "get",
2103
+ path: "/api/v3.1/tools/enum",
2104
+ chain: ["tools", "retrieveEnum"],
2105
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2106
+ },
2107
+ {
2108
+ method: "get",
2109
+ path: "/api/v3.1/tools/{tool_slug}",
2110
+ chain: ["tools", "retrieve"],
2111
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2112
+ },
2113
+ {
2114
+ method: "get",
2115
+ path: "/api/v3.1/trigger_instances/active",
2116
+ chain: ["triggerInstances", "listActive"],
2117
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2118
+ hasDeprecatedInputs: true
2119
+ },
2120
+ {
2121
+ method: "get",
2122
+ path: "/api/v3.1/triggers_types",
2123
+ chain: ["triggersTypes", "list"],
2124
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2125
+ },
2126
+ {
2127
+ method: "get",
2128
+ path: "/api/v3.1/triggers_types/list/enum",
2129
+ chain: ["triggersTypes", "retrieveEnum"],
2130
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2131
+ },
2132
+ {
2133
+ method: "get",
2134
+ path: "/api/v3.1/triggers_types/{slug}",
2135
+ chain: ["triggersTypes", "retrieve"],
2136
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2137
+ },
2138
+ {
2139
+ method: "get",
2140
+ path: "/api/v3.1/webhook_endpoints",
2141
+ chain: ["webhookEndpoints", "list"]
2142
+ },
2143
+ {
2144
+ method: "get",
2145
+ path: "/api/v3.1/webhook_endpoints/{nano_id}",
2146
+ chain: ["webhookEndpoints", "retrieve"]
2147
+ },
2148
+ {
2149
+ method: "get",
2150
+ path: "/api/v3.1/webhook_subscriptions",
2151
+ chain: ["webhookSubscriptions", "list"]
2152
+ },
2153
+ {
2154
+ method: "get",
2155
+ path: "/api/v3.1/webhook_subscriptions/event_types",
2156
+ chain: ["webhookSubscriptions", "listEventTypes"]
2157
+ },
2158
+ {
2159
+ method: "get",
2160
+ path: "/api/v3.1/webhook_subscriptions/{id}",
2161
+ chain: ["webhookSubscriptions", "retrieve"]
2162
+ },
2163
+ {
2164
+ method: "patch",
2165
+ path: "/api/v3.1/auth_configs/{nanoid}",
2166
+ chain: ["authConfigs", "update"],
2167
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2168
+ hasDeprecatedInputs: true
2169
+ },
2170
+ {
2171
+ method: "patch",
2172
+ path: "/api/v3.1/auth_configs/{nanoid}/{status}",
2173
+ chain: ["authConfigs", "updateStatus"]
2174
+ },
2175
+ {
2176
+ method: "patch",
2177
+ path: "/api/v3.1/connected_accounts/{nanoId}/status",
2178
+ chain: ["connectedAccounts", "updateStatus"]
2179
+ },
2180
+ {
2181
+ method: "patch",
2182
+ path: "/api/v3.1/connected_accounts/{nanoid}",
2183
+ chain: ["connectedAccounts", "patch"]
2184
+ },
2185
+ {
2186
+ method: "patch",
2187
+ path: "/api/v3.1/mcp/{id}",
2188
+ chain: ["mcp", "update"]
2189
+ },
2190
+ {
2191
+ method: "patch",
2192
+ path: "/api/v3.1/tool_router/session/{session_id}",
2193
+ chain: [
2194
+ "toolRouter",
2195
+ "session",
2196
+ "patch"
2197
+ ]
2198
+ },
2199
+ {
2200
+ method: "patch",
2201
+ path: "/api/v3.1/trigger_instances/manage/{triggerId}",
2202
+ chain: [
2203
+ "triggerInstances",
2204
+ "manage",
2205
+ "update"
2206
+ ],
2207
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2208
+ },
2209
+ {
2210
+ method: "patch",
2211
+ path: "/api/v3.1/webhook_endpoints/{nano_id}",
2212
+ chain: ["webhookEndpoints", "update"]
2213
+ },
2214
+ {
2215
+ method: "patch",
2216
+ path: "/api/v3.1/webhook_subscriptions/{id}",
2217
+ chain: ["webhookSubscriptions", "update"]
2218
+ },
2219
+ {
2220
+ method: "post",
2221
+ path: "/api/v3.1/api_key_revocation",
2222
+ chain: ["apiKeyRevocation", "create"],
2223
+ schemes: ["no_auth"]
2224
+ },
2225
+ {
2226
+ method: "post",
2227
+ path: "/api/v3.1/auth_configs",
2228
+ chain: ["authConfigs", "create"],
2229
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2230
+ },
2231
+ {
2232
+ method: "post",
2233
+ path: "/api/v3.1/cli/codact_failures",
2234
+ chain: ["cli", "createCodactFailure"],
2235
+ schemes: ["UserApiKeyAuth"],
2236
+ requiredHeaders: ["x-user-api-key"]
2237
+ },
2238
+ {
2239
+ method: "post",
2240
+ path: "/api/v3.1/cli/create-session",
2241
+ chain: ["cli", "createSession"],
2242
+ schemes: ["no_auth"]
2243
+ },
2244
+ {
2245
+ method: "post",
2246
+ path: "/api/v3.1/cli/realtime/auth",
2247
+ chain: [
2248
+ "cli",
2249
+ "realtime",
2250
+ "auth"
2251
+ ],
2252
+ schemes: ["UserApiKeyAuth"]
2253
+ },
2254
+ {
2255
+ method: "post",
2256
+ path: "/api/v3.1/connected_accounts",
2257
+ chain: ["connectedAccounts", "create"]
2258
+ },
2259
+ {
2260
+ method: "post",
2261
+ path: "/api/v3.1/connected_accounts/complete_auth",
2262
+ chain: ["connectedAccounts", "completeAuth"]
2263
+ },
2264
+ {
2265
+ method: "post",
2266
+ path: "/api/v3.1/connected_accounts/link",
2267
+ chain: ["link", "create"],
2268
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2269
+ },
2270
+ {
2271
+ method: "post",
2272
+ path: "/api/v3.1/connected_accounts/{nanoid}/refresh",
2273
+ chain: ["connectedAccounts", "refresh"]
2274
+ },
2275
+ {
2276
+ method: "post",
2277
+ path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
2278
+ chain: ["connectedAccounts", "revoke"]
2279
+ },
2280
+ {
2281
+ method: "post",
2282
+ path: "/api/v3.1/custom/toolkits/sync",
2283
+ chain: ["custom", "sync"],
2284
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2285
+ },
2286
+ {
2287
+ method: "post",
2288
+ path: "/api/v3.1/custom/toolkits/upsert",
2289
+ chain: ["custom", "upsert"],
2290
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
2291
+ },
2292
+ {
2293
+ method: "post",
2294
+ path: "/api/v3.1/files/upload/request",
2295
+ chain: ["files", "createPresignedURL"]
2296
+ },
2297
+ {
2298
+ method: "post",
2299
+ path: "/api/v3.1/internal/action_execution/logs",
2300
+ chain: [
2301
+ "logs",
2302
+ "tools",
2303
+ "list"
2304
+ ]
2305
+ },
2306
+ {
2307
+ method: "post",
2308
+ path: "/api/v3.1/internal/trigger/logs",
2309
+ chain: [
2310
+ "logs",
2311
+ "triggers",
2312
+ "list"
2313
+ ]
2314
+ },
2315
+ {
2316
+ method: "post",
2317
+ path: "/api/v3.1/logs/tool_execution",
2318
+ chain: ["logs", "createToolExecution"]
2319
+ },
2320
+ {
2321
+ method: "post",
2322
+ path: "/api/v3.1/mcp/servers",
2323
+ chain: ["mcp", "create"]
2324
+ },
2325
+ {
2326
+ method: "post",
2327
+ path: "/api/v3.1/mcp/servers/custom",
2328
+ chain: [
2329
+ "mcp",
2330
+ "custom",
2331
+ "create"
2332
+ ]
2333
+ },
2334
+ {
2335
+ method: "post",
2336
+ path: "/api/v3.1/mcp/servers/generate",
2337
+ chain: [
2338
+ "mcp",
2339
+ "generate",
2340
+ "url"
2341
+ ],
2342
+ hasDeprecatedInputs: true
2343
+ },
2344
+ {
2345
+ method: "post",
2346
+ path: "/api/v3.1/mcp/servers/{serverId}/instances",
2347
+ chain: ["mcp", "createInstance"]
2348
+ },
2349
+ {
2350
+ method: "post",
2351
+ path: "/api/v3.1/org/clanker/create_claim",
2352
+ chain: [
2353
+ "org",
2354
+ "clanker",
2355
+ "createClaim"
2356
+ ],
2357
+ schemes: ["OrgApiKeyAuth"]
2358
+ },
2359
+ {
2360
+ method: "post",
2361
+ path: "/api/v3.1/org/consumer/project/resolve",
2362
+ chain: [
2363
+ "org",
2364
+ "consumer",
2365
+ "project",
2366
+ "resolve"
2367
+ ],
2368
+ schemes: ["UserApiKeyAuth"],
2369
+ requiredHeaders: ["x-user-api-key", "x-org-id"]
2370
+ },
2371
+ {
2372
+ method: "post",
2373
+ path: "/api/v3.1/org/owner/project/new",
2374
+ chain: [
2375
+ "org",
2376
+ "owner",
2377
+ "project",
2378
+ "create"
2379
+ ],
2380
+ schemes: ["OrgApiKeyAuth"]
2381
+ },
2382
+ {
2383
+ method: "post",
2384
+ path: "/api/v3.1/org/owner/project/{nano_id}/regenerate_api_key",
2385
+ chain: [
2386
+ "org",
2387
+ "owner",
2388
+ "project",
2389
+ "regenerateAPIKey"
2390
+ ],
2391
+ schemes: ["OrgApiKeyAuth"]
2392
+ },
2393
+ {
2394
+ method: "post",
2395
+ path: "/api/v3.1/org/usage/summary",
2396
+ chain: [
2397
+ "org",
2398
+ "usage",
2399
+ "retrieveSummary"
2400
+ ],
2401
+ schemes: ["OrgApiKeyAuth"]
2402
+ },
2403
+ {
2404
+ method: "post",
2405
+ path: "/api/v3.1/org/usage/{entity_type}",
2406
+ chain: [
2407
+ "org",
2408
+ "usage",
2409
+ "retrieve"
2410
+ ],
2411
+ schemes: ["OrgApiKeyAuth"]
2412
+ },
2413
+ {
2414
+ method: "post",
2415
+ path: "/api/v3.1/project/usage/summary",
2416
+ chain: [
2417
+ "project",
2418
+ "usage",
2419
+ "retrieveSummary"
2420
+ ]
2421
+ },
2422
+ {
2423
+ method: "post",
2424
+ path: "/api/v3.1/project/usage/{entity_type}",
2425
+ chain: [
2426
+ "project",
2427
+ "usage",
2428
+ "retrieve"
2429
+ ]
2430
+ },
2431
+ {
2432
+ method: "post",
2433
+ path: "/api/v3.1/tool_router/session",
2434
+ chain: [
2435
+ "toolRouter",
2436
+ "session",
2437
+ "create"
2438
+ ]
2439
+ },
2440
+ {
2441
+ method: "post",
2442
+ path: "/api/v3.1/tool_router/session/{session_id}/attach",
2443
+ chain: [
2444
+ "toolRouter",
2445
+ "session",
2446
+ "attach"
2447
+ ]
2448
+ },
2449
+ {
2450
+ method: "post",
2451
+ path: "/api/v3.1/tool_router/session/{session_id}/execute",
2452
+ chain: [
2453
+ "toolRouter",
2454
+ "session",
2455
+ "execute"
2456
+ ],
2457
+ schemes: ["ApiKeyAuth", "workbench_access_key"]
2458
+ },
2459
+ {
2460
+ method: "post",
2461
+ path: "/api/v3.1/tool_router/session/{session_id}/execute_meta",
2462
+ chain: [
2463
+ "toolRouter",
2464
+ "session",
2465
+ "executeMeta"
2466
+ ]
2467
+ },
2468
+ {
2469
+ method: "post",
2470
+ path: "/api/v3.1/tool_router/session/{session_id}/link",
2471
+ chain: [
2472
+ "toolRouter",
2473
+ "session",
2474
+ "link"
2475
+ ]
2476
+ },
2477
+ {
2478
+ method: "post",
2479
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/delete",
2480
+ chain: [
2481
+ "toolRouter",
2482
+ "session",
2483
+ "files",
2484
+ "delete"
2485
+ ]
2486
+ },
2487
+ {
2488
+ method: "post",
2489
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/download_url",
2490
+ chain: [
2491
+ "toolRouter",
2492
+ "session",
2493
+ "files",
2494
+ "createDownloadURL"
2495
+ ]
2496
+ },
2497
+ {
2498
+ method: "post",
2499
+ path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/upload_url",
2500
+ chain: [
2501
+ "toolRouter",
2502
+ "session",
2503
+ "files",
2504
+ "createUploadURL"
2505
+ ]
2506
+ },
2507
+ {
2508
+ method: "post",
2509
+ path: "/api/v3.1/tool_router/session/{session_id}/proxy_execute",
2510
+ chain: [
2511
+ "toolRouter",
2512
+ "session",
2513
+ "proxyExecute"
2514
+ ],
2515
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2516
+ hasDeprecatedInputs: true
2517
+ },
2518
+ {
2519
+ method: "post",
2520
+ path: "/api/v3.1/tool_router/session/{session_id}/search",
2521
+ chain: [
2522
+ "toolRouter",
2523
+ "session",
2524
+ "search"
2525
+ ]
2526
+ },
2527
+ {
2528
+ method: "post",
2529
+ path: "/api/v3.1/toolkits/multi",
2530
+ chain: ["toolkits", "retrieveMulti"]
2531
+ },
2532
+ {
2533
+ method: "post",
2534
+ path: "/api/v3.1/toolkits/{toolkit_slug}/scopes/recommended",
2535
+ chain: ["toolkits", "recommendScopes"]
2536
+ },
2537
+ {
2538
+ method: "post",
2539
+ path: "/api/v3.1/tools/execute/proxy",
2540
+ chain: ["tools", "proxy"],
2541
+ hasDeprecatedInputs: true
2542
+ },
2543
+ {
2544
+ method: "post",
2545
+ path: "/api/v3.1/tools/execute/{tool_slug}",
2546
+ chain: ["tools", "execute"],
2547
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2548
+ hasDeprecatedInputs: true
2549
+ },
2550
+ {
2551
+ method: "post",
2552
+ path: "/api/v3.1/tools/execute/{tool_slug}/input",
2553
+ chain: ["tools", "getInput"]
2554
+ },
2555
+ {
2556
+ method: "post",
2557
+ path: "/api/v3.1/tools/scopes/required",
2558
+ chain: ["tools", "retrieveRequiredScopes"]
2559
+ },
2560
+ {
2561
+ method: "post",
2562
+ path: "/api/v3.1/trigger_instances/{slug}/upsert",
2563
+ chain: ["triggerInstances", "upsert"],
2564
+ schemes: ["ApiKeyAuth", "UserApiKeyAuth"],
2565
+ hasDeprecatedInputs: true
2566
+ },
2567
+ {
2568
+ method: "post",
2569
+ path: "/api/v3.1/webhook_endpoints",
2570
+ chain: ["webhookEndpoints", "create"]
2571
+ },
2572
+ {
2573
+ method: "post",
2574
+ path: "/api/v3.1/webhook_endpoints/{nano_id}",
2575
+ chain: ["webhookEndpoints", "replace"]
2576
+ },
2577
+ {
2578
+ method: "post",
2579
+ path: "/api/v3.1/webhook_subscriptions",
2580
+ chain: ["webhookSubscriptions", "create"]
2581
+ },
2582
+ {
2583
+ method: "post",
2584
+ path: "/api/v3.1/webhook_subscriptions/{id}/rotate_secret",
2585
+ chain: ["webhookSubscriptions", "rotateSecret"]
2586
+ }
2587
+ ];
2588
+ /**
2589
+ * The same descriptors, indexed by public chain — what a generated resource
2590
+ * resolves its own operation from at module load, so the kernel reads
2591
+ * identity off the call instead of recovering it from the URL.
2592
+ *
2593
+ * Built from the array rather than emitted a second time, so the two indexes
2594
+ * hold the *same objects* and cannot drift apart.
2595
+ */
2596
+ const GENERATED_OPERATIONS_BY_KEY = new Map(GENERATED_OPERATIONS.map((operation) => [operation.chain.join("."), operation]));
2597
+ /**
2598
+ * The descriptor a generated method dispatches with. A miss is a generator
2599
+ * defect, not a runtime condition, so it fails at import time rather than
2600
+ * silently degrading that method back to path matching.
2601
+ */
2602
+ const generatedOperation = (chainKey) => {
2603
+ const operation = GENERATED_OPERATIONS_BY_KEY.get(chainKey);
2604
+ if (operation === void 0) throw new Error(`generated-operations: no operation for chain '${chainKey}'`);
2605
+ return operation;
2606
+ };
2607
+
2608
+ //#endregion
2609
+ export { Auth as A, SCHEME_HEADERS as B, resolveIdentity as C, inspectDeprecatedInputs as D, mergeHeaders as E, chooseCredential as F, carriesCredentials as H, credentialHeader as I, resolveAuth as L, assertRequiredOperationHeaders as M, authConstructors as N, inspectDeprecation as O, authFromCredentials as P, resolveScope as R, reservedHeaders as S, buildHeaders as T, parseHTTPURL as U, assertCredentialTransport as V, resolveHTTPURL as W, shouldRetryResponse as _, TOO_MANY_REDIRECTS as a, createFetchTransport as b, buildURL as c, path as d, printableURL as f, safeJSON as g, rewriteForRedirect as h, REDIRECT_STATUSES as i, assertNoRemovedCredentialOptions as j, matchOperation as k, castToError as l, retryDelayMillis as m, generatedOperation as n, buildBody as o, readOperation as p, OPAQUE_REDIRECT as r, buildRequestHeaders as s, GENERATED_OPERATIONS as t, makeRequest as u, validatePositiveInteger as v, VERSION as w, assertNoReservedHeaders as x, withOperation as y, scopeForCall as z };