hive-agent: add stream_enrich module — stamp _icon/_summary/_category on SSE events

Move per-message rendering logic from frontend JS to backend Rust.
A new stream_enrich::enrich() function stamps display fields onto
LiveEvent::Stream payloads at SSE-emit time (both live tail and history
replay), so the frontend can consume pre-computed fields instead of
re-implementing the dispatch logic in JavaScript.

Phase 1: backend stamps _icon/_summary/_category; client falls back to
its own JS tables when absent. Zero user-visible change.

- system events: _category (drop/thinking_tok/note/details) + _summary
  and optional _body (commands_changed expands to a slash-cmd list)
- assistant tool_use entries: _icon + _summary per tool; rich tools
  (Write, Edit, send, ask, answer) get _category: 'rich'
- enrichment applied in web_ui/stream.rs at emit time; DB stores raw
  events so no migration is needed when enrichment logic changes
- idempotent: existing _-prefixed fields are left unchanged
This commit is contained in:
iris 2026-07-19 17:32:35 +02:00
commit ae3f011eb3
3 changed files with 733 additions and 1 deletions

View file

@ -22,6 +22,7 @@ mod plugins;
mod prompt;
mod serve_common;
mod stats;
mod stream_enrich;
mod turn;
mod turn_stats;
mod vacuum;