-
Notifications
You must be signed in to change notification settings - Fork 0
Implement persistence command enhancements #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -648,10 +648,13 @@ impl App { | |
| /mode auto - Enable automatic agent routing | ||
| /mode manual - Enable manual agent selection | ||
| /agent <name> - Select specific agent (manual mode) | ||
| /agents - List all available agents | ||
| /clear - Clear current session | ||
| /save <name> - Save current session | ||
| /load <id> - Load session by ID | ||
| /new - Start a new session | ||
| /save <name> - Save current session to file | ||
| /load <id> - Load a session by ID | ||
| /sessions - List all saved sessions | ||
| /delete <id> - Delete a session by ID | ||
| /remember <key> <value> - Store a value in session memory | ||
| /recall <key> - Retrieve a value from session memory | ||
| /forget <key> - Delete a value from session memory | ||
|
|
@@ -771,12 +774,12 @@ impl App { | |
| self.chat.add_message(msg); | ||
| } | ||
| "/save" => { | ||
| if let Some(name) = args.first() { | ||
| self.session.title = name.to_string(); | ||
| if !args.is_empty() { | ||
| self.session.title = args.join(" "); | ||
| } | ||
| match self.session_store.save(&self.session).await { | ||
| Ok(_) => { | ||
| let msg = Message::system(&format!("Session '{}' saved successfully.", self.session.title)); | ||
| let msg = Message::system(&format!("Session '{}' saved successfully (ID: {}).", self.session.title, self.session.id)); | ||
| self.session.add_message(msg.clone()); | ||
| self.chat.add_message(msg); | ||
| } | ||
|
|
@@ -838,6 +841,26 @@ impl App { | |
| } | ||
| } | ||
| } | ||
| "/delete" => { | ||
| if let Some(id) = args.first() { | ||
| match self.session_store.delete(id).await { | ||
| Ok(_) => { | ||
| let msg = Message::system(&format!("Session '{}' deleted successfully.", id)); | ||
| self.session.add_message(msg.clone()); | ||
|
Comment on lines
+846
to
+849
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Useful? React with 👍 / 👎. |
||
| self.chat.add_message(msg); | ||
| } | ||
| Err(e) => { | ||
| let msg = Message::system(&format!("Failed to delete session: {}", e)); | ||
| self.session.add_message(msg.clone()); | ||
| self.chat.add_message(msg); | ||
| } | ||
| } | ||
| } else { | ||
| let msg = Message::system("Usage: /delete <session_id>"); | ||
| self.session.add_message(msg.clone()); | ||
| self.chat.add_message(msg); | ||
| } | ||
| } | ||
| "/remember" => { | ||
| if args.len() >= 2 { | ||
| let key = args[0]; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This passes raw command input directly to
session_store.delete(id), and the store builds file paths by joiningsession_idinto the base directory. Without input validation, IDs containing path segments like../can resolve outside the sessions folder and delete unintended.jsonfiles, so/deleteshould reject non-ID characters (or canonicalize/guard paths) before calling delete.Useful? React with 👍 / 👎.