Commit Graph
331 Commits
Author SHA1 Message Date
yetone 2ea25b925b cursor: the latency test's far events show once their step has answered, and a step's wait is counted in asks, not ms (#159, #162, #165)
#159 and #162: the "far from Cursor" fake showed a Run's usage event
SHOWS (225 ms scaled) after the Run's stream closed. The step's wait
takes its last look about 180 ms after that close, so only ~45 ms stood
between "the event is not there yet" (what the test means) and "the
event is already there" (the step owns it and the sum moves). A loaded
machine eats 45 ms. #162's title guessed an earlier test's cached
usage; it was the step's own event showing inside its wait.

The fake now holds a far Run's event until the step whose Run it is has
answered, and shows it at once if that step already has: the state the
test is about, not a duration.

#165: test 1 bounded each step's wait in milliseconds, which load
stretches. Each wait asks once and the round trip is most of it, so the
bound is now at most 2 asks per step (its own event, plus what earlier
steps owe).

Run (bun 1.4.2, load average 280-295 throughout):
- Old test, cause injected by showing the event earlier (SHOWS - 50 ms):
  #159's failure; SHOWS - 80 ms: #162's. New test with the same
  injections: green.
- packages/cursor/latency.test.mjs: 9 of 9 green.
- packages/cursor whole package (HOME=$(mktemp -d) bun test): 3 of 3,
  272 pass, 0 fail.
- Broken by hand in index.mjs, each turned the new test red: the step
  waiting for its own event removed; owed() not gathering at the end;
  the ask bound raised (a step asking 3+ times).
Not run: the whole-repo suite (test-only change in one file).
2026-10-16 19:11:56 +08:00
yetone be7b03e090 autoclaw: the refresh test reads the expiry between the clock before and after, not the clock again
"refreshTokens orders hosts by the token's source_id and falls back on
400002" compared the expiry refreshTokens computed (Date.now() + 3600s -
10min) with Date.now() read again after it returned. On a millisecond
boundary between the two reads it is off by one: publish run 38885546686
(devin 0.1.20's push, 29adee2) went red on ubuntu with expires
1792148517446 against 1792148517447, and no package published. The test
now takes the clock before and after the call and checks the expiry lies
between them.

Run: with a 3ms busy-wait injected after refreshTokens returns, the old
test is red (0 pass, 1 fail) and the new one green. bun test in
packages/autoclaw under a mktemp HOME: 9 pass. bun scripts/check.mjs
autoclaw: ok. Test only; the package's version is unchanged.
2026-10-16 18:14:43 +08:00
yetone 3d0a546aa3 usage 0.1.1: the tab is named in the window's language, and the tiles fill four across or two by two
magpie.page.titles names the page in zh, zh-TW, ja and de; a magpie that
doesn't know titles still reads title. The tiles were auto-fill, which left
a hole in their row at most widths; now four across, two by two under 640px.

Run: bun test in packages/usage (6 pass). Tried in the magpie sandbox app's
dev UI with the real usage.jsonl, WebKit, dark and light, zh and en, at
900 and 560px.
2026-10-16 18:13:05 +08:00
yetone 29adee2688 devin 0.1.20: a tool's images go to Devin with its result, as the built-in sends them
magpie's built-in Devin (internal/gateway/devin.go buildDevin) sends the
images a tool returned on the tool message that answers the call
(inlineImages(p.Images), field 10). A chat's tool message holds text
alone, so magpie's gateway hands the plugin those images in the user
message after the results (buildChat's seeLater: "[From the result of
<tool> (tool call <id>):]" then the images, and the result's text ends
"[The tool returned an image; it follows in the next message.]"). The
plugin sent them to Devin as a user message of their own, and a tool
message's own image_url parts were dropped.

build() now puts each result's images back on its tool message: the
images under a heading naming a result just sent, up to the number its
note says (so the user's own images after them stay the user's), and a
tool message's own data: image_url parts. The note is taken off the
result's text when every image it names went back with it; an empty
result is "(no output)", as the built-in words it. Images without bytes
(URLs) are left out, as inlineImages leaves them. A heading that names no
result just sent is left as the user's text.

