Enhance tool documentation and add new features
- Added module-level documentation for memory tools (`remember`, `recall`, `forget`) to clarify their purpose. - Improved documentation in `recall.rs` and `remember.rs` to describe the functionality and flow of memory entry operations. - Updated `mod.rs` to include descriptions for the tool trait and execution context. - Enhanced `plan.rs` with detailed comments on plan-mode signaling tools. - Documented text search tools in `search.rs` to explain their functionality. - Improved sequential-thinking tool documentation in `seqthink.rs`. - Added safety filter documentation in `shell_filter` for credential and git operations. - Enhanced utility tools documentation, including `cd`, `dir_cache_update`, and `todowrite`. - Improved rendering documentation in view modules (`chat`, `markdown`, `status`, `workflow`) to clarify rendering flows and purposes.
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
//! Wire message types exchanged between an attached client and the
|
||||
//! daemon over the `Connection`/framing layer (`conn.rs`, `frame.rs`).
|
||||
//!
|
||||
//! Flow: client input events are captured as `KeyAction`/`ClientRequest`
|
||||
//! and sent to the daemon → the daemon applies them to its `AppStateRest`
|
||||
//! and replies with `DaemonFrame` variants (a flattened `StatePayload`
|
||||
//! for redraw, streamed tokens, system notes, or a close signal).
|
||||
//!
|
||||
//! Why: `StatePayload`/`MessageEntry`/`ToastEntry` are deliberately flat,
|
||||
//! serializable projections of daemon-side state so the client can
|
||||
//! redraw its TUI without sharing any in-process state with the daemon.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Wire-serializable subset of `crossterm::event::KeyCode`, sent from
|
||||
/// an attached client to the daemon over IPC.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum KeyAction {
|
||||
Char(char),
|
||||
@@ -19,6 +33,8 @@ pub enum KeyAction {
|
||||
Function(u8),
|
||||
}
|
||||
|
||||
/// Messages an attached client sends to the daemon: input events, a
|
||||
/// full-line submit, terminal resize, and connection lifecycle.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum ClientRequest {
|
||||
Tick,
|
||||
@@ -33,6 +49,7 @@ pub enum ClientRequest {
|
||||
Close,
|
||||
}
|
||||
|
||||
/// Flattened chat message sent from daemon to client for transcript display.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct MessageEntry {
|
||||
pub role: String,
|
||||
@@ -40,6 +57,7 @@ pub struct MessageEntry {
|
||||
pub timestamp: i64,
|
||||
}
|
||||
|
||||
/// Flattened toast notification sent from daemon to client for rendering.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ToastEntry {
|
||||
pub kind: String,
|
||||
@@ -48,6 +66,8 @@ pub struct ToastEntry {
|
||||
pub lifetime_ms: u64,
|
||||
}
|
||||
|
||||
/// Snapshot of daemon-side `AppStateRest` sent to the client after every
|
||||
/// action, enough for the client to redraw its TUI without shared state.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct StatePayload {
|
||||
pub session_id: String,
|
||||
@@ -61,6 +81,7 @@ pub struct StatePayload {
|
||||
pub input_cursor: usize,
|
||||
}
|
||||
|
||||
/// Messages the daemon sends back to an attached client.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum DaemonFrame {
|
||||
StateUpdate(Box<StatePayload>),
|
||||
|
||||
Reference in New Issue
Block a user