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