docs/11-crates.md

11 — Crate & Module Layout

Cargo workspace, Rust 2021+, MSRV 1.85 (matches alacritty_terminal floor if later adopted; vt100 needs only 1.70).

text
1Cargo.toml # workspace
2crates/
3 signaltty-core/ # toolkit-free domain model (no tokio, no PTY)
4 src/{lib,ids,model,state,layout,notification,git,error}.rs
5 signaltty-proto/ # IPC envelopes, methods, events, versions
6 src/{lib,protocol,message,method,event,error}.rs
7 signaltty-term/ # TerminalBackend trait + headless impl + OSC scan
8 src/{lib,backend,headless,osc,sanitize}.rs
9 signaltty-agent/ # Phase 2: AgentAdapter trait + impls + hooks
10 src/{lib,types,registry,adapters/*}.rs
11 signaltty-server/ # daemon: store, PTY mgr, router, persist, bus
12 src/{main,server,store,pty,router,events,persist,config,gitwatch}.rs
13 signaltty-cli/ # clap client (human + automation + hooks entry)
14 src/{main,client,daemon,attach,integration}.rs
15 signaltty-plugin/ # Phase 4: plugin.toml manifests + hook dispatch
16 src/lib.rs
17 signaltty-gui/ # Phase 3: gtk4 + libadwaita + vte4 (plain gtk-rs)
18 src/{main,app,actor,sidebar,terminal,notif,util}.rs
19 signaltty-testkit/ # shared integration-test harness (real PTYs)
20 src/{lib,server,pty_helpers}.rs

Dependency rules

  • core: serde, uuid, chrono|time, thiserror only. No async, no OS.
  • proto → core. term → core (+vt100, vte).
  • server → core, proto, term, agent (+tokio, portable-pty, serde_json, nix, base64).
  • cli → core, proto (+tokio, clap, serde_json). Never server.
  • gui → core, proto (+gtk4, libadwaita, vte4, notify-rust). Never server, never PTY crates.
  • plugin → core, proto (+tokio, toml). server and cli depend on it; it never depends on them.
  • agent → core, proto only; adapters are pure classifiers over AdapterEvent snapshots so they stay unit-testable without PTYs.

Binaries

signaltty-server (daemon), signaltty (CLI), signaltty-gui (Phase 3). One version for the whole workspace; server.status reports it and IPC refuses cross-major mismatches.

Phase 1 build order

core → proto → term → server → cli → testkit, each with unit tests; integration tests live in server/tests/ + cli/tests/ using testkit with real PTYs.