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

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 (166) hide show
  1. package/README.md +32 -0
  2. package/dist/{api-key-revocation-BZL5FAx7.mjs → api-key-revocation-Cbokr5zZ.mjs} +4 -3
  3. package/dist/{auth-CEq4JqWm.mjs → auth-CNDyZgjw.mjs} +1 -1
  4. package/dist/{auth-configs-CyksMqNB.mjs → auth-configs-4u-8I2K7.mjs} +17 -11
  5. package/dist/{clanker-4wByThQJ.mjs → clanker-D6FjS8Lj.mjs} +4 -3
  6. package/dist/cli-LIRIGe7k.mjs +45 -0
  7. package/dist/{client-CK6bm7nf.d.mts → client-ByIYmMzt.d.mts} +48 -7
  8. package/dist/{connected-accounts-B-qN_yLT.mjs → connected-accounts-Bqtl42g0.mjs} +23 -15
  9. package/dist/{consumer-DWlaGBmh.mjs → consumer-BauHsJXO.mjs} +8 -8
  10. package/dist/{custom-BQWoONFY.mjs → custom-CGqEBUWj.mjs} +4 -3
  11. package/dist/{files-B-UnEejx.mjs → files-BYEsIET1.mjs} +7 -5
  12. package/dist/{files-CNZ-ttVS.mjs → files-DkH2-irQ.mjs} +13 -9
  13. package/dist/{generate-DSqfJENZ.mjs → generate-DTodgjHD.mjs} +4 -3
  14. package/dist/{request-DwPfYYNF.mjs → generated-operations-WtSYnmW0.mjs} +1130 -83
  15. package/dist/index.d.mts +3 -3
  16. package/dist/index.mjs +274 -819
  17. package/dist/{link-CukKZMxs.mjs → link-DL53IiYh.mjs} +4 -3
  18. package/dist/{logs-B87z4hq7.mjs → logs-DPgNkEde.mjs} +8 -6
  19. package/dist/{manage-By-b66OH.mjs → manage-DDmuMlFb.mjs} +6 -4
  20. package/dist/mcp-CS9s4sDK.mjs +82 -0
  21. package/dist/{org-BSq_z6fP.mjs → org-9gTqtmtc.mjs} +9 -8
  22. package/dist/{owner-BDkEFEVF.mjs → owner-EZzWtfQx.mjs} +1 -1
  23. package/dist/{project-_s0fWHut.mjs → project-4Ol46ZwD.mjs} +7 -7
  24. package/dist/project-CKmDHyu_.mjs +47 -0
  25. package/dist/{project-D-c0Zrrl.mjs → project-DeRwedA-.mjs} +1 -1
  26. package/dist/{project-Cj-NKnWZ.mjs → project-uN9dGkls.mjs} +4 -3
  27. package/dist/realtime-C8DEUgai.mjs +28 -0
  28. package/dist/resources/api-key-revocation.d.mts +1 -1
  29. package/dist/resources/api-key-revocation.mjs +1 -1
  30. package/dist/resources/auth/auth.d.mts +1 -1
  31. package/dist/resources/auth/auth.mjs +1 -1
  32. package/dist/resources/auth/index.d.mts +1 -1
  33. package/dist/resources/auth/index.mjs +2 -2
  34. package/dist/resources/auth/session.d.mts +1 -1
  35. package/dist/resources/auth/session.mjs +1 -1
  36. package/dist/resources/auth-configs.d.mts +1 -1
  37. package/dist/resources/auth-configs.mjs +1 -1
  38. package/dist/resources/auth.d.mts +1 -1
  39. package/dist/resources/auth.mjs +2 -2
  40. package/dist/resources/cli/cli.d.mts +1 -1
  41. package/dist/resources/cli/cli.mjs +1 -1
  42. package/dist/resources/cli/index.d.mts +1 -1
  43. package/dist/resources/cli/index.mjs +2 -2
  44. package/dist/resources/cli/realtime.d.mts +1 -1
  45. package/dist/resources/cli/realtime.mjs +1 -1
  46. package/dist/resources/cli.d.mts +1 -1
  47. package/dist/resources/cli.mjs +2 -2
  48. package/dist/resources/connected-accounts.d.mts +1 -1
  49. package/dist/resources/connected-accounts.mjs +1 -1
  50. package/dist/resources/files.d.mts +1 -1
  51. package/dist/resources/files.mjs +1 -1
  52. package/dist/resources/index.d.mts +1 -1
  53. package/dist/resources/index.mjs +13 -13
  54. package/dist/resources/link.d.mts +1 -1
  55. package/dist/resources/link.mjs +1 -1
  56. package/dist/resources/logs/index.d.mts +1 -1
  57. package/dist/resources/logs/index.mjs +3 -3
  58. package/dist/resources/logs/logs.d.mts +1 -1
  59. package/dist/resources/logs/logs.mjs +1 -1
  60. package/dist/resources/logs/tools.d.mts +1 -1
  61. package/dist/resources/logs/tools.mjs +1 -1
  62. package/dist/resources/logs/triggers.d.mts +1 -1
  63. package/dist/resources/logs/triggers.mjs +1 -1
  64. package/dist/resources/logs.d.mts +1 -1
  65. package/dist/resources/logs.mjs +3 -3
  66. package/dist/resources/mcp/custom.d.mts +1 -1
  67. package/dist/resources/mcp/custom.mjs +1 -1
  68. package/dist/resources/mcp/generate.d.mts +1 -1
  69. package/dist/resources/mcp/generate.mjs +1 -1
  70. package/dist/resources/mcp/index.d.mts +1 -1
  71. package/dist/resources/mcp/index.mjs +3 -3
  72. package/dist/resources/mcp/mcp.d.mts +1 -1
  73. package/dist/resources/mcp/mcp.mjs +1 -1
  74. package/dist/resources/mcp.d.mts +1 -1
  75. package/dist/resources/mcp.mjs +3 -3
  76. package/dist/resources/org/clanker.d.mts +1 -1
  77. package/dist/resources/org/clanker.mjs +1 -1
  78. package/dist/resources/org/consumer/consumer.d.mts +1 -1
  79. package/dist/resources/org/consumer/consumer.mjs +1 -1
  80. package/dist/resources/org/consumer/index.d.mts +1 -1
  81. package/dist/resources/org/consumer/index.mjs +2 -2
  82. package/dist/resources/org/consumer/project.d.mts +1 -1
  83. package/dist/resources/org/consumer/project.mjs +1 -1
  84. package/dist/resources/org/consumer.d.mts +1 -1
  85. package/dist/resources/org/consumer.mjs +2 -2
  86. package/dist/resources/org/index.d.mts +1 -1
  87. package/dist/resources/org/index.mjs +6 -6
  88. package/dist/resources/org/org.d.mts +1 -1
  89. package/dist/resources/org/org.mjs +1 -1
  90. package/dist/resources/org/owner/index.d.mts +1 -1
  91. package/dist/resources/org/owner/index.mjs +2 -2
  92. package/dist/resources/org/owner/owner.d.mts +1 -1
  93. package/dist/resources/org/owner/owner.mjs +1 -1
  94. package/dist/resources/org/owner/project.d.mts +1 -1
  95. package/dist/resources/org/owner/project.mjs +1 -1
  96. package/dist/resources/org/owner.d.mts +1 -1
  97. package/dist/resources/org/owner.mjs +2 -2
  98. package/dist/resources/org/project.d.mts +1 -1
  99. package/dist/resources/org/project.mjs +1 -1
  100. package/dist/resources/org/usage.d.mts +1 -1
  101. package/dist/resources/org/usage.mjs +1 -1
  102. package/dist/resources/org.d.mts +1 -1
  103. package/dist/resources/org.mjs +6 -6
  104. package/dist/resources/project/index.d.mts +1 -1
  105. package/dist/resources/project/index.mjs +1 -1
  106. package/dist/resources/project/project.d.mts +1 -1
  107. package/dist/resources/project/project.mjs +1 -1
  108. package/dist/resources/project/usage.d.mts +1 -1
  109. package/dist/resources/project/usage.mjs +1 -1
  110. package/dist/resources/project.d.mts +1 -1
  111. package/dist/resources/project.mjs +1 -1
  112. package/dist/resources/tool-router/index.d.mts +1 -1
  113. package/dist/resources/tool-router/index.mjs +2 -2
  114. package/dist/resources/tool-router/session/files.d.mts +1 -1
  115. package/dist/resources/tool-router/session/files.mjs +1 -1
  116. package/dist/resources/tool-router/session/index.d.mts +1 -1
  117. package/dist/resources/tool-router/session/index.mjs +2 -2
  118. package/dist/resources/tool-router/session/session.d.mts +1 -1
  119. package/dist/resources/tool-router/session/session.mjs +1 -1
  120. package/dist/resources/tool-router/session.d.mts +1 -1
  121. package/dist/resources/tool-router/session.mjs +2 -2
  122. package/dist/resources/tool-router/tool-router.d.mts +1 -1
  123. package/dist/resources/tool-router/tool-router.mjs +1 -1
  124. package/dist/resources/tool-router.d.mts +1 -1
  125. package/dist/resources/tool-router.mjs +2 -2
  126. package/dist/resources/toolkits.d.mts +1 -1
  127. package/dist/resources/toolkits.mjs +1 -1
  128. package/dist/resources/tools.d.mts +1 -1
  129. package/dist/resources/tools.mjs +1 -1
  130. package/dist/resources/trigger-instances/index.d.mts +1 -1
  131. package/dist/resources/trigger-instances/index.mjs +2 -2
  132. package/dist/resources/trigger-instances/manage.d.mts +1 -1
  133. package/dist/resources/trigger-instances/manage.mjs +1 -1
  134. package/dist/resources/trigger-instances/trigger-instances.d.mts +1 -1
  135. package/dist/resources/trigger-instances/trigger-instances.mjs +1 -1
  136. package/dist/resources/trigger-instances.d.mts +1 -1
  137. package/dist/resources/trigger-instances.mjs +2 -2
  138. package/dist/resources/triggers-types.d.mts +1 -1
  139. package/dist/resources/triggers-types.mjs +1 -1
  140. package/dist/resources/webhook-endpoints.d.mts +1 -1
  141. package/dist/resources/webhook-endpoints.mjs +1 -1
  142. package/dist/resources/webhook-subscriptions.d.mts +1 -1
  143. package/dist/resources/webhook-subscriptions.mjs +1 -1
  144. package/dist/{session-Do3wHYNe.mjs → session-DWQaRfV_.mjs} +39 -26
  145. package/dist/{session-DNm4GFO-.mjs → session-EJK1YmKD.mjs} +3 -2
  146. package/dist/{tool-router-5OfsPkJ_.mjs → tool-router-CqRP0_gv.mjs} +1 -1
  147. package/dist/toolkits-B3eGuBu0.mjs +48 -0
  148. package/dist/tools-B4uip2mE.mjs +33 -0
  149. package/dist/tools-fb-vXe-l.mjs +67 -0
  150. package/dist/{trigger-instances-lkKWqHgd.mjs → trigger-instances-BCL5DJ0o.mjs} +8 -6
  151. package/dist/{triggers-DNx9yjbS.mjs → triggers-DnDhI69h.mjs} +6 -4
  152. package/dist/triggers-types-HHDB0mLH.mjs +34 -0
  153. package/dist/{usage-Cv9VNy5H.mjs → usage-B6vtknow.mjs} +7 -5
  154. package/dist/{usage-CKyu9RzD.mjs → usage-CzAfsIc4.mjs} +7 -5
  155. package/dist/{webhook-endpoints-DIyg3YlR.mjs → webhook-endpoints-DRJgQ6s0.mjs} +15 -10
  156. package/dist/webhook-subscriptions-WcdnIkGU.mjs +55 -0
  157. package/package.json +5 -2
  158. package/dist/cli-Bi4_ORQO.mjs +0 -45
  159. package/dist/mcp-B0wla_93.mjs +0 -73
  160. package/dist/project-C0h91WGF.mjs +0 -42
  161. package/dist/realtime-BcHoYszT.mjs +0 -26
  162. package/dist/toolkits-CcE90C2S.mjs +0 -43
  163. package/dist/tools-B5uEInC8.mjs +0 -30
  164. package/dist/tools-CdVgfSpk.mjs +0 -63
  165. package/dist/triggers-types-MjEcrPbH.mjs +0 -31
  166. package/dist/webhook-subscriptions-B7AgTACq.mjs +0 -48
