harness-tools: read, write, bash, glob, grep

Five of the six M1 built-ins (edit's replacer chain is a separate port).
bash uses process_group(0) + SIGKILL-the-group on timeout/cancel; glob/grep
are gitignore-aware via ignore::WalkBuilder and don't ask permission
(read-only); read/write/bash ask through ctx.ask with opencode's coarser
"always" pattern (first word + wildcard for bash, path for edit/read).
Wired tool output through the central 30k-char truncate() in the processor
so every tool gets spill-to-disk behavior for free. 70 tests passing,
clippy clean.
This commit is contained in:
Erik Simon
2026-07-08 17:12:48 +02:00
parent a68ca02894
commit 27ab6de4f5
12 changed files with 1224 additions and 1 deletions
@@ -424,6 +424,11 @@ impl<'a> Run<'a> {
}
};
// docs/05-tools.md: cap tool output at 30k chars regardless of which tool produced it.
let output = crate::tool::truncate::truncate(&output, &self.ctx.data_dir, &call_id)
.map(|t| t.text)
.unwrap_or(output);
let final_state = if is_error {
ToolState::Error {
input,