@frontmcp/plugin-codecall 1.9.1 → 1.9.3

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.
@@ -1,4 +1,4 @@
1
- import { DynamicPlugin, type FlowCtxOf, type ProviderType } from '@frontmcp/sdk';
1
+ import { DynamicPlugin, type FlowCtxOf, type ProviderType, type ToolType } from '@frontmcp/sdk';
2
2
  import { type CodeCallPluginOptions, type CodeCallPluginOptionsInput } from './codecall.types';
3
3
  export default class CodeCallPlugin extends DynamicPlugin<CodeCallPluginOptions, CodeCallPluginOptionsInput> {
4
4
  options: CodeCallPluginOptions;
@@ -10,13 +10,18 @@ export default class CodeCallPlugin extends DynamicPlugin<CodeCallPluginOptions,
10
10
  * without touching the plugin decorator.
11
11
  */
12
12
  static dynamicProviders(options: CodeCallPluginOptionsInput): ProviderType[];
13
+ /**
14
+ * The CodeCall meta-tools. `codecall:search` and `codecall:execute` describe the `topK` and the
15
+ * script limits these options give, since the model plans its calls from those descriptions.
16
+ */
17
+ static dynamicTools(options: CodeCallPluginOptionsInput): ToolType[];
13
18
  /**
14
19
  * Hook into list_tools to enforce CodeCall modes:
15
20
  *
16
21
  * Modes:
17
22
  * - codecall_only: Hide all tools from list_tools except CodeCall meta-tools.
18
23
  * All other tools must be discovered via codecall:search.
19
- * - codecall_opt_in: Show all tools in list_tools. Tools opt-in to CodeCall via metadata.
24
+ * - codecall_opt_in: Show tools in list_tools unless they set visibleInListTools: false. Tools opt-in to CodeCall via metadata.
20
25
  * - metadata_driven: Use per-tool metadata.codecall to control visibility in list_tools.
21
26
  *
22
27
  * CodeCall meta-tools (codecall:search, codecall:describe, codecall:execute, codecall:invoke)
@@ -42,6 +47,13 @@ export default class CodeCallPlugin extends DynamicPlugin<CodeCallPluginOptions,
42
47
  * has no CodeCall plugin of its own.
43
48
  */
44
49
  refuseDirectCallOfHiddenTool(flowCtx: FlowCtxOf<'tools:call-tool'>): Promise<void>;
50
+ /**
51
+ * Whether a client may call the tool directly: it is listed, and a tool the SDK keeps out of `tools/list`
52
+ * (`visibility: 'hidden'`) also opts in with `visibleInListTools: true`, in every mode.
53
+ */
54
+ private isDirectlyCallable;
55
+ /** Whether the tool's app is one `appIds` puts under `codecall_only`; every app is, without `appIds`. */
56
+ private managesApp;
45
57
  /** Whether this instance's direct-call gate runs for the tool, so the listing hides only what that gate refuses. */
46
58
  private judges;
47
59
  private tryGetScope;
@@ -1 +1 @@
1
- {"version":3,"file":"codecall.plugin.d.ts","sourceRoot":"","sources":["../src/codecall.plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAQb,KAAK,SAAS,EAEd,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAEhC,MAAM,kBAAkB,CAAC;AAsC1B,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,aAAa,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAC1G,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAiB;IAEtC,OAAO,CAAC,SAAS;gBAOL,OAAO,GAAE,0BAA+B;IAMpD;;;OAGG;WACa,gBAAgB,CAAC,OAAO,EAAE,0BAA0B,GAAG,YAAY,EAAE;IAsDrF;;;;;;;;;;;;;OAaG;IAEG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,kBAAkB,CAAC;IAsB5D;;;;;;;;;;;;;;;OAeG;IAEG,4BAA4B,CAAC,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC;IAUxE,oHAAoH;IACpH,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,WAAW;IAQnB;;;;;;;;;OASG;IAEH,OAAO,CAAC,qBAAqB;IA4C7B;;;OAGG;IAEH,OAAO,CAAC,cAAc;IAStB;;OAEG;IAEH,OAAO,CAAC,mBAAmB;CAG5B"}
1
+ {"version":3,"file":"codecall.plugin.d.ts","sourceRoot":"","sources":["../src/codecall.plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAUb,KAAK,SAAS,EAEd,KAAK,YAAY,EAEjB,KAAK,QAAQ,EACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAEhC,MAAM,kBAAkB,CAAC;AAuC1B,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,aAAa,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAC1G,OAAO,EAAE,qBAAqB,CAAC;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAiB;IAEtC,OAAO,CAAC,SAAS;gBAOL,OAAO,GAAE,0BAA+B;IAMpD;;;OAGG;WACa,gBAAgB,CAAC,OAAO,EAAE,0BAA0B,GAAG,YAAY,EAAE;IAuDrF;;;OAGG;WACa,YAAY,CAAC,OAAO,EAAE,0BAA0B,GAAG,QAAQ,EAAE;IAwB7E;;;;;;;;;;;;;OAaG;IAEG,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,kBAAkB,CAAC;IAsB5D;;;;;;;;;;;;;;;OAeG;IAEG,4BAA4B,CAAC,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC;IAUxE;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAO1B,yGAAyG;IACzG,OAAO,CAAC,UAAU;IAOlB,oHAAoH;IACpH,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,WAAW;IAQnB;;;;;;;;;OASG;IAEH,OAAO,CAAC,qBAAqB;IAyB7B;;;OAGG;IAEH,OAAO,CAAC,cAAc;IAStB;;OAEG;IAEH,OAAO,CAAC,mBAAmB;CAG5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"codecall.types.d.ts","sourceRoot":"","sources":["../src/codecall.types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAIvC;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,KAAK,C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AE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAIF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,0BAA0B;QAClC;;;WAGG;QACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;KACjC;CACF"}
package/esm/index.mjs CHANGED
@@ -14,9 +14,11 @@ import CachePlugin from "@frontmcp/plugin-cache";
14
14
  import {
15
15
  DynamicPlugin,
16
16
  FrontMcpLogger,
17
+ FrontMcpToolTokens,
17
18
  isEntryGatedBy,
18
19
  ListToolsHook,
19
20
  Plugin,
21
+ resolveToolVisibility,
20
22
  ScopeEntry,
21
23
  ToolHook,
22
24
  ToolNotFoundError
@@ -47,7 +49,8 @@ var codeCallVmOptionsSchema = z.object({
47
49
  */
48
50
  timeoutMs: z.number().positive().optional(),
49
51
  /**
50
- * Allow loop constructs (for, while, do-while)
52
+ * Allow `for` loops besides `for-of`; false refuses every loop but `for-of` before the script runs.
53
+ * The sandbox always refuses `while`, `do-while` and `for-in`.
51
54
  * Defaults vary by preset
52
55
  */
53
56
  allowLoops: z.boolean().optional(),
@@ -67,8 +70,8 @@ var codeCallVmOptionsSchema = z.object({
67
70
  */
68
71
  disabledGlobals: z.array(z.string()).optional(),
69
72
  /**
70
- * Allow console.log/warn/error
71
- * Defaults vary by preset
73
+ * @deprecated Has no effect: scripts never get `console`, and one that uses it is refused before it runs.
74
+ * Scripts log with `mcpLog(level, message)`.
72
75
  */
73
76
  allowConsole: z.boolean().optional(),
74
77
  /**
@@ -232,15 +235,15 @@ var codeCallPluginOptionsObjectSchema = z.object({
232
235
  */
233
236
  appIds: z.array(z.string()).optional(),
234
237
  /**
235
- * Default number of tools to return in search results
238
+ * Search results per query when a `codecall:search` call names no `topK`
236
239
  * @default 8
237
240
  */
238
241
  topK: z.number().positive().default(8),
239
242
  /**
240
- * Maximum number of tool definitions to include
243
+ * Most tool definitions one `codecall:describe` call returns; a call that would describe more is refused
241
244
  * @default 8
242
245
  */
243
- maxDefinitions: z.number().positive().default(8),
246
+ maxDefinitions: z.number().int().positive().default(8),
244
247
  /**
245
248
  * Optional filter function for including tools.
246
249
  * Signature: (tool: IncludeToolsFilterToolInfo) => boolean
@@ -278,7 +281,7 @@ var DEFAULT_PLUGIN_OPTIONS = {
278
281
  var codeCallPluginOptionsSchema = codeCallPluginOptionsObjectSchema.prefault(DEFAULT_PLUGIN_OPTIONS);
279
282
 
280
283
  // plugins/plugin-codecall/src/providers/code-call.config.ts
281
- import { Provider, ProviderScope, BaseConfig } from "@frontmcp/sdk";
284
+ import { BaseConfig, Provider, ProviderScope } from "@frontmcp/sdk";
282
285
  var CodeCallConfig = class extends BaseConfig {
283
286
  constructor(options = {}) {
284
287
  const parsedConfig = codeCallPluginOptionsSchema.parse(options);
@@ -293,6 +296,10 @@ CodeCallConfig = __decorateClass([
293
296
  scope: ProviderScope.GLOBAL
294
297
  })
295
298
  ], CodeCallConfig);
299
+ var MAX_ITERATIONS_PER_LOOP = 1e4;
300
+ function maxToolCallsOf(vmOptions) {
301
+ return vmOptions.maxSteps || 100;
302
+ }
296
303
  function resolveVmOptions(vmOptions) {
297
304
  const preset = vmOptions?.preset ?? "secure";
298
305
  const base = presetDefaults(preset);
@@ -1525,13 +1532,9 @@ var ToolSearchService = class _ToolSearchService {
1525
1532
  defaultSimilarityThreshold: this.config.defaultSimilarityThreshold
1526
1533
  });
1527
1534
  }
1528
- if (config.synonymExpansion === false) {
1529
- this.synonymService = null;
1530
- } else if (this.strategy === "tfidf") {
1531
- const synonymConfig = typeof config.synonymExpansion === "object" ? config.synonymExpansion : {};
1532
- if (synonymConfig.enabled !== false) {
1533
- this.synonymService = new SynonymExpansionService(synonymConfig);
1534
- }
1535
+ const synonymExpansion = config.synonymExpansion ?? embeddingOptions.synonymExpansion;
1536
+ if (this.strategy === "tfidf" && synonymExpansion !== false && synonymExpansion?.enabled !== false) {
1537
+ this.synonymService = new SynonymExpansionService(synonymExpansion ?? {});
1535
1538
  }
1536
1539
  this.subscriptionPromise = new Promise((resolve, reject) => {
1537
1540
  this.subscriptionResolve = resolve;
@@ -1829,6 +1832,111 @@ import {
1829
1832
  } from "@enclave-vm/core";
1830
1833
  import { Provider as Provider3, ProviderScope as ProviderScope3 } from "@frontmcp/sdk";
1831
1834
 
1835
+ // plugins/plugin-codecall/src/security/script-policy.ts
1836
+ import {
1837
+ ForbiddenLoopRule,
1838
+ JSAstValidator,
1839
+ ValidationSeverity
1840
+ } from "@enclave-vm/ast";
1841
+ var AGENTSCRIPT_PARSE_OPTIONS = {
1842
+ ecmaVersion: "latest",
1843
+ sourceType: "script",
1844
+ allowReturnOutsideFunction: true,
1845
+ allowAwaitOutsideFunction: true
1846
+ };
1847
+ var PARSE_ATTEMPTS = [
1848
+ { wrap: (code) => code, parseOptions: AGENTSCRIPT_PARSE_OPTIONS, lineOffset: 0 },
1849
+ { wrap: (code) => code, parseOptions: { ...AGENTSCRIPT_PARSE_OPTIONS, sourceType: "module" }, lineOffset: 0 },
1850
+ {
1851
+ wrap: (code) => `async function __temp__() {
1852
+ ${code}
1853
+ }`,
1854
+ parseOptions: AGENTSCRIPT_PARSE_OPTIONS,
1855
+ lineOffset: 1
1856
+ }
1857
+ ];
1858
+ var NON_REFERENCE_KEYS = /* @__PURE__ */ new Set(["type", "loc", "start", "end", "range", "label"]);
1859
+ function isAstNode(value) {
1860
+ return typeof value === "object" && value !== null && typeof value.type === "string";
1861
+ }
1862
+ function isPropertyName(parent, key) {
1863
+ if (!parent || parent["computed"]) return false;
1864
+ if (parent.type === "MemberExpression") return key === "property";
1865
+ return key === "key" && ["Property", "MethodDefinition", "PropertyDefinition"].includes(parent.type);
1866
+ }
1867
+ function visitIdentifierReferences(node, visit, parent, key = "") {
1868
+ if (node.type === "Identifier") {
1869
+ if (!isPropertyName(parent, key)) visit(node);
1870
+ return;
1871
+ }
1872
+ for (const [childKey, child] of Object.entries(node)) {
1873
+ if (NON_REFERENCE_KEYS.has(childKey)) continue;
1874
+ const children = Array.isArray(child) ? child : [child];
1875
+ for (const childNode of children) {
1876
+ if (isAstNode(childNode)) visitIdentifierReferences(childNode, visit, node, childKey);
1877
+ }
1878
+ }
1879
+ }
1880
+ var DisallowedGlobalsRule = class {
1881
+ constructor(messages) {
1882
+ this.messages = messages;
1883
+ }
1884
+ messages;
1885
+ name = "codecall-disallowed-globals";
1886
+ description = "Globals CodeCall scripts may not use";
1887
+ defaultSeverity = ValidationSeverity.ERROR;
1888
+ enabledByDefault = true;
1889
+ validate(context) {
1890
+ visitIdentifierReferences(context.ast, (identifier) => {
1891
+ const message = identifier.name === void 0 ? void 0 : this.messages.get(identifier.name);
1892
+ if (message === void 0) return;
1893
+ context.report({
1894
+ code: "DISALLOWED_IDENTIFIER",
1895
+ message,
1896
+ location: identifier.loc ? { line: identifier.loc.start.line, column: identifier.loc.start.column } : void 0,
1897
+ data: { identifier: identifier.name }
1898
+ });
1899
+ });
1900
+ }
1901
+ };
1902
+ function disallowedGlobalMessages({ disabledBuiltins, disabledGlobals }) {
1903
+ return new Map([
1904
+ ...disabledBuiltins.map((name) => [name, `${name} is disabled by vm.disabledBuiltins`]),
1905
+ ...disabledGlobals.map((name) => [name, `${name} is disabled by vm.disabledGlobals`]),
1906
+ ["console", "console is not available in CodeCall scripts; use mcpLog(level, message)"]
1907
+ ]);
1908
+ }
1909
+ function scriptPolicyRules(options) {
1910
+ const rules = [new DisallowedGlobalsRule(disallowedGlobalMessages(options))];
1911
+ if (!options.allowLoops) {
1912
+ rules.push(
1913
+ new ForbiddenLoopRule({
1914
+ allowFor: false,
1915
+ allowForOf: true,
1916
+ allowWhile: false,
1917
+ allowDoWhile: false,
1918
+ allowForIn: false,
1919
+ message: "Only for-of loops are allowed (vm.allowLoops is false)"
1920
+ })
1921
+ );
1922
+ }
1923
+ return rules;
1924
+ }
1925
+ async function findScriptPolicyIssues(code, options) {
1926
+ const validator = new JSAstValidator(scriptPolicyRules(options));
1927
+ for (const attempt of PARSE_ATTEMPTS) {
1928
+ const result = await validator.validate(attempt.wrap(code), {
1929
+ parseOptions: attempt.parseOptions,
1930
+ preScan: { enabled: false }
1931
+ });
1932
+ if (result.parseError) continue;
1933
+ return result.issues.map(
1934
+ (issue) => issue.location && attempt.lineOffset > 0 ? { ...issue, location: { ...issue.location, line: issue.location.line - attempt.lineOffset } } : issue
1935
+ );
1936
+ }
1937
+ return [];
1938
+ }
1939
+
1832
1940
  // plugins/plugin-codecall/src/utils/build-tool-namespaces.ts
1833
1941
  var IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
1834
1942
  var PROTOTYPE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
@@ -2087,6 +2195,11 @@ function toolFailureName(error) {
2087
2195
  const name = error && typeof error === "object" ? error.name : void 0;
2088
2196
  return typeof name === "string" && name ? name.slice(0, 128) : "ToolError";
2089
2197
  }
2198
+ var ITERATION_LIMIT_PREFIX = "Maximum iteration limit exceeded";
2199
+ var ITERATION_LIMIT_ERROR = {
2200
+ name: "Error",
2201
+ message: `${ITERATION_LIMIT_PREFIX} (${MAX_ITERATIONS_PER_LOOP}). This limit prevents infinite loops.`
2202
+ };
2090
2203
  var PARSE_FAILURE_PREFIX = "Failed to parse AgentScript code: ";
2091
2204
  var PARSE_POSITION_RE = /\((\d+):(\d+)\)$/;
2092
2205
  function parseFailureOf(message) {
@@ -2133,6 +2246,22 @@ var EnclaveService = class {
2133
2246
  throw new ScriptTooLargeError(code.length, maxLength);
2134
2247
  }
2135
2248
  }
2249
+ const policyIssues = await findScriptPolicyIssues(code, this.vmOptions);
2250
+ if (policyIssues.length > 0) {
2251
+ return {
2252
+ success: false,
2253
+ error: {
2254
+ message: `AgentScript validation failed:
2255
+ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.location.line})` : ""}: ${issue.message}`).join("\n")}`,
2256
+ name: "ValidationError",
2257
+ code: "VALIDATION_ERROR",
2258
+ blockedPatterns: [...new Set(policyIssues.map((issue) => issue.code))]
2259
+ },
2260
+ logs,
2261
+ timedOut: false,
2262
+ stats: { duration: 0, toolCallCount: 0, iterationCount: 0 }
2263
+ };
2264
+ }
2136
2265
  const toolFailures = [];
2137
2266
  const toolHandler = async (toolName, args) => {
2138
2267
  try {
@@ -2180,8 +2309,8 @@ var EnclaveService = class {
2180
2309
  };
2181
2310
  const options = {
2182
2311
  timeout: this.vmOptions.timeoutMs,
2183
- maxToolCalls: this.vmOptions.maxSteps || 100,
2184
- maxIterations: 1e4,
2312
+ maxToolCalls: maxToolCallsOf(this.vmOptions),
2313
+ maxIterations: MAX_ITERATIONS_PER_LOOP,
2185
2314
  maxSanitizeDepth: this.vmOptions.maxSanitizeDepth,
2186
2315
  maxSanitizeProperties: this.vmOptions.maxSanitizeProperties,
2187
2316
  toolHandler,
@@ -2218,7 +2347,9 @@ var EnclaveService = class {
2218
2347
  if (result.success) {
2219
2348
  return { success: true, result: result.value, logs, timedOut: false, stats };
2220
2349
  }
2221
- const error = result.error ?? { name: "Error", message: "Script execution failed" };
2350
+ const reportedError = result.error ?? { name: "Error", message: "Script execution failed" };
2351
+ const toolFailure = [...toolFailures].reverse().find((failure) => failure.message === reportedError.message && failure.name === reportedError.name);
2352
+ const error = !toolFailure && reportedError.message?.startsWith(ITERATION_LIMIT_PREFIX) ? { ...reportedError, ...ITERATION_LIMIT_ERROR } : reportedError;
2222
2353
  if (error.code === "ENCLAVE_ERROR" && error.message?.startsWith(PARSE_FAILURE_PREFIX)) {
2223
2354
  const { message, location } = parseFailureOf(error.message);
2224
2355
  return {
@@ -2229,7 +2360,6 @@ var EnclaveService = class {
2229
2360
  stats
2230
2361
  };
2231
2362
  }
2232
- const toolFailure = [...toolFailures].reverse().find((failure) => failure.message === error.message && failure.name === error.name);
2233
2363
  if (toolFailure) {
2234
2364
  return {
2235
2365
  success: false,
@@ -2300,7 +2430,9 @@ import { getCallSurface, Tool, ToolContext } from "@frontmcp/sdk";
2300
2430
 
2301
2431
  // plugins/plugin-codecall/src/tools/search.schema.ts
2302
2432
  import { z as z2 } from "@frontmcp/lazy-zod";
2303
- var searchToolDescription = `Find tools by splitting user request into atomic actions.
2433
+ var DEFAULT_MIN_RELEVANCE_SCORE = 0.1;
2434
+ function buildSearchToolDescription(topK) {
2435
+ return `Find tools by splitting user request into atomic actions.
2304
2436
 
2305
2437
  DECOMPOSE: "delete users and send email" \u2192 queries: ["delete user", "send email"]
2306
2438
  DECOMPOSE: "get order and refund" \u2192 queries: ["get order", "calculate refund"]
@@ -2312,18 +2444,20 @@ INPUT:
2312
2444
  - queries: string[] (required) - atomic action phrases, max 10
2313
2445
  - appIds?: string[] - filter by app
2314
2446
  - excludeToolNames?: string[] - skip known tools
2315
- - topK?: number (default 5) - results per query
2316
- - minRelevanceScore?: number (default 0.3) - minimum match threshold
2447
+ - topK?: number (default ${topK}) - results per query
2448
+ - minRelevanceScore?: number (default ${DEFAULT_MIN_RELEVANCE_SCORE}) - minimum match threshold
2317
2449
 
2318
2450
  OUTPUT: Flat deduplicated tool list. relevanceScore: 0.5+=good, 0.7+=strong match.
2319
2451
 
2320
2452
  FLOW: search \u2192 describe \u2192 execute/invoke`;
2453
+ }
2454
+ var searchToolDescription = buildSearchToolDescription(codeCallPluginOptionsSchema.parse({}).topK);
2321
2455
  var searchToolInputSchema = {
2322
2456
  queries: z2.array(z2.string().min(2).max(256)).min(1).max(10).describe("Atomic action queries. Split complex requests into simple actions."),
2323
2457
  appIds: z2.array(z2.string()).max(10).optional().describe("Filter by app IDs"),
2324
2458
  excludeToolNames: z2.array(z2.string()).max(50).optional().describe("Skip already-known tool names"),
2325
- topK: z2.number().int().positive().max(50).optional().default(10).describe("Results per query (default 10)"),
2326
- minRelevanceScore: z2.number().min(0).max(1).optional().default(0.1).describe("Minimum relevance threshold (default 0.1)")
2459
+ topK: z2.number().int().positive().max(50).optional().describe("Results per query (defaults to the server's CodeCall topK, 8 unless configured)"),
2460
+ minRelevanceScore: z2.number().min(0).max(1).optional().default(DEFAULT_MIN_RELEVANCE_SCORE).describe(`Minimum relevance threshold (default ${DEFAULT_MIN_RELEVANCE_SCORE})`)
2327
2461
  };
2328
2462
  var searchToolOutputSchema = z2.object({
2329
2463
  tools: z2.array(
@@ -2348,7 +2482,7 @@ var searchToolOutputSchema = z2.object({
2348
2482
  // plugins/plugin-codecall/src/tools/search.tool.ts
2349
2483
  var SearchTool = class extends ToolContext {
2350
2484
  async execute(input) {
2351
- const { queries, appIds, excludeToolNames = [], topK = 5, minRelevanceScore = 0.3 } = input;
2485
+ const { queries, appIds, excludeToolNames = [], topK, minRelevanceScore = DEFAULT_MIN_RELEVANCE_SCORE } = input;
2352
2486
  const searchService = this.get(ToolSearchService);
2353
2487
  const warnings = [];
2354
2488
  const audit = this.tryGet(AuditLoggerService);
@@ -2730,7 +2864,7 @@ SearchKnowledgeTool = __decorateClass([
2730
2864
 
2731
2865
  // plugins/plugin-codecall/src/tools/describe.tool.ts
2732
2866
  import { toJSONSchema, z as z6, ZodType } from "@frontmcp/lazy-zod";
2733
- import { getCallSurface as getCallSurface2, Tool as Tool4, ToolContext as ToolContext4 } from "@frontmcp/sdk";
2867
+ import { getCallSurface as getCallSurface2, InvalidInputError, Tool as Tool4, ToolContext as ToolContext4 } from "@frontmcp/sdk";
2734
2868
 
2735
2869
  // plugins/plugin-codecall/src/utils/describe.utils.ts
2736
2870
  var INTENT_PATTERNS = {
@@ -3144,7 +3278,7 @@ import { z as z5 } from "@frontmcp/lazy-zod";
3144
3278
  import { ToolAnnotationsSchema } from "@frontmcp/protocol";
3145
3279
  var describeToolDescription = `Get input/output schemas for tools from search results.
3146
3280
 
3147
- INPUT: toolNames: string[] - tool names from search
3281
+ INPUT: toolNames: string[] - tool names from search, at most the server's maxDefinitions (8 unless configured) per call
3148
3282
  OUTPUT per tool: inputSchema (JSON Schema), outputSchema (JSON Schema), usageExamples (up to 5 callTool examples)
3149
3283
 
3150
3284
  IMPORTANT: If notFound array is non-empty \u2192 re-search with corrected queries.
@@ -3198,9 +3332,10 @@ var DescribeTool = class extends ToolContext4 {
3198
3332
  const audit = this.tryGet(AuditLoggerService);
3199
3333
  const executionId = audit ? audit.generateExecutionId() : "";
3200
3334
  const startedAt = Date.now();
3335
+ const config = this.get(CodeCallConfig);
3336
+ const maxDefinitions = config.get("maxDefinitions");
3201
3337
  const tools = [];
3202
3338
  const notFound = [];
3203
- const config = this.get(CodeCallConfig);
3204
3339
  const surface = getCallSurface2();
3205
3340
  for (const toolName of toolNames) {
3206
3341
  if (isBlockedSelfReference(toolName)) {
@@ -3214,6 +3349,11 @@ var DescribeTool = class extends ToolContext4 {
3214
3349
  continue;
3215
3350
  }
3216
3351
  const tool = access.entry;
3352
+ if (tools.length >= maxDefinitions) {
3353
+ throw new InvalidInputError(
3354
+ `codecall:describe describes at most ${maxDefinitions} tools per call; describe the rest in another call`
3355
+ );
3356
+ }
3217
3357
  const appId = this.extractAppId(tool);
3218
3358
  const inputSchema = this.getInputSchema(tool);
3219
3359
  const outputSchema = this.toJsonSchema(tool.rawOutputSchema ?? tool.outputSchema);
@@ -3372,7 +3512,15 @@ import { getCallSurface as getCallSurface3, Tool as Tool5, ToolContext as ToolCo
3372
3512
  // plugins/plugin-codecall/src/tools/execute.schema.ts
3373
3513
  import { z as z7 } from "@frontmcp/lazy-zod";
3374
3514
  var MIN_EXECUTE_SCRIPT_LENGTH = 'return callTool("a",{})'.length;
3375
- var executeToolDescription = `Execute AgentScript (safe JS subset) for multi-tool orchestration.
3515
+ var ALWAYS_BLOCKED_NAMES = ["eval", "require", "fetch", "setTimeout", "process", "globalThis"];
3516
+ function buildExecuteToolDescription(vmOptions) {
3517
+ const loops = vmOptions.allowLoops ? "for, for-of" : "for-of";
3518
+ const blockedLoops = vmOptions.allowLoops ? "while, do-while" : "while, do-while, for";
3519
+ const blockedNames = /* @__PURE__ */ new Set([...ALWAYS_BLOCKED_NAMES, ...vmOptions.disabledBuiltins, ...vmOptions.disabledGlobals]);
3520
+ const namespaces = ["Math", "JSON"].filter((name) => !blockedNames.has(name)).map((name) => `${name}.*, `);
3521
+ const timeoutSeconds = vmOptions.timeoutMs / 1e3;
3522
+ const maxToolCalls = maxToolCallsOf(vmOptions);
3523
+ return `Execute AgentScript (safe JS subset) for multi-tool orchestration.
3376
3524
 
3377
3525
  API: await callTool(name, args, opts?)
3378
3526
  - Default: throws on error
@@ -3387,12 +3535,14 @@ for (const u of users.items) {
3387
3535
  }
3388
3536
  return results;
3389
3537
 
3390
- ALLOWED: for, for-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals
3391
- BLOCKED: while, do-while, function decl, eval, require, fetch, setTimeout, process, globalThis
3538
+ ALLOWED: ${loops}, arrow fn, map/filter/reduce/find, ${namespaces.join("")}if/else, destructuring, spread, template literals
3539
+ BLOCKED: ${blockedLoops}, console (use mcpLog), function decl, ${[...blockedNames].join(", ")}
3392
3540
 
3393
3541
  ERRORS: NOT_FOUND | VALIDATION | EXECUTION | TIMEOUT | ACCESS_DENIED
3394
3542
  STATUS: ok | syntax_error | illegal_access | runtime_error | tool_error | timeout
3395
- LIMITS: 10K iter/loop, 30s timeout, 100 calls max`;
3543
+ LIMITS: ${MAX_ITERATIONS_PER_LOOP} iterations per loop, ${timeoutSeconds}s timeout, ${maxToolCalls} tool calls`;
3544
+ }
3545
+ var executeToolDescription = buildExecuteToolDescription(resolveVmOptions());
3396
3546
  var executeToolInputSchema = {
3397
3547
  script: z7.string().min(MIN_EXECUTE_SCRIPT_LENGTH).max(100 * 1024).describe(
3398
3548
  "JavaScript code to execute in the sandbox. Must return a value (implicitly or via explicit return). Use callTool(name, input) to invoke tools."
@@ -3899,6 +4049,7 @@ var CodeCallPlugin = class extends DynamicPlugin {
3899
4049
  return new ToolSearchService(
3900
4050
  {
3901
4051
  embeddingOptions: parsedOptions.embedding,
4052
+ defaultTopK: parsedOptions.topK,
3902
4053
  mode: parsedOptions.mode,
3903
4054
  includeTools: parsedOptions["includeTools"]
3904
4055
  },
@@ -3908,6 +4059,35 @@ var CodeCallPlugin = class extends DynamicPlugin {
3908
4059
  }
3909
4060
  ];
3910
4061
  }
4062
+ /**
4063
+ * The CodeCall meta-tools. `codecall:search` and `codecall:execute` describe the `topK` and the
4064
+ * script limits these options give, since the model plans its calls from those descriptions.
4065
+ */
4066
+ static dynamicTools(options) {
4067
+ const config = new CodeCallConfig(codeCallPluginOptionsSchema.parse(options)).getAll();
4068
+ class ConfiguredSearchTool extends SearchTool {
4069
+ }
4070
+ class ConfiguredExecuteTool extends ExecuteTool {
4071
+ }
4072
+ Reflect.defineMetadata(
4073
+ FrontMcpToolTokens.description,
4074
+ buildSearchToolDescription(config.topK),
4075
+ ConfiguredSearchTool
4076
+ );
4077
+ Reflect.defineMetadata(
4078
+ FrontMcpToolTokens.description,
4079
+ buildExecuteToolDescription(config.resolvedVm),
4080
+ ConfiguredExecuteTool
4081
+ );
4082
+ return [
4083
+ ConfiguredSearchTool,
4084
+ SearchSkillsTool,
4085
+ SearchKnowledgeTool,
4086
+ DescribeTool,
4087
+ ConfiguredExecuteTool,
4088
+ InvokeTool
4089
+ ];
4090
+ }
3911
4091
  async adjustListTools(flowCtx) {
3912
4092
  const logger = this.getLogger();
3913
4093
  const { resolvedTools } = flowCtx.state;
@@ -3927,11 +4107,28 @@ var CodeCallPlugin = class extends DynamicPlugin {
3927
4107
  async refuseDirectCallOfHiddenTool(flowCtx) {
3928
4108
  const { tool } = flowCtx.state;
3929
4109
  if (!tool || tool.owner?.kind === "scope") return;
3930
- if (this.shouldShowInListTools(tool, this.options.mode)) return;
4110
+ if (this.isDirectlyCallable(tool)) return;
3931
4111
  if (isInProcessDispatch(callContextOf(flowCtx))) return;
3932
4112
  this.getLogger().verbose("refused a direct tools/call of a tool CodeCall hides", { tool: tool.fullName });
3933
4113
  throw new ToolNotFoundError(flowCtx.state.input?.name ?? tool.name);
3934
4114
  }
4115
+ /**
4116
+ * Whether a client may call the tool directly: it is listed, and a tool the SDK keeps out of `tools/list`
4117
+ * (`visibility: 'hidden'`) also opts in with `visibleInListTools: true`, in every mode.
4118
+ */
4119
+ isDirectlyCallable(tool) {
4120
+ if (!this.managesApp(tool)) return true;
4121
+ if (!this.shouldShowInListTools(tool, this.options.mode)) return false;
4122
+ if (resolveToolVisibility(tool.metadata) !== "hidden") return true;
4123
+ return this.getCodeCallMetadata(tool)?.visibleInListTools === true;
4124
+ }
4125
+ /** Whether the tool's app is one `appIds` puts under `codecall_only`; every app is, without `appIds`. */
4126
+ managesApp(tool) {
4127
+ const managedAppIds = this.options.appIds;
4128
+ if (this.options.mode !== "codecall_only" || !managedAppIds || managedAppIds.length === 0) return true;
4129
+ const toolOwnerAppId = tool.owner?.kind === "app" ? tool.owner.id : void 0;
4130
+ return toolOwnerAppId !== void 0 && managedAppIds.includes(toolOwnerAppId);
4131
+ }
3935
4132
  /** Whether this instance's direct-call gate runs for the tool, so the listing hides only what that gate refuses. */
3936
4133
  judges(scope, entry) {
3937
4134
  return !scope?.hooks || isEntryGatedBy(scope, entry, this);
@@ -3959,23 +4156,11 @@ var CodeCallPlugin = class extends DynamicPlugin {
3959
4156
  }
3960
4157
  const codecallMeta = this.getCodeCallMetadata(tool);
3961
4158
  switch (mode) {
3962
- case "codecall_only": {
3963
- const managedAppIds = this.options.appIds;
3964
- if (managedAppIds && managedAppIds.length > 0) {
3965
- const toolOwnerAppId = tool.owner?.kind === "app" ? tool.owner.id : void 0;
3966
- if (!toolOwnerAppId || !managedAppIds.includes(toolOwnerAppId)) {
3967
- return true;
3968
- }
3969
- }
3970
- return codecallMeta?.visibleInListTools === true;
3971
- }
4159
+ case "codecall_only":
4160
+ return !this.managesApp(tool) || codecallMeta?.visibleInListTools === true;
3972
4161
  case "codecall_opt_in":
3973
- return true;
3974
4162
  case "metadata_driven":
3975
- if (codecallMeta?.visibleInListTools === false) {
3976
- return false;
3977
- }
3978
- return true;
4163
+ return codecallMeta?.visibleInListTools !== false;
3979
4164
  default:
3980
4165
  return true;
3981
4166
  }
@@ -4006,8 +4191,7 @@ CodeCallPlugin = __decorateClass([
4006
4191
  name: "codecall",
4007
4192
  description: "CodeCall plugin: AgentScript-based meta-tools for orchestrating MCP tools",
4008
4193
  providers: [],
4009
- plugins: [CachePlugin],
4010
- tools: [SearchTool, SearchSkillsTool, SearchKnowledgeTool, DescribeTool, ExecuteTool, InvokeTool]
4194
+ plugins: [CachePlugin]
4011
4195
  })
4012
4196
  ], CodeCallPlugin);
4013
4197
  export {
package/esm/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/plugin-codecall",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
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",
@@ -50,14 +50,14 @@
50
50
  "dependencies": {
51
51
  "@enclave-vm/ast": "^2.16.0",
52
52
  "@enclave-vm/core": "^2.16.0",
53
- "@frontmcp/protocol": "1.9.1",
54
- "@frontmcp/sdk": "1.9.1",
53
+ "@frontmcp/protocol": "1.9.3",
54
+ "@frontmcp/sdk": "1.9.3",
55
55
  "acorn": "^8.15.0",
56
- "vectoriadb": "^2.3.2"
56
+ "vectoriadb": "^2.3.3"
57
57
  },
58
58
  "peerDependencies": {
59
- "@frontmcp/lazy-zod": "1.9.1",
60
- "@frontmcp/plugin-cache": "1.9.1"
59
+ "@frontmcp/lazy-zod": "1.9.3",
60
+ "@frontmcp/plugin-cache": "1.9.3"
61
61
  },
62
62
  "devDependencies": {
63
63
  "reflect-metadata": "^0.2.2"
package/index.js CHANGED
@@ -83,7 +83,8 @@ var codeCallVmOptionsSchema = import_lazy_zod.z.object({
83
83
  */
84
84
  timeoutMs: import_lazy_zod.z.number().positive().optional(),
85
85
  /**
86
- * Allow loop constructs (for, while, do-while)
86
+ * Allow `for` loops besides `for-of`; false refuses every loop but `for-of` before the script runs.
87
+ * The sandbox always refuses `while`, `do-while` and `for-in`.
87
88
  * Defaults vary by preset
88
89
  */
89
90
  allowLoops: import_lazy_zod.z.boolean().optional(),
@@ -103,8 +104,8 @@ var codeCallVmOptionsSchema = import_lazy_zod.z.object({
103
104
  */
104
105
  disabledGlobals: import_lazy_zod.z.array(import_lazy_zod.z.string()).optional(),
105
106
  /**
106
- * Allow console.log/warn/error
107
- * Defaults vary by preset
107
+ * @deprecated Has no effect: scripts never get `console`, and one that uses it is refused before it runs.
108
+ * Scripts log with `mcpLog(level, message)`.
108
109
  */
109
110
  allowConsole: import_lazy_zod.z.boolean().optional(),
110
111
  /**
@@ -268,15 +269,15 @@ var codeCallPluginOptionsObjectSchema = import_lazy_zod.z.object({
268
269
  */
269
270
  appIds: import_lazy_zod.z.array(import_lazy_zod.z.string()).optional(),
270
271
  /**
271
- * Default number of tools to return in search results
272
+ * Search results per query when a `codecall:search` call names no `topK`
272
273
  * @default 8
273
274
  */
274
275
  topK: import_lazy_zod.z.number().positive().default(8),
275
276
  /**
276
- * Maximum number of tool definitions to include
277
+ * Most tool definitions one `codecall:describe` call returns; a call that would describe more is refused
277
278
  * @default 8
278
279
  */
279
- maxDefinitions: import_lazy_zod.z.number().positive().default(8),
280
+ maxDefinitions: import_lazy_zod.z.number().int().positive().default(8),
280
281
  /**
281
282
  * Optional filter function for including tools.
282
283
  * Signature: (tool: IncludeToolsFilterToolInfo) => boolean
@@ -329,6 +330,10 @@ CodeCallConfig = __decorateClass([
329
330
  scope: import_sdk.ProviderScope.GLOBAL
330
331
  })
331
332
  ], CodeCallConfig);
333
+ var MAX_ITERATIONS_PER_LOOP = 1e4;
334
+ function maxToolCallsOf(vmOptions) {
335
+ return vmOptions.maxSteps || 100;
336
+ }
332
337
  function resolveVmOptions(vmOptions) {
333
338
  const preset = vmOptions?.preset ?? "secure";
334
339
  const base = presetDefaults(preset);
@@ -1561,13 +1566,9 @@ var ToolSearchService = class _ToolSearchService {
1561
1566
  defaultSimilarityThreshold: this.config.defaultSimilarityThreshold
1562
1567
  });
1563
1568
  }
1564
- if (config.synonymExpansion === false) {
1565
- this.synonymService = null;
1566
- } else if (this.strategy === "tfidf") {
1567
- const synonymConfig = typeof config.synonymExpansion === "object" ? config.synonymExpansion : {};
1568
- if (synonymConfig.enabled !== false) {
1569
- this.synonymService = new SynonymExpansionService(synonymConfig);
1570
- }
1569
+ const synonymExpansion = config.synonymExpansion ?? embeddingOptions.synonymExpansion;
1570
+ if (this.strategy === "tfidf" && synonymExpansion !== false && synonymExpansion?.enabled !== false) {
1571
+ this.synonymService = new SynonymExpansionService(synonymExpansion ?? {});
1571
1572
  }
1572
1573
  this.subscriptionPromise = new Promise((resolve, reject) => {
1573
1574
  this.subscriptionResolve = resolve;
@@ -1863,6 +1864,107 @@ var ToolSearchService = class _ToolSearchService {
1863
1864
  var import_core = require("@enclave-vm/core");
1864
1865
  var import_sdk4 = require("@frontmcp/sdk");
1865
1866
 
1867
+ // plugins/plugin-codecall/src/security/script-policy.ts
1868
+ var import_ast = require("@enclave-vm/ast");
1869
+ var AGENTSCRIPT_PARSE_OPTIONS = {
1870
+ ecmaVersion: "latest",
1871
+ sourceType: "script",
1872
+ allowReturnOutsideFunction: true,
1873
+ allowAwaitOutsideFunction: true
1874
+ };
1875
+ var PARSE_ATTEMPTS = [
1876
+ { wrap: (code) => code, parseOptions: AGENTSCRIPT_PARSE_OPTIONS, lineOffset: 0 },
1877
+ { wrap: (code) => code, parseOptions: { ...AGENTSCRIPT_PARSE_OPTIONS, sourceType: "module" }, lineOffset: 0 },
1878
+ {
1879
+ wrap: (code) => `async function __temp__() {
1880
+ ${code}
1881
+ }`,
1882
+ parseOptions: AGENTSCRIPT_PARSE_OPTIONS,
1883
+ lineOffset: 1
1884
+ }
1885
+ ];
1886
+ var NON_REFERENCE_KEYS = /* @__PURE__ */ new Set(["type", "loc", "start", "end", "range", "label"]);
1887
+ function isAstNode(value) {
1888
+ return typeof value === "object" && value !== null && typeof value.type === "string";
1889
+ }
1890
+ function isPropertyName(parent, key) {
1891
+ if (!parent || parent["computed"]) return false;
1892
+ if (parent.type === "MemberExpression") return key === "property";
1893
+ return key === "key" && ["Property", "MethodDefinition", "PropertyDefinition"].includes(parent.type);
1894
+ }
1895
+ function visitIdentifierReferences(node, visit, parent, key = "") {
1896
+ if (node.type === "Identifier") {
1897
+ if (!isPropertyName(parent, key)) visit(node);
1898
+ return;
1899
+ }
1900
+ for (const [childKey, child] of Object.entries(node)) {
1901
+ if (NON_REFERENCE_KEYS.has(childKey)) continue;
1902
+ const children = Array.isArray(child) ? child : [child];
1903
+ for (const childNode of children) {
1904
+ if (isAstNode(childNode)) visitIdentifierReferences(childNode, visit, node, childKey);
1905
+ }
1906
+ }
1907
+ }
1908
+ var DisallowedGlobalsRule = class {
1909
+ constructor(messages) {
1910
+ this.messages = messages;
1911
+ }
1912
+ messages;
1913
+ name = "codecall-disallowed-globals";
1914
+ description = "Globals CodeCall scripts may not use";
1915
+ defaultSeverity = import_ast.ValidationSeverity.ERROR;
1916
+ enabledByDefault = true;
1917
+ validate(context) {
1918
+ visitIdentifierReferences(context.ast, (identifier) => {
1919
+ const message = identifier.name === void 0 ? void 0 : this.messages.get(identifier.name);
1920
+ if (message === void 0) return;
1921
+ context.report({
1922
+ code: "DISALLOWED_IDENTIFIER",
1923
+ message,
1924
+ location: identifier.loc ? { line: identifier.loc.start.line, column: identifier.loc.start.column } : void 0,
1925
+ data: { identifier: identifier.name }
1926
+ });
1927
+ });
1928
+ }
1929
+ };
1930
+ function disallowedGlobalMessages({ disabledBuiltins, disabledGlobals }) {
1931
+ return new Map([
1932
+ ...disabledBuiltins.map((name) => [name, `${name} is disabled by vm.disabledBuiltins`]),
1933
+ ...disabledGlobals.map((name) => [name, `${name} is disabled by vm.disabledGlobals`]),
1934
+ ["console", "console is not available in CodeCall scripts; use mcpLog(level, message)"]
1935
+ ]);
1936
+ }
1937
+ function scriptPolicyRules(options) {
1938
+ const rules = [new DisallowedGlobalsRule(disallowedGlobalMessages(options))];
1939
+ if (!options.allowLoops) {
1940
+ rules.push(
1941
+ new import_ast.ForbiddenLoopRule({
1942
+ allowFor: false,
1943
+ allowForOf: true,
1944
+ allowWhile: false,
1945
+ allowDoWhile: false,
1946
+ allowForIn: false,
1947
+ message: "Only for-of loops are allowed (vm.allowLoops is false)"
1948
+ })
1949
+ );
1950
+ }
1951
+ return rules;
1952
+ }
1953
+ async function findScriptPolicyIssues(code, options) {
1954
+ const validator = new import_ast.JSAstValidator(scriptPolicyRules(options));
1955
+ for (const attempt of PARSE_ATTEMPTS) {
1956
+ const result = await validator.validate(attempt.wrap(code), {
1957
+ parseOptions: attempt.parseOptions,
1958
+ preScan: { enabled: false }
1959
+ });
1960
+ if (result.parseError) continue;
1961
+ return result.issues.map(
1962
+ (issue) => issue.location && attempt.lineOffset > 0 ? { ...issue, location: { ...issue.location, line: issue.location.line - attempt.lineOffset } } : issue
1963
+ );
1964
+ }
1965
+ return [];
1966
+ }
1967
+
1866
1968
  // plugins/plugin-codecall/src/utils/build-tool-namespaces.ts
1867
1969
  var IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
1868
1970
  var PROTOTYPE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
@@ -1997,7 +2099,7 @@ function toSandboxToolNamespaces(namespaces, reservedGlobals = []) {
1997
2099
  }
1998
2100
 
1999
2101
  // plugins/plugin-codecall/src/utils/script-lines.ts
2000
- var import_ast = require("@enclave-vm/ast");
2102
+ var import_ast2 = require("@enclave-vm/ast");
2001
2103
  var acorn = __toESM(require("acorn"));
2002
2104
  var PARSE_OPTIONS = { ecmaVersion: "latest", locations: true };
2003
2105
  var NON_CHILD_KEYS = /* @__PURE__ */ new Set(["type", "loc", "start", "end", "range"]);
@@ -2038,8 +2140,8 @@ function parseBody(code, sourceType) {
2038
2140
  }
2039
2141
  function treesOf(script) {
2040
2142
  try {
2041
- const wrap = !(0, import_ast.isWrappedInMain)(script);
2042
- const printed = parseBody((0, import_ast.transformAgentScript)(script, { wrapInMain: wrap }), "script");
2143
+ const wrap = !(0, import_ast2.isWrappedInMain)(script);
2144
+ const printed = parseBody((0, import_ast2.transformAgentScript)(script, { wrapInMain: wrap }), "script");
2043
2145
  const { body, offset } = parseScript(script);
2044
2146
  if (!wrap) return { printed, script: body, offset };
2045
2147
  const main = printed[0]?.["body"];
@@ -2121,6 +2223,11 @@ function toolFailureName(error) {
2121
2223
  const name = error && typeof error === "object" ? error.name : void 0;
2122
2224
  return typeof name === "string" && name ? name.slice(0, 128) : "ToolError";
2123
2225
  }
2226
+ var ITERATION_LIMIT_PREFIX = "Maximum iteration limit exceeded";
2227
+ var ITERATION_LIMIT_ERROR = {
2228
+ name: "Error",
2229
+ message: `${ITERATION_LIMIT_PREFIX} (${MAX_ITERATIONS_PER_LOOP}). This limit prevents infinite loops.`
2230
+ };
2124
2231
  var PARSE_FAILURE_PREFIX = "Failed to parse AgentScript code: ";
2125
2232
  var PARSE_POSITION_RE = /\((\d+):(\d+)\)$/;
2126
2233
  function parseFailureOf(message) {
@@ -2167,6 +2274,22 @@ var EnclaveService = class {
2167
2274
  throw new ScriptTooLargeError(code.length, maxLength);
2168
2275
  }
2169
2276
  }
2277
+ const policyIssues = await findScriptPolicyIssues(code, this.vmOptions);
2278
+ if (policyIssues.length > 0) {
2279
+ return {
2280
+ success: false,
2281
+ error: {
2282
+ message: `AgentScript validation failed:
2283
+ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.location.line})` : ""}: ${issue.message}`).join("\n")}`,
2284
+ name: "ValidationError",
2285
+ code: "VALIDATION_ERROR",
2286
+ blockedPatterns: [...new Set(policyIssues.map((issue) => issue.code))]
2287
+ },
2288
+ logs,
2289
+ timedOut: false,
2290
+ stats: { duration: 0, toolCallCount: 0, iterationCount: 0 }
2291
+ };
2292
+ }
2170
2293
  const toolFailures = [];
2171
2294
  const toolHandler = async (toolName, args) => {
2172
2295
  try {
@@ -2214,8 +2337,8 @@ var EnclaveService = class {
2214
2337
  };
2215
2338
  const options = {
2216
2339
  timeout: this.vmOptions.timeoutMs,
2217
- maxToolCalls: this.vmOptions.maxSteps || 100,
2218
- maxIterations: 1e4,
2340
+ maxToolCalls: maxToolCallsOf(this.vmOptions),
2341
+ maxIterations: MAX_ITERATIONS_PER_LOOP,
2219
2342
  maxSanitizeDepth: this.vmOptions.maxSanitizeDepth,
2220
2343
  maxSanitizeProperties: this.vmOptions.maxSanitizeProperties,
2221
2344
  toolHandler,
@@ -2252,7 +2375,9 @@ var EnclaveService = class {
2252
2375
  if (result.success) {
2253
2376
  return { success: true, result: result.value, logs, timedOut: false, stats };
2254
2377
  }
2255
- const error = result.error ?? { name: "Error", message: "Script execution failed" };
2378
+ const reportedError = result.error ?? { name: "Error", message: "Script execution failed" };
2379
+ const toolFailure = [...toolFailures].reverse().find((failure) => failure.message === reportedError.message && failure.name === reportedError.name);
2380
+ const error = !toolFailure && reportedError.message?.startsWith(ITERATION_LIMIT_PREFIX) ? { ...reportedError, ...ITERATION_LIMIT_ERROR } : reportedError;
2256
2381
  if (error.code === "ENCLAVE_ERROR" && error.message?.startsWith(PARSE_FAILURE_PREFIX)) {
2257
2382
  const { message, location } = parseFailureOf(error.message);
2258
2383
  return {
@@ -2263,7 +2388,6 @@ var EnclaveService = class {
2263
2388
  stats
2264
2389
  };
2265
2390
  }
2266
- const toolFailure = [...toolFailures].reverse().find((failure) => failure.message === error.message && failure.name === error.name);
2267
2391
  if (toolFailure) {
2268
2392
  return {
2269
2393
  success: false,
@@ -2334,7 +2458,9 @@ var import_sdk5 = require("@frontmcp/sdk");
2334
2458
 
2335
2459
  // plugins/plugin-codecall/src/tools/search.schema.ts
2336
2460
  var import_lazy_zod2 = require("@frontmcp/lazy-zod");
2337
- var searchToolDescription = `Find tools by splitting user request into atomic actions.
2461
+ var DEFAULT_MIN_RELEVANCE_SCORE = 0.1;
2462
+ function buildSearchToolDescription(topK) {
2463
+ return `Find tools by splitting user request into atomic actions.
2338
2464
 
2339
2465
  DECOMPOSE: "delete users and send email" \u2192 queries: ["delete user", "send email"]
2340
2466
  DECOMPOSE: "get order and refund" \u2192 queries: ["get order", "calculate refund"]
@@ -2346,18 +2472,20 @@ INPUT:
2346
2472
  - queries: string[] (required) - atomic action phrases, max 10
2347
2473
  - appIds?: string[] - filter by app
2348
2474
  - excludeToolNames?: string[] - skip known tools
2349
- - topK?: number (default 5) - results per query
2350
- - minRelevanceScore?: number (default 0.3) - minimum match threshold
2475
+ - topK?: number (default ${topK}) - results per query
2476
+ - minRelevanceScore?: number (default ${DEFAULT_MIN_RELEVANCE_SCORE}) - minimum match threshold
2351
2477
 
2352
2478
  OUTPUT: Flat deduplicated tool list. relevanceScore: 0.5+=good, 0.7+=strong match.
2353
2479
 
2354
2480
  FLOW: search \u2192 describe \u2192 execute/invoke`;
2481
+ }
2482
+ var searchToolDescription = buildSearchToolDescription(codeCallPluginOptionsSchema.parse({}).topK);
2355
2483
  var searchToolInputSchema = {
2356
2484
  queries: import_lazy_zod2.z.array(import_lazy_zod2.z.string().min(2).max(256)).min(1).max(10).describe("Atomic action queries. Split complex requests into simple actions."),
2357
2485
  appIds: import_lazy_zod2.z.array(import_lazy_zod2.z.string()).max(10).optional().describe("Filter by app IDs"),
2358
2486
  excludeToolNames: import_lazy_zod2.z.array(import_lazy_zod2.z.string()).max(50).optional().describe("Skip already-known tool names"),
2359
- topK: import_lazy_zod2.z.number().int().positive().max(50).optional().default(10).describe("Results per query (default 10)"),
2360
- minRelevanceScore: import_lazy_zod2.z.number().min(0).max(1).optional().default(0.1).describe("Minimum relevance threshold (default 0.1)")
2487
+ topK: import_lazy_zod2.z.number().int().positive().max(50).optional().describe("Results per query (defaults to the server's CodeCall topK, 8 unless configured)"),
2488
+ minRelevanceScore: import_lazy_zod2.z.number().min(0).max(1).optional().default(DEFAULT_MIN_RELEVANCE_SCORE).describe(`Minimum relevance threshold (default ${DEFAULT_MIN_RELEVANCE_SCORE})`)
2361
2489
  };
2362
2490
  var searchToolOutputSchema = import_lazy_zod2.z.object({
2363
2491
  tools: import_lazy_zod2.z.array(
@@ -2382,7 +2510,7 @@ var searchToolOutputSchema = import_lazy_zod2.z.object({
2382
2510
  // plugins/plugin-codecall/src/tools/search.tool.ts
2383
2511
  var SearchTool = class extends import_sdk5.ToolContext {
2384
2512
  async execute(input) {
2385
- const { queries, appIds, excludeToolNames = [], topK = 5, minRelevanceScore = 0.3 } = input;
2513
+ const { queries, appIds, excludeToolNames = [], topK, minRelevanceScore = DEFAULT_MIN_RELEVANCE_SCORE } = input;
2386
2514
  const searchService = this.get(ToolSearchService);
2387
2515
  const warnings = [];
2388
2516
  const audit = this.tryGet(AuditLoggerService);
@@ -3178,7 +3306,7 @@ var import_lazy_zod5 = require("@frontmcp/lazy-zod");
3178
3306
  var import_protocol = require("@frontmcp/protocol");
3179
3307
  var describeToolDescription = `Get input/output schemas for tools from search results.
3180
3308
 
3181
- INPUT: toolNames: string[] - tool names from search
3309
+ INPUT: toolNames: string[] - tool names from search, at most the server's maxDefinitions (8 unless configured) per call
3182
3310
  OUTPUT per tool: inputSchema (JSON Schema), outputSchema (JSON Schema), usageExamples (up to 5 callTool examples)
3183
3311
 
3184
3312
  IMPORTANT: If notFound array is non-empty \u2192 re-search with corrected queries.
@@ -3232,9 +3360,10 @@ var DescribeTool = class extends import_sdk8.ToolContext {
3232
3360
  const audit = this.tryGet(AuditLoggerService);
3233
3361
  const executionId = audit ? audit.generateExecutionId() : "";
3234
3362
  const startedAt = Date.now();
3363
+ const config = this.get(CodeCallConfig);
3364
+ const maxDefinitions = config.get("maxDefinitions");
3235
3365
  const tools = [];
3236
3366
  const notFound = [];
3237
- const config = this.get(CodeCallConfig);
3238
3367
  const surface = (0, import_sdk8.getCallSurface)();
3239
3368
  for (const toolName of toolNames) {
3240
3369
  if (isBlockedSelfReference(toolName)) {
@@ -3248,6 +3377,11 @@ var DescribeTool = class extends import_sdk8.ToolContext {
3248
3377
  continue;
3249
3378
  }
3250
3379
  const tool = access.entry;
3380
+ if (tools.length >= maxDefinitions) {
3381
+ throw new import_sdk8.InvalidInputError(
3382
+ `codecall:describe describes at most ${maxDefinitions} tools per call; describe the rest in another call`
3383
+ );
3384
+ }
3251
3385
  const appId = this.extractAppId(tool);
3252
3386
  const inputSchema = this.getInputSchema(tool);
3253
3387
  const outputSchema = this.toJsonSchema(tool.rawOutputSchema ?? tool.outputSchema);
@@ -3406,7 +3540,15 @@ var import_sdk9 = require("@frontmcp/sdk");
3406
3540
  // plugins/plugin-codecall/src/tools/execute.schema.ts
3407
3541
  var import_lazy_zod7 = require("@frontmcp/lazy-zod");
3408
3542
  var MIN_EXECUTE_SCRIPT_LENGTH = 'return callTool("a",{})'.length;
3409
- var executeToolDescription = `Execute AgentScript (safe JS subset) for multi-tool orchestration.
3543
+ var ALWAYS_BLOCKED_NAMES = ["eval", "require", "fetch", "setTimeout", "process", "globalThis"];
3544
+ function buildExecuteToolDescription(vmOptions) {
3545
+ const loops = vmOptions.allowLoops ? "for, for-of" : "for-of";
3546
+ const blockedLoops = vmOptions.allowLoops ? "while, do-while" : "while, do-while, for";
3547
+ const blockedNames = /* @__PURE__ */ new Set([...ALWAYS_BLOCKED_NAMES, ...vmOptions.disabledBuiltins, ...vmOptions.disabledGlobals]);
3548
+ const namespaces = ["Math", "JSON"].filter((name) => !blockedNames.has(name)).map((name) => `${name}.*, `);
3549
+ const timeoutSeconds = vmOptions.timeoutMs / 1e3;
3550
+ const maxToolCalls = maxToolCallsOf(vmOptions);
3551
+ return `Execute AgentScript (safe JS subset) for multi-tool orchestration.
3410
3552
 
3411
3553
  API: await callTool(name, args, opts?)
3412
3554
  - Default: throws on error
@@ -3421,12 +3563,14 @@ for (const u of users.items) {
3421
3563
  }
3422
3564
  return results;
3423
3565
 
3424
- ALLOWED: for, for-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals
3425
- BLOCKED: while, do-while, function decl, eval, require, fetch, setTimeout, process, globalThis
3566
+ ALLOWED: ${loops}, arrow fn, map/filter/reduce/find, ${namespaces.join("")}if/else, destructuring, spread, template literals
3567
+ BLOCKED: ${blockedLoops}, console (use mcpLog), function decl, ${[...blockedNames].join(", ")}
3426
3568
 
3427
3569
  ERRORS: NOT_FOUND | VALIDATION | EXECUTION | TIMEOUT | ACCESS_DENIED
3428
3570
  STATUS: ok | syntax_error | illegal_access | runtime_error | tool_error | timeout
3429
- LIMITS: 10K iter/loop, 30s timeout, 100 calls max`;
3571
+ LIMITS: ${MAX_ITERATIONS_PER_LOOP} iterations per loop, ${timeoutSeconds}s timeout, ${maxToolCalls} tool calls`;
3572
+ }
3573
+ var executeToolDescription = buildExecuteToolDescription(resolveVmOptions());
3430
3574
  var executeToolInputSchema = {
3431
3575
  script: import_lazy_zod7.z.string().min(MIN_EXECUTE_SCRIPT_LENGTH).max(100 * 1024).describe(
3432
3576
  "JavaScript code to execute in the sandbox. Must return a value (implicitly or via explicit return). Use callTool(name, input) to invoke tools."
@@ -3933,6 +4077,7 @@ var CodeCallPlugin = class extends import_sdk11.DynamicPlugin {
3933
4077
  return new ToolSearchService(
3934
4078
  {
3935
4079
  embeddingOptions: parsedOptions.embedding,
4080
+ defaultTopK: parsedOptions.topK,
3936
4081
  mode: parsedOptions.mode,
3937
4082
  includeTools: parsedOptions["includeTools"]
3938
4083
  },
@@ -3942,6 +4087,35 @@ var CodeCallPlugin = class extends import_sdk11.DynamicPlugin {
3942
4087
  }
3943
4088
  ];
3944
4089
  }
4090
+ /**
4091
+ * The CodeCall meta-tools. `codecall:search` and `codecall:execute` describe the `topK` and the
4092
+ * script limits these options give, since the model plans its calls from those descriptions.
4093
+ */
4094
+ static dynamicTools(options) {
4095
+ const config = new CodeCallConfig(codeCallPluginOptionsSchema.parse(options)).getAll();
4096
+ class ConfiguredSearchTool extends SearchTool {
4097
+ }
4098
+ class ConfiguredExecuteTool extends ExecuteTool {
4099
+ }
4100
+ Reflect.defineMetadata(
4101
+ import_sdk11.FrontMcpToolTokens.description,
4102
+ buildSearchToolDescription(config.topK),
4103
+ ConfiguredSearchTool
4104
+ );
4105
+ Reflect.defineMetadata(
4106
+ import_sdk11.FrontMcpToolTokens.description,
4107
+ buildExecuteToolDescription(config.resolvedVm),
4108
+ ConfiguredExecuteTool
4109
+ );
4110
+ return [
4111
+ ConfiguredSearchTool,
4112
+ SearchSkillsTool,
4113
+ SearchKnowledgeTool,
4114
+ DescribeTool,
4115
+ ConfiguredExecuteTool,
4116
+ InvokeTool
4117
+ ];
4118
+ }
3945
4119
  async adjustListTools(flowCtx) {
3946
4120
  const logger = this.getLogger();
3947
4121
  const { resolvedTools } = flowCtx.state;
@@ -3961,11 +4135,28 @@ var CodeCallPlugin = class extends import_sdk11.DynamicPlugin {
3961
4135
  async refuseDirectCallOfHiddenTool(flowCtx) {
3962
4136
  const { tool } = flowCtx.state;
3963
4137
  if (!tool || tool.owner?.kind === "scope") return;
3964
- if (this.shouldShowInListTools(tool, this.options.mode)) return;
4138
+ if (this.isDirectlyCallable(tool)) return;
3965
4139
  if (isInProcessDispatch(callContextOf(flowCtx))) return;
3966
4140
  this.getLogger().verbose("refused a direct tools/call of a tool CodeCall hides", { tool: tool.fullName });
3967
4141
  throw new import_sdk11.ToolNotFoundError(flowCtx.state.input?.name ?? tool.name);
3968
4142
  }
4143
+ /**
4144
+ * Whether a client may call the tool directly: it is listed, and a tool the SDK keeps out of `tools/list`
4145
+ * (`visibility: 'hidden'`) also opts in with `visibleInListTools: true`, in every mode.
4146
+ */
4147
+ isDirectlyCallable(tool) {
4148
+ if (!this.managesApp(tool)) return true;
4149
+ if (!this.shouldShowInListTools(tool, this.options.mode)) return false;
4150
+ if ((0, import_sdk11.resolveToolVisibility)(tool.metadata) !== "hidden") return true;
4151
+ return this.getCodeCallMetadata(tool)?.visibleInListTools === true;
4152
+ }
4153
+ /** Whether the tool's app is one `appIds` puts under `codecall_only`; every app is, without `appIds`. */
4154
+ managesApp(tool) {
4155
+ const managedAppIds = this.options.appIds;
4156
+ if (this.options.mode !== "codecall_only" || !managedAppIds || managedAppIds.length === 0) return true;
4157
+ const toolOwnerAppId = tool.owner?.kind === "app" ? tool.owner.id : void 0;
4158
+ return toolOwnerAppId !== void 0 && managedAppIds.includes(toolOwnerAppId);
4159
+ }
3969
4160
  /** Whether this instance's direct-call gate runs for the tool, so the listing hides only what that gate refuses. */
3970
4161
  judges(scope, entry) {
3971
4162
  return !scope?.hooks || (0, import_sdk11.isEntryGatedBy)(scope, entry, this);
@@ -3993,23 +4184,11 @@ var CodeCallPlugin = class extends import_sdk11.DynamicPlugin {
3993
4184
  }
3994
4185
  const codecallMeta = this.getCodeCallMetadata(tool);
3995
4186
  switch (mode) {
3996
- case "codecall_only": {
3997
- const managedAppIds = this.options.appIds;
3998
- if (managedAppIds && managedAppIds.length > 0) {
3999
- const toolOwnerAppId = tool.owner?.kind === "app" ? tool.owner.id : void 0;
4000
- if (!toolOwnerAppId || !managedAppIds.includes(toolOwnerAppId)) {
4001
- return true;
4002
- }
4003
- }
4004
- return codecallMeta?.visibleInListTools === true;
4005
- }
4187
+ case "codecall_only":
4188
+ return !this.managesApp(tool) || codecallMeta?.visibleInListTools === true;
4006
4189
  case "codecall_opt_in":
4007
- return true;
4008
4190
  case "metadata_driven":
4009
- if (codecallMeta?.visibleInListTools === false) {
4010
- return false;
4011
- }
4012
- return true;
4191
+ return codecallMeta?.visibleInListTools !== false;
4013
4192
  default:
4014
4193
  return true;
4015
4194
  }
@@ -4040,8 +4219,7 @@ CodeCallPlugin = __decorateClass([
4040
4219
  name: "codecall",
4041
4220
  description: "CodeCall plugin: AgentScript-based meta-tools for orchestrating MCP tools",
4042
4221
  providers: [],
4043
- plugins: [import_plugin_cache.default],
4044
- tools: [SearchTool, SearchSkillsTool, SearchKnowledgeTool, DescribeTool, ExecuteTool, InvokeTool]
4222
+ plugins: [import_plugin_cache.default]
4045
4223
  })
4046
4224
  ], CodeCallPlugin);
4047
4225
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/plugin-codecall",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
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",
@@ -50,14 +50,14 @@
50
50
  "dependencies": {
51
51
  "@enclave-vm/ast": "^2.16.0",
52
52
  "@enclave-vm/core": "^2.16.0",
53
- "@frontmcp/protocol": "1.9.1",
54
- "@frontmcp/sdk": "1.9.1",
53
+ "@frontmcp/protocol": "1.9.3",
54
+ "@frontmcp/sdk": "1.9.3",
55
55
  "acorn": "^8.15.0",
56
- "vectoriadb": "^2.3.2"
56
+ "vectoriadb": "^2.3.3"
57
57
  },
58
58
  "peerDependencies": {
59
- "@frontmcp/lazy-zod": "1.9.1",
60
- "@frontmcp/plugin-cache": "1.9.1"
59
+ "@frontmcp/lazy-zod": "1.9.3",
60
+ "@frontmcp/plugin-cache": "1.9.3"
61
61
  },
62
62
  "devDependencies": {
63
63
  "reflect-metadata": "^0.2.2"
@@ -1,6 +1,6 @@
1
1
  import { BaseConfig } from '@frontmcp/sdk';
2
- import { CodeCallPluginOptions } from '../codecall.types';
3
- import { ResolvedCodeCallVmOptions } from '../codecall.symbol';
2
+ import { type ResolvedCodeCallVmOptions } from '../codecall.symbol';
3
+ import { type CodeCallPluginOptions, type CodeCallVmOptions } from '../codecall.types';
4
4
  /**
5
5
  * CodeCall configuration provider with convict-like API
6
6
  * Extends BaseConfig to provide type-safe dotted path access
@@ -27,4 +27,9 @@ export default class CodeCallConfig extends BaseConfig<CodeCallPluginOptions & {
27
27
  }> {
28
28
  constructor(options?: Partial<CodeCallPluginOptions>);
29
29
  }
30
+ /** Iterations the sandbox allows each loop of a script; not configurable. */
31
+ export declare const MAX_ITERATIONS_PER_LOOP = 10000;
32
+ /** Tool calls a script may make: `vm.maxSteps`, else 100. */
33
+ export declare function maxToolCallsOf(vmOptions: ResolvedCodeCallVmOptions): number;
34
+ export declare function resolveVmOptions(vmOptions?: CodeCallVmOptions): ResolvedCodeCallVmOptions;
30
35
  //# sourceMappingURL=code-call.config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-call.config.d.ts","sourceRoot":"","sources":["../../src/providers/code-call.config.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,UAAU,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EACL,qBAAqB,EAItB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CACpD,qBAAqB,GAAG;IAAE,UAAU,EAAE,yBAAyB,CAAA;CAAE,CAClE;gBACa,OAAO,GAAE,OAAO,CAAC,qBAAqB,CAAM;CASzD"}
1
+ {"version":3,"file":"code-call.config.d.ts","sourceRoot":"","sources":["../../src/providers/code-call.config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAA2B,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAEvB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CACpD,qBAAqB,GAAG;IAAE,UAAU,EAAE,yBAAyB,CAAA;CAAE,CAClE;gBACa,OAAO,GAAE,OAAO,CAAC,qBAAqB,CAAM;CASzD;AAED,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAE7C,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,SAAS,EAAE,yBAAyB,GAAG,MAAM,CAE3E;AAID,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,iBAAiB,GAAG,yBAAyB,CAWzF"}
@@ -0,0 +1,13 @@
1
+ import { type ValidationIssue } from '@enclave-vm/ast';
2
+ import type { ResolvedCodeCallVmOptions } from '../codecall.symbol';
3
+ type ScriptPolicyOptions = Pick<ResolvedCodeCallVmOptions, 'allowLoops' | 'disabledBuiltins' | 'disabledGlobals'>;
4
+ /**
5
+ * The places a script uses a loop `vm.allowLoops: false` turns off, a global `vm.disabledBuiltins` or
6
+ * `vm.disabledGlobals` lists, or `console`, which the sandbox never gives a script, in the script's
7
+ * own lines. The sandbox takes no option for these, so CodeCall checks before it runs the script,
8
+ * parsing it the way the sandbox does. A script none of those parses accept is left to the sandbox,
9
+ * which fails on the same parse and reports the syntax error.
10
+ */
11
+ export declare function findScriptPolicyIssues(code: string, options: ScriptPolicyOptions): Promise<ValidationIssue[]>;
12
+ export {};
13
+ //# sourceMappingURL=script-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script-policy.d.ts","sourceRoot":"","sources":["../../src/security/script-policy.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAEpE,KAAK,mBAAmB,GAAG,IAAI,CAAC,yBAAyB,EAAE,YAAY,GAAG,kBAAkB,GAAG,iBAAiB,CAAC,CAAC;AA2GlH;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAenH"}
@@ -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;AAIhE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC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EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAiDrG;;OAEG;IACH,eAAe,IAAI,MAAM,EAAE;IAQ3B;;OAEG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAWvC;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAMpD;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb;;OAEG;IACH,WAAW,IAAI,iBAAiB;IAIhC;;OAEG;IACH,aAAa,IAAI,OAAO;CAGzB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from '@frontmcp/lazy-zod';
2
- export declare const describeToolDescription = "Get input/output schemas for tools from search results.\n\nINPUT: toolNames: string[] - tool names from search\nOUTPUT per tool: inputSchema (JSON Schema), outputSchema (JSON Schema), usageExamples (up to 5 callTool examples)\n\nIMPORTANT: If notFound array is non-empty \u2192 re-search with corrected queries.\nFLOW: search \u2192 describe \u2192 execute/invoke";
2
+ export declare const describeToolDescription = "Get input/output schemas for tools from search results.\n\nINPUT: toolNames: string[] - tool names from search, at most the server's maxDefinitions (8 unless configured) per call\nOUTPUT per tool: inputSchema (JSON Schema), outputSchema (JSON Schema), usageExamples (up to 5 callTool examples)\n\nIMPORTANT: If notFound array is non-empty \u2192 re-search with corrected queries.\nFLOW: search \u2192 describe \u2192 execute/invoke";
3
3
  export declare const describeToolInputSchema: {
4
4
  toolNames: import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodString>;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"describe.schema.d.ts","sourceRoot":"","sources":["../../src/tools/describe.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAGvC,eAAO,MAAM,uBAAuB,gXAMK,CAAC;AAE1C,eAAO,MAAM,uBAAuB;;CAuBnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AAErF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;gCAoCnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"describe.schema.d.ts","sourceRoot":"","sources":["../../src/tools/describe.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAGvC,eAAO,MAAM,uBAAuB,obAMK,CAAC;AAE1C,eAAO,MAAM,uBAAuB;;CAuBnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AAErF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;gCAoCnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"describe.tool.d.ts","sourceRoot":"","sources":["../../src/tools/describe.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,WAAW,EAAkB,MAAM,eAAe,CAAC;AAMlF,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAuB3B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IAC7C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkEpE;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAkDpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA6BpB;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;CAyBzB"}
1
+ {"version":3,"file":"describe.tool.d.ts","sourceRoot":"","sources":["../../src/tools/describe.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2C,WAAW,EAAkB,MAAM,eAAe,CAAC;AAMrG,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAuB3B,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IAC7C,OAAO,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwEpE;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAuBtB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAkDpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA6BpB;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;CAyBzB"}
@@ -1,5 +1,8 @@
1
1
  import { z } from '@frontmcp/lazy-zod';
2
- export declare const executeToolDescription = "Execute AgentScript (safe JS subset) for multi-tool orchestration.\n\nAPI: await callTool(name, args, opts?)\n- Default: throws on error\n- Safe mode: { throwOnError: false } \u2192 returns { success, data?, error? }\n\nEXAMPLE:\nconst users = await callTool('users:list', { active: true });\nconst results = [];\nfor (const u of users.items) {\n const orders = await callTool('orders:list', { userId: u.id });\n results.push({ id: u.id, total: orders.items.reduce((s,o) => s + o.amount, 0) });\n}\nreturn results;\n\nALLOWED: for, for-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals\nBLOCKED: while, do-while, function decl, eval, require, fetch, setTimeout, process, globalThis\n\nERRORS: NOT_FOUND | VALIDATION | EXECUTION | TIMEOUT | ACCESS_DENIED\nSTATUS: ok | syntax_error | illegal_access | runtime_error | tool_error | timeout\nLIMITS: 10K iter/loop, 30s timeout, 100 calls max";
2
+ import type { ResolvedCodeCallVmOptions } from '../codecall.symbol';
3
+ /** The `codecall:execute` description for the server's resolved `vm` options. */
4
+ export declare function buildExecuteToolDescription(vmOptions: ResolvedCodeCallVmOptions): string;
5
+ export declare const executeToolDescription: string;
3
6
  export declare const executeToolInputSchema: {
4
7
  script: import("@frontmcp/lazy-zod").ZodString;
5
8
  allowedTools: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodString>>;
@@ -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;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;AA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;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"}
@@ -1,10 +1,14 @@
1
1
  import { z } from '@frontmcp/lazy-zod';
2
- export declare const searchToolDescription = "Find tools by splitting user request into atomic actions.\n\nDECOMPOSE: \"delete users and send email\" \u2192 queries: [\"delete user\", \"send email\"]\nDECOMPOSE: \"get order and refund\" \u2192 queries: [\"get order\", \"calculate refund\"]\n\nAVOID RE-SEARCHING: Use excludeToolNames for already-discovered tools.\nRE-SEARCH WHEN: describe fails (typo?) OR execute returns tool_not_found.\n\nINPUT:\n- queries: string[] (required) - atomic action phrases, max 10\n- appIds?: string[] - filter by app\n- excludeToolNames?: string[] - skip known tools\n- topK?: number (default 5) - results per query\n- minRelevanceScore?: number (default 0.3) - minimum match threshold\n\nOUTPUT: Flat deduplicated tool list. relevanceScore: 0.5+=good, 0.7+=strong match.\n\nFLOW: search \u2192 describe \u2192 execute/invoke";
2
+ /** The `minRelevanceScore` a `codecall:search` call that names none is given. */
3
+ export declare const DEFAULT_MIN_RELEVANCE_SCORE = 0.1;
4
+ /** The `codecall:search` description for a server whose `topK` is `topK`. */
5
+ export declare function buildSearchToolDescription(topK: number): string;
6
+ export declare const searchToolDescription: string;
3
7
  export declare const searchToolInputSchema: {
4
8
  queries: import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodString>;
5
9
  appIds: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodString>>;
6
10
  excludeToolNames: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodString>>;
7
- topK: import("@frontmcp/lazy-zod").ZodDefault<import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodNumber>>;
11
+ topK: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodNumber>;
8
12
  minRelevanceScore: import("@frontmcp/lazy-zod").ZodDefault<import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodNumber>>;
9
13
  };
10
14
  export type SearchToolInput = z.infer<z.ZodObject<typeof searchToolInputSchema>>;
@@ -1 +1 @@
1
- {"version":3,"file":"search.schema.d.ts","sourceRoot":"","sources":["../../src/tools/search.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAEvC,eAAO,MAAM,qBAAqB,kzBAiBO,CAAC;AAE1C,eAAO,MAAM,qBAAqB;;;;;;CAgBjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;AAEjF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;gCAsBjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"search.schema.d.ts","sourceRoot":"","sources":["../../src/tools/search.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAIvC,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,6EAA6E;AAC7E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmB/D;AAED,eAAO,MAAM,qBAAqB,QAAyE,CAAC;AAE5G,eAAO,MAAM,qBAAqB;;;;;;CAsBjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC;AAEjF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;gCAsBjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,eAAe,CAAC;AAIlE,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AA6BzB,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAuGjE"}
1
+ {"version":3,"file":"search.tool.d.ts","sourceRoot":"","sources":["../../src/tools/search.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,eAAe,CAAC;AAIlE,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AA6BzB,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IAC3C,OAAO,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAuGjE"}