agent page: inbox view of last 30 messages addressed to this agent

new wire request AgentRequest::Recent { limit } / ManagerRequest::Recent
(plus matching responses with Vec<InboxRow>). InboxRow moved to
hive-sh4re so it lives on both surfaces without an internal-to-wire
conversion. host-side dispatch in agent_server / manager_server
calls broker.recent_for(name, limit).

per-agent web_ui /api/state grew an inbox: Vec<InboxRow> populated
via the same per-agent socket (best-effort; transport failure
returns empty). frontend renders as a collapsible <details> section
between the state row and the terminal — fmt timestamp / from /
body in a tight grid, capped at 16em scrollable. only visible when
there are rows.
This commit is contained in:
müde 2026-05-15 20:32:19 +02:00
parent bd7d2d4860
commit 538e0446d7
13 changed files with 151 additions and 20 deletions

View file

@ -337,6 +337,30 @@
}
renderStateBadge();
}
function renderInbox(rows) {
const root = $('inbox-section');
const list = $('inbox-list');
const summary = $('inbox-summary');
if (!root || !list || !summary) return;
if (!rows.length) {
root.hidden = true;
return;
}
root.hidden = false;
summary.textContent = 'inbox · ' + rows.length;
list.innerHTML = '';
const fmt = (n) => new Date(n * 1000).toISOString().replace('T', ' ').slice(5, 19);
for (const m of rows) {
const li = el('li');
li.append(
el('span', { class: 'inbox-ts' }, fmt(m.at)), ' ',
el('span', { class: 'inbox-from' }, m.from), ' ',
el('span', { class: 'inbox-sep' }, '→'), ' ',
el('span', { class: 'inbox-body' }, m.body),
);
list.append(li);
}
}
function renderLastTurn(ms) {
const el_ = $('last-turn');
if (!el_) return;
@ -386,6 +410,7 @@
const s = await resp.json();
if (!headerSet) { setHeader(s.label, s.dashboard_port); headerSet = true; }
renderTermInput(s.label, s.status === 'online');
renderInbox(s.inbox || []);
// Drive the state badge from the harness status. Live SSE events
// override to 'thinking' / 'idle' as turns start/end; this only
// kicks in for the not-online (offline) case and the initial seed.