aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-ai/src/tui/events.rs
diff options
context:
space:
mode:
authorMichelle Tilley <michelle@michelletilley.net>2026-04-21 10:32:54 -0700
committerGitHub <noreply@github.com>2026-04-21 10:32:54 -0700
commit0f20ee4eb871907defe7848f0d3e2203cfff057e (patch)
treecda9034c4c6e7b5ecf0fe957978284e9138b80ff /crates/atuin-ai/src/tui/events.rs
parentchore: Clarified note about regular expressions matching in path. (#3427) (diff)
downloadatuin-0f20ee4eb871907defe7848f0d3e2203cfff057e.zip
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.
Diffstat (limited to 'crates/atuin-ai/src/tui/events.rs')
-rw-r--r--crates/atuin-ai/src/tui/events.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/atuin-ai/src/tui/events.rs b/crates/atuin-ai/src/tui/events.rs
index 1a422fef..969f6ae5 100644
--- a/crates/atuin-ai/src/tui/events.rs
+++ b/crates/atuin-ai/src/tui/events.rs
@@ -38,7 +38,34 @@ pub(crate) enum AiTuiEvent {
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum PermissionResult {
Allow,
+ /// Per-file, time-limited grant scoped to the current session.
+ AllowFileForSession,
AlwaysAllowInDir,
AlwaysAllow,
Deny,
}
+
+impl PermissionResult {
+ /// String identifier used as the SelectOption value.
+ pub fn as_value_str(&self) -> &'static str {
+ match self {
+ Self::Allow => "allow",
+ Self::AllowFileForSession => "allow-file-session",
+ Self::AlwaysAllowInDir => "always-allow-in-dir",
+ Self::AlwaysAllow => "always-allow",
+ Self::Deny => "deny",
+ }
+ }
+
+ /// Parse from a SelectOption value string.
+ pub fn from_value_str(s: &str) -> Option<Self> {
+ match s {
+ "allow" => Some(Self::Allow),
+ "allow-file-session" => Some(Self::AllowFileForSession),
+ "always-allow-in-dir" => Some(Self::AlwaysAllowInDir),
+ "always-allow" => Some(Self::AlwaysAllow),
+ "deny" => Some(Self::Deny),
+ _ => None,
+ }
+ }
+}