Skip to main content

sim_lib_view_agent/
lib.rs

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