/** * Pure Turn→Session fan-in helper per session-hierarchy.md §5.1. * * Extracted from `session/hierarchy/session.ts` on 2026-04-21 (ses_010 commit * 4) so the shape definition can live under `types/session/` while the * runtime helper stays in a feature folder — the type-layering rule * (`types/` = pure shapes, feature folders = runtime). * * The precedence (highest first) matches the pattern-doc table: * 1. Session-level states that do not fan in from Turn status: * - `locked` (handoff CAS window) — preserved verbatim * - `awaiting_merge` (broadcast source post-fan-out, §5.4) — preserved * - `archived` (retention tombstone, §12.3) — preserved * 2. Any turn `running` or `awaiting_subsession` → Session `active`. * Delegation-in-flight is an active state of the parent — the parent * turn is suspended waiting on the child's SessionSummaryMaterializer, * and the session is NOT idle while that is pending. * 3. Any turn `awaiting_hitl` or `awaiting_hitl_resolution` → Session * `awaiting_hitl`. * 4. All turns `failed` and at least one turn present → Session `failed`. * 5. Otherwise (all turns terminal — succeeded/cancelled/failed mix, or no * turns at all) → Session `idle`. * * `cancelled` does NOT surface a `failed` Session (§5.1 — "Cancellation is * not a terminal Session state"). Only `failed` turns drive the Session to * `failed` when every Turn ended that way. */ import type { Session, SessionStatus } from '../../types/session/entity.js'; import type { TurnStatus } from '../../types/session/turn.js'; export declare function deriveStatus(session: Session, turns: readonly { status: TurnStatus; }[]): SessionStatus; //# sourceMappingURL=derive.d.ts.map