@frontmcp/plugin-codecall 1.8.4 → 1.8.5
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/esm/index.mjs +127 -6
- package/esm/package.json +7 -5
- package/index.js +127 -6
- package/package.json +7 -5
- package/services/enclave.service.d.ts +0 -1
- package/services/enclave.service.d.ts.map +1 -1
- package/tools/execute.schema.d.ts +2 -2
- package/tools/execute.schema.d.ts.map +1 -1
- package/utils/script-lines.d.ts +14 -0
- package/utils/script-lines.d.ts.map +1 -0
package/esm/index.mjs
CHANGED
|
@@ -1871,6 +1871,121 @@ function toSandboxToolNamespaces(namespaces, reservedGlobals = []) {
|
|
|
1871
1871
|
return count > 0 ? bindable : void 0;
|
|
1872
1872
|
}
|
|
1873
1873
|
|
|
1874
|
+
// plugins/plugin-codecall/src/utils/script-lines.ts
|
|
1875
|
+
import { isWrappedInMain, transformAgentScript } from "@enclave-vm/ast";
|
|
1876
|
+
import * as acorn from "acorn";
|
|
1877
|
+
var PARSE_OPTIONS = { ecmaVersion: "latest", locations: true };
|
|
1878
|
+
var NON_CHILD_KEYS = /* @__PURE__ */ new Set(["type", "loc", "start", "end", "range"]);
|
|
1879
|
+
function isNode(value) {
|
|
1880
|
+
return typeof value === "object" && value !== null && typeof value.type === "string";
|
|
1881
|
+
}
|
|
1882
|
+
function isAddedByTransform(node) {
|
|
1883
|
+
if (node.type === "VariableDeclaration") {
|
|
1884
|
+
const [declaration] = node["declarations"] ?? [];
|
|
1885
|
+
const id = declaration?.["id"];
|
|
1886
|
+
return typeof id?.["name"] === "string" && id["name"].startsWith("__iter_");
|
|
1887
|
+
}
|
|
1888
|
+
if (node.type === "IfStatement") {
|
|
1889
|
+
const right = node["test"]?.["right"];
|
|
1890
|
+
return right?.type === "Identifier" && right["name"] === "__maxIterations";
|
|
1891
|
+
}
|
|
1892
|
+
return false;
|
|
1893
|
+
}
|
|
1894
|
+
function parseScript(script) {
|
|
1895
|
+
try {
|
|
1896
|
+
return { body: parseBody(script, "script"), offset: 0 };
|
|
1897
|
+
} catch {
|
|
1898
|
+
try {
|
|
1899
|
+
return { body: parseBody(script, "module"), offset: 0 };
|
|
1900
|
+
} catch {
|
|
1901
|
+
const wrapped = parseBody(`async function __temp__() {
|
|
1902
|
+
${script}
|
|
1903
|
+
}`, "script");
|
|
1904
|
+
const fn = wrapped[0];
|
|
1905
|
+
const block = fn?.["body"];
|
|
1906
|
+
return { body: block?.["body"] ?? [], offset: 1 };
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
function parseBody(code, sourceType) {
|
|
1911
|
+
const program = acorn.parse(code, { ...PARSE_OPTIONS, sourceType });
|
|
1912
|
+
return program["body"] ?? [];
|
|
1913
|
+
}
|
|
1914
|
+
function treesOf(script) {
|
|
1915
|
+
try {
|
|
1916
|
+
const wrap = !isWrappedInMain(script);
|
|
1917
|
+
const printed = parseBody(transformAgentScript(script, { wrapInMain: wrap }), "script");
|
|
1918
|
+
const { body, offset } = parseScript(script);
|
|
1919
|
+
if (!wrap) return { printed, script: body, offset };
|
|
1920
|
+
const main = printed[0]?.["body"];
|
|
1921
|
+
return { printed: main?.["body"] ?? [], script: body, offset };
|
|
1922
|
+
} catch {
|
|
1923
|
+
return void 0;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
function pairLists(printed, script, depth, out, offset) {
|
|
1927
|
+
const kept = printed.filter((node) => !(isNode(node) && isAddedByTransform(node)));
|
|
1928
|
+
if (kept.length !== script.length) return;
|
|
1929
|
+
kept.forEach((node, index) => {
|
|
1930
|
+
const own = script[index];
|
|
1931
|
+
if (isNode(node) && isNode(own)) pairNodes(node, own, depth, out, offset);
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
function pairNodes(printed, script, depth, out, offset) {
|
|
1935
|
+
if (printed.type === "ReturnStatement" && script.type === "ExpressionStatement") {
|
|
1936
|
+
record(printed, script, depth, out, offset);
|
|
1937
|
+
const argument = printed["argument"];
|
|
1938
|
+
const expression = script["expression"];
|
|
1939
|
+
if (isNode(argument) && isNode(expression)) pairNodes(argument, expression, depth + 1, out, offset);
|
|
1940
|
+
return;
|
|
1941
|
+
}
|
|
1942
|
+
if (printed.type !== script.type) return;
|
|
1943
|
+
record(printed, script, depth, out, offset);
|
|
1944
|
+
for (const key of Object.keys(printed)) {
|
|
1945
|
+
if (NON_CHILD_KEYS.has(key)) continue;
|
|
1946
|
+
const printedChild = printed[key];
|
|
1947
|
+
const scriptChild = script[key];
|
|
1948
|
+
if (Array.isArray(printedChild) && Array.isArray(scriptChild)) {
|
|
1949
|
+
pairLists(printedChild, scriptChild, depth + 1, out, offset);
|
|
1950
|
+
} else if (isNode(printedChild) && isNode(scriptChild)) {
|
|
1951
|
+
pairNodes(printedChild, scriptChild, depth + 1, out, offset);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
function record(printed, script, depth, out, offset) {
|
|
1956
|
+
if (!printed.loc || !script.loc) return;
|
|
1957
|
+
out.push({
|
|
1958
|
+
printedStart: printed.loc.start.line,
|
|
1959
|
+
printedEnd: printed.loc.end.line,
|
|
1960
|
+
scriptLine: script.loc.start.line - offset,
|
|
1961
|
+
depth
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
function validatedLineMapper(script) {
|
|
1965
|
+
const trees = treesOf(script);
|
|
1966
|
+
if (!trees) return () => void 0;
|
|
1967
|
+
const pairs = [];
|
|
1968
|
+
pairLists(trees.printed, trees.script, 0, pairs, trees.offset);
|
|
1969
|
+
return (printedLine) => {
|
|
1970
|
+
const starting = pairs.filter((pair) => pair.printedStart === printedLine);
|
|
1971
|
+
const candidates = starting.length > 0 ? starting : pairs.filter((pair) => pair.printedStart <= printedLine && printedLine <= pair.printedEnd);
|
|
1972
|
+
const best = candidates.reduce(
|
|
1973
|
+
(deepest, pair) => !deepest || pair.depth > deepest.depth ? pair : deepest,
|
|
1974
|
+
void 0
|
|
1975
|
+
);
|
|
1976
|
+
return best && best.scriptLine >= 1 ? best.scriptLine : void 0;
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
var ISSUE_LINE_RE = / \(line (\d+)\)/g;
|
|
1980
|
+
function withScriptLines(message, script) {
|
|
1981
|
+
if (!message.includes("(line ")) return message;
|
|
1982
|
+
const lineOf = validatedLineMapper(script);
|
|
1983
|
+
return message.replace(ISSUE_LINE_RE, (_match, printed) => {
|
|
1984
|
+
const line = lineOf(Number(printed));
|
|
1985
|
+
return line === void 0 ? "" : ` (line ${line})`;
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1874
1989
|
// plugins/plugin-codecall/src/services/enclave.service.ts
|
|
1875
1990
|
function toolFailureMessage(error, toolName) {
|
|
1876
1991
|
if (typeof error === "string" && error) return error;
|
|
@@ -1995,7 +2110,7 @@ var EnclaveService = class {
|
|
|
1995
2110
|
const enclave = createEnclave(options);
|
|
1996
2111
|
try {
|
|
1997
2112
|
const result = await enclave.run(code);
|
|
1998
|
-
return this.mapEnclaveResult(result, logs, toolFailures);
|
|
2113
|
+
return this.mapEnclaveResult(result, logs, toolFailures, code);
|
|
1999
2114
|
} finally {
|
|
2000
2115
|
enclave.dispose();
|
|
2001
2116
|
}
|
|
@@ -2003,7 +2118,7 @@ var EnclaveService = class {
|
|
|
2003
2118
|
/**
|
|
2004
2119
|
* Map Enclave ExecutionResult to EnclaveExecutionResult
|
|
2005
2120
|
*/
|
|
2006
|
-
mapEnclaveResult(result, logs, toolFailures = []) {
|
|
2121
|
+
mapEnclaveResult(result, logs, toolFailures = [], script = "") {
|
|
2007
2122
|
const stats = {
|
|
2008
2123
|
duration: result.stats.duration,
|
|
2009
2124
|
toolCallCount: result.stats.toolCallCount,
|
|
@@ -2045,7 +2160,9 @@ var EnclaveService = class {
|
|
|
2045
2160
|
return {
|
|
2046
2161
|
success: false,
|
|
2047
2162
|
error: {
|
|
2048
|
-
|
|
2163
|
+
// The enclave names lines of the code it validated (the script wrapped and printed again),
|
|
2164
|
+
// not the script's own.
|
|
2165
|
+
message: withScriptLines(error.message, script),
|
|
2049
2166
|
name: "ValidationError",
|
|
2050
2167
|
code: error.code,
|
|
2051
2168
|
...blockedPatterns.length > 0 ? { blockedPatterns } : {}
|
|
@@ -3186,7 +3303,11 @@ var runtimeErrorPayloadSchema = z7.object({
|
|
|
3186
3303
|
var toolErrorPayloadSchema = z7.object({
|
|
3187
3304
|
source: z7.literal("tool"),
|
|
3188
3305
|
toolName: z7.string(),
|
|
3189
|
-
|
|
3306
|
+
/**
|
|
3307
|
+
* @deprecated Never set: the sandbox resolves sidecar references in a call's arguments before
|
|
3308
|
+
* the tool sees them, so they may hold data the script itself never had.
|
|
3309
|
+
*/
|
|
3310
|
+
toolInput: z7.unknown().optional(),
|
|
3190
3311
|
message: z7.string(),
|
|
3191
3312
|
code: z7.string().optional(),
|
|
3192
3313
|
/** @deprecated Never set: the enclave's error data is not sanitized for clients. */
|
|
@@ -3433,10 +3554,10 @@ var ExecuteTool = class extends ToolContext5 {
|
|
|
3433
3554
|
error: {
|
|
3434
3555
|
source: "tool",
|
|
3435
3556
|
toolName: error.toolName,
|
|
3436
|
-
toolInput: error.toolInput,
|
|
3437
3557
|
message: toClientErrorMessage(error.message),
|
|
3438
3558
|
code: error.code
|
|
3439
|
-
// No `details`: the enclave's error data is not sanitized for clients.
|
|
3559
|
+
// No `details`: the enclave's error data is not sanitized for clients. No `toolInput`:
|
|
3560
|
+
// the arguments the tool saw may hold sidecar-resolved data the script never had.
|
|
3440
3561
|
}
|
|
3441
3562
|
};
|
|
3442
3563
|
}
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-codecall",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"description": "CodeCall plugin for FrontMCP - AgentScript-based meta-tools for orchestrating MCP tools",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,14 +48,16 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
+
"@enclave-vm/ast": "^2.15.3",
|
|
51
52
|
"@enclave-vm/core": "^2.15.3",
|
|
52
|
-
"@frontmcp/protocol": "1.8.
|
|
53
|
-
"@frontmcp/sdk": "1.8.
|
|
53
|
+
"@frontmcp/protocol": "1.8.5",
|
|
54
|
+
"@frontmcp/sdk": "1.8.5",
|
|
55
|
+
"acorn": "^8.15.0",
|
|
54
56
|
"vectoriadb": "^2.3.2"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
57
|
-
"@frontmcp/lazy-zod": "1.8.
|
|
58
|
-
"@frontmcp/plugin-cache": "1.8.
|
|
59
|
+
"@frontmcp/lazy-zod": "1.8.5",
|
|
60
|
+
"@frontmcp/plugin-cache": "1.8.5"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"reflect-metadata": "^0.2.2"
|
package/index.js
CHANGED
|
@@ -1908,6 +1908,121 @@ function toSandboxToolNamespaces(namespaces, reservedGlobals = []) {
|
|
|
1908
1908
|
return count > 0 ? bindable : void 0;
|
|
1909
1909
|
}
|
|
1910
1910
|
|
|
1911
|
+
// plugins/plugin-codecall/src/utils/script-lines.ts
|
|
1912
|
+
var import_ast = require("@enclave-vm/ast");
|
|
1913
|
+
var acorn = __toESM(require("acorn"));
|
|
1914
|
+
var PARSE_OPTIONS = { ecmaVersion: "latest", locations: true };
|
|
1915
|
+
var NON_CHILD_KEYS = /* @__PURE__ */ new Set(["type", "loc", "start", "end", "range"]);
|
|
1916
|
+
function isNode(value) {
|
|
1917
|
+
return typeof value === "object" && value !== null && typeof value.type === "string";
|
|
1918
|
+
}
|
|
1919
|
+
function isAddedByTransform(node) {
|
|
1920
|
+
if (node.type === "VariableDeclaration") {
|
|
1921
|
+
const [declaration] = node["declarations"] ?? [];
|
|
1922
|
+
const id = declaration?.["id"];
|
|
1923
|
+
return typeof id?.["name"] === "string" && id["name"].startsWith("__iter_");
|
|
1924
|
+
}
|
|
1925
|
+
if (node.type === "IfStatement") {
|
|
1926
|
+
const right = node["test"]?.["right"];
|
|
1927
|
+
return right?.type === "Identifier" && right["name"] === "__maxIterations";
|
|
1928
|
+
}
|
|
1929
|
+
return false;
|
|
1930
|
+
}
|
|
1931
|
+
function parseScript(script) {
|
|
1932
|
+
try {
|
|
1933
|
+
return { body: parseBody(script, "script"), offset: 0 };
|
|
1934
|
+
} catch {
|
|
1935
|
+
try {
|
|
1936
|
+
return { body: parseBody(script, "module"), offset: 0 };
|
|
1937
|
+
} catch {
|
|
1938
|
+
const wrapped = parseBody(`async function __temp__() {
|
|
1939
|
+
${script}
|
|
1940
|
+
}`, "script");
|
|
1941
|
+
const fn = wrapped[0];
|
|
1942
|
+
const block = fn?.["body"];
|
|
1943
|
+
return { body: block?.["body"] ?? [], offset: 1 };
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
function parseBody(code, sourceType) {
|
|
1948
|
+
const program = acorn.parse(code, { ...PARSE_OPTIONS, sourceType });
|
|
1949
|
+
return program["body"] ?? [];
|
|
1950
|
+
}
|
|
1951
|
+
function treesOf(script) {
|
|
1952
|
+
try {
|
|
1953
|
+
const wrap = !(0, import_ast.isWrappedInMain)(script);
|
|
1954
|
+
const printed = parseBody((0, import_ast.transformAgentScript)(script, { wrapInMain: wrap }), "script");
|
|
1955
|
+
const { body, offset } = parseScript(script);
|
|
1956
|
+
if (!wrap) return { printed, script: body, offset };
|
|
1957
|
+
const main = printed[0]?.["body"];
|
|
1958
|
+
return { printed: main?.["body"] ?? [], script: body, offset };
|
|
1959
|
+
} catch {
|
|
1960
|
+
return void 0;
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
function pairLists(printed, script, depth, out, offset) {
|
|
1964
|
+
const kept = printed.filter((node) => !(isNode(node) && isAddedByTransform(node)));
|
|
1965
|
+
if (kept.length !== script.length) return;
|
|
1966
|
+
kept.forEach((node, index) => {
|
|
1967
|
+
const own = script[index];
|
|
1968
|
+
if (isNode(node) && isNode(own)) pairNodes(node, own, depth, out, offset);
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
function pairNodes(printed, script, depth, out, offset) {
|
|
1972
|
+
if (printed.type === "ReturnStatement" && script.type === "ExpressionStatement") {
|
|
1973
|
+
record(printed, script, depth, out, offset);
|
|
1974
|
+
const argument = printed["argument"];
|
|
1975
|
+
const expression = script["expression"];
|
|
1976
|
+
if (isNode(argument) && isNode(expression)) pairNodes(argument, expression, depth + 1, out, offset);
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
if (printed.type !== script.type) return;
|
|
1980
|
+
record(printed, script, depth, out, offset);
|
|
1981
|
+
for (const key of Object.keys(printed)) {
|
|
1982
|
+
if (NON_CHILD_KEYS.has(key)) continue;
|
|
1983
|
+
const printedChild = printed[key];
|
|
1984
|
+
const scriptChild = script[key];
|
|
1985
|
+
if (Array.isArray(printedChild) && Array.isArray(scriptChild)) {
|
|
1986
|
+
pairLists(printedChild, scriptChild, depth + 1, out, offset);
|
|
1987
|
+
} else if (isNode(printedChild) && isNode(scriptChild)) {
|
|
1988
|
+
pairNodes(printedChild, scriptChild, depth + 1, out, offset);
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
function record(printed, script, depth, out, offset) {
|
|
1993
|
+
if (!printed.loc || !script.loc) return;
|
|
1994
|
+
out.push({
|
|
1995
|
+
printedStart: printed.loc.start.line,
|
|
1996
|
+
printedEnd: printed.loc.end.line,
|
|
1997
|
+
scriptLine: script.loc.start.line - offset,
|
|
1998
|
+
depth
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
function validatedLineMapper(script) {
|
|
2002
|
+
const trees = treesOf(script);
|
|
2003
|
+
if (!trees) return () => void 0;
|
|
2004
|
+
const pairs = [];
|
|
2005
|
+
pairLists(trees.printed, trees.script, 0, pairs, trees.offset);
|
|
2006
|
+
return (printedLine) => {
|
|
2007
|
+
const starting = pairs.filter((pair) => pair.printedStart === printedLine);
|
|
2008
|
+
const candidates = starting.length > 0 ? starting : pairs.filter((pair) => pair.printedStart <= printedLine && printedLine <= pair.printedEnd);
|
|
2009
|
+
const best = candidates.reduce(
|
|
2010
|
+
(deepest, pair) => !deepest || pair.depth > deepest.depth ? pair : deepest,
|
|
2011
|
+
void 0
|
|
2012
|
+
);
|
|
2013
|
+
return best && best.scriptLine >= 1 ? best.scriptLine : void 0;
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
var ISSUE_LINE_RE = / \(line (\d+)\)/g;
|
|
2017
|
+
function withScriptLines(message, script) {
|
|
2018
|
+
if (!message.includes("(line ")) return message;
|
|
2019
|
+
const lineOf = validatedLineMapper(script);
|
|
2020
|
+
return message.replace(ISSUE_LINE_RE, (_match, printed) => {
|
|
2021
|
+
const line = lineOf(Number(printed));
|
|
2022
|
+
return line === void 0 ? "" : ` (line ${line})`;
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
|
|
1911
2026
|
// plugins/plugin-codecall/src/services/enclave.service.ts
|
|
1912
2027
|
function toolFailureMessage(error, toolName) {
|
|
1913
2028
|
if (typeof error === "string" && error) return error;
|
|
@@ -2032,7 +2147,7 @@ var EnclaveService = class {
|
|
|
2032
2147
|
const enclave = createEnclave(options);
|
|
2033
2148
|
try {
|
|
2034
2149
|
const result = await enclave.run(code);
|
|
2035
|
-
return this.mapEnclaveResult(result, logs, toolFailures);
|
|
2150
|
+
return this.mapEnclaveResult(result, logs, toolFailures, code);
|
|
2036
2151
|
} finally {
|
|
2037
2152
|
enclave.dispose();
|
|
2038
2153
|
}
|
|
@@ -2040,7 +2155,7 @@ var EnclaveService = class {
|
|
|
2040
2155
|
/**
|
|
2041
2156
|
* Map Enclave ExecutionResult to EnclaveExecutionResult
|
|
2042
2157
|
*/
|
|
2043
|
-
mapEnclaveResult(result, logs, toolFailures = []) {
|
|
2158
|
+
mapEnclaveResult(result, logs, toolFailures = [], script = "") {
|
|
2044
2159
|
const stats = {
|
|
2045
2160
|
duration: result.stats.duration,
|
|
2046
2161
|
toolCallCount: result.stats.toolCallCount,
|
|
@@ -2082,7 +2197,9 @@ var EnclaveService = class {
|
|
|
2082
2197
|
return {
|
|
2083
2198
|
success: false,
|
|
2084
2199
|
error: {
|
|
2085
|
-
|
|
2200
|
+
// The enclave names lines of the code it validated (the script wrapped and printed again),
|
|
2201
|
+
// not the script's own.
|
|
2202
|
+
message: withScriptLines(error.message, script),
|
|
2086
2203
|
name: "ValidationError",
|
|
2087
2204
|
code: error.code,
|
|
2088
2205
|
...blockedPatterns.length > 0 ? { blockedPatterns } : {}
|
|
@@ -3223,7 +3340,11 @@ var runtimeErrorPayloadSchema = import_lazy_zod7.z.object({
|
|
|
3223
3340
|
var toolErrorPayloadSchema = import_lazy_zod7.z.object({
|
|
3224
3341
|
source: import_lazy_zod7.z.literal("tool"),
|
|
3225
3342
|
toolName: import_lazy_zod7.z.string(),
|
|
3226
|
-
|
|
3343
|
+
/**
|
|
3344
|
+
* @deprecated Never set: the sandbox resolves sidecar references in a call's arguments before
|
|
3345
|
+
* the tool sees them, so they may hold data the script itself never had.
|
|
3346
|
+
*/
|
|
3347
|
+
toolInput: import_lazy_zod7.z.unknown().optional(),
|
|
3227
3348
|
message: import_lazy_zod7.z.string(),
|
|
3228
3349
|
code: import_lazy_zod7.z.string().optional(),
|
|
3229
3350
|
/** @deprecated Never set: the enclave's error data is not sanitized for clients. */
|
|
@@ -3470,10 +3591,10 @@ var ExecuteTool = class extends import_sdk8.ToolContext {
|
|
|
3470
3591
|
error: {
|
|
3471
3592
|
source: "tool",
|
|
3472
3593
|
toolName: error.toolName,
|
|
3473
|
-
toolInput: error.toolInput,
|
|
3474
3594
|
message: toClientErrorMessage(error.message),
|
|
3475
3595
|
code: error.code
|
|
3476
|
-
// No `details`: the enclave's error data is not sanitized for clients.
|
|
3596
|
+
// No `details`: the enclave's error data is not sanitized for clients. No `toolInput`:
|
|
3597
|
+
// the arguments the tool saw may hold sidecar-resolved data the script never had.
|
|
3477
3598
|
}
|
|
3478
3599
|
};
|
|
3479
3600
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-codecall",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.5",
|
|
4
4
|
"description": "CodeCall plugin for FrontMCP - AgentScript-based meta-tools for orchestrating MCP tools",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,14 +48,16 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
+
"@enclave-vm/ast": "^2.15.3",
|
|
51
52
|
"@enclave-vm/core": "^2.15.3",
|
|
52
|
-
"@frontmcp/protocol": "1.8.
|
|
53
|
-
"@frontmcp/sdk": "1.8.
|
|
53
|
+
"@frontmcp/protocol": "1.8.5",
|
|
54
|
+
"@frontmcp/sdk": "1.8.5",
|
|
55
|
+
"acorn": "^8.15.0",
|
|
54
56
|
"vectoriadb": "^2.3.2"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
57
|
-
"@frontmcp/lazy-zod": "1.8.
|
|
58
|
-
"@frontmcp/plugin-cache": "1.8.
|
|
59
|
+
"@frontmcp/lazy-zod": "1.8.5",
|
|
60
|
+
"@frontmcp/plugin-cache": "1.8.5"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"reflect-metadata": "^0.2.2"
|
|
@@ -12,7 +12,6 @@ export interface EnclaveExecutionResult {
|
|
|
12
12
|
stack?: string;
|
|
13
13
|
code?: string;
|
|
14
14
|
toolName?: string;
|
|
15
|
-
toolInput?: unknown;
|
|
16
15
|
details?: unknown;
|
|
17
16
|
/** For a script that doesn't parse (`code: 'SYNTAX_ERROR'`): where, in the script's own lines. */
|
|
18
17
|
location?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enclave.service.d.ts","sourceRoot":"","sources":["../../src/services/enclave.service.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,qBAAqB,EAA6B,MAAM,oBAAoB,CAAC;AAE3F,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"enclave.service.d.ts","sourceRoot":"","sources":["../../src/services/enclave.service.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,qBAAqB,EAA6B,MAAM,oBAAoB,CAAC;AAE3F,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAC;AAIhE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,kGAAkG;QAClG,QAAQ,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5C;;;;;WAKG;QACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAkDD;;;;;;;;GAQG;AACH;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CASpD;AAOD,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyB;gBAE5C,MAAM,EAAE,cAAc;IAOlC;;;;;;;OAOG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAwGhG;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAyFzB"}
|
|
@@ -44,7 +44,7 @@ export declare const codeCallToolErrorResultSchema: import("@frontmcp/lazy-zod")
|
|
|
44
44
|
error: import("@frontmcp/lazy-zod").ZodObject<{
|
|
45
45
|
source: import("@frontmcp/lazy-zod").ZodLiteral<"tool">;
|
|
46
46
|
toolName: import("@frontmcp/lazy-zod").ZodString;
|
|
47
|
-
toolInput: import("@frontmcp/lazy-zod").ZodUnknown
|
|
47
|
+
toolInput: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodUnknown>;
|
|
48
48
|
message: import("@frontmcp/lazy-zod").ZodString;
|
|
49
49
|
code: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
|
|
50
50
|
details: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodUnknown>;
|
|
@@ -91,7 +91,7 @@ export declare const executeToolOutputSchema: import("@frontmcp/lazy-zod").ZodDi
|
|
|
91
91
|
error: import("@frontmcp/lazy-zod").ZodObject<{
|
|
92
92
|
source: import("@frontmcp/lazy-zod").ZodLiteral<"tool">;
|
|
93
93
|
toolName: import("@frontmcp/lazy-zod").ZodString;
|
|
94
|
-
toolInput: import("@frontmcp/lazy-zod").ZodUnknown
|
|
94
|
+
toolInput: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodUnknown>;
|
|
95
95
|
message: import("@frontmcp/lazy-zod").ZodString;
|
|
96
96
|
code: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
|
|
97
97
|
details: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodUnknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.schema.d.ts","sourceRoot":"","sources":["../../src/tools/execute.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAKvC,eAAO,MAAM,sBAAsB,o7BAoBe,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;CAclC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"execute.schema.d.ts","sourceRoot":"","sources":["../../src/tools/execute.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAKvC,eAAO,MAAM,sBAAsB,o7BAoBe,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;CAclC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;AAkDnF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;gCAIjC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;gCAG1C,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;gCAG5C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;gCAG3C,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;gCAGxC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;gCAGtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAOlC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAC5F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,yBAAyB,GACzB,2BAA2B,GAC3B,0BAA0B,GAC1B,uBAAuB,GACvB,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function from a line of the code the enclave validated (for this script) to the script's own
|
|
3
|
+
* line, or `undefined` for a line that is none of the script's (the wrapper, a line the loop
|
|
4
|
+
* transform added) or a script that can't be parsed.
|
|
5
|
+
*
|
|
6
|
+
* @param script The script as the caller sent it
|
|
7
|
+
*/
|
|
8
|
+
export declare function validatedLineMapper(script: string): (printedLine: number) => number | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* `message` with the lines its issues name mapped back to the script's own lines. A line that is
|
|
11
|
+
* none of the script's is dropped rather than left pointing at the wrong line.
|
|
12
|
+
*/
|
|
13
|
+
export declare function withScriptLines(message: string, script: string): string;
|
|
14
|
+
//# sourceMappingURL=script-lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-lines.d.ts","sourceRoot":"","sources":["../../src/utils/script-lines.ts"],"names":[],"mappings":"AA4IA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAmB/F;AAKD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOvE"}
|