trusty_code/session/mod.rs
1//! Daemon-owned session model + attach/detach protocol (#2054, vision spec
2//! Axiom 4 / §4.3-4.4 / §12).
3//!
4//! Why: "The Daemon OWNS Sessions; CLI Attaches Over the API" — a running
5//! session is a first-class object living inside `tcode serve`, not a tmux
6//! pane the CLI scrapes. This module is the whole vertical slice: the
7//! domain type, its in-memory registry + ring buffer + attach bookkeeping,
8//! and the `session.*` JSON-RPC methods built on top of the existing
9//! `crate::jsonrpc::Router` — reachable identically over STDIO and HTTP
10//! (`crate::serve`), reusing the SAME method surface both transports
11//! dispatch through.
12//! What: [`model::Session`]/[`model::SessionStatus`] (the domain type),
13//! [`registry::SessionRegistry`] (storage + ring buffer + attach/detach +,
14//! since #2056, execution tracking, #2350 operator-facing goal slots),
15//! [`transcript::TranscriptRecord`] (#2058's `session.get_transcript`
16//! response DTO, #2350 additive `goals` field) plus its
17//! [`transcript::GoalSlotRecord`] snapshot type, [`memory_sink::TurnMemorySink`]
18//! (#2345's durable per-turn dual-write to trusty-memory, owned per-session
19//! by `registry::SessionRegistry`), and [`protocol::register`] (wires
20//! `session.create`/`list`/`status`/`send`/`attach`/`detach`/`cancel`/
21//! `get_transcript`/(#2350)`set_goal`/`clear_goal`/`get_goals` onto a
22//! `Router`).
23//! Test: `model::tests::*`, `registry::registry_tests::*`,
24//! `protocol::tests::*`; end-to-end over the real daemon in
25//! `tests/session_e2e.rs` and (#2058) `tests/task_e2e.rs`.
26
27pub mod memory_sink;
28pub mod model;
29pub mod protocol;
30pub mod registry;
31pub mod transcript;
32
33pub use memory_sink::TurnMemorySink;
34pub use model::{Session, SessionStatus};
35pub use registry::SessionRegistry;
36pub use transcript::{GoalSlotRecord, TranscriptRecord};