hive-sh4re: split manager-socket constants + HelperEvent into their own topic module
This commit is contained in:
parent
02bbff1e34
commit
138f6b6c10
24 changed files with 268 additions and 244 deletions
|
|
@ -105,7 +105,7 @@ fn emit_crash_transitions(coord: &Coordinator, prev: &HashSet<String>, current:
|
|||
}
|
||||
tracing::warn!(agent = %stopped, "container crash detected");
|
||||
coord.record_crash(stopped);
|
||||
coord.notify_manager(&hive_sh4re::HelperEvent::ContainerCrash {
|
||||
coord.notify_manager(&hive_sh4re::manager::HelperEvent::ContainerCrash {
|
||||
agent: stopped.clone(),
|
||||
note: Some("container stopped without an operator action".into()),
|
||||
});
|
||||
|
|
@ -138,7 +138,7 @@ async fn emit_login_transitions(
|
|||
tracing::info!(%agent, "agent logged in");
|
||||
let _ = coord
|
||||
.push_todo(
|
||||
hive_sh4re::MANAGER_AGENT,
|
||||
hive_sh4re::manager::MANAGER_AGENT,
|
||||
"core",
|
||||
Some(format!("logged_in:{agent}")),
|
||||
format!("agent '{agent}' logged in"),
|
||||
|
|
@ -169,7 +169,7 @@ async fn emit_login_transitions(
|
|||
tracing::info!(%agent, "agent needs login");
|
||||
let _ = coord
|
||||
.push_todo(
|
||||
hive_sh4re::MANAGER_AGENT,
|
||||
hive_sh4re::manager::MANAGER_AGENT,
|
||||
"core",
|
||||
Some(format!("needs_login:{agent}")),
|
||||
format!("agent '{agent}' needs login"),
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ async fn broadcast_change(coord: &Coordinator, before: &str, after: &str) {
|
|||
} else {
|
||||
format!("[system] /knowledge updated:\n{stat}")
|
||||
};
|
||||
let errors = coord.broadcast_send(hive_sh4re::SYSTEM_SENDER, &body);
|
||||
let errors = coord.broadcast_send(hive_sh4re::manager::SYSTEM_SENDER, &body);
|
||||
if !errors.is_empty() {
|
||||
tracing::warn!(?errors, "knowledge: broadcast had per-agent failures");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ async fn fire_schedule(coord: &Arc<Coordinator>, schedule: &Schedule, now: i64)
|
|||
// no in-container todo inbox, so it keeps the regular broker
|
||||
// `Message` path; the dashboard mirrors `to == operator` into
|
||||
// its own pane.
|
||||
if target != hive_sh4re::OPERATOR_RECIPIENT && !known.contains(target) {
|
||||
if target != hive_sh4re::manager::OPERATOR_RECIPIENT && !known.contains(target) {
|
||||
let reason = format!("no such agent: {target}");
|
||||
if let Err(e) =
|
||||
coord
|
||||
|
|
@ -169,9 +169,9 @@ async fn deliver_to_target(
|
|||
target: &str,
|
||||
body: &str,
|
||||
) -> Result<(), String> {
|
||||
if target == hive_sh4re::OPERATOR_RECIPIENT {
|
||||
if target == hive_sh4re::manager::OPERATOR_RECIPIENT {
|
||||
let msg = Message {
|
||||
from: hive_sh4re::trusted_sender("scheduled"),
|
||||
from: hive_sh4re::manager::trusted_sender("scheduled"),
|
||||
to: target.to_owned(),
|
||||
body: body.to_owned(),
|
||||
in_reply_to: None,
|
||||
|
|
@ -205,8 +205,8 @@ fn notify_operator_missing_target(coord: &Coordinator, schedule: &Schedule, targ
|
|||
body = schedule.body
|
||||
);
|
||||
let msg = Message {
|
||||
from: hive_sh4re::trusted_sender("scheduled"),
|
||||
to: hive_sh4re::OPERATOR_RECIPIENT.to_owned(),
|
||||
from: hive_sh4re::manager::trusted_sender("scheduled"),
|
||||
to: hive_sh4re::manager::OPERATOR_RECIPIENT.to_owned(),
|
||||
body,
|
||||
in_reply_to: None,
|
||||
};
|
||||
|
|
@ -291,7 +291,7 @@ pub async fn fire_now(
|
|||
continue;
|
||||
}
|
||||
let target = &target_row.target;
|
||||
if target != hive_sh4re::OPERATOR_RECIPIENT && !known.contains(target) {
|
||||
if target != hive_sh4re::manager::OPERATOR_RECIPIENT && !known.contains(target) {
|
||||
let reason = format!("manual fire: no such agent: {target}");
|
||||
if let Err(e) =
|
||||
coord
|
||||
|
|
@ -371,7 +371,7 @@ pub async fn fire_now(
|
|||
async fn known_agents() -> std::collections::HashSet<String> {
|
||||
use std::collections::HashSet;
|
||||
let mut out: HashSet<String> = HashSet::new();
|
||||
out.insert(hive_sh4re::MANAGER_AGENT.to_owned());
|
||||
out.insert(hive_sh4re::manager::MANAGER_AGENT.to_owned());
|
||||
match crate::lifecycle::list().await {
|
||||
Ok(list) => {
|
||||
for raw in list {
|
||||
|
|
|
|||
Loading…
Reference in a new issue