f2eb56c6bbde1300dddc402861b59cd4e45e0215
73
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a5ccf3f23f |
plugins: an update of an unfixed git source re-resolves the branch, not the lock's old commit (#2954)
What changed - Before Bun resolves a git plugin's spec, the branches and tags of its repository are fetched into the bare clone Bun keeps in its install cache (refreshGitCache in gitrev.go): best-effort before install's bun add (a remote that can't be reached leaves the install to what the cache has), an error before reinstall's bun update (an update that didn't happen is not reported as done). - When bun update exits 0 but the plugin is still behind the commit the update checks saw the repository at, reinstall says so instead of claiming the update. - A spec that names a commit (#<sha>) is left alone: nothing is resolved for one, and its pin stands. - docs/subsystems/provider-plugins.md: this git update path. Why A plugin added from an unfixed git+https://... URL could not be updated (#2954): plugins/package.json named no commit, but Bun resolves a git spec through its own bare clone of the repository in the install cache, whose refs stay at the first install - a fetch there moves FETCH_HEAD, not the clone's refs/heads. Every resolve after the first, bun update as much as a bun add after a remove, therefore named the old commit again, bun.lock re-recorded it (name@git+...#bb961b2...), and the update said it had installed while node_modules kept 0.1.3. The lock is the record of that resolution, not its cause. Verified with Bun 1.4.2 (the version magpie runs) against a local git+file:// repository: after the branch moved, bun update my-plugin answered "no changes" and exited 0, and so did bun install with the lock entry dropped, bun update --force and bun install --force; with the clone's refs fetched, the same bun update installed the branch's commit now. Run go test ./internal/plugin/ -count=1 (ok; new: TestGitUpdateInstallsTheBran chsCommitNow and TestGitUpdateKeepsACommitPin on the bun on PATH against a local git+file:// repository, TestGitUpdateSaysWhenItDidnt with the fake bun keeping the lock's commit, TestRefFixed, TestSameRepoAndCloneOrigin) go test ./internal/cli/ ./internal/provider/ -count=1 (ok) gofmt -l (clean); go vet ./internal/plugin/ on darwin, linux and windows (ok); builds of darwin and of windows (CGO_ENABLED=0 -tags production, as the Makefile cross-compiles it) and of the 79 Linux packages that don't need Linux GTK cgo (the GUI and cli are built natively per machine, as the Makefile says). Review (magpie): patch sha256 checked against the issue; read whole. Run at the batch head on the Mac mini: go test ./internal/plugin -count=1 ok, the real-Bun git e2e among them (not skipped); on the Windows box TestGitUpdate* pass. Broken by hand: store.go at the base - TestGitUpdateInstallsTheBranchsCommitNow ("still at 1.0.0, want 2.0.0") and TestGitUpdateSaysWhenItDidnt red; only install()'s refresh removed - "installed again: 2.0.0, want 3.0.0". Not tried: a real plugin from a real GitHub branch. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
f115122626 |
plugins: an Anthropic model under a loader base without /v1 goes to its /v1 (Copilot's Claude 404)
cyoking1 on X (tweet 2116084357731701020): every Claude model through the GitHub Copilot plugin answered 404. pluginFetch took the loader's baseURL first, and Copilot's loader says https://api.githubcopilot.com for every model, while its Claude models are @ai-sdk/anthropic rows whose own api.url is https://api.githubcopilot.com/v1 (models.dev). magpie's /v1 is taken off the path, so the request went to https://api.githubcopilot.com/messages. pluginRequestBase now sends an Anthropic model whose own URL ends in /v1 under the loader's base + /v1 when that base doesn't end in it, as OpenCode's own Copilot provider does (packages/core/src/plugin/ provider/github-copilot.ts: `${loaded.baseURL}/v1` for messages models). That covers every plugin, and Copilot Enterprise's copilot-api.<host>. Unchanged: a base already ending in /v1 (zcode, minimax, commandcode, zed), a model whose own URL has no /v1 (Kiro's BASE), and every non-Anthropic model (Copilot's GPT on its bare base). Every @ai-sdk/anthropic api.url in models.dev ends in /v1. Run: - Real account (owner's Copilot sign-in, token from the OAuth refresh): POST api.githubcopilot.com/messages claude-sonnet-5 -> 404 "404 page not found"; /v1/messages -> 200 with a reply. - TestPluginAnthropicBaseKeepsV1 (new): green; broken by hand (the /v1 append commented out) it is red on the copilot, trailing-slash and enterprise cases. - mote: go test -count=1 ./internal/provider ./internal/plugin ok; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... clean; go build, GOOS=linux -tags nogui and GOOS=windows builds ok; gofmt -l empty. - Full suite (-timeout 45m) started on mote at this head; pushed before it ends per the ship-at-once rule; reds get their own issues. Not tried: a whole magpie gateway with the Copilot plugin signed in end to end; the fix was checked at the base it computes and the real endpoint by hand. |
||
|
|
497100488a |
provider, library: a .git is a repository only when git takes it for one (#3675)
TestPluginToldWhereTheAgentWorks was red on any machine with an empty .git above its temp folder. GitOnDisk took the first .git it met going up as a repository, and on this box /tmp/.git is an empty folder (owned by nobody), so every folder under /tmp read "yes". git passes such a folder over and goes on up: git rev-parse under it says "not a git repository". GitOnDisk now reads each .git on the way as git's own search does (repo_discovery_find_dir in git 2.56's setup.c), through GitAt: - A folder counts when git takes it for a repository (is_git_directory): a HEAD git takes (a link into refs/, "ref: refs/...", or a commit's id), and objects and refs folders, in the folder its commondir names for a linked worktree. Any other folder, an empty one say, is passed over and the walk goes on up. - A file counts when it is "gitdir: <folder>" naming such a folder, relative to the .git's own folder (a linked worktree's, a submodule's). Any other file, one over git's 1 MB, or one that is neither file nor folder is "no": git stops there with "not a git repository" (a worktree whose repository has gone) or "invalid gitfile format". (git 2.34 passed a .git that is neither file nor folder over; 2.55 and 2.56, CI's, stop at it.) - A .git it can't read is unknown, and the header is left off. git passes such a folder over and stops at such a file, but either way it can't tell an empty .git from a repository it isn't let into (another user's, through a shared magpie), and a failed read is unknown here. A bare repository kept as a folder's .git (git init --bare .git) is still "yes": git finds one there, though no work tree. Not mirrored: the filesystem boundary, GIT_CEILING_DIRECTORIES and safe.directory's ownership check. Cost: the same one stat per folder on the way up; at a .git, a read of HEAD (255 bytes at most) and stats of commondir, objects and refs. What a user sees: a request to a plugin provider from an agent that doesn't say whether its folder is a repository (Codex, Pi) was told "yes" for a project under a stray empty .git, under a worktree whose repository was deleted, or under a .git file that names nothing. The community ZCode plugin then tells the model "- <git label>: yes" and Command Code's sends isGitRepo: true, so the model may run git commands that fail with "not a git repository". They are now told "no", and with a .git on the way magpie can't read, nothing (ZCode's plugin leaves the line out, Command Code's sends false). Claude Code's and OpenCode's requests say it themselves and are passed on as they say it, so nothing changes for them; Claude Code 2.1.310's own check takes any .git, an empty one too. The only caller of GitOnDisk is tellWorkPlace (workdir.go), which needs no change. The library's skill groups had the same first-.git walk: gitRepoOf took the first .git within four folders of a linked skill for its checkout, so an empty one between a skill and its clone left the skill in no group, and gave one imported from there no From. gitRepoOf now asks provider.GitAt, passes such a .git over to the clone's, and reads the origin from the folder GitAt names (a linked worktree's common one), which replaces gitdirConfig. gitdirConfig also took "gitdir:" with no space after it, or with spaces around the line, which git doesn't take; such a .git now traces to nothing, as git finds nothing there. Checkouts git made are traced as before; the test's fake ones had only a config and now have a HEAD, objects and refs. Every other .git folder in the Go code is one a walk skips when it copies, hashes or checks a skill (carry.go, skillcheck.go, skills.go, skill_edits.go), or the one magpie removes from its own fetch of a skill (skillgit.go), not a decision about a repository. The Claude bridge's claudeWorkDir takes the temp folder for one in no repository; Claude Code decides that for itself, and its git status is off for every run (CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS), so it stays. TestPluginToldWhereTheAgentWorks gets a real repository for "in a repository" (HEAD, objects, refs; an empty .git was all it had) and a case under an empty .git in its own temp folder, so it fails without this on any machine. Its "not in one" cases, and the new provider tests' "no" ones, still need no repository above the temp folder, as the test did before. TestGitOnDiskIsWhatGitFinds lays out each kind of .git by hand; TestGitOnDiskAgreesWithGit asks git rev-parse --git-common-dir in each of those folders and in ones git made (init, worktree add, a worktree whose record was removed, --separate-git-dir, init --bare .git), for yes or no and where; TestGitOnDiskUnreadIsUnknown locks a .git folder and a worktree's .git file. provider-plugins.md and library.md say the same. What was run (tree 9a4504d9, on origin/main |
||
|
|
f11bf27c1f |
video: a plugin's model that gives video makes videos through its fetch on the account
XYenon asked for video for account-backed plugins: customVideomakers
left out every provider with an Account. A plugin's model that says it
gives video (capabilities.output.video / modalities.output) is now a
video maker (the Grok plugin keeps its own). Start, poll and content go
OpenAI-shaped to <base>/videos, /videos/{id} and /videos/{id}/content
through the plugin's fetch (videoBase now takes Provider.OpenAIBase,
the Chat base for any other provider). The video's id names the account
that started it (keyMark: "a" + signer), and markedKey asks after it on
that account of the plugin's (AlsoOn), as a key provider's videos are
asked on their key. Account and model holds (videoAsker,
videoModelHeld) and the start's usage row are the existing paths'.
Test: TestPluginMakesVideos (fake $FAKE_VIDEO, two accounts): started
by a key held to the second account, polled and fetched on it, a key
held to the first gets 403 on the poll, a key held to other models 403
on the start and the poll; the start is in the ledger. Broken by hand:
with the old video.go the video makers are empty (red); without the
account mark the poll goes to the first account and the content is
refused 403 (red).
Run on mote: gofmt -l clean; go vet ./internal/gateway ./internal/provider
./internal/plugin for darwin, linux (-tags nogui) and windows; go test
-count=1 -timeout 45m ./internal/gateway ./internal/plugin
./internal/provider ok at the tree of the video commit (
|
||
|
|
6cb73ec4f0 |
gateway: embeddings and speech reach a plugin through its fetch whatever API its chat is on
XYenon asked how /v1/embeddings and /v1/audio/speech reach a plugin whose models are all on Gemini's API. serveRetrieval sent them under the provider's Chat base, which a plugin has only with an @ai-sdk/openai-compatible model, so such a plugin was turned away 400 "has no OpenAI-style API". Provider.OpenAIBase is plugin://<id>/v1 for a plugin (the Chat base for any other provider), and serveRetrieval (embeddings, rerank, speech, transcriptions, translations) sends under it: the request reaches the plugin's fetch OpenAI-shaped at <base>/embeddings or /audio/speech, with the model's own id, for the plugin to put in its vendor's shape. magpie converts none of them to Gemini's embedContent or TTS; the plugin owns its vendor's protocol. Key holds, account holds, masking and usage are serveRetrieval's, as before. Test: TestGooglePluginTakesEmbeddingsAndSpeech (fake $FAKE_GOOGLE: every model on @ai-sdk/google, with $FAKE_KINDS' embedding and TTS): both reach the vendor through the fetch, both are in the usage ledger, a key held to other models gets 403 on each. Broken by hand: with the old Base(provider.Chat) it is red (400 "has no OpenAI-style API"). Run on mote: gofmt -l clean; go vet ./internal/gateway ./internal/provider ./internal/plugin for darwin, linux (-tags nogui) and windows; go test -count=1 -timeout 45m ./internal/gateway ./internal/plugin ./internal/provider ok at the tree of the video commit ( |
||
|
|
e2b7233499 |
draw: a plugin's Gemini image model draws on generateContent through its fetch
XYenon (magpie-google-ai-studio, Discord) asked how a plugin's image models reach /v1/images/generations and /v1/images/edits. A plugin's model on Gemini's API (@ai-sdk/google) that says it gives images (capabilities.output.image / modalities.output), or is named for them, is now a drawer: Drawers lists it, and draw sends it to drawCodeAssist (pluginDrawsGemini), as a Google sign-in's image models are drawn. That asks generateContent with responseModalities ["TEXT","IMAGE"] through the plugin's fetch, an edit's pictures as inlineData, and reads the pictures from the answer. Request.draws asks for the IMAGE modality of a model not named for images. Imagen (catalog.ImagesAPI, :predict) is left out. The OpenAI-compatible plugin path (SenseNova) is unchanged. Test: TestGeminiPluginDraws (fake plugin $FAKE_GEMINI_DRAWS: a model named for images, one that only says it gives them, an Imagen). Broken by hand: with the old draw.go the drawers are empty (red); with the old codeassist.go the declared-only model is sent no responseModalities (red). Run on mote: gofmt -l clean; go vet ./internal/gateway ./internal/provider ./internal/plugin for darwin, linux (-tags nogui) and windows; go test -count=1 -timeout 45m ./internal/gateway ./internal/plugin ./internal/provider ok at this commit on its first base |
||
|
|
8c63c5b787 |
provider, plugin: a plugin model that says it gives no text leaves the chat lists (#3279)
A plugin provider's list counted every model it named as a chat model.
XYenon's Google AI Studio plugin put gemini-embedding-001 and its TTS
models in the chat chips, the agents' lists and /v1/models. The plugin
does declare them: the embedding's capabilities.output is
{"text": false} and the TTS's says audio only. But the host's kinds()
kept only the true keys. That made "said it gives nothing" look the same
as "said nothing", and pluginCatalog never read Outputs.
- host.js passes outputsSaid, which is whether capabilities.output says
yes or no to any kind (kindsSaid). It goes into plugin.Model.OutputsSaid.
- pluginCatalog leaves out a model whose outputs were declared and name
no text, image or video (pluginTalks). Every chat list is built from
that list: /v1/models, provider.Catalog (the agents' lists and routing),
and Available (the editor's chips).
- A plugin that says nothing about outputs keeps every model, whatever
the id. Image-only and video-only models stay where they are; #2792
decides where they go.
Ported from ggbdpq's hunt65-c-3279-kinds (7391b0df2), with changes
after review. That patch found the right place (pluginCatalog) and
wrote the provider tests kept here. It judged an embedding by "embed" in
its id, because the host drops the declaration. So an embedding named
otherwise (bge-m3, text:false) stayed in the list. A plugin that says
nothing about outputs lost any model whose id held "embed" or "-tts",
which changes today's behaviour. An image-only model (outputs ["image"])
was dropped, though the patch said it left #2792's models alone. This
version fixes the declaration in the host instead and guesses nothing
from ids. catalog.textModel is unchanged.
Docs: docs/subsystems/provider-plugins.md, "A model that gives no text".
Run (mote, at base 96a703a59; then rebased onto
|
||
|
|
046093bf7b |
gateway: a plugin's try with another candidate after it is told so, and gives way to a queue (#4049)
axuhere on X: on free models a request sat behind "模型请求正在排队 · 预计等待超过 10 分钟" with other providers configured for the same model, and asked for magpie to move on to the next provider and say why. |
||
|
|
e5e2aa58e5 |
routes: each provider's wallets go by what they have left in a group too (#4095)
mycf_711 (#4095, comment): SuperMagic's accounts asked directly went by their points (6,636, 282, 119), but in group/deepseek-v4.1-flash1017 they went 282, 119, 6,635, the provider's listed order. A Smart group weighs its members' accounts as one pool (planLevel → weigh over the heads), and the pool held WorkBuddy's credits beside SuperMagic's points: byLeft returned nil as soon as it saw two kinds of LeftIn, so no balance ordered anyone. Each 400 「积分已不足」 was then met on the small balances first. byLeft now orders each kind (provider + unit) in the places its own seats take: the told seats' places in the pool's order (Smart) or by what magpie sent each lately (Pace, Least used, as their tie-break after the balance), each kind's seats put into its places by what they have left, and seats of two kinds keep that order between them. A seat that told none still goes after those that did. It is one rank per seat, so the comparators stay a consistent order; comparing two kinds as a tie would not be. One kind alone orders exactly as before (TestWalletsGoByWhatTheyHaveLeft unchanged). Tests: TestWalletsOfSeveralProvidersEachGoByWhatTheyHaveLeft (routes: Smart, Pace, Least used, the reporter's three behind a WorkBuddy seat, two kinds interleaved, and Least used's token order between kinds) and TestGroupWalletsGoByWhatTheyHaveLeft (gateway: weigh over a group's pool with the reporter's balances, smart/pace/usage). docs/subsystems/provider-plugins.md and gateway-routing.md say it. Broken by hand: with the old strategies.go both tests are red (the group keeps 632, 710, 051 under every routing). Run on mote, at |
||
|
|
1319a44bbc |
docs: plugin guide says what four rules do when a plugin gets them wrong (plugins#468)
Guide (en, zh, ja) and provider-plugins.md: - usage: leave used out rather than send 0; with amount/limit it is their share, with no count the window is text and routing doesn't read it; aside keeps a window out of routing whatever its count. - sign-in: a model refused is 403/404, not 401; a 401 that says only that the model isn't served is read as kept. - free comes only from the vendor's word; rate 0 is none given, never free (magpie infers nothing from rate). - GitHub listing licence: from LICENSE as GitHub reads it, else package.json's license. Docs only. Checked each claim against the source at this tree (plugin_usage.go quotaOfPlugin, plugins.go modelOnly401, fallback.go modelRefused, plugin/providers.go Model.Rate, models.go FreeModel, github.go readTagged). Site deployed with wrangler and the pages read back with curl. |
||
|
|
602ad84adc |
plugin: the host is told the gateway's address (MAGPIE_ADDR), so a page's own service reaches it on any port
yuesh1_ on X (reply to 2115451149633626237) opened the community chat page (Magiczerowxy/magpie-chat, @magpie-community/page-chat 0.1.16) and got "127.0.0.1 拒绝了连接". That is Chromium's frame error: the plugin's chat server on 127.0.0.1:3477 wasn't listening. Before v0.1.1905 ( |
||
|
|
d4f1d6480c |
plugin: a program a plugin starts with no folder runs in plugin-work, not beside magpie's settings
jiakun_zhao on X asked whose page_<hash>.html, magpie_home.html,
magpie_install.sh and magpie_*.md files they had found after using the
chat page plugin (Magiczerowxy/magpie-chat). That plugin starts the
user's MCP servers from the plugin host with node:child_process spawn
and no cwd, and runs their tools for a model. The host runs in magpie's
config folder (~/.config/magpie), so every file such a tool saved by a
relative name went beside settings.json and providers.json, and a tool
told to write "providers.json" would have written over magpie's.
host.js's spawn wrapper (which already hands on the proxy and keeps
programs off the host's stdio) now starts a program that names no
folder of its own in <config>/plugin-work, created on first use, with
PWD to match outside Windows. A folder the plugin gives is kept.
Not the cause of files in the user's home folder: magpie's host never
runs in ~, and no magpie code names a file page_<hash>.html or calls a
user's MCP tool itself. Files in ~ come from a process whose folder was
~: the chat's server started by hand (node serve.mjs) from ~, or
another agent run there. Filed on magpie-chat for the plugin to give
its MCP servers a workspace of its own and tell the model where it is.
Run (mote, macOS):
- TestPluginProgramsRunInTheirOwnFolder (new; testdata/clicwd checks
child_process spawn, spawn with env, execSync and Bun.spawn, plus an
own cwd kept): ok. Red with origin/main's host.js put back by hand
(plugin-work not made; programs ran in the config folder).
- go test ./internal/plugin ./internal/agentplug ./internal/pluginrt
-count=1: ok (plugin 261s).
- go test ./internal/gateway -run Plugin -count=1 at
|
||
|
|
c48fccfad7 |
plugin: the dist index is read from GitHub beside jsDelivr's copy, so a plugin npm doesn't have is offered its newer version
star21321321124 on Discord: CodeArts 0.2.3 showed "已自动更新", the page said
every plugin was up to date, and Update did nothing, with 0.2.4 on the
plugins repo's dist branch. npm has neither CodeArts nor River (E404), so
npmAsk's version is the dist index's latest. With the 「国内镜像」 switch on,
index.json was read from jsDelivr first, and a 200 from it was final. A
jsDelivr edge serves the branch as it was when it cached it (s-maxage=43200):
on 10-28 gcore.jsdelivr.net served the index with codearts latest 0.2.3
(age 6631s) while raw.githubusercontent.com, cdn and fastly had 0.2.4. So
the hourly update, Check for updates and Update all saw 0.2.3.
readDistIndex now asks raw.githubusercontent.com beside the mirror (with
the switch on) and merges the two copies: every version either names,
each package's newer latest. Each version keeps the sha512 its own copy of
the branch names, which installDist checks the tarball against as before.
GitHub is waited for 5s (distGrace) past the mirror's answer; unreachable,
the mirror's copy is read alone, as before. Switch off: one read, as before.
River: on dist at 0.1.0 only, nothing newer; the test holds it "current".
Run (mote, at this tree rebased on
|
||
|
|
5ced5b1aa0 |
routing: a wallet's row says what of it lapses first, as the Usage card does (#3964)
MYCF711's SuperMagic plugin (magpie-magicrew-auth daca18e) sends a balance window 积分余额 with runsOut, and 今日 / 限时 / 永久 as aside rows. The Routing page already showed all four rows, in the stage row's tooltip and the account list's .wins line, both through cardOf/winsOf (the Usage page's own readings). The row's own text said only "6,291 积分 left". For a wallet seat, quota() now adds the Usage card's runsOutText for the card's window of the same balance and unit: "6,291 积分 left · 185 积分 expire 23:59". It is client only. The Go side (allowanceOf, Weighed) is unchanged, because the aside rows are display only and routing weighs the total. Run (mote, at |
||
|
|
a05b373538 |
checkin: a plugin's until is when its answer stops holding (Qoder's 10:00 UTC+8)
sdytman on Discord: Qoder's daily credits start at 10:00, can the plugin's check-in follow it? Qoder's /me/campaigns opens each day's CLAIM_BENEFIT campaign at 10:00 and closes it at 09:59 the next day, UTC+8 (startAt and endAt, read with a real account on 10-28; Qoder.app polls the list every 5 minutes). A check-in before 10:00 meets the day before's campaign. Since #2696 the Qoder plugins are asked again every 30 minutes, so today's was claimed somewhere between 10:00 and 10:30; a plain plugin was settled for the Beijing day. auth.checkin may now answer until (RFC 3339 or epoch ms); host.js passes it as RFC 3339 (plugin.Checkin.Until), kept as ValidUntil. settled holds an answer only until then, whatever its outcome; the loop wakes at it instead of its next 30-minute look; an early done that carries it is not provisional (#3326), as the vendor said when its day turns. Instants throughout, so the machine's zone doesn't matter. The Qoder plugins send until from 0.2.43 (plugins fd40b20): the check-in now lands at 10:01. Run (mote): TestPluginCheckinAsksAgainAtUntil, minute by minute from 09:27 Beijing to the next day's 10:30, with time.Local UTC, UTC-8 and Beijing: asks at 09:27, 10:01, 00:00 (the Beijing day), 10:01; a failure in the 09:59 gap asked at 10:01:00 only. GOOS=linux and windows go vet; go test -tags nogui -timeout 45m ./... all ok (76 packages). gofmt -l clean. Broken by hand, each red: settled ignoring ValidUntil (no 10:01 asks); tick not waking at it (10:27 instead); provisional ignoring it (asked every 30 minutes from 00:00 to 10:00); host.js dropping until (ValidUntil zero). Not tried: the Qoder plugin's recheck path with until (the fake plugin is fakeco; the tick and settled it goes through are the same); a GUI change (none: until isn't shown). |
||
|
|
8bade6c5e2 |
provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.
- host.js passes a finite balance on (at least 0), anything else as null.
plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
Aside, so routing knows the account with no Used invented. allowanceOf
copies it into Limit.Balance; an empty wallet counts as used up.
Allowance.Left(model) is the least balance of the windows that count
the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
provider and unit). Smart, pace and usage (least used) put the seat
with more left first where they would otherwise tie (byLeft), only
when every seat with a balance shares one LeftIn: balances in two
units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
text, no bar, a why sentence, the account list), magpie accounts and
the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
providers-accounts, plugin-runtime, host.js typings and the site's
plugins page (en, zh, ja).
Run, at base
|
||
|
|
2b0387574e |
draw: an OpenAI-compatible plugin's image models draw (SenseNova's sensenova-u1.5-lite)
01huadalang (Discord, #feedback): SenseNova's sensenova-u1.5-lite can draw, but magpie's image generation picker doesn't list it. |
||
|
|
9bfe680481 |
plugin: a changed plugin option lists the providers again (plugins#430)
WorkBuddy's plugin 0.1.38 adds a "Free models only" switch (a plugin option) that lists only WorkBuddy's free models and refuses any other before it is sent. Its list goes by the switch, but SetProviderOptions only handed the values over: the host cleared its infos while Go kept provCache, so the Providers page and /v1/models showed the old list until something else re-read it. SetProviderOptions now forgets the kept providers (whether the host runs or not), so the next Cached() lists them again. Nothing else runs on a change. The workbuddy mover's min is 0.1.38 (npm view --prefer-online at landing: 0.1.38). Run: - go test ./internal/plugin ./internal/provider -count=1 -timeout 45m at this head ( |
||
|
|
6cb1cfb794 |
plugin: a lock behind package.json's dist tarball is mended, its tarballs kept (#3622)
Part 1 of 2, pruneDist (coffemon's first commit): pruneDist took out every tarball in plugins/dist that plugins/package.json doesn't name, as encoding/json reads it. Bun installs a package from the tarball bun.lock's packages has it at, and that can be one package.json has moved on from: gkd2323c's lock (#3622, Windows, Bun 1.4.4) had autoclaw, codearts and cloudflare-workers-ai at the tarballs before the ones package.json names, and those were gone from plugins/dist, where nothing but pruneDist takes a file out. With Bun's own copy of such a tarball, every bun command that changes plugins/ puts the older version back; with none, every add and removal, of any plugin, fails with "ENOENT extracting tarball from <that package>" (part 2 has the likely why there was none). Now a tarball the lock's packages has a package at stays, beside the ones package.json names. Kept, it is what Bun installs: a package whose lock is behind package.json stays at the older version without a word, where |
||
|
|
51202cd431 |
plugin: a check-in outcome magpie doesn't know names what the plugin said
A plugin check-in that answered an outcome not in the list, with a message, became failed with the plugin's message alone, so "the daily credits were refreshed" read as magpie's own failure reason. The reason now names the answer first: the plugin answered "yes": <message>. With no message it stays "the plugin answered no outcome" or the answer. Split out of skygunner's fix/usage-absent-used branch (#3650), which carried it beside the usage fix. Run: go test ./internal/provider -run TestPluginCheckinRunsAsTheBuiltinsDo ok. Broken by hand: host.js's old line makes it red (Msg was the message alone). Not tried: a real plugin answering an unknown outcome. Co-authored-by: skygunner <skygunner@users.noreply.github.com> |
||
|
|
9733ed1b4a |
usage: a plugin window that doesn't say used is no reading (#3650)
A plugin usage window that leaves out `used` was read as 0 in host.js
usageOf. The card then showed "100% left" (or NaN% once the GUI saw a
missing value), and allowanceOf ranked the account as the one with all
of its allowance left, so smart routing put spent accounts first.
Now a left-out used is null from the host, plugin.UsageWindow.Used is a
*float64, and quotaOfPlugin makes such a window Text and Aside: the card
shows its display (else "No allowance reported"), with no percentage and
no meter, and routing leaves it out. An account whose windows all tell no
share has no allowance and is not known to routing (routedAllowance), as
one never read: not preferred and not rested. A window that says used:0
is a reading at 0, as before.
Ported from skygunner's fix/usage-absent-used (6791aa99). Changed from
the branch:
- lastAllowances (the reading kept on disk) built an empty allowance for
such an account, which routing read as known with all of it left. Both
it and Allowances now go through routedAllowance.
- quotaText shows "No allowance reported" for a no-share window with no
display, rather than a blank.
- A host-level test (the bun host with the fake plugin) and the GUI test
widened to both engines, every language, 900 and 390px, used and left.
- The branch's check-in wording change is its own commit.
Note: an account whose windows are all aside or text was known with 0%
used before; it is now not known, so loginRoom won't pick it as the
next account with room.
Run at this tree (base
|
||
|
|
fed0055da8 |
plugin: a plugin stuck on its vendor no longer holds up the plugins loaded or listed with it
shualaitianduai on Discord: a plugin whose sign-in kept failing (401)
held up the plugins behind it. host.js loaded the plugins one after
another and answered init only when all were in, so a plugin function
that never returned held every other plugin until init's two-minute
deadline failed the whole host. providers() listed the providers one
after another too, so one stuck models hook held the whole list past
refreshDeadline (30s), and every provider's list went stale.
Now loadPlugins loads every plugin side by side, each given
pluginLoadWait (20s) for its import and plugin function, and each
config hook as long; one still loading is told as not loaded ("the
plugin's load didn't finish in 20s") and init answers with the rest.
Hooks are kept in the list's order, as before. providers() lists every
provider side by side and gives each models hook pluginListWait (20s,
inside refreshDeadline): one that hasn't answered is listed as fallen
back with that as its listError, so magpie keeps the list it had, and
that answer isn't kept for requests (keepInfo). Documented in
docs/subsystems/provider-plugins.md.
Run at this head (base origin/main
|
||
|
|
a2ff7e6cab |
plugin: add takes a community plugin's name (WorkBuddy, think-tags, qoder-cn)
Atlas on Discord (#help, 10-25, Linux): `magpie plugin add WorkBuddy`
said "isn't an npm package name". Worse, a bare `workbuddy` passed the
npm-name check and installed npm's unscoped workbuddy@latest, not
@magpie-community/opencode-workbuddy-auth.
plugin.Add, which the CLI, the Plugins page's field (/api/plugins/add)
and the movers all go through, now resolves a bare name first
(internal/plugin/resolve.go). Case aside, a name one community listing
goes by is its package, at the version given: the package or its bare
name, the short name (workbuddy, think-tags), the shown name (WorkBuddy,
Command Code), a provider id it serves or the subscription it replaces,
and a retired subscription's id through its mover (qoder-cn; provider
sets plugin.SubscriptionPlugin = MovePackage). The CLI says which
package it picked. A name two listings go by, or none that isn't an npm
name, is refused with the community plugins listed. A name no listing
goes by is npm's own package (opencode-gemini-auth keeps working), but
only when the list was fetched within the six hours: when the fetch
fails, the copy kept or built in may not name a newer plugin, so the
name is refused with why, and npm:<name> installs npm's package as
written. market() now says whether its list is a fresh fetch (marketErr).
Scoped names, paths and git specs are unchanged. A backup's or a sync's
plugins go in by their own spec (plugin.AddExact via addPluginExact),
never resolved, so a restore isn't held by GitHub being unreachable.
Update, Upgrade and InstallMissing use add with stored specs, unchanged.
Tests (fake registry over httptest, fake bun; no network):
TestResolveCommunityNames, TestResolveRefusesWhatItCantName,
TestResolveListUnread, TestAddByCommunityName. TestUpdateAllUpdatesAPinnedPlugin
adds an unscoped third-party name, so it now serves a registry.
Broken by hand: Add without resolve -> TestAddByCommunityName red with
the reporter's own error ("WorkBuddy" isn't an npm package name) and
workbuddy -> workbuddy@latest. The unread-list rule turned off (valid
name goes to npm regardless) -> TestResolveListUnread red.
Real use, sandbox HOME, built binary, real npm and GitHub:
`plugin add WorkBuddy` -> installed @magpie-community/opencode-workbuddy-auth@latest,
listed workbuddy and workbuddy-ai; `think-tags` -> middleware-think-tags;
`opencode-gemini-auth` -> npm's, google-plugin listed; `qoder-cn` with
MAGPIE_PLUGIN_MARKET=off -> opencode-qoder-auth; "Work Buddy Pro" ->
refused with the 38 community plugins listed; `twinz` with the list off
or at a dead URL -> refused, saying why and npm:twinz.
Run at this head (rebased on origin/main
|
||
|
|
5b32b7ea80 |
plugins: a Bun Windows can't load (0xc0000139, before 10 1809 / Server 2019) says so and what to do (zgcwkj on Discord)
zgcwkj runs magpie-cli-windows-amd64.exe as a Windows service (nssm) and every plugin install failed with "bun add …: exit status 0xc0000139: (and from the community repo's dist branch: bun add ./dist/….tgz: exit status 0xc0000139: )". Why: 0xc0000139 is STATUS_ENTRYPOINT_NOT_FOUND, the loader refusing the exe before it runs. Reading the PE imports (debug/pe) of Bun's windows-x64(-baseline) zips: 1.3.14 and later, so magpie's floor 1.4.2 and the latest 1.4.4, import kernel32's CreatePseudoConsole, ClosePseudoConsole and ResizePseudoConsole, which Windows has from 10 1809 (build 17763) / Server 2019 on. 1.3.13 doesn't. Bun's docs say "Windows 10 version 1809 or later" (bun.com/docs/installation). So Windows Server 2016 and Windows 10 1507 to 1803 (LTSB 2015/2016) can't run any Bun magpie uses. 1.4.2's pinned SHA-256 matches the asset. What changes: - wontLoad (internal/plugin/bun.go) reads an exit of 0xc0000139 as "this Windows" and 0xc000001d or SIGILL as "this processor" (Bun's x64 build targets SSE4.2), as a *BunUnstartableError whose message says which, the versions Bun needs, and MAGPIE_BUN. - bun add, bun update, cantStart and whyDied (the host's start) wrap it. - An install no longer tries the dist branch after it: that bun add can't start either, and its error read as the dist branch's. - The GUI's fail() answers it with code bun_unstartable, bunWhy and said, an i18n.js key (bunSaid in api.go), which api() in app.js puts through t(): en, zh, zh-TW, ja, de, in the window and in magpie web. The sentences live in Go so app.js grows one line: with both in app.js, TestCoreScriptBudget was 128 bytes over app.js's budget and 487 over the core's, and no budget is raised here. TestBunSaidIsTranslated fails when a language lacks one. The CLI prints the English message. - No fallback to an older Bun: 1.3.13 is below BunVersion and Bun doesn't support that Windows, and the -baseline assets are now the same binary. - docs/subsystems/provider-plugins.md says all this. Run: - New tests: TestWontLoadSaysWindowsOrCPU (injected NTSTATUS exits, a real kill -ILL), TestInstallOnUnstartableBunSaysWhyAndSkipsDist (0 dist requests), TestHostOnUnstartableBunSaysWhy, TestFailSaysBun Unstartable, TestBunSaidIsTranslated, plugin-bun-unstartable.test.cjs (chromium and webkit, every language, window and web). - Real Windows (10.0.26200 box, a sandbox dir of its own): a windows/amd64 nogui magpie-cli.exe with a fake magpie-bun.exe that exits 0xc0000139, `plugin add @magpie-community/opencode-raccoon-auth` printed the new message, and no dist folder was made. - gofmt -l; go vet darwin, linux -tags nogui, windows; builds of all three. - Full suite (go test -tags nogui -timeout 45m ./..., through suite-lock, at |
||
|
|
3a47e377e0 |
usage: a call whose vendor counts no cache is left out of every hit rate (#3464)
#3464 (zeewell on X): Kiro caches on its side, but its replies give only credits and a context share, never cache tokens. Every hit rate outside the Routing page read those calls' CacheRead of 0 as a miss. A Kiro-heavy day showed "hit rate 6%" when the counted calls hit 90%. The plugin already says so (opencode-kiro-auth 0.1.16 sends usage.magpie_cache_unknown), and the gateway already kept it as RouteUsage.CacheUnknown for Routing. This carries it the rest of the way: - gateway: Usage.cacheNotCounted() (the vendor said so and no try reported a cache token) goes into usage.Record.CacheUnknown on every path that records a call: the gateway's own record, the OTel attempt path in observe.go, and trace's routeUsage. - usage: Record.CacheUnknown is kept as ledger row flag 8192 (rowCacheUnknown; grepped, no other flag uses that bit). Totals sums such calls' prompt into cache_unknown and counts them in cache_unknown_calls. Totals.HitRate leaves that prompt out of its denominator, and gives no rate when nothing is left. - Old records: calls kept before the plugin said so carry no flag. A Kiro call (provider kiro or kiro-plugin) with no cache counted is read as uncounted (usage.CountsNoCache): in the ledger's row read, in Totals, and for Routing's history in internal/gui/trace.go (cacheCounted). The rule is scoped to Kiro's two ids, so another vendor's 0 stays a miss (tested). - GUI: cacheHitOf in app.js drives the tray panel's card, the Usage page's agent rows and cache tile, the requests' Cache hit rate card and each ranking row. When only uncounted calls are left it shows "—" or nothing instead of 0%. Otherwise it says "{n} requests left out: their vendor doesn't count the cache". A request row's cache cells show "—", and its details say the vendor doesn't count the cache. The Context page (context.go, context.js) shows no cache for such a call and doesn't score it as a miss. - No budget raised. This adds 625 bytes to app.js (1,320,224 to 1,320,849, under its 1,321,336); |
||
|
|
436bcc946d |
routing: a request whose vendor counts no cache tokens shows no hit rate, not 0% (zeewell on X)
zeewell on X: every Kiro request in a routing group showed cache 0%, for
claude-sonnet-5.5 and claude-opus-5.5 from Claude Code, with 148k to
182k tokens and consecutive calls.
The cause, from real Kiro calls on the owner's account (read-only, from
a sandbox): Kiro does cache. A repeated 900-line prefix cost 0.0912
credits and then 0.0484, with or without cachePoints, and with a fixed
conversationId too. But Kiro's reply holds only assistantResponseEvent,
metadataEvent {stopReason}, contextUsageEvent (a percent) and
meteringEvent (credits). There are no token counts at all, and
kiro-cli 2.32's own trace shows the same. The plugin wrote
cache_read_input_tokens: 0, which magpie showed as 0%.
opencode-kiro-auth 0.1.16 (plugins 9f6c4e8) now leaves the cache fields
out and says `magpie_cache_unknown: true`. This commit reads that field:
- aUsage reads it into Usage.cacheUnknown, ORed in Usage.add.
- routeUsage sets RouteUsage.CacheUnknown (cache_unknown, omitempty) on
a try that counted no cache read or write.
- The Routing page's promptOf leaves such a try out of the hit rate. The
row and its session then show no Cache metric, as for older history.
Clients are never told the field. Usage.anthropic() leaves it out, and
a passthrough forwards the plugin's bytes as they came. The gateway
already relays cache_control to an Anthropic-protocol plugin as Claude
Code sent it, so nothing was lost on the way to Kiro.
Left alone: the usage ledger. usage.Record has no such flag, so the
Usage page's aggregate hit rate still counts a Kiro prompt as a miss.
Filed as #3464.
Run at this head (rebased on origin/main
|
||
|
|
ed91aa04ef |
checkin: an inactive or ineligible check-in shows the plugin's reason (plugins#304)
Qoder's plugin 0.2.32 (magpie-community/plugins 74be632) says why no check-in was offered: it asked with this machine's own device identity and Qoder offered no campaign, and Qoder desktop can claim one it shows. magpie dropped a hook's message for inactive and ineligible and showed only "No check-in event now". Now: - GUI: the Usage card's row reads "<label> · <message>", wrapped under the label rather than cut off with "…" (data-why, as a failed row's reason wraps, #821); Settings' check-in line under the plugin's switch carries it too. A result without a message reads as before. No new i18n keys: the message is the plugin's own text, as for failed rows. - TUI: the Usage cell is too narrow, so it adds "c says why"; c's flash carries the message (checkinWhy). - CLI: `magpie accounts checkin` prints it after the label. - The Qoder mover's min is 0.2.32 (npm view --prefer-online: 0.2.32). - docs/subsystems/provider-plugins.md says how the message is shown. Run at this tree (based on origin/main |
||
|
|
a77b5b4fc9 |
gui: Check in now says what the press came to, not "refreshed" (#3326)
Promised to connoryang331 on #3326: a press of Check in now said "Check-in
status refreshed" whatever happened. It now says, in the same toast, a
count per kind (checkinPressSaid): "Claimed: 1 (+200 credits)",
"Already checked in today: N", "Not available yet: N" (inactive,
ineligible, or an "already" magpie asks again), "Check in in its own app:
N" (captcha, Trae's 9074), "Check-in failed for N account(s)" (red, as
before). No layout change. en, zh, zh-TW, ja, de.
A result counts as claimed now only when the vendor was asked on this
press: WorkBuddyCheckin.Asked is now sent as "asked" (omitempty). It is
still never kept: checkinNow writes the file before setting it. An
account claimed earlier today, settled and not asked, counts as already.
The TUI and CLI already say each account's result ("+N", "· already"),
unchanged.
app.js and the core budget: +771 bytes over the previous commit, 349 over
the budget after compacting the helper, raised by exactly that with the
reason in core_budget_test.go (the check-in row is the core's, the tray
panel draws it too).
Tests:
- checkin-early-done.test.cjs: the press's toast is "Claimed: 1 (+200
credits)" in each language, and checkinPressSaid's text for already,
not yet and a mix (claimed x2 +150, already, failed), bad = 1 for a
failure. qoder-checkin-recheck.test.cjs now wants "Not available yet:
1" for its inactive press.
- Red on the previous commit's app.js: both files 0/20 in Chromium.
Run at this tree:
- GUI: checkin-account, checkin-early-done, i18n-keys, plugin-checkin,
qoder-checkin-recheck, usage-card-refresh, usage-checkin, Chromium and
WebKit: 177/179; the 2 reds are usage-checkin's WebKit Qoder check-in
tab, red alone on origin/main
|
||
|
|
45fa29973c |
checkin: an early "already checked in" is asked again, not kept for the day (#3326)
connoryang331 (v0.1.1328, Windows): at 00:00:28 Beijing 14 of 29 plugin
check-ins (AutoClaw CN x5, WorkBuddy x2, CodeArts, Trae x3, MiniMax,
Raccoon x2) answered "already" (done). magpie kept that as the day's
result and never asked again, and Check in now answered from the record
without asking. A real claim at 10:54 paid +200: the vendors' days turn
later than Beijing midnight, so 00:00's "already" was yesterday's.
The class, in the checkiner every check-in shares (built-in and plugin):
- A done, inactive or ineligible answered before noon Beijing
(checkinSureHour) for an account magpie hasn't seen claim that Beijing
day is provisional. The loop asks it again 30 minutes (wbCheckinEvery)
after the answer, until a claim or an answer from noon on: at most 24
more asks a day per such account, none once magpie claims.
- A press (soon) asks again at once for done, inactive and ineligible,
whatever the hour. own-app (Trae 9074) and captcha still stand.
- A claim stamps Claimed, carried over while later answers that day say
done, so a done after magpie's own claim is settled (Qoder's claim then
done case).
- The record goes out with again: true (worked out when shown, never
kept). The card says "{name} says already checked in; its day may not
have turned yet, so magpie asks again later" and keeps Check in now;
Settings, TUI and CLI say the same. en, zh, zh-TW, ja, de.
- Qoder's recheck (#2696, pluginRechecks) is unchanged: its tests pass
as they were.
The plugins repo does not cache "already": autoclaw reads the task list
or calls dailySignin each time, codearts, minimax, raccoon and trae ask
the server each call (read at magpie-community/plugins origin/main
652f06d). No plugin change, publish or mover min.
Tests:
- TestPluginCheckinEarlyDoneAskedAgain (the reporter's 00:00:28: loop at
+29m no ask, +30m asks then claims; a press at 10:54 claims; done all
day is 25 asks and settles at noon; done after magpie's claim settled)
and TestWorkBuddyCheckinEarlyDoneAskedAgain.
- TestPluginCheckinOthersSettledForTheDay now answers at 12:00 Beijing
and checks a press asks again (claimed still settled);
TestPluginCheckinRunsAsTheBuiltinsDo, TestTraeCheckinAnswers and the
WorkBuddy nothing-to-claim/refused tests follow the new rule.
- TestCheckinAgainNotShownAsToday (TUI words and cell).
- checkin-early-done.test.cjs: again card's wording, data-state wait,
Check in now asks plugin-checkin {provider: autoclaw-cn}; a kept done
is "Checked in today +50" with no press. Chromium and WebKit, 5
languages, 900 and 440px, 20/20.
Red on the old code: with the non-test change reverse-applied (fields
kept so it compiles), TestPluginCheckinRunsAsTheBuiltinsDo,
TestPluginCheckinOthersSettledForTheDay (inactive, done, ineligible) and
all 4 subtests of TestPluginCheckinEarlyDoneAskedAgain fail; with
origin/main's app.js, checkin-early-done fails ("Checked in today").
Run at this tree:
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... clean.
- go test -tags nogui ./internal/provider/ -run 'Checkin|CheckIn',
./internal/tui/ -run 'Checkin|OwnApp': ok.
- GUI: checkin-account, checkin-early-done, i18n-keys, plugin-checkin,
qoder-checkin-recheck, usage-card-refresh, usage-checkin: 177/179. The
2 reds are usage-checkin's "webkit en/zh: Settings has a Qoder check-in
tab", red the same alone on origin/main
|
||
|
|
21f7f9df23 |
checkin: the Qoder plugins' check-in is asked again within the day, as the built-in's was (#2696)
The native Qoder and Qoder CN plugin check-in (pluginCheckinProvider) built
its checkiner without recheck, while the built-in qoderCheckiner set it.
So an inactive or done result was kept for the whole Beijing day, and a
press of "Check in now" was answered from that record too. Qoder CN's
campaign runs 10:00 to 09:59 the next day (mufanmu), so an early read
describes yesterday's campaign and said nothing about today's.
What changed:
- provider: pluginRechecks(id) is true for "qoder" and "qoder-cn" only,
and sets recheck on their checkiner. A press asks at once. The loop asks
again after wbCheckinEvery (30m) for inactive and done. Every other
plugin stays settled for the day.
- GUI (checkinRow): a Qoder account (built-in or plugin) whose check-in
found no campaign today keeps "Check in now". A press reports "Check-in
status refreshed" instead of "Checked in", since it may still find
none. The unused "Checked in" key is replaced in all four languages.
- docs/subsystems/provider-plugins.md names the exception and the tests.
Taken from LoKi's (lokic7123-star) patch on the issue: the recheck on the
Qoder plugin ids, the Check in now button for an inactive Qoder card, and
the neutral press status. Their GUI test was adapted into
qoder-checkin-recheck.test.cjs.
Left out, as the earlier review asked: the blanket 30-minute message, the
UTC timestamps and the client-computed next check. Also left out: the
"Already checked in today" wording and the "· credit" display. That is
not this bug, and the TUI and CLI would need the same change.
Run:
- Red on the old code:
- All 8 subtests of TestPluginCheckinQoderRechecksCampaigns
({qoder,qoder-cn} x {inactive,done} x {loop,press}) fail without
the fix.
- Forcing recheck on for every plugin turns
TestPluginCheckinOthersSettledForTheDay red.
- qoder-checkin-recheck.test.cjs is red on the origin/main assets (no
.ci-now on the card).
- At 91bb01e65 (base
|
||
|
|
5871f02dd6 |
plugins, provider, gui: a keyless plugin sign-in needs no key, and a single-identity plugin has one account (#2695, LoKi)
LoKi's patch (lokic7123-star), picked onto origin/main |
||
|
|
9b0f48612b |
gateway: a plugin's model that searches by itself can be the web searcher
01huadalang (Discord #feedback, 10-20): Settings › Web search offered only Antigravity; Trae's search model couldn't be picked, "可能也有别的模型能搜索 但是识别不到". partSearcher and modelSearches answer false for every provider with an account behind it, so no plugin-served provider was ever offered, and a plugin had no way to say which of its models searches. A plugin now marks such a model with `searches: true` (in its config models or the list its models hook gives). host.js passes it on, plugin.Model carries it, and pluginCatalog makes it WebSearch "native". partSearcher offers a plugin provider with such a model, with those models only, at rank 4 (as Command Code's search models); remoteSearch asks it in plain words, the way it asks Command Code's. A client's own web_search sent to that model still goes to magpie's searcher (searchesModel is unchanged): the plugin's upstream takes no web_search tool. Behaviour change: a marked plugin model ranks ahead of Antigravity and Google (rank 5) when magpie picks the searcher itself. Run: - TestPluginSearchModelIsASearcher (new; a fake plugin's model marked searches answers a weather question with a URL): red on the old code (the picker offers [], want the plugin's fake-search alone), green now. - Broken by hand: host.js without the `searches` passthrough; the test goes red at the picker. - gofmt -l clean; go vet darwin, linux -tags nogui, windows on gateway, plugin, provider, catalog. - set -o pipefail; go test -timeout 45m ./... at this tree: 68 ok, no FAIL. Not tried: the Trae plugin itself. It declares nothing about search yet; marking Trae CN's search_agent there needs a Trae account to try it with, which this machine doesn't have. No GUI files changed. |
||
|
|
ba319a7587 |
gateway: the lone tool_choice none goes to the Grok plugin only (#3110)
|
||
|
|
19527ca8dd |
gateway: tools turned off with none declared reach a plugin as tool_choice none (#3110)
Cause: buildResponses wrote tool_choice only inside its tools block, so a
Chat "none", Anthropic {"type":"none"} or Gemini NONE with no tools was
dropped on the way to Responses. A provider plugin that adds a
server-side tool (Grok's x_search, plugins PR #263) couldn't tell
"tools off" from "no choice". The other builders (Chat, Anthropic,
Gemini, Code Assist) send no tool choice without tools, which is what
their vendors accept (OpenAI Chat refuses a lone tool_choice), so they
are unchanged.
Fix:
- buildResponses keeps a lone "none" (only "none"; "" and "auto"
still go unsaid).
- forwardTranslated strips it again for every non-plugin upstream, and
for a plugin on api.x.ai or Copilot (refusesLoneToolChoice, the #378
rule now shared with passthrough). A vendor never sees it.
- The grok plugin's body shaping (grokPluginBody) keeps a lone "none";
the built-in's grokBody still drops it. grok plugin 0.1.18
(magpie-community/plugins aee6b9d, on npm) drops any lone tool_choice
itself before Grok, so the mover's min goes 0.1.17 -> 0.1.18.
Run at this commit (worktree on
|
||
|
|
a8ecf4020e |
provider: a check-in file that can't be read or parsed stops the check-in
readCheckins, the reader every daily check-in shares (WorkBuddy, Trae CN,
MiniMax Code, Qoder and the plugins' own), took a file it couldn't read
or parse as empty. The next check-in then asked the vendor again for
every account and wrote its answers over the file: an account could be
checked in twice in one day, and the entries it couldn't read were lost.
readCheckins now returns an error for a file that is there but can't be
read, or doesn't parse into entries (cut short, zeroed, empty, `[]`,
`null`). A file not there is still empty. On the error:
- checkiner.checkinNow asks nothing and writes nothing. Each account it
would look at is `failed` with the reason (the path and why), so the
loop tries again after 30 minutes and a press (GUI, TUI, `magpie
accounts checkin`) says why. The error is logged once while it stays
the same.
- The readers that only show results (WithCheckins, *Checkins(),
PluginCheckins) go through shownCheckins, which gives what last read
from the file in this process, so a card keeps its last good data.
- adoptLegacyPluginCheckins' own strict copy of the read now uses
readCheckins too.
Docs: providers-accounts.md no longer lists check-in marks among the
caches written over; provider-plugins.md says the plugin file's case.
Test: TestCheckinUnreadableFileLeftAlone writes a cut-short, zeroed,
empty, `[]` and `null` workbuddy-checkin.json, runs the loop and a press
against a fake WorkBuddy, and checks no status or claim request went out,
the file is byte for byte unchanged, and the result says the path; a
folder in place of plugin-checkin.json does the same through a plugin
checkiner. TestCheckinMissingFileIsEmpty and
TestCheckinUnreadableKeepsLastGood cover the other two sides.
Broken by hand (checkinNow taking the error as an empty map again): the
test went red, every case claimed (Asked true), and green once restored.
Run in a worktree at origin/main
|
||
|
|
62a1df8010 |
provider: a plugin's daily check-in reaches every sign-in, also two that share a display name (plugins#254)
AutoClaw's plugin can hold several sign-ins under one default display name,
which AutoClaw doesn't let the user change. plugin_checkin.go keyed each
account's check-in on "<provider>|<AccountID>", the display name, so
checkinNow's per-key dedupe asked only the first sign-in of each name, by
the loop and by Check in now alike; the others stayed 今日未签 for good,
and Settings showed one row, and one Off switch, per name.
Each sign-in is now keyed on the key plugin-auth.json keeps it under
(pluginCheckinKey: "autoclaw|autoclaw", "autoclaw|autoclaw#x1y2z3").
Two sign-ins never share it; a refresh writes the same key, and signing
in to an account already signed in goes back to its key (host.js
settle). The display name is shown only. Cards, Settings rows,
CheckinOff and Check in now all read the same key, so app.js is
unchanged. An account without an AccountID already had this key.
Upgrade (adoptLegacyPluginCheckins, run when the plugin's accounts are
listed): an entry kept as "<provider>|<display name>" goes
- in plugin-checkin.json, to the first sign-in in use of that name (the
one the old key's check-in asked) and only to it, and the old entry
is dropped: it isn't asked again today, and its namesakes, never asked,
are;
- in settings.CheckinOff, to every sign-in of that name: the user turned
that name off and none of its sign-ins was checked in since, so the
upgrade switches none on (settings.EditCheckinOff edits that field
alone from what the file holds).
A plugin-checkin.json that can't be read or parsed is left as it is and
carried over once it reads; writes go through writePrivate
(temp-and-rename). Known gap: a sign-in made the same day after another
was signed out can take the freed key and that day's result.
The fake plugin's check-in now records a signed-in account as
name@fake/uid so two of one name tell apart in the presses.
Tests:
- TestPluginCheckinTellsSignInsOfOneNameApart: four sign-ins, A/u1, A/u2,
B/u3, B/u4 (the reporter's case). All four pressed once, none again
that day, four entries kept, four Settings rows, every card marked;
with A/u2 off, Check in now the next day presses the other three.
- TestPluginCheckinCarriesOverDisplayNameEntries: a plugin-checkin.json
with fakeco|A@fake and fakeco|B@fake claimed today plus another
plugin's entry, and CheckinOff ["workbuddy|123", "fakeco|B@fake"].
A's check-in goes to its first sign-in only, the old entries go, the
other plugin's stays, both B sign-ins are off and workbuddy|123 is
kept; the loop then presses only A's namesake, and a second look
presses nothing.
- TestPluginCheckinCarriesNothingOverAnUnreadableFile.
Broken by hand, each red:
1. key back on the display name: TellsApart pressed only A@fake/u1 and
B@fake/u3; CarriesOver kept the old entries.
2. adoption not called: CarriesOver ("A's check-in went to ... ok false").
3. record to every heir: CarriesOver ("carried to both") and Unreadable.
4. Off to the first heir only: CarriesOver (CheckinOff lacks one B).
5. old entry kept: CarriesOver and Unreadable.
6. parse error ignored: Unreadable.
Run at
|
||
|
|
f76201a84a |
plugins: a sign-in page the plugin's CLI opened isn't opened again, Grok's opened twice on macOS (andyfmyth on X)
"magpie里的grok 登录验证 在mac下 似乎每次都会弹两次验证, 在浏览器窗口里". Grok's plugin signs in through `grok login --device-auth`, and Grok Build (1.0.50, the webbrowser crate) opens the device page itself, through NSWorkspace on macOS and ShellExecuteW on Windows. Neither reads $BROWSER; the macOS binary has no "BROWSER" string. magpie then opened the same URL from /api/plugin-signin (desktop), startPluginSignIn/followSignIn (a browser tab) or `magpie plugin login`. Reproduced in a sandbox HOME/GROK_HOME: grok's device-code tab appeared in Chrome with magpie not involved, with and without SSH_CONNECTION. Built-in grok is retired ( |
||
|
|
de671719a0 |
provider: a retired built-in's failed move is tried again in 10 minutes, not 6 hours
A failed move waited moveRetry (6h) before KeepRetiringMoved tried it again. That was fine while the built-in carried on serving the accounts. A retired built-in serves nothing, so a move that failed for a moment (npm out of reach, or the plugin listed in plugins.json but not installed yet, which the real-account run on 85b8f6d4d hit with Command Code: the first Move failed, the second worked) left the user's subscription unserved for up to 6 hours unless they pressed Move. - retryWait(id) is retiredRetry (10 minutes) for a retired built-in, and moveRetry otherwise. MoveRetiring and HandOver both use it (retryDue). - KeepRetiringMoved's next run is brought forward to when a retired built-in's failed move is due (nextRetiringRun, at least a minute), instead of always an hour. - docs/subsystems/provider-plugins.md says so. TestMoveCutShort now also checks: - a failed move 11 minutes old waits while the built-in serves it, and the next run is an hour; - once retired, the next run is 10 minutes, it isn't tried at once, and it is moved after retiredRetry. Broken by hand, each red: - retryWait returning moveRetry for a retired built-in: "a retired built-in after retiredRetry: map[]" - nextRetiringRun always an hour: "the next run after a retired built-in's failed move: 1h0m0s, not 10m0s" Run: go test -tags nogui ./internal/provider -run TestMoveCutShort: ok. What was run for the stack, at load ~300 (it was rebased from |
||
|
|
0f1666b387 |
provider: a built-in can be retired, its plugin serving it moved or not, and its unmoved accounts get a Move line
The owner (10-16) wants every deprecated built-in taken out of magpie,
one at a time. This is the ground for that; it retires nothing yet.
- retiredBuiltins / BuiltinRetired(id) in migrate.go name a built-in
whose code is gone. Only an id with a mover can be retired.
- PluginServes(id) is Moved(id) or retired. Every gate that asked
Moved(id) asks it now: sign-in, Factory keys, usage, logins, cards,
forget, accounts, check-ins, plugin sign-in, the CLI's accounts and
providers, the GUI's account label.
- A retired row's move.state is plugin, and its id is in onPlugins
once the plugin is installed.
- /api/providers lists a retired subscription's built-in accounts that
haven't moved in `unmoved` (MoveCandidate, now with the failed move's
error and why). The GUI shows a quiet line over the Providers list
for each, with Move / Try again (unmovedLine), in en, zh, zh-TW, ja
and de.
- AGENTS.md and docs/subsystems/provider-plugins.md say what a retired
built-in is.
Run at 270aa1c9c with this change:
- go test -tags nogui ./... -count=1 -timeout 90m: 66 packages ok.
- gofmt -l internal: nothing. GOOS=linux and GOOS=windows
go vet -tags nogui ./...: clean.
- GUI, both engines, en and zh: retired-move (new, 4/4), plugin-move,
deprecation-notice, deprecated-subscriptions, plugin-move-unserved,
plugin-movable-review, i18n-keys: 39 pass.
- TestRetiredBuiltinIsThePlugins -count=20 (it picks a mover at random).
The Move line is the Providers list's own, not a page that could be a
plugin. It took the core's scripts to 1,427,218 bytes, which the budget
main raised in
|
||
|
|
f550d3699c |
claude: a SOCKS proxy reaches Claude Code through magpie's HTTP bridge (#2651)
demystify0137's Claude account sits behind a socks5:// proxy. Every turn was answered 502 after minutes of retries, Claude Code failing each try as UnsupportedProxyProtocol: it is a Bun binary, and Bun takes only http:// and https:// proxies. magpie handed it the socks5:// URL as HTTPS_PROXY. Every Claude Code magpie runs for the subscription now gets its env from one helper, netproxy.EnvForBunWith, which sets the proxy as before and puts the loopback HTTP bridge (netproxy.Bridge, #1409) in place of a SOCKS URL: a turn (startRun), the model test (askClaude), /usage (claudeUsage), sign-in (startClaudeSignIn) and the sign-in check (claudeSignedIn). Where the bridge can't be used (it doesn't start, or Claude Code runs in WSL under NAT, which doesn't reach this computer's loopback) the request fails at once with that reason, instead of Claude Code retrying for minutes. Other CLIs magpie runs with a proxy (grok, devin, cursor-agent) aren't Bun (checked their binaries), and the settings.json env writer already leaves SOCKS out. What was run: - Real Claude Code 2.1.302 in a sandbox HOME with a fake API key, through a fake SOCKS5 proxy (temporary test, removed): raw socks5:// gave "API Error: Unable to connect to API (UnsupportedProxyProtocol)" with 0 SOCKS connections; bridged it reached Anthropic, 401 "Invalid API key", 7 SOCKS connections. - New tests TestEnvForBunWithBridgesTheProvidersSOCKS, TestClaudeCodeGivenTheBridgeForASOCKSProxy (turn, askClaude, claudeUsage), TestClaudeSignInBridgesASOCKSProxy. With proxied() put back to EnvWith both gateway and provider tests went red ("Claude Code was given the SOCKS proxy: https=socks5://127.0.0.1:1...", "login-proxy: Claude Code ran with HTTPS_PROXY=\"socks5://127.0.0.1:1\""). - gofmt -l clean; go vet -tags nogui ./... on darwin, GOOS=linux and GOOS=windows at 8b1fad8f5: ok. - Full suite at 8b1fad8f5 (this and #2649 on origin/main |
||
|
|
8233eadaec |
provider, gateway: a plugin's model served at priority has fast mode, whichever plugin (Lovest on Discord)
Since #2514 a plugin can say which tiers its vendor serves a model at
(serviceTiers). CanFast still returned true only for Cursor's plugin, so
no other plugin's models could be a group's fast member or an agent's
fast pick. The Routing and Agents pickers (gui/groups.go, agent/route.go
FastFor) and SetFastPick/SaveGroup all read CanFast, so they refused too.
Changes:
- CanFast: a plugin's model has fast mode when the plugin says it is
served at "priority", on its Chat or Responses API (pluginTierOn), where
the gateway sends service_tier. This holds for any plugin. Cursor's
fast flag and -fast sibling logic are kept below it, unchanged.
- UltraOn/CanUltra: such a model can also be picked Ultrafast when the
plugin says "ultrafast". Before, plugins were excluded outright.
- forwardTranslated: a plugin's request whose agent spoke Claude's API
carries fast mode as speed "fast", with no tier. It is now given tier
"priority" ("ultrafast" for an Ultrafast pick) when the model is served
at that tier. Before, Claude Code's fast pick on a tiered plugin went
out with no service_tier.
- The "no fast mode" error names plugins.
- docs/subsystems/provider-plugins.md says all of this.
Test: TestPluginTiersGiveFastMode (gateway, fake plugin with FAKE_TIERS):
- CanFast and CanUltra: fake-1 (priority+ultrafast) true/true,
fake-resp (ultrafast only) false/false, fake-claude (none) false/false.
- fake-claude is refused as a fast member and as a fast pick.
- A fast group member reaches the plugin's fetch as priority from Chat,
Responses and Anthropic.
- Claude Code's fast pick sends priority, its Ultrafast pick sends
ultrafast, and another agent's request sends none.
Broken by hand, each then restored green:
- CanFast's tier check off (the old behaviour): red on CanFast(fake-1),
CanUltra(fake-1) and the fast member being refused.
- forwardTranslated's Fast-to-tier off: red on the anthropic member, the
fast pick (nil, want priority) and the Ultrafast pick.
- UltraOn's plugin branch off: red on CanUltra(fake-1) and "no account
offers Ultrafast".
Existing TestPluginServiceTierReachesFetch, TestPluginModelServiceTiers*
and TestCursorPlugin* pass.
No GUI asset changed (the pickers only read canFast/UltraOK from Go), so
the GUI suite was not run.
Run:
- gofmt -l: clean.
- go vet: darwin, GOOS=linux -tags nogui, GOOS=windows -tags nogui.
- go test -tags nogui -timeout 90m ./... at 9f9bfc160+this: EXIT=0, 66
packages ok, none failed (agent 3928s, gateway 2739s, provider 785s).
The timeout is 90m because the load average was ~150-270, and 45m cut
agent and gateway short on this box earlier today.
- Rebased then onto
|
||
|
|
7d7dba31ae |
provider: removing or turning off a moved subscription's plugin moves nothing back
The built-ins are being retired (the owner, 10-16: 陆续把内置Provider下线掉),
so the last way back to one is gone. MoveBack, moveBack and releasePlugin
are removed, with the Left flag they set.
- SetPluginOff only turns the plugin off. A moved subscription stays
moved, off with it.
- RemovePlugin records the moved ids as the new state "removed". The
record keeps its accounts, which plugin.Remove leaves in the plugin's
auth store. Nothing moves or installs it by itself: MoveRetiring
skips it and keepMovedCurrent reads only "plugin".
- HandOver turns a removed record whose plugin is installed and current
back into "plugin", record and all. So does Adopt (the editor's Move).
- MoveRetiring moves an old "back" record again, whatever Left said.
- Plugins page, rm/off confirms: "{names} stops working until the plugin
is installed again. Its accounts are kept." / "... while the plugin
is off." The status after removing no longer says it is back on the
built-in.
- Strings: five old strings dropped ("Moving back…" among them), three
new ones in zh, zh-TW, ja and de.
- `magpie plugins rm`/`off` say the same in their output.
- Docs: provider-plugins.md (the states table, the Move-back paragraph)
and AGENTS.md.
Tests:
- TestNoWayBack is new. It covers a "back" record moved again, the
plugin turned off (still moved, accounts kept), removed (removed, not
reinstalled by keepMovedCurrent or MoveRetiring), installed again
(HandOver), and removed again then Adopt.
- TestReleasePlugin and TestMoveBackKeepsLapse asserted the way back
and are deleted.
- TestMove, TestHandOver, TestMoveTidiesItsPlugin and
TestAdoptBeforeSigningIn no longer call MoveBack. TestKeepMovedCurrent
uses the removed state.
- plugin-release.test.cjs checks the new asks and that the status names
no built-in.
Run:
- Broken by hand:
- With HEAD's migrate.go, TestNoWayBack is red at "turning the plugin
off moved it back".
- With HandOver's removed branch disabled, it is red at "installed
again: map[], moved false".
- go test -tags nogui ./internal/provider -run
'TestMove|TestNoWayBack|TestHandOver|TestKeepMovedCurrent|TestAdopt|TestInstallPlugin|TestWorkBuddyCheckin|Plugin|Migrat':
ok.
- GUI (NODE_PATH playwright, --test-concurrency=1): plugin-release,
plugin-move and i18n-keys, chromium and webkit: 17/17.
- gofmt -l clean; GOOS=linux and windows go vet of provider, gui and cli.
- Full suite: go test -tags nogui ./... -count=1 -timeout 90m at this commit rebased on
|
||
|
|
f9ceac1628 |
provider: a move onto the plugin takes every account, and no model holds it back
The built-ins are retired (the owner, 10-16: 一定要下线完毕), so a move
can't be held back by something only the built-in could fix. Before, a
move failed when every account was lapsed, when one account's check
failed (the vendor unreachable through the plugin), when the vendor
refused every account, or when a model in use wasn't in the plugin's
list. Each of those left the user on a built-in that is going away.
Now Move installs the plugin and imports every account:
- one the vendor refuses goes along marked lapsed, as before;
- one already lapsed, or whose check fails otherwise, goes along untried
and unmarked, for the plugin's own reads to judge, and is logged;
- no model is checked against the plugin's list.
Only an install failure, the plugin not serving the id, or a sign-in the
plugin won't import fails the move, which puts everything back and is
tried again after moveRetry. The movers' served (Devin, Cursor) and
builtin (ZCode) hooks, modelsInUse, modelNames, lapsedAll and devinBase
had no other use and are gone, with the tests of the hooks. The page still
translates an older magpie's lapsed, unserved and account whys, which
migrations.json can hold.
Tests:
- TestMoveEveryAccountLapsed and TestMoveTriesEachAccount are new, and
TestMoveToPlugin's first case is now a refused account that moves.
importAuth is a seam: the fake mover's "r-noimport" sign-in fails part
way, so TestMoveToPlugin, TestMoveTidiesItsPlugin and TestMoveCutShort
still test putting back.
- TestMoveCutShort's cut-short record now carries the sent sign-in's
hash, as a real move writes it. Without it putBack took the built-in's
sign-in as renewed. The old test passed only because the check renewed
the token a second time.
- Broken by hand: with a failed check or a refusal returning an error
again, TestMoveToPlugin and TestMoveTriesEachAccount go red.
What was run:
- go test -tags nogui ./internal/provider -run
'Move|HandOver|Lapse|PutBack|Retir|Adopt|KeepMoved|ReleasePlugin|
ZCodeStartPlan|Devin|Cursor' passes.
- go vet passes and gofmt -l is clean.
- At ab7b28510 on
|
||
|
|
9fcf6a6e7f |
provider: every deprecated built-in moves onto its plugin, and there's no way back
The owner, 10-16: 陆续把内置Provider下线掉…一定要下线完毕. The plugins now do what the built-ins did (the parity batch up to |
||
|
|
9b04c4e20f |
plugin: async gateway request hooks, run in Bun before routing and after the reply (#2118)
A package's magpie.hooks entry (or a *.hooks.{js,mjs,ts,mts} file) exports
`async onRequest(body, ctx)` and an optional `onResponse(reply, ctx)`. They
run in the Bun plugin host, so a hook can await I/O, for example a context
service like PowerContext, which the sync moejs middleware can't. The
gateway still makes one model request per client request. A hook adds
context to the body; it doesn't register tools or run a loop, so magpie
doesn't become an agent runtime.
Ported from Tsukikage7/magpie#1. Changes from the fork:
- The entry name is magpie.hooks / *.hooks.*. The fork's magpie.gateway /
*.gateway.mjs is already the middleware's alias, so a hook importing
node:fs was also loaded as moejs middleware and failed there.
TestGatewayHookNamesApartFromMiddleware fails if the two sets overlap.
- onRequest is rolled back, and counts as failed with no onResponse, when
it throws, times out, returns non-JSON, or changes tools, tool_choice,
function_call, functions, toolConfig, model or stream.
- onResponse gets the client-facing reply, merged through the gateway's own
stream decoder, collector and renderer (no second merger).
- Codex's native passthrough (/backend-api/codex) runs the hooks too,
without the sync middleware.
- The run ends with the request handler, not the client connection. Codex
hangs up on response.completed, and the reply it got is still captured
as a success. TestGatewayHookSeesReplyAfterClientHangsUp is red on the
old `r.Context().Err()` check and green with -count=3.
- ctx.origin is host-derived (local / gateway-key / remote). Headers, keys
and peer addresses never reach the hook.
- Plugins page: a hook package shows a "Request hook" chip, a diagnostics
line (outcome code, calls, avg ms, bytes, failures; no content), and
Options. Strings are in en, zh, zh-TW, ja and de.
Docs: docs/subsystems/gateway-request-hooks.md (new), provider-plugins.md,
gateway-middleware.md, and site docs plugins.html in en, zh and ja.
Real use, sandbox HOME on 127.0.0.1:3486 with the owner's real Codex Pro
sign-in. The probe hook adds a codename note and logs both callbacks:
- /v1/responses, /v1/messages, Gemini generateContent: stream and
non-stream. onRequest's note reached the model (the answer had the
codename), and onResponse got success=true and the whole reply.
- /v1/chat/completions: with the probe also changing `model`, the change
was rolled back (the reply came from the asked model) and no onResponse
ran. Without that change, earlier: stream and non-stream success.
- The real Codex CLI 0.162.1 `codex exec` through openai_base_url ->
/backend-api/codex: the hook saw origin=local, agent=codex and the
query; the answer had the codename; onResponse success=true (before the
hang-up fix it never ran: the context was already cancelled).
- `magpie plugin list` shows only "async gateway hook onRequest" for the
hook package, no failed middleware.
Tests (base origin/main
|
||
|
|
e733b0722e |
plugins: a provider plugin says which service tiers a model serves, and Codex offers them (#2514)
Lovest on Discord (#general, v0.1.1267): a provider plugin had no way to
say a model is served at Fast or Ultrafast, so Codex never offered them for
plugin models, and the host dropped the field anyway.
- host.js keeps m.serviceTiers (tiersOf: string ids or {id} objects,
trimmed, de-duplicated, anything else dropped) as plugin.Model.ServiceTiers.
- pluginCatalog puts them on catalog.Model.Tiers; CodexTiers offers a
plugin's tiers when it declares any, so codexcat writes service_tiers
(priority named Fast) into Codex's catalog and /v1/models.
- forwardTranslated keeps service_tier (OwnTier) for a plugin provider only
when the request is translated to its Chat or Responses and the tier is
one the model declares (provider.PluginTiers). A request relayed in its
own protocol was already sent as the client wrote it; unchanged. Cursor's
fast flag and #1954's ChatGPT tiers are untouched (#1954 not on main yet).
- Docs: serviceTiers in site/public/docs plugins (en, zh, ja) and a
"service tiers" section in docs/subsystems/provider-plugins.md.
Tests (internal/gateway/plugin_tiers_test.go, fake plugin FAKE_TIERS):
TestPluginModelServiceTiersListed (fake-1 priority=Fast + ultrafast,
fake-resp ultrafast, fake-claude none) and TestPluginServiceTierReachesFetch
(Responses→plugin Chat and Chat→plugin Responses send a declared tier,
drop an undeclared one; same-protocol relays as before).
Broken by hand: OwnTier branch forced false → 3 translated cases red;
CodexTiers without IsPlugin → listed test red; host.js serviceTiers: [] →
listed test red. Restored → green.
gofmt -l clean; go vet -tags nogui with GOOS=darwin, linux, windows clean.
Not tried with a real vendor plugin that serves ultrafast.
Full suite: go test -timeout 45m ./... at af9e0d6b2 (sandbox HOME, load
average ~408 from other sessions): every package ok except agent and
gateway, which timed out at 45m with no failed test (rerun whole: timed
out again, 0 failures), gui (TestMainWindowCorners killed, #1936),
TestVendorThatStopsMidAnswerIsSaid (filed #2535) and
TestSetAnswersWhileDevinAndProvidersHang (#1375). The reds and the tests
running at each timeout (TestCodexKeptOnChatGPT, TestReplyNamesMember)
pass rerun alone, except TestMainWindowCorners (#1936). CI is the gate.
|
||
|
|
e894443932 |
trae: a check-in Trae CN refused 9074 says Trae refused it and to check in in the Trae CN app, not that Trae pays only its own app (#1920)
#1920 showed Buddy Switch checking in third-party Trae CN accounts, so
"Trae CN only gives check-in credits to its own app" wasn't true. What is
known is that Trae CN answered the claim 9074 (当前参与用户太多). The
own-app outcome stays as it was (the day's answer, no Check in now), but a
Trae account (By "trae") now has its own text in every place it shows:
- GUI card and Settings line: two new keys in en, zh, zh-TW, ja and de
("Trae CN refused this check-in (9074: too many taking part); check in
in the Trae CN app" / "Trae CN 拒绝了这次签到(9074 当前参与用户太多),
请在 Trae CN App 里签到"). WorkBuddy keeps the shared own-app key.
- TUI line and cell, CLI: provider.TraeRefusedWords; the cell says
"签到 refused by Trae CN (9074) · check in in its app".
- trae_checkin.go, workbuddy_checkin.go and provider-plugins.md comments
and the claim's fallback message say the same. They also note the
plugin side: since @magpie-community/opencode-trae-auth 0.2.14 the
account the machine's own Trae CN client is signed in as checks in with
the client's device id, read only. No id is made up or rotated (#1705).
Ran (worktree at origin/main
|
||
|
|
118f4f28bf |
plugin: a community plugin npm doesn't have installs from the plugins repo's dist branch, so a reviewed plugin no longer waits unmerged for an owner's npm 2FA (magpie-community/plugins#84)
npm's Trusted Publishing can't create a package, so a new plugin's first
version needs an owner's 2FA, and reviewed PRs sat unmerged for it. A
trust made after 2026-09-03 also allows stage publish only, which is why
npm refused zed 0.1.7 and zen-free 0.1.7.
The plugins repo now packs every merged version onto its `dist` branch
(scripts/dist.mjs, magpie-community/plugins f5308cd): tgz/<file> and an
index.json with each version's sha512, manifest and README, with no
credentials. magpie still asks npm first. Only when `bun add` fails for a
@magpie-community package at latest or an exact version, and not because
of the user's minimumReleaseAge (that hold is kept), does installDist
fetch the tarball. It refuses the tarball unless its sha512 is the index's,
keeps it in plugins/dist and runs `bun add ./dist/<file>`. A later npm
install replaces it, and pruneDist removes tarballs package.json no longer
names. npmAsk (market version, Update, the hourly check) takes dist's
latest when npm errors or is behind, and Readme falls back to dist's. The
branch is read through jsDelivr when the China mirror switch is on, else
raw.githubusercontent.com. installMu is now held for the whole install,
fallback included.
Run at this head (on origin/main
|
||
|
|
4e9335c96c |
plugin: Windows on ARM downloads Bun's native windows-aarch64 build and runs plugins, not "Bun has no build for windows/arm64" (#2183, EdwinDigital)
bunTargetFor turned windows/arm64 away, so magpie-windows-arm64.exe listed a plugin as on while its host never started, and its providers never showed. Bun publishes bun-windows-aarch64.zip (1.4.2 and later), so windows/arm64 now maps to it, with no baseline suffix (arm64 has no baseline build). Its SHA-256 a7a16b87…0cfd is added to bunSums, taken from Bun 1.4.2's SHASUMS256.txt, so the download is still checked and can come through a mirror. The provider-plugins page says so. What was run (macOS arm64, sandbox HOME, private GOCACHE): - TestWindowsOnArmGetsNativeBun (new): with windows/arm64 stubbed, Bun() downloads bun-windows-aarch64.zip from an httptest release and runs it; the checksum is the official one. Old bun.go: FAIL "bunTarget = "", Bun has no build for windows/arm64". - TestBunTargetForMusl gains windows/arm64 and now checks every target has a checksum; TestBunDefaultSums and TestBunTarget list bun-windows-aarch64. Both FAIL on the old code. - go test ./internal/plugin/ ok; gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean; GOOS=windows GOARCH=arm64 go build ok. - Downloaded the real bun-v1.4.2/bun-windows-aarch64.zip: SHA-256 matches, it holds bun-windows-aarch64/bun.exe, a PE32+ Aarch64 binary. Not tried: a real Windows ARM64 machine (the Windows box is x64), so the plugin host starting on that bun is not verified. |
||
|
|
33da86c71a |
provider: removing a plugin sets its providers' model picks in providers.json aside, and adding it again puts them back (#2057, dawn1095)
A plugin's provider leaves a record in providers.json once the user picks its models: its id and nothing of its own (OnlyPicks). Removing the plugin left those records behind. Nothing listed them, `magpie provider rm` couldn't reach them, and a sync or backup asked for a sign-in to them on every run. RemovePlugin now finds the ids the plugin's providers are stored under (PluginID of each provider plugin.Listed gives for its spec), and moves the records with those ids that hold only picks into providers.json's new pluginLeft, under the plugin's package name. Left alone: - any record with an endpoint or a key (the user's own provider, whatever its id); - a built-in's ids (accountIDs) and "magpie"; - an id another installed plugin serves too; - everything, when the plugins' listing isn't known (no cache and no plugin-providers.json): unknown is not "none is the user's". provider.AddPlugin (CLI, GUI, backup restore) puts the set-aside records back, each one whose id has no record now; one the user has given to a provider since stays aside. plugin.Listed is new: the cached listing, or plugin-providers.json. Run: - plugin_left_test.go, four tests with user-owned records beside the plugin's (a user "zap" with an endpoint next to the plugin's zap-plugin, a hand-made "mine", a built-in's picks, another plugin's and a shared id). Each guarantee broken by hand turned its test red: no set-aside, no OnlyPicks check, no other-plugin exclusion, no unknown-listing guard, take-back over the user's record, no take-back. - go test ./... in a sandbox HOME; gofmt -l; go vet darwin, linux (-tags nogui), windows. Not done: records left by plugins removed before this change stay where they are; turning a plugin off (not removing it) sets nothing aside; `magpie provider rm` still can't name such a leftover. The move flow (installPlugin) still adds through plugin.Add, since its own migration owns those records. Not tried with a real plugin removal in the GUI. |