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:
asepharyana
2026-07-12 11:28:39 +07:00
parent 7158d362fd
commit 2efd40ca88
124 changed files with 2379 additions and 19 deletions
+19
View File
@@ -1,10 +1,16 @@
//! Shallow state diffing — records opaque "modified" markers so the TUI
//! knows to re-render without computing fine-grained deltas.
use serde::{Deserialize, Serialize};
/// A collection of changes tracking which parts of app state have been
/// modified since the last render sweep.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct StateDiff {
changes: Vec<Change>,
}
/// A single named change — currently always carries a flat `"."` path
/// and `"modified"` kind because the system does not track granular diffs.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Change {
pub path: String,
@@ -12,23 +18,36 @@ pub struct Change {
}
impl StateDiff {
/// Create an empty diff.
pub fn new() -> Self {
StateDiff { changes: Vec::new() }
}
/// Record a change at `path` of the given `kind`.
pub fn add_change(&mut self, path: String, kind: String) {
self.changes.push(Change { path, kind });
}
/// Return true if no changes have been recorded.
pub fn is_empty(&self) -> bool {
self.changes.is_empty()
}
/// Remove all recorded changes.
pub fn clear(&mut self) {
self.changes.clear();
}
}
/// Compute a shallow diff between two serialised state values.
///
/// Flow: compare with `==`, return an empty vec if equal, otherwise
/// return a single `Change { ".", "modified" }`.
///
/// Why: a placeholder — the current rendering model re-validates the
/// whole viewport every frame, so fine-grained diffs are unnecessary.
///
/// Return: the list of changes (always 0 or 1 entry).
pub fn compute_diff(before: &serde_json::Value, after: &serde_json::Value) -> Vec<Change> {
if before == after {
return Vec::new();