@ancha-labs/cli 0.4.40 → 0.4.41
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/lib/ancha.mjs +1170 -584
- package/lib/assets/SKILL.md +4 -1
- package/lib/assets/agents-section.md +4 -1
- package/lib/assets/data/pellmont/pellmont-approved-merge.yaml +75 -0
- package/lib/assets/data/pellmont/pellmont-building-services.yaml +1704 -0
- package/lib/assets/data/pellmont/pellmont-duplicates.yaml +21 -0
- package/lib/assets/docs/cloud.md +26 -9
- package/lib/assets/docs/run.md +1 -1
- package/lib/assets/docs/setup.md +4 -1
- package/lib/assets/harbor/companion.mjs +209 -18
- package/lib/assets/ui/app.js +8 -6
- package/lib/mcp-entry.mjs +1 -1
- package/lib/worker.mjs +354 -84
- package/lib/world-server.mjs +1 -1
- package/package.json +1 -1
package/lib/worker.mjs
CHANGED
|
@@ -20533,37 +20533,42 @@ var init_errors3 = __esm({
|
|
|
20533
20533
|
// packages/core/src/agent-routes.ts
|
|
20534
20534
|
function parseAgentRoutes(value5) {
|
|
20535
20535
|
const parsed4 = agentRoutesSchema.safeParse(value5);
|
|
20536
|
-
if (!parsed4.success) throw new AnchaError("CONFIG_INVALID", "agent.routes must be a mapping containing
|
|
20536
|
+
if (!parsed4.success) throw new AnchaError("CONFIG_INVALID", "agent.routes must be a mapping containing quickbooks: composio and/or netsuite: composio");
|
|
20537
20537
|
return parsed4.data;
|
|
20538
20538
|
}
|
|
20539
|
-
function validateAgentRoutes(agent,
|
|
20539
|
+
function validateAgentRoutes(agent, _twins) {
|
|
20540
20540
|
if (agent.routes === void 0) return;
|
|
20541
20541
|
const routes2 = parseAgentRoutes(agent.routes);
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20542
|
+
for (const toolkit of ["quickbooks", "netsuite"]) {
|
|
20543
|
+
if (!routes2[toolkit]) continue;
|
|
20544
|
+
if (!agent.passEnv?.includes("COMPOSIO_API_KEY")) throw new AnchaError("CONFIG_INVALID", `agent.routes.${toolkit} requires COMPOSIO_API_KEY in agent.pass_env`);
|
|
20545
|
+
}
|
|
20545
20546
|
}
|
|
20546
20547
|
function mergeRouteSummaries(values3) {
|
|
20547
|
-
const
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
}
|
|
20564
|
-
|
|
20548
|
+
const result = {};
|
|
20549
|
+
for (const toolkit of ["quickbooks", "netsuite"]) {
|
|
20550
|
+
const routes2 = values3.flatMap((value5) => value5?.[toolkit] ? [value5[toolkit]] : []);
|
|
20551
|
+
if (!routes2.length) continue;
|
|
20552
|
+
const via = { direct: 0, session: 0, mcp: 0 };
|
|
20553
|
+
for (const route15 of routes2) for (const path8 of ["direct", "session", "mcp"]) via[path8] += route15.via?.[path8] ?? 0;
|
|
20554
|
+
const narrowed = [...new Set(routes2.flatMap((route15) => route15.narrowed ?? []))].sort();
|
|
20555
|
+
result[toolkit] = {
|
|
20556
|
+
platform: "composio",
|
|
20557
|
+
executions: routes2.reduce((n2, r2) => n2 + r2.executions, 0),
|
|
20558
|
+
reached: routes2.reduce((n2, r2) => n2 + r2.reached, 0),
|
|
20559
|
+
refused: routes2.reduce((n2, r2) => n2 + r2.refused, 0),
|
|
20560
|
+
...routes2.some((r2) => r2.via !== void 0) && { via },
|
|
20561
|
+
...routes2.some((r2) => r2.sessions !== void 0) && { sessions: routes2.reduce((n2, r2) => n2 + (r2.sessions ?? 0), 0) },
|
|
20562
|
+
...narrowed.length && { narrowed },
|
|
20563
|
+
...routes2.some((r2) => r2.connection) && { connection: routes2.some((r2) => r2.connection === "failed") ? "failed" : "created" },
|
|
20564
|
+
...routes2.some((r2) => r2.cleanup) && { cleanup: routes2.some((r2) => r2.cleanup === "failed") ? "failed" : "done" }
|
|
20565
|
+
};
|
|
20566
|
+
}
|
|
20567
|
+
return Object.keys(result).length ? result : void 0;
|
|
20568
|
+
}
|
|
20569
|
+
function formatRouteSummary(route15, toolkit = "quickbooks") {
|
|
20565
20570
|
return [
|
|
20566
|
-
|
|
20571
|
+
`${toolkit === "quickbooks" ? "QuickBooks" : "NetSuite"} via Composio: ${route15.executions} executions, ${route15.reached} reached the world, ${route15.refused} refused`,
|
|
20567
20572
|
...route15.via ? [`via direct ${route15.via.direct} / session ${route15.via.session} / MCP ${route15.via.mcp}`] : [],
|
|
20568
20573
|
...route15.sessions !== void 0 ? [`${route15.sessions} sessions`] : [],
|
|
20569
20574
|
...route15.narrowed?.length ? [`narrowed: ${route15.narrowed.join(", ")}`] : [],
|
|
@@ -20577,7 +20582,7 @@ var init_agent_routes = __esm({
|
|
|
20577
20582
|
"use strict";
|
|
20578
20583
|
init_zod();
|
|
20579
20584
|
init_errors3();
|
|
20580
|
-
agentRoutesSchema = external_exports.strictObject({ quickbooks: external_exports.literal("composio").optional() });
|
|
20585
|
+
agentRoutesSchema = external_exports.strictObject({ quickbooks: external_exports.literal("composio").optional(), netsuite: external_exports.literal("composio").optional() });
|
|
20581
20586
|
}
|
|
20582
20587
|
});
|
|
20583
20588
|
|
|
@@ -21163,6 +21168,16 @@ var init_clock = __esm({
|
|
|
21163
21168
|
|
|
21164
21169
|
// packages/core/src/ids.ts
|
|
21165
21170
|
import { createHash } from "node:crypto";
|
|
21171
|
+
function memoryCounters() {
|
|
21172
|
+
const counts2 = /* @__PURE__ */ new Map();
|
|
21173
|
+
return {
|
|
21174
|
+
next(namespace) {
|
|
21175
|
+
const n2 = counts2.get(namespace) ?? 0;
|
|
21176
|
+
counts2.set(namespace, n2 + 1);
|
|
21177
|
+
return n2;
|
|
21178
|
+
}
|
|
21179
|
+
};
|
|
21180
|
+
}
|
|
21166
21181
|
function validateLength(len) {
|
|
21167
21182
|
if (!Number.isInteger(len) || len < 1 || len > 4096) throw new RangeError("ID length must be an integer from 1 to 4096");
|
|
21168
21183
|
}
|
|
@@ -70944,6 +70959,14 @@ var init_jobs_contract = __esm({
|
|
|
70944
70959
|
|
|
70945
70960
|
// backend/src/execution/composio.ts
|
|
70946
70961
|
import { timingSafeEqual } from "node:crypto";
|
|
70962
|
+
function noWorldMessage(toolkit) {
|
|
70963
|
+
const name5 = toolkit === "quickbooks" ? "QuickBooks" : "NetSuite";
|
|
70964
|
+
return `This test's world has no ${name5}. Add ${name5} to the test's world or run this call in a test whose world has it.`;
|
|
70965
|
+
}
|
|
70966
|
+
function requireWorld(name5, route15) {
|
|
70967
|
+
const toolkit = name5.startsWith("QUICKBOOKS_") ? "quickbooks" : name5.startsWith("NETSUITE_") ? "netsuite" : void 0;
|
|
70968
|
+
if (toolkit && (route15.toolkits ?? { quickbooks: "composio" })[toolkit] && !activeComposioToolkits(route15)[toolkit]) throw new RouteRefusal("NO_WORLD", toolkit);
|
|
70969
|
+
}
|
|
70947
70970
|
function parsed2(schema2, value5) {
|
|
70948
70971
|
const result = schema2.safeParse(value5);
|
|
70949
70972
|
return result.success ? result.data : refuse("SCHEMA");
|
|
@@ -70957,12 +70980,16 @@ function jsonBody(body7, contentType) {
|
|
|
70957
70980
|
return refuse("JSON");
|
|
70958
70981
|
}
|
|
70959
70982
|
}
|
|
70960
|
-
function toolArguments(name5, value5 = {}, metaOnly = false) {
|
|
70983
|
+
function toolArguments(route15, name5, value5 = {}, metaOnly = false) {
|
|
70984
|
+
requireWorld(name5, route15);
|
|
70985
|
+
if (name5.startsWith("NETSUITE_")) refuse("NETSUITE_TOOL");
|
|
70961
70986
|
if (!meta3.has(name5) && (metaOnly || !quickbooks.test(name5))) refuse(name5.startsWith("COMPOSIO_") || metaOnly ? "META_TOOL" : "TOOL");
|
|
70962
70987
|
const { account: _account, ...args } = value5;
|
|
70963
70988
|
if (name5 === multi) {
|
|
70964
70989
|
const items = parsed2(external_exports.array(external_exports.object({ tool_slug: external_exports.string(), arguments: record7.optional() }).passthrough()).min(1), args.tools);
|
|
70990
|
+
for (const item2 of items) requireWorld(item2.tool_slug, route15);
|
|
70965
70991
|
args.tools = items.map(({ account: _account2, connected_account_id: _id, user_id: _user, ...item2 }) => {
|
|
70992
|
+
if (item2.tool_slug.startsWith("NETSUITE_")) refuse("NETSUITE_TOOL");
|
|
70966
70993
|
if (!quickbooks.test(item2.tool_slug)) refuse(item2.tool_slug.startsWith("COMPOSIO_") ? "META_TOOL" : "TOOL");
|
|
70967
70994
|
return item2;
|
|
70968
70995
|
});
|
|
@@ -70988,18 +71015,32 @@ function validateComposio(method2, target5, apiKey, body7, contentType, route15,
|
|
|
70988
71015
|
if (typeof apiKey !== "string" || !route15.agentKey || Buffer.byteLength(apiKey) !== Buffer.byteLength(route15.agentKey) || !timingSafeEqual(Buffer.from(apiKey), Buffer.from(route15.agentKey))) refuse("API_KEY");
|
|
70989
71016
|
if (!target5.startsWith("/") || target5.length > 8192 || target5.includes("#") || /[%\\\x00-\x20\x7f#]/.test(target5.split("?")[0]) || target5.includes("//") || target5.split("?")[0].split("/").some((part) => part === "." || part === "..")) refuse("PATH");
|
|
70990
71017
|
const url4 = new URL(target5, "https://backend.composio.dev");
|
|
70991
|
-
const
|
|
71018
|
+
const qb = !!activeComposioToolkits(route15).quickbooks;
|
|
71019
|
+
const base6 = { toolkit: qb ? "quickbooks" : "netsuite", op: "catalog", via: composioVia(target5), target: target5 };
|
|
70992
71020
|
const noQuery = () => {
|
|
70993
71021
|
if (url4.search) refuse("QUERY");
|
|
70994
71022
|
};
|
|
70995
71023
|
const empty2 = () => {
|
|
70996
71024
|
if (body7.length) refuse("SCHEMA");
|
|
70997
71025
|
};
|
|
71026
|
+
if (/^\/api\/v3(?:\.1)?\/tools\/execute\/COMPOSIO_MULTI_EXECUTE_TOOL$/.test(url4.pathname)) {
|
|
71027
|
+
if (method2 !== "POST") refuse("METHOD");
|
|
71028
|
+
noQuery();
|
|
71029
|
+
const value5 = parsed2(bodySchema, jsonBody(body7, contentType));
|
|
71030
|
+
toolArguments(route15, multi, value5.arguments);
|
|
71031
|
+
refuse("META_TOOL");
|
|
71032
|
+
}
|
|
70998
71033
|
const match3 = execution.exec(url4.pathname);
|
|
70999
71034
|
if (match3) {
|
|
71000
71035
|
if (method2 !== "POST") refuse("METHOD");
|
|
71001
71036
|
noQuery();
|
|
71002
71037
|
const value5 = parsed2(bodySchema, jsonBody(body7, contentType));
|
|
71038
|
+
requireWorld(match3[1], route15);
|
|
71039
|
+
if (match3[1].startsWith("NETSUITE_")) {
|
|
71040
|
+
if (!route15.netsuite || match3[1] !== "NETSUITE_RUN_SUITEQL_QUERY") refuse("NETSUITE_TOOL");
|
|
71041
|
+
return { ...base6, toolkit: "netsuite", op: "execute", local: "netsuite", slug: match3[1], arguments: value5.arguments ?? {} };
|
|
71042
|
+
}
|
|
71043
|
+
if (!qb) refuse("TOOL");
|
|
71003
71044
|
const { connected_account_id: _id, custom_connection_data: _data, entity_id: _entity, custom_auth_params: _auth, ...kept } = value5;
|
|
71004
71045
|
return { ...base6, op: "execute", slug: match3[1], body: bytes({ ...kept, user_id: route15.user, custom_auth_params: {
|
|
71005
71046
|
base_url: route15.publicUrl,
|
|
@@ -71017,11 +71058,13 @@ function validateComposio(method2, target5, apiKey, body7, contentType, route15,
|
|
|
71017
71058
|
if (!["initialize", "notifications/initialized", "notifications/cancelled", "ping", "tools/list", "tools/call"].includes(value5.method)) refuse("MCP_METHOD");
|
|
71018
71059
|
if (value5.method === "tools/call") {
|
|
71019
71060
|
const params10 = parsed2(external_exports.strictObject({ name: external_exports.string(), arguments: record7.optional(), account: external_exports.unknown().optional(), _meta: record7.optional() }), value5.params);
|
|
71020
|
-
const call2 = toolArguments(params10.name, params10.arguments);
|
|
71061
|
+
const call2 = toolArguments(route15, params10.name, params10.arguments);
|
|
71062
|
+
if (!qb) refuse("SESSION_ENDPOINT");
|
|
71021
71063
|
const { account: _account, ...kept } = params10;
|
|
71022
71064
|
value5.params = { ...kept, arguments: call2.arguments };
|
|
71023
71065
|
return { ...base6, op: call2.op, slug: params10.name, headers: forwarded2, body: bytes(value5) };
|
|
71024
71066
|
}
|
|
71067
|
+
if (!qb) refuse("SESSION_ENDPOINT");
|
|
71025
71068
|
return { ...base6, headers: forwarded2, body: bytes(value5) };
|
|
71026
71069
|
}
|
|
71027
71070
|
const session2 = /^\/api\/v3(?:\.1)?\/tool_router\/session(?:\/([^/]+)(.*))?$/.exec(url4.pathname);
|
|
@@ -71032,13 +71075,14 @@ function validateComposio(method2, target5, apiKey, body7, contentType, route15,
|
|
|
71032
71075
|
noQuery();
|
|
71033
71076
|
const value6 = parsed2(sessionSchema, jsonBody(body7, contentType));
|
|
71034
71077
|
const narrowed = /* @__PURE__ */ new Set();
|
|
71078
|
+
const declared = route15.toolkits ?? { quickbooks: "composio" };
|
|
71035
71079
|
const note2 = (name6) => {
|
|
71036
|
-
if (name6.toLowerCase()
|
|
71080
|
+
if (!(name6.toLowerCase() === "quickbooks" && declared.quickbooks) && !(name6.toLowerCase() === "netsuite" && declared.netsuite)) narrowed.add(name6);
|
|
71037
71081
|
};
|
|
71038
71082
|
const toolkitApprovals = slugList.safeParse(value6.toolkits?.require_approval);
|
|
71039
71083
|
for (const name6 of [...Object.keys(value6.auth_configs ?? {}), ...Object.keys(value6.connected_accounts ?? {}), ...Object.keys(value6.tools ?? {}), ...value6.toolkits?.enable ?? [], ...toolkitApprovals.success ? toolkitApprovals.data : []]) note2(name6);
|
|
71040
71084
|
const keepSlugs = (slugs2) => slugs2.filter((name6) => {
|
|
71041
|
-
if (quickbooks.test(name6)) return true;
|
|
71085
|
+
if (qb && quickbooks.test(name6)) return true;
|
|
71042
71086
|
const toolkit2 = /^([A-Z0-9]+)_/.exec(name6)?.[1]?.toLowerCase();
|
|
71043
71087
|
if (toolkit2) note2(toolkit2);
|
|
71044
71088
|
return false;
|
|
@@ -71060,6 +71104,7 @@ function validateComposio(method2, target5, apiKey, body7, contentType, route15,
|
|
|
71060
71104
|
const preload = listed.success ? { tools: listed.data.tools === "all" ? "all" : keepSlugs(listed.data.tools) } : void 0;
|
|
71061
71105
|
const search10 = switchOf(value6.search, "enable"), multiExecute = switchOf(value6.execute, "enable_multi_execute");
|
|
71062
71106
|
const approveToolkit = toolkitApprovals.success && toolkitApprovals.data.some((name6) => name6.toLowerCase() === "quickbooks");
|
|
71107
|
+
if (!qb) return { ...base6, local: "session", response: "session-create", narrowed: [...narrowed] };
|
|
71063
71108
|
return { ...base6, connection: "session", response: "session-create", narrowed: [...narrowed], body: bytes({
|
|
71064
71109
|
user_id: route15.user,
|
|
71065
71110
|
toolkits: { enable: ["quickbooks"], ...approveToolkit && { require_approval: ["quickbooks"] } },
|
|
@@ -71077,12 +71122,13 @@ function validateComposio(method2, target5, apiKey, body7, contentType, route15,
|
|
|
71077
71122
|
if (!identifier.test(sid) || !route15.sessions.has(sid)) refuse("SESSION");
|
|
71078
71123
|
if (method2 === "PATCH") refuse("SESSION_MUTATION");
|
|
71079
71124
|
if (!["", "/tools", "/toolkits", "/execute", "/execute_meta", "/search"].includes(suffix)) refuse("SESSION_ENDPOINT");
|
|
71125
|
+
if (!qb && suffix !== "" && suffix !== "/execute" && suffix !== "/execute_meta") refuse("SESSION_ENDPOINT");
|
|
71080
71126
|
if (suffix === "" || suffix === "/tools" || suffix === "/toolkits") {
|
|
71081
71127
|
if (method2 !== "GET" && !(suffix === "" && method2 === "DELETE")) refuse("METHOD");
|
|
71082
71128
|
empty2();
|
|
71083
71129
|
if (suffix === "") {
|
|
71084
71130
|
noQuery();
|
|
71085
|
-
return { ...base6, response: method2 === "GET" ? "session-get" : "session-delete", sessionId: sid };
|
|
71131
|
+
return { ...base6, ...!qb && { local: "session" }, response: method2 === "GET" ? "session-get" : "session-delete", sessionId: sid };
|
|
71086
71132
|
}
|
|
71087
71133
|
return base6;
|
|
71088
71134
|
}
|
|
@@ -71093,12 +71139,19 @@ function validateComposio(method2, target5, apiKey, body7, contentType, route15,
|
|
|
71093
71139
|
const extra2 = { input_responses: external_exports.unknown().optional(), request_state: external_exports.unknown().optional(), experimental: external_exports.unknown().optional() };
|
|
71094
71140
|
const call2 = suffix === "/execute" ? parsed2(external_exports.strictObject({ tool_slug: external_exports.string(), arguments: record7.optional(), account: external_exports.unknown().optional(), enable_auto_workbench_offload: external_exports.boolean().optional(), ...extra2 }), value5) : parsed2(external_exports.strictObject({ slug: external_exports.string(), arguments: record7.optional(), ...extra2 }), value5);
|
|
71095
71141
|
const name5 = "tool_slug" in call2 ? call2.tool_slug : call2.slug;
|
|
71096
|
-
|
|
71142
|
+
requireWorld(name5, route15);
|
|
71143
|
+
if (name5.startsWith("NETSUITE_")) {
|
|
71144
|
+
if (!route15.netsuite || name5 !== "NETSUITE_RUN_SUITEQL_QUERY" || suffix !== "/execute") refuse("NETSUITE_TOOL");
|
|
71145
|
+
return { ...base6, toolkit: "netsuite", op: "execute", local: "netsuite", slug: name5, arguments: call2.arguments ?? {} };
|
|
71146
|
+
}
|
|
71147
|
+
const checked = toolArguments(route15, name5, call2.arguments, suffix === "/execute_meta");
|
|
71148
|
+
if (!qb) refuse("SESSION_ENDPOINT");
|
|
71097
71149
|
const kept = { ...call2.input_responses !== void 0 && { input_responses: call2.input_responses }, ...call2.request_state !== void 0 && { request_state: call2.request_state } };
|
|
71098
71150
|
return { ...base6, op: checked.op, slug: name5, body: bytes(suffix === "/execute" ? { tool_slug: name5, arguments: checked.arguments, ..."enable_auto_workbench_offload" in call2 && { enable_auto_workbench_offload: false }, ...kept } : { slug: name5, arguments: checked.arguments, ...kept }) };
|
|
71099
71151
|
}
|
|
71100
71152
|
const accounts2 = /^\/api\/v3(?:\.1)?\/connected_accounts(?:\/(.*))?$/.exec(url4.pathname);
|
|
71101
71153
|
if (accounts2) {
|
|
71154
|
+
if (!qb) refuse("ACCOUNT");
|
|
71102
71155
|
if (method2 !== "GET") refuse("ACCOUNT");
|
|
71103
71156
|
empty2();
|
|
71104
71157
|
const id14 = accounts2[1];
|
|
@@ -71115,6 +71168,16 @@ function validateComposio(method2, target5, apiKey, body7, contentType, route15,
|
|
|
71115
71168
|
}
|
|
71116
71169
|
return { ...base6, connection: "accounts", target: url4.pathname + "?" + query11.toString() };
|
|
71117
71170
|
}
|
|
71171
|
+
const schema2 = /^\/api\/v3(?:\.1)?\/tools\/(NETSUITE_RUN_SUITEQL_QUERY)$/.exec(url4.pathname);
|
|
71172
|
+
if (schema2) {
|
|
71173
|
+
requireWorld(schema2[1], route15);
|
|
71174
|
+
if (!route15.netsuite) refuse("NETSUITE_TOOL");
|
|
71175
|
+
if (method2 !== "GET") refuse("METHOD");
|
|
71176
|
+
empty2();
|
|
71177
|
+
return { ...base6, toolkit: "netsuite", slug: schema2[1] };
|
|
71178
|
+
}
|
|
71179
|
+
if (/NETSUITE_/i.test(url4.pathname)) refuse("NETSUITE_TOOL");
|
|
71180
|
+
if (!qb) refuse("SESSION_ENDPOINT");
|
|
71118
71181
|
const tool = catalogTool.exec(url4.pathname), toolkit = /^\/api\/v3(?:\.1)?\/toolkits\/quickbooks$/i.test(url4.pathname);
|
|
71119
71182
|
const list17 = /^\/api\/v3(?:\.1)?\/tools$/.test(url4.pathname);
|
|
71120
71183
|
if (!tool && !toolkit && !list17) refuse("PATH");
|
|
@@ -71153,27 +71216,114 @@ async function readComposioBody(req) {
|
|
|
71153
71216
|
}
|
|
71154
71217
|
return Buffer.concat(chunks);
|
|
71155
71218
|
}
|
|
71156
|
-
function refuseComposio(res, reason2) {
|
|
71219
|
+
function refuseComposio(res, reason2, toolkit) {
|
|
71157
71220
|
res.writeHead(403, { "content-type": "application/json", connection: "close" });
|
|
71158
|
-
res.end(JSON.stringify({ error: { code: "COMPOSIO_ROUTE_REFUSED", reason: reason2, message:
|
|
71221
|
+
res.end(JSON.stringify({ error: { code: "COMPOSIO_ROUTE_REFUSED", reason: reason2, message: new RouteRefusal(reason2, toolkit).message } }));
|
|
71222
|
+
}
|
|
71223
|
+
function nextRouteId(route15, kind) {
|
|
71224
|
+
let ids2 = routeIds.get(route15);
|
|
71225
|
+
if (!ids2) {
|
|
71226
|
+
ids2 = new IdStream(route15.attemptId, "composio-route", memoryCounters());
|
|
71227
|
+
routeIds.set(route15, ids2);
|
|
71228
|
+
}
|
|
71229
|
+
return `${kind}_${ids2.fork(kind).alnumUpper(16)}`;
|
|
71159
71230
|
}
|
|
71160
|
-
|
|
71231
|
+
async function executeLocalComposio(call2, route15, origin, fetcher = fetch, signal) {
|
|
71232
|
+
if (call2.local === "session") {
|
|
71233
|
+
route15.narrowed(call2.narrowed ?? []);
|
|
71234
|
+
if (call2.response === "session-delete") {
|
|
71235
|
+
route15.sessions.delete(call2.sessionId);
|
|
71236
|
+
return { status: 204 };
|
|
71237
|
+
}
|
|
71238
|
+
const id14 = call2.sessionId ?? nextRouteId(route15, "trs");
|
|
71239
|
+
if (call2.response === "session-create") route15.sessions.add(id14);
|
|
71240
|
+
return { status: call2.response === "session-create" ? 201 : 200, body: {
|
|
71241
|
+
session_id: id14,
|
|
71242
|
+
mcp: { type: "http", url: `${origin}/_tool/composio/tool_router/${id14}/mcp` },
|
|
71243
|
+
tool_router_tools: [],
|
|
71244
|
+
config_version: 1,
|
|
71245
|
+
config: {
|
|
71246
|
+
user_id: route15.user,
|
|
71247
|
+
toolkits: { enabled: ["netsuite"] },
|
|
71248
|
+
preload: { tools: [] },
|
|
71249
|
+
search: { enable: false },
|
|
71250
|
+
execute: { enable_multi_execute: false },
|
|
71251
|
+
manage_connections: { enabled: false },
|
|
71252
|
+
multi_account: { enable: false },
|
|
71253
|
+
workbench: { enable: false }
|
|
71254
|
+
}
|
|
71255
|
+
} };
|
|
71256
|
+
}
|
|
71257
|
+
const log_id = nextRouteId(route15, "log");
|
|
71258
|
+
const envelope = (data7, error64, reached2) => ({ status: 200, reached: reached2, body: {
|
|
71259
|
+
data: data7,
|
|
71260
|
+
error: error64,
|
|
71261
|
+
log_id,
|
|
71262
|
+
...call2.via === "session" ? { result_type: error64 === null ? "completed" : "failed" } : { successful: error64 === null }
|
|
71263
|
+
} });
|
|
71264
|
+
const failure5 = (message8, status_code, reached2 = false) => {
|
|
71265
|
+
for (const secret of [route15.agentKey, route15.apiKey, route15.token, route15.netsuite?.token]) if (secret) message8 = message8.replaceAll(secret, "[redacted]");
|
|
71266
|
+
return envelope({ message: message8, status_code }, message8, reached2);
|
|
71267
|
+
};
|
|
71268
|
+
const args = suiteqlArguments.safeParse(call2.arguments ?? {});
|
|
71269
|
+
if (!args.success) return { ...failure5(call2.arguments?.q === void 0 ? "Invalid request data provided\n- Following fields are missing: {'q'}" : "Invalid request data provided: q must be a string, limit an integer >= 1, and offset an integer >= 0; use only q, limit and offset.", 400), invalidArguments: true };
|
|
71270
|
+
if (args.data.limit !== void 0 && args.data.offset !== void 0 && args.data.offset % args.data.limit !== 0)
|
|
71271
|
+
return { ...failure5("Invalid request data provided: offset must be a multiple of limit.", 400), invalidArguments: true };
|
|
71272
|
+
const connection4 = route15.netsuite;
|
|
71273
|
+
const url4 = new URL(connection4.url.replace(/\/$/, "") + "/services/rest/query/v1/suiteql");
|
|
71274
|
+
for (const key5 of ["limit", "offset"]) if (args.data[key5] !== void 0) url4.searchParams.set(key5, String(args.data[key5]));
|
|
71275
|
+
let reached = false;
|
|
71276
|
+
try {
|
|
71277
|
+
const reply6 = await fetcher(url4, {
|
|
71278
|
+
method: "POST",
|
|
71279
|
+
redirect: "error",
|
|
71280
|
+
signal: AbortSignal.any([AbortSignal.timeout(55e3), ...signal ? [signal] : []]),
|
|
71281
|
+
headers: { authorization: `Bearer ${connection4.token}`, "content-type": "application/json", accept: "application/json", prefer: "transient" },
|
|
71282
|
+
body: JSON.stringify({ q: args.data.q })
|
|
71283
|
+
});
|
|
71284
|
+
reached = true;
|
|
71285
|
+
const chunks = [];
|
|
71286
|
+
let size2 = 0;
|
|
71287
|
+
if (Number(reply6.headers.get("content-length") ?? 0) > 8 * 1024 * 1024) {
|
|
71288
|
+
await reply6.body?.cancel();
|
|
71289
|
+
throw new Error("Response bound");
|
|
71290
|
+
}
|
|
71291
|
+
if (reply6.body) for await (const chunk of reply6.body) {
|
|
71292
|
+
size2 += chunk.length;
|
|
71293
|
+
if (size2 > 8 * 1024 * 1024) throw new Error("Response bound");
|
|
71294
|
+
chunks.push(chunk);
|
|
71295
|
+
}
|
|
71296
|
+
const data7 = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
71297
|
+
if (reply6.ok) return envelope(data7, null, true);
|
|
71298
|
+
const details = external_exports.object({ "o:errorDetails": external_exports.array(external_exports.object({ detail: external_exports.string() })) }).safeParse(data7);
|
|
71299
|
+
const message8 = details.success ? details.data["o:errorDetails"].map((item2) => item2.detail).join("\n") : `NetSuite answered ${reply6.status}.`;
|
|
71300
|
+
return failure5(message8, reply6.status, true);
|
|
71301
|
+
} catch {
|
|
71302
|
+
return failure5("The NetSuite world request could not be completed.", 502, reached);
|
|
71303
|
+
}
|
|
71304
|
+
}
|
|
71305
|
+
var RouteRefusal, activeComposioToolkits, refuse, NETSUITE_FIX, slug3, quickbooks, execution, catalogTool, identifier, multi, meta3, record7, bodySchema, slugList, sessionSchema, toolFilter, preloadSchema, switchOf, connections, bytes, routeIds, suiteqlArguments;
|
|
71161
71306
|
var init_composio = __esm({
|
|
71162
71307
|
"backend/src/execution/composio.ts"() {
|
|
71163
71308
|
"use strict";
|
|
71309
|
+
init_src();
|
|
71164
71310
|
init_zod();
|
|
71165
71311
|
RouteRefusal = class extends Error {
|
|
71166
71312
|
reason;
|
|
71167
|
-
|
|
71168
|
-
|
|
71313
|
+
toolkit;
|
|
71314
|
+
constructor(reason2, toolkit) {
|
|
71315
|
+
super(reason2 === "NO_WORLD" && toolkit ? noWorldMessage(toolkit) : reason2 === "NETSUITE_TOOL" ? NETSUITE_FIX : "Configure this call to use the declared QuickBooks or NetSuite route.");
|
|
71169
71316
|
this.reason = reason2;
|
|
71317
|
+
this.toolkit = toolkit;
|
|
71170
71318
|
}
|
|
71171
71319
|
};
|
|
71320
|
+
activeComposioToolkits = (route15) => route15.activeToolkits ?? route15.toolkits ?? { quickbooks: "composio" };
|
|
71172
71321
|
refuse = (reason2) => {
|
|
71173
71322
|
throw new RouteRefusal(reason2);
|
|
71174
71323
|
};
|
|
71175
|
-
|
|
71176
|
-
|
|
71324
|
+
NETSUITE_FIX = "Use session.execute or tools.execute with NETSUITE_RUN_SUITEQL_QUERY.";
|
|
71325
|
+
slug3 = "(?:QUICKBOOKS|NETSUITE)_[A-Z0-9_]{1,96}";
|
|
71326
|
+
quickbooks = new RegExp("^QUICKBOOKS_[A-Z0-9_]{1,96}$");
|
|
71177
71327
|
execution = new RegExp(`^/api/v3(?:\\.1)?/tools/execute/(${slug3})$`);
|
|
71178
71328
|
catalogTool = new RegExp(`^/api/v3(?:\\.1)?/tools/(${slug3}|COMPOSIO_MULTI_EXECUTE_TOOL|COMPOSIO_SEARCH_TOOLS|COMPOSIO_GET_TOOL_SCHEMAS)$`);
|
|
71179
71329
|
identifier = /^[a-zA-Z0-9_-]{1,256}$/;
|
|
@@ -71210,6 +71360,8 @@ var init_composio = __esm({
|
|
|
71210
71360
|
};
|
|
71211
71361
|
connections = /* @__PURE__ */ new WeakMap();
|
|
71212
71362
|
bytes = (value5) => Buffer.from(JSON.stringify(value5));
|
|
71363
|
+
routeIds = /* @__PURE__ */ new WeakMap();
|
|
71364
|
+
suiteqlArguments = external_exports.strictObject({ q: external_exports.string(), limit: external_exports.number().int().min(1).optional(), offset: external_exports.number().int().min(0).optional() });
|
|
71213
71365
|
}
|
|
71214
71366
|
});
|
|
71215
71367
|
|
|
@@ -71312,6 +71464,7 @@ async function startIsolationGateway(options5) {
|
|
|
71312
71464
|
const sockets = /* @__PURE__ */ new Set();
|
|
71313
71465
|
const upstreamRequests = /* @__PURE__ */ new Set();
|
|
71314
71466
|
const modelActivity = /* @__PURE__ */ new Set();
|
|
71467
|
+
const localRequests = /* @__PURE__ */ new Set();
|
|
71315
71468
|
let exposedOrigin, closed = false;
|
|
71316
71469
|
const mapped = (origin) => ({
|
|
71317
71470
|
env: { ...structuredClone(env), ...env.mcp && { mcp: Object.fromEntries(Object.entries(env.mcp).map(([tool, connection4]) => [tool, { ...connection4, url: origin + new URL(connection4.url).pathname }])) }, services: Object.fromEntries(Object.entries(env.services).map(([service, connection4]) => [service, {
|
|
@@ -71338,16 +71491,59 @@ async function startIsolationGateway(options5) {
|
|
|
71338
71491
|
toolCall = validateComposio(req.method ?? "", req.url.slice("/_tool/composio".length), req.headers["x-api-key"], toolBody, req.headers["content-type"], route15, req.headers);
|
|
71339
71492
|
} catch (error64) {
|
|
71340
71493
|
const reason2 = error64 instanceof RouteRefusal ? error64.reason : "JSON";
|
|
71341
|
-
|
|
71342
|
-
|
|
71494
|
+
const toolkit = (error64 instanceof RouteRefusal ? error64.toolkit : void 0) ?? (reason2 === "NETSUITE_TOOL" || /NETSUITE_/.test(toolBody?.toString("utf8") ?? "") || /NETSUITE_/.test(req.url ?? "") || route15?.toolkits && !route15.toolkits.quickbooks ? "netsuite" : "quickbooks");
|
|
71495
|
+
route15?.record({ leg: "platform", op: "refused", toolkit, via: composioVia((req.url ?? "").slice("/_tool/composio".length)), method: ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"].includes(req.method ?? "") ? req.method : "OTHER", status: 403, ms: Math.round(performance.now() - toolStarted), reason: reason2 });
|
|
71496
|
+
refuseComposio(res, reason2, toolkit);
|
|
71343
71497
|
return;
|
|
71344
71498
|
}
|
|
71345
71499
|
}
|
|
71500
|
+
if (toolCall?.local && route15) {
|
|
71501
|
+
const call2 = toolCall, controller = new AbortController();
|
|
71502
|
+
const cancel4 = () => {
|
|
71503
|
+
controller.abort();
|
|
71504
|
+
};
|
|
71505
|
+
localRequests.add(controller);
|
|
71506
|
+
res.once("close", cancel4);
|
|
71507
|
+
const operation = (async () => {
|
|
71508
|
+
let reached, invalidArguments = false, busy = false;
|
|
71509
|
+
const activity3 = options5.onModelActivity ?? route15.activity;
|
|
71510
|
+
try {
|
|
71511
|
+
if (call2.op === "execute") {
|
|
71512
|
+
await activity3(true);
|
|
71513
|
+
busy = true;
|
|
71514
|
+
}
|
|
71515
|
+
controller.signal.throwIfAborted();
|
|
71516
|
+
if (closed || !route15.available()) throw new Error("Route closed");
|
|
71517
|
+
const result = await executeLocalComposio(call2, route15, exposedOrigin, fetch, controller.signal);
|
|
71518
|
+
reached = result.reached;
|
|
71519
|
+
invalidArguments = result.invalidArguments === true;
|
|
71520
|
+
if (!res.destroyed) {
|
|
71521
|
+
res.writeHead(result.status, { "content-type": "application/json" });
|
|
71522
|
+
res.end(result.body === void 0 ? void 0 : JSON.stringify(result.body));
|
|
71523
|
+
}
|
|
71524
|
+
} catch {
|
|
71525
|
+
if (!res.destroyed) reject2(res, 502, "The routed world request could not be completed.");
|
|
71526
|
+
} finally {
|
|
71527
|
+
route15.record({ leg: "platform", toolkit: call2.toolkit, op: call2.op, via: call2.via, method: req.method, ...call2.slug && { slug: call2.slug }, ...invalidArguments && { reason: "ARGUMENTS" }, status: res.destroyed && !res.writableFinished ? 502 : res.statusCode, ms: Math.round(performance.now() - toolStarted) }, reached);
|
|
71528
|
+
if (busy) await activity3(false).catch(() => {
|
|
71529
|
+
});
|
|
71530
|
+
localRequests.delete(controller);
|
|
71531
|
+
res.removeListener("close", cancel4);
|
|
71532
|
+
}
|
|
71533
|
+
})();
|
|
71534
|
+
modelActivity.add(operation);
|
|
71535
|
+
try {
|
|
71536
|
+
await operation;
|
|
71537
|
+
} finally {
|
|
71538
|
+
modelActivity.delete(operation);
|
|
71539
|
+
}
|
|
71540
|
+
return;
|
|
71541
|
+
}
|
|
71346
71542
|
if (toolCall && route15) {
|
|
71347
71543
|
try {
|
|
71348
71544
|
await prepareComposio(toolCall, route15);
|
|
71349
71545
|
} catch {
|
|
71350
|
-
route15.record({ leg: "platform", op: "catalog", via: toolCall.via, method: req.method, status: 502, ms: Math.round(performance.now() - toolStarted) });
|
|
71546
|
+
route15.record({ leg: "platform", toolkit: toolCall.toolkit, op: "catalog", via: toolCall.via, method: req.method, status: 502, ms: Math.round(performance.now() - toolStarted) });
|
|
71351
71547
|
res.writeHead(502, { "content-type": "application/json" });
|
|
71352
71548
|
res.end(JSON.stringify({ error: { code: "COMPOSIO_ROUTE_CONNECTION", message: "The attempt's test connection is not available." } }));
|
|
71353
71549
|
return;
|
|
@@ -71371,7 +71567,7 @@ async function startIsolationGateway(options5) {
|
|
|
71371
71567
|
const record15 = () => {
|
|
71372
71568
|
if (recorded2) return;
|
|
71373
71569
|
recorded2 = true;
|
|
71374
|
-
route15.record({ leg: "platform", op: call2.op, via: call2.via, method: req.method, ...call2.slug && { slug: call2.slug }, status: res.writableFinished ? res.statusCode : 502, ms: Math.round(performance.now() - toolStarted) }, endWindow?.());
|
|
71570
|
+
route15.record({ leg: "platform", toolkit: call2.toolkit, op: call2.op, via: call2.via, method: req.method, ...call2.slug && { slug: call2.slug }, status: res.writableFinished ? res.statusCode : 502, ms: Math.round(performance.now() - toolStarted) }, endWindow?.());
|
|
71375
71571
|
};
|
|
71376
71572
|
res.once("finish", record15);
|
|
71377
71573
|
res.once("close", record15);
|
|
@@ -71662,6 +71858,7 @@ ${Object.entries(reply6.headers).map(([name5, value5]) => `${name5}: ${value5}`)
|
|
|
71662
71858
|
closed = true;
|
|
71663
71859
|
socketGrants.clear();
|
|
71664
71860
|
options5.signal?.removeEventListener("abort", abort);
|
|
71861
|
+
for (const controller of localRequests) controller.abort();
|
|
71665
71862
|
for (const target5 of upstreamRequests) target5.destroy();
|
|
71666
71863
|
for (const socket of sockets) socket.destroy();
|
|
71667
71864
|
await new Promise((resolve15) => server.close(() => resolve15()));
|
|
@@ -72078,30 +72275,49 @@ async function bounded(response6, cap) {
|
|
|
72078
72275
|
}
|
|
72079
72276
|
return Buffer.concat(chunks);
|
|
72080
72277
|
}
|
|
72278
|
+
function refusedDetail(reason2 = "REFUSED", toolkit) {
|
|
72279
|
+
const fix = REFUSAL_FIX[reason2] ?? "use the declared QuickBooks route";
|
|
72280
|
+
return `a Composio call was refused (${reason2}): ${typeof fix === "function" ? fix(toolkit) : `${fix}.`}`;
|
|
72281
|
+
}
|
|
72081
72282
|
async function startIngressClient(options5) {
|
|
72082
|
-
const { descriptor: descriptor2, env } = options5,
|
|
72083
|
-
|
|
72283
|
+
const { descriptor: descriptor2, env } = options5, toolkits = options5.routes ?? { quickbooks: "composio" };
|
|
72284
|
+
const twins = options5.twins ?? Object.keys(env.services);
|
|
72285
|
+
const activeToolkits = {};
|
|
72286
|
+
for (const toolkit of ["quickbooks", "netsuite"]) if (toolkits[toolkit] && twins.includes(toolkit)) activeToolkits[toolkit] = "composio";
|
|
72287
|
+
const qb = !!activeToolkits.quickbooks;
|
|
72288
|
+
const connection4 = qb ? env.services.quickbooks : { url: "http://127.0.0.1", token: "", accountId: "" };
|
|
72289
|
+
if (!connection4 || qb && (!connection4.accountId || !connection4.token) || !descriptor2.secretValues.COMPOSIO_API_KEY) throw new AnchaError("CONFIG_INVALID", "Composio route credentials are required");
|
|
72084
72290
|
const local2 = new URL(connection4.url);
|
|
72085
|
-
if (local2.protocol !== "http:" || local2.hostname !== "127.0.0.1" || local2.username || local2.password || local2.search || local2.hash || local2.pathname.replace(/\/$/, "") !== `/e/${env.id}/quickbooks`) throw new Error("QuickBooks route must target its local world");
|
|
72291
|
+
if (qb && (local2.protocol !== "http:" || local2.hostname !== "127.0.0.1" || local2.username || local2.password || local2.search || local2.hash || local2.pathname.replace(/\/$/, "") !== `/e/${env.id}/quickbooks`)) throw new Error("QuickBooks route must target its local world");
|
|
72292
|
+
const ns = activeToolkits.netsuite ? env.services.netsuite : void 0;
|
|
72293
|
+
if (activeToolkits.netsuite) {
|
|
72294
|
+
if (!ns?.token) throw new AnchaError("CONFIG_INVALID", "NetSuite route credentials are required");
|
|
72295
|
+
const url4 = new URL(ns.url);
|
|
72296
|
+
if (url4.protocol !== "http:" || url4.hostname !== "127.0.0.1" || url4.username || url4.password || url4.search || url4.hash || url4.pathname.replace(/\/$/, "") !== `/e/${env.id}/netsuite`) throw new AnchaError("CONFIG_INVALID", "NetSuite route must target its local world");
|
|
72297
|
+
}
|
|
72086
72298
|
const base6 = new URL(descriptor2.relay.baseUrl);
|
|
72087
72299
|
if (base6.username || base6.password || base6.search || base6.hash || !["https:", "http:"].includes(base6.protocol)) throw new Error("Invalid relay");
|
|
72088
72300
|
const endpoint2 = `${base6.origin}/_attempts/${encodeURIComponent(descriptor2.attemptId)}/ingress`;
|
|
72089
72301
|
const stop = new AbortController(), failure5 = new AbortController();
|
|
72090
72302
|
const signal = AbortSignal.any([stop.signal, ...options5.signal ? [options5.signal] : []]);
|
|
72091
|
-
let id14 = "", instance = "", publicUrl = "", expires = 0, closed = false, failed2 = false, probe = "";
|
|
72303
|
+
let id14 = "", instance = "", publicUrl = "", expires = qb ? 0 : Infinity, closed = false, failed2 = false, probe = "";
|
|
72092
72304
|
let closing;
|
|
72093
72305
|
let polls = [];
|
|
72094
72306
|
const windows = /* @__PURE__ */ new Set(), records4 = [];
|
|
72095
|
-
const
|
|
72307
|
+
const counters = () => ({ platform: "composio", executions: 0, reached: 0, refused: 0 });
|
|
72308
|
+
const counts2 = { quickbooks: counters(), netsuite: counters() };
|
|
72309
|
+
const paths3 = () => ({ direct: 0, session: 0, mcp: 0 });
|
|
72310
|
+
const via = { quickbooks: paths3(), netsuite: paths3() };
|
|
72096
72311
|
const record15 = (event3, status5, issue10) => {
|
|
72097
|
-
|
|
72312
|
+
const toolkit = event3?.toolkit ?? (qb ? "quickbooks" : "netsuite");
|
|
72313
|
+
records4.push({ seq: 0, source: "world", service: toolkit, method: event3?.leg === "platform" ? event3.method : "RELAY", path: `/_route/${toolkit}`, tSim: env.startTime, tReal: Date.now(), status: status5, routeEvent: event3 && { ...event3, toolkit }, ...issue10 && { issue: issue10 } });
|
|
72098
72314
|
};
|
|
72099
|
-
const issue9 = (code2, detail3) => ({ kind: "world", owner:
|
|
72315
|
+
const issue9 = (code2, detail3, toolkit = qb ? "quickbooks" : "netsuite", owner5 = "harness") => ({ kind: "world", owner: owner5, service: toolkit, code: code2, message: `${code2}: ${detail3}` });
|
|
72100
72316
|
const fail6 = () => {
|
|
72101
72317
|
if (failed2 || closed || options5.signal?.aborted) return;
|
|
72102
72318
|
failed2 = true;
|
|
72103
|
-
record15({ leg: "ingress", relayHash: hash2(id14), path: "/_route", ms: 0 }, 502, issue9("ROUTE_INGRESS_FAILED", "the world's public QuickBooks address stopped answering; run again."));
|
|
72104
|
-
failure5.abort(new Error("
|
|
72319
|
+
record15({ leg: "ingress", relayHash: hash2(id14), path: "/_route", ms: 0 }, 502, issue9("ROUTE_INGRESS_FAILED", qb ? "the world's public QuickBooks address stopped answering; run again." : "the NetSuite world route could not be kept open; run again."));
|
|
72320
|
+
failure5.abort(new Error("Composio route failed"));
|
|
72105
72321
|
stop.abort();
|
|
72106
72322
|
};
|
|
72107
72323
|
async function call2(path8, method2, body7, cleanup = false) {
|
|
@@ -72164,7 +72380,7 @@ async function startIngressClient(options5) {
|
|
|
72164
72380
|
fail6();
|
|
72165
72381
|
}
|
|
72166
72382
|
}
|
|
72167
|
-
try {
|
|
72383
|
+
if (qb) try {
|
|
72168
72384
|
const response6 = await call2("", "POST", { service: "quickbooks" });
|
|
72169
72385
|
if (response6.status !== 201) {
|
|
72170
72386
|
await response6.body?.cancel();
|
|
@@ -72199,8 +72415,19 @@ async function startIngressClient(options5) {
|
|
|
72199
72415
|
record15({ leg: "ingress", relayHash: hash2(id14), path: "/_connection", ms: 0 }, 502, issue9("ROUTE_CONNECTION_FAILED", error64.message));
|
|
72200
72416
|
}
|
|
72201
72417
|
});
|
|
72202
|
-
const
|
|
72418
|
+
const narrowed = /* @__PURE__ */ new Set(), localSessions = /* @__PURE__ */ new Set(), seenSessions = /* @__PURE__ */ new Set();
|
|
72419
|
+
const sessions2 = qb ? lifecycle2.sessions : { add(id15) {
|
|
72420
|
+
if (!closed) {
|
|
72421
|
+
localSessions.add(id15);
|
|
72422
|
+
seenSessions.add(id15);
|
|
72423
|
+
}
|
|
72424
|
+
}, has: (id15) => !closed && localSessions.has(id15), delete(id15) {
|
|
72425
|
+
localSessions.delete(id15);
|
|
72426
|
+
} };
|
|
72203
72427
|
return {
|
|
72428
|
+
toolkits,
|
|
72429
|
+
activeToolkits,
|
|
72430
|
+
...ns && { netsuite: { url: ns.url, token: ns.token } },
|
|
72204
72431
|
publicUrl,
|
|
72205
72432
|
token: connection4.token,
|
|
72206
72433
|
realm: connection4.accountId,
|
|
@@ -72208,10 +72435,10 @@ async function startIngressClient(options5) {
|
|
|
72208
72435
|
attemptId: descriptor2.attemptId,
|
|
72209
72436
|
agentKey,
|
|
72210
72437
|
user: user9,
|
|
72211
|
-
connection: () => closed || failed2 || signal.aborted || Date.now() >= expires ? Promise.reject(new ComposioConnectionError(503, "ROUTE_CLOSED")) : lifecycle2.connection(),
|
|
72212
|
-
sessions:
|
|
72213
|
-
narrowed: (
|
|
72214
|
-
for (const toolkit of
|
|
72438
|
+
connection: () => !qb || closed || failed2 || signal.aborted || Date.now() >= expires ? Promise.reject(new ComposioConnectionError(503, "ROUTE_CLOSED")) : lifecycle2.connection(),
|
|
72439
|
+
sessions: sessions2,
|
|
72440
|
+
narrowed: (toolkits2) => {
|
|
72441
|
+
for (const toolkit of toolkits2) if (![agentKey, descriptor2.secretValues.COMPOSIO_API_KEY, connection4.token, ns?.token, publicUrl].some((secret) => secret && toolkit.includes(secret))) narrowed.add(toolkit);
|
|
72215
72442
|
},
|
|
72216
72443
|
signal: failure5.signal,
|
|
72217
72444
|
get failed() {
|
|
@@ -72235,19 +72462,30 @@ async function startIngressClient(options5) {
|
|
|
72235
72462
|
};
|
|
72236
72463
|
},
|
|
72237
72464
|
record(event3, reached) {
|
|
72465
|
+
const toolkit = event3.toolkit ?? (qb ? "quickbooks" : "netsuite");
|
|
72238
72466
|
if (event3.op === "execute") {
|
|
72239
|
-
via[event3.via ?? "direct"]++;
|
|
72240
|
-
counts2.executions++;
|
|
72241
|
-
if (reached) counts2.reached++;
|
|
72467
|
+
via[toolkit][event3.via ?? "direct"]++;
|
|
72468
|
+
counts2[toolkit].executions++;
|
|
72469
|
+
if (reached) counts2[toolkit].reached++;
|
|
72242
72470
|
}
|
|
72243
|
-
if (event3.op === "refused") counts2.refused++;
|
|
72244
|
-
record15({ ...event3, relayHash: hash2(id14) }, event3.status, event3.op === "refused" ? issue9("ROUTE_REFUSED", refusedDetail(event3.reason)) : event3.op === "execute" && !reached ? issue9("ROUTE_NOT_REACHED", unreachedDetail(event3.status)) : void 0);
|
|
72471
|
+
if (event3.op === "refused") counts2[toolkit].refused++;
|
|
72472
|
+
record15({ ...event3, toolkit, relayHash: hash2(id14) }, event3.status, event3.op === "refused" ? issue9("ROUTE_REFUSED", refusedDetail(event3.reason, toolkit), toolkit, event3.reason === "NO_WORLD" ? "agent" : "harness") : event3.op === "execute" && !reached && event3.reason === "ARGUMENTS" ? issue9("ROUTE_ARGUMENTS", "The agent's NETSUITE_RUN_SUITEQL_QUERY arguments were invalid; it got Composio's failure response.", toolkit, "agent") : event3.op === "execute" && !reached ? issue9("ROUTE_NOT_REACHED", toolkit === "netsuite" ? "The SuiteQL call did not reach the NetSuite world: check q, limit and offset, then run again." : unreachedDetail(event3.status), toolkit) : void 0);
|
|
72473
|
+
},
|
|
72474
|
+
summary: () => {
|
|
72475
|
+
const result = {};
|
|
72476
|
+
for (const toolkit of ["quickbooks", "netsuite"]) if (activeToolkits[toolkit] || counts2[toolkit].refused) result[toolkit] = {
|
|
72477
|
+
...counts2[toolkit],
|
|
72478
|
+
...counts2[toolkit].executions && { via: { ...via[toolkit] } },
|
|
72479
|
+
...activeToolkits[toolkit] && (toolkit === "quickbooks" ? lifecycle2.summary() : qb ? { ...lifecycle2.summary().sessions && { sessions: lifecycle2.summary().sessions }, ...lifecycle2.summary().cleanup && { cleanup: lifecycle2.summary().cleanup } } : { ...seenSessions.size && { sessions: seenSessions.size }, ...closed && { cleanup: "done" } }),
|
|
72480
|
+
...activeToolkits[toolkit] && narrowed.size && { narrowed: [...narrowed].sort() }
|
|
72481
|
+
};
|
|
72482
|
+
return result;
|
|
72245
72483
|
},
|
|
72246
|
-
summary: () => ({ quickbooks: { ...counts2, ...counts2.executions && { via: { ...via } }, ...lifecycle2.summary(), ...narrowed.size && { narrowed: [...narrowed].sort() } } }),
|
|
72247
72484
|
entries: () => records4,
|
|
72248
72485
|
close() {
|
|
72249
72486
|
return closing ??= (async () => {
|
|
72250
72487
|
closed = true;
|
|
72488
|
+
localSessions.clear();
|
|
72251
72489
|
lifecycle2.stopAccepting();
|
|
72252
72490
|
stop.abort();
|
|
72253
72491
|
await Promise.all(polls);
|
|
@@ -72268,12 +72506,13 @@ async function startIngressClient(options5) {
|
|
|
72268
72506
|
}
|
|
72269
72507
|
};
|
|
72270
72508
|
}
|
|
72271
|
-
var headersSchema, requestSchema, batchSchema, bindSchema, forwarded, methods, hash2, REFUSAL_FIX,
|
|
72509
|
+
var headersSchema, requestSchema, batchSchema, bindSchema, forwarded, methods, hash2, REFUSAL_FIX, unreachedDetail;
|
|
72272
72510
|
var init_ingress_client = __esm({
|
|
72273
72511
|
"backend/src/execution/ingress-client.ts"() {
|
|
72274
72512
|
"use strict";
|
|
72275
72513
|
init_zod();
|
|
72276
72514
|
init_src();
|
|
72515
|
+
init_composio();
|
|
72277
72516
|
init_composio_connection();
|
|
72278
72517
|
headersSchema = external_exports.record(external_exports.string(), external_exports.string());
|
|
72279
72518
|
requestSchema = external_exports.strictObject({ rid: external_exports.string().min(1).max(256), method: external_exports.enum(["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"]), path: external_exports.string().max(8192), query: external_exports.string().max(8192), headers: headersSchema, body_b64: external_exports.string().max(87384) });
|
|
@@ -72283,6 +72522,8 @@ var init_ingress_client = __esm({
|
|
|
72283
72522
|
methods = /* @__PURE__ */ new Set(["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"]);
|
|
72284
72523
|
hash2 = (value5) => createHash5("sha256").update(value5).digest("hex").slice(0, 16);
|
|
72285
72524
|
REFUSAL_FIX = {
|
|
72525
|
+
NO_WORLD: noWorldMessage,
|
|
72526
|
+
NETSUITE_TOOL: "use session.execute or tools.execute with NETSUITE_RUN_SUITEQL_QUERY",
|
|
72286
72527
|
ROUTE_UNAVAILABLE: "the route had closed; run again",
|
|
72287
72528
|
PATH: "use QuickBooks tools, sessions and session MCP through COMPOSIO_BASE_URL",
|
|
72288
72529
|
METHOD: "use POST for executions and MCP, GET for catalogs, and DELETE to close a session",
|
|
@@ -72293,7 +72534,7 @@ var init_ingress_client = __esm({
|
|
|
72293
72534
|
JSON: "send a JSON body",
|
|
72294
72535
|
SCHEMA: "use the SDK request fields for this endpoint; the route supplies the world connection",
|
|
72295
72536
|
SESSION: "create a session through COMPOSIO_BASE_URL and use its returned session",
|
|
72296
|
-
SESSION_ENDPOINT: "use session tools, toolkits, search, execute or execute_meta",
|
|
72537
|
+
SESSION_ENDPOINT: (toolkit) => toolkit === "netsuite" ? "this session serves NetSuite: use session.execute with NETSUITE_RUN_SUITEQL_QUERY, and create, get or delete the session." : "use session tools, toolkits, search, execute or execute_meta.",
|
|
72297
72538
|
SESSION_MUTATION: "create a new session through the route instead of modifying its connection",
|
|
72298
72539
|
TOOL: "execute a QUICKBOOKS_ tool",
|
|
72299
72540
|
META_TOOL: "use COMPOSIO_MULTI_EXECUTE_TOOL, COMPOSIO_SEARCH_TOOLS or COMPOSIO_GET_TOOL_SCHEMAS; multi-execute items must be QUICKBOOKS_ tools",
|
|
@@ -72301,7 +72542,6 @@ var init_ingress_client = __esm({
|
|
|
72301
72542
|
MCP_METHOD: "use initialize, notifications/initialized, notifications/cancelled, ping, tools/list or tools/call",
|
|
72302
72543
|
MCP_BATCH: "send one JSON-RPC object per MCP request"
|
|
72303
72544
|
};
|
|
72304
|
-
refusedDetail = (reason2 = "REFUSED") => `a Composio call was refused (${reason2}): ${REFUSAL_FIX[reason2] ?? "use the declared QuickBooks route"}.`;
|
|
72305
72545
|
unreachedDetail = (status5) => status5 === 401 || status5 === 403 ? `Composio answered ${status5} without calling the world: check the workspace secret COMPOSIO_API_KEY.` : status5 >= 500 ? `Composio answered ${status5} without calling the world; run again.` : `Composio answered ${status5} without calling the world: check the QuickBooks tool arguments and use the connection supplied by the route.`;
|
|
72306
72546
|
}
|
|
72307
72547
|
});
|
|
@@ -72316,7 +72556,7 @@ function attachTrialIngress(env, route15) {
|
|
|
72316
72556
|
};
|
|
72317
72557
|
}
|
|
72318
72558
|
function validateRouteRuntime(agent) {
|
|
72319
|
-
if (!agent.routes?.quickbooks) return;
|
|
72559
|
+
if (!agent.routes?.quickbooks && !agent.routes?.netsuite) return;
|
|
72320
72560
|
const runtime2 = trustedRuntime();
|
|
72321
72561
|
if (runtime2 !== "fly-vm" && runtime2 !== "unsafe-local") throw new AnchaError("CONFIG_INVALID", "agent.routes requires ancha run --on cloud");
|
|
72322
72562
|
if (!attemptDescriptor()) throw new AnchaError("CONFIG_INVALID", "agent.routes requires a cloud attempt");
|
|
@@ -72329,11 +72569,13 @@ function appendRouteEvidence(capture3, route15) {
|
|
|
72329
72569
|
async function runRoutedTrial(spec, run5) {
|
|
72330
72570
|
validateAgentRoutes(spec.agent, spec.scene.twins);
|
|
72331
72571
|
validateRouteRuntime(spec.agent);
|
|
72332
|
-
if (!spec.agent.routes?.quickbooks) return run5(spec);
|
|
72572
|
+
if (!spec.agent.routes?.quickbooks && !spec.agent.routes?.netsuite) return run5(spec);
|
|
72333
72573
|
const descriptor2 = attemptDescriptor();
|
|
72334
72574
|
const startedAt = performance.now();
|
|
72335
72575
|
let sessionId, captured;
|
|
72336
72576
|
const route15 = await startIngressClient({
|
|
72577
|
+
routes: spec.agent.routes,
|
|
72578
|
+
twins: spec.scene.twins,
|
|
72337
72579
|
descriptor: descriptor2,
|
|
72338
72580
|
env: spec.env,
|
|
72339
72581
|
...spec.signal && { signal: spec.signal },
|
|
@@ -72370,7 +72612,7 @@ async function runRoutedTrial(spec, run5) {
|
|
|
72370
72612
|
await route15.close();
|
|
72371
72613
|
const connectionIssue = route15.entries().find((entry2) => entry2.issue?.code === "ROUTE_CONNECTION_FAILED")?.issue;
|
|
72372
72614
|
if (!route15.failed && !connectionIssue || spec.signal?.aborted) throw error64;
|
|
72373
|
-
const result = await invalidTrial({ scene: spec.scene, trial: spec.trial, dir: spec.dir, startedAt, envId: spec.env.id, ...sessionId && { sessionId }, ...captured && { capture: captured }, service: "quickbooks", error: connectionIssue ? { code: "ROUTE_CONNECTION_FAILED", message: connectionIssue.message } : { code: "ROUTE_INGRESS_FAILED", message: "The
|
|
72615
|
+
const result = await invalidTrial({ scene: spec.scene, trial: spec.trial, dir: spec.dir, startedAt, envId: spec.env.id, ...sessionId && { sessionId }, ...captured && { capture: captured }, service: spec.agent.routes.quickbooks ? "quickbooks" : "netsuite", error: connectionIssue ? { code: "ROUTE_CONNECTION_FAILED", message: connectionIssue.message } : { code: "ROUTE_INGRESS_FAILED", message: "The Composio route could not be kept open." } });
|
|
72374
72616
|
if (!captured) {
|
|
72375
72617
|
result.trace = route15.entries().map((entry2, i) => ({ ...entry2, seq: i + 1 }));
|
|
72376
72618
|
result.harnessIssues = collectHarnessIssues(result.trace, []);
|
|
@@ -72857,7 +73099,7 @@ function agentTask(scene2, runtime2) {
|
|
|
72857
73099
|
return runtime2?.task ?? scene2.trigger?.task ?? scene2.task ?? "";
|
|
72858
73100
|
}
|
|
72859
73101
|
function agentTemplateVars(envId, services2, task2, trial, session2, runtime2, mcp) {
|
|
72860
|
-
const vars = { task: task2, "env.id": envId, trial: String(trial) };
|
|
73102
|
+
const vars = { task: task2, task_json: JSON.stringify(task2), "env.id": envId, trial: String(trial) };
|
|
72861
73103
|
if (runtime2?.taskFile !== void 0) vars.task_file = runtime2.taskFile;
|
|
72862
73104
|
for (const [tool, connection4] of Object.entries(mcp ?? {})) Object.assign(vars, { [`${tool}.mcp_url`]: connection4.url, [`${tool}.mcp_token`]: connection4.token });
|
|
72863
73105
|
for (const [twin, s2] of Object.entries(services2)) {
|
|
@@ -73423,7 +73665,7 @@ function nonDefaultOut(cwd, out) {
|
|
|
73423
73665
|
}
|
|
73424
73666
|
function renderSummaryText(s2, opts = {}) {
|
|
73425
73667
|
const lines = s2.replayOf === void 0 ? [] : [`replay of ${s2.replayOf}`];
|
|
73426
|
-
if (s2.routes?.
|
|
73668
|
+
for (const toolkit of ["quickbooks", "netsuite"]) if (s2.routes?.[toolkit]) lines.push(formatRouteSummary(s2.routes[toolkit], toolkit));
|
|
73427
73669
|
const never2 = agentNeverRan(s2);
|
|
73428
73670
|
if (never2 === void 0) {
|
|
73429
73671
|
for (const scene2 of s2.scenes) for (const t of scene2.trialsDetail) if (t.diagnosis) lines.push(`${scene2.sceneId} trial ${t.trial}`, ...toolDiagnosticLines(t).map((line2) => ` ${line2}`));
|
|
@@ -165367,7 +165609,7 @@ function compare4(left, op, right) {
|
|
|
165367
165609
|
throw invalid16("q");
|
|
165368
165610
|
}
|
|
165369
165611
|
}
|
|
165370
|
-
function parseQuery(source,
|
|
165612
|
+
function parseQuery(source, aliases2) {
|
|
165371
165613
|
const tokens4 = tokenize4(source);
|
|
165372
165614
|
let at4 = 0;
|
|
165373
165615
|
const peek = () => tokens4[at4];
|
|
@@ -165430,7 +165672,7 @@ function parseQuery(source, aliases) {
|
|
|
165430
165672
|
if (!isWord(expect(), "in")) throw invalid16("q");
|
|
165431
165673
|
const field7 = expect();
|
|
165432
165674
|
if (field7.kind !== "word") throw invalid16("q");
|
|
165433
|
-
const value5 = first.value === "me" ?
|
|
165675
|
+
const value5 = first.value === "me" ? aliases2.me : first.value === "root" ? aliases2.root : first.value;
|
|
165434
165676
|
switch (field7.value) {
|
|
165435
165677
|
case "parents":
|
|
165436
165678
|
return (file3) => file3.parents.includes(value5);
|
|
@@ -175390,8 +175632,8 @@ function expression2(input5, alias, bind) {
|
|
|
175390
175632
|
}
|
|
175391
175633
|
if (castParts[1]) {
|
|
175392
175634
|
const requested2 = castParts[1];
|
|
175393
|
-
const
|
|
175394
|
-
const type = (
|
|
175635
|
+
const aliases2 = { int: "int4", integer: "int4", bigint: "int8", smallint: "int2", boolean: "bool", decimal: "numeric", real: "float4" };
|
|
175636
|
+
const type = (aliases2[requested2.replace(/\[\]$/, "")] ?? requested2.replace(/\[\]$/, "")) + (requested2.endsWith("[]") ? "[]" : "");
|
|
175395
175637
|
if (!/^[a-zA-Z_][a-zA-Z_0-9]*(\[\])?$/.test(type)) return parseError(input5);
|
|
175396
175638
|
sql5 = `(${sql5})::${ident2(type.replace(/\[\]$/, ""))}${type.endsWith("[]") ? "[]" : ""}`;
|
|
175397
175639
|
}
|
|
@@ -182670,7 +182912,7 @@ async function handle18(c) {
|
|
|
182670
182912
|
}
|
|
182671
182913
|
function microsoftWordTwin() {
|
|
182672
182914
|
const app2 = new Hono3();
|
|
182673
|
-
const
|
|
182915
|
+
const aliases2 = microsoftWordCoverage.flatMap((entry2) => {
|
|
182674
182916
|
if (!entry2.path.startsWith("/v1.0/me/drive")) return [];
|
|
182675
182917
|
const paths3 = [entry2.path];
|
|
182676
182918
|
if (entry2.path.includes("/items/{item-id}")) {
|
|
@@ -182681,7 +182923,7 @@ function microsoftWordTwin() {
|
|
|
182681
182923
|
}
|
|
182682
182924
|
return paths3.flatMap((path8) => [path8, path8.replace("/v1.0/me/drive", "/v1.0/drive"), path8.replace("/v1.0/me/drive", "/v1.0/drives/{drive-id}")]).filter((path8) => path8 !== entry2.path).map((path8) => ({ ...entry2, path: path8, operation: `${entry2.method} ${entry2.path}` }));
|
|
182683
182925
|
});
|
|
182684
|
-
registerOperationRoutes(app2, [...microsoftWordCoverage, ...
|
|
182926
|
+
registerOperationRoutes(app2, [...microsoftWordCoverage, ...aliases2], handle18);
|
|
182685
182927
|
app2.all("*", handle18);
|
|
182686
182928
|
return { name: "microsoft-word", basePath: "", app: app2, migrate: migrate28, seed: seed27, credentials: credentials26, dumpState: dumpState27, actions: {}, checks: {}, coverage: microsoftWordCoverage };
|
|
182687
182929
|
}
|
|
@@ -189570,7 +189812,7 @@ function evaluate2(q, w2) {
|
|
|
189570
189812
|
comment: { kind: "text", get: (i) => w2.comments(i.id).map((c) => adfToText(c.body)).join("\n") },
|
|
189571
189813
|
text: { kind: "text", get: (i) => [i.summary, adfToText(i.description), ...w2.comments(i.id).map((c) => adfToText(c.body))].join("\n") }
|
|
189572
189814
|
};
|
|
189573
|
-
const
|
|
189815
|
+
const aliases2 = {
|
|
189574
189816
|
issuekey: "key",
|
|
189575
189817
|
id: "key",
|
|
189576
189818
|
issue: "key",
|
|
@@ -189584,7 +189826,7 @@ function evaluate2(q, w2) {
|
|
|
189584
189826
|
"cf[10016]": "story point estimate"
|
|
189585
189827
|
};
|
|
189586
189828
|
const fieldOf = (name5) => {
|
|
189587
|
-
const n2 = name5.toLowerCase(), key5 =
|
|
189829
|
+
const n2 = name5.toLowerCase(), key5 = aliases2[n2] ?? n2;
|
|
189588
189830
|
if (fields13[key5]) return fields13[key5];
|
|
189589
189831
|
if (UNMODELED2.has(n2) || /^cf\[\d+\]$/.test(n2)) throw new JqlGap(`the JQL field ${name5}`);
|
|
189590
189832
|
throw new JqlError(`Field '${name5}' does not exist or you do not have permission to view it.`);
|
|
@@ -189652,7 +189894,7 @@ function evaluate2(q, w2) {
|
|
|
189652
189894
|
};
|
|
189653
189895
|
const found = q.where ? w2.issues.filter((i) => test2(q.where, i)) : [...w2.issues];
|
|
189654
189896
|
const sortKey = (name5) => {
|
|
189655
|
-
const n2 = name5.toLowerCase(), key5 =
|
|
189897
|
+
const n2 = name5.toLowerCase(), key5 = aliases2[n2] ?? n2;
|
|
189656
189898
|
switch (key5) {
|
|
189657
189899
|
case "key":
|
|
189658
189900
|
return (i) => `${w2.projects.find((p2) => p2.id === i.project_id).key}-${String(i.number).padStart(10, "0")}`;
|
|
@@ -224425,7 +224667,7 @@ async function startVmAgent(command, opts, deps = {}) {
|
|
|
224425
224667
|
const unsafe = runtime2 === "unsafe-local";
|
|
224426
224668
|
validateRouteRuntime(opts.agent);
|
|
224427
224669
|
const composio = trialIngress(opts.env);
|
|
224428
|
-
if (opts.agent.routes?.quickbooks && !composio?.available()) throw new AnchaError("CONFIG_INVALID", "The
|
|
224670
|
+
if ((opts.agent.routes?.quickbooks || opts.agent.routes?.netsuite) && !composio?.available()) throw new AnchaError("CONFIG_INVALID", "The Composio route must be bound before launching the agent.");
|
|
224429
224671
|
const names7 = vmEnvironmentNames(opts.agent);
|
|
224430
224672
|
explicitEnvironment(names7, descriptor2.secretValues);
|
|
224431
224673
|
const modelHosts = vmModelHosts(descriptor2.modelHosts);
|
|
@@ -224494,7 +224736,7 @@ async function startVmAgent(command, opts, deps = {}) {
|
|
|
224494
224736
|
runtime: agentRuntime,
|
|
224495
224737
|
paths: { ...paths3, path: [...descriptor2.pathPrepend, VM_PATH].join(":") }
|
|
224496
224738
|
});
|
|
224497
|
-
if (composio) Object.assign(values3, { COMPOSIO_BASE_URL: `${unsafe ? gateway2.url : VM_GATEWAY_ORIGIN}/_tool/composio`, QUICKBOOKS_PUBLIC_URL: composio.publicUrl, COMPOSIO_API_KEY: composio.agentKey });
|
|
224739
|
+
if (composio) Object.assign(values3, { COMPOSIO_BASE_URL: `${unsafe ? gateway2.url : VM_GATEWAY_ORIGIN}/_tool/composio`, ...activeComposioToolkits(composio).quickbooks ? { QUICKBOOKS_PUBLIC_URL: composio.publicUrl } : {}, COMPOSIO_API_KEY: composio.agentKey });
|
|
224498
224740
|
if (composio) {
|
|
224499
224741
|
for (const [name5, value5] of Object.entries(values3)) if (value5 && composio.apiKey) values3[name5] = value5.replaceAll(composio.apiKey, composio.agentKey);
|
|
224500
224742
|
}
|
|
@@ -224510,7 +224752,7 @@ async function startVmAgent(command, opts, deps = {}) {
|
|
|
224510
224752
|
const protectedValues = [
|
|
224511
224753
|
...Object.values(descriptor2.secretValues),
|
|
224512
224754
|
descriptor2.relay.token,
|
|
224513
|
-
...composio ? [composio.apiKey, composio.agentKey, composio.publicUrl, new URL(composio.publicUrl).pathname.split("/").at(-1)] : [],
|
|
224755
|
+
...composio ? [composio.apiKey, composio.agentKey, ...composio.publicUrl ? [composio.publicUrl, new URL(composio.publicUrl).pathname.split("/").at(-1)] : []] : [],
|
|
224514
224756
|
...Object.entries(values3).filter(([name5]) => /(?:KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL)/i.test(name5)).map(([, value5]) => value5 ?? "")
|
|
224515
224757
|
];
|
|
224516
224758
|
const writer = vmLog(protectedValues, (text26) => writeSync3(opts.logFd, text26));
|
|
@@ -224620,6 +224862,7 @@ var LOG_LIMIT2, KILL_GRACE_MS2, exec2, directories;
|
|
|
224620
224862
|
var init_vm = __esm({
|
|
224621
224863
|
"backend/src/execution/vm.ts"() {
|
|
224622
224864
|
"use strict";
|
|
224865
|
+
init_composio();
|
|
224623
224866
|
init_routed_trial();
|
|
224624
224867
|
init_src();
|
|
224625
224868
|
init_agent_env();
|
|
@@ -225870,12 +226113,20 @@ var init_run = __esm({
|
|
|
225870
226113
|
}
|
|
225871
226114
|
});
|
|
225872
226115
|
|
|
226116
|
+
// backend/src/kit/json-task-input.ts
|
|
226117
|
+
var init_json_task_input = __esm({
|
|
226118
|
+
"backend/src/kit/json-task-input.ts"() {
|
|
226119
|
+
"use strict";
|
|
226120
|
+
}
|
|
226121
|
+
});
|
|
226122
|
+
|
|
225873
226123
|
// backend/src/kit/task-input.ts
|
|
225874
226124
|
var init_task_input = __esm({
|
|
225875
226125
|
"backend/src/kit/task-input.ts"() {
|
|
225876
226126
|
"use strict";
|
|
225877
226127
|
init_src();
|
|
225878
226128
|
init_agent_env();
|
|
226129
|
+
init_json_task_input();
|
|
225879
226130
|
}
|
|
225880
226131
|
});
|
|
225881
226132
|
|
|
@@ -225917,6 +226168,24 @@ var init_tool_signals = __esm({
|
|
|
225917
226168
|
}
|
|
225918
226169
|
});
|
|
225919
226170
|
|
|
226171
|
+
// backend/src/kit/composio-signals.ts
|
|
226172
|
+
var aliases;
|
|
226173
|
+
var init_composio_signals = __esm({
|
|
226174
|
+
"backend/src/kit/composio-signals.ts"() {
|
|
226175
|
+
"use strict";
|
|
226176
|
+
init_src();
|
|
226177
|
+
aliases = Object.fromEntries(SUPPORTED_TWINS.flatMap((tool) => [[tool, tool], [tool.replaceAll("-", ""), tool], [tool.replaceAll("-", "_"), tool]]));
|
|
226178
|
+
Object.assign(aliases, {
|
|
226179
|
+
googledrive: "google-drive",
|
|
226180
|
+
googlecalendar: "google-calendar",
|
|
226181
|
+
googleads: "google-ads",
|
|
226182
|
+
googleanalytics: "ga4",
|
|
226183
|
+
amazons3: "amazon-s3",
|
|
226184
|
+
s3: "amazon-s3"
|
|
226185
|
+
});
|
|
226186
|
+
}
|
|
226187
|
+
});
|
|
226188
|
+
|
|
225920
226189
|
// backend/src/kit/detect.ts
|
|
225921
226190
|
var init_detect = __esm({
|
|
225922
226191
|
"backend/src/kit/detect.ts"() {
|
|
@@ -225927,6 +226196,7 @@ var init_detect = __esm({
|
|
|
225927
226196
|
init_project_files();
|
|
225928
226197
|
init_function_tools();
|
|
225929
226198
|
init_tool_signals();
|
|
226199
|
+
init_composio_signals();
|
|
225930
226200
|
}
|
|
225931
226201
|
});
|
|
225932
226202
|
|