Files
magpie/docs/subsystems
yetone ed63a5be5e gui: a picked accent colours what is chosen (CHENGJIAHEGOXIS on X)
「选中任意强调色没反应」: picking an accent in Settings › General seemed
to do nothing. The token did apply. With the real server, in Chromium
and WebKit, under light, dark and system, with and without a background
image, --accent was set by lookCSS and kept. Neither the theme nor the
wallpaper overrode it. But nothing on Settings, the sidebar, the header
tabs or the panel's tabs used --accent: every chosen option is graphite,
var(--fg), by design. So the colour only showed in a few buttons
elsewhere.

The fix is a --mark token, the ink of what is chosen.
- It is var(--fg) by default, so magpie's own look is unchanged, like a
  Mac's Graphite.
- accentVars sets it once the user picks an accent. It is moved toward
  black (light) or white (dark) until it reads at 4.5:1 on the surfaces a
  chosen option sits on: --pill-hover #e9e9ee, and the dark switch thumb
  #4c4c52.
- It is used by .seg/.opt/.ptabs/.warm-tabs/.am-seg/.klf-tab/.day-chip/
  .apptab .on, the header nav's chosen tab, the side-nav's open-page icon
  and Settings icon, and Library's switches and radios. Each is the same
  "chosen" role, so all of them follow the accent, not just one.

Tests:
- appearance_test.go's TestAccentReadable checks --mark's contrast on
  each surface, in both themes.
- appearance-look.test.cjs adds 8 tests, in Chromium and WebKit, light
  and dark:
  - Settings' theme and bird options and the side-nav icon at 1200 with a
    wallpaper set: graphite by default, the mark for #0d9488 and #db2777,
    and back to graphite on Default.
  - The header tabs at 900 and the panel's tabs at 380.

Run:
- gofmt clean. go vet ok on darwin, GOOS=linux -tags nogui and
  GOOS=windows (at 75bdc85fe, the same change on an older main).
- At 6f5549b1f (this change on 08f77528f), on Linux (WSL magpie-desktop),
  since mote's suite queue was hours deep:
  - The whole GUI suite, Chromium and WebKit, every language and the
    panel widths: 27231 tests, 1258 red in 183 files. The same 183 files
    at the parent were 1226 red. The 70 tests red only with the change
    were rerun with their 43 files at concurrency 2: 80 red with it, 89
    at the parent 783b69b8c. Every one left has a language or width
    sibling red at the parent too. None is about colour. They are the
    Linux reds #5559 and #4388 track.
  - go test -tags nogui ./... -timeout 45m: every package ok except
    internal/usage's TestRequestStateKeptAcrossACatalogFetchedAgain,
    red the same at the parent (#6572).
- At the pushed head, on mote (macOS):
  - TestAccent*, TestWallpaper*, TestLook* ok.
  - appearance-look 36/36, i18n-keys 4/4, library-all 26/26.
  - segs-press-redraw 16 red and api-key-theme 6/6 red, the same counts
    at the parent 6c88d61f0 (#4566, #3922, #6444).
  - TestCoreScriptBudget is red (1269382 > 1268961), the same at the
    parent. 92e760f3d took it over (#6518, taken). This change adds no
    script.
- Broken by hand:
  - With the old app.css and library.css, the 8 new GUI tests are red,
    8 of 8.
  - accentVars without --mark: TestAccentReadable fails ("…;--sel:#efefef",
    no mark).

Not tried:
- The whole GUI suite and the Go suite on macOS at the pushed head. mote's
  suite.lock queue was hours deep, so they ran on Linux instead.
- The real macOS app.
- Windows WebView2, and Linux WebKitGTK.
- Charts' --c1 series colour still does not follow the accent; that is
  left as it was.
2026-11-14 09:58:38 +08:00
..
2026-11-10 03:25:44 +08:00

Subsystem design references

These pages describe current responsibilities, runtime paths, state, and contracts. Start with the subsystem relevant to your task, then follow its source links to verify the implementation you change.

Subsystem Reference
Built-in subscriptions moving to plugins Provider and plugin ownership
Built-in plugins: registry, lifecycle, plugins.yml, presets, settings schemas, the window's kernel (slots, error boundary, kit) Plugin runtime
Plugins that run on the gateway's requests and replies Gateway middleware
Tools that plugins give, offered to every agent as an MCP server Plugin tools
Plugins that await context recall and observe completed replies Asynchronous gateway request hooks
Claude subscription turns across Claude Code runs Claude subscription bridge
How the gateway picks a provider, key or account, and falls back Gateway routing and fallback
Gateway Session Aggregation Gateway Session Aggregation
Connecting an agent's config to the gateway, drift, disconnect, WSL twins Agent wiring
Providers, keys, subscription accounts, refresh and allowance Providers and accounts
Instructions, MCP servers, skills and RTK written into agents Library
One MCP server, magpie, given to every agent in place of the Library's servers MCP router
Memory shared by every agent: the memory MCP server, the digest in instructions, the Memory tab Memory
One skill, magpie-skills, listing the Library's skills in place of each agent's own Skill router
Tray, panel, window, magpie web and the page's JSON API GUI app shell
Encrypted backups and setup synchronization over WebDAV, S3 or GitHub Sync and backup

A subsystem can span several packages or repositories. Its reference describes the behavior those parts provide together; it does not need to list every function.

Maintain a reference

Update the owning reference in the same PR when a change alters a documented responsibility, interface, state transition, runtime path, compatibility rule, or failure behavior. An internal refactor that preserves these contracts does not require a prose change.

Keep each fact in one reference and link to it from agent instructions or other pages. Link to source files and named symbols rather than copying implementation details that change frequently. Explain field meanings and constraints that signatures alone do not express.

For a new reference, include the responsibilities and boundaries, source of truth, main runtime paths, state transitions, important constraints, and existing verification commands. Include failure and compatibility behavior where relevant. Document current behavior separately from proposed changes; the proposal belongs in its issue or PR.

Describe a PR's semantic changes

For each affected subsystem, explain the observable change with its trigger and before/after behavior. Include changes to interfaces, state, compatibility, and failure behavior when relevant. Link the affected reference, implementation, and verification evidence. State when a refactor preserves the documented behavior.

For example, a change to plugin adoption should explain which migration state and account condition trigger it, which implementation handles requests before and after adoption, and which test exercises that transition.

This is an author-provided explanation that a reviewer verifies against the diff and surrounding code. It is not an automatically proven compatibility verdict.

Review a change

  1. Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
  2. Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
  3. Check that changed contracts appear in the owning reference and that source links still resolve.
  4. Check that the cited tests or runtime evidence exercise the claimed behavior. Report checks that were not run.

A documentation update alone does not prove the implementation. Existing tests and runtime evidence remain necessary for behavior changes.