Skip to main content

aion_package/
lib.rs

1//! Archive validation, content hashing, and namespacing for Aion packages.
2//!
3//! This crate loads `.aion` archives, validates manifests and BEAM entries,
4//! computes stable content hashes, and derives deployed module names for engine
5//! registration.
6//!
7//! # Example
8//!
9//! ```no_run
10//! use aion_package::{ExtractionLimits, Package};
11//!
12//! // Operator-local file: extraction may run unbounded. Network input must
13//! // use `ExtractionLimits::bounded` instead.
14//! let package = Package::load_from_path("workflow.aion", ExtractionLimits::unbounded())?;
15//! println!("entry module: {}", package.manifest().entry_module);
16//! # Ok::<(), Box<dyn std::error::Error>>(())
17//! ```
18
19/// Declared-contract admission of caller-supplied values at a boundary.
20pub mod admission;
21/// AWL document provenance carried by an archive.
22pub mod awl;
23/// Compiled BEAM module records extracted from packages.
24pub mod beam;
25/// Which `serde_json::Map` representation this build resolved, announced.
26mod build_coverage;
27/// Archive builder utilities for tests and packaging tools.
28pub mod builder;
29/// Canonical JSON text encoding for emitted artifacts.
30pub mod canonical;
31/// Gleam type and JSON codec generation from project schemas.
32pub mod codegen;
33/// Worker advertisement compatibility and field-level differences.
34pub mod compatibility;
35/// Durable worker-contract records and canonical identity encoding.
36pub mod contract;
37/// Package validation and archive-loading errors.
38pub mod error;
39/// Explicit inflate budgets for archive extraction.
40pub mod extraction;
41/// Stable content-hash calculation for package contents.
42pub mod hash;
43/// Manifest structures and format-version constants.
44pub mod manifest;
45/// Deployment namespace helpers for compiled module names.
46pub mod namespace;
47/// Validated in-memory package loading and accessors.
48pub mod package;
49/// Project-level packaging driven by `workflow.toml` descriptors.
50pub mod project;
51/// Workflow primitive-structure projection: the graph model and bounded
52/// Gleam regeneration (a projection of the typed source, never authoritative).
53pub mod structure;
54/// Workflow version identifiers derived from package content.
55pub mod version;
56
57pub use admission::{
58    AdmissionError, UnenforceableSchema, admit_value, declares_nothing, schema_is_usable,
59};
60pub use awl::AwlSource;
61pub use beam::{BeamModule, BeamSet, RESERVED_MODULE_NAMES};
62pub use builder::PackageBuilder;
63pub use canonical::{CanonicalJson, serialize_value, sorted_entries};
64pub use codegen::{
65    ActivityArtifact, ActivityDeclaration, ActivityReport, AionDependency, AwlScaffoldError,
66    AwlWorkerScaffold, BoundaryType, CodecReport, CodegenError, CodegenMode, Connection,
67    ConnectionPlan, DocumentRoot, FileOwnership, ScaffoldedFile, SchemaEmitReport, ServableAction,
68    TestScaffoldReport, Tier, WorkerScaffold, boundary_types_from_interface, build_input_skeleton,
69    emit_schemas, generate_activities, generate_codecs, generate_test_scaffold, parse_declarations,
70    scaffold_awl_worker,
71};
72pub use compatibility::{ContractDiff, contract_diffs};
73pub use contract::{
74    ActionBodyContract, ActionContract, ActivityDescriptor, AdditionalWorkflowContract,
75    ChildContract, ContractIdentityError, PackageContract, RetryContract, SignalContract,
76    WorkerContract,
77};
78pub use error::PackageError;
79pub use extraction::ExtractionLimits;
80pub use hash::{
81    ContentHash, content_hash, content_hash_with_contract, content_hash_with_timeout,
82    content_hash_with_timeouts,
83};
84pub use manifest::{
85    CURRENT_FORMAT_VERSION, DeclaredActivity, Manifest, ManifestDigest, ManifestVersion,
86    WorkflowEntry,
87};
88pub use namespace::{
89    DEPLOYED_NAME_SEPARATOR, NamespaceError, ParsedDeployedName, deployed_name, deployed_names,
90    parse_deployed_name,
91};
92pub use package::Package;
93pub use project::{
94    ExcludedModule, ExcludedReason, PackageOptions, PackagedWorkflow, PackagingError,
95    ProjectReport, package_project,
96};
97pub use structure::{
98    ArmLabel, CorrelationKey, DeterminismError, EdgeKind, FactsError, GraphEdge, GraphNode, NodeId,
99    NodePrimitive, StructuralDelta, StructureError, Violation, ViolationKind, WorkflowFacts,
100    WorkflowGraph, analyze_determinism, extract_structure, extract_workflow_facts,
101    regenerate_gleam,
102};
103pub use version::WorkflowVersion;