lattice_terminal/install.rs
1//! BC.4: the crate-owned `install(boot)` entry point.
2//!
3//! Terminal's only host-side boot *wiring* was its mode registration; this
4//! moves it into one Phase-B line (`lattice_terminal::install(&mut boot)`)
5//! against the generic [`SubsystemBoot`] surface, matching the claude-code
6//! shape (BC.3b).
7//!
8//! Two terminal touch-points intentionally stay host-side, and are *not*
9//! mode-ownership violations:
10//!
11//! - The `TerminalStoreHandle` service is a **host-published primitive** — the
12//! host's `BufferRegistry` exposed under `dyn TerminalStore` (the
13//! `impl TerminalStore for BufferRegistry` lives in `lattice-host`). It's the
14//! same category as `buffer_store` / `diagnostics`: the host owns the data,
15//! the terminal *mode* consumes it via `services.get`. The `SubsystemBoot`
16//! surface can't carry a terminal-specific type, so it stays host-registered
17//! until/unless terminal impls `TerminalStore` over `BufferStoreHandle`.
18//! - The `Editor`-coupled invocation runner (`Editor::run_terminal_invocation`)
19//! is the shared invocation-runner mechanism (Help / Oil / FileTree / Terminal
20//! all bind `Editor::run_*_invocation`); migrating it is a cross-cutting
21//! cleanup, not a terminal slice.
22
23use lattice_mode::SubsystemBoot;
24
25use crate::modes::register_terminal_modes;
26
27/// Wire the terminal subsystem into the editor at boot.
28pub fn install(boot: &mut impl SubsystemBoot) {
29 // Issue #40 / Terminal-mode T1: register `terminal-mode` (+ Normal / Insert)
30 // so option contributions (ReadOnly + NoFile) apply to Terminal buffers and
31 // each mode's `on_activate` installs its own keymap / handlers.
32 register_terminal_modes(boot.modes_mut());
33}