swarm-ui: read-only agent terminal page consuming the swarm term stream
Moves the TermMsg rendering pipeline (Row.tsx, termMsg.ts, linkify.tsx,
markdown.ts) from @hive/agent into @hive/shared, so swarm-ui becomes a
second consumer of it instead of forking a copy -- CSS was already
shared (@hive/shared/terminal.css). marked+dompurify move from
@hive/agent's deps to @hive/shared's; swarm-ui picks them up
transitively, no new direct dep there.
New swarm-ui route /agents/:name/term (AgentTermPage), linked from
AgentsPage's detail panel via a "terminal" badge next to "link matrix
account". Consumes GET /api/agents/{name}/term/stream: unlike
@hive/agent's own useLiveStream (TermEnvelope-wrapped, history/backfill
dance), the swarm relay forwards one bare TermMsg per SSE event with no
envelope and no history endpoint -- useSwarmTermStream is a much
smaller hook for that shape (EventSource -> parse -> coalesce, nothing
to buffer/dedupe/backfill against).
Verified against a live SSE mock (screenshots in /agents/iris/state/screenshots/
3801-agents-detail-panel-terminal-badge.png and
3801-agent-term-page-live-rows.png -- real rows rendering through the
shared Row component, not just a build/typecheck pass).
This commit is contained in:
parent
5dff508e79
commit
593923375c
15 changed files with 232 additions and 22 deletions
|
|
@ -18,7 +18,9 @@ publishes rows bare, with no envelope around them
|
|||
read the time from.
|
||||
|
||||
The frontend renders a `TermMsg` close to as-is
|
||||
(`frontend/packages/agent/src/components/Row.tsx`): `level` picks the
|
||||
(`frontend/packages/shared/src/terminal/Row.tsx` — moved out of
|
||||
`packages/agent` once swarm-ui became a second consumer of it): `level`
|
||||
picks the
|
||||
CSS colour (`terminal.css`'s `.live .level-*`), an empty `summary` +
|
||||
markdown `body` renders as a flat row with just the body (assistant
|
||||
text), and any other bodied row is an expandable `<details>`, opened by
|
||||
|
|
@ -59,7 +61,7 @@ read that when you need the specifics, this doc doesn't duplicate it.
|
|||
|
||||
## Markdown
|
||||
|
||||
`frontend/packages/agent/src/lib/markdown.ts`'s `renderMarkdown()` runs
|
||||
`frontend/packages/shared/src/terminal/markdown.ts`'s `renderMarkdown()` runs
|
||||
`marked.parse()` through DOMPurify into a `<div class="md">`. Applied to
|
||||
any `TermMsg` with `body_format: "markdown"`.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue