Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: the messages page's feed is a folded card named message log

The messages page had a card called messages under a nav tab called messages, and its feed was the only part of the page open on arrival. The feed is now the folded message log card, like the broadcast and schedules cards above it. Its header carries the connection badge (live, reconnecting, disconnected) so the state shows while it is folded; the reconnect button moves into the bar inside it. The stream keeps running while the card is folded, and opening it scrolls the list to the newest message.
This commit is contained in:
iris 2026-11-20 01:28:46 +01:00 • committed by mara
commit f29435fcf1
3 changed files with 27 additions and 23 deletions

View file

@ -596,8 +596,10 @@ since that agent's `send` row already did. The query `since_minutes` (default
read from each agent's newest 100 rows. A message an agent drained with an read from each agent's newest 100 rows. A message an agent drained with an
in-turn `recv` starts no turn and so is missing. in-turn `recv` starts no turn and so is missing.
The **messages** page (`/messages`) reads that feed. A **history** select picks The **messages** page (`/messages`) reads that feed. The feed is the **message
the window, from live only up to 24 hours, and a filter keeps the messages whose log** card, folded like the broadcast and schedules cards above it; a badge in its
header says whether the stream is live. Open it, and a **history** select picks the
window, from live only up to 24 hours, and a filter keeps the messages whose
sender or recipient contains the text you type. Each message is one row of the sender or recipient contains the text you type. Each message is one row of the
same list an agent's terminal uses, a summary line with the time, the two same list an agent's terminal uses, a summary line with the time, the two
parties and the start of the body, and the whole body under it. The list parties and the start of the body, and the whole body under it. The list

View file

@ -1,7 +1,7 @@
/* <MessagesPage>: the filter bar over the terminal-style message list. */ /* <MessagesPage>: the filter bar over the terminal-style message list. */
@import "@hive/shared/terminal.css"; @import "@hive/shared/terminal.css";
/* The broadcast card, folded by default, over the messages card. */ /* The broadcast and schedules cards, folded by default, over the message log. */
.ui-messages-page { .ui-messages-page {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View file

@ -3,6 +3,7 @@
// streams them (`GET /api/messages/stream`), across all hives. Above the // streams them (`GET /api/messages/stream`), across all hives. Above the
// list, a folded **broadcast** card holds the composer that sends one message // list, a folded **broadcast** card holds the composer that sends one message
// to several agents, and a folded **schedules** card holds the scheduled prompts. // to several agents, and a folded **schedules** card holds the scheduled prompts.
// The list itself is the folded **message log** card.
// //
// The stream sends the chosen window of history first, then the live tail. A // The stream sends the chosen window of history first, then the live tail. A
// message an agent drained with an in-turn `recv` is missing, because it starts // message an agent drained with an in-turn `recv` is missing, because it starts
@ -17,7 +18,6 @@ import { BroadcastComposer } from "../broadcast/BroadcastComposer.js";
import { SchedulesCard } from "../schedules/SchedulesPage.js"; import { SchedulesCard } from "../schedules/SchedulesPage.js";
import { Disclosure } from "../../ui/disclosure/Disclosure.js"; import { Disclosure } from "../../ui/disclosure/Disclosure.js";
import { Hint } from "../../ui/hint/Hint.js"; import { Hint } from "../../ui/hint/Hint.js";
import { Panel } from "../../ui/panel/Panel.js";
import { SelectField } from "../../ui/select-field/SelectField.js"; import { SelectField } from "../../ui/select-field/SelectField.js";
import { TextField } from "../../ui/text-field/TextField.js"; import { TextField } from "../../ui/text-field/TextField.js";
import { import {
@ -57,6 +57,8 @@ export function MessagesPage() {
const [sinceMinutes, setSinceMinutes] = useState(DEFAULT_WINDOW_MINUTES); const [sinceMinutes, setSinceMinutes] = useState(DEFAULT_WINDOW_MINUTES);
const [query, setQuery] = useState(""); const [query, setQuery] = useState("");
const [composing, setComposing] = useState(false); const [composing, setComposing] = useState(false);
// The log starts folded, as the cards above it do.
const [logOpen, setLogOpen] = useState(false);
// The composer is built on the first open and kept after, so what was typed // The composer is built on the first open and kept after, so what was typed
// and ticked stays through a fold, and a page where it is never opened does // and ticked stays through a fold, and a page where it is never opened does
// not poll the agent list. // not poll the agent list.
@ -82,7 +84,7 @@ export function MessagesPage() {
useLayoutEffect(() => { useLayoutEffect(() => {
const el = logRef.current; const el = logRef.current;
if (el && stickToBottom) el.scrollTop = el.scrollHeight - el.clientHeight; if (el && stickToBottom) el.scrollTop = el.scrollHeight - el.clientHeight;
}, [newestId, shown.length, stickToBottom]); }, [newestId, shown.length, stickToBottom, logOpen]);
return ( return (
<div class="ui-messages-page"> <div class="ui-messages-page">
@ -99,27 +101,27 @@ export function MessagesPage() {
{composerBuilt ? <BroadcastComposer /> : null} {composerBuilt ? <BroadcastComposer /> : null}
</Disclosure> </Disclosure>
<SchedulesCard /> <SchedulesCard />
<Panel <Disclosure
title="messages" title="message log"
icon="💬" icon="💬"
actions={ hint={
<> <Badge
<Badge tone={CONNECTION_TONE[connection]}
tone={CONNECTION_TONE[connection]} value={CONNECTION_LABEL[connection]}
value={CONNECTION_LABEL[connection]} />
/>
{connection === "closed" ? (
<Badge
variant="quiet"
value="reconnect"
title="open the message stream again"
onClick={reconnect}
/>
) : null}
</>
} }
open={logOpen}
onToggle={setLogOpen}
> >
<div class="ui-messages-bar"> <div class="ui-messages-bar">
{connection === "closed" ? (
<Badge
variant="quiet"
value="reconnect"
title="open the message stream again"
onClick={reconnect}
/>
) : null}
<SelectField <SelectField
id="messages-window" id="messages-window"
label="history" label="history"
@ -165,7 +167,7 @@ export function MessagesPage() {
an in-turn <code>recv</code> is missing. The history is at most 100 an in-turn <code>recv</code> is missing. The history is at most 100
recent messages per agent. recent messages per agent.
</Hint> </Hint>
</Panel> </Disclosure>
</div> </div>
); );
} }