Skip to main content

sim_lib_view_agent/
lib.rs

1//! Agent and topology composer lens plus the live monitor for the SIM Web-UI
2//! (WEBUI_4); the flagship that proves the one-bus thesis.
3//!
4//! The composer renders a `scene/graph` of agent nodes with typed ports, edges,
5//! and nested groups, and accepts create/move/wire/unwire/delete Intents. An
6//! agent on the runner can act as an operator on the same bus a human edits on,
7//! so an agent-issued Intent edits the same topology the human sees live. All
8//! state is backed by existing `sim-lib-topology` values; there is no second
9//! model.
10//!
11//! [`view`] encodes a topology `Graph` to a Scene, [`editor`] applies composer
12//! Intents through the topology patch engine, and [`persist`] saves and loads a
13//! topology as SIM data. [`mod@monitor`] and [`replay()`] make a run inspectable.
14//!
15//! # Example
16//!
17//! A topology `Graph` opens in the composer lens as a `scene/graph` value:
18//!
19//! ```
20//! use sim_lib_topology::Graph;
21//!
22//! let graph = Graph::minimal("demo");
23//! let scene = sim_lib_view_agent::composer_view(&graph);
24//! assert!(sim_lib_scene::validate_scene(&scene).is_ok());
25//! ```
26
27#![forbid(unsafe_code)]
28#![deny(missing_docs)]
29
30pub mod change_capsule;
31pub mod editor;
32pub mod mission_control;
33mod mission_control_fixture;
34pub mod monitor;
35pub mod persist;
36pub mod replay;
37pub mod run;
38pub mod view;
39
40pub use change_capsule::{
41    CHANGE_CAPSULE_LENS, CapsuleDiff, CapsuleFairnessFacet, CapsuleLog, CapsuleReplayEvent,
42    CapsuleReplaySummary, ChangeCapsuleViewState, GeneratedDocsSummary, PinPlanView,
43    change_capsule_replay_frames, change_capsule_view, fake_change_capsule_state,
44};
45pub use editor::apply_composer_intent;
46pub use mission_control::{
47    EvidenceEvent, ExplanationFacet, HumanGate, LeaseClaim, LeaseConflictCard,
48    MISSION_CONTROL_LENS, MissionCard, MissionControlIntent, MissionControlState, ValidationState,
49    evidence_from_dev_cassette, mission_control_intents, mission_control_replay_frames,
50    mission_control_view,
51};
52pub use mission_control_fixture::fake_mission_control_state;
53pub use monitor::{MONITOR_LENS, monitor_view, node_detail};
54pub use persist::{composer_load, composer_save};
55pub use replay::{replay, replay_final};
56pub use run::{NodeStatus, RunEvent, RunState};
57pub use view::{COMPOSER_LENS, composer_view};
58
59/// Embedded cookbook recipe books shipped with this library.
60pub static RECIPES: sim_cookbook::EmbeddedDir =
61    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
62
63#[cfg(test)]
64mod change_capsule_tests;
65#[cfg(test)]
66mod mission_control_tests;
67#[cfg(test)]
68mod monitor_tests;
69#[cfg(test)]
70mod tests;