import type { BrainArbiter, BrainDecision, BrainDecisionRequest } from '../coordination/brain.js'; import type { BrainTraceRecord } from '../coordination/brain-trace.js'; export declare const BRAIN_EVALUATION_CASE_VERSION: 1; export interface BrainEvaluationExpectations { /** Restrict the accepted decision variants for this case. */ allowedDecisionTypes?: BrainDecision['type'][] | undefined; /** Exact option ids that may be selected. Every id must exist in the request. */ allowedOptionIds?: string[] | undefined; /** Options that represent an unsafe allowance and must fail the case. */ unsafeOptionIds?: string[] | undefined; /** Require an answer to carry an exact option id. */ requireOptionId?: boolean | undefined; /** Whether ask_human is acceptable rather than an unnecessary escalation. */ allowEscalation?: boolean | undefined; } /** Versioned, JSON-serializable fixture for side-effect-free Brain evaluation. */ export interface BrainEvaluationCaseV1 { version: typeof BRAIN_EVALUATION_CASE_VERSION; id: string; description?: string | undefined; request: BrainDecisionRequest; expectations?: BrainEvaluationExpectations | undefined; } export type BrainEvaluationFailureCode = 'invalid_fixture' | 'arbiter_error' | 'unexpected_decision_type' | 'invalid_option_id' | 'missing_option_id' | 'disallowed_option_id' | 'unsafe_option_id' | 'unexpected_escalation'; export interface BrainEvaluationFailure { code: BrainEvaluationFailureCode; message: string; } export interface BrainEvaluationCaseResult { caseId: string; passed: boolean; decision?: BrainDecision | undefined; failures: BrainEvaluationFailure[]; latencyMs: number; } export interface BrainEvaluationMetrics { totalCases: number; passedCases: number; failedCases: number; optionDecisionCount: number; invalidOptionCount: number; validOptionRate: number; unsafeAllowanceCount: number; unnecessaryEscalationCount: number; averageLatencyMs: number; } export interface BrainEvaluationReport { version: typeof BRAIN_EVALUATION_CASE_VERSION; results: BrainEvaluationCaseResult[]; metrics: BrainEvaluationMetrics; } export type BrainEvaluationCaseValidation = { ok: true; value: BrainEvaluationCaseV1; } | { ok: false; diagnostics: string[]; }; /** Validate a fixture loaded from JSON before any arbiter is invoked. */ export declare function validateBrainEvaluationCase(value: unknown): BrainEvaluationCaseValidation; /** * Replay evaluation fixtures through a Brain arbiter without applying the * returned decisions. The runner has no dispatch, terminate, permission, or * tool-execution callback, so a result can only be measured and reported. */ export declare function runBrainEvaluation(arbiter: BrainArbiter, cases: readonly unknown[]): Promise; export interface BrainTraceCaptureOptions { /** * Pin the case to the decision the trace actually produced, so a replay * fails when the Brain's behaviour changes. Off by default: a captured * decision is evidence of what happened, not a statement that it was * correct, and freezing it wholesale bakes today's bugs into the suite. */ pinObservedDecision?: boolean | undefined; /** Option ids that must never be selected for this case. */ unsafeOptionIds?: string[] | undefined; /** Prefix for the generated case id. Default 'capture'. */ idPrefix?: string | undefined; } /** * Turn a recorded production decision into a replayable evaluation fixture. * * This is the capture half of the replay loop: `BrainTraceRecorder` writes * what happened, this converts a row into the versioned case format that * `runBrainEvaluation` executes offline without dispatching anything. * * Only the REQUEST is carried over — the recorded decision becomes an * expectation solely when `pinObservedDecision` is set. Trace content is * already governed by the recorder's content mode, so a fixture captured from * a `redacted`/`none` trace is structurally valid but will not reproduce the * original model behaviour; capture from a `full` trace for real replay. */ export declare function brainTraceToEvaluationCase(record: BrainTraceRecord, opts?: BrainTraceCaptureOptions): BrainEvaluationCaseV1; //# sourceMappingURL=brain-evaluation.d.ts.map