@composio/client 2.0.0-rc.1 → 2.0.0-rc.11

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 (177) hide show
  1. package/README.md +108 -2
  2. package/dist/{api-key-revocation-BZL5FAx7.mjs → api-key-revocation-Dh-KSokR.mjs} +4 -3
  3. package/dist/{auth-CEq4JqWm.mjs → auth-Drov-jN8.mjs} +1 -1
  4. package/dist/{auth-configs-CyksMqNB.mjs → auth-configs-yM05-r6r.mjs} +18 -11
  5. package/dist/{clanker-4wByThQJ.mjs → clanker-BYmc69WC.mjs} +4 -3
  6. package/dist/cli-Ce8RT7yp.mjs +45 -0
  7. package/dist/{connected-accounts-B-qN_yLT.mjs → connected-accounts-D__sOoNZ.mjs} +31 -15
  8. package/dist/{consumer-DWlaGBmh.mjs → consumer-DTh50Hih.mjs} +8 -8
  9. package/dist/{custom-BQWoONFY.mjs → custom-CdC-6Y_i.mjs} +5 -3
  10. package/dist/custom-nlGufiDz.mjs +88 -0
  11. package/dist/error-DLB1uKM3.mjs +109 -0
  12. package/dist/{files-B-UnEejx.mjs → files-DROCPzLP.mjs} +7 -5
  13. package/dist/{files-CNZ-ttVS.mjs → files-RJPIH6iE.mjs} +13 -9
  14. package/dist/{generate-DSqfJENZ.mjs → generate-mU4b3zJf.mjs} +5 -3
  15. package/dist/{request-DwPfYYNF.mjs → generated-operations-CWhusMPU.mjs} +1266 -157
  16. package/dist/index.d.mts +3 -3
  17. package/dist/index.mjs +312 -827
  18. package/dist/keyring-BzkcB1gu.mjs +17 -0
  19. package/dist/{link-CukKZMxs.mjs → link-CfIyH3nF.mjs} +4 -3
  20. package/dist/{logs-B87z4hq7.mjs → logs-D2wxXYiO.mjs} +8 -6
  21. package/dist/{manage-By-b66OH.mjs → manage-Vc3jdRr_.mjs} +7 -5
  22. package/dist/mcp-DEe7xU7G.mjs +91 -0
  23. package/dist/{org-BSq_z6fP.mjs → org-CYsl9O1u.mjs} +9 -8
  24. package/dist/{owner-BDkEFEVF.mjs → owner-DmQb3AF5.mjs} +1 -1
  25. package/dist/pagination.d.mts +56 -0
  26. package/dist/pagination.mjs +50 -0
  27. package/dist/{project-D-c0Zrrl.mjs → project-BVBWJzHm.mjs} +1 -1
  28. package/dist/{project-_s0fWHut.mjs → project-D-_r3H1_.mjs} +7 -7
  29. package/dist/project-DvSCDA9B.mjs +47 -0
  30. package/dist/{project-Cj-NKnWZ.mjs → project-OSigfIdr.mjs} +4 -3
  31. package/dist/realtime-Dsk1QGAl.mjs +28 -0
  32. package/dist/resources/api-key-revocation.d.mts +1 -1
  33. package/dist/resources/api-key-revocation.mjs +1 -1
  34. package/dist/resources/auth/auth.d.mts +1 -1
  35. package/dist/resources/auth/auth.mjs +1 -1
  36. package/dist/resources/auth/index.d.mts +1 -1
  37. package/dist/resources/auth/index.mjs +2 -2
  38. package/dist/resources/auth/session.d.mts +1 -1
  39. package/dist/resources/auth/session.mjs +1 -1
  40. package/dist/resources/auth-configs.d.mts +1 -1
  41. package/dist/resources/auth-configs.mjs +1 -1
  42. package/dist/resources/auth.d.mts +1 -1
  43. package/dist/resources/auth.mjs +2 -2
  44. package/dist/resources/cli/cli.d.mts +1 -1
  45. package/dist/resources/cli/cli.mjs +1 -1
  46. package/dist/resources/cli/index.d.mts +1 -1
  47. package/dist/resources/cli/index.mjs +2 -2
  48. package/dist/resources/cli/realtime.d.mts +1 -1
  49. package/dist/resources/cli/realtime.mjs +1 -1
  50. package/dist/resources/cli.d.mts +1 -1
  51. package/dist/resources/cli.mjs +2 -2
  52. package/dist/resources/connected-accounts.d.mts +1 -1
  53. package/dist/resources/connected-accounts.mjs +1 -1
  54. package/dist/resources/custom.d.mts +2 -0
  55. package/dist/resources/custom.mjs +3 -0
  56. package/dist/resources/files.d.mts +1 -1
  57. package/dist/resources/files.mjs +1 -1
  58. package/dist/resources/index.d.mts +1 -1
  59. package/dist/resources/index.mjs +13 -13
  60. package/dist/resources/keyring.d.mts +2 -0
  61. package/dist/resources/keyring.mjs +3 -0
  62. package/dist/resources/link.d.mts +1 -1
  63. package/dist/resources/link.mjs +1 -1
  64. package/dist/resources/logs/index.d.mts +1 -1
  65. package/dist/resources/logs/index.mjs +3 -3
  66. package/dist/resources/logs/logs.d.mts +1 -1
  67. package/dist/resources/logs/logs.mjs +1 -1
  68. package/dist/resources/logs/tools.d.mts +1 -1
  69. package/dist/resources/logs/tools.mjs +1 -1
  70. package/dist/resources/logs/triggers.d.mts +1 -1
  71. package/dist/resources/logs/triggers.mjs +1 -1
  72. package/dist/resources/logs.d.mts +1 -1
  73. package/dist/resources/logs.mjs +3 -3
  74. package/dist/resources/mcp/custom.d.mts +1 -1
  75. package/dist/resources/mcp/custom.mjs +1 -1
  76. package/dist/resources/mcp/generate.d.mts +1 -1
  77. package/dist/resources/mcp/generate.mjs +1 -1
  78. package/dist/resources/mcp/index.d.mts +1 -1
  79. package/dist/resources/mcp/index.mjs +3 -3
  80. package/dist/resources/mcp/mcp.d.mts +1 -1
  81. package/dist/resources/mcp/mcp.mjs +1 -1
  82. package/dist/resources/mcp.d.mts +1 -1
  83. package/dist/resources/mcp.mjs +3 -3
  84. package/dist/resources/org/clanker.d.mts +1 -1
  85. package/dist/resources/org/clanker.mjs +1 -1
  86. package/dist/resources/org/consumer/consumer.d.mts +1 -1
  87. package/dist/resources/org/consumer/consumer.mjs +1 -1
  88. package/dist/resources/org/consumer/index.d.mts +1 -1
  89. package/dist/resources/org/consumer/index.mjs +2 -2
  90. package/dist/resources/org/consumer/project.d.mts +1 -1
  91. package/dist/resources/org/consumer/project.mjs +1 -1
  92. package/dist/resources/org/consumer.d.mts +1 -1
  93. package/dist/resources/org/consumer.mjs +2 -2
  94. package/dist/resources/org/index.d.mts +1 -1
  95. package/dist/resources/org/index.mjs +6 -6
  96. package/dist/resources/org/org.d.mts +1 -1
  97. package/dist/resources/org/org.mjs +1 -1
  98. package/dist/resources/org/owner/index.d.mts +1 -1
  99. package/dist/resources/org/owner/index.mjs +2 -2
  100. package/dist/resources/org/owner/owner.d.mts +1 -1
  101. package/dist/resources/org/owner/owner.mjs +1 -1
  102. package/dist/resources/org/owner/project.d.mts +1 -1
  103. package/dist/resources/org/owner/project.mjs +1 -1
  104. package/dist/resources/org/owner.d.mts +1 -1
  105. package/dist/resources/org/owner.mjs +2 -2
  106. package/dist/resources/org/project.d.mts +1 -1
  107. package/dist/resources/org/project.mjs +1 -1
  108. package/dist/resources/org/usage.d.mts +1 -1
  109. package/dist/resources/org/usage.mjs +1 -1
  110. package/dist/resources/org.d.mts +1 -1
  111. package/dist/resources/org.mjs +6 -6
  112. package/dist/resources/project/index.d.mts +1 -1
  113. package/dist/resources/project/index.mjs +1 -1
  114. package/dist/resources/project/project.d.mts +1 -1
  115. package/dist/resources/project/project.mjs +1 -1
  116. package/dist/resources/project/usage.d.mts +1 -1
  117. package/dist/resources/project/usage.mjs +1 -1
  118. package/dist/resources/project.d.mts +1 -1
  119. package/dist/resources/project.mjs +1 -1
  120. package/dist/resources/session-configs.d.mts +2 -0
  121. package/dist/resources/session-configs.mjs +24 -0
  122. package/dist/resources/tool-router/index.d.mts +1 -1
  123. package/dist/resources/tool-router/index.mjs +2 -2
  124. package/dist/resources/tool-router/session/files.d.mts +1 -1
  125. package/dist/resources/tool-router/session/files.mjs +1 -1
  126. package/dist/resources/tool-router/session/index.d.mts +1 -1
  127. package/dist/resources/tool-router/session/index.mjs +2 -2
  128. package/dist/resources/tool-router/session/session.d.mts +1 -1
  129. package/dist/resources/tool-router/session/session.mjs +1 -1
  130. package/dist/resources/tool-router/session.d.mts +1 -1
  131. package/dist/resources/tool-router/session.mjs +2 -2
  132. package/dist/resources/tool-router/tool-router.d.mts +1 -1
  133. package/dist/resources/tool-router/tool-router.mjs +1 -1
  134. package/dist/resources/tool-router.d.mts +1 -1
  135. package/dist/resources/tool-router.mjs +2 -2
  136. package/dist/resources/toolkits.d.mts +1 -1
  137. package/dist/resources/toolkits.mjs +1 -1
  138. package/dist/resources/tools.d.mts +1 -1
  139. package/dist/resources/tools.mjs +1 -1
  140. package/dist/resources/trigger-instances/index.d.mts +1 -1
  141. package/dist/resources/trigger-instances/index.mjs +2 -2
  142. package/dist/resources/trigger-instances/manage.d.mts +1 -1
  143. package/dist/resources/trigger-instances/manage.mjs +1 -1
  144. package/dist/resources/trigger-instances/trigger-instances.d.mts +1 -1
  145. package/dist/resources/trigger-instances/trigger-instances.mjs +1 -1
  146. package/dist/resources/trigger-instances.d.mts +1 -1
  147. package/dist/resources/trigger-instances.mjs +2 -2
  148. package/dist/resources/triggers-types.d.mts +1 -1
  149. package/dist/resources/triggers-types.mjs +1 -1
  150. package/dist/resources/webhook-endpoints.d.mts +1 -1
  151. package/dist/resources/webhook-endpoints.mjs +1 -1
  152. package/dist/resources/webhook-subscriptions.d.mts +1 -1
  153. package/dist/resources/webhook-subscriptions.mjs +1 -1
  154. package/dist/{session-Do3wHYNe.mjs → session-BUYbl8BA.mjs} +39 -26
  155. package/dist/{session-DNm4GFO-.mjs → session-DfISYrbs.mjs} +3 -2
  156. package/dist/{client-CK6bm7nf.d.mts → session-configs-CipRvstF.d.mts} +5450 -1009
  157. package/dist/{tool-router-5OfsPkJ_.mjs → tool-router-DJQ12uhs.mjs} +1 -1
  158. package/dist/toolkits-CbdyRtvr.mjs +62 -0
  159. package/dist/tools-DiH6dAto.mjs +69 -0
  160. package/dist/tools-a29E_8La.mjs +33 -0
  161. package/dist/{trigger-instances-lkKWqHgd.mjs → trigger-instances-Bg0n7X-d.mjs} +8 -6
  162. package/dist/{triggers-DNx9yjbS.mjs → triggers-BoSFNGss.mjs} +6 -4
  163. package/dist/triggers-types-BPtTEwUA.mjs +34 -0
  164. package/dist/{usage-CKyu9RzD.mjs → usage-CHVyZ3tm.mjs} +7 -5
  165. package/dist/{usage-Cv9VNy5H.mjs → usage-Cs10eWCd.mjs} +7 -5
  166. package/dist/{webhook-endpoints-DIyg3YlR.mjs → webhook-endpoints-B4lZc5YC.mjs} +15 -10
  167. package/dist/webhook-subscriptions-DJTSJd6K.mjs +55 -0
  168. package/package.json +21 -6
  169. package/dist/cli-Bi4_ORQO.mjs +0 -45
  170. package/dist/mcp-B0wla_93.mjs +0 -73
  171. package/dist/project-C0h91WGF.mjs +0 -42
  172. package/dist/realtime-BcHoYszT.mjs +0 -26
  173. package/dist/toolkits-CcE90C2S.mjs +0 -43
  174. package/dist/tools-B5uEInC8.mjs +0 -30
  175. package/dist/tools-CdVgfSpk.mjs +0 -63
  176. package/dist/triggers-types-MjEcrPbH.mjs +0 -31
  177. package/dist/webhook-subscriptions-B7AgTACq.mjs +0 -48