package/dist/index.mjs CHANGED
@@ -1,25 +1,25 @@
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 { C as PermissionDeniedError, S as NotFoundError, T as UnprocessableEntityError, _ as AuthenticationError, b as ConflictError, d as assertCredentialTransport, f as mergeHeaders, g as APIUserAbortError, h as APIError, i as makeRequest, l as inspectDeprecatedInputs, m as APIConnectionTimeoutError, o as readOperation, p as APIConnectionError, r as castToError, s as safeJSON, t as GENERATED_OPERATIONS, u as inspectDeprecation, v as BadRequestError, w as RateLimitError, x as InternalServerError, y as ComposioError } from "./generated-operations-WtSYnmW0.mjs";
2
+ import { t as ApiKeyRevocation } from "./api-key-revocation-Cbokr5zZ.mjs";
3
+ import { t as AuthConfigs } from "./auth-configs-4u-8I2K7.mjs";
4
+ import { t as Auth } from "./auth-CNDyZgjw.mjs";
5
+ import { t as Cli } from "./cli-LIRIGe7k.mjs";
6
+ import { t as ConnectedAccounts } from "./connected-accounts-Bqtl42g0.mjs";
7
+ import { t as Files$1 } from "./files-BYEsIET1.mjs";
8
+ import { t as Link } from "./link-DL53IiYh.mjs";
9
+ import { t as Logs } from "./logs-DPgNkEde.mjs";
10
+ import { t as Mcp } from "./mcp-CS9s4sDK.mjs";
11
11
  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";
