@composio/core 0.2.5 → 0.2.7-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/dist/index.cjs +601 -99
  2. package/dist/index.d.cts +41460 -8981
  3. package/dist/index.d.ts +41460 -8981
  4. package/dist/index.js +586 -95
  5. package/generated/ably.ts +20 -0
  6. package/generated/accelo.ts +8 -0
  7. package/generated/acculynx.ts +17 -0
  8. package/generated/active_campaign.ts +30 -0
  9. package/generated/adobe.ts +8 -0
  10. package/generated/adyntel.ts +12 -0
  11. package/generated/aero_workflow.ts +8 -0
  12. package/generated/affinity.ts +29 -0
  13. package/generated/agencyzoom.ts +108 -0
  14. package/generated/ahrefs.ts +49 -0
  15. package/generated/airtable.ts +26 -0
  16. package/generated/alchemy.ts +16 -0
  17. package/generated/algolia.ts +39 -0
  18. package/generated/altoviz.ts +18 -0
  19. package/generated/amazon.ts +8 -0
  20. package/generated/amcards.ts +11 -0
  21. package/generated/amplitude.ts +25 -0
  22. package/generated/anthropic_administrator.ts +13 -0
  23. package/generated/apaleo.ts +38 -0
  24. package/generated/apollo.ts +40 -0
  25. package/generated/appdrag.ts +8 -0
  26. package/generated/appsflyer.ts +8 -0
  27. package/generated/asana.ts +95 -0
  28. package/generated/ashby.ts +8 -0
  29. package/generated/atlassian.ts +8 -0
  30. package/generated/attio.ts +20 -0
  31. package/generated/auth0.ts +8 -0
  32. package/generated/axonaut.ts +8 -0
  33. package/generated/bamboohr.ts +168 -0
  34. package/generated/bannerbear.ts +17 -0
  35. package/generated/baserow.ts +11 -0
  36. package/generated/battlenet.ts +8 -0
  37. package/generated/beeminder.ts +14 -0
  38. package/generated/bigmailer.ts +12 -0
  39. package/generated/bigml.ts +15 -0
  40. package/generated/bill.ts +218 -0
  41. package/generated/bitbucket.ts +25 -0
  42. package/generated/bitwarden.ts +8 -0
  43. package/generated/blackbaud.ts +8 -0
  44. package/generated/blackboard.ts +323 -0
  45. package/generated/boldsign.ts +8 -0
  46. package/generated/bolna.ts +24 -0
  47. package/generated/borneo.ts +162 -0
  48. package/generated/botbaba.ts +8 -0
  49. package/generated/box.ts +282 -0
  50. package/generated/braintree.ts +8 -0
  51. package/generated/brandfetch.ts +15 -0
  52. package/generated/breezy_hr.ts +8 -0
  53. package/generated/brevo.ts +28 -0
  54. package/generated/brex.ts +8 -0
  55. package/generated/brex_staging.ts +8 -0
  56. package/generated/brightpearl.ts +8 -0
  57. package/generated/brilliant_directories.ts +15 -0
  58. package/generated/browseai.ts +18 -0
  59. package/generated/browserbase_tool.ts +10 -0
  60. package/generated/browserhub.ts +8 -0
  61. package/generated/browserless.ts +16 -0
  62. package/generated/bubble.ts +8 -0
  63. package/generated/bugbug.ts +13 -0
  64. package/generated/builtwith.ts +21 -0
  65. package/generated/cal.ts +150 -0
  66. package/generated/calendly.ts +51 -0
  67. package/generated/canva.ts +41 -0
  68. package/generated/canvas.ts +100 -0
  69. package/generated/chatwork.ts +17 -0
  70. package/generated/chmeetings.ts +8 -0
  71. package/generated/clickup.ts +153 -0
  72. package/generated/clockify.ts +23 -0
  73. package/generated/close.ts +15 -0
  74. package/generated/cloudflare.ts +10 -0
  75. package/generated/coda.ts +115 -0
  76. package/generated/codeinterpreter.ts +14 -0
  77. package/generated/coinbase.ts +15 -0
  78. package/generated/coinmarketcal.ts +8 -0
  79. package/generated/composio.ts +34 -0
  80. package/generated/composio_search.ts +22 -0
  81. package/generated/confluence.ts +199 -0
  82. package/generated/contentful.ts +12 -0
  83. package/generated/crustdata.ts +23 -0
  84. package/generated/customer_io.ts +8 -0
  85. package/generated/cutt_ly.ts +10 -0
  86. package/generated/d2lbrightspace.ts +54 -0
  87. package/generated/dailybot.ts +15 -0
  88. package/generated/datadog.ts +47 -0
  89. package/generated/datagma.ts +8 -0
  90. package/generated/datarobot.ts +8 -0
  91. package/generated/deel.ts +8 -0
  92. package/generated/demio.ts +8 -0
  93. package/generated/dialpad.ts +201 -0
  94. package/generated/digicert.ts +15 -0
  95. package/generated/discord.ts +17 -0
  96. package/generated/discordbot.ts +173 -0
  97. package/generated/docmosis.ts +8 -0
  98. package/generated/docusign.ts +351 -0
  99. package/generated/dropbox.ts +20 -0
  100. package/generated/dropbox_sign.ts +8 -0
  101. package/generated/dynamics365.ts +25 -0
  102. package/generated/echtpost.ts +10 -0
  103. package/generated/elevenlabs.ts +70 -0
  104. package/generated/emailoctopus.ts +16 -0
  105. package/generated/enigma.ts +11 -0
  106. package/generated/entelligence.ts +11 -0
  107. package/generated/epic_games.ts +8 -0
  108. package/generated/eventbrite.ts +12 -0
  109. package/generated/exa.ts +13 -0
  110. package/generated/excel.ts +34 -0
  111. package/generated/exist.ts +8 -0
  112. package/generated/facebook.ts +8 -0
  113. package/generated/factorial.ts +8 -0
  114. package/generated/figma.ts +59 -0
  115. package/generated/finage.ts +19 -0
  116. package/generated/firecrawl.ts +16 -0
  117. package/generated/fireflies.ts +21 -0
  118. package/generated/fitbit.ts +8 -0
  119. package/generated/flutterwave.ts +33 -0
  120. package/generated/fomo.ts +10 -0
  121. package/generated/formcarry.ts +10 -0
  122. package/generated/formsite.ts +14 -0
  123. package/generated/foursquare.ts +14 -0
  124. package/generated/freshbooks.ts +11 -0
  125. package/generated/freshdesk.ts +16 -0
  126. package/generated/front.ts +8 -0
  127. package/generated/github.ts +967 -0
  128. package/generated/gitlab.ts +82 -0
  129. package/generated/gmail.d.ts +86 -0
  130. package/generated/gmail.js +13 -0
  131. package/generated/gmail.ts +95 -0
  132. package/generated/go_to_webinar.ts +8 -0
  133. package/generated/gong.ts +63 -0
  134. package/generated/google_analytics.ts +13 -0
  135. package/generated/google_maps.ts +16 -0
  136. package/generated/googleads.ts +14 -0
  137. package/generated/googlebigquery.ts +10 -0
  138. package/generated/googlecalendar.ts +39 -0
  139. package/generated/googledocs.ts +41 -0
  140. package/generated/googledrive.ts +62 -0
  141. package/generated/googlemeet.ts +18 -0
  142. package/generated/googlephotos.ts +22 -0
  143. package/generated/googlesheets.ts +40 -0
  144. package/generated/googleslides.ts +8 -0
  145. package/generated/googlesuper.ts +230 -0
  146. package/generated/googletasks.ts +23 -0
  147. package/generated/gorgias.ts +41 -0
  148. package/generated/gumroad.ts +14 -0
  149. package/generated/guru.ts +8 -0
  150. package/generated/hackernews.ts +15 -0
  151. package/generated/hackerrank_work.ts +8 -0
  152. package/generated/harvest.ts +56 -0
  153. package/generated/helcim.ts +8 -0
  154. package/generated/heygen.ts +44 -0
  155. package/generated/highlevel.ts +8 -0
  156. package/generated/hubspot.ts +252 -0
  157. package/generated/humanloop.ts +13 -0
  158. package/generated/icims_talent_cloud.ts +8 -0
  159. package/generated/idea_scale.ts +8 -0
  160. package/generated/index.d.ts +136 -0
  161. package/generated/index.js +34 -0
  162. package/generated/index.ts +151 -0
  163. package/generated/insighto_ai.ts +19 -0
  164. package/generated/intercom.ts +52 -0
  165. package/generated/interzoid.ts +8 -0
  166. package/generated/jira.ts +59 -0
  167. package/generated/jotform.ts +15 -0
  168. package/generated/junglescout.ts +15 -0
  169. package/generated/keap.ts +8 -0
  170. package/generated/kibana.ts +58 -0
  171. package/generated/kit.ts +38 -0
  172. package/generated/klaviyo.ts +240 -0
  173. package/generated/klipfolio.ts +20 -0
  174. package/generated/kommo.ts +24 -0
  175. package/generated/lastpass.ts +8 -0
  176. package/generated/launch_darkly.ts +16 -0
  177. package/generated/leadfeeder.ts +13 -0
  178. package/generated/leadoku.ts +10 -0
  179. package/generated/lever.ts +8 -0
  180. package/generated/lever_sandbox.ts +8 -0
  181. package/generated/lexoffice.ts +8 -0
  182. package/generated/linear.ts +31 -0
  183. package/generated/linkedin.ts +13 -0
  184. package/generated/linkhut.ts +14 -0
  185. package/generated/linkup.ts +11 -0
  186. package/generated/listennotes.ts +35 -0
  187. package/generated/lmnt.ts +16 -0
  188. package/generated/lodgify.ts +10 -0
  189. package/generated/mailchimp.ts +285 -0
  190. package/generated/mailerlite.ts +8 -0
  191. package/generated/maintainx.ts +20 -0
  192. package/generated/make.ts +12 -0
  193. package/generated/mboum.ts +8 -0
  194. package/generated/mem0.ts +52 -0
  195. package/generated/metaads.ts +25 -0
  196. package/generated/metatextai.ts +8 -0
  197. package/generated/microsoft_clarity.ts +10 -0
  198. package/generated/microsoft_teams.ts +22 -0
  199. package/generated/microsoft_tenant.ts +8 -0
  200. package/generated/miro.ts +23 -0
  201. package/generated/mixpanel.ts +30 -0
  202. package/generated/mocean.ts +8 -0
  203. package/generated/monday.ts +30 -0
  204. package/generated/mopinion.ts +8 -0
  205. package/generated/more_trees.ts +10 -0
  206. package/generated/moxie.ts +8 -0
  207. package/generated/moz.ts +8 -0
  208. package/generated/mural.ts +14 -0
  209. package/generated/nasdaq.ts +15 -0
  210. package/generated/ncscale.ts +8 -0
  211. package/generated/neon.ts +78 -0
  212. package/generated/netsuite.ts +8 -0
  213. package/generated/nextdns.ts +11 -0
  214. package/generated/ngrok.ts +18 -0
  215. package/generated/notion.ts +40 -0
  216. package/generated/oncehub.ts +8 -0
  217. package/generated/one_drive.ts +49 -0
  218. package/generated/onepage.ts +11 -0
  219. package/generated/open_sea.ts +33 -0
  220. package/generated/outlook.ts +37 -0
  221. package/generated/pagerduty.ts +362 -0
  222. package/generated/pandadoc.ts +23 -0
  223. package/generated/peopledatalabs.ts +24 -0
  224. package/generated/perplexityai.ts +10 -0
  225. package/generated/piggy.ts +8 -0
  226. package/generated/pipedrive.ts +288 -0
  227. package/generated/placekey.ts +12 -0
  228. package/generated/posthog.ts +367 -0
  229. package/generated/precoro.ts +8 -0
  230. package/generated/printnode.ts +8 -0
  231. package/generated/process_street.ts +14 -0
  232. package/generated/productboard.ts +8 -0
  233. package/generated/qualaroo.ts +8 -0
  234. package/generated/quickbooks.ts +22 -0
  235. package/generated/rafflys.ts +8 -0
  236. package/generated/ragic.ts +10 -0
  237. package/generated/ramp.ts +17 -0
  238. package/generated/ravenseotools.ts +8 -0
  239. package/generated/recallai.ts +17 -0
  240. package/generated/reddit.ts +19 -0
  241. package/generated/resend.ts +27 -0
  242. package/generated/retellai.ts +19 -0
  243. package/generated/retently.ts +24 -0
  244. package/generated/ring_central.ts +8 -0
  245. package/generated/rippling.ts +8 -0
  246. package/generated/rocket_reach.ts +8 -0
  247. package/generated/rocketlane.ts +42 -0
  248. package/generated/rootly.ts +12 -0
  249. package/generated/rosette_text_analytics.ts +12 -0
  250. package/generated/sage.ts +8 -0
  251. package/generated/salesforce.ts +46 -0
  252. package/generated/scrape_do.ts +28 -0
  253. package/generated/scrapingant.ts +14 -0
  254. package/generated/screenshotone.ts +10 -0
  255. package/generated/seismic.ts +8 -0
  256. package/generated/semanticscholar.ts +23 -0
  257. package/generated/semrush.ts +45 -0
  258. package/generated/sendgrid.ts +384 -0
  259. package/generated/sentry.ts +185 -0
  260. package/generated/serpapi.ts +32 -0
  261. package/generated/servicem8.ts +37 -0
  262. package/generated/servicenow.ts +14 -0
  263. package/generated/share_point.ts +15 -0
  264. package/generated/shopify.ts +37 -0
  265. package/generated/shortcut.ts +131 -0
  266. package/generated/simplesat.ts +11 -0
  267. package/generated/slack.d.ts +16 -0
  268. package/generated/slack.js +11 -0
  269. package/generated/slack.ts +24 -0
  270. package/generated/slackbot.ts +205 -0
  271. package/generated/smartrecruiters.ts +8 -0
  272. package/generated/smugmug.ts +14 -0
  273. package/generated/snowflake.ts +15 -0
  274. package/generated/sourcegraph.ts +16 -0
  275. package/generated/square.ts +8 -0
  276. package/generated/stack_exchange.ts +17 -0
  277. package/generated/starton.ts +11 -0
  278. package/generated/storeganise.ts +12 -0
  279. package/generated/stripe.ts +50 -0
  280. package/generated/supabase.ts +86 -0
  281. package/generated/survey_monkey.ts +8 -0
  282. package/generated/tally.ts +25 -0
  283. package/generated/tapfiliate.ts +11 -0
  284. package/generated/tapform.ts +8 -0
  285. package/generated/tavily.ts +10 -0
  286. package/generated/terminus.ts +8 -0
  287. package/generated/text_to_pdf.ts +10 -0
  288. package/generated/textrazor.ts +22 -0
  289. package/generated/timecamp.ts +10 -0
  290. package/generated/timekit.ts +8 -0
  291. package/generated/timely.ts +11 -0
  292. package/generated/tinypng.ts +15 -0
  293. package/generated/tinyurl.ts +10 -0
  294. package/generated/tisane.ts +15 -0
  295. package/generated/todoist.ts +19 -0
  296. package/generated/toneden.ts +8 -0
  297. package/generated/tpscheck.ts +10 -0
  298. package/generated/trello.ts +360 -0
  299. package/generated/twitch.ts +8 -0
  300. package/generated/twitter.ts +82 -0
  301. package/generated/twitter_media.ts +10 -0
  302. package/generated/typefully.ts +14 -0
  303. package/generated/venly.ts +8 -0
  304. package/generated/vero.ts +8 -0
  305. package/generated/visme.ts +8 -0
  306. package/generated/waboxapp.ts +8 -0
  307. package/generated/wakatime.ts +8 -0
  308. package/generated/wave_accounting.ts +8 -0
  309. package/generated/weathermap.ts +10 -0
  310. package/generated/webex.ts +37 -0
  311. package/generated/webflow.ts +30 -0
  312. package/generated/whatsapp.ts +14 -0
  313. package/generated/wiz.ts +8 -0
  314. package/generated/workiom.ts +12 -0
  315. package/generated/wrike.ts +47 -0
  316. package/generated/xero.ts +13 -0
  317. package/generated/yandex.ts +13 -0
  318. package/generated/ynab.ts +8 -0
  319. package/generated/yousearch.ts +10 -0
  320. package/generated/youtube.ts +26 -0
  321. package/generated/zendesk.ts +23 -0
  322. package/generated/zenrows.ts +25 -0
  323. package/generated/zenserp.ts +20 -0
  324. package/generated/zoho.ts +33 -0
  325. package/generated/zoho_bigin.ts +21 -0
  326. package/generated/zoho_books.ts +8 -0
  327. package/generated/zoho_desk.ts +8 -0
  328. package/generated/zoho_inventory.ts +8 -0
  329. package/generated/zoho_invoice.ts +15 -0
  330. package/generated/zoho_mail.ts +8 -0
  331. package/generated/zoom.ts +181 -0
  332. package/generated/zoominfo.ts +26 -0
  333. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -36,7 +36,9 @@ var AuthSchemeTypes = {
36
36
  NO_AUTH: "NO_AUTH",
37
37
  BASIC_WITH_JWT: "BASIC_WITH_JWT",
38
38
  CALCOM_AUTH: "CALCOM_AUTH",
39
- SERVICE_ACCOUNT: "SERVICE_ACCOUNT"
39
+ SERVICE_ACCOUNT: "SERVICE_ACCOUNT",
40
+ SAML: "SAML",
41
+ DCR_OAUTH: "DCR_OAUTH"
40
42
  };
