pub struct FlowEngine { /* private fields */ }Implementations§
Source§impl FlowEngine
impl FlowEngine
pub async fn new( packs: Vec<Arc<PackRuntime>>, config: Arc<HostConfig>, ) -> Result<FlowEngine, Error>
Sourcepub fn with_rollout_ids(self, rollout_ids: RolloutIds) -> FlowEngine
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.
Sourcepub fn rollout_ids(&self) -> &RolloutIds
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.
Sourcepub fn with_mcp_source(self, source: Option<Arc<McpToolSource>>) -> FlowEngine
pub fn with_mcp_source(self, source: Option<Arc<McpToolSource>>) -> FlowEngine
Use an MCP tool source the embedding host built, in place of the one
FlowEngine::new derives from the process-global GREENTIC_AW_*
environment.
Env can only ever name ONE tenant, so a host that serves many tenants
from one process cannot express its per-tenant catalog that way. Such a
host builds a source per tenant (see
greentic_aw_runtime::McpCallerIdentity) and injects it here.
None LEAVES THE ENV-DERIVED SOURCE IN PLACE rather than clearing it —
callers thread this straight through from a host that may not have one,
and the standalone runner must keep working off its environment. Use
GREENTIC_AW_MCP=0 to disable MCP outright.
Sourcepub fn with_mcp_secrets(
self,
secrets: Option<Arc<dyn SecretsManager>>,
) -> FlowEngine
pub fn with_mcp_secrets( self, secrets: Option<Arc<dyn SecretsManager>>, ) -> FlowEngine
Bind the host’s secrets manager for MCP credential resolution.
Same shape and same reason as with_mcp_source:
None leaves the env-derived behaviour alone, so a standalone runner is
unaffected.
Sourcepub fn set_cross_pack_resolver(&mut self, resolver: Arc<dyn CrossPackResolver>)
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).
Sourcepub fn set_remote_dispatch_handler(
&mut self,
handler: Arc<dyn RemoteDispatchHandler>,
)
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.
Sourcepub fn set_approval_dispatch_handler(
&mut self,
handler: Arc<dyn RemoteDispatchHandler>,
)
pub fn set_approval_dispatch_handler( &mut self, handler: Arc<dyn RemoteDispatchHandler>, )
Set the handler approval.call dispatches through in preference to
the shared remote-dispatch handler: the HTTP approval inbox
(runner::approval_http). Never consulted for any other runtime, and
never counted by Self::remote_dispatch_configured.
Sourcepub fn set_operala_node_handler(&mut self, handler: Arc<dyn OperalaNodeHandler>)
pub fn set_operala_node_handler(&mut self, handler: Arc<dyn OperalaNodeHandler>)
Set the handler that bridges operala.call flow nodes into an
in-process deep-worker runtime. Constructed by the runner binary
(runtime.rs, operala-in-process feature, unless
GREENTIC_OPERALA_DISPATCH=nats) so operala.call nodes run with no
NATS in that build. Mirrors set_agent_node_handler.
Sourcepub fn set_agent_node_handler(&mut self, handler: Arc<dyn AgentNodeHandler>)
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).
Sourcepub fn set_ext_artifact_port(&mut self, port: Option<Arc<dyn ArtifactPort>>)
pub fn set_ext_artifact_port(&mut self, port: Option<Arc<dyn ArtifactPort>>)
Set the artifact port media.create nodes store their file through.
Pass the same port the agent runtime receives, so a flow’s file and a
worker’s file land in the same store.
Sourcepub fn set_graph_node_handler(&mut self, handler: Arc<dyn GraphNodeHandler>)
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.
Sourcepub fn set_dw_agent_dispatch(&mut self, mode: DwAgentDispatch)
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 viaAgentNodeHandler. Zero configuration overhead; today’s behaviour. - [
DwAgentDispatch::Nats]: reroutes the node over the durable agentic NATS path (greentic.agentic.request.v1), identical to anagentic.callnode. Requiresset_remote_dispatch_handlerto also be set.
Called by runtime.rs when GREENTIC_AW_DISPATCH=nats.
pub async fn execute( &self, ctx: FlowContext<'_>, input: Value, ) -> Result<FlowExecution, Error>
Sourcepub async fn execute_from(
&self,
ctx: FlowContext<'_>,
input: Value,
entry_node: &str,
) -> Result<FlowExecution, Error>
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.
pub async fn resume( &self, ctx: FlowContext<'_>, snapshot: FlowSnapshot, input: Value, ) -> Result<FlowExecution, Error>
Sourcepub async fn resume_surfacing_failures(
&self,
ctx: FlowContext<'_>,
snapshot: FlowSnapshot,
input: Value,
) -> Result<FlowExecution, Error>
pub async fn resume_surfacing_failures( &self, ctx: FlowContext<'_>, snapshot: FlowSnapshot, input: Value, ) -> Result<FlowExecution, Error>
Self::resume for the top-level turn path. A resumed run whose failure
FOLLOWED an external effect of that same run (is_after_effects_failure)
is rendered as the same metadata-only envelope a fresh run gets, as an
Ok completed execution, so the caller clears the park exactly as it
does for any completed turn; returning Err would leave the snapshot in
place and the next message would resume it and repeat the effect. Every
other failure (deterministic pre-effect, transient pre-effect) is still
an Err and the park is kept, so a transient one can be retried.
Source§impl FlowEngine
impl FlowEngine
pub fn flows(&self) -> &[FlowDescriptor]
Sourcepub async fn flow_node_ids(&self, pack_id: &str, flow_id: &str) -> Vec<String>
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.
pub fn flow_by_key( &self, pack_id: &str, flow_id: &str, ) -> Option<&FlowDescriptor>
pub fn flow_by_type(&self, flow_type: &str) -> Option<&FlowDescriptor>
Sourcepub fn entry_flow_by_type(&self, flow_type: &str) -> Option<&FlowDescriptor>
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).
pub fn flow_by_id(&self, flow_id: &str) -> Option<&FlowDescriptor>
Auto Trait Implementations§
impl !Freeze for FlowEngine
impl !RefUnwindSafe for FlowEngine
impl !UnwindSafe for FlowEngine
impl Send for FlowEngine
impl Sync for FlowEngine
impl Unpin for FlowEngine
impl UnsafeUnpin for FlowEngine
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