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