e4e9eb0928becfa4e48484dde85ef5032671d582
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2051dfc232 |
library: the Pi market finds packages by name on npmmirror (eachg0 on X)
eachg0 on X: searching the Pi market for "rename" (or "pi-rename") found nothing, though npm's pi-rename 1.2.0 carries the pi-package keyword. |
||
|
|
ec1a1a7a55 |
library: import the slash commands the agents already have
miantiao_me on X (after v0.1.4189): 「之前在 Pi 定义的可以导入吗?」. Library ›
Slash commands now has a "Find in agents" card at the top. It reads the
command files each agent already has, from the same places magpie writes
them (Pi prompts/*.md, Claude commands/*.md, OpenCode command/ and
commands/, Gemini and Qwen .toml, Qwen .md, Droid), and lists them to
import, the way Subagents' import does.
- Parsing: frontmatter description plus body; for TOML, description and
prompt. Arguments go back to magpie's form: Claude's $ARGUMENTS[n] and
$n (0-based) become $n+1, Gemini/Qwen {{args}} becomes $ARGUMENTS,
Pi's $@ becomes $ARGUMENTS (${@:N} is left as written).
- Files magpie wrote itself are skipped. The same content in several
agents is one command; a name with different bodies per agent shows
"Differs by agent" and one of them is picked; a name the library has
with other content is "Name taken" and can't be picked.
- An imported command keeps its source agents ticked, and magpie adopts
each original file byte for byte (Command.Taken): sync writes the same
bytes at the same path, so the file is never doubled or rewritten.
After an edit the agent gets magpie's render at that path; a rename
drops Taken. Taken never leaves the machine (Collect strips it, Put
keeps the local one).
- API: POST /api/library/commands/probe, and commands/import through
the library change route. internal/cli's parity test names the probe
as stage 3, like subagents/probe.
- Docs: docs/subsystems/library.md has the new row.
Run at 039e25752 (on origin/main
|
||
|
|
da29171a4e |
library: a plugin hook that reads CLAUDE_PLUGIN_ROOT itself gets the folder
@AXmake110 on X: with the Claude Code plugin ponytail installed for an
agent, every start of the agent printed a red error. ponytail's hooks
read the folder in Node, not through the shell:
node -e "require(require('path').join(process.env.CLAUDE_PLUGIN_ROOT.split(String.fromCharCode(92)).join('/'), 'hooks/ponytail-activate.js'))"
magpie replaced only ${CLAUDE_PLUGIN_ROOT} and $CLAUDE_PLUGIN_ROOT, so
the command went into Claude Code's settings.json (and, for the
UserPromptSubmit hook, Codex's hooks.json) as written. Outside Claude
Code's plugin runtime nothing sets the variable, and Node threw
"Cannot read properties of undefined (reading 'split')".
Fixed for the class (plugin_env.go):
- a hook program's own read of CLAUDE_PLUGIN_ROOT or CLAUDE_PLUGIN_DATA
becomes a quoted string literal of the folder, with forward slashes:
process.env.X, process.env['X'], Bun.env, Deno.env.get, Python's
os.environ[...]/.get/os.getenv, Ruby's ENV[...]/ENV.fetch. The quote
is chosen so it doesn't end the sh quoting around it. PowerShell's
$env:X / ${env:X} and cmd's %X% become the folder.
- a plugin's command MCP server gets both variables in its env, as
Claude Code gives them, unless the plugin set them.
- ${CLAUDE_PLUGIN_ROOT}/DATA in a subagent's prompt and in a copied
SKILL.md are resolved, as Claude Code resolves them in Markdown.
- every agent gets the same text: the parts are library items, so
Claude Code, Codex, Gemini, Cursor and Grok are all written from them.
- existing installs: load() heals the hooks, servers and subagent
prompts of an installed plugin that still name the variables, and the
next sync (the app's startup sync) writes them out again; the old
entry is replaced, not duplicated. A SKILL.md copied before is fixed
by the plugin's Update or a reinstall.
Not carried yet, filed as #6682: exec-form hooks (command + args, whose
args are dropped today) and CLAUDE_PLUGIN_OPTION_<KEY>.
The fixture is ponytail's published hooks files, byte for byte
(DietrichGebert/ponytail 96608e07, testdata/ponytail/README.md).
Run (mote; full suite at 901b56c80 on origin/main
|
||
|
|
4e770f733a |
library: subagents imported from a repository
CHENGJIAHEGOXIS on X asked for an easy way to install a repository of
subagents such as msitarzewski/agency-agents. Library → Subagents now
has a find line. It takes what the skill installer takes: owner/repo, a
GitHub or GitLab link to a repository, folder or file, any git address,
or a folder on this computer. It lists the subagents found, lets the
user tick all or some, and imports them as Library subagents for the
agents ticked.
- Fetching is the skill importer's: resolvePluginRoot's source handling
moved into fetchSourceRoot, which both use. tooBig still refuses a
whole repository that is too big and asks for the folder's link.
- A subagent is a Markdown file whose front matter has a description.
- Its name is the slug of `name`. In an `agents` or `droids` folder
with no `name`, it is the file's own name.
- The description is folded to one line of at most 1000 characters.
- The body is the prompt.
- Dropped: every other front-matter key (agency-agents' color, emoji
and vibe, and tools, model, author or anything else). A Codex TOML
role is not read. A skill's folder (one with SKILL.md) and .git,
.github and node_modules are skipped.
- Two files with one name: the shallower is taken, and the other is
listed as left out, with why. So is a file Subagent.check refuses.
- An imported subagent records its source and file (From) and a hash
of its description and prompt as imported (FromHash). Imported again,
a subagent from the same file is:
- have, when it is unchanged;
- update, when upstream changed and the library's copy still matches
FromHash (description and prompt replaced; agents, skills, servers
and model kept);
- edited, when the user changed it in magpie (left as it is).
- A name the library already uses for another subagent is never written
over: the import takes the next free name-N.
- A carried library carries From.
- The page has Select all, a filter past eight, a tag per state, the
files left out, and a summary of what was imported and updated.
i18n: zh, zh-TW, ja, de.
- The fixture is agency-agents' own files in
internal/library/testdata/agency-agents. No test reaches the network.
Run on 80ae5ba24, which is this change on
|
||
|
|
dc1f17c1c8 |
library: RTK's chart says its top number is the busiest day, not a total (jasonchia58 on X)
jasonchia58 on X (macOS, v0.1.3119): the number at the top right of Library → RTK's chart (1.6M) stopped changing, while the total under the chart kept growing. That number is the bars' scale: the busiest day's (or week's) input in the range, shown bare since |
||
|
|
97fcbe3540 |
library: billion-context's card shows the tokens it saved (Scott__D on X)
The RTK tab says what RTK saved (rtk gain); the billion-context tab said nothing of its effect. bili 0.1.213 has no command that prints its savings. Its running proxy serves its dashboard's numbers at GET /__bili/overview, summed over every session in its one store, and each bili that runs registers in <state>/instances/<id>.json ($XDG_STATE_HOME or ~/.local/state, then billion-context, on every system; read from bili's dist and its Hermes plugin's twin reader). readBiliSaved (internal/library/bili_saved.go) asks the registered bilis newest first, loopback http origins only, 3s in all, and puts the first answer on BiliView.Saved: netSavedTotal (bili's headline "net savings", after post-fold rebuilds and the summaries' cost, only with hasFoldData), grossSavedTotal (which bili calls an upper bound), foldsTotal, sessions, requests. The answer is kept in bili-saved.json in magpie's config folder and shown "as of" its time when no bili runs; a kept file that doesn't parse is no answer. magpie never starts a bili to ask (it would auto-update and start watchers). The card says "166.3k tokens saved over 7 folds in 1 session", bili's own count over every session on this computer, the gross before costs; "Nothing folded yet over N requests" before a fold; and that it shows once bili has run when no bili ever answered. zh, zh-TW, ja and de; site docs (en, zh, ja) and docs/subsystems/library.md. Run: - Real bili 0.1.213 on mote in a sandbox HOME (ACP_AUTO_UPDATE=0, 20000 token window, bili start on 18799, a fake OpenAI upstream answering usage = bytes/4): ten turns of a growing conversation through /bili/<upstream>/ gave overview net 166285, gross 166390, 7 folds, 1 session, 10 requests. That literal answer is the Go fixture (testdata/bili/overview-0.1.213.json) and the GUI test's numbers. readBiliSaved/ReadBili run on mote against that live bili with that HOME read the same numbers (Live true, Version 0.1.213). - go test -tags nogui ./internal/library ./internal/gui on mote: ok. - win-run go test -run 'TestBiliSaved|TestBiliLoopback' ./internal/library on xiaomi-gpu: ok. - library-bili, i18n-keys and i18n-en-no-cjk in chromium and webkit (every language, 1100 and 420 wide): 92 pass, 0 fail. - gofmt -l clean; go vet darwin, GOOS=linux -tags nogui and GOOS=windows for internal/library and internal/gui: ok. - site/public/llms-full.txt regenerated (node llms-full.mjs); site worker.test.mjs: 38 of 38 ok. Broken by hand: - the loopback filter taken out: TestBiliSavedFromRunningBili red (192.0.2.7 asked first, the 3s budget gone, nothing read). - net read from tokensSaved, and a kept answer marked live: TestBiliSavedFromRunningBili and TestBiliSavedOnThePage red. - the card's line taken out: library-bili 40 of 42 red (chromium). Not tried: a real agent session with a real model through bili (the upstream was a fake with made-up usage, so only the plumbing of bili's numbers is checked, not how much a real session saves); a bili with money data (hasMoneyData; its dollars are passed as usd but not shown); the card on Linux WebKitGTK. |
||
|
|
969868ccda |
library: a Python MCP server in a GitHub repository's folder is found and added filled in (CyberCaius on Discord)
CyberCaius pasted https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_askecho_search_infinity (Volcengine's askecho web search) into the Library's MCP search. The fragment was dropped, the MCP Registry was asked for "mcp-server" and "volcengine", nothing it lists is there, so the page offered only a blank command named "server". A GitHub address naming a folder (#subdirectory=, /tree/<ref>/…, /blob/<ref>/…/file) is now read before the registry: the folder's pyproject.toml names the program ([project.scripts]) and its README's "env": {…} examples the keys. It is offered as a normal market card: uvx --from git+https://github.com/o/r[@ref]#subdirectory=<path> <program>, with the keys asked for in the install sheet. Of several keys none is required (askecho takes an API key, or an access key and secret); one alone is. A bare repository is read that way only when the registry has nothing at it. A pypi.org/project/ page, or a one-word search naming mcp (with - _ or .) that the registry lists nothing by, asks PyPI's JSON API and offers uvx <package> with its description's keys. Claude Desktop is already wired for local Library servers (claude_desktop_config.json); the test installs it there. Run (mote): - go test ./internal/library -run 'TestMarket|TestParseRepoAt|TestEnvInputs': ok - go test ./internal/library rebased on |
||
|
|
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. |