feat(#1137): rich unread summary in loose ends and wake signal

- hive-sh4re: UnreadMatrix gains summary: String field (per-room breakdown)
- hive-matrix-mcp/protocol: add RoomUnread struct + UnreadSummary request
- hive-matrix-mcp/handlers: collect_unread() fetches per-room data;
  single-unread rooms include truncated last-message body + sender;
  multi-unread rooms carry count only
- hive-matrix-mcp/wake: format_unread_summary() builds wake body from
  RoomUnread slice; terse one-liner for single-room/single-message,
  bulleted list for multi-room; always appends read-hint
- hive-matrix-mcp/timeline: wake body now covers all rooms with unread
  at fire time, not just the triggering event; falls back to per-event
  teaser if notification counts haven't updated yet
- hive-ag3nt/mcp: matrix_unread_summary() replaces matrix_unread_rooms();
  UnreadMatrix loose end carries per-room summary lines; render shows
  room breakdown with sender: body for single-unread rooms
This commit is contained in:
atlas 2026-06-03 12:52:24 +02:00
commit 68e30b857c
19 changed files with 421 additions and 108 deletions

View file

@ -277,7 +277,16 @@ impl RebuildQueue {
reason: String,
parent_id: Option<u64>,
) -> u64 {
self.enqueue_full(kind, agent, source, reason, parent_id, Vec::new(), None, None)
self.enqueue_full(
kind,
agent,
source,
reason,
parent_id,
Vec::new(),
None,
None,
)
}
/// Same as `enqueue` but carries an `inputs` payload — used by
@ -1304,14 +1313,20 @@ mod tests {
Some(meta),
);
// The two Rebuilds have different parent_ids — must NOT dedup.
assert_ne!(sweep_rebuild, cascade_rebuild,
"cascade rebuild must be distinct from startup-sweep rebuild");
assert_ne!(
sweep_rebuild, cascade_rebuild,
"cascade rebuild must be distinct from startup-sweep rebuild"
);
let snap = q.snapshot();
let rebuilds: Vec<_> = snap.iter()
let rebuilds: Vec<_> = snap
.iter()
.filter(|e| e.kind == QueueKind::Rebuild && e.agent == "alice")
.collect();
assert_eq!(rebuilds.len(), 2,
"both rebuilds must be present in the queue");
assert_eq!(
rebuilds.len(),
2,
"both rebuilds must be present in the queue"
);
}
#[test]