package/dist/index.mjs CHANGED
@@ -1,25 +1,29 @@
1
- import { _ as PermissionDeniedError, a as inspectDeprecation, c as APIConnectionTimeoutError, d as AuthenticationError, f as BadRequestError, g as NotFoundError, h as InternalServerError, i as safeJSON, l as APIError, m as ConflictError, n as makeRequest, o as assertCredentialTransport, p as ComposioError, s as APIConnectionError, t as castToError, u as APIUserAbortError, v as RateLimitError, y as UnprocessableEntityError } from "./request-DwPfYYNF.mjs";
2
- import { t as ApiKeyRevocation } from "./api-key-revocation-BZL5FAx7.mjs";
3
- import { t as AuthConfigs } from "./auth-configs-CyksMqNB.mjs";
4
- import { t as Auth } from "./auth-CEq4JqWm.mjs";
5
- import { t as Cli } from "./cli-Bi4_ORQO.mjs";
6
- import { t as ConnectedAccounts } from "./connected-accounts-B-qN_yLT.mjs";
7
- import { t as Files$1 } from "./files-B-UnEejx.mjs";
8
- import { t as Link } from "./link-CukKZMxs.mjs";
9
- import { t as Logs } from "./logs-B87z4hq7.mjs";
10
- import { t as Mcp } from "./mcp-B0wla_93.mjs";
1
+ import { a as AuthenticationError, c as ConflictError, d as PermissionDeniedError, f as RateLimitError, i as APIUserAbortError, l as InternalServerError, n as APIConnectionTimeoutError, o as BadRequestError, p as UnprocessableEntityError, r as APIError, s as ComposioError, t as APIConnectionError, u as NotFoundError } from "./error-DLB1uKM3.mjs";
2
+ import { d as inspectDeprecation, f as assertCredentialTransport, i as makeRequest, l as VERSION, m as mergeHeaders, o as readOperation, p as parseHTTPURL, r as castToError, s as safeJSON, t as GENERATED_OPERATIONS, u as inspectDeprecatedInputs } from "./generated-operations-CWhusMPU.mjs";
3
+ import { t as Custom } from "./custom-nlGufiDz.mjs";
4
+ import { t as ApiKeyRevocation } from "./api-key-revocation-Dh-KSokR.mjs";
5
+ import { t as AuthConfigs } from "./auth-configs-yM05-r6r.mjs";
6
+ import { t as Auth } from "./auth-Drov-jN8.mjs";
7
+ import { t as Cli } from "./cli-Ce8RT7yp.mjs";
8
+ import { t as ConnectedAccounts } from "./connected-accounts-D__sOoNZ.mjs";
9
+ import { t as Files$1 } from "./files-DROCPzLP.mjs";
10
+ import { t as Keyring } from "./keyring-BzkcB1gu.mjs";
11
+ import { t as Link } from "./link-CfIyH3nF.mjs";
12
+ import { t as Logs } from "./logs-D2wxXYiO.mjs";
13
+ import { t as Mcp } from "./mcp-DEe7xU7G.mjs";
11
14
  import { t as Migration } from "./migration-CBhnoN-Y.mjs";
