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, AssistantConfigChoice, AssistantConfigOption,
74    AssistantConfigValue, AssistantDocumentContext, AssistantDocumentPosition,
75    AssistantDocumentSelection, AssistantPermissionDecision, AssistantSessionEvent,
76    AssistantSessionFrame, AssistantSessionId, AssistantSessionIdError, AssistantSessionProjection,
77    AssistantSessionState, AssistantSessionSummary, AssistantToolCallStatus, AssistantTurnContext,
78    NO_SETTLING_RECORD, TITLE_CHARACTERS,
79};
80pub use cluster_event::{
81    ClusterCommand, ClusterDeployment, ClusterEvent, ClusterEventMeta, ClusterPeer, ClusterShard,
82    ClusterSnapshot, ClusterStreamError, ClusterWorker, DeploymentAssociation, DesiredState,
83    NamespacePlacementWire, PutOutcome, WorkerDeathReason, WorkerTransport,
84};
85pub use current_step::{current_step, open_steps};
86pub use describe::{DescribeWorkflowResponse, RunGeneration, UnservedActivity};
87pub use describe_live::{
88    AttemptLiveness, CurrentStep, DescribeLiveResponse, HeartbeatNote, LiveAttempt, OpenStep,
89    StepState, TranscriptStreamHead, TranscriptTail,
90};
91pub use error::{ActivityError, ActivityErrorKind, WorkflowError};
92pub use event::{
93    DEFAULT_TASK_QUEUE, DISPLAY_NAME_ATTRIBUTE, Event, EventEnvelope,
94    START_TIME_TASK_QUEUE_ATTRIBUTE, TimerCancelCause, WithTimeoutOutcome, display_name,
95    display_name_from_attributes, start_time_task_queue,
96};
97pub use filter::{WorkflowFilter, WorkflowSummary, failure_projection};
98pub use ids::{ActivityId, IdError, PackageVersion, RunId, TimerId, TimerIdKind, WorkflowId};
99pub use intervention::{
100    ApprovalDecision, InjectPriority, InterventionCapabilities, InterventionCommand,
101    InterventionKind, InterventionOutcome, InterventionPrimitive,
102};
103pub use lease_projection::{
104    LeaseRecording, OutstandingLease, apply_lease_transition, current_worker, lease_recording,
105    outstanding_leases,
106};
107pub use listing::{
108    DEFAULT_NAMESPACE, INTERNAL_WORKFLOW_TYPES, NAMESPACE_ATTRIBUTE, SortDirection, WorkflowKind,
109    WorkflowListFilter, WorkflowListPage, WorkflowListRequest, WorkflowSort, WorkflowSortField,
110    is_internal_workflow_type, namespace_from_attributes,
111};
112pub use payload::{ContentType, Payload, PayloadElision, PayloadError};
113pub use provenance::ReadProvenance;
114pub use schedule::{CatchUpPolicy, OverlapPolicy, ScheduleConfig, ScheduleId, TriggerSpec};
115pub use search::{
116    SearchAttributeError, SearchAttributeSchema, SearchAttributeType, SearchAttributeValue,
117    search_attributes_from_events,
118};
119pub use status::{WorkflowStatus, current_lease_terminal, run_segment, status_from_events};
120pub use worker_attribution::WorkerAttribution;
121pub use workloop::{
122    AlarmCause, CarryContract, HealthSample, HealthStatus, InvariantAlarm, InvariantSpec,
123    ToleranceSpec, WORKFLOW_KIND_ATTRIBUTE, WORKLOOP_KIND, WorkloopArming, WorkloopSpec,
124    WorkloopSpecError, hatch_workflow_id, workflow_kind, workflow_kind_from_attributes,
125};