Skip to main content

areev_run_core/
lib.rs

1//! # areev-run-core — the pure scheduler of `areev run`
2//!
3//! Sans-IO by construction (governed-agents proposal §4): this crate cannot
4//! observe the world. It exports [`step()`] — a pure function from
5//! `(plan, env, state, events)` to `(commands, state)` — and the vocabulary
6//! around it. The driver crate (`areev-run`) owns the store, the clock, the
7//! executors, and the journal; it materializes journal lookups into
8//! [`EventIn`]s and performs [`Command`]s. Replay IS this function: feed the
9//! journaled events back in and assert the same commands come out.
10//!
11//! Purity is enforced mechanically, not aspirationally: the dependency tree
12//! carries no clock/rand/net crate (CI checks `cargo tree`), and this
13//! crate's `clippy.toml` disallows `SystemTime::now`/`Instant::now`.
14//! Scheduler state uses `Vec`/`BTreeMap` exclusively — hash-iteration order
15//! is the classic silent replay-divergence source and has no business here.
16
17/// The scheduler's replay generation (#288).
18///
19/// Bumped EXACTLY when a change makes an existing journal replay differently
20/// — the #251 class, where 1.8.3's dotted-tool fix meant a run recorded by
21/// 1.8.2 no longer verifies and no fix was possible without keeping the
22/// defect alive behind a per-run epoch. A verifier holding such a run needs
23/// to be able to tell tampering from "written by an older scheduler", and
24/// the version string alone cannot say that: most releases change nothing
25/// here.
26///
27/// Every bump gets a CHANGELOG line. A run whose pinned epoch differs from
28/// this one is refused on `resume` (RUN-E026) and labelled — not silently
29/// accepted — on `verify`.
30pub const SCHEDULER_EPOCH: u32 = 1;
31
32pub mod cond;
33pub mod error;
34pub mod plan;
35pub mod state;
36pub mod step;
37pub mod types;
38
39pub use error::{BudgetAxis, Result, RunError};
40pub use plan::{PlanEdge, PlanGraph};
41pub use state::{
42    DecideInFlight, EdgeRes, FoldInFlight, NodeState, PendingAsk, Phase, SchedulerState, Spent,
43};
44pub use step::{
45    bound_tool_content, flow_key, step, DecideEnv, StepEnv, StepOutcome,
46    DEFAULT_MAX_EFFECTS_PER_ATTEMPT,
47};
48pub use types::{
49    Ask, Budgets, Command, DecisionRecord, EdgeOutcome, EffectKind, EffectOutcome, EventIn,
50    DynamicDispatch, DynamicTool, FailCause, FoldRecord, JournalKey, LlmNodeConfig, NodeExecutor,
51    OfferedTool, RunOutcome, DECIDE_TOOL,
52    DECIDE_URI, INBOX, PARKED_ASKS,
53};