@frontmcp/plugin-codecall 1.9.2 → 1.9.4

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,6 +10,11 @@ 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
  *
@@ -1 +1 @@
1
- {"version":3,"file":"codecall.plugin.d.ts","sourceRoot":"","sources":["../src/codecall.plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EASb,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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;;;;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"}
package/esm/index.mjs CHANGED
@@ -14,6 +14,7 @@ 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,
@@ -280,7 +281,7 @@ var DEFAULT_PLUGIN_OPTIONS = {
280
281
  var codeCallPluginOptionsSchema = codeCallPluginOptionsObjectSchema.prefault(DEFAULT_PLUGIN_OPTIONS);
281
282
 
282
283
  // plugins/plugin-codecall/src/providers/code-call.config.ts
283
- import { Provider, ProviderScope, BaseConfig } from "@frontmcp/sdk";
284
+ import { BaseConfig, Provider, ProviderScope } from "@frontmcp/sdk";
284
285
  var CodeCallConfig = class extends BaseConfig {
285
286
  constructor(options = {}) {
286
287
  const parsedConfig = codeCallPluginOptionsSchema.parse(options);
@@ -295,6 +296,10 @@ CodeCallConfig = __decorateClass([
295
296
  scope: ProviderScope.GLOBAL
296
297
  })
297
298
  ], CodeCallConfig);
299
+ var MAX_ITERATIONS_PER_LOOP = 1e4;
300
+ function maxToolCallsOf(vmOptions) {
301
+ return vmOptions.maxSteps || 100;
302
+ }
298
303
  function resolveVmOptions(vmOptions) {
299
304
  const preset = vmOptions?.preset ?? "secure";
300
305
  const base = presetDefaults(preset);
@@ -1872,26 +1877,38 @@ function visitIdentifierReferences(node, visit, parent, key = "") {
1872
1877
  }
1873
1878
  }
1874
1879
  }
1875
- var GlobalConsoleRule = class {
1876
- name = "codecall-global-console";
1877
- description = "console is not available in CodeCall scripts";
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";
1878
1887
  defaultSeverity = ValidationSeverity.ERROR;
1879
1888
  enabledByDefault = true;
1880
1889
  validate(context) {
1881
1890
  visitIdentifierReferences(context.ast, (identifier) => {
1882
- if (identifier.name !== "console") return;
1891
+ const message = identifier.name === void 0 ? void 0 : this.messages.get(identifier.name);
1892
+ if (message === void 0) return;
1883
1893
  context.report({
1884
1894
  code: "DISALLOWED_IDENTIFIER",
1885
- message: "console is not available in CodeCall scripts; use mcpLog(level, message)",
1895
+ message,
1886
1896
  location: identifier.loc ? { line: identifier.loc.start.line, column: identifier.loc.start.column } : void 0,
1887
- data: { identifier: "console" }
1897
+ data: { identifier: identifier.name }
1888
1898
  });
1889
1899
  });
1890
1900
  }
1891
1901
  };
1892
- function scriptPolicyRules({ allowLoops }) {
1893
- const rules = [new GlobalConsoleRule()];
1894
- if (!allowLoops) {
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) {
1895
1912
  rules.push(
1896
1913
  new ForbiddenLoopRule({
1897
1914
  allowFor: false,
@@ -2178,6 +2195,11 @@ function toolFailureName(error) {
2178
2195
  const name = error && typeof error === "object" ? error.name : void 0;
2179
2196
  return typeof name === "string" && name ? name.slice(0, 128) : "ToolError";
2180
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
+ };
2181
2203
  var PARSE_FAILURE_PREFIX = "Failed to parse AgentScript code: ";
2182
2204
  var PARSE_POSITION_RE = /\((\d+):(\d+)\)$/;
2183
2205
  function parseFailureOf(message) {
@@ -2287,8 +2309,8 @@ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.l
2287
2309
  };
2288
2310
  const options = {
2289
2311
  timeout: this.vmOptions.timeoutMs,
2290
- maxToolCalls: this.vmOptions.maxSteps || 100,
2291
- maxIterations: 1e4,
2312
+ maxToolCalls: maxToolCallsOf(this.vmOptions),
2313
+ maxIterations: MAX_ITERATIONS_PER_LOOP,
2292
2314
  maxSanitizeDepth: this.vmOptions.maxSanitizeDepth,
2293
2315
  maxSanitizeProperties: this.vmOptions.maxSanitizeProperties,
2294
2316
  toolHandler,
@@ -2325,7 +2347,9 @@ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.l
2325
2347
  if (result.success) {
2326
2348
  return { success: true, result: result.value, logs, timedOut: false, stats };
2327
2349
  }
2328
- 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;
2329
2353
  if (error.code === "ENCLAVE_ERROR" && error.message?.startsWith(PARSE_FAILURE_PREFIX)) {
2330
2354
  const { message, location } = parseFailureOf(error.message);
2331
2355
  return {
@@ -2336,7 +2360,6 @@ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.l
2336
2360
  stats
2337
2361
  };
2338
2362
  }
2339
- const toolFailure = [...toolFailures].reverse().find((failure) => failure.message === error.message && failure.name === error.name);
2340
2363
  if (toolFailure) {
2341
2364
  return {
2342
2365
  success: false,
@@ -2407,7 +2430,9 @@ import { getCallSurface, Tool, ToolContext } from "@frontmcp/sdk";
2407
2430
 
2408
2431
  // plugins/plugin-codecall/src/tools/search.schema.ts
2409
2432
  import { z as z2 } from "@frontmcp/lazy-zod";
2410
- 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.
2411
2436
 
2412
2437
  DECOMPOSE: "delete users and send email" \u2192 queries: ["delete user", "send email"]
2413
2438
  DECOMPOSE: "get order and refund" \u2192 queries: ["get order", "calculate refund"]
@@ -2419,18 +2444,20 @@ INPUT:
2419
2444
  - queries: string[] (required) - atomic action phrases, max 10
2420
2445
  - appIds?: string[] - filter by app
2421
2446
  - excludeToolNames?: string[] - skip known tools
2422
- - topK?: number (default: the server's topK, 8 unless configured) - results per query
2423
- - 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
2424
2449
 
2425
2450
  OUTPUT: Flat deduplicated tool list. relevanceScore: 0.5+=good, 0.7+=strong match.
2426
2451
 
2427
2452
  FLOW: search \u2192 describe \u2192 execute/invoke`;
2453
+ }
2454
+ var searchToolDescription = buildSearchToolDescription(codeCallPluginOptionsSchema.parse({}).topK);
2428
2455
  var searchToolInputSchema = {
2429
2456
  queries: z2.array(z2.string().min(2).max(256)).min(1).max(10).describe("Atomic action queries. Split complex requests into simple actions."),
2430
2457
  appIds: z2.array(z2.string()).max(10).optional().describe("Filter by app IDs"),
2431
2458
  excludeToolNames: z2.array(z2.string()).max(50).optional().describe("Skip already-known tool names"),
2432
2459
  topK: z2.number().int().positive().max(50).optional().describe("Results per query (defaults to the server's CodeCall topK, 8 unless configured)"),
2433
- minRelevanceScore: z2.number().min(0).max(1).optional().default(0.1).describe("Minimum relevance threshold (default 0.1)")
2460
+ minRelevanceScore: z2.number().min(0).max(1).optional().default(DEFAULT_MIN_RELEVANCE_SCORE).describe(`Minimum relevance threshold (default ${DEFAULT_MIN_RELEVANCE_SCORE})`)
2434
2461
  };
2435
2462
  var searchToolOutputSchema = z2.object({
2436
2463
  tools: z2.array(
@@ -2455,7 +2482,7 @@ var searchToolOutputSchema = z2.object({
2455
2482
  // plugins/plugin-codecall/src/tools/search.tool.ts
2456
2483
  var SearchTool = class extends ToolContext {
2457
2484
  async execute(input) {
2458
- const { queries, appIds, excludeToolNames = [], topK, minRelevanceScore = 0.3 } = input;
2485
+ const { queries, appIds, excludeToolNames = [], topK, minRelevanceScore = DEFAULT_MIN_RELEVANCE_SCORE } = input;
2459
2486
  const searchService = this.get(ToolSearchService);
2460
2487
  const warnings = [];
2461
2488
  const audit = this.tryGet(AuditLoggerService);
@@ -3485,7 +3512,15 @@ import { getCallSurface as getCallSurface3, Tool as Tool5, ToolContext as ToolCo
3485
3512
  // plugins/plugin-codecall/src/tools/execute.schema.ts
3486
3513
  import { z as z7 } from "@frontmcp/lazy-zod";
3487
3514
  var MIN_EXECUTE_SCRIPT_LENGTH = 'return callTool("a",{})'.length;
3488
- 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.
3489
3524
 
3490
3525
  API: await callTool(name, args, opts?)
3491
3526
  - Default: throws on error
@@ -3500,12 +3535,14 @@ for (const u of users.items) {
3500
3535
  }
3501
3536
  return results;
3502
3537
 
3503
- ALLOWED: for-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals
3504
- BLOCKED: while, do-while, for (unless the server sets vm.allowLoops), console (use mcpLog), 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(", ")}
3505
3540
 
3506
3541
  ERRORS: NOT_FOUND | VALIDATION | EXECUTION | TIMEOUT | ACCESS_DENIED
3507
3542
  STATUS: ok | syntax_error | illegal_access | runtime_error | tool_error | timeout
3508
- 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());
3509
3546
  var executeToolInputSchema = {
3510
3547
  script: z7.string().min(MIN_EXECUTE_SCRIPT_LENGTH).max(100 * 1024).describe(
3511
3548
  "JavaScript code to execute in the sandbox. Must return a value (implicitly or via explicit return). Use callTool(name, input) to invoke tools."
@@ -4022,6 +4059,35 @@ var CodeCallPlugin = class extends DynamicPlugin {
4022
4059
  }
4023
4060
  ];
4024
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
+ }
4025
4091
  async adjustListTools(flowCtx) {
4026
4092
  const logger = this.getLogger();
4027
4093
  const { resolvedTools } = flowCtx.state;
@@ -4125,8 +4191,7 @@ CodeCallPlugin = __decorateClass([
4125
4191
  name: "codecall",
4126
4192
  description: "CodeCall plugin: AgentScript-based meta-tools for orchestrating MCP tools",
4127
4193
  providers: [],
4128
- plugins: [CachePlugin],
4129
- tools: [SearchTool, SearchSkillsTool, SearchKnowledgeTool, DescribeTool, ExecuteTool, InvokeTool]
4194
+ plugins: [CachePlugin]
4130
4195
  })
4131
4196
  ], CodeCallPlugin);
4132
4197
  export {
package/esm/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/plugin-codecall",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
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.2",
54
- "@frontmcp/sdk": "1.9.2",
53
+ "@frontmcp/protocol": "1.9.4",
54
+ "@frontmcp/sdk": "1.9.4",
55
55
  "acorn": "^8.15.0",
56
56
  "vectoriadb": "^2.3.3"
57
57
  },
58
58
  "peerDependencies": {
59
- "@frontmcp/lazy-zod": "1.9.2",
60
- "@frontmcp/plugin-cache": "1.9.2"
59
+ "@frontmcp/lazy-zod": "1.9.4",
60
+ "@frontmcp/plugin-cache": "1.9.4"
61
61
  },
62
62
  "devDependencies": {
63
63
  "reflect-metadata": "^0.2.2"
package/index.js CHANGED
@@ -330,6 +330,10 @@ CodeCallConfig = __decorateClass([
330
330
  scope: import_sdk.ProviderScope.GLOBAL
331
331
  })
332
332
  ], CodeCallConfig);
333
+ var MAX_ITERATIONS_PER_LOOP = 1e4;
334
+ function maxToolCallsOf(vmOptions) {
335
+ return vmOptions.maxSteps || 100;
336
+ }
333
337
  function resolveVmOptions(vmOptions) {
334
338
  const preset = vmOptions?.preset ?? "secure";
335
339
  const base = presetDefaults(preset);
@@ -1901,26 +1905,38 @@ function visitIdentifierReferences(node, visit, parent, key = "") {
1901
1905
  }
1902
1906
  }
1903
1907
  }
1904
- var GlobalConsoleRule = class {
1905
- name = "codecall-global-console";
1906
- description = "console is not available in CodeCall scripts";
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";
1907
1915
  defaultSeverity = import_ast.ValidationSeverity.ERROR;
1908
1916
  enabledByDefault = true;
1909
1917
  validate(context) {
1910
1918
  visitIdentifierReferences(context.ast, (identifier) => {
1911
- if (identifier.name !== "console") return;
1919
+ const message = identifier.name === void 0 ? void 0 : this.messages.get(identifier.name);
1920
+ if (message === void 0) return;
1912
1921
  context.report({
1913
1922
  code: "DISALLOWED_IDENTIFIER",
1914
- message: "console is not available in CodeCall scripts; use mcpLog(level, message)",
1923
+ message,
1915
1924
  location: identifier.loc ? { line: identifier.loc.start.line, column: identifier.loc.start.column } : void 0,
1916
- data: { identifier: "console" }
1925
+ data: { identifier: identifier.name }
1917
1926
  });
1918
1927
  });
1919
1928
  }
1920
1929
  };
1921
- function scriptPolicyRules({ allowLoops }) {
1922
- const rules = [new GlobalConsoleRule()];
1923
- if (!allowLoops) {
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) {
1924
1940
  rules.push(
1925
1941
  new import_ast.ForbiddenLoopRule({
1926
1942
  allowFor: false,
@@ -2207,6 +2223,11 @@ function toolFailureName(error) {
2207
2223
  const name = error && typeof error === "object" ? error.name : void 0;
2208
2224
  return typeof name === "string" && name ? name.slice(0, 128) : "ToolError";
2209
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
+ };
2210
2231
  var PARSE_FAILURE_PREFIX = "Failed to parse AgentScript code: ";
2211
2232
  var PARSE_POSITION_RE = /\((\d+):(\d+)\)$/;
2212
2233
  function parseFailureOf(message) {
@@ -2316,8 +2337,8 @@ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.l
2316
2337
  };
2317
2338
  const options = {
2318
2339
  timeout: this.vmOptions.timeoutMs,
2319
- maxToolCalls: this.vmOptions.maxSteps || 100,
2320
- maxIterations: 1e4,
2340
+ maxToolCalls: maxToolCallsOf(this.vmOptions),
2341
+ maxIterations: MAX_ITERATIONS_PER_LOOP,
2321
2342
  maxSanitizeDepth: this.vmOptions.maxSanitizeDepth,
2322
2343
  maxSanitizeProperties: this.vmOptions.maxSanitizeProperties,
2323
2344
  toolHandler,
@@ -2354,7 +2375,9 @@ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.l
2354
2375
  if (result.success) {
2355
2376
  return { success: true, result: result.value, logs, timedOut: false, stats };
2356
2377
  }
2357
- 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;
2358
2381
  if (error.code === "ENCLAVE_ERROR" && error.message?.startsWith(PARSE_FAILURE_PREFIX)) {
2359
2382
  const { message, location } = parseFailureOf(error.message);
2360
2383
  return {
@@ -2365,7 +2388,6 @@ ${policyIssues.map((issue) => `${issue.code}${issue.location ? ` (line ${issue.l
2365
2388
  stats
2366
2389
  };
2367
2390
  }
2368
- const toolFailure = [...toolFailures].reverse().find((failure) => failure.message === error.message && failure.name === error.name);
2369
2391
  if (toolFailure) {
2370
2392
  return {
2371
2393
  success: false,
@@ -2436,7 +2458,9 @@ var import_sdk5 = require("@frontmcp/sdk");
2436
2458
 
2437
2459
  // plugins/plugin-codecall/src/tools/search.schema.ts
2438
2460
  var import_lazy_zod2 = require("@frontmcp/lazy-zod");
2439
- 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.
2440
2464
 
2441
2465
  DECOMPOSE: "delete users and send email" \u2192 queries: ["delete user", "send email"]
2442
2466
  DECOMPOSE: "get order and refund" \u2192 queries: ["get order", "calculate refund"]
@@ -2448,18 +2472,20 @@ INPUT:
2448
2472
  - queries: string[] (required) - atomic action phrases, max 10
2449
2473
  - appIds?: string[] - filter by app
2450
2474
  - excludeToolNames?: string[] - skip known tools
2451
- - topK?: number (default: the server's topK, 8 unless configured) - results per query
2452
- - 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
2453
2477
 
2454
2478
  OUTPUT: Flat deduplicated tool list. relevanceScore: 0.5+=good, 0.7+=strong match.
2455
2479
 
2456
2480
  FLOW: search \u2192 describe \u2192 execute/invoke`;
2481
+ }
2482
+ var searchToolDescription = buildSearchToolDescription(codeCallPluginOptionsSchema.parse({}).topK);
2457
2483
  var searchToolInputSchema = {
2458
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."),
2459
2485
  appIds: import_lazy_zod2.z.array(import_lazy_zod2.z.string()).max(10).optional().describe("Filter by app IDs"),
2460
2486
  excludeToolNames: import_lazy_zod2.z.array(import_lazy_zod2.z.string()).max(50).optional().describe("Skip already-known tool names"),
2461
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)"),
2462
- minRelevanceScore: import_lazy_zod2.z.number().min(0).max(1).optional().default(0.1).describe("Minimum relevance threshold (default 0.1)")
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})`)
2463
2489
  };
2464
2490
  var searchToolOutputSchema = import_lazy_zod2.z.object({
2465
2491
  tools: import_lazy_zod2.z.array(
@@ -2484,7 +2510,7 @@ var searchToolOutputSchema = import_lazy_zod2.z.object({
2484
2510
  // plugins/plugin-codecall/src/tools/search.tool.ts
2485
2511
  var SearchTool = class extends import_sdk5.ToolContext {
2486
2512
  async execute(input) {
2487
- const { queries, appIds, excludeToolNames = [], topK, minRelevanceScore = 0.3 } = input;
2513
+ const { queries, appIds, excludeToolNames = [], topK, minRelevanceScore = DEFAULT_MIN_RELEVANCE_SCORE } = input;
2488
2514
  const searchService = this.get(ToolSearchService);
2489
2515
  const warnings = [];
2490
2516
  const audit = this.tryGet(AuditLoggerService);
@@ -3514,7 +3540,15 @@ var import_sdk9 = require("@frontmcp/sdk");
3514
3540
  // plugins/plugin-codecall/src/tools/execute.schema.ts
3515
3541
  var import_lazy_zod7 = require("@frontmcp/lazy-zod");
3516
3542
  var MIN_EXECUTE_SCRIPT_LENGTH = 'return callTool("a",{})'.length;
3517
- 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.
3518
3552
 
3519
3553
  API: await callTool(name, args, opts?)
3520
3554
  - Default: throws on error
@@ -3529,12 +3563,14 @@ for (const u of users.items) {
3529
3563
  }
3530
3564
  return results;
3531
3565
 
3532
- ALLOWED: for-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals
3533
- BLOCKED: while, do-while, for (unless the server sets vm.allowLoops), console (use mcpLog), 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(", ")}
3534
3568
 
3535
3569
  ERRORS: NOT_FOUND | VALIDATION | EXECUTION | TIMEOUT | ACCESS_DENIED
3536
3570
  STATUS: ok | syntax_error | illegal_access | runtime_error | tool_error | timeout
3537
- 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());
3538
3574
  var executeToolInputSchema = {
3539
3575
  script: import_lazy_zod7.z.string().min(MIN_EXECUTE_SCRIPT_LENGTH).max(100 * 1024).describe(
3540
3576
  "JavaScript code to execute in the sandbox. Must return a value (implicitly or via explicit return). Use callTool(name, input) to invoke tools."
@@ -4051,6 +4087,35 @@ var CodeCallPlugin = class extends import_sdk11.DynamicPlugin {
4051
4087
  }
4052
4088
  ];
4053
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
+ }
4054
4119
  async adjustListTools(flowCtx) {
4055
4120
  const logger = this.getLogger();
4056
4121
  const { resolvedTools } = flowCtx.state;
@@ -4154,8 +4219,7 @@ CodeCallPlugin = __decorateClass([
4154
4219
  name: "codecall",
4155
4220
  description: "CodeCall plugin: AgentScript-based meta-tools for orchestrating MCP tools",
4156
4221
  providers: [],
4157
- plugins: [import_plugin_cache.default],
4158
- tools: [SearchTool, SearchSkillsTool, SearchKnowledgeTool, DescribeTool, ExecuteTool, InvokeTool]
4222
+ plugins: [import_plugin_cache.default]
4159
4223
  })
4160
4224
  ], CodeCallPlugin);
4161
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.2",
3
+ "version": "1.9.4",
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.2",
54
- "@frontmcp/sdk": "1.9.2",
53
+ "@frontmcp/protocol": "1.9.4",
54
+ "@frontmcp/sdk": "1.9.4",
55
55
  "acorn": "^8.15.0",
56
56
  "vectoriadb": "^2.3.3"
57
57
  },
58
58
  "peerDependencies": {
59
- "@frontmcp/lazy-zod": "1.9.2",
60
- "@frontmcp/plugin-cache": "1.9.2"
59
+ "@frontmcp/lazy-zod": "1.9.4",
60
+ "@frontmcp/plugin-cache": "1.9.4"
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"}
@@ -1,11 +1,12 @@
1
1
  import { type ValidationIssue } from '@enclave-vm/ast';
2
2
  import type { ResolvedCodeCallVmOptions } from '../codecall.symbol';
3
- type ScriptPolicyOptions = Pick<ResolvedCodeCallVmOptions, 'allowLoops'>;
3
+ type ScriptPolicyOptions = Pick<ResolvedCodeCallVmOptions, 'allowLoops' | 'disabledBuiltins' | 'disabledGlobals'>;
4
4
  /**
5
- * The places a script uses a loop `vm.allowLoops: false` turns off, or `console`, which the sandbox
6
- * never gives a script, in the script's own lines. The sandbox takes no loop option, so CodeCall
7
- * checks before it runs the script, parsing it the way the sandbox does. A script none of those
8
- * parses accept is left to the sandbox, which fails on the same parse and reports the syntax error.
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.
9
10
  */
10
11
  export declare function findScriptPolicyIssues(code: string, options: ScriptPolicyOptions): Promise<ValidationIssue[]>;
11
12
  export {};
@@ -1 +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,CAAC,CAAC;AAgGzE;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAenH"}
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;AAKhE;;GAEG;AAC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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;IA0HhG;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAgGzB"}
@@ -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-of, arrow fn, map/filter/reduce/find, Math.*, JSON.*, if/else, destructuring, spread, template literals\nBLOCKED: while, do-while, for (unless the server sets vm.allowLoops), console (use mcpLog), 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,i/BAoBe,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;AAC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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,5 +1,9 @@
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: the server's topK, 8 unless configured) - 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>>;
@@ -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,w1BAiBO,CAAC;AAE1C,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
+ {"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"}