Expand description
Inbound control_request dispatch: ControlDispatchHandle
routes permission checks, MCP JSON-RPC, and hook callbacks to the
appropriate handler and writes the matching control_response via
a clonable SharedWriter.
Internal: built once during Client::spawn,
cloned and moved into a tokio::spawnβd task per inbound
control_request by the reader task in crate::client::runtime.
The clonable writer + the tokio::spawn mean a slow callback cannot
block the read loop, and cancellation of the actorβs select! cannot
drop a control_response write mid-flight.
Used the same way during the synchronous init handshake - the
init loop calls ControlDispatchHandle::dispatch directly for
interleaved control_requests, since no concurrent reader exists
yet.
Re-exportsΒ§
use std::collections::HashMap;πuse std::sync::Arc;πuse crate::Error;πuse crate::control::AllowBehavior;πuse crate::control::ControlRequest;πuse crate::control::ControlRequestKind;πuse crate::control::ControlResponse;πuse crate::control::ControlResponseKind;πuse crate::control::ControlResponseType;πuse crate::hooks::callback::ErasedHookCallback;πuse crate::hooks::HookContext;πuse crate::hooks::HookDecision;πuse crate::hooks::HookKind;πuse crate::mcp::orchestration::Dispatched;πuse crate::mcp::orchestration::McpHosts;πuse crate::mcp::protocol::JsonRpcRequest;πuse crate::permissions::CanUseToolCallback;πuse forge_primitives::hooks::outputs::encode_updated_input_wrapper;πuse forge_primitives::PermissionDecision;πuse forge_primitives::ToolPermissionContext;π
StructsΒ§
- Control
Dispatch πHandle - Clonable bundle of state + writer that dispatches a single
control_request. Internal - built once duringClient::spawnand cloned by the reader task per inbound request.
FunctionsΒ§
- control_
subtype π - The subtype a request crossed as, for a failure record that has to say which kind of control request went unanswered.