Commit Graph
144 Commits
Author SHA1 Message Date
yetone 61a04f42a2 library: a project's Skills menu groups the skills by source, a heading ticks the whole group (Elorynth on X)
The project card's Skills menu listed every library skill flat. It now
lists them as the Library does (skillGroups(true): by repository or the
user's own group, this computer's last, whatever sort the list has), with
a heading over each group. Pressing a heading ticks all of the group's
skills, or unticks them when all are in; it is half-ticked while some are.
A typed filter keeps a group's heading over the skills it finds, and
matches a skill by its group's name. One group only stays the flat list.
openProtoMenu takes a `group` option (the values it ticks) for this.
Paid for in app.js by five comments cut, no budget raise.

Run on the Windows box (mote's Chromium launch hung, SSH refused at
times): project-skills-groups.test.cjs, new, in chromium and webkit,
en/zh/zh-TW/ja/de at 400px wide: red on the old code (6 of 6), green
after. With project-*, i18n-*, menu-*, proto-menu-overflow and
skill-group* GUI files in both engines: all green except
menu-input-scroll and menu-scroll (14 chromium, 13 webkit), which are
red the same at origin/main aa2ea5c90 on the Windows box (commented on
#3402). TestCoreScriptBudget ok at the rebased head.
Not tried: the full suite, the real Linux app (WebKitGTK). Part 2 of the
report (instruction presets bundled into a toolkit) is not built: a
project has no instructions of its own yet.
2026-11-11 13:31:23 +08:00
yetone cc659c7559 library: Instructions reach MiniMax Code and WorkBuddy (lysyscy8 on X)
MiniMax Code reads AGENTS.md in its data folder ($MINIMAX_DATA_DIR, else
~/.minimax) before every conversation (readGlobalInstructions in
@minimax-ai/code 0.7.6's chunks), so its target now names that file.

WorkBuddy and WorkBuddy AI keep their instructions as the string
personalization.customPrompt in app/app-config.json of their folder
(PersonalizationCollector and AppConfigService in 5.5.6's app.asar, both
builds). Target.Field says the instructions are a JSON string rather than a
file; instrRead/instrSave read and write it through edit.SetJSON/DelJSON, so
every other key, its order and indentation stay, the user's own prompt stays
in the field around magpie's marker part, and taking the part back leaves
the file byte for byte as it was (an empty personalization object magpie
made goes too). A file that is not JSON, or a field that is not text, is
unknown: reported, never written over. Import takes the user's prompt into
the library the same way.

Run: TestMiniMaxCodeInstructions, TestWorkBuddyInstructionsAreAJSONField,
TestWorkBuddyInstructionsFromNothing, TestWorkBuddyInstructionsUnreadFileIsLeftAlone,
TestWorkBuddyInstructionsImport and TestWorkBuddyAIInstructions, in a sandbox
HOME, on Linux (wsl-run) and Windows (win-run); all fail with the two target
assignments taken out (broken by hand), and pass with them. internal/library
whole on Linux (ok) and Windows: 3 reds, TestGoneAgentListedToTakeOut,
TestCheckMixedServerEachSide (both #4115) and TestPluginImportCarryOnOffRemove
(#6065), all three red the same on origin/main d1b4eff5a on Windows.
Not tried: a running WorkBuddy or mcode reading the written values (the apps'
sources were read; WorkBuddy loads its config as it starts, so a running one
may need a restart); WORKBUDDY_USER_DATA_DIR is not followed.
2026-11-11 11:54:21 +08:00
yetone 6af54dc9a9 library: Claude Code plugins kept as one item, with a Claude plugins tab (FakeshadowzZ on X)
A Claude Code plugin (.claude-plugin/plugin.json, skills/, agents/,
hooks/hooks.json, .mcp.json) can be installed into the Library from a
folder, a git address or a marketplace.json, and is one row: turned on, off
or removed as a whole, and given to the agents picked with the chips every
tab has. Its skills, MCP servers, hooks and subagents are ordinary library
items tagged Bundle: <plugin>, so each agent gets them through the code of
its kind and the Skills, MCP servers, Hooks and Subagents tabs go on
working. Off clears every part's agents and keeps them for on; Remove
removes the parts. A part whose name the library has gets the plugin's name
as a prefix, never over the user's own. Claude hook events and matchers map
to the portable ones; others become claude:<Event>, for Claude Code only.
Slash commands, LSP servers and non-command hooks are listed as not
carried, not dropped. internal/library/plugin.go, POST /api/library/plugins/*,
the Claude plugins tab in plugins/library/client.js (en, zh, zh-TW, ja, de),
docs/subsystems/library.md.

Run (mote): go test -tags nogui ./internal/library ./internal/gui
./internal/backup ./internal/davsync ok; gofmt clean; go vet darwin, linux
(-tags nogui) and windows clean. GUI, chromium and webkit, en zh zh-TW ja de
at 420 and 1100: library-plugins (new), library-hooks, library-subagents,
i18n-keys, i18n-en-no-cjk, click-scroll all pass. Whole GUI suite started
and cut short at ~460 of its tests: failing only account-dragging and
accounts-sheet (routing, untouched by this), not compared on origin/main.
Broken by hand: dropping the Off handling in givePlugin and the hookTakes
filter each turned the new Go tests red.

Not tried: a real Claude Code plugin from a marketplace, a git source
(tests use folders), WSL, Windows. Not carried yet: commands/*.md, LSP
servers, a plugin's folder across computers (a backup carries the parts, not
the plugin record).
2026-11-11 02:55:15 +08:00
yetone 025123431c library: add and remove a project's skills from the CLI (Sephiro_Lan on X, #5193)
magpie library project … does what the window's Library › Projects page
does, through the same library calls its page makes (AddProject,
RemoveProject, ProjectSkills, ProjectSkill, ProjectCopy):

  magpie library project [--json]                 the projects and their skills
  magpie library project add <dir>
  magpie library project rm <dir> [--keep-files]
  magpie library project skills <dir> [--json]
  magpie library project skill add <dir> <skill…> [agents=a,b…]
  magpie library project skill rm <dir> <skill…>
  magpie library project skill agents <dir> <skill> <a,b…|none>
  magpie library project copy <dir> on|off

<dir> may be relative or "." (library.ProjectPath / ProjectAt find the
listed project, through a link too). A skill added with no agents= goes
to the agents the page's Skills menu picks: those the project's skills
are for already, else every agent here with a project skills folder.
Each skill added says where it was placed; one that wasn't (a folder
there that isn't magpie's, left as it is) is named with why, and the
command exits 1, so a script tells "installed" from "left as it is" by
the status. --help prints the project usage; an unknown flag, command,
skill, agent or on/off value is refused, and so is rm of a skill the
project doesn't have.

Docs: the Projects row of docs/subsystems/library.md, and the site's
library page in en/zh/ja. site/public/llms-full.txt rebuilt with
`node llms-full.mjs`; it also picks up a line (Alma, Shelley) another
docs change left out of it.

Run (mote, at this tree):
- go test -count=1 -run TestLibraryProject ./internal/cli: ok; the same
  on Windows (win-run, xiaomi-gpu): ok.
- go vet ./internal/cli ./internal/library for darwin, linux (-tags nogui)
  and windows: ok. go test -count=1 ./internal/cli ./internal/library:
  ok (45s, 99s), at this head after the rebase. site: node --test worker.test.mjs: 38 pass. gofmt -l:
  clean.
- A sandbox HOME end to end with the built binary: claude and codex
  installed, three library skills, a git project. add ., skill add with
  no agents= (links in .claude/skills and .agents/skills, listed
  in .git/info/exclude, the .gitignore left as it is), a folder of the user's in .claude/skills/pdf (named,
  exit 1, untouched), agents=codex, skill agents, unknown
  skill/agent/flag/command refused, skills --json, skill rm, rm .: the
  links, magpie's folders and the exclude block gone, the user's
  folder kept.

Broken by hand: with the not-placed exit taken out, TestLibraryProjectCmd
goes red ("a folder of the user's in the way: <nil>").

Not tried: a project's MCP servers from the CLI (the issue asks for
skills; servers stay on the page), WSL agents, and a real Linux box.
2026-11-11 00:44:41 +08:00
yetone 87b3af7653 library: a project turns a global MCP server or skill off, out of git, and its worktrees follow (WhyULose0 on X)
WhyULose0 asked for MCP servers and skills per project: a global set every
project inherits, each project that set ± items (a global one turned off
for one project too), one place to tick for every agent, nothing written
into the project's git, the router running a shared server once, and a
new git worktree following its main project.

What was there: projects could add skills and servers (Library → a
project's card), the MCP router ran each server once, but a project could
not turn a global item off, magpie wrote its entries into the project's
.gitignore (a tracked file), and a worktree got nothing.

What changed:
- Turning a global item off in one project (ProjectServerOff,
  ProjectSkillsOff; POST /api/library/projects/server-off, skill-off),
  done the way each agent reads a folder: Claude Code's record of the
  project in ~/.claude.json (disabledMcpServers; magpie takes out only
  names it put there), Codex's project .codex/config.toml
  ([mcp_servers.X] enabled = false, only for a server in Codex's own
  config), Claude Code's skillOverrides "off" in the project's
  .claude/settings.local.json.
- With the router on, a project that adds or turns off a routed server
  gives Claude Code (local scope in its project record) and Codex (project
  config) the hub at /mcp/magpie/hub/<agent>~<projectKey>; hubServers
  serves that address the project's set, each server still started once.
  gateway.HubAgentOf cuts the key off for the log, errors and on-demand.
- Out of git: entries go to the repository's info/exclude (one block per
  project, shared by every worktree); the .gitignore is left as the user
  wrote it, and a block an older magpie wrote there is taken out. A folder
  git-inited later gets its block on the next KeepLinked.
- Worktrees: the project's folder in each worktree of its repository gets
  the same skills, servers and offs, found on KeepLinked, let go when
  removed.
- GUI: a project's card lights each agent that has an item from the
  Library; a click turns it off (or back on) in that project. An agent that
  can't take an off (Gemini CLI etc., or a skill that goes through the
  skill router) stays lit and says why. The Skills menu ticks inherited
  skills; unticking turns one off. zh, zh-TW, ja, de.

Limits, per agent:
- Offs only for Claude Code (servers and skills) and Codex (servers).
  Codex reads the project config only in a trusted project.
- A skill reached through the skill router can't be turned off in one
  project.
- Claude Code keys its record by the repository's main top folder, so a
  project in a subfolder turns its server offs on repo-wide.

Run (mote's SSH refused every try today, kex reset; every run went to
the WSL box through wsl-run, linux, at load 60 to 80 from other runs):
- go test -tags nogui ./internal/library: ok at this head. At the base
  before (4a9142ccd) TestEveryAgentInLibrary was red on main's own
  avibe/obsidian, fixed upstream since.
- go test -tags nogui ./internal/gateway ./internal/gui, one rebase back:
  gateway ok; gui ok but for TestSetAnswersWhileDevinAndProvidersHang
  (a set waited 37s; #1375, numbers added there). An earlier run had one
  TestMiddlewareThroughGateway red (the reply's first delta skipped a
  middleware's onEvent; nothing here touches middleware), 5 of 5 alone,
  filed as #5955.
- go vet: linux (-tags nogui) and windows clean; darwin (-tags nogui,
  cross from linux, no cgo) clean but for internal/gui's
  traywindows_darwin_test.go, which needs trayImagePNG from a
  darwin && cgo file, untouched here.
- gofmt -l: clean
- GUI, chromium + webkit: project-*, i18n-* and library-* 4 wide, then
  each red file alone at this head. Alone, all pass, project-scope
  included, but for library-mcp-copy-config ja chromium (#5941) and
  library-browser-setup (#5974); both are red the same way at origin/main
  without this change (40ca0c88d and 6bac8f8a5). library-all webkit
  (#4967) was red alone before the rebase, also at 40ca0c88d.

At 82a8acb09 (this change on 065ca02c2): go vet -tags nogui ./...
clean, ./internal/library ok, project-* and i18n-* GUI 32 of 32. Then rebased over b2b83d4f9's four commits (lessons,
gateway plugin models through a remote, a plugin hook test, agent auto
mode), none of them in a file this change touches.

Broken by hand, each red:
- Claude offs not written: TestProjectServerOff (no record)
- Codex offs not written: TestProjectServerOff (codex project config)
- hubServers ignoring a project's offs: TestProjectSetThroughRouter
- skill offs not written: TestProjectSkillOff
- worktrees not listed: TestProjectWorktreeFollows
- writeExclude a no-op: TestProjectServerOff, TestProjectKeptOutOfGitByExclude,
  TestProjectOutsideGit
- every chip click sent to the add path: project-scope.test.cjs

Not tried: a real Claude Code or Codex run in a project with an off (the
record and table shapes are read from Claude Code 2.1.316's and Codex's
config code, not watched working); darwin (mote down), Windows runs;
a real `git worktree add` (the test writes git's worktree files by hand).
2026-11-10 22:39:29 +08:00
yetone a1ba92ad8c library: a market of Pi's packages, installed and removed by pi itself (nineruiing on X)
Library -> Pi now has a Discover list of Pi packages: npm packages with
the pi-package keyword (pi's own docs: the keyword makes a package
eligible for the pi.dev/packages gallery), sorted by monthly downloads,
with search. Like the other markets it ships a 500-entry snapshot
(market_pi.json), keeps a 6h memory and disk cache, and refreshes from
npm. Install and remove run that Pi's own `pi install npm:<name>` /
`pi remove npm:<name>` with PI_CODING_AGENT_DIR set to its folder, so
settings.json's packages list and <agentDir>/npm are written by pi, not
by magpie. Each card says which Pis have it; Install goes straight to
the only Pi without it or asks which one; the Pi's list gets a remove
button behind a confirm. New routes: GET /api/library/market/pi, POST
/api/library/pi/install and /api/library/pi/remove.

Run:
- mote: go test -count=1 -timeout 45m ./internal/library ./internal/cli
  ./internal/gui at this head: ok, ok, ok.
- mote: gofmt -l clean; go vet of library, gui, cli for darwin, linux
  (-tags nogui) and windows: ok.
- mote: library-pi-market, library-pi-extensions, i18n-keys,
  i18n-en-no-cjk in chromium and webkit: 52 of 52; the 17 market and
  library GUI files: 598 pass, 0 fail (pre-rebase tree).
- win-run: go test -tags nogui ./internal/library -run 'TestPi|TestMarket'
  ok (TestPiRunGivesAgentDir skips on Windows).
- wsl-run: library TestPi|TestMarket ok; library-pi-market 22 of 22.
- Real pi 1.5.1 in a sandbox HOME on WSL: PI_CODING_AGENT_DIR=$A pi
  install npm:pi-btw wrote packages ["npm:pi-btw"] beside the existing
  theme and installed node_modules/pi-btw; pi remove put packages back
  to []. The live ~/.pi was untouched.

Broken by hand (each red, then green restored):
- the pi-package keyword filter dropped: TestPiMarketFromNPM;
- the name check dropped in the market: TestPiMarketFromNPM;
- the name check dropped in install: TestPiInstallAndRemove;
- PI_CODING_AGENT_DIR not set: TestPiRunGivesAgentDir;
- the identity dedupe dropped: TestPiInstallAndRemove;
- the installed marking always "live": library-pi-market 11 of 11 red.

Not tried: a real magpie binary driving pi install end to end; pi on
native Windows; git: and local package sources (the market lists npm
only, and the Pi's list still shows and removes them as before).
2026-11-10 21:15:14 +08:00
yetone 00e8242e85 library: Hermes folds its context with billion-context through its /bili/ prefix (Duckb7si on X)
Library › billion-context said no agent could use it on a machine where
Hermes was connected to magpie. Hermes was left out of the lanes on
purpose: bili's native Hermes plugin (hermes-plugin/__init__.py,
apply_env, billion-context 0.1.213) only sets HTTPS_PROXY, HERMES_CA_BUNDLE
and SSL_CERT_FILE. magpie's Hermes provider is http://127.0.0.1:3425/v1,
plain http on loopback, so that proxy never sees it: the plugin would add
its tools and fold nothing.

Hermes now takes the route Zed takes, bili's documented /bili/ prefix.
Turned on, magpie runs `bili start --port 8787` and sets base_url of the
magpie and magpie-anthropic providers to http://127.0.0.1:8787/bili/<gw>,
in config.yaml and in every profile that has magpie's provider
(agent.HermesThrough). Each later Sync or pick keeps a loopback prefix
with a path (hermesPrefix), and drops anything else back to the gateway.
Turning it off puts the gateway back. The empty-list string, docs (en, zh,
ja), llms-full.txt and docs/subsystems/library.md name Hermes.

The other agents bili supports that magpie wires (dsh, Kimi, ZCode, Codex,
Gemini, Qwen, ...) are #5915.

Run (mote, at the rebased head unless said):
- go test -tags nogui ./internal/library: ok (252s) at the rebased head
- go test -run 'TestHermes|TestZed|TestProxy|TestBili|Kept'
  ./internal/agent ./internal/library: ok before the rebase (base
  2219fdd49); the whole internal/agent at the rebased head was still
  running at push (mote load ~60), result goes on #5915
- GUI library-bili, library-all, i18n-keys, i18n-en-no-cjk (chromium and
  webkit, every language): 84, 26, 4, 4 pass, 0 fail (before the rebase)
- site node --test: 107 pass (llms-full.txt regenerated with llms-full.mjs)
- go vet darwin, GOOS=linux -tags nogui, GOOS=windows on agent and
  library: clean; gofmt -l clean
Broken by hand:
- hermesEntries without the prefix: TestHermesThroughBili red (a pick
  drops the prefix)
- no "hermes" URL lane: TestBiliHermesThroughPrefix red (Hermes not
  offered)
Not tried:
- a real Hermes and a real `bili start`; tests fake bili and the probe
- a profile created after turning it on goes to the gateway until Hermes
  is turned on again
- bili's native Hermes plugin installed at the same time
- Windows run (vet only)
2026-11-10 16:16:11 +08:00
yetone 93a33d8174 agent: OpenBot's icon, its requests named its own, its skills in the Library (SSNQT on X)
SSNQT on X, magpie 0.1.3503 on macOS, OpenBot (611ce90d1): no icon in
the Agents list, its requests listed as OpenCode's, and no way to pick
it for skills or MCP servers in the Library.

- Icon: OpenBot's production icon (build/icon-production.png in
  nightly-labs/openbot, 128px) as icons/openbot.png, in pngIcons and in
  app.css's tile rule (a solid tile, icon-tile.test.cjs); openbot is off
  client_icons_test's generic list.
- Requests: OpenBot seals an endpoint's key and headers in safeStorage,
  which magpie can't write, and hands the endpoint to the OpenCode it
  runs, so every request came with OpenCode's User-Agent and nothing of
  OpenBot's. magpie's entry is now at <gateway>/agent/openbot/v1
  (gateway.AgentURL). lanGuard takes /agent/<id> off the path when <id>
  is an agent magpie knows (takeAgentPath), agentOf names that agent
  first, and startedByAgent never takes such a request for a script. An
  unknown id is left in the path (404 as before). An entry written at
  /v1 is rewritten at the next sync; OpenBot reads it after a restart,
  which its notice already says. Requests recorded before stay
  OpenCode's.
- Library: an openbot target with skills in ~/.agents/skills, the only
  folder OpenBot reads (home-skills.ts, HOME_SKILL_FOLDER). Its MCP
  servers are rows in its SQLite database (openbot.db,
  projection_mcp_servers), which magpie doesn't write, so it stays out
  of the MCP picker: #5896.
- Guard: TestEveryAgentInLibrary fails for a built-in agent that has no
  Library target and isn't in noLibrary with a reason. 34 agents had
  none when it landed; they are listed as "not looked at (#5897)". The
  icon guard (TestEveryClientHasNameAndIcon) and the agent-name guard
  (TestIsAgentByUserAgent) were there already.

Run (mote unless said): gofmt -l internal (clean); go vet darwin, GOOS=linux
-tags nogui, GOOS=windows on agent, gateway, library, gui: ok;
go test -count=1 ./internal/agent ./internal/gateway ./internal/library
./internal/gui ./internal/usage: all ok but internal/gui's
TestUpdateSlowDownloadOutlastsTheCheckBound (its check request hit its
deadline with four other suites on the box; passes 3 of 3 alone; the
updater isn't touched here; #5905); TestAgentInPath and
TestEveryAgentInLibrary on Windows (win-run): ok; GUI i18n-keys,
icon-tile, icon-one-tone, icon-builtin-over-address,
routing-client-icons, library-pick-remove: chromium 101/101, webkit
54/54. Real gateway (nogui build, sandbox HOME, port 3591): a POST to
/agent/openbot/v1/chat/completions with OpenCode's User-Agent was
recorded as agent openbot, the same at /v1 as opencode, and
/agent/openbot/v1/models answered the list.

Broken by hand, each red: the takeAgentPath call in lanGuard taken out
(TestAgentInPath: path kept, agent opencode); the pathAgent check in
agentOf taken out (agent opencode); the openbot case in targetOf renamed
(TestEveryAgentInLibrary: openbot has no place); Icon back to generic
(TestEveryClientHasNameAndIcon).

Not tried: real OpenBot or a real OpenCode sending to the new address
(the URL is built as `${baseURL}/chat/completions` by
@ai-sdk/openai-compatible, read in its source); the full suite (runs
after the tag).
2026-11-10 15:56:21 +08:00
yetone 97fcbe3540 library: billion-context's card shows the tokens it saved (Scott__D on X)
The RTK tab says what RTK saved (rtk gain); the billion-context tab said
nothing of its effect. bili 0.1.213 has no command that prints its
savings. Its running proxy serves its dashboard's numbers at
GET /__bili/overview, summed over every session in its one store, and
each bili that runs registers in <state>/instances/<id>.json
($XDG_STATE_HOME or ~/.local/state, then billion-context, on every
system; read from bili's dist and its Hermes plugin's twin reader).

readBiliSaved (internal/library/bili_saved.go) asks the registered
bilis newest first, loopback http origins only, 3s in all, and puts the
first answer on BiliView.Saved: netSavedTotal (bili's headline "net
savings", after post-fold rebuilds and the summaries' cost, only with
hasFoldData), grossSavedTotal (which bili calls an upper bound),
foldsTotal, sessions, requests. The answer is kept in bili-saved.json
in magpie's config folder and shown "as of" its time when no bili runs;
a kept file that doesn't parse is no answer. magpie never starts a bili
to ask (it would auto-update and start watchers). The card says
"166.3k tokens saved over 7 folds in 1 session", bili's own count over
every session on this computer, the gross before costs; "Nothing folded
yet over N requests" before a fold; and that it shows once bili has run
when no bili ever answered. zh, zh-TW, ja and de; site docs (en, zh,
ja) and docs/subsystems/library.md.

Run:
- Real bili 0.1.213 on mote in a sandbox HOME (ACP_AUTO_UPDATE=0, 20000
  token window, bili start on 18799, a fake OpenAI upstream answering
  usage = bytes/4): ten turns of a growing conversation through
  /bili/<upstream>/ gave overview net 166285, gross 166390, 7 folds,
  1 session, 10 requests. That literal answer is the Go fixture
  (testdata/bili/overview-0.1.213.json) and the GUI test's numbers.
  readBiliSaved/ReadBili run on mote against that live bili with that
  HOME read the same numbers (Live true, Version 0.1.213).
- go test -tags nogui ./internal/library ./internal/gui on mote: ok.
- win-run go test -run 'TestBiliSaved|TestBiliLoopback'
  ./internal/library on xiaomi-gpu: ok.
- library-bili, i18n-keys and i18n-en-no-cjk in chromium and webkit
  (every language, 1100 and 420 wide): 92 pass, 0 fail.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui and
  GOOS=windows for internal/library and internal/gui: ok.
- site/public/llms-full.txt regenerated (node llms-full.mjs); site
  worker.test.mjs: 38 of 38 ok.

Broken by hand:
- the loopback filter taken out: TestBiliSavedFromRunningBili red
  (192.0.2.7 asked first, the 3s budget gone, nothing read).
- net read from tokensSaved, and a kept answer marked live:
  TestBiliSavedFromRunningBili and TestBiliSavedOnThePage red.
- the card's line taken out: library-bili 40 of 42 red (chromium).

Not tried: a real agent session with a real model through bili (the
upstream was a fake with made-up usage, so only the plumbing of bili's
numbers is checked, not how much a real session saves); a bili with
money data (hasMoneyData; its dollars are passed as usd but not shown);
the card on Linux WebKitGTK.
2026-11-10 15:47:32 +08:00
yetone eff7f9f62a library: a market server starts the way its registry entry says (fwxkogaia on X)
Serena from Library → MCP's market showed "已退出 (2)": magpie ran
`uvx serena-agent`, which prints its help and exits 2. The registry has
uvx run it as `uvx -p 3.13 serena-agent start-mcp-server
--project-from-cwd --context desktop-app`: its runtimeArguments, which
the shipped crawl (market_servers.json) had dropped and magpie never
read.

The class, fixed in launchLine (market_launch.go):
- runtimeArguments are read: the runner's own options (uvx -p/--from/
  --with/--prerelease, npx --package, docker's mounts, -e and
  --entrypoint) go before the package, the program's words after it,
  then packageArguments. A required option with no value magpie can
  fill keeps the package from being offered.
- An executable not named after its package is reached with
  `uvx --from <pkg> <bin>` / `npx -y --package <pkg> <bin>`. The crawl
  now keeps each package's executables (`bins`: npm's `bin`, the
  wheel's console scripts); a package with none, or several with none
  standing out (pickBin), isn't offered. `python -m mod` among
  runtimeArguments runs that module from the package.
- One package that can't be started no longer hides another of the
  same server (npm, then pypi, then oci).
- serverKey/packageOf skip uvx's option values, so Serena's key stays
  "uvx serena-agent" and an installed one is still found.

Audit of the 500 shipped entries (old line → new): 101 change. Among
them firebase (`npx -y firebase-tools mcp`), basic-memory, docling,
ouroboros, pm-claude-skills, llm-sandbox, polymarket-paper-trader,
visualtorch, canvas-mcp, alfanous (python -m), uniswap, pyscrappy,
llmtrim, reddit-research-mcp, word-mcp-live, omega, tinysearch,
haiku-rag, orcareplay, terravision, watch-skill, PyMemoryEditor,
edgartools/mirobody/new-term-radar/backlot (--with/--python), docker
robin/funasr/MARM (mounts). No longer offered (no line that starts):
aihawk and mcp-sap-docs (not on PyPI/npm), mcp-video, unifi-mcp-server,
antigravity-link-extension (no executable), token-savior, flyto-core
(several, none for MCP), maintenant and apollo (a docker mount to fill
in).

Users who installed one already: heal() gives a uvx/npx server whose
command and arguments are exactly the line magpie offered before the
line the registry says (healMarketLines), so the next start of magpie
rewrites library.json and every agent given it. A line the user edited
is left as it is.

Run (mote, via mote-run): go test ./internal/library ./internal/gui;
go vet darwin, GOOS=linux -tags nogui, GOOS=windows; gofmt.
TestRegistryLaunchLines uses the registry's own entries (Serena,
docling, olcli, alfanous, visualtorch, basic-memory, firebase, MARM,
...); TestPopularSerenaStarts reads the shipped crawl;
TestInstalledMarketLineHealed seeds `uvx serena-agent` given to Codex,
syncs, and checks config.toml and library.json. No network in tests.
Real starts on mote in a sandbox HOME (MCP initialize): `uvx
serena-agent` exits 2 with usage; the new Serena line answers
initialize (serverInfo Serena). Also answer: polymarket pm-trader-mcp,
basic-memory, llmtrim, pm-claude-skills, visualtorch-mcp. canvas and
reddit start but need their keys.

Broken by hand: ignoring runtimeArguments and the bins check turns 14
of TestRegistryLaunchLines' cases and TestPopularSerenaStarts red;
dropping healMarketLines from heal turns
TestInstalledMarketLineHealed red.

Not tried / still wrong upstream: omega and tinysearch now run their
real executable but their registry entries omit the `[server]` extra
(omega also needs `serve`), so they still don't serve MCP; that is
their registry entries. Docker lines weren't started. No GUI asset
changed, so no GUI files were run. The full suite runs after the tag.
2026-11-10 15:47:14 +08:00
yetone 4869d0c966 library: an MCP server switches off for every agent and app, and on again as it was (swang20201 on X)
An installed server in Library could only be removed. Each server row
now has a switch after its agent chips. Per-agent chips already
existed, but in Docker gateway mode there are none, and the MCP router
gives every server to any app at its address, so nothing could turn a
server off there.

ServerOn (POST /api/library/servers/on, `magpie library mcp off|on
<name>`) reuses the Hidden/Paused pair a plugin's hidden server
already has. Off: Hidden, with its agents kept in Paused. On: those
agents get it back, or none when it had none, so the router gives it
to other apps again. Its command, env, headers, sign-in, DisabledTools
and note stay in library.json. Off, it is also left out of every
project's files (syncProjectMCP) and of subagents' mcpServers
(renderSubagent), which before had only skipped a server gone from
the library. The router's held process ends on the next prune,
because Hidden/Paused are in its hubKey. An off row is dimmed, its
chips take no click, and it is health-checked only on a click.
Strings are in zh, zh-TW, ja and de. docs/subsystems/library.md has
a row for it, and mcp-router.md names it.

Run (mote):
- go test ./internal/library ./internal/cli ./internal/gui: ok.
- go vet ./..., GOOS=linux -tags nogui, GOOS=windows: ok.
- gofmt -l: empty.
- GUI: the 145 files that touch the Library, i18n-keys and gui-*, in
  chromium and webkit. 2798 of 2881 passed.
  - i18n-keys was red because the key "{name} on" also matched core's
    "{name} on magpie". The key is now "Turn {name} on or off", and
    i18n-keys and library-mcp-on are green (26/26).
  - Nine files are red the same way on a clean origin/main 217d77848,
    with the same set failing on this branch: library-hooks,
    library-subagents, library-loading, library-items, list-sort,
    market-have, mobile-web, sidebar-tab-top and skill-where. The Library's
    tab strip shows MCP and has no RTK. Filed as #5850.
- library-mcp-on.test.cjs: en, zh, zh-TW, ja and de, in the app at
  1100px and in gateway mode at 420px, both engines, 22/22.

Broken by hand, each went red:
- project_mcp without the Hidden skip: the project's .mcp.json kept it.
- subagents without it: the subagent still named it.
- ServerOn not giving Paused back: on again, claude's file lacked it.
- the row without its switch, and the CSS without pointer-events:none
  on an off row's chips: library-mcp-on red.
- A Hidden check added to hubPrune stayed green, because hubKey
  already ends the process, so it was left out. The test still checks
  that the process ends.

Not tried: the real Docker image, and a real MCP server with a
sign-in (the test's server is a fake stdio one). The TUI has no
switch (the CLI has one).
2026-11-10 10:23:53 +08:00
yetone b75aff1073 library: billion-context for Zed through its /bili/ prefix (CoMi6818 on X)
billion-context's README lists Zed, but Library's billion-context tab
offered only Pi, omp, OpenCode and Claude Code. Zed has no plugin of
bili's. Upstream gives it two routes: `bili zed`, a Linux-only launcher
that leaves a provider on loopback direct (so it never passes magpie's
gateway), and, on every system, the /bili/ prefix its docs give any
client whose model address can be edited, with `bili start` answering
on 8787.

Zed is now a URL lane (biliURLLanes, internal/library/bili_url.go).
Switched on, magpie has bili start answer (one the user runs is used;
else magpie runs its own under KeepLinked's context, logged to
bili-start.log, and starts it again at magpie's start while Zed is on),
then agent.ZedThrough sets the magpie provider's api_url to
http://127.0.0.1:8787/bili/<gateway>/v1 and saves the key for that
address in the credential store, where Zed looks it up by address. A
pick and a sync keep the prefix while magpie answers through it
(zedReach, #1985's proxy recognition). Off puts api_url back on the
gateway and ends magpie's bili start when nothing goes through it.
Zed must be on magpie first; the error says to pick a magpie model.

Run:
- bili 0.1.213 on mote: bili start --port N, then
  /bili/http://127.0.0.1:<fake magpie>/v1 forwarded GET /, GET
  /v1/models and POST /v1/chat/completions with Authorization kept and
  bili's tools injected (repro/zedroute.sh).
- mote: go test -tags nogui ./internal/library ./internal/agent (full
  packages), go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- mote: library-bili, i18n-keys, i18n-en-no-cjk GUI tests (chromium
  and webkit).
- win-run: go test ./internal/agent ./internal/library -run
  'TestZed|TestBili'.
- gofmt -l clean.

Broken by hand: SetBili without the URL-lane dispatch, and zedReach
without the proxy keep: TestBiliZedThroughPrefix and TestZedThroughBili
go red; restored, green.

Not tried: a real Zed app through bili (no Zed on mote), and the real
keychain write (zedCredential stubbed in tests, as before). Other
clients upstream lists (Cline/Roo/Kilo, Continue, OpenHands, Void,
Cursor, Warp, launcher-only lanes) are not added here.
2026-11-10 09:59:22 +08:00
yetone 3aa55065a3 library: Claude Code keeps its auto-compaction beside billion-context (Kling__Lab on X)
Kling__Lab's Claude Code stopped after a little use with "Prompt is too
long", every message answered at once (作業時間 0s) with nothing sent.
bili's Claude Code install writes DISABLE_AUTO_COMPACT=1 into the shared
~/.claude/settings.json. A session bili doesn't fold then has nothing to
keep it under the window: the Claude desktop app's Code tab runs Claude
Code on that settings.json with its own ANTHROPIC_BASE_URL, past bili's
proxy (bili's own #2290), and a window bili takes larger than the one
magpie serves lets the session reach it first. With auto-compaction off,
Claude Code blocks locally at about window-3000 and returns "Prompt is
too long" without a request.

magpie now writes "0" in place of bili's added "1" right after the
install. bili leaves a value that isn't "1" as the user's, through its
SessionStart hook and a reinstall, and its remove takes only a "1". So
auto-compaction stays on as a backstop at the window magpie wrote
(CLAUDE_CODE_AUTO_COMPACT_WINDOW), which bili, when it does fold, keeps
the session under. A DISABLE_AUTO_COMPACT the user had before the install
is left as theirs. A plugin magpie installed before this is mended from
KeepLinked at start, and its bili-plugins.json record says "0" too, so
switching it off still puts the file back as it was.

Reproduced on mote with Claude Code 2.1.321 and billion-context 0.1.213
against a fake gateway reporting 195000 input tokens on a 200000 window:
with DISABLE_AUTO_COMPACT=1 the second turn is "Prompt is too long" with
no request sent; with 0 it compacts and goes on.

Run (mote-run): go test -tags nogui ./internal/library -run
'TestBili|TestParseBiliList' -v, all ok, including the new
TestBiliClaudeKeepsAutoCompact (on and off, the user's own value, a
plugin installed before), then the whole package (go test -tags nogui
./internal/library ok, 154s). gofmt -l clean; go vet ./internal/library
./internal/gui/..., GOOS=linux -tags nogui and GOOS=windows go vet
./internal/library ok.

Broken by hand: biliKeepCompact returning at once. The new test's "on
and off" and "installed before" went red (DISABLE_AUTO_COMPACT = 1 after
the install / after magpie started), "the user's own" stayed green.

Not tried: the real Claude desktop app's Code tab, and a real bili
install on a real account; the fake bili in the test copies bili 0.1.213's
"1 only when absent or 1" rule, read from its source.
2026-11-10 09:48:31 +08:00
yetone fdc96dfe4d library: a billion-context tab switches its plugin on per agent and restores each file exactly
@Kling__Lab on X asked for billion-context (npm billion-context, CLI bili,
github.com/ranxianglei/billion-context) beside RTK. The Library gets a
billion-context tab after RTK, a card like RTK's:

- No bili: its README's `npm install -g billion-context --prefix=~/.local`
  and Install billion-context (InstallBili; biliPath finds bili in
  ~/.local/bin when it isn't on PATH).
- Installed: its version, a note that an agent switched on here can't also
  run billion-context-pi or opencode-acp, and a switch per agent that runs
  `bili plugin install|remove <agent>` (SetBili), read back from
  `bili plugin list`.
- Offered for Pi, omp, OpenCode and Claude Code, the lanes that keep
  magpie in front: Pi/omp/OpenCode load it in process and still send to
  magpie; Claude Code goes through bili's proxy, which forwards to
  magpie's gateway. Not offered: Codex (MCP only), ZCode (routes only its
  own provider), Kimi Code (renames default_model to bili-kimi), dsh (its
  install failed through dsh's pnpm), Hermes (can't be tried in a sandbox
  HOME), and agents in WSL.

bili's remove doesn't restore a file: it leaves `"packages": []` in Pi's
settings and `extensions:` in omp's config, and after magpie rewrote
Claude Code's settings.json it deleted ANTHROPIC_BASE_URL (Claude Code
then went to Anthropic, not magpie) and put back DISABLE_AUTO_COMPACT.
So switching on records each file before and after (bili-plugins.json in
magpie's config folder), and off writes the before bytes back when the
file is unchanged since, else merges JSON three ways; with no record
(bili set up outside magpie) only a Claude Code ANTHROPIC_BASE_URL the
remove took out is put back. bili's .bili-bak/.bili-last files go too.
`GET/POST /api/library/bili`, `POST /api/library/bili/install` are
named in the CLI parity list beside RTK's. Docs: site library pages
(en, zh, ja) and docs/subsystems/library.md.

Run:
- go test ./internal/library -run 'TestBili|TestParseBiliList' on mote:
  ok (a fake bili mimicking pi/claude lanes, .bili-bak re-backup and
  claude's buggy remove; a fake npm for the install).
- Full `go test -timeout 45m ./...` on mote at 16c67965f (this commit
  before the body was written, same tree): every package ok but
  internal/gateway's TestBurstTellsNoSpeed/responses_from_chat_burst
  (804ms burst read as a speed, load ~50 after a mote reboot); passes
  -count=3 alone at the same head; recorded on #2719, same test. An
  earlier full run at 8c8c63537 was all ok.
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
  go vet ./... at 16c67965f: ok. gofmt -l: nothing.
- GUI at 16c67965f: library-bili, i18n-keys, i18n-en-no-cjk,
  library-memory, library-rtk-gain, library-pi-extensions, Chromium and
  WebKit (library-bili: every language, 1100 and 420 wide).
  80 of 80 pass.
- The whole GUI suite is still running on mote at this head, started
  before the tag; two earlier whole-suite runs were cut short (mote ran
  out of disk mid-run, then rebooted), so their reds are not a record.
  Its result goes in a follow-up.
- Real, in a sandbox HOME (named dir, bili 0.1.213 installed there,
  magpie web built from this branch on 3486/3487): through magpie's API,
  Pi and Claude Code switched on; `claude -p` and `pi -p` each answered
  "pong" through magpie's gateway (Claude Code via bili's proxy on
  18788 -> 127.0.0.1:3486); switched off: Pi's settings.json, Claude
  Code's settings.json and .claude.json byte-identical to before, no
  .bili-* files left, commands/acp-cache.md gone; claude -p answered
  again straight to the gateway. Earlier, with bili run by hand, Pi,
  OpenCode, omp, Claude Code and Kimi each sent a request through a
  recording relay with bili's tools/headers on it.

Broken by hand: skipping biliRestore turned TestBiliOnOffExact,
TestBiliClaudeKeepsMagpiesRoute and TestBiliOffWithoutRecord red;
dropping the no-record URL fix turned TestBiliOffWithoutRecord red;
removing the tab turned all 22 library-bili cases red; removing the zh
note string turned the zh cases red in both engines. Each put back.

Not tried: Kimi, dsh, Hermes, Codex, ZCode lanes (not offered); WSL;
Windows (the %APPDATA%\npm lookup and npm without --prefix are untried
on the Windows box); OpenCode and omp switched through magpie's API
(switched by hand with bili before); a real npm install from the button
(sandbox had bili already; the test fakes npm).
2026-11-10 07:24:26 +08:00
yetone 88b541a25c images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2):
- go vet ./internal/gui ./internal/gateway ./internal/agent
  ./internal/provider ./internal/settingsapi: ok
- go test -run 'Image|Draw|Video|Hidden|Group|Settings' ./internal/gui
  ./internal/gateway ./internal/settingsapi: ok; ./internal/imagemcp,
  ./internal/library, ./internal/catalog: ok
- GUI: i18n-keys, i18n-en-no-cjk, image-models-hide,
  library-browser-setup: pass in Chromium and WebKit
- gofmt -l: nothing
Not tried: a real agent reading the new MCP instructions (text only).
2026-11-09 21:51:53 +08:00
yetone b475004d52 library: Pi's extensions and packages, switched and copied between Pis
leokon3 runs Pi on Windows and in WSL and asked for magpie's Library to
manage Pi's extensions and packages. A new "Pi packages" tab in the
Library lists each Pi here (this computer's and each WSL distro's), with
the extensions and packages it loads, read by Pi's own rules
(@earendil-works/pi-coding-agent 1.4.0). Each has a switch, written as
`pi config` writes it, and a "Copy to…" menu for the other running Pis.

- A package is copied as its settings.json entry; Pi installs it itself
  when it next starts. node_modules is never copied. A local package, and
  one the other Pi already has by Pi's identity (npm name, git host/path),
  is refused.
- An extension file or folder is copied as files, without node_modules,
  .git or symlinks, never over one of the same name. The page says to run
  npm install there when it has dependencies.
- A package that already picks some parts (filtered in `pi config`) shows
  its switch disabled. A settings.json that can't be parsed lists nothing
  and is never written; a stopped distro is never started; every write is
  backed up first.
- GET/POST /api/library/pi, POST /api/library/pi/copy (notYet in the CLI
  parity list, stage 3: the library).

Run at 29d63e2dd (this tree on origin/main c7ebb6f8d; rebased after onto
608c1543e, which changes only internal/gateway), on mote:
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows on
  internal/library and internal/gui: ok.
- go test -tags nogui ./internal/library ./internal/gui ./internal/cli:
  ok, ok, ok.
- A real pi 1.4.0 (npm) in a sandbox HOME and PI_CODING_AGENT_DIR, through
  an uncommitted pireal test: pi -p loads hello.ts (a marker file), the
  switch turns it off (no marker) and on again; a todo folder copied from
  a second Pi's dir is loaded by the real pi; npm:pi-web-access@0.47.0
  copied as a settings entry was installed by pi itself into
  <agentDir>/npm/node_modules and read back as installed v0.47.0; switched
  off, `pi list` still lists it and magpie reads it off.
- GUI, 70 files (library-*, i18n-*, gui-* and the Library's neighbours),
  both engines: 1503 of 1515 pass. The 12 reds are the same on origin/main
  c7ebb6f8d: page-width-steady's 11 (run there alone, 11 of 20 red; #5013)
  and i18n-keys "a plugin's words are its own" for "Use the library's",
  "No session ID" and "View routing" (#5482, #5426, #5332).
  library-pi-extensions runs en, zh, zh-TW, ja and de at 980 and 380px.
On Windows (win-run): go vet with and without the pireal tag ok; go test
-run TestPi ./internal/library ok.

Broken by hand: the first run named the tab "Pi extensions", which a
comment in internal/provider/discovery.go says too, and i18n-keys went
red for it; library-loading went red for the new tab next to RTK while a
Pi is here; and TestEveryRouteHasACommandOrIsNamed went red for the three
routes. All three were fixed and pass in the run above.

Not tried: a real copy between a WSL Pi and the Windows Pi (the WSL side
is covered by the unit tests' fake distro only), the full go test ./...,
and the whole GUI suite.

Reported-by: leokon3 (Discord)
2026-11-09 16:33:28 +08:00
yetoneandggbdpq 3480f822c5 library: an apply over a library that lost its instructions leaves the agents' parts alone (#5709)
Starting v0.1.3327 applied the Library at launch while it was empty, and
the apply wrote that over nine agents' instruction files: zcode's lost
magpie's part, and codex's, kimi's, opencode's and dsh's AGENTS.md were
deleted whole, with nothing asked or logged. library.json then recorded
hash("") for every agent. syncInstructions fell through to
withBlock(file, "") and, for a file with nothing of the user's outside
the part, edit.Remove.

Now:
- An automatic write (Sync: at a start, and beside a change) that would
  write nothing over a part while the library has no instructions to
  give anyone (no agent ticked, or no shared text) leaves the part where
  it is and logs a line per agent, naming a record whose last write
  hashes empty. The reporter's library.json had both. Only the page's
  own write (changeInstructions) takes parts back; a text still held
  with one agent unticked takes back as before (TestWSLStoppedInstructions).
- An automatic write never removes a whole instructions file; it empties
  it in place. The page's write keeps the removal, with the backup first.
- A set's or an agent's extra text that is there but can't be read
  (readText swallowed the error) is a Problem, never an empty text: an
  unreadable set file no longer cuts parts down, on the page's writes too.

Siblings left: syncMCP, syncHooks, syncSkills and syncSubagents take back
by Applied record what magpie wrote (config entries and links that the
library and market can give again, not prose), and a library reset that
loses their lists loses those records too. The sync chain (an empty part
coming down from another computer) is #5642's commit.

Ported from ggbdpq's patch on the issue, with the guard widened from
"no shared text" to "no agent ticked or no shared text" and the
unreadable-text check added.

Run:
- New tests in internal/library/empty_library_test.go, all red on the
  old instructions.go/sync.go (part cut to the user's own lines, or
  "deleted whole by the apply"), green after:
  TestEmptyLibraryApplyLeavesAgentsFilesAlone,
  TestEmptyTextApplyLeavesTickedFilesAlone,
  TestApplySaysWhyItLeftAPartAlone,
  TestUntickedLibraryApplyLeavesFilesAlone (agents unticked, text kept:
  red under the original patch's guard too; the page's untick still
  takes back), TestUnreadableTextLeavesFilesAlone (set file mode 000).
- go test -tags nogui ./internal/davsync/ ./internal/library/ on mote.
- gofmt -l on the changed files: nothing.

Not tried: the reporter's v0.1.3327 upgrade that emptied the index.

Reported-by: lennonli (yetone/magpie#5709)
Reported-by: gua2100 (Discord)
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-09 12:04:06 +08:00
yetone dc098c1e82 library: a skill from a folder follows GitHub once installed from there (biubiu8802 on X)
biubiu8802 (X, 2119602075864903924) downloaded a skill from GitHub and
put it in the Library from its folder, so it had nothing to update from
and no way to link it to GitHub. Installing it from its GitHub link now
links the two, the way an update of a CC Switch skill already does: the
library's skill by that name takes GitHub's files and GitHub as its
source. A check and an update cover it from then on, and the agents'
links keep pointing at it. When its own files aren't GitHub's, they go to
the backups like UpdateSkill's replace does, and the result says so. A
folder of the user's it was linked to stays as it is.

followsHere (skill_link.go) decides it. It links only a skill with no
remote source that wasn't renamed and is that skill: it traces to this
repository (CC Switch, the skills CLI's lock, a git checkout, From), or
it traces nowhere and its SKILL.md has the same description as GitHub's,
as an older download of it does. One traced to another repository, or
an untraced one that describes something else (mora1n's case,
TestInstallSetPutsAnotherByTheSameNameBeside), still goes in beside it
(skill_beside.go). A had skill with
the same files and no source is bound to the GitHub source it was found
in, so a later install of another repository's skill by that name goes
beside it, not over it (TestSameFilesByNameAreHad).

The probe marks such a candidate links:true. The GUI's Add list tags it
"links to GitHub" with a tooltip, and the report names "updates from
GitHub now" and "files of their own kept with the backups". The TUI's
probe list and result line say the same. The new strings are in zh,
zh-TW, ja and de.

Run on mote (macOS), on 64ecd0f69, then rebased on 8a58c0e30, whose
new commits touch none of internal/library, the TUI's library or the
library page:
- gofmt -l clean; go vet ./..., GOOS=windows go vet ./...,
  GOOS=linux go vet -tags nogui ./..., GOOS=linux go build -tags nogui
  ./..., GOOS=windows go build ./... all ok
- go test ./internal/library/... ok at this tree; ./internal/tui/...,
  ./internal/cli/... and ./internal/gui/ ok at the tree before the
  description check (that change touches internal/library only)
- GUI (chromium + webkit, 5 languages, wide and narrow):
  skill-install-link (new), skill-install-beside, skill-install-skip,
  skill-install-agents-all, skill-git-source, skill-too-big,
  provider-discovery, i18n-en-no-cjk pass. i18n-keys' "a plugin's words
  are its own" is red on main for three strings this change doesn't
  touch, already filed: #5332/#5327 ("View routing"), #5482 ("Use the
  library's"), #5426 ("No session ID").

Broken by hand: without the description check (the first version),
TestInstallSetPutsAnotherByTheSameNameBeside is red (caveman taken over).
followsHere returning false always turns
TestFolderSkillFollowsGitHub red (probed As:pdf-pro-biubiu) and
TestOwnSkillFollowsGitHubKeepsItsFiles red (linked [] kept []).

Not run: the full go test ./... suite. mote's suite lock had a queue
waiting up to 16h, so this change ran the packages it touches.
No real GitHub install either: the tests use a fake tarball server. Not
tried on Windows or Linux. The market's had-check (haveSkill) is
unchanged: a market skill with a folder copy by that name still counts
as had.
2026-11-09 11:29:51 +08:00
yetone a2b552a34b library: a session-start hook can be narrowed to some starts (#5604)
A Library hook on "When a session starts" can now carry a matcher of
starts: one or more of startup, resume, clear, compact and fork (Claude
Code's words, library.HookStarts), joined by "|". NEKO-CwC's case is a
hook that re-injects a file after compaction alone; written whole, it
also ran at startup and once for every subagent fork.

Each agent's format was read from its own source:
- Claude Code 2.1.316 tests the matcher against source, which has all
  five starts. Its entry is written as given.
- Codex (codex-rs/hooks, rust-v0.165.0): SessionStartSource has the
  same five, and a "|" list is read as exact names. Written as given.
- Gemini CLI 0.63.0 has startup, resume and clear only, and its
  matchesTrigger compares the matcher whole. It takes one of those.
- Grok 1.0.67 tells only "new" (fresh, /new, /clear) from "load"
  (resumed). It takes a set that is exactly one of those groups.
- Cursor (cursor-agent 2026.10.01) takes no matcher: its Claude-hooks
  importer warns that a SessionStart trigger matcher "is not supported
  in Cursor, hooks will fire for all triggers".

startMatcher keeps the chosen starts that the agent has. With none
left, the agent is refused; with every one it has, it gets the hook
whole. An agent that can't run the hook at exactly the starts picked is
refused with why, and its chip is greyed, as for any other per-agent
limit. This is the least surprising choice. Widening the hook to every
start would run it at the very starts the user excluded (the fork runs
the issue is about), and a matcher the agent never matches would do
nothing without saying so. SomeHooksAgents (Select) gives a narrowed
hook only to the agents that can run it.

Tool-event validation is unchanged: only tool events take shell or
edit, and only session-start takes starts. check() refuses an unknown
start, a start named twice, an empty part and a wrong case. The matcher
as written is recorded in Applied.Hooks, so an agent's own edit of the
entry is still theirs, and is kept when the hook changes or is removed.

GUI: the editor shows an "At which starts" app menu for session-start
(openProtoMenu, no <select>), with Any start, A fresh session, A
resumed session, After /clear, After the context is compacted, A
forked session and Any start but a fork. HookAgentView.Starts and
StartSources tell the page which matchers each agent takes. A chip that
can't take the matcher greys with one of three reasons, in the editor
and on the row, and save leaves it out. Every new string is in zh,
zh-TW, ja and de. docs/subsystems/library.md's Hooks row says all this.

Run, at 7f60927fd (origin/main 61394481c + this), all on mote:
- go test -tags nogui -count=1 ./internal/library ./internal/backup
  ./internal/davsync: ok.
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...:
  ok. gofmt -l: clean.
- node --test --test-concurrency=4 library-*.test.cjs (57 files)
  i18n-keys.test.cjs, both engines: 1183 of 1186 passed.
  - i18n-keys "a plugin's words are its own" is red for three strings
    already filed: #5482, #5426 and #5332/#5327. My "A new session"
    hit that test too (internal/claudetui says it), so it became "A
    fresh session".
  - library-mcp-json chromium "ja 390" timed out once. It passed 11/11
    run alone, twice. Filed as #5613.

Broken by hand:
- With the old hooks.go, TestHookSessionStartNarrowed and
  TestHookMatcherKeptToItsEvent fail ("session-start can't be narrowed
  to compact").
- With entry() writing no matcher and the sync check skipped, 17
  assertions fail: Claude and Codex are given matcher "", Gemini,
  Cursor and Grok get the hook whole, and no problems are shown.
- With the old client.js, library-hooks.test.cjs fails in every
  language, waiting for .lib-hookstart.

Not tried:
- No real agent ran a narrowed hook. The formats come from each
  agent's source and docs, not from a live session start.
- Old data: a hook saved before this has no matcher and is unchanged.
  A narrowed hook carried in a backup or sync to an older magpie is
  written whole there, because that magpie's sync doesn't check the
  matcher.
- The full go test ./... and the whole GUI suite run after the push,
  as agent-rules.md orders.

Reported-by: NEKO-CwC
2026-11-07 20:14:25 +08:00
yetone d55881730d gateway: a key can be held to some MCP servers and tools
wakaka on Discord (#help, 11-06) asked for gateway keys limited to some
MCP servers and tools, as keys already are to models (#882).

A key's MCP list (caller-keys.json "mcp") holds entries "server" (every
tool of it) or "server/tool"; "-" alone is no MCP server; an empty list
is every server, as before. A key issued under another is held to its
issuer's list too.

Every MCP route checks it:
- magpie's own servers (web search, vision, image, Magpie Browser, plugin
  tools) through serveMCP: initialize/tools/list/tools/call are refused
  or filtered per server and tool, and /v1/magpie/key-limits names "mcp";
- the Library hub ("magpie"): only the backing servers and tools the key
  may use are listed, and a call by name or by fallback is refused;
- /mcp/<name> and /mcp/run/<name>: the server is refused, tools/list is
  filtered in JSON and SSE replies, tools/call refused; a reply the
  filter can't read (an encoded body) is a 502, never passed through.

GUI: "MCP servers" in the key row's menu opens the app's own picker (no
native select) with All, No MCP server, each server and its tools (GET
/api/caller-keys/mcp lists magpie's own servers and the Library's). A
key held to some shows a badge saying which, that opens the same list;
a free key shows nothing more in its row, on hover either. A hover badge
was tried first: it pushed the row past 560px (gateway-caller-keys) and
squeezed the masked key under a drag at 420px (gateway-key-arrange).
CLI: magpie gateway-key mcp <id> github fs/read_file | none | all.
zh, zh-TW, ja, de strings; docs/reference.md and the gateway-routing and
library subsystem pages.

Not covered: a model's own built-in web search (a vendor tool, not MCP).

GET /api/caller-keys/mcp is named in the CLI parity test's notYet (its
list is what `magpie gateway-key mcp` takes; TestEveryRouteHasACommandOrIsNamed
caught it at the rebased head).

Run on mote (mote-run), at the pushed head:
- go test ./internal/access ./internal/cli ./internal/gui
  ./internal/library ./internal/gateway at a9c40186d (this change on
  2ce44dc28): ok except internal/gui's TestMainWindowCorners/macOS_26_SDK
  (#3949, the same message on macOS 27). After the rebase onto a9667daad
  (no file in common): TestCoreScriptBudget, TestCallerKey*,
  TestEveryRoute*, TestGatewayKey*, TestKeyMCP*, internal/access and
  go vet ./internal/... at d36f89224's tree: ok.
- gateway-caller-keys chromium en reads wider than 560px 4 of 6 runs
  alone on this branch and 4 of 6 on origin/main a9667daad: #3797,
  recorded there.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./...: clean; darwin, linux (nogui) and windows builds ok; gofmt -l
  clean.
- GUI: gateway-key-mcp.test.cjs in chromium and webkit, widths 1100 and
  420, en/zh/zh-TW/ja/de: 20/20. Every gateway-key*, gateway-keys* and
  i18n* file in both engines: ok except gateway-key-models en (red on
  origin/main ecc26a339 too, #4081/#5233) and i18n-keys "a plugin's words
  are its own" (red on main, #5332).
- The whole GUI suite (both engines, every language) with the hover
  badge: 91 reds in 25 files. Rerun alone on this branch and on
  origin/main 54dc257f1: only gateway-caller-keys (560px sideways),
  gateway-key-readonly, models-fold and models-select-all-api were red
  on the branch alone; the badge moved into the row menu for the first
  two. After it, every gateway-key*, gateway-caller-keys, gateway-card,
  gateway-connect-keys, api-key-theme and i18n* file passes in both
  engines, except i18n-keys "a plugin's words are its own" (red on main,
  #5332, none of the three strings are this change's) and 1 of 20
  models-select-all-api "the click scrolled" (#4389; models-fold is
  #4071). The rest are red on origin/main too and each has an issue:
  account-weight #4644, codex-auto-reset #2360, header-centre #3479,
  images-codex-one #4618, key-replace #4126, menu-input-scroll #3402,
  mobile-web #3952, model-chip-steady #4388, model-copy-id #4621,
  models-works-only #4391, nav-timeout #4787, omarchy #4624,
  page-width-steady #5013, phone-connect-menu #4706/#4707,
  plugin-move-unserved #4392.

Broken by hand, each went red: the serveMCP server gate, call check and
list filter, the own-server list filter and key-limits "mcp"
(TestKeyMCPOwnServer); hubTools, hubServersOf, the hubToolNamed
fallback and hubMCPRun (TestKeyMCPHub); /mcp/run (TestKeyMCPRun); the
/mcp/<name> guard and filter (TestKeyMCPProxy); the GUI's "No MCP
server" being exclusive (gateway-key-mcp).
gateway-key-readonly chromium 420 ja was red with the hover badge (the
sibling run, the whole suite and its rerun; green on origin/main) and
passes with the badge in the row menu.

Not tried: a real Library server through a live gateway, the hub with a
real agent, and running on Windows or Linux (vet and build only).

Reported-by: wakaka
2026-11-07 03:21:57 +08:00
yetone 25b201eb67 library: the Skills and MCP headings keep Select and put the rest under ⋯
ryanpascal on Discord: the Library › Skills heading had too many
buttons, up to a dozen beside the sort. The heading now shows the sort,
Select, Clean up and Update n when they apply, and a ⋯ (the app's row
menu, openRowMenu) holding Check for updates, Update all, Group again,
Collapse all / Expand all, Turn all on, Turn all off, By agent, Manage
n in magpie and Remove all, in that order with separators. The MCP
servers heading does the same with Turn all on, Turn all off, By agent
and Remove all. A busy action stays in sight on the bar (Checking…,
Grouping…, Updating…), so the wait is seen. Each menu item is the old
button: its words, its title, greyed when it was, its click; Remove
all is red as it was. No new words: ⋯ is the core's "More".

barMore builds the menu from the buttons as they are when ⋯ is
pressed, so a count or a greyed state is never stale; a hidden button
is left out and the ⋯ itself is hidden when nothing is left.

The tests that pressed these buttons on the bar (by-agent, every-skill,
github-token, library-gone-agents, library-null-agents,
library-servers-bulk, remove-all-skills, skill-fold-all,
skill-git-source, skill-handover, skill-new-in-repo, skill-regroup)
now open ⋯ and press the item. docs/subsystems/library.md says where
the buttons are.

Run (mote, through mote-run):
- node --test library-bar-more.test.cjs: 22 pass (en, zh, zh-TW, ja,
  de at 420 and 1180 px, Chromium and WebKit): nothing moved is on the
  bar, ⋯'s label, one line at 1180, the menu's items and order in each
  language, the menu inside the window, a second ⋯ closes it, Turn all
  off's sheet, Check for updates posting once, the MCP heading's menu,
  no sideways scroll.
- the 12 updated files plus library-bar-more: 176 pass before the
  usage fix below, the 22 reds all library-bar-more's (its second ⋯
  click eaten, the cause fixed in the commit before this; then the
  wide window's tabs, which are the side nav's, fixed in the test).
- skill-manual, list-sort, skill-gone, skill-update-edited, skill-how,
  library-hooks, library-pick-remove, library-row-remove,
  menu-first-second, i18n-keys, i18n-en-no-cjk: 127 pass, 1 fail, the
  "a plugin's words are its own" red that origin/main fe61503e6 has
  (#5327, #5426, #5482).
- the whole GUI suite under the suite lock: 21630 tests, 21295 pass, 335 fail in 63
  files. Those 62 files (i18n-keys apart) again at fresh origin/main
  18a9a2d88 and at this head, concurrency 6: 308 fail at main, 291
  here, in the same files, each with an open issue (umbrella #5475).
  The five red only here (account-arrange, account-mask,
  codex-subagent-model, connect-snippet-shell, ledger-swipe), each
  failing different cases each run, pass 52 of 52 run alone here.

At the pushed head (rebased on origin/main 361da10ee, which brought
77bda84a6's folder Check for updates: its condition and title kept,
the button moved under ⋯ like the rest, and skill-new-in-repo's new
folder case opens ⋯), on mote: the 17 files above plus
skill-new-in-repo, 239 pass, 1 fail, the known i18n-keys red (#5332).

Broken by hand: HEAD's client.js and library.css (the old bar) put
back, library-bar-more red in all 22 cases ("a moved button is still
on the bar", 7 !== 0).

Not tried: the real app with the user's own library; the tray panel
has no Library; keyboard order through the menu beyond the first
item's focus (openRowMenu's, unchanged).

Reported-by: ryanpascal (Discord)
2026-11-06 22:27:09 +08:00
yetone adcb69107c library: a skill set to disable-model-invocation is marked Manual only
sunset3279 on Discord asked to see which skills set
disable-model-invocation: true in their SKILL.md, the ones Claude Code
runs only when the user types /name. parseMeta reads the field into
meta.Manual; the library's rows (SkillView.Manual) and the agents' own
(FoundSkill.Manual) carry it, and the page puts a quiet "Manual only"
tag after the name, its tooltip naming /name and the field. A front
matter that doesn't parse, or a value that isn't a bool, is not known
to be manual: no tag. Translated in zh, zh-TW, ja and de.

Run (mote, through mote-run):
- go test -run 'TestSkillManualFromFrontMatter|TestSkillsFromFolder|TestFoundInLibraryFolder' ./internal/library: ok
- node --test internal/gui/tests/skill-manual.test.cjs: 22 pass, 0 fail
  (en, zh, zh-TW, ja, de at 420 and 1180 px, Chromium and WebKit)
- go test ./internal/library: ok (692s)
- go vet ./internal/library for darwin, windows and linux (nogui): ok
- node --test i18n-keys and i18n-en-no-cjk: 7 pass, 1 fail. The fail is
  "a plugin's words are its own", the same three entries on origin/main
  fe61503e6 (#5327, #5426, #5482); none is a word of this change.

Broken by hand:
- the Manual assignments in sync.go and skills.go taken out:
  TestSkillManualFromFrontMatter red ("deploy: manual false, want
  true", "crlf: …", "release: {…Manual:false…}").
- the manualTag calls in client.js taken out: all 22 GUI cases red
  (null, want 'Manual only').
- an explicit error branch in parseMeta was tried and left out: the test
  passed with and without it, since yaml.v3 decodes nothing on a syntax
  error and leaves a wrong-typed field zero.

Not tried: the real app with the user's own skills; the TUI and CLI show
no mark. A long name clips its tag in a narrow window, as every name tag
in the row does (.row .name is nowrap; #5512); the test uses short names.

Reported-by: sunset3279 (Discord)
2026-11-06 22:22:20 +08:00
yetone e1eeeed734 browser: the extension's key connects Magpie Browser and nothing else; own needs this computer; a key turned off closes its browser
483b131ef wrote a full-access gateway key ("Magpie Browser") into the
extension zip in Downloads. Anyone with a copy of the zip could use every
model, MCP server and stat, and, with own = key == OwnBrowserKey(), could
connect from another machine as this computer's own browser and receive
this computer's agents' browser calls (page data out, prompt injection
in). A keyed WebSocket also stayed open after its key was turned off.

- access: Key.Browser / Identity.Browser. A browser key is also ReadOnly
  (so a magpie from before reads it as read-only) and never issues keys.
  access-key and issuer-key refuse it. ScopeBrowser(id) holds an existing
  key to the browser with the same secret; the sharing key is never
  scoped. Current(who) says whether a key Check took is still on by the
  same secret (Identity carries the secret's SHA-256, set on the legacy
  sharing-key fallback too, so a legacy caller's identity is the same
  before and after its migration).
- gateway readOnlyGuard, the one place every route passes after the key
  is known: a browser key gets 403 gateway_key_browser_only on every
  pattern except GET /v1/magpie/browser/extension.
- own: the key must be OwnBrowserKey() and the request local(r)
  (loopback peer, not proxied, not the page port).
- browserConn keeps its key's identity. call() refuses a connection whose
  key is no longer Current, and a 5s watcher closes it (1008).
- gui browserKey: a new key is made Browser; the recorded key is reused
  only once ScopeBrowser holds it.
- GUI key row: "Browser only" tag (zh, zh-TW, ja, de), no access toggle.
  CLI prints "browser" access. agent gatewayTakes skips a browser key.

Old data: an existing "Magpie Browser" key (OwnBrowserKey) is rescoped in
place, same id and secret, when the gateway starts (ScopeOwnBrowserKey)
and again on the next extension download. Installed extensions keep
connecting with no reinstall. Every copy of an old zip loses models, MCP,
stats and writes, and from another machine it is no longer this
computer's browser. A user who downgrades reads the key as read-only.
Keys a user made themselves are untouched.

Regression, filed as #5529: Magpie in Docker with the host's Chrome
reaches the container from 172.17.0.1, not loopback, so its agents no
longer get the host's browser as their own. #5529 proposes pairing in
its place. docs/reference.md and site docker pages (en, zh, ja) say so.

Docs: docs/subsystems/gateway-routing.md (browser key), library.md
(Download), docs/reference.md (Docker), site/public/docs{,/zh,/ja}/docker.html.

Run on mote at origin/main 2000ae439 + this change:
- gofmt -l internal cmd: empty.
- go vet darwin, GOOS=windows, GOOS=linux -tags nogui over access,
  gateway, gui, agent, cli: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway
  ./internal/gui ./internal/access ./internal/library ./internal/agent
  ./internal/cli: all ok except access's
  TestLegacyLANFallbackBeforeMigration, red from this change (the legacy
  fallback had no secret sum). Fixed here, then ./internal/access in full:
  ok.
- GUI, 21 files (gateway-key-*, i18n-*, library-browser-*), chromium and
  webkit, every language: 332 of 334. The 2 reds fail the same on
  origin/main 6f5d48ea0 run alone: i18n-keys "a plugin's words are its
  own" (#5332, #5426, #5482) and gateway-key-models' 560px width check
  (#4081, commented).

Rebased onto 6f5d48ea0 (remote_prove: a new POST /v1/magpie/prove route
and edits to readonly.go and gateway.go, so not a -run rerun): gofmt -l
empty, vet on all three ok, go test -count=1 ./internal/gateway
./internal/access ok, ./internal/gui -run Browser ok. A browser key gets
403 on the prove route too (TestBrowserKeyEveryRoute walks every pattern).

Broken by hand, each red on mote:
- guard off: TestBrowserKeyEveryRoute (/v1/ 200, /v1/models read_only
  not browser_only).
- no migrate: TestBrowserKeyEveryRoute (/v1/models 200).
- own without local(r): TestOwnBrowserKeyIsThisComputers.
- no watcher: TestBrowserKeyOffClosesItsBrowser (stayed connected).
- no Current check in call(): TestBrowserKeyOffClosesItsBrowser.
- Current ignoring the secret: TestCurrent.
- gui reuse without ScopeBrowser / new key without Browser:
  TestBrowserExtensionDownload (both).

Not tried: a real Chrome with the real extension, a real Docker
container, a real old key in a live HOME, the TUI. No CLI test for the
"browser" access word. Tests reach no network (httptest, loopback only).
2026-11-06 22:11:02 +08:00
yetone 483b131ef0 browser: magpie in Docker uses the host's own browser, through a key the page hands out
noahhrreion ran magpie in a container and its Magpie Browser never
connected. The host's Chrome dials ws://127.0.0.1:3425/v1/magpie/browser/
extension, which reaches the container from the bridge (172.17.0.1). That
is not loopback, so the gateway refused it (403). The browser MCP also
refused every caller from elsewhere, and the hub marked the browser
HereOnly. The extension's folder under the container's HOME can't be
loaded by the host's browser either.

Nothing is opened to the network without a key:

- The extension takes a gateway key: its popup has a Gateway key field,
  and config.js carries KEY (extension 0.1.7). From another computer the
  extension connects only with ?key= of a gateway key that is on, and
  only from the extension's own Origin (checked first). Loopback is
  unchanged, and a page's origin, null, a keyless call or a rebound Host
  are all still refused (TestBrowserExtensionOnlyFromItsOrigin).
- A browser that connects with a key belongs to that key. Sessions are
  tagged key:<id>/... (browserOwner, keyedSession), and a remote caller's
  session is forced to its own key's whatever it names. The relay filters
  every lookup (forSession, all, choose) through browserConn.serves. The
  browser MCP admits a remote caller only with a gateway key; a web page
  is refused as before.
- The key the page makes is recorded as this magpie's own browser's: its
  id goes in settings.Dir()/browser-key, written temp-and-rename. This
  goes by where the key came from, not by its name. A browser connecting
  with it serves this computer's sessions too, so agents inside the
  container use it as they would one on loopback. A record that can't be
  read names no key, so no keyed browser is this computer's.
- Router: magpie mcp browser is HubServer.Keyed. A visitor from
  elsewhere gets it only with a key (HubVisitor.Key), and hubCall names
  its session key:<id>/..., so it reaches only that key's browser.
- GUI: a page whose browser can't reach magpie's folders (InContainer, or
  a page from another computer) is "away". The Magpie Browser sheet's
  button then reads Download the extension. It does a POST to
  /api/library/browser/extension with the page's origin, which answers a
  zip pointed at that origin (3430 passes the gateway's routes on) and
  holding the recorded key's secret. The key is made the first time and
  reused while it is on. The steps (unzip, chrome://extensions, Developer
  mode, Load unpacked) are shown in every language. It is a POST so that
  a link from another site can't mint a key.
- Docs: reference.md (Docker), subsystems/library.md and mcp-router.md,
  and site docker.html in en, zh and ja.

Run, at this tree rebased on origin/main 6302f88bf, on mote:
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., and darwin, linux and windows builds:
  clean, all ok
- go test -tags nogui -run 'Browser|Hub|OwnBrowser' ./internal/gateway/,
  and the whole of internal/library, internal/gui and internal/browserext:
  ok (gateway 2.4s, library 166s, gui 104s, browserext 0.3s)
- GUI tests library-browser-away (new: every language, Chromium and
  WebKit, 1100 and 420 wide), library-browser-setup, library-browser-ask,
  i18n-keys and i18n-en-no-cjk: 115 pass. One red, i18n-keys "a plugin's words are its own", is for three
  strings this change doesn't touch and is already filed (#5332, #5426,
  #5482)

Real use, in Docker Desktop on xiaomi-gpu (Windows 11): this tree's
Dockerfile image, run as `web --addr 0.0.0.0:3430` with 3425 and 3430
published to the host's localhost. The host's Node and Playwright Chromium:
- signed in to the page, which says away:true;
- downloaded the zip (GATEWAY "ws://localhost:3530" and a KEY), twice,
  getting the same key both times;
- a keyless /mcp/magpie/browser call from the host got 401;
- loaded the unzipped extension with --load-extension. The container's log
  says "Magpie Browser 0.1.7 connected with gateway key 12d2702a…" and
  /api/library/browser says connected:true;
- an MCP client on the host with that key listed b1 (Chrome 151), opened
  http://localhost:3531/ (served on the host) and read "hello from the
  host";
- a second gateway key made in the container got "isn't connected with
  this gateway key";
- a curl inside the container to 127.0.0.1:3425/mcp/magpie/browser with no
  key listed the host browser's tabs, the host page included.

Broken by hand, each red:
- forSession left unfiltered;
- a remote session not forced to its key;
- no Origin check on a keyed connect;
- hubCall not prefixing the session;
- Keyed given to a visitor with no key;
- the old MCP guard;
- browserKey not reusing the key;
- the away peer check removed;
- serves("") without own (TestOwnBrowserKeyIsThisComputers,
  TestOwnBrowserKeyUnreadable);
- OwnBrowserKey reading the wrong file (the gateway tests and
  TestBrowserExtensionDownload).

Not tried:
- the reporter's own setup (their compose file and Chrome);
- a real agent's MCP client calling the browser from the host. Node's
  fetch sends Sec-Fetch-Mode: cors, which fromBrowser counts as a web page
  and refuses. The e2e used node's http instead. Whether an agent's MCP
  client built on fetch is hit by this is not checked; filed as #5522.
- Edge, Brave and Firefox;
- a remote page over https/wss through a proxy.

What the user does: update magpie and publish 3425 and 3430. In the web
UI open Library -> Magpie Browser -> Download the extension, unzip it and
Load unpacked in chrome://extensions. An extension 0.1.7 already loaded
can take the address and key in its popup instead.

Reported-by: noahhrreion (Discord)
2026-11-06 20:06:15 +08:00
yetone 77bda84a6f library: a check offers the skills a git repository or folder added since
refeccd (Discord): skills added from a repository or a folder only had
the existing ones updated; ones the source added later never reached
the library. GitHub sources already had this (findNew); git repositories
on other hosts and folders on this machine did not, and a folder install
didn't even remember the folder it came from.

- git: when ls-remote gives the ref a head, findNewGit reads the fetch
  the check shares and offers skills under newBase that the library
  doesn't have and hasn't offered. Once per head while its finds are
  kept (gitLooked). The address is kept as the library has it (.git and
  all), so an Add lands on the same repo@ref key.
- folder: an install from a folder now records "folder:<path>" in
  SeenSkills (offered), which is how the library knows where to look
  again. findNewFolder reads it as Add from folder does and skips a
  folder the library links, has offered, or has a skill by that name of.
- A check never adds or writes a skill: each is offered with Add and
  Ignore, as GitHub's are. A skill the user removed or set aside isn't
  offered again, and a folder edit is never written over.
- View.CheckFolders shows Check for updates with only linked skills and
  makes checkDue true; its title says it looks in folders too. A find's
  row shows its folder (pathLink) or git address. The old head note
  ("on GitHub beside skills you have…") is gone; the new title is in all
  five languages.
- docs/subsystems/library.md says so.

Old data: a folder added before this kept no folder: key, so it is
looked in only after the user adds from that folder once more (the
picker then lists the new skills, and the install records the folder).

Run (mote, at fcc0daa23 plus this change):
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...; go build ./... and the CGO_ENABLED=0
  nogui build: ok.
- go test ./internal/library: ok. go test ./internal/gui: ok except
  TestPanelHiddenByWailsMarksPageOutOfSight (#5322) and
  TestMainWindowCorners (#3949), both red the same on origin/main
  19c45d5d4 run alone.
- GUI, both engines: every library-*, skill-*, github-token,
  plugin-check-*, plugin-git, i18n-keys, i18n-en-no-cjk, gui-de,
  gui-ja, gui-zh-tw file: 1526 of 1529. Reds: i18n-keys "a plugin's
  words are its own" (#5332, #5426, #5482, red on origin/main) and
  skill-where "the switch scrolls nothing", flaky on origin/main
  19c45d5d4 too (1, 0 and 2 reds in three runs; noted on #5154).
  skill-new-in-repo's new folder case runs en and zh at 860 and 440px.

At the pushed head (rebased on origin/main 94d4866b5), again on mote:
go vet of internal/library and internal/gui, go test ./internal/library
ok, internal/gui's Budget/Size tests ok, skill-new-in-repo 4 of 4 and
i18n-keys with only the known red above.

Broken by hand: with the git branch of CheckSkills and lookInFolders
off, TestCheckSkillsFindsNewInGitRepo and TestCheckSkillsFindsNewInFolder
fail ("new: []"); with offered() not recording the picker's shown
skills, both fail offering what the picker showed ([review], [xlsx]).

Not tried: a real GitLab or intranet repository (the test uses a local
file:// bare repo with the real git); the CLI and TUI, which don't list
new skills; the Windows and Linux boxes.

Reported-by: refeccd (Discord)
2026-11-06 19:50:40 +08:00
yetone 1ccad582d8 library: a skill the user has in ~/.agents/skills under another folder or with other files is not given a second time
math_milian (Discord #feedback, 11-06) still saw skills twice after
d487aaab7. That commit kept the library's link out of a reader's own
folder only when ~/.agents/skills held the same files under the same
folder name. Pi, Codex, Gemini, Kimi Code and the other readers of that
folder still got a second copy when the user's entry there:
- had other files (an update through `npx skills`, a local edit), or
- sat under another folder name with the same SKILL.md name (Pi goes by
  the frontmatter name; real Pi 1.4.0 warns `name "hunk-review"
  collision` for both cases with magpie's link beside it, and loads the
  user's alone with no diagnostics once the link is gone).

readSharedOwn/sharedOwn.rival now finds the user's entry by folder
name or SKILL.md name. A same-tree one counts as the library's (as
before). A differing one gets no second copy: it raises the Own problem
("{agent} already has a skill of its own called X"), whose Use the
library's sets the shared entry aside with the backups and gives the
link, and whose Keep {agent}'s unticks it. Agents that don't read the
folder (Claude Code) keep their link. Old users' second links go on
the next sync (the GUI syncs at start), through the existing unlink.

TestKimiSweepLeavesTheUsersOwnSharedSkills and TestSkillsWhereShared
assumed a differing same-name user skill gave the library's again;
they now expect the Own problem and no second link.

Run (mote, at this tree on cd9c52c16):
- go test -tags nogui -count=1 ./internal/library ./internal/cli
  ./internal/gui: ok
- GOOS=linux/windows go vet -tags nogui ./internal/library, go vet: ok;
  gofmt -l clean
- win-run: TestSharedCopy*, TestSharedOwn*, TestSkillsWhereShared,
  TestKimiSweep*: ok
- probe in a sandbox HOME, skill ticked for claude, codex, pi, gemini,
  opencode: same tree / other files / other folder name / shared link
  elsewhere; before, the last-but-one two gave pi, codex, gemini a
  second entry; after, none (OpenCode merges ~/.claude/skills with
  ~/.agents/skills by id, so it never shows two)
- real Pi 1.4.0 loader on mote for the two cases, before and after

Broken by hand:
- rival matching same-tree only: TestSharedCopyNotGivenTwice and
  TestSharedOwnSettled red
- readSharedOwn keyed by folder name only: TestSharedCopyOtherFolderName
  red (.pi, .codex, .gemini still have a second one)

Not tried: the reporter's own tree (asked for), the real GUI's Use/Keep
buttons on this problem, WSL/Linux runs, a Pi or omp of unknown version
(still given its own, in docs' Not covered).

Reported-by: math_milian
2026-11-06 15:04:01 +08:00
yetone 9e3a389e0b library: a skill whose app left its own link on a deleted version follows the version on disk
tjhhhh_84378 on Discord (11-06): ego lite updated from 0.6.2.5 to 0.6.2.7,
deleted Versions/0.6.2.5, and left its own ~/.local/share/ego/
active_version_dir naming it. The library's ego-browser, brought in since
dccfefdf7 (#2635), links to ego's ~/.local/share/ego/ego-skills ->
active_version_dir/Resources/ego-skills/ego-browser, so the whole chain led
nowhere and the skill was lost, while 0.6.2.7 had it complete.

Who owns which link: ~/.local/share/ego/ego-skills, active_version_dir and
the framework's Versions/* are ego's; magpie only reads them. magpie writes
the library's own link (library/skills/ego-browser) and the agents' links
to it. The stale pointer is ego's, but magpie lost the skill with a newer
version on disk.

557f51dbf mended a library link that points straight into Versions/<old>,
but movedVersion looked only at the link's own target: for ego-skills the
first missing part is not a version name, so nothing was found.

followMovedSkills (skill_moved.go) now, for a dangling library link whose
target isn't in a version folder, follows the links on the way as far as
they are there (linkedEnd) and asks movedVersion of where they end:
Current/current/latest when that leads to the skill, else the highest
version beside the deleted one with a SKILL.md there. The library links to
that folder, and keeps the app's steady link as the new Source.Via. Once
the steady link leads to a SKILL.md again (ego or the user mended it), the
library links through it once more and Via is cleared. ego's links are
never written. With no other version on disk the link is kept as it was
and the skill is shown missing, as before.

Old imports: a skill linked straight into Versions/<old> was already
mended by 557f51dbf; one linked through ego's link (since dccfefdf7) is
mended by this on the next read of the Library page or the next sync. No
re-import needed. Agents that read ~/.agents/skills directly still see
ego's own entry there, which is the user's/ego's and is left alone.

Tests (skill_moved_test.go), the reporter's layout: egoLite at 0.6.2.5,
brought in through ~/.agents/skills/ego-browser -> ego-skills, then 0.6.2.7
added, 0.6.2.5 deleted, active_version_dir and Versions/Current left on
0.6.2.5:
- TestSteadyLinkLeftOnDeletedVersion: Read shows it not missing, it reads
  as 0.6.2.7's, active_version_dir is unchanged, Via is ego-skills; after
  active_version_dir is pointed at 0.6.2.7, a Sync links through ego-skills
  again with no Via.
- TestSteadyLinkLeftOnDeletedVersionNoOther: no other version, shown
  missing, link left as it was.

Broken by hand:
- linkedEnd step turned off: TestSteadyLinkLeftOnDeletedVersion red
  (Missing:true), i.e. red on the old code.
- the go-back-to-Via case turned off: red, still linked to 0.6.2.7.

Run (mote via mote-run): gofmt -l clean; go vet -tags nogui
./internal/library for darwin, GOOS=linux and GOOS=windows clean; go test
-tags nogui -count=1 ./internal/library ok (91s). Windows box (win-run):
SteadyLink, OldImport and ImportedSkill tests pass (junctions). Full suite
after the push, recorded on the tag's follow-up.

Not tried: the reporter's machine or a real ego lite update; the layout is
the #2635 fixture with the paths from their message. Whether ego's
Versions/Current also stayed on 0.6.2.5 isn't known; both are covered.

Reported-by: tjhhhh_84378
2026-11-06 12:13:16 +08:00
yetone d487aaab79 library: no second copy of a skill the user keeps in ~/.agents/skills
math_milian: a skill given to every agent was in ~/.agents/skills and
in ~/.pi/agent/skills, and Pi warned
  "hunk-review" collision: ~/.agents/skills/hunk-review (skipped)
Pi 1.4.0 reads ~/.pi/agent/skills, then ~/.agents/skills
(userAgentsSkillsDir in dist/core/package-manager.js), and drops a
skill read twice only when both paths are one file (realPathSet in
dist/core/skills.js). magpie already left out its own link for an
agent that reads the shared folder when the entry there was the
library's folder, magpie's link, or a holder's (Goose, Kimi Code). It
did not when the entry was the user's own copy of the same files
(another installer's, or copied by hand), so Pi, Codex, Gemini CLI,
OpenCode and the other readers each got a second tree beside it.

inShared now also counts such a copy (sharedCopy: not ours, not the
library's own folder, sameTree with the library's). The reader gets
nothing in its own folder, and the existing unlink loop takes out
magpie's link or marked copy there on the next sync, which only ever
touches entries ours() proves magpie made. The user's copy is never
touched; once it differs from the library's, the library's is given
again. Readers checked in their own code: Pi 1.4.0's loader, Codex
0.165.0's binary (user-agent-skills, .agents/skills), Gemini CLI
0.35.3's bundle (Storage.getUserAgentSkillsDir) and OpenCode 2.0.25's
binary (home/.agents). Amp isn't a skills target of magpie's.

Run:
- mote-run go test -count=1 ./internal/library ./internal/gui
  ./internal/cli: library and cli ok; gui red only on
  TestMainWindowCorners/macOS_26_SDK, #3949 (mote is macOS 27). go vet internal/library (darwin, GOOS=linux
  -tags nogui, GOOS=windows): ok. gofmt -l: clean.
- Real Pi 1.4.0's own loader (DefaultResourceLoader) in a sandbox HOME,
  cwd outside the home: a link in ~/.pi/agent/skills to the library's
  folder beside the user's copy in ~/.agents/skills gives
  'name "hunk-review" collision'; with the link gone (what the sync now
  does) the skill loads from ~/.agents/skills and no diagnostic.
Broken by hand: sharedCopy's return replaced with false,
TestSharedCopyNotGivenTwice red (link and copy: pi's and codex's
second entry stays).
Not tried: the magpie GUI against the reporter's real tree (their
layout is inferred from the warning); a library skill that is itself
a link to the agent's own folder beside such a copy keeps both (that
folder is the library's); a Pi or omp of unknown version is given its
own as before; Windows and WSL not run.

Reported-by: math_milian
2026-11-06 11:18:51 +08:00
yetone 6ddfc15843 library: an MCP command's $HOME, ${NAME} and ~ work in every agent (math_milian)
A Library server whose command is $HOME/bin/x (one value for a Mac's
/Users and Linux's /home) reached each agent as written. Claude Code
spawns '$HOME/bin/x' (it expands only ${NAME}), Codex and the rest
spawn it with no shell, and magpie's own check, router and Codex run
did the same.

library.json keeps what the user wrote. withCmdVars (cmdvars.go) makes
the copy an agent is written, in sync after runVia and in a project's
files:
- an agent that expands a reference in command and args itself
  (Claude Code, CodeBuddy, WorkBuddy, Grok, Gemini, omp/Qoder/AtomCode,
  OpenCode as {env:NAME}, Cursor as ${env:NAME}) gets the reference in
  its syntax, $NAME written ${NAME}, so it is read from the agent's own
  environment and a token in an arg stays out of its file;
- every other agent (Droid, which shares Claude Code's format, by the
  new NoCmdRefs; Codex, Kiro, Crush, Copilot, Goose, Pi, Hermes, dsh,
  Command Code, LiveAgent and those reading none) gets the values: HOME
  is its own home, the rest from magpie's environment or a terminal's;
  in WSL the distro's home and no variable of magpie's;
- a leading ~ is put in for all of them; a variable nothing has is
  left as written.
Sync compares against that copy, so a second sync rewrites nothing.
magpie starting the command itself (startServer for the check and the
router, a distro's HOME asked of its login shell; specOf for Codex on
magpie) puts the same values in (launchCmd). Env and headers keep
their ${NAME} handling (envref.go) as before.

Run:
- mote: go vet ./internal/library for darwin, linux and windows;
  gofmt -l clean; go test ./internal/library ./internal/gui: every test
  but TestRunServerAsks (once, then 10/10 alone; filed #5433, my change
  leaves a command without $ or ~ as it is) and TestMainWindowCorners
  (macOS 27 on mote, #3949).
- wsl-run and win-run: TestCmdVars*, TestEnvRefs*, TestCheckStdio ok.
- Real Claude Code 2.1.316 in a sandbox HOME/CLAUDE_CONFIG_DIR, claude
  mcp list: "${HOME}/bin/srv" Connected, "$HOME/bin/srv" ENOENT
  posix_spawn '$HOME/bin/srv', the reporter's failure and why $NAME is
  written ${NAME} for it.

Broken by hand: with the sync, specOf and startServer wiring taken out,
TestCmdVarsSync (claude and codex files) and TestCmdVarsLaunch ($VAR,
~ and the spec) are red.

Not tried: the reporter's own agent and server; a real Codex, Cursor,
OpenCode, Gemini or Droid starting the written entry (their expansion
is as envref.go's cited sources say); a real WSL distro (distroHome is
unit-free, the WSL target is tested with a set Home); npxDirect on a
command spelled with a variable (it still sees the written value).
2026-11-06 10:20:34 +08:00
ggbdpqandIkki c6d2bd3316 library: ZCode reads the shared skills folder too (#4987)
ZCode reads ~/.agents/skills beside its own ~/.zcode/skills, but it
wasn't among the readers of the shared folder: a skill kept there
behaved as if ZCode didn't have it — its chip unlocked, a tick writing
a second link into its own folder. It reads it as the others do.

Generated-by: GLM-5.3-Flash (ZCode)

Reviewed and ported: docs/subsystems/library.md now lists ZCode among the
readers of ~/.agents/skills, as Ikki6666's own branch (a23828e81) had it;
the reporter checked the published ZCode builds for a version boundary
and found none (#4987).

Run on mote (darwin arm64, Go 1.26.8): go test -tags nogui -count=1
./internal/library/ ok 76.5s; -run 'ZCode|Shared|Always' ok.
Broken by hand: "zcode" taken out of readsShared, test kept:
TestSharedSkillReachesZCode FAIL "zcode has a second link to it in its
own folder" and "zcode's own folder got it on the sync too".
Not tried: a real ZCode install reading the skill.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
Co-authored-by: Ikki <824310075@qq.com>
2026-11-06 05:41:29 +08:00
yetone c24915f04e library: LiveAgent in the MCP and Skills pickers (zero2sin)
LiveAgent was missing from the Library's MCP and Skill agent pickers
(zero2sin on Discord #feedback). It is now a target, written in its own
engine's formats, read from K-brain 507f560 (the one LiveAgent af89ea7
pins), not guessed:

- MCP: <data dir>/config.json.live-mcp.json (cmd/kn/backend.go,
  internal/mcp/live.go LiveSettings): {"servers":[{"id","enabled",
  "transport":"stdio"|"http","command","args","env" | "url","headers",
  ...}],"selected":[...]}. Streamable HTTP only, so SSE is refused.
  ${NAME} in env and headers resolves as K-brain's secret refs
  (internal/config/secret.go). The user's servers and their
  description/enabled/cwd/timeoutMs/policy/auth/... are kept; untouched
  servers are written back byte for byte (json.RawMessage). A non-empty
  selected gets magpie's server added (or it would have no tools) and
  taken out on remove, never the last one. With no file yet, K-brain
  reads config.json's "mcp" object (settingsFromConfigs), so the first
  write carries those servers over the way K-brain's own first save
  does. A new file is 0600 like K-brain's. A file K-brain itself could
  not parse is not written over.
- Skills: <data dir>/skills, as copies (Target.Copy): K-brain refuses a
  link in a skill's path (safePath) and ScanDetailed walks past one. A
  skill there loads only when picked in skills-settings.json
  global.selected (Manager.Effective), so syncLiveAgentPicks picks each
  copy magpie makes once (Applied.Picked), never again after the user
  unpicks it, and unpicks it when the copy goes. Names K-brain refuses
  (validManagedName) are never put in selected, since its next save
  would fail on them. Its built-in skills-creator/skills-installer are
  not offered for import.
- Not added: instructions (K-brain's brain.md is its own memory file).
  A server written while LiveAgent runs is seen at its next start (the
  app holds the list in memory and saves it whole).

Run (mote-run, at base 326e72f4c):
- go test -run LiveAgent ./internal/library/: 7 tests ok
- go test ./internal/library/... ./internal/agent/ ./internal/gui/:
  library ok, agent ok, gui FAIL only TestMainWindowCorners/macOS_26_SDK
  (#3949, macOS 27 on mote, no library code)
- GOOS=linux and GOOS=windows go vet ./internal/library/: clean;
  gofmt -l: clean
- node --test of 100 GUI files (library-*, *skill*, *mcp*, i18n-keys)
  in chromium and webkit: 1941 of 1946 pass. Red: i18n-keys "a plugin's
  words are its own" (two Go test files elsewhere say a plugin's word)
  and found-skill-pick-remove "en at 420px" in both engines; this change
  touches no GUI file.
- Rebased on origin/main 125fd93ec and run again there:
  go test ./internal/library/ ok; found-skill-pick-remove and i18n-keys
  red the same (en at 420px both engines; "a plugin's words are its
  own"), and red the same on a clean origin/main 125fd93ec worktree:
  filed as #5013 and #5327/#5332.

Broken by hand, each red: Copy=false (TestLiveAgentTarget,
TestLiveAgentSkills: a link); no syncLiveAgentPicks call (nothing
picked); re-picking every sync (TestLiveAgentSkills: xlsx picked again
after the user unpicked it); no built-in skip (found lists
skills-creator); no selected append (TestLiveAgentMCP); no config.json
seeding (TestLiveAgentMCPFromConfig); no chmod (0644); no name check
(TestLiveAgentSkillsNewSettings: My_Skill picked).

Not tried: a real LiveAgent app reading the written files (no LiveAgent
on mote or here); Windows and Linux test runs (vet only).
2026-11-06 00:26:59 +08:00
yetone 47d5839397 library: sync and backup files carry the hooks
VincentChan on Discord (v0.1.3005) said part of the Library doesn't reach
his other computer through sync. Checked kind by kind what the library part
of a bundle carries: instructions (each set's text, a linked set's file text,
the agents ticked, each agent's own addition), MCP servers, skills and
subagents all go. Hooks didn't: library.Bundle had no field for them, so a
hook made on one computer never reached the other, by WebDAV/S3/GitHub sync
or a backup file.

- library.Bundle.Hooks (*[]*Hook): name, description, event, matcher,
  command, timeout, agents ticked. Collect always sets it, empty too.
  Applied.Hooks (the entries magpie wrote into each agent here) stays out:
  each computer writes them on the sync Put runs, beside the user's own
  hooks, and records its own entries, so an entry the user edited there
  stays theirs.
- Put replaces the hooks with the bundle's, so one taken out on one
  computer goes from the others. A nil list (a bundle from a magpie before
  this) keeps this computer's.
- check refuses a hook with no name, no command, or named twice. The event
  and agents are carried as they come: an event a newer magpie knows is a
  problem on the agent here, not a refused library.
- davsync: an empty list hashes as before the field, so upgrading with no
  hooks syncs nothing.
- The CLI's backup line counts hooks; the GUI's sync/export/import ticks
  say "instructions, MCP servers, skills, hooks and subagents" in every
  language.
- library.md and sync-backup.md updated, and they now name what stays
  this computer's own: projects, skill groups, CopySkills/SkillHow,
  SharedSkills, MCPHub.

Instructions: two sandbox computers through the fake DAV server carried a
named set and a change to it, a set linked to ~/.agents/AGENTS.md and a
hand edit of that file, both computers having their own text first, an
agent's own addition, and an agent installed after the first sync. All
reached the second computer's CLAUDE.md/AGENTS.md (exploration tests, not
kept). So no instructions change here; what VincentChan saw is not
reproduced yet.

Run (worktree at 0e55a7593; origin/main bf60ea596's two commits touch
none of these files):
- mote: go test -tags nogui ./internal/backup ./internal/davsync
  ./internal/cli ./internal/library ok; go vet -tags nogui for darwin,
  GOOS=linux and GOOS=windows on the four packages ok; gofmt -l clean;
  go test ./internal/gui -run 'TestCoreScriptBudget|Words|I18n|Builtins' ok
- GUI (wsl-run, Linux): i18n-keys, github-sync, s3-sync, sync-*,
  webdav-settings-refresh, library-backups-top, gui-de, gui-ja, gui-zh-tw:
  187/187

Broken by hand: with Collect not setting Hooks, Put ignoring them and the
hash not dropping an empty list (the old code), TestCarryHooks,
TestCarryOldBundleKeepsHooks, TestCarryNewerHooks,
TestBackupFileCarriesHooks, TestSyncHooks and TestNoHooksHashAsBefore
went red.

Not tried: a real WebDAV/S3/GitHub remote between two real computers;
Windows and Linux runs of the Go packages.
2026-11-05 11:29:20 +08:00
yetone 7564e46690 library: a subagent names its model, written into Codex's role as model (#4421)
luckymanjc (Discord) set Codex's subagent model to Default on the Agents
page and gave a Library subagent a prompt that named a routing group.
Codex knew the group's name, but the subagent ran on Codex's own model.
A Library subagent had no model field, and Codex's role file
($CODEX_HOME/agents/<name>.toml) got only name, description and
developer_instructions. So Codex started the subagent on the model the
lead passed in spawn_agent, or on the lead's own model. The group was
only text in the prompt.

codex-rs reads a role file's model (AgentRoleOverrides). In
child_config.rs, prepare_agent_spawn_config applies the lead's
spawn_agent model, or [agents] default_subagent_model, first, and then
the role. So the role's model wins. A subagent now has a Model field: an
app menu with "Picked by the agent", the models and routing groups Codex
lists (groups noted as a routing group), and a saved id Codex no longer
lists. The Model is written as model = "..." to Codex's role only. A
subagent without a Model is written as before, byte for byte. Other
agents' files don't change; the hint names the agents that don't take
it. When the Agents page's Codex subagent model is set, the gateway still
puts that in place of the role's model (codexSubagentPick), and the hint
says so.

Run:
- Real codex 0.165.0 on mote, sandbox CODEX_HOME, fake Responses
  server. With no role model, the collab_spawn request carried the
  lead's model. With model = "group/review" in the role, it carried
  group/review, also when the lead named gpt-6-sol in spawn_agent.
- mote-run go test ./internal/library: ok. TestSubagentModelGoesToCodex
  went red with codexRole given "" for the model by hand.
- GUI library-subagents.test.cjs: 12/12 in Chromium and WebKit, in en,
  zh, zh-TW, ja and de. Red with origin/main's client.js (timed out
  waiting for the model picker).
- i18n-keys 4/4: it was red at first, because the plugin defined
  "Routing group" and "Find a model". The change now uses core's
  "routing group" and "Find a model…".
- gui-zh-tw, gui-ja, gui-de, library-all, library-gone-agents,
  library-wsl-asleep: ok.
- gofmt -l is clean. go vet, GOOS=windows go vet, and GOOS=linux go vet
  -tags nogui on internal/library and internal/gui: ok.
- go test ./internal/gui: only TestMainWindowCorners/macOS_26_SDK is
  red. It is red alone on origin/main 93d5c76c0 too: #3949.

Not tried: a real magpie gateway with a real routing group end to end,
the Codex app or IDE extension, and Windows and Linux runs. A
reasoning effort per subagent, and a model for Claude Code, OpenCode,
Droid and the other agents, stay open in #4421.
2026-11-04 21:18:56 +08:00
yetone 5957223d89 library: a project's skills can be given to DeepSeek Harness, in the project's .agents/skills
xingchen_c on Discord (#general, 11-04): "资源库按照项目配置能否支持一下dsh".
projectSkillsDirs left dsh out, its comment saying it reads no project
folder magpie can rely on. It does, and always has: the skill provider
every dsh profile mounts (dsh-base's cordis.patch.yml, id skill-filesystem)
scans <projectRoot>/.dsh/skills (rank 100) and <projectRoot>/.agents/skills
(rank 200), the project root being the nearest folder up from the
session's cwd with a .git, else the cwd (roots and findProjectRoot in
@deepseek-ai/dsh-skill-filesystem 0.2.1-rc.5; the same two joins in
0.0.1-rc.3, 0.1.0-rc.6, 0.1.5-rc.3, 0.1.7-rc.2, 0.2.0-rc.2, 0.2.1-rc.1
and 0.2.2-alpha.3). dsh now gets the shared .agents/skills, so the
project row lists it and one link serves it with Codex and the rest.

MCP stays as it was: dsh's servers are dsh-mcp-client rows in a
profile's patch layers (bundles, the profile's and $DSH_HOME's
cordis.patch.yml, --patch overlays; composeProfile in @deepseek-ai/dsh
0.2.1-rc.5), none of them the project's. Said in project_mcp.go and
docs/subsystems/library.md.

Run:
- mote: go test -count=1 ./internal/library/ ok (102.9s); gofmt -l
  clean; GOOS=windows and GOOS=linux go vet ./internal/library/ ok.
- Broken by hand: TestProjectSkillsDsh with projects.go at origin/main
  fails ("magpie knows of no folder dsh reads a project's skills from").
- Real dsh: @deepseek-ai/dsh 0.2.1-rc.5 from npm on mote, sandbox HOME
  and DSH_HOME, headless profile against a fake OpenAI-compatible server.
  Run in a folder with .git, a skill linked into its .agents/skills is in
  the request's <available_skills>; run in a folder with no .git, its own
  .agents/skills is read; run in a subfolder of the repository, only the
  root's is read, not the subfolder's (filed as #5172).
- GUI: /api/library's view from library.Read with a sandbox ~/.dsh,
  served to the real assets in Chromium and WebKit, en and zh: the
  project card's skill rows have a dsh chip (lit where given), and the
  "reads no project skills folder" line no longer names it.

Not tried: the dsh Desktop app (its own profile; the same base bundle
is assumed, not checked); the full GUI suite (no GUI file changed);
Windows copy mode with a real dsh.
2026-11-04 13:53:04 +08:00
yetone 50265256ba library: a note on a skill or an MCP server, the library's own (youyo.p_10001)
youyo.p_10001 on Discord: with many skills and MCP servers installed,
you can't tell what each is for or which to use. A skill has the
description its author wrote for models, often in English and about
what it does, not why you installed it. An MCP server has nothing but
its command and its tool list. So each now takes a note in the user's
own words.

- Server.Note and Skill.Note in library.json: one line of at most 200
  characters, whitespace run together (checkNote), as a hook's
  description (#2011). A longer one is turned away, not cut.
- The server editor has a Note field under the name. A skill's reader
  (2a19043af's file reader) has one over its files: Save shows once it
  changes, saves the file being edited with it, and a changed note is
  asked about before the dialog closes. SkillNote, POST skills/note.
- A row shows the note in place of its command or description, so rows
  keep their height; the tooltip gives the note, then that line. The
  skills' filter matches notes.
- No agent is given a note: not in any agent's MCP entry, a project's
  file, the MCP router's list or a skill's copied SKILL.md.
- A sync carries it (CarriedSkill.Note; a server goes whole), and
  clearing it is carried too. An older magpie on another computer
  doesn't know notes: a bundle it writes has none, so a sync from it
  clears them. The TUI's server editor keeps a note as it was.

Run at the pushed head:
Run at the pushed head (on origin/main f168dd278, then
rebased onto 94d0fbfcd, whose two commits change only
migrate_zcode.go and the searcher-pick test):
- mote: go test -timeout 45m internal/library (TestNoteNeverGiven,
  TestNoteCarried, TestNoteTooLong), gui, tui, davsync, backup: ok,
  except internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's SDK
  (#3949). GOOS=windows go vet of library, gui, tui and GOOS=linux of
  library, tui: clean. gofmt -l: clean.
- mote, both engines, every language, narrow and wide: skill-edit (the
  skill reader's note), library-mcp-json (the server's note, its row and
  the filter), mcp-editor-cancel, library-mcp-win-line, market-address,
  market-have, i18n-keys: 108 of 108.
- WSL, the whole GUI suite: no red in a library file that origin/main
  hasn't too (see the command commit; #4120, #4471 for the rest).
- "Note" is in core i18n.js, not the plugin's: agent code says it as a
  word. The rebase had dropped main's title on a server row's command
  line (library-mcp-win-line went red); it is back, and with a note the
  tooltip gives the note, then that line.

Broken by hand, each red, then restored:
- add("note", s.Note) in Claude's MCP format: TestNoteNeverGiven
  (.claude.json held the note).
- the carry of Note left out: TestNoteCarried.
- note left out of the server editor's save: the GUI test, 22 of 22.
- notes left out of the skills' filter text: the GUI test, 22 of 22.
- the note's save left out of the skill reader's Save: skill-edit, 22
  of 22 (Save never goes away).
- the note left out of the reader's unsaved check: skill-edit, 22 of 22
  (closing never asks).

Not tried: a real sync between two computers, a real agent reading its
config (the guard reads every file magpie writes in a sandbox HOME), a
real app window, Linux WebKitGTK.
2026-11-03 21:43:54 +08:00
yetone a80575cc86 library: an MCP server's command wraps, and the editor shows the server as JSON (hema_17384)
hema_17384 on Discord: in Library > MCP servers, the editor's Command
field was one line, so `npx -y universal-db-mcp --type sqlserver --host
... --user sa --password ... --database ...` was cut off, and they asked
to see and edit the server as JSON.

- The command is a box that wraps (lineBox, a textarea of one row that
  grows with autosize). It is still one line: Enter saves, Escape
  closes, and a newline is a space between words (a shell's \ before it
  too, except on Windows, whose lines keep their backslashes). At 390
  wide it wraps over several rows; nothing scrolls sideways.
- The editor's head has a Form | JSON switch (the app's segmented
  control, not a <select>). JSON is the server as Copy config gives it
  for Claude Code: {"mcpServers": {name: {type, command, args, env}}},
  or {type, url, headers} for a URL, with ${NAME} references as written.
  An edit there is read as a paste is (serversIn) and becomes the form's
  at once. JSON that isn't one server's marks the box invalid, says so,
  and keeps the dialog from saving or going back to the form, and
  counts as unsaved for Cancel. The agents, sync and the startup
  timeout and OAuth app stay in the form and are kept as they were.
  ⌘/Ctrl-Enter saves from the box; a paste into it is the box's, not
  the dialog's "paste a README's JSON".
- Strings in en, zh, zh-TW, ja and de.

Run at the pushed head (on top of the note commit, which shares these
files):
Run at the pushed head (on origin/main f168dd278, then
rebased onto 94d0fbfcd, whose two commits change only
migrate_zcode.go and the searcher-pick test, with the note commit
on top, which shares these files):
- mote: go test -timeout 45m internal/library, gui, tui, davsync, backup:
  ok, except internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's
  SDK (#3949). GOOS=windows go vet of library, gui, tui and GOOS=linux of
  library, tui: clean (internal/gui's Linux vet needs gtk3 and ran clean
  on WSL before the rebase, with no Go change since). gofmt -l: clean.
- mote, both engines, en/zh/zh-TW/ja/de, 390 to 1100 wide:
  library-mcp-json (new), mcp-editor-cancel, library-mcp-win-line,
  market-address, market-have, skill-edit, i18n-keys: 108 of 108.
- WSL, the whole GUI suite (before this rebase, at the same change):
  541 subtests red in 57 tests, the WSL baseline (#4120, #4471). Those
  in library files are red on origin/main too, run side by side:
  found-skill-pick-remove (#5013, #4097), library-mcp-hub (#4483),
  market-more (#5076), library-chip-fan (#3072), library-mcp-tools ja
  420 (#4693). market-address and market-have were mine: they still
  looked for the command's <input>; they find textarea.lib-cmd now and
  pass 32 of 32 on WSL.
- "Form" is in core i18n.js, not the plugin's: agent code says it as a
  word, which i18n-keys turns away in a plugin.

Broken by hand, each red, then restored:
- .lib-cmd back to white-space: pre: "the command scrolls sideways".
- the command field back to an <input>: the new test and
  library-mcp-win-line fail (28 of 28).
- save without the JSON check: the "isn't an MCP server's JSON" error
  never shows and the broken JSON goes to save.
- (wrap="off" on the textarea alone stays green: the CSS's pre-wrap
  wins, so the CSS is the guard.)

Not tried: a real magpie app window (the GUI tests fake the API), the
reporter's real server, Linux WebKitGTK.
2026-11-03 21:43:54 +08:00
yetone 22f5cf69e5 library: an agent in WSL links to the distro's one copy of a skill (cutemmuu on X)
Cause: an agent in a WSL distro could only get copies (Target.Copy).
A distro can't follow a link to the library's folder on Windows. A
link Windows makes through \\wsl.localhost (os.Symlink) is an empty
folder inside the distro. Windows can't use a link the distro has: it
can Lstat one (irregular), but Readlink fails ("Incorrect function"),
and Stat, ReadDir and Remove all say it isn't there. Probed on
xiaomi-gpu with magpie-desktop. So every agent there got a copy of
its own of every skill.

Now each distro keeps one copy of each skill its agents are given,
magpie's and marked, in ~/.local/share/magpie/skills (Target.Store,
storeSkill). Each agent there gets a link to it, which wsl.exe makes,
reads and removes inside the distro (agent.WSLSymlink, WSLReadlink,
WSLRemoveLink). The scripts refuse to put a link over a folder or file.
- An edit made through the link is in that copy, and takeEdits reads
  it like any copy of magpie's.
- When no agent there links to a copy or is given its skill any more,
  sweepWSLStores removes it. An edited copy goes to the backups.
- A folder in the store that isn't magpie's is never touched. Each
  agent it blocks reports a problem and keeps what it had.
- An agent set to copies (SkillHow) still gets copies of its own.
- So does one whose skills folder or the store is on a Windows drive
  (#4502): a link the distro makes there can't be read from Windows.
- The copy isn't put in the distro's ~/.agents/skills. Every agent
  there that reads that folder would get each skill, ticked or not.
- A stopped distro's agents are now shown as linked (HowLink), not as
  forced to copies.

Agents that read ~/.agents/skills on their own (readsShared, checked
against each one's source or docs when the list was made): Codex,
Gemini CLI, OpenCode, DevEco Code, Crush, dsh, Command Code, Devin,
Droid, Cline, Grok Build, Grok App, fx, Alma, Kimi Code and OmO, plus
Pi from 0.54.0 and omp from 11.0.0. Claude Code doesn't. Ticks are per
agent, so the store keeps per-agent choices working in WSL.

Existing users: nothing to do. On the next sync, each per-agent copy
magpie made in a distro is replaced by a link:
- its edit is taken into the library first (newest edit wins);
- a copy whose edit lost is set aside with the backups (wslRelink);
- unmarked folders (the user's own skills) are left alone.

Run:
- mote, at 3f1f1882a plus this change:
  - go test ./internal/library ./internal/agent -timeout 45m -count=1:
    both ok (493 and 1210 Test funcs; library 184s, agent 312s).
  - gofmt -l .: empty.
  - GOOS=windows, linux and darwin go vet of both packages: ok.
- xiaomi-gpu, Windows 11, WSL 2, distro magpie-desktop only:
  - TestWSLLinksLive passes. A link made through wsl.exe is followed by
    the distro, read back from Windows, refused over a folder and
    removed alone.
  - TestWSLSkillsLinkedLive passes. Working in a /tmp home inside the
    distro, it checks:
    - links for Codex and Claude Code that the distro follows;
    - a second sync changes nothing;
    - an edit made in WSL through the link reaches the library and
      Windows' Claude Code;
    - copies, then links again;
    - an untick removes the links and the store copy.
  - go test ./internal/library ./internal/agent -run 'WSL|Wsl|Skill'
    with MAGPIE_WSL_TEST_DISTRO set: library ok. In agent, only the
    older TestWSLCodexLive is red. It calls wslList() without -l -q, so
    it lists no distros. Filed as #5077; this change doesn't touch it.
New tests:
- TestWSLLinks (fake);
- TestWSLOldCopiesBecomeLinks, which edits a copy and then syncs;
- TestWSLEditThroughLinkReachesTheLibrary;
- TestWSLStoreSweepKeepsEdits;
- the two live tests above.
TestWSLSkillsCopied is now TestWSLSkillsLinked.

Broken by hand (logs in wsl-skills-scratch):
- WSL targets given copies again: 7 red, including TestWSLTargets,
  TestWSLSkillsLinked and TestWSLOldCopiesBecomeLinks.
- takeEdits not following the link to the store: 1 red,
  TestWSLEditThroughLinkReachesTheLibrary.
- ours not counting a link to the store: 3 red.
- wslLinkScript's folder refusal dropped: TestWSLLinksLive red on the
  real distro.

Not tried:
- the magpie GUI on Windows against a real distro, and agents running
  in a real WSL reading a skill through the link (the distro reads the
  link's files, checked with cat);
- WSL 1;
- a distro whose home is on a Windows drive (covered by the fake
  #4502 tests only);
- the GUI suite, since no GUI file changed.
2026-11-03 20:03:00 +08:00
yetone 00098f12bf library: Magpie Browser's "which agents may use it" is a line of its own under its row
tao0194 on Discord (v0.1.2828, zh, panel-width window): in Library > MCP
servers the magpie-browser row showed the connected ask (green dot, the
question, a button per agent) inside the name's column, wrapped into a
narrow strip between the command and the row's Scope and agent chips,
three lines tall beside every other server's two.

browserAsk's element was appended to the row's .who. It is now the row's
own child: the row gets lib-asking while it shows, wraps, and the ask
takes a line under the name, command and chips, from the name's left
edge (the picture plus the row's gap, 37px, 38px in the window's rows)
to the row's right edge. The first line keeps the name, command and
chips as the other rows have them (.who flex-basis 0 above 560px). At
560px and under, where rows already wrap, a long command now ellipsizes
beside the row's picture instead of taking the name to a line of its
own under it; that was so for any server with a long command, and the
ask's left edge follows the name. docs/subsystems/library.md says where
the ask sits.

library-browser-ask.test.cjs now has three agents (Codex, Zed among
them) and a context7 row beside it, runs at 1100, 600, the panel's 440
and 360, and checks the ask starts under the first line, at the name's
left edge, reaches the chips' right edge, that the first line is as
tall as another server's, and that the name sits beside the picture.

Run (mote, Playwright 1.62.0, Chromium and WebKit, en/zh/zh-TW/ja/de):
- library-browser-ask.test.cjs on the old client.js/library.css: 42 of
  44 red (every layout subtest; the two not-connected/given ones pass).
  With the change: 44 of 44 green.
- The 84 GUI files that open the Library, name lib-row/lib-server or
  library.css, or check budgets and i18n keys: 1480 of 1480 ok, before
  the rebase onto c3593dc49 (no upstream change touches these files);
  library-browser-ask, i18n-keys and builtins again after it: 52 of 52
  ok. go test ./internal/gui at the rebased head: TestMainWindowCorners
  red only (an AppKit window test, the same on origin/main 78cd4e6dd,
  #3949); everything else ok.
Not tried: the real app's panel (WKWebView) with a connected extension;
the full GUI suite.
2026-11-03 18:21:58 +08:00
yetone 2a19043afc library: a skill's files are read as Markdown and edited in the page (refeccd)
refeccd on Discord kept skills in ~/.agents/skills, handed them over to
magpie ("let magpie manage"), and then had nowhere to edit them: the
Library's skill view showed SKILL.md as raw text with no way to change
it. There never was an edit path; this adds one.

- GET /api/library/skill takes `file` and answers library.ReadSkillFile:
  the file (SKILL.md by default), its text, the skill's folder and its
  text files (UTF-8, no NUL, up to 1 MB each, 200 listed, SKILL.md first;
  links, hidden folders and what installing writes left out).
- POST /api/library/skills/save {name, file, text, was} is
  library.SaveSkillFile, through change(): it writes only a regular
  file already in the skill's library folder (no .., no absolute path,
  no link, no folder that is a link out of the skill, nothing under
  node_modules/.venv/…), refuses when the file no longer holds `was`
  (the text the page opened), keeps CRLF line ends, and writes with
  edit.WriteAtomic. The sync after it reaches every agent: a linked
  one reads the library's folder, a copy is made again. A copy edited in
  an agent before the save is older, so takeEdits sets it aside in the
  backups. A GitHub skill saved here reads as Changed here, so an update
  asks first.
- The page (viewSkill in plugins/library/client.js) draws a Markdown
  file with the Plugins page's own renderer (plugins.js exports it as
  window.mdRender, 27 bytes of core script) and its front matter as
  rows; other files as text. Edit swaps in a text box; Save or ⌘S/Ctrl+S
  sends it; Cancel asks when there are changes. Other files are the
  app's menu under the name (no native select). New code is in the
  library plugin, so the core script budget is not raised.
- SkillText is gone (its only caller was the route). One new string, in
  all five languages. docs/subsystems/library.md says all this.

Run on mote at the change rebased on 9335e23d3:
- go test -count=1 -timeout 45m ./internal/library ./internal/gui
  ./internal/cli: library ok. gui: TestCoreScriptBudget passes; the only
  red is TestMainWindowCorners/macOS_26_SDK (#3949, mote's macOS 27).
  cli: the only red is TestEveryRouteHasACommandOrIsNamed on GET
  /api/context/reply (#5026, from 0872bc2a0). Both are red on main and
  filed.
- GOOS=linux and GOOS=windows go vet -tags nogui on the three packages;
  gofmt -l clean.
- skill-edit.test.cjs: 22/22 (chromium and webkit; en, zh, zh-TW, ja,
  de; 860px and 400px). It checks the drawn Markdown and front matter,
  no sideways scroll, ⌘S posting the exact body with `was`, the status,
  the file menu, Cancel sending nothing, Save on a second file, no click
  scrolling the page, no left-border stripe or gradient. i18n-keys ok.
- Whole GUI suite (a new API call), on the Linux box (wsl-run; mote had
  two other full suites): ~4460 of its results in at the push, not
  finished. Its reds are all WebKit and none is in a file this touches.
  The ones near it, run alone at this change and at origin/main
  bc10a6198: click-scroll, found-skill-pick-remove and account-eye fail
  the same on both (#4385, #4097/#5013, #4244).

Again at the pushed head (rebased on b967b1620; its commits change
app.js and the core budget), on the Linux box: TestCoreScriptBudget ok,
go test ./internal/library ok, gofmt -l clean, skill-edit.test.cjs and
i18n-keys 26/26.

Broken by hand: without the `was` check, without the linked-folder check
and without the CRLF handling, TestSkillFileSaveRefusesAChangedFile,
TestSkillFileStaysInTheSkill and TestSkillFileKeepsLineEnds each went red.
skill-edit.test.cjs on the old assets: 0/11 in chromium (.lib-mdview
never appears).

Not tried: refeccd's own skills (the fixture is a made-up handover from
~/.agents/skills, with a copy agent and a link agent); the real app
window (the GUI tests fake the API); the TUI and CLI, which have no
editor; making, renaming or removing a file from the page; Windows.
2026-11-03 16:33:03 +08:00
yetone 6b81344301 library: the keep-here switch says sync, and is on while it syncs (bin.90)
bin.90 on Discord read the Library editor's 「只在这台电脑」 switch as a
LAN-sharing switch: "this computer only" says nothing about what it keeps
from where. It is about sync, so it now says so.

- Library editor (MCP servers, skills): the switch is "Sync to your other
  computers" (同步到其他电脑 / 同步到其他電腦 / ほかのコンピュータと同期 /
  Mit deinen anderen Computern synchronisieren), on while the server or
  skill syncs. Its note says off keeps it here, and a sync from the
  others neither removes it nor replaces it.
- The stored value keeps its meaning: `local` true is still kept here.
  The switch shows !local and saves !on, so every saved library.json,
  sync payload and CLI flag (`magpie library mcp local NAME on|off`)
  means what it meant.
- Row tag: "Not synced" (不同步 / 同步しない / Nicht synchronisiert) where
  it said "This computer only", in the Library, the TUI ("not synced ·")
  and `magpie library` output.
- Agents page sibling (the same words for an agent's picks): its menu
  item is "Don't sync picks to your other computers", its tag "Not
  synced". The agentsHere setting is unchanged.
- docs/subsystems/library.md and sync-backup.md name the new labels.

app.js stays in its budget: origin/main 8af751987 was already 31 bytes
over coreScriptBudget (1,533,833 > 1,533,802), so a comment in
setAgentHidden was cut to one line (core 1,533,756 now), no raise.

Run on mote, rebased on 8af751987, budget again at 2cfeda3d3:
- GUI: mcp-local-server, agent-here, i18n-keys, skill-off-here: 78/78
  before the rebase, in Chromium and WebKit, every language, at 390, 640
  and 1100 wide and in the panel; after it agent-here, i18n-keys and
  mcp-local-server 56/56, agent-here again 30/30 after the trim.
- go test ./internal/tui ./internal/cli ok; ./internal/gui ok except
  TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, open,
  the same without this change); TestCoreScriptBudget ok after the trim.
- go vet ./internal/tui ./internal/cli ./internal/gui; GOOS=linux go vet
  -tags nogui and GOOS=windows go vet of tui and cli; gofmt -l clean.

Broken by hand: saving `d.local = on` (no negation) turns
mcp-local-server red (expected 'false', got 'true').

Not tried: a real sync between two computers with the switch flipped;
the stored value's meaning is checked through the saved request only.
2026-11-03 12:21:49 +08:00
yetone 1851ead1a7 library: Pi and omp lock ~/.agents/skills from their versions; Put skills in links every skill there
usrname1833 on Discord asked for two things.

Pi reads ~/.agents/skills itself, so a skill kept there is Pi's whatever
is ticked, with the lock as Codex and OpenCode have. Pi started to in
0.54.0, not 0.19 (its CHANGELOG; userAgentsSkillsDir in
package-manager.js), and omp in 11.0.0 (src/discovery/agents.ts; 10.6.2
doesn't). Target.SharedToo says so from the version, and every reader of
readsShared goes through Target.readsSharedDir: Always (the lock),
syncSkills' inShared (no second link) and a handover's readsSharedHere.
OmO's senpi reads it in every npm version (0.74.0 up), so omo joins
readsShared. A Pi or omp of no known version is taken as older, as
before.

The second ask is a switch: Library > Skills > "Put skills in": each
agent's own folder (the default, today's behaviour) or ~/.agents/skills
(Library.SharedSkills; POST /api/library/skills/where {how};
magpie library skill where agents|shared). On, every library skill on
here gets magpie's link in ~/.agents/skills (syncShared, after
sweepShared), so every agent and tool reading that folder has it and
shows it locked. The files stay in the library rather than moving, so
updates, edit tracking and Off here keep working; existing skills just
get links when it is turned on, nothing is moved. A user's own entry by
the same name is never written over. Off takes out magpie's links there
and nothing else, and agents' own links come back. Per computer:
Collect doesn't carry it. docs/subsystems/library.md says all this.

Not covered, filed: on Windows without link rights the shared entry is
a marked copy, and takeEdits doesn't take edits made in it (#4958).

Run on mote rebased on d76c4b23a (which has 8abdf53a8):
gofmt -l clean; go vet GOOS=linux and GOOS=windows on internal/library,
internal/gui, internal/cli ok; go test internal/library, internal/gui,
internal/cli ok. GUI, every skill-*, library-* and i18n-keys file in
chromium and webkit: 1302 pass, 4 fail, all in library-all (webkit) and
library-null-agents (chromium). Both pass alone at this tree (52/52), so
they are load reds, filed as #4967. skill-where.test.cjs (new) covers en,
zh, zh-TW, ja, de at 900px and 400px. Before the rebase, cli's
TestEveryRouteHasACommandOrIsNamed was red on /api/usage/checkin-account
(not this change); it is green at this base.

Rebased twice more on origin/main (cli's settings_parity_test, app.js,
i18n.js, settings): internal/cli and internal/gui go test ok, i18n-keys
and skill-where green at the pushed tree.

Broken by hand, each red, then restored: since() always false
(TestPiReadsSharedSkillsFromItsVersion, TestSkillsWhereShared red);
syncShared step dropped (red); sweepShared's keepsShared keep dropped
(red on the SameFile no-relink check); the holder line in wanted
(TestSkillsWhereSharedWithKimi red); skillWhereBar not appended
(skill-where 0/11 per engine).

Not tried: a real Pi, omp or OmO run (versions read from their npm
source); the setting on the Windows box or in WSL; the whole GUI suite.
2026-11-03 05:43:12 +08:00
yetone b3eb26400c library: a ${NAME} only the login shell exports reaches the MCP server magpie starts or calls
Cyrus on Discord: once a Library MCP server's token was written as
${NAME}, the Library listed no tools for it. magpie expanded the
reference from its own environment only, and a magpie opened from the
Finder or the Dock has none of the profile's variables, so a token
exported in .zshrc was "not set" for the tool-list check, and the
router (dialHub) and Codex's run through the gateway (specOf) didn't
start the server either.

expandAll, the one place all three expand a reference, now takes a
variable magpie's environment hasn't from proc.LoginVars: what the
login shell (and fish or nushell, as shellEnv asks them) exports, read
through /bin/sh as the existing PATH probe is, each answer kept a
minute. On Windows it reads the registry's user then machine variables
(one set with setx after magpie started). The value is only in memory
at call time: never set in magpie's environment, never written to
library.json or an agent's file, never logged. A variable set nowhere
is still novar, naming it ("NAME not set" on the page, unchanged). The
library only documents ${NAME} (no ${NAME:-default}), so nothing else
is parsed.

Run at this head (90d554db1 rebased on 46a13f837), on mote:
- go test -tags nogui ./internal/proc ./internal/library: ok
- GOOS=linux and GOOS=windows go vet ./internal/proc ./internal/library: ok
- gofmt -l: clean
- wsl-run (magpie-desktop): TestLoginVars, TestEnvRefs*, TestCheckStdio,
  TestCheckHTTP, TestShellEnv*, TestLoginEnv*: ok
- ./internal/cli before the rebase: only TestEveryRouteHasACommandOrIsNamed
  red, POST /api/usage/checkin-account, already filed as #4826.
- By hand on mote: LoginVars with the real /bin/zsh (.zshrc) and
  /bin/bash (.bash_profile) in a temp HOME read the exported token and
  left an unset name unset.

TestEnvRefsFromLoginShell: a fake login shell exports CYRUS_TOKEN,
magpie's environment hasn't it; a fake stdio server that exits without
the right token and an http one that answers 401 without it are each
checked (ok, with tools) and dialled by the router, Codex's run spec has
the value, a variable set nowhere is novar, and after SaveServer, a
check and a Sync no file in the sandbox HOME holds the token.
TestLoginVars: exported, exported-empty, unexported and unset names, bad
names never asked, the minute's cache and a new SHELL asked again.

Broken by hand: loginVars returning nothing made TestEnvRefsFromLoginShell
red (command and url both novar CYRUS_TOKEN, the reporter's case);
parseNamed ignoring the set flag made TestLoginVars red.

Not tried: the Windows registry read (compiled by vet only, no run on
xiaomi-gpu); a real Finder-launched magpie.app with a real token; the
GUI suite (no GUI file changed).
2026-11-02 11:01:51 +08:00
yetone 679bc412cb library: Magpie Browser's row asks which agents may use it, once connected
Magpie Browser is added with no agents (opt-in), so the router offers it
to none until one is ticked, and an agent asked to use the browser
reached for AppleScript instead. While its extension is connected
(GET /api/library/browser, read again every 3s while the row is shown,
so connecting it needs no reload) and no agent has it, its row asks
"Which agents may use it? They act in your tabs, signed in as you are.",
a button per agent that clicks that agent's chip (servers/agents, as a
chip's click). Once one has it, the row asks nothing more. Not
connected, or given to an agent already, it asks nothing.

Run on mote at this head (8e884421c + this): library-browser-ask (every
language, Chromium and WebKit, 1100/420px) with library-row-remove,
library-open-again, library-mcp* and i18n*: 200/200. Red with the row's
ask taken out by hand (2 pass, 22 fail). An earlier run of every
library* and i18n* file on this change had only library-row-remove red,
the #3099 flake fixed in 8e884421c. Not tried: the real extension
connecting in the owner's Chrome with the window open.
2026-11-02 08:01:47 +08:00
ggbdpq 655d23f790 library: an MCP server signed in to in Codex itself says so instead of "needs sign-in" (#3508)
A server signed in to with `codex mcp login` was still "needs sign-in"
in the Library. Codex keeps those tokens in its keyring, or in a
.credentials.json of CODEX_HOME when its config's
mcp_oauth_credentials_store is file or the keyring is missing, and the
check read no such file.

It now reads it for each Codex target, beside the config.toml the
target already has, a distro's too (codexCredentialsOf, readCodex in
mcp_agent_signin.go). The file holds an entry per server under the key
codex-rs's compute_store_key makes of its name and a 16 hex of the
hash of its config, each entry naming its server and URL with the
tokens flattened into it (its FallbackTokenEntry, read from codex-rs's
rmcp-client/src/oauth.rs — not the StoredOAuthTokens of the login's
memory the report guessed at). An entry of the server's name and URL
with an access or refresh token names Codex in
ServerHealth.AgentSignIn, and the row says "signed in in Codex"
instead of "needs sign-in". An entry with neither token, one of the
executor's (executor_owned: codex answers no host's lookup with it),
another URL by the same name, and a file that can't be read or parsed
name nobody, so the row stays "needs sign-in". The keyring itself is
never read. A stopped distro has no target and isn't started. The
sign-ins are already part of the check's cache key, and the page names
any agent's id in the row, so mcp_check.go and the GUI needed nothing.

Run:
- TestCheckNamesCodexSignedInItself (internal/library): agent.FakeWSL
  forces the Windows+WSL switch (Ubuntu running, its home a temp root),
  sandbox HOME/USERPROFILE, CODEX_HOME cleared, a real httptest server
  answering 401 with WWW-Authenticate.
- Broken by hand, each red with a FAIL naming the behavior:
  - the old behavior (the reader names nobody): codexCredentialsOf
    returns "": "signed in in codex@wsl:Ubuntu, the check says
    {State:auth ... AgentSignIn:[]}".
  - counting an executor's entry: "only the executor's sign-in
    counted".
  - counting an entry with no token: "a sign-in with no token counted".
- gofmt -l (nothing); go vet on darwin, GOOS=linux -tags nogui and
  GOOS=windows for ./internal/library; go build darwin, GOOS=windows
  and GOOS=linux -tags nogui ./...; go test -tags nogui -count=1
  ./internal/library: ok (71s); the two sign-in tests also with -race:
  ok.

Codex's file format was read from codex-rs's source (rmcp-client/src/
oauth.rs, oauth/resolved_store.rs, core/src/config/mod.rs).

Not tried: a real `codex mcp login` (no .credentials.json on this
machine, whose Codex keeps its MCP tokens in the keyring, which is
never read); the test's file is built from codex-rs's writer
(save_oauth_tokens_to_file, its FallbackTokenEntry), and the WSL
distro's file is a temp root behind a FakeWSL probe.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-01 16:43:21 +08:00
yetone 788057340b library: Magpie Image Recognition in Discover beside Magpie Image and Web Search (matrix0487 on Discord, #4653)
matrix0487 asked on Discord (#feedback) for all three of magpie's own MCP
servers, image recognition, image generation and search, in the Library's
Discover. Image generation and search were there; image recognition was
an address to copy in Settings only (#4653).

- `magpie mcp vision` (browsermcp.RunVision) relays stdio to the
  gateway's /mcp/magpie/vision, as `mcp search` does. analyze_image's
  relative image path is made one in the agent's folder on the way
  (imageFrom), since the gateway can't know where the agent runs; an
  absolute path, ~, a URL or a drive goes as written.
- library: magpie-vision is a featured, opt-in server (no agents until
  picked), any binary's `mcp vision` is one server (serverKey), and it
  gets the 120s tool timeout (selfTimeout).
- Settings › Models › Images: the Image recognition row has Give agents
  Magpie Image Recognition… / Turn on the Library, none with recognition
  off or in gateway mode. The three links are one helper, libWay, used by
  Image generation and Web search too (no budget raised: core 1,533,011
  of 1,533,105).
- Never a dead tool: Discover lists all three whatever is set up, and one
  that can't answer yet says why (gateway.OwnUnready, set by
  /api/library/market/servers as `unready`): a "Not set up yet" badge on
  its card with the reason as its title, and the reason in its sheet
  (nothing set up, or turned off in Settings / Plugins). It can still be
  added; its tools already answer with the same reason until then.
- Strings in en, zh, zh-TW, ja, de; docs/subsystems/library.md.

Run, all on mote (macOS 27) through mote-run, at this head's tree
(rebased on 21882a68d):
- gofmt -l internal/: clean. go vet darwin; GOOS=linux -tags nogui;
  GOOS=windows: browsermcp, cli, library, gateway, gui, imagemcp ok.
- go test -timeout 45m: internal/library, browsermcp, cli, imagemcp ok;
  internal/gateway ok (whole package, 556s, before the rebase; OwnMCP,
  OwnUnready, VisionMCP, SearchMCP after it). internal/gui: three reds,
  none from this change, each red on origin/main 21882a68d too:
  TestSettingsSaveKeepsWhatItDoesNotSend (BusyLoad, from 8d8df0639,
  filed #4739), TestMainWindowCorners/macOS_26_SDK (#3949),
  TestColdTurnsTaken (#4510). Budget tests ok.
- New: TestMagpieImageRecognitionIsOptIn, TestVisionBridgePassesLines,
  TestImageFromLeavesTheRest, TestOwnUnreadyWhileNotListed.
- New GUI test vision-mcp-library.test.cjs: chromium + webkit, en, zh,
  zh-TW, ja, de, 1100 and 420px (link opens the sheet with its hint and
  unready line; Library off → Turn on the Library; one added opens
  Discover with all three, only the unready one badged, inside its card;
  gateway mode and recognition off show no link; no horizontal overflow,
  no page errors): 206/206 with search-mcp-library and
  images-library-way. On e84870f17 (old code), chromium: every link and
  Discover case red.
- i18n-keys, gui-de, gui-zh-tw ok; gui-ja's one red is #4580, the same
  on origin/main 21882a68d.
- Broken by hand: serverKey without "vision" → TestMagpieImageRecognitionIsOptIn
  red; imageFrom not joining the folder → both browsermcp tests red.
- Real use, sandbox HOME on mote, nogui build, `magpie serve` on
  127.0.0.1:3591: `magpie mcp vision` initialize / tools/list answered;
  analyze_image of shots/a.png says "magpie has no model that sees
  images…"; missing/b.png names /…/work/missing/b.png (relative path
  resolved); an extra argument exits 1; gateway down answers id 9 with
  "magpie isn't running, so Magpie Image Recognition can't be reached".

Not tried: analyze_image against a real seeing model through the relay
(the sandbox had no provider; the gateway path is the one /mcp/magpie/vision
already serves); a real agent adding it from Discover; WSL (unchanged,
the MCP router serves it there); the whole GUI suite, queued after
mote's running one.

Reported-by: matrix0487 (Discord)
Closes #4653
2026-11-01 14:12:42 +08:00
yetone b1fc435407 library: Magpie Web Search, magpie's search MCP server in Library › MCP (lutra_fs)
lutra_fs on Discord: magpie's search MCP shows in Settings › Models but
not in Library › MCP servers. They were right. The gateway's web search
MCP (/mcp/magpie/web-search) was only an address to copy in Settings ›
Models › Web search. It was never a Library server, so no agent could be
given it from the Library, and the Library didn't list it.

Change:
- `magpie mcp search`: a stdio relay to the gateway's search MCP, made by
  widening browsermcp's Magpie Browser relay into a bridge with its own
  path, title and an optional session (search sends none, and has a 5
  minute client). It takes no arguments. When magpie isn't running, it
  says "Magpie Web Search can't be reached: start magpie".
- library: Magpie Web Search (magpie-web-search) is a featured,
  opt-in server beside Magpie Image and Magpie Browser. It is installed
  with no agents, so the user picks them in its sheet, and it switches
  per agent like any other row. Its command is the full binary path, and
  serverKey treats any binary's `mcp search` as the same server. Each
  agent's tool timeout is at least 120s.
- Settings › Models › Web search › MCP server: under the address there is
  a "Give agents Magpie Web Search…" link that opens its Library sheet,
  or "Turn on the Library" while the Library is off, as Images does for
  Magpie Image. Gateway mode has no link.
- The sheet's hint says where each search goes and what it costs. All
  strings are in en, zh, zh-TW, ja and de.
- docs/subsystems/library.md names magpie's own servers and the new one.
- An agent in WSL gets it through the MCP router, as Magpie Browser
  does. The image-only WSL side() is unchanged.
- The sibling, Image recognition's MCP server, is still in Settings only.
  That is filed as #4653.

Run, at this head (rebased on origin/main a6217e83d), on mote: gofmt -l
is empty. go vet passes for darwin, linux (nogui) and windows.
internal/library, browsermcp, cli and imagemcp pass. The internal/gui Go
package and the GUI files search-mcp-library, search-mcp,
images-library-way, i18n-keys, gui-ja/de/zh-tw, searcher-pick and
search-keys: 197 passed, 2 failed. The 2 reds are both known. gui-ja is
the {agent} ja string, #4580. searcher-pick's chromium en case reads a
null box: red 1 of 3 here and 2 of 3 at a6217e83d, filed as #4274.
internal/gui's three reds are red at base and filed:
TestSettingsSaveKeepsWhatItDoesNotSend #4514,
TestMainWindowCorners/macOS_26_SDK #3949 and TestColdTurnsTaken #4510.

New test: search-mcp-library.test.cjs covers Chromium and WebKit, 5
languages, at 1100 and 420px. On the old code it is red, 52 failed and
10 passed; the passes are its gateway-mode cases, which expect no link.
TestMagpieWebSearchIsOptIn and TestSearchBridgePassesLines are new too.

Broken by hand: with "search" taken out of serverKey,
TestMagpieWebSearchIsOptIn goes red (Have empty).

Real use: on mote, in a sandbox HOME, with a nogui build and the
gateway on 127.0.0.1:3611. `magpie mcp search` answered initialize with
serverInfo magpie-web-search and listed web_search in tools/list.
web_fetch https://example.com returned "Example Domain". With the
gateway killed it gave -32603 "magpie isn't running, so Magpie Web
Search can't be reached…". With an extra argument it exited 1 with
"takes no arguments".

Whole GUI suite on WSL magpie-desktop (load 120 to 180), at the
pre-rebase tree 73595f737: 17260 tests, 16684 passed, 574 failed. The
base, origin/main da0005df8, ran on the same machine: 516 failed, and
324 top-level tests were red. Each of the 161 files with a red was then
run alone on mote at head:
- At head, 118 of them pass alone. They aren't caused by this change.
- 43 fail alone at head, and every one of those also fails alone at
  base. Two pass at base once: login-import is flaky at both (#1307),
  and usage-curve-zoom-back went red once of two at base and passed 2 of
  2 at head.
  view-open-wheel was red 1 of 2 at both, filed as #4723.
- segs-press-redraw ("searchAllRow option 1") fails the same way at
  base, filed as #4566. gui-ja's {agent} string is #4580, and
  usage-ledger is #4078.
- Reds with no issue are now filed one per test: #4680 to #4728.
  Already filed: #4638 claude-mode, #4650 routing-request-model, #4176
  skeleton-bird and #1937 name-suffix-no-names.
Not tried: web_search with a real search API key (mote has none). An
agent in WSL using it directly. A run on the Windows box.
2026-11-01 12:38:01 +08:00
yetone 20482d71ff library: a skill by a name the library has from elsewhere goes in beside it
mora1n on Discord: anthropics/skills' skill-creator and openai/skills'
are two skills by one name, and only the first could be added; the
second was skipped as "another skill called skill-creator, left as it
is". The library keyed being had by name in every place that asked.

Now being had is decided by source (hadSkill): the same source under any
name here, or a skill with no source (taken in from an agent's folder)
by that name with the very same files. Another skill from GitHub or a
git repository whose name is taken goes in beside it as
<name>-<owner> (skill-creator-openai), then owner-repo, repo, a number,
at most 64 bytes (freeSkillName in skill_beside.go). The library's copy
of its SKILL.md gets that name in the front matter's top-level name:
line (nameSkill), so no agent sees two skills by one name; Skill.Called
keeps the name it came with, and the carried bundle carries it. Its hash
is of the renamed copy, and checks (GitHub and git) and updates compare
what they fetch renamed the same way (fetchedHash), so it doesn't read
as edited and an update keeps the name.

The class: probe (Candidate.Have now means this skill; Candidate.As is
the name it has or would get), installFrom (listed and unlisted folder
by that name), the new-skills check (no longer drops a skill because
its name is taken), the market's had check (by name only for a skill
with no repository: none or a folder), carry, the TUI's probe list and
the GUI's probe list ("adds as {name}" with why in its title, "In the
library as {name}"; zh, zh-TW, ja, de; the tag is cut short in its row).

Old data: nothing is renamed. A skill already in the library keeps its
name, folder, SKILL.md and agent links; library.json without "called"
reads as before. Only a skill added from now on can get another name.
Not changed: a folder of the user's own is linked as it is and its
SKILL.md can't be named apart, so one by a taken name is still skipped,
now saying to rename it in its SKILL.md; and an agent's own skills
folder still holds one skill per name (an agent's own skill by the
library's name is settled by Use library / Keep agent's as before).

Run (mote, at c6fd4b37c on origin/main 6a900e0d0, then rebased on
0fe9f97c1, which touches only claudetui, gui and provider):
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build ./..., go build -tags nogui:
  clean.
- go test -tags nogui -count=1 -timeout 45m ./...: 82 packages ok,
  internal/gui red only in TestSettingsSaveKeepsWhatItDoesNotSend
  (SearchAll, #4514, open on main, not this change).
- After the rebase: internal/library and internal/tui ok.
- GUI, both engines: skill-install-beside (new), every skill-*,
  library-*, found-skill-*, remove-found-*, mcp-*, i18n-keys, gui-ja,
  gui-de, gui-zh-tw, font-cascade, inner-scroll-contain, win-fonts:
  1427 tests, 1423 pass. The 4 reds fail the same at origin/main
  3baf3b6df run alone: gui-ja (#4580), i18n-keys "Unmarked" (#4524),
  library-row-remove chromium (#3099).

Red on the old code: the anthropics-then-openai install against
origin/main code fails with "the library already has another skill
called skill-creator, left as it is". Broken by hand: fetchedHash made
to hash the fetched files unrenamed turns
TestSameNameFromAnotherSourceGoesInBeside red (hash mismatch); the
.lib-pick > .lib-tag rule removed turns skill-install-beside red ("the
tag stays in its row") in both widths.

Not tried: real anthropics/skills and openai/skills installs in a
sandbox HOME (the tests serve both repositories' layouts as tarballs;
the fixtures put both at skills/skill-creator. The real openai/skills
keeps it under skills/.system, which a probe of the repository's top
doesn't walk into; that is how probing has been and isn't changed
here); Windows and Linux runs of the GUI.
2026-11-01 02:02:24 +08:00
yetone 557f51dbf0 library: a skill linked into an app version the update deleted follows it to the current one (tjhhhh on Discord)
tjhhhh: ego lite keeps its skills in its framework's Versions/<v>. After
the app updated, the skill was in the new version's folder, the old folder
was gone, and magpie still linked the old one. dccfefdf7 (#2635) linked new
imports through the app's own steady link (~/.local/share/ego/ego-skills, or
Versions/Current), but a skill brought in before then links straight to the
resolved Versions/<old> path. tjhhhh's case is that old link: an import
made since dccfefdf7 already follows the update
(TestImportedSkillFollowsAppUpdate).

followMovedSkills (skill_moved.go) runs on every read of the Library page,
under the read's link memo, which is restarted when a link is mended. It
also runs as the first step of every sync. For each library skill that is
a link:
- Target gone, and its first missing part named like a version: link the
  same place under the folder's Current/current/latest link. With no such
  link, use the highest version beside it that has a SKILL.md there
  (1.10 after 1.9).
- Target in Versions/<v> while the bundle's Versions/Current links to
  another version with the same skill: link it through Current.
Source.Dir follows. Only the link is replaced (os.Remove of the link, then
dirLink, and the old link is put back if the new one can't be made). A
folder of the library's own, a link the user deleted that isn't a version
(still shown missing), and the app's old version folder are left alone.
docs/subsystems/library.md says so.

Run (all on mote via mote-run):
- New tests on ego lite's real layout (egoLite: framework Versions/<v>,
  Current, ~/.local/share/ego links): TestOldImportFollowsDeletedVersion
  (0.5.1.13 deleted, then 0.6.0.12, then the next update to 0.7.0.1 by
  itself, plus the agents' link through the library),
  TestOldImportFollowsVersionsCurrent (old kept, through Sync()),
  TestOldImportFollowsHighestVersion, TestMovedSkillsLeaveTheRest and
  TestVersionLess. All pass, as do dccfefdf7's three tests.
- Broken by hand: with followMovedSkills returning false at once, the
  three OldImport tests are red.
- go vet -tags nogui ./..., GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: clean. gofmt -l: nothing.
- Full go test -tags nogui -count=1 -timeout 45m ./... in a sandbox HOME:
  80 ok, 3 FAIL.
  - internal/library TestReadLooksAtEachFolderOnce was mine: the mend ran
    before the read's memo, so each skill link was looked at twice. Fixed
    (the memo starts first and restarts after a mend). The whole
    internal/library package then passed (75s).
  - internal/gui TestSettingsSaveKeepsWhatItDoesNotSend is red on
    origin/main 3ecc02b78 and ccc791231 alike (#4514, SearchAll).
  - internal/cli TestAgentFieldNameShowsIt failed once under load. It
    passes alone and in a whole internal/cli run, and its message was lost
    to my grep of the log (#4583).
  The full ./... was not run again after the memo fix.
- At the pushed head, rebased on a51776f9c (which changed internal/library
  too): go vet and the whole internal/library package ok (95s).

Not tried: tjhhhh's own machine and ego lite's real update (the layout is
the #2635 fixture, built from iomect's report). Windows junctions to a
deleted version (dirLink is the same call ImportSkill uses). An app that
renames the folder above the version is not followed: it stays missing.
2026-10-31 22:01:45 +08:00
yetone 73a12e8bf6 wsl: a distro's agent folder that is a link is opened where it leads (#4502)
On Windows, adding a skill or switching RTK on for an agent in WSL failed
with `mkdir \\wsl.localhost\<distro>\root\.codex: Cannot create a file
when that file already exists` (linusxiong). In the distro ~/.codex is a
link to /mnt/c/Users/<user>/.codex. Through \\wsl.localhost Windows can't
follow a link the distro has: a mkdir of it says it exists, and nothing
below it can be made, written, read or listed. ggbdpq found and explained
the link (thanks); their patch, which takes that EEXIST as "there", wasn't
used: the writes below the link fail next (its test passed because a
symlink here is followed).

The fix, for every agent folder and every writer through \\wsl.localhost:
- The WSL probe asks `readlink -f` in the distro where each agent folder,
  its skills folder and the folders beside them lead (wslLinkPaths ->
  distro.Links; a $HOME that is itself through a link is left alone), and
  which drive each Windows mount is (win:/mnt/c C: -> distro.Drives).
- distro.open opens a path at or below a link where it leads: on a Windows
  drive, the drive's own path (C:\Users\<user>\.codex); elsewhere in the
  distro, through \\wsl.localhost again. native spells it back through
  the link, so the agent is told its own path.
- A link readlink couldn't resolve is never guessed at: distro.open
  errors, and the agent is unreached (Agent.Unreached: its notice says
  why; every field Set and Sync returns it).
- Writers: the agents' own files (place.join/place.open, every
  filepath.Join(at.home, ...) in internal/agent), the library's WSL
  targets (wslOpen/wslOpened; one "wsl" problem per agent and nothing
  written), RTK (rtkAt, rtkInstall checks agent.WSLOpen before its mkdir),
  the Sessions page's WSL reads (sessions.WSLHome.Open) and the Copilot
  CLI sign-in read (provider.CopilotWSLHomes -> CopilotWSLDirs).
- Not changed: magpie's image MCP server opens arbitrary paths an agent
  in WSL gives it the same way; filed as #4578. Links deeper than the
  probed paths (other than <agent dir>/skills) aren't resolved. A distro
  probed by an older magpie has no Links until probed again (each run).

Run:
- Real Windows box (xiaomi-gpu, distro magpie-desktop, sandbox
  /tmp/x4502/home with .codex -> /mnt/c/Users/yeton/runs/x4502-target/.codex,
  .claude -> /tmp/x4502/data/claude, .pi -> a missing folder), a throwaway
  Windows test running the real probe with that HOME: probe said
  link:.codex /mnt/c/..., link:.claude /tmp/x4502/data/claude, link:.pi,
  win:/mnt/c C:, win:/mnt/d D:. The old way, MkdirAll(\\wsl.localhost\
  magpie-desktop\tmp\x4502\home\.codex\skills\pdf) = "Cannot create a file
  when that file already exists" (the report's error). distro.open wrote
  SKILL.md to C:\Users\yeton\runs\x4502-target\.codex\skills\pdf and to
  \\wsl.localhost\magpie-desktop\tmp\x4502\data\claude\skills\pdf, both
  read back with cat in the distro through the links; .pi said "~/.pi in
  WSL magpie-desktop is a link magpie couldn't follow". Sandbox and target
  removed after.
- New tests with a fake distro whose ~/.codex and ~/.claude are links to
  /mnt/c/... that don't exist here, so, as through \\wsl.localhost,
  nothing below them can be made: TestWSLFolderIsALinkToC,
  TestWSLFolderLinkUnresolved, TestRTKWSLFolderIsALink,
  TestRTKWSLFolderLinkUnresolved (library); TestWSLProbeLinks (runs the
  probe script), TestWSLOpenThroughLinks, TestWSLAgentFolderIsALink
  (config and a Claude session read on C:), TestWSLAgentFolderLinkUnresolved
  (agent).
- Broken by hand: the library tests on the base (with a no-op
  FakeWSLDrives) fail with "mkdir .../home/me/.codex: file exists", the
  report's error; with ggbdpq's patch applied they still fail (the skill
  mkdir, and RTK's hook not written).
- mote: go build ./...; go vet of agent, library, sessions, provider for
  darwin, GOOS=windows (and linux for agent, library); gofmt -l clean;
  go test -timeout 45m ./internal/agent ./internal/library
  ./internal/sessions ./internal/provider: all ok.
- Windows (win-run): the same four packages. The new tests pass (the
  RTK ones skip: the fake distro runs sh). 32 tests are red, all already
  red at the base c63c2136b run on the same box, and filed (#4115, #2808:
  Hermes profiles, Codex keychain, Agy, desktop entries, ...); the Hermes
  ones fail alike on base and branch with -count=3.

- Rebased on origin/main 3ecc02b78 (it changed internal/agent): at this
  head on mote, go build ./..., go vet of the four packages for darwin,
  windows and linux, gofmt -l, go test ./internal/agent ./internal/library:
  ok.

Not tried: the full ./... suite; the GUI (no GUI change; the unreached
notice uses the existing Notice); a real Codex/Claude Code run against
the moved files in the distro.
2026-10-31 21:29:22 +08:00
JoeyWu-tech 722ca104c0 library: the Subagents page lists a stopped WSL distro's agents, greyed (#4238)
While a WSL distro runs, the Subagents page lists its agents that take
subagents here (Claude Code, Codex and the rest of SubagentAgents) with
a greyed chip that says magpie gives subagents only to agents on this
computer, not yet to it in WSL. With the distro stopped, they were gone
from the page: subagentsView built its agents from the targets only, and
an agent in a stopped distro is no target (#3896).

As the commit before did for the Hooks page: subagentsView now also
lists each stopped agent of those kinds that the MCP and Skills pages
list from its shape (asleepView), with the reason it has while the
distro runs (wslNoSubagents, which subagentSpecOf now shares), so its
chip, a subagent's problem for it and the "magpie can't give subagents
to ... yet" line are the same, stopped or running. Nothing of the
distro is opened. One magpie never saw (unseen) isn't listed.

No WSL agent can be given a subagent yet, so there is nothing to keep
for Woken. No change to the page; nothing new to translate. The line in
library.md that named the pages leaving a stopped distro's agents out
(#4182, #4237, #4238) is gone with this.

What was run (tree e03c52f0, on origin/main ec5571d6, go1.26.8,
linux/amd64, Linux 5.15, umask 077):
- TestWSLStoppedSubagents (new): the Subagents page's WSL agents read
  while a FakeWSL distro runs (Claude Code and Codex, the kinds it
  lists, each with the reason), then with it stopped and its folder
  moved away: the same two, field for field. A subagent given the
  stopped Claude Code has the same problem for it. Nothing was written
  into the distro and FakeWSLRuns didn't move.
- Broken by hand, each alone: subagentsView skipping the stopped agents
  ("... while it is stopped: map[], while it ran: map[claude@wsl:...]",
  and the subagent with no problem for Claude Code); the stopped agents
  listed with no reason ("No:" empty against the running ones', the
  same problem missing).
- library-wsl-asleep, its new Subagents case beside the Hooks one,
  Chromium and WebKit, en, zh, zh-TW, ja and de at 1100 and 390px: a
  subagent's chips are Claude Code and the stopped Codex, Codex's
  blocked, asleep, aria-disabled, with the WSL reason as its tooltip,
  the line names it, a click on it sends nothing. As for Hooks, the page
  isn't changed, so only TestWSLStoppedSubagents catches the gap.
- GUI files, each alone, Chromium and WebKit, Node 22.22.1, Playwright
  1.62.1, DISPLAY unset: library-wsl-asleep 44/44 each, i18n-keys 4/4,
  library-subagents 6/6, library-hooks 6/6, library-gone-agents 11/11:
  142 of 142.
- go test -tags nogui -count=1 ./internal/library ./internal/agent
  ./internal/cli: library and cli ok; agent red in TestInstalledVersion,
  TestCursorFolderFromTheEditorIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
  TestOmpDetectedWithPiDir
  (#3141). go test -race -run TestWSL ./internal/library: ok.
- gofmt -l clean. go vet -tags nogui for linux, windows and darwin, go
  vet for windows, go build -tags nogui for linux and darwin and go
  build for windows: exit 0 each. go vet and go build without the tag on
  linux: exit 1 (no GTK headers here).
- go test -tags nogui -count=1 -timeout 45m ./... (Bun 1.4.2; 9m49s,
  load 20 at its start): 78 packages ok, and 8 tests red in 3 packages,
  each filed: agent TestInstalledVersion,
  TestCursorFolderFromTheEditorIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141); gui TestGatewayHeldByAContainer and
  TestGatewayFixQuitsOnlyAMagpie (#3649); plugin
  TestGatewayHookMixedPiPackage ("starting plugins: context deadline
  exceeded", #2865, under load). The same suite on an origin/main
  ec5571d6 worktree right after (10m01s): the same agent and gui reds,
  test for test, and plugin ok there.

Not tried: a real distro, and the real app; FakeWSL counts the wsl.exe
-d commands run in the stopped distro (none).

Reviewed and run again by the maintainer at the stack's tree 45994757c
(this commit and the six beside it, on origin/main 90518de26), go1.26.8:
- mote (macOS, arm64): gofmt -l clean; go vet and go build for darwin,
  GOOS=linux -tags nogui and GOOS=windows (library, plugin, gui): exit 0.
  go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
  internal/gui TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
  internal/proc TestNoCommandBypassesProc (#4491), both red on main
  from b09349d17 and c59c547c5, in files this stack doesn't touch.
  go test -race -run 'TestWSL|TestTagged|TestPinnedPiCache' for
  library and plugin: ok.
- magpie-desktop (Linux, wsl-run; WebKit hangs on mote), Chromium and
  WebKit: every library-*, sync-*, s3-sync, github-sync and i18n-keys
  file, 4 at a time: 1003 of 1020. The 17 reds are in 6 files no commit here
  touches: i18n-keys ("Unmarked", #4524), library-chip-fan, -items,
  -mcp-health, -mcp-hub (#4483) and -mcp-tools. Those 6 alone, one at a
  time, at load ~60: 74 of 92 here, 77 of 92 at 90518de26 itself. Red
  in both: i18n-keys, -chip-fan and -items in WebKit, -mcp-tools in
  Chromium ja 420; -mcp-health green in both; -mcp-hub's WebKit case
  red here only, the case #4483 has red on main. -chip-fan and -items
  are #3072's and #4501's kind, WebKit under load.
- Broken by hand on mote: subagentsView skipping the stopped distro's
  agents turns TestWSLStoppedSubagents red.
2026-10-31 17:00:14 +08:00