agent_tui/detection/
traits.rs1use crate::terminal::ScreenBuffer;
2
3use super::pattern::PatternMatch;
4
5pub struct DetectionContext<'a> {
6 pub screen_text: &'a str,
7 pub lines: Vec<&'a str>,
8}
9
10impl<'a> DetectionContext<'a> {
11 pub fn new(screen_text: &'a str, _screen_buffer: Option<&'a ScreenBuffer>) -> Self {
12 Self {
13 screen_text,
14 lines: screen_text.lines().collect(),
15 }
16 }
17}
18
19#[allow(dead_code)]
20pub trait ElementDetectorImpl: Send + Sync {
21 fn detect_patterns(&self, ctx: &DetectionContext) -> Vec<PatternMatch>;
22
23 fn framework_name(&self) -> &'static str;
24
25 fn priority(&self) -> i32 {
26 0
27 }
28
29 fn can_detect(&self, _ctx: &DetectionContext) -> bool {
30 true
31 }
32}