@composio/client 2.0.0-rc.8 → 2.0.0

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