import type { EvolutionProposal, IndependentEvaluatorResult } from './evolution-types.js'; /** * * The independent scorer is a SEPARATE sub-agent (process / model / * context). Its ONLY input is the evaluation package (target, * before/after snapshots, diff, rubric, red_lines, source_traces). * The author reasoning, the LLM session, and the proposal's * self-praise framing are explicitly EXCLUDED. * * The runner is exposed as a pure function so a unit test (or a * non-LLM harness) can stub the LLM call by passing an * `invokeLlm` factory. Production wiring lives in M5; M4 ships * the contract + the deterministic LLM stub used by tests. * * - Input: EvolutionProposal (the public package only). * - Output: IndependentEvaluatorResult { score, riskTags, refuteParagraph }. * - The runner MUST NOT receive the author's session id, the * author's reasoning, or any `recommendation` / `推荐` framing. * * M4 ships a deterministic default scorer that does NOT call an * LLM. It computes `score` from the proposal's `after_score` * field (a placeholder for the LLM-derived score), derives * `riskTags` from the diff keys, and produces a stub * `refuteParagraph` that names the independent-context rule. The * LLM-backed implementation lands in M5; the M4 unit tests * exercise the contract. */ /** * The minimal evaluation package the scorer sees. Mirrors the spec * §6.2 prose: * * { target_kind, target_release_id, * optimization_dimension, * before_snapshot, after_snapshot, diff, * rubric, red_lines, source_traces, * // EXCLUDED: author self-praise, "推荐A" framing, full author reasoning * } */ export interface EvaluationPackage { readonly target_kind: EvolutionProposal['target_kind']; readonly target_release_id: EvolutionProposal['target_release_id']; readonly optimization_dimension: string; readonly before_snapshot: Readonly>; readonly after_snapshot: Readonly>; readonly diff: Readonly>; readonly rubric: Readonly>; readonly red_lines: ReadonlyArray; readonly source_traces: ReadonlyArray; } /** * Public function: build the evaluation package from a proposal. * This is the ONLY data the scorer is allowed to see. The author * session id, author reasoning, and recommendation framing are * explicitly NOT included. */ export declare function buildEvaluationPackage(proposal: EvolutionProposal): EvaluationPackage; /** * Optional LLM call factory. The default implementation * (`deterministicInvokeLlm`) ignores the LLM and produces a stable * result from the evaluation package; tests can swap in a stub. */ export type LlmInvoke = (pkg: EvaluationPackage, prompt: string) => Promise<{ score: number; riskTags: string[]; refuteParagraph: string; }>; /** * The prompt handed to the LLM scorer. By construction this * contains NO author session id, NO author reasoning, and NO * `推荐` / `recommendation` framing. The scorer is told the */ export declare function buildEvaluatorPrompt(pkg: EvaluationPackage): string; /** * Default LLM call: deterministic, no LLM dependency. Produces a * stable score from the diff keys + the declared * optimization_dimension. M5 will swap this for the real LLM * client. */ export declare const deterministicInvokeLlm: LlmInvoke; /** * Public entry point: run the independent evaluator against an * evaluation package. The caller (EvolutionService.score) supplies * the proposal; this function NEVER sees the author's session or * reasoning. The return value is shape-compatible with * `IndependentEvaluatorResult`. */ export declare function runIndependentEvaluator(proposal: EvolutionProposal, invokeLlm?: LlmInvoke): Promise;