Expand description
Workspace-side per-session state.
Holds what workspace itself needs: routing metadata (AgentHandle
slot, claude-issued session_id), the pending-interaction mailbox,
and the facts every view reads through the view surface. The rest of
the operational state a view renders (lifecycle, cwd, account info)
lives on the viewโs own session record.
Two classes are held here rather than folded per view. The turn
signal DomainSession::runtime_state is the one the workspace needs
authoritatively for its worker-liveness and prompt-interception
guards, and DomainSession::background_work,
DomainSession::available_commands and
DomainSession::available_agents are held so a view arriving late
reads them from the core.
Re-exportsยง
use std::collections::HashMap;๐use std::collections::HashSet;๐use std::sync::Arc;๐use forge_agent::AgentHandle;๐use forge_primitives::AvailableAgent;๐use forge_primitives::AvailableCommand;๐use forge_primitives::AvailableModel;๐use forge_primitives::CurrentModel;๐use forge_primitives::EffortLevel;๐use forge_primitives::McpServerStatus;๐use forge_primitives::MonitorRecord;๐use forge_primitives::PermissionMode;๐use forge_primitives::RuntimeSessionState;๐use forge_primitives::SessionId;๐use crate::SessionSlot;๐use crate::protocol::PendingInteractionSlot;๐
Structsยง
- Context
Usage - How full the sessionโs context window is, from the bridgeโs last
answer. Both halves are
Optionbecause the upstream probe reports them independently. - Domain
Session - Handoff
State - The handoff this session is running, if any.
- McpServers
- The MCP servers a sessionโs bridge last reported, and the failure standing beside them when the read did not complete.
- Pending
Auto Continue - A continuation the failure left behind: the words the model will receive, taken by the fire as soon as the failed turn is folded.
- Pending
Interactions - The interactions a seat is parked on, oldest first.
Enumsยง
- Turn
Liveness - What one frame says about whether a turn is open, when it says anything.
Constantsยง
- EFFORT_
LEVEL_ ๐KEY - The CLI settings key a sessionโs effort is stamped under. One const, so the writer and this reader cannot split the seam.
- SETTLED_
STATES ๐ - Workspaceโs owned per-session state. One
DomainSessionper activeSessionTask. Single writer (theSessionTask); accessed viaArc<parking_lot::Mutex<DomainSession>>so theWorkspacecan route commands without locking the whole pool. The lifecycle states that settle a queued row.
Functionsยง
- configured_
effort_ ๐from_ settings - The effort level a spawn asked for, read back from the launch settings forge stamps for the CLI.
- configured_
permission_ ๐mode_ from_ settings - The mode a spawn asked for, read back from the same launch settings the effort comes from.
- liveness_
of - What one message says about a turnโs liveness, or
Nonewhere it says nothing.