agent ui: live event panel via SSE + stream-json

This commit is contained in:
müde 2026-05-15 15:01:26 +02:00
parent 3c9d42b2a7
commit 9eab28a716
8 changed files with 277 additions and 33 deletions

View file

@ -9,6 +9,7 @@ use std::time::Duration;
use anyhow::{Result, bail};
use clap::{Parser, Subcommand};
use hive_ag3nt::events::Bus;
use hive_ag3nt::login::{self, LoginState};
use hive_ag3nt::{DEFAULT_SOCKET, DEFAULT_WEB_PORT, client, web_ui};
use hive_sh4re::{HelperEvent, ManagerRequest, ManagerResponse, SYSTEM_SENDER};
@ -66,11 +67,14 @@ async fn main() -> Result<()> {
tracing::info!(state = ?initial, claude_dir = %claude_dir.display(), "hm1nd boot");
let login_state = Arc::new(Mutex::new(initial));
let ui_state = login_state.clone();
let bus = Bus::new();
let ui_bus = bus.clone();
tokio::spawn(async move {
if let Err(e) = web_ui::serve(label, port, ui_state).await {
if let Err(e) = web_ui::serve(label, port, ui_state, ui_bus).await {
tracing::error!(error = ?e, "web ui failed");
}
});
let _ = bus; // manager turn loop not wired to events yet
match initial {
LoginState::Online => serve(&cli.socket, Duration::from_millis(poll_ms)).await,
LoginState::NeedsLogin => {