feat(tui): add usage overlay and sidebar for displaying usage statistics and tasks
feat(tui): implement status bar with connection and turn state indicators feat(tui): create workflow panel for agent status and progress visualization feat(web): introduce web frontend interface with static file serving feat(ws): add WebSocket interface for real-time communication and session management
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
//! Delete a memory by name.
|
||||
|
||||
use crate::tools::{Tool, ToolCtx};
|
||||
use anyhow::Result;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use zesdex_domain::cms::MemoryRepository;
|
||||
|
||||
pub struct Forget;
|
||||
|
||||
impl Tool for Forget {
|
||||
fn name(&self) -> &'static str {
|
||||
"forget"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Delete a saved memory by name"
|
||||
}
|
||||
|
||||
fn parameters(&self) -> Value {
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of the memory to delete"
|
||||
}
|
||||
},
|
||||
"required": ["name"]
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let name = crate::tools::arg_str(args, "name")?;
|
||||
let repo = crate::persistence::cms::memory_repo::MarkdownMemoryRepository::new();
|
||||
repo.delete(&ctx.memory_dir, &name)?;
|
||||
Ok(format!("Memory '{}' deleted", name))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
//! Memory management tools — remember, recall, forget.
|
||||
|
||||
pub mod forget;
|
||||
pub mod recall;
|
||||
pub mod remember;
|
||||
@@ -0,0 +1,52 @@
|
||||
//! Recall previously saved memories.
|
||||
|
||||
use crate::tools::{Tool, ToolCtx};
|
||||
use anyhow::Result;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use zesdex_domain::cms::MemoryRepository;
|
||||
|
||||
pub struct Recall;
|
||||
|
||||
impl Tool for Recall {
|
||||
fn name(&self) -> &'static str {
|
||||
"recall"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"List or search saved memories"
|
||||
}
|
||||
|
||||
fn parameters(&self) -> Value {
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Optional: specific memory name to recall"
|
||||
},
|
||||
"search": {
|
||||
"type": "string",
|
||||
"description": "Optional: keyword to search in memory descriptions"
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let repo = crate::persistence::cms::memory_repo::MarkdownMemoryRepository::new();
|
||||
|
||||
let specific_name = args.get("name").and_then(|v| v.as_str());
|
||||
|
||||
if let Some(name) = specific_name {
|
||||
let memory = repo.load(&ctx.memory_dir, name)?;
|
||||
Ok(serde_json::to_string_pretty(&memory)?)
|
||||
} else {
|
||||
let names = repo.list(&ctx.memory_dir)?;
|
||||
if names.is_empty() {
|
||||
return Ok("No memories saved yet".to_string());
|
||||
}
|
||||
Ok(format!("Available memories:\n{}", names.join("\n")))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//! Remember a lesson or fact as persistent memory.
|
||||
|
||||
use crate::tools::{Tool, ToolCtx};
|
||||
use anyhow::Result;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use zesdex_domain::cms::{Memory, MemoryRepository};
|
||||
|
||||
pub struct Remember;
|
||||
|
||||
impl Tool for Remember {
|
||||
fn name(&self) -> &'static str {
|
||||
"remember"
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
"Save a lesson or fact to persistent memory"
|
||||
}
|
||||
|
||||
fn parameters(&self) -> Value {
|
||||
json!({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Unique name for this memory"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Short summary of the memory"
|
||||
},
|
||||
"content": {
|
||||
"type": "string",
|
||||
"description": "Full content of the memory"
|
||||
},
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"enum": ["lesson", "reference", "fact"],
|
||||
"description": "Category of memory"
|
||||
}
|
||||
},
|
||||
"required": ["name", "description", "content"]
|
||||
})
|
||||
}
|
||||
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let name = crate::tools::arg_str(args, "name")?;
|
||||
let description = crate::tools::arg_str(args, "description")?;
|
||||
let content = crate::tools::arg_str(args, "content")?;
|
||||
let kind = args
|
||||
.get("kind")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("reference")
|
||||
.to_string();
|
||||
|
||||
let memory = Memory {
|
||||
name: name.clone(),
|
||||
description,
|
||||
content,
|
||||
kind,
|
||||
created_at: chrono::Utc::now().timestamp(),
|
||||
updated_at: chrono::Utc::now().timestamp(),
|
||||
outcome: None,
|
||||
lifecycle: "active".to_string(),
|
||||
scope: None,
|
||||
before_snippet: None,
|
||||
after_snippet: None,
|
||||
provenances: Vec::new(),
|
||||
};
|
||||
|
||||
let repo = crate::persistence::cms::memory_repo::MarkdownMemoryRepository::new();
|
||||
repo.save(&ctx.memory_dir, &memory)?;
|
||||
|
||||
Ok(format!("Memory '{}' saved", name))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user