import { z } from "zod"; import { isDiagnosticPlainRecord, replayReviewPlanRun, REVIEW_PLAN_REPLAY_LIMITS, type ReviewPlanRun, type ReviewPlanReplay } from "@actuarial-ts/core"; import { parseReviewBoundary } from "./reviewBoundary.js"; // The pure replay checks every closed run/node field, compilation, reference, dependency and output. // Retain the original run here: a structural JSON import must not strip evidence before comparison. export const reviewPlanReplayRequestSchema = z.object({ run: z.custom(isDiagnosticPlainRecord, "Expected a saved review-run object"), limits: z.object({ maximumInputCharacters: z.number().int().positive().max(REVIEW_PLAN_REPLAY_LIMITS.maximumInputCharacters) }).strict(), }).strict(); /** Safe import followed by complete current-SDK execution. Parsing alone never issues a verified receipt. */ export function replayReviewPlanRunFromInput(input: unknown): ReviewPlanReplay { return replayReviewPlanRun(parseReviewBoundary(reviewPlanReplayRequestSchema, input)); }