12
- import { t as Org } from "./org-BSq_z6fP.mjs";
13
- import { t as Project } from "./project-D-c0Zrrl.mjs";
14
- import { t as Files } from "./files-CNZ-ttVS.mjs";
15
- import { t as Session } from "./session-Do3wHYNe.mjs";
16
- import { t as ToolRouter } from "./tool-router-5OfsPkJ_.mjs";
17
- import { t as Toolkits } from "./toolkits-CcE90C2S.mjs";
18
- import { t as Tools } from "./tools-CdVgfSpk.mjs";
19
- import { t as TriggerInstances } from "./trigger-instances-lkKWqHgd.mjs";
20
- import { t as TriggersTypes } from "./triggers-types-MjEcrPbH.mjs";
21
- import { t as WebhookEndpoints } from "./webhook-endpoints-DIyg3YlR.mjs";
22
- import { t as WebhookSubscriptions } from "./webhook-subscriptions-B7AgTACq.mjs";
15
+ import { t as Org } from "./org-CYsl9O1u.mjs";
16
+ import { t as Project } from "./project-BVBWJzHm.mjs";
17
+ import { SessionConfigs } from "./resources/session-configs.mjs";
18
+ import { t as Files } from "./files-RJPIH6iE.mjs";
19
+ import { t as Session } from "./session-BUYbl8BA.mjs";
20
+ import { t as ToolRouter } from "./tool-router-DJQ12uhs.mjs";
21
+ import { t as Toolkits } from "./toolkits-CbdyRtvr.mjs";
22
+ import { t as Tools } from "./tools-DiH6dAto.mjs";
23
+ import { t as TriggerInstances } from "./trigger-instances-Bg0n7X-d.mjs";
24
+ import { t as TriggersTypes } from "./triggers-types-BPtTEwUA.mjs";
25
+ import { t as WebhookEndpoints } from "./webhook-endpoints-B4lZc5YC.mjs";
26
+ import { t as WebhookSubscriptions } from "./webhook-subscriptions-DJTSJd6K.mjs";
23
27
 
24
28
  //#region src/compat/api-promise.ts