41
43
  var AuthConfigCreationToolAccessConfigSchema = z.object({
42
44
  toolsForConnectedAccountCreation: z.array(z.string()).optional()
@@ -56,7 +58,9 @@ var AuthSchemeEnum = z.enum([
56
58
  "NO_AUTH",
57
59
  "BASIC_WITH_JWT",
58
60
  "CALCOM_AUTH",
59
- "SERVICE_ACCOUNT"
61
+ "SERVICE_ACCOUNT",
62
+ "SAML",
63
+ "DCR_OAUTH"
60
64
  ]);
61
65
  var CreateCustomAuthConfigParamsSchema = z.object({
62
66
  type: z.literal("use_custom_auth"),
@@ -203,7 +207,14 @@ var BaseSchemeRaw = z2.object({
203
207
  // for generic api key
204
208
  generic_api_key: z2.string().optional(),
205
209
  // for bearer token
206
- bearer_token: z2.string().optional()
210
+ bearer_token: z2.string().optional(),
211
+ // for basic auth encoded
212
+ basic_encoded: z2.string().optional(),
213
+ // for dcr oauth
214
+ long_redirect_url: z2.boolean().optional(),
215
+ state_prefix: z2.string().optional(),
216
+ registration_access_token: z2.string().optional(),
217
+ registration_client_uri: z2.string().optional()
207
218
  }).catchall(z2.unknown());
208
219
  var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
209
220
  status: z2.literal(ConnectionStatuses.INITIALIZING)
@@ -479,6 +490,98 @@ var BasicWithJwtConnectionDataSchema = z2.discriminatedUnion("status", [
479
490
  var CustomBasicWithJwtConnectionDataSchema = BasicWithJwtInitiatingSchema.omit({
480
491
  status: true
481
492
  });
493
+ var ServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
494
+ status: z2.literal(ConnectionStatuses.INITIALIZING)
495
+ }).catchall(z2.unknown());
496
+ var ServiceAccountConnectionDataSchema = z2.discriminatedUnion("status", [
497
+ ServiceAccountInitiatingSchema,
498
+ ServiceAccountInitiatingSchema.extend({
499
+ status: z2.literal(ConnectionStatuses.INITIATED)
500
+ }).catchall(z2.unknown()),
501
+ ServiceAccountInitiatingSchema.extend({
502
+ status: z2.literal(ConnectionStatuses.ACTIVE),
503
+ application_id: z2.string(),
504
+ installation_id: z2.string(),
505
+ private_key: z2.string()
506
+ }).catchall(z2.unknown()),
507
+ ServiceAccountInitiatingSchema.extend({
508
+ status: z2.literal(ConnectionStatuses.INACTIVE),
509
+ application_id: z2.string(),
510
+ installation_id: z2.string(),
511
+ private_key: z2.string()
512
+ }).catchall(z2.unknown())
513
+ ]);
514
+ var CustomServiceAccountConnectionDataSchema = z2.object({
515
+ application_id: z2.string(),
516
+ installation_id: z2.string(),
517
+ private_key: z2.string()
518
+ }).merge(BaseSchemeRaw).catchall(z2.unknown());
519
+ var SamlInitiatingSchema = BaseSchemeRaw.extend({
520
+ status: z2.literal(ConnectionStatuses.INITIALIZING)
521
+ }).catchall(z2.unknown());
522
+ var SamlConnectionDataSchema = z2.discriminatedUnion("status", [
523
+ SamlInitiatingSchema,
524
+ SamlInitiatingSchema.extend({
525
+ status: z2.literal(ConnectionStatuses.INITIATED)
526
+ }).catchall(z2.unknown()),
527
+ SamlInitiatingSchema.extend({
528
+ status: z2.literal(ConnectionStatuses.ACTIVE)
529
+ }).catchall(z2.unknown()),
530
+ SamlInitiatingSchema.extend({
531
+ status: z2.literal(ConnectionStatuses.INACTIVE)
532
+ }).catchall(z2.unknown()),
533
+ SamlInitiatingSchema.extend({
534
+ status: z2.literal(ConnectionStatuses.FAILED),
535
+ error: z2.string().optional(),
536
+ error_description: z2.string().optional()
537
+ }).catchall(z2.unknown()),
538
+ SamlInitiatingSchema.extend({
539
+ status: z2.literal(ConnectionStatuses.EXPIRED),
540
+ expired_at: z2.string().optional()
541
+ }).catchall(z2.unknown())
542
+ ]);
543
+ var CustomSamlConnectionDataSchema = BaseSchemeRaw.catchall(z2.unknown());
544
+ var DcrOauthInitiatingSchema = BaseSchemeRaw.extend({
545
+ status: z2.literal(ConnectionStatuses.INITIALIZING)
546
+ }).catchall(z2.unknown());
547
+ var DcrOauthConnectionDataSchema = z2.discriminatedUnion("status", [
548
+ DcrOauthInitiatingSchema,
549
+ DcrOauthInitiatingSchema.extend({
550
+ status: z2.literal(ConnectionStatuses.INITIATED),
551
+ client_id: z2.string(),
552
+ client_secret: z2.string(),
553
+ redirectUrl: z2.string()
554
+ }).catchall(z2.unknown()),
555
+ DcrOauthInitiatingSchema.extend({
556
+ status: z2.literal(ConnectionStatuses.ACTIVE),
557
+ access_token: z2.string(),
558
+ client_id: z2.string(),
559
+ token_type: z2.string().optional(),
560
+ refresh_token: z2.string().nullish(),
561
+ expires_in: z2.union([z2.string(), z2.number(), z2.null()]).optional(),
562
+ scope: z2.union([z2.string(), z2.array(z2.string()), z2.null()]).optional(),
563
+ id_token: z2.string().optional(),
564
+ client_secret: z2.string().optional()
565
+ }).catchall(z2.unknown()),
566
+ DcrOauthInitiatingSchema.extend({
567
+ status: z2.literal(ConnectionStatuses.INACTIVE),
568
+ access_token: z2.string(),
569
+ client_id: z2.string()
570
+ }).catchall(z2.unknown()),
571
+ DcrOauthInitiatingSchema.extend({
572
+ status: z2.literal(ConnectionStatuses.FAILED),
573
+ error: z2.string().optional(),
574
+ error_description: z2.string().optional()
575
+ }).catchall(z2.unknown()),
576
+ DcrOauthInitiatingSchema.extend({
577
+ status: z2.literal(ConnectionStatuses.EXPIRED),
578
+ expired_at: z2.string().optional()
579
+ }).catchall(z2.unknown())
580
+ ]);
581
+ var CustomDcrOauthConnectionDataSchema = z2.object({
582
+ access_token: z2.string(),
583
+ client_id: z2.string()
584
+ }).merge(BaseSchemeRaw).catchall(z2.unknown());
482
585
  var ConnectionDataSchema = z2.discriminatedUnion("authScheme", [
483
586
  z2.object({
484
587
  authScheme: z2.literal(AuthSchemeTypes.OAUTH1),
@@ -556,6 +659,27 @@ var ConnectionDataSchema = z2.discriminatedUnion("authScheme", [
556
659
  * the main connection data discriminated by auth scheme
557
660
  */
558
661
  val: BasicWithJwtConnectionDataSchema
662
+ }),
663
+ z2.object({
664
+ authScheme: z2.literal(AuthSchemeTypes.SERVICE_ACCOUNT),
665
+ /**
666
+ * the main connection data discriminated by auth scheme
667
+ */
668
+ val: ServiceAccountConnectionDataSchema
669
+ }),
670
+ z2.object({
671
+ authScheme: z2.literal(AuthSchemeTypes.SAML),
672
+ /**
673
+ * the main connection data discriminated by auth scheme
674
+ */
675
+ val: SamlConnectionDataSchema
676
+ }),
677
+ z2.object({
678
+ authScheme: z2.literal(AuthSchemeTypes.DCR_OAUTH),
679
+ /**
680
+ * the main connection data discriminated by auth scheme
681
+ */
682
+ val: DcrOauthConnectionDataSchema
559
683
  })
560
684
  ]);
561
685
  var CustomConnectionDataSchema = z2.discriminatedUnion("authScheme", [
@@ -564,6 +688,11 @@ var CustomConnectionDataSchema = z2.discriminatedUnion("authScheme", [
564
688
  toolkitSlug: z2.string(),
565
689
  val: CustomOauth2ConnectionDataSchema
566
690
  }),
691
+ z2.object({
692
+ authScheme: z2.literal(AuthSchemeTypes.DCR_OAUTH),
693
+ toolkitSlug: z2.string(),
694
+ val: CustomDcrOauthConnectionDataSchema
695
+ }),
567
696
  z2.object({
568
697
  authScheme: z2.literal(AuthSchemeTypes.API_KEY),
569
698
  toolkitSlug: z2.string(),
@@ -593,6 +722,11 @@ var CustomConnectionDataSchema = z2.discriminatedUnion("authScheme", [
593
722
  authScheme: z2.literal(AuthSchemeTypes.NO_AUTH),
594
723
  toolkitSlug: z2.string(),
595
724
  val: CustomNoAuthConnectionDataSchema
725
+ }),
726
+ z2.object({
727
+ authScheme: z2.literal(AuthSchemeTypes.SERVICE_ACCOUNT),
728
+ toolkitSlug: z2.string(),
729
+ val: CustomServiceAccountConnectionDataSchema
596
730
  })
597
731
  ]);
598
732
 
@@ -743,7 +877,12 @@ var ToolProxyParamsSchema = z3.object({
743
877
  })
744
878
  ).optional(),
745
879
  connectedAccountId: z3.string().optional(),
746
- customConnectionData: CustomConnectionDataSchema.optional()
880
+ /**
881
+ * @deprecated
882
+ */
883
+ customConnectionData: CustomConnectionDataSchema.describe(
884
+ "DEPRECATED: This field is deprecated and will be removed in the future."
885
+ ).optional()
747
886
  });
748
887
 
749
888
  // src/models/CustomTools.ts
@@ -1031,12 +1170,12 @@ ${originalStackBody}`;
1031
1170
  }
1032
1171
  /**
1033
1172
  * Utility function to handle errors in a consistent way
1034
- * This properly displays the error and exits the process if needed
1173
+ * This properly displays the error without throwing
1035
1174
  * @param error The error to handle
1036
1175
  * @param options Options for error handling
1037
1176
  */
1038
1177
  static handle(error, options = {}) {
1039
- const { includeStack = false, exitProcess = false, exitCode = 1 } = options;
1178
+ const { includeStack = false, exitProcess = false } = options;
1040
1179
  if (error instanceof _ComposioError) {
1041
1180
  error.prettyPrint(includeStack);
1042
1181
  } else if (error instanceof ZodError) {
@@ -1046,8 +1185,34 @@ ${originalStackBody}`;
1046
1185
  } else {
1047
1186
  this.handleUnknownError(error);
1048
1187
  }
1049
- if (exitProcess && typeof process !== "undefined") {
1050
- process.exit(exitCode);
1188
+ if (exitProcess) {
1189
+ this.throwError(error);
1190
+ }
1191
+ }
1192
+ /**
1193
+ * Utility function to handle errors and then throw them
1194
+ * This properly displays the error and then throws it, allowing callers to catch it.
1195
+ * Use this for fatal errors that should stop execution.
1196
+ * @param error The error to handle and throw
1197
+ * @param includeStack Whether to include the stack trace in the output
1198
+ * @throws ComposioError - Always throws after displaying the error
1199
+ */
1200
+ static handleAndThrow(error, includeStack = false) {
1201
+ this.handle(error, { includeStack });
1202
+ this.throwError(error);
1203
+ }
1204
+ /**
1205
+ * Helper method to throw an error as a ComposioError
1206
+ * @param error The error to throw
1207
+ * @private
1208
+ */
1209
+ static throwError(error) {
1210
+ if (error instanceof _ComposioError) {
1211
+ throw error;
1212
+ } else if (error instanceof Error) {
1213
+ throw new _ComposioError(error.message, { cause: error });
1214
+ } else {
1215
+ throw new _ComposioError(String(error));
1051
1216
  }
1052
1217
  }
1053
1218
  /**
@@ -2124,6 +2289,14 @@ var CustomTools = class {
2124
2289
  parameters,
2125
2290
  body: data.body,
2126
2291
  connected_account_id: connectedAccountId,
2292
+ /**
2293
+ * @deprecated
2294
+ * @description
2295
+ * This parameter is deprecated and will be removed in the future.
2296
+ * Please use custom_auth_params instead.
2297
+ *
2298
+ */
2299
+ // @ts-ignore
2127
2300
  custom_connection_data: data.customConnectionData
2128
2301
  });
2129
2302
  return {
@@ -2584,28 +2757,20 @@ var Tools = class {
2584
2757
  provider;
2585
2758
  autoUploadDownloadFiles;
2586
2759
  toolkitVersions;
2587
- constructor(client, provider, config) {
2760
+ constructor(client, config) {
2588
2761
  if (!client) {
2589
2762
  throw new Error("ComposioClient is required");
2590
2763
  }
2591
- if (!provider) {
2764
+ if (!config?.provider) {
2592
2765
  throw new ComposioProviderNotDefinedError("Provider not passed into Tools instance");
2593
2766
  }
2594
2767
  this.client = client;
2595
2768
  this.customTools = new CustomTools(client);
2596
- this.provider = provider;
2769
+ this.provider = config.provider;
2597
2770
  this.autoUploadDownloadFiles = config?.autoUploadDownloadFiles ?? true;
2598
2771
  this.toolkitVersions = config?.toolkitVersions ?? "latest";
2599
2772
  this.execute = this.execute.bind(this);
2600
- const providerExecuteToolFn = this.provider._isAgentic ? this.execute : (slug, body, modifiers) => this.execute(
2601
- slug,
2602
- {
2603
- ...body,
2604
- dangerouslySkipVersionCheck: body.dangerouslySkipVersionCheck ?? true
2605
- },
2606
- modifiers
2607
- );
2608
- this.provider._setExecuteToolFn(providerExecuteToolFn);
2773
+ this.provider._setExecuteToolFn(this.createExecuteFnForProviders());
2609
2774
  this.getRawComposioToolBySlug = this.getRawComposioToolBySlug.bind(this);
2610
2775
  this.getRawComposioTools = this.getRawComposioTools.bind(this);
2611
2776
  telemetry.instrument(this, "Tools");
@@ -2951,19 +3116,55 @@ var Tools = class {
2951
3116
  */
2952
3117
  async get(userId, arg2, arg3) {
2953
3118
  const options = arg3;
2954
- const executeToolFn = this.createExecuteToolFn(userId, options);
2955
3119
  if (typeof arg2 === "string") {
2956
3120
  const tool = await this.getRawComposioToolBySlug(arg2, {
2957
3121
  modifySchema: options?.modifySchema
2958
3122
  });
2959
- return this.provider.wrapTools([tool], executeToolFn);
3123
+ return this.wrapToolsForProvider(
3124
+ userId,
3125
+ [tool],
3126
+ options
3127
+ );
2960
3128
  } else {
2961
3129
  const tools = await this.getRawComposioTools(arg2, {
2962
3130
  modifySchema: options?.modifySchema
2963
3131
  });
2964
- return this.provider.wrapTools(tools, executeToolFn);
3132
+ return this.wrapToolsForProvider(
3133
+ userId,
3134
+ tools,
3135
+ options
3136
+ );
2965
3137
  }
2966
3138
  }
3139
+ /**
3140
+ * @internal
3141
+ * Creates a global execute tool function.
3142
+ * This function is used by providers to execute tools.
3143
+ * It skips the version check for provider controlled execution.
3144
+ * @returns {GlobalExecuteToolFn} The global execute tool function
3145
+ */
3146
+ createExecuteFnForProviders() {
3147
+ return async (slug, body, modifiers) => {
3148
+ return await this.execute(
3149
+ slug,
3150
+ { ...body, dangerouslySkipVersionCheck: body.dangerouslySkipVersionCheck ?? true },
3151
+ modifiers
3152
+ );
3153
+ };
3154
+ }
3155
+ /**
3156
+ * @inte
3157
+ * Utility to wrap a given set of tools in the format expected by the provider
3158
+ *
3159
+ * @param userId - The user id to get the tools for
3160
+ * @param tools - The tools to wrap
3161
+ * @param modifiers - The modifiers to be applied to the tools
3162
+ * @returns The wrapped tools
3163
+ */
3164
+ wrapToolsForProvider(userId, tools, modifiers) {
3165
+ const executeToolFn = this.createExecuteToolFn(userId, modifiers);
3166
+ return this.provider.wrapTools(tools, executeToolFn);
3167
+ }
2967
3168
  /**
2968
3169
  * @internal
2969
3170
  * @description
@@ -2981,7 +3182,7 @@ var Tools = class {
2981
3182
  {
2982
3183
  userId,
2983
3184
  arguments: input,
2984
- // dangerously skip version check for agentic and non agentic tool execution via providers
3185
+ // dangerously skip version check for agentic tool execution via providers
2985
3186
  // this can be safe because most agentic flows users fetch latest version and then execute the tool
2986
3187
  dangerouslySkipVersionCheck: true
2987
3188
  },
@@ -3007,6 +3208,13 @@ var Tools = class {
3007
3208
  allow_tracing: body.allowTracing,
3008
3209
  connected_account_id: body.connectedAccountId,
3009
3210
  custom_auth_params: body.customAuthParams,
3211
+ /**
3212
+ * @deprecated: customConnectionData
3213
+ * @description
3214
+ * This parameter is deprecated and will be removed in the future.
3215
+ * Please use custom_connection_data instead.
3216
+ *
3217
+ */
3010
3218
  custom_connection_data: body.customConnectionData,
3011
3219
  arguments: body.arguments,
3012
3220
  user_id: body.userId,
@@ -3212,6 +3420,14 @@ var Tools = class {
3212
3420
  body: toolProxyParams.data.body,
3213
3421
  connected_account_id: toolProxyParams.data.connectedAccountId,
3214
3422
  parameters,
3423
+ /**
3424
+ * @deprecated: customConnectionData
3425
+ * @description
3426
+ * This parameter is deprecated and will be removed in the future.
3427
+ * Please use custom_auth_params instead.
3428
+ *
3429
+ */
3430
+ // @ts-ignore
3215
3431
  custom_connection_data: toolProxyParams.data.customConnectionData
3216
3432
  });
3217
3433
  }
@@ -6637,9 +6853,7 @@ function getSDKConfig(baseUrl, apiKey) {
6637
6853
  const baseURLParsed = baseUrl || getEnvVariable("COMPOSIO_BASE_URL") || baseURLFromUserConfig || DEFAULT_BASE_URL;
6638
6854
  const apiKeyParsed = apiKey || getEnvVariable("COMPOSIO_API_KEY") || apiKeyFromUserConfig || "";
6639
6855
  if (!apiKeyParsed) {
6640
- ComposioError.handle(new ComposioNoAPIKeyError(), {
6641
- exitProcess: true
6642
- });
6856
+ ComposioError.handleAndThrow(new ComposioNoAPIKeyError());
6643
6857
  }
6644
6858
  logger_default.debug("Environment", `API Key: ${apiKeyParsed}`);
6645
6859
  logger_default.debug("Environment", `Base URL: ${baseURLParsed}`);
@@ -6715,7 +6929,7 @@ var BaseProvider = class {
6715
6929
  /**
6716
6930
  * @public
6717
6931
  * Global function to execute a tool.
6718
- * This function is used by providerds to implement helper functions to execute tools.
6932
+ * This function is used by providers to implement helper functions to execute tools.
6719
6933
  * This is a 1:1 mapping of the `execute` method in the `Tools` class.
6720
6934
  * @param {string} toolSlug - The slug of the tool to execute.
6721
6935
  * @param {ToolExecuteParams} body - The body of the tool execution.
@@ -7191,7 +7405,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
7191
7405
  };
7192
7406
 
7193
7407
  // package.json
7194
- var version = "0.2.5";
7408
+ var version = "0.2.7-alpha.0";
7195
7409
 
7196
7410
  // src/models/Files.ts
7197
7411
  var Files = class {
@@ -7287,77 +7501,337 @@ var getDefaultHeaders = (headers, provider) => {
7287
7501
 
7288
7502
  // src/types/toolRouter.types.ts
7289
7503
  import z10 from "zod/v3";
7290
- var ToolRouterToolkitConfigSchema = z10.object({
7291
- toolkit: z10.string(),
7292
- authConfigId: z10.string().optional()
7293
- });
7294
- var ToolRouterConfigSchema = z10.object({
7295
- toolkits: z10.array(z10.union([z10.string(), ToolRouterToolkitConfigSchema])).optional(),
7296
- manuallyManageConnections: z10.boolean().optional()
7504
+ var MCPServerTypeSchema = z10.enum(["HTTP", "SSE"]);
7505
+ var ToolRouterConfigManageConnectionsSchema = z10.object({
7506
+ enabled: z10.boolean().optional().default(true).describe(
7507
+ "Whether to use tools to manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually"
7508
+ ),
7509
+ callbackUri: z10.string().optional().describe("The callback uri to use in the tool router session"),
7510
+ inferScopesFromTools: z10.boolean().optional().default(false).describe(
7511
+ "Whether to infer scopes from tools in the tool router session. Defaults to false, if set to true, tool router will infer scopes from allowed tools"
7512
+ )
7513
+ }).strict();
7514
+ var ToolRouterToolkitsParamSchema = z10.array(z10.string()).describe("List of toolkits to enable in the tool router session");
7515
+ var ToolRouterToolkitsDisabledConfigSchema = z10.object({
7516
+ disabled: ToolRouterToolkitsParamSchema.describe(
7517
+ "List of toolkits to disable in the tool router session"
7518
+ )
7519
+ }).strict();
7520
+ var ToolRouterToolkitsEnabledConfigSchema = z10.object({
7521
+ enabled: ToolRouterToolkitsParamSchema.describe(
7522
+ "List of toolkits to enable in the tool router session"
7523
+ )
7524
+ }).strict();
7525
+ var ToolRouterManageConnectionsConfigSchema = z10.object({
7526
+ enabled: z10.boolean().optional().describe(
7527
+ "Whether to use tools to manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually"
7528
+ ).default(true),
7529
+ callbackUrl: z10.string().optional().describe("The callback url to use in the tool router session")
7297
7530
  });
7298
- var ToolRouterSessionSchema = z10.object({
7299
- sessionId: z10.string(),
7300
- url: z10.string()
7531
+ var ToolRouterTagsParamSchema = z10.array(z10.string()).describe("The tags to use in the tool router session");
7532
+ var ToolRouterEnabledTagsConfigSchema = z10.object({
7533
+ enabled: ToolRouterTagsParamSchema.describe("The tags to enable in the tool router session")
7534
+ }).strict();
7535
+ var ToolRouterDisabledTagsConfigSchema = z10.object({
7536
+ disabled: ToolRouterTagsParamSchema.describe("The tags to disable in the tool router session")
7537
+ }).strict();
7538
+ var ToolRouterConfigTagsSchema = z10.union([
7539
+ ToolRouterTagsParamSchema,
7540
+ ToolRouterEnabledTagsConfigSchema,
7541
+ ToolRouterDisabledTagsConfigSchema
7542
+ ]).describe("The tags to use in the tool router session");
7543
+ var ToolRouterToolsParamSchema = z10.array(z10.string()).describe("The tools to use in the tool router session");
7544
+ var ToolRouterConfigToolsSchema = z10.object({
7545
+ overrides: z10.record(
7546
+ z10.string(),
7547
+ z10.union([
7548
+ ToolRouterToolsParamSchema,
7549
+ z10.object({
7550
+ enabled: ToolRouterToolsParamSchema.describe(
7551
+ "The tools to enable in the tool router session"
7552
+ )
7553
+ }).strict(),
7554
+ z10.object({
7555
+ disabled: ToolRouterToolsParamSchema.describe(
7556
+ "The tools to disable in the tool router session"
7557
+ )
7558
+ }).strict()
7559
+ ])
7560
+ ).describe("The tools to override in the tool router session").optional(),
7561
+ tags: ToolRouterConfigTagsSchema.optional().describe("The tags to filter the tools by")
7562
+ }).strict();
7563
+ var ToolRouterCreateSessionConfigSchema = z10.object({
7564
+ tools: ToolRouterConfigToolsSchema.optional().describe(
7565
+ "The tools to use in the tool router session"
7566
+ ),
7567
+ toolkits: z10.union([
7568
+ ToolRouterToolkitsParamSchema,
7569
+ ToolRouterToolkitsDisabledConfigSchema,
7570
+ ToolRouterToolkitsEnabledConfigSchema
7571
+ ]).optional().describe("The toolkits to use in the tool router session"),
7572
+ authConfigs: z10.record(z10.string(), z10.string()).describe(
7573
+ "The auth configs to use in the tool router session. The key is the toolkit slug, the value is the auth config id."
7574
+ ).default({}),
7575
+ connectedAccounts: z10.record(z10.string(), z10.string()).describe(
7576
+ "The connected accounts to use in the tool router session. The key is the toolkit slug, the value is the connected account id."
7577
+ ).default({}),
7578
+ manageConnections: z10.union([z10.boolean(), ToolRouterConfigManageConnectionsSchema]).optional().default(true).describe(
7579
+ "The config for the manage connections in the tool router session. Defaults to true, if set to false, you need to manage connections manually. If set to an object, you can configure the manage connections settings."
7580
+ ),
7581
+ execution: z10.object({
7582
+ proxyExecutionEnabled: z10.boolean().optional().describe("Whether to enable proxy execution in the tool router session"),
7583
+ timeoutSeconds: z10.number().optional().describe("The timeout in seconds for the tool router session")
7584
+ }).optional().describe("The execution config for the tool router session")
7585
+ }).partial().describe("The config for the tool router session");
7586
+ var ToolkitConnectionStateSchema = z10.object({
7587
+ slug: z10.string().describe("The slug of a toolkit"),
7588
+ name: z10.string().describe("The name of a toolkit"),
7589
+ logo: z10.string().optional().describe("The logo of a toolkit"),
7590
+ isNoAuth: z10.boolean().default(false).describe("Whether the toolkit is no auth or not"),
7591
+ connection: z10.object({
7592
+ isActive: z10.boolean().describe("Whether the connection is active or not"),
7593
+ authConfig: z10.object({
7594
+ id: z10.string().describe("The id of the auth config"),
7595
+ mode: z10.string().describe("The auth scheme used by the auth config"),
7596
+ isComposioManaged: z10.boolean().describe("Whether the auth config is managed by Composio")
7597
+ }).nullish().describe("The auth config of a toolkit"),
7598
+ connectedAccount: z10.object({
7599
+ id: z10.string().describe("The id of the connected account"),
7600
+ status: z10.string().describe("The status of the connected account")
7601
+ }).optional().describe("The connected account of a toolkit")
7602
+ })
7603
+ }).describe("The connection state of a toolkit");
7604
+ var ToolkitConnectionsDetailsSchema = z10.object({
7605
+ items: z10.array(ToolkitConnectionStateSchema),
7606
+ nextCursor: z10.string().optional(),
7607
+ totalPages: z10.number()
7301
7608
  });
7302
7609
 
7303
- // src/models/ToolRouter.experimental.ts
7610
+ // src/lib/toolRouterParams.ts
7611
+ var transformToolRouterToolsParams = (params) => {
7612
+ if (!params) {
7613
+ return void 0;
7614
+ }
7615
+ const { overrides, tags } = params;
7616
+ const toolOverrides = overrides ? Object.keys(overrides).reduce(
7617
+ (acc, key) => {
7618
+ const override = overrides[key];
7619
+ if (Array.isArray(override)) {
7620
+ acc[key] = { enabled: override };
7621
+ } else if (override !== void 0) {
7622
+ if ("enabled" in override && override.enabled) {
7623
+ acc[key] = { enabled: override.enabled };
7624
+ } else if ("disabled" in override && override.disabled) {
7625
+ acc[key] = { disabled: override.disabled };
7626
+ }
7627
+ }
7628
+ return acc;
7629
+ },
7630
+ {}
7631
+ ) : void 0;
7632
+ const tagFilters = tags ? (() => {
7633
+ if (Array.isArray(tags)) {
7634
+ return { include: tags };
7635
+ } else if ("enabled" in tags && tags.enabled) {
7636
+ return { include: tags.enabled };
7637
+ } else if ("disabled" in tags && tags.disabled) {
7638
+ return { exclude: tags.disabled };
7639
+ }
7640
+ return void 0;
7641
+ })() : void 0;
7642
+ return {
7643
+ overrides: toolOverrides,
7644
+ filters: tagFilters ? {
7645
+ tags: tagFilters
7646
+ } : void 0
7647
+ };
7648
+ };
7649
+
7650
+ // src/models/ToolRouter.ts
7304
7651
  var ToolRouter = class {
7305
- constructor(client) {
7306
- this.client = client;
7652
+ constructor(client, config) {
7307
7653
  this.client = client;
7654
+ this.config = config;
7308
7655
  telemetry.instrument(this, "ToolRouter");
7309
7656
  }
7310
7657
  /**
7311
- * Creates a new Session for the tool router
7658
+ * Creates a function that authorizes a toolkit for a user.
7659
+ * @param sessionId {string} The session id to create the authorize function for
7660
+ * @returns {ToolRouterAuthorizeFn} The authorize function
7661
+ *
7662
+ */
7663
+ createAuthorizeFn = (sessionId) => {
7664
+ const authorizeFn = async (toolkit, options) => {
7665
+ const response = await this.client.toolRouter.session.link(sessionId, {
7666
+ ...options ?? {},
7667
+ toolkit
7668
+ });
7669
+ return createConnectionRequest(
7670
+ this.client,
7671
+ response.connected_account_id,
7672
+ ConnectedAccountStatuses.INITIATED,
7673
+ response.redirect_url
7674
+ );
7675
+ };
7676
+ return authorizeFn;
7677
+ };
7678
+ /**
7679
+ *
7680
+ * @param sessionId {string} The session id to create the connections function for
7681
+ * @returns {ToolRouterConectionsFn} The connections function
7682
+ *
7683
+ * @example
7684
+ * ```typescript
7685
+ * import { Composio } from '@composio/core';
7686
+ *
7687
+ * const composio = new Composio();
7688
+ * const sessionId = 'session_123';
7689
+ *
7690
+ * const session = await composio.create(sessionId);
7691
+ * console.log(connections);
7692
+ * ```
7693
+ */
7694
+ createToolkitsFn = (sessionId) => {
7695
+ const connectionsFn = async (options) => {
7696
+ const result = await this.client.toolRouter.session.toolkits(sessionId, {
7697
+ cursor: options?.nextCursor,
7698
+ limit: options?.limit
7699
+ });
7700
+ const toolkitConnectedStates = result.items.map((item) => {
7701
+ const connectedState = transform(item).with(ToolkitConnectionStateSchema).using((item2) => ({
7702
+ slug: item2.slug,
7703
+ name: item2.name,
7704
+ logo: item2.meta.logo,
7705
+ isNoAuth: false,
7706
+ connection: {
7707
+ isActive: item2.connected_account?.status === "ACTIVE",
7708
+ authConfig: item2.connected_account && {
7709
+ id: item2.connected_account?.auth_config.id,
7710
+ mode: item2.connected_account?.auth_config.auth_scheme,
7711
+ isComposioManaged: item2.connected_account?.auth_config.is_composio_managed
7712
+ },
7713
+ connectedAccount: item2.connected_account ? {
7714
+ id: item2.connected_account.id,
7715
+ status: item2.connected_account.status
7716
+ } : void 0
7717
+ }
7718
+ }));
7719
+ return connectedState;
7720
+ });
7721
+ return {
7722
+ items: toolkitConnectedStates,
7723
+ nextCursor: result.next_cursor,
7724
+ totalPages: result.total_pages
7725
+ };
7726
+ };
7727
+ return connectionsFn;
7728
+ };
7729
+ /**
7730
+ * @internal
7731
+ * Creates a function that wraps the tools based on the provider.
7732
+ * The returned tools will be of the type the frameworks expects.
7733
+ *
7734
+ * @param userId - The user id to get the tools for
7735
+ * @param tools - The tools to wrap
7736
+ * @returns A function that wraps the tools based on the provider.
7737
+ */
7738
+ createToolsFn = (userId, toolSlugs) => {
7739
+ return async (modifiers) => {
7740
+ const ToolsModel = new Tools(this.client, this.config);
7741
+ const tools = await ToolsModel.get(
7742
+ userId,
7743
+ {
7744
+ tools: toolSlugs
7745
+ },
7746
+ modifiers
7747
+ );
7748
+ return tools;
7749
+ };
7750
+ };
7751
+ /**
7752
+ * Creates a new tool router session for a user.
7312
7753
  *
7313
7754
  * @param userId {string} The user id to create the session for
7314
- * @param routerConfig {ToolRouterConfig} The router config to use
7315
- * @returns {Promise<ToolRouterSession>} The tool router session
7755
+ * @param config {ToolRouterConfig} The config for the tool router session
7756
+ * @returns {Promise<ToolRouterSession<TToolCollection, TTool, TProvider>>} The tool router session
7316
7757
  *
7317
7758
  * @example
7318
7759
  * ```typescript
7319
- * import { Composio } form "@composio/core"
7760
+ * import { Composio } from '@composio/core';
7320
7761
  *
7321
- * const composio = new Composio()
7322
- * const userId = "xxx-ooo-xxxx"
7762
+ * const composio = new Composio();
7763
+ * const userId = 'user_123';
7323
7764
  *
7324
- * const mcpSession = await composio.experimental.toolRouter.createSession(userId, {
7325
- * toolkits: ["github", "hackernews", "slack"]
7326
- * })
7765
+ * const session = await composio.create(userId, {
7766
+ * manageConnections: true,
7767
+ * });
7327
7768
  *
7328
- * // with auth configs
7329
- * const mcpSession = await composio.experimental.toolRouter.createSession(userId, {
7330
- * toolkits: [{ toolkit: "github", authConfingId: "ac_123455344"}]
7769
+ * console.log(session.sessionId);
7770
+ * console.log(session.url);
7771
+ * console.log(session.tools());
7772
+ * console.log(session.toolkits());
7331
7773
  * ```
7332
7774
  */
7333
- async createSession(userId, routerConfig) {
7334
- const config = ToolRouterConfigSchema.safeParse(routerConfig ?? {});
7335
- if (config.error) {
7336
- throw new ValidationError("Failed to parse tool router config", {
7337
- cause: config.error
7338
- });
7339
- }
7340
- const toolkitConfig = config.data.toolkits?.map((config2) => {
7341
- if (typeof config2 === "string") {
7342
- return { toolkit: config2 };
7343
- } else {
7344
- return {
7345
- toolkit: config2.toolkit,
7346
- auth_config_id: config2.authConfigId
7347
- };
7348
- }
7349
- });
7350
- const session = await this.client.toolRouter.createSession({
7775
+ async create(userId, config) {
7776
+ const routerConfig = ToolRouterCreateSessionConfigSchema.parse(config ?? {});
7777
+ const manageConnectedAccounts = typeof routerConfig.manageConnections === "boolean" ? routerConfig.manageConnections : routerConfig.manageConnections?.enabled ?? true;
7778
+ const toolkits = Array.isArray(routerConfig.toolkits) ? { enabled: routerConfig.toolkits } : routerConfig.toolkits;
7779
+ const tools = transformToolRouterToolsParams(routerConfig.tools);
7780
+ const inferScopesFromTools = typeof routerConfig.manageConnections === "object" ? routerConfig.manageConnections.inferScopesFromTools : false;
7781
+ const payload = {
7351
7782
  user_id: userId,
7352
- config: {
7353
- toolkits: toolkitConfig,
7354
- manually_manage_connections: config.data.manuallyManageConnections
7355
- }
7356
- });
7357
- return transform(session).with(ToolRouterSessionSchema).using((raw) => ({
7358
- sessionId: raw.session_id,
7359
- url: raw.chat_session_mcp_url
7360
- }));
7783
+ toolkits,
7784
+ auth_configs: routerConfig.authConfigs,
7785
+ connected_accounts: routerConfig.connectedAccounts,
7786
+ tools,
7787
+ connections: {
7788
+ infer_scopes_from_tools: inferScopesFromTools,
7789
+ auto_manage_connections: manageConnectedAccounts,
7790
+ callback_uri: typeof routerConfig.manageConnections === "object" ? routerConfig.manageConnections.callbackUri : void 0
7791
+ },
7792
+ execution: routerConfig.execution ? {
7793
+ proxy_execution_enabled: routerConfig.execution?.proxyExecutionEnabled,
7794
+ timeout_seconds: routerConfig.execution?.timeoutSeconds
7795
+ } : void 0
7796
+ };
7797
+ const session = await this.client.toolRouter.session.create(payload);
7798
+ return {
7799
+ sessionId: session.session_id,
7800
+ mcp: {
7801
+ type: session.mcp.type,
7802
+ url: session.mcp.url
7803
+ },
7804
+ tools: this.createToolsFn(userId, session.tool_router_tools),
7805
+ authorize: this.createAuthorizeFn(session.session_id),
7806
+ toolkits: this.createToolkitsFn(session.session_id)
7807
+ };
7808
+ }
7809
+ /**
7810
+ * Use an existing session
7811
+ * @param id {string} The id of the session to use
7812
+ * @returns {Promise<ToolRouterSession<TToolCollection, TTool, TProvider>>} The tool router session
7813
+ *
7814
+ * @example
7815
+ * ```typescript
7816
+ * import { Composio } from '@composio/core';
7817
+ *
7818
+ * const composio = new Composio();
7819
+ * const id = 'session_123';
7820
+ * const session = await composio.toolRouter.use(id);
7821
+ *```
7822
+ */
7823
+ async use(id) {
7824
+ const session = await this.client.toolRouter.session.retrieve(id);
7825
+ return {
7826
+ sessionId: session.session_id,
7827
+ mcp: {
7828
+ type: session.mcp.type,
7829
+ url: session.mcp.url
7830
+ },
7831
+ tools: this.createToolsFn(session.config.user_id, session.tool_router_tools),
7832
+ authorize: this.createAuthorizeFn(session.session_id),
7833
+ toolkits: this.createToolkitsFn(session.session_id)
7834
+ };
7361
7835
  }
7362
7836
  };
7363
7837
 
@@ -7384,6 +7858,11 @@ var Composio = class _Composio {
7384
7858
  authConfigs;
7385
7859
  connectedAccounts;
7386
7860
  mcp;
7861
+ /**
7862
+ * Experimental feature, use with caution
7863
+ * @experimental
7864
+ */
7865
+ toolRouter;
7387
7866
  /**
7388
7867
  * Experimental features
7389
7868
  */
@@ -7430,15 +7909,16 @@ var Composio = class _Composio {
7430
7909
  if (IS_DEVELOPMENT_OR_CI) {
7431
7910
  logger_default.debug(`Initializing Composio w API Key: [REDACTED] and baseURL: ${baseURLParsed}`);
7432
7911
  }
7912
+ this.provider = config?.provider ?? new OpenAIProvider();
7433
7913
  this.config = {
7434
7914
  ...config,
7435
7915
  baseURL: baseURLParsed,
7436
7916
  apiKey: apiKeyParsed,
7437
7917
  toolkitVersions: getToolkitVersionsFromEnv(config?.toolkitVersions),
7438
7918
  allowTracking: config?.allowTracking ?? true,
7439
- autoUploadDownloadFiles: config?.autoUploadDownloadFiles ?? true
7919
+ autoUploadDownloadFiles: config?.autoUploadDownloadFiles ?? true,
7920
+ provider: config?.provider ?? this.provider
7440
7921
  };
7441
- this.provider = config?.provider ?? new OpenAIProvider();
7442
7922
  const defaultHeaders = getDefaultHeaders(this.config.defaultHeaders, this.provider);
7443
7923
  this.client = new ComposioClient4({
7444
7924
  apiKey: apiKeyParsed,
@@ -7446,21 +7926,21 @@ var Composio = class _Composio {
7446
7926
  defaultHeaders,
7447
7927
  logLevel: COMPOSIO_LOG_LEVEL
7448
7928
  });
7449
- this.tools = new Tools(this.client, this.provider, this.config);
7929
+ this.tools = new Tools(this.client, this.config);
7450
7930
  this.mcp = new MCP(this.client);
7451
7931
  this.toolkits = new Toolkits(this.client);
7452
7932
  this.triggers = new Triggers(this.client, this.config);
7453
7933
  this.authConfigs = new AuthConfigs(this.client);
7454
7934
  this.files = new Files(this.client);
7455
7935
  this.connectedAccounts = new ConnectedAccounts(this.client);
7936
+ this.toolRouter = new ToolRouter(this.client, this.config);
7456
7937
  this.experimental = {
7457
- /**
7458
- * Experimental tool router
7459
- * Helps you create a single MCP server containing all the tools with smart routing.
7460
- *
7461
- * @description Allows you to create an isolated toolRouter MCP session for a user
7462
- */
7463
- toolRouter: new ToolRouter(this.client)
7938
+ create: async (userId, routerConfig) => {
7939
+ return this.toolRouter.create(userId, routerConfig);
7940
+ },
7941
+ use: async (id) => {
7942
+ return this.toolRouter.use(id);
7943
+ }
7464
7944
  };
7465
7945
  this.deprecated = {
7466
7946
  /**
@@ -7818,6 +8298,7 @@ export {
7818
8298
  MCPServerCreateResponseSchema,
7819
8299
  MCPServerListResponseSchema,
7820
8300
  MCPServerSchema,
8301
+ MCPServerTypeSchema,
7821
8302
  MCPServerUpdateParamsSchema,
7822
8303
  MCPSingleAppServerSchema,
7823
8304
  MCPToolkitConfigSchema,
@@ -7852,15 +8333,25 @@ export {
7852
8333
  ToolListParamsSchema,
7853
8334
  ToolListResponseSchema,
7854
8335
  ToolProxyParamsSchema,
7855
- ToolRouter,
7856
- ToolRouterConfigSchema,
7857
- ToolRouterSessionSchema,
7858
- ToolRouterToolkitConfigSchema,
8336
+ ToolRouterConfigManageConnectionsSchema,
8337
+ ToolRouterConfigTagsSchema,
8338
+ ToolRouterConfigToolsSchema,
8339
+ ToolRouterCreateSessionConfigSchema,
8340
+ ToolRouterDisabledTagsConfigSchema,
8341
+ ToolRouterEnabledTagsConfigSchema,
8342
+ ToolRouterManageConnectionsConfigSchema,
8343
+ ToolRouterTagsParamSchema,
8344
+ ToolRouterToolkitsDisabledConfigSchema,
8345
+ ToolRouterToolkitsEnabledConfigSchema,
8346
+ ToolRouterToolkitsParamSchema,
8347
+ ToolRouterToolsParamSchema,
7859
8348
  ToolSchema,
7860
8349
  ToolkitAuthConfigDetailsSchema,
7861
8350
  ToolkitAuthFieldSchema,
7862
8351
  ToolkitAuthFieldsResponseSchema,
7863
8352
  ToolkitCategorySchema,
8353
+ ToolkitConnectionStateSchema,
8354
+ ToolkitConnectionsDetailsSchema,
7864
8355
  ToolkitErrorCodes,
7865
8356
  ToolkitMangedByEnumSchema,
7866
8357
  ToolkitRetrieveCategoriesResponseSchema,