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/// The canonical agent-outcome record every harness emits from the seam.
22pub mod agent_outcome;
23/// Cluster topology and ownership events for the ops console real-time channel (WS3).
24pub mod cluster_event;
25/// Which step a run is on, folded from its own history.
26pub mod current_step;
27/// Describe-workflow response projection (summary + event history).
28pub mod describe;
29/// The live describe projection: current step, attempt liveness, notes, transcript.
30pub mod describe_live;
31/// Error types shared by workflow engines, callers, and activities.
32pub mod error;
33/// Durable workflow history events and envelopes.
34pub mod event;
35/// Workflow visibility filters and summaries.
36pub mod filter;
37#[cfg(test)]
38mod generated_types;
39/// Strongly typed identifiers for workflows, runs, activities, timers, and schedules.
40pub mod ids;
41/// Harness-neutral mid-run intervention commands for the ops console control channel.
42pub mod intervention;
43/// Type-erased payload bytes with explicit content-type metadata.
44pub mod payload;
45/// Schedule configuration, trigger, and catch-up policy models.
46pub mod schedule;
47/// Search-attribute schemas and values used by visibility queries.
48pub mod search;
49/// Workflow lifecycle status derivation.
50pub mod status;
51
52pub use activity_event::{ActivityEvent, ActivityEventKind, MessageRole, ProgressDetail, StopKind};
53pub use agent_outcome::{AgentOutcome, AgentOutcomeError};
54pub use cluster_event::{
55    ClusterCommand, ClusterDeployment, ClusterEvent, ClusterEventMeta, ClusterPeer, ClusterShard,
56    ClusterSnapshot, ClusterStreamError, ClusterWorker, DeploymentAssociation, DesiredState,
57    NamespacePlacementWire, PutOutcome, WorkerDeathReason, WorkerTransport,
58};
59pub use current_step::{current_step, open_steps};
60pub use describe::{DescribeWorkflowResponse, RunGeneration, UnservedActivity};
61pub use describe_live::{
62    AttemptLiveness, CurrentStep, DescribeLiveResponse, HeartbeatNote, LiveAttempt, OpenStep,
63    StepState, TranscriptStreamHead, TranscriptTail,
64};
65pub use error::{ActivityError, ActivityErrorKind, WorkflowError};
66pub use event::{
67    DEFAULT_TASK_QUEUE, DISPLAY_NAME_ATTRIBUTE, Event, EventEnvelope,
68    START_TIME_TASK_QUEUE_ATTRIBUTE, TimerCancelCause, WithTimeoutOutcome, display_name,
69    display_name_from_attributes, start_time_task_queue,
70};
71pub use filter::{WorkflowFilter, WorkflowSummary, failure_projection};
72pub use ids::{ActivityId, IdError, PackageVersion, RunId, TimerId, TimerIdKind, WorkflowId};
73pub use intervention::{
74    ApprovalDecision, InjectPriority, InterventionCapabilities, InterventionCommand,
75    InterventionKind, InterventionOutcome, InterventionPrimitive,
76};
77pub use payload::{ContentType, Payload, PayloadElision, PayloadError};
78pub use schedule::{CatchUpPolicy, OverlapPolicy, ScheduleConfig, ScheduleId, TriggerSpec};
79pub use search::{
80    SearchAttributeError, SearchAttributeSchema, SearchAttributeType, SearchAttributeValue,
81    search_attributes_from_events,
82};
83pub use status::{WorkflowStatus, current_lease_terminal, run_segment, status_from_events};