pub struct HostState {
pub extension_id: String,
pub permissions: Permissions,
pub call_depth: AtomicU32,
/* private fields */
}Expand description
Per-Store host context. One HostState is built per WIT invocation —
the dependencies live in Arcs so cloning is cheap.
Fields§
§extension_id: String§permissions: Permissions§call_depth: AtomicU32Implementations§
Source§impl HostState
impl HostState
Sourcepub fn builder(
extension_id: String,
permissions: Permissions,
) -> HostStateBuilder
pub fn builder( extension_id: String, permissions: Permissions, ) -> HostStateBuilder
Builder used by LoadedExtension::build_store_and_instance to
produce a HostState for a single dispatch.
pub fn translator(&self) -> &dyn Translator
pub fn secrets_backend(&self) -> &dyn SecretsBackend
pub fn url_matcher(&self) -> &UrlMatcher
Trait Implementations§
Source§impl Host for HostState
impl Host for HostState
fn complete(&mut self, request: LlmRequest) -> Result<LlmResponse, String>
Source§impl Host for HostState
impl Host for HostState
Source§fn get_token(
&mut self,
provider_id: String,
_subject: String,
scopes: Vec<String>,
) -> String
fn get_token( &mut self, provider_id: String, _subject: String, scopes: Vec<String>, ) -> String
Retrieve a token for the given OAuth provider.
Permission gate: the provider must be declared in
permissions.oauth_providers. If not, returns a JSON error string with
"error": "permission_denied" — fails closed.
When permitted but no oauth_config or http_client is present (e.g.
the runtime was not configured with an OAuth broker), returns
"error": "oauth_broker_unconfigured".
The shared_secret is NEVER logged.
Source§fn get_consent_url(
&mut self,
_provider_id: String,
_subject: String,
_scopes: Vec<String>,
_redirect_path: String,
_extra_json: String,
) -> String
fn get_consent_url( &mut self, _provider_id: String, _subject: String, _scopes: Vec<String>, _redirect_path: String, _extra_json: String, ) -> String
Build a consent URL for the given OAuth provider.
Not yet implemented in the design-extension runtime — returns an empty string. Consent flows are handled by the OAuth broker service directly; this stub satisfies the WIT interface contract.
Source§fn exchange_code(
&mut self,
_provider_id: String,
_subject: String,
_code: String,
_redirect_path: String,
) -> String
fn exchange_code( &mut self, _provider_id: String, _subject: String, _code: String, _redirect_path: String, ) -> String
Exchange an authorization code for a token set.
Not yet implemented in the design-extension runtime — returns an empty string. Code exchange is handled by the OAuth broker service directly; this stub satisfies the WIT interface contract.
Source§impl WasiView for HostState
Implement WasiView so that wasmtime_wasi::p2::add_to_linker_sync can wire
WASI host functions. cargo-component adds WASI imports to every component it
builds, even if the Rust source never calls them.
impl WasiView for HostState
Implement WasiView so that wasmtime_wasi::p2::add_to_linker_sync can wire
WASI host functions. cargo-component adds WASI imports to every component it
builds, even if the Rust source never calls them.
Source§fn ctx(&mut self) -> WasiCtxView<'_>
fn ctx(&mut self) -> WasiCtxView<'_>
WasiCtx configuration used for this
context.Auto Trait Implementations§
impl !Freeze for HostState
impl !RefUnwindSafe for HostState
impl !Sync for HostState
impl !UnwindSafe for HostState
impl Send for HostState
impl Unpin for HostState
impl UnsafeUnpin for HostState
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> 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