pub struct CallbackHandler { /* private fields */ }Expand description
Callback Handler
Central handler for all callback requests from external extension services. Coordinates AI, tool, and context callback handlers.
Implementations§
Source§impl CallbackHandler
impl CallbackHandler
Sourcepub fn new(
security: Arc<SecurityValidator>,
tool_router: Arc<ToolRouter>,
node_router: Arc<NodeRouter>,
) -> Self
pub fn new( security: Arc<SecurityValidator>, tool_router: Arc<ToolRouter>, node_router: Arc<NodeRouter>, ) -> Self
Create a new callback handler
Sourcepub fn with_config(
security: Arc<SecurityValidator>,
tool_router: Arc<ToolRouter>,
_node_router: Arc<NodeRouter>,
config: CallbackConfig,
) -> Self
pub fn with_config( security: Arc<SecurityValidator>, tool_router: Arc<ToolRouter>, _node_router: Arc<NodeRouter>, config: CallbackConfig, ) -> Self
Create a new callback handler with configuration
Sourcepub async fn handle_request(
&self,
request: JsonRpcRequest,
) -> Result<CallbackResult, CallbackError>
pub async fn handle_request( &self, request: JsonRpcRequest, ) -> Result<CallbackResult, CallbackError>
Handle a JSON-RPC callback request
Sourcepub fn create_success_response(
&self,
id: JsonRpcId,
result: CallbackResult,
) -> JsonRpcResponse
pub fn create_success_response( &self, id: JsonRpcId, result: CallbackResult, ) -> JsonRpcResponse
Create a JSON-RPC response for a callback result
Sourcepub fn create_error_response(
&self,
error: CallbackError,
id: JsonRpcId,
) -> JsonRpcResponse
pub fn create_error_response( &self, error: CallbackError, id: JsonRpcId, ) -> JsonRpcResponse
Create a JSON-RPC error response for callback failures
Sourcepub async fn generate_token(
&self,
service_id: ServiceId,
request_id: String,
allowed_types: Vec<String>,
) -> Result<String, CallbackError>
pub async fn generate_token( &self, service_id: ServiceId, request_id: String, allowed_types: Vec<String>, ) -> Result<String, CallbackError>
Generate a callback token for a service
Sourcepub async fn validate(
&self,
token: &str,
service_id: &ServiceId,
request_id: &str,
callback_type: &str,
) -> ValidationResult
pub async fn validate( &self, token: &str, service_id: &ServiceId, request_id: &str, callback_type: &str, ) -> ValidationResult
Validate a callback request (pre-validation)
Sourcepub fn security(&self) -> Arc<SecurityValidator> ⓘ
pub fn security(&self) -> Arc<SecurityValidator> ⓘ
Get the security validator
Sourcepub fn ai_handler(&self) -> Arc<AiCallbackHandler> ⓘ
pub fn ai_handler(&self) -> Arc<AiCallbackHandler> ⓘ
Get the AI handler
Sourcepub fn tool_handler(&self) -> Arc<ToolCallbackHandler> ⓘ
pub fn tool_handler(&self) -> Arc<ToolCallbackHandler> ⓘ
Get the tool handler
Sourcepub fn context_handler(&self) -> Arc<ContextCallbackHandler> ⓘ
pub fn context_handler(&self) -> Arc<ContextCallbackHandler> ⓘ
Get the context handler
Auto Trait Implementations§
impl !RefUnwindSafe for CallbackHandler
impl !UnwindSafe for CallbackHandler
impl Freeze for CallbackHandler
impl Send for CallbackHandler
impl Sync for CallbackHandler
impl Unpin for CallbackHandler
impl UnsafeUnpin for CallbackHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more