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#[cfg(feature = "automation")]
25pub mod actions;
26
27/// Where the toolbar's Help button points: the generated help site `brep-docs`
28/// writes next to the served page. Declared here — outside the `automation`
29/// feature gate — so the button and the `help_open` command that presses it
30/// without a pointer read ONE literal.
31pub const HELP_URL: &str = "help/index.html";
32
33#[cfg(feature = "automation")]
34pub mod command;
35#[cfg(feature = "automation")]
36pub mod pointer;
37#[cfg(feature = "automation")]
38pub mod queue;
39
40#[cfg(feature = "automation")]
41mod cmd_assembly;
42mod assembly_output_schema;
43// The output-schema vocabulary (U4d); some helpers only serve automation-gated schemas.
44#[cfg_attr(not(feature = "automation"), allow(dead_code))]
45mod schema_dsl;
46#[cfg(feature = "automation")]
47mod cmd_classes;
48mod cmd_files;
49mod cmd_import_preview;
50#[cfg(feature = "automation")]
51mod cmd_camera;
52#[cfg(feature = "automation")]
53pub mod cmd_capture;
54#[cfg(feature = "automation")]
55mod cmd_document;
56#[cfg(feature = "automation")]
57mod cmd_frame;
58#[cfg(feature = "automation")]
59mod cmd_history;
60#[cfg(feature = "automation")]
61mod cmd_input;
62#[cfg(feature = "automation")]
63mod cmd_metadata;
64#[cfg(feature = "automation")]
65mod cmd_perf;
66#[cfg(feature = "automation")]
67mod cmd_pmi;
68#[cfg(feature = "automation")]
69mod cmd_scene;
70#[cfg(feature = "automation")]
71mod cmd_sheets;
72#[cfg(feature = "automation")]
73mod cmd_settings;
74#[cfg(feature = "automation")]
75mod cmd_shell;
76#[cfg(feature = "automation")]
77mod cmd_ecad;
78#[cfg(feature = "automation")]
79mod cmd_state;
80#[cfg(feature = "automation")]
81mod cmd_wire_harness;
82#[cfg(feature = "automation")]
83mod cmd_cam;
84mod cmd_exploded;
85mod cmd_instructions;
86mod cmd_instructions_motion;
87mod cmd_simulation;
88mod cmd_simulation_play;
89mod cmd_cam_sim;
90#[cfg(all(feature = "automation", not(target_arch = "wasm32")))]
91mod cmd_plm;
92#[cfg(all(feature = "automation", not(target_arch = "wasm32")))]
93mod cmd_kicad;
94
95/// How a host builds the app. `store: None` = the default store (the user's
96/// own config directory); a host MUST pass an isolated store.
97/// `seed: false` starts on an empty document instead of the seed model.
98pub struct AppOptions {
99    pub store: Option<Box<dyn crate::store::ModelStore>>,
100    pub seed: bool,
101}
102
103impl Default for AppOptions {
104    fn default() -> Self {
105        Self { store: None, seed: true }
106    }
107}
108
109#[cfg(feature = "automation")]
110mod cmd_plugins;
111mod plugin_output_schema;
112
113#[cfg(feature = "automation")]
114mod catalogue_output_schema;
115
116#[cfg(feature = "automation")]
117mod pmi_output_schema;
118
119#[cfg(feature = "automation")]
120mod diagnostic_output_schema;
121
122#[cfg(feature = "automation")]
123mod sheet_output_schema;
124
125#[cfg(feature = "automation")]
126mod cam_sim_output_schema;
127
128#[cfg(feature = "automation")]
129mod cam_tool_output_schema;
130
131#[cfg(feature = "automation")]
132mod cam_path_output_schema;
133
134#[cfg(feature = "automation")]
135mod cam_setup_output_schema;
136#[cfg(feature = "automation")]
137mod cam_autoprogram_output_schema;
138
139#[cfg(feature = "automation")]
140mod domain_output_schema;
141
142#[cfg(feature = "automation")]
143mod cam_state_output_schema;