12
+ import { t as Org } from "./org-9gTqtmtc.mjs";
13
+ import { t as Project } from "./project-DeRwedA-.mjs";
14
+ import { t as Files } from "./files-DkH2-irQ.mjs";
15
+ import { t as Session } from "./session-DWQaRfV_.mjs";
16
+ import { t as ToolRouter } from "./tool-router-CqRP0_gv.mjs";
17
+ import { t as Toolkits } from "./toolkits-B3eGuBu0.mjs";
18
+ import { t as Tools } from "./tools-fb-vXe-l.mjs";
19
+ import { t as TriggerInstances } from "./trigger-instances-BCL5DJ0o.mjs";
20
+ import { t as TriggersTypes } from "./triggers-types-HHDB0mLH.mjs";
21
+ import { t as WebhookEndpoints } from "./webhook-endpoints-DRJgQ6s0.mjs";
22
+ import { t as WebhookSubscriptions } from "./webhook-subscriptions-WcdnIkGU.mjs";
23
23
 
24
24
  //#region src/compat/api-promise.ts
25
25
  /**
@@ -99,750 +99,96 @@ var APIPromise = class APIPromise extends Promise {
99
99
  };
100
100
 
101
101
  //#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
- ];
102
+ //#region src/compat/generated-deprecated-inputs.ts
103
+ const GENERATED_DEPRECATED_INPUTS = /* @__PURE__ */ new Map([
104
+ ["authConfigs.list", [{
105
+ wire: "deprecated_app_id",
106
+ in: "query",
107
+ replacementWire: "toolkit_slug"
108
+ }, {
109
+ wire: "deprecated_status",
110
+ in: "query",
111
+ replacementWire: null
112
+ }]],
113
+ ["authConfigs.update", [{
114
+ wire: "restrict_to_following_tools",
115
+ in: "body",
116
+ replacementWire: "tool_access_config"
117
+ }]],
118
+ ["tools.execute", [{
119
+ wire: "entity_id",
120
+ in: "body",
121
+ replacementWire: "user_id"
122
+ }, {
123
+ wire: "allow_tracing",
124
+ in: "body",
125
+ replacementWire: null
126
+ }]],
127
+ ["tools.list", [{
128
+ wire: "search",
129
+ in: "query",
130
+ replacementWire: "query"
131
+ }]],
132
+ ["tools.proxy", [{
133
+ wire: "custom_connection_data",
134
+ in: "body",
135
+ replacementWire: null
136
+ }]],
137
+ ["triggerInstances.listActive", [
138
+ {
139
+ wire: "connectedAccountIds",
140
+ in: "query",
141
+ replacementWire: "connected_account_ids"
142
+ },
143
+ {
144
+ wire: "authConfigIds",
145
+ in: "query",
146
+ replacementWire: "auth_config_ids"
147
+ },
148
+ {
149
+ wire: "triggerIds",
150
+ in: "query",
151
+ replacementWire: "trigger_ids"
152
+ },
153
+ {
154
+ wire: "triggerNames",
155
+ in: "query",
156
+ replacementWire: "trigger_names"
157
+ },
158
+ {
159
+ wire: "showDisabled",
160
+ in: "query",
161
+ replacementWire: "show_disabled"
162
+ },
163
+ {
164
+ wire: "deprecatedConnectedAccountUuids",
165
+ in: "query",
166
+ replacementWire: "connected_account_ids"
167
+ },
168
+ {
169
+ wire: "deprecatedAuthConfigUuids",
170
+ in: "query",
171
+ replacementWire: "auth_config_ids"
172
+ }
173
+ ]],
174
+ ["triggerInstances.upsert", [
175
+ {
176
+ wire: "connectedAuthId",
177
+ in: "body",
178
+ replacementWire: "connected_account_id"
179
+ },
180
+ {
181
+ wire: "triggerConfig",
182
+ in: "body",
183
+ replacementWire: "trigger_config"
184
+ },
185
+ {
186
+ wire: "version",
187
+ in: "body",
188
+ replacementWire: "toolkit_versions"
189
+ }
190
+ ]]
191
+ ]);
846
192
 
