1use crate::chat_error::ChatError;
2use crate::storage::ToolCallItem;
3use crate::tools::ImageData;
4use std::sync::mpsc;
5
6#[derive(Debug, Clone, PartialEq, Default)]
10pub enum PlanDecision {
11 #[default]
13 None,
14 Approve,
16 ApproveAndClearContext,
18 Reject,
20}
21
22pub enum StreamMsg {
26 Chunk,
28 ToolCallRequest(Vec<ToolCallItem>),
30 Done,
32 Error(ChatError),
34 Cancelled,
36 Retrying {
38 attempt: u32,
40 max_attempts: u32,
42 delay_ms: u64,
44 error: String,
46 },
47 Compacting,
49 Compacted {
51 messages_before: usize,
53 },
54}
55
56#[derive(Debug)]
58pub enum ToolExecStatus {
59 PendingConfirm,
61 Executing,
63 #[allow(dead_code)]
65 Done(String),
66 Rejected,
68 Failed(String),
70}
71
72#[derive(Debug)]
74pub struct ToolCallStatus {
75 pub tool_call_id: String,
76 pub tool_name: String,
77 pub arguments: String,
78 pub confirm_message: String,
79 pub status: ToolExecStatus,
80 pub tool_description: Option<String>,
82}
83
84#[derive(Debug)]
86pub struct ToolResultMsg {
87 pub tool_call_id: String,
88 pub result: String,
89 #[allow(dead_code)]
90 pub is_error: bool,
91 pub images: Vec<ImageData>,
93 pub plan_decision: PlanDecision,
95}
96
97#[derive(Debug)]
99pub struct CompletedToolResult {
100 pub tool_call_id: String,
101 pub summary: String,
102 pub is_error: bool,
103}
104
105#[derive(Debug, Clone)]
107pub struct AskOption {
108 pub label: String,
109 pub description: String,
110}
111
112#[derive(Debug, Clone)]
114pub struct AskQuestion {
115 pub question: String,
116 pub header: String,
117 pub options: Vec<AskOption>,
118 pub multi_select: bool,
119}
120
121#[derive(Clone)]
123pub enum AskAnswer {
124 Selected(Vec<usize>),
126 FreeText(String),
128}
129
130#[derive(Debug)]
132pub struct AskRequest {
133 pub questions: Vec<AskQuestion>,
134 pub response_tx: mpsc::Sender<String>,
135}