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

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 +618 -9
  2. package/dist/{client-D5v0_f-k.d.mts → api-key-revocation-DUHNHxSZ.d.mts} +5686 -2227
  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-BGA2C5nZ.mjs +222 -0
  334. package/dist/environments-xPjIJ-r7.d.mts +19 -0
  335. package/dist/error-Bw7_G2NZ.mjs +117 -0
  336. package/dist/{request-zLX87M09.mjs → generated-operations-DhZryVXy.mjs} +1493 -307
  337. package/dist/index.d.mts +3 -5
  338. package/dist/index.mjs +153 -1090
  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
@@ -0,0 +1,1626 @@
1
+ import { h as makeAPIErrorMessage, m as errorDetails, s as ComposioError } from "./error-Bw7_G2NZ.mjs";
2
+ import { B as SCHEME_HEADERS, C as resolveIdentity, D as inspectDeprecatedInputs, E as mergeHeaders, F as chooseCredential, H as carriesCredentials, I as credentialHeader, L as resolveAuth, M as assertRequiredOperationHeaders, N as authConstructors, O as inspectDeprecation, P as authFromCredentials, R as resolveScope, S as reservedHeaders, T as buildHeaders, U as parseHTTPURL, V as assertCredentialTransport, W as resolveHTTPURL, _ as shouldRetryResponse, a as TOO_MANY_REDIRECTS, c as buildURL, d as path, f as printableURL, g as safeJSON, h as rewriteForRedirect, i as REDIRECT_STATUSES, j as assertNoRemovedCredentialOptions, k as matchOperation, m as retryDelayMillis, n as generatedOperation, o as buildBody, r as OPAQUE_REDIRECT, s as buildRequestHeaders, t as GENERATED_OPERATIONS, v as validatePositiveInteger, w as VERSION, x as assertNoReservedHeaders, z as scopeForCall } from "./generated-operations-DhZryVXy.mjs";
3
+ import { i as classifySuccessBody, n as GENERATED_DEPRECATED_INPUTS, t as ENVIRONMENTS } from "./environments-BGA2C5nZ.mjs";
4
+ import { i as standardNextCursor, n as assertPageItems, r as isFinalCursor, t as assertCursorAdvanced } from "./pagination-rules-CMnBwktJ.mjs";
5
+ import { Config, Context, Data, Effect, Exit, Layer, Match, Option, Predicate, Redacted, References, Result, Stream, Tracer } from "effect";
6
+ import * as HttpClient from "effect/http/HttpClient";
7
+ import * as Headers from "effect/http/Headers";
8
+ import * as Schema from "effect/Schema";
9
+ import * as FetchHttpClient from "effect/http/FetchHttpClient";
10
+ import * as HttpBody from "effect/http/HttpBody";
11
+ import { StatusCodeError, isHttpClientError } from "effect/http/HttpClientError";
12
+ import * as HttpClientRequest from "effect/http/HttpClientRequest";
13
+ import * as UrlParams from "effect/http/UrlParams";
14
+
15
+ //#region src/effect/errors.ts
16
+ /**
17
+ * The failure model of the Effect surface: flat tagged errors, one per status
18
+ * class the compat client distinguishes, plus the failures that have no HTTP
19
+ * status at all.
20
+ *
21
+ * Every error is built with `Data.TaggedError`, so recovery is
22
+ * `Effect.catchTag` on a tag rather than a walk through a cause chain, and no
23
+ * Schema module is evaluated to construct one.
24
+ *
25
+ * What an error value may hold is deliberately narrow. It names the request by
26
+ * its method and a label built from the operation template — never the
27
+ * `HttpClientRequest`, whose headers carry the credential, and never the
28
+ * transport's own error, which holds that request. A success body is where
29
+ * this API returns secrets, so the decode error carries where and what kind,
30
+ * not the body.
31
+ */
32
+ var BadRequestError = class extends Data.TaggedError("@composio/client/BadRequestError") {};
33
+ var AuthenticationError = class extends Data.TaggedError("@composio/client/AuthenticationError") {};
34
+ var PermissionDeniedError = class extends Data.TaggedError("@composio/client/PermissionDeniedError") {};
35
+ var NotFoundError = class extends Data.TaggedError("@composio/client/NotFoundError") {};
36
+ var ConflictError = class extends Data.TaggedError("@composio/client/ConflictError") {};
37
+ var UnprocessableEntityError = class extends Data.TaggedError("@composio/client/UnprocessableEntityError") {};
38
+ var RateLimitError = class extends Data.TaggedError("@composio/client/RateLimitError") {};
39
+ /** Any status of 500 and above. */
40
+ var InternalServerError = class extends Data.TaggedError("@composio/client/InternalServerError") {};
41
+ /** A non-success status none of the other classes names. */
42
+ var APIError = class extends Data.TaggedError("@composio/client/APIError") {};
43
+ /**
44
+ * The request never produced a response: the transport failed below HTTP.
45
+ *
46
+ * The transport's error is reduced to `reason` (which of its failure kinds it
47
+ * was) and `description` (its own text, or its cause's messages).
48
+ */
49
+ var APIConnectionError = class extends Data.TaggedError("@composio/client/APIConnectionError") {};
50
+ /** An attempt outlived its time budget. */
51
+ var APIConnectionTimeoutError = class extends Data.TaggedError("@composio/client/APIConnectionTimeoutError") {};
52
+ /** A success response whose body is not what it claims to be. */
53
+ var DecodeError = class extends Data.TaggedError("@composio/client/DecodeError") {};
54
+ /**
55
+ * The client or the call is set up in a way no request can be made from: a
56
+ * credentialed origin that cannot carry a credential, a path parameter that
57
+ * would rewrite the path, a body that does not serialize. Retrying cannot
58
+ * change the answer.
59
+ */
60
+ var ConfigurationError = class extends Data.TaggedError("@composio/client/ConfigurationError") {};
61
+ /** What a caller is told when a request could not be built and the reason is not the kernel's own to give. */
62
+ const UNBUILDABLE = "The request could not be built: a header value, the URL or the body is not valid.";
63
+ /**
64
+ * Whatever a setup step threw, as a {@link ConfigurationError}.
65
+ *
66
+ * The message is copied only from an error the kernel itself raised: a
67
+ * rejected path parameter or option, an origin that cannot carry a credential,
68
+ * a pagination rule. Anything else comes from the platform or from the
69
+ * caller's own objects, and its text is not this client's to repeat. The
70
+ * platform's `Headers` quotes the value it refuses, and that value can be a
71
+ * credential.
72
+ */
73
+ const configurationErrorFrom = (cause) => new ConfigurationError({ message: cause instanceof ComposioError ? cause.message : UNBUILDABLE });
74
+ /** The status mapping of the compat client's `APIError.generate`. */
75
+ const apiErrorFromResponse = (fields) => {
76
+ const { status } = fields;
77
+ if (status === 400) return new BadRequestError(fields);
78
+ if (status === 401) return new AuthenticationError(fields);
79
+ if (status === 403) return new PermissionDeniedError(fields);
80
+ if (status === 404) return new NotFoundError(fields);
81
+ if (status === 409) return new ConflictError(fields);
82
+ if (status === 422) return new UnprocessableEntityError(fields);
83
+ if (status === 429) return new RateLimitError(fields);
84
+ if (status >= 500) return new InternalServerError(fields);
85
+ return new APIError(fields);
86
+ };
87
+ /**
88
+ * Every tag this surface fails with, and whether it is a status class. Typed
89
+ * against the union, so an error class added to it and not here does not compile.
90
+ */
91
+ const TAG_KINDS = {
92
+ "@composio/client/BadRequestError": "status",
93
+ "@composio/client/AuthenticationError": "status",
94
+ "@composio/client/PermissionDeniedError": "status",
95
+ "@composio/client/NotFoundError": "status",
96
+ "@composio/client/ConflictError": "status",
97
+ "@composio/client/UnprocessableEntityError": "status",
98
+ "@composio/client/RateLimitError": "status",
99
+ "@composio/client/InternalServerError": "status",
100
+ "@composio/client/APIError": "status",
101
+ "@composio/client/APIConnectionError": "other",
102
+ "@composio/client/APIConnectionTimeoutError": "other",
103
+ "@composio/client/DecodeError": "other",
104
+ "@composio/client/ConfigurationError": "other"
105
+ };
106
+ const tagOf = (value) => Predicate.hasProperty(value, "_tag") && typeof value._tag === "string" ? value._tag : void 0;
107
+ const kindOf = (value) => {
108
+ const tag = tagOf(value);
109
+ return tag !== void 0 && Object.hasOwn(TAG_KINDS, tag) ? TAG_KINDS[tag] : void 0;
110
+ };
111
+ /**
112
+ * Whether a value is an error for a non-success HTTP response, of any status
113
+ * class. Structural, so it holds across duplicated copies of this module.
114
+ */
115
+ const isAPIError = (value) => kindOf(value) === "status";
116
+ /** Whether a value is any error this surface produces. Structural, like {@link isAPIError}. */
117
+ const isComposioError = (value) => kindOf(value) !== void 0;
118
+
119
+ //#endregion
120
+ //#region src/effect/credentials.ts
121
+ /**
122
+ * How the Effect kernel holds credentials, and how it keeps them out of what
123
+ * the transport records.
124
+ *
125
+ * Which credential a request carries, and where it may go, is decided by the
126
+ * compat kernel's own functions (`../compat/credentials.ts`); nothing here
127
+ * restates a rule. What is specific to this surface is the wrapping — a
128
+ * credential is a `Redacted` for as long as the client holds it — and Effect's
129
+ * redaction list, which knows `x-api-key` and not the other two schemes.
130
+ */
131
+ const reveal = (key) => typeof key === "string" ? key : Redacted.value(key);
132
+ const EFFECT_CREDENTIAL = {
133
+ is: (value) => typeof value === "function" || typeof value === "string" || Redacted.isRedacted(value),
134
+ keyOf: (credential) => typeof credential === "function" ? void 0 : reveal(credential)
135
+ };
136
+ const hold = (credential) => {
137
+ if (typeof credential === "string") return Redacted.make(credential);
138
+ return credential;
139
+ };
140
+ const holdAuth = (auth) => ({
141
+ mode: auth.mode,
142
+ credentials: Object.fromEntries(Object.entries(auth.credentials).map(([scheme, credential]) => [scheme, hold(credential)]))
143
+ });
144
+ const providerFailed = () => new ConfigurationError({ message: "The `auth` credential provider failed." });
145
+ const keyOf = (credential) => {
146
+ if (typeof credential !== "function") return Effect.succeed(reveal(credential));
147
+ return Effect.tryPromise({
148
+ try: async () => reveal(await credential()),
149
+ catch: providerFailed
150
+ });
151
+ };
152
+ /** The compat kernel's rule, with failures as `ConfigurationError`s that hold neither the provider's error nor a key. */
153
+ const resolveCallCredential = (auth, baseURL, requestURL, operation, supplied) => {
154
+ const choice = chooseCredential(auth, baseURL, requestURL, operation, supplied);
155
+ if (choice === null) return Effect.succeed(null);
156
+ return Effect.flatMap(keyOf(choice.credential), (key) => Effect.try({
157
+ try: () => credentialHeader(choice.scheme, key),
158
+ catch: configurationErrorFrom
159
+ }));
160
+ };
161
+ const CREDENTIAL_HEADER_NAMES = Object.values(SCHEME_HEADERS);
162
+ /** The extended list for each list seen, so a request does not rebuild it. */
163
+ const extended = /* @__PURE__ */ new WeakMap();
164
+ /**
165
+ * Effect's redaction list with every credential header name on it, so a span
166
+ * attribute or a rendering of the request made while the transport handles it
167
+ * shows `<redacted>` for all three.
168
+ *
169
+ * The list in context is extended, not replaced: an application that added
170
+ * names of its own keeps them.
171
+ */
172
+ const withCredentialHeaderNames = (names) => {
173
+ const known = extended.get(names);
174
+ if (known !== void 0) return known;
175
+ const all = [...names, ...CREDENTIAL_HEADER_NAMES.filter((name) => !Headers.isRedactedName(name, names))];
176
+ extended.set(names, all);
177
+ return all;
178
+ };
179
+
180
+ //#endregion
181
+ //#region src/effect/decode.ts
182
+ /**
183
+ * Opt-in response validation: a success body checked against the operation's
184
+ * generated schema.
185
+ *
186
+ * Decoding is off unless a call or the client asks for it, and the schemas are
187
+ * not this module's to find. They arrive as a loader table the caller imports
188
+ * from `@composio/client/effect/schemas` and hands to the client, one dynamic
189
+ * `import()` per operation. Nothing the default entry reaches names that table
190
+ * or a schema module, so a client that never decodes never evaluates one, and
191
+ * a bundle of an application that never imports the table contains none.
192
+ *
193
+ * A schema here is a validator, not a parser. The caller gets the body exactly
194
+ * as it was parsed — a field the API returns ahead of the spec is not
195
+ * stripped — and this module's only answer is what, if anything, is wrong with
196
+ * it: where, and what kind of problem. Never the value found there, and never
197
+ * Effect's own rendering of the failure, which quotes it; a success body is
198
+ * where this API returns secrets.
199
+ */
200
+ /** What a client or a call that asks for decoding is told when no table was supplied. */
201
+ const SCHEMAS_MISSING = "Decoding needs the response schemas, and this client was given none: import { schemaLoaders } from '@composio/client/effect/schemas' and pass it as the `schemas` option.";
202
+ /** The same configuration message before dispatch and after a failed dynamic import. */
203
+ const schemaUnavailableMessage = (key) => `The response schema of '${key}' could not be loaded.`;
204
+ const segment = (key) => typeof key === "symbol" ? String(key) : key;
205
+ /**
206
+ * The leaves of an issue tree, each with the path the tree led to it by. The
207
+ * leaf's kind is its tag: `MissingKey`, `InvalidType`, `InvalidValue`, …
208
+ */
209
+ const leaves = (issue, path) => {
210
+ const leaf = ({ _tag }) => [{
211
+ path,
212
+ kind: _tag
213
+ }];
214
+ return Match.valueTags(issue, {
215
+ Pointer: (pointer) => leaves(pointer.issue, [...path, ...pointer.path.map(segment)]),
216
+ Composite: (composite) => composite.issues.flatMap((child) => leaves(child, path)),
217
+ AnyOf: (anyOf) => anyOf.issues.length === 0 ? leaf(anyOf) : anyOf.issues.flatMap((child) => leaves(child, path)),
218
+ Filter: (filter) => leaves(filter.issue, path),
219
+ Encoding: (encoding) => leaves(encoding.issue, path),
220
+ InvalidType: leaf,
221
+ InvalidValue: leaf,
222
+ MissingKey: leaf,
223
+ UnexpectedKey: leaf,
224
+ Forbidden: leaf,
225
+ OneOf: leaf
226
+ });
227
+ };
228
+ /** A union reports a problem once per member it tried; one mention of each is enough. */
229
+ const distinct = (issues) => [...new Map(issues.map((issue) => [JSON.stringify([issue.path, issue.kind]), issue])).values()];
230
+ /** What is wrong with `body` as a value of `schema`; empty when nothing is. */
231
+ const issuesOf = (schema, body) => {
232
+ const result = Schema.decodeUnknownResult(schema, { errors: "all" })(body);
233
+ return Result.isFailure(result) ? distinct(leaves(result.failure.issue, [])) : [];
234
+ };
235
+ /**
236
+ * Validates a success body against the response schema of the operation
237
+ * `key` names (`toolkits.list`), loading the schema from `loaders` first.
238
+ * Succeeds with the issues found, empty for a body that is what the spec says.
239
+ *
240
+ * A schema that cannot be loaded is a broken installation — a bundle that left
241
+ * the module out — and no request would change that.
242
+ */
243
+ const responseIssues = (loaders, key, body) => {
244
+ const unavailable = () => new ConfigurationError({ message: schemaUnavailableMessage(key) });
245
+ const load = loaders[key];
246
+ if (load === void 0) return Effect.fail(unavailable());
247
+ return Effect.map(Effect.tryPromise({
248
+ try: load,
249
+ catch: unavailable
250
+ }), (schema) => issuesOf(schema, body));
251
+ };
252
+
253
+ //#endregion
254
+ //#region src/effect/pagination.ts
255
+ /**
256
+ * Cursor pagination as a `Stream`: the items of a standard `items` /
257
+ * `next_cursor` operation, one page requested at a time and only when the
258
+ * stream is pulled that far, so a consumer that stops — or is interrupted —
259
+ * causes no further request.
260
+ *
261
+ * The cursor rules are the ones `./pagination` traverses by, called rather
262
+ * than restated: an absent, null or empty `next_cursor` ends the stream, a
263
+ * cursor the server repeats fails it, and so does a page-number envelope that
264
+ * leaves `next_cursor` out before its last page.
265
+ */
266
+ /**
267
+ * One page's items and the position after it, or the reason the traversal
268
+ * cannot go on. No request would change that reason, so it is a
269
+ * {@link ConfigurationError} carrying the message `./pagination` throws.
270
+ */
271
+ const advance = (page, seen) => Result.try({
272
+ try: () => {
273
+ const items = page.items;
274
+ assertPageItems(items);
275
+ const cursor = standardNextCursor(page);
276
+ if (isFinalCursor(cursor)) return [items, Option.none()];
277
+ assertCursorAdvanced(seen, cursor);
278
+ seen.add(cursor);
279
+ return [items, Option.some(cursor)];
280
+ },
281
+ catch: configurationErrorFrom
282
+ });
283
+ /**
284
+ * The items of every page `fetchPage` returns, in order. `fetchPage` is first
285
+ * called with no cursor, then with each `next_cursor` in turn.
286
+ */
287
+ const cursorStream = (fetchPage) => Stream.suspend(() => {
288
+ const seen = /* @__PURE__ */ new Set();
289
+ return Stream.paginate(void 0, (cursor) => Effect.flatMap(fetchPage(cursor), (page) => Effect.fromResult(advance(page, seen))));
290
+ });
291
+
292
+ //#endregion
293
+ //#region src/effect/deprecation.ts
294
+ /**
295
+ * Deprecation notices on the Effect surface.
296
+ *
297
+ * Deciding that a notice exists, wording it, and remembering that it was
298
+ * already given are the compat module's functions (`../compat/deprecation.ts`),
299
+ * called here with the same tables. This module owns only the way out: a
300
+ * notice is a `Warn` record on Effect's logger, so the application's logger
301
+ * and minimum log level decide what becomes of it.
302
+ */
303
+ const NOTICE_ANNOTATION = "composio.client.notice";
304
+ const DEPRECATION = "deprecation";
305
+ const noticeAnnotation = (options) => options.fiber.getRef(References.CurrentLogAnnotations)[NOTICE_ANNOTATION];
306
+ /** Whether a log record is one of this client's deprecation notices, for a `Logger` that drops or routes them. */
307
+ const isDeprecationNotice = Predicate.mapInput((value) => value === DEPRECATION, noticeAnnotation);
308
+ const logNotice = (message) => Effect.logWarning(message).pipe(Effect.annotateLogs(NOTICE_ANNOTATION, DEPRECATION));
309
+ /** The compat inspectors report through a callback; this collects what one of them said. */
310
+ const warnings = (inspect) => {
311
+ const messages = [];
312
+ inspect((message) => messages.push(message));
313
+ return messages.length === 0 ? Effect.void : Effect.forEach(messages, logNotice, { discard: true });
314
+ };
315
+ /**
316
+ * The notice for inputs the spec marks deprecated, decided from the request
317
+ * alone — so it is given before dispatch, whatever the transport then does.
318
+ * `seen` is the client's (operation, notice) record, so one client warns once.
319
+ */
320
+ const noticeDeprecatedInputs = (seen, input) => input.operation === null ? Effect.void : Effect.suspend(() => warnings((warn) => inspectDeprecatedInputs({
321
+ operation: input.operation,
322
+ query: input.query,
323
+ body: input.body,
324
+ headers: input.headers(),
325
+ table: GENERATED_DEPRECATED_INPUTS,
326
+ seen,
327
+ warn
328
+ })));
329
+ /**
330
+ * The notice a response carries in its `Deprecation`, `Sunset` and `Link`
331
+ * fields. Given for the response a call ends with, never for one that is
332
+ * discarded and retried or for a hop of a redirect chain.
333
+ */
334
+ const noticeDeprecatedResponse = (seen, input) => Effect.suspend(() => warnings((warn) => inspectDeprecation({
335
+ response: {
336
+ headers: new globalThis.Headers(input.headers),
337
+ url: input.url
338
+ },
339
+ method: input.method,
340
+ path: input.path,
341
+ operation: input.operation ?? void 0,
342
+ baseURL: input.baseURL,
343
+ operations: GENERATED_OPERATIONS,
344
+ seen,
345
+ warn
346
+ })));
347
+
348
+ //#endregion
349
+ //#region src/effect/request.ts
350
+ /**
351
+ * The Effect kernel's request path: an operation and its arguments in, an
352
+ * `Effect` of the parsed response out.
353
+ *
354
+ * Everything that decides *what* is sent — the URL, the query string, the
355
+ * body, the header precedence, which credential a request carries — is the
356
+ * compat kernel's own function, called here rather than restated, so the two
357
+ * surfaces cannot drift apart on the wire. This module owns only what differs:
358
+ * the transport is Effect's `HttpClient`, and failures are values.
359
+ */
360
+ const PLACEHOLDER = /\{[^}]+\}/;
361
+ /**
362
+ * The methods RFC 9110 (section 9.2.2) defines as idempotent: repeating one has
363
+ * the effect of sending it once. Only a call with one of these takes the
364
+ * client's retries by default. Any other call, `POST` and `PATCH` included, is
365
+ * sent once unless it sets `maxRetries` itself, because a write that failed in
366
+ * flight may already have acted, and repeating it would repeat the effect.
367
+ */
368
+ const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
369
+ "GET",
370
+ "HEAD",
371
+ "OPTIONS",
372
+ "PUT",
373
+ "DELETE"
374
+ ]);
375
+ /** An operation's public chain, dotted: the key its schema is loaded by and the name a `DecodeError` gives it. */
376
+ const operationKey = (operation) => operation?.chain.join(".");
377
+ /**
378
+ * A template's parameters filled in through the compat `path` tag, so encoding
379
+ * and the rejection of `.`/`..` segments are that function's and not a copy.
380
+ */
381
+ const substitute = (template, params) => {
382
+ const statics = template.split(PLACEHOLDER);
383
+ return path(Object.assign(statics, { raw: statics }), ...params);
384
+ };
385
+ const hopHeaders = (prepared, hop) => buildRequestHeaders(prepared.headerConfig, { headers: prepared.callHeaders }, hop.url, hop.bodyHeaders, hop.withdrawn, prepared.call);
386
+ const check = (kernel, call) => {
387
+ const callHeaders = call.headers();
388
+ assertNoReservedHeaders(callHeaders, kernel.reserved, "headers");
389
+ if (!call.recovered) assertRequiredOperationHeaders(call.operation, call.operationHeaders);
390
+ const path = call.path();
391
+ if (call.options?.timeout !== void 0) validatePositiveInteger("timeout", call.options.timeout);
392
+ const resolvedRetries = call.options?.maxRetries ?? kernel.maxRetries;
393
+ validatePositiveInteger("maxRetries", resolvedRetries);
394
+ const maxRetries = call.options?.maxRetries !== void 0 || IDEMPOTENT_METHODS.has(call.method.toUpperCase()) ? resolvedRetries : 0;
395
+ const decode = call.options?.decode ?? kernel.decode;
396
+ if (decode) {
397
+ if (kernel.schemas === void 0) throw new ComposioError(SCHEMAS_MISSING);
398
+ const operation = operationKey(call.operation);
399
+ if (operation !== void 0 && kernel.schemas[operation] === void 0) throw new ComposioError(schemaUnavailableMessage(operation));
400
+ }
401
+ const { url, query } = buildURL(kernel, {
402
+ path,
403
+ query: call.query
404
+ });
405
+ const { body, bodyHeaders } = buildBody({ body: call.body });
406
+ return {
407
+ method: call.method,
408
+ path,
409
+ label: printableURL(url, call.operation),
410
+ operation: call.operation,
411
+ query,
412
+ headerConfig: {
413
+ baseURL: kernel.baseURL,
414
+ allowedHTTPOrigin: kernel.allowedHTTPOrigin,
415
+ userAgent: kernel.userAgent,
416
+ defaultHeaders: kernel.defaultHeaders,
417
+ identity: kernel.identity
418
+ },
419
+ callHeaders,
420
+ scope: scopeForCall(kernel.scope, call.operationHeaders),
421
+ maxRetries,
422
+ timeout: call.options?.timeout ?? kernel.timeout,
423
+ schemas: decode ? kernel.schemas : void 0,
424
+ url,
425
+ body,
426
+ bodyHeaders
427
+ };
428
+ };
429
+ const withFirstHop = (checked, credential) => {
430
+ const { scope, url, body, bodyHeaders, ...rest } = checked;
431
+ const shared = {
432
+ ...rest,
433
+ call: {
434
+ credential,
435
+ scope
436
+ }
437
+ };
438
+ const first = {
439
+ url,
440
+ method: checked.method.toUpperCase(),
441
+ body,
442
+ bodyHeaders,
443
+ withdrawn: false,
444
+ index: 0
445
+ };
446
+ return {
447
+ ...shared,
448
+ first: {
449
+ ...first,
450
+ headers: hopHeaders(shared, first)
451
+ }
452
+ };
453
+ };
454
+ /** Checks the call, resolves its credential once for every attempt and hop, and builds its first hop. */
455
+ const prepare = (kernel, call) => Effect.try({
456
+ try: () => check(kernel, call),
457
+ catch: configurationErrorFrom
458
+ }).pipe(Effect.flatMap((checked) => Effect.map(resolveCallCredential(kernel.auth, kernel.baseURL, checked.url, call.operation, call.operationHeaders), (credential) => ({
459
+ checked,
460
+ credential
461
+ }))), Effect.flatMap(({ checked, credential }) => Effect.try({
462
+ try: () => withFirstHop(checked, credential),
463
+ catch: configurationErrorFrom
464
+ })));
465
+ /**
466
+ * Built from its parts rather than through `HttpClientRequest.make`: the URL
467
+ * already carries its query, serialized by the compat rules, and must reach
468
+ * the transport as that exact string. The body goes out as the same JSON text
469
+ * the compat client hands `fetch`.
470
+ */
471
+ const toRequest = (hop) => HttpClientRequest.makeWith(hop.method, hop.url, UrlParams.empty, Option.none(), Headers.fromInput(hop.headers), hop.body === void 0 ? HttpBody.empty : HttpBody.raw(hop.body, { contentType: "application/json" }));
472
+ /** A transport cause's own words, following `cause` a few levels down. */
473
+ const describeCause = (cause, depth = 0) => {
474
+ if (typeof cause === "string") return cause;
475
+ if (typeof cause !== "object" || cause === null) return void 0;
476
+ const message = "message" in cause && typeof cause.message === "string" ? cause.message : void 0;
477
+ const nested = depth < 3 && "cause" in cause ? describeCause(cause.cause, depth + 1) : void 0;
478
+ if (message === void 0 || message === "") return nested;
479
+ return nested === void 0 || nested === "" ? message : `${message}: ${nested}`;
480
+ };
481
+ /** The transport's error reduced to text; the error itself holds the request. */
482
+ const describeTransport = (error) => error.reason.description ?? describeCause(error.reason.cause);
483
+ const connectionError = (prepared, error) => new APIConnectionError({
484
+ message: "Connection error.",
485
+ method: prepared.first.method,
486
+ url: prepared.label,
487
+ reason: error.reason._tag,
488
+ description: describeTransport(error)
489
+ });
490
+ const timeoutError = (prepared) => new APIConnectionTimeoutError({
491
+ message: "Request timed out.",
492
+ method: prepared.first.method,
493
+ url: prepared.label
494
+ });
495
+ const terminal = (error) => ({
496
+ error,
497
+ retryable: false
498
+ });
499
+ const refusedChain = (prepared, reason, message) => terminal(new APIConnectionError({
500
+ message,
501
+ method: prepared.first.method,
502
+ url: prepared.label,
503
+ reason,
504
+ description: void 0
505
+ }));
506
+ /** The compat kernel reads a transport failure that says it timed out as a timeout; so does this one. */
507
+ const TIMED_OUT = /timed? ?out/i;
508
+ const transportFailure = (prepared, error) => {
509
+ const failed = connectionError(prepared, error);
510
+ return {
511
+ error: TIMED_OUT.test(failed.description ?? "") ? timeoutError(prepared) : failed,
512
+ retryable: true
513
+ };
514
+ };
515
+ const untraced = () => true;
516
+ /**
517
+ * What a span of this request may end on in place of the transport's error.
518
+ *
519
+ * Effect ends a client span on an `HttpClientError` — for a failure below
520
+ * HTTP, and for a 4xx or 5xx answer too, which it marks failed with one it
521
+ * builds itself. That error holds the request, credential headers and all, and
522
+ * a tracer keeps it past the scope the redaction list is extended in. The span
523
+ * gets the error this client would fail with instead, as far as it is known
524
+ * when the span ends: the status class, before the body is read.
525
+ */
526
+ const spanError = (prepared, error) => {
527
+ if (!isHttpClientError(error)) return error;
528
+ const response = error.response;
529
+ if (response === void 0 || response.status < 400) return transportFailure(prepared, error).error;
530
+ return apiErrorFromResponse({
531
+ message: makeAPIErrorMessage(response.status, void 0, void 0),
532
+ method: prepared.first.method,
533
+ url: prepared.label,
534
+ status: response.status,
535
+ requestId: requestIdOf(response),
536
+ details: void 0,
537
+ body: void 0
538
+ });
539
+ };
540
+ /**
541
+ * The tracer in context, with every span it opens for this request using only
542
+ * the operation template in URL attributes and ending on {@link spanError}.
543
+ * The span is the tracer's own object, changed in place:
544
+ * a tracer recognizes its spans by identity, which a wrapper would not have.
545
+ */
546
+ const guardingSpans = (prepared) => (tracer) => Tracer.make({
547
+ span: (options) => {
548
+ const span = tracer.span(options);
549
+ const attribute = span.attribute.bind(span);
550
+ span.attribute = (key, value) => {
551
+ if (key === "url.full") return attribute(key, prepared.label);
552
+ if (key === "url.path") return attribute(key, prepared.operation?.path ?? "/<custom>");
553
+ if (key === "url.query") return;
554
+ attribute(key, value);
555
+ };
556
+ const end = span.end.bind(span);
557
+ span.end = (endTime, exit) => {
558
+ end(endTime, Exit.mapError(exit, (error) => spanError(prepared, error)));
559
+ };
560
+ return span;
561
+ },
562
+ context: tracer.context?.bind(tracer)
563
+ });
564
+ /**
565
+ * One exchange with the transport: a hop in, a response or a failure out.
566
+ *
567
+ * This is the single point every request crosses, and where the client's own
568
+ * configuration is laid over whatever `HttpClient` it was given: the redirect
569
+ * mode a fetch-backed transport dispatches in, the tracing mode, and the
570
+ * credential header names on the redaction list. The application's
571
+ * `RequestInit` is kept except for `redirect`, which is the kernel's — a
572
+ * transport that followed a credentialed request on its own would forward the
573
+ * credential across origins.
574
+ *
575
+ * All of it is one edit of the context, each value read from the context the
576
+ * call runs in.
577
+ */
578
+ const exchange = (kernel, prepared, hop, redirect) => Effect.suspend(() => kernel.httpClient.execute(toRequest(hop))).pipe(Effect.updateContext((context) => {
579
+ const overlay = Context.empty().pipe(Context.add(FetchHttpClient.RequestInit, {
580
+ ...Context.getOrUndefined(context, FetchHttpClient.RequestInit),
581
+ redirect
582
+ }), Context.add(Headers.CurrentRedactedNames, withCredentialHeaderNames(Context.get(context, Headers.CurrentRedactedNames))), kernel.tracing === "off" ? Context.add(HttpClient.TracerDisabledWhen, untraced) : Context.add(Tracer.Tracer, guardingSpans(prepared)(Context.get(context, Tracer.Tracer))), kernel.tracing === "propagate" ? (self) => self : Context.add(HttpClient.TracerPropagationEnabled, false));
583
+ return Context.merge(context, overlay);
584
+ }), Effect.catch((error) => error.response !== void 0 && error.reason instanceof StatusCodeError ? Effect.succeed(error.response) : Effect.fail(transportFailure(prepared, error))));
585
+ /**
586
+ * Gives up a response the kernel will not read: one it retries past, or a
587
+ * redirect it follows by hand. Left alone, its request is aborted only when
588
+ * the response is garbage-collected, and the connection stays checked out
589
+ * until then.
590
+ *
591
+ * The body is opened and closed without a read, so its size does not matter.
592
+ * Closing it cancels the underlying stream and ends that request, which is
593
+ * the one request this response came from: the next attempt or hop has its
594
+ * own. It happens on a fiber of its own, since the call does not wait for it
595
+ * and nothing that goes wrong in it is the call's failure. A response with no
596
+ * body, or from a transport that has nothing to cancel, loses nothing.
597
+ */
598
+ const discard = (response) => Effect.asVoid(Effect.forkDetach(Effect.ignoreCause(Effect.suspend(() => Effect.scoped(Stream.toPull(response.stream)))), { startImmediately: true }));
599
+ /**
600
+ * One attempt: the request, plus however many redirects it takes to land on a
601
+ * response that is not one.
602
+ *
603
+ * The loop is the compat kernel's `dispatchWithRedirects`, hop for hop. The
604
+ * headers of every hop are rebuilt from the URL that hop goes to, so a hop
605
+ * off the configured origin carries no credential; once the chain has changed
606
+ * origin the caller's own credential headers are withdrawn too, for the rest
607
+ * of it. The method and body follow fetch's 301/302/303 rewrite.
608
+ *
609
+ * A first dispatch that carries nothing credential-bearing is handed to the
610
+ * platform to follow, as there: nothing can leak, and it is the only way a
611
+ * browser follows at all. Reading a `Location` needs a transport that returns
612
+ * the 3xx itself — a fetch-backed one in `redirect: 'manual'` does, on Node
613
+ * and on Bun.
614
+ */
615
+ const followChain = (kernel, prepared, hop) => {
616
+ const delegated = hop.index === 0 && !carriesCredentials(hop.headers);
617
+ return Effect.flatMap(exchange(kernel, prepared, hop, delegated ? "follow" : "manual"), (response) => {
618
+ if (delegated) return Effect.succeed(response);
619
+ if (response.status === 0) return Effect.fail(refusedChain(prepared, "OpaqueRedirect", OPAQUE_REDIRECT));
620
+ if (!REDIRECT_STATUSES.has(response.status)) return Effect.succeed(response);
621
+ const location = response.headers["location"];
622
+ if (location === void 0) return Effect.succeed(response);
623
+ const target = resolveHTTPURL(location, hop.url);
624
+ if (target === null) return Effect.succeed(response);
625
+ if (hop.index >= 20) return Effect.andThen(discard(response), Effect.fail(refusedChain(prepared, "TooManyRedirects", TOO_MANY_REDIRECTS)));
626
+ const rewritten = rewriteForRedirect(response.status, hop.method);
627
+ const next = {
628
+ url: target.href,
629
+ method: rewritten ? "GET" : hop.method,
630
+ body: rewritten ? void 0 : hop.body,
631
+ bodyHeaders: rewritten ? void 0 : hop.bodyHeaders,
632
+ withdrawn: hop.withdrawn || target.origin !== new URL(hop.url).origin,
633
+ index: hop.index + 1
634
+ };
635
+ return Effect.andThen(discard(response), Effect.flatMap(Effect.try({
636
+ try: () => ({
637
+ ...next,
638
+ headers: hopHeaders(prepared, next)
639
+ }),
640
+ catch: (cause) => terminal(configurationErrorFrom(cause))
641
+ }), (following) => followChain(kernel, prepared, following)));
642
+ });
643
+ };
644
+ /**
645
+ * One attempt inside its time budget. The whole redirect chain shares the
646
+ * budget, so a chain cannot multiply it by the hop limit; running out
647
+ * interrupts the exchange in flight, which aborts its request.
648
+ */
649
+ const attempt = (kernel, prepared) => Effect.timeoutOrElse(followChain(kernel, prepared, prepared.first), {
650
+ duration: prepared.timeout,
651
+ orElse: () => Effect.fail({
652
+ error: timeoutError(prepared),
653
+ retryable: true
654
+ })
655
+ });
656
+ /**
657
+ * The attempt loop, with the compat kernel's schedule: a connection failure
658
+ * or a timeout is retried, as is a response the server marks retryable
659
+ * (`x-should-retry`) or whose status is 408, 409, 429 or 5xx. How many times
660
+ * is `prepare`'s decision, which is where the method counts. The wait is
661
+ * `retry-after-ms`, then `retry-after`, then exponential backoff — that
662
+ * module's `retryDelayMillis`, slept on Effect's clock.
663
+ *
664
+ * A retry re-issues the original request, redirect chain and all.
665
+ */
666
+ const withRetries = (kernel, prepared, numRetries) => Effect.flatMap(Effect.result(attempt(kernel, prepared)), (result) => {
667
+ const retriesRemaining = prepared.maxRetries - numRetries;
668
+ if (Result.isFailure(result)) {
669
+ const { error, retryable } = result.failure;
670
+ return retryable && retriesRemaining > 0 ? retryAfter(kernel, prepared, numRetries, retryDelayMillis(numRetries)) : Effect.fail(error);
671
+ }
672
+ const response = result.success;
673
+ if (retriesRemaining > 0 && (response.status < 200 || response.status > 299)) {
674
+ const headers = new globalThis.Headers(response.headers);
675
+ if (shouldRetryResponse({
676
+ status: response.status,
677
+ headers
678
+ })) return Effect.andThen(discard(response), retryAfter(kernel, prepared, numRetries, retryDelayMillis(numRetries, headers)));
679
+ }
680
+ return Effect.succeed(response);
681
+ });
682
+ /** The next attempt, once the wait before it is over. */
683
+ const retryAfter = (kernel, prepared, numRetries, delayMillis) => Effect.flatMap(Effect.sleep(delayMillis), () => withRetries(kernel, prepared, numRetries + 1));
684
+ /** `APIError.requestId`'s rule: an empty header is "no id", so the envelope still wins. */
685
+ const requestIdOf = (response, envelopeId) => response.headers["x-request-id"] || envelopeId;
686
+ const failForStatus = (prepared, response) => response.text.pipe(Effect.catch((error) => Effect.succeed(describeTransport(error) ?? "")), Effect.flatMap((text) => {
687
+ const body = safeJSON(text);
688
+ const details = errorDetails(body);
689
+ return Effect.fail(apiErrorFromResponse({
690
+ message: makeAPIErrorMessage(response.status, body, body ? void 0 : text),
691
+ method: prepared.first.method,
692
+ url: prepared.label,
693
+ status: response.status,
694
+ requestId: requestIdOf(response, details?.request_id),
695
+ details,
696
+ body
697
+ }));
698
+ }));
699
+ const invalidJSON = (prepared, response) => new DecodeError({
700
+ message: "The response body is not valid JSON.",
701
+ method: prepared.first.method,
702
+ url: prepared.label,
703
+ status: response.status,
704
+ requestId: requestIdOf(response),
705
+ operation: operationKey(prepared.operation),
706
+ issues: [{
707
+ path: [],
708
+ kind: "InvalidJSON"
709
+ }]
710
+ });
711
+ /**
712
+ * The body, once it has passed the operation's schema — when the call asked
713
+ * for that and there is an operation to have one. What comes back is the value
714
+ * that went in, never the schema's output, so nothing the spec does not
715
+ * declare is lost.
716
+ */
717
+ const validated = (prepared, response, body) => {
718
+ const operation = operationKey(prepared.operation);
719
+ if (prepared.schemas === void 0 || operation === void 0) return Effect.succeed(body);
720
+ return Effect.flatMap(responseIssues(prepared.schemas, operation, body), (issues) => issues.length === 0 ? Effect.succeed(body) : Effect.fail(new DecodeError({
721
+ message: `The response body does not match the schema of '${operation}'.`,
722
+ method: prepared.first.method,
723
+ url: prepared.label,
724
+ status: response.status,
725
+ requestId: requestIdOf(response),
726
+ operation,
727
+ issues
728
+ })));
729
+ };
730
+ /**
731
+ * Response parsing by the compat rules: a non-2xx is its status class, a 204
732
+ * is `null`, a JSON media type is parsed (or `undefined` when empty), anything
733
+ * else is text. A 204 has no body to validate; every other success is held to
734
+ * the schema when decoding is on, whatever it was read as.
735
+ */
736
+ const parse = (prepared, response, headers) => {
737
+ if (response.status < 200 || response.status > 299) return failForStatus(prepared, response);
738
+ const kind = classifySuccessBody(response.status, headers["content-type"], headers["content-length"]);
739
+ if (kind === "null") return Effect.succeed(null);
740
+ if (kind === "undefined") return validated(prepared, response, void 0);
741
+ const text = Effect.mapError(response.text, (error) => connectionError(prepared, error));
742
+ if (kind === "text") return Effect.flatMap(text, (body) => validated(prepared, response, body));
743
+ return Effect.flatMap(text, (json) => Effect.flatMap(Effect.try({
744
+ try: () => JSON.parse(json),
745
+ catch: () => invalidJSON(prepared, response)
746
+ }), (body) => validated(prepared, response, body)));
747
+ };
748
+ const dispatch = (kernel, call) => prepare(kernel, call).pipe(Effect.flatMap((prepared) => {
749
+ const noticed = call.recovered || prepared.operation?.hasDeprecatedInputs === true ? noticeDeprecatedInputs(kernel.deprecationSeen, {
750
+ operation: prepared.operation,
751
+ query: prepared.query,
752
+ body: call.body,
753
+ headers: () => buildHeaders([kernel.defaultHeaders, prepared.callHeaders])
754
+ }) : void 0;
755
+ const exchanged = withRetries(kernel, prepared, 0);
756
+ return Effect.flatMap(noticed === void 0 ? exchanged : Effect.andThen(noticed, exchanged), (response) => {
757
+ const headers = response.headers;
758
+ if (headers["deprecation"] === void 0) return parse(prepared, response, headers);
759
+ return Effect.flatMap(noticeDeprecatedResponse(kernel.deprecationSeen, {
760
+ method: prepared.method,
761
+ path: prepared.path,
762
+ operation: prepared.operation,
763
+ baseURL: kernel.baseURL,
764
+ url: response.url,
765
+ headers
766
+ }), () => parse(prepared, response, headers));
767
+ });
768
+ }));
769
+ /**
770
+ * Runs one declared operation. This is what every generated resource method
771
+ * calls: the operation's own descriptor, its arguments, and the caller's
772
+ * per-call options.
773
+ */
774
+ const executeOperation = (kernel, operation, args, options) => dispatch(kernel, {
775
+ method: operation.method,
776
+ path: () => substitute(operation.path, args.path ?? []),
777
+ query: args.query,
778
+ body: args.body,
779
+ headers: () => args.headers === void 0 ? options?.headers : mergeHeaders([args.headers, options?.headers]),
780
+ operationHeaders: args.operationHeaders,
781
+ operation,
782
+ recovered: false,
783
+ options
784
+ });
785
+ /**
786
+ * Runs a request to a path given verbatim — the raw `get`/`post`/`put`/
787
+ * `patch`/`delete` methods. The operation is recovered by matching the path
788
+ * against the table, as the compat client does, so a raw call to a declared
789
+ * path authenticates the way its typed twin would.
790
+ */
791
+ const executeRaw = (kernel, method, path, options) => dispatch(kernel, {
792
+ method,
793
+ path: () => path,
794
+ query: options?.query,
795
+ body: options?.body,
796
+ headers: () => options?.headers,
797
+ operationHeaders: void 0,
798
+ operation: matchOperation(method, path, GENERATED_OPERATIONS),
799
+ recovered: true,
800
+ options
801
+ });
802
+
803
+ //#endregion
804
+ //#region src/effect/generated/resources/tool-router/session/files.ts
805
+ const OP_LIST$15 = generatedOperation("toolRouter.session.files.list");
806
+ const OP_DELETE$7 = generatedOperation("toolRouter.session.files.delete");
807
+ const OP_CREATE_DOWNLOAD_URL = generatedOperation("toolRouter.session.files.createDownloadURL");
808
+ const OP_CREATE_UPLOAD_URL = generatedOperation("toolRouter.session.files.createUploadURL");
809
+ const makeFiles$1 = (kernel) => {
810
+ const resource = {
811
+ list: (mountID, params, options) => {
812
+ const { session_id, ...query } = params;
813
+ return executeOperation(kernel, OP_LIST$15, {
814
+ path: [session_id, mountID],
815
+ query
816
+ }, options);
817
+ },
818
+ listStream: (mountID, params, options) => cursorStream((cursor) => resource.list(mountID, cursor === void 0 ? params : {
819
+ ...params,
820
+ cursor
821
+ }, options)),
822
+ delete: (mountID, params, options) => {
823
+ const { session_id, ...body } = params;
824
+ return executeOperation(kernel, OP_DELETE$7, {
825
+ path: [session_id, mountID],
826
+ body
827
+ }, options);
828
+ },
829
+ createDownloadURL: (mountID, params, options) => {
830
+ const { session_id, ...body } = params;
831
+ return executeOperation(kernel, OP_CREATE_DOWNLOAD_URL, {
832
+ path: [session_id, mountID],
833
+ body
834
+ }, options);
835
+ },
836
+ createUploadURL: (mountID, params, options) => {
837
+ const { session_id, ...body } = params;
838
+ return executeOperation(kernel, OP_CREATE_UPLOAD_URL, {
839
+ path: [session_id, mountID],
840
+ body
841
+ }, options);
842
+ }
843
+ };
844
+ return resource;
845
+ };
846
+
847
+ //#endregion
848
+ //#region src/effect/generated/resources/tool-router/session/session.ts
849
+ const OP_CREATE$9 = generatedOperation("toolRouter.session.create");
850
+ const OP_RETRIEVE$14 = generatedOperation("toolRouter.session.retrieve");
851
+ const OP_DELETE$6 = generatedOperation("toolRouter.session.delete");
852
+ const OP_ATTACH = generatedOperation("toolRouter.session.attach");
853
+ const OP_CONFIG_HISTORY = generatedOperation("toolRouter.session.configHistory");
854
+ const OP_EXECUTE$1 = generatedOperation("toolRouter.session.execute");
855
+ const OP_EXECUTE_META = generatedOperation("toolRouter.session.executeMeta");
856
+ const OP_LINK = generatedOperation("toolRouter.session.link");
857
+ const OP_PATCH$1 = generatedOperation("toolRouter.session.patch");
858
+ const OP_PROXY_EXECUTE = generatedOperation("toolRouter.session.proxyExecute");
859
+ const OP_SEARCH = generatedOperation("toolRouter.session.search");
860
+ const OP_TOOLKITS = generatedOperation("toolRouter.session.toolkits");
861
+ const OP_TOOLS = generatedOperation("toolRouter.session.tools");
862
+ const makeSession$1 = (kernel) => {
863
+ const resource = {
864
+ files: makeFiles$1(kernel),
865
+ create: (body, options) => executeOperation(kernel, OP_CREATE$9, { body }, options),
866
+ retrieve: (sessionID, options) => executeOperation(kernel, OP_RETRIEVE$14, { path: [sessionID] }, options),
867
+ delete: (sessionID, options) => executeOperation(kernel, OP_DELETE$6, { path: [sessionID] }, options),
868
+ attach: (sessionID, body = {}, options) => executeOperation(kernel, OP_ATTACH, {
869
+ path: [sessionID],
870
+ body
871
+ }, options),
872
+ configHistory: (sessionID, query = {}, options) => executeOperation(kernel, OP_CONFIG_HISTORY, {
873
+ path: [sessionID],
874
+ query
875
+ }, options),
876
+ configHistoryStream: (sessionID, query, options) => cursorStream((cursor) => resource.configHistory(sessionID, cursor === void 0 ? query : {
877
+ ...query,
878
+ cursor
879
+ }, options)),
880
+ execute: (sessionID, body, options) => executeOperation(kernel, OP_EXECUTE$1, {
881
+ path: [sessionID],
882
+ body
883
+ }, options),
884
+ executeMeta: (sessionID, body, options) => executeOperation(kernel, OP_EXECUTE_META, {
885
+ path: [sessionID],
886
+ body
887
+ }, options),
888
+ link: (sessionID, body, options) => executeOperation(kernel, OP_LINK, {
889
+ path: [sessionID],
890
+ body
891
+ }, options),
892
+ patch: (sessionID, body = {}, options) => executeOperation(kernel, OP_PATCH$1, {
893
+ path: [sessionID],
894
+ body
895
+ }, options),
896
+ proxyExecute: (sessionID, body, options) => executeOperation(kernel, OP_PROXY_EXECUTE, {
897
+ path: [sessionID],
898
+ body
899
+ }, options),
900
+ search: (sessionID, body, options) => executeOperation(kernel, OP_SEARCH, {
901
+ path: [sessionID],
902
+ body
903
+ }, options),
904
+ toolkits: (sessionID, query = {}, options) => executeOperation(kernel, OP_TOOLKITS, {
905
+ path: [sessionID],
906
+ query
907
+ }, options),
908
+ toolkitsStream: (sessionID, query, options) => cursorStream((cursor) => resource.toolkits(sessionID, cursor === void 0 ? query : {
909
+ ...query,
910
+ cursor
911
+ }, options)),
912
+ tools: (sessionID, query = {}, options) => executeOperation(kernel, OP_TOOLS, {
913
+ path: [sessionID],
914
+ query
915
+ }, options),
916
+ toolsStream: (sessionID, query, options) => cursorStream((cursor) => resource.tools(sessionID, cursor === void 0 ? query : {
917
+ ...query,
918
+ cursor
919
+ }, options))
920
+ };
921
+ return resource;
922
+ };
923
+
924
+ //#endregion
925
+ //#region src/effect/generated/resources/tool-router/tool-router.ts
926
+ const makeToolRouter = (kernel) => ({ session: makeSession$1(kernel) });
927
+
928
+ //#endregion
929
+ //#region src/effect/generated/resources/tools.ts
930
+ const OP_RETRIEVE$13 = generatedOperation("tools.retrieve");
931
+ const OP_LIST$14 = generatedOperation("tools.list");
932
+ const OP_EXECUTE = generatedOperation("tools.execute");
933
+ const OP_GET_INPUT = generatedOperation("tools.getInput");
934
+ const OP_PROXY = generatedOperation("tools.proxy");
935
+ const OP_RETRIEVE_ENUM$1 = generatedOperation("tools.retrieveEnum");
936
+ const OP_RETRIEVE_REQUIRED_SCOPES = generatedOperation("tools.retrieveRequiredScopes");
937
+ const makeTools$1 = (kernel) => {
938
+ const resource = {
939
+ retrieve: (toolSlug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE$13, {
940
+ path: [toolSlug],
941
+ query
942
+ }, options),
943
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$14, { query }, options),
944
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
945
+ ...query,
946
+ cursor
947
+ }, options)),
948
+ execute: (toolSlug, params = {}, options) => {
949
+ const { "x-llm-gateway-headers": xLlmGatewayHeaders, ...body } = params ?? {};
950
+ return executeOperation(kernel, OP_EXECUTE, {
951
+ path: [toolSlug],
952
+ body,
953
+ headers: { ...xLlmGatewayHeaders != null ? { "x-llm-gateway-headers": xLlmGatewayHeaders } : void 0 }
954
+ }, options);
955
+ },
956
+ getInput: (toolSlug, body, options) => executeOperation(kernel, OP_GET_INPUT, {
957
+ path: [toolSlug],
958
+ body
959
+ }, options),
960
+ proxy: (body, options) => executeOperation(kernel, OP_PROXY, { body }, options),
961
+ retrieveEnum: (options) => executeOperation(kernel, OP_RETRIEVE_ENUM$1, {}, options),
962
+ retrieveRequiredScopes: (body, options) => executeOperation(kernel, OP_RETRIEVE_REQUIRED_SCOPES, { body }, options)
963
+ };
964
+ return resource;
965
+ };
966
+
967
+ //#endregion
968
+ //#region src/effect/generated/resources/files.ts
969
+ const OP_LIST$13 = generatedOperation("files.list");
970
+ const OP_CREATE_PRESIGNED_URL = generatedOperation("files.createPresignedURL");
971
+ const makeFiles = (kernel) => {
972
+ const resource = {
973
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$13, { query }, options),
974
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
975
+ ...query,
976
+ cursor
977
+ }, options)),
978
+ createPresignedURL: (body, options) => executeOperation(kernel, OP_CREATE_PRESIGNED_URL, { body }, options)
979
+ };
980
+ return resource;
981
+ };
982
+
983
+ //#endregion
984
+ //#region src/effect/generated/resources/connected-accounts.ts
985
+ const OP_CREATE$8 = generatedOperation("connectedAccounts.create");
986
+ const OP_RETRIEVE$12 = generatedOperation("connectedAccounts.retrieve");
987
+ const OP_LIST$12 = generatedOperation("connectedAccounts.list");
988
+ const OP_DELETE$5 = generatedOperation("connectedAccounts.delete");
989
+ const OP_COMPLETE_AUTH = generatedOperation("connectedAccounts.completeAuth");
990
+ const OP_PATCH = generatedOperation("connectedAccounts.patch");
991
+ const OP_REFRESH = generatedOperation("connectedAccounts.refresh");
992
+ const OP_REVOKE = generatedOperation("connectedAccounts.revoke");
993
+ const OP_UPDATE_STATUS$1 = generatedOperation("connectedAccounts.updateStatus");
994
+ const makeConnectedAccounts = (kernel) => {
995
+ const resource = {
996
+ create: (body, options) => executeOperation(kernel, OP_CREATE$8, { body }, options),
997
+ retrieve: (nanoid, options) => executeOperation(kernel, OP_RETRIEVE$12, { path: [nanoid] }, options),
998
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$12, { query }, options),
999
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
1000
+ ...query,
1001
+ cursor
1002
+ }, options)),
1003
+ delete: (nanoid, query = {}, options) => executeOperation(kernel, OP_DELETE$5, {
1004
+ path: [nanoid],
1005
+ query
1006
+ }, options),
1007
+ completeAuth: (body, options) => executeOperation(kernel, OP_COMPLETE_AUTH, { body }, options),
1008
+ patch: (nanoid, body = {}, options) => executeOperation(kernel, OP_PATCH, {
1009
+ path: [nanoid],
1010
+ body
1011
+ }, options),
1012
+ refresh: (nanoid, params = {}, options) => {
1013
+ const { query_redirect_url, body_redirect_url, ...body } = params ?? {};
1014
+ return executeOperation(kernel, OP_REFRESH, {
1015
+ path: [nanoid],
1016
+ query: { redirect_url: query_redirect_url },
1017
+ body: {
1018
+ ...body,
1019
+ redirect_url: body_redirect_url
1020
+ }
1021
+ }, options);
1022
+ },
1023
+ revoke: (nanoid, options) => executeOperation(kernel, OP_REVOKE, { path: [nanoid] }, options),
1024
+ updateStatus: (nanoID, body, options) => executeOperation(kernel, OP_UPDATE_STATUS$1, {
1025
+ path: [nanoID],
1026
+ body
1027
+ }, options)
1028
+ };
1029
+ return resource;
1030
+ };
1031
+
1032
+ //#endregion
1033
+ //#region src/effect/generated/resources/link.ts
1034
+ const OP_CREATE$7 = generatedOperation("link.create");
1035
+ const makeLink = (kernel) => ({ create: (body, options) => executeOperation(kernel, OP_CREATE$7, { body }, options) });
1036
+
1037
+ //#endregion
1038
+ //#region src/effect/generated/resources/toolkits.ts
1039
+ const OP_RETRIEVE$11 = generatedOperation("toolkits.retrieve");
1040
+ const OP_LIST$11 = generatedOperation("toolkits.list");
1041
+ const OP_RECOMMEND_SCOPES = generatedOperation("toolkits.recommendScopes");
1042
+ const OP_RETRIEVE_CATEGORIES = generatedOperation("toolkits.retrieveCategories");
1043
+ const OP_RETRIEVE_CHANGELOG = generatedOperation("toolkits.retrieveChangelog");
1044
+ const OP_RETRIEVE_MULTI = generatedOperation("toolkits.retrieveMulti");
1045
+ const OP_RETRIEVE_SCOPES_GRANT_CONTEXT = generatedOperation("toolkits.retrieveScopesGrantContext");
1046
+ const makeToolkits = (kernel) => {
1047
+ const resource = {
1048
+ retrieve: (slug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE$11, {
1049
+ path: [slug],
1050
+ query
1051
+ }, options),
1052
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$11, { query }, options),
1053
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
1054
+ ...query,
1055
+ cursor
1056
+ }, options)),
1057
+ recommendScopes: (toolkitSlug, body, options) => executeOperation(kernel, OP_RECOMMEND_SCOPES, {
1058
+ path: [toolkitSlug],
1059
+ body
1060
+ }, options),
1061
+ retrieveCategories: (options) => executeOperation(kernel, OP_RETRIEVE_CATEGORIES, {}, options),
1062
+ retrieveChangelog: (options) => executeOperation(kernel, OP_RETRIEVE_CHANGELOG, {}, options),
1063
+ retrieveMulti: (body = {}, options) => executeOperation(kernel, OP_RETRIEVE_MULTI, { body }, options),
1064
+ retrieveMultiStream: (body, options) => cursorStream((cursor) => resource.retrieveMulti(cursor === void 0 ? body : {
1065
+ ...body,
1066
+ cursor
1067
+ }, options)),
1068
+ retrieveScopesGrantContext: (toolkitSlug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE_SCOPES_GRANT_CONTEXT, {
1069
+ path: [toolkitSlug],
1070
+ query
1071
+ }, options)
1072
+ };
1073
+ return resource;
1074
+ };
1075
+
1076
+ //#endregion
1077
+ //#region src/effect/generated/resources/auth-configs.ts
1078
+ const OP_CREATE$6 = generatedOperation("authConfigs.create");
1079
+ const OP_RETRIEVE$10 = generatedOperation("authConfigs.retrieve");
1080
+ const OP_UPDATE$4 = generatedOperation("authConfigs.update");
1081
+ const OP_LIST$10 = generatedOperation("authConfigs.list");
1082
+ const OP_DELETE$4 = generatedOperation("authConfigs.delete");
1083
+ const OP_UPDATE_STATUS = generatedOperation("authConfigs.updateStatus");
1084
+ const makeAuthConfigs = (kernel) => {
1085
+ const resource = {
1086
+ create: (body, options) => executeOperation(kernel, OP_CREATE$6, { body }, options),
1087
+ retrieve: (nanoid, options) => executeOperation(kernel, OP_RETRIEVE$10, { path: [nanoid] }, options),
1088
+ update: (nanoid, body, options) => executeOperation(kernel, OP_UPDATE$4, {
1089
+ path: [nanoid],
1090
+ body
1091
+ }, options),
1092
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$10, { query }, options),
1093
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
1094
+ ...query,
1095
+ cursor
1096
+ }, options)),
1097
+ delete: (nanoid, query = {}, options) => executeOperation(kernel, OP_DELETE$4, {
1098
+ path: [nanoid],
1099
+ query
1100
+ }, options),
1101
+ updateStatus: (status, params, options) => {
1102
+ const { nanoid } = params;
1103
+ return executeOperation(kernel, OP_UPDATE_STATUS, { path: [nanoid, status] }, options);
1104
+ }
1105
+ };
1106
+ return resource;
1107
+ };
1108
+
1109
+ //#endregion
1110
+ //#region src/effect/generated/resources/triggers-types.ts
1111
+ const OP_RETRIEVE$9 = generatedOperation("triggersTypes.retrieve");
1112
+ const OP_LIST$9 = generatedOperation("triggersTypes.list");
1113
+ const OP_RETRIEVE_ENUM = generatedOperation("triggersTypes.retrieveEnum");
1114
+ const makeTriggersTypes = (kernel) => {
1115
+ const resource = {
1116
+ retrieve: (slug, query = {}, options) => executeOperation(kernel, OP_RETRIEVE$9, {
1117
+ path: [slug],
1118
+ query
1119
+ }, options),
1120
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$9, { query }, options),
1121
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
1122
+ ...query,
1123
+ cursor
1124
+ }, options)),
1125
+ retrieveEnum: (options) => executeOperation(kernel, OP_RETRIEVE_ENUM, {}, options)
1126
+ };
1127
+ return resource;
1128
+ };
1129
+
1130
+ //#endregion
1131
+ //#region src/effect/generated/resources/trigger-instances/manage.ts
1132
+ const OP_UPDATE$3 = generatedOperation("triggerInstances.manage.update");
1133
+ const OP_DELETE$3 = generatedOperation("triggerInstances.manage.delete");
1134
+ const makeManage = (kernel) => ({
1135
+ update: (triggerID, body = {}, options) => executeOperation(kernel, OP_UPDATE$3, {
1136
+ path: [triggerID],
1137
+ body
1138
+ }, options),
1139
+ delete: (triggerID, options) => executeOperation(kernel, OP_DELETE$3, { path: [triggerID] }, options)
1140
+ });
1141
+
1142
+ //#endregion
1143
+ //#region src/effect/generated/resources/trigger-instances/trigger-instances.ts
1144
+ const OP_LIST_ACTIVE = generatedOperation("triggerInstances.listActive");
1145
+ const OP_UPSERT$1 = generatedOperation("triggerInstances.upsert");
1146
+ const makeTriggerInstances = (kernel) => {
1147
+ const resource = {
1148
+ manage: makeManage(kernel),
1149
+ listActive: (query = {}, options) => executeOperation(kernel, OP_LIST_ACTIVE, { query }, options),
1150
+ listActiveStream: (query, options) => cursorStream((cursor) => resource.listActive(cursor === void 0 ? query : {
1151
+ ...query,
1152
+ cursor
1153
+ }, options)),
1154
+ upsert: (slug, body = {}, options) => executeOperation(kernel, OP_UPSERT$1, {
1155
+ path: [slug],
1156
+ body
1157
+ }, options)
1158
+ };
1159
+ return resource;
1160
+ };
1161
+
1162
+ //#endregion
1163
+ //#region src/effect/generated/resources/mcp/custom.ts
1164
+ const OP_CREATE$5 = generatedOperation("mcp.custom.create");
1165
+ const makeCustom$1 = (kernel) => ({ create: (body, options) => executeOperation(kernel, OP_CREATE$5, { body }, options) });
1166
+
1167
+ //#endregion
1168
+ //#region src/effect/generated/resources/mcp/generate.ts
1169
+ const OP_URL = generatedOperation("mcp.generate.url");
1170
+ const makeGenerate = (kernel) => ({ url: (body, options) => executeOperation(kernel, OP_URL, { body }, options) });
1171
+
1172
+ //#endregion
1173
+ //#region src/effect/generated/resources/mcp/mcp.ts
1174
+ const OP_CREATE$4 = generatedOperation("mcp.create");
1175
+ const OP_RETRIEVE$8 = generatedOperation("mcp.retrieve");
1176
+ const OP_UPDATE$2 = generatedOperation("mcp.update");
1177
+ const OP_LIST$8 = generatedOperation("mcp.list");
1178
+ const OP_DELETE$2 = generatedOperation("mcp.delete");
1179
+ const OP_CREATE_INSTANCE = generatedOperation("mcp.createInstance");
1180
+ const OP_DELETE_INSTANCE = generatedOperation("mcp.deleteInstance");
1181
+ const OP_LIST_INSTANCES = generatedOperation("mcp.listInstances");
1182
+ const OP_RETRIEVE_APP = generatedOperation("mcp.retrieveApp");
1183
+ const makeMcp = (kernel) => ({
1184
+ custom: makeCustom$1(kernel),
1185
+ generate: makeGenerate(kernel),
1186
+ create: (body, options) => executeOperation(kernel, OP_CREATE$4, { body }, options),
1187
+ retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$8, { path: [id] }, options),
1188
+ update: (id, body = {}, options) => executeOperation(kernel, OP_UPDATE$2, {
1189
+ path: [id],
1190
+ body
1191
+ }, options),
1192
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$8, { query }, options),
1193
+ delete: (id, options) => executeOperation(kernel, OP_DELETE$2, { path: [id] }, options),
1194
+ createInstance: (serverID, body, options) => executeOperation(kernel, OP_CREATE_INSTANCE, {
1195
+ path: [serverID],
1196
+ body
1197
+ }, options),
1198
+ deleteInstance: (instanceID, params, options) => {
1199
+ const { serverId } = params;
1200
+ return executeOperation(kernel, OP_DELETE_INSTANCE, { path: [serverId, instanceID] }, options);
1201
+ },
1202
+ listInstances: (serverID, query = {}, options) => executeOperation(kernel, OP_LIST_INSTANCES, {
1203
+ path: [serverID],
1204
+ query
1205
+ }, options),
1206
+ retrieveApp: (appKey, query = {}, options) => executeOperation(kernel, OP_RETRIEVE_APP, {
1207
+ path: [appKey],
1208
+ query
1209
+ }, options)
1210
+ });
1211
+
1212
+ //#endregion
1213
+ //#region src/effect/generated/resources/cli/realtime.ts
1214
+ const OP_AUTH = generatedOperation("cli.realtime.auth");
1215
+ const OP_CREDENTIALS = generatedOperation("cli.realtime.credentials");
1216
+ const makeRealtime = (kernel) => ({
1217
+ auth: (body, options) => executeOperation(kernel, OP_AUTH, { body }, options),
1218
+ credentials: (options) => executeOperation(kernel, OP_CREDENTIALS, {}, options)
1219
+ });
1220
+
1221
+ //#endregion
1222
+ //#region src/effect/generated/resources/cli/cli.ts
1223
+ const OP_CREATE_CODACT_FAILURE = generatedOperation("cli.createCodactFailure");
1224
+ const OP_CREATE_SESSION = generatedOperation("cli.createSession");
1225
+ const OP_GET_SESSION = generatedOperation("cli.getSession");
1226
+ const makeCli = (kernel) => ({
1227
+ realtime: makeRealtime(kernel),
1228
+ createCodactFailure: (params, options) => {
1229
+ const { "x-user-api-key": xUserApiKey, ...body } = params;
1230
+ return executeOperation(kernel, OP_CREATE_CODACT_FAILURE, {
1231
+ body,
1232
+ operationHeaders: { "x-user-api-key": xUserApiKey }
1233
+ }, options);
1234
+ },
1235
+ createSession: (body = {}, options) => executeOperation(kernel, OP_CREATE_SESSION, { body }, options),
1236
+ getSession: (query, options) => executeOperation(kernel, OP_GET_SESSION, { query }, options)
1237
+ });
1238
+
1239
+ //#endregion
1240
+ //#region src/effect/generated/resources/logs/triggers.ts
1241
+ const OP_RETRIEVE$7 = generatedOperation("logs.triggers.retrieve");
1242
+ const OP_LIST$7 = generatedOperation("logs.triggers.list");
1243
+ const makeTriggers = (kernel) => ({
1244
+ retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$7, { path: [id] }, options),
1245
+ list: (body = {}, options) => executeOperation(kernel, OP_LIST$7, { body }, options)
1246
+ });
1247
+
1248
+ //#endregion
1249
+ //#region src/effect/generated/resources/logs/tools.ts
1250
+ const OP_RETRIEVE$6 = generatedOperation("logs.tools.retrieve");
1251
+ const OP_LIST$6 = generatedOperation("logs.tools.list");
1252
+ const OP_LIST_FIELDS = generatedOperation("logs.tools.listFields");
1253
+ const makeTools = (kernel) => ({
1254
+ retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$6, { path: [id] }, options),
1255
+ list: (body, options) => executeOperation(kernel, OP_LIST$6, { body }, options),
1256
+ listFields: (options) => executeOperation(kernel, OP_LIST_FIELDS, {}, options)
1257
+ });
1258
+
1259
+ //#endregion
1260
+ //#region src/effect/generated/resources/logs/logs.ts
1261
+ const OP_CREATE_TOOL_EXECUTION = generatedOperation("logs.createToolExecution");
1262
+ const OP_RETRIEVE_TOOL_EXECUTION = generatedOperation("logs.retrieveToolExecution");
1263
+ const makeLogs = (kernel) => ({
1264
+ triggers: makeTriggers(kernel),
1265
+ tools: makeTools(kernel),
1266
+ createToolExecution: (body = {}, options) => executeOperation(kernel, OP_CREATE_TOOL_EXECUTION, { body }, options),
1267
+ retrieveToolExecution: (id, options) => executeOperation(kernel, OP_RETRIEVE_TOOL_EXECUTION, { path: [id] }, options)
1268
+ });
1269
+
1270
+ //#endregion
1271
+ //#region src/effect/generated/resources/project/usage.ts
1272
+ const OP_RETRIEVE$5 = generatedOperation("project.usage.retrieve");
1273
+ const OP_RETRIEVE_SUMMARY$1 = generatedOperation("project.usage.retrieveSummary");
1274
+ const makeUsage$1 = (kernel) => ({
1275
+ retrieve: (entityType, body = {}, options) => executeOperation(kernel, OP_RETRIEVE$5, {
1276
+ path: [entityType],
1277
+ body
1278
+ }, options),
1279
+ retrieveSummary: (body = {}, options) => executeOperation(kernel, OP_RETRIEVE_SUMMARY$1, { body }, options)
1280
+ });
1281
+
1282
+ //#endregion
1283
+ //#region src/effect/generated/resources/project/project.ts
1284
+ const makeProject$3 = (kernel) => ({ usage: makeUsage$1(kernel) });
1285
+
1286
+ //#endregion
1287
+ //#region src/effect/generated/resources/webhook-subscriptions.ts
1288
+ const OP_CREATE$3 = generatedOperation("webhookSubscriptions.create");
1289
+ const OP_RETRIEVE$4 = generatedOperation("webhookSubscriptions.retrieve");
1290
+ const OP_UPDATE$1 = generatedOperation("webhookSubscriptions.update");
1291
+ const OP_LIST$5 = generatedOperation("webhookSubscriptions.list");
1292
+ const OP_DELETE$1 = generatedOperation("webhookSubscriptions.delete");
1293
+ const OP_LIST_EVENT_TYPES = generatedOperation("webhookSubscriptions.listEventTypes");
1294
+ const OP_ROTATE_SECRET = generatedOperation("webhookSubscriptions.rotateSecret");
1295
+ const makeWebhookSubscriptions = (kernel) => {
1296
+ const resource = {
1297
+ create: (body, options) => executeOperation(kernel, OP_CREATE$3, { body }, options),
1298
+ retrieve: (id, options) => executeOperation(kernel, OP_RETRIEVE$4, { path: [id] }, options),
1299
+ update: (id, body = {}, options) => executeOperation(kernel, OP_UPDATE$1, {
1300
+ path: [id],
1301
+ body
1302
+ }, options),
1303
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$5, { query }, options),
1304
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
1305
+ ...query,
1306
+ cursor
1307
+ }, options)),
1308
+ delete: (id, options) => executeOperation(kernel, OP_DELETE$1, { path: [id] }, options),
1309
+ listEventTypes: (options) => executeOperation(kernel, OP_LIST_EVENT_TYPES, {}, options),
1310
+ rotateSecret: (id, options) => executeOperation(kernel, OP_ROTATE_SECRET, { path: [id] }, options)
1311
+ };
1312
+ return resource;
1313
+ };
1314
+
1315
+ //#endregion
1316
+ //#region src/effect/generated/resources/webhook-endpoints.ts
1317
+ const OP_CREATE$2 = generatedOperation("webhookEndpoints.create");
1318
+ const OP_RETRIEVE$3 = generatedOperation("webhookEndpoints.retrieve");
1319
+ const OP_UPDATE = generatedOperation("webhookEndpoints.update");
1320
+ const OP_LIST$4 = generatedOperation("webhookEndpoints.list");
1321
+ const OP_REPLACE = generatedOperation("webhookEndpoints.replace");
1322
+ const makeWebhookEndpoints = (kernel) => ({
1323
+ create: (body, options) => executeOperation(kernel, OP_CREATE$2, { body }, options),
1324
+ retrieve: (nanoID, options) => executeOperation(kernel, OP_RETRIEVE$3, { path: [nanoID] }, options),
1325
+ update: (nanoID, body, options) => executeOperation(kernel, OP_UPDATE, {
1326
+ path: [nanoID],
1327
+ body
1328
+ }, options),
1329
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$4, { query }, options),
1330
+ replace: (nanoID, body, options) => executeOperation(kernel, OP_REPLACE, {
1331
+ path: [nanoID],
1332
+ body
1333
+ }, options)
1334
+ });
1335
+
1336
+ //#endregion
1337
+ //#region src/effect/generated/resources/org/owner/project.ts
1338
+ const OP_CREATE$1 = generatedOperation("org.owner.project.create");
1339
+ const OP_RETRIEVE$2 = generatedOperation("org.owner.project.retrieve");
1340
+ const OP_LIST$3 = generatedOperation("org.owner.project.list");
1341
+ const OP_DELETE = generatedOperation("org.owner.project.delete");
1342
+ const OP_REGENERATE_APIKEY = generatedOperation("org.owner.project.regenerateAPIKey");
1343
+ const makeProject$2 = (kernel) => ({
1344
+ create: (body, options) => executeOperation(kernel, OP_CREATE$1, { body }, options),
1345
+ retrieve: (nanoID, options) => executeOperation(kernel, OP_RETRIEVE$2, { path: [nanoID] }, options),
1346
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$3, { query }, options),
1347
+ delete: (nanoID, query = {}, options) => executeOperation(kernel, OP_DELETE, {
1348
+ path: [nanoID],
1349
+ query
1350
+ }, options),
1351
+ regenerateAPIKey: (nanoID, options) => executeOperation(kernel, OP_REGENERATE_APIKEY, { path: [nanoID] }, options)
1352
+ });
1353
+
1354
+ //#endregion
1355
+ //#region src/effect/generated/resources/org/owner/owner.ts
1356
+ const makeOwner = (kernel) => ({ project: makeProject$2(kernel) });
1357
+
1358
+ //#endregion
1359
+ //#region src/effect/generated/resources/org/consumer/project.ts
1360
+ const OP_RESOLVE = generatedOperation("org.consumer.project.resolve");
1361
+ const makeProject$1 = (kernel) => ({ resolve: (params, options) => {
1362
+ const { "x-user-api-key": xUserApiKey, "x-org-id": xOrgId } = params;
1363
+ return executeOperation(kernel, OP_RESOLVE, { operationHeaders: {
1364
+ "x-user-api-key": xUserApiKey,
1365
+ "x-org-id": xOrgId
1366
+ } }, options);
1367
+ } });
1368
+
1369
+ //#endregion
1370
+ //#region src/effect/generated/resources/org/consumer/consumer.ts
1371
+ const OP_LIST_CONNECTED_TOOLKITS = generatedOperation("org.consumer.listConnectedToolkits");
1372
+ const makeConsumer = (kernel) => ({
1373
+ project: makeProject$1(kernel),
1374
+ listConnectedToolkits: (params, options) => {
1375
+ const { "x-user-api-key": xUserApiKey, "x-org-id": xOrgId, ...query } = params;
1376
+ return executeOperation(kernel, OP_LIST_CONNECTED_TOOLKITS, {
1377
+ query,
1378
+ operationHeaders: {
1379
+ "x-user-api-key": xUserApiKey,
1380
+ "x-org-id": xOrgId
1381
+ }
1382
+ }, options);
1383
+ }
1384
+ });
1385
+
1386
+ //#endregion
1387
+ //#region src/effect/generated/resources/org/project.ts
1388
+ const OP_LIST$2 = generatedOperation("org.project.list");
1389
+ const makeProject = (kernel) => ({ list: (query = {}, options) => executeOperation(kernel, OP_LIST$2, { query }, options) });
1390
+
1391
+ //#endregion
1392
+ //#region src/effect/generated/resources/org/usage.ts
1393
+ const OP_RETRIEVE$1 = generatedOperation("org.usage.retrieve");
1394
+ const OP_RETRIEVE_SUMMARY = generatedOperation("org.usage.retrieveSummary");
1395
+ const makeUsage = (kernel) => ({
1396
+ retrieve: (entityType, body = {}, options) => executeOperation(kernel, OP_RETRIEVE$1, {
1397
+ path: [entityType],
1398
+ body
1399
+ }, options),
1400
+ retrieveSummary: (body = {}, options) => executeOperation(kernel, OP_RETRIEVE_SUMMARY, { body }, options)
1401
+ });
1402
+
1403
+ //#endregion
1404
+ //#region src/effect/generated/resources/org/clanker.ts
1405
+ const OP_CREATE_CLAIM = generatedOperation("org.clanker.createClaim");
1406
+ const makeClanker = (kernel) => ({ createClaim: (body, options) => executeOperation(kernel, OP_CREATE_CLAIM, { body }, options) });
1407
+
1408
+ //#endregion
1409
+ //#region src/effect/generated/resources/org/org.ts
1410
+ const OP_LIST$1 = generatedOperation("org.list");
1411
+ const makeOrg = (kernel) => ({
1412
+ owner: makeOwner(kernel),
1413
+ consumer: makeConsumer(kernel),
1414
+ project: makeProject(kernel),
1415
+ usage: makeUsage(kernel),
1416
+ clanker: makeClanker(kernel),
1417
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST$1, { query }, options)
1418
+ });
1419
+
1420
+ //#endregion
1421
+ //#region src/effect/generated/resources/auth/session.ts
1422
+ const OP_RETRIEVE_INFO = generatedOperation("auth.session.retrieveInfo");
1423
+ const makeSession = (kernel) => ({ retrieveInfo: (options) => executeOperation(kernel, OP_RETRIEVE_INFO, {}, options) });
1424
+
1425
+ //#endregion
1426
+ //#region src/effect/generated/resources/auth/auth.ts
1427
+ const makeAuth = (kernel) => ({ session: makeSession(kernel) });
1428
+
1429
+ //#endregion
1430
+ //#region src/effect/generated/resources/api-key-revocation.ts
1431
+ const OP_CREATE = generatedOperation("apiKeyRevocation.create");
1432
+ const makeApiKeyRevocation = (kernel) => ({ create: (body, options) => executeOperation(kernel, OP_CREATE, { body }, options) });
1433
+
1434
+ //#endregion
1435
+ //#region src/effect/generated/resources/custom.ts
1436
+ const OP_DELETE_TOOLKIT = generatedOperation("custom.deleteToolkit");
1437
+ const OP_SYNC = generatedOperation("custom.sync");
1438
+ const OP_UPSERT = generatedOperation("custom.upsert");
1439
+ const makeCustom = (kernel) => ({
1440
+ deleteToolkit: (slug, query = {}, options) => executeOperation(kernel, OP_DELETE_TOOLKIT, {
1441
+ path: [slug],
1442
+ query
1443
+ }, options),
1444
+ sync: (body, options) => executeOperation(kernel, OP_SYNC, { body }, options),
1445
+ upsert: (body, options) => executeOperation(kernel, OP_UPSERT, { body }, options)
1446
+ });
1447
+
1448
+ //#endregion
1449
+ //#region src/effect/generated/resources/keyring.ts
1450
+ const OP_LIST_TRANSFER_KEYS = generatedOperation("keyring.listTransferKeys");
1451
+ const makeKeyring = (kernel) => ({ listTransferKeys: (options) => executeOperation(kernel, OP_LIST_TRANSFER_KEYS, {}, options) });
1452
+
1453
+ //#endregion
1454
+ //#region src/effect/generated/resources/session-configs.ts
1455
+ const OP_RETRIEVE = generatedOperation("sessionConfigs.retrieve");
1456
+ const OP_LIST = generatedOperation("sessionConfigs.list");
1457
+ const makeSessionConfigs = (kernel) => {
1458
+ const resource = {
1459
+ retrieve: (sessionConfigID, options) => executeOperation(kernel, OP_RETRIEVE, { path: [sessionConfigID] }, options),
1460
+ list: (query = {}, options) => executeOperation(kernel, OP_LIST, { query }, options),
1461
+ listStream: (query, options) => cursorStream((cursor) => resource.list(cursor === void 0 ? query : {
1462
+ ...query,
1463
+ cursor
1464
+ }, options))
1465
+ };
1466
+ return resource;
1467
+ };
1468
+
1469
+ //#endregion
1470
+ //#region src/effect/generated/resource-wiring.ts
1471
+ const createClientResources = (kernel) => ({
1472
+ toolRouter: makeToolRouter(kernel),
1473
+ tools: makeTools$1(kernel),
1474
+ files: makeFiles(kernel),
1475
+ connectedAccounts: makeConnectedAccounts(kernel),
1476
+ link: makeLink(kernel),
1477
+ toolkits: makeToolkits(kernel),
1478
+ authConfigs: makeAuthConfigs(kernel),
1479
+ triggersTypes: makeTriggersTypes(kernel),
1480
+ triggerInstances: makeTriggerInstances(kernel),
1481
+ mcp: makeMcp(kernel),
1482
+ cli: makeCli(kernel),
1483
+ logs: makeLogs(kernel),
1484
+ project: makeProject$3(kernel),
1485
+ webhookSubscriptions: makeWebhookSubscriptions(kernel),
1486
+ webhookEndpoints: makeWebhookEndpoints(kernel),
1487
+ org: makeOrg(kernel),
1488
+ auth: makeAuth(kernel),
1489
+ apiKeyRevocation: makeApiKeyRevocation(kernel),
1490
+ custom: makeCustom(kernel),
1491
+ keyring: makeKeyring(kernel),
1492
+ sessionConfigs: makeSessionConfigs(kernel)
1493
+ });
1494
+
1495
+ //#endregion
1496
+ //#region src/effect/client.ts
1497
+ /**
1498
+ * The Effect client: a `Context.Service`, layers that build it from the
1499
+ * `HttpClient` in context, and a plain
1500
+ * constructor for callers who already hold one.
1501
+ *
1502
+ * Options are fixed at construction. Nothing here reads the environment except
1503
+ * {@link layerConfig}, which reads the `COMPOSIO_*` settings through Effect's
1504
+ * `Config` — so the `ConfigProvider` in context decides where they come from.
1505
+ */
1506
+ const Auth = authConstructors();
1507
+ var ComposioClient = class extends Context.Service()("@composio/client/effect/ComposioClient") {};
1508
+ const DEFAULT_BASE_URL = ENVIRONMENTS.production;
1509
+ const DEFAULT_MAX_RETRIES = 2;
1510
+ const DEFAULT_TIMEOUT = 6e4;
1511
+ const resolveAccess = (options, baseURL) => {
1512
+ assertNoRemovedCredentialOptions(options);
1513
+ const auth = resolveAuth(options.auth, EFFECT_CREDENTIAL);
1514
+ const scope = resolveScope(options.scope);
1515
+ const identity = resolveIdentity(options.identity);
1516
+ const reserved = reservedHeaders(identity, {
1517
+ auth: auth.mode !== "none",
1518
+ scope: scope !== void 0
1519
+ });
1520
+ assertNoReservedHeaders(options.defaultHeaders, reserved, "defaultHeaders");
1521
+ const allowedHTTPOrigin = options.allowInsecureHTTP ? parseHTTPURL(baseURL)?.origin ?? null : null;
1522
+ assertCredentialTransport(baseURL, auth.mode !== "none", allowedHTTPOrigin);
1523
+ return {
1524
+ auth: holdAuth(auth),
1525
+ scope,
1526
+ identity,
1527
+ reserved,
1528
+ allowedHTTPOrigin
1529
+ };
1530
+ };
1531
+ const resolveKernel = (options, httpClient) => {
1532
+ const baseURL = options.baseURL || DEFAULT_BASE_URL;
1533
+ if (options.decode === true && options.schemas === void 0) return Result.fail(new ConfigurationError({ message: SCHEMAS_MISSING }));
1534
+ const resolved = Result.try({
1535
+ try: () => resolveAccess(options, baseURL),
1536
+ catch: configurationErrorFrom
1537
+ });
1538
+ if (Result.isFailure(resolved)) return Result.fail(resolved.failure);
1539
+ return Result.succeed({
1540
+ httpClient,
1541
+ baseURL,
1542
+ ...resolved.success,
1543
+ userAgent: `Composio/JS ${VERSION}`,
1544
+ defaultHeaders: options.defaultHeaders,
1545
+ maxRetries: options.maxRetries ?? DEFAULT_MAX_RETRIES,
1546
+ timeout: options.timeout ?? DEFAULT_TIMEOUT,
1547
+ tracing: options.tracing ?? "off",
1548
+ decode: options.decode ?? false,
1549
+ schemas: options.schemas,
1550
+ deprecationSeen: /* @__PURE__ */ new Set()
1551
+ });
1552
+ };
1553
+ const fromKernel = (kernel) => ({
1554
+ ...createClientResources(kernel),
1555
+ get: (path, options) => executeRaw(kernel, "get", path, options),
1556
+ post: (path, options) => executeRaw(kernel, "post", path, options),
1557
+ put: (path, options) => executeRaw(kernel, "put", path, options),
1558
+ patch: (path, options) => executeRaw(kernel, "patch", path, options),
1559
+ delete: (path, options) => executeRaw(kernel, "delete", path, options)
1560
+ });
1561
+ /**
1562
+ * The kernel a client dispatches through. Internal: the generated resources
1563
+ * are built over it, and it is not part of the entry's exports.
1564
+ *
1565
+ * @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
1566
+ * credential cannot be sent as a header, `identity` is invalid or
1567
+ * `defaultHeaders` names an identity header, or the client is to decode and
1568
+ * was given no schemas.
1569
+ */
1570
+ const makeKernel = (options, httpClient) => Result.getOrThrow(resolveKernel(options, httpClient));
1571
+ /**
1572
+ * Builds a client synchronously from an `HttpClient` the caller already holds.
1573
+ * Reads no environment variable.
1574
+ *
1575
+ * @throws {ConfigurationError} when a credentialed origin is not HTTPS, a
1576
+ * credential cannot be sent as a header, `identity` is invalid or
1577
+ * `defaultHeaders` names an identity header, or the client is to decode and
1578
+ * was given no schemas.
1579
+ */
1580
+ const make = (options, httpClient) => fromKernel(makeKernel(options, httpClient));
1581
+ /**
1582
+ * Provides the client from explicit options and the `HttpClient` in context.
1583
+ * Reads no environment variable.
1584
+ */
1585
+ const layer = (options) => Layer.effect(ComposioClient, Effect.flatMap(HttpClient.HttpClient, (httpClient) => Effect.map(Effect.fromResult(resolveKernel(options, httpClient)), fromKernel)));
1586
+ /** A setting as `Composio.fromEnv` reads one: trimmed, and absent when empty. */
1587
+ const setting = (name) => Config.map(Config.option(Config.String(name)), (value) => Option.getOrUndefined(Option.filter(Option.map(value, (text) => text.trim()), (text) => text !== "")));
1588
+ const trimmedKey = (key) => {
1589
+ const trimmed = Redacted.value(key).trim();
1590
+ if (trimmed === "") return Option.none();
1591
+ return Option.some(Redacted.make(trimmed));
1592
+ };
1593
+ const secret = (name) => Config.map(Config.option(Config.Redacted(name)), (value) => Option.getOrUndefined(Option.flatMap(value, trimmedKey)));
1594
+ const settings = Config.all({
1595
+ project: secret("COMPOSIO_API_KEY"),
1596
+ user: secret("COMPOSIO_USER_API_KEY"),
1597
+ organization: secret("COMPOSIO_ORG_API_KEY"),
1598
+ baseURL: setting("COMPOSIO_BASE_URL"),
1599
+ allowInsecureHTTP: setting("COMPOSIO_ALLOW_INSECURE_HTTP")
1600
+ });
1601
+ /**
1602
+ * Provides the client from the `COMPOSIO_*` settings through the
1603
+ * `ConfigProvider` in context, by `Composio.fromEnv`'s rules. Each override
1604
+ * replaces the setting it names.
1605
+ */
1606
+ const layerConfig = (overrides = {}) => Layer.effect(ComposioClient, Effect.gen(function* () {
1607
+ const httpClient = yield* HttpClient.HttpClient;
1608
+ const env = yield* Effect.mapError(settings, () => new ConfigurationError({ message: "The COMPOSIO_* configuration could not be read." }));
1609
+ const mapped = {
1610
+ auth: authFromCredentials({
1611
+ project: env.project,
1612
+ user: env.user,
1613
+ organization: env.organization
1614
+ }),
1615
+ baseURL: env.baseURL,
1616
+ allowInsecureHTTP: env.allowInsecureHTTP === "1"
1617
+ };
1618
+ const kernel = yield* Effect.fromResult(resolveKernel({
1619
+ ...mapped,
1620
+ ...overrides
1621
+ }, httpClient));
1622
+ return fromKernel(kernel);
1623
+ }));
1624
+
1625
+ //#endregion
1626
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, Auth, AuthenticationError, BadRequestError, ComposioClient, ConfigurationError, ConflictError, DecodeError, ENVIRONMENTS, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError, VERSION, isAPIError, isComposioError, isDeprecationNotice, layer, layerConfig, make };