generated from nhcarrigan/template
feat: add visual todo list panel
- Add TodoPanel component to display TodoWrite tool calls - Create todos Svelte store to track todo state - Emit todo-update Tauri event when TodoWrite is called - Add todo button to status bar (next to session history) - Display todos with status icons, progress bar, and completion count - Real-time updates as I work through tasks Closes #132
This commit is contained in:
@@ -282,6 +282,21 @@ pub struct AgentEndEvent {
|
||||
pub num_turns: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TodoItem {
|
||||
pub content: String,
|
||||
pub status: String, // "pending", "in_progress", or "completed"
|
||||
#[serde(rename = "activeForm")]
|
||||
pub active_form: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TodoUpdateEvent {
|
||||
pub todos: Vec<TodoItem>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub conversation_id: Option<String>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -16,8 +16,8 @@ use crate::stats::{calculate_cost, StatsUpdateEvent, UsageStats};
|
||||
use crate::types::{
|
||||
AgentEndEvent, AgentStartEvent, CharacterState, ClaudeMessage, ConnectionEvent,
|
||||
ConnectionStatus, ContentBlock, MessageCost, OutputEvent, PermissionPromptEvent,
|
||||
PermissionPromptEventItem, QuestionOption, SessionEvent, StateChangeEvent,
|
||||
UserQuestionEvent, WorkingDirectoryEvent,
|
||||
PermissionPromptEventItem, QuestionOption, SessionEvent, StateChangeEvent, TodoItem,
|
||||
TodoUpdateEvent, UserQuestionEvent, WorkingDirectoryEvent,
|
||||
};
|
||||
use parking_lot::RwLock;
|
||||
use std::cell::RefCell;
|
||||
@@ -937,6 +937,34 @@ fn process_json_line(
|
||||
);
|
||||
}
|
||||
|
||||
// Emit todo-update event for TodoWrite tool invocations
|
||||
if name == "TodoWrite" {
|
||||
if let Some(todos_value) = input.get("todos") {
|
||||
if let Some(todos_array) = todos_value.as_array() {
|
||||
let todos: Vec<TodoItem> = todos_array
|
||||
.iter()
|
||||
.filter_map(|todo| {
|
||||
serde_json::from_value(todo.clone()).ok()
|
||||
})
|
||||
.collect();
|
||||
|
||||
tracing::debug!(
|
||||
"Emitting todo-update: {} todos, parent={:?}",
|
||||
todos.len(),
|
||||
parent_tool_use_id
|
||||
);
|
||||
|
||||
let _ = app.emit(
|
||||
"claude:todo-update",
|
||||
TodoUpdateEvent {
|
||||
todos,
|
||||
conversation_id: conversation_id.clone(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let desc = format_tool_description(name, input);
|
||||
let _ = app.emit(
|
||||
"claude:output",
|
||||
|
||||
Reference in New Issue
Block a user