trusty_memory/chat/mod.rs
1//! Chat HTTP surface for trusty-memory: OpenRouter/Ollama SSE chat, tool
2//! dispatch, chat-session CRUD, and inter-project messaging endpoints.
3//!
4//! Why: Extracted from `web.rs` to keep the HTTP router thin and isolate the
5//! tool-calling loop (which is by far the largest single concern in this
6//! crate's HTTP surface) behind its own module. The router still owns wiring,
7//! but the chat-specific request/response handlers, the tool dispatcher, and
8//! the inter-project messaging handlers all live here.
9//! What: Re-exports `chat_handler`, provider/session handlers, the
10//! `execute_*` dispatcher set, and the `/api/v1/messages*` handlers. Items
11//! kept `pub(crate)` so `web::router()` and the cross-palace recall handler
12//! can reference them without enlarging the public crate surface.
13//! Test: Behaviour is covered by `web::tests::all_tools_returns_expected_set`
14//! and `web::tests::execute_tool_dispatches_known_tools`, which still call
15//! into this module via the `pub(crate)` re-exports.
16
17pub mod handler;
18pub mod messaging;
19pub mod sessions;
20pub mod tools;
21
22// Re-export the `pub(crate)` HTTP surface so `web::router()` and the
23// cross-palace recall handler keep referencing `crate::chat::X` exactly as
24// they did against the former monolithic module.
25pub(crate) use handler::chat_handler;
26pub(crate) use messaging::{
27 list_messages_handler, mark_message_read_handler, send_message_handler,
28};
29pub(crate) use sessions::{
30 create_chat_session, delete_chat_session, get_chat_session, list_chat_sessions, list_providers,
31};
32#[cfg(test)]
33pub(crate) use tools::{all_tools, execute_tool};