25
29
  /**
@@ -99,750 +103,114 @@ var APIPromise = class APIPromise extends Promise {
99
103
  };
100
104
 
101
105
  //#endregion
102
- //#region src/compat/generated-operations.ts
103
- const GENERATED_OPERATIONS = [
104
- {
105
- method: "delete",
106
- path: "/api/v3.1/auth_configs/{nanoid}",
107
- chain: ["authConfigs", "delete"],
108
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
109
- },
110
- {
111
- method: "delete",
112
- path: "/api/v3.1/connected_accounts/{nanoid}",
113
- chain: ["connectedAccounts", "delete"],
114
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
115
- },
116
- {
117
- method: "delete",
118
- path: "/api/v3.1/mcp/servers/{serverId}/instances/{instanceId}",
119
- chain: ["mcp", "deleteInstance"]
120
- },
121
- {
122
- method: "delete",
123
- path: "/api/v3.1/mcp/{id}",
124
- chain: ["mcp", "delete"]
125
- },
126
- {
127
- method: "delete",
128
- path: "/api/v3.1/org/owner/project/{nano_id}",
129
- chain: [
130
- "org",
131
- "owner",
132
- "project",
133
- "delete"
134
- ],
135
- schemes: ["OrgApiKeyAuth"]
136
- },
137
- {
138
- method: "delete",
139
- path: "/api/v3.1/tool_router/session/{session_id}",
140
- chain: [
141
- "toolRouter",
142
- "session",
143
- "delete"
144
- ]
145
- },
146
- {
147
- method: "delete",
148
- path: "/api/v3.1/trigger_instances/manage/{triggerId}",
149
- chain: [
150
- "triggerInstances",
151
- "manage",
152
- "delete"
153
- ],
154
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
155
- },
156
- {
157
- method: "delete",
158
- path: "/api/v3.1/webhook_subscriptions/{id}",
159
- chain: ["webhookSubscriptions", "delete"]
160
- },
161
- {
162
- method: "get",
163
- path: "/api/v3.1/auth/session/info",
164
- chain: [
165
- "auth",
166
- "session",
167
- "retrieveInfo"
168
- ],
169
- schemes: ["UserApiKeyAuth"]
170
- },
171
- {
172
- method: "get",
173
- path: "/api/v3.1/auth_configs",
174
- chain: ["authConfigs", "list"],
175
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
176
- },
177
- {
178
- method: "get",
179
- path: "/api/v3.1/auth_configs/{nanoid}",
180
- chain: ["authConfigs", "retrieve"],
181
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
182
- },
183
- {
184
- method: "get",
185
- path: "/api/v3.1/cli/get-session",
186
- chain: ["cli", "getSession"],
187
- schemes: ["no_auth"]
188
- },
189
- {
190
- method: "get",
191
- path: "/api/v3.1/cli/realtime/credentials",
192
- chain: [
193
- "cli",
194
- "realtime",
195
- "credentials"
196
- ],
197
- schemes: ["UserApiKeyAuth"]
198
- },
199
- {
200
- method: "get",
201
- path: "/api/v3.1/connected_accounts",
202
- chain: ["connectedAccounts", "list"],
203
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
204
- },
205
- {
206
- method: "get",
207
- path: "/api/v3.1/connected_accounts/{nanoid}",
208
- chain: ["connectedAccounts", "retrieve"],
209
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
210
- },
211
- {
212
- method: "get",
213
- path: "/api/v3.1/files/list",
214
- chain: ["files", "list"]
215
- },
216
- {
217
- method: "get",
218
- path: "/api/v3.1/internal/action_execution/fields",
219
- chain: [
220
- "logs",
221
- "tools",
222
- "listFields"
223
- ]
224
- },
225
- {
226
- method: "get",
227
- path: "/api/v3.1/internal/action_execution/log/{id}",
228
- chain: [
229
- "logs",
230
- "tools",
231
- "retrieve"
232
- ]
233
- },
234
- {
235
- method: "get",
236
- path: "/api/v3.1/internal/trigger/log/{id}",
237
- chain: [
238
- "logs",
239
- "triggers",
240
- "retrieve"
241
- ]
242
- },
243
- {
244
- method: "get",
245
- path: "/api/v3.1/logs/tool_execution/{id}",
246
- chain: ["logs", "retrieveToolExecution"]
247
- },
248
- {
249
- method: "get",
250
- path: "/api/v3.1/mcp/app/{appKey}",
251
- chain: ["mcp", "retrieveApp"]
252
- },
253
- {
254
- method: "get",
255
- path: "/api/v3.1/mcp/servers",
256
- chain: ["mcp", "list"]
257
- },
258
- {
259
- method: "get",
260
- path: "/api/v3.1/mcp/servers/{serverId}/instances",
261
- chain: ["mcp", "listInstances"]
262
- },
263
- {
264
- method: "get",
265
- path: "/api/v3.1/mcp/{id}",
266
- chain: ["mcp", "retrieve"]
267
- },
268
- {
269
- method: "get",
270
- path: "/api/v3.1/org/consumer/connected_toolkits",
271
- chain: [
272
- "org",
273
- "consumer",
274
- "listConnectedToolkits"
275
- ],
276
- schemes: ["UserApiKeyAuth"]
277
- },
278
- {
279
- method: "get",
280
- path: "/api/v3.1/org/list",
281
- chain: ["org", "list"],
282
- schemes: ["UserApiKeyAuth"]
283
- },
284
- {
285
- method: "get",
286
- path: "/api/v3.1/org/owner/project/list",
287
- chain: [
288
- "org",
289
- "owner",
290
- "project",
291
- "list"
292
- ],
293
- schemes: ["OrgApiKeyAuth"]
294
- },
295
- {
296
- method: "get",
297
- path: "/api/v3.1/org/owner/project/{nano_id}",
298
- chain: [
299
- "org",
300
- "owner",
301
- "project",
302
- "retrieve"
303
- ],
304
- schemes: ["OrgApiKeyAuth"]
305
- },
306
- {
307
- method: "get",
308
- path: "/api/v3.1/org/project/list",
309
- chain: [
310
- "org",
311
- "project",
312
- "list"
313
- ],
314
- schemes: ["UserApiKeyAuth"]
315
- },
316
- {
317
- method: "get",
318
- path: "/api/v3.1/tool_router/session/{session_id}",
319
- chain: [
320
- "toolRouter",
321
- "session",
322
- "retrieve"
323
- ]
324
- },
325
- {
326
- method: "get",
327
- path: "/api/v3.1/tool_router/session/{session_id}/config_history",
328
- chain: [
329
- "toolRouter",
330
- "session",
331
- "configHistory"
332
- ]
333
- },
334
- {
335
- method: "get",
336
- path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/items",
337
- chain: [
338
- "toolRouter",
339
- "session",
340
- "files",
341
- "list"
342
- ]
343
- },
344
- {
345
- method: "get",
346
- path: "/api/v3.1/tool_router/session/{session_id}/toolkits",
347
- chain: [
348
- "toolRouter",
349
- "session",
350
- "toolkits"
351
- ]
352
- },
353
- {
354
- method: "get",
355
- path: "/api/v3.1/tool_router/session/{session_id}/tools",
356
- chain: [
357
- "toolRouter",
358
- "session",
359
- "tools"
360
- ]
361
- },
362
- {
363
- method: "get",
364
- path: "/api/v3.1/toolkits",
365
- chain: ["toolkits", "list"],
366
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
367
- },
368
- {
369
- method: "get",
370
- path: "/api/v3.1/toolkits/categories",
371
- chain: ["toolkits", "retrieveCategories"]
372
- },
373
- {
374
- method: "get",
375
- path: "/api/v3.1/toolkits/changelog",
376
- chain: ["toolkits", "retrieveChangelog"]
377
- },
378
- {
379
- method: "get",
380
- path: "/api/v3.1/toolkits/{slug}",
381
- chain: ["toolkits", "retrieve"],
382
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
383
- },
384
- {
385
- method: "get",
386
- path: "/api/v3.1/tools",
387
- chain: ["tools", "list"],
388
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
389
- },
390
- {
391
- method: "get",
392
- path: "/api/v3.1/tools/enum",
393
- chain: ["tools", "retrieveEnum"],
394
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
395
- },
396
- {
397
- method: "get",
398
- path: "/api/v3.1/tools/{tool_slug}",
399
- chain: ["tools", "retrieve"],
400
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
401
- },
402
- {
403
- method: "get",
404
- path: "/api/v3.1/trigger_instances/active",
405
- chain: ["triggerInstances", "listActive"],
406
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
407
- },
408
- {
409
- method: "get",
410
- path: "/api/v3.1/triggers_types",
411
- chain: ["triggersTypes", "list"],
412
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
413
- },
414
- {
415
- method: "get",
416
- path: "/api/v3.1/triggers_types/list/enum",
417
- chain: ["triggersTypes", "retrieveEnum"],
418
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
419
- },
420
- {
421
- method: "get",
422
- path: "/api/v3.1/triggers_types/{slug}",
423
- chain: ["triggersTypes", "retrieve"],
424
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
425
- },
426
- {
427
- method: "get",
428
- path: "/api/v3.1/webhook_endpoints",
429
- chain: ["webhookEndpoints", "list"]
430
- },
431
- {
432
- method: "get",
433
- path: "/api/v3.1/webhook_endpoints/{nano_id}",
434
- chain: ["webhookEndpoints", "retrieve"]
435
- },
436
- {
437
- method: "get",
438
- path: "/api/v3.1/webhook_subscriptions",
439
- chain: ["webhookSubscriptions", "list"]
440
- },
441
- {
442
- method: "get",
443
- path: "/api/v3.1/webhook_subscriptions/event_types",
444
- chain: ["webhookSubscriptions", "listEventTypes"]
445
- },
446
- {
447
- method: "get",
448
- path: "/api/v3.1/webhook_subscriptions/{id}",
449
- chain: ["webhookSubscriptions", "retrieve"]
450
- },
451
- {
452
- method: "patch",
453
- path: "/api/v3.1/auth_configs/{nanoid}",
454
- chain: ["authConfigs", "update"],
455
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
456
- },
457
- {
458
- method: "patch",
459
- path: "/api/v3.1/auth_configs/{nanoid}/{status}",
460
- chain: ["authConfigs", "updateStatus"]
461
- },
462
- {
463
- method: "patch",
464
- path: "/api/v3.1/connected_accounts/{nanoId}/status",
465
- chain: ["connectedAccounts", "updateStatus"]
466
- },
467
- {
468
- method: "patch",
469
- path: "/api/v3.1/connected_accounts/{nanoid}",
470
- chain: ["connectedAccounts", "patch"]
471
- },
472
- {
473
- method: "patch",
474
- path: "/api/v3.1/mcp/{id}",
475
- chain: ["mcp", "update"]
476
- },
477
- {
478
- method: "patch",
479
- path: "/api/v3.1/tool_router/session/{session_id}",
480
- chain: [
481
- "toolRouter",
482
- "session",
483
- "patch"
484
- ]
485
- },
486
- {
487
- method: "patch",
488
- path: "/api/v3.1/trigger_instances/manage/{triggerId}",
489
- chain: [
490
- "triggerInstances",
491
- "manage",
492
- "update"
493
- ],
494
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
495
- },
496
- {
497
- method: "patch",
498
- path: "/api/v3.1/webhook_endpoints/{nano_id}",
499
- chain: ["webhookEndpoints", "update"]
500
- },
501
- {
502
- method: "patch",
503
- path: "/api/v3.1/webhook_subscriptions/{id}",
504
- chain: ["webhookSubscriptions", "update"]
505
- },
506
- {
507
- method: "post",
508
- path: "/api/v3.1/api_key_revocation",
509
- chain: ["apiKeyRevocation", "create"],
510
- schemes: ["no_auth"]
511
- },
512
- {
513
- method: "post",
514
- path: "/api/v3.1/auth_configs",
515
- chain: ["authConfigs", "create"],
516
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
517
- },
518
- {
519
- method: "post",
520
- path: "/api/v3.1/cli/codact_failures",
521
- chain: ["cli", "createCodactFailure"],
522
- schemes: ["UserApiKeyAuth"]
523
- },
524
- {
525
- method: "post",
526
- path: "/api/v3.1/cli/create-session",
527
- chain: ["cli", "createSession"],
528
- schemes: ["no_auth"]
529
- },
530
- {
531
- method: "post",
532
- path: "/api/v3.1/cli/realtime/auth",
533
- chain: [
534
- "cli",
535
- "realtime",
536
- "auth"
537
- ],
538
- schemes: ["UserApiKeyAuth"]
539
- },
540
- {
541
- method: "post",
542
- path: "/api/v3.1/connected_accounts",
543
- chain: ["connectedAccounts", "create"]
544
- },
545
- {
546
- method: "post",
547
- path: "/api/v3.1/connected_accounts/link",
548
- chain: ["link", "create"],
549
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
550
- },
551
- {
552
- method: "post",
553
- path: "/api/v3.1/connected_accounts/{nanoid}/refresh",
554
- chain: ["connectedAccounts", "refresh"]
555
- },
556
- {
557
- method: "post",
558
- path: "/api/v3.1/connected_accounts/{nanoid}/revoke",
559
- chain: ["connectedAccounts", "revoke"]
560
- },
561
- {
562
- method: "post",
563
- path: "/api/v3.1/files/upload/request",
564
- chain: ["files", "createPresignedURL"]
565
- },
566
- {
567
- method: "post",
568
- path: "/api/v3.1/internal/action_execution/logs",
569
- chain: [
570
- "logs",
571
- "tools",
572
- "list"
573
- ]
574
- },
575
- {
576
- method: "post",
577
- path: "/api/v3.1/internal/trigger/logs",
578
- chain: [
579
- "logs",
580
- "triggers",
581
- "list"
582
- ]
583
- },
584
- {
585
- method: "post",
586
- path: "/api/v3.1/logs/tool_execution",
587
- chain: ["logs", "createToolExecution"]
588
- },
589
- {
590
- method: "post",
591
- path: "/api/v3.1/mcp/servers",
592
- chain: ["mcp", "create"]
593
- },
594
- {
595
- method: "post",
596
- path: "/api/v3.1/mcp/servers/custom",
597
- chain: [
598
- "mcp",
599
- "custom",
600
- "create"
601
- ]
602
- },
603
- {
604
- method: "post",
605
- path: "/api/v3.1/mcp/servers/generate",
606
- chain: [
607
- "mcp",
608
- "generate",
609
- "url"
610
- ]
611
- },
612
- {
613
- method: "post",
614
- path: "/api/v3.1/mcp/servers/{serverId}/instances",
615
- chain: ["mcp", "createInstance"]
616
- },
617
- {
618
- method: "post",
619
- path: "/api/v3.1/org/clanker/create_claim",
620
- chain: [
621
- "org",
622
- "clanker",
623
- "createClaim"
624
- ],
625
- schemes: ["OrgApiKeyAuth"]
626
- },
627
- {
628
- method: "post",
629
- path: "/api/v3.1/org/consumer/project/resolve",
630
- chain: [
631
- "org",
632
- "consumer",
633
- "project",
634
- "resolve"
635
- ],
636
- schemes: ["UserApiKeyAuth"]
637
- },
638
- {
639
- method: "post",
640
- path: "/api/v3.1/org/owner/project/new",
641
- chain: [
642
- "org",
643
- "owner",
644
- "project",
645
- "create"
646
- ],
647
- schemes: ["OrgApiKeyAuth"]
648
- },
649
- {
650
- method: "post",
651
- path: "/api/v3.1/org/owner/project/{nano_id}/regenerate_api_key",
652
- chain: [
653
- "org",
654
- "owner",
655
- "project",
656
- "regenerateAPIKey"
657
- ],
658
- schemes: ["OrgApiKeyAuth"]
659
- },
660
- {
661
- method: "post",
662
- path: "/api/v3.1/org/usage/summary",
663
- chain: [
664
- "org",
665
- "usage",
666
- "retrieveSummary"
667
- ],
668
- schemes: ["OrgApiKeyAuth"]
669
- },
670
- {
671
- method: "post",
672
- path: "/api/v3.1/org/usage/{entity_type}",
673
- chain: [
674
- "org",
675
- "usage",
676
- "retrieve"
677
- ],
678
- schemes: ["OrgApiKeyAuth"]
679
- },
680
- {
681
- method: "post",
682
- path: "/api/v3.1/project/usage/summary",
683
- chain: [
684
- "project",
685
- "usage",
686
- "retrieveSummary"
687
- ]
688
- },
689
- {
690
- method: "post",
691
- path: "/api/v3.1/project/usage/{entity_type}",
692
- chain: [
693
- "project",
694
- "usage",
695
- "retrieve"
696
- ]
697
- },
698
- {
699
- method: "post",
700
- path: "/api/v3.1/tool_router/session",
701
- chain: [
702
- "toolRouter",
703
- "session",
704
- "create"
705
- ]
706
- },
707
- {
708
- method: "post",
709
- path: "/api/v3.1/tool_router/session/{session_id}/attach",
710
- chain: [
711
- "toolRouter",
712
- "session",
713
- "attach"
714
- ]
715
- },
716
- {
717
- method: "post",
718
- path: "/api/v3.1/tool_router/session/{session_id}/execute",
719
- chain: [
720
- "toolRouter",
721
- "session",
722
- "execute"
723
- ],
724
- schemes: ["ApiKeyAuth", "workbench_access_key"]
725
- },
726
- {
727
- method: "post",
728
- path: "/api/v3.1/tool_router/session/{session_id}/execute_meta",
729
- chain: [
730
- "toolRouter",
731
- "session",
732
- "executeMeta"
733
- ]
734
- },
735
- {
736
- method: "post",
737
- path: "/api/v3.1/tool_router/session/{session_id}/link",
738
- chain: [
739
- "toolRouter",
740
- "session",
741
- "link"
742
- ]
743
- },
744
- {
745
- method: "post",
746
- path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/delete",
747
- chain: [
748
- "toolRouter",
749
- "session",
750
- "files",
751
- "delete"
752
- ]
753
- },
754
- {
755
- method: "post",
756
- path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/download_url",
757
- chain: [
758
- "toolRouter",
759
- "session",
760
- "files",
761
- "createDownloadURL"
762
- ]
763
- },
764
- {
765
- method: "post",
766
- path: "/api/v3.1/tool_router/session/{session_id}/mounts/{mount_id}/upload_url",
767
- chain: [
768
- "toolRouter",
769
- "session",
770
- "files",
771
- "createUploadURL"
772
- ]
773
- },
774
- {
775
- method: "post",
776
- path: "/api/v3.1/tool_router/session/{session_id}/proxy_execute",
777
- chain: [
778
- "toolRouter",
779
- "session",
780
- "proxyExecute"
781
- ],
782
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
783
- },
784
- {
785
- method: "post",
786
- path: "/api/v3.1/tool_router/session/{session_id}/search",
787
- chain: [
788
- "toolRouter",
789
- "session",
790
- "search"
791
- ]
792
- },
793
- {
794
- method: "post",
795
- path: "/api/v3.1/toolkits/multi",
796
- chain: ["toolkits", "retrieveMulti"]
797
- },
798
- {
799
- method: "post",
800
- path: "/api/v3.1/tools/execute/proxy",
801
- chain: ["tools", "proxy"]
802
- },
803
- {
804
- method: "post",
805
- path: "/api/v3.1/tools/execute/{tool_slug}",
806
- chain: ["tools", "execute"],
807
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
808
- },
809
- {
810
- method: "post",
811
- path: "/api/v3.1/tools/execute/{tool_slug}/input",
812
- chain: ["tools", "getInput"]
813
- },
814
- {
815
- method: "post",
816
- path: "/api/v3.1/tools/scopes/required",
817
- chain: ["tools", "retrieveRequiredScopes"]
818
- },
819
- {
820
- method: "post",
821
- path: "/api/v3.1/trigger_instances/{slug}/upsert",
822
- chain: ["triggerInstances", "upsert"],
823
- schemes: ["ApiKeyAuth", "UserApiKeyAuth"]
824
- },
825
- {
826
- method: "post",
827
- path: "/api/v3.1/webhook_endpoints",
828
- chain: ["webhookEndpoints", "create"]
829
- },
830
- {
831
- method: "post",
832
- path: "/api/v3.1/webhook_endpoints/{nano_id}",
833
- chain: ["webhookEndpoints", "replace"]
834
- },
835
- {
836
- method: "post",
837
- path: "/api/v3.1/webhook_subscriptions",
838
- chain: ["webhookSubscriptions", "create"]
839
- },
840
- {
841
- method: "post",
842
- path: "/api/v3.1/webhook_subscriptions/{id}/rotate_secret",
843
- chain: ["webhookSubscriptions", "rotateSecret"]
844
- }
845
- ];
106
+ //#region src/compat/generated-deprecated-inputs.ts
107
+ const GENERATED_DEPRECATED_INPUTS = /* @__PURE__ */ new Map([
108
+ ["authConfigs.list", [{
109
+ wire: "deprecated_app_id",
110
+ in: "query",
111
+ replacementWire: "toolkit_slug"
112
+ }, {
113
+ wire: "deprecated_status",
114
+ in: "query",
115
+ replacementWire: null
116
+ }]],
117
+ ["authConfigs.update", [{
118
+ wire: "restrict_to_following_tools",
119
+ in: "body",
120
+ replacementWire: null
121
+ }, {
122
+ wire: "tool_access_config",
123
+ in: "body",
124
+ replacementWire: null
125
+ }]],
126
+ ["toolRouter.session.proxyExecute", [{
127
+ wire: "custom_connection_data",
128
+ in: "body",
129
+ replacementWire: null
130
+ }]],
131
+ ["toolkits.list", [{
132
+ wire: "managed_by",
133
+ in: "query",
134
+ replacementWire: null
135
+ }]],
136
+ ["tools.execute", [{
137
+ wire: "entity_id",
138
+ in: "body",
139
+ replacementWire: "user_id"
140
+ }, {
141
+ wire: "allow_tracing",
142
+ in: "body",
143
+ replacementWire: null
144
+ }]],
145
+ ["tools.list", [{
146
+ wire: "auth_config_ids",
147
+ in: "query",
148
+ replacementWire: null
149
+ }, {
150
+ wire: "search",
151
+ in: "query",
152
+ replacementWire: "query"
153
+ }]],
154
+ ["tools.proxy", [{
155
+ wire: "custom_connection_data",
156
+ in: "body",
157
+ replacementWire: null
158
+ }]],
159
+ ["triggerInstances.listActive", [
160
+ {
161
+ wire: "connectedAccountIds",
162
+ in: "query",
163
+ replacementWire: "connected_account_ids"
164
+ },
165
+ {
166
+ wire: "authConfigIds",
167
+ in: "query",
168
+ replacementWire: "auth_config_ids"
169
+ },
170
+ {
171
+ wire: "triggerIds",
172
+ in: "query",
173
+ replacementWire: "trigger_ids"
174
+ },
175
+ {
176
+ wire: "triggerNames",
177
+ in: "query",
178
+ replacementWire: "trigger_names"
179
+ },
180
+ {
181
+ wire: "showDisabled",
182
+ in: "query",
183
+ replacementWire: "show_disabled"
184
+ },
185
+ {
186
+ wire: "deprecatedConnectedAccountUuids",
187
+ in: "query",
188
+ replacementWire: "connected_account_ids"
189
+ },
190
+ {
191
+ wire: "deprecatedAuthConfigUuids",
192
+ in: "query",
193
+ replacementWire: "auth_config_ids"
194
+ }
195
+ ]],
196
+ ["triggerInstances.upsert", [
197
+ {
198
+ wire: "connectedAuthId",
199
+ in: "body",
200
+ replacementWire: "connected_account_id"
201
+ },
202
+ {
203
+ wire: "triggerConfig",
204
+ in: "body",
205
+ replacementWire: "trigger_config"
206
+ },
207
+ {
208
+ wire: "version",
209
+ in: "body",
210
+ replacementWire: "toolkit_versions"
211
+ }
212
+ ]]
213
+ ]);
846
214
 
