Skip to main content

lattice_agent/
lib.rs

1//! `lattice-agent` — the editor-capability port that lattice's agent
2//! integrations are built on.
3//!
4//! lattice integrates coding agents over two inverted transports: an MCP
5//! server the agent dials into (Claude Code) and an ACP client that spawns and
6//! drives the agent (opencode). Transport direction is not what the code is
7//! made of — "give me the selection", "write this file", "ask the user to
8//! approve this diff" mean one thing regardless of who opened the socket.
9//!
10//! This crate owns that surface. It carries **no agent wire protocol**: no
11//! `agent-client-protocol`, no `tokio-tungstenite`, no `lattice-lsp`. Adapters
12//! live in `lattice-ai`. See `docs/dev/architecture/agent-integration.md`.
13
14pub mod error;
15
16pub mod commands;
17
18pub mod diff_review;
19
20pub mod state_cache;
21
22pub mod editor_access;
23
24pub mod write_bus;
25
26pub mod log;
27
28pub use commands::{parse_no_args, parse_rest_as_text};
29pub use diff_review::{DiffReviewRequest, review_diff};
30pub use editor_access::{EditorAccess, OpenEditor, SelectionInfo};
31pub use error::{AgentError, Result};
32pub use state_cache::{EditorStateCache, EditorStateHandle};
33pub use write_bus::{EditorWriteRequest, InboundKind, InboundReply, make_handler};
34
35pub use log::ai_log::{
36    AiLogEventPublisher, AiLogLevel, AiLogPushed, AiLogRecord, AiLogSource, AiLogger, LogRing,
37    SessionKey, format_ai_log_line, level_tag,
38};
39pub use log::buffer_names::{ai_log_name, parse_ai_log_name};
40pub use log::modes::AiLogMode;