f2eb56c6bbde1300dddc402861b59cd4e45e0215
14
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7bc602236b |
library: the MCP hub is called the MCP router
The owner asked why it was a "hub". Composio calls the same thing a Tool Router; "router" says what it does (one server that routes each call to the right one), and "gateway" is taken by magpie's LLM gateway. Only the words change: MCP router / MCP 路由 / MCP 路由 / MCP ルーター / MCP-Router, "Router address", and the CLI's `magpie library mcp router on|off`, where `hub` still works. The URL /mcp/magpie/hub, the mcpHub setting, the servers/hub API and the Go names stay, so nothing a user or an agent config holds changes. docs/subsystems/mcp-hub.md moves to mcp-router.md and the pages that link it follow. #4382's new words follow too: "Through the MCP router", "Not through the router" and their hints in every language, and the CLI's `magpie library mcp router <name> shared|direct` (`hub` works there too; library_hub_test.go says router for direct, hub for shared). Run at e2583df31 (this stack on |
||
|
|
b889ffe813 |
library: a server can stay each agent's own entry with the MCP hub on (#4382)
cuipengcx90's #4382, Option A's first step (nifengfanpan asked on Discord): with the MCP hub on, every Library server went behind magpie's one entry, so a server that reads its project from the folder it starts in, or keeps a session's state, resolved the wrong repository or shared state across agents. A server now has a hub policy, Server.Hub ("hub" in library.json): "" (shared, the default, so nothing changes for existing users; "shared" is saved as "") or "direct". A direct server is left out of the hub through inHub, the test that already keeps magpie's own image server out, so each agent given it keeps its own entry written as with the hub off, beside the hub's entry for the rest. An agent whose every server is direct gets no hub entry. The hub neither lists nor runs a direct server, at /mcp/magpie/hub either, and hubPrune ends one it held. Switching goes through change(), so the agents are written again at once and the entry from the other policy is removed. An unknown policy is an error. - GUI: with the hub on, the server editor has a "Through the MCP hub" switch (role=switch, not a <select>; not shown with the hub off or for the image server), a direct server's row has a "Not through the hub" tag, and the hub's line and the Connect sheet name the direct servers with the image server as given directly. Strings are in zh, zh-TW, ja and de ("MCP 聚合" as the core uses it). - CLI: magpie library mcp hub <name> shared|direct (ServerHub), and magpie library marks a direct server. - TUI: an edit keeps the policy. - Not done: Option B (per-roots/project backends behind the hub, keying hubPool by roots). It is left for later; #4382 stays open for it. Run: - TestHubDirectServer (internal/library) and the extended TestLibraryMCPHub (internal/cli) on mote. Broken by hand: inHub back to !isSelf(s) makes TestHubDirectServer red ("codex with the hub on: [magpie], want [index magpie]"). - Real configs in a sandbox HOME on mote (fake claude on PATH, the real binary built from this tree): mcp add index + web for claude and codex, hub on, hub index direct, shared, then both direct. The direct index entry was in .claude.json and .codex/config.toml beside magpie's; with every server direct both files were byte-for-byte as with the hub off (json.tool diff and diff); shared again removed the index entry. - Full Go suite (-tags nogui -timeout 45m ./...) on mote at this tree rebased on origin/main |
||
|
|
4054251865 |
library: an MCP server can be kept to this computer, never synced
huhuy72219405 on X: "能不能把不同设备的mcp区分一下,有些mcp属于本地的, 同步之后其他设备不应该读取到". A server in Library > MCP now has a "This computer only" switch in its editor (Server.Local; CLI `magpie library mcp add ... --local` and `magpie library mcp local <name> on|off`; the TUI keeps it on edit and marks the row). - Collect leaves local servers out (carriedServers), so neither a sync nor a backup file takes one to another computer. Turning a shared server local takes it out of what is carried, so the other computers drop it at their next sync; the flag itself is never carried. - Put (sync, join, Restore, Undo, backup file) keeps every local server, with its agents, and clears Local on what comes in. - Another computer's server by a local server's name goes to Library.Away: given to no agent, not in the hub, carried on as it came, so a push from here never removes it from the computers that have it. settleAway (every change) promotes it once the name is gone here, and drops it once the name is shared here again. - The hub serves local servers like any other (it runs here); subagents aren't carried, so one naming a local server keeps it. Docs: docs/subsystems/library.md, docs/subsystems/sync-backup.md. Run at |
||
|
|
3ce2a9819f |
library: RTK for agents in WSL, with the distro's own rtk (lex on Discord)
lex: Claude Code and other agents in WSL couldn't use the RTK of magpie
on Windows. rtkAgents looked an agent up in rtkSpecs by its whole id, so
claude@wsl:Ubuntu never matched and WSL agents weren't on the RTK page at
all. Even matched, the specs read this machine's home, and Windows' rtk.exe
is no command inside the distro, where the hook runs.
Now an agent is looked up by its kind (rtkKind). One in WSL:
- has its files read and written under the distro's home as magpie opens
it (rtkClaudeDir, rtkCodexDir, rtkHome), with blocked/version checks
against the distro's rtk and OpenCode;
- uses the distro's own rtk: rtkDistroOf asks the distro (wsl.exe -d <d>
-e sh -lc) where rtk is on its shells' PATH, else in ~/.local/bin or
~/.cargo/bin (offPath), kept 15s; ReadRTK lists one RTKDistro per distro;
- switching on runs that rtk there (rtk init -g ..., its folder on PATH);
- Install RTK in WSL <distro> (POST /api/library/rtk/install {distro},
magpie library rtk install <distro>) runs RTK's own Linux installer in
the distro (curl, or wget).
A distro that isn't running is never started (#3896): its agents are
listed asleep with the switch off, and switching or installing says to
start it. The page has a card per distro (install, off-PATH, asleep) and
uses the distro's rtk for each WSL row's tags and switch; strings in zh,
zh-TW, ja and de. The install route now refuses a body it can't read
instead of installing on this computer.
Run:
- mote (macOS 27), at origin/main
|
||
|
|
c1da9ccda3 |
library: a stopped WSL distro's agents are listed, and a tick for one is written there once it runs (cybercaius on Discord)
cybercaius: with WSL not started, the Library's MCP page didn't list the agents in the distro at all, and nothing ticked for them could be kept. A stopped distro's agents are no targets (#3896: opening their files starts the distro), so they fell off the page. While a distro runs, each agent's places and what its MCP file takes are kept in wsl.json (keepShape, agent.WSLKeep, key library:<kind>). While it is stopped, Read lists its agents from that (asleepView, asleep: <distro>) with the library's ticks; one magpie never saw is listed only on rows that name it, as unseen, its chip disabled and kept by every click (keptOf). A tick on a stopped agent is kept in library.json (Takes accepts a known shape, serversAgents judges it by shape.reaches); nothing is opened or run in the distro. Woken, from KeepLinked's 30s loop, syncs once a distro the library names goes from stopped to running (wsl.exe -l --running starts nothing). The page greys a stopped agent's chip and says why in its tooltip and one line per distro; the MCP hub leaves them out. The CLI says the same on stderr (AsleepIn). en, zh, zh-TW, ja, de. Run at this tree (20695ad8b before this message; on |
||
|
|
da8039368f |
library: skills kept in ~/.agents/skills can be handed over to the library, and then turned off per agent
tnt1223 on Discord asked for the skills in ~/.agents/skills to move into
magpie's library folder and be managed there ("统一移入 magpie 的资源库文件
夹,交给 magpie 管理"), since a skill there can't be turned off for one agent
("不能决定某个 skill 是否自由开启"). Codex, Gemini CLI and the other readers
of that folder read it themselves, whatever the library ticks. Goose, Kimi
Code and Cindy use it as their own folder.
HandOverSkills (POST /api/library/skills/hand-over with names) does the
hand-over only when the user asks for it:
- A folder kept in ~/.agents/skills moves into library/skills/<name>
(moveIn). It is renamed, or, across disks, copied. A copy has to read
back the same (sameTree) before the original is set aside with the
backups. On any failure the folder stays where it was and the library's
link stays as it was.
- An entry there that only links to a folder elsewhere is removed, and
the library links straight to that folder. The folder itself stays.
- The user's own links to the skill in agents' folders are removed too,
since they would point at nothing. The library gives those agents its
own link.
- Every agent here that read the skill there (readsSharedHere, plus the
agent of each such link) is ticked. So each agent keeps the skill, now
from the library, until the user unticks it or turns it off here.
- A skill found there that isn't in the library yet is imported first.
- A name that can't be handed over is listed in Result.Unmoved, and the
other names are handed over all the same.
HandBackSkill moves the folder back and links the library to it again.
"Kept there" is now sharedEntry: the skill's own entry in the shared
folder, by its name, or, for a library link into it under another
folder's name, by that folder's name. Everything that read the old
by-name check follows it:
- SkillView.Always, plus the new Shared and SharedElsewhere fields;
- syncSkills' in-shared check;
- the shared folder's own target, which no longer gets a second link
beside such an entry. TestSharedUnderAnotherName covers this, and it
fails without the guard.
Where:
- GUI, Library > Skills: a row kept there has "Manage in magpie"
("交给 magpie 管理") in its source line. With more than one such row,
the skills heading has "Manage {n} in magpie". Each asks first, in the
page, and says:
- where the folder goes, or that only the link goes;
- which agents keep the skill, ticked;
- how to put it back.
Cancel sends nothing. The strings are in en, zh, zh-TW, ja and de.
- CLI: `magpie library skill hand-over <name…>|--all` and
`magpie library skill hand-back <name>`.
Existing users: nothing changes until they click. A library.json gains
no new key.
Run (mote, at 58e926e5d/d4b7c0586 rebased on
|
||
|
|
fe05f0a721 |
library: a skill can be turned off on this computer alone, and a sync neither carries that nor turns it on
hanslin1666 on Discord (#general 1565016936344191096) wanted a library
skill off on one computer only ("只在这台电脑上关掉"). The only way to do
that was to untick its agents, and the ticks are what a sync carries, so
every other computer lost it too. A sync from a computer that had it on
also gave it back here.
Skill.OffHere (library.json "offHere", omitempty) turns a skill off on
this computer. No agent here gets it, whatever Agents says. Every reader
that gives a skill to an agent now asks gives():
- syncSkills, including the shared ~/.agents/skills check;
- desktop_skills.go;
- skill_changed.go;
- skill_edits.go;
- behind;
- Targets.
Agents stays what a sync carries, and the page shows those chips faded.
Collect never carries OffHere, so turning a skill off changes no part a
sync uploads. Put keeps this computer's OffHere for a skill it puts, so
a sync from a computer that has it on (or that gives it to more agents)
leaves it off here.
Where to turn it off:
- GUI: a power button on the skill row (aria-pressed). When off, an
"Off on this computer" tag sits on its own line under the name; it
says why and turns the skill on when clicked.
- CLI: `magpie library skill off-here|on-here <name>`.
- TUI: the row says the skill is off.
The strings are in en, zh, zh-TW, ja and de.
Existing users: nothing changes. An older library.json has no offHere,
so every skill stays on, and a skill that was never turned off writes no
key (TestSkillOffHereOldLibraryIsOn).
Not covered:
- a project's skills;
- a library skill whose own folder is inside ~/.agents/skills, which
agents read in place;
- a skill another computer removes (the flag goes with it).
The skill's files in the library folder still update while it is off.
Docs: docs/subsystems/library.md and sync-backup.md.
Run at the parent
|
||
|
|
e0ea15b8e8 |
library: an MCP hub, one magpie server in place of every library server (#2679)
With Library → MCP → "MCP hub" on (off by default), each agent that takes an MCP server over HTTP is given one entry, magpie, at /mcp/magpie/hub/<agent>, in place of the library servers ticked for it. magpie runs those servers itself, once for every agent: a command starts on its first call and ends after 10 idle minutes, a URL server is reached with its headers and MCP sign-in. Tools are <server>__<tool>; a tool off in the library is neither listed nor run. Any other app connects at /mcp/magpie/hub, which serves every library server. Both are guarded as /mcp/magpie/tools is (local or a gateway key, no foreign page, 4 MiB, the key's limit per call). An agent that reaches no server over HTTP (Claude Desktop), has a magpie entry of its own, or sits beside a library server called magpie keeps each server's own entry, and the page says why. Off gives every agent its servers back and ends every process the hub started. GUI: a switch under the MCP list, a line of what it serves, the address, and a Connect… sheet. The sheet lists every agent magpie detects that takes MCP (not a fixed four), each with where it stands; one given none of the hub's servers has a Connect that ticks it for every server it can reach (servers/agents-all), so it gets the entry, and the sheet stays open. Then any other app: Cursor (when it isn't a detected agent), VS Code, Other, with the JSON and, in the app, "Add to …" through the app's own install link built in Go (servers/hub-open; the page never sends a link). CLI: magpie library mcp hub on|off. Design: docs/subsystems/mcp-hub.md. With #3885 ( |
||
|
|
e4552cca9f |
library: a cargo RTK upgrades on Windows, and says why when it can't
新v学员 (Discord #feedback, 10-27): upgrading an RTK installed with cargo
failed silently on Windows. Four causes, each fixed:
- No cargo on magpie's PATH (magpie started before Rust was installed,
or from a shortcut whose PATH rustup never touched): rtkUpgrader gave
no upgrade, so Upgrade was greyed with only a tooltip, which a click
never shows. Now the cargo rustup put beside rtk is run by its path;
with no cargo anywhere, the card (and the CLI) says it was installed
with cargo, to install Rust from rustup.rs or run the command shown
(RTKView.NoUpgrade, Manual), and UpgradeRTK's error says the same.
- CARGO_HOME (D:\Rust\.cargo is common) moved cargo's folder: an rtk
there wasn't cargo's to magpie. cargoBins reads it, for finding rtk
and for the upgrade; on Windows the folder matches whatever its case.
- cargo install --git built rtk-ai/rtk's default branch, develop, whose
Cargo.toml says 0.49.0 while v1.1.0 is out from master: the upgrade
left rtk as it was, or older, on every OS. It now names --branch
master, as rtk's own installation guide does.
- Windows refuses cargo's move over a running rtk.exe ("failed to move
… (os error 5)", exit 101, after the whole build), and an agent runs
rtk for every command. On that refusal the rtk is renamed aside
(rtk.exe.old-<pid>, which Windows allows), a copy put in its place,
and cargo run again; its build is kept in magpie's CARGO_TARGET_DIR,
so the retry builds nothing. Old copies are removed on the next
upgrade.
A failed cargo now says its first error with the cause, and what to do
for the common ones (rtk in use, link.exe/dlltool missing, GitHub
unreachable), not its last three lines, which only said the build
failed and where its files were left.
Run:
- Real Windows (10.0.0.132, sandbox CARGO_HOME/RUSTUP_HOME/USERPROFILE,
rustup + cargo 1.99.1, removed after): plain cargo install over a
running rtk.exe fails with "拒绝访问。 (os error 5)" exit 101; a
Windows build of this package's tests (GOOS=windows go test -c, a
scratch test calling ReadRTK/UpgradeRTK, not committed) with no cargo
anywhere gave NoUpgrade "cargo" and the new error; with cargo only
beside rtk (not on PATH) and the old rtk.exe running, UpgradeRTK
built rtk-ai/rtk master and went 1.0.0 -> 1.1.0 in 3m26s, the running
rtk kept running, rtk.exe.old-<pid> was left and removed once it
exited. The build used the gnullvm toolchain with llvm-mingw; the
gnu toolchain failed with "error calling dlltool" and lld's missing
-lgcc_eh, which is the output the tests use.
- New tests (rtk_cargo_test.go) and the updated
TestRTKUpgradeCargoNamesThePackage are red on origin/main
(
|
||
|
|
9298d2a7c3 |
cli: prompts read the stdin Windows' console init reopens, not the one package init saw
tom047784 (Discord, Windows desktop build): `magpie plugin login` in a
terminal failed with "read /dev/stdin: The handle is invalid". The
desktop build is a GUI-subsystem binary; console_windows.go's init
attaches the parent console and reopens CONIN$/CONOUT$ into os.Stdin,
os.Stdout and os.Stderr. But `var stdin = bufio.NewReader(os.Stdin)` in
backup_cmd.go is a package variable, set before any init runs, so it
kept the invalid handle.
That one reader serves every CLI prompt, so all of them broke the same
way: plugin login (askPrompt, askNumber, the code and pasted callback
lines), backup/WebDAV passphrases and passwords piped in (secret), the
library and quota confirmations. stdin is now a func that makes the
reader over os.Stdin as it is when read, and remakes it if os.Stdin
changed; one reader still serves a run, so a second piped secret is
still the second line.
Sibling of the same class: lipgloss's default renderer (termenv's
default output) is made over os.Stdout at its package init, before the
reattach, so the desktop build's CLI printed every style without colour.
The init now points that renderer at CONOUT$ in place; the styles made
at package init hold it. A grep for package-level os.Stdin/os.Stdout/
os.Stderr found no other one in the repo (writers like fmt.Println and
json.NewEncoder(os.Stdout) inside functions resolve at use time).
webdav_cli_test's piped() swapped both os.Stdin and the reader, which is
why no test caught this; it now swaps os.Stdin only.
Run (at this tree, worktree off origin/main
|
||
|
|
fba554c7f8 |
library: magpie library mcp add without agents= says the server went to no agent
A server added with no agents= is kept in the library and given to no
agent, but the command printed "✓ every agent already has it". It now
says "<name> is in the library, given to no agent yet" and names
`magpie library mcp agents <name> <a,b…>`. With agents=, and for
`mcp agents`, the output is as before ("written into claude").
Found while trying the magpie-setup skill's commands in a sandbox HOME.
Not changed (#3598): `library instructions set` with no agents chosen still
prints "every agent already has it" while no agent is given it.
Instructions have sets, so its check needs the active set's agents.
Run: go test ./internal/cli -run TestLibrary -count=1 ok; the new
TestLibraryMCPAddNoAgents fails on the old library_cli.go (reverted by
hand: "✓ every agent already has it") and passes with it. go vet
./internal/cli and gofmt -l clean.
|
||
|
|
c417b1f4e3 |
library: a skill removed from its source is said so, and every such skill goes in one click, asked first
スライム on Discord (#help, 10-22): taste-skills took some of its skills
out, Update all reported each of them as a failure, and the only way
out was to delete them one by one.
An update or a check that reads the source whole and finds the skill's
folder (or its SKILL.md) gone now calls it removed upstream, not a
failure. GitHub tarballs and other git repositories both work this way.
- UpdateSkill returns *GoneError.
- UpdateSkills and UpdateSomeSkills list it in Result.Gone, not
Unupdated.
- A check gives status "gone".
- Each marks Skill.Gone. The mark is cleared when a check or an update
finds the skill there again.
- A fetch that failed, a skill left out of a fetch as too big, and a
folder that can't be read stay unknown, never gone (goneFrom).
Nothing is deleted by itself. RemoveGoneSkills takes the named skills
out, or every marked one when none are named, through RemoveSkills, so
the folders go to the backups. A skill found in its source again is
kept and said so.
- GUI: a "Removed upstream" tag replaces Update available and the
update icon. Update all says gone skills apart from failures. "Clean
up N" sits in the group heading, or in the bar when there is one
group, and opens a sheet naming each skill. One changed here carries
"Changed here". Strings are in en, zh, zh-TW, ja and de.
- CLI: `magpie library skill rm --gone [--yes]` asks at a terminal and
refuses without --yes otherwise. It names the ones changed here.
update and status print the hint.
- TUI: the row says "removed from <repo> · d takes it out".
- API: POST /api/library/skills/remove-gone {names}.
- Docs: the Skill updates row and Verification in
docs/subsystems/library.md.
Record for this push: 13 commits on origin/main
|
||
|
|
9fd80b2128 |
library: skills install from any git repository, GitLab and a company's own among them (sunset on Discord)
ProbeSkills took only a GitHub source or a folder. It now also takes any
git repository's address: https/http on gitlab.com or a self-hosted
server (any depth of groups), a GitLab or Gitea page of a folder
(/-/tree/<ref>/<path>, /-/blob/..., /src/branch/...), ssh://,
git@host:group/repo.git, a bare host.name/group/repo, and file://.
Such a source is kind "git" (gitSource, skillgit.go).
It is fetched with the user's own git (proc.FindTool), so their
credential helpers and SSH keys reach an intranet host: git init, then
fetch --depth 1 --no-tags -- <url> <ref|HEAD>, checkout FETCH_HEAD into
a magpie-skill-* folder, .git removed; the same keepProbe/maxFetch path
GitHub's tarball takes.
What the user typed is data: an address starting with - and any
transport:: address (ext::, fd::, file::) are refused before git runs;
the address follows --; git runs with protocol.ext.allow=never and
core.symlinks=false, no shell, GIT_TERMINAL_PROMPT=0, and ssh -o
BatchMode=yes unless the user set their own SSH command (GIT_SSH,
GIT_SSH_COMMAND, core.sshCommand), so a sign-in it can't make fails
instead of waiting. An address with a password or token in it is
refused: library.json is shown and backed up. Git missing, a sign-in
refused, an unknown host key, a missing branch and an unreachable host
each say so plainly (gitError).
Updates: Commit keeps the repository head the skill was fetched at. A
check runs git ls-remote; another head is fetched (once per repository
and ref) and the skill's folder hashed, so a commit elsewhere in the
repository leaves it current and moves Commit on. UpdateSkill and the
edited-skill refusal work as for GitHub; EditedError and the page's
Changed here / Update / replace question name the repository instead of
GitHub. findNew, Group again, icons and the market stay GitHub's only
(documented).
Page, TUI and docs: the add box's placeholder in en/zh/zh-TW/ja/de
(zh: owner/repo、GitHub 或 GitLab 链接、任意 git 仓库地址,或本机上的文件夹),
a git skill's source shown as a link (https) or text (SSH), its own
Update and Check for updates; the TUI's prompt; library.md's Skills and
Skill updates rows. GIT_SSH/GIT_SSH_COMMAND are listed in agentenv's
notAnAgent (TestFolderVarsAreListed).
Tests (fail on the old code: gitSource/gitPath don't exist there, and
skill-git-source.test.cjs fails on the old assets' placeholder, checked
by stashing client.js/i18n.js): TestGitSourceReads,
TestInstallFromGitRepo (a local bare repo over file://: probe, install,
check finds an update, update, a commit elsewhere stays current, an
edit here is refused naming the repo), TestGitTreeURLInstallsFolder,
TestGitMissingSaysSo, TestGitSignInRefusedSaysSo (a local httptest 401,
GIT_CONFIG_NOSYSTEM so no Keychain), TestGitRefusesOptionsAndTransports,
TestGitErrorsSaid. No test reaches the network.
Run (worktree at origin/main
|
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |