Skip to main content

Crate aion_toolchain

Crate aion_toolchain 

Source
Expand description

Server-side Gleam authoring toolchain.

This crate turns a running Aion engine into a Gleam authoring loop: it takes submitted workflow source, compiles and type-checks it, and — on success — packages a verified .aion archive ready to hot-load.

§No embedded compiler (CN7 / C12 / C15)

The toolchain embeds no Gleam compiler. It only ever spawns the external gleam binary (the caller supplies its path) and captures the compiler’s output. Its entire dependency set is aion_package (the .aion format) plus thiserror; there is no Gleam compiler crate and no beamr in the tree. The no_gleam_compiler_in_dependency_tree integration test asserts this guarantee mechanically. Without the toolchain there is no way to compile Gleam on the server, which is exactly why the server-side authoring endpoints are gated on an explicit gleam_path.

§Per-submission isolation

compile_source treats the configured project root as a read-only template: each call stages its own throwaway working copy (a workspace::Workspace), writes and builds entirely within it, and removes it on drop. Concurrent submissions never share an entry-file, a build/ directory, or a .aion output — no global lock and no pool-size cap.

§Blocking

compile_source is synchronous and blocks on staging the working copy, gleam build, and packaging, all of which can run for seconds. Async callers MUST wrap it in a blocking task (for example tokio::task::spawn_blocking).

Re-exports§

pub use compile::CompileRequest;
pub use compile::CompiledWorkflow;
pub use compile::build_project;
pub use compile::compile_source;
pub use compile::compile_source_for_entry;
pub use error::ToolchainError;
pub use workspace::Workspace;

Modules§

compile
Core compile/type-check/package loop over the external gleam binary. Core authoring compile loop: stage an isolated working copy of the project template, write the submitted source into it, run gleam build there, and package on success.
error
Toolchain error taxonomy. Error taxonomy for the Gleam authoring toolchain.
gleam_failure
Which layer of gleam refused a build — its dependency layer, or the sources it was given. Which layer of gleam refused a build: its own dependency layer, or the sources it was given.
project
Project-root validation and entry-module source resolution. Project-root helpers for the authoring toolchain.
workspace
Per-submission isolated build workspace (RAII working copy of the template). Per-submission isolated build workspace.