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/// The workflow list contract: filter, sort, request, page.
44pub mod listing;
45/// Type-erased payload bytes with explicit content-type metadata.
46pub mod payload;
47/// Schedule configuration, trigger, and catch-up policy models.
48pub mod schedule;
49/// Search-attribute schemas and values used by visibility queries.
50pub mod search;
51/// Workflow lifecycle status derivation.
52pub mod status;
53/// Workloop vocabulary: arming, invariants, tolerance, health, alarms, hatch identity.
54pub mod workloop;
55
56pub use activity_event::{ActivityEvent, ActivityEventKind, MessageRole, ProgressDetail, StopKind};
57pub use agent_outcome::{AgentOutcome, AgentOutcomeError};
58pub use cluster_event::{
59    ClusterCommand, ClusterDeployment, ClusterEvent, ClusterEventMeta, ClusterPeer, ClusterShard,
60    ClusterSnapshot, ClusterStreamError, ClusterWorker, DeploymentAssociation, DesiredState,
61    NamespacePlacementWire, PutOutcome, WorkerDeathReason, WorkerTransport,
62};
63pub use current_step::{current_step, open_steps};
64pub use describe::{DescribeWorkflowResponse, RunGeneration, UnservedActivity};
65pub use describe_live::{
66    AttemptLiveness, CurrentStep, DescribeLiveResponse, HeartbeatNote, LiveAttempt, OpenStep,
67    StepState, TranscriptStreamHead, TranscriptTail,
68};
69pub use error::{ActivityError, ActivityErrorKind, WorkflowError};
70pub use event::{
71    DEFAULT_TASK_QUEUE, DISPLAY_NAME_ATTRIBUTE, Event, EventEnvelope,
72    START_TIME_TASK_QUEUE_ATTRIBUTE, TimerCancelCause, WithTimeoutOutcome, display_name,
73    display_name_from_attributes, start_time_task_queue,
74};
75pub use filter::{WorkflowFilter, WorkflowSummary, failure_projection};
76pub use ids::{ActivityId, IdError, PackageVersion, RunId, TimerId, TimerIdKind, WorkflowId};
77pub use intervention::{
78    ApprovalDecision, InjectPriority, InterventionCapabilities, InterventionCommand,
79    InterventionKind, InterventionOutcome, InterventionPrimitive,
80};
81pub use listing::{
82    DEFAULT_NAMESPACE, INTERNAL_WORKFLOW_TYPES, NAMESPACE_ATTRIBUTE, SortDirection, WorkflowKind,
83    WorkflowListFilter, WorkflowListPage, WorkflowListRequest, WorkflowSort, WorkflowSortField,
84    is_internal_workflow_type, namespace_from_attributes,
85};
86pub use payload::{ContentType, Payload, PayloadElision, PayloadError};
87pub use schedule::{CatchUpPolicy, OverlapPolicy, ScheduleConfig, ScheduleId, TriggerSpec};
88pub use search::{
89    SearchAttributeError, SearchAttributeSchema, SearchAttributeType, SearchAttributeValue,
90    search_attributes_from_events,
91};
92pub use status::{WorkflowStatus, current_lease_terminal, run_segment, status_from_events};
93pub use workloop::{
94    AlarmCause, CarryContract, HealthSample, HealthStatus, InvariantAlarm, InvariantSpec,
95    ToleranceSpec, WORKFLOW_KIND_ATTRIBUTE, WORKLOOP_KIND, WorkloopArming, WorkloopSpec,
96    WorkloopSpecError, hatch_workflow_id, workflow_kind, workflow_kind_from_attributes,
97};