/** * Work Handoff Builder (2.0) * * Assembles a ≤1-page, secret-scrubbed handoff document (+ a full diff of * uncommitted edits) from durable on-disk state, so any agent from any vendor * can stop and another can resume. Single engine behind `specweave handoff`, * `/sw:handoff`, and the PreCompact hook. * * Workspace = SpecWeave when the resolved root carries `.specweave/config.json`. * The increment is the single `active` one (metadata.json), or the explicit id. * Task state comes from the ledger fold (one counter — no disagreeing numbers). * Single write location: `.specweave/increments//handoff.md` + `handoff.diff`, * with a pointer at `.specweave/state/handoff-latest.txt`. * * @module core/session/work-handoff */ import { type AutoCommitResult } from '../increment/auto-commit.js'; import { type HandoffPushInfo } from './handoff-doc-format.js'; export interface WorkHandoffOptions { incrementId?: string; reason?: string; summary?: string; next?: string; gotcha?: string; decisions?: string[]; inline?: boolean; out?: string; nonSpecweave?: boolean; /** * Push the branch and a snapshot of the working tree so `specweave pickup` * finds it from any clone. Default: on when the repo has an `origin` * remote (quietly skipped otherwise); `false` keeps the handoff local. */ push?: boolean; /** Keep this agent's claims instead of releasing them for the next agent. */ keepClaims?: boolean; /** `--no-commit` → false: skip the `git.autoCommitIncrement` commit. */ commit?: boolean; /** * A checkpoint (PreCompact) rather than a handoff: the same session goes on * working, so claims stay and no `handoff` event is written. */ checkpoint?: boolean; /** Automatic session checkpoint: capture this worktree, tolerate ambiguous * increment context, and leave the shared handoff pointer untouched. Requires * checkpoint:true and an isolated out path; explicit handoff is unchanged. */ checkpointRoot?: string; /** Override the agent id (tests). */ agent?: string; } export interface WorkHandoffResult { docPath: string; diffPath: string; docMarkdown: string; pastePrompt: string; isSpecWeave: boolean; incrementId?: string; /** Task ids whose claims this handoff released. */ released: string[]; push?: HandoffPushInfo; /** The opt-in commit of the increment's own files (absent for checkpoints). */ commit?: AutoCommitResult; } export declare class AmbiguousActiveIncrementError extends Error { readonly candidates: string[]; constructor(candidates: string[]); } export declare const HANDOFF_POINTER_FILE = "handoff-latest.txt"; /** Where the generated doc goes when the increment's `handoff.md` was written by hand. */ export declare const AUTO_HANDOFF_FILE = "handoff.auto.md"; export declare function buildWorkHandoff(repoRoot: string, opts?: WorkHandoffOptions): Promise; /** Read-only export for callers that want the active ids (e.g. session-start context). */ export declare function activeIncrementIds(projectRoot: string): string[]; /** * Decision bullets from `## Approach`, `## Decisions`, `## Key decisions`, * `## Risks` sections of spec.md / plan.md. Whole bullets — continuation lines * (indented or unindented wrapped text) are joined onto their bullet. */ export declare function readDecisions(filePath: string): string[]; /** A root `./HANDOFF.md` without our marker is a foreign file we must not clobber. */ export declare function isForeignHandoffFile(handoffPath: string): boolean; //# sourceMappingURL=work-handoff.d.ts.map