pub trait AgentParser: Send + 'static {
// Required methods
fn name(&self) -> &str;
fn on_bytes(&mut self, bytes: &[u8]) -> Vec<AgentEvent>;
// Provided method
fn on_eof(&mut self) -> Vec<AgentEvent> { ... }
}Expand description
Translates raw PTY bytes into structured AgentEvents.
Implementations are agent-specific. They may use vt100 internally to
track screen state, or treat the byte stream as a raw text stream, or
any combination thereof.
Parsers run on the PTY reader thread (sync) — keep work bounded.
Required Methods§
Sourcefn on_bytes(&mut self, bytes: &[u8]) -> Vec<AgentEvent>
fn on_bytes(&mut self, bytes: &[u8]) -> Vec<AgentEvent>
Process a new chunk of bytes from the agent’s PTY. Return any CAP events extracted (zero or more). May be empty if the parser needs more data to make a decision.
Provided Methods§
Sourcefn on_eof(&mut self) -> Vec<AgentEvent>
fn on_eof(&mut self) -> Vec<AgentEvent>
Called once when PTY EOF is observed (agent exited). Return any
final events (e.g. a synthesised AgentEvent::Done).