stynx_code_tui/state/
conversation_state.rs1#[derive(Debug, Clone)]
2pub struct DisplayMessage {
3 pub role: String,
4 pub content: String,
5 pub thinking: String,
6 pub tool_uses: Vec<DisplayToolUse>,
7 pub is_streaming: bool,
8}
9
10#[derive(Debug, Clone, PartialEq, Eq)]
11pub enum DiffLineKind {
12 Added,
13 Removed,
14 Context,
15}
16
17#[derive(Debug, Clone)]
18pub struct DiffLine {
19 pub kind: DiffLineKind,
20 pub text: String,
21}
22
23#[derive(Debug, Clone)]
24pub struct DisplayToolUse {
25 pub name: String,
26 pub status: ToolUseStatus,
27 pub output_preview: String,
28 pub input_json: String,
29 pub input_summary: String,
30 pub output_excerpt: Vec<String>,
31 pub diff: Vec<DiffLine>,
32}
33
34#[derive(Debug, Clone, Copy, PartialEq, Eq)]
35pub enum ToolUseStatus {
36 Running,
37 Completed,
38 Error,
39}
40
41pub struct ConversationState {
42 pub messages: Vec<DisplayMessage>,
43 pub scroll_offset: usize,
44 pub auto_scroll: bool,
45 pub total_lines: usize,
46}
47
48impl ConversationState {
49 pub fn new() -> Self {
50 Self {
51 messages: Vec::new(),
52 scroll_offset: 0,
53 auto_scroll: true,
54 total_lines: 0,
55 }
56 }
57}
58
59impl Default for ConversationState {
60 fn default() -> Self {
61 Self::new()
62 }
63}