import type { AgencyConfig } from "../config.js"; import { type EvalRunState } from "./runArtifacts.js"; import type { Input, EvalRunInputResult } from "./runTypes.js"; /** * How to actually invoke the compiled agent for an input. The CLI plugs in a * subprocess fork; alternative callers (tests, in-process variants) can * plug in their own runner. Must never throw — failures are returned as * `{ ok: false, errorMessage }`. * * On success the runner may report the path where it actually wrote the * statelog. When omitted, the framework uses the `statelogPath` it provided * to the runner. */ export type EvalInputRunner = (args: { compiledEntryPath: string; node: string; args: Record; cwd: string; statelogPath: string; }) => Promise<{ ok: true; statelogPath?: string; } | { ok: false; errorMessage: string; }>; /** * How to turn a written statelog into an eval-record.json. Must never throw * — failures should be raised by the caller, not encoded as input errors, * because they indicate a bug in the extractor rather than an input failure. * Errors are still caught here so they get routed into the input result. */ export type EvalRecordExtractor = (args: { statelogPath: string; outPath: string; input: Input; }) => Promise; /** * Single source of truth for "run one eval input end-to-end." * * Both the CLI (`agency eval run`) and the stdlib (`std::agency/eval.evalRun`) * route through this function so the prepare → invoke → extract → record * pipeline lives in exactly one place. Callers only supply the *how* of * invoking the agent; the *what* (artifact layout, error routing, summary * shape) is fixed here. * * Never throws — every failure path is reified as an `EvalRunInputResult`. */ export declare function runEvalInput(args: { state: EvalRunState; input: Input; /** The workdir spec for this input: seed dir + agent path within it. */ seed: { dir: string; agentRelPath: string; }; /** Optional candidate-file overlay applied on top of the seed before compile. */ overlayFiles?: Record; config: AgencyConfig; defaultNode: string; runner: EvalInputRunner; extractor: EvalRecordExtractor; }): Promise;