Skip to main content

Module domain_session

Module domain_session 

Source
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ยง

ContextUsage
How full the sessionโ€™s context window is, from the bridgeโ€™s last answer. Both halves are Option because the upstream probe reports them independently.
DomainSession
HandoffState
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.
PendingAutoContinue
A continuation the failure left behind: the words the model will receive, taken by the fire as soon as the failed turn is folded.
PendingInteractions
The interactions a seat is parked on, oldest first.

Enumsยง

TurnLiveness
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 DomainSession per active SessionTask. Single writer (the SessionTask); accessed via Arc<parking_lot::Mutex<DomainSession>> so the Workspace can 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 None where it says nothing.