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