Skip to main content

af_workflow/
lib.rs

1//! `af-workflow` — spec-driven workflow chassis.
2//!
3//! A workflow is typed node expressions composed into a branched DAG. Port of
4//! `agent_core/workflow`.
5//!
6//! - **Spec model** ([`Spec`], [`Branch`], [`Node`], [`Edge`]) — deserializes
7//!   existing Python builtin JSON specs unchanged.
8//! - **Runtime** — [`Event`] / [`StepResult`] / [`WorkflowContext`] / [`State`]
9//!   and the [`StepNode`] trait (one event in, one result out).
10//! - **Registry** ([`NodeRegistry`]) — maps node types to factories. Ships the
11//!   generic node types via [`NodeRegistry::with_builtins`]; products register
12//!   their own business types and side-effect guards.
13//! - **Durable host** ([`WorkflowHost`]) — validates and compiles a branch DAG;
14//!   claimed work is scheduled only by [`run_due_pass`].
15
16#![deny(missing_docs)]
17#![deny(rustdoc::broken_intra_doc_links)]
18
19pub mod builtins;
20pub mod contract;
21pub mod event;
22mod executor;
23pub mod graph;
24pub mod host;
25pub mod ingress;
26pub mod metrics;
27pub mod node;
28pub mod provider;
29pub mod recorder;
30pub mod registry;
31pub mod result;
32pub mod spec;
33pub mod spec_driver;
34pub mod state;
35pub mod supervisor;
36pub mod template;
37pub mod validator;
38
39pub use contract::*;
40pub use event::Event;
41pub use executor::{CompileError, RunOutcome, Terminal};
42pub use graph::{
43    primitive_kind, render_graph, render_graph_json, GraphEdge, GraphNode, WorkflowGraph,
44};
45pub use host::{HostError, WorkflowHost, ROOT_BRANCH};
46pub use ingress::{
47    ingress_plans, next_cron_at, next_scheduled_at, schedule_decision, BranchIngressPlan,
48    ScheduleDecision,
49};
50pub use metrics::{Readiness, RuntimeMetrics};
51pub use node::{StepNode, WorkflowContext};
52pub use provider::{ProviderBlock, ProviderGate, ProviderLimits, ProviderPermit, WorkPriority};
53pub use recorder::{noop_recorder, NoopRecorder, RunHandle, RunRecorder, RunStatus, StepStatus};
54pub use registry::{FieldSpec, FieldType, NodeError, NodeRegistry, NodeSchema, StepFactory};
55/// Registrar a product fills in `Product::register_workflow`.
56pub type WorkflowRegistrar = NodeRegistry;
57pub use result::{PreparedAction, StepResult};
58pub use spec::{Branch, Edge, Node, Spec, SpecError};
59pub use spec_driver::SpecDriver;
60pub use state::{MemoryState, NamespacedState, State};
61pub use supervisor::{
62    run_due_pass, DriverRegistry, EvaluationOutcome, MemoryWorkQueue, SupervisorError,
63    SupervisorSettings, SupervisorStats, Wakeup, WorkDisposition, WorkItem, WorkQueue,
64    WorkflowDriver, WorkflowTransitionCommand,
65};
66pub use template::{resolve_config, TemplateError};
67pub use validator::{validate, Violation};