import { type ToolDef } from "./types.js"; import type { EditorSession, SessionRegistry } from "./session.js"; export interface UntargetedCall { /** `category.action`, already resolved through any gateway indirection. */ taskName: string; /** Every registered editor, in registration order. */ editors: string[]; /** The editor an untargeted call would land in. */ activeEditor: string; /** The parameter name a caller uses to address an editor. */ targetParam: string; } /** * Why this untargeted call cannot be routed, or null when it can. * * Never called at one editor: a single-session server has nothing to choose * between, so there is nothing to refuse. */ export declare function refuseUntargetedCall(call: UntargetedCall): string | null; export interface RoutedCall { /** The editor this call runs in. */ session: EditorSession; /** Params with every routing instruction removed, at both nesting levels. */ params: Record; /** True when the caller named the editor rather than taking the default. */ targeted: boolean; } /** * Route one call to the editor it addressed. * * `editor` is a routing instruction only on a tool that had the parameter * injected; on any other tool it is that tool's own parameter and is left * alone. It is stripped here, at both nesting levels, so no dispatch path can * forward it into a bridge call. */ export declare function routeEditorCall(tool: ToolDef, params: Record, sessions: SessionRegistry): RoutedCall; /** * The `category.action` a call actually runs, seen past any gateway. * * In micro mode every call arrives as `tools(call, category, method)`, so * classifying the tool the client named would classify the gateway instead of * the thing being invoked, and let every mutation through as one read. */ export declare function effectiveTaskName(tool: ToolDef, params: Record): string; /** * The gate, against a live session registry. * * Returns null at one editor without classifying anything, which is what keeps * a single-editor server on exactly the path it was on before. */ export declare function refuseUntargetedInRegistry(sessions: SessionRegistry, taskName: string, targeted: boolean): string | null; /** The machine-readable block naming the editor that served a response. */ export declare const EDITOR_ATTRIBUTION_PREFIX = "MACHINE_EDITOR="; /** * Name the editor a response came from. * * Returns null at one editor, which is what keeps a single-editor response * byte-identical. The prose of the result is never touched: this is an extra * content block, the same way MACHINE_ERROR and MACHINE_DIRECTIVE are, so a * client that only reads the first block sees exactly what it saw before. */ export declare function editorAttribution(editor: { name: string; projectPath: string | null; }, editorCount: number): string | null;