feat(plugins): perf.read / perf.act bridges; Performance and Storage move to the performance plugin #15

Closed
gabrielvidal wants to merge 0 commits from performance-plugin into main
pull from: performance-plugin
Owner

Summary

The Performance and Storage dashboards, and the conversation's CPU & RAM and On disk Details cards, leave the core for the performance live plugin (companion PR: gabrielvidal/ai-agent-plugins#7 (gabrielvidal/ai-agent-plugins#7)). The core gains two owner-only bridges the plugin reads and acts through: perf.read and perf.act. The plugin also reads telemetry.read, whose bridge gets a hub/telemetry/hub route for the Hub itself section. Everything that measures (backend/perf/, every /api/perf/* route) stays core. So do the conversation header's chips, the Bash cards' cost strip and the guest Stats. This follows the activity / plan-usage moves: after it, every Dashboards page is a plugin's.

Key changes

  • backend/plugins/hubperf.py (new):
    • perf.read: GET …/hub/perf/live, history, conversations, commands, conversation/{sid}?series=10m,life ({perf, series}, one call per card refresh), conversation/{sid}/storage, storage, storage/history, storage/writers, storage/config and settings. live and storage also return profiles and guestNames.
    • perf.act: POST …/hub/perf/kill, keep, settings, storage/rm, storage/scan and storage/config. Only the plugin's own handlers may call them.
    • telemetry.read gains …/hub/telemetry/hub.
    • The bridges call the existing route functions, so no logic is duplicated.
  • backend/plugins/manifest.py: adds the perf.read and perf.act capabilities (operator-only, labelled). main.py mounts the router.
  • Frontend: the moved files are deleted (about −3,300 lines):
    • pages/Performance.tsx, pages/Storage.tsx, perfLive, perfTotals, perfViz, perfStorage, storageItems, storageWriters, HubCard, guestPill;
    • hubAnalysis (+ its test), telemetryApi, perfApi;
    • conversations/components/PerfCards.tsx and StorageCards.tsx.
    • viz.tsx keeps only useTip (the guest Stats heatmap). perfFormat.ts keeps fmtBytes, fmtPct and fmtCpuTime.
  • PerformanceRedirect.tsx: /dashboards/performance and /dashboards/storage go to /plugins/performance/performance and …/storage, or to /dashboards when the plugin isn't installed.
  • nav.ts: the Dashboards drawer's Performance entry now also matches /plugins/performance. DashboardsPanel drops its two core rows, and the telemetry feature paths now point at the plugin pages.
  • Conversation.tsx:
    • the six perf cards leave DETAIL_CARDS;
    • DETAIL_CARD_RENAMES maps perfLive, perfTotals, perfLife, perfCommands and perfLeftovers to plugin:performance:conv-perf, and storage to plugin:performance:conv-storage;
    • detailSlotUpdate adds drawerOpen and prompts (each prompt's epoch seconds).
  • PerfCard.tsx and StorageCard.tsx keep only the header chips (PerfChip, StorageChip).
  • Docs: CLAUDE.md (Performance and Storage sections, telemetry pages) and docs/plugins.md (the bridges, plus a row in the retired-widgets table).
  • backend/test_plugin_perf_bridge.py (new, 12 tests).

Key decisions

  • Two slots, not six. The five CPU & RAM cards become one conv-perf slot, and On disk becomes conv-storage. Saved drawer layouts keep their position because every old id maps onto the new slots.
  • The header chips stay core. There is no plugin slot in the conversation header. The core Performance switch now gates only the chips; the plugin's cards have their own Performance cards switch.
  • perf.act is limited to the plugin's own handlers. Kill, Remove and Measure change things on the machines, so even the owner's caller token can't reach them directly. They go through the plugin's checked act action.
  • The redirect waits on isPending, not isLoading. On a cold load the plugin list can be pending before its fetch starts. The redirect then bounced to the overview, and a real browser on the local hub hit this every time. ActivityRedirect and PlanUsageRedirect have the same pattern; they are left untouched here and noted as a follow-up.
  • The guest pick is now the page's own. Before, it was shared with the Guests home. A frame can't write the app's filter store, and adding a bridge for that one use wasn't worth it.
  • /api/perf/* and /api/telemetry/hub stay. The chips, CallCost, CommandPlayback, the guest Stats and the bridges themselves use them.

Changelog

  • Changed: the Performance and Storage dashboards are now the Performance plugin's pages (Dashboards → Performance / Storage). Old links still work.
  • Changed: a conversation's CPU & RAM and On disk cards in Details come from the Performance plugin, with their own "Performance cards" switch.

Test notes

  • Backend, each module run in its own bwrap with a throwaway /data:
    • test_plugin_perf_bridge 12/12;
    • test_perf*, test_plugins, test_plugin_usage_bridge, test_batch1_platform, test_telemetry, test_authz, test_authz_matrix, test_plugin_widget_platform, test_plugin_gaps and test_guest_perf all pass;
    • test_typed_plugins::test_records_carry_kind fails, and fails on main too.
  • Frontend:
    • tsc --noEmit is clean and npm run build passes;
    • vitest passes for i18n, nav, dashboards, conversations, composer, lib and motion, except useShareTarget ×2 and FreshContext (both already failing on main) and reachability (flaky: it passes when run alone, on this branch and on main).
  • Live local hub (EVOX2, port 8133):
    • the plugin was installed from the companion branch;
    • SIDECAR_URL pointed at the EVOX2's own worker sidecar, so every screenshot shows real /procs, call-probe and storage data, with auto-kill off;
    • two real transcripts were indexed for the Details drawer;
    • both old routes redirect to the plugin pages.
    • In the Details screenshot the totals read 0 because the test hub's perf store was minutes old; the commands and leftovers come from the probe.
  • Not deployed from the EVOX2.
  • Homelab steps, in order. The plugin can't be installed before the deploy: validate_manifest rejects the perf.read and perf.act capabilities until ai-agent #15 is deployed.
    1. Merge ai-agent #15 and ai-agent-plugins #7.
    2. Deploy the hub with the ai-agent-deploy skill.
    3. Run ai-agent plugin install ~/projects/ai-agent-plugins/plugins/performance and approve the operator capabilities perf.read, perf.act and telemetry.read.
      Between steps 2 and 3, /dashboards/performance and /dashboards/storage fall back to the Dashboards overview, and a conversation's CPU & RAM and On disk cards are missing, until the plugin is installed.
  • May conflict with sibling PRs in root.tsx, CLAUDE.md, docs/plugins.md, plugins/manifest.py and main.py (small, local hunks); rebase in merge order.

🤖 Generated with Claude Code

Screenshots

perf-1-top.png
perf-3-history.png
storage-1.png
conv-ended.png

## Summary The Performance and Storage dashboards, and the conversation's CPU & RAM and *On disk* Details cards, leave the core for the `performance` live plugin (companion PR: gabrielvidal/ai-agent-plugins#7 (https://git.gabvdl.xyz/gabrielvidal/ai-agent-plugins/pulls/7)). The core gains two owner-only bridges the plugin reads and acts through: `perf.read` and `perf.act`. The plugin also reads `telemetry.read`, whose bridge gets a `hub/telemetry/hub` route for the *Hub itself* section. Everything that measures (`backend/perf/`, every `/api/perf/*` route) stays core. So do the conversation header's chips, the Bash cards' cost strip and the guest Stats. This follows the activity / plan-usage moves: after it, every Dashboards page is a plugin's. ## Key changes - `backend/plugins/hubperf.py` (new): - **`perf.read`**: GET `…/hub/perf/live`, `history`, `conversations`, `commands`, `conversation/{sid}?series=10m,life` (`{perf, series}`, one call per card refresh), `conversation/{sid}/storage`, `storage`, `storage/history`, `storage/writers`, `storage/config` and `settings`. `live` and `storage` also return `profiles` and `guestNames`. - **`perf.act`**: POST `…/hub/perf/kill`, `keep`, `settings`, `storage/rm`, `storage/scan` and `storage/config`. Only the plugin's own handlers may call them. - `telemetry.read` gains `…/hub/telemetry/hub`. - The bridges call the existing route functions, so no logic is duplicated. - `backend/plugins/manifest.py`: adds the `perf.read` and `perf.act` capabilities (operator-only, labelled). `main.py` mounts the router. - Frontend: the moved files are deleted (about −3,300 lines): - `pages/Performance.tsx`, `pages/Storage.tsx`, `perfLive`, `perfTotals`, `perfViz`, `perfStorage`, `storageItems`, `storageWriters`, `HubCard`, `guestPill`; - `hubAnalysis` (+ its test), `telemetryApi`, `perfApi`; - `conversations/components/PerfCards.tsx` and `StorageCards.tsx`. - `viz.tsx` keeps only `useTip` (the guest Stats heatmap). `perfFormat.ts` keeps `fmtBytes`, `fmtPct` and `fmtCpuTime`. - `PerformanceRedirect.tsx`: `/dashboards/performance` and `/dashboards/storage` go to `/plugins/performance/performance` and `…/storage`, or to `/dashboards` when the plugin isn't installed. - `nav.ts`: the Dashboards drawer's *Performance* entry now also matches `/plugins/performance`. `DashboardsPanel` drops its two core rows, and the telemetry feature paths now point at the plugin pages. - `Conversation.tsx`: - the six perf cards leave `DETAIL_CARDS`; - `DETAIL_CARD_RENAMES` maps `perfLive`, `perfTotals`, `perfLife`, `perfCommands` and `perfLeftovers` to `plugin:performance:conv-perf`, and `storage` to `plugin:performance:conv-storage`; - `detailSlotUpdate` adds `drawerOpen` and `prompts` (each prompt's epoch seconds). - `PerfCard.tsx` and `StorageCard.tsx` keep only the header chips (`PerfChip`, `StorageChip`). - Docs: CLAUDE.md (Performance and Storage sections, telemetry pages) and `docs/plugins.md` (the bridges, plus a row in the retired-widgets table). - `backend/test_plugin_perf_bridge.py` (new, 12 tests). ## Key decisions - **Two slots, not six.** The five CPU & RAM cards become one `conv-perf` slot, and *On disk* becomes `conv-storage`. Saved drawer layouts keep their position because every old id maps onto the new slots. - **The header chips stay core.** There is no plugin slot in the conversation header. The core *Performance* switch now gates only the chips; the plugin's cards have their own *Performance cards* switch. - **`perf.act` is limited to the plugin's own handlers.** Kill, Remove and Measure change things on the machines, so even the owner's caller token can't reach them directly. They go through the plugin's checked `act` action. - **The redirect waits on `isPending`, not `isLoading`.** On a cold load the plugin list can be pending before its fetch starts. The redirect then bounced to the overview, and a real browser on the local hub hit this every time. `ActivityRedirect` and `PlanUsageRedirect` have the same pattern; they are left untouched here and noted as a follow-up. - **The guest pick is now the page's own.** Before, it was shared with the Guests home. A frame can't write the app's filter store, and adding a bridge for that one use wasn't worth it. - `/api/perf/*` and `/api/telemetry/hub` stay. The chips, `CallCost`, `CommandPlayback`, the guest Stats and the bridges themselves use them. ## Changelog - Changed: the Performance and Storage dashboards are now the Performance plugin's pages (Dashboards → Performance / Storage). Old links still work. - Changed: a conversation's CPU & RAM and On disk cards in Details come from the Performance plugin, with their own "Performance cards" switch. ## Test notes - Backend, each module run in its own bwrap with a throwaway `/data`: - `test_plugin_perf_bridge` 12/12; - `test_perf*`, `test_plugins`, `test_plugin_usage_bridge`, `test_batch1_platform`, `test_telemetry`, `test_authz`, `test_authz_matrix`, `test_plugin_widget_platform`, `test_plugin_gaps` and `test_guest_perf` all pass; - `test_typed_plugins::test_records_carry_kind` fails, and fails on `main` too. - Frontend: - `tsc --noEmit` is clean and `npm run build` passes; - vitest passes for i18n, nav, dashboards, conversations, composer, lib and motion, except `useShareTarget` ×2 and `FreshContext` (both already failing on main) and `reachability` (flaky: it passes when run alone, on this branch and on main). - **Live local hub** (EVOX2, port 8133): - the plugin was installed from the companion branch; - `SIDECAR_URL` pointed at the EVOX2's own worker sidecar, so every screenshot shows real `/procs`, call-probe and storage data, with auto-kill off; - two real transcripts were indexed for the Details drawer; - both old routes redirect to the plugin pages. - In the Details screenshot the totals read 0 because the test hub's perf store was minutes old; the commands and leftovers come from the probe. - **Not deployed from the EVOX2.** - **Homelab steps, in order.** The plugin can't be installed before the deploy: `validate_manifest` rejects the `perf.read` and `perf.act` capabilities until ai-agent #15 is deployed. 1. Merge ai-agent #15 and ai-agent-plugins #7. 2. Deploy the hub with the **ai-agent-deploy** skill. 3. Run `ai-agent plugin install ~/projects/ai-agent-plugins/plugins/performance` and approve the operator capabilities `perf.read`, `perf.act` and `telemetry.read`. Between steps 2 and 3, `/dashboards/performance` and `/dashboards/storage` fall back to the Dashboards overview, and a conversation's CPU & RAM and On disk cards are missing, until the plugin is installed. - May conflict with sibling PRs in `root.tsx`, `CLAUDE.md`, `docs/plugins.md`, `plugins/manifest.py` and `main.py` (small, local hunks); rebase in merge order. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Screenshots ![perf-1-top.png](https://git.gabvdl.xyz/attachments/5aa27cdc-65ae-4ca2-a163-ab1f00c7d049) ![perf-3-history.png](https://git.gabvdl.xyz/attachments/98655e7d-9b96-4082-8520-894ecfae7c7d) ![storage-1.png](https://git.gabvdl.xyz/attachments/bb57c0f2-b9bb-47b2-926f-b9b0887af806) ![conv-ended.png](https://git.gabvdl.xyz/attachments/68bad5a9-e73d-4b4d-b781-c3f0b62609d0)
gabrielvidal self-assigned this 2026-11-27 00:17:23 +01:00
gabrielvidal added 1 commit 2026-11-27 00:17:23 +01:00
- backend: plugins/hubperf.py — perf.read (GET hub/perf/live, history,
  conversations, commands, conversation/{sid}?series=, conversation/{sid}/storage,
  storage, storage/history, storage/writers, storage/config, settings; live and
  storage add profiles + guestNames), perf.act (POST hub/perf/kill, keep,
  settings, storage/rm, storage/scan, storage/config — the plugin's own
  handlers only), and telemetry.read's hub/telemetry/hub. Owner-only,
  operator-approved caps. backend/perf and every /api/perf/* route stay.
- frontend: the Performance and Storage pages, perfLive/perfTotals/perfViz/
  perfStorage/storageItems/storageWriters/HubCard/guestPill, hubAnalysis,
  telemetryApi, perfApi and the conversation's PerfCards/StorageCards go;
  /dashboards/performance and /dashboards/storage redirect to
  /plugins/performance/performance|storage (else the overview);
  DETAIL_CARD_RENAMES maps the six retired card ids onto the plugin's
  conv-perf / conv-storage slots; the slot update carries drawerOpen and
  prompts. The header chips, CallCost / CommandPlayback and the guest Stats
  stay core.
- docs: CLAUDE.md, docs/plugins.md; tests: test_plugin_perf_bridge.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Merged into main as 38f24b4f (batch merge of the EVOX2 plugin moves on top of main 0797e454, all ai-agent suites green) and deployed: ai-agent @ 7c397fbc live since 2026-11-27 00:57. performance installed.

Merged into `main` as 38f24b4f (batch merge of the EVOX2 plugin moves on top of main 0797e454, all ai-agent suites green) and deployed: ai-agent @ 7c397fbc live since 2026-11-27 00:57. performance installed.
gabrielvidal closed this pull request 2026-11-27 00:58:15 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gabrielvidal/ai-agent#15