@composio/core 0.8.0 → 0.9.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/{CustomTool-DCrZcOUW.d.cts → CustomTool-87USJ2u0.d.cts} +1 -1
- package/dist/{CustomTool-DJVmDusu.d.mts → CustomTool-BNxqr6BI.d.mts} +1 -1
- package/dist/{CustomTool-CVwF_isu.mjs → CustomTool-DOE7hgw6.mjs} +232 -27
- package/dist/{CustomTool-DnCSEC6t.cjs → CustomTool-Dj4fNvsu.cjs} +279 -26
- package/dist/{composio-DH5gDW5F.d.mts → composio-BJW2NaoA.d.mts} +110 -79
- package/dist/{composio-Dzaqn_PS.d.cts → composio-DTntXzL-.d.cts} +110 -79
- package/dist/{customTool.types-Xk-tbwbc.d.mts → customTool.types-B3HG185y.d.mts} +401 -32
- package/dist/{customTool.types-BqC41wRt.d.cts → customTool.types-Bd8ylotX.d.cts} +401 -32
- package/dist/experimental/index.cjs +1 -1
- package/dist/experimental/index.d.cts +2 -2
- package/dist/experimental/index.d.mts +3 -3
- package/dist/experimental/index.mjs +1 -1
- package/dist/index.cjs +574 -85
- package/dist/index.d.cts +84 -8
- package/dist/index.d.mts +84 -8
- package/dist/index.mjs +570 -88
- package/dist/{tool.types-Cb-o48UU.d.mts → tool.types-CB_4JKhV.d.mts} +601 -38
- package/dist/{tool.types-B4k2Bnxc.d.cts → tool.types-CwbAy9l_.d.cts} +601 -38
- package/dist/{types-BR-1DJRJ.d.mts → types-BClz5lKM.d.mts} +2 -2
- package/dist/{types-gjJ_hDol.d.cts → types-jsOgjrWN.d.cts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +4 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +4 -4
- 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.workerd.d.cts +1 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/package.json +2 -2
- package/generated/ably.ts +0 -20
- package/generated/accelo.ts +0 -8
- package/generated/acculynx.ts +0 -17
- package/generated/active_campaign.ts +0 -30
- package/generated/adobe.ts +0 -8
- package/generated/adyntel.ts +0 -12
- package/generated/aero_workflow.ts +0 -8
- package/generated/affinity.ts +0 -29
- package/generated/agencyzoom.ts +0 -108
- package/generated/ahrefs.ts +0 -49
- package/generated/airtable.ts +0 -26
- package/generated/alchemy.ts +0 -16
- package/generated/algolia.ts +0 -39
- package/generated/altoviz.ts +0 -18
- package/generated/amazon.ts +0 -8
- package/generated/amcards.ts +0 -11
- package/generated/amplitude.ts +0 -25
- package/generated/anthropic_administrator.ts +0 -13
- package/generated/apaleo.ts +0 -38
- package/generated/apollo.ts +0 -40
- package/generated/appdrag.ts +0 -8
- package/generated/appsflyer.ts +0 -8
- package/generated/asana.ts +0 -95
- package/generated/ashby.ts +0 -8
- package/generated/atlassian.ts +0 -8
- package/generated/attio.ts +0 -20
- package/generated/auth0.ts +0 -8
- package/generated/axonaut.ts +0 -8
- package/generated/bamboohr.ts +0 -168
- package/generated/bannerbear.ts +0 -17
- package/generated/baserow.ts +0 -11
- package/generated/battlenet.ts +0 -8
- package/generated/beeminder.ts +0 -14
- package/generated/bigmailer.ts +0 -12
- package/generated/bigml.ts +0 -15
- package/generated/bill.ts +0 -218
- package/generated/bitbucket.ts +0 -25
- package/generated/bitwarden.ts +0 -8
- package/generated/blackbaud.ts +0 -8
- package/generated/blackboard.ts +0 -323
- package/generated/boldsign.ts +0 -8
- package/generated/bolna.ts +0 -24
- package/generated/borneo.ts +0 -162
- package/generated/botbaba.ts +0 -8
- package/generated/box.ts +0 -282
- package/generated/braintree.ts +0 -8
- package/generated/brandfetch.ts +0 -15
- package/generated/breezy_hr.ts +0 -8
- package/generated/brevo.ts +0 -28
- package/generated/brex.ts +0 -8
- package/generated/brex_staging.ts +0 -8
- package/generated/brightpearl.ts +0 -8
- package/generated/brilliant_directories.ts +0 -15
- package/generated/browseai.ts +0 -18
- package/generated/browserbase_tool.ts +0 -10
- package/generated/browserhub.ts +0 -8
- package/generated/browserless.ts +0 -16
- package/generated/bubble.ts +0 -8
- package/generated/bugbug.ts +0 -13
- package/generated/builtwith.ts +0 -21
- package/generated/cal.ts +0 -150
- package/generated/calendly.ts +0 -51
- package/generated/canva.ts +0 -41
- package/generated/canvas.ts +0 -100
- package/generated/chatwork.ts +0 -17
- package/generated/chmeetings.ts +0 -8
- package/generated/clickup.ts +0 -153
- package/generated/clockify.ts +0 -23
- package/generated/close.ts +0 -15
- package/generated/cloudflare.ts +0 -10
- package/generated/coda.ts +0 -115
- package/generated/codeinterpreter.ts +0 -14
- package/generated/coinbase.ts +0 -15
- package/generated/coinmarketcal.ts +0 -8
- package/generated/composio.ts +0 -34
- package/generated/composio_search.ts +0 -22
- package/generated/confluence.ts +0 -199
- package/generated/contentful.ts +0 -12
- package/generated/crustdata.ts +0 -23
- package/generated/customer_io.ts +0 -8
- package/generated/cutt_ly.ts +0 -10
- package/generated/d2lbrightspace.ts +0 -54
- package/generated/dailybot.ts +0 -15
- package/generated/datadog.ts +0 -47
- package/generated/datagma.ts +0 -8
- package/generated/datarobot.ts +0 -8
- package/generated/deel.ts +0 -8
- package/generated/demio.ts +0 -8
- package/generated/dialpad.ts +0 -201
- package/generated/digicert.ts +0 -15
- package/generated/discord.ts +0 -17
- package/generated/discordbot.ts +0 -173
- package/generated/docmosis.ts +0 -8
- package/generated/docusign.ts +0 -351
- package/generated/dropbox.ts +0 -20
- package/generated/dropbox_sign.ts +0 -8
- package/generated/dynamics365.ts +0 -25
- package/generated/echtpost.ts +0 -10
- package/generated/elevenlabs.ts +0 -70
- package/generated/emailoctopus.ts +0 -16
- package/generated/enigma.ts +0 -11
- package/generated/entelligence.ts +0 -11
- package/generated/epic_games.ts +0 -8
- package/generated/eventbrite.ts +0 -12
- package/generated/exa.ts +0 -13
- package/generated/excel.ts +0 -34
- package/generated/exist.ts +0 -8
- package/generated/facebook.ts +0 -8
- package/generated/factorial.ts +0 -8
- package/generated/figma.ts +0 -59
- package/generated/finage.ts +0 -19
- package/generated/firecrawl.ts +0 -16
- package/generated/fireflies.ts +0 -21
- package/generated/fitbit.ts +0 -8
- package/generated/flutterwave.ts +0 -33
- package/generated/fomo.ts +0 -10
- package/generated/formcarry.ts +0 -10
- package/generated/formsite.ts +0 -14
- package/generated/foursquare.ts +0 -14
- package/generated/freshbooks.ts +0 -11
- package/generated/freshdesk.ts +0 -16
- package/generated/front.ts +0 -8
- package/generated/github.ts +0 -967
- package/generated/gitlab.ts +0 -82
- package/generated/gmail.d.ts +0 -86
- package/generated/gmail.js +0 -13
- package/generated/gmail.ts +0 -95
- package/generated/go_to_webinar.ts +0 -8
- package/generated/gong.ts +0 -63
- package/generated/google_analytics.ts +0 -13
- package/generated/google_maps.ts +0 -16
- package/generated/googleads.ts +0 -14
- package/generated/googlebigquery.ts +0 -10
- package/generated/googlecalendar.ts +0 -39
- package/generated/googledocs.ts +0 -41
- package/generated/googledrive.ts +0 -62
- package/generated/googlemeet.ts +0 -18
- package/generated/googlephotos.ts +0 -22
- package/generated/googlesheets.ts +0 -40
- package/generated/googleslides.ts +0 -8
- package/generated/googlesuper.ts +0 -230
- package/generated/googletasks.ts +0 -23
- package/generated/gorgias.ts +0 -41
- package/generated/gumroad.ts +0 -14
- package/generated/guru.ts +0 -8
- package/generated/hackernews.ts +0 -15
- package/generated/hackerrank_work.ts +0 -8
- package/generated/harvest.ts +0 -56
- package/generated/helcim.ts +0 -8
- package/generated/heygen.ts +0 -44
- package/generated/highlevel.ts +0 -8
- package/generated/hubspot.ts +0 -252
- package/generated/humanloop.ts +0 -13
- package/generated/icims_talent_cloud.ts +0 -8
- package/generated/idea_scale.ts +0 -8
- package/generated/index.ts +0 -151
- package/generated/insighto_ai.ts +0 -19
- package/generated/intercom.ts +0 -52
- package/generated/interzoid.ts +0 -8
- package/generated/jira.ts +0 -59
- package/generated/jotform.ts +0 -15
- package/generated/junglescout.ts +0 -15
- package/generated/keap.ts +0 -8
- package/generated/kibana.ts +0 -58
- package/generated/kit.ts +0 -38
- package/generated/klaviyo.ts +0 -240
- package/generated/klipfolio.ts +0 -20
- package/generated/kommo.ts +0 -24
- package/generated/lastpass.ts +0 -8
- package/generated/launch_darkly.ts +0 -16
- package/generated/leadfeeder.ts +0 -13
- package/generated/leadoku.ts +0 -10
- package/generated/lever.ts +0 -8
- package/generated/lever_sandbox.ts +0 -8
- package/generated/lexoffice.ts +0 -8
- package/generated/linear.ts +0 -31
- package/generated/linkedin.ts +0 -13
- package/generated/linkhut.ts +0 -14
- package/generated/linkup.ts +0 -11
- package/generated/listennotes.ts +0 -35
- package/generated/lmnt.ts +0 -16
- package/generated/lodgify.ts +0 -10
- package/generated/mailchimp.ts +0 -285
- package/generated/mailerlite.ts +0 -8
- package/generated/maintainx.ts +0 -20
- package/generated/make.ts +0 -12
- package/generated/mboum.ts +0 -8
- package/generated/mem0.ts +0 -52
- package/generated/metaads.ts +0 -25
- package/generated/metatextai.ts +0 -8
- package/generated/microsoft_clarity.ts +0 -10
- package/generated/microsoft_teams.ts +0 -22
- package/generated/microsoft_tenant.ts +0 -8
- package/generated/miro.ts +0 -23
- package/generated/mixpanel.ts +0 -30
- package/generated/mocean.ts +0 -8
- package/generated/monday.ts +0 -30
- package/generated/mopinion.ts +0 -8
- package/generated/more_trees.ts +0 -10
- package/generated/moxie.ts +0 -8
- package/generated/moz.ts +0 -8
- package/generated/mural.ts +0 -14
- package/generated/nasdaq.ts +0 -15
- package/generated/ncscale.ts +0 -8
- package/generated/neon.ts +0 -78
- package/generated/netsuite.ts +0 -8
- package/generated/nextdns.ts +0 -11
- package/generated/ngrok.ts +0 -18
- package/generated/notion.ts +0 -40
- package/generated/oncehub.ts +0 -8
- package/generated/one_drive.ts +0 -49
- package/generated/onepage.ts +0 -11
- package/generated/open_sea.ts +0 -33
- package/generated/outlook.ts +0 -37
- package/generated/pagerduty.ts +0 -362
- package/generated/pandadoc.ts +0 -23
- package/generated/peopledatalabs.ts +0 -24
- package/generated/perplexityai.ts +0 -10
- package/generated/piggy.ts +0 -8
- package/generated/pipedrive.ts +0 -288
- package/generated/placekey.ts +0 -12
- package/generated/posthog.ts +0 -367
- package/generated/precoro.ts +0 -8
- package/generated/printnode.ts +0 -8
- package/generated/process_street.ts +0 -14
- package/generated/productboard.ts +0 -8
- package/generated/qualaroo.ts +0 -8
- package/generated/quickbooks.ts +0 -22
- package/generated/rafflys.ts +0 -8
- package/generated/ragic.ts +0 -10
- package/generated/ramp.ts +0 -17
- package/generated/ravenseotools.ts +0 -8
- package/generated/recallai.ts +0 -17
- package/generated/reddit.ts +0 -19
- package/generated/resend.ts +0 -27
- package/generated/retellai.ts +0 -19
- package/generated/retently.ts +0 -24
- package/generated/ring_central.ts +0 -8
- package/generated/rippling.ts +0 -8
- package/generated/rocket_reach.ts +0 -8
- package/generated/rocketlane.ts +0 -42
- package/generated/rootly.ts +0 -12
- package/generated/rosette_text_analytics.ts +0 -12
- package/generated/sage.ts +0 -8
- package/generated/salesforce.ts +0 -46
- package/generated/scrape_do.ts +0 -28
- package/generated/scrapingant.ts +0 -14
- package/generated/screenshotone.ts +0 -10
- package/generated/seismic.ts +0 -8
- package/generated/semanticscholar.ts +0 -23
- package/generated/semrush.ts +0 -45
- package/generated/sendgrid.ts +0 -384
- package/generated/sentry.ts +0 -185
- package/generated/serpapi.ts +0 -32
- package/generated/servicem8.ts +0 -37
- package/generated/servicenow.ts +0 -14
- package/generated/share_point.ts +0 -15
- package/generated/shopify.ts +0 -37
- package/generated/shortcut.ts +0 -131
- package/generated/simplesat.ts +0 -11
- package/generated/slack.d.ts +0 -16
- package/generated/slack.js +0 -11
- package/generated/slack.ts +0 -24
- package/generated/slackbot.ts +0 -205
- package/generated/smartrecruiters.ts +0 -8
- package/generated/smugmug.ts +0 -14
- package/generated/snowflake.ts +0 -15
- package/generated/sourcegraph.ts +0 -16
- package/generated/square.ts +0 -8
- package/generated/stack_exchange.ts +0 -17
- package/generated/starton.ts +0 -11
- package/generated/storeganise.ts +0 -12
- package/generated/stripe.ts +0 -50
- package/generated/supabase.ts +0 -86
- package/generated/survey_monkey.ts +0 -8
- package/generated/tally.ts +0 -25
- package/generated/tapfiliate.ts +0 -11
- package/generated/tapform.ts +0 -8
- package/generated/tavily.ts +0 -10
- package/generated/terminus.ts +0 -8
- package/generated/text_to_pdf.ts +0 -10
- package/generated/textrazor.ts +0 -22
- package/generated/timecamp.ts +0 -10
- package/generated/timekit.ts +0 -8
- package/generated/timely.ts +0 -11
- package/generated/tinypng.ts +0 -15
- package/generated/tinyurl.ts +0 -10
- package/generated/tisane.ts +0 -15
- package/generated/todoist.ts +0 -19
- package/generated/toneden.ts +0 -8
- package/generated/tpscheck.ts +0 -10
- package/generated/trello.ts +0 -360
- package/generated/twitch.ts +0 -8
- package/generated/twitter.ts +0 -82
- package/generated/twitter_media.ts +0 -10
- package/generated/typefully.ts +0 -14
- package/generated/venly.ts +0 -8
- package/generated/vero.ts +0 -8
- package/generated/visme.ts +0 -8
- package/generated/waboxapp.ts +0 -8
- package/generated/wakatime.ts +0 -8
- package/generated/wave_accounting.ts +0 -8
- package/generated/weathermap.ts +0 -10
- package/generated/webex.ts +0 -37
- package/generated/webflow.ts +0 -30
- package/generated/whatsapp.ts +0 -14
- package/generated/wiz.ts +0 -8
- package/generated/workiom.ts +0 -12
- package/generated/wrike.ts +0 -47
- package/generated/xero.ts +0 -13
- package/generated/yandex.ts +0 -13
- package/generated/ynab.ts +0 -8
- package/generated/yousearch.ts +0 -10
- package/generated/youtube.ts +0 -26
- package/generated/zendesk.ts +0 -23
- package/generated/zenrows.ts +0 -25
- package/generated/zenserp.ts +0 -20
- package/generated/zoho.ts +0 -33
- package/generated/zoho_bigin.ts +0 -21
- package/generated/zoho_books.ts +0 -8
- package/generated/zoho_desk.ts +0 -8
- package/generated/zoho_inventory.ts +0 -8
- package/generated/zoho_invoice.ts +0 -15
- package/generated/zoho_mail.ts +0 -8
- package/generated/zoom.ts +0 -181
- package/generated/zoominfo.ts +0 -26
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CQwRTUmo.cjs');
|
|
2
2
|
const require_FileModifierErrors = require('./FileModifierErrors-BYJBHiay.cjs');
|
|
3
|
-
const require_CustomTool = require('./CustomTool-
|
|
3
|
+
const require_CustomTool = require('./CustomTool-Dj4fNvsu.cjs');
|
|
4
4
|
const require_Telemetry = require('./Telemetry-Dm-0sewu.cjs');
|
|
5
5
|
const require_buffer = require('./buffer-BjWptbNH.cjs');
|
|
6
6
|
const require_FileToolModifier_utils_neutral = require('./FileToolModifier.utils.neutral-Dfwqgimk.cjs');
|
|
@@ -156,7 +156,8 @@ const ConnectionStatuses = {
|
|
|
156
156
|
ACTIVE: "ACTIVE",
|
|
157
157
|
FAILED: "FAILED",
|
|
158
158
|
EXPIRED: "EXPIRED",
|
|
159
|
-
INACTIVE: "INACTIVE"
|
|
159
|
+
INACTIVE: "INACTIVE",
|
|
160
|
+
REVOKED: "REVOKED"
|
|
160
161
|
};
|
|
161
162
|
const RedirectableAuthSchemeSchema = zod_v3.z.enum([AuthSchemeTypes.OAUTH1, AuthSchemeTypes.OAUTH2]);
|
|
162
163
|
const BaseSchemeRaw = zod_v3.z.object({
|
|
@@ -254,13 +255,18 @@ const Oauth2InactiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.
|
|
|
254
255
|
scope: zod_v3.z.string().optional()
|
|
255
256
|
}).optional().describe("for slack user scopes")
|
|
256
257
|
}).catchall(zod_v3.z.unknown());
|
|
258
|
+
const Oauth2RevokedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
259
|
+
status: zod_v3.z.literal(ConnectionStatuses.REVOKED),
|
|
260
|
+
revoked_at: zod_v3.z.string().optional()
|
|
261
|
+
}).catchall(zod_v3.z.unknown());
|
|
257
262
|
const Oauth2ConnectionDataSchema = zod_v3.z.discriminatedUnion("status", [
|
|
258
263
|
Oauth2InitiatingConnectionDataSchema,
|
|
259
264
|
Oauth2InitiatedConnectionDataSchema,
|
|
260
265
|
Oauth2ActiveConnectionDataSchema,
|
|
261
266
|
Oauth2FailedConnectionDataSchema,
|
|
262
267
|
Oauth2ExpiredConnectionDataSchema,
|
|
263
|
-
Oauth2InactiveConnectionDataSchema
|
|
268
|
+
Oauth2InactiveConnectionDataSchema,
|
|
269
|
+
Oauth2RevokedConnectionDataSchema
|
|
264
270
|
]);
|
|
265
271
|
const CustomOauth2ConnectionDataSchema = Oauth2ActiveConnectionDataSchema.omit({ status: true });
|
|
266
272
|
const S2SOauth2BaseSchema = BaseSchemeRaw.extend({ status: zod_v3.z.literal(ConnectionStatuses.INITIALIZING) }).catchall(zod_v3.z.unknown());
|
|
@@ -309,6 +315,10 @@ const S2SOauth2ConnectionDataSchema = zod_v3.z.discriminatedUnion("status", [
|
|
|
309
315
|
S2SOauth2BaseSchema.extend({
|
|
310
316
|
status: zod_v3.z.literal(ConnectionStatuses.EXPIRED),
|
|
311
317
|
expired_at: zod_v3.z.string().optional()
|
|
318
|
+
}).catchall(zod_v3.z.unknown()),
|
|
319
|
+
S2SOauth2BaseSchema.extend({
|
|
320
|
+
status: zod_v3.z.literal(ConnectionStatuses.REVOKED),
|
|
321
|
+
revoked_at: zod_v3.z.string().optional()
|
|
312
322
|
}).catchall(zod_v3.z.unknown())
|
|
313
323
|
]);
|
|
314
324
|
const CustomS2SOauth2ConnectionDataSchema = BaseSchemeRaw.extend({
|
|
@@ -1017,7 +1027,8 @@ const ConnectedAccountStatuses = {
|
|
|
1017
1027
|
ACTIVE: "ACTIVE",
|
|
1018
1028
|
FAILED: "FAILED",
|
|
1019
1029
|
EXPIRED: "EXPIRED",
|
|
1020
|
-
INACTIVE: "INACTIVE"
|
|
1030
|
+
INACTIVE: "INACTIVE",
|
|
1031
|
+
REVOKED: "REVOKED"
|
|
1021
1032
|
};
|
|
1022
1033
|
const ConnectedAccountStatusSchema = zod_v3.z.enum([
|
|
1023
1034
|
ConnectedAccountStatuses.INITIALIZING,
|
|
@@ -1025,7 +1036,8 @@ const ConnectedAccountStatusSchema = zod_v3.z.enum([
|
|
|
1025
1036
|
ConnectedAccountStatuses.ACTIVE,
|
|
1026
1037
|
ConnectedAccountStatuses.FAILED,
|
|
1027
1038
|
ConnectedAccountStatuses.EXPIRED,
|
|
1028
|
-
ConnectedAccountStatuses.INACTIVE
|
|
1039
|
+
ConnectedAccountStatuses.INACTIVE,
|
|
1040
|
+
ConnectedAccountStatuses.REVOKED
|
|
1029
1041
|
]);
|
|
1030
1042
|
const CreateConnectedAccountParamsSchema = zod_v3.z.object({
|
|
1031
1043
|
authConfig: zod_v3.z.object({ id: zod_v3.z.string() }),
|
|
@@ -1097,7 +1109,8 @@ const ConnectedAccountListResponseSchema = zod_v3.z.object({
|
|
|
1097
1109
|
});
|
|
1098
1110
|
const CreateConnectedAccountLinkOptionsSchema = zod_v3.z.object({
|
|
1099
1111
|
callbackUrl: zod_v3.z.string().optional(),
|
|
1100
|
-
alias: zod_v3.z.string().optional()
|
|
1112
|
+
alias: zod_v3.z.string().optional(),
|
|
1113
|
+
allowMultiple: zod_v3.z.boolean().optional()
|
|
1101
1114
|
});
|
|
1102
1115
|
const CreateConnectedAccountLinkResponseSchema = zod_v3.z.object({ redirectUrl: zod_v3.z.string() });
|
|
1103
1116
|
const ConnectedAccountRefreshOptionsSchema = zod_v3.z.object({
|
|
@@ -1479,6 +1492,7 @@ function resolveEffectiveUploadAllowlist(userDirs) {
|
|
|
1479
1492
|
|
|
1480
1493
|
//#endregion
|
|
1481
1494
|
//#region src/models/Tools.ts
|
|
1495
|
+
const TOOL_ROUTER_SESSION_TOOLS_PAGE_LIMIT = 500;
|
|
1482
1496
|
/**
|
|
1483
1497
|
* This class is used to manage tools in the Composio SDK.
|
|
1484
1498
|
* It provides methods to list, get, and execute tools.
|
|
@@ -1730,23 +1744,33 @@ var Tools = class {
|
|
|
1730
1744
|
return modifiedTools;
|
|
1731
1745
|
}
|
|
1732
1746
|
/**
|
|
1733
|
-
* Fetches
|
|
1734
|
-
* This
|
|
1735
|
-
* It provides access to the underlying
|
|
1747
|
+
* Fetches tools exposed by a tool router session.
|
|
1748
|
+
* This includes helper/meta tools plus any tools preloaded into the session.
|
|
1749
|
+
* It provides access to the underlying tool data without provider-specific wrapping.
|
|
1736
1750
|
*
|
|
1737
|
-
* @param sessionId {string} The session id to get
|
|
1751
|
+
* @param sessionId {string} The session id to get tools for
|
|
1738
1752
|
* @param options {SchemaModifierOptions} Optional configuration for tool retrieval
|
|
1739
1753
|
* @param {TransformToolSchemaModifier} [options.modifySchema] - Function to transform the tool schema
|
|
1740
|
-
* @returns {Promise<ToolList>} The list of
|
|
1754
|
+
* @returns {Promise<ToolList>} The list of session tools
|
|
1741
1755
|
*
|
|
1742
1756
|
* @example
|
|
1743
1757
|
* ```typescript
|
|
1744
|
-
* const
|
|
1745
|
-
* console.log(
|
|
1758
|
+
* const sessionTools = await composio.tools.getRawToolRouterSessionTools('session_123');
|
|
1759
|
+
* console.log(sessionTools);
|
|
1746
1760
|
* ```
|
|
1747
1761
|
*/
|
|
1748
|
-
async
|
|
1749
|
-
|
|
1762
|
+
async getRawToolRouterSessionTools(sessionId, options) {
|
|
1763
|
+
const tools = [];
|
|
1764
|
+
let cursor;
|
|
1765
|
+
do {
|
|
1766
|
+
const response = await this.client.toolRouter.session.tools(sessionId, {
|
|
1767
|
+
limit: TOOL_ROUTER_SESSION_TOOLS_PAGE_LIMIT,
|
|
1768
|
+
...cursor ? { cursor } : {}
|
|
1769
|
+
});
|
|
1770
|
+
tools.push(...response.items.map((tool) => this.transformToolCases(tool)));
|
|
1771
|
+
cursor = response.next_cursor;
|
|
1772
|
+
} while (cursor);
|
|
1773
|
+
let modifiedTools = tools;
|
|
1750
1774
|
if (options?.modifySchema) {
|
|
1751
1775
|
const modifier = options.modifySchema;
|
|
1752
1776
|
if (typeof modifier === "function") {
|
|
@@ -1893,7 +1917,7 @@ var Tools = class {
|
|
|
1893
1917
|
* @returns {Tool[]} The wrapped tools
|
|
1894
1918
|
*/
|
|
1895
1919
|
wrapToolsForToolRouter(sessionId, tools, modifiers) {
|
|
1896
|
-
const executeToolFn = this.createExecuteToolFnForToolRouter(sessionId, modifiers);
|
|
1920
|
+
const executeToolFn = this.createExecuteToolFnForToolRouter(sessionId, tools, modifiers);
|
|
1897
1921
|
return this.provider.wrapTools(tools, executeToolFn);
|
|
1898
1922
|
}
|
|
1899
1923
|
/**
|
|
@@ -1924,12 +1948,13 @@ var Tools = class {
|
|
|
1924
1948
|
* @param {SessionExecuteMetaModifiers} modifiers - The modifiers to apply to the tool
|
|
1925
1949
|
* @returns {ExecuteToolFn} The execute tool function
|
|
1926
1950
|
*/
|
|
1927
|
-
createExecuteToolFnForToolRouter(sessionId, modifiers) {
|
|
1951
|
+
createExecuteToolFnForToolRouter(sessionId, tools, modifiers) {
|
|
1952
|
+
const toolBySlug = new Map(tools.map((tool) => [tool.slug.toUpperCase(), tool]));
|
|
1928
1953
|
const executeToolFn = async (toolSlug, input) => {
|
|
1929
|
-
return await this.
|
|
1954
|
+
return await this.executeSessionTool(toolSlug, {
|
|
1930
1955
|
sessionId,
|
|
1931
1956
|
arguments: input
|
|
1932
|
-
}, modifiers);
|
|
1957
|
+
}, modifiers, toolBySlug.get(toolSlug.toUpperCase()));
|
|
1933
1958
|
};
|
|
1934
1959
|
return executeToolFn;
|
|
1935
1960
|
}
|
|
@@ -2057,29 +2082,34 @@ var Tools = class {
|
|
|
2057
2082
|
return result;
|
|
2058
2083
|
}
|
|
2059
2084
|
/**
|
|
2060
|
-
* Executes a
|
|
2085
|
+
* Executes a tool based on a tool router session.
|
|
2061
2086
|
*
|
|
2062
2087
|
* @param {string} toolSlug - The slug of the tool to execute
|
|
2063
2088
|
* @param {ToolExecuteMetaParams} body - The execution parameters
|
|
2064
2089
|
* @param {string} body.sessionId - The session id to execute the tool for
|
|
2065
2090
|
* @param {Record<string, unknown>} body.arguments - The input to pass to the tool
|
|
2066
2091
|
* @param {SessionExecuteMetaModifiers} modifiers - The modifiers to apply to the tool
|
|
2092
|
+
* @param {Tool} tool - Optional tool schema used to resolve toolkit metadata for modifiers
|
|
2067
2093
|
* @returns {Promise<ToolExecuteResponse>} The response from the tool execution
|
|
2068
2094
|
*/
|
|
2069
|
-
async
|
|
2070
|
-
const
|
|
2071
|
-
if (!
|
|
2095
|
+
async executeSessionTool(toolSlug, body, modifiers, tool, options) {
|
|
2096
|
+
const executeParams = ToolExecuteMetaParamsSchema.safeParse(body);
|
|
2097
|
+
if (!executeParams.success) throw new require_CustomTool.ValidationError("Invalid tool execute session parameters", { cause: executeParams.error });
|
|
2072
2098
|
let modifiedParams = body.arguments ?? {};
|
|
2099
|
+
const toolkitSlug = tool?.toolkit?.slug ?? "composio";
|
|
2073
2100
|
if (modifiers?.beforeExecute) modifiedParams = await modifiers.beforeExecute({
|
|
2074
2101
|
toolSlug,
|
|
2075
|
-
toolkitSlug
|
|
2102
|
+
toolkitSlug,
|
|
2076
2103
|
sessionId: body.sessionId,
|
|
2077
2104
|
params: modifiedParams
|
|
2078
2105
|
});
|
|
2079
|
-
const
|
|
2080
|
-
|
|
2081
|
-
arguments: modifiedParams
|
|
2082
|
-
|
|
2106
|
+
const executePayload = {
|
|
2107
|
+
tool_slug: toolSlug,
|
|
2108
|
+
arguments: modifiedParams,
|
|
2109
|
+
enable_auto_workbench_offload: true
|
|
2110
|
+
};
|
|
2111
|
+
if (options?.experimental) executePayload.experimental = options.experimental;
|
|
2112
|
+
const response = await this.client.toolRouter.session.execute(body.sessionId, executePayload);
|
|
2083
2113
|
let result = {
|
|
2084
2114
|
data: response.data,
|
|
2085
2115
|
error: response.error,
|
|
@@ -2088,7 +2118,7 @@ var Tools = class {
|
|
|
2088
2118
|
};
|
|
2089
2119
|
if (modifiers?.afterExecute) result = await modifiers.afterExecute({
|
|
2090
2120
|
toolSlug,
|
|
2091
|
-
toolkitSlug
|
|
2121
|
+
toolkitSlug,
|
|
2092
2122
|
sessionId: body.sessionId,
|
|
2093
2123
|
result
|
|
2094
2124
|
});
|
|
@@ -2712,28 +2742,36 @@ function createConnectionRequest(client, connectedAccountId, status, redirectUrl
|
|
|
2712
2742
|
* ```
|
|
2713
2743
|
*/
|
|
2714
2744
|
async function waitForConnection(timeout = 6e4) {
|
|
2745
|
+
const terminalErrorStates = [
|
|
2746
|
+
ConnectedAccountStatuses.FAILED,
|
|
2747
|
+
ConnectedAccountStatuses.EXPIRED,
|
|
2748
|
+
ConnectedAccountStatuses.REVOKED
|
|
2749
|
+
];
|
|
2750
|
+
const failIfTerminal = (response) => {
|
|
2751
|
+
if (terminalErrorStates.includes(response.status)) throw new require_CustomTool.ConnectionRequestFailedError(`Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`, { meta: {
|
|
2752
|
+
connectedAccountId: state.id,
|
|
2753
|
+
status: response.status,
|
|
2754
|
+
statusReason: response.status_reason
|
|
2755
|
+
} });
|
|
2756
|
+
};
|
|
2715
2757
|
try {
|
|
2716
2758
|
const response = await client.connectedAccounts.retrieve(state.id);
|
|
2717
2759
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
2718
2760
|
state.status = ConnectedAccountStatuses.ACTIVE;
|
|
2719
2761
|
return transformConnectedAccountResponse(response);
|
|
2720
2762
|
}
|
|
2763
|
+
failIfTerminal(response);
|
|
2721
2764
|
} catch (error) {
|
|
2722
2765
|
if (error instanceof _composio_client.default.NotFoundError) throw new require_CustomTool.ComposioConnectedAccountNotFoundError(`Connected account with id ${state.id} not found`, { meta: { connectedAccountId: state.id } });
|
|
2723
2766
|
else throw error;
|
|
2724
2767
|
}
|
|
2725
|
-
const terminalErrorStates = [ConnectedAccountStatuses.FAILED, ConnectedAccountStatuses.EXPIRED];
|
|
2726
2768
|
const start = Date.now();
|
|
2727
2769
|
const pollInterval = 1e3;
|
|
2728
2770
|
while (Date.now() - start < timeout) try {
|
|
2729
2771
|
const response = await client.connectedAccounts.retrieve(state.id);
|
|
2730
2772
|
state.status = response.status;
|
|
2731
2773
|
if (response.status === ConnectedAccountStatuses.ACTIVE) return transformConnectedAccountResponse(response);
|
|
2732
|
-
|
|
2733
|
-
connectedAccountId: state.id,
|
|
2734
|
-
status: response.status,
|
|
2735
|
-
statusReason: response.status_reason
|
|
2736
|
-
} });
|
|
2774
|
+
failIfTerminal(response);
|
|
2737
2775
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
2738
2776
|
} catch (error) {
|
|
2739
2777
|
throw error;
|
|
@@ -2751,6 +2789,19 @@ function createConnectionRequest(client, connectedAccountId, status, redirectUrl
|
|
|
2751
2789
|
//#endregion
|
|
2752
2790
|
//#region src/models/ConnectedAccounts.ts
|
|
2753
2791
|
/**
|
|
2792
|
+
* @fileoverview Connected accounts class for Composio SDK, used to manage connected accounts of a user.
|
|
2793
|
+
*
|
|
2794
|
+
* @author Musthaq Ahamad <musthaq@composio.dev>
|
|
2795
|
+
* @date 2025-05-05
|
|
2796
|
+
* @module ConnectedAccounts
|
|
2797
|
+
*/
|
|
2798
|
+
const LEGACY_RETIRING_OAUTH_SCHEMES = new Set([
|
|
2799
|
+
"OAUTH1",
|
|
2800
|
+
"OAUTH2",
|
|
2801
|
+
"DCR_OAUTH"
|
|
2802
|
+
]);
|
|
2803
|
+
let _legacyInitiateWarningEmitted = false;
|
|
2804
|
+
/**
|
|
2754
2805
|
* ConnectedAccounts class
|
|
2755
2806
|
*
|
|
2756
2807
|
* This class is used to manage connected accounts in the Composio SDK.
|
|
@@ -2808,6 +2859,22 @@ var ConnectedAccounts = class {
|
|
|
2808
2859
|
* This function creates a new connected account and returns a connection request.
|
|
2809
2860
|
* Users can then wait for the connection to be established using the `waitForConnection` method.
|
|
2810
2861
|
*
|
|
2862
|
+
* **Deprecated for Composio-managed OAuth (OAuth1, OAuth2, DCR_OAUTH).**
|
|
2863
|
+
* The legacy `POST /api/v3/connected_accounts` endpoint that this method
|
|
2864
|
+
* wraps is being retired for Composio-managed auth configs on redirectable
|
|
2865
|
+
* schemes. The cutover is **2026-05-08** for new organizations and
|
|
2866
|
+
* **2026-07-03** for all remaining organizations. After your org's cutover,
|
|
2867
|
+
* this method will throw {@link ComposioLegacyConnectedAccountsEndpointRetiredError}
|
|
2868
|
+
* for that specific combination.
|
|
2869
|
+
*
|
|
2870
|
+
* Use {@link ConnectedAccounts.link} for Composio-managed OAuth — it works for
|
|
2871
|
+
* every redirectable scheme regardless of whether the auth config is
|
|
2872
|
+
* Composio-managed or custom, and the return shape is the same.
|
|
2873
|
+
*
|
|
2874
|
+
* Custom auth configs (your own OAuth app) and non-OAuth schemes (API key,
|
|
2875
|
+
* bearer token, basic auth) are unaffected and continue to work on
|
|
2876
|
+
* `initiate()`. See https://docs.composio.dev/docs/changelog/2026/04/24
|
|
2877
|
+
*
|
|
2811
2878
|
* @param {string} userId - User ID of the connected account
|
|
2812
2879
|
* @param {string} authConfigId - Auth config ID of the connected account
|
|
2813
2880
|
* @param {CreateConnectedAccountOptions} options - Options for creating a new connected account
|
|
@@ -2872,7 +2939,18 @@ var ConnectedAccounts = class {
|
|
|
2872
2939
|
...options?.alias != null && { alias: options.alias }
|
|
2873
2940
|
}
|
|
2874
2941
|
};
|
|
2875
|
-
|
|
2942
|
+
let response;
|
|
2943
|
+
try {
|
|
2944
|
+
response = await this.client.connectedAccounts.create(createParams);
|
|
2945
|
+
} catch (error) {
|
|
2946
|
+
if (error instanceof _composio_client.BadRequestError && typeof error.message === "string" && error.message.includes("no longer supported") && error.message.includes("/api/v3/connected_accounts/link")) throw new require_CustomTool.ComposioLegacyConnectedAccountsEndpointRetiredError(error.message, { cause: error });
|
|
2947
|
+
throw error;
|
|
2948
|
+
}
|
|
2949
|
+
const responseAuthScheme = response.connectionData?.authScheme;
|
|
2950
|
+
if (!_legacyInitiateWarningEmitted && typeof responseAuthScheme === "string" && LEGACY_RETIRING_OAUTH_SCHEMES.has(responseAuthScheme)) {
|
|
2951
|
+
_legacyInitiateWarningEmitted = true;
|
|
2952
|
+
require_FileModifierErrors.logger_default.warn("[Deprecation] composio.connectedAccounts.initiate() will stop working for Composio-managed OAuth auth configs on 2026-05-08 (new orgs) and 2026-07-03 (all orgs). If this auth config is Composio-managed, switch to composio.connectedAccounts.link() before then. Custom auth configs are unaffected. See https://docs.composio.dev/docs/changelog/2026/04/24");
|
|
2953
|
+
}
|
|
2876
2954
|
const redirectUrl = typeof response.connectionData?.val?.redirectUrl === "string" ? response.connectionData.val.redirectUrl : null;
|
|
2877
2955
|
return createConnectionRequest(this.client, response.id, response.connectionData.val.status, redirectUrl);
|
|
2878
2956
|
}
|
|
@@ -2914,6 +2992,13 @@ var ConnectedAccounts = class {
|
|
|
2914
2992
|
async link(userId, authConfigId, options) {
|
|
2915
2993
|
const requestOptions = await CreateConnectedAccountLinkOptionsSchema.safeParse(options || {});
|
|
2916
2994
|
if (!requestOptions.success) throw new require_CustomTool.ValidationError("Failed to parse create connected account link options", { cause: requestOptions.error });
|
|
2995
|
+
const existing = await this.list({
|
|
2996
|
+
userIds: [userId],
|
|
2997
|
+
authConfigIds: [authConfigId],
|
|
2998
|
+
statuses: [ConnectedAccountStatuses.ACTIVE]
|
|
2999
|
+
});
|
|
3000
|
+
if (existing.items.length > 0 && !requestOptions.data.allowMultiple) throw new require_CustomTool.ComposioMultipleConnectedAccountsError(`Multiple connected accounts found for user ${userId} in auth config ${authConfigId}. Please use the allowMultiple option to allow multiple connected accounts.`);
|
|
3001
|
+
else if (existing.items.length > 0) require_FileModifierErrors.logger_default.warn(`[Warn:AllowMultiple] Multiple connected accounts found for user ${userId} in auth config ${authConfigId}`);
|
|
2917
3002
|
try {
|
|
2918
3003
|
const response = await this.client.link.create({
|
|
2919
3004
|
auth_config_id: authConfigId,
|
|
@@ -5404,7 +5489,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5404
5489
|
|
|
5405
5490
|
//#endregion
|
|
5406
5491
|
//#region package.json
|
|
5407
|
-
var version = "0.
|
|
5492
|
+
var version = "0.9.0";
|
|
5408
5493
|
|
|
5409
5494
|
//#endregion
|
|
5410
5495
|
//#region src/utils/session.ts
|
|
@@ -5447,7 +5532,26 @@ const getDefaultHeaders = (headers, provider) => {
|
|
|
5447
5532
|
|
|
5448
5533
|
//#endregion
|
|
5449
5534
|
//#region src/types/toolRouter.types.ts
|
|
5535
|
+
const SessionPreset = { DIRECT_TOOLS: "direct_tools" };
|
|
5450
5536
|
const MCPServerTypeSchema = zod_v3.default.enum(["http", "sse"]);
|
|
5537
|
+
/**
|
|
5538
|
+
* Sandbox compute tier for the tool router workbench.
|
|
5539
|
+
*
|
|
5540
|
+
* | Tier | vCPU | RAM |
|
|
5541
|
+
* | -------- | ---- | ----- |
|
|
5542
|
+
* | standard | 1 | 1 GB |
|
|
5543
|
+
* | medium | 2 | 2 GB |
|
|
5544
|
+
* | large | 4 | 4 GB |
|
|
5545
|
+
* | xlarge | 8 | 8 GB |
|
|
5546
|
+
*
|
|
5547
|
+
* Defaults to `standard` server-side when omitted.
|
|
5548
|
+
*/
|
|
5549
|
+
const SandboxSizeSchema = zod_v3.default.enum([
|
|
5550
|
+
"standard",
|
|
5551
|
+
"medium",
|
|
5552
|
+
"large",
|
|
5553
|
+
"xlarge"
|
|
5554
|
+
]);
|
|
5451
5555
|
const ToolRouterConfigManageConnectionsSchema = zod_v3.default.object({
|
|
5452
5556
|
enable: zod_v3.default.boolean().default(true).optional().describe("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"),
|
|
5453
5557
|
callbackUrl: zod_v3.default.string().optional().describe("The callback uri to use in the tool router session"),
|
|
@@ -5509,7 +5613,8 @@ const ToolRouterConfigToolsSchema = zod_v3.default.union([
|
|
|
5509
5613
|
});
|
|
5510
5614
|
}
|
|
5511
5615
|
});
|
|
5512
|
-
const
|
|
5616
|
+
const ToolRouterCreateSessionConfigBaseSchema = zod_v3.default.object({
|
|
5617
|
+
sessionPreset: zod_v3.default.literal(SessionPreset.DIRECT_TOOLS).optional().describe("Shortcut to expose every tool allowed by the session filters directly in session.tools() and the MCP tool list. This disables meta tools by default (search, multi-execute, manage-connections, and workbench). Use when all tools are known upfront and helper/meta tools are not needed. Without this preset, ToolRouter uses its default configuration with meta tools enabled."),
|
|
5513
5618
|
tools: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.union([ToolRouterToolsParamSchema, ToolRouterConfigToolsSchema])).optional().describe("The tools to use in the tool router session"),
|
|
5514
5619
|
tags: ToolRouterConfigTagsSchema.optional().describe("Global tags to filter the tools by"),
|
|
5515
5620
|
toolkits: zod_v3.default.union([
|
|
@@ -5518,24 +5623,38 @@ const ToolRouterCreateSessionConfigSchema = zod_v3.default.object({
|
|
|
5518
5623
|
ToolRouterToolkitsEnabledConfigSchema
|
|
5519
5624
|
]).optional().describe("The toolkits to use in the tool router session"),
|
|
5520
5625
|
authConfigs: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.string()).describe("The auth configs to use in the tool router session. The key is the toolkit slug, the value is the auth config id.").default({}),
|
|
5521
|
-
connectedAccounts: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.string()).describe("The connected accounts to use in the tool router session. The key is the toolkit slug, the value is
|
|
5626
|
+
connectedAccounts: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.union([zod_v3.default.string(), zod_v3.default.array(zod_v3.default.string())])).describe("The connected accounts to use in the tool router session. The key is the toolkit slug, the value is a connected account id or an array of ids. Only one account per toolkit is allowed when multi-account mode is disabled.").default({}),
|
|
5522
5627
|
manageConnections: zod_v3.default.union([zod_v3.default.boolean(), ToolRouterConfigManageConnectionsSchema]).optional().default(true).describe("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."),
|
|
5523
5628
|
workbench: zod_v3.default.object({
|
|
5524
5629
|
enable: zod_v3.default.boolean().default(true).describe("Whether to enable the workbench entirely. Defaults to true. When set to false, no code execution tools (COMPOSIO_REMOTE_WORKBENCH, COMPOSIO_REMOTE_BASH_TOOL) are available in the session."),
|
|
5525
5630
|
enableProxyExecution: zod_v3.default.boolean().optional().describe("Whether to enable proxy execution in the tool router session"),
|
|
5526
|
-
autoOffloadThreshold: zod_v3.default.number().optional().describe("The auto offload threshold in characters for the tool execution to be moved into workbench")
|
|
5631
|
+
autoOffloadThreshold: zod_v3.default.number().optional().describe("The auto offload threshold in characters for the tool execution to be moved into workbench"),
|
|
5632
|
+
sandboxSize: SandboxSizeSchema.optional().describe("Sandbox compute tier for the workbench. One of \"standard\" (1 vCPU / 1 GB), \"medium\" (2 vCPU / 2 GB), \"large\" (4 vCPU / 4 GB), or \"xlarge\" (8 vCPU / 8 GB). Defaults to \"standard\" server-side. Changing this on an existing session recreates the session's workbench sandbox on next access; the in-memory FS is lost, but /mnt/files/ persists.")
|
|
5527
5633
|
}).optional().describe("The workbench config for the tool router session"),
|
|
5528
5634
|
multiAccount: zod_v3.default.object({
|
|
5529
5635
|
enable: zod_v3.default.boolean().default(false).describe("When true, enables multi-account mode for this session. Defaults to false."),
|
|
5530
5636
|
maxAccountsPerToolkit: zod_v3.default.number().int().min(2).max(10).optional().describe("Maximum number of connected accounts allowed per toolkit. Defaults to 5 when multi-account is enabled."),
|
|
5531
5637
|
requireExplicitSelection: zod_v3.default.boolean().optional().describe("When true, require explicit account selection when multiple accounts are connected. When false (default), use the first/default account.")
|
|
5532
5638
|
}).optional().describe("Multi-account configuration for this session"),
|
|
5639
|
+
preload: zod_v3.default.object({ tools: zod_v3.default.union([zod_v3.default.array(zod_v3.default.string()), zod_v3.default.literal(require_CustomTool.PRELOAD_TOOLS_ALL)]).optional().describe("Tool slugs to preload into session.tools() and the MCP tool list, or \"all\" to preload every app tool allowed by the session filters. \"all\" requires a positive filter such as toolkits, tools, or tags; the backend validates and caps the final tool set.") }).strict().optional().describe("Preload configuration for tools that should be exposed without search."),
|
|
5533
5640
|
experimental: zod_v3.default.object({
|
|
5534
5641
|
assistivePrompt: zod_v3.default.object({ userTimezone: zod_v3.default.string().optional().describe("IANA timezone identifier (e.g., \"America/New_York\", \"Europe/London\") for timezone-aware assistive prompts") }).optional().describe("Configuration for assistive prompt generation"),
|
|
5535
5642
|
customTools: zod_v3.default.array(zod_v3.default.custom()).optional().describe("Custom tools to include in this session. Created via createCustomTool() from @composio/core/experimental."),
|
|
5536
5643
|
customToolkits: zod_v3.default.array(zod_v3.default.custom()).optional().describe("Custom toolkits to include in this session. Created via createCustomToolkit() from @composio/core/experimental.")
|
|
5537
5644
|
}).optional().describe("Experimental features configuration - not stable, may be modified or removed")
|
|
5538
5645
|
}).partial().describe("The config for the tool router session");
|
|
5646
|
+
const applyDirectToolsPresetDefaults = (value) => {
|
|
5647
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
5648
|
+
const config = value;
|
|
5649
|
+
if (config.sessionPreset !== SessionPreset.DIRECT_TOOLS) return value;
|
|
5650
|
+
return {
|
|
5651
|
+
...config,
|
|
5652
|
+
manageConnections: config.manageConnections === void 0 ? false : config.manageConnections,
|
|
5653
|
+
workbench: config.workbench === void 0 ? { enable: false } : config.workbench,
|
|
5654
|
+
preload: config.preload === void 0 ? { tools: require_CustomTool.PRELOAD_TOOLS_ALL } : config.preload
|
|
5655
|
+
};
|
|
5656
|
+
};
|
|
5657
|
+
const ToolRouterCreateSessionConfigSchema = zod_v3.default.preprocess(applyDirectToolsPresetDefaults, ToolRouterCreateSessionConfigBaseSchema).describe("The config for the tool router session");
|
|
5539
5658
|
const ToolkitConnectionStateSchema = zod_v3.default.object({
|
|
5540
5659
|
slug: zod_v3.default.string().describe("The slug of a toolkit"),
|
|
5541
5660
|
name: zod_v3.default.string().describe("The name of a toolkit"),
|
|
@@ -5654,6 +5773,34 @@ const SessionProxyExecuteParamsSchema = zod_v3.default.object({
|
|
|
5654
5773
|
value: zod_v3.default.union([zod_v3.default.string(), zod_v3.default.number()])
|
|
5655
5774
|
})).optional()
|
|
5656
5775
|
});
|
|
5776
|
+
const ToolRouterUpdateSessionConfigSchema = zod_v3.default.object({
|
|
5777
|
+
toolkits: zod_v3.default.union([
|
|
5778
|
+
ToolRouterToolkitsParamSchema,
|
|
5779
|
+
ToolRouterToolkitsDisabledConfigSchema,
|
|
5780
|
+
ToolRouterToolkitsEnabledConfigSchema
|
|
5781
|
+
]).optional(),
|
|
5782
|
+
tools: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.union([ToolRouterToolsParamSchema, ToolRouterConfigToolsSchema])).optional(),
|
|
5783
|
+
tags: ToolRouterConfigTagsSchema.optional(),
|
|
5784
|
+
authConfigs: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.string()).optional(),
|
|
5785
|
+
connectedAccounts: zod_v3.default.record(zod_v3.default.string(), zod_v3.default.union([zod_v3.default.string(), zod_v3.default.array(zod_v3.default.string())])).transform((rec) => {
|
|
5786
|
+
const out = {};
|
|
5787
|
+
for (const [k, v] of Object.entries(rec)) out[k] = typeof v === "string" ? [v] : v;
|
|
5788
|
+
return out;
|
|
5789
|
+
}).optional(),
|
|
5790
|
+
manageConnections: zod_v3.default.union([zod_v3.default.boolean(), ToolRouterConfigManageConnectionsSchema]).nullable().optional(),
|
|
5791
|
+
workbench: zod_v3.default.object({
|
|
5792
|
+
enable: zod_v3.default.boolean().optional(),
|
|
5793
|
+
enableProxyExecution: zod_v3.default.boolean().optional(),
|
|
5794
|
+
autoOffloadThreshold: zod_v3.default.number().optional(),
|
|
5795
|
+
sandboxSize: SandboxSizeSchema.optional()
|
|
5796
|
+
}).nullable().optional(),
|
|
5797
|
+
multiAccount: zod_v3.default.object({
|
|
5798
|
+
enable: zod_v3.default.boolean().optional(),
|
|
5799
|
+
maxAccountsPerToolkit: zod_v3.default.number().int().min(2).max(10).optional(),
|
|
5800
|
+
requireExplicitSelection: zod_v3.default.boolean().optional()
|
|
5801
|
+
}).nullable().optional(),
|
|
5802
|
+
preload: zod_v3.default.object({ tools: zod_v3.default.union([zod_v3.default.array(zod_v3.default.string()), zod_v3.default.literal("all")]).optional() }).strict().optional()
|
|
5803
|
+
}).partial();
|
|
5657
5804
|
|
|
5658
5805
|
//#endregion
|
|
5659
5806
|
//#region src/lib/toolRouterParams.ts
|
|
@@ -5702,15 +5849,43 @@ const transformToolRouterWorkbenchParams = (params) => {
|
|
|
5702
5849
|
return {
|
|
5703
5850
|
enable: params.enable ?? true,
|
|
5704
5851
|
enable_proxy_execution: params.enableProxyExecution,
|
|
5705
|
-
auto_offload_threshold: params.autoOffloadThreshold
|
|
5852
|
+
auto_offload_threshold: params.autoOffloadThreshold,
|
|
5853
|
+
sandbox_size: params.sandboxSize
|
|
5706
5854
|
};
|
|
5707
5855
|
};
|
|
5856
|
+
/**
|
|
5857
|
+
* PATCH-safe variant of transformToolRouterManageConnectionsParams.
|
|
5858
|
+
* Does NOT apply defaults — only includes fields explicitly present in the input.
|
|
5859
|
+
*/
|
|
5860
|
+
const transformToolRouterUpdateManageConnectionsParams = (params) => {
|
|
5861
|
+
if (typeof params === "boolean") return { enable: params };
|
|
5862
|
+
const parsedResult = ToolRouterConfigManageConnectionsSchema.safeParse(params);
|
|
5863
|
+
if (!parsedResult.success) throw new require_CustomTool.ValidationError("Failed to parse manage connections config", { cause: parsedResult.error });
|
|
5864
|
+
const config = parsedResult.data;
|
|
5865
|
+
const result = {};
|
|
5866
|
+
if (config.enable !== void 0) result.enable = config.enable;
|
|
5867
|
+
if (config.callbackUrl !== void 0) result.callback_url = config.callbackUrl;
|
|
5868
|
+
if (config.waitForConnections !== void 0) result.enable_wait_for_connections = config.waitForConnections;
|
|
5869
|
+
return result;
|
|
5870
|
+
};
|
|
5871
|
+
/**
|
|
5872
|
+
* PATCH-safe variant of transformToolRouterWorkbenchParams.
|
|
5873
|
+
* Does NOT apply `enable ?? true` default — only includes fields explicitly present.
|
|
5874
|
+
*/
|
|
5875
|
+
const transformToolRouterUpdateWorkbenchParams = (params) => {
|
|
5876
|
+
const result = {};
|
|
5877
|
+
if (params.enable !== void 0) result.enable = params.enable;
|
|
5878
|
+
if (params.enableProxyExecution !== void 0) result.enable_proxy_execution = params.enableProxyExecution;
|
|
5879
|
+
if (params.autoOffloadThreshold !== void 0) result.auto_offload_threshold = params.autoOffloadThreshold;
|
|
5880
|
+
if (params.sandboxSize !== void 0) result.sandbox_size = params.sandboxSize;
|
|
5881
|
+
return result;
|
|
5882
|
+
};
|
|
5708
5883
|
const transformToolRouterMultiAccountParams = (params) => {
|
|
5709
5884
|
if (!params) return;
|
|
5710
5885
|
const transformedParams = {
|
|
5711
5886
|
enable: params.enable,
|
|
5712
5887
|
max_accounts_per_toolkit: params.maxAccountsPerToolkit,
|
|
5713
|
-
require_explicit_selection: params.requireExplicitSelection
|
|
5888
|
+
require_explicit_selection: params.requireExplicitSelection ?? (params.enable ? true : void 0)
|
|
5714
5889
|
};
|
|
5715
5890
|
if (transformedParams.enable === void 0 && transformedParams.max_accounts_per_toolkit === void 0 && transformedParams.require_explicit_selection === void 0) return;
|
|
5716
5891
|
return transformedParams;
|
|
@@ -5720,6 +5895,32 @@ const transformToolRouterToolkitsParams = (params) => {
|
|
|
5720
5895
|
if (Array.isArray(params)) return { enable: params };
|
|
5721
5896
|
return params;
|
|
5722
5897
|
};
|
|
5898
|
+
const transformToolRouterUpdateParams = (config) => {
|
|
5899
|
+
const params = {};
|
|
5900
|
+
if (config.toolkits !== void 0) params.toolkits = transformToolRouterToolkitsParams(config.toolkits);
|
|
5901
|
+
if (config.tools !== void 0) params.tools = transformToolRouterToolsParams(config.tools);
|
|
5902
|
+
if (config.tags !== void 0) params.tags = transformToolRouterTagsParams(config.tags);
|
|
5903
|
+
if (config.authConfigs !== void 0) params.auth_configs = config.authConfigs;
|
|
5904
|
+
if (config.connectedAccounts !== void 0) {
|
|
5905
|
+
const coerced = {};
|
|
5906
|
+
for (const [k, v] of Object.entries(config.connectedAccounts)) coerced[k] = typeof v === "string" ? [v] : v;
|
|
5907
|
+
params.connected_accounts = coerced;
|
|
5908
|
+
}
|
|
5909
|
+
if (config.manageConnections !== void 0) if (config.manageConnections === null) params.manage_connections = null;
|
|
5910
|
+
else params.manage_connections = transformToolRouterUpdateManageConnectionsParams(config.manageConnections);
|
|
5911
|
+
if (config.workbench !== void 0) if (config.workbench === null) params.workbench = null;
|
|
5912
|
+
else params.workbench = transformToolRouterUpdateWorkbenchParams(config.workbench);
|
|
5913
|
+
if (config.multiAccount !== void 0) if (config.multiAccount === null) params.multi_account = null;
|
|
5914
|
+
else {
|
|
5915
|
+
const ma = {};
|
|
5916
|
+
if (config.multiAccount.enable !== void 0) ma.enable = config.multiAccount.enable;
|
|
5917
|
+
if (config.multiAccount.maxAccountsPerToolkit !== void 0) ma.max_accounts_per_toolkit = config.multiAccount.maxAccountsPerToolkit;
|
|
5918
|
+
if (config.multiAccount.requireExplicitSelection !== void 0) ma.require_explicit_selection = config.multiAccount.requireExplicitSelection;
|
|
5919
|
+
params.multi_account = ma;
|
|
5920
|
+
}
|
|
5921
|
+
if (config.preload !== void 0) params.preload = config.preload;
|
|
5922
|
+
return params;
|
|
5923
|
+
};
|
|
5723
5924
|
|
|
5724
5925
|
//#endregion
|
|
5725
5926
|
//#region src/utils/transformers/toolRouterResponseTransform.ts
|
|
@@ -6313,7 +6514,23 @@ function transformProxyParams(params) {
|
|
|
6313
6514
|
function findCustomTool(map, slug) {
|
|
6314
6515
|
if (!map) return void 0;
|
|
6315
6516
|
const upper = slug.toUpperCase();
|
|
6316
|
-
|
|
6517
|
+
const finalSlugMatch = map.byFinalSlug.get(upper);
|
|
6518
|
+
if (finalSlugMatch) return finalSlugMatch;
|
|
6519
|
+
if (map.ambiguousOriginalSlugs?.has(upper)) return void 0;
|
|
6520
|
+
return map.byOriginalSlug.get(upper);
|
|
6521
|
+
}
|
|
6522
|
+
/**
|
|
6523
|
+
* Reject ambiguous bare original slugs before falling through to backend execution.
|
|
6524
|
+
* Agents receive final slugs (LOCAL_<TOOLKIT>_<TOOL>) from schemas, while bare original
|
|
6525
|
+
* slugs are only a convenience for manual session.execute() calls when unique.
|
|
6526
|
+
*/
|
|
6527
|
+
function assertUnambiguousCustomToolSlug(map, slug) {
|
|
6528
|
+
if (!map) return;
|
|
6529
|
+
const upper = slug.toUpperCase();
|
|
6530
|
+
if (!map.ambiguousOriginalSlugs?.has(upper)) return;
|
|
6531
|
+
const finalSlugs = [...map.byFinalSlug.values()].filter((entry) => entry.handle.slug.toUpperCase() === upper).map((entry) => entry.finalSlug).sort();
|
|
6532
|
+
const hint = finalSlugs.length ? ` Use one of: ${finalSlugs.join(", ")}.` : "";
|
|
6533
|
+
throw new require_CustomTool.ValidationError(`Ambiguous custom tool slug "${slug}". Multiple custom toolkit tools share this original slug; manual session.execute() by original slug is only supported when the original slug is unique.` + hint);
|
|
6317
6534
|
}
|
|
6318
6535
|
/**
|
|
6319
6536
|
* Execute a custom tool in-process.
|
|
@@ -6345,6 +6562,12 @@ async function executeCustomTool(entry, arguments_, sessionContext) {
|
|
|
6345
6562
|
}
|
|
6346
6563
|
}
|
|
6347
6564
|
|
|
6565
|
+
//#endregion
|
|
6566
|
+
//#region src/models/inlineCustomToolsPayload.ts
|
|
6567
|
+
function inlineCustomToolsExperimental(payload) {
|
|
6568
|
+
return payload;
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6348
6571
|
//#endregion
|
|
6349
6572
|
//#region src/models/SessionContext.ts
|
|
6350
6573
|
/**
|
|
@@ -6358,10 +6581,11 @@ async function executeCustomTool(entry, arguments_, sessionContext) {
|
|
|
6358
6581
|
*/
|
|
6359
6582
|
var SessionContextImpl = class {
|
|
6360
6583
|
userId;
|
|
6361
|
-
constructor(client, userId, sessionId, customToolsMap) {
|
|
6584
|
+
constructor(client, userId, sessionId, customToolsMap, inlineCustomToolsPayload) {
|
|
6362
6585
|
this.client = client;
|
|
6363
6586
|
this.sessionId = sessionId;
|
|
6364
6587
|
this.customToolsMap = customToolsMap;
|
|
6588
|
+
this.inlineCustomToolsPayload = inlineCustomToolsPayload;
|
|
6365
6589
|
this.userId = userId;
|
|
6366
6590
|
}
|
|
6367
6591
|
/**
|
|
@@ -6381,10 +6605,14 @@ var SessionContextImpl = class {
|
|
|
6381
6605
|
logId: ""
|
|
6382
6606
|
});
|
|
6383
6607
|
}
|
|
6384
|
-
|
|
6608
|
+
assertUnambiguousCustomToolSlug(this.customToolsMap, toolSlug);
|
|
6609
|
+
const executeParams = {
|
|
6385
6610
|
tool_slug: toolSlug,
|
|
6386
6611
|
arguments: arguments_
|
|
6387
|
-
}
|
|
6612
|
+
};
|
|
6613
|
+
const experimental = inlineCustomToolsExperimental(this.inlineCustomToolsPayload);
|
|
6614
|
+
if (experimental) executeParams.experimental = experimental;
|
|
6615
|
+
const response = await this.client.toolRouter.session.execute(this.sessionId, executeParams);
|
|
6388
6616
|
return ToolRouterSessionExecuteResponseSchema.parse(transformExecuteResponse(response));
|
|
6389
6617
|
}
|
|
6390
6618
|
/**
|
|
@@ -6413,13 +6641,19 @@ var SessionContextImpl = class {
|
|
|
6413
6641
|
//#endregion
|
|
6414
6642
|
//#region src/models/ToolRouterSession.ts
|
|
6415
6643
|
const COMPOSIO_MULTI_EXECUTE_TOOL = "COMPOSIO_MULTI_EXECUTE_TOOL";
|
|
6644
|
+
const DIRECT_CUSTOM_TOOL_DESCRIPTION_PREFIX = "[Direct tool - call directly, no search needed beforehand.]";
|
|
6416
6645
|
var ToolRouterSession = class {
|
|
6417
6646
|
sessionId;
|
|
6418
6647
|
mcp;
|
|
6419
6648
|
experimental;
|
|
6649
|
+
preload;
|
|
6650
|
+
configVersion;
|
|
6651
|
+
warnings;
|
|
6652
|
+
preloadedCustomToolSlugs;
|
|
6653
|
+
inlineCustomToolsPayload;
|
|
6420
6654
|
/** Singleton session context — shared across all custom tool executions */
|
|
6421
6655
|
sessionContext;
|
|
6422
|
-
constructor(client, config, sessionId, mcp, experimentalOverrides, customToolsMap, userId) {
|
|
6656
|
+
constructor(client, config, sessionId, mcp, experimentalOverrides, customToolsMap, userId, metadata) {
|
|
6423
6657
|
this.client = client;
|
|
6424
6658
|
this.config = config;
|
|
6425
6659
|
this.customToolsMap = customToolsMap;
|
|
@@ -6431,7 +6665,12 @@ var ToolRouterSession = class {
|
|
|
6431
6665
|
assistivePrompt: experimentalOverrides?.assistivePrompt,
|
|
6432
6666
|
files: new ToolRouterSessionFilesMount(client, sessionId)
|
|
6433
6667
|
};
|
|
6434
|
-
|
|
6668
|
+
this.preload = metadata?.preload ?? { tools: [] };
|
|
6669
|
+
this.configVersion = metadata?.configVersion;
|
|
6670
|
+
this.warnings = metadata?.warnings ?? [];
|
|
6671
|
+
this.preloadedCustomToolSlugs = metadata?.preloadedCustomToolSlugs ?? [];
|
|
6672
|
+
this.inlineCustomToolsPayload = metadata?.inlineCustomToolsPayload;
|
|
6673
|
+
if (customToolsMap && userId) this.sessionContext = new SessionContextImpl(client, userId, sessionId, customToolsMap, this.inlineCustomToolsPayload);
|
|
6435
6674
|
require_Telemetry.telemetry.instrument(this, "ToolRouterSession");
|
|
6436
6675
|
}
|
|
6437
6676
|
/**
|
|
@@ -6443,19 +6682,65 @@ var ToolRouterSession = class {
|
|
|
6443
6682
|
*/
|
|
6444
6683
|
async tools(modifiers) {
|
|
6445
6684
|
const ToolsModel = new Tools(this.client, this.config);
|
|
6446
|
-
const tools = await ToolsModel.
|
|
6685
|
+
const tools = await ToolsModel.getRawToolRouterSessionTools(this.sessionId, modifiers?.modifySchema ? { modifySchema: modifiers.modifySchema } : void 0);
|
|
6686
|
+
const sessionTools = await this.addPreloadedCustomTools(tools, modifiers);
|
|
6687
|
+
const toolBySlug = new Map(sessionTools.map((tool) => [tool.slug.toUpperCase(), tool]));
|
|
6447
6688
|
if (this.hasCustomTools()) {
|
|
6448
6689
|
const routingExecuteFn = async (toolSlug, input) => {
|
|
6449
|
-
if (toolSlug === COMPOSIO_MULTI_EXECUTE_TOOL) return this.routeMultiExecute(input, ToolsModel, modifiers);
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6690
|
+
if (toolSlug === COMPOSIO_MULTI_EXECUTE_TOOL) return this.routeMultiExecute(input, ToolsModel, sessionTools, modifiers);
|
|
6691
|
+
const customTool = findCustomTool(this.customToolsMap, toolSlug);
|
|
6692
|
+
if (customTool) return executeCustomTool(customTool, input, this.sessionContext);
|
|
6693
|
+
assertUnambiguousCustomToolSlug(this.customToolsMap, toolSlug);
|
|
6694
|
+
return this.executeBackendSessionTool(ToolsModel, toolSlug, input, modifiers, toolBySlug.get(toolSlug.toUpperCase()));
|
|
6454
6695
|
};
|
|
6455
6696
|
if (!this.config?.provider) throw new Error("A provider is required when using custom tools with session.tools(). Pass a provider in the Composio constructor.");
|
|
6456
|
-
return this.config.provider.wrapTools(
|
|
6697
|
+
return this.config.provider.wrapTools(sessionTools, routingExecuteFn);
|
|
6457
6698
|
}
|
|
6458
|
-
return ToolsModel.wrapToolsForToolRouter(this.sessionId,
|
|
6699
|
+
return ToolsModel.wrapToolsForToolRouter(this.sessionId, sessionTools, modifiers);
|
|
6700
|
+
}
|
|
6701
|
+
async addPreloadedCustomTools(tools, modifiers) {
|
|
6702
|
+
const customTools = await this.getPreloadedCustomToolSchemas(modifiers);
|
|
6703
|
+
if (!customTools.length) return tools;
|
|
6704
|
+
const existingSlugs = new Set(tools.map((tool) => tool.slug.toUpperCase()));
|
|
6705
|
+
const appendedTools = customTools.filter((tool) => !existingSlugs.has(tool.slug.toUpperCase()));
|
|
6706
|
+
if (!appendedTools.length) return tools;
|
|
6707
|
+
return [...tools, ...appendedTools];
|
|
6708
|
+
}
|
|
6709
|
+
async getPreloadedCustomToolSchemas(modifiers) {
|
|
6710
|
+
if (!this.customToolsMap || !this.preloadedCustomToolSlugs.length) return [];
|
|
6711
|
+
const tools = [];
|
|
6712
|
+
for (const slug of this.preloadedCustomToolSlugs) {
|
|
6713
|
+
const entry = require_CustomTool.findCustomToolMapEntryByFinalSlug(this.customToolsMap, slug);
|
|
6714
|
+
if (!entry) continue;
|
|
6715
|
+
let tool = this.customToolEntryToTool(entry);
|
|
6716
|
+
if (modifiers?.modifySchema) tool = await modifiers.modifySchema({
|
|
6717
|
+
toolSlug: tool.slug,
|
|
6718
|
+
toolkitSlug: tool.toolkit?.slug ?? "custom",
|
|
6719
|
+
schema: tool
|
|
6720
|
+
});
|
|
6721
|
+
tools.push(tool);
|
|
6722
|
+
}
|
|
6723
|
+
return tools;
|
|
6724
|
+
}
|
|
6725
|
+
customToolEntryToTool(entry) {
|
|
6726
|
+
const toolkitSlug = entry.toolkit ?? "custom";
|
|
6727
|
+
const toolkitName = (this.customToolsMap?.toolkits?.find((toolkit) => toolkit.slug.toLowerCase() === toolkitSlug.toLowerCase()))?.name ?? entry.toolkit ?? "Custom";
|
|
6728
|
+
return {
|
|
6729
|
+
slug: entry.finalSlug,
|
|
6730
|
+
name: entry.handle.name,
|
|
6731
|
+
description: `${DIRECT_CUSTOM_TOOL_DESCRIPTION_PREFIX}\n${entry.handle.description}`,
|
|
6732
|
+
inputParameters: entry.handle.inputSchema,
|
|
6733
|
+
outputParameters: entry.handle.outputSchema,
|
|
6734
|
+
tags: [],
|
|
6735
|
+
toolkit: {
|
|
6736
|
+
slug: toolkitSlug,
|
|
6737
|
+
name: toolkitName
|
|
6738
|
+
},
|
|
6739
|
+
isDeprecated: false,
|
|
6740
|
+
availableVersions: [],
|
|
6741
|
+
scopes: [],
|
|
6742
|
+
isNoAuth: !entry.handle.extendsToolkit
|
|
6743
|
+
};
|
|
6459
6744
|
}
|
|
6460
6745
|
/**
|
|
6461
6746
|
* List all custom tools registered in this session.
|
|
@@ -6491,7 +6776,7 @@ var ToolRouterSession = class {
|
|
|
6491
6776
|
description: tk.description,
|
|
6492
6777
|
tools: tk.tools.map((tool) => {
|
|
6493
6778
|
return {
|
|
6494
|
-
slug: this.customToolsMap.byOriginalSlug.get(tool.slug.toUpperCase())?.finalSlug ?? tool.slug,
|
|
6779
|
+
slug: (require_CustomTool.findCustomToolMapEntryByToolkitAndOriginalSlug(this.customToolsMap, tk.slug, tool.slug) ?? this.customToolsMap.byOriginalSlug.get(tool.slug.toUpperCase()))?.finalSlug ?? tool.slug,
|
|
6495
6780
|
name: tool.name,
|
|
6496
6781
|
description: tool.description,
|
|
6497
6782
|
toolkit: tk.slug,
|
|
@@ -6557,10 +6842,13 @@ var ToolRouterSession = class {
|
|
|
6557
6842
|
* Returns relevant tools for the given query with schemas and guidance.
|
|
6558
6843
|
*/
|
|
6559
6844
|
async search(params) {
|
|
6560
|
-
const
|
|
6845
|
+
const experimental = inlineCustomToolsExperimental(this.inlineCustomToolsPayload);
|
|
6846
|
+
const searchParams = {
|
|
6561
6847
|
queries: [{ use_case: params.query }],
|
|
6562
|
-
...params.toolkits?.length ? { toolkits: params.toolkits } : {}
|
|
6563
|
-
|
|
6848
|
+
...params.toolkits?.length ? { toolkits: params.toolkits } : {},
|
|
6849
|
+
...experimental ? { experimental } : {}
|
|
6850
|
+
};
|
|
6851
|
+
const transformed = transformSearchResponse(await this.client.toolRouter.session.search(this.sessionId, searchParams));
|
|
6564
6852
|
return ToolRouterSessionSearchResponseSchema.parse(transformed);
|
|
6565
6853
|
}
|
|
6566
6854
|
/**
|
|
@@ -6572,9 +6860,11 @@ var ToolRouterSession = class {
|
|
|
6572
6860
|
*
|
|
6573
6861
|
* @param toolSlug - The tool slug to execute
|
|
6574
6862
|
* @param arguments_ - Optional tool arguments
|
|
6863
|
+
* @param options - Optional execution options
|
|
6864
|
+
* @param options.account - Account identifier for direct app tool execution in multi-account sessions. Helper/meta tools either ignore this top-level field or define their own account-selection fields.
|
|
6575
6865
|
* @returns The tool execution result
|
|
6576
6866
|
*/
|
|
6577
|
-
async execute(toolSlug, arguments_) {
|
|
6867
|
+
async execute(toolSlug, arguments_, options) {
|
|
6578
6868
|
const entry = findCustomTool(this.customToolsMap, toolSlug);
|
|
6579
6869
|
if (entry) {
|
|
6580
6870
|
const result = await executeCustomTool(entry, arguments_ ?? {}, this.sessionContext);
|
|
@@ -6584,10 +6874,15 @@ var ToolRouterSession = class {
|
|
|
6584
6874
|
logId: ""
|
|
6585
6875
|
};
|
|
6586
6876
|
}
|
|
6587
|
-
|
|
6877
|
+
assertUnambiguousCustomToolSlug(this.customToolsMap, toolSlug);
|
|
6878
|
+
const executeParams = {
|
|
6588
6879
|
tool_slug: toolSlug,
|
|
6589
6880
|
arguments: arguments_ ?? {}
|
|
6590
|
-
}
|
|
6881
|
+
};
|
|
6882
|
+
if (options?.account) executeParams.account = options.account;
|
|
6883
|
+
const experimental = inlineCustomToolsExperimental(this.inlineCustomToolsPayload);
|
|
6884
|
+
if (experimental) executeParams.experimental = experimental;
|
|
6885
|
+
const transformed = transformExecuteResponse(await this.client.toolRouter.session.execute(this.sessionId, executeParams));
|
|
6591
6886
|
return ToolRouterSessionExecuteResponseSchema.parse(transformed);
|
|
6592
6887
|
}
|
|
6593
6888
|
/**
|
|
@@ -6614,10 +6909,31 @@ var ToolRouterSession = class {
|
|
|
6614
6909
|
} } : {}
|
|
6615
6910
|
};
|
|
6616
6911
|
}
|
|
6912
|
+
/**
|
|
6913
|
+
* Partially update the session configuration.
|
|
6914
|
+
* Only the fields provided will be changed; omitted fields are preserved.
|
|
6915
|
+
* Mutates this session's `configVersion`, `preload`, and `warnings` in-place.
|
|
6916
|
+
*/
|
|
6917
|
+
async update(config) {
|
|
6918
|
+
const params = transformToolRouterUpdateParams(ToolRouterUpdateSessionConfigSchema.parse(config));
|
|
6919
|
+
const response = await this.client.toolRouter.session.patch(this.sessionId, params);
|
|
6920
|
+
this.configVersion = response.config_version;
|
|
6921
|
+
this.preload = response.config.preload;
|
|
6922
|
+
this.warnings = response.warnings ?? [];
|
|
6923
|
+
}
|
|
6617
6924
|
/** Check if this session has any custom tools bound. */
|
|
6618
6925
|
hasCustomTools() {
|
|
6619
6926
|
return (this.customToolsMap?.byFinalSlug.size ?? 0) > 0;
|
|
6620
6927
|
}
|
|
6928
|
+
executeBackendSessionTool(ToolsModel, toolSlug, input, modifiers, tool) {
|
|
6929
|
+
const body = {
|
|
6930
|
+
sessionId: this.sessionId,
|
|
6931
|
+
arguments: input
|
|
6932
|
+
};
|
|
6933
|
+
const experimental = inlineCustomToolsExperimental(this.inlineCustomToolsPayload);
|
|
6934
|
+
if (experimental) return ToolsModel.executeSessionTool(toolSlug, body, modifiers, tool, { experimental });
|
|
6935
|
+
return ToolsModel.executeSessionTool(toolSlug, body, modifiers, tool);
|
|
6936
|
+
}
|
|
6621
6937
|
/** Parse an individual tool item from COMPOSIO_MULTI_EXECUTE_TOOL's tools array */
|
|
6622
6938
|
parseToolItem(item) {
|
|
6623
6939
|
if (typeof item !== "object" || item === null) return {
|
|
@@ -6635,12 +6951,10 @@ var ToolRouterSession = class {
|
|
|
6635
6951
|
* Splits the tools[] array into local and remote, executes each appropriately,
|
|
6636
6952
|
* and merges results preserving original order.
|
|
6637
6953
|
*/
|
|
6638
|
-
async routeMultiExecute(input, ToolsModel, modifiers) {
|
|
6954
|
+
async routeMultiExecute(input, ToolsModel, tools, modifiers) {
|
|
6955
|
+
const multiExecuteTool = tools.find((tool) => tool.slug === COMPOSIO_MULTI_EXECUTE_TOOL);
|
|
6639
6956
|
const toolItems = input.tools;
|
|
6640
|
-
if (!Array.isArray(toolItems) || toolItems.length === 0) return
|
|
6641
|
-
sessionId: this.sessionId,
|
|
6642
|
-
arguments: input
|
|
6643
|
-
}, modifiers);
|
|
6957
|
+
if (!Array.isArray(toolItems) || toolItems.length === 0) return this.executeBackendSessionTool(ToolsModel, COMPOSIO_MULTI_EXECUTE_TOOL, input, modifiers, multiExecuteTool);
|
|
6644
6958
|
const parsed = toolItems.map((item) => this.parseToolItem(item));
|
|
6645
6959
|
const localItems = [];
|
|
6646
6960
|
const remoteIndices = [];
|
|
@@ -6650,12 +6964,12 @@ var ToolRouterSession = class {
|
|
|
6650
6964
|
index: i,
|
|
6651
6965
|
entry
|
|
6652
6966
|
});
|
|
6653
|
-
else
|
|
6967
|
+
else {
|
|
6968
|
+
assertUnambiguousCustomToolSlug(this.customToolsMap, parsed[i].tool_slug);
|
|
6969
|
+
remoteIndices.push(i);
|
|
6970
|
+
}
|
|
6654
6971
|
}
|
|
6655
|
-
if (localItems.length === 0) return
|
|
6656
|
-
sessionId: this.sessionId,
|
|
6657
|
-
arguments: input
|
|
6658
|
-
}, modifiers);
|
|
6972
|
+
if (localItems.length === 0) return this.executeBackendSessionTool(ToolsModel, COMPOSIO_MULTI_EXECUTE_TOOL, input, modifiers, multiExecuteTool);
|
|
6659
6973
|
const ctx = this.sessionContext;
|
|
6660
6974
|
const localPromises = localItems.map(async ({ index, entry }) => {
|
|
6661
6975
|
return {
|
|
@@ -6670,10 +6984,7 @@ var ToolRouterSession = class {
|
|
|
6670
6984
|
...input,
|
|
6671
6985
|
tools: remoteToolItems
|
|
6672
6986
|
};
|
|
6673
|
-
remotePromise =
|
|
6674
|
-
sessionId: this.sessionId,
|
|
6675
|
-
arguments: remoteInput
|
|
6676
|
-
}, modifiers);
|
|
6987
|
+
remotePromise = this.executeBackendSessionTool(ToolsModel, COMPOSIO_MULTI_EXECUTE_TOOL, remoteInput, modifiers, multiExecuteTool);
|
|
6677
6988
|
}
|
|
6678
6989
|
const [localResults, remoteResult] = await Promise.all([Promise.all(localPromises), remotePromise]);
|
|
6679
6990
|
if (remoteIndices.length === 0 && localResults.length === 1) return localResults[0].result;
|
|
@@ -6718,6 +7029,26 @@ var ToolRouterSession = class {
|
|
|
6718
7029
|
|
|
6719
7030
|
//#endregion
|
|
6720
7031
|
//#region src/models/ToolRouter.ts
|
|
7032
|
+
function getSessionMetadata(session) {
|
|
7033
|
+
return {
|
|
7034
|
+
preload: session.config.preload,
|
|
7035
|
+
configVersion: session.config_version,
|
|
7036
|
+
warnings: "warnings" in session ? session.warnings ?? [] : []
|
|
7037
|
+
};
|
|
7038
|
+
}
|
|
7039
|
+
function preloadsAllCustomTools(preload) {
|
|
7040
|
+
return preload?.tools === require_CustomTool.PRELOAD_TOOLS_ALL;
|
|
7041
|
+
}
|
|
7042
|
+
function prepareInlineCustomTools(options) {
|
|
7043
|
+
const { customTools, customToolkits, defaultPreload = false, preloadTools } = options;
|
|
7044
|
+
require_CustomTool.assertNoCustomToolSlugsInPreload(preloadTools, !!(customTools?.length || customToolkits?.length) ? require_CustomTool.buildCustomToolsMap(customTools ?? [], customToolkits) : void 0);
|
|
7045
|
+
const serializedTools = customTools?.length ? require_CustomTool.serializeCustomTools(customTools, { defaultPreload }) : void 0;
|
|
7046
|
+
const serializedToolkits = customToolkits?.length ? require_CustomTool.serializeCustomToolkits(customToolkits, { defaultPreload }) : void 0;
|
|
7047
|
+
return serializedTools || serializedToolkits ? {
|
|
7048
|
+
...serializedTools ? { custom_tools: serializedTools } : {},
|
|
7049
|
+
...serializedToolkits ? { custom_toolkits: serializedToolkits } : {}
|
|
7050
|
+
} : void 0;
|
|
7051
|
+
}
|
|
6721
7052
|
var ToolRouter = class {
|
|
6722
7053
|
constructor(client, config) {
|
|
6723
7054
|
this.client = client;
|
|
@@ -6733,6 +7064,8 @@ var ToolRouter = class {
|
|
|
6733
7064
|
}
|
|
6734
7065
|
/**
|
|
6735
7066
|
* Creates a new tool router session for a user.
|
|
7067
|
+
* Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools
|
|
7068
|
+
* should be exposed directly; see `ToolRouterCreateSessionConfig`.
|
|
6736
7069
|
*
|
|
6737
7070
|
* @param userId {string} The user id to create the session for
|
|
6738
7071
|
* @param config {ToolRouterCreateSessionConfig} The config for the tool router session
|
|
@@ -6740,7 +7073,7 @@ var ToolRouter = class {
|
|
|
6740
7073
|
*
|
|
6741
7074
|
* @example
|
|
6742
7075
|
* ```typescript
|
|
6743
|
-
* import { Composio
|
|
7076
|
+
* import { Composio } from '@composio/core';
|
|
6744
7077
|
*
|
|
6745
7078
|
* const composio = new Composio();
|
|
6746
7079
|
*
|
|
@@ -6756,30 +7089,49 @@ var ToolRouter = class {
|
|
|
6756
7089
|
*/
|
|
6757
7090
|
async create(userId, config) {
|
|
6758
7091
|
const routerConfig = ToolRouterCreateSessionConfigSchema.parse(config ?? {});
|
|
7092
|
+
const isDirectToolsPreset = routerConfig.sessionPreset === SessionPreset.DIRECT_TOOLS;
|
|
6759
7093
|
const customTools = routerConfig.experimental?.customTools;
|
|
6760
7094
|
const customToolkits = routerConfig.experimental?.customToolkits;
|
|
7095
|
+
const defaultCustomPreload = preloadsAllCustomTools(routerConfig.preload);
|
|
7096
|
+
const inlineCustomToolsPayload = prepareInlineCustomTools({
|
|
7097
|
+
customTools,
|
|
7098
|
+
customToolkits,
|
|
7099
|
+
defaultPreload: defaultCustomPreload,
|
|
7100
|
+
preloadTools: routerConfig.preload?.tools
|
|
7101
|
+
});
|
|
6761
7102
|
const experimentalPayload = {};
|
|
6762
7103
|
if (routerConfig.experimental?.assistivePrompt?.userTimezone) experimentalPayload.assistive_prompt_config = { user_timezone: routerConfig.experimental.assistivePrompt.userTimezone };
|
|
6763
|
-
if (
|
|
6764
|
-
if (
|
|
7104
|
+
if (inlineCustomToolsPayload?.custom_tools) experimentalPayload.custom_tools = inlineCustomToolsPayload.custom_tools;
|
|
7105
|
+
if (inlineCustomToolsPayload?.custom_toolkits) experimentalPayload.custom_toolkits = inlineCustomToolsPayload.custom_toolkits;
|
|
6765
7106
|
const multiAccountPayload = transformToolRouterMultiAccountParams(routerConfig.multiAccount);
|
|
7107
|
+
const connectedAccountsPayload = routerConfig.connectedAccounts === void 0 ? void 0 : Object.fromEntries(Object.entries(routerConfig.connectedAccounts).map(([toolkit, ids]) => [toolkit, typeof ids === "string" ? [ids] : ids]));
|
|
6766
7108
|
const payload = {
|
|
6767
7109
|
user_id: userId,
|
|
6768
7110
|
auth_configs: routerConfig.authConfigs,
|
|
6769
|
-
connected_accounts:
|
|
7111
|
+
connected_accounts: connectedAccountsPayload,
|
|
6770
7112
|
toolkits: transformToolRouterToolkitsParams(routerConfig.toolkits),
|
|
6771
7113
|
tools: transformToolRouterToolsParams(routerConfig.tools),
|
|
6772
7114
|
tags: transformToolRouterTagsParams(routerConfig.tags),
|
|
6773
7115
|
manage_connections: transformToolRouterManageConnectionsParams(routerConfig.manageConnections),
|
|
6774
7116
|
workbench: transformToolRouterWorkbenchParams(routerConfig.workbench),
|
|
6775
7117
|
multi_account: multiAccountPayload,
|
|
7118
|
+
preload: routerConfig.preload,
|
|
7119
|
+
...isDirectToolsPreset && {
|
|
7120
|
+
search: { enable: false },
|
|
7121
|
+
execute: { enable_multi_execute: false }
|
|
7122
|
+
},
|
|
6776
7123
|
experimental: Object.keys(experimentalPayload).length > 0 ? experimentalPayload : void 0
|
|
6777
7124
|
};
|
|
6778
7125
|
const session = await this.client.toolRouter.session.create(payload);
|
|
6779
7126
|
let customToolsMap;
|
|
6780
7127
|
if (customTools?.length || customToolkits?.length) customToolsMap = require_CustomTool.buildCustomToolsMapFromResponse(customTools ?? [], customToolkits, session.experimental);
|
|
7128
|
+
const metadata = {
|
|
7129
|
+
...getSessionMetadata(session),
|
|
7130
|
+
preloadedCustomToolSlugs: require_CustomTool.getPreloadedCustomToolSlugs(customToolsMap, defaultCustomPreload),
|
|
7131
|
+
inlineCustomToolsPayload
|
|
7132
|
+
};
|
|
6781
7133
|
const assistivePrompt = session.experimental?.assistive_prompt;
|
|
6782
|
-
return new ToolRouterSession(this.client, this.config, session.session_id, this.createMCPServerConfig(session.mcp), { assistivePrompt }, customToolsMap, userId);
|
|
7134
|
+
return new ToolRouterSession(this.client, this.config, session.session_id, this.createMCPServerConfig(session.mcp), { assistivePrompt }, customToolsMap, userId, metadata);
|
|
6783
7135
|
}
|
|
6784
7136
|
/**
|
|
6785
7137
|
* Use an existing session
|
|
@@ -6798,9 +7150,36 @@ var ToolRouter = class {
|
|
|
6798
7150
|
* console.log(session.mcp.headers);
|
|
6799
7151
|
* ```
|
|
6800
7152
|
*/
|
|
6801
|
-
async use(id) {
|
|
6802
|
-
const
|
|
6803
|
-
|
|
7153
|
+
async use(id, options) {
|
|
7154
|
+
const customTools = options?.customTools;
|
|
7155
|
+
const customToolkits = options?.customToolkits;
|
|
7156
|
+
const hasCustoms = !!(customTools?.length || customToolkits?.length);
|
|
7157
|
+
let session;
|
|
7158
|
+
const attachInlineCustomToolsPayload = prepareInlineCustomTools({
|
|
7159
|
+
customTools,
|
|
7160
|
+
customToolkits
|
|
7161
|
+
});
|
|
7162
|
+
let inlineCustomToolsPayload = attachInlineCustomToolsPayload;
|
|
7163
|
+
if (hasCustoms) session = await this.client.toolRouter.session.attach(id, { experimental: attachInlineCustomToolsPayload });
|
|
7164
|
+
else session = await this.client.toolRouter.session.retrieve(id);
|
|
7165
|
+
const defaultCustomPreload = preloadsAllCustomTools(session.config.preload);
|
|
7166
|
+
if (hasCustoms && defaultCustomPreload) inlineCustomToolsPayload = prepareInlineCustomTools({
|
|
7167
|
+
customTools,
|
|
7168
|
+
customToolkits,
|
|
7169
|
+
defaultPreload: true
|
|
7170
|
+
});
|
|
7171
|
+
let customToolsMap;
|
|
7172
|
+
let userId;
|
|
7173
|
+
if (hasCustoms) {
|
|
7174
|
+
customToolsMap = require_CustomTool.buildCustomToolsMapFromResponse(customTools ?? [], customToolkits, session.experimental);
|
|
7175
|
+
userId = session.config.user_id;
|
|
7176
|
+
}
|
|
7177
|
+
const metadata = {
|
|
7178
|
+
...getSessionMetadata(session),
|
|
7179
|
+
preloadedCustomToolSlugs: require_CustomTool.getPreloadedCustomToolSlugs(customToolsMap, defaultCustomPreload),
|
|
7180
|
+
inlineCustomToolsPayload
|
|
7181
|
+
};
|
|
7182
|
+
return new ToolRouterSession(this.client, this.config, session.session_id, this.createMCPServerConfig(session.mcp), void 0, customToolsMap, userId, metadata);
|
|
6804
7183
|
}
|
|
6805
7184
|
};
|
|
6806
7185
|
|
|
@@ -6847,6 +7226,8 @@ var Composio = class Composio {
|
|
|
6847
7226
|
toolRouter;
|
|
6848
7227
|
/**
|
|
6849
7228
|
* Creates a new tool router session for a user.
|
|
7229
|
+
* Use `sessionPreset: SessionPreset.DIRECT_TOOLS` when all needed tools
|
|
7230
|
+
* should be exposed directly; see `ToolRouterCreateSessionConfig`.
|
|
6850
7231
|
*
|
|
6851
7232
|
* @param userId {string} The user id to create the session for
|
|
6852
7233
|
* @param config {ToolRouterConfig} The config for the tool router session
|
|
@@ -7090,6 +7471,107 @@ var ComposioProvider = class extends BaseNonAgenticProvider {
|
|
|
7090
7471
|
|
|
7091
7472
|
//#endregion
|
|
7092
7473
|
//#region src/utils/jsonSchema.ts
|
|
7474
|
+
const MAX_REF_CHAIN_DEPTH = 100;
|
|
7475
|
+
const MAX_NODE_DEPTH = 512;
|
|
7476
|
+
const CYCLE_BREAK_SENTINEL = {
|
|
7477
|
+
type: "object",
|
|
7478
|
+
additionalProperties: true
|
|
7479
|
+
};
|
|
7480
|
+
const POLLUTING_KEYS = new Set([
|
|
7481
|
+
"__proto__",
|
|
7482
|
+
"constructor",
|
|
7483
|
+
"prototype"
|
|
7484
|
+
]);
|
|
7485
|
+
const REF_RESOLUTION_FIXES = ["Ensure the $ref pointer matches a path in $defs or definitions", "External $ref pointers (http://, https://, file://, …) are not resolved by the SDK"];
|
|
7486
|
+
const decodePointerSegment = (segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
7487
|
+
const failResolution = (pointer, segment) => {
|
|
7488
|
+
throw new require_CustomTool.JsonSchemaRefResolutionError(`Cannot resolve $ref ${pointer}`, {
|
|
7489
|
+
meta: {
|
|
7490
|
+
ref: pointer,
|
|
7491
|
+
failedAt: segment
|
|
7492
|
+
},
|
|
7493
|
+
possibleFixes: REF_RESOLUTION_FIXES
|
|
7494
|
+
});
|
|
7495
|
+
};
|
|
7496
|
+
const stepInto = (cursor, segment, pointer) => {
|
|
7497
|
+
if (cursor === null || typeof cursor !== "object") failResolution(pointer, segment);
|
|
7498
|
+
if (Array.isArray(cursor)) {
|
|
7499
|
+
const i = Number(segment);
|
|
7500
|
+
if (!Number.isInteger(i) || i < 0 || i >= cursor.length) failResolution(pointer, segment);
|
|
7501
|
+
return cursor[i];
|
|
7502
|
+
}
|
|
7503
|
+
const obj = cursor;
|
|
7504
|
+
if (!Object.prototype.hasOwnProperty.call(obj, segment)) failResolution(pointer, segment);
|
|
7505
|
+
return obj[segment];
|
|
7506
|
+
};
|
|
7507
|
+
const resolvePointer = (root, pointer) => {
|
|
7508
|
+
if (pointer === "#" || pointer === "") return root;
|
|
7509
|
+
if (!pointer.startsWith("#/")) throw new require_CustomTool.JsonSchemaRefResolutionError(`Unsupported $ref pointer: ${pointer}`, {
|
|
7510
|
+
meta: { ref: pointer },
|
|
7511
|
+
possibleFixes: REF_RESOLUTION_FIXES
|
|
7512
|
+
});
|
|
7513
|
+
return pointer.slice(2).split("/").map(decodePointerSegment).reduce((cursor, seg) => stepInto(cursor, seg, pointer), root);
|
|
7514
|
+
};
|
|
7515
|
+
/**
|
|
7516
|
+
* Inlines internal JSON Schema `$ref` pointers (`#/$defs/...` and legacy
|
|
7517
|
+
* `#/definitions/...`) so the returned schema can be safely handed to
|
|
7518
|
+
* consumers that don't tolerate unresolved references (e.g. AJV in
|
|
7519
|
+
* `@mastra/schema-compat`). External (`http://`, `https://`, …) refs are
|
|
7520
|
+
* left untouched. Cycles are broken with `{ type: 'object',
|
|
7521
|
+
* additionalProperties: true }`. The input is never mutated.
|
|
7522
|
+
*
|
|
7523
|
+
* @throws {JsonSchemaRefResolutionError} on malformed pointers, missing
|
|
7524
|
+
* targets, or chains past the depth cap.
|
|
7525
|
+
*/
|
|
7526
|
+
function dereferenceJsonSchema(schema) {
|
|
7527
|
+
if (!require_FileToolModifier_utils_neutral.isPlainObject(schema)) return schema;
|
|
7528
|
+
const root = schema;
|
|
7529
|
+
const visiting = /* @__PURE__ */ new WeakSet();
|
|
7530
|
+
const cloneChildren = (obj, visitedRefs, chainDepth, nodeDepth) => Object.fromEntries(Object.entries(obj).filter(([k]) => !POLLUTING_KEYS.has(k)).map(([k, v]) => [k, walk(v, visitedRefs, chainDepth, nodeDepth + 1)]));
|
|
7531
|
+
function walk(node, visitedRefs, chainDepth, nodeDepth) {
|
|
7532
|
+
if (nodeDepth >= MAX_NODE_DEPTH) throw new require_CustomTool.JsonSchemaRefResolutionError(`JSON Schema node depth exceeded cap (${MAX_NODE_DEPTH})`, { possibleFixes: REF_RESOLUTION_FIXES });
|
|
7533
|
+
if (Array.isArray(node)) {
|
|
7534
|
+
if (visiting.has(node)) return { ...CYCLE_BREAK_SENTINEL };
|
|
7535
|
+
visiting.add(node);
|
|
7536
|
+
try {
|
|
7537
|
+
return node.map((item) => walk(item, visitedRefs, chainDepth, nodeDepth + 1));
|
|
7538
|
+
} finally {
|
|
7539
|
+
visiting.delete(node);
|
|
7540
|
+
}
|
|
7541
|
+
}
|
|
7542
|
+
if (!require_FileToolModifier_utils_neutral.isPlainObject(node)) return node;
|
|
7543
|
+
if (visiting.has(node)) return { ...CYCLE_BREAK_SENTINEL };
|
|
7544
|
+
visiting.add(node);
|
|
7545
|
+
try {
|
|
7546
|
+
const ref = typeof node.$ref === "string" ? node.$ref : null;
|
|
7547
|
+
if (ref === null || !ref.startsWith("#")) {
|
|
7548
|
+
if (ref !== null) require_FileModifierErrors.logger_default.warn(`Leaving external $ref untouched: ${ref}`);
|
|
7549
|
+
return cloneChildren(node, visitedRefs, chainDepth, nodeDepth);
|
|
7550
|
+
}
|
|
7551
|
+
if (chainDepth >= MAX_REF_CHAIN_DEPTH) throw new require_CustomTool.JsonSchemaRefResolutionError(`JSON Schema $ref chain exceeded depth cap (${MAX_REF_CHAIN_DEPTH}): ${ref}`, {
|
|
7552
|
+
meta: { ref },
|
|
7553
|
+
possibleFixes: REF_RESOLUTION_FIXES
|
|
7554
|
+
});
|
|
7555
|
+
if (visitedRefs.has(ref)) return { ...CYCLE_BREAK_SENTINEL };
|
|
7556
|
+
const resolved = walk(resolvePointer(root, ref), new Set(visitedRefs).add(ref), chainDepth + 1, nodeDepth + 1);
|
|
7557
|
+
const siblings = { ...node };
|
|
7558
|
+
delete siblings.$ref;
|
|
7559
|
+
if (Object.keys(siblings).length === 0 || !require_FileToolModifier_utils_neutral.isPlainObject(resolved)) return resolved;
|
|
7560
|
+
return {
|
|
7561
|
+
...resolved,
|
|
7562
|
+
...cloneChildren(siblings, visitedRefs, chainDepth, nodeDepth)
|
|
7563
|
+
};
|
|
7564
|
+
} finally {
|
|
7565
|
+
visiting.delete(node);
|
|
7566
|
+
}
|
|
7567
|
+
}
|
|
7568
|
+
const out = walk(root, /* @__PURE__ */ new Set(), 0, 0);
|
|
7569
|
+
if (require_FileToolModifier_utils_neutral.isPlainObject(out)) {
|
|
7570
|
+
delete out.$defs;
|
|
7571
|
+
delete out.definitions;
|
|
7572
|
+
}
|
|
7573
|
+
return out;
|
|
7574
|
+
}
|
|
7093
7575
|
/**
|
|
7094
7576
|
* Removes all non-required properties from the schema
|
|
7095
7577
|
*
|
|
@@ -7664,6 +8146,7 @@ exports.ComposioGenerateURLResponseSchema = ComposioGenerateURLResponseSchema;
|
|
|
7664
8146
|
exports.ComposioGlobalExecuteToolFnNotSetError = require_CustomTool.ComposioGlobalExecuteToolFnNotSetError;
|
|
7665
8147
|
exports.ComposioInvalidExecuteFunctionError = require_CustomTool.ComposioInvalidExecuteFunctionError;
|
|
7666
8148
|
exports.ComposioInvalidModifierError = require_CustomTool.ComposioInvalidModifierError;
|
|
8149
|
+
exports.ComposioLegacyConnectedAccountsEndpointRetiredError = require_CustomTool.ComposioLegacyConnectedAccountsEndpointRetiredError;
|
|
7667
8150
|
exports.ComposioMcpDeleteResponseSchema = ComposioMcpDeleteResponseSchema;
|
|
7668
8151
|
exports.ComposioMcpListResponseSchema = ComposioMcpListResponseSchema;
|
|
7669
8152
|
exports.ComposioMcpRetrieveResponseSchema = ComposioMcpRetrieveResponseSchema;
|
|
@@ -7721,6 +8204,7 @@ exports.GenerateURLParamsSchema = GenerateURLParamsSchema;
|
|
|
7721
8204
|
exports.GenerateURLResponseSchema = GenerateURLResponseSchema;
|
|
7722
8205
|
exports.IncomingTriggerPayloadSchema = IncomingTriggerPayloadSchema;
|
|
7723
8206
|
exports.JSONSchemaPropertySchema = JSONSchemaPropertySchema;
|
|
8207
|
+
exports.JsonSchemaRefResolutionError = require_CustomTool.JsonSchemaRefResolutionError;
|
|
7724
8208
|
exports.JsonSchemaToZodError = require_CustomTool.JsonSchemaToZodError;
|
|
7725
8209
|
exports.MCP = MCP;
|
|
7726
8210
|
exports.MCPAuthOptionsSchema = MCPAuthOptionsSchema;
|
|
@@ -7753,6 +8237,7 @@ exports.Oauth2FailedConnectionDataSchema = Oauth2FailedConnectionDataSchema;
|
|
|
7753
8237
|
exports.Oauth2InactiveConnectionDataSchema = Oauth2InactiveConnectionDataSchema;
|
|
7754
8238
|
exports.Oauth2InitiatedConnectionDataSchema = Oauth2InitiatedConnectionDataSchema;
|
|
7755
8239
|
exports.Oauth2InitiatingConnectionDataSchema = Oauth2InitiatingConnectionDataSchema;
|
|
8240
|
+
exports.Oauth2RevokedConnectionDataSchema = Oauth2RevokedConnectionDataSchema;
|
|
7756
8241
|
exports.OpenAIProvider = OpenAIProvider;
|
|
7757
8242
|
exports.RedirectableAuthSchemeSchema = RedirectableAuthSchemeSchema;
|
|
7758
8243
|
exports.RemoteFile = RemoteFile;
|
|
@@ -7760,6 +8245,8 @@ exports.RemoteFileDataSchema = RemoteFileDataSchema;
|
|
|
7760
8245
|
exports.RemoteFileDownloadError = require_CustomTool.RemoteFileDownloadError;
|
|
7761
8246
|
exports.RemoteFileErrorCodes = require_CustomTool.RemoteFileErrorCodes;
|
|
7762
8247
|
exports.SDKErrorCodes = require_CustomTool.SDKErrorCodes;
|
|
8248
|
+
exports.SandboxSizeSchema = SandboxSizeSchema;
|
|
8249
|
+
exports.SessionPreset = SessionPreset;
|
|
7763
8250
|
exports.SessionProxyExecuteParamsSchema = SessionProxyExecuteParamsSchema;
|
|
7764
8251
|
exports.SingleConnectedAccountDetailedResponseSchema = SingleConnectedAccountDetailedResponseSchema;
|
|
7765
8252
|
exports.ToolErrorCodes = require_CustomTool.ToolErrorCodes;
|
|
@@ -7792,6 +8279,7 @@ exports.ToolRouterToolkitsEnabledConfigSchema = ToolRouterToolkitsEnabledConfigS
|
|
|
7792
8279
|
exports.ToolRouterToolkitsOptionsSchema = ToolRouterToolkitsOptionsSchema;
|
|
7793
8280
|
exports.ToolRouterToolkitsParamSchema = ToolRouterToolkitsParamSchema;
|
|
7794
8281
|
exports.ToolRouterToolsParamSchema = ToolRouterToolsParamSchema;
|
|
8282
|
+
exports.ToolRouterUpdateSessionConfigSchema = ToolRouterUpdateSessionConfigSchema;
|
|
7795
8283
|
exports.ToolSchema = ToolSchema;
|
|
7796
8284
|
exports.ToolkitAuthConfigDetailsSchema = ToolkitAuthConfigDetailsSchema;
|
|
7797
8285
|
exports.ToolkitAuthFieldSchema = ToolkitAuthFieldSchema;
|
|
@@ -7847,6 +8335,7 @@ Object.defineProperty(exports, 'constants', {
|
|
|
7847
8335
|
}
|
|
7848
8336
|
});
|
|
7849
8337
|
exports.createConnectionRequest = createConnectionRequest;
|
|
8338
|
+
exports.dereferenceJsonSchema = dereferenceJsonSchema;
|
|
7850
8339
|
exports.experimental_createTool = require_CustomTool.createCustomTool;
|
|
7851
8340
|
exports.experimental_createToolkit = require_CustomTool.createCustomToolkit;
|
|
7852
8341
|
exports.getExtensionFromMimeType = getExtensionFromMimeType;
|