Run:
- bun test in packages/devin under a mktemp HOME: 93 pass, 0 fail.
- bun scripts/check.mjs devin: ok.
- tool-images.test.mjs against the old index.mjs: 3 of its 4 tests red
  (the fourth guards a heading naming no result, which held before too).
  With the count limit broken by hand (images past the note's number taken
  as the tool's), the two-results test goes red.
- The fixtures in testdata/ are magpie's literal buildChat output at
  origin/main b03031738, captured with a throwaway test in a separate
  magpie worktree (codexViewImage, and an Anthropic request with two Read
  results and the user's own image).

Not tried: a real Devin account (whether Devin's model reads a tool
message's images better than a user message's was not measured); OpenCode
itself, outside magpie, whose own shape for a tool's images was not read.
2026-10-16 18:10:59 +08:00
yetone 8fc3833aa7 commandcode 0.1.13: the Credits window renews at the plan's period end, the CLI's free models are free, and a Go request's max_tokens stays within 200,000
Three things magpie's built-in Command Code did that the plugin didn't,
ahead of retiring the built-in:

- The Credits window had no reset, though the month's credits come back
  when the plan's period ends, which billing/subscriptions' currentPeriodEnd
  says (sub.until, already the card's "until"). allowanceOf now puts it on
  the window as resetsAt (yetone/magpie#2454). No period end, no reset.
- The models the CLI marks FREE (magpie's cmdFree, all 11: Space Bunny
  Alpha, Pixel Canary, Laguna S 2.1, the Ling 3.0/3.1 Flash ones, the
  MiniMax M3/M2.7 free ids, LongCat 2.0 free, Tencent Hy3) now say
  free: true on every list: the Provider API's, Go's, and Go's table when
  the list can't be had.
- A Go chat's max_tokens sent to /alpha/generate is kept within 200,000,
  the most Command Code takes ("Too big: expected number to be <=200000
  at params.max_tokens"; magpie's CommandCodeMaxOutput in cmdRequest).
  Before, a 384,000 ask failed the whole request.

Run: bun test in packages/commandcode: 49 pass, 0 fail. parity.test.mjs
is new; usage.test.mjs's two plan-with-period cases now expect the reset.
Broke each by hand and watched red: no resetsAt, 3 fail; no free flag,
3 fail; no cap, 1 fail. bun scripts/check.mjs commandcode: ok.
Live, with the owner's GOAT key: the card's Credits window says resetsAt
2026-10-28T16:16:42Z, the subscription's until; its list (71 models) has
poolside/laguna-s-2.1-free free, the only one of the 11 Command Code lists
today. Not tried live: a Go request over 200,000 (no Go key here).
2026-10-16 17:37:25 +08:00
yetone 0c35adbf03 cursor 0.2.18: a failed tool result tells Cursor isError, and a refused keychain read is not asked again for ten minutes
Two things magpie's built-in Cursor did that the plugin didn't, ahead of
the built-in's retirement:

- The stateless path (conversation) sent every tool result with
  isError false. A chat tool message with is_error: true (what magpie now
  sends for a failed tool, as the built-in's cursorResult told Cursor
  isError) is marked isError, as the native path already did.
- cliToken ran `security` on every call. It now reads the Keychain as the
  built-in's cursorKeychainToken (internal/provider/cursor.go; magpie
  #746, #2408): a read is kept 10s; a read that failed with anything but
  exit 44 (no such item) may have been a dialog the user said no to, and
  is not asked again for 10 minutes; reads go one at a time, so callers
  at once share one run. A sign-in and the read after `cursor-agent
  status` read afresh, as forgetCursorStatus / cursorTokenOf(true) did.
  README's "read on every request" says so now.

What was run (bun 1.4.2, macOS, load average ~280-300):
- parity.test.mjs (new, 5 tests): green. Broken by hand, each watched
  red, then restored: is_error ignored (1 red), cache check removed
  (3 red), denied backoff at 10s (1 red), exit 44 treated as refusal
  (1 red), no read serialisation (1 red).
- `security find-generic-password` for a missing item gives execFile
  err.code 44 (number) on this Mac, as the mapping assumes.
- Full `bun test` in packages/cursor, 7 runs: 272/272 green in 4; the
  other 3 red only in latency.test.mjs ("events never show in time",
  #159; "nothing naming the session", #162), which the change doesn't
  touch. On clean origin/main aec06bd, latency.test.mjs alone is red
  too, including "far from Cursor ... cache and all" (filed as #165).
- Not tried: a real Keychain dialog denial; the backoff is checked with
  a fake `security`.
2026-10-16 17:36:57 +08:00
yetone 47a8bb40d2 zed 0.1.8: a free account's card says "No plan", as the built-in's did, and the README says what the plugin and magpie now do
What changed:
- usage: magpie's built-in zedLoginQuota showed a free account's card
  (plan_v3 zed_free, or none) as "No plan", unless an overdue invoice was
  its error, while the account row kept zed.PlanName's "Free". magpie's
  card knows "No plan" (app.js noPlan) and translates it. The plugin's card
  said "Free". It now says "No plan" in the same case; the sign-in still
  saves planName "Free", and an overdue free card keeps "Free" with its
  error, as the built-in's switch did.
- README: "Not included" listed the plan display, which the usage hook has
  shown since 0.1.x, and several accounts and the web-search stand-in,
  which magpie gives a plugin provider itself (plugin_accounts.go, the
  gateway's generic searchReply path). It is now a "Usage" section and an
  "In magpie, not the plugin" section.

What was run:
- usage.test.mjs: the free-account test (zed_free, "" and an overdue free
  account) fails on 0.1.7's index.mjs ("Free" for "No plan"), passes now.
- packages/zed under a scratch HOME: 31 pass, 0 fail (4 files).
- bun scripts/check.mjs zed passes.

Not tried: a real free Zed account.
2026-10-16 17:36:24 +08:00
yetone 09f946b5e6 zcode 0.1.19: a GLM Coding Plan's own resets show on the card, each with its end, a team's say so, and a Start Plan refusal says what to do, as the built-in did
What changed, for parity with magpie's built-in ZCode before it retires:

- Personal resets. The built-in's zcodeQuota read
  /api/biz/customer-package-reset/list?targetType=PERSONAL with the plan's
  key (zhipuPersonalResets, yetone/magpie#1191) and showed the count, by
  window, and each reset's end. The plugin read only the team's list.
  codingUsage now reads the personal list alongside the subscription list,
  so a Coding Plan card (and a dual gift + Coding Plan card, built on it)
  carries resets: {count, byWindow, fiveHour, weekly, until, each}.
- Team resets now carry team: true and each, as zhipuTeamResets set Team.
  Both lists are read by one resetsOf: only available ones count, each
  {until?, window} sorted soonest first with an endless one last
  (sortResetCards), nothing on a failed read or none left.
- Start Plan refusal. A Start Plan answer that is a 405, the block page
  ("request has been blocked" / errors.aliyun.com) or code 3012 / "unusual
  activity" now comes back, same status, as {type:"error", error:{message:
  "<vendor's words, or the status for a block page> — <hint>"}}, the hint
  word for word magpie's provider.ZCodeStartBlockedHint, as the built-in's
  zcodeStartExplain / Provider.Explain put it. The block page's own words
  are left out, so magpie's APIError no longer reads it as a network
  firewall's (BlockedHint). Coding Plan and team answers are untouched.
- README: the resets and the Start Plan's hint.

What was run:
- usage.test.mjs: a new test with #1191's literal reset list (the
  built-in's zhipuResetList) fails on 0.1.18 (no resets); the team test,
  now expecting team and each, fails on 0.1.18 too.
- start.test.mjs: the new refusal test fails with the startBlocked line
  disabled by hand (block page passed through), passes with it.
- Every packages/zcode test file under a scratch HOME: dual 25, gift 20,
  models 1, moved 1, own 6, signin 3, start 11, usage 16 (83 pass).
- bun scripts/check.mjs zcode passes.

Not tried: a real account's reset list or a real Start Plan refusal.
`team` and `each` reach magpie's card from its next release; older magpie
ignores them.
2026-10-16 17:36:24 +08:00
Mars-Sea 4a35799021 factory 0.1.32: a model's token multiplier reaches magpie as its rate (#158)
Every model in MODELS carries the tokenMultiplier droid 0.241.1's registry
has for it (testdata/droid-0.241.1-costs.txt, byte for byte). A promotion
running takes its discount off it, with the multiplier before it as rateWas;
one that has ended or not begun is no discount. The rate reaches magpie
through a provider hook (host.js reads rate/rateWas from its models; a
config hook's models carry no rate there). Fast Mode entries stay last.

Reviewed at 498b8723e5350657aa26f8f0e2bb1d859f59803b:
- each multiplier and promotion checked against the testdata excerpt;
  gpt-5.6-sol's expired M promotion is skipped and Pt (20%) applies, as
  droid's first-running-promotion rule gives
- host.js info(): the provider hook's list replaces the config list, and
  the request path strips temperature for OpenAI models in droidBody, so
  capabilities.temperature=true in providerModel changes nothing sent
- factory unchanged on main between the PR's base 7687314 and fe5631c

Run (HOME=$(mktemp -d), PR head merged with main fe5631c):
- bun test: 1620 pass, 2 fail; the two are cursor latency.test reds under
  the full run at load ~260, already filed as #159 and #162; packages/cursor
  alone: 267 pass, 0 fail
- bun test packages/factory: 149 pass, 0 fail
- packages/factory/rate.test.mjs against main's index.mjs: 5 fail
- bun scripts/check.mjs: passes
Not tried with a real Factory account here (the author did, 46 models).
2026-10-16 17:36:20 +08:00
yetone aec06bdf96 devin 0.1.19: a chat's response_format is told in the instructions, as the built-in told it
Devin's GetChatMessage has no field for the answer's format, so magpie's
built-in Devin (internal/gateway/devin.go, req.inSystem()) told the model
in the instructions: the json_schema's schema, or any JSON object for
json_object. The plugin dropped response_format, and magpie's generic
plugin path falls back to inSystem only when an upstream answers 400
naming the format, so a moved user asking for JSON got prose. build()
now adds the built-in's words (format.go's instruction) after the
system messages, ahead of the tool descriptions, at the head of the
first user message. A json_schema with no schema asks for any JSON
object, as the built-in's openAIFormat reads it.

Checked against the built-in, no change needed:
- Lightning variants (swe-2-high-lightning, swe-1-7-lightning-medium):
  the built-in's tiers are fast and priority only (devinTiers), so a
  -lightning id is no effort and no tier and is listed as its own model,
  as the plugin lists it.
- A failed tool's result: magpie sends its content as "Error: …", and
  build() passes a tool message's text to Devin as it came; a test now
  holds that.

Run: HOME=$(mktemp -d) bun test in packages/devin: 89 pass, 0 fail.
structured-output.test.mjs: 3 of its 5 tests red with the index.mjs
change taken out (the other two: no format unchanged, and the
"Error: " pass-through). bun scripts/check.mjs devin: ok.
Not run: a real Devin account, nor magpie end to end.
2026-10-16 17:32:23 +08:00
yetone 060bda8f65 kiro 0.1.12: a request's structured output (output_config.format) is told in the system prompt, as the built-in told it
Kiro's generateAssistantResponse has no field for the answer's format, so
magpie's built-in Kiro (internal/gateway/kiro.go, req.inSystem()) told
the model the schema at the end of the system prompt: "Respond with a
single JSON value and nothing else, matching this JSON schema:\n<schema>."
The plugin dropped output_config.format, and magpie's generic plugin path
falls back to inSystem only when an upstream answers 400 naming the
format, which the plugin never did, so a moved user asking for JSON got
prose. buildKiro now says the schema the same way, after the caller's
system prompt and before the thinking budget prefix. The AI SDK's
output_format is read too. A JSON object with no schema needs nothing
here: magpie's Anthropic body already tells it in the system prompt.

Run: HOME=$(mktemp -d) bun test in packages/kiro: 46 pass, 0 fail.
structured-output.test.mjs: 3 of its 4 tests red with the index.mjs
change taken out (the fourth checks a request with no format is
unchanged). bun scripts/check.mjs kiro: ok.
Not run: a real Kiro account, nor magpie end to end.
2026-10-16 17:32:22 +08:00
yetone fe5631c1cb zen-free 0.1.10: the sign-in says a personal OpenCode key belongs in the built-in OpenCode Zen (TradingLife on Discord)
A user typed keys made under several OpenCode accounts into Zen Free's key
field and expected several accounts. The method's authorize() always
returns key "public", and magpie's host stores result.key over the typed
key (host.js save), so every such sign-in is the same shared credential
and the typed key is dropped. The label and README now say so and point
own keys to magpie's built-in OpenCode Zen provider (several keys,
rotation and failover).

Run: bun test in packages/zen-free, 174 pass 0 fail. Read host.js
apiKey/save on magpie 63be47717 to confirm the stored key is "public".
Not tried: a sign-in through magpie's GUI with the new label.
2026-10-16 16:59:02 +08:00
yetone 9fd59cf6e8 trae 0.2.15: a model Trae's list marks multimodal takes images, and they reach it (#161)
Reported on magpie's Discord (#help): through magpie, Trae CN's doubao
model said it couldn't read images, while in Trae it reads them.

Every model was listed as text-only (MODEL's modalities), and partText
put "[an image, which this model can't see]" in every image's place, so
no image ever reached Trae.

What changed:
- Trae's lists mark each entry `multimodal` true or false
  (config_info_list). A listed model's flag now decides
  capabilities.input.image, attachment and modalities, over a fallback
  entry's word. Doubao-Seed, Kimi K3/K2.6, Qwen 3.7 Plus and MiniMax M3
  are true; GLM-5.x and DeepSeek V4 are false.
- An image sent to a model that takes images goes to llm_utils_chat as
  an OpenAI image_url part ({url}) after the text part. That is the
  shape TRAE's ai-agent carries (LLMRawMultiContent/LLMRawChatImageURL,
  in the ai-agent binary's strings) and what autumnsentiment/Trae2api-cn
  passes llm_utils_chat unchanged.
- A model marked false still gets the placeholder.
- The fallback list marks kimi-k2.6 and qwen-3.7-plus as taking images,
  as Trae's SOLO list does.

The list fixture is two entries of a relay's capture of the SOLO list
(wangqi233/trae2api scripts/_solo-models-clean.json).

Run:
- images.test.mjs: 6 pass on this change; 5 of 6 fail on 0.2.14's
  index.mjs (only the text-only case passes there).
- packages/trae: 146 tests, 0 fail.
- HOME=$(mktemp -d) bun test across the repo: 1616 pass, 0 fail.
- bun scripts/check.mjs: ok.

Not tried: a real Trae account. Magpie's owner has none signed in, so no
real image request was sent to Trae.
2026-10-16 15:41:00 +08:00
yetone 3dbaa0b16f cursor 0.2.17: a tool-result continuation in a Run's last minute rebuilds before writing results, not 502 at the lifetime (#157, nicegui)
Run at this commit: packages/cursor `bun test` (isolated HOME) 267 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-16 15:40:48 +08:00
nicegui 0b821908bc cursor: a tool-result continuation in a Run's last minute rebuilds before writing results, not 502 at the lifetime (#157, nicegui)
The 15-minute absolute lifetime spans all of a retained Run's tool
roundtrips. A tool-result continuation that arrives with no more than
min(60s, lifetime/10) left now retires the owner (410 "retired before
lifetime deadline") and rebuilds from the supplied history before writing
any result, instead of resuming and failing mid-segment with "native Run
lifetime expired". Replays of an already submitted batch keep their path.
Merging main resolved a conflict with a7614aa (#143): expireIn sets
expiresAt as well as the timer.

Reviewed at 75e481a (nicegui's 6f03753 plus the merge of main):
- packages/cursor `bun test` (isolated HOME) 267 pass, 0 fail, three
  times; `bun scripts/check.mjs` ok; PR CI run 38868447170 green, attempt 1.
- The near-expiry test fails on the source without the reserve check.
- Near-deadline injected by shifting Date.now() from the owner's
  expiresAt, not by waiting: 62s left resumes on the same Run (1 Run, 1
  result written); 59s and 0.5s left rebuild (2 Runs, no result written).
  With the check removed by hand, 59s and 0.5s go red.
2026-10-16 15:39:10 +08:00
yetone a7614aa2ff cursor: the lifetime-expiry test brings a Run's lifetime in after its first answer, not before it starts (#143)
The native retention test set NATIVE_LIMITS.lifetime = 65 before the
first ask. The lifetime counts from the Run's start, so on a loaded
machine the first Run expired before it answered: 410 where the test
wants 200. NativeSession now sets its deadline through expireIn(ms), the
constructor giving it the whole lifetime as before, and the lifetime case
calls owner.expireIn(65) after the first answer. The resultWait case
still sets its limit up front, since that wait counts from the answer.
The plugin's behaviour is unchanged, so there is no version bump.

Run:
- Injected: on the old test, a lifetime of 0–10 ms is red ("Expected: 200
  Received: 410"); 15 ms and up is green. The new test is green.
- HOME=$(mktemp -d) bun test, whole repo: 10 runs in a row, 0 fail
  each. On current main 2dd4328 plus this change: 1609 pass, 0 fail.
- bun test packages/cursor/latency.test.mjs 8 runs: green with this
  change. On main without it, 1 red in 8 runs. That red is
  "events never show in time" at load ~120, filed as #159. It is not
  this test. grok's login flake from an earlier run is #160.
2026-10-16 15:30:52 +08:00
unisong 7687314d07 codex-history: opt-in Codex Responses history filter middleware (#152)
An opt-in gateway middleware for Codex Responses history after a provider
or account switch. For a provider whose rule turns historyFilter on, it
drops old reasoning items and items typed encrypted_content, removes the
optional server id from message and tool items, and sets store false. It
keeps text, tool arguments, results and call_id pairing. It rejects
previous_response_id, conversation, item_reference, encrypted compaction
and /responses/compact with a message, instead of dropping them silently.
Every provider passes through unless configured. No network, file, env or
child-process access.

Run at the reviewed head 96881ead, merged with origin/main:
- bun test packages/codex-history: 22 pass, 0 fail.
- The same 22 cases.json cases through magpie's own engine (moejs, via
  internal/middleware Begin/Request in a throwaway test): 22 ran, all equal.
- Broke it by hand (reasoning items kept): bun 4 fail, moejs 4 BAD; restored.
- Whole repo: bun test 1606 pass, 0 fail; bun scripts/check.mjs exit 0.
2026-10-16 15:11:17 +08:00
yetone 2dd4328d5a cursor 0.2.16: a multi-step turn's last step reports its own share of usage, and a step's calls get batchWait from the latest one (#156, #155)
Run at this commit: packages/cursor `bun test` (isolated HOME) 266 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-16 15:09:25 +08:00
yetone c7c6498d85 cursor: a multi-step turn's last step reports its own share of usage, and a step's calls get batchWait from the latest one (#156 erzay, #155 midmirror)
#156: a native Run of N tool steps ended with TurnEndedUpdate's totals as
the final step's prompt_tokens (1,105,934 on erzay's ~21-step turn, where
the real context was ~61K), and Codex compacted at once. The final step
now keeps its last model call's share, max(that call's chars/4 prompt
estimate, turn total / model calls), split proportionally across input,
cache read and cache write; the rest goes into usage.magpie_deferred
(merged with any settled stateless debt), so magpie still bills the whole
turn. On erzay's numbers that is ~52.7K reported, ~1.05M deferred.

#155: waitForBatch armed once, at a step's first call, so a step whose
calls arrive one by one as the model writes them (13 calls, 9 long-arg)
failed 502 "did not complete its declared native tool batch" ~30s after
the first call even though it never paused that long. The deadline now
restarts on every call, answered call, count and text/reasoning frame.

Run at this commit: packages/cursor `bun test` (isolated HOME) 266 pass,
0 fail, three times; `bun scripts/check.mjs` ok. The three new tests fail
on 4e64f26's source (prompt 1105934; sealed step failed at 300ms; stall
failed 303ms after the first call instead of after the latest).
2026-10-16 15:09:25 +08:00
hubo 423e78e49c autoclaw 0.1.0: AutoClaw (Zhipu OpenClaw) provider plugin (#53, hubo1989)
Adds packages/autoclaw, @magpie-community/opencode-autoclaw-auth, for AutoClaw (Zhipu OpenClaw).
- Providers autoclaw (oversea, web sign-in through Google or z.ai) and autoclaw-cn (CN, phone SMS).
- Reads the credit balance and runs the daily check-in through auth.checkin.

Since the 10-08 review, this fixes:
- The OAuth callback takes a code only with the state the authorize page handed out (login CSRF). The legacy /callback is gone.
- The local server closes after 10 minutes even if magpie never calls callback, so port 18432 isn't held.
- The registry entry no longer uses ZCode's icon.
- The User-Agent names the real arch.
- The check-in row's used is 0.
- A 401 or 403 the upstream answers without an envelope marks the sign-in expired.
- New tests with a fake fetch cover loader().fetch, refreshTokens and the callback's state check.

What was run, at 356fb53 (8a0fd3a plus a merge of origin/main 118cf2e; the merge resolved registry.json, raccoon's entry beside autoclaw's):
- HOME=$(mktemp -d) bun test packages/autoclaw: 9 pass, 0 fail.
- Whole repo, HOME=$(mktemp -d) bun test: 1584 pass, 0 fail.
- bun scripts/check.mjs: all ✓.
- Broken by hand, each turning a test red:
  - Dropping the callback's state comparison: 1 fail.
  - Dropping the expired mark on a non-envelope 401: 1 fail.
- The package isn't on npm yet. magpie serves it from the dist branch until an owner publishes its first version.

Not verified: a real AutoClaw account, and the 10-minute server close (read, not tested).
2026-10-16 15:04:41 +08:00
yijiemaooo-ux 118cf2edcc raccoon 0.1.0: SenseTime Raccoon (商汤小浣熊) provider plugin (#88, yijiemaooo-ux)
Adds packages/raccoon, @magpie-community/opencode-raccoon-auth, for SenseTime Raccoon (商汤小浣熊, xiaohuanxiong.com).
- Sign-in: through the browser, or reusing Raccoon desktop's live sign-in.
- Lists the models and makes chat requests.
- Reads account credits (balance and bills).
- Runs the daily check-in through auth.checkin, plus the desktop's first-login grant. The grant is marked settled only when the vendor gives a definite answer.

What was run, at the reviewed head 6078f92 merged onto origin/main 4e64f26:
- HOME=$(mktemp -d) bun test packages/raccoon: 21 pass, 0 fail.
- bun scripts/check.mjs: every package ✓, raccoon included.
- Whole repo, HOME=$(mktemp -d) bun test: 1575 pass, 1 fail.
  - The failure was grok's "a login's link is still handed on", a 5s timeout. Another full suite was running on the machine at the same time.
  - The test passed 5 of 5 when run alone.
  - It is filed separately.
- The raccoon code is byte-identical to c068cc5. That head was reviewed line by line on the PR, and every fix was broken by hand to check that its test goes red. 6078f92 only merges main.
- The package isn't on npm yet. magpie serves it from the dist branch until an owner publishes 0.1.0 (scripts/new-to-npm.sh).

Not verified: a real Raccoon account. Only the reply bytes the author captured were used.
2026-10-16 15:00:23 +08:00
yetone 4e64f2680c factory 0.1.31: an OpenAI model's request goes without temperature and top_p, not 400 (sweanng424, Nowledge Mem on gpt-6.1-sol, magpie's Discord)
OpenAI's reasoning models turn temperature and top_p away with a 400, and
droid sends neither. droidBody now takes both out of a Responses request
for a model whose upstream is openai, also when the body already opens
with droid's line. configModels says temperature: false for those models,
so OpenCode doesn't send it either. Grok and the chat-completions models
keep theirs.

Run: bun test in packages/factory, 144 pass. The new test fails on 0.1.30's
index.mjs (temperature still in the body). Not tried against Factory's API
with a real account.
2026-10-16 13:50:29 +08:00
yetone 6a3fe9b49e calc: the tools are named calc_* from npm too (magpie v0.1.1260) 2026-10-16 03:41:45 +08:00
yetone df3a04070a README, registry: tools, pages and routing strategies, and how to write your own
registry.json lists tools-calc (kind "tools"), page-usage (kind "page")
and middleware-reserve (kind "middleware"), community, with en/zh
summaries and no icon (magpie has none that fits).

README: sections "Routing strategies" (under Gateway middleware), "Tools
for every agent" and "Pages", each with a table and what a package of
that kind is a folder with; "Write your own" pointing to
usemagpie.ai/docs/plugins (#tools, #pages, #gateway-points, #middleware,
#agents, #quick) and to a template package of each kind. The market
section names the kinds.

Run: registry.json parses (26 entries); HOME=$(mktemp -d) bun test 1554
pass, 0 fail; bun scripts/check.mjs ok.
Known: magpie main's Plugins > Discover (plugins.js kindOf) treats any
kind but middleware and agent as a provider, so the tools and page
entries show with the provider chip until magpie learns those kinds.
2026-10-16 02:57:51 +08:00
yetone b3a3e609ed middleware-reserve 0.1.0: routings that fill to a ceiling, or accounts before keys
A routing-strategy gateway plugin (magpie.gateway, exports strategies):
reserve/ceiling fills accounts in listed order up to `ceiling` percent of
their allowance (80 by default), then the next; past it everywhere, the
least used first. reserve/accounts-first puts subscriptions before API
keys, accounts least used first, keys by weight then recent tokens.
Resting seats go last in both. One file, no imports, for moejs.

Run:
- bun test packages/reserve: 12 tests (10 strategies.json cases through
  checkStrategies, exactly two strategies and no hooks, every answer a
  permutation for 2-8 seats). Breaking the resting rule by hand turned
  its case red.
- Sandbox magpie from yetone/magpie origin/main b03031738: `magpie plugin`
  lists "routings reserve/accounts-first, reserve/ceiling". A stub
  OpenAI-compatible provider on 127.0.0.1:3593 recorded the key of each
  request; the provider had key-a, key-b, key-c (weight 5), listed in that
  order. routing=reserve/accounts-first: 3 of 3 went to key-c. With key-c
  answering 429: key-c 429 once, then key-a, key-b, key-a (key-c resting,
  last; equal weights by fewer tokens). routing=reserve/ceiling: 4 of 4
  to key-a (keys' allowance unknown, so listed order).
Not tried: the over-ceiling tier with real subscription accounts; it is
covered by strategies.json only.
2026-10-16 02:57:43 +08:00
yetone 8828f7731c page-usage 0.1.0: a page with calls, errors, tokens and cost at a glance
A new kind of package: a page in magpie's window (magpie.page), with
magpie.permissions ["usage:summary"] and nothing else. Today, 7 or 30
days; models by tokens, calls or cost; the picks are saved through
magpie.options.set (debounced past the bridge's once-a-second limit).
Theme from --magpie-* variables; en and zh text.

Run:
- bun test packages/usage: 6 tests (permissions are exactly what the
  scripts read; no fetch/XHR/WebSocket; no inline scripts; every local
  reference exists; what tiles and rows say).
- Sandbox magpie from yetone/magpie origin/main b03031738: `magpie plugin`
  lists "page Usage glance (reads usage:summary)". `magpie web` on
  127.0.0.1:3595 serves every page file under the sandbox CSP
  (connect-src 'none'); /api/plugin-pages/read usage:summary answers the
  sandbox's 10 calls; providers:list is refused 403. Headless Chromium and
  WebKit (playwright 1.62.0) opened the sidebar tab: tiles "Calls 10,
  Errors 0, Tokens 70, Cost $0", row "stub-1 70 · 10 calls", no console
  errors; picking 7 days wrote "period": "7d" to plugins.json.
2026-10-16 02:57:43 +08:00
yetone bd6e1ed387 tools-calc 0.1.0: exact arithmetic, unit conversion and date math for every agent
A new kind of package: an OpenCode plugin whose only hook is `tool`,
which magpie serves to every agent on /mcp/magpie/tools. Three tools:
eval (exact rational arithmetic in BigInt fractions), convert (data,
time, length, CSS, mass, angle, temperature) and date (calendar-aware
add, between, weekday/ISO week, IANA zones through Intl, DST included).
No network, no key, no dependency.

Run:
- bun test packages/calc: 8 tests, 73 expects, pass with TZ=UTC and
  TZ=Pacific/Kiritimati.
- A sandbox magpie built from yetone/magpie origin/main b03031738
  (nogui, HOME in a scratch dir, gateway on 127.0.0.1:3591):
  `magpie plugin add <folder>`; `magpie plugin` lists
  "tools calc_convert, calc_date, calc_eval". Over /mcp/magpie/tools:
  initialize, tools/list (3 tools with their schemas), tools/call
  calc_eval 0.1+0.2 -> {"exact":"3/10","decimal":"0.3"}, 1/0 -> isError
  "division by zero", calc_convert 1 GiB->MB -> 16777216/15625
  (1073.741824), calc_date across New York's DST with `to` -> between.
Not tried: an npm install. From npm the tools are named tools-calc_*,
since magpie's ShortName doesn't strip "tools-".
2026-10-16 02:57:29 +08:00
yetone b93c9eca8c scripts: check tools-only plugins, skip pages and routings, run strategies.json
check.mjs now checks a plugin whose only hook is `tool`: each tool's name
is one an MCP client takes, and it has a description, args and execute.
It skips packages with magpie.gateway (routing strategies) and page-only
packages (magpie.page with no main), whose own tests check them.

middleware.mjs gains order() and checkStrategies(): a gateway plugin's
strategy is asked for an order the way magpie's gateway asks it
(internal/routes.Apply), falling back to the listed order on a throw or
an answer that isn't a permutation, and strategies.json cases are run
against it.

Run: HOME=$(mktemp -d) bun test (1554 pass, 0 fail) and
bun scripts/check.mjs (every package ok) at this tree with the three
packages that follow.
2026-10-16 02:57:19 +08:00
yetoneandsryimnoob ffc06aca49 opendesign 0.1.6: each model is asked on the API amr-link thinks on, and reasons at max too (#141, sryimnoob123)
sryimnoob123 measured a streaming request to every model on each of
amr-link's three APIs: chat completions carries the thinking of most,
claude-haiku-5.5 and deepseek-v4-pro think longer on Responses, and
glm-5.3-flash thinks only on Anthropic's messages. The vendor also names
max beside low and high. #141 was written against 0.1.4 and conflicted
with 0.1.5 (#137's levels), so it is ported onto main here:

- WIRE/MODEL_WIRE/wireOf as the PR had them; the provider default is
  chat completions, and a live list's and the seed's models each carry
  api.npm/provider.npm, which magpie's host reads per model.
- The config hook sets every model's wire again over a kept copy, so a
  model 0.1.5 left on the Responses API moves to its own.
- max joins every measured level list.

Run: bun test in packages/opendesign, 22 pass (a new test holds a kept
0.1.5 model moving to its wire; the old Responses-only expectations were
changed to the measured ones). Not tried against a real amr-link account.

Co-authored-by: sryimnoob <314134180+sryimnoob123@users.noreply.github.com>
2026-10-16 00:53:37 +08:00
yetone b549b40b14 opendesign 0.1.5: a signed-in account's models reason in magpie, at the low and high levels amr-link took (#137, sryimnoob123)
sryimnoob123 measured amr-link with reasoning_effort high and low on all
11 models (magpie 0.1.1254, Windows): every one answered 200, and all but
gpt-6-luna streamed reasoning, four the catalog calls "standard" too.
Their install showed all 11 with reasoning false and no levels. Two
causes:

- provider.models gave the live list in the config's shape
  (reasoning: true, modalities: [...]). magpie's plugin host reads a
  listed model's thinking from capabilities.reasoning and its kinds from
  capabilities.input, so for a signed-in account every model read as not
  reasoning, with no image input. It now gives OpenCode's model shape
  (servedOf: api, capabilities, variants), as minimax/workbuddy do.
- No model had levels: nothing declared variants, and magpie shows a
  model's levels only from them. models.mjs now records the measured
  levels (efforts): ["low", "high"] on the 10 that thought, [] on
  gpt-6-luna (took it, never thought). Only the two levels the table
  shows were given. A model with levels reasons whatever its capability
  word; one the seed doesn't know keeps the old rule (advanced reasons)
  with no levels. refresh-models.mjs keeps efforts like names.

Run:
- bun test packages/opendesign: 21 pass, 0 fail. New: "a signed-in
  account's models reason at the levels amr-link took (#137)", "the
  seed's models carry the measured levels as the config's variants";
  the live-list test now pins the OpenCode shape.
- Broken by hand: modelsOf back on modelOf (config shape) -> 2 fail;
  efforts not passed from the seed to the live list -> 1 fail.
- magpie origin/main internal/plugin/host.js run under bun with a
  preloaded fetch stub serving a 3-model catalog (init + providers, a
  stored oauth account): with 0.1.4 gpt-6-luna, deepseek-v4-pro and
  claude-haiku-5.5 all list reasoning=false variants=[] image=false;
  with this change luna false/[]/image true, v4-pro true/[low high],
  haiku true/[low high]/image true, url the amr-link base.
- refresh-models.mjs against the same stub: efforts kept per model.
- bun scripts/check.mjs: every package ok.
- TMPDIR/HOME isolated bun test (whole repo): 1526 pass, 0 fail. A first
  run had 1 fail, packages/grok/login.test.mjs "a login's link is still
  handed on" timing out at 5s with load average ~100; alone 3/3 pass and
  the rerun of the whole repo passed. Untouched package; not filed.

Not tried: a real Open Design account (none here) or magpie's
`model efforts` command end to end; the levels rest on the reporter's
table.

Full suite: bun test (whole repo, with factory 0.1.30 below it): 1527 pass, 0 fail
2026-10-15 21:11:53 +08:00
yetone b8717aa860 factory 0.1.30: requests say droid 0.242.0, the current release (sky杨 on magpie's Discord: every model 403 "Factory: Forbidden" from Claude Code on 0.1.29)
sky杨, on magpie 0.1.1254 with this plugin at 0.1.29, got 403 "Factory:
Forbidden" from Claude Code on every model, GPT, Claude and Gemini alike.
Factory's body was a bare "Forbidden", not a phrase-specific refusal.

Header diff against droid 0.242.0 (npm droid and @factory/cli-darwin-arm64
0.242.0, unpacked with --ignore-scripts into an empty directory and read
with strings, never run). Its model requests carry: Authorization,
X-Factory-Client: cli, X-Client-Version, X-Factory-Org-Id, User-Agent
factory-cli/<ver>, x-session-id, x-assistant-message-id, x-api-provider,
x-provider-routing-source (registry_default without a routing claim),
OpenAI-Platform: org-bHuLtG1fGmYk5YaOihAAXFBw for openai/azure_openai,
and X-Api-Key "placeholder" from its Anthropic client. The plugin sends
each of these with the same value, apart from the release: 0.233.0, nine
releases behind. The WorkOS client id is unchanged. droid's binary still
reads a server-side min_cli_version flag and runs a forced auto-update.

0.1.16 was the same case (JL: every model 403 "Forbidden" from pi and
Claude Code while droid worked; the plugin said 0.231.0, two behind), and
JL's later reports (0.1.25) were about models, not refusals. Whether
Factory refuses an old release with a 403 is still not confirmed: there is
no Factory account to try with. This is the one header difference found.

Run: bun test in packages/factory, 143 pass. With VERSION put back to
0.233.0, droid.test.mjs goes red (Expected "0.242.0", Received
"0.233.0"). bun scripts/check.mjs factory: ok.
Not tried against Factory itself.

Full suite: bun test (packages/factory) 143 pass
2026-10-15 21:01:58 +08:00
yetone da27b4ce6b zen-free 0.1.9: a free model Zen lists is offered the hour it lists it, before OpenCode's catalog or docs describe it, and a list read with them out of reach isn't said as fallen back (yetone/magpie#2385)
Zen made deepseek-v4.1-flash-free free (in its /models as the public key
reads it, 2026-10-15) and the plugin never offered it. Two causes:

- buildModels left out a listed model that neither the catalog
  (models.opencode.ai) nor the docs' endpoint table described: a free
  model Zen lists before they catch up, or every model but the snapshot's
  when either can't be read. A listed id ending in -free with no word from
  either is now asked through the provider's own package
  (openai-compatible, chat), as OpenCode asks a model with no package of
  its own. A paid or unknown id that doesn't say -free still needs the
  catalog; the docs saying SystemOne still keep one out.
- A discovery with the catalog or the docs unread was marked
  magpie.fellBack, though Zen's own list was read. magpie answers a
  fallen-back list by keeping the last list read in full
  (plugin.keepListed), so a user who can't reach GitHub's raw host or the
  catalog kept that old list, and every model Zen made free since stayed
  out. Only a failed read of Zen's /models is fallen back now; models
  verified before are still kept while Zen lists them.

Tests (no network; the fixture server serves
fixtures/zen-models-2026-10-15.json, Zen's /models byte for byte):
- "a free model Zen lists that the catalog and the docs don't describe is
  offered, on chat (#2385)": catalog 503, docs 404 -> the ten free models
  Zen lists (Jev, "test" and the paid ones out), deepseek-v4.1-flash-free
  on chat, muse-spark-1.3 on Responses, not fallen back; a request for it
  goes to /chat/completions
- "... before the catalog has it is offered with the catalog read (#2385)"
- models.test: an unknown -free id is offered on the provider's package,
  "unknown-paid", "freebie" and "free-model" aren't, SystemOne stays out
  (replaces "unknown models require a known protocol rather than a
  guessed chat endpoint")
- two partial-discovery tests now expect no fellBack
Broken by hand: models.mjs back to 0.1.8's -> 3 fail; provider.mjs back
to 0.1.8's -> 3 fail; both fixed: bun test 174 pass, 0 fail (bun 1.4.2).
bun scripts/check.mjs zen-free: ok.

Not tried: a live request to deepseek-v4.1-flash-free through the plugin
(one GET of Zen's /models was the only network used). A future free
model Zen serves on Responses or Messages that the catalog doesn't
describe yet would be offered on chat and refused by Zen until the
catalog has it.

No magpie mover to raise: zen-free isn't a moved built-in, and magpie
updates @magpie-community plugins by itself within the hour.
2026-10-15 19:46:57 +08:00
yetone c59ee33efe scripts/owner.sh: npm asks for 2FA on the terminal, and a run with none stops first
Run through Claude Code's ! (no terminal), every npm step printed the 2FA
link and failed with EOTP at once: npm waits for the browser only when it
can ask on a terminal. npm now reads from /dev/tty, so piping the script
to sh still works, and a run with no terminal says so before any npm step.

Run: with no terminal, --dry-run lists the four packages and the real run
stops with the message, exit 1, nothing asked of npm. Not run on a terminal
(that takes the owner's 2FA).
2026-10-15 18:13:30 +08:00
yetone 80baa27570 scripts/owner.sh: an npm owner's first publishes and Trusted Publishers in one command
Finds from the registry, for origin/main, each package npm doesn't have
(first publish, then publish.yml as its Trusted Publisher with
--allow-publish) and each whose version npm lacks (its trust revoked and
made again with --allow-publish, then publish.yml dispatched). Runs npm 11
through npx, since npm trust needs 11.5.

Run: sh -n; --dry-run against the real registry lists opendesign 0.1.4 and
type4me 0.1.0 as new, zed 0.1.7 and zen-free 0.1.8 as behind, and leaves
no worktree behind. The trust-id parser was tried on sample JSON. The
publish and trust steps themselves need an owner's 2FA and weren't run.
2026-10-15 18:07:43 +08:00
yetone 2b67811af8 cursor 0.2.15: calls the bridge answers itself count toward Cursor's tool count, and KV replies wait for a slow link instead of failing the Run (#142, Evopower)
Run at this commit: packages/cursor `bun test` (isolated HOME) 263 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-15 17:51:41 +08:00
yetone 1bf9113390 cursor: calls the bridge answers itself count toward Cursor's tool count, and KV replies wait for a slow link instead of failing the Run (#142, Evopower)
Cursor's tool_requests_listed (InteractionUpdate 27) counts every call of
the model's step, and is sent after them. That count includes calls the
plugin answers itself: a tool the request doesn't have (0.2.14's native
path refuses those) and Cursor's get_mcp_tools (exec 36). 0.2.14 counted
only the calls it accepted. A step with a refused call then either waited
30s for a call that never came (502 "did not complete its declared native
tool batch") or met the next step's count with the stale one (502
"inconsistent native tool count", the reporter's error). The stateless
decoder had the same miscount and hung. Both paths now count answered
calls toward the step and end a step whose calls were all answered without
one.

503 "native outbound messages limit reached": a long history goes out as
one blob per message, and Cursor asks for every blob at once. The native
transport caps its pending writes at 256 messages / 16 MiB and failed the
Run when a slow link backed them up past that. KV replies now wait for
room (NATIVE_LIMITS.writeWait, 30s) and fail only if the link doesn't
drain for that long. The stateless path writes directly and has no cap.

The fixtures are real Cursor frames captured on 2026-10-15 (model auto,
cursor-agent's agent.v1): get_mcp_tools plus a refused WebSearch in one
step followed by read_file, which gave 0.2.14 the reporter's exact
"inconsistent native tool count"; and read_file, refused WebSearch,
read_file under a count of 3, which gave 0.2.14 the batch timeout.

Run at this commit (on origin/main 43d93b0):
- packages/cursor `bun test` (isolated HOME): 263 pass, 0 fail.
- `bun scripts/check.mjs`: every package ok.
- Broken by hand: with native-session.mjs and index.mjs reverted to
  0.2.14, the new tests fail with "inconsistent native tool count",
  "native outbound messages limit reached", the batch wait, and the
  stateless decoder's hang; 4 of 5 red (the stateless mixed case passes
  on 0.2.14, which hands WebSearch to the caller there).
- Real Cursor, before the fix: the captures above reproduced both 502s
  through the plugin's native path. The 503 was not reproduced on a real
  link (my queue peaked at 160 of 256); it is reproduced in the test with
  a 16-message bound and a slow fake write.
- Real Cursor, after the fix (owner's account, model auto, the mixed
  prompt): native path 3 of 3 runs 200 with read_file a.txt and b.txt
  (WebSearch refused to the model), stateless 3 of 3 runs 200; a native
  Run with 1200 history messages 200.
- Not proven: the reporter's empty replies. They are likely the turns
  after these failures and are not addressed separately.
2026-10-15 17:51:41 +08:00
yetone 43d93b0cf9 devin 0.1.18: each model carries the price Devin lists for it, and SWE-2 is free again beside its Lightning variants (太陽と向日葵 on Discord)
太陽と向日葵 on magpie's Discord: Usage no longer shows what calls through
Devin cost. Two causes, both in what the list gives magpie:

- Every model went with a price of 0 (runtimeModel's cost), and magpie
  falls back to models.dev, which has none of Devin's own models (SWE-2,
  SWE-1.7 Lightning). Devin lists each paid model's price in
  GetCliModelConfigs: field 32 of a config, one per "Input", "Cached input"
  and "Output", a float32 in USD per "1M tokens". parsePrices reads it
  (fields() now keeps a fixed32's bytes), and listed() gives an entry the
  price its variants share, none when they differ. Read from Devin's own
  response on 10-15: Opus 5.5 4/20 (cache 0.2), its fast run 8/40, SWE-1.7
  Lightning 2.5/12.5, SWE-2 Lightning 1/5, GLM-5.2 1.4/4.4. The Free tier
  lists none.
- Devin now files swe-2-high-, -medium- and -max-lightning under SWE-2 at
  the High cost tier. A family was free only when every model under it
  was, so swe-2 lost free (seen in the owner's plugin-providers.json on
  0.1.17), and with it 0.1.16's rule that a used-up day and week don't hold
  SWE-2. A family is now judged by the variants variantFor sends it as:
  those at an effort and its default.

Run: HOME=<mktemp -d> bun test in packages/devin: 84 pass. prices.test.mjs
uses Devin's real GetCliModelConfigs bytes of 10-15, cut to 11 configs
(testdata/model-configs-1015.bin, no account data in it). Without the
index.mjs change: 3 of its 4 tests red. Broke by hand: the family's free
over every model again turns 2 red; cost back at 0 turns 1 red.
bun scripts/check.mjs devin: ok. Every price above checked by decoding the
full real response with a separate Python reader.
Not run: magpie end to end with this version (magpie reads a plugin's
price from its next commit on).
2026-10-15 17:39:13 +08:00
yetone 9a4ec8600c workbuddy 0.1.24: a refused sign-in on a request over 2 MiB says the 401 and to sign in again, not ECONNRESET (wyp on Discord)
wyp's WorkBuddy AI requests worked for a while, then every turn failed as
"502 WorkBuddy AI: ECONNRESET: The socket connection was closed
unexpectedly". Measured on www.workbuddy.ai and copilot.tencent.com: the
front door answers a token it refuses with 401 only for a body up to
2097152 bytes. At 2097153 bytes and above it resets the connection with no
reply. With an accepted token, 20 MB bodies go through, and app errors
(400 11128) still come back on big bodies. So once a long Claude Code
session is past 2 MiB and the account's sign-in is refused, every turn is a
reset, and nothing about it is temporary.

Keep-alive reuse was ruled out: the server closes an idle connection with
a FIN at 60s, and Bun opens a new connection for requests at 59.99s and
59.995s.

When a chat over 2 MiB fails before any reply, the loader now asks the meter
(POST /billing/meter/get-user-resource-summary, 401 for a refused token) once.
On a 401 it returns that 401 with the reason and the remedy (sign in again,
in magpie or in the desktop app), marked kept like the plugin's other 401s.
Any other answer, a failed meter read, or an abort leaves the original
error. The chat is never sent again.

Run: HOME=<temp> bun test in packages/workbuddy: 97 pass (reset.test.mjs is
a socket fake of the front door that resets past 2 MiB). Broke it by hand
(unanswered rethrows at once): 3 of the 5 new tests go red. bun
scripts/check.mjs workbuddy: ok. Against the real endpoint in a sandbox
HOME: refused token + 2.2 MB body gives 401 with the message (0.1.23:
ECONNRESET); refused short chat gives the front door's HTML 401; good
token + 2.2 MB body gives 200. Not run: magpie's gateway end to end with
this version. Why wyp's token was refused is not yet confirmed.
2026-10-15 17:25:38 +08:00
yetone 103bb24b65 trae: ownclient's tests open one fake at a time, so global.test finds the realm's own hosts (0.2.14's publish run)
checkIn() opened a fake over the one the test had already opened; closing
the second put the first's 127.0.0.1 origin back as trae-cn's hosts, so
global.test.mjs, run after it in one process, read a fake host. The
publish run for 2009f49 went red on it and 0.2.14 never reached npm.
checkIn now closes the fake before it opens another.

Ran: HOME=$(mktemp -d) bun test at the repo root: 1509 pass, 0 fail.
Broken by hand: without the close, `bun test ./ownclient.test.mjs
./global.test.mjs` fails "the realm's table is its own" (26 pass, 1 fail),
as the publish run did.
2026-10-15 17:07:59 +08:00
yetone 2009f49751 trae 0.2.14: the account Trae CN's own client is signed in as checks in on the client's device, not one the plugin made up (yetone/magpie#1920)
On one account Trae CN's desktop client's claim went through while the
plugin's, on a device id it had made up (digits(19)) with a hard-coded
brand and OS, came back 9074 every day (MiFaZhan on yetone/magpie#808;
aliceh1 on #1920, where Buddy Switch reads the local client). Now, for a
check-in (/trae/api/v2/ug/*) only, the account whose uid matches the
userId of this machine's Trae CN client sends the client's own device id,
the one Trae's device service registered: the digits in the client's
storage.json key iCubeAuthInfo://icube-dc:<id> (seen in real clients'
files, #808 and #1705). x-device-type and x-os-version are this machine's
(Windows' product name, else its build; elsewhere the kernel release),
and no brand is sent, as the client's fb leaves it out with no model.

The uid comes from the client's sign-in envelope
(iCubeAuthInfo://icube.cloudide), plain JSON or the client's fixed
AES-128-CBC codec, read as dingminhua/dsh-connect-trae (MIT) reads it;
only userId is looked at, the client's token is never used. The file is
only read, never written. Every other account keeps its own device; a
missing or unreadable file, one that can't be made out, a failed
integrity check, or zero or several icube-dc keys change nothing. No id
is made up, changed or rotated (the owner's ruling on #1705 stands).

Ran: bun test in packages/trae, 140 pass (11 new in ownclient.test.mjs);
bun scripts/check.mjs trae ok. Broken by hand: matching every account
instead of the client's uid fails "an account the client isn't signed in
as keeps its own device"; not passing the client's device to ugHeaders
fails the two matched-account tests. Tests never read this machine's
client (fake.mjs points ownClient.paths at nothing). Not tried: a real
Trae CN client or account (none here), so whether the claim now goes
through for the matched account is unproven; the Linux paths are guesses.
2026-10-15 16:57:55 +08:00
Kun Chen 8c4bf5cc72 registry: Type4Me (agent-type4me 0.1.0) under Agents (#139, kchen0x)
Lists @magpie-community/agent-type4me (merged in #136) on the Plugins tab under Agents, with an en/zh summary like Aider's. Not on npm yet (E404 on registry.npmjs.org); magpie 0.1.1243+ installs it from `dist`, which the README's Publishing section says is no reason to hold a listing.

Run at the reviewed head 1ff93d8 (on top of origin/main e543ab1):
- registry.json parses; `bun scripts/check.mjs` exits 0; `bun test` in packages/type4me: 4 pass. PR checks (test, on-npm) green.
- dist: `tgz/magpie-community-agent-type4me-0.1.0.tgz` hashes to the sha512 index.json names; its type4me.agent.js is byte-identical to packages/type4me on main. Icon URL answers 200.
- Upstream Type4Me (joewongjc/type4me) reads `AppDataLocation.profileDirectory/magpie-agent.json` (MagpieAgentFile.defaultURL) and reloads it on mtime/size change, so "used from the next dictation" holds.
- Sandbox HOME (magpie 0.1.1208, the dist tarball's package added): Type4Me shows on `magpie agents` once ~/Library/Application Support/Type4Me exists; `magpie type4me magpie/fakeco/fake-1` wrote baseURL http://127.0.0.1:3425/v1, apiKey magpie-type4me, model fakeco/fake-1 and kept a user key beside them; `magpie type4me default` put back the user's own {"model":"user-own","extra":1}.

Not tried: the real Type4Me app dictating through magpie, and installing from `dist` (needs magpie 0.1.1243; the local one is 0.1.1208).
2026-10-15 15:38:05 +08:00
yetone e543ab1ae8 cursor 0.2.14: Run tool calls stay on one native Cursor session, and a tool past Cursor's limit resumes stateless, not as a failed turn (#135, nicegui)
Run at this commit: packages/cursor `bun test` (isolated HOME) 258 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-15 13:40:06 +08:00
nicegui 33cdf7c1a8 cursor: Run tool calls stay on one native Cursor session and resume stateless after a long tool, not a failed turn (#135, nicegui)
Cursor's Run (native) calls stay on one Cursor session across a tool result. With them, a tool that runs longer than Cursor's limit resumes stateless, not as a failed turn. The session pool lives in native-session.mjs. It applies to a conversation's first user turn, and a new user turn goes stateless (see the README). X-Magpie-Cursor-Continuity says which path a request took.

The dashboard-usage ledger counts two distinct events in one response that share a millisecond, as main did. Only timestamps claimed by earlier fetches are left out. A new deferred-usage test covers it.

Run at the reviewed head 398aeddc0186cfc38189b1f05577b181aa2d587d (merge base 5d5d86e; main has no packages/cursor change since):
- packages/cursor `bun test` 3 times: 258 pass, 0 fail each time.
- `bun test latency` 12 times with fresh HOMEs: 12/12 pass.
- Broken by hand: putting back `if (claimed.has(key + "\0" + ev.timestamp) || at >= before()) continue` makes the new test "distinct same-millisecond events in one response are billed together, not again on later fetches" fail (2 pass, 1 fail). The head's line passes.
- `bun scripts/check.mjs`: all packages pass.
- `npm pack`, extracted into a fresh dir: index.mjs, native-session.mjs, package.json, README.md. `import("./index.mjs")` exports CursorAuthPlugin and _internal, and native-session.mjs imports.
- CI: test and on-npm green.

Not tried: a real Cursor account. The owner's stored plugin sign-in has no access token. The author reports a real Claude Code run through an isolated gateway: a child resumed stateless after a 125s tool, and all 6 requests returned 200.
2026-10-15 13:39:14 +08:00
Kun Chen c4f7bea372 type4me: Type4Me (macOS voice input) as a magpie agent (#136, kchen0x)
Adds @magpie-community/agent-type4me: Type4Me (macOS voice input) as a magpie agent. magpie writes the picked model, its /v1 address and Type4Me's key into ~/Library/Application Support/Type4Me/magpie-agent.json, which Type4Me reads before each dictation (joewongjc/type4me#343, merged). The folder is the one Type4Me and Type4Me Dev share (AppDataLocation.sharedProfileName).

Run at the reviewed head dc9d19bd: bun test packages/type4me (4 pass), bun scripts/check.mjs (green). Checked every field against magpie's agentplug.Desc and the file path, keys and folder against Type4Me's MagpieAgentFile and AppDataLocation.

Not done: the first npm publish of a new package name is manual (the package has no trusted publisher yet), and registry.json is not updated in this PR.
2026-10-15 13:15:03 +08:00
yetone ec8ae09cc8 workbuddy 0.1.23: credits used up leave the free models counted out, so magpie doesn't put the account last for deepseek-v4.1-flash (#138, hheei)
WorkBuddy serves a model at x0.00 (deepseek-v4.1-flash) with the account's
credits used up: hheei's account at 560 / 560 was still served it. The
usage read gave one Credits window over every model, so at 100% magpie's
routing ranked the account spent for its free models too: put behind every
other account, and moved off by conversation affinity.

The Credits window (personal and enterprise) now carries notModels: the
ids the account's live list (/v3/config) prices at x0.00. A model free only
some hours (a night promotion) still counts, as the list never says it is
free. A list that can't be read leaves the window as before. magpie reads
notModels as it does for Devin's and Cursor's windows (Limit.applies), so
For(free model) no longer sees the full window, and a 14018 on a paid model
rests only that model (Pooled), as PaidBesideFree already did.

Run: HOME=<temp> bun test in packages/workbuddy: 92 pass. Broke it by hand
(no notModels set): the two new usage tests go red. bun scripts/check.mjs
workbuddy: ok. Not tried against a real account at 100% credits; the
behaviour that free models are still served there is the reporter's.
2026-10-15 13:11:46 +08:00
yetone b015ee515e factory 0.1.29: Claude Code on GLM and other /api/llm/o models goes without the phrases Factory refuses, not "403 Factory: Forbidden" (Echoo on magpie's Discord)
Echoo, with Factory moved onto this plugin, got "API Error: 403 Factory:
Forbidden" from Claude Code on GLM-5.3-Flash, while Codex worked on the
same account and model. GLM is a chat model Factory serves on /api/llm/o,
so magpie translates Claude Code's Messages request into chat completions
(or Responses) before the plugin gets it. Only anthropicBody, the
/api/llm/a route, adapted Claude Code's fixed phrases Factory refuses (its
identity line, "You have been invoked in the following environment", "You
are powered by the model", update-config's "not Claude, so memory", tool
output quoting them). droidBody, for /api/llm/o, only added droid's line,
so all of them went to Factory as they were. The headers, the model and
the account are the same for both agents; Codex's prompt has none of the
phrases.

anthropicBody's per-text adapters are now functions of their own
(claudeIdentity, promptText, systemMessageText, userBlockText), and
droidBody applies them to chat completions and Responses:
- chat's first system message and Responses' instructions as a system
  prompt; other system and developer messages as system messages;
- user text as a user block; a chat user string, where magpie joins a
  turn's blocks with nothing between them, also reminder by reminder;
- chat's tool messages and Responses' function_call_output as tool output.
The Messages route is unchanged: the refactor kept every earlier test
green before the new code went in.

testdata/claude-code-2.1.300-glm-{chat,responses}.json are magpie's
translations of a real Claude Code 2.1.300 request, captured in a sandbox
HOME (paths changed to /Users/me, tools left out).

Run: bun test in packages/factory, 143 pass. With index.mjs at 0.1.28 the
new claude-chat.test.mjs fails 4 of 5 (the Codex one passes on both).
bun scripts/check.mjs factory: ok. Routed the captured request through the
plugin: each refused phrase is 0 in the chat and Responses bodies now, as
on /api/llm/a (1 each with 0.1.28).
Not tried against Factory itself: there is no Factory account to try with.
2026-10-15 12:53:14 +08:00
yetone cbff94eb43 zen-free 0.1.8: the free models Zen lists are offered again when OpenCode's docs or catalog can't be read, and the docs are read from where they moved (yetone/magpie#2305, MiniFullC)
The reporter, on 0.1.7 with the public key, saw only Big Pickle, Space
Bunny Free and Muse Spark 1.3 Free: the three models the plugin knows
offline. Two causes:

- DOCS pointed at packages/web/src/content/docs/zen.mdx, which OpenCode
  removed on 2026-10-12 (anomalyco/opencode#54761, "replace old Zen and Go
  pages with V2 console docs"). It answers 404, so every discovery since
  was partial. The endpoint table now lives in
  services/www/src/docs/content/console/models.mdx; parseProtocolDocs
  reads its rows as they are.
- A listed model the catalog (models.opencode.ai) didn't describe and the
  docs didn't name was left out. When the catalog can't be read, that is
  every listed model but the three in bootstrapProvider, which is the
  reporter's list exactly. bootstrapProtocols is now a snapshot of the
  console docs' free rows (2026-10-15), used under whatever the docs say,
  and bootstrapProvider gains the catalog's metadata for Cat Jam, Step 5
  Preview, LongCat 2.5 Preview, MiMo-V2.6-Flash and Nemotron 3.5
  Lightning Free.

Not changed, on purpose: jev-1.13-free is a SystemOne decision model
(docs: endpoint /v1/systemone, no AI SDK package), which can't answer a
chat, so it stays out as SystemOne models always have. exo-free is
"deprecated" in the catalog and not in Zen's /models list now.

Tests (no network; the fixture server): "listed free models are offered
when the catalog and the docs can't be read" (catalog 503, docs 404,
listing big-pickle, step-5-preview-free, cat-jam-free, jev-1.13-free,
paid -> the three free chat models only) and "reads the console docs'
endpoint table, and Jev stays out as SystemOne" (literal rows from the new
page). Both fail on 0.1.7's models.mjs/provider.mjs (2 fail, 170 pass)
and pass with the change; bun test: 172 pass. bun scripts/check.mjs ok.

Real use (live Zen, public key, this checkout): discovery now lists
big-pickle cat-jam-free longcat-2.5-preview-free mimo-v2.6-flash-free
muse-spark-1.3-contributor-free nemotron-3.5-lightning-free
space-bunny-free step-5-preview-free, not fallen back (0.1.7: the same
eight with the docs 404 marking it partial). A request to cat-jam-free
through the plugin's fetch streamed 200; step-5-preview-free answered
Zen's own 429 "Upstream request failed: Endpoint is unavailable." twice.
The reporter's catalog failure itself wasn't reproduced from here.
2026-10-15 12:08:28 +08:00
yetone 157c7c0f88 devin 0.1.17: a tool whose schema has a list type, an array with no items, or properties or an enum with no type goes to Gemini models in a shape they take, not "There is an issue with this request" (7eleven on Discord)
7eleven, in ZCode on devin/gemini-4-argon, got every turn refused:
"Devin: There is an issue with this request, please try a different
model." (invalid_argument). It is the request content, on Gemini models
only. On a real account, gemini-4-argon, gemini-3-1-pro and
gemini-3-8-flash refuse a request offering a tool whose schema has, at
any depth:
- a list type: ["string","null"], ["string"], ["string","number"];
- type "array" with no items, items true, or items that are a list;
- properties with no type;
- an enum with no type.
claude-sonnet-4-6 and swe-2 take all of them. Nullable written as anyOf,
items {}, nullable:true, const, $ref/$defs, additionalProperties and
format all go through on Gemini.

geminiSchema rewrites them, for a Gemini uid only:
- a list type becomes its one type, nullable when it had "null", or
  anyOf of each type;
- such an array's items become {} (a one-schema list becomes that
  schema);
- a schema with properties gets type object;
- an enum gets its values' type, and an enum of mixed values is dropped.
The caller's schema is not changed. Claude and swe-2 requests are byte
for byte what they were.

What was run:
- HOME=$(mktemp -d) bun test packages/devin: 80 pass.
- gemini-schema.test.mjs, with the gemini line in build() turned off by
  hand: 10 red, one per refused shape.
- bun scripts/check.mjs: ok.
- Real account: each refused schema, sent as built here, went through on
  gemini-4-argon-medium and gemini-3-1-pro-high.
- build() end to end with a search tool holding a list type, an array
  with no items and an untyped enum: gemini-4-argon called the tool, where
  0.1.16 got invalid_argument. claude-sonnet-4-6 called it on both.

Not tried: ZCode itself against the plugin. The reporter's exact tool is
not known; ZCode's own zod 4 tools write anyOf, so it is likely one of
their MCP or plugin tools.
2026-10-15 11:08:07 +08:00
yetone 5d5d86e225 qoder 0.2.16: a tool call written into the text that can't be read, or that the stream ends inside, ends the turn as an error, never as the answer (#132)
A <tool_call> block whose JSON wasn't whole ({"path":}) was reprinted as
text, and one the stream ended inside was flushed as text; either way the
turn finished "stop" with a 200, the call lost and nothing to fail over on.
Mirrors trae since 0.2.5 (#38): a block on its way to being a call (its
content starts with "{" or holds "<function=") that can't be read, or is
cut short at the end, ends the turn as an error: the stream with the error
frame and no finish, a request not streamed (or one with nothing before the
block) a 502. A block whose JSON (or XML function) is whole when the stream
ends without its close is still the call. A tag in a code fence or inline
code, or one that isn't call-shaped (<tool_call>incomplete), stays text.

Siblings: only trae (already fixed) and qoder parse calls out of the text;
grep for tool_call/function=/invoke/DSML across packages/*/index.mjs finds
no other parser.

Run at this head:
- textcall.test.mjs (new, the issue's literal frames: closed with bad JSON,
  stream ends inside, readable control, whole JSON without its close, XML
  form, look-alike text; streamed whole and 3 chars per frame, and not
  streamed): 7 of 9 red on the 0.2.15 code (the control and look-alike
  tests passed there), all green after.
- packages/qoder: 118 pass, 0 fail.
- Whole repo as CI runs it: HOME/TMPDIR in a scratch dir, bun test:
  1320 pass, 0 fail; bun scripts/check.mjs: ok.
Not tried against a real Qoder account; the frames are the reporter's.
2026-10-15 07:10:01 +08:00
yetone 8a28086bf1 opendesign tests: the real fetch is put back after each test, so every package's tests after it pass again (publish red since #84)
bun test runs every package's files in one process. opendesign's tests
set globalThis.fetch directly, and mock.restore() doesn't undo that, so
every file after it (minimax, trae, zcode, zen-free: 148 tests) got
opendesign's stub and failed. The publish run at 3db704a went red at its
test job, so neither dist nor npm ran. #84's review saw these failures
and wrongly put them down to load.

Run: `bun test packages/opendesign packages/minimax packages/zen-free
packages/trae/usage.test.mjs` with HOME in a temp dir: 234 pass, 0 fail.
Without this change: 34 fail.
2026-10-15 06:57:55 +08:00