/** * Evaluation Harness, external task-suite adapter (Terminal-Bench-style). * * A Terminal-Bench task suite is a DIRECTORY of tasks, each its own * subdirectory holding a task definition and a verification script: * * / * / * task.json { id, instruction, verify, timeoutMs? } * verify.sh exits 0 = pass, non-zero = fail * ... any fixtures the task needs * * This adapter runs each task through a REAL session, supplied by the caller as * an injectable `TaskSessionExecutor` (the seam a consumer fills with an actual * model-driven session operating in the task's working directory), and then * runs the task's verification script to decide pass/fail. It reports a * per-task result and an aggregate. * * SCOPE (honest). This is the adapter CONTRACT plus a default script verifier, * not a benchmark import: it does not bundle Terminal-Bench's task corpus, a * container runtime, or a specific model harness. The session executor and (if * desired) the verifier are injected, so the same contract drives the bundled * example suite in tests and a real suite + real session in a consumer. */ /** One task's on-disk definition (task.json). */ export interface TaskDefinition { /** Stable task id (used as the result key). Defaults to the task directory name when omitted. */ readonly id: string; /** The instruction handed to the session. */ readonly instruction: string; /** Path (relative to the task directory) to the verification script. Defaults to `verify.sh`. */ readonly verify: string; /** Optional per-task wall-clock cap for the session executor, in ms. */ readonly timeoutMs?: number; } /** What the session executor is given for one task. */ export interface TaskExecutionContext { readonly taskId: string; /** Absolute path to the task directory (definition + fixtures + verify script). */ readonly taskDir: string; /** The instruction from the task definition. */ readonly instruction: string; readonly timeoutMs?: number | undefined; } /** The outcome the session executor reports (whether the session ran to completion). */ export interface TaskSessionOutcome { readonly completed: boolean; readonly summary?: string; } /** The injectable "real session" seam: run one task's instruction in its directory. */ export type TaskSessionExecutor = (ctx: TaskExecutionContext) => Promise; /** What the verifier is given. */ export interface TaskVerifyContext { readonly taskId: string; readonly taskDir: string; /** Absolute path to the verification script. */ readonly verifyScript: string; readonly timeoutMs?: number | undefined; } /** The verifier's verdict. */ export interface TaskVerifyResult { readonly passed: boolean; readonly output: string; } /** Runs a task's verification script and decides pass/fail. Injectable; defaults to a shell runner. */ export type TaskVerifier = (ctx: TaskVerifyContext) => Promise; /** One task's result. */ export interface TaskResult { readonly taskId: string; readonly passed: boolean; readonly sessionCompleted: boolean; readonly verifierPassed: boolean; readonly verifierOutput: string; readonly reason: string; readonly durationMs: number; } /** The aggregate for a whole suite directory. */ export interface TaskSuiteResult { readonly suiteDir: string; readonly results: readonly TaskResult[]; readonly passed: boolean; readonly total: number; readonly passedCount: number; } export interface RunTaskSuiteOptions { /** The real-session seam. Required, there is no faked default session. */ readonly executor: TaskSessionExecutor; /** Verification runner. Defaults to {@link defaultShellVerifier} (runs the script, exit 0 = pass). */ readonly verifier?: TaskVerifier; } /** Load and validate a task.json from a task directory. Throws a named error on a malformed definition. */ export declare function loadTaskDefinition(taskDir: string): TaskDefinition; /** A discovered task: its parsed definition and the absolute directory it lives in. */ export interface DiscoveredTask { readonly definition: TaskDefinition; readonly taskDir: string; } /** Discover the task subdirectories (each containing a task.json) of a suite directory, sorted by id. */ export declare function discoverTasks(suiteDir: string): DiscoveredTask[]; /** Default verifier: run the verification script through `bash` and treat exit 0 as pass. */ export declare const defaultShellVerifier: TaskVerifier; /** * Run every task in `suiteDir` through the injected session executor, then its * verification script, and report pass/fail per task. A task passes only when * the session completed AND its verifier passed. */ export declare function runTaskSuite(suiteDir: string, options: RunTaskSuiteOptions): Promise; /** Format a task-suite result as a per-task, one-line-each report. */ export declare function formatTaskSuiteResult(result: TaskSuiteResult): string; //# sourceMappingURL=task-suite.d.ts.map