Skip to main content

Module facade

Module facade 

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

CloseOnDrop ๐Ÿ”’
Closes a terminal when the runโ€™s work is over, whatever path it took.
OpenAnswer
What terminal__open answers.
OpenRequest
What terminal__open asks for.
ProdTerminalFacade
Production impl: the workspaceโ€™s registry.
ReadAnswer
What terminal__read answers.
ResolveOnDrop ๐Ÿ”’
Resolves a parked hand-off when the awaiting handler goes - a session that died mid-wait, never a decision.
RunAnswer
What terminal__run answers.
WaitAnswer
What terminal__wait answers.

Enumsยง

WaitUntil
What terminal__wait waits for.

Traitsยง

TerminalFacade
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.