Skip to main content

Connector

Trait Connector 

Source
pub trait Connector: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn describe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ConnectorDescription, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        arguments: Value,
        context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn admit_child<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _parent: &'life1 str,
        _child: &'life2 str,
        _request: Option<&'life3 RequestContext>,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn prepare_arguments<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _seq: u64,
        _tool: &'life1 ConnectorTool,
        arguments: Value,
        _context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn retry_policy(&self, _method: &str) -> RetryPolicy { ... }
    fn recover<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _method: &'life1 str,
        _arguments: &'life2 Value,
        _context: &'life3 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<CallRecovery, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn revert<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _method: &'life1 str,
        _arguments: Value,
        _result: Value,
        _context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn pass_ended<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _execution_id: &'life1 str,
        _status: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn execution_ended<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _execution_id: &'life1 str,
        _status: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

A transport-neutral source of sandbox-callable tools.

Required Methods§

Source

fn name(&self) -> &str

Returns the namespace this connector is bound to.

Separate from Connector::describe so a namespace can be named without being contacted. describe reaches the underlying service, so deriving the name from it meant every connector had to be connected to before any program could be built — including the ones the program never mentions.

Source

fn describe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConnectorDescription, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns connector metadata and schemas.

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, method: &'life1 str, arguments: Value, context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Executes one connector method.

Provided Methods§

Source

fn admit_child<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _parent: &'life1 str, _child: &'life2 str, _request: Option<&'life3 RequestContext>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Binds inherited host authority before any prepared child pass may run. References in a program cannot supply or expand this authority.

Source

fn prepare_arguments<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _seq: u64, _tool: &'life1 ConnectorTool, arguments: Value, _context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolves contextual defaults before replay comparison and dispatch.

The default preserves caller arguments. Implementations must return stable values for the same execution context and call sequence.

Source

fn retry_policy(&self, _method: &str) -> RetryPolicy

Retry budget for one method. The default invokes a method at most once.

Source

fn recover<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _method: &'life1 str, _arguments: &'life2 Value, _context: &'life3 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<CallRecovery, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Reconciles an interrupted or transiently failed call before any repeat.

Implementations must use the stable key in ToolContext::call with their authoritative effect store or remote idempotency contract. Untrusted remote annotations alone do not prove a repeat is safe. This must not repeat the write.

Source

fn revert<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _method: &'life1 str, _arguments: Value, _result: Value, _context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Compensates a previously applied connector action.

Source

fn pass_ended<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _execution_id: &'life1 str, _status: &'life2 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Releases resources scoped to one sandbox pass.

Source

fn execution_ended<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _execution_id: &'life1 str, _status: &'life2 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Releases resources scoped to a complete execution.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§