Skip to main content

aion_core/
lib.rs

1//! Pure domain model and shared vocabulary for Aion durable workflows.
2//!
3//! This leaf crate defines the stable identifiers, payload carrier, history events,
4//! workflow filters, schedule settings, search attributes, statuses, and error
5//! taxonomy used by every other Aion component.
6//!
7//! # Example
8//!
9//! ```
10//! use aion_core::{Payload, WorkflowId};
11//! use serde_json::json;
12//!
13//! let workflow_id = WorkflowId::new_v4();
14//! let payload = Payload::from_json(&json!({ "workflow_id": workflow_id.to_string() }))?;
15//! assert_eq!(payload.to_json()?["workflow_id"], workflow_id.to_string());
16//! # Ok::<(), Box<dyn std::error::Error>>(())
17//! ```
18
19/// Agent-observability transcript events for the ops console real-time channel.
20pub mod activity_event;
21/// Cluster topology and ownership events for the ops console real-time channel (WS3).
22pub mod cluster_event;
23/// Which step a run is on, folded from its own history.
24pub mod current_step;
25/// Describe-workflow response projection (summary + event history).
26pub mod describe;
27/// The live describe projection: current step, attempt liveness, notes, transcript.
28pub mod describe_live;
29/// Error types shared by workflow engines, callers, and activities.
30pub mod error;
31/// Durable workflow history events and envelopes.
32pub mod event;
33/// Workflow visibility filters and summaries.
34pub mod filter;
35#[cfg(test)]
36mod generated_types;
37/// Strongly typed identifiers for workflows, runs, activities, timers, and schedules.
38pub mod ids;
39/// Harness-neutral mid-run intervention commands for the ops console control channel.
40pub mod intervention;
41/// Type-erased payload bytes with explicit content-type metadata.
42pub mod payload;
43/// Schedule configuration, trigger, and catch-up policy models.
44pub mod schedule;
45/// Search-attribute schemas and values used by visibility queries.
46pub mod search;
47/// Workflow lifecycle status derivation.
48pub mod status;
49
50pub use activity_event::{ActivityEvent, ActivityEventKind, MessageRole, ProgressDetail, StopKind};
51pub use cluster_event::{
52    ClusterCommand, ClusterDeployment, ClusterEvent, ClusterEventMeta, ClusterPeer, ClusterShard,
53    ClusterSnapshot, ClusterStreamError, ClusterWorker, DeploymentAssociation, DesiredState,
54    NamespacePlacementWire, PutOutcome, WorkerDeathReason, WorkerTransport,
55};
56pub use current_step::{current_step, open_steps};
57pub use describe::{DescribeWorkflowResponse, UnservedActivity};
58pub use describe_live::{
59    AttemptLiveness, CurrentStep, DescribeLiveResponse, HeartbeatNote, LiveAttempt, OpenStep,
60    StepState, TranscriptStreamHead, TranscriptTail,
61};
62pub use error::{ActivityError, ActivityErrorKind, WorkflowError};
63pub use event::{
64    DEFAULT_TASK_QUEUE, Event, EventEnvelope, START_TIME_TASK_QUEUE_ATTRIBUTE, TimerCancelCause,
65    WithTimeoutOutcome, start_time_task_queue,
66};
67pub use filter::{WorkflowFilter, WorkflowSummary, failure_projection};
68pub use ids::{ActivityId, IdError, PackageVersion, RunId, TimerId, TimerIdKind, WorkflowId};
69pub use intervention::{
70    ApprovalDecision, InjectPriority, InterventionCapabilities, InterventionCommand,
71    InterventionKind, InterventionOutcome, InterventionPrimitive,
72};
73pub use payload::{ContentType, Payload, PayloadElision, PayloadError};
74pub use schedule::{CatchUpPolicy, OverlapPolicy, ScheduleConfig, ScheduleId, TriggerSpec};
75pub use search::{
76    SearchAttributeError, SearchAttributeSchema, SearchAttributeType, SearchAttributeValue,
77    search_attributes_from_events,
78};
79pub use status::{WorkflowStatus, current_lease_terminal, run_segment, status_from_events};