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`](crate::automation::command::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;
23pub mod state_blobs;
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;
40mod assembly_output_schema;
41// The output-schema vocabulary (U4d); some helpers only serve automation-gated schemas.
42#[cfg_attr(not(feature = "automation"), allow(dead_code))]
43mod schema_dsl;
44#[cfg(feature = "automation")]
45mod cmd_classes;
46mod cmd_files;
47#[cfg(feature = "automation")]
48mod cmd_camera;
49#[cfg(feature = "automation")]
50pub mod cmd_capture;
51#[cfg(feature = "automation")]
52mod cmd_document;
53#[cfg(feature = "automation")]
54mod cmd_frame;
55#[cfg(feature = "automation")]
56mod cmd_history;
57#[cfg(feature = "automation")]
58mod cmd_input;
59#[cfg(feature = "automation")]
60mod cmd_metadata;
61#[cfg(feature = "automation")]
62mod cmd_perf;
63#[cfg(feature = "automation")]
64mod cmd_pmi;
65#[cfg(feature = "automation")]
66mod cmd_scene;
67#[cfg(feature = "automation")]
68mod cmd_sheets;
69#[cfg(feature = "automation")]
70mod cmd_settings;
71#[cfg(feature = "automation")]
72mod cmd_shell;
73#[cfg(feature = "automation")]
74mod cmd_ecad;
75#[cfg(feature = "automation")]
76mod cmd_state;
77#[cfg(feature = "automation")]
78mod cmd_wire_harness;
79#[cfg(feature = "automation")]
80mod cmd_cam;
81mod cmd_exploded;
82mod cmd_instructions;
83mod cmd_instructions_motion;
84mod cmd_simulation;
85mod cmd_simulation_play;
86mod cmd_cam_sim;
87#[cfg(all(feature = "automation", not(target_arch = "wasm32")))]
88mod cmd_plm;
89#[cfg(all(feature = "automation", not(target_arch = "wasm32")))]
90mod cmd_kicad;
91
92/// How a host builds the app. `store: None` = the default store (the user's
93/// own config directory); a host MUST pass an isolated store. `seed: false`
94/// starts on an empty document instead of the seed model.
95pub struct AppOptions {
96    pub store: Option<Box<dyn crate::store::ModelStore>>,
97    pub seed: bool,
98}
99
100impl Default for AppOptions {
101    fn default() -> Self {
102        Self { store: None, seed: true }
103    }
104}
105
106#[cfg(feature = "automation")]
107mod cmd_plugins;
108mod plugin_output_schema;
109
110#[cfg(feature = "automation")]
111mod catalogue_output_schema;
112
113#[cfg(feature = "automation")]
114mod pmi_output_schema;
115
116#[cfg(feature = "automation")]
117mod diagnostic_output_schema;
118
119#[cfg(feature = "automation")]
120mod sheet_output_schema;
121
122#[cfg(feature = "automation")]
123mod cam_sim_output_schema;
124
125#[cfg(feature = "automation")]
126mod cam_tool_output_schema;
127
128#[cfg(feature = "automation")]
129mod cam_path_output_schema;
130
131#[cfg(feature = "automation")]
132mod cam_setup_output_schema;
133#[cfg(feature = "automation")]
134mod cam_autoprogram_output_schema;
135
136#[cfg(feature = "automation")]
137mod domain_output_schema;
138
139#[cfg(feature = "automation")]
140mod cam_state_output_schema;