/** * How long the current turn has been running, for the closing status box. * * The box already reports `session`, which is cumulative and says nothing * about the work just done: a 9-minute session hides whether this turn took * twelve seconds or eight minutes. `turn` measures from the operator's prompt * (`turn.started`) to the moment the box renders, so the operator reads the * cost of the turn they are about to be handed. * * Every read here is best-effort by contract. A missing ledger, an * unvalidated one, or no `turn.started` for this owner renders no row rather * than failing the status command. */ import type { EventV3 } from "../events/v3/contract.js"; export interface TurnElapsed { /** Seconds from the turn's start to its terminal, or to `now` while open. */ secs: number; /** True once a `turn.completed` closed the turn this measures. */ complete: boolean; /** Stop-hook restarts folded into this measurement. */ remediation_restarts: number; } /** * Measure the newest turn for `instanceId` from an already-read event stream. * * A Stop-hook bounce ends one `turn.started` and opens another carrying * `stop_remediation`. The operator experiences those as one turn, so the walk * back over remediation restarts reports elapsed time since their prompt, not * since the last retry. The walk stays inside one generation: a resumed * session must not absorb the previous generation's turn into its own. */ export declare function resolveTurnElapsed(events: readonly EventV3[], instanceId: string, now?: number): TurnElapsed | null; /** * Render a turn duration for the box. Seconds stay visible below an hour * because most turns land there and a bare `4m` cannot be compared with the * turn before it. */ export declare function formatTurnElapsed(secs: number): string; export interface TurnElapsedTarget { coordRoot: string; instanceId: string; } /** * The whole status-box contribution in one best-effort call: read the ledger * and render this session's `turn` row. Null means render no row. */ export declare function turnElapsedStatusRow(target: TurnElapsedTarget, now?: number): { value: string; elapsed: TurnElapsed; } | null; //# sourceMappingURL=turn-elapsed.d.ts.map