Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codi-rs/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ impl Agent {

// Notify callback
if let Some(ref on_tool_result) = self.callbacks.on_tool_result {
on_tool_result(&tool_call.id, &result.content, result.is_error.unwrap_or(false));
on_tool_result(&tool_call.id, &tool_call.name, &result.content, result.is_error.unwrap_or(false));
}

result
Expand Down
4 changes: 2 additions & 2 deletions codi-rs/src/agent/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ pub struct AgentCallbacks {
pub on_text: Option<Arc<dyn Fn(&str) + Send + Sync>>,
/// Called when a tool is about to be executed (tool_id, tool_name, input).
pub on_tool_call: Option<Arc<dyn Fn(&str, &str, &serde_json::Value) + Send + Sync>>,
/// Called when a tool execution completes (tool_id, result, is_error).
pub on_tool_result: Option<Arc<dyn Fn(&str, &str, bool) + Send + Sync>>,
/// Called when a tool execution completes (tool_id, tool_name, result, is_error).
pub on_tool_result: Option<Arc<dyn Fn(&str, &str, &str, bool) + Send + Sync>>,
/// Called to confirm destructive operations. Returns approval result.
pub on_confirm: Option<Arc<dyn Fn(ToolConfirmation) -> ConfirmationResult + Send + Sync>>,
/// Called when context compaction starts/ends.
Expand Down
2 changes: 1 addition & 1 deletion codi-rs/src/tui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl App {
})),
on_tool_result: Some(Arc::new({
let tx = event_tx.clone();
move |tool_id: &str, result: &str, is_error: bool| {
move |tool_id: &str, _name: &str, result: &str, is_error: bool| {
let _ = tx.send(AppEvent::ToolResult(tool_id.to_string(), result.to_string(), is_error));
}
})),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
source: tests/tui_exec_cell.rs
assertion_line: 157
expression: terminal.backend()
---
"┌ bash ────────────────────────────────────────────────────────────────────────┐"
"│ ⠋ Running... (6ms) │"
"│ Input: {"cmd":"long_running_command"} │"
"│ ┌──────────────────────────────────────────────────────────────────────────┐ │"
"│ │ Starting process... │ │"
"│ │ Loading configuration │ │"
"│ │ Connecting to database │ │"
"│ │ Executing query │ │"
"│ │ Processing results │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ └──────────────────────────────────────────────────────────────────────────┘ │"
"└──────────────────────────────────────────────────────────────────────────────┘"
25 changes: 25 additions & 0 deletions codi-rs/tests/snapshots/tui_exec_cell__exec_cell_pending.snap.new
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
source: tests/tui_exec_cell.rs
assertion_line: 30
expression: terminal.backend()
---
"┌ read_file ───────────────────────────────────────────────────────────────────┐"
"│ ○ Running... (9ms) │"
"│ Input: {"path":"test.rs"} │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"│ │"
"└──────────────────────────────────────────────────────────────────────────────┘"
25 changes: 25 additions & 0 deletions codi-rs/tests/snapshots/tui_exec_cell__exec_cell_running.snap.new
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
source: tests/tui_exec_cell.rs
assertion_line: 51
expression: terminal.backend()
---
"┌ bash ────────────────────────────────────────────────────────────────────────┐"
"│ ⠋ Running... (5ms) │"
"│ Input: {"cmd":"echo hello"} │"
"│ ┌──────────────────────────────────────────────────────────────────────────┐ │"
"│ │ Processing... │ │"
"│ │ Step 1 complete │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ │ │ │"
"│ └──────────────────────────────────────────────────────────────────────────┘ │"
"└──────────────────────────────────────────────────────────────────────────────┘"