pub struct PackRuntime { /* private fields */ }Implementations§
Source§impl PackRuntime
impl PackRuntime
pub fn contains_component(&self, component_ref: &str) -> bool
Sourcepub fn state_store_handle(&self) -> Option<Arc<dyn StateStore>>
pub fn state_store_handle(&self) -> Option<Arc<dyn StateStore>>
Returns a clonable handle to the pack’s state store, when one is
configured. Used by the flow engine’s built-in state.get/state.set
operators which call into the same store that WASM components read
through their state.read/state.write host imports.
pub async fn load( path: impl AsRef<Path>, config: Arc<HostConfig>, mocks: Option<Arc<MockLayer>>, archive_source: Option<&Path>, session_store: Option<Arc<dyn SessionStore>>, state_store: Option<Arc<dyn StateStore>>, wasi_policy: Arc<RunnerWasiPolicy>, secrets: Arc<dyn SecretsManager>, oauth_config: Option<OAuthBrokerConfig>, verify_archive: bool, component_resolution: ComponentResolution, ) -> Result<PackRuntime, Error>
Sourcepub fn set_runtime_config_non_secret(
&mut self,
map: Option<Arc<BTreeMap<String, Value>>>,
)
pub fn set_runtime_config_non_secret( &mut self, map: Option<Arc<BTreeMap<String, Value>>>, )
Inject the pack-config.v1.non_secret map for this pack. Called by
the producer (greentic-start, C4.3) after loading the deployed
PackConfig. Passing None clears any previously-set map.
Sourcepub fn runtime_config_non_secret(&self) -> Option<&Arc<BTreeMap<String, Value>>>
pub fn runtime_config_non_secret(&self) -> Option<&Arc<BTreeMap<String, Value>>>
Read-only accessor for the injected pack-config.v1.non_secret map.
Used by the revision loader’s tests to assert producer plumbing.
Sourcepub fn set_runtime_refs(&mut self, injection: Option<RuntimeRefsInjection>)
pub fn set_runtime_refs(&mut self, injection: Option<RuntimeRefsInjection>)
Inject the pack-config.v1.runtime_refs channel (C5): per-pack
key → URI bindings plus the env-shared resolver. Called by
greentic-start after loading the deployed PackConfig. Passing
None clears any previously-set injection.
Sourcepub fn runtime_refs(&self) -> Option<&RuntimeRefsInjection>
pub fn runtime_refs(&self) -> Option<&RuntimeRefsInjection>
Read-only accessor for the injected runtime-refs channel. Used by the revision loader’s tests to assert producer plumbing.
pub async fn list_flows(&self) -> Result<Vec<FlowDescriptor>, Error>
pub async fn run_flow( &self, flow_id: &str, input: Value, ) -> Result<Value, Error>
pub async fn invoke_component( &self, component_ref: &str, ctx: ExecCtx, operation: &str, config_json: Option<String>, input_json: String, ) -> Result<Value, Error>
pub fn resolve_provider( &self, provider_id: Option<&str>, provider_type: Option<&str>, ) -> Result<ProviderBinding, Error>
pub async fn invoke_provider( &self, binding: &ProviderBinding, ctx: ExecCtx, op: &str, input_json: Vec<u8>, ) -> Result<Value, Error>
Sourcepub async fn invoke_identify_instance(
&self,
binding: &ProviderBinding,
payload: Vec<u8>,
) -> Result<IdentifyOutcome, Error>
pub async fn invoke_identify_instance( &self, binding: &ProviderBinding, payload: Vec<u8>, ) -> Result<IdentifyOutcome, Error>
Call the provider component’s identify-instance export
(greentic:provider-instance-identity@0.1.0) with the inbound
payload bytes. Returns an IdentifyOutcome — see the variant
docs for the per-case contract.
§Payload shape (M1 IID.4d wrapper)
payload is forwarded opaque to the component. The shape is set by
the caller; the M1 IID.4d wrapper convention from greentic-start
is {headers: [{name,value}], body: <parsed-or-null>} so providers
whose discriminator lives in HTTP headers (Telegram via
x-telegram-bot-api-secret-token) can identify the instance the
same call shape that body-based providers (Teams, Slack, Webex,
etc.) use. See the docstring on
greentic:provider-instance-identity/instance-identity-api.identify-instance
for the full contract; this host method does not parse or
validate the bytes.
§Host authority on identity probes
The linker registers the full host import surface (Wasmtime
validates all imports eagerly at instantiate_pre, not just
those reachable from the invoked export). The WASI sandbox is
locked down: no preopens, no env, no stdio. Deny-shim linker
handlers (trap on call, satisfy at link time) are a follow-up
in greentic-interfaces-wasmtime. See register_identity_probe.
Sourcepub async fn invoke_describe_identify_instance(
&self,
binding: &ProviderBinding,
) -> Result<Option<IdentifyInstanceHint>, Error>
pub async fn invoke_describe_identify_instance( &self, binding: &ProviderBinding, ) -> Result<Option<IdentifyInstanceHint>, Error>
Call the provider component’s describe-identify-instance export
(greentic:provider-instance-identity/instance-identity-describe@0.1.0)
and parse the returned JSON into an IdentifyInstanceHint.
Returns Ok(None) for every “no hint available” case: the
component does not export the describe world, the export returned
none, the returned bytes are not valid JSON, or the version
gate failed. The two malformed cases are warn-logged so a typo’d
hint surfaces in operator logs without blocking ingest. Component
traps and other infrastructure errors propagate as Err.
This is the uncached probe — see resolve_identify_hint for the
cached wrapper that callers SHOULD use on the inbound hot path.
Sourcepub async fn resolve_identify_hint(
&self,
binding: &ProviderBinding,
) -> Option<IdentifyInstanceHint>
pub async fn resolve_identify_hint( &self, binding: &ProviderBinding, ) -> Option<IdentifyInstanceHint>
Cached wrapper around invoke_describe_identify_instance. The
hint for a given binding.component_ref is invariant across
inbound requests within a revision (it is a function of the
component itself, not of the payload), so we probe lazily on
first ask and reuse thereafter. ArcSwap-driven revision swaps
allocate a fresh PackRuntime, naturally invalidating the cache.
Returns None when the component does not export the describe
world, when the probe returns no hint, or when the probe fails
(trap, timeout, instantiation error). Failures are warn-logged
and cached — the same trap is logged once per revision per
component, not per request.
Sourcepub async fn describe_identify_hints_by_provider_type(
&self,
provider_types: &[&str],
) -> Result<HashMap<String, Option<IdentifyInstanceHint>>, Error>
pub async fn describe_identify_hints_by_provider_type( &self, provider_types: &[&str], ) -> Result<HashMap<String, Option<IdentifyInstanceHint>>, Error>
Fan out resolve_identify_hint over each requested provider_type.
Result map is keyed by provider_type; None value means the
pack has no binding for that type OR the binding’s component does
not export the describe world (unhinted — caller forwards input
headers unfiltered for back-compat).
provider_id-collision errors from ProviderRegistry::resolve
against a provider_type query are propagated (M1.1 invariant
violation, malformed pack).
Fan out resolve_identify_hint across requested types. None value
means the pack has no binding for that type OR the binding’s component
does not export the describe world.
The per-binding loop is inlined (rather than factored into a shared
AsyncFnMut-based helper) deliberately: routing through an
AsyncFnMut closure destabilises HRTB Send inference for the
returned future, which propagates up to host-level fan-out APIs and
from there to downstream spawned-service consumers. See the
regression test identify_futures_are_send on the host.
Sourcepub async fn identify_endpoints_by_provider_type(
&self,
provider_types: &[&str],
payload: &[u8],
) -> Result<HashMap<String, IdentifyOutcome>, Error>
pub async fn identify_endpoints_by_provider_type( &self, provider_types: &[&str], payload: &[u8], ) -> Result<HashMap<String, IdentifyOutcome>, Error>
Unscoped legacy API: fan out invoke_identify_instance with the
caller-supplied opaque payload bytes forwarded verbatim. No
describe-identify-instance hint lookup, no per-provider header
scoping. New callers should use the _scoped sibling for
per-provider header allowlist scoping (Phase D).
Loop inlined for the same reason as
describe_identify_hints_by_provider_type.
Sourcepub async fn identify_endpoints_by_provider_type_scoped(
&self,
provider_types: &[&str],
headers: &[(String, String)],
body: &Value,
) -> Result<HashMap<String, IdentifyOutcome>, Error>
pub async fn identify_endpoints_by_provider_type_scoped( &self, provider_types: &[&str], headers: &[(String, String)], body: &Value, ) -> Result<HashMap<String, IdentifyOutcome>, Error>
Per-provider scoped variant of identify_endpoints_by_provider_type.
The wrapper payload is built per-binding from (headers, body) and
the component’s cached identify-instance hint (see
resolve_identify_hint): hinted providers see only the headers
their hint declares; unhinted providers see every header passed in.
Result-map semantics match the unscoped variant.
Loop inlined for the same reason as
describe_identify_hints_by_provider_type.
pub fn load_flow(&self, flow_id: &str) -> Result<Flow, Error>
pub fn metadata(&self) -> &PackMetadata
Sourcepub fn read_asset(&self, asset_path: &str) -> Result<Vec<u8>, Error>
pub fn read_asset(&self, asset_path: &str) -> Result<Vec<u8>, Error>
Read an asset file from the pack’s assets directory.
Accepts paths like assets/cards/card-a.json or cards/card-a.json
(the assets/ prefix is stripped automatically).
pub fn component_manifest( &self, component_ref: &str, ) -> Option<&ComponentManifest>
pub fn describe_component_contract_v0_6( &self, component_ref: &str, ) -> Result<Option<Value>, Error>
pub fn load_schema_json(&self, schema_ref: &str) -> Result<Option<Value>, Error>
pub fn required_secrets(&self) -> &[SecretRequirement]
pub fn missing_secrets(&self, tenant_ctx: &TenantCtx) -> Vec<SecretRequirement>
pub fn for_component_test( components: Vec<(String, PathBuf)>, flows: HashMap<String, FlowIR>, pack_id: &str, config: Arc<HostConfig>, ) -> Result<PackRuntime, Error>
Auto Trait Implementations§
impl !Freeze for PackRuntime
impl !RefUnwindSafe for PackRuntime
impl !UnwindSafe for PackRuntime
impl Send for PackRuntime
impl Sync for PackRuntime
impl Unpin for PackRuntime
impl UnsafeUnpin for PackRuntime
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request