847
215
  //#endregion
848
216
  //#region src/compat/generated-resource-wiring.ts
@@ -865,13 +233,12 @@ const createClientResources = (client) => ({
865
233
  webhookEndpoints: new WebhookEndpoints(client),
866
234
  org: new Org(client),
867
235
  auth: new Auth(client),
868
- apiKeyRevocation: new ApiKeyRevocation(client)
236
+ apiKeyRevocation: new ApiKeyRevocation(client),
237
+ custom: new Custom(client),
238
+ keyring: new Keyring(client),
239
+ sessionConfigs: new SessionConfigs(client)
869
240
  });
870
241
 
871
- //#endregion
872
- //#region src/version.ts
873
- const VERSION = "2.0.0-rc.1";
874
-
875
242
  //#endregion
876
243
  //#region src/compat/client.ts
877
244
  const environments = {
@@ -879,6 +246,33 @@ const environments = {
879
246
  staging: "https://staging-backend.composio.dev",
880
247
  local: "http://localhost:9900"
881
248
  };
249
+ const environmentReader = Symbol("Composio.environmentReader");
250
+ /** Read a trimmed environment value in Node or Deno without assuming either runtime exists. */
251
+ const readEnv = (name) => {
252
+ const globals = globalThis;
253
+ try {
254
+ const fromProcess = globals.process?.env?.[name]?.trim();
255
+ if (fromProcess) return fromProcess;
256
+ } catch {}
257
+ try {
258
+ return globals.Deno?.env?.get?.(name)?.trim() || void 0;
259
+ } catch {}
260
+ };
261
+ const createEnvironmentReader = (environment) => (name) => environment[name]?.trim() || void 0;
262
+ const emptyEnvironmentReader = () => void 0;
263
+ const mergeEnvironmentHeaders = (raw, defaults) => {
264
+ if (!raw) return defaults;
265
+ const parsed = {};
266
+ for (const line of raw.split("\n")) {
267
+ const colon = line.indexOf(":");
268
+ if (colon >= 0) parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
269
+ }
270
+ try {
271
+ return mergeHeaders([parsed, defaults]);
272
+ } catch (cause) {
273
+ throw new ComposioError(`COMPOSIO_CUSTOM_HEADERS contains an invalid header: ${cause instanceof Error ? cause.message : String(cause)}`);
274
+ }
275
+ };
882
276
  /** Severity order: a record at or below the configured level is emitted. */
883
277
  const LOG_LEVELS = {
884
278
  off: 0,
@@ -889,10 +283,43 @@ const LOG_LEVELS = {
889
283
  };
890
284
  /**
891
285
  * `logLevel` is a plain string on the public surface and may arrive from
892
- * `COMPOSIO_LOG`, so it can hold anything. An unrecognized value falls back to
286
+ * `COMPOSIO_LOG_LEVEL`, so it can hold anything. An unrecognized value falls back to
893
287
  * the default rather than silencing the client or making it shout.
894
288
  */
895
289
  const isLogLevel = (value) => value !== void 0 && Object.hasOwn(LOG_LEVELS, value);
290
+ const resolveCredential = (explicit, readEnvironment, variable) => {
291
+ if (explicit !== void 0) return explicit;
292
+ return readEnvironment(variable) ?? null;
293
+ };
294
+ const resolveBaseURL = (options, readEnvironment, hasExplicitEnvironment) => {
295
+ if (options.baseURL !== void 0) return options.baseURL;
296
+ if (hasExplicitEnvironment && options.environment !== void 0) return null;
297
+ return readEnvironment("COMPOSIO_BASE_URL") ?? null;
298
+ };
299
+ const resolveClientOptions = (input) => {
300
+ if (input.transport !== void 0 && (input.fetch !== void 0 || input.fetchOptions !== void 0)) throw new ComposioError("The `transport` option cannot be combined with `fetch` or `fetchOptions`");
301
+ const hasExplicitEnvironment = input[environmentReader] !== void 0;
302
+ const readEnvironment = input[environmentReader] ?? readEnv;
303
+ const baseURL = resolveBaseURL(input, readEnvironment, hasExplicitEnvironment);
304
+ const apiKey = resolveCredential(input.apiKey, readEnvironment, "COMPOSIO_API_KEY");
305
+ const userApiKey = resolveCredential(input.userApiKey, readEnvironment, "COMPOSIO_USER_API_KEY");
306
+ const orgApiKey = resolveCredential(input.orgApiKey, readEnvironment, "COMPOSIO_ORG_API_KEY");
307
+ if (baseURL && input.environment) throw new ComposioError("Ambiguous URL; The `baseURL` option (or COMPOSIO_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null");
308
+ const options = {
309
+ ...input,
310
+ apiKey,
311
+ userApiKey,
312
+ orgApiKey,
313
+ allowInsecureHTTP: input.allowInsecureHTTP ?? readEnvironment("COMPOSIO_ALLOW_INSECURE_HTTP") === "1",
314
+ allowedHTTPOrigin: input.allowedHTTPOrigin ?? null,
315
+ baseURL,
316
+ environment: input.environment ?? "production",
317
+ logLevel: input.logLevel ?? readEnvironment("COMPOSIO_LOG_LEVEL") ?? "warn"
318
+ };
319
+ options.defaultHeaders = mergeEnvironmentHeaders(readEnvironment("COMPOSIO_CUSTOM_HEADERS"), input.defaultHeaders);
320
+ if (hasExplicitEnvironment) options[environmentReader] = emptyEnvironmentReader;
321
+ return options;
322
+ };
896
323
  var Composio = class Composio {
897
324
  apiKey;
898
325
  userApiKey;
@@ -904,12 +331,16 @@ var Composio = class Composio {
904
331
  logLevel;
905
332
  fetchOptions;
906
333
  #fetch;
334
+ #transport;
907
335
  #options;
908
336
  /**
909
- * The (operation, notice) pairs this instance has already warned about, so a
910
- * deprecated endpoint called in a loop announces itself once — while a
911
- * *revised* notice from that same endpoint, say once a `Sunset` date is
912
- * committed, still gets through.
337
+ * The (operation, notice) pairs, and separately the (operation, deprecated
338
+ * input set) pairs, this instance has already warned about — one Set shared
339
+ * by both triggers under distinct key prefixes (`inspectDeprecation` vs
340
+ * `inspectDeprecatedInputs`), so a deprecated endpoint or a deprecated
341
+ * parameter called in a loop announces itself once — while a *revised*
342
+ * notice from that same endpoint, say once a `Sunset` date is committed,
343
+ * still gets through.
913
344
  *
914
345
  * Per client *lineage*, not per process: a client built with `new Composio()`
915
346
  * starts empty, and `withOptions()` shares this exact Set with the client it
@@ -917,45 +348,49 @@ var Composio = class Composio {
917
348
  * only so a derived client can join its parent's record.
918
349
  */
919
350
  #deprecationSeen = /* @__PURE__ */ new Set();
920
- constructor({ baseURL = process.env["COMPOSIO_BASE_URL"]?.trim(), apiKey = process.env["COMPOSIO_API_KEY"]?.trim() ?? null, userApiKey = process.env["COMPOSIO_USER_API_KEY"]?.trim() ?? null, orgApiKey = process.env["COMPOSIO_ORG_API_KEY"]?.trim() ?? null, ...opts } = {}) {
921
- const options = {
922
- apiKey,
923
- userApiKey,
924
- orgApiKey,
925
- ...opts,
926
- baseURL,
927
- environment: opts.environment ?? "production"
928
- };
929
- if (baseURL && opts.environment) throw new ComposioError("Ambiguous URL; The `baseURL` option (or COMPOSIO_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null");
930
- this.baseURL = options.baseURL || environments[options.environment || "production"];
351
+ constructor(input = {}) {
352
+ const options = resolveClientOptions(input);
353
+ this.baseURL = options.baseURL || environments[options.environment];
931
354
  this.timeout = options.timeout ?? Composio.DEFAULT_TIMEOUT;
932
355
  this.logger = options.logger ?? console;
933
- this.logLevel = options.logLevel ?? process.env["COMPOSIO_LOG"]?.trim() ?? "warn";
356
+ this.logLevel = options.logLevel;
934
357
  this.fetchOptions = options.fetchOptions;
935
358
  this.maxRetries = options.maxRetries ?? 2;
936
359
  this.#fetch = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
937
- const customHeadersEnv = process.env["COMPOSIO_CUSTOM_HEADERS"];
938
- if (customHeadersEnv) {
939
- const parsed = {};
940
- for (const line of customHeadersEnv.split("\n")) {
941
- const colon = line.indexOf(":");
942
- if (colon >= 0) parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
943
- }
944
- options.defaultHeaders = {
945
- ...parsed,
946
- ...options.defaultHeaders
947
- };
948
- }
360
+ this.#transport = options.transport;
361
+ options.allowedHTTPOrigin = options.allowInsecureHTTP ? options.allowedHTTPOrigin ?? parseHTTPURL(this.baseURL)?.origin ?? null : null;
949
362
  this.#options = options;
950
- this.apiKey = apiKey;
951
- this.userApiKey = userApiKey;
952
- this.orgApiKey = orgApiKey;
953
- assertCredentialTransport(this.baseURL, this.#credentials());
363
+ this.apiKey = options.apiKey;
364
+ this.userApiKey = options.userApiKey;
365
+ this.orgApiKey = options.orgApiKey;
366
+ assertCredentialTransport(this.baseURL, this.#credentials(), options.allowedHTTPOrigin);
954
367
  Object.assign(this, createClientResources(this));
955
368
  }
369
+ /**
370
+ * Constructs a client from a caller-supplied environment snapshot.
371
+ *
372
+ * Unlike the compatibility constructor, this method never reads ambient
373
+ * process or Deno state. Explicit options replace values from `environment`;
374
+ * in particular, an explicit named environment replaces
375
+ * `COMPOSIO_BASE_URL`, and `apiKey: null` disables a mapped API key.
376
+ */
377
+ static fromEnv(environment, options = {}) {
378
+ const input = {
379
+ ...options,
380
+ [environmentReader]: createEnvironmentReader(environment)
381
+ };
382
+ return new this(input);
383
+ }
956
384
  /** Returns a new client reusing the current options with `options` merged over them. */
957
385
  withOptions(options) {
958
- const client = new this.constructor({
386
+ const hasFetch = Object.hasOwn(options, "fetch");
387
+ const hasFetchOptions = Object.hasOwn(options, "fetchOptions");
388
+ const replacesTransport = hasFetch || hasFetchOptions;
389
+ const transport = Object.hasOwn(options, "transport") ? options.transport : replacesTransport ? void 0 : this.#transport;
390
+ const fetch = transport === void 0 ? hasFetch ? options.fetch : this.#fetch : void 0;
391
+ const fetchOptions = transport === void 0 ? hasFetchOptions ? options.fetchOptions : this.fetchOptions : void 0;
392
+ const allowedHTTPOrigin = options.allowInsecureHTTP === true ? void 0 : this.#options.allowedHTTPOrigin;
393
+ const derivedOptions = {
959
394
  ...this.#options,
960
395
  environment: options.environment ? options.environment : void 0,
961
396
  baseURL: options.environment ? void 0 : this.baseURL,
@@ -963,13 +398,16 @@ var Composio = class Composio {
963
398
  timeout: this.timeout,
964
399
  logger: this.logger,
965
400
  logLevel: this.logLevel,
966
- fetch: this.#fetch,
967
- fetchOptions: this.fetchOptions,
968
401
  apiKey: this.apiKey,
969
402
  userApiKey: this.userApiKey,
970
403
  orgApiKey: this.orgApiKey,
971
- ...options
972
- });
404
+ ...options,
405
+ allowedHTTPOrigin,
406
+ transport,
407
+ fetch,
408
+ fetchOptions
409
+ };
410
+ const client = new this.constructor(derivedOptions);
973
411
  client.#deprecationSeen = this.#deprecationSeen;
974
412
  return client;
975
413
  }
@@ -1006,31 +444,55 @@ var Composio = class Composio {
1006
444
  orgApiKey: this.orgApiKey
1007
445
  };
1008
446
  }
447
+ #onKernelLog = (level, message, metadata) => {
448
+ this.#emitLog(level, message, metadata);
449
+ };
450
+ #onKernelResponse = (response, options) => {
451
+ inspectDeprecation({
452
+ response,
453
+ method: options.method,
454
+ path: options.path,
455
+ operation: readOperation(options),
456
+ baseURL: this.baseURL,
457
+ operations: GENERATED_OPERATIONS,
458
+ seen: this.#deprecationSeen,
459
+ warn: (message) => {
460
+ this.#emitLog("warn", message);
461
+ }
462
+ });
463
+ };
464
+ #onKernelRequest = (operation, query, body, headers) => {
465
+ inspectDeprecatedInputs({
466
+ operation,
467
+ query,
468
+ body,
469
+ headers,
470
+ table: GENERATED_DEPRECATED_INPUTS,
471
+ seen: this.#deprecationSeen,
472
+ warn: (message) => {
473
+ this.#emitLog("warn", message);
474
+ }
475
+ });
476
+ };
1009
477
  #kernelConfig() {
478
+ const configuredLogLevel = isLogLevel(this.logLevel) ? this.logLevel : "warn";
479
+ const lifecycleLoggingEnabled = LOG_LEVELS[configuredLogLevel] >= LOG_LEVELS.info;
1010
480
  return {
1011
481
  baseURL: this.baseURL,
1012
482
  credentials: this.#credentials(),
483
+ allowedHTTPOrigin: this.#options.allowedHTTPOrigin,
1013
484
  operations: GENERATED_OPERATIONS,
1014
485
  maxRetries: this.maxRetries,
1015
486
  timeout: this.timeout,
1016
487
  userAgent: `${this.constructor.name}/JS ${VERSION}`,
1017
488
  fetch: this.#fetch,
489
+ transport: this.#transport,
1018
490
  defaultHeaders: this.#options.defaultHeaders,
1019
491
  defaultQuery: this.#options.defaultQuery,
1020
492
  fetchOptions: this.fetchOptions,
1021
- onResponse: (response, options) => {
1022
- inspectDeprecation({
1023
- response,
1024
- method: options.method,
1025
- path: options.path,
1026
- baseURL: this.baseURL,
1027
- operations: GENERATED_OPERATIONS,
1028
- seen: this.#deprecationSeen,
1029
- warn: (message) => {
1030
- this.#emitLog("warn", message);
1031
- }
1032
- });
1033
- }
493
+ ...lifecycleLoggingEnabled ? { onLog: this.#onKernelLog } : {},
494
+ onResponse: this.#onKernelResponse,
495
+ onRequest: this.#onKernelRequest
1034
496
  };
1035
497
  }
1036
498
  /**
@@ -1040,15 +502,15 @@ var Composio = class Composio {
1040
502
  * and the public surface is pinned against the Stainless client, which
1041
503
  * exposes no such method. The logger is caller-supplied, so a missing method
1042
504
  * or a throwing one is treated as no logger at all — the same rule the
1043
- * kernel applies to `onResponse`.
505
+ * kernel applies to its advisory observer callbacks.
1044
506
  */
1045
- #emitLog(level, message) {
507
+ #emitLog(level, message, ...details) {
1046
508
  const configured = isLogLevel(this.logLevel) ? this.logLevel : "warn";
1047
509
  if (LOG_LEVELS[configured] < LOG_LEVELS[level]) return;
1048
- const sink = this.logger[level];
1049
- if (typeof sink !== "function") return;
1050
510
  try {
1051
- sink.call(this.logger, message);
511
+ const sink = this.logger[level];
512
+ if (typeof sink !== "function") return;
513
+ sink.call(this.logger, message, ...details);
1052
514
  } catch {}
1053
515
  }
1054
516
  static Composio = this;
@@ -1086,6 +548,29 @@ Composio.WebhookEndpoints = WebhookEndpoints;
1086
548
  Composio.Org = Org;
1087
549
  Composio.Auth = Auth;
1088
550
  Composio.ApiKeyRevocation = ApiKeyRevocation;
551
+ Composio.Custom = Custom;
552
+ Composio.Keyring = Keyring;
553
+
554
+ //#endregion
555
+ //#region src/compat/transport.ts
556
+ const KERNEL_OWNED_KEYS = [
557
+ "method",
558
+ "headers",
559
+ "body",
560
+ "signal",
561
+ "redirect"
562
+ ];
563
+ const assertSafeDefaults = (defaults) => {
564
+ if (defaults === void 0) return;
565
+ const owned = KERNEL_OWNED_KEYS.find((key) => key in defaults);
566
+ if (owned !== void 0) throw new TypeError(`Fetch transport defaults cannot set kernel-owned '${owned}'`);
567
+ };
568
+ /** Creates a transport backed by the supplied or global fetch function. */
569
+ const createFetchTransport = (options = {}) => {
570
+ assertSafeDefaults(options.defaults);
571
+ const fetchImplementation = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
572
+ return { send: (request) => fetchImplementation(request, options.defaults) };
573
+ };
1089
574
 
1090
575
  //#endregion
1091
- export { APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, APIUserAbortError, AuthenticationError, BadRequestError, Composio, Composio as default, ComposioError, ConflictError, Files, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, Session, ToolRouter, UnprocessableEntityError, VERSION };
576
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, APIUserAbortError, AuthenticationError, BadRequestError, Composio, Composio as default, ComposioError, ConflictError, Files, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, Session, ToolRouter, UnprocessableEntityError, VERSION, createFetchTransport };