847
193
  //#endregion
848
194
  //#region src/compat/generated-resource-wiring.ts
@@ -870,7 +216,7 @@ const createClientResources = (client) => ({
870
216
 
871
217
  //#endregion
872
218
  //#region src/version.ts
873
- const VERSION = "2.0.0-rc.1";
219
+ const VERSION = "2.0.0-rc.3";
874
220
 
875
221
  //#endregion
876
222
  //#region src/compat/client.ts
@@ -879,6 +225,33 @@ const environments = {
879
225
  staging: "https://staging-backend.composio.dev",
880
226
  local: "http://localhost:9900"
881
227
  };
228
+ const environmentReader = Symbol("Composio.environmentReader");
229
+ /** Read a trimmed environment value in Node or Deno without assuming either runtime exists. */
230
+ const readEnv = (name) => {
231
+ const globals = globalThis;
232
+ try {
233
+ const fromProcess = globals.process?.env?.[name]?.trim();
234
+ if (fromProcess) return fromProcess;
235
+ } catch {}
236
+ try {
237
+ return globals.Deno?.env?.get?.(name)?.trim() || void 0;
238
+ } catch {}
239
+ };
240
+ const createEnvironmentReader = (environment) => (name) => environment[name]?.trim() || void 0;
241
+ const emptyEnvironmentReader = () => void 0;
242
+ const mergeEnvironmentHeaders = (raw, defaults) => {
243
+ if (!raw) return defaults;
244
+ const parsed = {};
245
+ for (const line of raw.split("\n")) {
246
+ const colon = line.indexOf(":");
247
+ if (colon >= 0) parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
248
+ }
249
+ try {
250
+ return mergeHeaders([parsed, defaults]);
251
+ } catch (cause) {
252
+ throw new ComposioError(`COMPOSIO_CUSTOM_HEADERS contains an invalid header: ${cause instanceof Error ? cause.message : String(cause)}`);
253
+ }
254
+ };
882
255
  /** Severity order: a record at or below the configured level is emitted. */
883
256
  const LOG_LEVELS = {
884
257
  off: 0,
@@ -893,6 +266,37 @@ const LOG_LEVELS = {
893
266
  * the default rather than silencing the client or making it shout.
894
267
  */
895
268
  const isLogLevel = (value) => value !== void 0 && Object.hasOwn(LOG_LEVELS, value);
269
+ const resolveCredential = (explicit, readEnvironment, variable) => {
270
+ if (explicit !== void 0) return explicit;
271
+ return readEnvironment(variable) ?? null;
272
+ };
273
+ const resolveBaseURL = (options, readEnvironment, hasExplicitEnvironment) => {
274
+ if (options.baseURL !== void 0) return options.baseURL;
275
+ if (hasExplicitEnvironment && options.environment !== void 0) return null;
276
+ return readEnvironment("COMPOSIO_BASE_URL") ?? null;
277
+ };
278
+ const resolveClientOptions = (input) => {
279
+ 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`");
280
+ const hasExplicitEnvironment = input[environmentReader] !== void 0;
281
+ const readEnvironment = input[environmentReader] ?? readEnv;
282
+ const baseURL = resolveBaseURL(input, readEnvironment, hasExplicitEnvironment);
283
+ const apiKey = resolveCredential(input.apiKey, readEnvironment, "COMPOSIO_API_KEY");
284
+ const userApiKey = resolveCredential(input.userApiKey, readEnvironment, "COMPOSIO_USER_API_KEY");
285
+ const orgApiKey = resolveCredential(input.orgApiKey, readEnvironment, "COMPOSIO_ORG_API_KEY");
286
+ 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");
287
+ const options = {
288
+ ...input,
289
+ apiKey,
290
+ userApiKey,
291
+ orgApiKey,
292
+ baseURL,
293
+ environment: input.environment ?? "production",
294
+ logLevel: input.logLevel ?? readEnvironment("COMPOSIO_LOG") ?? "warn"
295
+ };
296
+ options.defaultHeaders = mergeEnvironmentHeaders(readEnvironment("COMPOSIO_CUSTOM_HEADERS"), input.defaultHeaders);
297
+ if (hasExplicitEnvironment) options[environmentReader] = emptyEnvironmentReader;
298
+ return options;
299
+ };
896
300
  var Composio = class Composio {
897
301
  apiKey;
898
302
  userApiKey;
@@ -904,12 +308,16 @@ var Composio = class Composio {
904
308
  logLevel;
905
309
  fetchOptions;
906
310
  #fetch;
311
+ #transport;
907
312
  #options;
908
313
  /**
909
- * The (operation, notice) pairs this instance has already warned about, so a
910
- * deprecated endpoint called in a loop announces itself oncewhile a
911
- * *revised* notice from that same endpoint, say once a `Sunset` date is
912
- * committed, still gets through.
314
+ * The (operation, notice) pairs, and separately the (operation, deprecated
315
+ * input set) pairs, this instance has already warned aboutone Set shared
316
+ * by both triggers under distinct key prefixes (`inspectDeprecation` vs
317
+ * `inspectDeprecatedInputs`), so a deprecated endpoint or a deprecated
318
+ * parameter called in a loop announces itself once — while a *revised*
319
+ * notice from that same endpoint, say once a `Sunset` date is committed,
320
+ * still gets through.
913
321
  *
914
322
  * Per client *lineage*, not per process: a client built with `new Composio()`
915
323
  * starts empty, and `withOptions()` shares this exact Set with the client it
@@ -917,44 +325,46 @@ var Composio = class Composio {
917
325
  * only so a derived client can join its parent's record.
918
326
  */
919
327
  #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"];
328
+ constructor(input = {}) {
329
+ const options = resolveClientOptions(input);
330
+ this.baseURL = options.baseURL || environments[options.environment];
931
331
  this.timeout = options.timeout ?? Composio.DEFAULT_TIMEOUT;
932
332
  this.logger = options.logger ?? console;
933
- this.logLevel = options.logLevel ?? process.env["COMPOSIO_LOG"]?.trim() ?? "warn";
333
+ this.logLevel = options.logLevel;
934
334
  this.fetchOptions = options.fetchOptions;
935
335
  this.maxRetries = options.maxRetries ?? 2;
936
336
  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
- }
337
+ this.#transport = options.transport;
949
338
  this.#options = options;
950
- this.apiKey = apiKey;
951
- this.userApiKey = userApiKey;
952
- this.orgApiKey = orgApiKey;
339
+ this.apiKey = options.apiKey;
340
+ this.userApiKey = options.userApiKey;
341
+ this.orgApiKey = options.orgApiKey;
953
342
  assertCredentialTransport(this.baseURL, this.#credentials());
954
343
  Object.assign(this, createClientResources(this));
955
344
  }
345
+ /**
346
+ * Constructs a client from a caller-supplied environment snapshot.
347
+ *
348
+ * Unlike the compatibility constructor, this method never reads ambient
349
+ * process or Deno state. Explicit options replace values from `environment`;
350
+ * in particular, an explicit named environment replaces
351
+ * `COMPOSIO_BASE_URL`, and `apiKey: null` disables a mapped API key.
352
+ */
353
+ static fromEnv(environment, options = {}) {
354
+ const input = {
355
+ ...options,
356
+ [environmentReader]: createEnvironmentReader(environment)
357
+ };
358
+ return new this(input);
359
+ }
956
360
  /** Returns a new client reusing the current options with `options` merged over them. */
957
361
  withOptions(options) {
362
+ const hasFetch = Object.hasOwn(options, "fetch");
363
+ const hasFetchOptions = Object.hasOwn(options, "fetchOptions");
364
+ const replacesTransport = hasFetch || hasFetchOptions;
365
+ const transport = Object.hasOwn(options, "transport") ? options.transport : replacesTransport ? void 0 : this.#transport;
366
+ const fetch = transport === void 0 ? hasFetch ? options.fetch : this.#fetch : void 0;
367
+ const fetchOptions = transport === void 0 ? hasFetchOptions ? options.fetchOptions : this.fetchOptions : void 0;
958
368
  const client = new this.constructor({
959
369
  ...this.#options,
960
370
  environment: options.environment ? options.environment : void 0,
@@ -963,12 +373,13 @@ var Composio = class Composio {
963
373
  timeout: this.timeout,
964
374
  logger: this.logger,
965
375
  logLevel: this.logLevel,
966
- fetch: this.#fetch,
967
- fetchOptions: this.fetchOptions,
968
376
  apiKey: this.apiKey,
969
377
  userApiKey: this.userApiKey,
970
378
  orgApiKey: this.orgApiKey,
971
- ...options
379
+ ...options,
380
+ transport,
381
+ fetch,
382
+ fetchOptions
972
383
  });
973
384
  client.#deprecationSeen = this.#deprecationSeen;
974
385
  return client;
@@ -1006,7 +417,39 @@ var Composio = class Composio {
1006
417
  orgApiKey: this.orgApiKey
1007
418
  };
1008
419
  }
420
+ #onKernelLog = (level, message, metadata) => {
421
+ this.#emitLog(level, message, metadata);
422
+ };
423
+ #onKernelResponse = (response, options) => {
424
+ inspectDeprecation({
425
+ response,
426
+ method: options.method,
427
+ path: options.path,
428
+ operation: readOperation(options),
429
+ baseURL: this.baseURL,
430
+ operations: GENERATED_OPERATIONS,
431
+ seen: this.#deprecationSeen,
432
+ warn: (message) => {
433
+ this.#emitLog("warn", message);
434
+ }
435
+ });
436
+ };
437
+ #onKernelRequest = (operation, query, body, headers) => {
438
+ inspectDeprecatedInputs({
439
+ operation,
440
+ query,
441
+ body,
442
+ headers,
443
+ table: GENERATED_DEPRECATED_INPUTS,
444
+ seen: this.#deprecationSeen,
445
+ warn: (message) => {
446
+ this.#emitLog("warn", message);
447
+ }
448
+ });
449
+ };
1009
450
  #kernelConfig() {
451
+ const configuredLogLevel = isLogLevel(this.logLevel) ? this.logLevel : "warn";
452
+ const lifecycleLoggingEnabled = LOG_LEVELS[configuredLogLevel] >= LOG_LEVELS.info;
1010
453
  return {
1011
454
  baseURL: this.baseURL,
1012
455
  credentials: this.#credentials(),
@@ -1015,22 +458,13 @@ var Composio = class Composio {
1015
458
  timeout: this.timeout,
1016
459
  userAgent: `${this.constructor.name}/JS ${VERSION}`,
1017
460
  fetch: this.#fetch,
461
+ transport: this.#transport,
1018
462
  defaultHeaders: this.#options.defaultHeaders,
1019
463
  defaultQuery: this.#options.defaultQuery,
1020
464
  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
- }
465
+ ...lifecycleLoggingEnabled ? { onLog: this.#onKernelLog } : {},
466
+ onResponse: this.#onKernelResponse,
467
+ onRequest: this.#onKernelRequest
1034
468
  };
1035
469
  }
1036
470
  /**
@@ -1040,15 +474,15 @@ var Composio = class Composio {
1040
474
  * and the public surface is pinned against the Stainless client, which
1041
475
  * exposes no such method. The logger is caller-supplied, so a missing method
1042
476
  * or a throwing one is treated as no logger at all — the same rule the
1043
- * kernel applies to `onResponse`.
477
+ * kernel applies to its advisory observer callbacks.
1044
478
  */
1045
- #emitLog(level, message) {
479
+ #emitLog(level, message, ...details) {
1046
480
  const configured = isLogLevel(this.logLevel) ? this.logLevel : "warn";
1047
481
  if (LOG_LEVELS[configured] < LOG_LEVELS[level]) return;
1048
- const sink = this.logger[level];
1049
- if (typeof sink !== "function") return;
1050
482
  try {
1051
- sink.call(this.logger, message);
483
+ const sink = this.logger[level];
484
+ if (typeof sink !== "function") return;
485
+ sink.call(this.logger, message, ...details);
1052
486
  } catch {}
1053
487
  }
1054
488
  static Composio = this;
@@ -1088,4 +522,25 @@ Composio.Auth = Auth;
1088
522
  Composio.ApiKeyRevocation = ApiKeyRevocation;
1089
523
 
1090
524
  //#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 };
525
+ //#region src/compat/transport.ts
526
+ const KERNEL_OWNED_KEYS = [
527
+ "method",
528
+ "headers",
529
+ "body",
530
+ "signal",
531
+ "redirect"
532
+ ];
533
+ const assertSafeDefaults = (defaults) => {
534
+ if (defaults === void 0) return;
535
+ const owned = KERNEL_OWNED_KEYS.find((key) => key in defaults);
536
+ if (owned !== void 0) throw new TypeError(`Fetch transport defaults cannot set kernel-owned '${owned}'`);
537
+ };
538
+ /** Creates a transport backed by the supplied or global fetch function. */
539
+ const createFetchTransport = (options = {}) => {
540
+ assertSafeDefaults(options.defaults);
541
+ const fetchImplementation = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
542
+ return { send: (request) => fetchImplementation(request, options.defaults) };
543
+ };
544
+
545
+ //#endregion
546
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, APIPromise, APIUserAbortError, AuthenticationError, BadRequestError, Composio, Composio as default, ComposioError, ConflictError, Files, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, Session, ToolRouter, UnprocessableEntityError, VERSION, createFetchTransport };