refactor: rebuild birth time rectification agent

This commit is contained in:
Jesse_Chen
2026-07-28 13:04:30 +08:00
parent ac5aef5f89
commit 8ade6ed5c8
59 changed files with 4422 additions and 1141 deletions
@@ -0,0 +1,13 @@
import type { CandidateSnapshot } from "../rectification-v4/contracts.ts";
import type { DiagnosticsSummary, QuestionOpportunity, RectificationDecision } from "./contracts.ts";
export function deterministicDecision(input: Readonly<{
snapshot: CandidateSnapshot | null;
diagnostics: DiagnosticsSummary | null;
opportunities: readonly QuestionOpportunity[];
}>): RectificationDecision {
if (input.snapshot?.canAcceptRange) return { action: "offer_candidate_range", snapshotId: input.snapshot.id };
const top = input.opportunities.find((item) => item.active);
if (top) return { action: "ask_question", opportunityId: top.opportunityId, narrativeFocus: ["latest_event", ...(top.kind === "refine_event_date" ? ["date_precision" as const] : [])] };
return { action: "stop_low_confidence", reasonCodes: input.diagnostics ? ["no_high_value_question", "diagnostics_not_stable"] : ["insufficient_scoreable_evidence"] };
}