export interface FinishTaskOptions {
specId: string;
/**
* Directory containing the spec file. The spec is expected at `
/.md`.
* The shipped spec lands at `/done/.md`.
*/
dir: string;
/** Context store directory containing prior factory-run records. */
contextDir: string;
}
/**
* v0.0.13 — batch ship every converged spec from a factory-sequence in one
* call. Mutually exclusive with the per-spec form: pass `allConverged: true`
* to opt in. `since` pins to a specific factory-sequence id; omit to walk
* the most recent factory-sequence.
*/
export interface FinishTaskBatchOptions {
allConverged: true;
since?: string;
dir: string;
contextDir: string;
}
export interface FinishTaskResult {
shippedRecordId: string;
fromPath: string;
toPath: string;
/** The converged factory-run record's id whose lineage adopted the new record. */
runId: string;
/** The shipped spec's id. */
specId: string;
}
export interface FinishTaskBatchResult {
/** The factory-sequence whose converged specs were walked. */
factorySequenceId: string;
/** Per-spec ship results, one entry per converged + moved spec. */
shipped: FinishTaskResult[];
/**
* v0.0.14 — per-spec skip records for runs whose final iteration's terminal
* phase did NOT pass. Mirrors run-sequence's `no-converge` verdict so
* `--all-converged` no longer ships specs the runtime considered un-shipped.
*/
skipped: Array<{
specId: string;
runId: string;
terminalPhase: string;
}>;
}
/**
* v0.0.14 — status-aggregator helper for `--all-converged`. Walks
* factory-phase records belonging to `runId`, groups by iteration, and
* returns the FINAL iteration's terminal phase status (`{ converged,
* terminalPhase }`).
*
* Aligns finish-task's batch predicate with run-sequence's verdict — both
* count only the FINAL iteration, since earlier iterations' failures are
* part of the implement-validate-iterate loop, not a verdict. The canonical
* cousin lives in `factory-runtime/src/sequence.ts` (`verifyRunConverged`,
* v0.0.12); this duplicate avoids cross-package coupling deferred per the
* v0.0.14 spec.
*
* Exported within the package so the helper unit tests in
* `finish-task.test.ts` can call it directly. NOT re-exported from
* `index.ts` — it's a package-internal helper.
*/
export declare function getRunConvergenceStatus(contextDir: string, runId: string): Promise<{
converged: boolean;
terminalPhase: string;
}>;
/**
* Mark a converged spec as shipped: move its file to `/done/` and
* persist a `factory-spec-shipped` context record parented on the converged
* `factory-run` so the lifecycle is reconstructible from the store alone.
*
* Refuses to move if no converged factory-run exists for the spec id.
*
* v0.0.13 — overloaded to also accept `{ allConverged: true, since? }` to
* batch-ship every converged spec under a factory-sequence in one call.
*/
export declare function finishTask(opts: FinishTaskOptions): Promise;
export declare function finishTask(opts: FinishTaskBatchOptions): Promise;
//# sourceMappingURL=finish-task.d.ts.map