pub struct HostOverrides {
pub translator: Arc<dyn Translator>,
pub secrets_backend: Arc<dyn SecretsBackend>,
pub http_client: Option<Client>,
pub llm_port: Option<Arc<dyn LlmPort>>,
pub url_matcher: UrlMatcher,
pub runtime_weak: Weak<ExtensionRuntime>,
pub call_depth_start: u32,
pub oauth_config: Option<OAuthBrokerConfig>,
}Expand description
Bundle of overrides every dispatch caller must supply when building a
HostState. Production code (designer) constructs adapters around
greentic-i18n + greentic-secrets; tests use HostOverrides::defaults_for_tests.
http_client is Option because reqwest::blocking::Client spawns an
internal tokio runtime, and dropping that runtime from inside an
outer async context panics with “Cannot drop a runtime in a context
where blocking is not allowed”. Tests instantiate ExtensionRuntime
inside #[tokio::test] bodies but never call http::fetch, so
they leave the client None — host_state will surface a clean
“http client not configured” error if a test ever does invoke fetch.
Production callers pass Some(client) once at startup.
Fields§
§translator: Arc<dyn Translator>§secrets_backend: Arc<dyn SecretsBackend>§http_client: Option<Client>§llm_port: Option<Arc<dyn LlmPort>>§url_matcher: UrlMatcher§runtime_weak: Weak<ExtensionRuntime>§call_depth_start: u32§oauth_config: Option<OAuthBrokerConfig>Implementations§
Source§impl HostOverrides
impl HostOverrides
Sourcepub fn defaults_for_tests() -> Self
pub fn defaults_for_tests() -> Self
Fakes-everywhere helper. http_client is None so dropping the
runtime inside an outer async context never panics; the test never
hits the path that uses it. Runtime weak is left unset (Weak::new),
so broker dispatch returns “no runtime context available” until
the cross-extension dispatch cascade lands.
Trait Implementations§
Source§impl Clone for HostOverrides
impl Clone for HostOverrides
Source§fn clone(&self) -> HostOverrides
fn clone(&self) -> HostOverrides
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HostOverrides
impl Debug for HostOverrides
Source§impl Default for HostOverrides
impl Default for HostOverrides
Source§fn default() -> Self
fn default() -> Self
Production-safe defaults: key-pass-through translator (i18n key
returned verbatim), empty in-memory secrets, no HTTP client (callers
that need HTTP must supply Some(client) via
RuntimeConfig::with_host_overrides or
ExtensionRuntime::with_host_overrides), empty URL allow-list, and
no broker-runtime weak reference (cross-extension dispatch returns
“no runtime context available” until the cascade cascade lands).
http_client is intentionally None rather than eagerly constructed
because reqwest::blocking::Client spawns its own internal tokio
runtime; dropping that runtime from inside an outer #[tokio::test]
body panics with “Cannot drop a runtime in a context where blocking is
not allowed”. Tests leave it None; production callers pass
Some(client) once at startup.
Auto Trait Implementations§
impl !RefUnwindSafe for HostOverrides
impl !UnwindSafe for HostOverrides
impl Freeze for HostOverrides
impl Send for HostOverrides
impl Sync for HostOverrides
impl Unpin for HostOverrides
impl UnsafeUnpin for HostOverrides
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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