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/// Structured replace-exactly-once edits to an assistant session's shared
24/// document, and the one applier both the server and the projection call.
25pub mod assistant_document;
26/// The assistant-session vocabulary: identity, state, summaries, turn context,
27/// and the frames a session streams and stores.
28pub mod assistant_session;
29/// Cluster topology and ownership events for the ops console real-time channel (WS3).
30pub mod cluster_event;
31/// Which step a run is on, folded from its own history.
32pub mod current_step;
33/// Describe-workflow response projection (summary + event history).
34pub mod describe;
35/// The live describe projection: current step, attempt liveness, notes, transcript.
36pub mod describe_live;
37/// Error types shared by workflow engines, callers, and activities.
38pub mod error;
39/// Durable workflow history events and envelopes.
40pub mod event;
41/// Workflow visibility filters and summaries.
42pub mod filter;
43#[cfg(test)]
44mod generated_types;
45/// Strongly typed identifiers for workflows, runs, activities, timers, and schedules.
46pub mod ids;
47/// Harness-neutral mid-run intervention commands for the ops console control channel.
48pub mod intervention;
49/// Which worker holds a run\'s open attempts, folded from its own history.
50pub mod lease_projection;
51/// The workflow list contract: filter, sort, request, page.
52pub mod listing;
53/// Type-erased payload bytes with explicit content-type metadata.
54pub mod payload;
55/// What a read surface says about itself beside what it says about a run.
56pub mod provenance;
57/// Schedule configuration, trigger, and catch-up policy models.
58pub mod schedule;
59/// Search-attribute schemas and values used by visibility queries.
60pub mod search;
61/// Workflow lifecycle status derivation.
62pub mod status;
63pub mod worker_attribution;
64/// Workloop vocabulary: arming, invariants, tolerance, health, alarms, hatch identity.
65pub mod workloop;
66
67pub use activity_event::{ActivityEvent, ActivityEventKind, MessageRole, ProgressDetail, StopKind};
68pub use agent_outcome::{AgentOutcome, AgentOutcomeError};
69pub use assistant_document::{
70    AssistantDocumentEditError, AssistantDocumentEditOp, apply_document_edits,
71};
72pub use assistant_session::{
73    AssistantCommand, AssistantCommandInvocation, AssistantDocumentContext,
74    AssistantDocumentPosition, AssistantDocumentSelection, AssistantPermissionDecision,
75    AssistantSessionEvent, AssistantSessionFrame, AssistantSessionId, AssistantSessionIdError,
76    AssistantSessionProjection, AssistantSessionState, AssistantSessionSummary,
77    AssistantToolCallStatus, AssistantTurnContext, NO_SETTLING_RECORD, TITLE_CHARACTERS,
78};
79pub use cluster_event::{
80    ClusterCommand, ClusterDeployment, ClusterEvent, ClusterEventMeta, ClusterPeer, ClusterShard,
81    ClusterSnapshot, ClusterStreamError, ClusterWorker, DeploymentAssociation, DesiredState,
82    NamespacePlacementWire, PutOutcome, WorkerDeathReason, WorkerTransport,
83};
84pub use current_step::{current_step, open_steps};
85pub use describe::{DescribeWorkflowResponse, RunGeneration, UnservedActivity};
86pub use describe_live::{
87    AttemptLiveness, CurrentStep, DescribeLiveResponse, HeartbeatNote, LiveAttempt, OpenStep,
88    StepState, TranscriptStreamHead, TranscriptTail,
89};
90pub use error::{ActivityError, ActivityErrorKind, WorkflowError};
91pub use event::{
92    DEFAULT_TASK_QUEUE, DISPLAY_NAME_ATTRIBUTE, Event, EventEnvelope,
93    START_TIME_TASK_QUEUE_ATTRIBUTE, TimerCancelCause, WithTimeoutOutcome, display_name,
94    display_name_from_attributes, start_time_task_queue,
95};
96pub use filter::{WorkflowFilter, WorkflowSummary, failure_projection};
97pub use ids::{ActivityId, IdError, PackageVersion, RunId, TimerId, TimerIdKind, WorkflowId};
98pub use intervention::{
99    ApprovalDecision, InjectPriority, InterventionCapabilities, InterventionCommand,
100    InterventionKind, InterventionOutcome, InterventionPrimitive,
101};
102pub use lease_projection::{
103    LeaseRecording, OutstandingLease, apply_lease_transition, current_worker, lease_recording,
104    outstanding_leases,
105};
106pub use listing::{
107    DEFAULT_NAMESPACE, INTERNAL_WORKFLOW_TYPES, NAMESPACE_ATTRIBUTE, SortDirection, WorkflowKind,
108    WorkflowListFilter, WorkflowListPage, WorkflowListRequest, WorkflowSort, WorkflowSortField,
109    is_internal_workflow_type, namespace_from_attributes,
110};
111pub use payload::{ContentType, Payload, PayloadElision, PayloadError};
112pub use provenance::ReadProvenance;
113pub use schedule::{CatchUpPolicy, OverlapPolicy, ScheduleConfig, ScheduleId, TriggerSpec};
114pub use search::{
115    SearchAttributeError, SearchAttributeSchema, SearchAttributeType, SearchAttributeValue,
116    search_attributes_from_events,
117};
118pub use status::{WorkflowStatus, current_lease_terminal, run_segment, status_from_events};
119pub use worker_attribution::WorkerAttribution;
120pub use workloop::{
121    AlarmCause, CarryContract, HealthSample, HealthStatus, InvariantAlarm, InvariantSpec,
122    ToleranceSpec, WORKFLOW_KIND_ATTRIBUTE, WORKLOOP_KIND, WorkloopArming, WorkloopSpec,
123    WorkloopSpecError, hatch_workflow_id, workflow_kind, workflow_kind_from_attributes,
124};