v1.4.2 — Edit tool
What's New
New `edit` built-in tool
The agent can now modify files without rewriting them in full. Works on both the local filesystem and inside the E2B sandbox.
Modes:
- Exact string replacement (default) — must match uniquely; errors with a clear message if not found or ambiguous
- replace_all — replace every occurrence
- regex — treat `old_string` as a JavaScript regular expression; `new_string` can use `$1`-style backreferences, and custom flags (`i`, `m`, `s`) are supported
Example:
```json
{ "path": "src/foo.ts", "old_string": "const x = 1", "new_string": "const x = 2" }
```
With regex:
```json
{
"path": "package.json",
"old_string": ""version":\\s*"\\d+\\.\\d+\\.\\d+"",
"new_string": ""version": "2.0.0"",
"regex": true
}
```
Built-in protections: refuses identical old/new strings, refuses no-op replacements, and reports the number of replacements applied.
Full Changelog: v1.4.1...v1.4.2