Skip to main content

FlowEngine

Struct FlowEngine 

Source
pub struct FlowEngine { /* private fields */ }

Implementations§

Source§

impl FlowEngine

Source

pub async fn new( packs: Vec<Arc<PackRuntime>>, config: Arc<HostConfig>, ) -> Result<FlowEngine, Error>

Source

pub fn with_rollout_ids(self, rollout_ids: RolloutIds) -> FlowEngine

Bind the rollout identifiers of the revision-keyed runtime this engine serves, so every invocation’s telemetry carries deployment/bundle/ revision attribution (C5.4). Called by the Phase-D revision dispatcher when it constructs a revision runtime; tenant-only runtimes leave the default (empty) IDs.

Source

pub fn rollout_ids(&self) -> &RolloutIds

The rollout identifiers bound to this engine (read counterpart to with_rollout_ids). Empty by default for the legacy tenant-only path.

Source

pub fn set_cross_pack_resolver(&mut self, resolver: Arc<dyn CrossPackResolver>)

Set an optional cross-pack resolver for provider.invoke nodes that reference providers in other packs (resolved via capability registry).

Source

pub fn set_remote_dispatch_handler( &mut self, handler: Arc<dyn RemoteDispatchHandler>, )

Set the handler that bridges sorla.call flow nodes into a separate runtime over pub/sub. Constructed by the runner binary when a transport (e.g. NATS) is configured.

Source

pub fn set_agent_node_handler(&mut self, handler: Arc<dyn AgentNodeHandler>)

Set the handler that bridges DwAgent flow nodes into the agentic-worker runtime. Constructed by the runner binary (Task 4.3).

Source

pub fn set_graph_node_handler(&mut self, handler: Arc<dyn GraphNodeHandler>)

Set the handler that bridges DwAgentGraph flow nodes into the durable graph executor. Constructed by the pack loader (Task 8). Mirrors set_agent_node_handler.

Source

pub fn set_dw_agent_dispatch(&mut self, mode: DwAgentDispatch)

Set the dispatch mode for dw.agent nodes.

  • [DwAgentDispatch::InProcess] (default): runs the agent in-process via AgentNodeHandler. Zero configuration overhead; today’s behaviour.
  • [DwAgentDispatch::Nats]: reroutes the node over the durable agentic NATS path (greentic.agentic.request.v1), identical to an agentic.call node. Requires set_remote_dispatch_handler to also be set.

Called by runtime.rs when GREENTIC_AW_DISPATCH=nats.

Source

pub async fn execute( &self, ctx: FlowContext<'_>, input: Value, ) -> Result<FlowExecution, Error>

Source

pub async fn execute_from( &self, ctx: FlowContext<'_>, input: Value, entry_node: &str, ) -> Result<FlowExecution, Error>

Execute a flow whose cursor starts at entry_node instead of the flow’s declared entrypoint.

Card-driven messaging packs carry the id of the next node to run on the inbound activity (the designer emits it as nextCardId). A host that can only call FlowEngine::execute restarts such a flow at its entrypoint on every turn, so the capture nodes chained between two cards never run.

Unlike FlowEngine::resume this needs no persisted FlowSnapshot: state starts fresh from input. That is what makes it usable for packs whose pause points are rendered cards rather than session.wait nodes — those never park, so they never leave a snapshot behind.

An entry_node that is not a node of the flow is a hard error. Falling back to the entrypoint would re-introduce the silent restart this exists to remove.

Source

pub async fn resume( &self, ctx: FlowContext<'_>, snapshot: FlowSnapshot, input: Value, ) -> Result<FlowExecution, Error>

Source§

impl FlowEngine

Source

pub fn flows(&self) -> &[FlowDescriptor]

Source

pub async fn flow_node_ids(&self, pack_id: &str, flow_id: &str) -> Vec<String>

Node ids declared by a flow, for callers that must tell a flow node apart from something else that shares the id space — a card asset, in the case of crate::runner::card_nav.

Loads the flow if it is not cached yet; an unloadable flow yields an empty list rather than an error, because the caller’s question (“is this a node?”) has a sound negative answer either way.

Source

pub fn flow_by_key( &self, pack_id: &str, flow_id: &str, ) -> Option<&FlowDescriptor>

Source

pub fn flow_by_type(&self, flow_type: &str) -> Option<&FlowDescriptor>

Source

pub fn entry_flow_by_type(&self, flow_type: &str) -> Option<&FlowDescriptor>

Resolve a flow by type, considering only application entrypoint flows.

Used to disambiguate an inbound provider event (routed by flow type, with no explicit pack_id/flow_id) when a pack registers one public entrypoint plus internal helper flows of the same type — the common “dispatcher + sub-flows” shape. Internal flows are only reachable via flow.call, so they must never win a type-only route.

Flows owned by a messaging provider pack (its manifest declares a messaging.* provider) are also excluded: a provider ships its own ingress main/default flow that is plumbing for that provider, not the application. In a multi-provider bundle that flow would otherwise compete with the app’s real entrypoint and make the route ambiguous.

Returns None when zero or more than one application entry flow of the type exists (genuinely ambiguous — the caller must then require a pack_id).

Source

pub fn flow_by_id(&self, flow_id: &str) -> Option<&FlowDescriptor>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Pointer = u32

Source§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more