brep_app/automation/mod.rs
1//! The automation layer — the one command channel the app exposes to a host
2//! (`brep-mcp` headless / window, or a dial-in adapter). Design record:
3//! `docs/developer/mcp-automation-build-spec.md` §3–§6 and Appendix A.
4//!
5//! Three registries live here; the engine's feature catalogue is the fourth:
6//! - [`command`] — every command registers a [`CommandSpec`] (name, group,
7//! doc, derived argument/result schemas, frame phase, annotations, handler)
8//! in its module's `COMMANDS` static; [`command::registry`] gathers them.
9//! A host reads the registry and generates its tool list; nothing lists
10//! commands by hand.
11//! - [`registry`] — the state registry: the JSON blobs the app publishes each
12//! frame (`__brep*`), with a doc string and, where the blob is typed, a
13//! schema. Always compiled; on wasm it also mirrors to `window.*`.
14//! - [`hit_keys`] — the widget hit-key docs each panel registers beside its
15//! hit-rect publisher.
16//!
17//! [`queue::AutomationQueue`] is the channel: a host submits an [`command::Envelope`]
18//! and gets a [`command::Reply`]; the app drains the queue at three fixed
19//! points in the frame (§4.4) — `raw_input_hook` for input, the top of `ui`
20//! for mutations, the bottom of `ui` after the registry is rebuilt for reads.
21pub mod hit_keys;
22pub(crate) mod hit_rects;
23pub mod registry;
24
25/// Where the toolbar's Help button points: the generated help site `brep-docs`
26/// writes next to the served page. Declared here — outside the `automation`
27/// feature gate — so the button and the `help_open` command that presses it
28/// without a pointer read ONE literal.
29pub const HELP_URL: &str = "help/index.html";
30
31#[cfg(feature = "automation")]
32pub mod command;
33#[cfg(feature = "automation")]
34pub mod pointer;
35#[cfg(feature = "automation")]
36pub mod queue;
37
38#[cfg(feature = "automation")]
39mod cmd_assembly;
40#[cfg(feature = "automation")]
41mod cmd_camera;
42#[cfg(feature = "automation")]
43pub mod cmd_capture;
44#[cfg(feature = "automation")]
45mod cmd_document;
46#[cfg(feature = "automation")]
47mod cmd_frame;
48#[cfg(feature = "automation")]
49mod cmd_history;
50#[cfg(feature = "automation")]
51mod cmd_input;
52#[cfg(feature = "automation")]
53mod cmd_metadata;
54#[cfg(feature = "automation")]
55mod cmd_pmi;
56#[cfg(feature = "automation")]
57mod cmd_scene;
58#[cfg(feature = "automation")]
59mod cmd_settings;
60#[cfg(feature = "automation")]
61mod cmd_shell;
62#[cfg(feature = "automation")]
63mod cmd_state;
64#[cfg(feature = "automation")]
65mod cmd_wire_harness;
66
67/// How a host builds the app. `store: None` = the default store (the user's
68/// own config directory); a host MUST pass an isolated store (spec §8).
69/// `seed: false` starts on an empty document instead of the seed model.
70pub struct AppOptions {
71 pub store: Option<Box<dyn crate::store::ModelStore>>,
72 pub seed: bool,
73}
74
75impl Default for AppOptions {
76 fn default() -> Self {
77 Self { store: None, seed: true }
78 }
79}