import type { DepthLevel } from '../../types/enums.js'; import type { PipelineState } from '../../types/state.js'; import type { AssemblyMode, ExistingArtifact } from '../../types/assembly.js'; import type { ScaffoldWarning } from '../../types/errors.js'; import type { DetectSpec } from '../../types/frontmatter.js'; export interface UpdateModeResult { isUpdateMode: boolean; existingArtifact?: ExistingArtifact; previousDepth?: DepthLevel; currentDepth: DepthLevel; depthIncreased?: boolean; warnings: ScaffoldWarning[]; } /** * Detect whether a step is being re-run (update mode). * Update mode is active when: * 1. The step status is 'completed', AND * 2. At least one artifact produced by the step exists on disk. */ export declare function detectUpdateMode(options: { step: string; state: PipelineState; currentDepth: DepthLevel; projectRoot: string; service?: string; }): UpdateModeResult; export interface AssemblyModeResult { mode: AssemblyMode; /** Raw update-mode detection result (pre-verification gate). */ updateDetection: UpdateModeResult; existingArtifact?: ExistingArtifact; previousDepth?: DepthLevel; currentDepth: DepthLevel; depthIncreased?: boolean; warnings: ScaffoldWarning[]; } /** * Resolve the assembly mode for a step per the D3 matrix (brownfield R3): * - prior completion surviving as verification verified|declared → 'update' * - no surviving completion + init-mode brownfield|v1-migration → 'adoption' * - else → 'fresh' * A D10a artifact_map incumbent stands in as the prior artifact when the * step's own outputs are absent (fallback only — own outputs win). * * R1 carry-forward (live-conflict gate): a stored completion must survive a * LIVE check (verifyStep) before it can drive update mode or count as a * surviving completion — a completed step whose declared outputs are gone or * whose detect: contract now fails is conflicted, and its stale claim must * not enter update mode. It instead routes like a reopened step: adoption in * brownfield/v1-migration, else fresh. * * `stateless` (R3 whole-branch fix): a `category: tool` / `stateless: true` * step has no completion state to adopt — update mode is already impossible * for it (no stored entry), and it must never resolve to 'adoption' either. * Tools carry no `## Adoption Mode Specifics` block, and the adoption * preamble's "never propose rewrites of working code" framing is wrong for a * tool like review-code/review-pr/release. When `stateless === true`, the * adoption-routing branch is skipped entirely and the step resolves to * 'fresh' — greenfield-identical, regardless of init-mode. */ export declare function resolveAssemblyMode(options: { step: string; state: PipelineState; currentDepth: DepthLevel; projectRoot: string; service?: string; artifactMap?: Record; expectedOutputs?: string[]; detect?: DetectSpec | null; /** True for `category: tool` / `stateless: true` steps — never routes to 'adoption'. */ stateless?: boolean; }): AssemblyModeResult; //# sourceMappingURL=update-mode.d.ts.map