1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Session Manager (SM) agent module (DOC-14 spec).
//!
//! Why: the SM is a PM-like, daemon-side orchestrator that delegates all work by
//! spawning t-mpm sessions (spec §3 prime directive). This module is its home in
//! trusty-mpm-core. SM-1 establishes the skeleton — config schema + an inert
//! agent struct — that SM-2..SM-8 fill in (multi-provider inference, dedicated
//! memory palace, rolling auto-compaction context, goal tracking, and the
//! stdio/HTTP adapters).
//! What: a thin facade that re-exports the SM config types, the agent
//! skeleton, (SM-2) the multi-provider inference abstraction, and (SM-3) the
//! system-prompt assembly + override layering from the `config`, `agent`,
//! `providers`, and `prompt` submodules.
//! Test: submodule `tests` modules (`config::tests`, `agent::tests`,
//! `providers::*::tests`, `prompt::tests`) plus the `MpmConfig`-level coverage
//! in `core/config.rs::tests`.
/// Rolling auto-compaction context engine (SM-5, DOC-14 §7).
///
/// Why: gives the SM effectively infinite conversation context — last-N rounds
/// verbatim plus a growing faithful compressed summary — with a precise §7.5
/// working-prompt assembly. The compaction LLM call is dependency-injected
/// through the [`providers::LlmProvider`] trait so it is unit-testable with a
/// mock; SM-5 is the engine only and is not yet wired into any endpoint/loop.
/// What: re-compiled in every build (no extra feature cost — pure logic + serde
/// + the SM-2 provider trait).
/// Test: `context::*::tests`.
/// The session-control seam the SM drives its fleet through (SM-8, DOC-14 §2.6).
///
/// Why: both the SM-8 delegation loop and the SM-STDIO adapter must drive managed
/// sessions through one narrow, mockable trait. Relocating it here (from
/// `daemon::sm_stdio`) lets the agent-side loop depend on it while `sm_stdio`
/// re-exports it unchanged.
/// What: re-compiled in every build (pure trait + serde value shapes).
/// Test: `agent::delegate` tests + `daemon::sm_stdio::tests`.
/// Goal-tracking model + dual (palace + cache) persistence (SM-6, DOC-14 §9).
///
/// Why: the SM tracks operator intent as durable goals fanned out to delegated
/// sessions, with progress and a BLOCKING verification gate (§3.5) derived from
/// per-session verification state. Goals persist with a dual design (§9.4): the
/// SM palace (SM-4) is the source of truth, `goals.json` is a hot cache rebuilt
/// from it on startup. The module is feature-INDEPENDENT (always compiled): the
/// store depends on the `GoalMemory` abstraction, and only the production
/// `SmMemory` impl of that trait is gated behind `sm-memory` (internally). SM-6 is
/// the store only — not yet wired into any endpoint/loop (SM-7 / SM-8).
/// What: re-compiled in every build (pure logic + serde + uuid/chrono).
/// Test: `goals::{model_tests, cache_tests, store_tests}`.
/// Dedicated SM memory palace + recall/remember wiring (SM-4, DOC-14 §8).
///
/// Why: gated behind the `sm-memory` feature because it turns on
/// `trusty-common/memory-core` — the heavy Memory Palace storage engine
/// (usearch HNSW, redb, bundled-ORT FastEmbedder). Default and
/// `--no-default-features` builds must not pay that cost, so the module (and its
/// dependency) are strictly opt-in.
/// What: re-compiled only under `--features sm-memory`.
/// Test: `memory::tests` (run with `--features sm-memory`).
/// Idle-session prune policy (issue #1313).
///
/// Why: the `tm session prune-idle` command needs a pure, testable mapping from
/// a session's latest activity-monitor verdict to a durability-respecting
/// teardown action (stop idle, decommission done, skip everything else). Keeping
/// it in core (not the binary) lets it be unit-tested without a live daemon and
/// reused by any future caller.
/// What: re-compiled in every build (pure logic, no extra deps).
/// Test: `prune::tests`.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;