Expand description
The narrow surface the terminal tools call: the seatโs terminal, driven by bytes and keys and read as text.
Mirrors crate::mcp::browser::facade: the Tool impls hold an
Arc<dyn TerminalFacade> so their tests drive a MockTerminalFacade
instead of a live PTY.
Re-exportsยง
use std::path::PathBuf;๐use std::sync::Arc;๐use std::time::Duration;๐use async_trait::async_trait;๐use forge_primitives::SessionSlot;๐use forge_primitives::browser::HandOffEnding;๐use forge_primitives::browser::HandOffSource;๐use forge_primitives::terminal::TerminalExit;๐use forge_primitives::terminal::TerminalState;๐use forge_terminal::Key;๐use tokio::time::Instant;๐use tokio::time::timeout;๐use crate::terminal::TerminalEntry;๐use crate::terminal::wire_state;๐use crate::workspace::Workspace;๐
Structsยง
- Close
OnDrop ๐ - Closes a terminal when the runโs work is over, whatever path it took.
- Open
Answer - What
terminal__openanswers. - Open
Request - What
terminal__openasks for. - Prod
Terminal Facade - Production impl: the workspaceโs registry.
- Read
Answer - What
terminal__readanswers. - Resolve
OnDrop ๐ - Resolves a parked hand-off when the awaiting handler goes - a session that died mid-wait, never a decision.
- RunAnswer
- What
terminal__runanswers. - Wait
Answer - What
terminal__waitanswers.
Enumsยง
- Wait
Until - What
terminal__waitwaits for.
Traitsยง
- Terminal
Facade - The agentโs terminal, as one tool call sees it.
Functionsยง
- held_
error ๐ - refusal_
now ๐ - refuse_
when_ ๐held - The screen and the PTY belong to the person while a hand-off is parked. Every tool that touches either is refused, so a parallel call or a subagent cannot read their typing or write into their prompt.
- wait_
exit ๐ - Wait for a command to finish: exact through the marks, the heuristicโs quiet prompt otherwise, and the shellโs own exit for either.
- wait_
pattern ๐ - Wait until the screen contains
pattern. - wait_
quiet ๐ - Wait until no output has arrived for the quiet window.
- wait_
ready ๐ - Wait until the shell has drawn something, so a typed command reaches a ready line editor rather than being buffered before its prompt exists.
Type Aliasesยง
- Blind ๐
- The seat a wait is polling, while it may be taken by the person - through a parked hand-off or through a clientโs take-control. A wait that sees it owned stops rather than reading what they type.