refactor: clean up tool dispatch and extract helpers
- Move working_stack tool to tools/working_stack.rs (was orphaned in agent.rs) - Create control.rs for pause/switch_model/yield_to_user with Result<ToolOutput> - Add ToolOutput::error() and ToolOutput::text() helper constructors - Clean up dispatch() with Option<Result<ToolOutput>> pattern for rich tools - Refactor memory.rs: extract cmd(), write_node(), supersede(), get_str(), get_f64() - Merge run_rg() and run_grep() into unified run_search() in grep.rs - Extract truncate_output() helper shared by bash, grep, glob tools Net: -77 lines, better structure, less duplication
This commit is contained in:
parent
3fd485a2e9
commit
45b7bba22a
6 changed files with 290 additions and 264 deletions
|
|
@ -168,13 +168,7 @@ pub async fn run_bash(args: &serde_json::Value, tracker: &ProcessTracker) -> Res
|
|||
result = "(no output)".to_string();
|
||||
}
|
||||
|
||||
const MAX_OUTPUT: usize = 30000;
|
||||
if result.len() > MAX_OUTPUT {
|
||||
result.truncate(MAX_OUTPUT);
|
||||
result.push_str("\n... (output truncated)");
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
Ok(super::truncate_output(result, 30000))
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
Err(anyhow::anyhow!("Command failed: {}", e))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue