pub struct SecurityGate { /* private fields */ }Expand description
Security gate wrapping a bote Dispatcher.
Every tools/call passes through t-ron’s check pipeline before reaching the
inner dispatcher. Non-tool methods (initialize, tools/list) pass through
unmodified.
Implementations§
Source§impl SecurityGate
impl SecurityGate
Sourcepub fn new(tron: TRon, dispatcher: Dispatcher) -> Self
pub fn new(tron: TRon, dispatcher: Dispatcher) -> Self
Create a new security gate.
Sourcepub fn dispatcher_mut(&mut self) -> &mut Dispatcher
pub fn dispatcher_mut(&mut self) -> &mut Dispatcher
Access the inner dispatcher (e.g. for registering handlers).
Sourcepub fn dispatcher(&self) -> &Dispatcher
pub fn dispatcher(&self) -> &Dispatcher
Access the inner dispatcher immutably.
Sourcepub fn register_tool_handlers(&mut self)
pub fn register_tool_handlers(&mut self)
Register t-ron’s tool handlers with the inner dispatcher.
Important: The tool definitions must be registered in the
ToolRegistry before creating the Dispatcher. Use
tools::tool_defs() to get the definitions
and register them alongside your application’s tools. This method only
wires up the handler functions.
Sourcepub async fn dispatch(
&self,
request: &JsonRpcRequest,
agent_id: &str,
) -> Option<JsonRpcResponse>
pub async fn dispatch( &self, request: &JsonRpcRequest, agent_id: &str, ) -> Option<JsonRpcResponse>
Dispatch a JSON-RPC request with security checks.
agent_id identifies the calling agent — this is the identity t-ron
checks against its policy engine. Callers are responsible for
authenticating the agent and providing a trusted ID.
Sourcepub async fn dispatch_streaming(
&self,
request: &JsonRpcRequest,
agent_id: &str,
) -> DispatchOutcome
pub async fn dispatch_streaming( &self, request: &JsonRpcRequest, agent_id: &str, ) -> DispatchOutcome
Dispatch with streaming support and security checks.