pub struct LocalBroker { /* private fields */ }Expand description
In-process credential broker. This module is the ONLY place runtime-serving
code may read auth.json, provider.<key> config values, or credential
environment variables.
Implementations§
Source§impl LocalBroker
impl LocalBroker
pub fn new(http: Client) -> LocalBroker
pub fn with_cloud_backend(self, backend: Arc<dyn CloudBackend>) -> LocalBroker
Sourcepub fn with_local_base_url(
http: Client,
base_url: impl Into<String>,
) -> LocalBroker
pub fn with_local_base_url( http: Client, base_url: impl Into<String>, ) -> LocalBroker
Test/embedding seam: pin the local provider endpoint explicitly.
Trait Implementations§
Source§impl CredentialBroker for LocalBroker
impl CredentialBroker for LocalBroker
Source§fn access_token<'life0, 'async_trait>(
&'life0 self,
provider: OAuthProviderId,
) -> Pin<Box<dyn Future<Output = Result<AccessToken, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
fn access_token<'life0, 'async_trait>(
&'life0 self,
provider: OAuthProviderId,
) -> Pin<Box<dyn Future<Output = Result<AccessToken, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
Vend a fresh OAuth access token (token + expiry ONLY).
Source§fn proxy<'life0, 'async_trait>(
&'life0 self,
request: ProxyRequest,
) -> Pin<Box<dyn Future<Output = Result<ProxyResponse, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
fn proxy<'life0, 'async_trait>(
&'life0 self,
request: ProxyRequest,
) -> Pin<Box<dyn Future<Output = Result<ProxyResponse, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
Execute a non-streaming provider request with the broker-owned key.
Source§fn proxy_stream<'life0, 'async_trait>(
&'life0 self,
request: ProxyRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Bytes, BrokerError>> + Send>>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
fn proxy_stream<'life0, 'async_trait>(
&'life0 self,
request: ProxyRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Bytes, BrokerError>> + Send>>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
Execute a streaming (SSE) provider request with the broker-owned key.
Returns the byte stream only when the upstream response is successful;
error statuses are read (bounded) and surfaced as
BrokerError.Source§fn anthropic_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Value, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
fn anthropic_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Value, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
Typed operation: fetch the Anthropic account-usage summary. Read more
Source§fn cloud_catalog<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: CloudProviderId,
context_ref: &'life1 str,
allow_stale: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<CloudCatalogEntry>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalBroker: 'async_trait,
fn cloud_catalog<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: CloudProviderId,
context_ref: &'life1 str,
allow_stale: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<CloudCatalogEntry>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
LocalBroker: 'async_trait,
Typed cloud catalog. Credentials and provider authority remain broker-owned.
Source§fn cloud_invoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
provider: CloudProviderId,
context_ref: &'life1 str,
model_id: &'life2 str,
request: InvokeRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<CloudEvent, BrokerError>> + Send>>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
LocalBroker: 'async_trait,
fn cloud_invoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
provider: CloudProviderId,
context_ref: &'life1 str,
model_id: &'life2 str,
request: InvokeRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<CloudEvent, BrokerError>> + Send>>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
LocalBroker: 'async_trait,
Typed cloud invocation. The canonical model and normalized request are the
only caller-controlled inputs; hosts, auth and signing remain broker-owned.
Source§fn capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ProviderStatus>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
fn capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ProviderStatus>, BrokerError>> + Send + 'async_trait>>where
'life0: 'async_trait,
LocalBroker: 'async_trait,
Non-secret provider capability/status list.
Auto Trait Implementations§
impl !RefUnwindSafe for LocalBroker
impl !UnwindSafe for LocalBroker
impl Freeze for LocalBroker
impl Send for LocalBroker
impl Sync for LocalBroker
impl Unpin for LocalBroker
impl UnsafeUnpin for LocalBroker
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more