@composio/core 0.6.3 → 0.6.5-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.
- package/dist/{BaseProvider-C7yGAyLz.d.mts → BaseProvider-B2v5L9PY.d.mts} +2273 -363
- package/dist/{BaseProvider-X7JCCvcK.d.cts → BaseProvider-B_UIuruL.d.cts} +2273 -363
- package/dist/{Telemetry-Bn5VseVi.mjs → Telemetry-CHfDfthM.mjs} +5 -8
- package/dist/{Telemetry-DErMJqj0.cjs → Telemetry-DRFfIuVS.cjs} +5 -8
- package/dist/{buffer-BFpVRahf.mjs → buffer-C1MwV-7j.mjs} +3 -1
- package/dist/{buffer-CYf1Z6Sd.cjs → buffer-Dy7Xi_sk.cjs} +8 -0
- package/dist/{composio-uGEfnO6v.d.cts → composio-B-tZKVA0.d.cts} +994 -407
- package/dist/{composio-Ds1Z80p8.d.mts → composio-OAY2JH-U.d.mts} +994 -407
- package/dist/{fileUtils.node-DLp53qm1.cjs → fileUtils.node-BUe2eO0j.cjs} +1 -1
- package/dist/{fileUtils.node-MOEGtpnI.mjs → fileUtils.node-D1JLL4nZ.mjs} +1 -1
- package/dist/index.cjs +1075 -123
- package/dist/index.d.cts +4906 -5
- package/dist/index.d.mts +4906 -5
- package/dist/index.mjs +1054 -124
- package/dist/models/Files.node.cjs +3 -3
- package/dist/models/Files.node.mjs +3 -3
- package/dist/{types-CMQAtpc_.d.mts → types-Bo0skt5g.d.mts} +2 -2
- package/dist/{types-CTXCkF_v.d.cts → types-lcoAiXDa.d.cts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +3 -3
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +3 -3
- package/dist/utils/modifiers/FileToolModifier.node.cjs +2 -2
- package/dist/utils/modifiers/FileToolModifier.node.d.cts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +2 -2
- package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +1 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/generated/ably.ts +20 -0
- package/generated/accelo.ts +8 -0
- package/generated/acculynx.ts +17 -0
- package/generated/active_campaign.ts +30 -0
- package/generated/adobe.ts +8 -0
- package/generated/adyntel.ts +12 -0
- package/generated/aero_workflow.ts +8 -0
- package/generated/affinity.ts +29 -0
- package/generated/agencyzoom.ts +108 -0
- package/generated/ahrefs.ts +49 -0
- package/generated/airtable.ts +26 -0
- package/generated/alchemy.ts +16 -0
- package/generated/algolia.ts +39 -0
- package/generated/altoviz.ts +18 -0
- package/generated/amazon.ts +8 -0
- package/generated/amcards.ts +11 -0
- package/generated/amplitude.ts +25 -0
- package/generated/anthropic_administrator.ts +13 -0
- package/generated/apaleo.ts +38 -0
- package/generated/apollo.ts +40 -0
- package/generated/appdrag.ts +8 -0
- package/generated/appsflyer.ts +8 -0
- package/generated/asana.ts +95 -0
- package/generated/ashby.ts +8 -0
- package/generated/atlassian.ts +8 -0
- package/generated/attio.ts +20 -0
- package/generated/auth0.ts +8 -0
- package/generated/axonaut.ts +8 -0
- package/generated/bamboohr.ts +168 -0
- package/generated/bannerbear.ts +17 -0
- package/generated/baserow.ts +11 -0
- package/generated/battlenet.ts +8 -0
- package/generated/beeminder.ts +14 -0
- package/generated/bigmailer.ts +12 -0
- package/generated/bigml.ts +15 -0
- package/generated/bill.ts +218 -0
- package/generated/bitbucket.ts +25 -0
- package/generated/bitwarden.ts +8 -0
- package/generated/blackbaud.ts +8 -0
- package/generated/blackboard.ts +323 -0
- package/generated/boldsign.ts +8 -0
- package/generated/bolna.ts +24 -0
- package/generated/borneo.ts +162 -0
- package/generated/botbaba.ts +8 -0
- package/generated/box.ts +282 -0
- package/generated/braintree.ts +8 -0
- package/generated/brandfetch.ts +15 -0
- package/generated/breezy_hr.ts +8 -0
- package/generated/brevo.ts +28 -0
- package/generated/brex.ts +8 -0
- package/generated/brex_staging.ts +8 -0
- package/generated/brightpearl.ts +8 -0
- package/generated/brilliant_directories.ts +15 -0
- package/generated/browseai.ts +18 -0
- package/generated/browserbase_tool.ts +10 -0
- package/generated/browserhub.ts +8 -0
- package/generated/browserless.ts +16 -0
- package/generated/bubble.ts +8 -0
- package/generated/bugbug.ts +13 -0
- package/generated/builtwith.ts +21 -0
- package/generated/cal.ts +150 -0
- package/generated/calendly.ts +51 -0
- package/generated/canva.ts +41 -0
- package/generated/canvas.ts +100 -0
- package/generated/chatwork.ts +17 -0
- package/generated/chmeetings.ts +8 -0
- package/generated/clickup.ts +153 -0
- package/generated/clockify.ts +23 -0
- package/generated/close.ts +15 -0
- package/generated/cloudflare.ts +10 -0
- package/generated/coda.ts +115 -0
- package/generated/codeinterpreter.ts +14 -0
- package/generated/coinbase.ts +15 -0
- package/generated/coinmarketcal.ts +8 -0
- package/generated/composio.ts +34 -0
- package/generated/composio_search.ts +22 -0
- package/generated/confluence.ts +199 -0
- package/generated/contentful.ts +12 -0
- package/generated/crustdata.ts +23 -0
- package/generated/customer_io.ts +8 -0
- package/generated/cutt_ly.ts +10 -0
- package/generated/d2lbrightspace.ts +54 -0
- package/generated/dailybot.ts +15 -0
- package/generated/datadog.ts +47 -0
- package/generated/datagma.ts +8 -0
- package/generated/datarobot.ts +8 -0
- package/generated/deel.ts +8 -0
- package/generated/demio.ts +8 -0
- package/generated/dialpad.ts +201 -0
- package/generated/digicert.ts +15 -0
- package/generated/discord.ts +17 -0
- package/generated/discordbot.ts +173 -0
- package/generated/docmosis.ts +8 -0
- package/generated/docusign.ts +351 -0
- package/generated/dropbox.ts +20 -0
- package/generated/dropbox_sign.ts +8 -0
- package/generated/dynamics365.ts +25 -0
- package/generated/echtpost.ts +10 -0
- package/generated/elevenlabs.ts +70 -0
- package/generated/emailoctopus.ts +16 -0
- package/generated/enigma.ts +11 -0
- package/generated/entelligence.ts +11 -0
- package/generated/epic_games.ts +8 -0
- package/generated/eventbrite.ts +12 -0
- package/generated/exa.ts +13 -0
- package/generated/excel.ts +34 -0
- package/generated/exist.ts +8 -0
- package/generated/facebook.ts +8 -0
- package/generated/factorial.ts +8 -0
- package/generated/figma.ts +59 -0
- package/generated/finage.ts +19 -0
- package/generated/firecrawl.ts +16 -0
- package/generated/fireflies.ts +21 -0
- package/generated/fitbit.ts +8 -0
- package/generated/flutterwave.ts +33 -0
- package/generated/fomo.ts +10 -0
- package/generated/formcarry.ts +10 -0
- package/generated/formsite.ts +14 -0
- package/generated/foursquare.ts +14 -0
- package/generated/freshbooks.ts +11 -0
- package/generated/freshdesk.ts +16 -0
- package/generated/front.ts +8 -0
- package/generated/github.ts +967 -0
- package/generated/gitlab.ts +82 -0
- package/generated/gmail.d.ts +86 -0
- package/generated/gmail.js +13 -0
- package/generated/gmail.ts +95 -0
- package/generated/go_to_webinar.ts +8 -0
- package/generated/gong.ts +63 -0
- package/generated/google_analytics.ts +13 -0
- package/generated/google_maps.ts +16 -0
- package/generated/googleads.ts +14 -0
- package/generated/googlebigquery.ts +10 -0
- package/generated/googlecalendar.ts +39 -0
- package/generated/googledocs.ts +41 -0
- package/generated/googledrive.ts +62 -0
- package/generated/googlemeet.ts +18 -0
- package/generated/googlephotos.ts +22 -0
- package/generated/googlesheets.ts +40 -0
- package/generated/googleslides.ts +8 -0
- package/generated/googlesuper.ts +230 -0
- package/generated/googletasks.ts +23 -0
- package/generated/gorgias.ts +41 -0
- package/generated/gumroad.ts +14 -0
- package/generated/guru.ts +8 -0
- package/generated/hackernews.ts +15 -0
- package/generated/hackerrank_work.ts +8 -0
- package/generated/harvest.ts +56 -0
- package/generated/helcim.ts +8 -0
- package/generated/heygen.ts +44 -0
- package/generated/highlevel.ts +8 -0
- package/generated/hubspot.ts +252 -0
- package/generated/humanloop.ts +13 -0
- package/generated/icims_talent_cloud.ts +8 -0
- package/generated/idea_scale.ts +8 -0
- package/generated/index.ts +151 -0
- package/generated/insighto_ai.ts +19 -0
- package/generated/intercom.ts +52 -0
- package/generated/interzoid.ts +8 -0
- package/generated/jira.ts +59 -0
- package/generated/jotform.ts +15 -0
- package/generated/junglescout.ts +15 -0
- package/generated/keap.ts +8 -0
- package/generated/kibana.ts +58 -0
- package/generated/kit.ts +38 -0
- package/generated/klaviyo.ts +240 -0
- package/generated/klipfolio.ts +20 -0
- package/generated/kommo.ts +24 -0
- package/generated/lastpass.ts +8 -0
- package/generated/launch_darkly.ts +16 -0
- package/generated/leadfeeder.ts +13 -0
- package/generated/leadoku.ts +10 -0
- package/generated/lever.ts +8 -0
- package/generated/lever_sandbox.ts +8 -0
- package/generated/lexoffice.ts +8 -0
- package/generated/linear.ts +31 -0
- package/generated/linkedin.ts +13 -0
- package/generated/linkhut.ts +14 -0
- package/generated/linkup.ts +11 -0
- package/generated/listennotes.ts +35 -0
- package/generated/lmnt.ts +16 -0
- package/generated/lodgify.ts +10 -0
- package/generated/mailchimp.ts +285 -0
- package/generated/mailerlite.ts +8 -0
- package/generated/maintainx.ts +20 -0
- package/generated/make.ts +12 -0
- package/generated/mboum.ts +8 -0
- package/generated/mem0.ts +52 -0
- package/generated/metaads.ts +25 -0
- package/generated/metatextai.ts +8 -0
- package/generated/microsoft_clarity.ts +10 -0
- package/generated/microsoft_teams.ts +22 -0
- package/generated/microsoft_tenant.ts +8 -0
- package/generated/miro.ts +23 -0
- package/generated/mixpanel.ts +30 -0
- package/generated/mocean.ts +8 -0
- package/generated/monday.ts +30 -0
- package/generated/mopinion.ts +8 -0
- package/generated/more_trees.ts +10 -0
- package/generated/moxie.ts +8 -0
- package/generated/moz.ts +8 -0
- package/generated/mural.ts +14 -0
- package/generated/nasdaq.ts +15 -0
- package/generated/ncscale.ts +8 -0
- package/generated/neon.ts +78 -0
- package/generated/netsuite.ts +8 -0
- package/generated/nextdns.ts +11 -0
- package/generated/ngrok.ts +18 -0
- package/generated/notion.ts +40 -0
- package/generated/oncehub.ts +8 -0
- package/generated/one_drive.ts +49 -0
- package/generated/onepage.ts +11 -0
- package/generated/open_sea.ts +33 -0
- package/generated/outlook.ts +37 -0
- package/generated/pagerduty.ts +362 -0
- package/generated/pandadoc.ts +23 -0
- package/generated/peopledatalabs.ts +24 -0
- package/generated/perplexityai.ts +10 -0
- package/generated/piggy.ts +8 -0
- package/generated/pipedrive.ts +288 -0
- package/generated/placekey.ts +12 -0
- package/generated/posthog.ts +367 -0
- package/generated/precoro.ts +8 -0
- package/generated/printnode.ts +8 -0
- package/generated/process_street.ts +14 -0
- package/generated/productboard.ts +8 -0
- package/generated/qualaroo.ts +8 -0
- package/generated/quickbooks.ts +22 -0
- package/generated/rafflys.ts +8 -0
- package/generated/ragic.ts +10 -0
- package/generated/ramp.ts +17 -0
- package/generated/ravenseotools.ts +8 -0
- package/generated/recallai.ts +17 -0
- package/generated/reddit.ts +19 -0
- package/generated/resend.ts +27 -0
- package/generated/retellai.ts +19 -0
- package/generated/retently.ts +24 -0
- package/generated/ring_central.ts +8 -0
- package/generated/rippling.ts +8 -0
- package/generated/rocket_reach.ts +8 -0
- package/generated/rocketlane.ts +42 -0
- package/generated/rootly.ts +12 -0
- package/generated/rosette_text_analytics.ts +12 -0
- package/generated/sage.ts +8 -0
- package/generated/salesforce.ts +46 -0
- package/generated/scrape_do.ts +28 -0
- package/generated/scrapingant.ts +14 -0
- package/generated/screenshotone.ts +10 -0
- package/generated/seismic.ts +8 -0
- package/generated/semanticscholar.ts +23 -0
- package/generated/semrush.ts +45 -0
- package/generated/sendgrid.ts +384 -0
- package/generated/sentry.ts +185 -0
- package/generated/serpapi.ts +32 -0
- package/generated/servicem8.ts +37 -0
- package/generated/servicenow.ts +14 -0
- package/generated/share_point.ts +15 -0
- package/generated/shopify.ts +37 -0
- package/generated/shortcut.ts +131 -0
- package/generated/simplesat.ts +11 -0
- package/generated/slack.d.ts +16 -0
- package/generated/slack.js +11 -0
- package/generated/slack.ts +24 -0
- package/generated/slackbot.ts +205 -0
- package/generated/smartrecruiters.ts +8 -0
- package/generated/smugmug.ts +14 -0
- package/generated/snowflake.ts +15 -0
- package/generated/sourcegraph.ts +16 -0
- package/generated/square.ts +8 -0
- package/generated/stack_exchange.ts +17 -0
- package/generated/starton.ts +11 -0
- package/generated/storeganise.ts +12 -0
- package/generated/stripe.ts +50 -0
- package/generated/supabase.ts +86 -0
- package/generated/survey_monkey.ts +8 -0
- package/generated/tally.ts +25 -0
- package/generated/tapfiliate.ts +11 -0
- package/generated/tapform.ts +8 -0
- package/generated/tavily.ts +10 -0
- package/generated/terminus.ts +8 -0
- package/generated/text_to_pdf.ts +10 -0
- package/generated/textrazor.ts +22 -0
- package/generated/timecamp.ts +10 -0
- package/generated/timekit.ts +8 -0
- package/generated/timely.ts +11 -0
- package/generated/tinypng.ts +15 -0
- package/generated/tinyurl.ts +10 -0
- package/generated/tisane.ts +15 -0
- package/generated/todoist.ts +19 -0
- package/generated/toneden.ts +8 -0
- package/generated/tpscheck.ts +10 -0
- package/generated/trello.ts +360 -0
- package/generated/twitch.ts +8 -0
- package/generated/twitter.ts +82 -0
- package/generated/twitter_media.ts +10 -0
- package/generated/typefully.ts +14 -0
- package/generated/venly.ts +8 -0
- package/generated/vero.ts +8 -0
- package/generated/visme.ts +8 -0
- package/generated/waboxapp.ts +8 -0
- package/generated/wakatime.ts +8 -0
- package/generated/wave_accounting.ts +8 -0
- package/generated/weathermap.ts +10 -0
- package/generated/webex.ts +37 -0
- package/generated/webflow.ts +30 -0
- package/generated/whatsapp.ts +14 -0
- package/generated/wiz.ts +8 -0
- package/generated/workiom.ts +12 -0
- package/generated/wrike.ts +47 -0
- package/generated/xero.ts +13 -0
- package/generated/yandex.ts +13 -0
- package/generated/ynab.ts +8 -0
- package/generated/yousearch.ts +10 -0
- package/generated/youtube.ts +26 -0
- package/generated/zendesk.ts +23 -0
- package/generated/zenrows.ts +25 -0
- package/generated/zenserp.ts +20 -0
- package/generated/zoho.ts +33 -0
- package/generated/zoho_bigin.ts +21 -0
- package/generated/zoho_books.ts +8 -0
- package/generated/zoho_desk.ts +8 -0
- package/generated/zoho_inventory.ts +8 -0
- package/generated/zoho_invoice.ts +15 -0
- package/generated/zoho_mail.ts +8 -0
- package/generated/zoom.ts +181 -0
- package/generated/zoominfo.ts +26 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CQwRTUmo.cjs');
|
|
2
|
-
const require_buffer = require('./buffer-
|
|
3
|
-
const require_Telemetry = require('./Telemetry-
|
|
2
|
+
const require_buffer = require('./buffer-Dy7Xi_sk.cjs');
|
|
3
|
+
const require_Telemetry = require('./Telemetry-DRFfIuVS.cjs');
|
|
4
4
|
let _composio_client = require("@composio/client");
|
|
5
5
|
_composio_client = require_chunk.__toESM(_composio_client);
|
|
6
6
|
let _file_tool_modifier = require("#file_tool_modifier");
|
|
@@ -34,7 +34,8 @@ const AuthSchemeTypes = {
|
|
|
34
34
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
35
35
|
SERVICE_ACCOUNT: "SERVICE_ACCOUNT",
|
|
36
36
|
SAML: "SAML",
|
|
37
|
-
DCR_OAUTH: "DCR_OAUTH"
|
|
37
|
+
DCR_OAUTH: "DCR_OAUTH",
|
|
38
|
+
S2S_OAUTH2: "S2S_OAUTH2"
|
|
38
39
|
};
|
|
39
40
|
const AuthConfigCreationToolAccessConfigSchema = zod_v3.z.object({ toolsForConnectedAccountCreation: zod_v3.z.array(zod_v3.z.string()).optional() });
|
|
40
41
|
const AuthConfigToolAccessConfigSchema = zod_v3.z.object({
|
|
@@ -54,7 +55,8 @@ const AuthSchemeEnum = zod_v3.z.enum([
|
|
|
54
55
|
"CALCOM_AUTH",
|
|
55
56
|
"SERVICE_ACCOUNT",
|
|
56
57
|
"SAML",
|
|
57
|
-
"DCR_OAUTH"
|
|
58
|
+
"DCR_OAUTH",
|
|
59
|
+
"S2S_OAUTH2"
|
|
58
60
|
]);
|
|
59
61
|
const CreateCustomAuthConfigParamsSchema = zod_v3.z.object({
|
|
60
62
|
type: zod_v3.z.literal("use_custom_auth"),
|
|
@@ -258,6 +260,70 @@ const Oauth2ConnectionDataSchema = zod_v3.z.discriminatedUnion("status", [
|
|
|
258
260
|
Oauth2InactiveConnectionDataSchema
|
|
259
261
|
]);
|
|
260
262
|
const CustomOauth2ConnectionDataSchema = Oauth2ActiveConnectionDataSchema.omit({ status: true });
|
|
263
|
+
const S2SOauth2BaseSchema = BaseSchemeRaw.extend({ status: zod_v3.z.literal(ConnectionStatuses.INITIALIZING) }).catchall(zod_v3.z.unknown());
|
|
264
|
+
const S2SOauth2ConnectionDataSchema = zod_v3.z.discriminatedUnion("status", [
|
|
265
|
+
S2SOauth2BaseSchema,
|
|
266
|
+
S2SOauth2BaseSchema.extend({ status: zod_v3.z.literal(ConnectionStatuses.INITIATED) }).catchall(zod_v3.z.unknown()),
|
|
267
|
+
S2SOauth2BaseSchema.extend({
|
|
268
|
+
status: zod_v3.z.literal(ConnectionStatuses.ACTIVE),
|
|
269
|
+
access_token: zod_v3.z.string().optional(),
|
|
270
|
+
id_token: zod_v3.z.string().optional(),
|
|
271
|
+
token_type: zod_v3.z.string().optional(),
|
|
272
|
+
refresh_token: zod_v3.z.string().nullish(),
|
|
273
|
+
expires_in: zod_v3.z.union([
|
|
274
|
+
zod_v3.z.string(),
|
|
275
|
+
zod_v3.z.number(),
|
|
276
|
+
zod_v3.z.null()
|
|
277
|
+
]).optional(),
|
|
278
|
+
scope: zod_v3.z.union([
|
|
279
|
+
zod_v3.z.string(),
|
|
280
|
+
zod_v3.z.array(zod_v3.z.string()),
|
|
281
|
+
zod_v3.z.null()
|
|
282
|
+
]).optional()
|
|
283
|
+
}).catchall(zod_v3.z.unknown()),
|
|
284
|
+
S2SOauth2BaseSchema.extend({
|
|
285
|
+
status: zod_v3.z.literal(ConnectionStatuses.INACTIVE),
|
|
286
|
+
access_token: zod_v3.z.string().optional(),
|
|
287
|
+
id_token: zod_v3.z.string().optional(),
|
|
288
|
+
token_type: zod_v3.z.string().optional(),
|
|
289
|
+
refresh_token: zod_v3.z.string().nullish(),
|
|
290
|
+
expires_in: zod_v3.z.union([
|
|
291
|
+
zod_v3.z.string(),
|
|
292
|
+
zod_v3.z.number(),
|
|
293
|
+
zod_v3.z.null()
|
|
294
|
+
]).optional(),
|
|
295
|
+
scope: zod_v3.z.union([
|
|
296
|
+
zod_v3.z.string(),
|
|
297
|
+
zod_v3.z.array(zod_v3.z.string()),
|
|
298
|
+
zod_v3.z.null()
|
|
299
|
+
]).optional()
|
|
300
|
+
}).catchall(zod_v3.z.unknown()),
|
|
301
|
+
S2SOauth2BaseSchema.extend({
|
|
302
|
+
status: zod_v3.z.literal(ConnectionStatuses.FAILED),
|
|
303
|
+
error: zod_v3.z.string().optional(),
|
|
304
|
+
error_description: zod_v3.z.string().optional()
|
|
305
|
+
}).catchall(zod_v3.z.unknown()),
|
|
306
|
+
S2SOauth2BaseSchema.extend({
|
|
307
|
+
status: zod_v3.z.literal(ConnectionStatuses.EXPIRED),
|
|
308
|
+
expired_at: zod_v3.z.string().optional()
|
|
309
|
+
}).catchall(zod_v3.z.unknown())
|
|
310
|
+
]);
|
|
311
|
+
const CustomS2SOauth2ConnectionDataSchema = BaseSchemeRaw.extend({
|
|
312
|
+
access_token: zod_v3.z.string().optional(),
|
|
313
|
+
id_token: zod_v3.z.string().optional(),
|
|
314
|
+
token_type: zod_v3.z.string().optional(),
|
|
315
|
+
refresh_token: zod_v3.z.string().nullish().optional(),
|
|
316
|
+
expires_in: zod_v3.z.union([
|
|
317
|
+
zod_v3.z.string(),
|
|
318
|
+
zod_v3.z.number(),
|
|
319
|
+
zod_v3.z.null()
|
|
320
|
+
]).optional(),
|
|
321
|
+
scope: zod_v3.z.union([
|
|
322
|
+
zod_v3.z.string(),
|
|
323
|
+
zod_v3.z.array(zod_v3.z.string()),
|
|
324
|
+
zod_v3.z.null()
|
|
325
|
+
]).optional()
|
|
326
|
+
}).catchall(zod_v3.z.unknown());
|
|
261
327
|
const Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({ status: zod_v3.z.literal(ConnectionStatuses.INITIALIZING) }).catchall(zod_v3.z.unknown());
|
|
262
328
|
const Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
263
329
|
status: zod_v3.z.literal(ConnectionStatuses.INITIATED),
|
|
@@ -618,6 +684,10 @@ const ConnectionDataSchema = zod_v3.z.discriminatedUnion("authScheme", [
|
|
|
618
684
|
authScheme: zod_v3.z.literal(AuthSchemeTypes.OAUTH2),
|
|
619
685
|
val: Oauth2ConnectionDataSchema
|
|
620
686
|
}),
|
|
687
|
+
zod_v3.z.object({
|
|
688
|
+
authScheme: zod_v3.z.literal(AuthSchemeTypes.S2S_OAUTH2),
|
|
689
|
+
val: S2SOauth2ConnectionDataSchema
|
|
690
|
+
}),
|
|
621
691
|
zod_v3.z.object({
|
|
622
692
|
authScheme: zod_v3.z.literal(AuthSchemeTypes.API_KEY),
|
|
623
693
|
val: ApiKeyConnectionDataSchema
|
|
@@ -669,6 +739,11 @@ const CustomConnectionDataSchema = zod_v3.z.discriminatedUnion("authScheme", [
|
|
|
669
739
|
toolkitSlug: zod_v3.z.string(),
|
|
670
740
|
val: CustomOauth2ConnectionDataSchema
|
|
671
741
|
}),
|
|
742
|
+
zod_v3.z.object({
|
|
743
|
+
authScheme: zod_v3.z.literal(AuthSchemeTypes.S2S_OAUTH2),
|
|
744
|
+
toolkitSlug: zod_v3.z.string(),
|
|
745
|
+
val: CustomS2SOauth2ConnectionDataSchema
|
|
746
|
+
}),
|
|
672
747
|
zod_v3.z.object({
|
|
673
748
|
authScheme: zod_v3.z.literal(AuthSchemeTypes.DCR_OAUTH),
|
|
674
749
|
toolkitSlug: zod_v3.z.string(),
|
|
@@ -1369,6 +1444,39 @@ var ComposioWebhookPayloadError = class extends require_buffer.ComposioError {
|
|
|
1369
1444
|
}
|
|
1370
1445
|
};
|
|
1371
1446
|
|
|
1447
|
+
//#endregion
|
|
1448
|
+
//#region src/errors/RemoteFileErrors.ts
|
|
1449
|
+
const RemoteFileErrorCodes = { DOWNLOAD_FAILED: "REMOTE_FILE_DOWNLOAD_FAILED" };
|
|
1450
|
+
/**
|
|
1451
|
+
* Error thrown when fetching a remote file from a tool router session mount fails.
|
|
1452
|
+
* Includes HTTP status, URL, and file path context for debugging.
|
|
1453
|
+
*/
|
|
1454
|
+
var RemoteFileDownloadError = class extends require_buffer.ComposioError {
|
|
1455
|
+
constructor(message = "Failed to download remote file", options = {}) {
|
|
1456
|
+
const { statusCode, statusText, downloadUrl, mountRelativePath, filename, meta: optionsMeta, ...rest } = options;
|
|
1457
|
+
const meta = {
|
|
1458
|
+
...optionsMeta,
|
|
1459
|
+
...statusCode !== void 0 && { statusCode },
|
|
1460
|
+
...statusText && { statusText },
|
|
1461
|
+
...downloadUrl && { downloadUrl },
|
|
1462
|
+
...mountRelativePath && { mountRelativePath },
|
|
1463
|
+
...filename && { filename }
|
|
1464
|
+
};
|
|
1465
|
+
super(message, {
|
|
1466
|
+
...rest,
|
|
1467
|
+
code: RemoteFileErrorCodes.DOWNLOAD_FAILED,
|
|
1468
|
+
statusCode,
|
|
1469
|
+
meta: Object.keys(meta).length > 0 ? meta : void 0,
|
|
1470
|
+
possibleFixes: options.possibleFixes ?? [
|
|
1471
|
+
"Verify the download URL has not expired (check expiresAt)",
|
|
1472
|
+
"Ensure the file exists at the specified mount path",
|
|
1473
|
+
"Retry the operation; presigned URLs may have transient failures"
|
|
1474
|
+
]
|
|
1475
|
+
});
|
|
1476
|
+
this.name = "RemoteFileDownloadError";
|
|
1477
|
+
}
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1372
1480
|
//#endregion
|
|
1373
1481
|
//#region src/types/connectedAccounts.types.ts
|
|
1374
1482
|
/**
|
|
@@ -1422,6 +1530,7 @@ const CreateConnectedAccountResponseSchema = zod_v3.z.object({
|
|
|
1422
1530
|
});
|
|
1423
1531
|
const ConnectedAccountAuthConfigSchema = zod_v3.z.object({
|
|
1424
1532
|
id: zod_v3.z.string(),
|
|
1533
|
+
authScheme: AuthSchemeEnum.optional(),
|
|
1425
1534
|
isComposioManaged: zod_v3.z.boolean(),
|
|
1426
1535
|
isDisabled: zod_v3.z.boolean()
|
|
1427
1536
|
});
|
|
@@ -1504,6 +1613,7 @@ function transformConnectedAccountResponse(response) {
|
|
|
1504
1613
|
authConfig: {
|
|
1505
1614
|
...response$1.auth_config,
|
|
1506
1615
|
id: response$1.auth_config.id,
|
|
1616
|
+
authScheme: response$1.auth_config.auth_scheme,
|
|
1507
1617
|
isComposioManaged: response$1.auth_config.is_composio_managed,
|
|
1508
1618
|
isDisabled: response$1.auth_config.is_disabled
|
|
1509
1619
|
},
|
|
@@ -3246,7 +3356,7 @@ var ConnectedAccounts = class {
|
|
|
3246
3356
|
const parsedOptions = ConnectedAccountRefreshOptionsSchema.safeParse(options);
|
|
3247
3357
|
if (!parsedOptions.success) throw new ValidationError("Failed to parse connected account refresh options", { cause: parsedOptions.error });
|
|
3248
3358
|
params = {
|
|
3249
|
-
|
|
3359
|
+
query_redirect_url: parsedOptions.data.redirectUrl,
|
|
3250
3360
|
validate_credentials: parsedOptions.data.validateCredentials
|
|
3251
3361
|
};
|
|
3252
3362
|
}
|
|
@@ -3677,11 +3787,19 @@ const WebhookPayloadV2Schema = zod_v3.z.object({
|
|
|
3677
3787
|
user_id: zod_v3.z.string()
|
|
3678
3788
|
}).passthrough()
|
|
3679
3789
|
});
|
|
3680
|
-
/** V3 webhook payload -
|
|
3790
|
+
/** V3 webhook payload - generic envelope for all composio.* events */
|
|
3681
3791
|
const WebhookPayloadV3Schema = zod_v3.z.object({
|
|
3682
3792
|
id: zod_v3.z.string(),
|
|
3683
3793
|
timestamp: zod_v3.z.string(),
|
|
3684
|
-
type: zod_v3.z.
|
|
3794
|
+
type: zod_v3.z.string().refine((val) => val.startsWith("composio."), { message: "V3 event type must start with 'composio.'" }),
|
|
3795
|
+
metadata: zod_v3.z.record(zod_v3.z.unknown()),
|
|
3796
|
+
data: zod_v3.z.record(zod_v3.z.unknown())
|
|
3797
|
+
});
|
|
3798
|
+
/** V3 trigger-specific payload - has trigger metadata fields */
|
|
3799
|
+
const WebhookTriggerPayloadV3Schema = zod_v3.z.object({
|
|
3800
|
+
id: zod_v3.z.string(),
|
|
3801
|
+
timestamp: zod_v3.z.string(),
|
|
3802
|
+
type: zod_v3.z.string(),
|
|
3685
3803
|
metadata: zod_v3.z.object({
|
|
3686
3804
|
log_id: zod_v3.z.string(),
|
|
3687
3805
|
trigger_slug: zod_v3.z.string(),
|
|
@@ -3689,7 +3807,7 @@ const WebhookPayloadV3Schema = zod_v3.z.object({
|
|
|
3689
3807
|
connected_account_id: zod_v3.z.string(),
|
|
3690
3808
|
auth_config_id: zod_v3.z.string(),
|
|
3691
3809
|
user_id: zod_v3.z.string()
|
|
3692
|
-
}),
|
|
3810
|
+
}).passthrough(),
|
|
3693
3811
|
data: zod_v3.z.record(zod_v3.z.unknown())
|
|
3694
3812
|
});
|
|
3695
3813
|
/** Union of all webhook payload versions */
|
|
@@ -4535,28 +4653,55 @@ var Triggers = class {
|
|
|
4535
4653
|
* @private
|
|
4536
4654
|
*/
|
|
4537
4655
|
normalizeV3Payload(payload) {
|
|
4538
|
-
const
|
|
4539
|
-
|
|
4656
|
+
const triggerResult = WebhookTriggerPayloadV3Schema.safeParse(payload);
|
|
4657
|
+
if (triggerResult.success) {
|
|
4658
|
+
const triggerSlug = triggerResult.data.metadata.trigger_slug;
|
|
4659
|
+
const toolkitSlug = triggerSlug.split("_")[0]?.toUpperCase() || "UNKNOWN";
|
|
4660
|
+
return {
|
|
4661
|
+
id: triggerResult.data.metadata.trigger_id,
|
|
4662
|
+
uuid: triggerResult.data.metadata.trigger_id,
|
|
4663
|
+
triggerSlug,
|
|
4664
|
+
toolkitSlug,
|
|
4665
|
+
userId: triggerResult.data.metadata.user_id,
|
|
4666
|
+
payload: payload.data,
|
|
4667
|
+
originalPayload: payload.data,
|
|
4668
|
+
metadata: {
|
|
4669
|
+
id: triggerResult.data.metadata.trigger_id,
|
|
4670
|
+
uuid: triggerResult.data.metadata.trigger_id,
|
|
4671
|
+
toolkitSlug,
|
|
4672
|
+
triggerSlug,
|
|
4673
|
+
triggerConfig: {},
|
|
4674
|
+
connectedAccount: {
|
|
4675
|
+
id: triggerResult.data.metadata.connected_account_id,
|
|
4676
|
+
uuid: triggerResult.data.metadata.connected_account_id,
|
|
4677
|
+
authConfigId: triggerResult.data.metadata.auth_config_id,
|
|
4678
|
+
authConfigUUID: triggerResult.data.metadata.auth_config_id,
|
|
4679
|
+
userId: triggerResult.data.metadata.user_id,
|
|
4680
|
+
status: "ACTIVE"
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
};
|
|
4684
|
+
}
|
|
4540
4685
|
return {
|
|
4541
|
-
id: payload.
|
|
4542
|
-
uuid: payload.
|
|
4543
|
-
triggerSlug,
|
|
4544
|
-
toolkitSlug,
|
|
4545
|
-
userId:
|
|
4686
|
+
id: payload.id,
|
|
4687
|
+
uuid: payload.id,
|
|
4688
|
+
triggerSlug: payload.type,
|
|
4689
|
+
toolkitSlug: "COMPOSIO",
|
|
4690
|
+
userId: "",
|
|
4546
4691
|
payload: payload.data,
|
|
4547
|
-
originalPayload: payload
|
|
4692
|
+
originalPayload: payload,
|
|
4548
4693
|
metadata: {
|
|
4549
|
-
id: payload.
|
|
4550
|
-
uuid: payload.
|
|
4551
|
-
toolkitSlug,
|
|
4552
|
-
triggerSlug,
|
|
4694
|
+
id: payload.id,
|
|
4695
|
+
uuid: payload.id,
|
|
4696
|
+
toolkitSlug: "COMPOSIO",
|
|
4697
|
+
triggerSlug: payload.type,
|
|
4553
4698
|
triggerConfig: {},
|
|
4554
4699
|
connectedAccount: {
|
|
4555
|
-
id:
|
|
4556
|
-
uuid:
|
|
4557
|
-
authConfigId:
|
|
4558
|
-
authConfigUUID:
|
|
4559
|
-
userId:
|
|
4700
|
+
id: "",
|
|
4701
|
+
uuid: "",
|
|
4702
|
+
authConfigId: "",
|
|
4703
|
+
authConfigUUID: "",
|
|
4704
|
+
userId: "",
|
|
4560
4705
|
status: "ACTIVE"
|
|
4561
4706
|
}
|
|
4562
4707
|
}
|
|
@@ -5584,7 +5729,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5584
5729
|
|
|
5585
5730
|
//#endregion
|
|
5586
5731
|
//#region package.json
|
|
5587
|
-
var version = "0.6.
|
|
5732
|
+
var version = "0.6.5-alpha.0";
|
|
5588
5733
|
|
|
5589
5734
|
//#endregion
|
|
5590
5735
|
//#region src/utils/session.ts
|
|
@@ -5741,6 +5886,72 @@ const ToolRouterToolkitsOptionsSchema = zod_v3.default.object({
|
|
|
5741
5886
|
isConnected: zod_v3.default.boolean().optional(),
|
|
5742
5887
|
search: zod_v3.default.string().optional()
|
|
5743
5888
|
});
|
|
5889
|
+
const ToolRouterSessionSearchResultReferenceWorkbenchSnippetSchema = zod_v3.default.object({
|
|
5890
|
+
code: zod_v3.default.string(),
|
|
5891
|
+
description: zod_v3.default.string()
|
|
5892
|
+
});
|
|
5893
|
+
const ToolRouterSessionSearchResultSchema = zod_v3.default.object({
|
|
5894
|
+
index: zod_v3.default.number(),
|
|
5895
|
+
useCase: zod_v3.default.string(),
|
|
5896
|
+
primaryToolSlugs: zod_v3.default.array(zod_v3.default.string()),
|
|
5897
|
+
relatedToolSlugs: zod_v3.default.array(zod_v3.default.string()),
|
|
5898
|
+
toolkits: zod_v3.default.array(zod_v3.default.string()),
|
|
5899
|
+
difficulty: zod_v3.default.string().optional(),
|
|
5900
|
+
error: zod_v3.default.string().nullable().optional(),
|
|
5901
|
+
executionGuidance: zod_v3.default.string().optional(),
|
|
5902
|
+
knownPitfalls: zod_v3.default.array(zod_v3.default.string()).optional(),
|
|
5903
|
+
memory: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.array(zod_v3.default.string())).optional(),
|
|
5904
|
+
planId: zod_v3.default.string().optional(),
|
|
5905
|
+
recommendedPlanSteps: zod_v3.default.array(zod_v3.default.string()).optional(),
|
|
5906
|
+
referenceWorkbenchSnippets: zod_v3.default.array(ToolRouterSessionSearchResultReferenceWorkbenchSnippetSchema).optional()
|
|
5907
|
+
});
|
|
5908
|
+
const ToolRouterSessionSearchSessionSchema = zod_v3.default.object({
|
|
5909
|
+
id: zod_v3.default.string(),
|
|
5910
|
+
generateId: zod_v3.default.boolean(),
|
|
5911
|
+
instructions: zod_v3.default.string()
|
|
5912
|
+
});
|
|
5913
|
+
const ToolRouterSessionSearchTimeInfoSchema = zod_v3.default.object({
|
|
5914
|
+
currentTimeUtc: zod_v3.default.string(),
|
|
5915
|
+
currentTimeUtcEpochSeconds: zod_v3.default.number(),
|
|
5916
|
+
message: zod_v3.default.string()
|
|
5917
|
+
});
|
|
5918
|
+
const ToolRouterSessionSearchToolSchemasSchemaRefSchema = zod_v3.default.object({
|
|
5919
|
+
args: zod_v3.default.object({ toolSlugs: zod_v3.default.array(zod_v3.default.string()) }),
|
|
5920
|
+
message: zod_v3.default.string(),
|
|
5921
|
+
tool: zod_v3.default.literal("COMPOSIO_GET_TOOL_SCHEMAS")
|
|
5922
|
+
});
|
|
5923
|
+
const ToolRouterSessionSearchToolSchemaSchema = zod_v3.default.object({
|
|
5924
|
+
toolSlug: zod_v3.default.string(),
|
|
5925
|
+
toolkit: zod_v3.default.string(),
|
|
5926
|
+
description: zod_v3.default.string().optional(),
|
|
5927
|
+
hasFullSchema: zod_v3.default.boolean().optional(),
|
|
5928
|
+
inputSchema: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.unknown()).optional(),
|
|
5929
|
+
outputSchema: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.unknown()).optional(),
|
|
5930
|
+
schemaRef: ToolRouterSessionSearchToolSchemasSchemaRefSchema.optional()
|
|
5931
|
+
});
|
|
5932
|
+
const ToolRouterSessionSearchToolkitConnectionStatusSchema = zod_v3.default.object({
|
|
5933
|
+
toolkit: zod_v3.default.string(),
|
|
5934
|
+
description: zod_v3.default.string(),
|
|
5935
|
+
hasActiveConnection: zod_v3.default.boolean(),
|
|
5936
|
+
statusMessage: zod_v3.default.string(),
|
|
5937
|
+
connectionDetails: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.unknown()).optional(),
|
|
5938
|
+
currentUserInfo: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.unknown()).optional()
|
|
5939
|
+
});
|
|
5940
|
+
const ToolRouterSessionSearchResponseSchema = zod_v3.default.object({
|
|
5941
|
+
success: zod_v3.default.boolean(),
|
|
5942
|
+
error: zod_v3.default.string().nullable(),
|
|
5943
|
+
results: zod_v3.default.array(ToolRouterSessionSearchResultSchema),
|
|
5944
|
+
toolSchemas: zod_v3.default.record(zod_v3.default.string(), ToolRouterSessionSearchToolSchemaSchema),
|
|
5945
|
+
toolkitConnectionStatuses: zod_v3.default.array(ToolRouterSessionSearchToolkitConnectionStatusSchema),
|
|
5946
|
+
nextStepsGuidance: zod_v3.default.array(zod_v3.default.string()),
|
|
5947
|
+
session: ToolRouterSessionSearchSessionSchema,
|
|
5948
|
+
timeInfo: ToolRouterSessionSearchTimeInfoSchema
|
|
5949
|
+
});
|
|
5950
|
+
const ToolRouterSessionExecuteResponseSchema = zod_v3.default.object({
|
|
5951
|
+
data: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.unknown()),
|
|
5952
|
+
error: zod_v3.default.string().nullable(),
|
|
5953
|
+
logId: zod_v3.default.string()
|
|
5954
|
+
});
|
|
5744
5955
|
|
|
5745
5956
|
//#endregion
|
|
5746
5957
|
//#region src/lib/toolRouterParams.ts
|
|
@@ -5798,117 +6009,719 @@ const transformToolRouterToolkitsParams = (params) => {
|
|
|
5798
6009
|
};
|
|
5799
6010
|
|
|
5800
6011
|
//#endregion
|
|
5801
|
-
//#region src/
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
6012
|
+
//#region src/utils/transformers/toolRouterResponseTransform.ts
|
|
6013
|
+
function transformSearchResult(raw) {
|
|
6014
|
+
return {
|
|
6015
|
+
index: raw.index,
|
|
6016
|
+
useCase: raw.use_case,
|
|
6017
|
+
primaryToolSlugs: raw.primary_tool_slugs,
|
|
6018
|
+
relatedToolSlugs: raw.related_tool_slugs,
|
|
6019
|
+
toolkits: raw.toolkits,
|
|
6020
|
+
difficulty: raw.difficulty,
|
|
6021
|
+
error: raw.error,
|
|
6022
|
+
executionGuidance: raw.execution_guidance,
|
|
6023
|
+
knownPitfalls: raw.known_pitfalls,
|
|
6024
|
+
memory: raw.memory,
|
|
6025
|
+
planId: raw.plan_id,
|
|
6026
|
+
recommendedPlanSteps: raw.recommended_plan_steps,
|
|
6027
|
+
referenceWorkbenchSnippets: raw.reference_workbench_snippets
|
|
6028
|
+
};
|
|
6029
|
+
}
|
|
6030
|
+
function transformToolSchema(raw) {
|
|
6031
|
+
return {
|
|
6032
|
+
toolSlug: raw.tool_slug,
|
|
6033
|
+
toolkit: raw.toolkit,
|
|
6034
|
+
description: raw.description,
|
|
6035
|
+
hasFullSchema: raw.hasFullSchema,
|
|
6036
|
+
inputSchema: raw.input_schema,
|
|
6037
|
+
outputSchema: raw.output_schema,
|
|
6038
|
+
schemaRef: raw.schemaRef ? {
|
|
6039
|
+
args: { toolSlugs: raw.schemaRef.args.tool_slugs },
|
|
6040
|
+
message: raw.schemaRef.message,
|
|
6041
|
+
tool: raw.schemaRef.tool
|
|
6042
|
+
} : void 0
|
|
6043
|
+
};
|
|
6044
|
+
}
|
|
6045
|
+
function transformToolkitConnectionStatus(raw) {
|
|
6046
|
+
return {
|
|
6047
|
+
toolkit: raw.toolkit,
|
|
6048
|
+
description: raw.description,
|
|
6049
|
+
hasActiveConnection: raw.has_active_connection,
|
|
6050
|
+
statusMessage: raw.status_message,
|
|
6051
|
+
connectionDetails: raw.connection_details,
|
|
6052
|
+
currentUserInfo: raw.current_user_info
|
|
6053
|
+
};
|
|
6054
|
+
}
|
|
6055
|
+
/**
|
|
6056
|
+
* Transforms a raw session search API response to camelCase.
|
|
6057
|
+
*/
|
|
6058
|
+
function transformSearchResponse(raw) {
|
|
6059
|
+
const toolSchemas = {};
|
|
6060
|
+
for (const [slug, schema] of Object.entries(raw.tool_schemas)) toolSchemas[slug] = transformToolSchema(schema);
|
|
6061
|
+
return {
|
|
6062
|
+
success: raw.success,
|
|
6063
|
+
error: raw.error,
|
|
6064
|
+
results: raw.results.map(transformSearchResult),
|
|
6065
|
+
toolSchemas,
|
|
6066
|
+
toolkitConnectionStatuses: raw.toolkit_connection_statuses.map(transformToolkitConnectionStatus),
|
|
6067
|
+
nextStepsGuidance: raw.next_steps_guidance,
|
|
6068
|
+
session: {
|
|
6069
|
+
id: raw.session.id,
|
|
6070
|
+
generateId: raw.session.generate_id,
|
|
6071
|
+
instructions: raw.session.instructions
|
|
6072
|
+
},
|
|
6073
|
+
timeInfo: {
|
|
6074
|
+
currentTimeUtc: raw.time_info.current_time_utc,
|
|
6075
|
+
currentTimeUtcEpochSeconds: raw.time_info.current_time_utc_epoch_seconds,
|
|
6076
|
+
message: raw.time_info.message
|
|
6077
|
+
}
|
|
6078
|
+
};
|
|
6079
|
+
}
|
|
6080
|
+
/**
|
|
6081
|
+
* Transforms a raw session execute API response to camelCase.
|
|
6082
|
+
*/
|
|
6083
|
+
function transformExecuteResponse(raw) {
|
|
6084
|
+
return {
|
|
6085
|
+
data: raw.data,
|
|
6086
|
+
error: raw.error,
|
|
6087
|
+
logId: raw.log_id
|
|
6088
|
+
};
|
|
6089
|
+
}
|
|
6090
|
+
|
|
6091
|
+
//#endregion
|
|
6092
|
+
//#region src/types/ToolRouterSessionFilesMount.types.ts
|
|
6093
|
+
const ToolRouterSessionFilesMountListOptionsSchema = zod_v3.default.object({
|
|
6094
|
+
path: zod_v3.default.string().optional(),
|
|
6095
|
+
mountId: zod_v3.default.string().default(require_buffer.DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID),
|
|
6096
|
+
cursor: zod_v3.default.string().optional(),
|
|
6097
|
+
limit: zod_v3.default.number().min(1).max(500).optional()
|
|
6098
|
+
});
|
|
6099
|
+
const FileListItemSchema = zod_v3.default.object({
|
|
6100
|
+
last_modified: zod_v3.default.string(),
|
|
6101
|
+
mount_relative_path: zod_v3.default.string(),
|
|
6102
|
+
sandbox_mount_prefix: zod_v3.default.string(),
|
|
6103
|
+
size: zod_v3.default.number()
|
|
6104
|
+
});
|
|
6105
|
+
const FileListResponseSchema = zod_v3.default.object({
|
|
6106
|
+
items: zod_v3.default.array(FileListItemSchema),
|
|
6107
|
+
next_cursor: zod_v3.default.string().optional()
|
|
6108
|
+
}).transform((data) => ({
|
|
6109
|
+
items: data.items.map((item) => ({
|
|
6110
|
+
lastModified: item.last_modified,
|
|
6111
|
+
mountRelativePath: item.mount_relative_path,
|
|
6112
|
+
sandboxMountPrefix: item.sandbox_mount_prefix,
|
|
6113
|
+
size: item.size
|
|
6114
|
+
})),
|
|
6115
|
+
nextCursor: data.next_cursor
|
|
6116
|
+
}));
|
|
6117
|
+
const ToolRouterSessionFilesMountUploadOptionsSchema = zod_v3.default.object({
|
|
6118
|
+
remotePath: zod_v3.default.string().optional(),
|
|
6119
|
+
mountId: zod_v3.default.string().default(require_buffer.DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID),
|
|
6120
|
+
mimetype: zod_v3.default.string().optional()
|
|
6121
|
+
});
|
|
6122
|
+
const ToolRouterSessionFilesMountDownloadOptionsSchema = zod_v3.default.object({ mountId: zod_v3.default.string().default(require_buffer.DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID) });
|
|
6123
|
+
const ToolRouterSessionFilesMountDeleteOptionsSchema = zod_v3.default.object({ mountId: zod_v3.default.string().default(require_buffer.DEFAULT_TOOL_ROUTER_SESSION_FILES_MOUNT_ID) });
|
|
6124
|
+
const RemoteFileDataSchema = zod_v3.default.object({
|
|
6125
|
+
expires_at: zod_v3.default.string(),
|
|
6126
|
+
mount_relative_path: zod_v3.default.string(),
|
|
6127
|
+
sandbox_mount_prefix: zod_v3.default.string(),
|
|
6128
|
+
download_url: zod_v3.default.string()
|
|
6129
|
+
}).transform((data) => ({
|
|
6130
|
+
expiresAt: data.expires_at,
|
|
6131
|
+
mountRelativePath: data.mount_relative_path,
|
|
6132
|
+
sandboxMountPrefix: data.sandbox_mount_prefix,
|
|
6133
|
+
downloadUrl: data.download_url
|
|
6134
|
+
}));
|
|
6135
|
+
const FileDeleteResponseSchema = zod_v3.default.object({
|
|
6136
|
+
mount_relative_path: zod_v3.default.string(),
|
|
6137
|
+
sandbox_mount_prefix: zod_v3.default.string()
|
|
6138
|
+
}).transform((data) => ({
|
|
6139
|
+
mountRelativePath: data.mount_relative_path,
|
|
6140
|
+
sandboxMountPrefix: data.sandbox_mount_prefix
|
|
6141
|
+
}));
|
|
6142
|
+
|
|
6143
|
+
//#endregion
|
|
6144
|
+
//#region src/models/RemoteFile.ts
|
|
6145
|
+
function getParentDir(filePath) {
|
|
6146
|
+
const lastSep = Math.max(filePath.lastIndexOf("/"), filePath.lastIndexOf("\\"));
|
|
6147
|
+
if (lastSep <= 0) return "";
|
|
6148
|
+
return filePath.slice(0, lastSep);
|
|
6149
|
+
}
|
|
6150
|
+
/**
|
|
6151
|
+
* Represents a file stored in a tool router session's file mount.
|
|
6152
|
+
* Provides methods to fetch, save, and work with the file content.
|
|
6153
|
+
*
|
|
6154
|
+
* @example
|
|
6155
|
+
* ```typescript
|
|
6156
|
+
* const remoteFile = await session.files.download('/output/report.pdf');
|
|
6157
|
+
* const buffer = await remoteFile.buffer();
|
|
6158
|
+
* await remoteFile.save('/tmp/report.pdf');
|
|
6159
|
+
* const text = await remoteFile.text();
|
|
6160
|
+
* ```
|
|
6161
|
+
*
|
|
6162
|
+
* @example
|
|
6163
|
+
* ```typescript
|
|
6164
|
+
* // Create from API response (snake_case)
|
|
6165
|
+
* const remoteFile = RemoteFile.parse(apiResponse);
|
|
6166
|
+
*
|
|
6167
|
+
* // Or create from parsed data (camelCase)
|
|
6168
|
+
* const remoteFile = new RemoteFile({
|
|
6169
|
+
* expiresAt: '...',
|
|
6170
|
+
* mountRelativePath: 'report.pdf',
|
|
6171
|
+
* sandboxMountPrefix: '/mnt/files',
|
|
6172
|
+
* downloadUrl: 'https://...',
|
|
6173
|
+
* });
|
|
6174
|
+
* ```
|
|
6175
|
+
*/
|
|
6176
|
+
var RemoteFile = class RemoteFile {
|
|
6177
|
+
/** ISO 8601 timestamp when the download URL expires */
|
|
6178
|
+
expiresAt;
|
|
6179
|
+
/** Relative path within the mount (e.g. "report.pdf") */
|
|
6180
|
+
mountRelativePath;
|
|
6181
|
+
/** Absolute mount path inside the sandbox (e.g. /mnt/files) */
|
|
6182
|
+
sandboxMountPrefix;
|
|
6183
|
+
/** Presigned URL for downloading the file */
|
|
6184
|
+
downloadUrl;
|
|
6185
|
+
constructor(data) {
|
|
6186
|
+
this.expiresAt = data.expiresAt;
|
|
6187
|
+
this.mountRelativePath = data.mountRelativePath;
|
|
6188
|
+
this.sandboxMountPrefix = data.sandboxMountPrefix;
|
|
6189
|
+
this.downloadUrl = data.downloadUrl;
|
|
6190
|
+
}
|
|
6191
|
+
/**
|
|
6192
|
+
* Parses an API response (snake_case) and returns a RemoteFile instance.
|
|
6193
|
+
* @param data - Raw API response with snake_case keys
|
|
6194
|
+
* @returns A RemoteFile instance
|
|
6195
|
+
* @throws ValidationError if the response shape is invalid
|
|
6196
|
+
*/
|
|
6197
|
+
static parse(data) {
|
|
6198
|
+
const parsed = RemoteFileDataSchema.safeParse(data);
|
|
6199
|
+
if (!parsed.success) throw new ValidationError("Failed to parse remote file response", { cause: parsed.error });
|
|
6200
|
+
return new RemoteFile(parsed.data);
|
|
6201
|
+
}
|
|
6202
|
+
/** Filename extracted from the mount path (e.g. "report.pdf" from "output/report.pdf") */
|
|
6203
|
+
get filename() {
|
|
6204
|
+
return _platform.platform.basename(this.mountRelativePath);
|
|
6205
|
+
}
|
|
6206
|
+
/**
|
|
6207
|
+
* Fetches the file content as a buffer.
|
|
6208
|
+
* @returns The file content as a Uint8Array
|
|
6209
|
+
* @throws RemoteFileDownloadError if the fetch fails
|
|
6210
|
+
*/
|
|
6211
|
+
async buffer() {
|
|
6212
|
+
const response = await fetch(this.downloadUrl);
|
|
6213
|
+
if (!response.ok) throw new RemoteFileDownloadError(`Failed to download file: ${response.status} ${response.statusText}`, {
|
|
6214
|
+
statusCode: response.status,
|
|
6215
|
+
statusText: response.statusText,
|
|
6216
|
+
downloadUrl: this.downloadUrl,
|
|
6217
|
+
mountRelativePath: this.mountRelativePath,
|
|
6218
|
+
filename: this.filename,
|
|
6219
|
+
cause: /* @__PURE__ */ new Error(`HTTP ${response.status}: ${response.statusText}`)
|
|
6220
|
+
});
|
|
6221
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
6222
|
+
return new Uint8Array(arrayBuffer);
|
|
6223
|
+
}
|
|
6224
|
+
/**
|
|
6225
|
+
* Fetches the file content as UTF-8 text.
|
|
6226
|
+
* @returns The file content as a string
|
|
6227
|
+
* @throws Error if the fetch fails
|
|
6228
|
+
*/
|
|
6229
|
+
async text() {
|
|
6230
|
+
const buf = await this.buffer();
|
|
6231
|
+
return new TextDecoder().decode(buf);
|
|
5807
6232
|
}
|
|
5808
6233
|
/**
|
|
5809
|
-
*
|
|
5810
|
-
* @
|
|
5811
|
-
* @
|
|
6234
|
+
* Fetches the file content as a Blob.
|
|
6235
|
+
* @returns The file content as a Blob
|
|
6236
|
+
* @throws RemoteFileDownloadError if the fetch fails
|
|
6237
|
+
*/
|
|
6238
|
+
async blob() {
|
|
6239
|
+
const response = await fetch(this.downloadUrl);
|
|
6240
|
+
if (!response.ok) throw new RemoteFileDownloadError(`Failed to download file: ${response.status} ${response.statusText}`, {
|
|
6241
|
+
statusCode: response.status,
|
|
6242
|
+
statusText: response.statusText,
|
|
6243
|
+
downloadUrl: this.downloadUrl,
|
|
6244
|
+
mountRelativePath: this.mountRelativePath,
|
|
6245
|
+
filename: this.filename,
|
|
6246
|
+
cause: /* @__PURE__ */ new Error(`HTTP ${response.status}: ${response.statusText}`)
|
|
6247
|
+
});
|
|
6248
|
+
return response.blob();
|
|
6249
|
+
}
|
|
6250
|
+
/**
|
|
6251
|
+
* Downloads and saves the file to the local filesystem.
|
|
6252
|
+
* Requires a Node.js runtime with file system support (not available in Cloudflare Workers/Edge).
|
|
5812
6253
|
*
|
|
6254
|
+
* @param path - Local path to save the file. If omitted, saves to the Composio temp directory using the filename from the mount path.
|
|
6255
|
+
* @returns The absolute path where the file was saved
|
|
6256
|
+
* @throws Error if file system is not supported or the save fails
|
|
5813
6257
|
*/
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
6258
|
+
async save(path) {
|
|
6259
|
+
if (!_platform.platform.supportsFileSystem) throw new Error("File system operations are not supported in this runtime (e.g. Cloudflare Workers). Use buffer(), text(), or blob() to work with the file content in memory, or run in Node.js.");
|
|
6260
|
+
const content = await this.buffer();
|
|
6261
|
+
const homeDir = _platform.platform.homedir();
|
|
6262
|
+
if (!homeDir) throw new Error("Cannot determine save location: home directory is not available");
|
|
6263
|
+
const savePath = path ?? _platform.platform.joinPath(homeDir, require_buffer.COMPOSIO_DIR, require_buffer.TEMP_FILES_DIRECTORY_NAME, this.filename);
|
|
6264
|
+
const dir = path != null ? getParentDir(savePath) : _platform.platform.joinPath(homeDir, require_buffer.COMPOSIO_DIR, require_buffer.TEMP_FILES_DIRECTORY_NAME);
|
|
6265
|
+
if (dir && !_platform.platform.existsSync(dir)) _platform.platform.mkdirSync(dir);
|
|
6266
|
+
_platform.platform.writeFileSync(savePath, content);
|
|
6267
|
+
return savePath;
|
|
6268
|
+
}
|
|
6269
|
+
};
|
|
6270
|
+
|
|
6271
|
+
//#endregion
|
|
6272
|
+
//#region src/utils/mime.ts
|
|
6273
|
+
/**
|
|
6274
|
+
* Maps MIME types to file extensions.
|
|
6275
|
+
* Used when deriving filenames from content-type headers (e.g. for URLs without path segments).
|
|
6276
|
+
*/
|
|
6277
|
+
function getExtensionFromMimeType(mimeType) {
|
|
6278
|
+
const mimeToExt = {
|
|
6279
|
+
"text/plain": "txt",
|
|
6280
|
+
"text/html": "html",
|
|
6281
|
+
"text/css": "css",
|
|
6282
|
+
"text/javascript": "js",
|
|
6283
|
+
"application/json": "json",
|
|
6284
|
+
"application/xml": "xml",
|
|
6285
|
+
"application/pdf": "pdf",
|
|
6286
|
+
"application/zip": "zip",
|
|
6287
|
+
"application/x-zip-compressed": "zip",
|
|
6288
|
+
"application/gzip": "gz",
|
|
6289
|
+
"application/octet-stream": "bin",
|
|
6290
|
+
"application/x-tar": "tar",
|
|
6291
|
+
"application/msword": "doc",
|
|
6292
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
6293
|
+
"application/vnd.ms-excel": "xls",
|
|
6294
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
6295
|
+
"application/vnd.ms-powerpoint": "ppt",
|
|
6296
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
|
|
6297
|
+
"image/jpeg": "jpg",
|
|
6298
|
+
"image/jpg": "jpg",
|
|
6299
|
+
"image/png": "png",
|
|
6300
|
+
"image/gif": "gif",
|
|
6301
|
+
"image/svg+xml": "svg",
|
|
6302
|
+
"image/webp": "webp",
|
|
6303
|
+
"image/bmp": "bmp",
|
|
6304
|
+
"image/tiff": "tiff",
|
|
6305
|
+
"audio/mpeg": "mp3",
|
|
6306
|
+
"audio/wav": "wav",
|
|
6307
|
+
"audio/ogg": "ogg",
|
|
6308
|
+
"video/mp4": "mp4",
|
|
6309
|
+
"video/mpeg": "mpeg",
|
|
6310
|
+
"video/quicktime": "mov",
|
|
6311
|
+
"video/x-msvideo": "avi",
|
|
6312
|
+
"video/webm": "webm"
|
|
5823
6313
|
};
|
|
6314
|
+
const cleanMimeType = mimeType.split(";")[0].toLowerCase().trim();
|
|
6315
|
+
if (mimeToExt[cleanMimeType]) return mimeToExt[cleanMimeType];
|
|
6316
|
+
const parts = cleanMimeType.split("/");
|
|
6317
|
+
if (parts.length === 2) {
|
|
6318
|
+
const subtype = parts[1].toLowerCase();
|
|
6319
|
+
if (subtype.includes("+")) {
|
|
6320
|
+
const plusParts = subtype.split("+");
|
|
6321
|
+
const prefix = plusParts[0];
|
|
6322
|
+
const suffix = plusParts[plusParts.length - 1];
|
|
6323
|
+
if ([
|
|
6324
|
+
"svg",
|
|
6325
|
+
"atom",
|
|
6326
|
+
"rss"
|
|
6327
|
+
].includes(prefix)) return prefix;
|
|
6328
|
+
if ([
|
|
6329
|
+
"json",
|
|
6330
|
+
"xml",
|
|
6331
|
+
"yaml",
|
|
6332
|
+
"zip",
|
|
6333
|
+
"gzip"
|
|
6334
|
+
].includes(suffix)) return suffix;
|
|
6335
|
+
return suffix;
|
|
6336
|
+
}
|
|
6337
|
+
return subtype || "txt";
|
|
6338
|
+
}
|
|
6339
|
+
return "bin";
|
|
6340
|
+
}
|
|
6341
|
+
|
|
6342
|
+
//#endregion
|
|
6343
|
+
//#region src/models/ToolRouterSessionFileMount.ts
|
|
6344
|
+
var ToolRouterSessionFilesMount = class {
|
|
6345
|
+
sessionId;
|
|
6346
|
+
client;
|
|
6347
|
+
constructor(client, sessionId) {
|
|
6348
|
+
this.client = client;
|
|
6349
|
+
this.sessionId = sessionId;
|
|
6350
|
+
require_Telemetry.telemetry.instrument(this, "ToolRouterSessionFiles");
|
|
6351
|
+
}
|
|
5824
6352
|
/**
|
|
6353
|
+
* Lists files and directories at the specified path on the session's file mount.
|
|
6354
|
+
*
|
|
6355
|
+
* Use this to browse the virtual filesystem attached to the tool router session.
|
|
6356
|
+
* The path is relative to the mount root (e.g., `"/"` for root, `"/documents"` for a subdirectory).
|
|
6357
|
+
* Supports cursor-based pagination via `cursor` and `limit` options.
|
|
5825
6358
|
*
|
|
5826
|
-
* @param
|
|
5827
|
-
* @
|
|
6359
|
+
* @param options - Optional configuration for the list operation.
|
|
6360
|
+
* @param options.path - The directory path to list. Use `"/"` for the mount root.
|
|
6361
|
+
* @param options.mountId - The ID of the file mount to operate on. Defaults to `"files"` when omitted.
|
|
6362
|
+
* @param options.cursor - Pagination cursor from the previous response's nextCursor field.
|
|
6363
|
+
* @param options.limit - Maximum number of files to return per page (1-500).
|
|
6364
|
+
* @returns List of files with nextCursor for pagination.
|
|
5828
6365
|
*
|
|
5829
6366
|
* @example
|
|
5830
6367
|
* ```typescript
|
|
5831
|
-
* import { Composio } from '@composio/core';
|
|
5832
|
-
*
|
|
5833
|
-
* const composio = new Composio();
|
|
5834
6368
|
* const session = await composio.toolRouter.use('session_123');
|
|
6369
|
+
* const { items, nextCursor } = await session.files.list({ path: '/' });
|
|
6370
|
+
* ```
|
|
5835
6371
|
*
|
|
5836
|
-
*
|
|
5837
|
-
*
|
|
6372
|
+
* @example
|
|
6373
|
+
* ```typescript
|
|
6374
|
+
* // Paginated listing
|
|
6375
|
+
* let result = await session.files.list({ path: '/', limit: 10 });
|
|
6376
|
+
* while (result.nextCursor) {
|
|
6377
|
+
* result = await session.files.list({ path: '/', cursor: result.nextCursor, limit: 10 });
|
|
6378
|
+
* }
|
|
5838
6379
|
* ```
|
|
5839
6380
|
*/
|
|
5840
|
-
|
|
5841
|
-
const
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
6381
|
+
async list(options) {
|
|
6382
|
+
const listOptions = ToolRouterSessionFilesMountListOptionsSchema.safeParse(options ?? {});
|
|
6383
|
+
if (!listOptions.success) throw new ValidationError("Failed to parse tool router session files mount list options", { cause: listOptions.error });
|
|
6384
|
+
const rawPath = listOptions.data.path;
|
|
6385
|
+
const mountRelativePrefix = rawPath === void 0 || rawPath === "" || rawPath === "/" ? void 0 : rawPath.startsWith("/") ? rawPath.slice(1) : rawPath;
|
|
6386
|
+
const response = await this.client.toolRouter.session.files.list(listOptions.data.mountId, {
|
|
6387
|
+
session_id: this.sessionId,
|
|
6388
|
+
mount_relative_prefix: mountRelativePrefix,
|
|
6389
|
+
cursor: listOptions.data.cursor,
|
|
6390
|
+
limit: listOptions.data.limit
|
|
6391
|
+
});
|
|
6392
|
+
const data = typeof response === "object" && "body" in response ? response.body : response;
|
|
6393
|
+
const parsed = FileListResponseSchema.safeParse(data);
|
|
6394
|
+
if (!parsed.success) throw new ValidationError("Failed to parse file list response", { cause: parsed.error });
|
|
6395
|
+
return parsed.data;
|
|
6396
|
+
}
|
|
6397
|
+
async normalizeUploadInput(input, options) {
|
|
6398
|
+
if (typeof input === "string") {
|
|
6399
|
+
if (input.startsWith("http://") || input.startsWith("https://")) {
|
|
6400
|
+
const response = await fetch(input);
|
|
6401
|
+
if (!response.ok) throw new Error(`Failed to fetch file from URL: ${response.statusText}`);
|
|
6402
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
6403
|
+
const mimeType = (response.headers.get("content-type") || "application/octet-stream").split(";")[0].trim();
|
|
6404
|
+
const segments = new URL(input).pathname.split("/").filter(Boolean);
|
|
6405
|
+
let filename$1 = segments.length > 0 ? segments[segments.length - 1] : "";
|
|
6406
|
+
if (!filename$1 || !filename$1.includes(".")) {
|
|
6407
|
+
const extension = getExtensionFromMimeType(mimeType);
|
|
6408
|
+
filename$1 = `${require_buffer.getRandomShortId()}.${extension}`;
|
|
6409
|
+
}
|
|
6410
|
+
return {
|
|
6411
|
+
fileToUpload: new File([arrayBuffer], filename$1, { type: mimeType }),
|
|
6412
|
+
remotePath: options.remotePath ?? filename$1,
|
|
6413
|
+
mimetype: mimeType
|
|
6414
|
+
};
|
|
6415
|
+
}
|
|
6416
|
+
const content = _platform.platform.readFileSync(input);
|
|
6417
|
+
const buffer$1 = content instanceof Uint8Array ? new Uint8Array(content) : new TextEncoder().encode(content);
|
|
6418
|
+
const filename = _platform.platform.basename(input);
|
|
6419
|
+
const mimetype$1 = options.mimetype ?? "application/octet-stream";
|
|
5851
6420
|
return {
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
name: item$1.name,
|
|
5856
|
-
logo: item$1.meta?.logo,
|
|
5857
|
-
isNoAuth: item$1.is_no_auth,
|
|
5858
|
-
connection: item$1.is_no_auth ? void 0 : {
|
|
5859
|
-
isActive: item$1.connected_account?.status === "ACTIVE",
|
|
5860
|
-
authConfig: item$1.connected_account && {
|
|
5861
|
-
id: item$1.connected_account?.auth_config.id,
|
|
5862
|
-
mode: item$1.connected_account?.auth_config.auth_scheme,
|
|
5863
|
-
isComposioManaged: item$1.connected_account?.auth_config.is_composio_managed
|
|
5864
|
-
},
|
|
5865
|
-
connectedAccount: item$1.connected_account ? {
|
|
5866
|
-
id: item$1.connected_account.id,
|
|
5867
|
-
status: item$1.connected_account.status
|
|
5868
|
-
} : void 0
|
|
5869
|
-
}
|
|
5870
|
-
}));
|
|
5871
|
-
}),
|
|
5872
|
-
nextCursor: result.next_cursor,
|
|
5873
|
-
totalPages: result.total_pages
|
|
6421
|
+
fileToUpload: new File([buffer$1], filename, { type: mimetype$1 }),
|
|
6422
|
+
remotePath: options.remotePath ?? filename,
|
|
6423
|
+
mimetype: mimetype$1
|
|
5874
6424
|
};
|
|
6425
|
+
}
|
|
6426
|
+
if (input instanceof File) return {
|
|
6427
|
+
fileToUpload: input,
|
|
6428
|
+
remotePath: options.remotePath ?? (input.name || `upload-${require_buffer.getRandomShortId()}.bin`),
|
|
6429
|
+
mimetype: input.type || "application/octet-stream"
|
|
5875
6430
|
};
|
|
5876
|
-
|
|
5877
|
-
|
|
6431
|
+
const buffer = input instanceof ArrayBuffer ? new Uint8Array(input) : input;
|
|
6432
|
+
if (!options.mimetype && !options.remotePath) throw new Error("When passing a buffer, either mimetype or remotePath (filename) is required. Example: files.upload(buffer, { remotePath: \"data.json\", mimetype: \"application/json\" })");
|
|
6433
|
+
const mimetype = options.mimetype ?? "application/octet-stream";
|
|
6434
|
+
const ext = getExtensionFromMimeType(mimetype);
|
|
6435
|
+
const remotePath = options.remotePath ?? `upload-${require_buffer.getRandomShortId()}.${ext}`;
|
|
6436
|
+
return {
|
|
6437
|
+
fileToUpload: new File([buffer], remotePath, { type: mimetype }),
|
|
6438
|
+
remotePath,
|
|
6439
|
+
mimetype
|
|
6440
|
+
};
|
|
6441
|
+
}
|
|
5878
6442
|
/**
|
|
5879
|
-
*
|
|
5880
|
-
*
|
|
5881
|
-
*
|
|
6443
|
+
* Uploads a file to the session's file mount.
|
|
6444
|
+
*
|
|
6445
|
+
* Accepts a file path (local or URL), a native File object, or a raw buffer.
|
|
6446
|
+
* The file is stored in the virtual filesystem associated with the tool router session.
|
|
6447
|
+
*
|
|
6448
|
+
* @param input - File path (string), native File, or raw buffer (ArrayBuffer | Uint8Array).
|
|
6449
|
+
* @param options - Optional configuration. When passing a buffer, remotePath is required.
|
|
6450
|
+
* @returns Metadata about the uploaded file.
|
|
6451
|
+
*
|
|
6452
|
+
* @example
|
|
6453
|
+
* ```typescript
|
|
6454
|
+
* // From file path (local or URL)
|
|
6455
|
+
* await session.files.upload('/path/to/report.pdf');
|
|
6456
|
+
* await session.files.upload('https://example.com/file.pdf');
|
|
6457
|
+
* ```
|
|
6458
|
+
*
|
|
6459
|
+
* @example
|
|
6460
|
+
* ```typescript
|
|
6461
|
+
* // From native File (e.g. from input[type=file])
|
|
6462
|
+
* await session.files.upload(fileInput.files[0]);
|
|
6463
|
+
* ```
|
|
5882
6464
|
*
|
|
5883
|
-
* @
|
|
5884
|
-
*
|
|
6465
|
+
* @example
|
|
6466
|
+
* ```typescript
|
|
6467
|
+
* // From raw buffer
|
|
6468
|
+
* await session.files.upload(buffer, { remotePath: 'data.json', mimetype: 'application/json' });
|
|
6469
|
+
* ```
|
|
5885
6470
|
*/
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
6471
|
+
async upload(input, options) {
|
|
6472
|
+
const uploadOptions = ToolRouterSessionFilesMountUploadOptionsSchema.safeParse(options ?? {});
|
|
6473
|
+
if (!uploadOptions.success) throw new ValidationError("Failed to parse tool router session files mount upload options", { cause: uploadOptions.error });
|
|
6474
|
+
const { fileToUpload, remotePath, mimetype } = await this.normalizeUploadInput(input, uploadOptions.data);
|
|
6475
|
+
const createUploadURLResponse = await this.client.toolRouter.session.files.createUploadURL(uploadOptions.data.mountId, {
|
|
6476
|
+
session_id: this.sessionId,
|
|
6477
|
+
mount_relative_path: remotePath,
|
|
6478
|
+
mimetype
|
|
6479
|
+
});
|
|
6480
|
+
const uploadURLData = typeof createUploadURLResponse === "object" && "body" in createUploadURLResponse ? createUploadURLResponse.body : createUploadURLResponse;
|
|
6481
|
+
const uploadResponse = await fetch(uploadURLData.upload_url, {
|
|
6482
|
+
method: "PUT",
|
|
6483
|
+
body: await fileToUpload.arrayBuffer(),
|
|
6484
|
+
headers: { "Content-Type": mimetype }
|
|
6485
|
+
});
|
|
6486
|
+
if (!uploadResponse.ok) throw new Error(`Failed to upload file: ${uploadResponse.statusText}`);
|
|
6487
|
+
const createDownloadURLResponse = await this.client.toolRouter.session.files.createDownloadURL(uploadOptions.data.mountId, {
|
|
6488
|
+
session_id: this.sessionId,
|
|
6489
|
+
mount_relative_path: uploadURLData.mount_relative_path
|
|
6490
|
+
});
|
|
6491
|
+
const downloadData = typeof createDownloadURLResponse === "object" && "body" in createDownloadURLResponse ? createDownloadURLResponse.body : createDownloadURLResponse;
|
|
6492
|
+
const parsed = RemoteFileDataSchema.safeParse(downloadData);
|
|
6493
|
+
if (!parsed.success) throw new ValidationError("Failed to parse remote file properties", { cause: parsed.error });
|
|
6494
|
+
return new RemoteFile(parsed.data);
|
|
6495
|
+
}
|
|
6496
|
+
/**
|
|
6497
|
+
* Downloads a file from the session's file mount to the local filesystem.
|
|
6498
|
+
*
|
|
6499
|
+
* Retrieves a file stored in the session's virtual filesystem (e.g., one produced
|
|
6500
|
+
* by a tool or previously uploaded) and saves it to the specified local path.
|
|
6501
|
+
*
|
|
6502
|
+
* @param filePath - The path of the file on the mount to download, or the local path where the file should be saved (implementation-specific).
|
|
6503
|
+
* @param options - Optional configuration for the download.
|
|
6504
|
+
* @param options.mountId - The ID of the file mount to download from. Defaults to `"files"` when omitted.
|
|
6505
|
+
* @returns The downloaded file data or path (implementation-specific).
|
|
6506
|
+
*
|
|
6507
|
+
* @example
|
|
6508
|
+
* ```typescript
|
|
6509
|
+
* const session = await composio.toolRouter.use('session_123');
|
|
6510
|
+
* const result = await session.files.download('/output/report.pdf');
|
|
6511
|
+
* ```
|
|
6512
|
+
*
|
|
6513
|
+
* @example
|
|
6514
|
+
* ```typescript
|
|
6515
|
+
* // Download from a custom mount
|
|
6516
|
+
* await session.files.download('/exports/data.json', {
|
|
6517
|
+
* mountId: 'custom-mount',
|
|
6518
|
+
* });
|
|
6519
|
+
* ```
|
|
6520
|
+
*/
|
|
6521
|
+
async download(filePath, options) {
|
|
6522
|
+
const downloadOptions = ToolRouterSessionFilesMountDownloadOptionsSchema.safeParse(options ?? {});
|
|
6523
|
+
if (!downloadOptions.success) throw new ValidationError("Failed to parse tool router session files mount download options", { cause: downloadOptions.error });
|
|
6524
|
+
const createDownloadURLResponse = await this.client.toolRouter.session.files.createDownloadURL(downloadOptions.data.mountId, {
|
|
6525
|
+
session_id: this.sessionId,
|
|
6526
|
+
mount_relative_path: filePath
|
|
6527
|
+
});
|
|
6528
|
+
const downloadURLData = typeof createDownloadURLResponse === "object" && "body" in createDownloadURLResponse ? createDownloadURLResponse.body : createDownloadURLResponse;
|
|
6529
|
+
const parsed = RemoteFileDataSchema.safeParse(downloadURLData);
|
|
6530
|
+
if (!parsed.success) throw new ValidationError("Failed to parse remote file properties", { cause: parsed.error });
|
|
6531
|
+
return new RemoteFile(parsed.data);
|
|
6532
|
+
}
|
|
6533
|
+
/**
|
|
6534
|
+
* Deletes a file or directory at the specified path on the session's file mount.
|
|
6535
|
+
*
|
|
6536
|
+
* Removes the file or directory from the virtual filesystem. Use with caution:
|
|
6537
|
+
* deletion is typically irreversible. Ensure the path exists and is intended for removal.
|
|
6538
|
+
*
|
|
6539
|
+
* @param remotePath - The path of the file or directory to delete on the mount.
|
|
6540
|
+
* @param options - Optional configuration for the delete operation.
|
|
6541
|
+
* @param options.mountId - The ID of the file mount to operate on. Defaults to `"files"` when omitted.
|
|
6542
|
+
* @returns Confirmation of deletion (implementation-specific).
|
|
6543
|
+
*
|
|
6544
|
+
* @example
|
|
6545
|
+
* ```typescript
|
|
6546
|
+
* const session = await composio.toolRouter.use('session_123');
|
|
6547
|
+
* await session.files.delete('/temp/cache.json');
|
|
6548
|
+
* ```
|
|
6549
|
+
*
|
|
6550
|
+
* @example
|
|
6551
|
+
* ```typescript
|
|
6552
|
+
* // Delete from a custom mount
|
|
6553
|
+
* await session.files.delete('/old-backup', {
|
|
6554
|
+
* mountId: 'custom-mount',
|
|
6555
|
+
* });
|
|
6556
|
+
* ```
|
|
6557
|
+
*
|
|
6558
|
+
* @warning This operation is destructive. Deleted files cannot be recovered.
|
|
6559
|
+
*/
|
|
6560
|
+
async delete(remotePath, options) {
|
|
6561
|
+
const deleteOptions = ToolRouterSessionFilesMountDeleteOptionsSchema.safeParse(options ?? {});
|
|
6562
|
+
if (!deleteOptions.success) throw new ValidationError("Failed to parse tool router session files mount delete options", { cause: deleteOptions.error });
|
|
6563
|
+
const deleteResponse = await this.client.toolRouter.session.files.delete(deleteOptions.data.mountId, {
|
|
6564
|
+
session_id: this.sessionId,
|
|
6565
|
+
mount_relative_path: remotePath
|
|
6566
|
+
});
|
|
6567
|
+
const fileDeleteResponse = FileDeleteResponseSchema.safeParse(deleteResponse);
|
|
6568
|
+
if (!fileDeleteResponse.success) throw new ValidationError("Failed to parse file delete response", { cause: fileDeleteResponse.error });
|
|
6569
|
+
return fileDeleteResponse.data;
|
|
6570
|
+
}
|
|
6571
|
+
};
|
|
6572
|
+
|
|
6573
|
+
//#endregion
|
|
6574
|
+
//#region src/models/ToolRouterSession.ts
|
|
6575
|
+
var ToolRouterSession = class {
|
|
6576
|
+
sessionId;
|
|
6577
|
+
mcp;
|
|
6578
|
+
files;
|
|
6579
|
+
constructor(client, config, sessionId, mcp, experimental) {
|
|
6580
|
+
this.client = client;
|
|
6581
|
+
this.config = config;
|
|
6582
|
+
this.experimental = experimental;
|
|
6583
|
+
this.sessionId = sessionId;
|
|
6584
|
+
this.mcp = mcp;
|
|
6585
|
+
this.files = new ToolRouterSessionFilesMount(client, sessionId);
|
|
6586
|
+
require_Telemetry.telemetry.instrument(this, "ToolRouterSession");
|
|
6587
|
+
}
|
|
6588
|
+
/**
|
|
6589
|
+
* Get the tools available in the session, formatted for your AI framework.
|
|
6590
|
+
* Requires a provider to be configured in the Composio constructor.
|
|
6591
|
+
*/
|
|
6592
|
+
async tools(modifiers) {
|
|
6593
|
+
const ToolsModel = new Tools(this.client, this.config);
|
|
6594
|
+
const tools = await ToolsModel.getRawToolRouterMetaTools(this.sessionId, modifiers?.modifySchema ? { modifySchema: modifiers.modifySchema } : void 0);
|
|
6595
|
+
return ToolsModel.wrapToolsForToolRouter(this.sessionId, tools, modifiers);
|
|
6596
|
+
}
|
|
6597
|
+
/**
|
|
6598
|
+
* Initiate an authorization flow for a toolkit.
|
|
6599
|
+
* Returns a ConnectionRequest with a redirect URL for the user.
|
|
6600
|
+
*/
|
|
6601
|
+
async authorize(toolkit, options) {
|
|
6602
|
+
const response = await this.client.toolRouter.session.link(this.sessionId, {
|
|
6603
|
+
...options?.callbackUrl ? { callback_url: options.callbackUrl } : {},
|
|
6604
|
+
toolkit
|
|
6605
|
+
});
|
|
6606
|
+
return createConnectionRequest(this.client, response.connected_account_id, ConnectedAccountStatuses.INITIATED, response.redirect_url);
|
|
6607
|
+
}
|
|
6608
|
+
/**
|
|
6609
|
+
* Query the connection state of toolkits in the session.
|
|
6610
|
+
* Supports pagination and filtering by toolkit slugs.
|
|
6611
|
+
*/
|
|
6612
|
+
async toolkits(options) {
|
|
6613
|
+
const toolkitOptions = ToolRouterToolkitsOptionsSchema.safeParse(options ?? {});
|
|
6614
|
+
if (!toolkitOptions.success) throw new ValidationError("Failed to parse toolkits options", { cause: toolkitOptions.error });
|
|
6615
|
+
const result = await this.client.toolRouter.session.toolkits(this.sessionId, {
|
|
6616
|
+
cursor: toolkitOptions.data.nextCursor,
|
|
6617
|
+
limit: toolkitOptions.data.limit,
|
|
6618
|
+
toolkits: toolkitOptions.data.toolkits,
|
|
6619
|
+
is_connected: toolkitOptions.data.isConnected,
|
|
6620
|
+
search: toolkitOptions.data.search
|
|
6621
|
+
});
|
|
6622
|
+
return {
|
|
6623
|
+
items: result.items.map((item) => {
|
|
6624
|
+
return transform(item).with(ToolkitConnectionStateSchema).using((item$1) => ({
|
|
6625
|
+
slug: item$1.slug,
|
|
6626
|
+
name: item$1.name,
|
|
6627
|
+
logo: item$1.meta?.logo,
|
|
6628
|
+
isNoAuth: item$1.is_no_auth,
|
|
6629
|
+
connection: item$1.is_no_auth ? void 0 : {
|
|
6630
|
+
isActive: item$1.connected_account?.status === "ACTIVE",
|
|
6631
|
+
authConfig: item$1.connected_account && {
|
|
6632
|
+
id: item$1.connected_account?.auth_config.id,
|
|
6633
|
+
mode: item$1.connected_account?.auth_config.auth_scheme,
|
|
6634
|
+
isComposioManaged: item$1.connected_account?.auth_config.is_composio_managed
|
|
6635
|
+
},
|
|
6636
|
+
connectedAccount: item$1.connected_account ? {
|
|
6637
|
+
id: item$1.connected_account.id,
|
|
6638
|
+
status: item$1.connected_account.status
|
|
6639
|
+
} : void 0
|
|
6640
|
+
}
|
|
6641
|
+
}));
|
|
6642
|
+
}),
|
|
6643
|
+
nextCursor: result.next_cursor ?? void 0,
|
|
6644
|
+
totalPages: result.total_pages
|
|
5891
6645
|
};
|
|
5892
|
-
}
|
|
6646
|
+
}
|
|
6647
|
+
/**
|
|
6648
|
+
* Search for tools by semantic use case.
|
|
6649
|
+
* Returns relevant tools for the given query with schemas and guidance.
|
|
6650
|
+
*
|
|
6651
|
+
* @param params - Search parameters
|
|
6652
|
+
* @param params.query - Semantic use-case query (e.g. "send emails", "create GitHub issues")
|
|
6653
|
+
* @param params.toolkits - Optional toolkit slugs to filter by
|
|
6654
|
+
* @returns Search results with matching tools and schemas
|
|
6655
|
+
*
|
|
6656
|
+
* @example
|
|
6657
|
+
* ```typescript
|
|
6658
|
+
* const session = await composio.toolRouter.use('session_123');
|
|
6659
|
+
* const results = await session.search({
|
|
6660
|
+
* query: 'send emails and notify Slack',
|
|
6661
|
+
* toolkits: ['gmail', 'slack'],
|
|
6662
|
+
* });
|
|
6663
|
+
* ```
|
|
6664
|
+
*/
|
|
6665
|
+
async search(params) {
|
|
6666
|
+
const transformed = transformSearchResponse(await this.client.toolRouter.session.search(this.sessionId, {
|
|
6667
|
+
queries: [{ use_case: params.query }],
|
|
6668
|
+
...params.toolkits?.length ? { toolkits: params.toolkits } : {}
|
|
6669
|
+
}));
|
|
6670
|
+
return ToolRouterSessionSearchResponseSchema.parse(transformed);
|
|
6671
|
+
}
|
|
5893
6672
|
/**
|
|
5894
|
-
*
|
|
5895
|
-
*
|
|
5896
|
-
* @param
|
|
5897
|
-
* @
|
|
6673
|
+
* Execute a tool within the session.
|
|
6674
|
+
*
|
|
6675
|
+
* @param toolSlug - The tool slug to execute (e.g. "GMAIL_SEND_EMAIL")
|
|
6676
|
+
* @param arguments_ - Optional tool arguments. Defaults to empty object if omitted.
|
|
6677
|
+
* @returns The tool execution result
|
|
6678
|
+
*
|
|
6679
|
+
* @example
|
|
6680
|
+
* ```typescript
|
|
6681
|
+
* const session = await composio.toolRouter.use('session_123');
|
|
6682
|
+
* const result = await session.execute('GMAIL_SEND_EMAIL', {
|
|
6683
|
+
* to: 'user@example.com',
|
|
6684
|
+
* subject: 'Hello',
|
|
6685
|
+
* body: 'Hi!',
|
|
6686
|
+
* });
|
|
6687
|
+
* ```
|
|
6688
|
+
*
|
|
6689
|
+
* @example
|
|
6690
|
+
* ```typescript
|
|
6691
|
+
* // Execute with no arguments
|
|
6692
|
+
* const result = await session.execute('HACKERNEWS_GET_USER');
|
|
6693
|
+
* ```
|
|
5898
6694
|
*/
|
|
5899
|
-
|
|
6695
|
+
async execute(toolSlug, arguments_) {
|
|
6696
|
+
const transformed = transformExecuteResponse(await this.client.toolRouter.session.execute(this.sessionId, {
|
|
6697
|
+
tool_slug: toolSlug,
|
|
6698
|
+
arguments: arguments_ ?? {}
|
|
6699
|
+
}));
|
|
6700
|
+
return ToolRouterSessionExecuteResponseSchema.parse(transformed);
|
|
6701
|
+
}
|
|
6702
|
+
};
|
|
6703
|
+
|
|
6704
|
+
//#endregion
|
|
6705
|
+
//#region src/models/ToolRouter.ts
|
|
6706
|
+
var ToolRouter = class {
|
|
6707
|
+
constructor(client, config) {
|
|
6708
|
+
this.client = client;
|
|
6709
|
+
this.config = config;
|
|
6710
|
+
require_Telemetry.telemetry.instrument(this, "ToolRouter");
|
|
6711
|
+
}
|
|
6712
|
+
createMCPServerConfig({ type, url }) {
|
|
5900
6713
|
return {
|
|
5901
6714
|
type,
|
|
5902
6715
|
url,
|
|
5903
|
-
headers: { ...this.config?.apiKey ? { "x-api-key": this.config
|
|
6716
|
+
headers: { ...this.config?.apiKey ? { "x-api-key": this.config.apiKey } : {} }
|
|
5904
6717
|
};
|
|
5905
|
-
}
|
|
6718
|
+
}
|
|
5906
6719
|
/**
|
|
5907
6720
|
* Creates a new tool router session for a user.
|
|
5908
6721
|
*
|
|
5909
6722
|
* @param userId {string} The user id to create the session for
|
|
5910
6723
|
* @param config {ToolRouterCreateSessionConfig} The config for the tool router session
|
|
5911
|
-
* @returns {Promise<
|
|
6724
|
+
* @returns {Promise<Session<TToolCollection, TTool, TProvider>>} The tool router session
|
|
5912
6725
|
*
|
|
5913
6726
|
* @example
|
|
5914
6727
|
* ```typescript
|
|
@@ -5953,19 +6766,12 @@ var ToolRouter = class {
|
|
|
5953
6766
|
};
|
|
5954
6767
|
const session = await this.client.toolRouter.session.create(payload);
|
|
5955
6768
|
const experimental = session.experimental ? { assistivePrompt: session.experimental.assistive_prompt } : void 0;
|
|
5956
|
-
return
|
|
5957
|
-
sessionId: session.session_id,
|
|
5958
|
-
mcp: this.createMCPServerConfig(session.mcp),
|
|
5959
|
-
tools: this.createToolsFn(session.session_id),
|
|
5960
|
-
authorize: this.createAuthorizeFn(session.session_id),
|
|
5961
|
-
toolkits: this.createToolkitsFn(session.session_id),
|
|
5962
|
-
experimental
|
|
5963
|
-
};
|
|
6769
|
+
return new ToolRouterSession(this.client, this.config, session.session_id, this.createMCPServerConfig(session.mcp), experimental);
|
|
5964
6770
|
}
|
|
5965
6771
|
/**
|
|
5966
6772
|
* Use an existing session
|
|
5967
6773
|
* @param id {string} The id of the session to use
|
|
5968
|
-
* @returns {Promise<
|
|
6774
|
+
* @returns {Promise<Session<TToolCollection, TTool, TProvider>>} The tool router session
|
|
5969
6775
|
*
|
|
5970
6776
|
* @example
|
|
5971
6777
|
* ```typescript
|
|
@@ -5981,13 +6787,7 @@ var ToolRouter = class {
|
|
|
5981
6787
|
*/
|
|
5982
6788
|
async use(id) {
|
|
5983
6789
|
const session = await this.client.toolRouter.session.retrieve(id);
|
|
5984
|
-
return
|
|
5985
|
-
sessionId: session.session_id,
|
|
5986
|
-
mcp: this.createMCPServerConfig(session.mcp),
|
|
5987
|
-
tools: this.createToolsFn(session.session_id),
|
|
5988
|
-
authorize: this.createAuthorizeFn(session.session_id),
|
|
5989
|
-
toolkits: this.createToolkitsFn(session.session_id)
|
|
5990
|
-
};
|
|
6790
|
+
return new ToolRouterSession(this.client, this.config, session.session_id, this.createMCPServerConfig(session.mcp));
|
|
5991
6791
|
}
|
|
5992
6792
|
};
|
|
5993
6793
|
|
|
@@ -6037,7 +6837,7 @@ var Composio = class Composio {
|
|
|
6037
6837
|
*
|
|
6038
6838
|
* @param userId {string} The user id to create the session for
|
|
6039
6839
|
* @param config {ToolRouterConfig} The config for the tool router session
|
|
6040
|
-
* @returns {Promise<
|
|
6840
|
+
* @returns {Promise<Session<TToolCollection, TTool, TProvider>>} The tool router session
|
|
6041
6841
|
*
|
|
6042
6842
|
* @example
|
|
6043
6843
|
* ```typescript
|
|
@@ -6060,7 +6860,7 @@ var Composio = class Composio {
|
|
|
6060
6860
|
* Use an existing tool router session
|
|
6061
6861
|
*
|
|
6062
6862
|
* @param id {string} The id of the session to use
|
|
6063
|
-
* @returns {Promise<
|
|
6863
|
+
* @returns {Promise<Session<TToolCollection, TTool, TProvider>>} The tool router session
|
|
6064
6864
|
*/
|
|
6065
6865
|
use;
|
|
6066
6866
|
/**
|
|
@@ -6464,6 +7264,136 @@ var AuthScheme = class {
|
|
|
6464
7264
|
}
|
|
6465
7265
|
};
|
|
6466
7266
|
|
|
7267
|
+
//#endregion
|
|
7268
|
+
//#region src/types/webhookEvents.types.ts
|
|
7269
|
+
const WebhookEventTypes = {
|
|
7270
|
+
CONNECTION_EXPIRED: "composio.connected_account.expired",
|
|
7271
|
+
TRIGGER_MESSAGE: "composio.trigger.message"
|
|
7272
|
+
};
|
|
7273
|
+
/**
|
|
7274
|
+
* Auth config schema for webhook payloads (raw API format, snake_case).
|
|
7275
|
+
*
|
|
7276
|
+
* This intentionally does NOT reuse ConnectedAccountAuthConfigSchema from
|
|
7277
|
+
* connectedAccounts.types.ts because:
|
|
7278
|
+
* - Webhook payloads arrive in raw snake_case (is_composio_managed, is_disabled)
|
|
7279
|
+
* while the SDK schema uses camelCase (isComposioManaged, isDisabled)
|
|
7280
|
+
* - Webhook payloads include additional fields (auth_scheme, deprecated)
|
|
7281
|
+
* not present in the SDK schema
|
|
7282
|
+
*
|
|
7283
|
+
* Uses .passthrough() to accept unknown fields the API may add in the future.
|
|
7284
|
+
*
|
|
7285
|
+
* @see ConnectedAccountAuthConfigSchema in connectedAccounts.types.ts for the camelCase SDK version
|
|
7286
|
+
*/
|
|
7287
|
+
const WebhookConnectedAccountAuthConfigSchema = zod_v3.z.object({
|
|
7288
|
+
id: zod_v3.z.string(),
|
|
7289
|
+
auth_scheme: zod_v3.z.nativeEnum(AuthSchemeTypes),
|
|
7290
|
+
is_composio_managed: zod_v3.z.boolean(),
|
|
7291
|
+
is_disabled: zod_v3.z.boolean(),
|
|
7292
|
+
deprecated: zod_v3.z.object({ uuid: zod_v3.z.string() }).optional()
|
|
7293
|
+
}).passthrough();
|
|
7294
|
+
/**
|
|
7295
|
+
* Simplified connection state schema for webhook payloads (raw API format).
|
|
7296
|
+
*
|
|
7297
|
+
* This intentionally does NOT reuse ConnectionDataSchema from
|
|
7298
|
+
* connectedAccountAuthStates.types.ts because:
|
|
7299
|
+
* - ConnectionDataSchema is a discriminated union requiring typed `val`
|
|
7300
|
+
* per auth scheme (e.g., Oauth2ConnectionDataSchema)
|
|
7301
|
+
* - Webhook payloads need loose validation (z.record(z.unknown()))
|
|
7302
|
+
* since the connection state varies and isn't the focus of event handling
|
|
7303
|
+
*
|
|
7304
|
+
* Uses .passthrough() to accept unknown fields the API may add in the future.
|
|
7305
|
+
*
|
|
7306
|
+
* @see ConnectionDataSchema in connectedAccountAuthStates.types.ts for the full typed version
|
|
7307
|
+
*/
|
|
7308
|
+
const WebhookConnectionStateSchema = zod_v3.z.object({
|
|
7309
|
+
authScheme: zod_v3.z.nativeEnum(AuthSchemeTypes),
|
|
7310
|
+
val: zod_v3.z.record(zod_v3.z.unknown())
|
|
7311
|
+
}).passthrough();
|
|
7312
|
+
/**
|
|
7313
|
+
* Connected account data schema for webhook payloads (raw API format, snake_case).
|
|
7314
|
+
*
|
|
7315
|
+
* This is the snake_case equivalent of ConnectedAccountRetrieveResponseSchema
|
|
7316
|
+
* from connectedAccounts.types.ts. It intentionally does NOT reuse that schema because:
|
|
7317
|
+
* - Webhook payloads arrive in raw snake_case (auth_config, user_id, created_at, etc.)
|
|
7318
|
+
* while the SDK schema uses camelCase (authConfig, createdAt, etc.)
|
|
7319
|
+
* - The SDK applies a transformation layer (utils/transformers/connectedAccounts.ts)
|
|
7320
|
+
* before validation; webhooks are validated directly by the user
|
|
7321
|
+
* - Webhook payloads include user_id, which the SDK schema omits
|
|
7322
|
+
*
|
|
7323
|
+
* Uses .passthrough() to accept unknown fields the API may add in the future.
|
|
7324
|
+
*
|
|
7325
|
+
* @see ConnectedAccountRetrieveResponseSchema in connectedAccounts.types.ts for the camelCase SDK version
|
|
7326
|
+
* @see utils/transformers/connectedAccounts.ts for the snake-to-camel transformation
|
|
7327
|
+
*/
|
|
7328
|
+
const SingleConnectedAccountDetailedResponseSchema = zod_v3.z.object({
|
|
7329
|
+
toolkit: zod_v3.z.object({ slug: zod_v3.z.string().describe("The slug of the toolkit") }).passthrough(),
|
|
7330
|
+
auth_config: WebhookConnectedAccountAuthConfigSchema,
|
|
7331
|
+
id: zod_v3.z.string(),
|
|
7332
|
+
user_id: zod_v3.z.string(),
|
|
7333
|
+
status: zod_v3.z.nativeEnum(ConnectionStatuses),
|
|
7334
|
+
created_at: zod_v3.z.string(),
|
|
7335
|
+
updated_at: zod_v3.z.string(),
|
|
7336
|
+
state: WebhookConnectionStateSchema,
|
|
7337
|
+
data: zod_v3.z.record(zod_v3.z.unknown()),
|
|
7338
|
+
params: zod_v3.z.record(zod_v3.z.unknown()),
|
|
7339
|
+
status_reason: zod_v3.z.string().nullable(),
|
|
7340
|
+
is_disabled: zod_v3.z.boolean(),
|
|
7341
|
+
test_request_endpoint: zod_v3.z.string().optional(),
|
|
7342
|
+
deprecated: zod_v3.z.object({
|
|
7343
|
+
labels: zod_v3.z.array(zod_v3.z.string()),
|
|
7344
|
+
uuid: zod_v3.z.string()
|
|
7345
|
+
}).optional()
|
|
7346
|
+
}).passthrough();
|
|
7347
|
+
/**
|
|
7348
|
+
* Webhook metadata for connection events.
|
|
7349
|
+
* Note: This differs from the trigger webhook metadata in WebhookTriggerPayloadV3Schema.
|
|
7350
|
+
*
|
|
7351
|
+
* Uses .passthrough() to accept unknown fields the API may add in the future.
|
|
7352
|
+
*/
|
|
7353
|
+
const WebhookConnectionMetadataSchema = zod_v3.z.object({
|
|
7354
|
+
project_id: zod_v3.z.string(),
|
|
7355
|
+
org_id: zod_v3.z.string()
|
|
7356
|
+
}).passthrough();
|
|
7357
|
+
/**
|
|
7358
|
+
* Connection expired webhook event payload.
|
|
7359
|
+
* Emitted when a connected account expires due to authentication refresh failure.
|
|
7360
|
+
*
|
|
7361
|
+
* Uses .passthrough() to accept unknown fields the API may add in the future.
|
|
7362
|
+
*
|
|
7363
|
+
* @example
|
|
7364
|
+
* ```typescript
|
|
7365
|
+
* import { ConnectionExpiredEventSchema } from '@composio/core';
|
|
7366
|
+
*
|
|
7367
|
+
* // In your webhook handler
|
|
7368
|
+
* const result = ConnectionExpiredEventSchema.safeParse(webhookPayload);
|
|
7369
|
+
* if (result.success) {
|
|
7370
|
+
* const { data, metadata } = result.data;
|
|
7371
|
+
* console.log(`Connection ${data.id} expired for user ${data.user_id}`);
|
|
7372
|
+
* console.log(`Toolkit: ${data.toolkit.slug}`);
|
|
7373
|
+
* console.log(`Project: ${metadata.project_id}`);
|
|
7374
|
+
* }
|
|
7375
|
+
* ```
|
|
7376
|
+
*/
|
|
7377
|
+
const ConnectionExpiredEventSchema = zod_v3.z.object({
|
|
7378
|
+
id: zod_v3.z.string(),
|
|
7379
|
+
timestamp: zod_v3.z.string(),
|
|
7380
|
+
type: zod_v3.z.literal(WebhookEventTypes.CONNECTION_EXPIRED),
|
|
7381
|
+
data: SingleConnectedAccountDetailedResponseSchema,
|
|
7382
|
+
metadata: WebhookConnectionMetadataSchema
|
|
7383
|
+
}).passthrough();
|
|
7384
|
+
/**
|
|
7385
|
+
* Union of all typed webhook event schemas.
|
|
7386
|
+
* Extend this as new event types are added.
|
|
7387
|
+
*
|
|
7388
|
+
* Note: This covers specific known event types with strict validation.
|
|
7389
|
+
* For unknown or new event types, use WebhookPayloadV3Schema from
|
|
7390
|
+
* triggers.types.ts which accepts any composio.* event with loose validation.
|
|
7391
|
+
*
|
|
7392
|
+
* Trigger events (composio.trigger.message) are handled through the
|
|
7393
|
+
* WebhookTriggerPayloadV3Schema in triggers.types.ts and the TriggerEvent type.
|
|
7394
|
+
*/
|
|
7395
|
+
const WebhookEventSchema = zod_v3.z.discriminatedUnion("type", [ConnectionExpiredEventSchema]);
|
|
7396
|
+
|
|
6467
7397
|
//#endregion
|
|
6468
7398
|
//#region src/types/mcp.types.ts
|
|
6469
7399
|
/**
|
|
@@ -6717,6 +7647,7 @@ exports.ConnectedAccountRetrieveResponseSchema = ConnectedAccountRetrieveRespons
|
|
|
6717
7647
|
exports.ConnectedAccountStatusSchema = ConnectedAccountStatusSchema;
|
|
6718
7648
|
exports.ConnectedAccountStatuses = ConnectedAccountStatuses;
|
|
6719
7649
|
exports.ConnectionDataSchema = ConnectionDataSchema;
|
|
7650
|
+
exports.ConnectionExpiredEventSchema = ConnectionExpiredEventSchema;
|
|
6720
7651
|
exports.ConnectionRequestErrorCodes = ConnectionRequestErrorCodes;
|
|
6721
7652
|
exports.ConnectionRequestFailedError = ConnectionRequestFailedError;
|
|
6722
7653
|
exports.ConnectionRequestTimeoutError = ConnectionRequestTimeoutError;
|
|
@@ -6737,6 +7668,8 @@ exports.CustomCreateResponseSchema = CustomCreateResponseSchema;
|
|
|
6737
7668
|
exports.CustomOauth1ConnectionDataSchema = CustomOauth1ConnectionDataSchema;
|
|
6738
7669
|
exports.CustomOauth2ConnectionDataSchema = CustomOauth2ConnectionDataSchema;
|
|
6739
7670
|
exports.DefaultCreateConnectedAccountParamsSchema = DefaultCreateConnectedAccountParamsSchema;
|
|
7671
|
+
exports.FileDeleteResponseSchema = FileDeleteResponseSchema;
|
|
7672
|
+
exports.FileListResponseSchema = FileListResponseSchema;
|
|
6740
7673
|
exports.GenerateURLParamsSchema = GenerateURLParamsSchema;
|
|
6741
7674
|
exports.GenerateURLResponseSchema = GenerateURLResponseSchema;
|
|
6742
7675
|
exports.IncomingTriggerPayloadSchema = IncomingTriggerPayloadSchema;
|
|
@@ -6775,7 +7708,12 @@ exports.Oauth2InitiatedConnectionDataSchema = Oauth2InitiatedConnectionDataSchem
|
|
|
6775
7708
|
exports.Oauth2InitiatingConnectionDataSchema = Oauth2InitiatingConnectionDataSchema;
|
|
6776
7709
|
exports.OpenAIProvider = OpenAIProvider;
|
|
6777
7710
|
exports.RedirectableAuthSchemeSchema = RedirectableAuthSchemeSchema;
|
|
7711
|
+
exports.RemoteFile = RemoteFile;
|
|
7712
|
+
exports.RemoteFileDataSchema = RemoteFileDataSchema;
|
|
7713
|
+
exports.RemoteFileDownloadError = RemoteFileDownloadError;
|
|
7714
|
+
exports.RemoteFileErrorCodes = RemoteFileErrorCodes;
|
|
6778
7715
|
exports.SDKErrorCodes = SDKErrorCodes;
|
|
7716
|
+
exports.SingleConnectedAccountDetailedResponseSchema = SingleConnectedAccountDetailedResponseSchema;
|
|
6779
7717
|
exports.ToolErrorCodes = ToolErrorCodes;
|
|
6780
7718
|
exports.ToolExecuteMetaParamsSchema = ToolExecuteMetaParamsSchema;
|
|
6781
7719
|
exports.ToolExecuteParamsSchema = ToolExecuteParamsSchema;
|
|
@@ -6792,6 +7730,13 @@ exports.ToolRouterConfigToolsSchema = ToolRouterConfigToolsSchema;
|
|
|
6792
7730
|
exports.ToolRouterCreateSessionConfigSchema = ToolRouterCreateSessionConfigSchema;
|
|
6793
7731
|
exports.ToolRouterMCPServerConfigSchema = ToolRouterMCPServerConfigSchema;
|
|
6794
7732
|
exports.ToolRouterManageConnectionsConfigSchema = ToolRouterManageConnectionsConfigSchema;
|
|
7733
|
+
exports.ToolRouterSession = ToolRouterSession;
|
|
7734
|
+
exports.ToolRouterSessionExecuteResponseSchema = ToolRouterSessionExecuteResponseSchema;
|
|
7735
|
+
exports.ToolRouterSessionFilesMountDeleteOptionsSchema = ToolRouterSessionFilesMountDeleteOptionsSchema;
|
|
7736
|
+
exports.ToolRouterSessionFilesMountDownloadOptionsSchema = ToolRouterSessionFilesMountDownloadOptionsSchema;
|
|
7737
|
+
exports.ToolRouterSessionFilesMountListOptionsSchema = ToolRouterSessionFilesMountListOptionsSchema;
|
|
7738
|
+
exports.ToolRouterSessionFilesMountUploadOptionsSchema = ToolRouterSessionFilesMountUploadOptionsSchema;
|
|
7739
|
+
exports.ToolRouterSessionSearchResponseSchema = ToolRouterSessionSearchResponseSchema;
|
|
6795
7740
|
exports.ToolRouterTagsEnableDisableSchema = ToolRouterTagsEnableDisableSchema;
|
|
6796
7741
|
exports.ToolRouterTagsParamSchema = ToolRouterTagsParamSchema;
|
|
6797
7742
|
exports.ToolRouterToolkitsDisabledConfigSchema = ToolRouterToolkitsDisabledConfigSchema;
|
|
@@ -6835,10 +7780,16 @@ exports.TriggersTypeListResponseSchema = TriggersTypeListResponseSchema;
|
|
|
6835
7780
|
exports.ValidationError = ValidationError;
|
|
6836
7781
|
exports.ValidationErrorCodes = ValidationErrorCodes;
|
|
6837
7782
|
exports.VerifyWebhookParamsSchema = VerifyWebhookParamsSchema;
|
|
7783
|
+
exports.WebhookConnectedAccountAuthConfigSchema = WebhookConnectedAccountAuthConfigSchema;
|
|
7784
|
+
exports.WebhookConnectionMetadataSchema = WebhookConnectionMetadataSchema;
|
|
7785
|
+
exports.WebhookConnectionStateSchema = WebhookConnectionStateSchema;
|
|
7786
|
+
exports.WebhookEventSchema = WebhookEventSchema;
|
|
7787
|
+
exports.WebhookEventTypes = WebhookEventTypes;
|
|
6838
7788
|
exports.WebhookPayloadSchema = WebhookPayloadSchema;
|
|
6839
7789
|
exports.WebhookPayloadV1Schema = WebhookPayloadV1Schema;
|
|
6840
7790
|
exports.WebhookPayloadV2Schema = WebhookPayloadV2Schema;
|
|
6841
7791
|
exports.WebhookPayloadV3Schema = WebhookPayloadV3Schema;
|
|
7792
|
+
exports.WebhookTriggerPayloadV3Schema = WebhookTriggerPayloadV3Schema;
|
|
6842
7793
|
exports.WebhookVersions = WebhookVersions;
|
|
6843
7794
|
Object.defineProperty(exports, 'constants', {
|
|
6844
7795
|
enumerable: true,
|
|
@@ -6847,6 +7798,7 @@ Object.defineProperty(exports, 'constants', {
|
|
|
6847
7798
|
}
|
|
6848
7799
|
});
|
|
6849
7800
|
exports.createConnectionRequest = createConnectionRequest;
|
|
7801
|
+
exports.getExtensionFromMimeType = getExtensionFromMimeType;
|
|
6850
7802
|
exports.handleToolExecutionError = handleToolExecutionError;
|
|
6851
7803
|
exports.jsonSchemaToZodSchema = jsonSchemaToZodSchema;
|
|
6852
7804
|
exports.logger = require_buffer.logger_default;
|