import type { ExtensionContext, ToolCallEvent, ToolCallEventResult } from "@earendil-works/pi-coding-agent"; import { type EvaluatorHost } from "./evaluator-internals/context.ts"; import type { ResolvedPluginState } from "./plugin-merger.ts"; import type { SteeringConfig } from "./schema.ts"; /** * Names of trackers the evaluator wires in directly (not via a plugin). * `resolvePlugins` accepts this list as `knownBuiltinTrackers`: plugin * `trackerExtensions` targeting these names are kept (so plugins can * compose modifiers onto them) without emitting an `extension-orphan` * diagnostic. * * All call sites (`buildSessionRuntime`, `loadHarness`, * `loadSteeringConfig`, the `pi-steering list` CLI) import this * constant so a future addition (e.g. an `argv` tracker) lights up * uniformly across production and the test harness. */ export declare const EVALUATOR_BUILTIN_TRACKERS: readonly ["cwd", "env"]; /** * Runtime-facing evaluator handle. Phase 3c holds an instance per * session and calls {@link evaluate} from the pi `tool_call` * listener. */ export interface EvaluatorRuntime { /** * Evaluate a single `tool_call` event against every rule in * `config.rules` + `resolved.rules`. Returns: * - `{ block: true, reason }` — a rule matched + wasn't overridden. * - `undefined` — no rule fires; tool call proceeds. */ evaluate(event: ToolCallEvent, ctx: ExtensionContext, agentLoopIndex: number): Promise; } /** * Construct an {@link EvaluatorRuntime}. * * Arguments: * - `config` — the user-facing {@link SteeringConfig}. Top-level * rules and `defaultNoOverride` live here. * - `resolved` — merged plugin state from * {@link resolvePlugins}. Source of plugin rules, * predicate handlers, and the composed tracker * registry for the walker. * - `host` — narrow surface exposing pi's `exec` + `appendEntry` * (typically `pi` itself in production; tests pass * a stub). Kept separate from `ExtensionContext` * because the ctx shape does not expose these. * * Observers (`config.observers + resolved.observers`, user-first * deduplicated via {@link mergeObserversUserFirst}) are threaded into * {@link prepareBashState} where the walker-level synthesis pass * turns them into per-ref speculative events on * `walkerState.events`. The built-in `when.happened` predicate merges * those with real entries via timestamp ordering. If future versions * add a dynamic-reload path (observers added at runtime), this merged * list must be rebuilt on change — otherwise `when.happened` with * `in: "tool_call"` scope consults a stale observer list. Today * there is no dynamic-reload path. */ export declare function buildEvaluator(config: SteeringConfig, resolved: ResolvedPluginState, host: EvaluatorHost): EvaluatorRuntime; export type { EvaluatorHost } from "./evaluator-internals/context.ts"; //# sourceMappingURL=evaluator.d.ts.map