Repository navigation
Show herdr plugin pane tokens in the sidebar (#1209) - #1341
Conversation
herdr plugins attach short text values to a pane (`herdr pane report-metadata --token name=value`): the Quota plugin's usage left, herdr-projects' summary and progress. herdr's TUI draws them where the user's `[ui.sidebar.agents]` rows name `$name`; the web UI drew none. - Agent rows draw the pane's tokens as a small dim line of their own under the place, on One line and Two lines alike, only where the pane has one. Values are text, never markup; long ones are cut, and the row's tooltip and a phone's ⋯ sheet say them whole. A disconnected PC draws none, as it draws no state. - The design follows herdr's own sidebar: server/herdr-sidebar.ts reads the `$name` tokens (and their `hide` rules) of `[ui.sidebar.agents]` `rows` and `rows_by_agent` from herdr's config.toml (HERDR_CONFIG_PATH, XDG_CONFIG_HOME, then %APPDATA% or ~/.config), re-reads it when it changes while a browser listens, and tells it on the machine events as `herdr-sidebar`. Like herdr's sidebar it is this PC's config, applied to every PC's agents. Where no rows are set, every token is drawn, by name. herdr's colors and weights are not drawn. - Tokens already reach the client in herdr's snapshot and refresh on pane.updated. A plugin's `display_agent` alone comes only as a status event of the same status (live, herdr 0.9.3), so the collector now refreshes clients when that line changes instead of waiting for the 5 s poll. Tests: the token picker and herdr's rule semantics, the config reader and its watcher, the event stream, the collector's display_agent refresh, the row's rendering, a contract test against the isolated test herdr, and a demo browser regression with screenshots (scripts/sidebar-tokens-demo-regression.ts). Closes #1209 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…how-herdr-plugin-pane-tokens-
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
Review 1 · Pass Does the change do what the task asked? Yes. Gate: major and worse must be fixed. The change carries pane tokens through to the agent sidebar and presents them safely in desktop and phone layouts. The live isolated herdr test and demo browser checks passed; the full fast check had two unrelated unit test failures on this host, so the whole repository suite is not green here. No findings. |
…how-herdr-plugin-pane-tokens-
|
Review 2 · Pass Does the change do what the task asked? Yes. Gate: major and worse must be fixed. The change meets the requested behavior in the inspected server, shared contract, and sidebar paths. Focused server and UI tests passed, and the demo browser regression exercised live updates, configured token selection, long values, plain text rendering, and phone layouts. I found no qualifying faults; the full repository check suite was not run. No findings. |
…e rows The phone sheet scrolls long token values instead of pushing its actions out, an open sheet reads its row at each render, a recovery resets the display_agent baseline to the resynced snapshot, and a token named twice in herdr's rows shows at the first place that does not hide it. Refs #1349.
…e rows (#1402) Refs #1349 (items 1, 2, 3 and 5; item 4, hide-rule operands on the machine events, touches what watch-only browsers receive and goes in its own PR). ## Change Follow-ups to #1341 (plugin pane tokens in the sidebar, not released yet, so no changelog fragment: `changelog.d/sidebar-plugin-tokens.md` still describes the feature). 1. **Long token values no longer push the phone sheet's actions away.** `.row-sheet-detail` is capped at a third of the screen and scrolls. Before, 32 long tokens filled the sheet: the title scrolled off the top and Pin agent sat under Cancel, out of reach. This follows the iOS action sheet (and the Claude and Codex apps' long-press sheets): a long message scrolls, the actions stay put. 2. **An open phone sheet follows its row.** `AgentSidebar` kept a copy of the title, place and tokens taken when the menu opened. The menu now keeps only which row and anchor, and reads what it says from the row at each render, so a changed value, a hide rule that now applies or a PC going away shows in the open sheet too. 3. **A plugin line (`display_agent`) after a recovery is measured against what clients show.** The collector's dedupe baseline was seeded only for panes it had never seen, so after a lost subscription the baseline stayed at the line heard before the loss. A change back to that line then looked like no change, and the sidebar waited for the next roster poll. On a resync, which already tells clients to read the panes again, the baseline now takes the snapshot's line, except for panes an event has spoken for since the snapshot was asked. 4. **A token named twice in herdr's rows shows if any of its places shows it.** `server/herdr-sidebar.ts` kept only the first place of a token, so a token hidden by its first place's rule showed nowhere, though herdr tests each place on its own (`src/ui/sidebar/tokens.rs` maps every row entry independently). The parser now keeps each place, and `paneTokenValues` says a token once, at the first place whose rules leave it shown. The `herdr-sidebar` machine event may now list a name more than once; an older browser reading it keeps the first place, as before. ## Validation - `bun run check fast`: workflow syntax, generated types and themes, typecheck, build, unit tests (4504 pass, 0 fail, 8 skip). - New unit cases: `shared/pane-tokens.test.ts` (a token named twice), `server/herdr-sidebar.test.ts` (each place kept, updated from "each once"), `server/collector.test.ts` (an event after a recovery). The collector case times out against main's `server/collector.ts` and passes with this change. - `scripts/sidebar-tokens-demo-regression.ts` (demo fixture, no live session) gained two phone checks: the open sheet's detail follows a changed value, and with 32 long tokens the sheet's title, Pin agent and Cancel are on screen and hit-testable while the detail scrolls. All four desktop and phone passes are green. Both checks failed on main when reproduced by hand before the fix (Pin agent covered by Cancel; sheet kept `40% 12m · 5h 95%` after the row changed).
HWU-3 is finished: agent rows in the sidebar now show what herdr plugins attach to a pane (#1209). It's one commit on the branch (fc7d9e3), and the message says
Closes #1209. The earlier stop was the weekly usage limit, not a fault in the code; I picked up from what was on disk.What users see
5h 95% · Wk 67%, or a task's progress) appear as a small dim line under its agent row. This works in both One line (the default) and Two lines mode, and only on panes that have values.$nametokens and theirhiderules from your herdr[ui.sidebar.agents]rows (including per-agent rows). If no rows are set, every value is shown. As in herdr's own sidebar, the config of the PC running the web UI applies to remote PCs too.display_agent) already showed in the row; it now also updates immediately. Before, it could lag up to 5 seconds, because herdr announces that change as a status event with an unchanged status.Checks
sidebar-activityfails the same way on the unchanged base commit.bun run check fast: typecheck and build pass. Unit tests: 4382 pass, 2 fail, neither caused by this change:install-starfails the same way on the base commit on this Mac, andportalpassed when rerun.I wrote a page with the demo screenshots: /Users/devswha/.herdr-projects/reports/herdr-web-ui/3/index.html
Also noticed
scripts/ci-tests.ts: the unit runner only picks up*.test.ts, sosrc/components/*.test.tsx(AgentMark, TurnTime, …) never run in CI.scripts/install-star.test.ts: "opens nothing on a PC with no display and no BROWSER" fails on macOS.scripts/sidebar-activity-demo-regression.ts: times out waiting for thecheckout-apiworkspace menu on this Mac.server/api.contract.test.ts: "creates, edits, searches, inspects, and closes an owned workspace" doesn't findmention.txtlocally.server/portal.test.ts: "rechecks cancellation after awaiting the relay" failed once under the parallel unit run.Task: HWU-3 (herdr-web-ui/3)