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/// The emitted form of an AWL `command` declaration and its one render.
38pub mod declared_command;
39/// Package validation and archive-loading errors.
40pub mod error;
41/// Explicit inflate budgets for archive extraction.
42pub mod extraction;
43/// Stable content-hash calculation for package contents.
44pub mod hash;
45/// Manifest structures and format-version constants.
46pub mod manifest;
47/// Deployment namespace helpers for compiled module names.
48pub mod namespace;
49/// Validated in-memory package loading and accessors.
50pub mod package;
51/// Project-level packaging driven by `workflow.toml` descriptors.
52pub mod project;
53/// Workflow primitive-structure projection: the graph model and bounded
54/// Gleam regeneration (a projection of the typed source, never authoritative).
55pub mod structure;
56/// Workflow version identifiers derived from package content.
57pub mod version;
58
59pub use admission::{
60    AdmissionError, UnenforceableSchema, admit_value, declares_nothing, schema_is_usable,
61};
62pub use awl::AwlSource;
63pub use beam::{BeamModule, BeamSet, RESERVED_MODULE_NAMES};
64pub use builder::PackageBuilder;
65pub use canonical::{CanonicalJson, serialize_value, sorted_entries};
66pub use codegen::{
67    ActivityArtifact, ActivityDeclaration, ActivityReport, AionDependency, AwlScaffoldError,
68    AwlWorkerScaffold, BoundaryType, CodecReport, CodegenError, CodegenMode, Connection,
69    ConnectionPlan, DocumentRoot, FileOwnership, ScaffoldedFile, SchemaEmitReport, ServableAction,
70    TestScaffoldReport, Tier, WorkerScaffold, boundary_types_from_interface, build_input_skeleton,
71    emit_schemas, emit_shell_manifest, generate_activities, generate_codecs,
72    generate_test_scaffold, parse_declarations, scaffold_awl_worker,
73};
74pub use compatibility::{ContractDiff, contract_diffs};
75pub use contract::{
76    ActionBodyContract, ActionContract, ActivityDescriptor, AdditionalWorkflowContract,
77    CarryContract, ChildContract, CommandBodyCapture, ContractIdentityError, DetachedContract,
78    InvariantContract, PackageContract, ReportContract, RetryContract, SignalContract,
79    ToleranceContract, WorkerContract, WorkloopContract,
80};
81pub use declared_command::{
82    ArgumentValue, ArgvSlot, CommandParameterContract, DeclaredCommandContract,
83    END_OF_OPTIONS_MARKER, EnvBindingContract, FillPiece, FillTemplate, RenderError,
84    RenderedCommand,
85};
86pub use error::PackageError;
87pub use extraction::ExtractionLimits;
88pub use hash::{
89    ContentHash, content_hash, content_hash_with_contract, content_hash_with_timeout,
90    content_hash_with_timeouts,
91};
92pub use manifest::{
93    CURRENT_FORMAT_VERSION, DeclaredActivity, Manifest, ManifestDigest, ManifestVersion,
94    WorkflowEntry,
95};
96pub use namespace::{
97    DEPLOYED_NAME_SEPARATOR, NamespaceError, ParsedDeployedName, deployed_name, deployed_names,
98    parse_deployed_name,
99};
100pub use package::Package;
101pub use project::{
102    ExcludedModule, ExcludedReason, PackageOptions, PackagedWorkflow, PackagingError,
103    ProjectReport, package_project,
104};
105pub use structure::{
106    ArmLabel, CorrelationKey, DeterminismError, EdgeKind, FactsError, GraphEdge, GraphNode, NodeId,
107    NodePrimitive, StructuralDelta, StructureError, Violation, ViolationKind, WorkflowFacts,
108    WorkflowGraph, analyze_determinism, extract_structure, extract_workflow_facts,
109    regenerate_gleam,
110};
111pub use version::WorkflowVersion;