Skip to main content

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