import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent"; import type { MergedConfig } from "../../config/config-layer.js"; import { type SubagentResult } from "../../forge-subagent.js"; import { attachViewportObserver } from "../../viewport/events.js"; import { type PhaseDescriptor } from "./task-phases.js"; import { type TaskRecord } from "./task-record.js"; import type { RunTaskPipelineOptions, RunTaskPipelineResult } from "./run-task-types.js"; export interface PhaseDispatchParams { opts: RunTaskPipelineOptions; phase: PhaseDescriptor; taskId: string; cwd: string; ctx: ExtensionCommandContext; storeCli: string; currentPhaseIndex: number; iterationCounts: Record; dispatchCounts: Record; modelRoutingConfig: MergedConfig; registry: RunTaskPipelineOptions["registry"]; cacheSessionId: string; taskRecordAtStart: TaskRecord | null; /** Raw sub-workflow markdown already loaded + marker-checked by the caller. */ subWorkflowMd: string; } export type PhaseDispatchOutcome = { kind: "return"; result: RunTaskPipelineResult; } | { kind: "ok"; result: SubagentResult; finishPhaseNode: (status: "completed" | "failed" | "escalated") => void; observer: ReturnType; phaseStart: number; writeDebug: (rec: Record) => void; }; /** * Run a single phase's subagent dispatch and classify the immediate outcome * (persona-load failure, subagent throw, cancellation, or non-zero exit) into * a discriminated result. On success returns `kind: "ok"` with the live locals * the caller's loop needs for verdict/postflight handling and advance. */ export declare function dispatchPhase(p: PhaseDispatchParams): Promise;