Skip to main content

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//!
27//! [`model::Session`]: crate::session::model::Session
28//! [`model::SessionStatus`]: crate::session::model::SessionStatus
29//! [`registry::SessionRegistry`]: crate::session::registry::SessionRegistry
30//! [`transcript::TranscriptRecord`]: crate::session::transcript::TranscriptRecord
31//! [`transcript::GoalSlotRecord`]: crate::session::transcript::GoalSlotRecord
32//! [`memory_sink::TurnMemorySink`]: crate::session::memory_sink::TurnMemorySink
33//! [`protocol::register`]: crate::session::protocol::register
34
35pub mod connector;
36/// (#6637) `session.events`: the socket transport's live tail of one session,
37/// standing in for the notification channel `session.attach` cannot have over
38/// a one-frame-in, one-frame-out connection.
39pub mod events_stream;
40/// (#2425) Bounded logical-order fold for durable-memory turn outcomes.
41/// Private: `registry::SessionEntry` owns one per session and is the only
42/// thing that drives it.
43mod memory_outcome_reconciler;
44pub mod memory_sink;
45pub mod model;
46pub mod protocol;
47pub mod registry;
48/// (#4351) The actionable `TaskResult` carried beside a `Session` snapshot.
49pub mod task_result;
50pub mod transcript;
51
52/// (issue #3948) The per-session working-context floor `registry` folds into
53/// each `SessionEntry` — a private sibling module, not part of the crate's
54/// public surface.
55#[path = "registry_context_floor.rs"]
56mod registry_context_floor;
57
58pub use connector::TcodeConnector;
59pub use memory_sink::{MemoryFailureCategory, PalaceCreation, TurnMemorySink};
60pub use model::{Session, SessionStatus};
61pub use registry::SessionRegistry;
62pub use task_result::{TaskResult, TaskResultStatus};
63pub use transcript::{GoalSlotRecord, MemoryDurabilityStatus, TranscriptRecord};