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

@ -135,11 +135,11 @@ pub struct AgentCycleOutput {
}
/// Per-agent runtime state visible to the TUI.
#[derive(Clone, Debug)]
pub struct AgentInfo {
pub name: &'static str,
pub pid: Option<u32>,
pub phase: Option<String>,
pub last_log: Option<std::path::PathBuf>,
}
/// Persistent state for the agent orchestration cycle.
@ -164,7 +164,7 @@ impl AgentCycleState {
.create(true).append(true).open(log_path).ok();
let agents = AGENT_CYCLE_NAMES.iter()
.map(|&name| AgentInfo { name, pid: None, phase: None, last_log: None })
.map(|&name| AgentInfo { name, pid: None, phase: None })
.collect();
AgentCycleState {