import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent"; import type { MergedConfig } from "../../config/config-layer.js"; import type { OrchestratorTranscriptWriter } from "../../subagent/orchestrator-transcript.js"; import type { RunTaskPipelineResult } from "./run-task-types.js"; import { type PhaseDescriptor } from "./task-phases.js"; export type VerdictLoopOutcome = { kind: "advance"; } | { kind: "loopback"; toIndex: number; } | { kind: "return"; result: RunTaskPipelineResult; }; export interface VerdictLoopParams { phase: PhaseDescriptor; taskId: string; storeCli: string; cwd: string; forgeRoot: string; iterationCounts: Record; currentPhaseIndex: number; modelRoutingConfig: MergedConfig; ctx: ExtensionCommandContext; orchTranscript: OrchestratorTranscriptWriter; /** Closure that finalizes this dispatch's OrchestratorTree node. */ finishPhaseNode: (status: "completed" | "failed" | "escalated") => void; /** Per-phase completion-recovery guard (forge-engineering#41) — roles that * already consumed their one set-summary recovery attempt this run. */ recoveredPhases: Set; /** Wall-clock ms at which the current phase dispatch started (from the * pipeline's `phaseStart`). When supplied, the verdict loop's stale-summary * divergence guard (WI-S48-T01) refuses to trust a stored verdict whose * `written_at` predates this moment — the subagent did not refresh the * store this round. Omit for legacy callers (guard disabled). */ phaseStartMs?: number; } /** * Evaluate the review-phase verdict and decide the loop's next move. * Mirrors the inline block that previously lived in runTaskPipelineInner. */ export declare function handleReviewVerdict(p: VerdictLoopParams): Promise;