layover_tower/lib.rs
1//! The supervisor: starting an agent CLI, watching it, and writing down what happened.
2//!
3//! # What lives here and what does not
4//!
5//! Everything in `layover-core` is a decision that can be checked without running anything —
6//! whether a route is permitted, whether an itinerary has Fuel left, what a run should be told.
7//! This crate is where those decisions meet an operating system, and it is the first place in the
8//! project that can do something irreversible.
9//!
10//! It deliberately decides nothing. Routing, accounting and prompt composition belong to
11//! `layover-core` and are already tested without a process in sight. What this adds is the part
12//! that cannot be tested that way: a child that writes to disk, spends money, and may not come
13//! back.
14//!
15//! # The order of operations is a safety property
16//!
17//! A run is recorded as started **before** the process is spawned, and the record carries the
18//! process identifier and the moment it began. That order is not an implementation detail:
19//!
20//! - A run that was alive when the supervisor died leaves no exit code. The only way to know it
21//! existed is to have written it down first.
22//! - A record written *after* spawning leaves a window in which a real process is running and
23//! nothing knows about it — exactly the window a crash falls into.
24//!
25//! Recovery needs to say "this was running, and it is confirmed gone". Both halves come from the
26//! record written before the spawn.
27
28pub mod barriers;
29pub mod clock;
30pub mod cost;
31pub mod dispatch;
32pub mod factory;
33pub mod runtime;
34pub mod spawn;
35pub mod state;
36pub mod tokens;
37pub mod wait;
38
39pub use barriers::{Abandoned, Barriers};
40pub use clock::{Clock, Due, Skipped};
41pub use cost::{Reported, from_transcript};
42pub use dispatch::{Authorised, Refusal, authorise};
43pub use factory::{Dispatched, Factory};
44pub use runtime::{Chains, FactoryRuntime, Wiring};
45pub use spawn::{Finished, Plan, SpawnError, Started, start};
46pub use state::{Ledger, Live, Verdict};
47pub use tokens::{ENDPOINT_VAR, TOKEN_VAR, Tokens, write_config};
48pub use wait::{Ended, kill_tree, wait_for};