/** * Deterministic phase-cut derivation (remediator auto-phasing, T3). * * When `/remediate-code` is pointed at an arbitrary N-goal input (e.g. the whole * backlog), the independent conceptual-design critique used to reject the run as * "over-scoped" and the HOST had to manually re-scope to a phase at intake. That * is the tool's job, not the host's: given the module-dependency DAG (each module * declares the neighbours it `needs`), the tool derives a foundations→consumers * phase cut MECHANICALLY — ordered tiers where every module sits one tier below * the modules that depend on it. The critique is then handed the derived cut, so * it assesses design quality WITHIN a mechanically dependency-ordered phasing * rather than rejecting breadth (over-scoping is already handled by construction). * * Pure + deterministic (no I/O, no Date/Math.random, stable ordering): the same * modules always yield the same cut. Cycle-safe — a dependency cycle cannot be * topologically tiered, so its members are placed together at the tier just past * their highest acyclic dependency (named-sorted, fail toward a LATER tier so a * cyclic module never front-runs a real foundation it transitively needs). */ /** One module + the names of the other modules it depends on (its foundations). */ export interface PhaseCutModule { name: string; /** Names of modules this module needs in place first (directional: this → dep). */ depends_on: string[]; } /** One derived phase: an ordered tier of modules that may be authored together. */ export interface PhaseCutPhase { /** 0-based tier ordinal; 0 = foundations. */ ordinal: number; /** Stable human label for the tier. */ name: string; /** Module names in this tier, sorted for determinism. */ modules: string[]; } /** The derived phase cut: ordered tiers covering every module exactly once. */ export interface PhaseCut { phases: PhaseCutPhase[]; /** True when a dependency cycle was detected (its members were tiered together). */ has_cycle: boolean; /** Module name → 0-based phase ordinal (foundations = 0). The downstream key. */ module_phase: Record; } /** * Derive the ordered phase cut from a module-dependency DAG. Each module's tier is * the length of its longest dependency chain (foundations = 0). Edges to unknown * module names are ignored (a `needs` on a module not in scope is not a phase * constraint here). Returns one phase per occupied tier, covering every module. */ export declare function derivePhaseCut(modules: PhaseCutModule[]): PhaseCut; /** * The id fragment obligation ids encode — re-exported from the id registry, * which owns both this and the mint that produces `OBL--…`, so encoder and * decoder cannot drift. Kept exported here because this module is where the * node→phase decoders live and import it from. */ export { moduleSlug } from "./idRegistry.js"; /** * Resolve the phase ordinal for an implementation-DAG node from the obligation * ids it discharges. Every derived obligation id is `OBL--…`, so the * owning module (hence phase) is recoverable by longest-slug prefix match — no * lossy slug reversal. A node spanning modules in several phases takes the MAX * ordinal (fail-toward-later: it cannot land before the latest module it touches * is reachable). A node whose obligations match no in-scope module slug — a * counterexample-only node, or an obligation from a module dropped from the cut — * defaults to the LAST phase (integration), never front-running a foundation. * * `slugToOrdinal` is the module-phase map re-keyed by `moduleSlug(name)`. */ export declare function phaseOrdinalForObligations(obligationIds: readonly string[], slugToOrdinal: Map, lastOrdinal: number): number; /** * Build {@link PhaseCutModule}s from drafted/finalized module contracts. A module's * `depends_on` is the UNION of two tool-derived signals: (1) any directional * `neighbor_needs` (`{ neighbor, needs }` — this module needs `neighbor`, present * on DRAFT contracts) and (2) producer/consumer artifact-token matching over * `inputs`/`outputs` (present on FINALIZED contracts, which drop `neighbor_needs`). * A module that needs/consumes from another is one tier ABOVE it. Tolerant of * malformed payloads: anything unparseable contributes no module/edge. */ export declare function phaseCutModulesFromContracts(contractsPayload: unknown): PhaseCutModule[]; /** * Add Path-A seam-preparation edges to the contract-derived module DAG. The * decomposition gate has already guaranteed one preparer per required seam; * this projection makes every implementation module for either participating * work block depend on that preparer, yielding a seam-first phase followed by * parallel refactor modules. */ export declare function applyWorkBlockSeamDependencies(modules: PhaseCutModule[], moduleDecompositionPayload: unknown, pathASeedPayload: unknown): PhaseCutModule[]; /** Render the derived phase cut as a markdown section for the critique prompt. */ export declare function renderPhaseCutSection(cut: PhaseCut): string; //# sourceMappingURL=phaseCut.d.ts.map