Lutra/crates/control/src/lib.rs
danny 9b278099cf M3.7: lutra CLI and single instance
- crates/control: rendezvous file (<data_dir>/instance.json, port + random
  token, atomic write, 0600 on Unix, stale detection), token-protected
  listener (start_with_token, app.auth first, constant-time compare,
  10 s auth timeout), app.focus, and a blocking client (connect_live,
  request/execute/subscribe/next_event, open_folder/open_file/reveal)
- lutra-desktop: a normal start forwards its path to a running instance
  and exits, otherwise claims the rendezvous; --control instances skip it
  unless LUTRA_RENDEZVOUS_DIR is set; non-Unicode args are usage errors
- lutra-cli (binary lutra, now L6): path[:line[:column]] targets, folder ->
  project.open, file -> file.open (parent opened without a project, outside
  the project refused), editor.reveal, starts the desktop if needed,
  --wait until bufferClosed, --version/--help, exit codes 0/1/2
- tests: proptest target parsing, rendezvous read/write/stale, token check
  over TCP, forwarding against a test backend, --wait end to end
- docs: architecture, G7, ROADMAP (agent automation 18% est.), roadmap,
  README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:23:09 +02:00

23 lines
949 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! Control channel of Lutra (layer L5).
//!
//! Serves JSON lines on `127.0.0.1:PORT` so that scripts and agents can run
//! engine commands and inspect the user interface. The protocol is described
//! in docs/architecture.md › Control channel; [`protocol`] parses and answers
//! single lines, [`server`] owns the sockets, [`methods`] lists the
//! methods. Hosts plug in through [`Backend`] and publish engine events to
//! subscribed connections through [`Subscribers`].
//!
//! The single instance (M3.7) adds [`rendezvous`], the per-user file that
//! names the token-protected listener of the running app, and [`client`],
//! the client that the `lutra` CLI, a second app start and `lutra mcp` use
//! to reach it.
mod backend;
pub mod client;
pub mod methods;
pub mod protocol;
pub mod rendezvous;
pub mod server;
pub use backend::{Backend, EVENT_QUEUE, EventSink, Subscribers};
pub use server::{ServerHandle, start, start_with_token};