ac4af582301a4e8a29245dbba767eba31334ddf9
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ce8b67de37 |
gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called page.goto with no timeout of its own, so Playwright held the first load of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a busy box (a whole-suite run at load 130-160) that load took longer and goto timed out. The same pattern is in 988 GUI test files (1174 pages): every one of them now also sets setDefaultNavigationTimeout(60000) on the same page, right after its default, so goto, reload and waitForURL wait on the load itself with room, while clicks and waits keep their short bar. group-from-model-add's own 20s navigation bar is raised to the same minute. claude-switch-only also gives its first provider row (drawn from the page's first reads) a minute before clicking it. nav-timeout.test.cjs (no browser) reads every GUI test file and names each page given a default under a minute without a navigation timeout of at least a minute, so a new file can't bring the pattern back. What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from other sessions): - node --check on every file in internal/gui/tests: all parse. - nav-timeout.test.cjs against origin/main's test files: red (names the 1174 pages); against this tree: its only reds were my own probe copies of the old files, since removed. - By hand: claude-switch-only with app.js served 7s late (a busy box's first load), --test-name-pattern "1100 en": origin/main's file 4 of 4 red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green. - claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420: 32 of 32. group-from-model-add, usage-access-key-card and i18n-keys: green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red on a 5s waitForFunction at line 115 (a wait after load, not the navigation), at load ~230. Not tried: the whole GUI suite (about 1000 files; the change is one mechanical line per page), Windows or mote (mote's browsers, #4125). |
||
|
|
83234fe920 |
gateway, gui: the skills an agent lists are their own part, not memory
The owner (10-24, on the Routing context map's "技能 / 记忆 · 9.6K"):
为什么这里又叫技能,又叫记忆?Skill 跟 Memory 应该是不一样的东西. The
gateway put Codex's <skills_instructions> in the memory part beside the
instruction files and reminders, so the tile said Skills of Memory.
Claude Code's skill list wasn't seen at all: it sat in its environment
message, counted as the system prompt.
- gateway: PartSkills ("skills") comes after tools. Codex's
<skills_instructions> goes there. So does Claude Code's list, from
"The following skills are available for use with the Skill tool:" to
the next blank line, taken out of whatever text holds it: its own
prompt, a harness message or a reminder.
- Routes kept before this (routing history) are read with an item
tagged skills moved out of memory into the skills part, so old
requests read the same way. The text view re-reads the body and finds
them under skills too.
- Usage's context baseline counts skills, as it did inside memory.
memory-heavy is now instruction files and reminders alone.
- gui: the card has a Skills part (slate, --c7), with its note in en,
zh, zh-TW, ja and de. The text view's "no longer kept" line is one
helper instead of two copies of the sentence, which makes the room for
it under the core script budget, with no room added.
Run (darwin):
- go test ./internal/gateway -run 'Text|Prompt|Context|History|Skill|Route'
ok; go test ./internal/gui ok; go vet both, gofmt clean.
- New: TestPromptOfClaudeCodeSkills (on testdata/workdir's real Claude
Code 2.1.296 body: 1502 tokens of skills out of the 2130-token
environment item), TestSplitSkillsEnds, TestSkillsApartOfKeptPrompt.
Broken by hand (splitSkills and skillsApart made no-ops): all three
red.
- GUI, chromium and webkit: context-map 22/22 (new: the skills tile's
tip names Skills and not Memory in every language, and it isn't
memory's colour), context-window 24/24, context-text 20/20,
context-scroll-end 14/14, routing-context-fold 24/24,
routing-ctx-still 16/16, i18n-keys 4/4.
Not run: the whole GUI suite (load ~400 on the box); a live Codex or
Claude Code request through the real app.
Not changed: the "system prompt, tools and memory" wording of the
baseline's tags, which now count skills too.
|
||
|
|
7edf5b0a3d |
gui: the context window is a map of tiles by default, the block grid a switch away
After flohoeller's "Context map" on X. The Context window card (Usage ›
Context, and Routing's request card) drew its window as 400 cells. It now
draws it as a map:
- Each item is a tile sized by its tokens, inside its part's area
(squarified, parts in their usual order).
- The tile has a soft fill of its part's colour, its name, and
"tokens · part".
- The free space is a hatched tile that names its share.
- The used share is drawn on a gentle curve (share^0.35), so a window
8% full still has tiles to read. The free tile states the real share.
Small items:
- Items too small to read go in one "{n} more" tile.
- A part whose items would leave a strip thinner than 14px is one tile.
- No tile is laid under 700px².
Hover and click:
- A hovered tile tells its item, part, tokens and share (a part's tile
lists its largest five) and dims the others.
- A row or the legend lights its tiles.
- A clicked tile opens its text, as a cell does.
Motion:
- Tiles come in with a short stagger (opacity, scale .94, blur), over
560ms with the iOS ease.
- A live update keeps the same nodes and glides them to their new rects.
- Tiles that are gone fade out.
- With motion reduced, or on a still pane, nothing moves.
The block grid is kept. A small segmented switch at the end of the legend
(Context map / Block grid) picks the look for every card, remembered in
localStorage magpie.ctxLook. The card eases to the other look's height.
The new look is the default, and the old one stays one click away (UI
restraint, owner's ask).
The text view shows an image the request sent inline (the gateway's Src,
previous commit), where it said "An image: magpie doesn't show it here".
It fades in, and a click opens it larger with a FLIP scale. An image with
no Src, or one that fails to load, keeps the old note.
Words: "Context map" and "Block grid" in zh, zh-TW, ja and de.
The core budget goes to 1,549,478, the new size with no room added:
context.js is drawn by the Routing page as well as Usage, so it is the
core's own (+14.4KB).
Tests:
- Seven existing tests read the grid's cells. They now pin
magpie.ctxLook=grid.
- New context-map.test.cjs, in both engines, en/zh/zh-TW/ja/de, at
1100 and 420px:
- The map is the default, with a free tile.
- Every tile is inside the map, none overlap, and none is a sliver.
- Hover gives the tip and dims the others.
- A refresh keeps the nodes.
- A click opens the text.
- An inline image loads (naturalWidth 2) and opens larger. One without
Src is named.
- The switch to the grid survives a reload, and the map comes back.
- With motion reduced, nothing animates.
Run at this head (rebased on
|
||
|
|
3c7ec4ba24 |
gui: Usage is a plugin's page, its code, markup and words in plugins/usage (P2)
P2 of docs/subsystems/plugin-runtime.md, the fourth page after Sessions,
Library and Routing, and the largest part of app.js.
- The Usage page's code (~3000 lines: the Overview's cards, the
Requests ledger and heatmap, the Sessions tab, the Agents list) moves
from app.js to assets/plugins/usage/page.js; its markup, index.html's
<main id="view-usage">, is client.js's part html. app.js 25756 →
22675 lines (1,355,376 → 1,198,239 bytes).
- page.js builds on app.js at the top level (its timers, ?view=usage's
tab and filters), so it is the one plugin script that loads after
app.js. index.html: kernel.js, the plugins' other scripts, app.js and
the scripts beside it, each page.js, then start.js, which is app.js's
old tail (magpie.start(), navHides, OPEN_VIEWS, the first page shown,
load()), so the first page has its code. TestBuiltinClientsLoaded
holds that order.
- Hooks: open loads it, refresh(again) is load()'s read of it, reload is
Refresh now, costs redraws costs on a currency change, tab says the
tab for focusQuotaCard. app.js calls those through magpie.call. The
allowance cards, quotasOpened, panelQuotaFocus and panelUseFocus stay
in app.js: the tray panel draws them too.
- plugins/usage: Essential, Requires window, no InUse. Off, its nav tab
goes and so do the ways to it (data-feature="usage": the panel's Open
Usage, Routing's View usage); show("usage") gives way to Agents; the
panel's Allowances tab stays. builtins.test.cjs switches it off and
checks each.
- The 173 strings only Usage says move to plugins/usage/i18n.js;
i18n.js 15032 → 14344 lines. "{n}s" and
"All sessions" stay: context.js says them too since #1591.
- context.js: with context.js now in before the first page is shown,
the page's open and load()'s first refresh both reached loadContext,
and the second drew "Reading…" again over the advice the first had
just drawn, so its curves never played their entrance (context-tune,
3 of 3 red). loadContext draws the waiting pane once for the same
days. Its dead last line, which loaded the tab once context.js came
in late, goes.
- context-window.test.cjs's "arrives after the state" becomes "loads at
once though context.js is slow": start.js now waits for it.
usage-stale-answer reads page.js beside app.js. quota-refresh-order
(#1630) cut app.js at the period picker's comment, now in page.js; it
ends at the next comment that stays (5 of 5; without keepRefreshedQuotas'
call, 2 of 5 red).
- docs: plugin-runtime.md, gui-shell.md.
Run, at this tree on origin/main
|
||
|
|
0b7a740ee6 |
gui: Usage's Context tab names its agents when the state answers after the routing history, not by their ids until the history changes
context.js draws each agent card and session row with the agent's name and
icon from the state (agentLabel, agentIcon). When /api/context answered
before /api/state, the cards were drawn by the agents' ids ("claude", a
generic icon). The state's arrival calls loadContext again, but a read that
brought the same history returned early ("the same answer keeps the pane"),
so the ids stayed until the history itself changed.
The "same answer" key now holds what the pane is drawn with besides the
history: each agent's id, name and icon from the state. Once the state is in
the pane is drawn again (still, without its entrance animations); a refresh
with the same history and the same agents still keeps the pane.
This is one of context-window.test.cjs's failures under load and alone: its
Claude Code card is found by hasText "Claude Code", which the card titled
"claude" never matches (":129 locator.innerText: Timeout 5000ms ...
.ctx-agent hasText 'Claude Code' .ctx-grade-word"). "codex" matched "Codex"
since hasText ignores case, which hid it on the other card.
New test in context-window.test.cjs: /api/state is held until the two cards
are drawn, then they must read "Codex, Claude Code".
Run:
- New test on origin/main
|
||
|
|
dc08da834c |
test(gui): hover a context cell only once it stops moving (#1263)
context-window.test.cjs failed about half its Chromium cases on macOS (6-7 of 11 per run, on main too) at the cell hover: the tip stayed hidden. A window's cells scale in one after another (ctx-cell), and wheelTo only waited for the view's scroll to settle. Hovered while the cell was still scaling, Chromium scrolled the view by 77px to reach it, the app put that scroll back 9ms later, and the pointer left the cell, closing its tip. A longer timeout didn't help; hovering again did. wheelTo now waits until the target's own rect stops moving, which covers both the eased wheel scroll and the cells' animation. On an M3 Mac: main 7, 6, 6 of 11 in Chromium; with this change 11/11 in 5 Chromium and 5 WebKit runs, and in 3 Chromium runs beside gui-ja. |
||
|
|
fd29653d4e |
context: a window opened on the Context tab loads it at once, not at the refresh's first tick five seconds on
context.js comes after app.js, and app.js shows ?view=usage and reads the state before context.js is there: when /api/state answered first, both paths called window.loadContext while it was undefined, the TypeError went to the status line, and the tab stayed empty until the 5s refresh (found as context-window's webkit de 1100px flake, 2 of 6 runs). The calls are optional now, and context.js loads the tab itself when the page opened on it, as plugins.js and library.js do. The new test holds context.js until the state has answered: it fails on both engines without the fix and passes with it; context-window passes 22/22, the case that flaked 10/10. |
||
|
|
586f2bce8f |
context: magpie inspects the context window of every request, session and agent
The gateway reads each request's prompt into its parts (system prompt, tools and MCP servers, memory, files, tool results, chat), measured against the model's window and calibrated to the tokens the vendor counted. Routing shows a request's window as a card: a 400-cell grid by part, a hover naming what is largest in a cell, and the contents by part. The Usage page's Context tab scores each agent out of 100 (cache reuse, how lean it starts, how fast it grows, how reliably it answers), tags it (lean, cache-friendly, mcp-heavy, compacts, near-full…), and draws each session's growth with its latest request's card. Older Safari (15) gets media-query and solid-colour fallbacks for the card's container queries and color-mix. |