Expand description
The per-seat terminals: the registry, the hand-off that parks on the person, and the idle clock.
The terminal belongs to the seat, not the occupant. It is keyed by the
slot and created lazily on first use; /new, /resume and a handoff
leave the PTY, its shell and its scrollback exactly where they were. It
lives as long as the seat: a release ends the seat and its terminal, and
an explicit close, the shell exiting or forge exiting also ends it.
No approval gate. Bash through the CLI already reaches the shell here, so the terminal adds no capability a session does not have. The one thing that is gated is the personβs own input, through the hand-off or through their own take-control of the raised surface.
Lock order: terminal_handoffs before terminals. Every path that
needs both takes them in that order, so a claim, an answer, a typed byte
and the idle sweep can never deadlock against each other. A path that
needed the other order has to drop one guard before taking the other.
Re-exportsΒ§
use std::path::PathBuf;πuse std::sync::Arc;πuse std::sync::atomic::AtomicU64;πuse std::sync::atomic::AtomicUsize;πuse std::sync::atomic::Ordering;πuse std::time::Duration;πuse std::time::Instant;πuse forge_primitives::SessionSlot;πuse forge_primitives::browser::HandOffEnding;πuse forge_primitives::terminal::TerminalExit;πuse forge_primitives::terminal::TerminalHandOff;πuse forge_primitives::terminal::TerminalHandOffAnswer;πuse forge_primitives::terminal::TerminalInputExpected;πuse forge_primitives::terminal::TerminalInputKind;πuse forge_primitives::terminal::TerminalSource;πuse forge_primitives::terminal::TerminalState;πuse forge_primitives::terminal::TerminalSummary;πuse parking_lot::Mutex;πuse tokio::sync::oneshot;πuse crate::protocol::SessionUpdate;πuse crate::workspace::Workspace;π
StructsΒ§
- Output
Chunk - One chunk of a terminalβs output, re-exported so a server half can name the type its stream carries without depending on the crate directly. One chunk of the terminalβs output, with its per-terminal sequence.
- Terminal
Entry - One seatβs terminal, as the registry holds it.
ConstantsΒ§
- CLOCK_
TICK π - How often the idle clock looks at the registry.
- DEFAULT_
COLS π - The size a terminal opens at before a clientβs attach resizes it.
- DEFAULT_
ROWS π
FunctionsΒ§
- wire_
state π - The wire state, from the crateβs own.