lattice_ai/opencode/mod.rs
1//! `opencode` — lattice drives the opencode agent's **native TUI** in a
2//! terminal buffer (the v1 opencode integration).
3//!
4//! `:opencode` spawns the `opencode` TUI (via [`Effect::SpawnTerminal`]) and
5//! activates [`OpencodeMode`] — a minor mode over `terminal-mode` that is the
6//! seam for future lattice-native integration. The full opencode UX (readline,
7//! `/` commands, model switching, history, and its own diff review) comes from
8//! opencode's real TUI running in the PTY, so lattice reimplements none of it.
9//!
10//! This is the **terminal topology** (like the MCP / Claude Code peer): the
11//! agent runs in a terminal buffer and lattice layers integration via a minor
12//! mode. Contrast [`super::acp`], which drives `opencode acp` *headlessly* and
13//! owns the conversation as a buffer — kept for the future IDE-native-review
14//! direction, reachable via `:opencode-acp`. See
15//! `docs/dev/architecture/agent-integration.md`.
16//!
17//! [`Effect::SpawnTerminal`]: lattice_grammar::effect::Effect::SpawnTerminal
18
19pub mod commands;
20pub mod modes;
21
22use lattice_mode::SubsystemBoot;
23
24/// Wire the opencode terminal integration into editor boot: the `:opencode`
25/// ex-command + the `opencode-mode` minor. One line in the crate-root install.
26pub fn install(boot: &mut impl SubsystemBoot) {
27 commands::register_opencode_ex_commands(boot.commands_mut());
28 modes::register_opencode_modes(boot.modes_mut());
29}
30
31pub use modes::{OpencodeMode, register_opencode_modes};