pub struct TuiBridge {
pub approval_rx: Receiver<PendingApprovalRequest>,
pub child_approval_rx: Receiver<PendingChildApproval>,
pub elicitation_rx: Receiver<PendingElicitation>,
pub oauth_rx: Receiver<PendingOAuthDisplay>,
/* private fields */
}Expand description
The aggregate wiring point a crates/cli embedder uses: constructs
every channel pair once, installs the SENDING halves onto the Agent/
McpClients that need them, and hands the RECEIVING halves to the
render loop to poll each frame. See crate::tui::should_activate’s
doc comment for why this is only ever built when the TUI is confirmed
active — installing these on an agent that no render loop is draining
would hang the first Ask-tier prompt or elicitation forever.
Fields§
§approval_rx: Receiver<PendingApprovalRequest>Poll this each render frame (try_recv) for a new top-level
approval prompt to show.
child_approval_rx: Receiver<PendingChildApproval>Poll this each render frame for a new child-approval prompt.
elicitation_rx: Receiver<PendingElicitation>Poll this each render frame for a new elicitation prompt.
oauth_rx: Receiver<PendingOAuthDisplay>Poll this each render frame for a new OAuth device-code display.
Implementations§
Source§impl TuiBridge
impl TuiBridge
Sourcepub fn new() -> Self
pub fn new() -> Self
Build a fresh bridge — four independent channel pairs, all cheap
(unbounded mpsc, no background threads spawned here).
Sourcepub fn install_on(&self, agent: &mut Agent)
pub fn install_on(&self, agent: &mut Agent)
Install this bridge’s top-level-approval and child-approval-factory
handlers onto agent. Does NOT touch MCP elicitation — an
McpClient needs Self::elicitation_handler installed on IT
directly (before the client is consumed into tool registration),
which is why that’s a separate method the caller invokes per
client, earlier in its own connect sequence.
Sourcepub fn elicitation_handler(&self) -> Arc<dyn McpElicitationHandler> ⓘ
pub fn elicitation_handler(&self) -> Arc<dyn McpElicitationHandler> ⓘ
A fresh TuiElicitationHandler wired to this bridge — install on
each McpClient via
crate::mcp::McpClient::set_elicitation_handler before that
client is consumed into tool registration.
Sourcepub fn oauth_sender(&self) -> Sender<PendingOAuthDisplay>
pub fn oauth_sender(&self) -> Sender<PendingOAuthDisplay>
The sender half for a one-shot OAuth device-code display push (P5-2
device flow’s on_prompt callback) — see crates/cli’s OAuth login
wiring for the call site.