parent
f6eb0442c4
commit
99752f81d9
1 changed files with 40 additions and 79 deletions
|
|
@ -107,7 +107,7 @@ use crate::turn_stats::TurnStats;
|
|||
use anyhow::Result;
|
||||
use clap::Parser;
|
||||
use hive_core_agent_sock::{Request, Response};
|
||||
use hive_sh4re::manager::{HelperEvent, SYSTEM_SENDER};
|
||||
use hive_sh4re::manager::SYSTEM_SENDER;
|
||||
use hive_sock_client::Retry;
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
@ -134,21 +134,12 @@ async fn main() -> Result<()> {
|
|||
// ---------- shared turn helpers ----------
|
||||
|
||||
/// Surface a `SYSTEM_SENDER` message in the live event bus + tracing
|
||||
/// log. Both agents and the manager receive `HelperEvent` notifications
|
||||
/// (just `NeedsUpdate`, now that a container crash is a log line instead
|
||||
/// of a `ContainerCrash` event); the parse and log path is
|
||||
/// identical. Quiet no-op when `from` isn't
|
||||
/// `SYSTEM_SENDER`.
|
||||
/// log. Quiet no-op when `from` isn't `SYSTEM_SENDER`.
|
||||
fn log_system_event(bus: &Bus, from: &str, body: &str) {
|
||||
if from != SYSTEM_SENDER {
|
||||
return;
|
||||
}
|
||||
let parsed = serde_json::from_str::<HelperEvent>(body).ok();
|
||||
if let Some(event) = &parsed {
|
||||
tracing::info!(?event, "helper event");
|
||||
} else {
|
||||
tracing::info!(%from, %body, "system message");
|
||||
}
|
||||
tracing::info!(%from, %body, "system message");
|
||||
bus.emit(LiveEvent::Note {
|
||||
text: format!("[system] {body}"),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue