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;
74mod cmd_sketch;
75#[cfg(feature = "automation")]
76mod cmd_shell;
77#[cfg(feature = "automation")]
78mod cmd_ui;
79#[cfg(feature = "automation")]
80mod cmd_ecad;
81#[cfg(feature = "automation")]
82mod cmd_state;
83#[cfg(feature = "automation")]
84mod cmd_wire_harness;
85#[cfg(feature = "automation")]
86mod cmd_cam;
87mod cmd_exploded;
88mod cmd_instructions;
89mod cmd_instructions_motion;
90mod cmd_simulation;
91mod cmd_simulation_play;
92mod cmd_cam_sim;
93#[cfg(all(feature = "automation", not(target_arch = "wasm32")))]
94mod cmd_plm;
95#[cfg(all(feature = "automation", not(target_arch = "wasm32")))]
96mod cmd_kicad;
97
98/// How a host builds the app. `store: None` = the default store (the user's
99/// own config directory); a host MUST pass an isolated store.
100/// `seed: false` starts on an empty document instead of the seed model.
101pub struct AppOptions {
102    pub store: Option<Box<dyn crate::store::ModelStore>>,
103    pub seed: bool,
104}
105
106impl Default for AppOptions {
107    fn default() -> Self {
108        Self { store: None, seed: true }
109    }
110}
111
112#[cfg(feature = "automation")]
113mod cmd_plugins;
114mod plugin_output_schema;
115
116#[cfg(feature = "automation")]
117mod catalogue_output_schema;
118
119#[cfg(feature = "automation")]
120mod pmi_output_schema;
121
122#[cfg(feature = "automation")]
123mod diagnostic_output_schema;
124
125#[cfg(feature = "automation")]
126mod sheet_output_schema;
127
128#[cfg(feature = "automation")]
129mod cam_sim_output_schema;
130
131#[cfg(feature = "automation")]
132mod cam_tool_output_schema;
133
134#[cfg(feature = "automation")]
135mod cam_path_output_schema;
136
137#[cfg(feature = "automation")]
138mod cam_setup_output_schema;
139#[cfg(feature = "automation")]
140mod cam_autoprogram_output_schema;
141
142#[cfg(feature = "automation")]
143mod domain_output_schema;
144
145#[cfg(feature = "automation")]
146mod cam_state_output_schema;