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 pub sub_progress: Vec<String>,
33 pub live_output: String,
35}
36
37#[derive(Debug, Clone, Copy, PartialEq, Eq)]
38pub enum ToolUseStatus {
39 Running,
40 Completed,
41 Error,
42}
43
44pub struct ConversationState {
45 pub messages: Vec<DisplayMessage>,
46 pub scroll_offset: usize,
47 pub auto_scroll: bool,
48 pub total_lines: usize,
49}
50
51impl ConversationState {
52 pub fn new() -> Self {
53 Self {
54 messages: Vec::new(),
55 scroll_offset: 0,
56 auto_scroll: true,
57 total_lines: 0,
58 }
59 }
60}
61
62impl Default for ConversationState {
63 fn default() -> Self {
64 Self::new()
65 }
66}