import { CatalogTransform } from '../catalog.transform.js'; import { NextToolHandler, TransformRegistry } from '../transform.interface.js'; import { Tool } from '../../tool.js'; import { ExecutionContext } from '../../types.js'; import { WorkerPool } from './worker-pool.js'; import { CodeModeTransformOptions, SandboxExecutionResult } from './types.js'; /** * CodeModeTransform transforms the MCP server tool catalog by substituting raw tools * with 3 synthetic meta-tools (search, get_schema, execute). * * This reduces context token usage by up to 98% and enables client LLMs to write and execute * multi-step orchestration scripts locally inside an isolated WebAssembly sandbox. */ export declare class CodeModeTransform extends CatalogTransform { readonly name = "code-mode"; private readonly options; private rawTools; private readonly bm25Engine; private workerPool; private cachedTransformedList; private lastCatalogHash; private registry; private syntheticTools; private readonly rebuilds; private disposed; constructor(options?: CodeModeTransformOptions); onRegister(registry: TransformRegistry): void; /** * Resolves a tool for sandbox dispatch and for the search/get_schema meta-tools. * * Goes through the server's resolution chain so downstream authorization transforms * still apply. When no server is attached (standalone use), there is no chain to * consult and the locally indexed catalog is the complete picture. */ private isMetaTool; private readonly resolveForSandbox; /** * Returns the subset of `names` the caller is allowed to see, preserving order. * Tools denied by an authorization transform are dropped rather than surfaced. */ private filterAuthorized; /** * Transforms raw catalog tools into Code Mode meta-tools plus any alwaysVisible tools. */ protected applyTransform(tools: Tool[], context?: ExecutionContext): Promise; private rebuildCatalog; /** * Resolves this transform's own meta-tools (search, get_schema, execute). * * There is deliberately no fallback to `rawTools`: re-resolving a tool the chain * declined would let a caller reach tools a downstream authorization transform * filtered out. Sandbox dispatch uses {@link resolveForSandbox}, which walks this * same chain. */ resolveTool(name: string, next: NextToolHandler, context?: ExecutionContext): Promise; /** * Directly executes a JavaScript code snippet inside the worker pool sandbox. * Throws an error if execution fails. */ execute(code: string, context?: ExecutionContext): Promise; private ensurePool; /** * Disposes the underlying worker pool. */ dispose(): Promise; /** * Diagnostic access to the worker pool. */ getWorkerPool(): WorkerPool | null; /** * Diagnostic access to indexed raw tools. */ getRawTools(): Map; } //# sourceMappingURL=code-mode.transform.d.ts.map