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/// Describe-workflow response projection (summary + event history).
24pub mod describe;
25/// Error types shared by workflow engines, callers, and activities.
26pub mod error;
27/// Durable workflow history events and envelopes.
28pub mod event;
29/// Workflow visibility filters and summaries.
30pub mod filter;
31#[cfg(test)]
32mod generated_types;
33/// Strongly typed identifiers for workflows, runs, activities, timers, and schedules.
34pub mod ids;
35/// Harness-neutral mid-run intervention commands for the ops console control channel.
36pub mod intervention;
37/// Type-erased payload bytes with explicit content-type metadata.
38pub mod payload;
39/// Schedule configuration, trigger, and catch-up policy models.
40pub mod schedule;
41/// Search-attribute schemas and values used by visibility queries.
42pub mod search;
43/// Workflow lifecycle status derivation.
44pub mod status;
45
46pub use activity_event::{ActivityEvent, ActivityEventKind, MessageRole, ProgressDetail, StopKind};
47pub use cluster_event::{
48    ClusterCommand, ClusterEvent, ClusterEventMeta, ClusterPeer, ClusterShard, ClusterSnapshot,
49    ClusterStreamError, ClusterWorker, NamespacePlacementWire, WorkerDeathReason, WorkerTransport,
50};
51pub use describe::DescribeWorkflowResponse;
52pub use error::{ActivityError, ActivityErrorKind, WorkflowError};
53pub use event::{
54    DEFAULT_TASK_QUEUE, Event, EventEnvelope, START_TIME_TASK_QUEUE_ATTRIBUTE, TimerCancelCause,
55    WithTimeoutOutcome, start_time_task_queue,
56};
57pub use filter::{WorkflowFilter, WorkflowSummary, failure_projection};
58pub use ids::{ActivityId, IdError, PackageVersion, RunId, TimerId, TimerIdKind, WorkflowId};
59pub use intervention::{
60    ApprovalDecision, InjectPriority, InterventionCapabilities, InterventionCommand,
61    InterventionKind, InterventionOutcome, InterventionPrimitive,
62};
63pub use payload::{ContentType, Payload, PayloadError};
64pub use schedule::{CatchUpPolicy, OverlapPolicy, ScheduleConfig, ScheduleId, TriggerSpec};
65pub use search::{
66    SearchAttributeError, SearchAttributeSchema, SearchAttributeType, SearchAttributeValue,
67    search_attributes_from_events,
68};
69pub use status::{WorkflowStatus, current_lease_terminal, run_segment, status_from_events};