Wire AgentCycleState through runner and TUI

Runner owns AgentCycleState, calls trigger() on each user message
instead of the old run_hook() JSON round-trip. Sends AgentUpdate
messages to TUI after each cycle.

TUI F2 screen reads agent state from messages instead of scanning
the filesystem on every frame. HookSession::from_fields() lets
poc-agent construct sessions without JSON serialization.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 00:52:57 -04:00
parent d097c8e067
commit 1c190a3925
5 changed files with 48 additions and 38 deletions

View file

@ -40,6 +40,16 @@ impl HookSession {
self.state_dir.join(format!("{}-{}", prefix, self.session_id))
}
/// Construct directly from fields.
pub fn from_fields(session_id: String, transcript_path: String, hook_event: String) -> Self {
HookSession {
state_dir: Self::sessions_dir(),
session_id,
transcript_path,
hook_event,
}
}
/// Load from a session ID string
pub fn from_id(session_id: String) -> Option<Self> {
if session_id.is_empty() { return None; }