88b4c00ea11c8653cada22e11edf20ab1594de43
176
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
aa6a0d6b20 |
library: one skill over 200 MB is left out, not the whole repository (#2062)
mikubaka88/CCFA-Skills couldn't be installed at all: "the skills in ... are
too big to install (over 200 MB)". The repository is over the 200 MB
tarball cap, so fetchSkillFiles fetched it file by file, and that refused
the whole repository once the files summed past 200 MB. One skill,
ccf-paper-writer, is 297 MB on its own (exemplar paper PDFs, llava-4d.pdf
alone 46.8 MB); the other 16 are small.
The 200 MB limit per skill stays: a skill is copied into every agent that
gets one as a copy, and treeOf stops comparing at 256 MB, so a 297 MB skill
can't be told current or edited. What changes is that one such skill no
longer blocks the rest:
- fetchSkillFiles sums each skill's files (the deepest skill folder a file
is under) and leaves out a skill over maxFetch; its files are never
asked for. Only when every skill is over it does it fail as before.
- The left-out skills reach ProbeSkills as Probe.Left (path, size), kept
per temp folder and taken once (tookLeftOut).
- The GUI's probe names each under the list ("{name} is too big to
install: 283 MB, over the 200 MB a skill may be"), or in place of "No
skills there" when nothing else is left; zh, zh-TW, ja, de. The TUI says
it in its flash.
- docs/subsystems/library.md says how a big repository is fetched.
Run:
- Real: probe of mikubaka88/CCFA-Skills under a sandbox HOME lists 16
skills and leaves out ccf-paper-writer (296736735 bytes). Not installed
into a real agent.
- gofmt -l internal/: clean. go vet ./internal/gateway ./internal/library
./internal/tui on darwin, GOOS=linux -tags nogui, GOOS=windows (set -o
pipefail): clean.
- go test -count=1 ./internal/library ./internal/tui: ok.
- TestOneSkillTooBigLeavesTheOthers (new): fails with the per-skill
leave-out turned off by hand, passes with it.
TestTooBigRepositoryChecksWhatArrives now makes every skill too big.
- skill-too-big.test.cjs (new), chromium and webkit, en 980 and zh,
zh-TW, ja 440, de 420, plus every-skill-too-big: 14/14; red (0/7 in
chromium) with client.js at origin/main. skill-*.test.cjs 190/190 and
library-*.test.cjs 484/484 in both engines.
|
||
|
|
8f34bbcd11 |
library: Grok Build and Grok App can be given hooks (#1790)
The Hooks tab said "Grok App has no hooks magpie can write" and RTK said
"No rtk hook". RTK stays correct for now (rtk init has no Grok agent), but
the hooks message was wrong: the Grok CLI keeps hooks as [[hooks.<Event>]]
array tables in its config.toml, which Grok App reads from agent-home on a
custom route. Hindsight already ships three hooks into both configs.
Add grok and grok-app to hookAgents with a TOML hook spec. A hook is written
as a [[hooks.<Event>]] table with a [[hooks.<Event>.hooks]] child, the same
find/claim/drop logic as a JSON agent's: the block text is recorded entry by
entry, so only a block still exactly as magpie wrote it is ever taken out,
and the user's own blocks around it stay as they are. Portable events map to
Stop / PostToolUse / PreToolUse / UserPromptSubmit / SessionStart; a tool
matcher uses Grok's own tool names (run_terminal_command, search_replace).
Grok Build and Grok App run the one CLI, so a grok:<Event> own event goes to
both (sameHookFamily).
edit gains WriteTOMLFile and SplitLines so the library can round-trip a
config's lines through the same validating write the other TOML editors use.
Verification (branch grokapp-hooks):
- TestHooksGrokConfigTables fails on the pre-change code with a real FAIL
("Grok Build has no hooks magpie can write"); passes with the change.
Broke the matcher map, the drop and the event map by hand; each break is
caught by the test.
- go test ./internal/library ./internal/edit: 811 passed (was 828 before the
two new grok cases and the hookAgents additions).
- gofmt -l clean; go vet on mac, GOOS=linux -tags nogui, and GOOS=windows all
clean; go build, GOOS=linux go build -tags nogui and GOOS=windows go build
all succeed.
- go test -tags nogui ./... has three pre-existing failures on base
|
||
|
|
45e77b61f7 |
library: Claude Code's hooks can go on every event it has, StopFailure, PostCompact and FileChanged among them (#2020, emo172)
The claude branch of hookSpecOf knew 12 of Claude Code's events, so a
hook on StopFailure, PostCompact, CwdChanged, WorktreeCreate and the
rest was refused ("it has no event called StopFailure") and could only
be written into settings.json by hand, outside magpie's record and
backups. The list is now claudeHookEvents: all 33 names of the
HOOK_EVENTS enum in the real claude 2.1.296 binary, read from it with
strings (read only, ~/.claude untouched). That is the 14 the issue
lists plus six it didn't (PostToolBatch, UserPromptExpansion,
PermissionDenied, Elicitation, ElicitationResult, DirectoryAdded). The
page's event picker takes the agent's list from the same table, so it
offers them too. Codex's, Gemini's and Cursor's tables are not
changed here: each of Codex's 12 names is in codex 0.162.1's strings,
but its full enum wasn't extracted.
Run: go test ./internal/library (TestHooksClaudeEventsAll new; on the
old table it fails with "it has no event called StopFailure"), gofmt
-l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/library.
|
||
|
|
17d4283a5a |
library, gui: a hook has a description in any language, shown under its name (#2011, emo172)
A hook's name is letters, digits, - and _ (checkName), so a Chinese user had to translate "auto-format-queue" back in their head; 编辑后格式化 was refused. Hook now has an optional Description: one line (whitespace and line breaks folded into single spaces) of at most 200 characters, kept in library.json only and never written into an agent's hooks file. The Hooks tab shows it under the name; the editor has a Description field (maxlength 200) under Name. The library's text fields no longer save or close on an Enter or Escape that only ends an input method's composition (isComposing / keyCode 229), which a Chinese description would hit. Strings in zh, zh-TW, ja and de; docs/subsystems/library.md says it. The reporter's other option, non-ASCII names, wasn't taken: the description says more than a name can, and names stay one rule across servers, skills and hooks. Run: TestHookDescription (kept through a save, an agents change and a rename, read by the page, no agent file has it, 201 characters refused, 200 kept) fails with the folding and the length check removed. library-hooks.test.cjs (a description under the name, none for a hook without, the field's placeholder and hint, an IME Enter posts nothing, Save posts the description) fails on the old library.js and with the IME guard removed. library-*, gui-de, gui-ja, gui-zh-tw, i18n-keys and click-scroll pass in Chromium and WebKit (263/263 each). go test -tags nogui ./internal/library ./internal/gui under a temp HOME, gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/library pass. |
||
|
|
692a779d3d |
library: an instruction set can be kept in a file of your own, such as ~/.agents/AGENTS.md (新v学员 on Discord)
新v学员 keeps one user-level ~/.agents/AGENTS.md by hand and wants every agent to follow it. Only Factory Droid, omp and Cline CLI read that file natively; Codex, Claude Code, Gemini, OpenCode, Pi, Amp and the rest don't. Rather than teach magpie a new agent target, a set of shared instructions can now be kept in that file instead of a copy in the library, and the library writes it into every agent that is on, as it does any set. What changed: - InstrSet.File: a set kept in a file of the user's own. Its text is read from that file, Save writes to it (kept aside in the backups first, written atomically, never removed: emptied, it stays empty), and Remove lets go of the set without touching the file. - The file is refused when it is relative, a folder, an agent's own instructions or override file (magpie writes into those), a file holding magpie's marked block, inside the library, or another set's. A file not there yet is made on the first save. - The GUI checks the active linked file every 30s (KeepLinked) and writes a change made in an editor into the agents. - Carried by davsync or a backup, a linked set goes as its text; where the file is stays this computer's. Put back, the set keeps its file and the file gets the carried text, never emptied for a text not carried. A profile restored with no text doesn't empty it either. - GUI: New set has "Keep in a file…" (filled with ~/.agents/AGENTS.md); a linked set is tagged "Your file", says where it is kept, and warns when Droid or omp is on, as they read ~/.agents/AGENTS.md themselves and would get it twice. Strings in zh, zh-TW, ja and de. Run: - gofmt -l; go vet for darwin, linux/amd64 -tags nogui and windows/amd64 on ./internal/library ./internal/gui. - go test ./internal/library ./internal/gui -count=1: ok. - New TestLinkedSet, TestLinkRefused, TestLinkedSetCarried. Each was broken by hand and went red: putText writing a linked file like a library one, Collect not stripping File, Put not restoring it, SyncLinked not syncing, linkable not checking agents' own files. - library-linked-set.test.cjs in chromium and webkit, at 1100 and 420, in en, zh, zh-TW, ja, de: 22 pass; red with the file left out of create. library-instr-sets and i18n-keys still pass. Not done or tried: - No CLI to link a set (`magpie library instructions set <file>` still copies once), and the headless `magpie serve` doesn't watch the file: after an edit there, `magpie library sync` writes it out. - Not tried with real Droid or omp reading the same file. |
||
|
|
776c255f56 |
library: a market skill kept only in a repository's .claude/skills installs (#1964, UFO404)
The market lists ui-ux-pro-max from nextlevelbuilder/ui-ux-pro-max-skill, whose SKILL.md is only at .claude/skills/ui-ux-pro-max. candidates() skipped every hidden folder, so the install said "has no skill ui-ux-pro-max any more". candidates() now looks into a hidden folder only for its skills folder (.claude/skills, .agents/skills, .codex/skills ...), the same agent folders the skills CLI behind skills.sh reads. A skill found there that the repository also has outside hidden folders (that repo keeps brand, design, slides... in both .claude/skills and cli/assets/skills) is listed once, as the one outside, as the skills CLI does by name. skillDirsIn, which the new-skills check reads from GitHub's tree, follows the same rule, so the two paths agree. A hidden folder that isn't an agent's skills folder (skills/.hidden, .claude-plugin/x) is still skipped. TestSkillsFromATooBigRepository (#1941) expected hindsight's own .claude/skills/ship-it to be left out; it is listed now, as the skills CLI lists it. Run: - TestMarketInstallsASkillKeptInClaudesFolder, with the repository's real paths. On the old code it fails with "has no skill ui-ux-pro-max any more". Turning off the de-duplication and the skills-folder rule by hand each turns it red. - A throwaway test (not committed) installing ui-ux-pro-max from the real GitHub repository in a sandbox HOME: installed, candidates are the six cli/assets skills plus .claude/skills/ui-ux-pro-max. - go test ./internal/library (nogui), gofmt -l, go vet for darwin, linux and windows. Not tried: the GUI Market page itself. |
||
|
|
38bd14dbfd |
library: a well-known kit brought in before v0.1.1223 groups as one source again (#1862, WardLu)
WardLu's Feishu skills (3) and Fish Audio skills (2) still showed as 3 and 2 groups on v0.1.1223, which grouped well-known kits by their base. The lock now says the kit's base, but each skill's From was recorded when it was brought in from ~/.agents/skills (ImportSkills), and back then that was the skill's own sourceUrl, e.g. "docs.fish.audio/.well-known/agent-skills/fish-audio-api/skill.md". repoOf takes From before the lock, so the stale per-skill key won. fromKey reads a From that carries /.well-known/ as the base before it, so those skills group as the lock now says, without rewriting the user's library. Run: TestWellKnownKitFromBeforeGrouped, built from the reporter's five lock entries with From set to the old form, passes; on the old skill_from.go it fails with five per-skill groups. go test ./internal/library ok; gofmt -l clean; go vet (darwin) and GOOS=linux / GOOS=windows go vet -tags nogui ./internal/library ok. Not tried in the reporter's own GUI. |
||
|
|
3ccbe6bc15 |
plugins: a runtime for built-in plugins, and Plugins › Built-in to switch them (P0)
Lxxyx on X (https://x.com/Lxxyx_/status/2109506752656150974): magpie has too much in it. This is P0 of making magpie's parts plugins, as DeepSeek Harness does: a runtime, plugins.yml, and the first five built-in plugins the user can switch off. - internal/pluginrt: a registry (Register from init), a manifest (API caret range, Requires/Provides, Essential, InUse, Apply, Parts, Defaults) and Reconcile: the plugins no longer wanted, with whatever needs a service they provided, are disposed newest first; the wanted ones are applied once their services are there. A plugin that fails or panics is failed and the rest run. TestPluginsImportOnlyCore keeps the boundary: nothing outside plugins/ imports one, none imports another. - plugins.yml (appdir.Config()): default → preset (essentials | all) → the user's rows → in use. A new install is written Essentials, a magpie that ran here before (settings.RanBefore) All, so existing users keep everything. Writes are locked, whole and keep a .bak; a file that doesn't parse is an error, never empty, and is never written over. - plugins/groups, library, otel, sessions, warmups. In P0 a plugin off is the window's alone: its page, sections and rows (data-feature) leave the window; the gateway, TUI and CLI serve the same, nothing is deleted. One in use stays on. - The window: Plugins › Built-in, the first tab, a switch per plugin; GET/POST /api/plugins/builtin; boot.js says which are off before the first paint. CLI: magpie plugin builtin [on|off <id>], plugin preset, plugin dump [--json]. - docs/subsystems/plugin-runtime.md, gui-shell.md. Run: go test ./internal/pluginrt/ ./internal/settings/ ./internal/gui/; gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./.... GUI: builtins.test.cjs in Chromium and WebKit, 5 languages, 1100/800/420; list-sort, mobile-web, routing-keys-fold, routing-sessions pass. By hand under a sandbox HOME: a new install gets essentials, an existing one all, a broken plugins.yml is refused and kept, dump works. Full suite results after the rebase are in the push notes. |
||
|
|
a894559e23 |
library: a project's skills and MCP servers reach Qoder, CodeBuddy, Droid, Cline and Command Code (eirc on Discord)
eirc could give Qoder and other agents skills and MCP servers only
user-wide; Library's project page didn't offer them. Each agent now gets
the project folder or file its own source or docs say it reads:
- Qoder, Qoder CN: skills in .qoder/skills, servers in
.qoder/settings.json's mcpServers (@qoder-ai/qodercli and
@qodercn-ai/qoderclicn 1.1.69: projectConfigDirName ".qoder",
getProjectSkillsDir = <config>/skills; docs.qoder.com/cli/mcp-reference).
- CodeBuddy Code: skills in .codebuddy/skills, servers in .mcp.json, or
mcp.json when the project has only that (2.164.0 reads the first of
[.mcp.json, mcp.json]).
- Droid: servers in .factory/mcp.json, skills in .agents/skills
(docs.factory.com).
- Cline: skills in .agents/skills (CLI 3.0.70 reads .clinerules, .cline
and .agents /skills).
- Command Code: skills in .commandcode/skills (commandcode.ai/docs/skills).
Left out, unconfirmed: Command Code's project MCP (.mcp.json in its own
transport shape, which would clash with Claude's), Copilot CLI's project
MCP, Zed's .zed/settings.json, WorkBuddy. docs/subsystems/library.md gets
a Projects row.
Run: go test -tags nogui ./internal/library (temp HOME, pinned module
cache); the three new tests in project_targets_test.go fail with the map
entries reverted ("magpie knows of no folder qoder reads a project's
skills from"), and the CodeBuddy mcp.json test fails with that fallback
turned off. gofmt -l clean; go vet -tags nogui on darwin, linux and
windows. No GUI asset changed (the page takes both from sync.go). Not
tried with the real Qoder, CodeBuddy or Droid CLIs.
|
||
|
|
97751188ea |
library: an unreadable skill copy stays in place during sync (#1102)
An unreadable subfolder in an agent's copy of a skill hid edits from the timestamp scan, which ignored read and stat errors. So switching copy/link mode, refreshing the skill, or removing a duplicate copy could replace the copy and lose those edits. Shared-folder deduplication could remove SKILL.md before failing on the unreadable subtree. changedAt and copyIsFresh now return the scan error. The copy is kept in place for that sync (Library.blockedSkills) and reported as a Problem naming the path. This covers agent copies, shared-folder deduplication, project copies and Claude Desktop copies. Other agents still sync, and a later sync tries again once the copy can be read. Merged onto main. #1449 added two callers of changedAt in skill_changed.go: - libraryHash doesn't remember a hash for a folder it couldn't wholly read. - editState says unknown for an agent's copy it couldn't wholly read, so an update from GitHub keeps the library's version aside. TestEditStateUnknownForAnUnreadableCopy covers editState. docs/subsystems/library.md keeps both new rules. Run: - go test -tags nogui ./internal/library/ and ./... (see the PR), go vet for darwin, linux with nogui, and windows, and gofmt. - With changedAt ignoring walk errors again, the four ScanError and EditState tests go red. - With editState ignoring the error, the new test goes red (edited true, known true). - Checked with Unix permissions on macOS only, not as root and not on Windows. |
||
|
|
3cf39f53d8 |
library: Pi and OmO write instructions into the user's own CLAUDE.md, not a new AGENTS.md that hides it
Pi reads one user-wide instructions file from its agent folder: AGENTS.override.md when it is there, else the first there is of AGENTS.md, AGENTS.MD, CLAUDE.md and CLAUDE.MD (loadContextFileFromDir in dist/core/resource-loader.js, @earendil-works/pi-coding-agent 1.2.0; the older @mariozechner/pi-coding-agent has the same order without the override). OmO's engine, @code-yeongyu/senpi 2026.10.12, has the same candidates (resource-loader.js:260) and loads the global one the same way (:314). The library always wrote ~/.pi/agent/AGENTS.md (and ~/.omo/agent/AGENTS.md), so a user who kept their instructions in CLAUDE.md there lost them to the new file from the next run on. Both targets, and their WSL ones, now pick the file with firstThere, as Prime Agent and StepCode already do, and name AGENTS.override.md as the Override the Instructions page shows when it has text. Not changed: omp (@oh-my-pi/pi-coding-agent 18.10.3) reads only its agent folder's AGENTS.md (src/discovery/builtin.ts:930), so it has no gap. dsh (@deepseek-ai/dsh 0.2.0-rc.2) keeps $DSH_HOME/AGENTS.md; its package has no loader of its own to check the order against, so it is unverified. Run: TestPiInstructionsFirstThere (new: no file -> AGENTS.md and the override path; a user's CLAUDE.md -> it is the target, SaveInstructions appends the block after "# Mine" and writes no AGENTS.md; an AGENTS.md there comes first again). Broken by hand three ways, each red: Pi back to a plain AGENTS.md, OmO back to a plain AGENTS.md, Pi's Override dropped. Full go test -tags nogui ./internal/library, gofmt -l, go vet on darwin, GOOS=linux -tags nogui and GOOS=windows, with pipefail, a private GOCACHE and a sandbox HOME. The WSL cases are not run: their target is only built with a distro running, which this Mac has none of. |
||
|
|
431707944e |
plugin, library: Check for updates asks GitHub with the GitHub token from Settings, and says when GitHub's rate limit is used up (#1942, bingqilinweimaotai)
What changed: a plugin installed from GitHub (github:owner/repo) is
checked by asking GitHub's API for its branch's commit (githubHead,
through fetchJSON). That request went without a token, so a token saved
in Settings → Network and sharing did nothing for it: the check stayed
at GitHub's 60 requests an hour for the whole address, which a shared
proxy exit uses up, and the row said only "<url>: 403 Forbidden".
- The token lookup, where a token may go and how a rate limit is told
move from internal/library into a new internal/ghtoken, shared by the
library and the plugin package (plugin can't import library).
The order is unchanged: Settings, then GITHUB_TOKEN, then GH_TOKEN.
- plugin's fetchJSON has a request to GitHub's API's host (githubAPI)
carry it, which covers the git plugins' check and the Plugins page's
topic search. Raw files, npm and every other host never get it, and
source.Do already sends nothing with Authorization to a mirror.
- An answer from GitHub's API that is a rate limit (429, or 403 with
X-RateLimit-Remaining 0, Retry-After or a rate-limit message) is a
ghtoken.Limited: the check's row has Why "limited" and Limited {until,
token} for the page, as the library's skill check already had. A 401
to a request with a token names which token was refused, never the
token.
What was run:
- TestGitPluginCheckCarriesGitHubToken (new, internal/plugin): asks with
no token / GH_TOKEN / GITHUB_TOKEN / Settings in that order of
precedence, a 403 rate limit with and without a token, a 429 with
Retry-After, a refused GH_TOKEN, and a raw-file host that must get no
Authorization. Broken by hand twice: with fetchJSON's Authorize removed
it fails "GH_TOKEN: GitHub's API was asked with Authorization "", want
"Bearer gh-env"" (and the other two sources); with the limit check
removed it fails with Why "registry", Limited nil, "403 Forbidden".
- go test -tags nogui -count=1 ./internal/library ./internal/plugin
(temp HOME, pinned caches): ok, the library's TestGitHubToken*,
TestGitHubRateLimitSaid among them.
- gofmt -l clean; go vet -tags nogui on darwin, GOOS=linux and
GOOS=windows for internal/plugin, library, ghtoken, gui: clean.
- Not tried against the real api.github.com (tests stay off the network).
|
||
|
|
43d8a5633f |
library: Library → Instructions lists Qoder, Command Code, CodeBuddy Code and Reasonix, each at the file its source reads
The rest of the audit after wongxy's Qwen Code report (
|
||
|
|
3d92b61d89 |
library: Library → Instructions lists Kimi Code, fx, Prime Agent, StepCode and jcode, each at the file its source reads
wongxy's report that Qwen Code was missing (
|
||
|
|
04ff9a775c |
library: the sync at start lets go after each agent's part, for the page's reads and changes to go first (#1624, Hipple)
magpie writes the library into the agents again at every start
(app.go's library.Sync). That ran as change(): one hold of the library's
lock through every agent's instructions, servers, hooks and skills. Every
read of the Library page (Read, Glance, ReadInstructions) and every change
waits on the same lock, so the first one or two operations after opening
magpie waited for the whole sync, and later ones didn't: Hipple's "the
slow ones are the first one or two after opening, then under 1s" on
0.1.1223, 11 agents and 88 skills on Windows.
Sync now runs the same steps change's sync does (syncSteps, shared by
both, so the order stays one), each under the lock on a fresh load and
saved after it. A read or change that comes meanwhile waits for one
agent's part, not the rest. What a step learnt of the skills (hashes,
copies found untouched) goes on to the next only while nothing else took
the lock between; the lock counts its holders for that. A change by the
page still syncs as before, in one hold.
Measured: with the library's sync made slow (looks slowed), a Read
started during it came in with 0 of 6 agents' skills given back; on the
old Sync it came in after all 6, every time.
Run:
- TestReadDuringSyncWaitsForOnePart: -race -count=5 green; with Sync put
back to change(nil) it fails 2 of 2 ("the read went after the whole
sync").
- go test ./internal/library/ green; ./internal/cli/ green after
rebasing onto
|
||
|
|
4794de398e |
library: a skill installs from a repository too big to download whole, by fetching only its skills' folders (#1941, Goalonez)
What changed: fetch still downloads a repository as one codeload
tarball first. When its files pass the 200 MB limit (untar's errTooBig),
it now falls back to fetchSkillFiles: one request to GitHub's API for
the repository's file list (git/trees?recursive=1), then every file in
a folder with a SKILL.md, from raw.githubusercontent.com, each checked
against the git hash the list gives. The repository's folders are made
empty, so candidates, origin, a probe of a subfolder and an update check
read the result as they read a whole download. The 200 MB limit now
applies to what is actually fetched: skills that are themselves over it
still say so. A private repository's files come from the API's
git/blobs with the Settings token (it never goes to raw). A repository
found too big is remembered for the run, so the install after its probe,
and update checks, don't download 150 MB again before falling back.
gitTree's entries gained mode, sha and size (named gitEntry).
Why: vectorize-io/hindsight keeps its skills (a few hundred KB) beside
an app; its tarball is 188 MB gzipped, 253 MB unpacked, so any skill
in it failed with "the repository is too big to install skills from".
What was run:
- Real repo, sandbox HOME, no token: on the old code ProbeSkills
("https://github.com/vectorize-io/hindsight") fails with "too big"
after 34s. With the fix it lists all 15 skills (skills/*, the
integrations' skills; .claude/skills hidden as before) in 32s, and
installing skills/hindsight-docs writes its 160 files, the same count
GitHub's tree lists.
- New TestSkillsFromATooBigRepository and
TestTooBigRepositoryChecksWhatArrives (httptest stand-ins for codeload,
the API and raw, laid out as hindsight is, paths and tree entries
from its real listing). With the fallback taken out both fail with
"the repository is too big to install skills from (over 200 MB)".
They check raw is never asked for a file outside a skill, codeload
is asked once across two probes, a file that doesn't match its hash
is refused, and skills over the limit themselves still error.
- go test -tags nogui ./internal/library (ok, 141s); -race -count=10
-run TooBig (ok); gofmt -l clean; go vet, GOOS=linux and
GOOS=windows go vet -tags nogui ./internal/library clean.
Not tried: a private repository over the limit against real GitHub
(covered only by reading: raw 404 -> git/blobs with the token).
|
||
|
|
e0a3b8c60a |
library, plugins: the RTK page and the Installed plugin list open without waiting on the package manager or the plugins' vendors (#1178)
The Library's RTK page took ~3.9s to open and the Plugins page's Installed list ~2.2s, every time. - Installed named each plugin's subscriptions from plugin.Providers, the whole providers RPC: each plugin in turn fetching its vendor's model list. The page uses only the names, which plugin.Cached keeps without starting the host (refreshed in the background when a sign-in or the plugins change). It now reads those: 2.2s to 13ms with seven plugins. A plugin added a moment ago has no names yet, so its row no longer claims it "signs in to nothing magpie can use" until the plugins have answered (plugin.Answered, the row's named). - ReadRTK waited up to 3s for GitHub and the package manager; winget show refreshes its sources and takes ~7.7s, so every open waited the full 3s and #1025's "waiting for winget" tag never came from it. GitHub stays on the first read; the package manager is asked in the background, its answer kept 6 hours as before. 3.9s to 1.6s. - ReadRTK and SetRTK detected the agents twice per call; once now. wizzy-yang's PR head 12342aa3, which conflicted with main: plugins.go keeps main's clash rows (plugin.Clashes) with the names from Cached, idName filled from Cached too; plugins.js keeps main's middleware/agent and clash branches ahead of the PR's named one; providers.go keeps main's Told and Settle beside the PR's Answered. Run: see the next commit. |
||
|
|
cefdbfd4e3 |
library: Library → Instructions lists Qwen Code and writes its ~/.qwen/QWEN.md (wongxy on Discord)
What: Qwen Code is a Library instructions target. magpie's block goes into
QWEN.md in Qwen's global folder ($QWEN_HOME, else ~/.qwen), after what the
user wrote there. When the user's settings.json sets context.fileName (a
name or a list, JSONC), the first non-empty name, trimmed, is used instead,
which is the file Qwen Code writes itself. Qwen joins ownFolder, so one in
a running WSL distro gets the same place under the distro's home.
Why: wongxy found that Qwen Code has a user-level instructions file but the
Library didn't list Qwen Code. Qwen Code had no Library target at all.
Source: QwenLM/qwen-code c5098a27: Storage.getGlobalQwenDir
(config/storage.ts, QWEN_HOME), getMemoryFilePaths (memory/
memoryDiscovery.ts, reads <global dir>/<each memory filename>),
memory-constants.ts (QWEN.md then AGENTS.md by default;
getCurrentMemoryFilename skips empty entries), packages/cli
config.ts (settings.context.fileName → setMemoryFilename).
Run:
- TestQwenInstructions (new): default ~/.qwen/QWEN.md, the user's text
kept, settings.json untouched, Takes("qwen-code"); QWEN_HOME with a JSONC
context.fileName list whose first entry is blank; a single name.
Broken by hand three ways, each FAIL: qwen case removed (no target),
context.fileName ignored (got qwen-home/QWEN.md), no trim/skip of empty
names (got the folder itself).
- Real Qwen Code 0.21.9 (Homebrew) in a sandbox HOME against a fake OpenAI
endpoint: `qwen -p hi` sent the model the magpie block from
~/.qwen/QWEN.md; with QWEN_HOME and context.fileName ["AGENTS.md"] it
sent the block from AGENTS.md and not the QWEN.md beside it. The files
were written in the format the test checks, not by a built magpie.
- go test -tags nogui ./internal/library, gofmt -l, go vet (darwin),
GOOS=linux go vet -tags nogui, GOOS=windows go vet on ./internal/library,
after rebasing on origin/main.
Not done: Qwen Code's MCP servers and skills are still not given by the
Library. No GUI strings changed (the page draws rows from the target data).
|
||
|
|
0f8cdc79f1 |
library, gui: Claude Desktop's own built-in skills are one row to keep, on the Skills tab, not five failed writes on every tab (#1896, SivanCola)
What changed: the screenshot on #1896 asked how to read a "duplicate MCP" box on the MCP page. It wasn't MCP servers: it was five "Claude Desktop already has a skill of its own called docx/frontend-design/pdf/pptx/xlsx" lines, Anthropic's built-in skills, shown as failed writes in English monospace, with a Try again that can never help, on every tab. - library: that problem is Own (the agent's own skill by the library's name), as other agents' are. UseLibrarySkills/KeepAgentSkills settle several names at once; Desktop's own skills are never set aside for the library's (they are its built-ins), only kept. - gui: the problems card shows each problem on its own tab and, on the others, a "{tab}: {n} more" button that opens it (no scroll). An agent's own skills are one row per agent ("Skills docx, pdf, ..."); Claude Desktop's row says it has its own and offers only Keep. With nothing failed the title says so and there is no Try again. API: skills/use-library and skills/keep-own take names[] beside name. Decision (product calls delegated): follow macOS's pattern of grouping related alerts with one action, rather than a list of errors. - i18n: 10 new strings in zh, zh-TW, ja, de. Run: - go test -tags nogui ./internal/library (474s, -timeout 40m at load ~90; the 10m default timed out in TestRTKUpgradeScript under that load) and ./internal/gui: ok. TestClaudeDesktopOwnSkillsKept broken by hand twice, red each time: Own dropped from the problem; Desktop's skills set aside by UseLibrarySkills. - GUI: own-skill, library-items, i18n-keys, gui-ja, gui-de, gui-zh-tw, panel-usage in Chromium and WebKit: all pass. With origin/main's library.js put back, 10 of own-skill/library-items' 20 fail. - gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on the touched packages: clean. Not tried with the reporter's real Claude Desktop; the fixture uses the skills-plugin manifest's creatorType "anthropic" entries. Reported-by: SivanCola |
||
|
|
6d7e5b53a0 |
library: the Library page opens without looking at the same folders thousands of times (#1771, oxyuan)
oxyuan's profile after v0.1.1214: every page opens at once but the
Library, ~1.3s a visit on Windows, 68% of it in library.resolve and the
read 97% system calls.
Cause: resolve follows links a part at a time, and for each part it
called linkTarget (an Lstat, and a Readlink for a link) and then Lstat'd
the same part again. One read of the page resolves a few hundred paths,
most of them many times over (each agent's skills folder for each skill,
CC Switch's folder and the source for each skill, home and the shared
folder once per skill), so the same ~150 folders were looked at
~10,000 times a read. On Windows each look is a cgocall.
Fix: while a read of the page (Read, Glance) holds the library's lock,
lookPart (linkmemo.go) keeps what each entry was found to be, one Lstat
and a Readlink for a link, for the rest of that read; linkTarget and
resolve both go through it, so the second Lstat is gone too. No change
runs while the read holds mu, so nothing the read keeps can be changed
by magpie under it. Nothing is kept past the read: the next visit looks
again, so a link made or moved on disk between visits shows. A look that
failed for another reason than "not there" is unknown and isn't kept. I
looked at a cache across visits keyed on the folders' times; checking it
costs one stat per folder on the way, the same as the memo's single look,
so it would save nothing over this.
Numbers, 11 agents, 40 skills from a linked folder given to all of them,
10 MCP servers (the package's sandbox, test binary built for each):
Windows 11 x64 box, median of 7:
Glance 10,144 looks, 116ms -> 117 looks, 26ms
Read 10,473 looks, 150ms -> 284 looks, 61ms
macOS (arm64), median of 7:
Glance 11,660 looks, 41ms -> 159 looks, 13ms
Read 12,040 looks, 53ms -> 360 looks, 28ms
The rest of a full Read (comparing the agents' copies, found skills)
runs without the lock, as before, and isn't memoized.
Tests: TestReadLooksAtEachFolderOnce (red with the memo taken out, and
with it outliving the read), TestLinkChangedBetweenVisitsShows (red with
a memo kept across visits), TestUnreadablePartIsLookedAtAgain (red when
an unknown look is kept).
Run: go test -tags nogui ./internal/library ./internal/gui (ok);
gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui
./internal/library; node --test internal/gui/tests/library-*.test.cjs,
chromium and webkit: 450/450 on the second full run. The first full run
had library-mcp-tool-switch red in WebKit (#1609, filed) and
library-chip-fan red once in Chromium under --test-concurrency=4; it
passed 3/3 alone and in the second full run. Not tried on oxyuan's
machine or with their library.
|
||
|
|
2d721f7f3d |
library, gui: the skills in your agents can be picked and removed together
wongxy on Discord: 资源库技能支持批量删除 (batch delete for the Library's skills). The library's own skills already have this: Select, then Remove…, since #1852 ( |
||
|
|
e528aeb3ce |
agent: DevEco Code, Huawei's OpenCode, as an agent (#1885)
foobra asked for DevEco Code (npm @deveco/deveco-code), Huawei's
HarmonyOS coding agent. It is OpenCode underneath, so it joins through
openCodeLike as MiMo Code did (
|
||
|
|
807cacd4a5 |
library: Pi's adapter isn't loaded under autoload:false or a "+" override (#1189)
|
||
|
|
a43fa6809b |
library: two changes in one millisecond each get a backup folder of their own (#1743)
liubing reported on #1743 that TestRemoveFoundEntryEveryFormat failed in a full run on Linux, the backup read holding another format's content, on an unmodified main too. The backup folder was named by the millisecond and taken as this change's own: a second change in the same millisecond wrote into the first's folder, its file kept under its folder's name since the first's held the name, and the copy at the name the change wrote was the other change's. The test's loop runs one change per format, all named config.json, and on a fast machine two land in one millisecond. A user's two quick changes did the same: the backup the second change named wasn't its own. freshBackup makes the folder with os.Mkdir, adding -2, -3... when the millisecond's is taken. pruneBackups' sort keeps them in order. Siblings checked: the skill backups (keepLibrarySkill, keepReplaced, setAside, carry's and RemoveSkills' aside) use per-skill paths under the stamp; setAside already steps past a taken name, and the others only collide on the same skill in the same millisecond, where move fails loudly rather than mixing; they are left as they were, since a folder each would split one change's skills over many folders. Run: go test -tags nogui ./internal/library/ ok on macOS and in Docker golang:1.26.8 GOTOOLCHAIN=local (also -count=30 of the two tests). The original red didn't show in Docker in 100 runs; it was reproduced by injecting a minute-wide stamp, which turned TestRemoveFoundEntryEveryFormat red on the old code and leaves it green with the fix. Broken by hand: os.Mkdir -> os.MkdirAll (no claim on the folder) turns TestBackupsInOneMillisecond red. |
||
|
|
d0e412e7a6 |
library: a checked MCP server's PWD is home too, and #1727's cwd test holds on macOS (#1727)
The previous commit starts the check's server in home. Its own test failed on macOS with that fix in: the child reported /private/var/folders/.../magpie-test-home-N and HOME was /var/folders/.../magpie-test-home-N, the same folder spelled through macOS's /var symlink, compared as strings. The test now compares the folders with os.SameFile. exec sets PWD to Dir by itself only when Env is nil, and the check sets Env, so the server ran in home with PWD still naming magpie's own folder; a shell-script server that reads $PWD would see the folder the fix moved it out of. The check now sets PWD=home with Dir (not on Windows, which doesn't use PWD, as exec does), before the server's own variables so one it sets still wins. The two subtests now give each run a home of its own (t.Setenv HOME and USERPROFILE) and move the process with t.Chdir, so the "needcwd" fake's ./logs goes with the test instead of staying in the package's shared test home, and nothing is left in another cwd when a subtest fails. The read-only-cwd subtest also checks that ./logs landed in home: Windows doesn't enforce a folder's read-only bit, so that is what makes it fail there without the fix. Run (sandbox HOME, private GOCACHE): TestCheckStdio -count=3 on macOS; the whole internal/library package. Broken by hand: without cmd.Dir both subtests fail (wrong folder; "mkdir logs: permission denied"); without the PWD line the cwd subtest fails on its PWD. On the Windows box (windows/amd64 test binary): TestCheckStdio passes, and without cmd.Dir both subtests fail there too (the server ran in the test's temp cwd, and ./logs wasn't in home). Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com> |
||
|
|
0154fe1135 |
library: start stdio MCP checks in the home directory (#1727)
A magpie started from a Windows shortcut keeps C:\Windows\system32 as its cwd. The Library check inherited that directory, so a server that writes into "." failed as exited (1) with no log. Agents start the same server from a project or home directory and succeed. Pin cmd.Dir to HOME for the check. |
||
|
|
1f0ff81dfc |
agent: Grok App's own route picked in magpie is taken, and Disconnect can put one back; a sync that isn't connected writes nothing (#1625)
Follow-up to fjrtdk's commit before this one, which this keeps: magpie never names itself as Grok App's route. - Set refused every own route (errGrokAppRoute) while Options still offered them, so the picker showed choices that only errored. It also broke Disconnect: when unwire leaves no route (Use set it to magpie, nothing stashed), Disconnect sets connect.was's route back through Set, got the error and stopped half done. An own route now takes magpie's channel out and is written as [models] default, the way picking another provider leaves magpie on other agents. That route can't be magpie, so the App's sign-in is never touched. - Sync ran rememberRoute/releaseRoute before checking for the channel, so every user with Grok App installed but not connected got stash entries. Now it returns before them unless the channel is there or the route is still magpie (an older magpie's takeover to put back). - Check again warns when the route is magpie and the channel is gone, which that commit dropped. - The notice uses the App's own labels (Settings › Account, Use; ja 「使う」, de Einstellungen › Konto / Verwenden, from grok-app 0.2.40's settings.nav.account and prov.useThis) and says a chat can pick magpie's models in its model picker (composer_prefs_set, which doesn't move the route). - Sibling: rtk init has no grok agent for Grok Build either (rtk 311ebcb agents: claude codex copilot cursor droid gemini hermes opencode pi trae vibe antigravity), so Grok Build is in rtkNoHook too. Run: gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows clean; go test ./internal/gateway ./internal/agent ./internal/library -count=1 pass; node --test i18n-keys and agent-notice-lang pass. Broken by hand: that commit's grokapp.go fails TestGrokAppOwnRouteStays, TestGrokAppDisconnectPutsTheRouteBack and TestGrokAppSyncUnconnected; dropping the Check branch fails TestGrokAppSyncUnconnected; dropping rtkNoHook["grok"] fails TestRTKNoHookGrokBuild. Not tried: the Grok App GUI itself; the config format and behaviour are from grok-app 0.2.40's source. Co-authored-by: fjrtdk <fjrtdk@gmail.com> |
||
|
|
ea3d480edf | agent: Grok App keeps its own route; magpie is a custom provider under Accounts, and the Library writes instructions, MCP and skills on agent-home (#1625) | ||
|
|
97dfed0f3e |
library: a site's well-known kit of skills is one group, by the lock's sourceBaseUrl (#1862)
WardLu (#1862): skills that `npx skills add` got from a site's /.well-known/agent-skills/ index were one group per skill. That was Feishu's lark-base, lark-doc and lark-sheets, and Fish Audio's fish-audio-api and fish-audio-sdk. readSkillLock grouped them by each skill's own sourceUrl (".../lark-base.tar.gz", ".../fish-audio-api/skill.md"). Now a lock entry with sourceType "well-known" is grouped by its sourceBaseUrl, read as host/path (wellKnownBase/siteOf): - the user, query and trailing slash are dropped, and the host is lower-cased without "www."; - so Feishu's three are open.feishu.cn/lark-cli/skills/regular and Fish Audio's two are docs.fish.audio; - a kit on the same host with a different base URL stays apart. Hosts are not merged. Fallbacks: - an older lock with no sourceBaseUrl takes the part of its sourceUrl before /.well-known/; - an entry with neither is grouped by its sourceUrl, as before. Two things this new key would otherwise get wrong: - Group again (RegroupSkills) tried every owner/repo-shaped key on GitHub. A kit one folder down a site (docs.example.com/kit) has that shape, so a key whose owner has a dot is skipped now. GitHub owners have no dot. - the heading's link sent a key with no path ("docs.fish.audio") to github.com. repoURL now opens it at https://docs.fish.audio. Run: - go test ./internal/library (all pass). New TestWellKnownKitGrouped uses the issue's base and source URLs for 3 Feishu + 2 Fish Audio skills, plus another kit on open.feishu.cn, an entry with no base, and a docs.example.com/kit kit that Group again must not fetch. - With the well-known branch disabled it fails, with the reporter's five one-skill groups. - With the dot check removed it fails on a GitHub fetch. - new TestWellKnownBase: a table of base and source forms. - skill-repo-groups.test.cjs now has a docs.fish.audio group that opens the site. It fails with origin/main's assets, which say "on GitHub". It and skill-regroup/skill-groups pass in chromium and webkit. - gofmt -l; go vet for darwin, linux -tags nogui and windows on internal/library. Not run: the reporter's real ~/.agents/.skill-lock.json. The issue quotes only these three fields of it. A row's own link still isn't its sourceUrl. |
||
|
|
e0ecf01610 |
mcpauth: an MCP server's own OAuth app is called back at Claude Code's http://localhost:<port>/callback, so an app made for Claude Code signs magpie in as it is (新v学员 on Discord)
What changed:
|
||
|
|
accc8c0903 |
library: an MCP server whose sign-in has no client registration (GitHub's) is signed in to as the user's own OAuth app (新v学员 on Discord)
What changed: GitHub's remote MCP server (api.githubcopilot.com/mcp/)
points to https://github.com/login/oauth, whose metadata has no
registration_endpoint, so magpie's sign-in, which always registered
itself (DCR), could never sign in to it. A server now carries an
optional OAuth app, `oauth: {clientId, clientSecret, callbackPort}`,
Claude Code's names for --client-id/--client-secret/--callback-port
(oauth.clientId in its .claude.json). mcpauth.StartWith signs in as
that app without registering: PKCE S256, a loopback callback
http://127.0.0.1:<port>/callback (any port unless callbackPort is set),
client_secret_post with a secret (basic only when the server lists
basic alone), "none" without one.
Without an app, a server with no registration endpoint now fails with
mcpauth.ErrNoRegistration, which says to make an OAuth app with the
vendor (GitHub's under Settings > Developer settings > OAuth Apps, with
http://127.0.0.1/callback) and give it under "OAuth app" in the editor.
The editor opens those fields with Client ID focused when that error
comes back. Filling them makes Sign in read "Save and sign in", and
Cancel asks before dropping them, as the earlier Cancel fix does.
GitHub answers token errors with 200 and {"error": ...}; tokenRequest
now reads a 2xx body with `error` as the error, and bad_refresh_token /
incorrect_client_credentials count as a dead sign-in as
invalid_grant/invalid_client do.
Secrets: the client secret sits in library.json like header and env
values. A backup without keys blanks it; WithSecrets puts this
computer's secret back only for the same client ID. No agent file is
given the app. The TUI editor, which doesn't show it, keeps it on save.
check() keeps it only on an HTTP server, requires a client ID when a
secret or port is given, and a port 1-65535.
Run (worktree at
|
||
|
|
eb1fab34c7 |
library, gateway: an MCP server magpie is signed in to no longer shows "Signed in" beside "needs sign-in" (新v学员 on Discord)
What was wrong, reproduced in a sandbox HOME with mcpauthtest's fake OAuth server behind a sandbox magpie: - A server no agent has is checked only on a click (#1597). Clicked before its sign-in it said "needs sign-in"; after signing in, the page rechecked only servers in use, so the row kept that result beside the new "Signed in" tag. The page now rechecks any server it has a result for once its key (sign-in included) changed. - The check sent magpie's token but never renewed it on a 401, so an expired access token with a good refresh token read "needs sign-in" beside "Signed in". checkHTTP now renews once and asks again, as the gateway's relay does. - A server that refuses even a just-renewed token was still "Signed in". mcpauth.Rejected marks such a sign-in run out, from the check and from the gateway's /mcp/<name> relay; ServerHealth.SignIn carries the status back (only for a server magpie has a sign-in record for) and the row's tag turns to "Sign-in ran out". mcpauthtest.Fake gains RefuseTokens for the last case. Run: - go test -tags nogui ./internal/mcpauth/... ./internal/library ./internal/gateway (HOME and GOCACHE in scratch): ok. - gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on the touched packages: clean. - New TestCheckRenewsMagpiesSignIn, TestCheckSaysSignInRanOut, TestMCPProxyRefusedAfterRenewalRunsOut. Broken by hand: renewal removed from checkHTTP, Rejected removed from the check, and from the gateway; each went red. - New mcp-signin-health.test.cjs: Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and 390 wide, 22/22. Each of the two library.js changes reverted on its own: 0/11 in Chromium. library-mcp-health, mcp-signin and i18n-keys pass. - Sandbox repro before and after with the fake server: both cases now show one tag; forget+revoke shows "Sign-in ran out · needs sign-in". Not run: a real vendor's server refusing a renewed token; the fake stands in for it. |
||
|
|
e08902e79d |
agent, library: Hermes Agent's folder is %LOCALAPPDATA%\hermes on Windows, and rtk's installer is told it (新v学员 on Discord)
新v学员 runs magpie on native Windows. Library -> RTK -> Hermes Agent
failed with "rtk's installer didn't add its hook to Hermes Agent:
Config: C:\Users\admin\AppData\Local\hermes\config.yaml ...". magpie
hard-coded ~/.hermes. Hermes' own default
(hermes_constants._get_platform_default_hermes_home) is
$LOCALAPPDATA\hermes on win32 (~/AppData/Local/hermes when LOCALAPPDATA
is empty) and ~/.hermes elsewhere, with $HERMES_HOME overriding it.
rtk 0.51's resolve_hermes_home knows only $HERMES_HOME and ~/.hermes,
on every OS.
What changed:
- appdir.HermesHome / HermesHomeIn / HermesDefaultIn: $HERMES_HOME,
else Hermes' per-OS default. This is the one place that resolves it.
- agent: hermesIn (Agents-page model wiring) and hermesProfiles use it
through place.hermesHome / hermesDefault. A WSL distro keeps
~/.hermes (Linux paths, Windows env not read). The Agents-page wiring
was wrong on native Windows too: without HERMES_HOME it wrote
%USERPROFILE%\.hermes\config.yaml, which Hermes never reads.
- sessions.HermesDir uses it, so Windows sessions are found.
- library/rtk: the hermes spec reads and writes the agent's own folder
(a.Dir), and rtkSpec.env passes HERMES_HOME=<that folder> to
`rtk init -g --agent hermes --auto-patch`.
- Tests resolve the folder through appdir instead of home/.hermes. New
TestHermesDefault/TestHermesHome (appdir), TestHermesFolder (agent:
Windows default, profiles under it, WSL unchanged), and
TestRTKHermesHome (library, a fake rtk that behaves like 0.51).
- docs/reference.md and docs/subsystems/library.md describe the
Windows folder and the env.
Run:
- gofmt -l clean. go vet ./... on darwin, GOOS=linux -tags nogui and
GOOS=windows.
- darwin: go test ./internal/appdir ./internal/library
./internal/sessions ./internal/agent ./internal/tui.
- TestRTKHermesHome against the old rtk.go fails with the reporter's
exact message ("didn't add its hook ... AppData/Local/hermes/
config.yaml"), and its default subtest fails with HERMES_HOME="".
- Windows box (cross-compiled test binaries, testenv sandbox
USERPROFILE/LOCALAPPDATA): appdir Hermes tests, agent
Hermes|Reseat|Effort (incl. TestHermesFolder) and library Hermes|RTK
pass. TestRTKHermesHome skips there (shell fake). The sessions binary
failed only TestHermesMessageVisibility, because its testdata wasn't
copied to the box.
- Real rtk.exe 0.51.0 on the Windows box: with
HERMES_HOME=<sandbox>\AppData\Local\hermes it wrote the plugin there
and patched that config.yaml. Without HERMES_HOME it wrote
C:\Users\<user>\.hermes, ignoring a sandbox USERPROFILE (rtk asks
Windows for the home folder). That confirms the cause and the fix.
The stray folder it made on the test box was removed.
Not run: real Hermes on Windows (no install, and running hermes under
a temp HERMES_HOME rewrites the live launcher); the GUI suite; the full
go test ./... ; the reporter's own machine.
|
||
|
|
8bfe33f1f4 |
agent, proc: where each command is on PATH is looked up once while its folders are unchanged, so a Windows page doesn't stat PATH per agent and per session (#1771)
oxyuan profiled every page's first load on Windows at seconds (4-7s), and Sessions, Usage → Sessions and Context at 26-45s: 96-98% of the samples were os.Stat under exec.LookPath and proc.FindTool. A failed lookup stats every PATHEXT candidate in every PATH folder (111ms there), and the pages asked once per known agent (Detected → binAt) and once per Pi session (sessions.carries → ompThere) on every request. proc.Look (new, look.go) is exec.LookPath with its answers kept. The proc.LookPath that |
||
|
|
e3a497d7a2 |
library, gui: Hooks are a fifth Library category, kept once and written into each ticked agent's own hooks file (#1790, AllenReder)
What: the Library page has a Hooks tab beside Instructions, MCP, Skills
and RTK. A hook is a command, an event, an optional tool filter, a
timeout and the agents ticked for it. magpie writes it into each agent in
that agent's own file and shape:
Claude Code <claude dir>/settings.json hooks.<Event>[{matcher, hooks[]}]
Codex <codex home>/hooks.json same shape
Gemini CLI ~/.gemini/settings.json same shape, timeout in ms
Cursor ~/.cursor/hooks.json flat entries, version 1
Portable events (turn end, after a tool, before a tool, prompt sent,
session start) map to each agent's own name; "shell"/"edit" map to each
agent's own tool names. An agent's own event (codex:PermissionRequest,
cursor:afterFileEdit, ...) is offered too and given to that agent only.
Rows have agent chips (All first), Select + bar, and Remove all, like
skills and servers. An agent that can't take a hook has its chip greyed
with the reason: every agent but those four ("has no hooks magpie can
write"), an agent in WSL (not yet), and another agent for a native event.
The page also says when an agent has all hooks turned off
(disableAllHooks, hooksConfig.enabled=false, [features] hooks=false).
Why these choices (product call delegated to us): the four agents are
the ones with a documented, file-based command-hook API whose events line
up; others (OpenCode's JS plugins, dsh, ...) have no comparable file, so
they're named as unavailable rather than half-supported. Removal is
exact: Applied.Hooks records each entry as written (canonical JSON), and
only an entry still exactly as written is taken out; one the user edited
is theirs, and their own hooks beside it are never touched. A hooks file
that doesn't parse is a problem, never treated as empty or written over.
Codex keeps trust per hook in config.toml keyed by group position, so
taking a group out re-keys the user's trust for the groups after it
(codexRekey) instead of silently untrusting them. Carried bundles
(backup/WebDAV/S3) don't carry hooks in this first version.
Run:
- go test ./internal/library ./internal/gui (sandbox HOME): pass. New
hooks_test.go: each agent's shape; the user's edited entry stays and is
no longer recorded; an unparseable file is left alone and reported;
Codex trust moves with its groups; native events/unavailable agents;
hooks-off reported.
- library-hooks.test.cjs: 12/12 in chromium and webkit, at 440px, in en,
zh, zh-TW, ja, de; against the old library.js it fails (timeouts on the
missing tab). All 52 new strings translated in the 4 languages.
- library-loading.test.cjs expects the Hooks tab in its tab lists
(it failed on this change before; 6/6 now).
- Every library-*/skill-* GUI test in chromium and webkit: all pass but
WebKit timeouts in library-mcp-tool-switch/library-mcp-tools, which fail
the same on origin/main
|
||
|
|
d7a1fcd41a |
library, gui: a skill pack added a while ago is grouped whole, and the Skills head has Group again (White Immortal on Discord)
Of mattpocock/skills' 38 skills only 20 were grouped with the repository on the Library page; the rest sat under On this computer, and nothing could trace them again. Cause: installing from a repository again (noteFrom) grouped a library skill with it only when its SKILL.md was byte for byte the repository's. A pack added a while ago is mostly older copies: of the copies at mattpocock/skills 3cca18b3 (2026-09-04), 18 of 37 match HEAD; at 8b78b531 (2026-08-13) 2 of 35. The GUI's parts draw all 38 when the data has them (checked with a Playwright run against 38 skills in the repo's real folder layout, github, lock-traced and mixed paths, both engines). noteFrom now also notes a skill traced to nowhere by a name the repository has, when the library has others from that repository (same file, or traced there already). A skill traced to another repository, and a same-named skill when the library has nothing from there, are left alone. RegroupSkills (POST /api/library/skills/regroup) fetches each GitHub repository the skills are traced to and runs the same; it fails only when no repository could be fetched. The Skills head has Group again (busy while it runs, status says how many joined), en/zh/zh-TW/ja/de. Run: TestRegroupOlderCopies (fails with the name match off: edited and later stay ungrouped), TestInstallAgainNotesFrom, TestSkillRepoTraced; skill-regroup.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de at 1100 and 440 wide (red on the old assets: no Group again); skill-parts and i18n-keys pass; go test -tags nogui ./internal/library ./internal/gui ok; gofmt, go vet. Not tried against the reporter's library or real GitHub. |
||
|
|
bfaedf1830 |
gui, profile: the profile in use is ticked and named on the panel's Profiles button, not a count read as its name (superhtoooth on X)
superhtoooth (macOS): 保存方案设置了方案名字,但是应用方案没有用这个名字。
menu 里面变成了方案 1,方案 2。而且在应用里面没有显示当前使用的方案.
The bug: the tray panel's Profiles button showed the number of saved
profiles next to its label ("方案" + "2"), which reads as a profile
named 方案 2. Profiles were saved and applied under the typed name all
along; nothing anywhere said which profile was in use.
What changed:
- profile.InUse: a profile is in use while applying it would change
nothing on this computer - every detected agent's saved field is as
the profile has it (compared with the same renamed-ref spelling Apply
writes), its model lists are held (provider.ModelListsHeld, a dry run
of SetModelLists via the extracted putModelLists) and its library
setup is as saved (library.Holds, the mirror of Restore). A profile
that touches no agent here is not in use.
- Why not "last applied": that would stay ticked after the user changes
a model by hand, a tick that lies. With this definition a profile
saved from the current setup is in use at once, a hand change clears
the tick, and applying puts it back. Two identical profiles are both
ticked; the button names the first.
- GUI: /api/state carries inUse. The panel's button names the profile
in use (a pop-up button showing what is picked), else counts them as
before; its chip gets a check mark and aria-current, in panel and
window; the chip's tooltip and its details say "In use" (string
already in every language). CLI `magpie profiles` marks it, the TUI
notes "in use". Docs (reference, start en/zh/ja) say so.
What was run:
- go test ./internal/profile (new TestProfileInUse: save, hand change,
apply, hidden model list, library instructions, absent agents) and
./internal/gui (new TestStateProfileInUse through the HTTP handler),
scratch HOME. Broken by hand: field compare, ModelListsHeld,
library.Holds and state's InUse each turned a test red.
- go test -tags nogui ./... in a scratch HOME (the four slow packages
rerun with -timeout 40m under load ~45).
- GUI: new profile-in-use.test.cjs (reporter's steps in the panel at
360px, every language, plus the window) and panel-profiles,
profile-confirm, profile-details, old-webkit, i18n-keys, gui-zh-tw,
gui-ja, gui-de in chromium and webkit: all pass. Old app.js fails the
new test.
- Real CLI in a sandbox HOME with a codex config: save/use/profiles
show the mark, and it goes after a hand edit.
- gofmt; go vet darwin, linux (nogui), windows.
Not tried: the real tray app with real agents, and Windows/Linux at
runtime.
|
||
|
|
9300b2a126 |
library: a visit to the Library no longer parses Codex's config.toml again when it hasn't changed (#1665, laowangba233)
laowangba233 saw magpie's CPU jump on each switch to a Library page. Profiled in a sandbox HOME with a copy of a real Codex config.toml (1.5 MB, 10,927 [projects."<dir>"] tables, one per folder Codex was ever opened in): 69% of GET /api/library's CPU was go-toml parsing that file through foundServersOf -> mcpFile.entries. go-toml's SeenTracker looks each table name up among every sibling before it, so the parse is quadratic in the number of projects, ~0.2 s of CPU each time, and the Library parsed it on every visit (edit.Read already kept the bytes, not the parse). mcpFile.entries now keeps what it parsed through filememo, keyed by the file's size and time (and, written in the last two seconds, its bytes), and hands each caller a deep copy of the servers it found, so a caller changing an entry doesn't change the next caller's. The RTK page's codexSandbox (Windows, Codex with rtk on) parsed the same file the same way on each visit and is kept the same way. Measured (sandbox HOME, the copied config and library, macOS, 10 warm GET /api/library after start): 2.67 s of CPU before, 0.55 s after (~0.27 s -> ~0.055 s a visit). TestCodexEntriesParsedOncePerChange: a config with 2000 projects read four times parses once, a caller's change to the entries doesn't reach the next, a change to the file is read, a file gone is no servers. It fails with the memo undone (entries parsing edit.Read's bytes each time) and with the copy undone. go test -tags nogui ./internal/library ./internal/filememo pass; TestCodexSandbox passes. The RTK memo has no test of its own (Windows only); filememo's own tests cover the keep. |
||
|
|
f57dc9610b |
library, gui: an instruction set made, saved or removed writes only the instructions, and the page holds its buttons while it does (#1624, Hipple)
On Windows 11 the Library's Instructions tab took 30s+ to show, and each instruction made, saved or removed took about a minute with nothing on the page to say so; a second click made a second set or removed twice. What an instruction change cost: - SaveInstructions and ImportInstructions went through change(), which gives every agent its MCP servers and skills again too (takeEdits and syncSkills look through every skill folder, and the projects), and the API then answered with a whole library.Read, which reads every agent's skill folders through again (foundSkills, behind: minutes on a machine with many skills, #541). - Every read of the library found the agents (Targets: every agent's folders, WSL too) three times: ReadInstructions, readView, and foundServers. Now: - library: changeInstructions writes only the instructions into the agents (with backups as before); readView finds the agents once and passes them to instructionsView and foundServersOf. ReadInstructions stays for the TUI. - gui: an instructions/* action answers {part: "instructions", instructions, result, problems}; the problems the last change had with servers and skills stay, those with the instructions are the new change's. - library.js change(): one change at a time; while one is out the page's (and the Library dialog's) buttons are disabled, the page is aria-busy, the button pressed says "Saving…" and so does the status. An answer with part "instructions" is merged into the page's library. Timed on the Windows test box (sandbox profile, 1 agent, 80 skills, copy mode): an instruction create was ~170ms + a ~460ms Read, now ~80ms + a ~70ms instructions read; Glance 350 -> 200ms, Read 480 -> 320ms. The 30s/1min the reporter sees wasn't reproduced there. Tests (each fails on the old code): - TestInstructionChangeWritesOnlyInstructions: a server taken out of codex's config by hand stays out through instruction create, switch, save and remove, and comes back with a server change. - TestInstructionChangeAnswersInstructions: the instructions answer and the problems kept. - library-instr-busy.test.cjs: a double click on Add sends one create, every page button is disabled and the pressed one says Saving… while the answer is held, the page keeps the rest of the library after an instructions-only answer; the sure Remove double-clicked sends one. Chromium and WebKit, en/zh/zh-TW/ja/de. Also run: go test ./internal/library ./internal/gui ./internal/tui; gofmt; GOOS=linux and windows go vet; every library*.test.cjs plus the 30 other GUI tests that reach the Library, Chromium and WebKit: all pass but library-mcp-tool-switch in WebKit, which fails the same alone on origin/main (#1609), and mobile-web's desktop-vs-main check, which needs a git checkout the scratch copy it ran in hadn't. |
||
|
|
234b2399c4 |
library: an MCP server an agent has of its own can be removed from it, its files backed up first (#1618, sxwedo)
A server listed under Library > MCP servers > "In your agents" could only be brought into the library. As a found skill can (#1303), it can now be taken out of every agent that has it, without bringing it in. - library.RemoveFoundServer(name): every agent the server was found in has it deleted from its MCP settings by the same per-format code the library writes with (JSON/JSONC paths, Codex and Grok TOML, Goose and Hermes YAML, dsh profiles, the Also files and the Extra files an agent still reads, Pi's old mcp-adapter.json among them). The user's other keys, comments and servers stay. - Every file it touches is copied to magpie's backups (res.Backup) before it is written; a file that doesn't hold the server isn't. - Every file is read before any is written: one that doesn't parse stops the removal with nothing changed (a failed read is unknown, not empty). The file is read back after, and a server still there is an error, not "removed". - A server the agent's app puts there itself (Own, e.g. Codex's node_repl) is refused: taking it out wouldn't last. The GUI doesn't list those, and the TUI says so. - An agent with a different server by that name (Others) is left alone. - GUI: a trash beside Bring in asks first, naming the agents, that each file goes to the backups and that the other server by that name stays; posts servers/remove-found. Strings in zh, zh-TW, ja, de. - TUI: d twice on a found-mcp row, as on a found skill. What was run: - go test ./internal/library ./internal/tui ./internal/gui (sandbox HOME). New tests: TestRemoveFoundServer (Claude/Codex/OpenCode files with user keys, comments and other servers that must survive; Gemini with a different one and an unparseable Cursor file left byte-identical), ...Unreadable, ...Own, ...EveryAgent (claude, codex, gemini, opencode, mimocode, pi, goose, cursor, copilot, crush, dsh), TestRemoveFoundEntryEveryFormat (every format, with backups), TestRemoveFoundEntryPiExtra; tui's d-twice found-mcp case keeps the rest of .claude.json. - Broken by hand, each went red: no backup, Extra file skipped, Extra unreadable read as empty (mcp.json must stay unwritten), no delete, Own allowed; GUI trash posting without the confirm. The main file unreadable read as empty stays green on purpose: nothing is written and the read-back still refuses. - GUI: remove-found-server.test.cjs (new), remove-found-skill, i18n-keys, every library-*.test.cjs, view-no-sideways, mobile-web, by-agent in Chromium and WebKit. library-mcp-tool-switch fails in WebKit with or without this change, and also when run alone (#1609); it has no found servers. - gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on the three packages. Not tried against a real agent's live config. |
||
|
|
8902ec2179 |
library: a server that admits only the apps it lists says so at Sign in, and leaves the sign-in to each agent (#1619, Xichun123)
Figma's remote MCP server (mcp.figma.com/mcp) allow-lists clients by the client_name they register with: its registration endpoint (api.figma.com/v1/oauth/mcp/register) answered a plain registration named Magpie 403 with the bare body "Forbidden" (tried once, by hand). The Library's Sign in then showed "registering magpie with the server's sign-in failed (403): Forbidden", which reads as a fault to retry. magpie doesn't register under another client's name. A 401 or 403 from registration is now mcpauth.ErrClientRefused: the server's sign-in admits only the apps it lists and turned magpie away; the agents given it still have the server's own address, so each signs in itself (in Claude Code, /mcp). That address is what they already get while magpie isn't signed in (library.through), so Claude Code, a client Figma lists, signs in there with its own registration. The message is translated into zh, zh-TW, ja and de. Other registration failures keep their status and body. docs/subsystems/library.md says it. Run: TestSignInRefusedByAnAllowListLeavesItToTheAgents (new, through library.SignInServer against mcpauthtest serving Figma's 403 bytes) fails without the change with the reporter's exact "registering magpie with the server's sign-in failed (403): Forbidden", passes with it, and checks claude, codex and cursor keep the server's own URL. mcp-signin.test.cjs (Figma case added) passes in Chromium and WebKit, en and zh; gui-ja, gui-de, gui-zh-tw and i18n-keys pass. go test -tags nogui ./internal/mcpauth/... ./internal/library/ ./internal/gui/ ok under a temp HOME; gofmt -l clean; GOOS=linux and GOOS=windows go vet ok. Not tried: Claude Code's own /mcp sign-in to Figma (no Figma account here). |
||
|
|
b7a926e9aa |
library, gui: a market search one source of which didn't answer says which, over what the rest found, not a failed search; a 503 is asked once more (#1589, Ti800)
Ti800 searched the Library's Discover for "prototype" and saw the amber
error "couldn't search skills.sh: www.skills.sh answered 503 Service
Unavailable" over two results. The cause was neither a stale request
(fetchMarket already drops an answer whose seq is old, results and error
alike) nor an error left over from an earlier search: MarketSkills matches
skills.sh's most-installed list (front page, cached) and magpie's picks
itself, then asks skills.sh's search. The search answered 503; the two
cards were the most-installed list's matches, and the handler sent both
the list and the search's error, which the page drew as a failed search.
- library: the search's failure is a SearchError naming its source
(skills.sh, the MCP Registry); get() asks once more after a 503, after
a one-second pause (one extra try, nothing else retried).
- gui: /api/library/market/{skills,servers} add failed and cause beside
error. With results, the page says in a muted line with an amber dot
that skills.sh's search (or the MCP Registry) didn't answer and why, and
that these are only the matches among magpie's picks and the most
installed (or magpie's featured servers). With no results the error bar
is as before. Strings in zh, zh-TW, ja, de.
Siblings: the MCP market has the same shape (featured + registry) and gets
the same notice. The Plugins page's npm search already shows its error in
the "On npm" section only, beside the market's own list, keyed by query.
Tests:
- internal/library TestSkillsSearch503 (httptest fake skills.sh): 503 then
200 gives the search's results and no error; 503 every time gives the
popular match and a SearchError for skills.sh, searched exactly twice.
With the retry taken out it fails: "after one 503:
[mattpocock/skills/prototype] couldn't search skills.sh: … 503 …, 1
searches".
- internal/gui TestMarketOfNamesTheFailedSource.
- gui tests market-partial.test.cjs: the reporter's case (two results +
skills.sh 503), nothing found (error kept), an older search's 503
answered 1.2s after a newer search's results (nothing changes), and the
MCP Registry case; Chromium and WebKit, en/zh/zh-TW/ja/de, 520px wide:
10/10. With the new branch disabled, 5/5 Chromium fail with "the partial
list is shown as a failed search". market-*.test.cjs and
library-discover-jump: 114/114.
- go test ./internal/library ./internal/gui, gofmt -l, GOOS=linux and
GOOS=windows go vet -tags nogui on both packages; full suite in the
push record.
Not tried against the real skills.sh (it answers 200 now); the fake
answers 503 as the report's text says.
|
||
|
|
f1001ec991 |
library, gui: each of an MCP server's tools has a switch, and the agents that can leave one out are told to (nf1qaz2w on Discord)
nf1qaz2w asked to turn single tools of a Library MCP server on and off.
|
||
|
|
6f4fb883eb |
library, gui: an MCP server's tools are listed by name and description (nf1qaz2w on Discord)
nf1qaz2w on Discord: "mcp现在好像只能看到有几个工具,看不到具体的工具名和描述等, 能否支持下?" The Library's MCP check kept only len(tools) from tools/list. What changed: - internal/library/mcp_check.go: ServerHealth carries ToolList (json "toolList"): each tool's name and the first paragraph of its description, whitespace collapsed and cut at 500 runes (a tool with only a title gets the title); names cut at 128; at most 500 tools kept while Tools still counts all. tools/list is now asked through listTools, shared by the stdio, streamable HTTP and SSE checks: it follows nextCursor up to 10 pages, each page with a step budget of its own (the #1467 per-step timeout), and a page after the first that is refused ends the list there. Before, nextCursor was ignored and only the first page counted. - internal/gui/assets/library.js/.css: a server whose check listed tools shows a chevron on its "N tools" status; a click opens the list under the row (name in the code font, description under it, "N more not shown" when magpie kept fewer than the server has, and Check again). Clicking the count again shuts it. A server with no listed tools keeps the old click, which checks it again. The list stays while it is checked again, no editor opens, no left-border stripe, no native select. The click guard keeps the clicked status in place (a centred row gives up 1px as it grows). - i18n: "Click to see them", "Click to hide them", "{n} more not shown" in zh, zh-TW, ja, de. - docs/subsystems/library.md: the check's tool list and paging. There is no CLI/TUI output of a server's check, so nothing changed there. What was run: - go test ./internal/library: TestCheckKeepsToolNames runs the check on the tools/list reply @modelcontextprotocol/server-filesystem really gave (captured with npx, testdata/filesystem-tools-list.json, 14 tools, the longest description 457 chars); TestCheckToolPages (no description, title only, a 1000-char description cut, two pages by nextCursor, the JSON the page reads); TestCheckToolPagesEnd (a server that pages forever is asked 10 times). With the list not kept and paging off, the first two fail: "got {State:ok Tools:14 ToolList:[] ...}, want ok with 14 tools, each listed" and "...Tools:3 ToolList:[]..., want ok with 4 tools over 2 pages". - GUI: internal/gui/tests/library-mcp-tools.test.cjs, Chromium and WebKit, en/zh/zh-TW/ja/de, at 980 and 420 wide: 20/20 pass; against the old library.js it fails. library-*.test.cjs, mcp-signin, search-mcp, i18n-keys and click-scroll in both engines: 377/377 pass. - gofmt -l (nothing), go vet / GOOS=linux / GOOS=windows go vet -tags nogui on internal/library and internal/gui, go build for darwin, linux and windows (nogui). Full go test -tags nogui ./... under the queue lock: every package ok but internal/provider, where TestClaudeSavedAccountDir failed "sign-in never finished" (waitDone's 2s bound on a fake claude process under full-suite load); alone it passes 5/5. Not touched here. |
||
|
|
36839d503a |
agent: Claude Code kept in CLAUDE_CONFIG_DIR is listed on the Agents page, and a model picked for it goes to the settings.json it reads (#1482, edussss)
The Agents page looked for ~/.claude/settings.json alone, while the
sessions, the Library, the sign-in, the account import and the gateway's
Claude subscription all read $CLAUDE_CONFIG_DIR. A Claude Code whose
folder is elsewhere (CLAUDE_CONFIG_DIR set) wasn't listed when its CLI
wasn't on magpie's PATH either, and a pick, a tune and the gateway's
stand-in went to a ~/.claude it never reads. The sibling of CODEX_HOME
(
|
||
|
|
26816de2f9 |
library, agentplug: an agent a plugin adds is given the Library's instructions, MCP servers and skills where its agent.library says (AlmarionAI on X)
Agent plugins wired models and keys only: library.targetOf had no case
for them, so the Library's instructions, MCP servers and skills never
reached an agent a plugin adds, while the announcement said the
Library carries over.
An agent export can now say
library: { instructions, mcp, mcpFormat, skills }
each a path (~ and $VAR expanded, as config is). mcpFormat names the
agent whose MCP file it is shaped like (agentplug.MCPFormats: claude,
codex, gemini, opencode, cursor, zed, ... 18 of the library's
mcpFormats). A format outside the list, or an mcp without one, keeps
the plugin from loading. library.pluginTarget makes such an agent a
Target, so it is written as any agent is: magpie's marker block in the
instructions file, servers merged beside the user's own (their fields
kept), skills linked or copied, Applied recording only magpie's part,
backups kept. Takes refuses a place the plugin doesn't name, and says
which agent.library key would give it.
Docs: docs/subsystems/library.md and agent-wiring.md; plugins.html
(en, zh, ja) gets the library field and what magpie does with it.
Run:
- internal/library/agent_plugin_test.go: TestPluginAgentGetsTheLibrary,
TestPluginAgentWithoutAPlaceIsRefused, TestPluginAgentMCPFormat,
TestPluginMCPFormatsAreWritten. With targetOf's plugin case and the
check() validation taken out by hand, the first three go red.
- e2e: a nogui build in a scratchpad HOME (env -i, no live configs),
`magpie plugin add` of a throwaway toy agent plugin; `library
instructions set/agents`, `library mcp add/rm` wrote and took back
only magpie's block and server, the user's "mine" server, its "note"
field and other keys kept, backups made; with mcp dropped from the
plugin, `library mcp add ... agents=toy` is refused naming
agent.library.mcp.
- go test -tags nogui ./... (one unrelated FIFO flake in internal/agent,
fixed in the commit before), gofmt -l clean, go vet for GOOS=linux
and GOOS=windows clean. No GUI code changed.
|
||
|
|
6876125a19 |
agent, library: an npm agent or winget's RTK under Program Files updates after Windows' administrator prompt, and says why when it can't (新v学员 on Discord)
On Windows the official Node.js installer leaves npm's global prefix at C:\Program Files\nodejs, which only an administrator can change. magpie runs as the user, and writable() on Windows always said true, so the Agents page offered the update and npm failed with EPERM (mkdir ...\node_modules\@scope), with nothing saying why. The same user then reported RTK and other actions needing elevation all failing, and asked for a setting to run magpie as administrator. There is no such setting: an elevated magpie would write the agents' configs as the administrator, couldn't start with Windows without a UAC prompt at each login, and widens what can go wrong. Instead each action that needs an administrator asks Windows for one, alone. - agent: writable() on Windows makes and removes a file in the folder (update.Writable) instead of always saying yes. An npm CLI in a folder the user can't write in is still offered on Windows, marked Admin, and its update runs through update.RunElevated, never as the user. Elsewhere (/usr/lib, would want sudo) nothing is offered, as before. - update: RunElevated (Windows) runs the command through ShellExecuteEx "runas" on a .cmd script that sets the env that differs from an elevated process's own plus PATH, cds to the folder, and sends output to a log read back; the exit code comes from GetExitCodeProcess (a non-zero one is update.ExitError, for its code). A declined prompt is ErrCanceled; no prompt to be had is the new ErrNoAdmin. Other systems: CanRunElevated false. - library: RTK installed by winget for every user (under Program Files) is upgraded through the same prompt when only an administrator can change rtk's folder; the card's Upgrade title says Windows asks first. Install, and an upgrade whose folder looked writable, run winget as the user and go through the prompt only when winget answers 0x8A150019 (command requires admin). winget's codes from the elevated run are read as before (0x8A15002B: no newer RTK, no failure). - A declined or impossible prompt is agent.AdminError (Via npm or winget); the GUI answers it with code needs_admin and says, in the reader's language, what needs an administrator and what to do: try again and allow it, or run the command in a terminal opened as administrator, and for npm also moving npm's prefix (npm config set prefix "%APPDATA%\npm") and reinstalling. - Install another agent: its npm commands note when npm's prefix (npm prefix -g, memoized) is such a folder. - Checked, not changed: autostart uses HKCU's Run key, no admin needed; magpie never runs npm uninstall; plugins install into magpie's own folder with bun; agent CLIs update only on a click; RTK's PATH fix writes HKCU's Environment and rtk init -g the user's own agent folders; the library's only other exec is the MCP server check. Run: - go test -tags nogui ./internal/agent ./internal/update ./internal/library (and the full ./... under the lock). TestNPMUpdateNeedsAdmin fails with the admin branch removed and with runAdmin bypassed; TestRTKUpgradeAsksForAdmin and TestRTKInstallRetriesAsAdmin fail with runRTKInstaller never elevating (checked by hand). - gofmt -l; go vet (darwin), GOOS=linux and GOOS=windows go vet. - GUI, Chromium and WebKit: cli-update-admin (en, zh), library-rtk-admin (en, zh exact; ja, de, zh-TW translated, no npm advice; fails with the old Upgrade title), library-rtk-upgrade/-path/-nohook/-gain, gui-ja, gui-de, gui-zh-tw, cli-update, i18n-keys. - Windows box (10.0.0.132): TestWritableSeesDeniedFolder passes, and fails on the old writable(). A portable Node 22 with Program Files' ACL (Users RX, Administrators F): as a non-elevated token (runas /trustlevel:0x20000) npm install -g failed with the reporter's EPERM, Writable said false, and dsh's CLI() said Via npm, Admin true; elevated it said Admin false. RunElevated from the elevated ssh session installed @deepseek-ai/dsh into that folder for real, and a missing version came back as exit status 1 with npm's ETARGET output. The library's RTK tests ran there too (TestRTKInstallRetriesAsAdmin passes; the shell-fake ones skip on Windows). - Not tried: the UAC prompt itself, allowing or declining it, as nobody sits at the box; the ErrNoAdmin path on a real system; a real machine-scope winget RTK (none is installed on the box). |
||
|
|
f04792f906 |
icon: remote icons are fetched through usemagpie.ai/api/icon, so their hosts never see the user's IP
A plugin's package.json icon, an import link's icon= and the library's market icons sit on hosts their authors pick. magpie fetched each straight from there, so an author could log the IP of everyone who opened Discover or the library. The owner asked for icons to keep showing without that. - site/worker.js: /api/icon?url=<https URL> fetches the picture from Cloudflare with only Accept: image/* and its own User-Agent, follows redirects, caps it at 1 MB (the app's MaxIcon), passes on only PNG, JPEG, GIF, WebP, ICO or SVG (by bytes, as StoreIcon), and counts and keeps nothing. It refuses http, userinfo, a non-443 port and usemagpie.ai itself; 404s are cached 5 minutes, 5xx not at all. - internal/iconproxy: URL(u) is the proxied address (MAGPIE_ICON_PROXY for tests); a picture already on usemagpie.ai is asked for as it is. - provider.FetchIcon (plugin, import link and partner icons) and library.fetchImage (market icons, avatars) fetch through it. The import link's checks (https, public host) still come first; there is no direct fallback. provider.FaviconFor still reads the user's own provider's site directly: they already send it their requests. - Privacy text in README en/zh, docs/reference.md and site docs start/import in en/zh/ja says so. Ran: - node --test site/*.test.mjs: 28 pass. The new test asks with Cookie, UA, X-Forwarded-For and CF-Connecting-IP and checks only accept and user-agent go upstream; 415/413/502/400 cases; its fetch stub throws instead of reaching the network. With the usemagpie.ai refusal removed by hand it goes red (27/1). - TestFetchIconGoesThroughTheProxy and TestIconGoesThroughTheProxy (author host is .invalid; an httptest server stands in for the proxy): with the proxy taken out by hand both go red (provider: lookup author.invalid; library: the proxy was never asked), green restored. - go test ./internal/iconproxy ./internal/provider ./internal/library ./internal/gui: ok. gofmt -l clean; go vet darwin (those four), linux (iconproxy, provider, library), windows (all four): clean. |
||
|
|
da77e825ff |
library: RTK installed with winget --location into any folder is upgraded with winget (#1527, whyIMBA)
rtkUpgrader took rtk for winget's only when its path had "/winget/" in
it. winget install --location "D:\codes\tools\rtk" puts rtk.exe in that
folder, and the link winget adds in WinGet\Links points there, so the
path once resolved had no "winget" in it: no Upgrade on the card, and
"magpie library rtk upgrade" said magpie can't tell how rtk was
installed, though winget upgrade --id rtk-ai.rtk works on it.
Now, on Windows, after the brew/winget-folder/cargo checks:
- the path heuristic also looks at the path rtk was found at, not only
the one its link leads to (WinGet\Links\rtk.exe);
- otherwise winget's own record decides: the entry winget writes for a
portable package under HKCU/HKLM ...\Uninstall
(rtk-ai.rtk_<source>, WinGetPackageIdentifier rtk-ai.rtk) names its
InstallLocation; rtk is winget's when it is in that folder, so an
rtk.exe copied elsewhere by hand isn't taken for winget's;
- with no record to read, winget list --id rtk-ai.rtk --exact is asked
through proc with a 15s timeout. The answer is kept 10 minutes per
rtk path, so the Library card doesn't run winget each time it is
drawn.
Siblings checked: rtkUpgrader is the only Library upgrader with a winget
path heuristic; its brew case matches /Cellar/rtk/, which every Homebrew
prefix has. Agents' CLI updates (internal/agent/cliupdate.go) and
magpie's own update know Homebrew by its Cellar only, and have no
winget, scoop or choco path rules.
Run:
- go test -tags nogui ./internal/library (sandbox HOME). New
rtk_winget_test.go with a fake winget (its list output from the test
box): the reporter's folder via the record (no winget run), a record
for another folder (and a name-prefix sibling folder) is not winget's,
winget list asked once per 10 minutes, unlisted/empty record/hung
winget are not winget's, the WinGet\Links link. Broke it four ways
(record check off, link check off, folder check as a bare prefix,
cache off) and each failed a test.
- Windows box (winget v1.29.380): winget install rtk-ai.rtk --location
D:\tools-1527\rtk. With rtk on PATH as D:\tools-1527\rtk\rtk.exe and
as WinGet\Links\rtk.exe: origin/main's "magpie library rtk upgrade"
says "magpie can't tell how the rtk ... was installed"; this build
runs winget upgrade ("winget's RTK is 0.50.0 so far; RTK 0.51.0 is
out"). A copy of rtk.exe in another folder is still "can't tell".
rtk uninstalled afterwards.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet on
internal/library.
|
||
|
|
d47c0fea0b |
agent, provider: with CODEX_HOME set, a model picked for Codex goes to $CODEX_HOME/config.toml, the file Codex reads, and its sign-in is read and switched there (#1513, Wakkana, sunxwei)
Wakkana on Discord (macOS, Codex CLI 0.162.1) keeps Codex in a CODEX_HOME
of their own. Picking a model in magpie wrote ~/.codex/config.toml and
~/.codex/magpie-models.json, which Codex never reads, while magpie read the
pick back from the same file and showed it applied.
Checked each claim in the source: codexIn built its folder from
filepath.Join(at.home, ".codex"); so did StandIn, the compact-window tune
and KeepCodexDaemonCurrent; codexAuthPath (logins.go), codexAccount
(account.go) and the Usage card's auth.json (subscription_usage.go) read a
hardcoded ~/.codex, and since the app-server restart takes its home from
codexAuthPath, it restarted ~/.codex's daemon too. sessions.CodexDir,
catalog.CodexHome, library's codexDir and import_codex's config path
already read CODEX_HOME, each with its own copy of the rule.
Now there is one rule, appdir.CodexHome / CodexHomeIn: $CODEX_HOME through
appdir.LookupEnv (so the value proc.UserPath lends the desktop app from the
login shell counts, and a relative one reads as unset), else ~/.codex.
Every place that reads or writes Codex's files goes through it:
config.toml and the catalog (codexIn, so detection, Dir, models_cache,
history, logs, threads too), StandIn, tune, the daemon check, auth.json
read/switch/sign-in/sign-out, the import's own-catalog check, sessions,
the models cache, library targets (AGENTS.md, skills, MCP, rtk). A WSL
distro's Codex keeps ~/.codex (place.codexHome), since magpie can't read
a distro's variables. Left as they are, on purpose: library's project-level
.codex/config.toml (Codex reads that in the project whatever CODEX_HOME
is), sessions/wsl.go and wsl.go's distro probes, cliupdate's standalone
install path, and gateway/prompt.go's "/.codex/" path heuristic for a
Claude Code memory file. Codex itself doesn't expand "~" in CODEX_HOME
(0.162.0: 'CODEX_HOME points to "~/x", but that path does not exist').
Tests:
- TestCodexHomeEnvTakesThePick (agent): CODEX_HOME set, pick fakeup/m1:
config.toml and magpie-models.json land in CODEX_HOME, Get reads it back,
StandIn and tune use it, nothing exists under ~/.codex. Old codexIn:
FAIL "Codex's files at …/001/.codex/config.toml, want under
…/codex-home"; old tune.go: FAIL "tune didn't write
$CODEX_HOME/config.toml"; old StandIn: FAIL "stand-in … is """.
- TestCodexHomeEnvSignIn (provider): auth.json, config import path and
daemon home are CODEX_HOME's; two accounts listed from it; SwitchLogin
writes it; ~/.codex never created. Old account.go: FAIL "sign-in in
$CODEX_HOME not read"; old codexAuthPath: FAIL "auth.json at
…/.codex/auth.json".
- TestRestartCodexDaemon and gui's TestCodexDaemonRestartRoute asserted the
old ~/.codex daemon under CODEX_HOME=/somewhere/else; they now want
/somewhere/else. TestFolderVarsAreListed scans appdir/codex.go too, so
its CODEX_HOME canary still finds the read.
Real use, sandbox HOME + CODEX_HOME=<sb>/custom-codex, MAGPIE_ADDR on a
free port with a stand-in listener: `magpie codex fakeup/m1` (this build)
wrote custom-codex/config.toml + magpie-models.json, no <sb>/home/.codex;
real codex 0.162.0 with that CODEX_HOME: `codex debug models` listed
fakeup/m1, `codex exec` sent POST /v1/responses model=fakeup/m1 to magpie's
address. The origin/main build in the same sandbox wrote
<sb>/home/.codex/{config.toml,magpie-models.json} and left
custom-codex/config.toml at model = "gpt-5.5" (the report). The GUI app
was not run.
#1513 (sunxwei, native Windows 0.1.1157, CODEX_HOME=F:\codex-home) is the
same bug. Windows has no shell to borrow from: a user-level variable is in
the environment Explorer hands the Start-menu app, which is what
appdir.LookupEnv reads, and a drive-letter path is rooted. On the Windows
box: the agent, provider and appdir test binaries (GOOS=windows) pass
TestCodexHomeEnvTakesThePick and TestCodexHomeEnvSignIn with CODEX_HOME a
C:\ temp folder; this build's magpie.exe codex fakeup/m1 in a sandbox
USERPROFILE with CODEX_HOME=D:\codexhome-sb\custom-codex wrote config.toml
(model, magpie provider, catalog) and magpie-models.json there and created
no %USERPROFILE%\.codex. Codex itself isn't installed there, so it was
not run on Windows.
Run: go test -tags nogui ./... in a temp HOME (all ok after the three test
updates above; re-ran agent, provider, gui, catalog, sessions, library,
appdir, usage, codexcat after rebase; gateway after rebase hit the 10m
default timeout at load ~150 and passed with -timeout 25m in 656s),
gofmt -l clean, go vet +
GOOS=linux + GOOS=windows go vet -tags nogui on the touched packages.
|