pub struct PtyState {
pub active: bool,
pub drive: Option<DriveWindow>,
}Expand description
PTY sub-state. The on-disk shape stays flat (active, drive_active,
drive_session_id, drive_mode, last_heartbeat_at_monotonic_ns) via a
hand-written serde impl below, so cross-language schema parity (Wave 7) is a
direct field map; in memory the drive cluster is one Option<DriveWindow>.
Fields§
§active: bool§drive: Option<DriveWindow>Some while an interactive drive window is open; None otherwise.
Implementations§
Source§impl PtyState
impl PtyState
Sourcepub fn take_active_drive(&mut self) -> Option<DriveWindow>
pub fn take_active_drive(&mut self) -> Option<DriveWindow>
Recovery step 4/5 ordering primitive (finding #12 Critical): atomically
READ the active drive window (returning its session id + mode + last
heartbeat) AND clear it. Callers MUST use the returned value to emit
drive_crashed — the read happens here, before the clear, so the event
reflects what the window was. Returns None if no drive was active.
With the drive cluster behind one Option, read-then-clear is just
Option::take: there is no window between the read and the clear for a
second observer to see a half-cleared state.