gui: a recorded call's body viewer moves from app.js to the Gateway plugin's script

callBodyPanel and what only it uses (the JSON tree, the stream's events
and reply, sseView/sseShown) move whole, unchanged, from app.js to the
end of plugins/gateway/client.js. Nothing in the core called them: the
Gateway page's recent calls, Usage's ledger and Routing's trace do, and
every plugin's script is loaded by index.html whether the plugin is on
or off, before any of them runs. app.js goes from 1,320,558 to
1,304,307 bytes; the budgets are not changed here. This makes room for
the per-account eye in the next commit without raising a budget.

Checked that the moved block is closed: none of its 12 names (and
sseView, sseShown) is used in app.js outside it, or in context.js,
plugins.js, kernel.js, pluginpages.js or start.js, and none is declared
in another script. docs/subsystems/plugin-runtime.md says where it is.

Run at this commit (Chromium + WebKit, NODE_PATH playwright 1.62.0):
json-tree, recent-call-bodies, request-archive-usage, request-archive,
routing-bodies, sse-body and i18n-keys: 58 pass, 0 fail.
go test ./internal/gui -run 'TestCoreScriptBudget|TestBuiltinClientsLoaded': ok.
The whole GUI suite and go test ./internal/gui ran with the next commit
at the pushed head (see its body).
This commit is contained in:
yetone
2026-10-26 18:18:18 +08:00
parent 0f6615ffc5
commit 05eeb4e1b9
3 changed files with 343 additions and 336 deletions
+4 -1
View File
@@ -84,7 +84,10 @@ plugins' scripts and `app.js`, all classic scripts sharing one scope. It is
The Gateway page is `plugins/gateway` with `Client: keys.js, client.js`
(`internal/gui/assets/plugins/gateway/`): `keys.js` is the gateway-key
manager that was `caller-keys.js`, and `client.js` is the page's code that
was in app.js, ending in its `magpie.plugin("gateway", …)`. Still in
was in app.js, ending in its `magpie.plugin("gateway", …)`, and after it
the viewer of a recorded call's bodies (`callBodyPanel`: a JSON tree, a
stream's events or its reply), which Usage's ledger and Routing's trace
call too; every plugin's scripts load whether it is on or off. Still in
app.js and app.css: its styles, its sidebar and header buttons
(`data-feature="gateway"` in index.html), and `decideEntry`, which the model
info card shares. `TestBuiltinClientsLoaded` holds index.html to load every