/** * Per-execution controller that drives tool-call simulation for a single * {@link CopilotSdkExecutor} run. * * It owns the SDK-coupled side of simulation — building the `onPreToolUse` hook * and signalling when the model-iteration cap is exceeded. The matching rules * themselves live in the pure `./simulation.js` module and are re-run by the * executor to tag each `tool_call` deterministically, so no cross-event * correlation state is needed here. * * One instance per `execute()` call: all mutable state (turn counter, cap * signal) is instance-scoped so concurrent executions on a shared executor never * cross-talk. */ import type { SessionConfig } from "@github/copilot-sdk"; import type { SimulationConfig } from "../eval/types.js"; type PreToolUseHandler = NonNullable["onPreToolUse"]>; type PreToolUseInput = Parameters[0]; type PreToolUseOutput = Exclude>, void>; export declare class SimulationController { /** Model-iteration cap (assistant turns), or undefined when unbounded. */ readonly maxIterations?: number; /** * Resolves once the number of assistant turns first exceeds {@link maxIterations}. * Created at construction so it can be raced by the executor without any * ordering dependency on when events start arriving. Never resolves when the * cap is unset. */ readonly capExceeded: Promise; private readonly overrides; private turnStartCount; private resolveCap?; constructor(config: SimulationConfig); /** * Record a model turn boundary. Resolves {@link capExceeded} the first time the * number of assistant turns exceeds {@link maxIterations} (`resolve` is * idempotent, so later turns are harmless no-ops). */ registerTurnStart(): void; /** * Whether a tool call with the given (raw or parsed) arguments would be * simulated. Pure and deterministic — the executor calls this on each * `tool_call` event's own arguments to tag it, mirroring the decision the hook * made for the same call, without any cross-event bookkeeping. */ isSimulated(toolName: string, toolArgs: unknown): boolean; /** * SDK `onPreToolUse` hook. Returns simulation output when an override matches, * or `undefined` to run the real tool. * * Shell-like tools are rewritten so their execution emits the canned result; * all other first-party tools are denied with the canned text (failure * simulation only — see {@link SimulationConfig.tool_overrides}). */ readonly onPreToolUse: (input: PreToolUseInput) => PreToolUseOutput | void; } export {}; //# sourceMappingURL=simulation-controller.d.ts.map