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/// The one JSON codec for payload bytes: base64 string or integer array in, array out until the writer landing.
56pub mod payload_bytes;
57/// What a read surface says about itself beside what it says about a run.
58pub mod provenance;
59/// Schedule configuration, trigger, and catch-up policy models.
60pub mod schedule;
61/// Search-attribute schemas and values used by visibility queries.
62pub mod search;
63/// Workflow lifecycle status derivation.
64pub mod status;
65pub mod worker_attribution;
66/// Workloop vocabulary: arming, invariants, tolerance, health, alarms, hatch identity.
67pub mod workloop;
68
69pub use activity_event::{ActivityEvent, ActivityEventKind, MessageRole, ProgressDetail, StopKind};
70pub use agent_outcome::{AgentOutcome, AgentOutcomeError};
71pub use assistant_document::{
72    AssistantDocumentEditError, AssistantDocumentEditOp, apply_document_edits,
73};
74pub use assistant_session::{
75    AssistantCommand, AssistantCommandInvocation, AssistantConfigChoice, AssistantConfigOption,
76    AssistantConfigValue, AssistantDocumentContext, AssistantDocumentPosition,
77    AssistantDocumentSelection, AssistantPermissionDecision, AssistantSessionEvent,
78    AssistantSessionFrame, AssistantSessionId, AssistantSessionIdError, AssistantSessionProjection,
79    AssistantSessionState, AssistantSessionSummary, AssistantToolCallStatus, AssistantTurnContext,
80    NO_SETTLING_RECORD, TITLE_CHARACTERS,
81};
82pub use cluster_event::{
83    ClusterCommand, ClusterDeployment, ClusterEvent, ClusterEventMeta, ClusterPeer, ClusterShard,
84    ClusterSnapshot, ClusterStreamError, ClusterWorker, DeploymentAssociation, DesiredState,
85    NamespacePlacementWire, PutOutcome, WorkerDeathReason, WorkerTransport,
86};
87pub use current_step::{current_step, open_steps};
88pub use describe::{DescribeWorkflowResponse, RunGeneration, UnservedActivity};
89pub use describe_live::{
90    AttemptLiveness, CurrentStep, DescribeLiveResponse, HeartbeatNote, LiveAttempt, OpenStep,
91    StepState, TranscriptStreamHead, TranscriptTail,
92};
93pub use error::{ActivityError, ActivityErrorKind, WorkflowError};
94pub use event::{
95    DEFAULT_TASK_QUEUE, DISPLAY_NAME_ATTRIBUTE, Event, EventEnvelope,
96    START_TIME_TASK_QUEUE_ATTRIBUTE, TimerCancelCause, WithTimeoutOutcome, display_name,
97    display_name_from_attributes, start_time_task_queue,
98};
99pub use filter::{WorkflowFilter, WorkflowSummary, failure_projection};
100pub use ids::{ActivityId, IdError, PackageVersion, RunId, TimerId, TimerIdKind, WorkflowId};
101pub use intervention::{
102    ApprovalDecision, InjectPriority, InterventionCapabilities, InterventionCommand,
103    InterventionKind, InterventionOutcome, InterventionPrimitive,
104};
105pub use lease_projection::{
106    LeaseRecording, OutstandingLease, apply_lease_transition, current_worker, lease_recording,
107    outstanding_leases,
108};
109pub use listing::{
110    DEFAULT_NAMESPACE, INTERNAL_WORKFLOW_TYPES, NAMESPACE_ATTRIBUTE, SortDirection, WorkflowKind,
111    WorkflowListFilter, WorkflowListPage, WorkflowListRequest, WorkflowSort, WorkflowSortField,
112    is_internal_workflow_type, namespace_from_attributes,
113};
114pub use payload::{ContentType, Payload, PayloadElision, PayloadError};
115pub use provenance::ReadProvenance;
116pub use schedule::{CatchUpPolicy, OverlapPolicy, ScheduleConfig, ScheduleId, TriggerSpec};
117pub use search::{
118    SearchAttributeError, SearchAttributeSchema, SearchAttributeType, SearchAttributeValue,
119    search_attributes_from_events,
120};
121pub use status::{WorkflowStatus, current_lease_terminal, run_segment, status_from_events};
122pub use worker_attribution::WorkerAttribution;
123pub use workloop::{
124    AlarmCause, CarryContract, HealthSample, HealthStatus, InvariantAlarm, InvariantSpec,
125    ToleranceSpec, WORKFLOW_KIND_ATTRIBUTE, WORKLOOP_KIND, WorkloopArming, WorkloopSpec,
126    WorkloopSpecError, hatch_workflow_id, workflow_kind, workflow_kind_from_attributes,
127};