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
//! `MemoryService` — pure business-logic facade over `AppState`.
//!
//! Why: `web.rs` previously hosted ~5700 lines that mingled axum extraction,
//! JSON wire shapes, and business logic. Moving the logic into a struct with
//! `anyhow::Result<Value>` methods lets the HTTP handlers stay one-liners
//! and lets non-HTTP callers (chat tool dispatch, future RPC bridges) reuse
//! the same code paths without dragging axum types around.
//! What: A zero-cost wrapper around [`AppState`](crate::AppState) exposing one async method
//! per logical operation. Each method returns either `anyhow::Result<Value>`
//! (for handlers that already wrap errors with `ApiError::internal`) or a
//! domain-specific result the handler maps into JSON.
//! Test: Each method is covered indirectly via the corresponding HTTP test in
//! `web::tests` (the handlers delegate here verbatim).
//!
//! Hard constraint (issue #151): no behaviour change. Every method's success
//! and failure shapes match what the handler used to produce inline.
// #6286: the assertions the retired `web::tests` suite carried, ported to
// direct `MemoryService` calls. Split by the module each one covers.
// Re-export the full public surface so external call sites
// (`crate::service::X`) keep resolving exactly as they did against the former
// monolithic module. `load_user_config`, `dream_config_from_user_config`, and
// `LoadedUserConfig` moved from `helpers` to `user_config` (issue #2593
// follow-up, to keep `helpers.rs` under the 500-SLOC cap); re-exported from
// their new home here so `crate::service::X` call sites are unaffected.
pub use MemoryService;
pub use ;
// #4670 added KgNeighborsPayload / KgNodeView / KgSeedPayload — the
// progressive graph-exploration payloads.
pub use ;
pub use ;