pi-subagent-web0.1.1
Live browser view of pi-subagents runs — Astryx chat UI, markdown transcript, inline tool calls, token/cost. Reads the artifacts pi-subagents already writes; no RPC.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-subagent-web
Live browser view of every pi-subagents run, built on Astryx
(@astryxdesign/core 0.7.17) — the same design system as
astryx.atmeta.com/templates/ai-chat. Markdown transcript, inline tool calls,
token/cost, grouped by project.
Install
pi install npm:pi-subagent-web # as a Pi package
# or try it once:
pi -e npm:pi-subagent-web
Then /reload in Pi. Requires pi-subagents (it reads that extension's artifacts) and,
for the built-in fonts + Astryx, nothing else — the whole UI is vendored.
Standalone, no Pi needed:
npx -y -p pi-subagent-web bun node_modules/pi-subagent-web/server.ts
# or from a clone:
bun ./server.ts # node ./server.ts also works (Node >= 22.6)
open http://127.0.0.1:7788
Use
/subagent-web # start server if needed + open browser
/subagent-web stop # stop it
/subagent-web open # just open the browser again
Runtime state (server log + pid) lives in ~/.pi/agent/subagent-web/, not in the package.
How it works
No RPC, no IPC, no build step. The server reads the lifecycle artifacts pi-subagents already writes to disk and indexes them every ~1.5s:
| source | path | gives |
|---|---|---|
| async runs | $TMPDIR/pi-subagents-*/async-subagent-runs/<runId>/ |
status.json (state, model, usage), events.jsonl (messages + full tool args/results), output-N.log, subagent-log-*.md |
| foreground / older runs | ~/.pi/agent/sessions/*/subagent-artifacts/<runId>_<agent>_*.jsonl |
_meta.json, _transcript.jsonl (no tool results), _output.md |
events.jsonl is preferred when both exist — the transcript is redacted and
carries no tool output.
UI
ui.html is React 19 + htm + Astryx, loaded
through an import map from vendor/ — no bundler, no npm install at runtime.
Components used: Theme, ChatLayout, ChatMessageList, ChatMessage,
ChatMessageBubble, ChatMessageMetadata, ChatSystemMessage,
ChatToolCalls, Markdown, Section, ListItem, Badge, Token,
Timestamp, Avatar, StatusDot, Switch, EmptyState.
Consecutive tool calls collapse into one ChatToolCalls group; expanding a row
shows its args and result as code blocks.
Sidebar
- 运行中 section pinned at the top: every live run across all projects, with a pulsing dot, its project tag and elapsed time. Live runs are excluded from their project group.
- Project groups are
Collapsible, collapsed by default; open ones persist inlocalStorage["sw.openProjects"](array of project names).
Header & settings
No bottom composer dock — the transcript owns the whole height. Everything that used to sit in the dock moved up:
- run meta row ends with
N 条 - a gear
IconButtonopens an AstryxPopoverholding the 隐藏工具调用 switch and the 字号 slider (13–21 px) 深色/浅色and原始输出stay as header buttons
ChatLayout is not used: it always renders its frosted composer dock, so the transcript is a
plain scroll container with a bottom-follow effect (scrolls when the reader is already within
240 px of the bottom).
Highlighting & font size
Astryx CodeBlock/Markdown highlight with built-in regex grammars — no shiki, no
highlight.js. Languages available out of the box: typescript/tsx/js/json/html/css/scss/
python/bash/sh/php/yaml/markdown/c/cpp/sql/rust/kotlin/swift/go. Others (java, ruby, lua,
toml, graphql, dockerfile, powershell, thrift, objective-c) must be imported from
@astryxdesign/core/CodeBlock/languages/*.
- Tool call args are always fenced as
json; the result is fenced by the file extension it read (pathin the args), shell output staysplaintext. - Assistant fences whose info string no tokenizer knows (
```acceptance,```output) are retagged tojsonwhen the body parses as JSON — otherwise they render flat. - Chrome renders tokens through the CSS Custom Highlight API, so the DOM holds plain text
and
getComputedStyleshows one colour. Verify highlighting from a screenshot, not from the DOM.
Font size: a Slider (13–21 px) sets document.documentElement.style.fontSize; Astryx
sizes everything in rem, so the whole UI scales. Persisted in localStorage["sw.fontSize"].
Endpoints
GET /api/runs— all runs, newest first (summary rows)GET /api/run/<id>?from=N— run header + items appended after N (incremental tail)GET /api/raw/<id>/output|log— final markdown output / run logGET /health
Files
server.ts— indexer + HTTP server (bun or node)ui.html— the appvendor/— Astryx 0.7.17 vendored:core.js(2.2 MB, esm.sh bundle),theme-neutral.js+dist/,react*,htm,stylex, and the three CSS files (reset.css,astryx.css,theme.css). Absolute esm.sh import paths inside them were rewritten to/vendor/*.vendor/fonts.css+ the woff2 files — opencode's font pair, copied fromopencode.ai/_build/assets: Inter (Inter OC, variable 100–900) for UI text, OpenMono for code. Self-hosted, no Google Fonts. The Astryx theme variables are overridden inline on the app root becausetheme.csssets them inside@scope ([data-astryx-theme="neutral"]), so:rootalone does not win.index.ts— pi extension:/subagent-webcommand, spawns the server detachedserver.log,server.pid— runtime state
Notes
- Binds
127.0.0.1only. Override port withSUBAGENT_WEB_PORT. - Tool results are clipped at 6000 chars per call.
- Neither Inter nor OpenMono carries CJK, so Chinese falls back to the system font (same as opencode.ai).
- Reads the same files pi-subagents cleans up on its own retention schedule; old runs disappear from the list when their artifacts are pruned.