From 0f20ee4eb871907defe7848f0d3e2203cfff057e Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Tue, 21 Apr 2026 10:32:54 -0700 Subject: feat: AI tool rendering overhaul + edit_file tool (#3423) Overhaul of how AI tool calls are modeled, rendered, and displayed in the Atuin AI TUI. Fixes bugs in shell command output capture, implements the `edit_file` tool with full safety infrastructure, and adds a diff preview for edits. --- crates/atuin-ai/src/tools/descriptor.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'crates/atuin-ai/src/tools/descriptor.rs') diff --git a/crates/atuin-ai/src/tools/descriptor.rs b/crates/atuin-ai/src/tools/descriptor.rs index fc44ec10..6ccb595f 100644 --- a/crates/atuin-ai/src/tools/descriptor.rs +++ b/crates/atuin-ai/src/tools/descriptor.rs @@ -16,6 +16,7 @@ pub(crate) struct ToolDescriptor { /// Past-tense verb for summaries (e.g. "Read file"). pub past_verb: &'static str, /// Whether this tool is executed client-side (by the CLI). + #[expect(dead_code)] pub is_client: bool, } @@ -30,9 +31,18 @@ pub(crate) const READ: &ToolDescriptor = &ToolDescriptor { is_client: true, }; +pub(crate) const EDIT: &ToolDescriptor = &ToolDescriptor { + canonical_names: &["edit_file"], + capability: Some("client_v1_edit_file"), + display_verb: "edit", + progressive_verb: "Editing file...", + past_verb: "Edited file", + is_client: true, +}; + pub(crate) const WRITE: &ToolDescriptor = &ToolDescriptor { - canonical_names: &["str_replace", "file_create", "file_insert"], - capability: Some("client_v1_write"), + canonical_names: &["write_file"], + capability: Some("client_v1_write_file"), display_verb: "write to", progressive_verb: "Writing file...", past_verb: "Wrote file", @@ -41,7 +51,7 @@ pub(crate) const WRITE: &ToolDescriptor = &ToolDescriptor { pub(crate) const SHELL: &ToolDescriptor = &ToolDescriptor { canonical_names: &["execute_shell_command"], - capability: Some("client_v1_shell"), + capability: Some("client_v1_execute_shell_command"), display_verb: "run", progressive_verb: "Running command...", past_verb: "Ran command", @@ -81,6 +91,7 @@ pub(crate) const SERVER_SCRAPE: &ToolDescriptor = &ToolDescriptor { /// All known tool descriptors, for lookup by name. const ALL_DESCRIPTORS: &[&ToolDescriptor] = &[ READ, + EDIT, WRITE, SHELL, ATUIN_HISTORY, -- cgit v1.3.1