Skip to main content

ProviderHost

Trait ProviderHost 

Source
pub trait ProviderHost: Send + Sync {
    // Required methods
    fn http_client(&self, timeout: Duration) -> Result<Client, String>;
    fn streaming_http_client(
        &self,
        connect_timeout: Duration,
        idle_timeout: Duration,
    ) -> Result<Client, String>;
    fn user_agent<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The host port, implemented by forge-agent. The only process plumbing a backend may reach, so the crate stays HTTP + mapping and is testable offline.

Required Methods§

Source

fn http_client(&self, timeout: Duration) -> Result<Client, String>

A reqwest client with the NODE_EXTRA_CA_CERTS roots applied and the caller’s timeout baked in.

Source

fn streaming_http_client( &self, connect_timeout: Duration, idle_timeout: Duration, ) -> Result<Client, String>

The same client for a streamed response: the NODE_EXTRA_CA_CERTS roots applied, connect_timeout bounding the connect and the TLS handshake, and idle_timeout bounding each read. The idle bound covers the wait for the response headers and then resets on every chunk; a streamed inference response has no known length, so the total deadline ProviderHost::http_client bakes in would cut a healthy long turn, while an idle bound still ends one whose upstream has stopped producing bytes.

Source

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

claude-code/<version>, resolved by one claude --version shell-out per process and cached, off the async runtime via spawn_blocking. Err preserves the probe’s UaProbe failure class.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§