Remove final_output tool - let summaries stream naturally
- Remove final_output from tool definitions, dispatch, and misc tools - Update system prompts to request summaries as regular markdown text - Remove print_final_output from UiWriter trait and all implementations - Remove final_output handling from agent core logic - Rename final_output_summary → summary in session continuation - Delete final_output test files - Update tool count tests (12→11, 27→26) This allows LLM summaries to stream through the markdown formatter for a more natural, responsive user experience instead of buffering everything into a tool call.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//! Miscellaneous tools: final_output, take_screenshot, code_coverage, code_search.
|
||||
//! Miscellaneous tools: take_screenshot, code_coverage, code_search.
|
||||
|
||||
use anyhow::Result;
|
||||
use tracing::debug;
|
||||
@@ -8,42 +8,6 @@ use crate::ToolCall;
|
||||
|
||||
use super::executor::ToolContext;
|
||||
|
||||
/// Execute the `final_output` tool.
|
||||
pub async fn execute_final_output<W: UiWriter>(
|
||||
tool_call: &ToolCall,
|
||||
ctx: &ToolContext<'_, W>,
|
||||
) -> Result<String> {
|
||||
debug!("Processing final_output tool call");
|
||||
|
||||
let summary_str = tool_call.args.get("summary").and_then(|v| v.as_str());
|
||||
|
||||
// In autonomous mode, check for incomplete TODO items before allowing completion
|
||||
if ctx.is_autonomous {
|
||||
let todo_content = ctx.todo_content.read().await;
|
||||
let has_incomplete_todos = todo_content
|
||||
.lines()
|
||||
.any(|line| line.trim().starts_with("- [ ]"));
|
||||
drop(todo_content);
|
||||
|
||||
if has_incomplete_todos {
|
||||
return Ok(
|
||||
"There are still incomplete TODO items. Please continue until \
|
||||
*ALL* TODO items in *ALL* phases are marked complete, and \
|
||||
*ONLY* then call `final_output`."
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the summary or a default message
|
||||
// Note: Session continuation saving is handled by the caller (Agent)
|
||||
if let Some(summary) = summary_str {
|
||||
Ok(summary.to_string())
|
||||
} else {
|
||||
Ok("✅ Turn completed".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute the `take_screenshot` tool.
|
||||
pub async fn execute_take_screenshot<W: UiWriter>(
|
||||
tool_call: &ToolCall,
|
||||
|
||||
Reference in New Issue
Block a user