/** * Live lane registry for autonomous background work (research/worker/learning lanes). * * This is the first real concurrency tracker behind `AutonomyStatusSnapshot.activeLaneCount`: * counts reflect lanes actually running in THIS process, never inferred/faked from historical * snapshots. Terminal lane records are persisted separately via `session-lane-record.ts`. */ import { type OrchestrationThinkingLevel } from "../orchestration/contracts.ts"; export type LaneType = "research" | "worker" | "learning" | "tmux-worker"; export type LaneTerminalStatus = "succeeded" | "partial" | "blocked" | "failed" | "canceled" | "timeout" | "budget_exhausted"; export type LaneStatus = "queued" | "running" | LaneTerminalStatus; export interface LaneRecord { laneId: string; type: LaneType; status: LaneStatus; /** Bounded human-readable work label retained across session resume. */ label?: string; /** Owner-authored profile that fixed the worker's model, thinking, tools, and budget. */ profileId?: string; /** Effective provider/model admitted into the immutable worker execution contract. */ modelRef?: string; /** Effective thinking level admitted with modelRef. */ thinkingLevel?: OrchestrationThinkingLevel; reasonCode?: string; startedAt?: string; completedAt?: string; costUsd?: number; goalId?: string; evidenceEntryId?: string; /** * Worktree-sync lane key this lane record was correlated to at dispatch (set only for a * tmux-worker lane whose fire_task carried a `worktreeLane` -- see `tmux-dispatch.ts`'s * `createLaneWorktree`). Optional so every pre-existing record/caller keeps compiling and * behaving unchanged; `undefined` for a lane never bound to a worktree-sync lane. */ worktreeLaneKey?: string; } export declare function isLaneTerminalStatus(value: unknown): value is LaneTerminalStatus; export declare function isLaneRecord(value: unknown): value is LaneRecord; export declare function cloneLaneRecordForStorage(record: LaneRecord): LaneRecord; export declare class LaneTracker { private readonly _lanes; private _nextLaneNumber; private readonly _now; constructor(options?: { now?: () => string; }); /** Seed the id counter (e.g. from persisted lane records) so resumed sessions don't reuse ids. */ ensureCounterAtLeast(next: number): void; private _evictOldTerminal; enqueue(args: { type: LaneType; goalId?: string; worktreeLaneKey?: string; }): LaneRecord; /** Restore an exact durable projection without minting a replacement logical id or timestamp. */ restore(record: LaneRecord): LaneRecord; /** Start or restart a caller-named lane. The supplied id is its durable logical identity. */ startNamed(args: { laneId: string; type: LaneType; goalId?: string; worktreeLaneKey?: string; }): LaneRecord; markRunning(laneId: string): LaneRecord | undefined; start(args: { type: LaneType; goalId?: string; worktreeLaneKey?: string; }): LaneRecord; complete(laneId: string, args: { status: LaneTerminalStatus; reasonCode?: string; costUsd?: number; evidenceEntryId?: string; }): LaneRecord | undefined; getActiveCount(type?: LaneType): number; getRunningCount(type?: LaneType): number; getRecords(): LaneRecord[]; getRecord(laneId: string): LaneRecord | undefined; } //# sourceMappingURL=lane-tracker.d.ts.map