steer_core/app/command.rs
1use crate::app::Message;
2use crate::app::agent_executor::ApprovalDecision;
3use crate::app::conversation::AppCommandType;
4use std::collections::HashSet;
5use steer_tools::ToolCall;
6use tokio::sync::oneshot;
7
8/// Tool-specific approval payload for different types of tool approvals
9#[derive(Debug, Clone)]
10pub enum ApprovalType {
11 /// Denied approval for this specific tool call
12 Denied,
13 /// One-time approval for this specific tool call
14 Once,
15 /// Always approve this entire tool
16 AlwaysTool,
17 /// Always approve this specific bash command pattern
18 AlwaysBashPattern(String),
19}
20
21/// Defines messages the TUI can send *to* the `App` actor.
22#[derive(Debug)]
23pub enum AppCommand {
24 /// Send a user's message text for processing.
25 ProcessUserInput(String),
26 /// Edit a previous message, creating a new branch
27 EditMessage {
28 /// ID of the message to edit. The new message will share the same parent.
29 message_id: String,
30 /// New content for the edited message
31 new_content: String,
32 },
33 /// Handle the user's decision on a tool approval request.
34 HandleToolResponse { id: String, approval: ApprovalType },
35 /// Execute a slash command.
36 ExecuteCommand(AppCommandType),
37 /// Execute a bash command directly (bypassing AI)
38 ExecuteBashCommand { command: String },
39 /// Cancel processing.
40 CancelProcessing,
41 /// Signal for graceful shutdown.
42 Shutdown,
43 /// Internal command for tool executor callback to request approval
44 RequestToolApprovalInternal {
45 tool_call: ToolCall,
46 responder: oneshot::Sender<ApprovalDecision>,
47 },
48 /// Restore conversation state when resuming a session
49 RestoreConversation {
50 messages: Vec<Message>,
51 approved_tools: HashSet<String>,
52 approved_bash_patterns: HashSet<String>,
53 active_message_id: Option<String>,
54 },
55 /// Request to send the current conversation state
56 /// Used by TUI to populate display after session restoration
57 GetCurrentConversation,
58 /// Request to list workspace files
59 RequestWorkspaceFiles,
60}