flybrain/services/flysim/crates/fly-session/src/lib.rs
acamilo f456fe9522 Merge main: the per-fly processes, the launcher and the thread budgets
Keep-both everywhere the two slices met. lib.rs takes both module sets.
AgentConfig keeps worker_threads and the sensor log; EnvironmentConfig
keeps worker_threads, the render delay and the render counter.
coordinator.rs keeps the two-stage resolution and its blame() beside the
media split of the Advance reply's attachments, and its imports take both.
harness.rs is main's launcher-based file with this slice's media
instrumentation re-applied on top.

The media instrumentation is shared memory, so it now follows the
launcher's own rule for the progress counter: sensor_log and renders
return None for a participant with a process of its own rather than a
misleading zero. The launcher carries the sensor log and the render
counter to a participant in this process and the render delay and the four
media faults on the command line to one in another process, where the
child builds its own log and counter.

The media path itself is mode-agnostic and is now tested as such: one
image per boundary, forwarded to every agent and published once, asserted
over the bus in all three execution modes, with the shared-memory
assertions made only where those participants live.
2026-09-22 16:07:30 +00:00

49 lines
1.9 KiB
Rust

//! `fly-session`: the lockstep session coordinator and a synthetic composition over Flybus.
//!
//! This crate is the SESSION-01 slice of the session-framework implementation guide: the
//! sequential transaction of [`step-v1`], driven over the [`flybus`] router, with small fake
//! workers standing in for a brain and an emulator.
//!
//! ```text
//! Coordinator ── Agent.Prepare ──> agent workers (fake model + fixed readout stub)
//! ── Environment.Advance ──> environment (a counter arena, no emulator)
//! ── task.evaluate_transition (once)
//! ── Agent.Commit ──> agent workers
//! ── committed snapshot ──> session.<id>.snapshots
//! ```
//!
//! Every arrow is a Flybus RPC to an incarnation-pinned service, with domain request ids and
//! the result caches of `ipc-v1` section 5 in front of every mutation. Nothing here contains a
//! public controller API, an implicit best-effort retry, a real emulator or a real brain.
//!
//! The domain types come from the CONTRACT-01 crate [`fly_session_types`]; [`types`] is a
//! facade over it plus the few session-side additions a coordinator needs.
//!
//! [`step-v1`]: https://example.invalid/step-v1
pub mod agent;
pub mod cli;
pub mod clock;
pub mod coordinator;
pub mod dedup;
pub mod environment;
pub mod harness;
pub mod launcher;
pub mod measure;
pub mod media;
pub mod metrics;
pub mod phase;
pub mod rpc;
pub mod task;
pub mod worker;
// CONTRACT-01 owns the domain types; `types` is a facade over its crate plus the few
// session-side additions a coordinator needs.
pub mod types;
pub use fly_session_types;
pub use coordinator::{
Coordinator, Deadlines, DispatchOrder, Injections, ResolutionEnd, SessionFailure, StepReport,
};
pub use launcher::{ExecutionMode, Launcher, ReapOutcome, ThreadBudget, Via};
pub use phase::{Phase, PhaseMachine};