pub struct EmbeddedHost { /* private fields */ }Expand description
The embedded WorldInterface host.
Owns the AQ engine, ContextStore, and ConnectorRegistry. Provides the full lifecycle API: flow submission, status queries, capability discovery, and single-op invocation.
Implementations§
Source§impl EmbeddedHost
impl EmbeddedHost
Sourcepub async fn start(
config: HostConfig,
registry: ConnectorRegistry,
) -> Result<Self, HostError>
pub async fn start( config: HostConfig, registry: ConnectorRegistry, ) -> Result<Self, HostError>
Start the host: validate config, bootstrap AQ engine, restore coordinator map, and launch the background tick loop.
Sourcepub async fn submit_flow(&self, spec: FlowSpec) -> Result<FlowRunId, HostError>
pub async fn submit_flow(&self, spec: FlowSpec) -> Result<FlowRunId, HostError>
Submit a FlowSpec for execution.
Validates, compiles, and submits the Coordinator task to AQ. Returns the FlowRunId for subsequent status queries.
Sourcepub async fn submit_flow_with_trigger_input(
&self,
spec: FlowSpec,
trigger_input: Value,
) -> Result<FlowRunId, HostError>
pub async fn submit_flow_with_trigger_input( &self, spec: FlowSpec, trigger_input: Value, ) -> Result<FlowRunId, HostError>
Submit a FlowSpec with trigger input data.
Like submit_flow, but additionally writes trigger_input to ContextStore
at (flow_run_id, TRIGGER_INPUT_NODE_ID) before submitting the Coordinator
task to AQ. This ensures trigger data is durably available before any step
can attempt to read it.
Sourcepub fn context_store(&self) -> &dyn ContextStore
pub fn context_store(&self) -> &dyn ContextStore
Access the shared ContextStore.
Used by the daemon for webhook registry persistence and trigger receipt storage. ContextStore operations are thread-safe.
Sourcepub fn store_trigger_receipt(
&self,
flow_run_id: FlowRunId,
receipt: &Value,
) -> Result<(), HostError>
pub fn store_trigger_receipt( &self, flow_run_id: FlowRunId, receipt: &Value, ) -> Result<(), HostError>
Store a trigger receipt in ContextStore globals.
Receipts are stored under receipt:trigger:<flow_run_id> for later retrieval.
Sourcepub async fn run_status(
&self,
flow_run_id: FlowRunId,
) -> Result<FlowRunStatus, HostError>
pub async fn run_status( &self, flow_run_id: FlowRunId, ) -> Result<FlowRunStatus, HostError>
Query the status of a flow run.
Sourcepub fn list_capabilities(&self) -> Vec<Descriptor>
pub fn list_capabilities(&self) -> Vec<Descriptor>
List all connector capabilities available in the registry.
Sourcepub fn describe(&self, connector_name: &str) -> Option<Descriptor>
pub fn describe(&self, connector_name: &str) -> Option<Descriptor>
Describe a specific connector by name.
Sourcepub async fn list_runs(&self) -> Result<Vec<FlowRunSummary>, HostError>
pub async fn list_runs(&self) -> Result<Vec<FlowRunSummary>, HostError>
List all known flow runs with summary status.
Returns a summary for each flow in the coordinator map. Terminal flows that have been pruned are not included.
Sourcepub async fn invoke_single(
&self,
connector_name: &str,
params: Value,
) -> Result<Value, HostError>
pub async fn invoke_single( &self, connector_name: &str, params: Value, ) -> Result<Value, HostError>
Invoke a single connector operation.
Creates an ephemeral 1-node FlowSpec and executes it through the full AQ path (never bypasses AQ — Invariant 1).
Sourcepub async fn shutdown(self) -> Result<(), HostError>
pub async fn shutdown(self) -> Result<(), HostError>
Shut down the host gracefully.
Stops the tick loop. In-flight handlers complete in background. On next restart, incomplete tasks are recovered from the WAL.
Sourcepub fn active_flow_count(&self) -> usize
pub fn active_flow_count(&self) -> usize
Count currently active (non-terminal) flow runs.
The coordinator map only contains non-terminal flows (pruned on completion), so its length is a good approximation of active flows.