/** * Pure, SDK-independent resolution logic for tool-call simulation. * * The executor owns the side-effecting wiring (registering an `onPreToolUse` * hook, tagging trajectory events); this module only decides — given a tool * name, its arguments, and a stimulus's overrides — what canned result to * produce, and renders the shell command that yields it. Keeping it pure makes * the matching rules (aliasing, first-match patterns, normalization, escaping) * unit-testable without a live agent. */ import type { BashPatternOverride, ToolOverride } from "../eval/types.js"; /** A single override entry as authored in the eval YAML. */ export type ToolOverrideSpec = string | ToolOverride | BashPatternOverride; /** * The resolved outcome for one tool invocation. `null` means "no override * matched — run the real tool". */ export interface SimulatedResult { /** Canned output text. */ output: string; /** Whether the output should be delivered as an error. */ isError: boolean; /** Whether the tool is shell-like (can produce a successful rewritten result). */ shell: boolean; } /** Whether a tool name is a shell-like tool eligible for command rewriting. */ export declare function isShellTool(toolName: string): boolean; /** * Coerce a tool's `toolArgs` — which the Copilot SDK delivers as a JSON string * in the `onPreToolUse` hook — into a plain object. Returns an empty object when * the value is absent or unparseable, so callers never have to guard the shape. */ export declare function parseToolArgs(toolArgs: unknown): Record; /** * Decide the simulated result for a single tool invocation, or `null` to run * the real tool. Pure: no I/O, no SDK types. `args` must be the parsed argument * object (see {@link parseToolArgs}). */ export declare function resolveToolOverride(toolName: string, args: Record, overrides: Record): SimulatedResult | null; /** * Whether an override *can* produce a successful result for some input. Used by * the validator to reject non-shell success overrides (only shell tools can * inject a successful result without executing side effects). */ export declare function overrideCanSucceed(value: ToolOverrideSpec): boolean; /** * Render a shell command that emits `output` (to stdout, or stderr when * `isError`) and exits with the corresponding code, without running anything * else. Used as `modifiedArgs.command` so the real shell produces the canned * result deterministically. */ export declare function renderShellSimulation(toolName: string, result: SimulatedResult): string; //# sourceMappingURL=simulation.d.ts.map