topology: drop the parent field and the hierarchy it fed
`topology.json` was a map of `name -> parent | null`, and that value fed the whole agent hierarchy: `<parent>` / `<children>` recipient sentinels, the reparenting API (CLI verb, wire verb, dashboard endpoints, DAG node), the dashboard tree, the rebuild depth sort, and an unconditional bind-mount grant giving every agent RW on its direct children's state. Per the operator's ruling the field goes, and with it all of the above. The file survives as what remains once the value is gone: the roster of agent names, which is the set `ManageRootAgent` grants mounts over. It is now a JSON array; `read` still accepts the old map shape and keeps its keys, so a hive that upgrades across this does not blank its roster (and so no capability holder loses its mounts for the length of that window). Two sites kept their behaviour under a different recipient rather than losing it. Both addressed `<parent>`, which the broker already resolved to `operator` for a root agent, and every agent is now what that fallback called a root: - the harness's turn-failure / plugin-failure notification (`Surface::send_to_parent` -> `send_to_operator`), and - the send allow-list's always-permitted escape hatch, so an agent with a restrictive allow-list still has a way to say it is stuck. What is NOT preserved, deliberately: an agent with no capability no longer sees any other agent's dirs. `ManageRootAgent`'s own grant is unchanged -- still every agent in the roster, still state RW + config RO, still no `harness`. The dashboard's reparenting control (the M0V3 picker) is deleted with its CSS. The tree rendering that reads `ContainerView.parent` is left for the frontend owner -- it degrades to a flat list with the field gone.
This commit is contained in:
parent
392f16cbc0
commit
d94bc2188d
28 changed files with 236 additions and 1513 deletions
|
|
@ -355,83 +355,6 @@ impl Broker {
|
|||
Ok(u64::try_from(n.max(0)).unwrap_or(0))
|
||||
}
|
||||
|
||||
/// Send a "your parent changed from X to Y" notification to `child`,
|
||||
/// coalescing with any existing undelivered one so that multiple moves
|
||||
/// while the agent is offline collapse into a single message spanning
|
||||
/// the full arc (e.g. A→B then B→C becomes "your parent changed from A to C").
|
||||
///
|
||||
/// If an undelivered system reparent notification for `child` already
|
||||
/// exists, its body is updated in-place preserving the original "from"
|
||||
/// label. If none exists, a fresh message is inserted with `old_label`
|
||||
/// as the source.
|
||||
pub fn send_coalescing_reparent(
|
||||
&self,
|
||||
child: &str,
|
||||
old_label: &str,
|
||||
new_label: &str,
|
||||
) -> Result<()> {
|
||||
const PREFIX: &str = "your parent changed from ";
|
||||
const SEPARATOR: &str = " to ";
|
||||
let conn = self.conn.lock().unwrap();
|
||||
let now = Utc::now().timestamp();
|
||||
let existing: Option<(i64, String)> = conn
|
||||
.query_row(
|
||||
"SELECT id, body FROM messages
|
||||
WHERE recipient = ?1
|
||||
AND sender = ?2
|
||||
AND body LIKE ?3
|
||||
AND delivered_at IS NULL
|
||||
AND acked_at IS NULL
|
||||
LIMIT 1",
|
||||
params![
|
||||
child,
|
||||
hive_sh4re::manager::SYSTEM_SENDER,
|
||||
format!("{PREFIX}%")
|
||||
],
|
||||
|row| Ok((row.get::<_, i64>(0)?, row.get::<_, String>(1)?)),
|
||||
)
|
||||
.optional()?;
|
||||
if let Some((row_id, old_body)) = existing {
|
||||
// Preserve the original "from" label from the earlier notification.
|
||||
let original_from = old_body
|
||||
.strip_prefix(PREFIX)
|
||||
.and_then(|rest| rest.split(SEPARATOR).next())
|
||||
.unwrap_or(old_label);
|
||||
let new_body = format!("{PREFIX}{original_from}{SEPARATOR}{new_label}");
|
||||
conn.execute(
|
||||
"UPDATE messages SET body = ?1, sent_at = ?2 WHERE id = ?3",
|
||||
params![new_body, now, row_id],
|
||||
)?;
|
||||
drop(conn);
|
||||
let _ = self.events.send(MessageEvent::Sent {
|
||||
id: row_id,
|
||||
from: hive_sh4re::manager::SYSTEM_SENDER.to_owned(),
|
||||
to: child.to_owned(),
|
||||
body: new_body,
|
||||
at: now,
|
||||
in_reply_to: None,
|
||||
});
|
||||
} else {
|
||||
let body = format!("{PREFIX}{old_label}{SEPARATOR}{new_label}");
|
||||
conn.execute(
|
||||
"INSERT INTO messages (sender, recipient, body, sent_at, in_reply_to)
|
||||
VALUES (?1, ?2, ?3, ?4, NULL)",
|
||||
params![hive_sh4re::manager::SYSTEM_SENDER, child, body, now],
|
||||
)?;
|
||||
let row_id = conn.last_insert_rowid();
|
||||
drop(conn);
|
||||
let _ = self.events.send(MessageEvent::Sent {
|
||||
id: row_id,
|
||||
from: hive_sh4re::manager::SYSTEM_SENDER.to_owned(),
|
||||
to: child.to_owned(),
|
||||
body,
|
||||
at: now,
|
||||
in_reply_to: None,
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Long-poll variant of `recv_batch`: returns immediately if any
|
||||
/// row is pending (popping up to `max`); otherwise waits up to
|
||||
/// `timeout` for the broker to emit a `Sent { to: recipient }`
|
||||
|
|
|
|||
Loading…
Reference in a new issue