Skip to content

Commit b64e70b

Browse files
d4ncerclaude
andcommitted
feat(ui): add EventLine struct and UiEvent::Event variant
Add the EventLine data type for the upcoming Events panel with category, message, timestamp, and is_error fields. Add the Event(EventLine) variant to UiEvent and a pub re-export from ui::mod. Include a no-op match arm in state::apply() to maintain exhaustive matching, and a basic PartialEq test for EventLine. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 25585f0 commit b64e70b

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

src/ui/event.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ pub struct ToolLine {
99
pub summary: String,
1010
}
1111

12+
/// A structured event entry for the Events panel.
13+
#[derive(Debug, Clone, PartialEq, Eq)]
14+
pub struct EventLine {
15+
/// Category label: "task", "iter", "feature", "verify", "review",
16+
/// "journal", "knowledge", "interrupt", "dag", "config".
17+
pub category: String,
18+
/// Pre-formatted message with template variables already substituted.
19+
pub message: String,
20+
/// Local timestamp formatted as "HH:MM:SS".
21+
pub timestamp: String,
22+
/// If true, render message in error style (red) instead of info style.
23+
pub is_error: bool,
24+
}
25+
1226
/// Event payload rendered by the TUI.
1327
#[derive(Debug, Clone, PartialEq, Eq)]
1428
pub enum UiEvent {
@@ -25,4 +39,31 @@ pub enum UiEvent {
2539
IterationDivider {
2640
iteration: u32,
2741
},
42+
/// Structured orchestration event for the Events panel.
43+
Event(EventLine),
44+
}
45+
46+
#[cfg(test)]
47+
mod tests {
48+
use super::*;
49+
50+
#[test]
51+
fn event_line_partial_eq() {
52+
let a = EventLine {
53+
category: "task".to_string(),
54+
message: "t-abcd1234 claimed".to_string(),
55+
timestamp: "14:32:05".to_string(),
56+
is_error: false,
57+
};
58+
let b = a.clone();
59+
assert_eq!(a, b);
60+
61+
let c = EventLine {
62+
category: "task".to_string(),
63+
message: "t-abcd1234 claimed".to_string(),
64+
timestamp: "14:32:05".to_string(),
65+
is_error: true,
66+
};
67+
assert_ne!(a, c);
68+
}
2869
}

src/ui/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::sync::mpsc::{self, Sender};
1212
use std::sync::{Mutex, OnceLock};
1313
use std::thread::JoinHandle;
1414

15+
pub use event::EventLine;
1516
pub use event::UiEvent;
1617

1718
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

src/ui/state.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ impl AppState {
167167
self.tools.pop_front();
168168
}
169169
}
170+
UiEvent::Event(_) => {
171+
// TODO: Events panel state management (Phase 1 state task)
172+
}
170173
}
171174
}
172175

0 commit comments

Comments
 (0)