Commit Graph
465 Commits
Author SHA1 Message Date
yetone c9a0215f31 cursor: a continued Run that goes quiet after the caller's results ends (#364)
Test only. #364's tests covered the pause at a sealed batch but not the
resume after the submit: with resume() leaving the Run paused, every
test passed and a retained Run that went quiet on its second model call
would wait for lifetime again. This one is red with that break (times
out at 5 s) and green at cf1873e.

Run: packages/cursor native-e2e.test.mjs, Bun 1.4.2, sandbox HOME:
131 pass, 0 fail.
2026-10-24 20:35:20 +08:00
LooSheng cf1873e292 cursor 0.2.21: a Run Cursor stops answering ends, retained or stateless (yetone/magpie#2672) (#364)
A Run Cursor stops answering mid-turn now ends with a 502 that says so,
on both the stateless path (runOnce/decode) and the retained path
(NativeSession.pump), instead of holding the reply open until the agent
gives up (yetone/magpie#2672: two composer-2.5 turns waited 305 s).

Quiet wraps a Run's frames: 60 s with no message at all, or 240 s with
only Cursor's heartbeats (InteractionUpdate.heartbeat), ends it. Only
time spent waiting on Cursor's next frame counts; a retained Run parked
for the caller's tool results is paused (resultWait bounds it) and
resumes from nothing after the submit. Each frame gets a fresh wake
promise, so frames already passed on are not held for the stream's life
(review of cbd5d3b). cursor 0.2.20 -> 0.2.21.

Run at the reviewed head 6a17d61 (base 79e383c; main 8d687ad since
touched only kimi-work), Bun 1.4.2, sandbox HOME:
- packages/cursor `bun test`: 288 pass, 0 fail (17 files).
- `bun scripts/check.mjs`: every package ok.
- 20,000 frames of 50 KB through Quiet.frames with the stream left
  open: 95 MB RSS (1376 MB at cbd5d3b).

Broken by hand, each red:
- the long-lived `gone` promise put back: the WeakRef frames test fails;
- heartbeats counted as frames: both heartbeats-only tests fail;
- stateless path unwrapped: 3 stateless tests fail;
- resume() leaving the Run paused: no test went red. A test for it
  (a continued Run going quiet after the caller's results) follows in
  its own commit; red with that break, green at this head.
- decode's `e.quiet` branch removed: no test red (the message then
  reads "the reply broke off: Cursor went quiet: ..."; tests use
  toContain). Cosmetic, left as is.

Not tried by the reviewer: a real Cursor account, Windows, Cursor
actually going quiet (the author's live runs are on the PR).
2026-10-24 20:34:47 +08:00
yetone 8d687ad519 kimi-work 0.1.10: a menu the web sign-in can't get is asked again without it, so K3.1 Pro stays listed
泠夜Soul (Discord) is on 0.1.9 and still has no K3.1 Pro (k3d1-agent),
with no error and nothing in the log. 0.1.9 was checked only against
the menu signed out.

What was found: provider.models asks the menu (DescribeKimiWorkConfig,
with credentials.kimiWeb.accessToken from Kimi's file) and agent-gw's
/models together, and a failed menu ask was dropped without a word:
the list was then /models' alone, k3-agent and k2d8-preview, which is
exactly the report, on 0.1.7 to 0.1.9 alike. www.kimi.com answers a web
sign-in it doesn't take with 401 "unauthenticated", "invalid user
token" (REASON_INVALID_AUTH_TOKEN), seen on 10-24 with a malformed and
a badly signed token; signed out it answers 200 with the desktop menu.
So a stale kimiWeb token in Kimi's file (the desktop closed, or it
renewed it elsewhere) takes K3.1 Pro away silently. That this is the
reporter's case is not proven: no signed-in account here.

What changed:
- The menu, when the signed-in ask fails (any HTTP status, a timeout,
  or a reply with no models), is asked again without Authorization, as
  the desktop asks it before signing in, with the same x-msh-* headers.
  That reply is the desktop menu, K3.1 Pro first. agent-gw requests and
  usage are unchanged; nothing is retried there.
- Each failure is written to the log (console.warn, so magpie's plugin
  stderr): which ask, and its status or reason, never the token.
- jsonRequest's errors carry the HTTP status, and leaves Authorization
  out when given no token.
- no-magpie.test's fake menu is now the captured desktop menu: an
  empty one is asked twice now, which its request count would miss.

Run at this tree (origin/main df55294 + this change), macOS, bun 1.4.2,
load ~360:
- bun test packages/kimi-work: 51 pass, 0 fail. With index.mjs put back
  to df55294's: 50 pass, 1 fail, the new test (401 / 503 / empty menu
  signed in, desktop menu signed out: expects k3d1-agent "K3.1 Pro" and
  a logged line without the token).
- Live, createPlugin's provider.models with a stale-looking web token
  and a bogus Work token, against the real www.kimi.com and agent-gw,
  darwin and win32: lists k3d1-agent=K3.1 Pro, k2d8-preview, k3-agent
  and logs "DescribeKimiWorkConfig with the web sign-in failed (HTTP
  401); asking it without one". df55294's index.mjs, same script:
  throws the sign-in error (both lists failed, nothing listed).
- HOME=$(mktemp -d) bun test: 2447 pass, 1 fail, layerfs's afterAll
  timing out (#362, layerfs untouched). (A first run with HOME and
  TMPDIR under a path containing "magpie" failed four no-magpie tests
  on that path alone.)
- bun scripts/check.mjs: every plugin ok. git diff --check clean.

Magpie side, read at origin/main 137187a40: a plugin update goes
through Restart, which retires the host and calls changed(), so
forgetProviders drops the cached list and a new host lists again;
keepListed keeps an old list only for a provider that fell back, which
this one never reports. No stale-cache cause there.

Not tried: a signed-in Work account, so whether the reporter's menu
ask fails (401 or otherwise) or succeeds with a menu lacking
k3d1-agent is not known. This release logs which. Not changed: the
desktop interceptor (www.kimi.com's own web bundle, the isDesktop
branch) also sends X-Traffic-Id, x-msh-device-id, x-msh-session-id and
X-Language, and the User-Agent is still Kimi Code's (#363).
2026-10-24 20:09:47 +08:00
yetone df552949e1 kimi-work 0.1.9: the menu is asked with the desktop's headers, so K3.1 Pro (k3d1-agent) is listed
泠夜Soul (Discord) has a Kimi Work membership whose desktop picks
K3.1 Pro, model id k3d1-agent, and magpie's Kimi Work list leaves it
out, on 0.1.7/0.1.8 too, which read DescribeKimiWorkConfig for this.

Cause, seen on the live endpoint (it answers without a sign-in):
DescribeKimiWorkConfig chooses the menu by the caller's x-msh-* headers.
Asked with none, as the plugin asked it (only User-Agent kimi-code-cli),
it answers with the web menu: k3-agent, k3-agent-swarm, k2d8-preview.
Asked as the desktop asks it (x-msh-platform mac or windows, as Kimi's
Connect interceptor sends from the desktop, with x-msh-version), it
answers k3d1-agent "K3.1 Pro", k2d8-preview, k3-agent. Five tries each,
stable. So the menu code was right and its reply was the web's.

What changed:
- www.kimi.com/apiv2 calls (the menu and GetSubscriptionStats, as the
  desktop's interceptor puts them on every apiv2 call) carry
  x-msh-platform (mac on macOS, windows on Windows, web elsewhere, as the
  desktop's own rule), x-msh-version 3.2.20 (the desktop build 0.1.8's
  headers came from) and R-Timezone. agent-gw's headers are unchanged.
- A menu row's reply limit is its requestParams.maxTokens (32768 for
  every model listed today, the value that was hard-coded).
- tests/fixtures/work-config.mac.json and work-config.web.json are the
  two literal replies, captured signed out on 10-24. The new tests have a
  fake that answers as the server does (desktop menu only for mac or
  windows) and check that k3d1-agent is listed as "K3.1 Pro" with
  low/high/max, 262144 context and 32768 output, on darwin and win32.

Run at this tree (origin/main 79e383c + this change), macOS, bun 1.4.2:
- bun test packages/kimi-work: 50 pass, 0 fail. With webHeaders(platform)
  put back to {'User-Agent':UA} by hand: 49 pass, 1 fail (the new menu
  test), so it fails without the fix.
- Live: createPlugin's own provider.models against the real
  DescribeKimiWorkConfig (Authorization taken out, no account here):
  darwin, win32 and linux list k3d1-agent, k2d8-preview, k3-agent. The
  same script on origin/main's index.mjs lists k3-agent, k3-agent-swarm,
  k2d8-preview on all three.
- HOME=$(mktemp -d) bun test: 2446 pass, 1 fail; the fail is layerfs's
  afterAll cleanup timing out at 5s at load ~500 (2 of 3 red alone,
  layerfs untouched), filed as #362.
- bun scripts/check.mjs: every plugin ok. git diff --check clean.

Not tried: a signed-in Work account (none on this machine), so neither
the signed-in menu nor a chat request with k3d1-agent through agent-gw
has been seen; the signed-out menu already lists k3d1-agent, so whether
a tier without it is refused is up to agent-gw. Not changed: the
User-Agent on www.kimi.com is still Kimi Code's, not the desktop
renderer's, which hasn't been captured (#363).
2026-10-24 19:14:00 +08:00
yetone 79e383c404 layerfs 0.7.2: tool descriptions and errors say "the app" and "the host", not magpie (#358)
Tool descriptions, and the errors a call answers, are part of the prompt
the agent sends its vendor. provision said "magpie's config directory",
exec "magpie serves these tools…", "MAGPIE_LAYERFS_EXEC=1" and "in
magpie's plugin options". They now say "the app's config directory",
"the host serves these tools…", "the exec switch in the host's
environment (see the package's README)" and "the host's plugin options".
The siblings that reach the model too are reworded the same way: the
source refusal ("the app's config directory"), the sim-only error (no
package or repo name, no variable names) and the bad-backend error.
Every environment variable is still read as before.

Not changed, filed as plugins#360: the workspace path provision answers
is under ~/.magpie-layerfs by default; moving it needs a plan for
existing workspaces.

Run:
- bun test (packages/layerfs): 50 pass, 0 fail
- bun scripts/check.mjs: ok
- no-magpie.test.mjs against HEAD's index.mjs and layerfs.mjs: 2 of 2 red
2026-10-24 17:43:23 +08:00
yetone c9a52b3baf opendesign 0.1.7: the sign-in names this computer, never "magpie" (#357)
The device authorization sent `host: hostname() || "magpie"`. The Open
Design CLI, `vela login` (@powerformer/vela-cli 0.1.7, darwin-arm64
binary), sends `{"cliVersion","host","profile":"prod"}` with host from
os.Hostname(), and when the name can't be read it stops with "resolve
hostname: %w" instead of sending a name of its own. The plugin now does
the same: this computer's name, or a sign-in that stops and says why,
with nothing sent.

Run:
- vela 0.1.7 `login` in a sandbox HOME/AMR_HOME with VELA_API_URL at a
  local recorder: body {"cliVersion":"0.1.7","host":"yetone-mac-mini.local",
  "profile":"prod"}
- bun test (packages/opendesign): 24 pass, 0 fail
- bun scripts/check.mjs: ok
- no-magpie.test.mjs against HEAD's index.mjs: 2 of 2 red

Not changed: cliVersion stays "0.1.4" and the User-Agent stays the
package's own name; neither names magpie.
Not tried: a live sign-in. There is no Open Design account to approve it.
2026-10-24 17:41:18 +08:00
yetone a9b57b6fb9 autoclaw 0.2.6: user-profile carries the account's own device id, not "magpie-plugin" (#355)
fetchUserProfile sent `device_id: "magpie-plugin"`. AutoClaw 1.18.5's own
client (app.asar, getUserInfoWithAccessToken -> withWebInfo) sends the
device id the account signed in with (getAuthState().deviceId), a 64-hex
id. The plugin already generates such an id per login (newDeviceId) and
sends it with the login; the server writes it into the tokens' device_id
claim. user-profile now sends that id: the login's own at sign-in, the
refresh token's claim on refresh (old accounts included), "" only when no
token carries one, as refreshTokens already does.

Found by the new test: the global chat path forwarded magpie's x-magpie-*
hint headers to the vendor. They are now dropped there (the CN path builds
its own headers).

Run:
- bun test (packages/autoclaw): 36 pass, 0 fail
- bun scripts/check.mjs: ok
- no-magpie.test.mjs against HEAD's index.mjs: 2 of 2 red (device_id
  "magpie-plugin", then the hint headers)

Not tried: a live run. There is no AutoClaw account to sign in with.
2026-10-24 17:37:27 +08:00
yetone a5c13b8c7a kimi-desktop 0.1.3: shared instructions go to the model as <shared-instructions>, not <magpie-kimi-shared-instructions> (#356)
The adapter puts the user's shared instructions in a system message of
their own, and its tag went upstream with every prompt naming the app.
This tag is the adapter's own (Kimi's client has no such message), so a
neutral one was picked: <shared-instructions>. A history holding the old
tag from turns before 0.1.3 has that message taken out as before, so no
prompt carries two copies or the old name.

Left as they are, and why: the menu alias magpie-local-<hash> and the
" · Magpie" display name live in Kimi's model menu; the adapter replaces
the alias with the real model id before a request leaves it, so neither
reaches the model.

Run:
- no-magpie.test.mjs: with shared instructions and an old tagged turn in
  history the prompt holds no "magpie", one <shared-instructions> message,
  and applying twice changes nothing (red on the old code); with no
  instructions the old turn is still taken out.
- bun test (package): 26 pass. scripts/check.mjs skips agent packages
  (exit 0).
Not tried live: no Kimi Work account here, and Kimi isn't installed on
this Mac or the Windows box.
2026-10-24 17:31:58 +08:00
yetone 8310fd2e77 kimi-work 0.1.8: Kimi gets the headers its own Work client sends, not "Magpie Kimi Work provider" (#353)
Every request to agent-gw and kimi.com carried the User-Agent "Magpie Kimi
Work provider/<version>". Kimi 3.2.20's daimon 0.6.10 (the desktop
component that holds the Work credential in daimon-share/daimon/config.json)
builds its agent-gw headers in createDaimonKimiCodeRequestHeaders:
User-Agent kimi-code-cli/<Kimi Code version> (0.36.0, from its
kimi-code.vendor.json; no caller passes a suffix), X-Msh-Device-Id,
X-Msh-Device-Model, X-Msh-Device-Name, X-Msh-Os-Version, X-Msh-Platform
"kimi-code-cli", X-Msh-Version and X-Msh-Daimon-Version 0.6.10. The plugin
sends the same on /models and /chat/completions.

The device id is the daimon's own: a randomUUID it writes once to
<daimon>/runtime/kimi-code/home/device_id. The plugin reads that file and
never writes it (it never writes the desktop app's files); when it is
missing the header is left out. The www.kimi.com reads (membership, and
0.1.7's DescribeKimiWorkConfig menu) get the kimi-code-cli User-Agent
only: those calls are made by Kimi's web page, whose own headers weren't
read.

The test also found magpie's x-magpie-* hint headers going through to
agent-gw on chat requests; they are now dropped.

Run:
- no-magpie.test.mjs: models, the Work menu, chat (with a magpie User-Agent and an
  x-magpie-work-dir coming in) and membership hold no "magpie"; agent-gw
  gets the daimon's headers; the device id is read and never written.
  Both tests red on 0a9415f (0.1.7).
- bun test (package, rebased on 0a9415f): 48 pass. bun scripts/check.mjs kimi-work: ok.
Not tried live: no Kimi Work account here, and Kimi isn't installed on
this Mac or the Windows box.
2026-10-24 17:30:44 +08:00
yetone 0a9415f4ef kimi-work 0.1.7: models come from Work's own menu (DescribeKimiWorkConfig) as well as /models, so K3.1 Pro on the 99 plan is listed
泠夜Soul (Discord #help, 10-24) is on Kimi's 99 membership and the official
Kimi Work desktop has "Kimi K3.1 Pro" picked in its composer, but magpie's
Kimi Work list (0.1.6) leaves it out.

Cause, read from Kimi desktop 3.2.20's main bundle (decoded): the desktop
does not build its Work model menu from agent-gw's /models. It calls the
Connect RPC kimi.gateway.config.v1.ConfigService/DescribeKimiWorkConfig on
https://www.kimi.com/apiv2 with the web sign-in, takes models plus
moreModels, and hands each entry's requestParams.modelId to its agent
(conversations.updateKimiModelList), which sends it to agent-gw as the
model. The plugin listed /models only, so a tier model the menu has and
/models doesn't was never offered. That /models leaves K3.1 Pro out is
inferred from the report (0.1.6 already lists /models in full), not seen
on an account.

What changed:
- provider.models asks both lists at once. Menu entries come first, under
  display.displayName, with id requestParams.modelId; reasoning levels are
  requestParams.reasoningEffortOptions, else daimonModelConfig's
  supportEfforts ("off" is REASONING_EFFORT_NONE there, sent as none);
  image input from its "image_in" capability. Context is capped at the
  standard 262,144 as before: XL is an X-Kimi-Context-Length header the
  desktop sends only when the user picks extended, and this doesn't send it.
- An id both list keeps /models' row under the menu's name. Either list
  failing leaves the other; both failing, or the menu empty with /models
  failing, throws, so magpie keeps the last good list.
- The reply is read in camelCase and in the proto's snake_case names.

The fixture (tests/fixtures/work-config.shape.json) is the reply's shape
from the proto descriptor and the desktop's mapping code. No reply was
captured from an account; k3d1-pro in it is a placeholder id, and the
fixture says so.

Run: bun test packages/kimi-work (46 pass, 0 fail); with the menu call
turned off by hand in index.mjs the two new list tests go red (44 pass,
2 fail); bun scripts/check.mjs kimi-work ok; git diff --check clean.
Not tried: a real Work account (none on this machine or the Windows box),
so neither the menu's reply nor a chat request with K3.1 Pro's id through
agent-gw has been seen. The model-speed header (X-Kimi-Model-Speed) is not
sent either.
2026-10-24 17:28:52 +08:00
yetone da079585d9 qoder 0.2.33: a request's task name is the prompt's first ten characters, as Qoder's own client sends, not "magpie session" (#354)
business.name went upstream as "magpie session" on every request. Qoder.app
0.4.3's worker runtime (qoder-agent-sdk qoder-worker-runtime.obf.mjs) names a
task by its prompt sliced to 10 characters (the session id only for
code_review). The plugin now does the same with the task's first user
message, kept for the task's whole tool loop. Nothing old is read back from
Qoder for this field, so existing sessions are unaffected.

Run:
- no-magpie.test.mjs: qoder and qoder-cn, sessions "", "magpie-…" and
  "dsh-session-1"; URL, headers, wire body and decoded body hold no
  "magpie"; short, long and Chinese prompts; name kept through tool calls.
  All 7 red on the old code, green now.
- bun test (package): 209 pass. bun scripts/check.mjs qoder: ok.
- Live, sandbox HOME, the owner's Qoder account (auth.set stubbed, token
  not refreshed): model "efficient", 200 with a streamed reply; business
  {"name":"Reply with",…}; 11 requests recorded, none naming magpie.
Not tried: qoder-cn live (no CN account).
2026-10-24 17:23:45 +08:00
yetone b025fb65d1 commandcode 0.1.16: no request to Command Code names magpie (#352)
The Go catalog (/provider/v1/models) went with User-Agent "magpie" and
every /alpha/generate with x-project-slug "magpie". Both are now what
command-code 1.88.0's cli.mjs sends:
- the catalog: installModelCatalogManager asks with accept alone under
  Node's fetch, whose User-Agent is "node";
- x-project-slug: buildCommandAuthHeaders' projectSlug is
  getCommandCurrentProjectDirName, slugify(basename(cwd)) || "root". The
  plugin takes the working folder magpie names (x-magpie-work-dir, which
  it already strips), else the home folder as before. A Windows path
  splits on "\" as the CLI's win32 basename does. A name past Latin-1 is
  percent-encoded: Node refuses such a header, so the CLI has no value
  there to copy and the request would otherwise throw (found by the
  existing #86 test's "中文" folder).

Test: no-magpie.test.mjs records every request (URL, every header,
body) for a Go chat with and without a folder, a Pro chat and the
catalog, and fails on /magpie/i; red on the old code (3 of 3 fail),
green now.

Run: bun test in packages/commandcode (64 pass, 1 skip, 0 fail);
bun scripts/check.mjs commandcode ok.
Live, sandbox HOME, owner's GOAT key: Provider API chat 200, catalog 62
models, /alpha/generate 200 with x-project-slug "shop" (billing answered
503 locally so the saved Go plan routed it); the second saved key is
dead (401) but its generate request went out clean too. 0 of 9 recorded
requests named magpie.
Not tried: a real Go-plan key; Windows.
2026-10-24 17:07:45 +08:00
yetone cc0bd902b3 zcode 0.1.26: a gift's -Trial models are listed when ZCode's config is out of reach, a failed gift read is asked again in a minute, and a card with no ZCode session says the gift needs one
bigsteven (Discord #feedback, 10-24): GLM Coding Plan spent, requests
go to it, and the model list has no GLM-5.3-Trial. Which sign-in the
account has is still asked; three ways the plugin drops a signed-in
account's -Trial entries, or drops them unsaid, are fixed here:

- ZCode's provider config out of reach (cdn-zcode.z.ai, 8s): the list
  falls back to the table and is marked magpie.fellBack, and magpie
  then keeps the list it was told last (internal/plugin/providers.go),
  from before the gift. The -Trial entries just read from the balance
  went with it. A list that carries trial entries is no longer marked.
- A gift balance read that failed was cached as "no gift" for ten
  minutes beside a good plan list, so one hiccup hid the -Trial
  entries and the gift's card section for ten minutes. It is now
  unknown and asked again in a minute (an expired session is known,
  and kept for ten).
- A key, or a sign-in whose ZCode session has expired (that token
  can't be renewed, and with a key beside it the account is never
  marked), reads no gift, so it lists no -Trial models, and the card
  said nothing. Its card now sets aside a line "ZCode gift plans
  (-Trial models) need ZCode's sign-in", with why in the display (an
  API key / no ZCode session / sign-in expired).

Run: HOME=<scratch> bun test packages/zcode: 102 pass (3 new tests);
bun scripts/check.mjs zcode ok.
Broken by hand: each of the three fixes reverted alone turns its
tests red (fellBack 1, retry 2, card line 1), restored after.
Changed on purpose: dual.test's "a gift read that fails at once still
trusts the plan list for ten minutes" now says a minute; usage.test's
key and key-only oauth cards carry the new line.
Not tried: a real account (no ZCode sign-in with a gift in this
session), nor a real CDN failure; the config fallback was forced in the
test through _internal.config(null). The new line's name is not yet in
magpie's i18n. A team-seat sign-in (an account with no plan of its own)
still lists no -Trial entries; not changed here.
2026-10-24 17:04:32 +08:00
yetone 9f6c4e8861 kiro 0.1.16: a reply with no token counts says its cache is unknown, not 0 (zeewell on X)
zeewell on X: every Kiro request in magpie's Routing page shows cache 0%
(Claude Code through group/wf-coding-*, claude-sonnet-5.5 and
claude-opus-5.5, 150-180k tokens, consecutive calls seconds apart).

Cause, from real requests (Google sign-in through kiro-cli, 2026-10-24):
Kiro caches, but reports no token counts at all. A
generateAssistantResponse reply ends with metadataEvent {stopReason},
contextUsageEvent {contextUsagePercentage} and meteringEvent {credits};
no tokenUsage. The same 9k-token prompt sent twice was billed 0.091
then 0.048 credits, the same with or without cachePoints and with a
fresh or a fixed conversationId. kiro-cli 2.32's own trace log
(KIRO_LOG_LEVEL=trace) shows its MetadataEvent with total_tokens,
uncached_input_tokens, cache_read_input_tokens and
cache_write_input_tokens all None, and kiro-cli sends no cachePoint.
So nothing the plugin sends or drops keeps Kiro from caching (#110's
reading that only cachePoints make it cache was wrong); the plugin said
cache_read_input_tokens 0 for a number Kiro never gave.

Now, with no tokenUsage, the reply's usage leaves both cache fields out
and says magpie_cache_unknown: true, which magpie reads as no hit rate
instead of 0%. A tokenUsage, if Kiro sends one, is told as before.
cache-points.test.mjs's comment is corrected; the marks stay.

Run: cache-unknown.test.mjs (the real reply's events, streamed and not)
fails on 0.1.15's index.mjs (1 fail) and passes; bun test in
packages/kiro 57 pass under a scratch HOME/TMPDIR; scripts/check.mjs
kiro ok. The patched loader's fetch against real Kiro (source "kiro",
claude-sonnet-4.5, twice): 200, message_delta usage
{"output_tokens":1,"magpie_cache_unknown":true}. Not tried: an IDE or
Builder ID sign-in, other models' replies.
2026-10-24 17:03:48 +08:00
yetone a41a8d3a57 cursor 0.2.20: the MCP server the caller's tools go to Cursor under is "tools", not "magpie"
What goes to Cursor named magpie in four places: the dynamic tool catalog
in the system prompt ('The MCP namespace "magpie" has the tools below' and
each <call> entry's "namespace":"magpie"), every CallDynamicTool call in
the history (args.namespace), each McpToolDefinition's provider_identifier
(field 4), and the server answered for mcp_state_exec_args (name and
identifier). magpie's LESSONS.md rule: text added to a vendor's prompt
names neither magpie nor the vendor's limits, with the care a header
change gets (5d33f060b / 3c4f8f9ae).

cursor-agent names a user's MCP server by its mcp.json label
(providerIdentifier = serverName) and a call by "<label>-<tool>"; read in
cursor-agent 2026.10.01-e373342. The plugin now does the same with the
generic label "tools" (NS), in all four places. Calls are read back under
NAMESPACES = ["tools", "magpie"]: a "<ns>-<tool>" name without field 5 is
stripped of either prefix, and a native exec's provider/server is accepted
as either, so a native session begun on 0.2.19 still has its calls served.
The non-native history is rebuilt from the caller's messages each request,
so it carries the new name at once.

Siblings in other packages that still name magpie upstream, filed, not
changed here: commandcode User-Agent and x-project-slug (#352), kimi-work
User-Agent (#353), qoder business.name (#354), autoclaw device_id (#355),
kimi-desktop's instructions tag (#356), opendesign's host fallback (#357),
layerfs tool descriptions (#358). Left alone as not upstream: X-Magpie-*
response headers, the x-magpie-cursor-session hook header (never sent to
Cursor), magpie_native/magpie_deferred usage fields, sign-in messages.

Test: upstream-words.test.mjs builds a Run (buildRun) from a conversation
with tools and a tool call, and checks that the catalog, every transcript
blob, the request bytes and the mcp_state answer contain no /magpie/i, and
that a call is read back as both "tools-read" and "magpie-read". Red on
the old index.mjs (2 of 3 fail: catalog, mcp_state); green now.
conversation, reasoning and native-test-wire expectations moved to
"tools"; native-e2e still sends provider "magpie", so the old name is
covered on the native path.

Run at this tree:
- bun test in packages/cursor: 279 pass, 0 fail (17 files).
- bun scripts/check.mjs: every package ok.
- Live, owner's Cursor account, sandbox HOME (scratchpad), the plugin's
  loader.fetch with one read_file tool, http2 writes scanned for "magpie":
  auto: turn 1 called read_file {"path":"notes.txt"}, turn 2 with the
  result answered "Pelican"; 0 chunks named magpie (the old index.mjs
  under the same scan: 2). grok-4.7-fast: the same two turns, 0 chunks.
  claude-4.6-sonnet: 429, not in this plan's weekly usage.
Not tried: a native session resumed across the upgrade against real Cursor
(covered by native-e2e's "magpie" provider against the fake server only).
2026-10-24 16:54:42 +08:00
yetone 71021b8f72 zcode 0.1.25: a key with no GLM Coding Plan says a ZCode gift plan (Start Plan, 1024 Dev Day) needs ZCode's sign-in
rtbeilin (X, 10-24) has ZCode 1024 Dev Day and no GLM Coding Plan.
"ZCode app's sign-in" works in magpie; the browser sign-in and the API
key don't.

The key: ZCode's gift plans are served by zcode.z.ai to ZCode's session
token (zcodejwttoken, the poll's `token`). A key carries none, so a key
reaches api.z.ai's / open.bigmodel.cn's coding plan alone, and a
gift-only account has nothing there. The card was empty, no error
(usage.test's own "API key, BigModel's" case: an empty list and no
limits gave {windows: []}), and each request got Z.ai's 1113 "no
resource package" with nothing saying why. Now:
- codingUsage: a subscription list read as having no VALID plan, with no
  level, no counted window and no saved plan, is the card's error
  NO_PLAN_KEY, which names the gift plans and says to add the account
  with "ZCode app's sign-in" or a ZCode browser sign-in. A list that
  can't be read keeps the card as it was.
- the fetch: a coding-plan refusal >= 400 to a sign-in with no ZCode
  session, whose code is 1113 (error.code, error.type or the envelope's
  code), keeps its status and Z.ai's words and adds NO_PLAN_KEY. The
  body is read only after the request failed. A sign-in with a session
  and any other code go as they came.
README says it under the key method.

The browser sign-in: no cause found. 3.16.3's bundle (the current
stable, downloaded from zcode.z.ai's release manifest) starts, polls
and reads the flow as the plugin does: same init body, the same
redirect / redirect_uri override, the same ready fields, Z.ai's token
exchanged at /api/auth/z/login. yg6888's screenshot in the same thread
shows two Dev Day accounts working in magpie. Not changed here.

Run:
- bun test packages/zcode, scratch HOME: 99 pass. The two new tests
  (usage "a key with no GLM Coding Plan...", signin "a key's 1113...")
  fail on 0.1.24's index.mjs. bun scripts/check.mjs zcode: ok.
- Real: the owner's real Z.ai key through the new usage hook: card
  "GLM Coding Lite", 5 hours + Weekly, no error. A bogus key: card
  "Authentication Failed", a request 401 {"error":{"message":
  "Authentication Failed","type":"1000"}} unchanged.

Not tried: a real key with no plan (none at hand), so the 1113 body is
magpie's zhipu_coding_test fixture, not a captured one. BigModel's real
answer neither. The browser sign-in with a Dev Day account.
2026-10-24 16:37:39 +08:00
yetone 663ce131cb kimi-work 0.1.6: one model's unreadable effort list no longer drops the whole catalog; K2.8 Preview in the fallback
泠夜Soul (Discord #help, 10-24) sees only "K3 · Work" in magpie, while the
Kimi app lists K3.1 Pro and K2.8 Preview for the same membership. "K3 · Work"
is the name of this plugin's static fallback; the live /models catalog names
k3-agent "K3". So the account's live list was not used: the models hook
threw or fell back, and magpie kept the config's one model.

The plugin already lists models from agent-gw's /models, so a model Kimi
adds to the account shows under its own id with no hard-coded list. What
changed:

- modelRows no longer throws the whole catalog away when one model's
  reasoningEffortOptions isn't an array, or an option has no string
  effort or one that isn't a plain word: that model keeps the levels that
  can be read (only levels Kimi lists, none guessed). A non-object entry
  is skipped like an id that can't be used. K3.1 Pro went live on
  2026-10-23, the day before the report, so a new entry in a shape not
  seen before is one way the catalog could have failed. It is not the
  confirmed cause: the user's provider.models error line has not been
  seen.
- The fallback (shown before the list is read, and kept when it can't be)
  offers k2d8-preview beside k3-agent. Both ids come from Work's own
  /models: tests/fixtures/work-models.redacted.json and the 10-17 macOS
  record in COMPATIBILITY.md, and #350 ran real Work requests on both.

Not added: a K3.1 Pro id. Kimi Code's docs name it k3.1-pro, but that is
api.kimi.com/coding's catalog (where K2.8 Preview is kimi-for-coding and
K3 is k3, not k3-agent), not the Work gateway's. Work's id for K3.1 Pro is
not in any vendor source found, so none is invented; the live catalog
will show it once read.

Run: bun test packages/kimi-work (43 pass, 0 fail); the two new tests
fail on origin/main's index.mjs (41 pass, 2 fail) and pass with this one;
bun scripts/check.mjs kimi-work ok; git diff --check clean.
Not tried: a real Work account (none on this machine), so the live
catalog with K3.1 Pro has not been seen.
2026-10-24 15:11:15 +08:00
yetone 4dbea65c62 kimi-desktop 0.1.2: a model that can't turn thinking off is declared always_thinking (#350)
Version bump for #350 (327ec8b). Ran bun test packages/kimi-desktop and scripts/check.mjs at this commit.
2026-10-24 15:08:14 +08:00
kupakupa 327ec8bc9d kimi-desktop: a model that can't turn thinking off is declared always_thinking (#350)
A model whose catalog lists every reasoning level magpie knows, none of
them "none", is declared always_thinking to Kimi desktop, in its runtime
entry and its menu. Kimi then stops sending an old Off choice to a model
that can't turn thinking off. A model that offers none, lists no levels or
lists an unknown one keeps its old declaration.

Run at the reviewed head fa08b22: bun test packages/kimi-desktop
packages/kimi-work, 65 pass. catalog-thinking.test.mjs against main's
catalog.mjs: 4 of 9 fail (the always_thinking cases), so the test holds the
change. The author's real Kimi 3.2.18.13 runs on Windows are in the PR; not
tried on macOS here.
2026-10-24 15:07:50 +08:00
yetone b04cca35c8 factory 0.1.38: Standard usage only, a plugin option that stops an account once a Standard window is used up (#349)
A new switch in magpie's plugin options, standard_only ("Standard usage
only"), off by default, read at each usage reading. When on,
limitWindows reports the Standard 5 hours / 7 days / 30 days windows
with no notModels and never aside (extra usage or not), so they count
every model, Droid Core's open models included. Droid Core's windows
become aside (shown only) and Extra usage stays aside. Off, the windows
are exactly as before.

magpie only leaves an account out before sending when it is held at a
usage cap (gateway perKeyBarred/capHeld; order routing tries a used-up
account and benches it only after Factory refuses). The README says to
pair the option with an account cap (magpie provider account-cap
factory <account> 99): then a held account is out before affinity, the
next account takes the same model, and with every account held magpie
answers 429 without sending.

Run at this commit, rebased on origin/main 74be632 (TMPDIR and HOME
under a scratch dir; the factory run was at d1b6500):
- bun test packages/factory: 174 pass, 0 fail
- bun test (whole repo): 2383 pass, 0 fail, exit 0
- bun scripts/check.mjs: exit 0

Broken by hand, usage.test.mjs's two new tests:
- index.mjs back to origin/main: both red
- usage not passing the option to limitWindows: the switch test red
- Droid Core's windows not aside under the option: both red

Not tried: a real Factory account, a real magpie host reading the
switch, or routing with a cap set (read from magpie's source only).
2026-10-24 14:25:17 +08:00
yetone 74be6323e3 qoder 0.2.32: a check-in offered nothing with this device's own identity says so, and that Qoder desktop can claim it (#304)
ReneXiong (#304): on Linux ARM64 with Qoder CLI 1.1.78 signed in, the
plugin read the CLI's runtime-info and sent its identity, and the campaigns
list had no CLAIM_BENEFIT, while the same account and device token with the
macOS desktop's identity listed a claimable 100. The check-in answered a
bare { outcome: "inactive" }, with nothing saying why.

Now that branch (identity read and sent, list has no CLAIM_BENEFIT) is
inactive with a message: "<site> check-in: <site> offered this device's
identity, read from this machine's own <site> runtime-info, no daily
credits campaign right now. <site> decides per device whether to offer it;
if <site> desktop shows today's credits, claim them there". It names only
what the plugin knows: the identity came from this machine's runtime-info
and the list offered nothing. It does not say whether the runtime was the
CLI's or the desktop's, nor why Qoder offered none. Outcome is unchanged
(still inactive), so magpie's day logic is the same. "no campaigns page
for this account" and the ineligible/failed paths are unchanged.

Run: TMPDIR=<scratch> HOME=<scratch>/h bun test packages/qoder: 202 pass,
0 fail (native-checkin.test.mjs: one test rewritten, one CN test new).
Repo root, same sandbox: 2381 pass, 0 fail. bun scripts/check.mjs qoder ok.
Broken by hand: with origin/main's index.mjs both tests are red (message
undefined).

Not tried: a real Qoder account; the wording is from the code path, not a
live answer.
2026-10-24 14:21:16 +08:00
yetone d1b65007ff zcode 0.1.24: Claude Code's tool search goes to ZCode's plans as ToolSearchTool, so a subagent sees Bash, Read and Write
小八 (Discord #general, 10-24): Claude Code through magpie on ZCode
(glm-5.3, glm-5.3-flash) gave subagents only the deferred MCP tools;
Bash, Read and Write were missing. Another upstream worked.

Cause, measured against api.z.ai with a real GLM Coding Plan account:
when a request's tools include one named exactly "ToolSearch", z.ai
shows the model none of the other tools except those a tool_reference
loaded. Claude Code 2.1.310's subagent request (captured from the real
binary in a sandbox HOME) has Agent, Bash, Edit, Read, Skill,
ToolSearch, DeferredToolPlaceholder (defer_loading) and Write. Input
tokens for that request: 2886 with ToolSearch, 2439 with no tools at
all, 5995 without ToolSearch. ToolSearch plus Bash also counts 2886.
Renaming the tool (tool_search, ToolSearchTool, SearchTools, ...) gives
6346, every tool counted. The anthropic-beta header changes nothing
(with or without advanced-tool-use: 2886), and neither does
defer_loading. So 0.1.22's dropped beta on the Start Plan is not the
cause; the coding plan path, which keeps the agent's headers, fails
the same way. ZCode 3.14.3's own client sends no ToolSearch tool and
no defer_loading (glm/zcode.cjs).

Now every path (GLM Coding Plan, team, Start Plan and gift) sends
Claude Code's ToolSearch as ToolSearchTool, in the tools and in the
assistant turns that called it. Tools go without defer_loading, as
ZCode's do; Claude Code sends a deferred tool's schema only after a
search loaded it. DeferredToolPlaceholder is left out. The tool_reference
results stay. The model's calls to ToolSearchTool come back to Claude
Code as ToolSearch, in a stream's content_block_start or a whole
message's content. A request without ToolSearch, or one that already
has a tool named ToolSearchTool, goes as before.

Run:
- toolsearch.test.mjs: 4 of 5 fail on 0.1.23's index.mjs (the
  passthrough test passes on both). bun test packages/zcode under a
  scratch HOME: 97 pass. bun scripts/check.mjs zcode: ok.
- Real, through the plugin's fetch to api.z.ai (GLM Coding Plan),
  real Claude Code 2.1.310 in a sandbox HOME with a stdio MCP server:
  on 0.1.23, "spawn a subagent to run ls -a with Bash" ended with the
  model saying it had no Agent tool. On this change the subagent ran
  Bash and returned the listing. A deferred MCP tool loaded through
  ToolSearch (now sent as ToolSearchTool) and was then called.

Not tried: the Start Plan against z.ai. The account's Start Plan
quota is spent (1005 exceed quota limit), so that path has only the
fake-server test. BigModel (open.bigmodel.cn) was not tried either.
2026-10-24 07:37:51 +08:00
yetone 1f8d38b8cd zcode 0.1.23: with two gift plans each bucket is named by its plan, and the live ones come first
01huadalang (Discord #feedback, 10-24): an account with the 1024 plan and
the new-user plan showed GLM-5.3 at 0 once the new-user plan's GLM-5.3 was
used up, and never showed the 1024 plan's GLM-5.3.

Cause: the plugin already kept every live plan's buckets (giftOf) and
counted a model on the live one (bestBuckets), setting the spent one aside.
But every window was named by its bucket's show_name alone, so both read
"GLM-5.3", and the windows went out in the balance's order: the new-user
plan's spent GLM-5.3 and its Flash first, the 1024 plan's after. magpie's
account row shows a card's first two windows and puts the rest in its
tooltip, so the row showed the spent GLM-5.3 at 0 and the 1024 plan's
allowance was out of sight, and where both showed they couldn't be told
apart.

Fix (startUsage and dualUsage alike): when the gift's buckets come from
more than one plan, each window is named "<plan> · <bucket>" ("ZCode 1024
Dev Day · GLM-5.3"); one plan's buckets keep their own names, as before.
The windows a request spends go before those set aside, each group in the
balance's order. A used-up plan still shows, at 100% used, set aside.

The 1024 plan's plan_id, name, show_names, capabilities and grant_units in
the new fixture are real bytes: the owner's account read
/billing/preview (read-only GET, credentials read in memory, nothing
written) and is offered "ZCode 1024 Dev Day" (zcode-v3-start-plan-1024,
GLM-5.3-Flash 300M, GLM-5.3 200M). That account has no active plan, so
its /billing/balance is empty; the balance rows are written in the shape
the existing fixtures use, and the new-user plan's name is the Start
Plan's from ganlerk's balance. The reporter's real balance wasn't seen.

Run at this head (parent efa41e3, origin/main fetched just before):
- packages/zcode: HOME=$(mktemp -d) bun test (Bun) 92 pass, 0 fail. The
  tests import bun:test, so they don't run under Node; under Node 24 the
  plugin loaded (node --check) and a scratch script ran auth.usage over the
  reporter's two-plan shape, gift-only and with a coding plan, and gave
  the labelled, ordered windows.
- Whole repo, as CI runs it: HOME=$(mktemp -d) bun test 2375 pass,
  0 fail; bun scripts/check.mjs all pass.
- Broke it by hand: index.mjs at efa41e3 turns the two new gift tests and
  ganlerk's test red (3 fail); keeping the labels but dropping the
  ordering turns both new tests red.

Changed expectations: ganlerk's test and dual.test's "every live plan"
test have two plans, so their windows now carry the plan's name.

Not tried: no account with two active gift plans was available, so no
real card with both was seen in magpie. Not changed: in dualUsage a
spent bucket set aside keeps its plain model names (startUsage drops
them); aside windows don't count, so left as it was.
2026-10-24 05:04:58 +08:00
kassama efa41e36e3 joycode 0.1.1: JoyCode (JD Cloud) with JD's browser sign-in, account models, credit multipliers and usage (#347)
New package @magpie-community/opencode-joycode-auth 0.1.1 (provider id `joycode`) and its registry entry (en and zh). JoyCode is JD Cloud's own coding IDE subscription (joycode.jd.com, api-ai.jd.com), not a relay.

- Browser sign-in through JoyCode's own login page. The page sends the browser to http://127.0.0.1:<authPort>/ with authKey and pt_key; I checked this against the page's bundle. A request without the right authKey gets a 404 and leaves the sign-in pending. A ptKey can also be pasted, with an optional tenant.
- Chat completions are signed per request (HMAC over a fresh t), with userId, tenant and orgFullName from joycode_userInfo. A bare JSON error sent as HTTP 200 SSE becomes an error reply: code 401 is 401 with sign-in expired, AI_GRAY_ACCESS_DENIED is 403, anything else is 502. JD's msg is kept as the error text.
- Account models come from joycode_modelList, credit multipliers from plugin_config billingRate, and credit usage from get_newpoint_ide (windows set aside).
- Contacts only JD's hosts. No runtime dependencies, no install scripts, no logging. The ptKey is kept only in magpie's plugin-auth.json.

Reviewed every line at c80068f and again at 1cac30c, which fixed all five review points: the README link, JD's `msg`, tests for the authKey check and for the HTTP 200 SSE code 401, the stale header comment, and stray loopback requests.

Run at the reviewed head 1cac30cce31a1f3efeb39b2c61df257963e655a, whose parent is main 57ec655:
- packages/joycode: `bun test` (Bun 1.4.2) 30 pass, 0 fail. `node --test` (Node 22) 30 pass.
- Whole repo, as CI runs it: `HOME=$(mktemp -d) bun test` 2373 pass, 0 fail. `bun scripts/check.mjs` all ✓.
- Broke the code by hand: removed the authKey check, made a wrong authKey end the sign-in, mapped the SSE code 401 to 502, and dropped `msg` in chat and in usage. Each one turns a test red.
- magpie built from main, in a sandbox HOME: `plugin add` lists `joycode (JoyCode, 5 models)`, and `plugin login joycode` offers both methods. With a made-up ptKey, provider.models, `provider test` and `quota` each fail with "JoyCode 登录已失效" and mark the sign-in expired. plugin-auth.json is mode 600.
- JD's gateway answered the made-up ptKey with HTTP 200 `{"code":401,"data":…,"msg":…}` on joycode_userInfo, chat_completions (as text/event-stream) and get_newpoint_ide.

Not tried: no JoyCode account was available, so no successful chat, model list, multiplier or quota read was made against JD. The author reports live JoyAI-Code-1.6 streaming and tool-call runs.
2026-10-24 03:34:36 +08:00
yetone 57ec655a24 zcode 0.1.22: a Start Plan request goes with ZCode 3.16.3's headers alone, never the agent's, and without ?beta=true
01huadalang (Discord) gets 405 / "ZCode's Start Plan still turned this
request away" again on 0.1.21. #343's check was a curl request to magpie,
which carries no agent headers.

What reached zcode.z.ai: startHeaders set ZCode's headers on top of the
ones it was given and removed only x-api-key, authorization and
X-Device-Mid. A plugin provider has no account of its own in magpie's
gateway, so a request from Claude Code goes to the plugin with
Claude Code's own headers (anthropic-beta claude-code-20250219,...,
x-app: cli, x-stainless-*, anthropic-dangerous-direct-browser-access,
x-claude-code-session-id) and ?beta=true on the URL (gateway.go
claudeCodeHeader, #179). All of that went on to the Start Plan. The
retired built-in deleted anthropic-beta, and its accounts never got the
Claude Code pass-through. ZCode sends none of these on the Start Plan:
its only beta, advanced-tool-use, is for coding plans.

Now startHeaders builds a new header set: the body's content-type and
ZCode's headers, as ZCode.app 3.16.3 (the current stable, 10-23) sends
them in glm/zcode.cjs:
- buildZCodeSourceHeadersFromContext: X-Os-Version is os.release()
  alone (it was "darwin 25.2.0 arm64"), and X-Client-Timezone is
  "unknown" when there is none.
- createModelRequestAttributionHeaders: the new x-zcode-query-source:
  main_turn.
- APP_VERSION goes to 3.16.3 (User-Agent, X-ZCode-App-Version and the
  app_version query).
The Start Plan URL loses its query. Prompt texts, the Start Plan
provider entry and ai-sdk/anthropic 3.0.81 are the same in 3.14.3 and
3.16.3 (checked against both bundles). The GLM Coding Plan and team
paths are unchanged, and a new test holds that they keep the agent's
query and headers.

Not established: which header (if any) zcode.z.ai keys on. No Start
Plan account was used. A network block of the user's IP is still
possible, and the error still says so.

Run: bun test in packages/zcode under a temp HOME, 90 pass. The two
start.test.mjs header tests fail on 0.1.21's index.mjs (Claude Code's
x-app/x-stainless-*/anthropic-beta and the query reach the fake).
2026-10-24 00:44:28 +08:00
Guislabert a1689b1b6f cloudflare-workers-ai 0.0.3: the provider shows Cloudflare's own cloud mark (#344)
cloudflare-workers-ai 0.0.3: the provider shows Cloudflare's own cloud mark (#344, Guislabert)

package.json's magpie.icon points at https://www.cloudflare.com/favicon.ico, and the READMEs' version moves to 0.0.3.

Checked at 42903e3:
- The URL answers 200 with a 99x96 PNG of 908 bytes. Go's http.DetectContentType reads it as image/png, which magpie's FetchIcon accepts (MaxIcon is 1 MiB), and it is on a public https host.
- The PR's test and on-npm checks pass.

Not tried: installing 0.0.3 in a running magpie and seeing the mark drawn.
2026-10-23 23:48:23 +08:00
yetone 44036e2fcc zcode 0.1.21: a Start Plan request sends the agent's system prompt at the end of ZCode's third system block, not as a fourth (#343)
fordlyn's report: on a Start Plan account zcode.z.ai now answers every
request whose system has more than three blocks with 405
{"code":3012,"msg":"request has been blocked due to unusual activity."}.
dress() put ZCode's three cached blocks first and then the agent's own
system texts as blocks 4, 5, ..., so every agent (all of them send a
system prompt) was turned away; only a system-less request passed.

What ZCode does, read from ZCode.app 3.14.3's glm/zcode.cjs
(ContextBuilder.assembleSystemMessages): it sends at most three system
messages, the cli_prefix section, the stable sections, and every dynamic
system section joined with "\n\n" into a third block that starts with
"\n\n". A section added to the builder (addSection) is dynamic by
default, so ZCode's own extra system text lands in the third block.
dress() now does the same: the agent's non-blank text blocks are joined
with "\n\n" after afterEnvironment in the third block, which keeps its
cache mark. The first two blocks stay byte for byte ZCode's, as the
issue's bisect requires. GLM Coding Plan and team requests are not
dressed and are unchanged.

Run: TMPDIR=<scratch> HOME=<scratch>/home bun test (2341 pass, 0 fail);
bun scripts/check.mjs (all ok). The new #343 test in start.test.mjs and
four updated layout tests are red on the old index.mjs (5 of 12 fail).
Not tried against the real API: no Start Plan account at hand. The
reporter's own harness got 200 for this shape (system "x", system plus
tools, 32 KB system, multi-turn).
2026-10-23 23:22:58 +08:00
yetone 61d058f6cf cline 0.1.11: ClinePass's DeepSeek models are pinned to DeepSeek's own API by default, with only + has, and go once more unpinned if the pin can't be served (hy125245 on X)
hy125245 (X, 10-23) pinned Cline Pass to DeepSeek by hand with magpie's
extra body, `"!providerOptions": {"gateway": {"only": ["deepseek"],
"has": ["vision", "implicit-caching"]}}` on a plain API provider for
https://api.cline.bot/api/v1, model cline-pass/deepseek-v4.1-flash-1017.
Their finding: on ClinePass the server's virtual model config wins over
`only` alone (a fake upstream was served too); with `has` beside it the
request went to DeepSeek (finalProvider "deepseek", magpie's Requests
list "vmc/deepseek-v4p1-flash … 上游: de…", ~200-246 tok/s, 3 of 3) and
a fake upstream was refused with "no matching upstream". The bill showed
creditsUsed 0.

What changed
- A request for a cline-pass/deepseek-… model now carries
  providerOptions.gateway {only: ["deepseek"], has: [...]} by default,
  written in before the body's last } so the cached prefix is the
  client's byte for byte.
- `has` is "implicit-caching", plus "vision" only for a model that takes
  images: Cline's catalog (/ai/cline/models input_modalities, read by
  the models hook; the bundled list says so for deepseek-v4.1-flash and
  -1017 until it answers) or a request carrying an image part. The
  catalog lists deepseek-v4-pro as text-only, and asking vision of it
  would rule out every upstream.
- A request that already has provider or providerOptions (the client's,
  or the user's extra body in magpie) goes as sent, as before: magpie's
  default never overrides a value the user set.
- The default pin never fails a request that would have worked: a
  pinned request answered with no matching upstream (or "no available
  provider/endpoint") or any 5xx goes once more exactly as sent, same
  account and headers. Once only. A 400 of another kind, 401, 402, 403
  and 429 are the request's or the account's, answered as they are.
- pinUpstream: false (or "false") turns it off. pinUpstream on keeps its
  meaning ("only from the makers' own APIs"): ClinePass DeepSeek models
  get the only + has pin with no unpinned retry; other DeepSeek and GLM
  models are pinned as in 0.1.10.
- Non-DeepSeek ClinePass models, cline-free/deepseek-…, usage-billed
  deepseek/… (without pinUpstream) and every other model go as sent.

Decision (owner delegated product calls): default on for ClinePass's
DeepSeek models. The reporter measured DeepSeek's own API faster than
the private landing, credits unchanged (0), and DeepSeek's API caches by
itself; the retry removes the one downside (a pin that can't be served).
Not made per model: nothing measured says another default is right for
some users.

Run (at this commit, rebased on origin/main)
- bun test packages/cline: 93 pass (11 new).
- HOME=$(mktemp -d) bun test (whole repo, as pr.yml): 0 fail.
- bun scripts/check.mjs: all packages ok.

Broken by hand, each red:
- no default pin: 8 fail (pin, catalog vision, three fallback cases,
  retry-once, pinUpstream off/on, glm-5.3-flash table test).
- the user's providerOptions overridden: 3 fail, incl. the reporter's
  extra body kept word for word.
- no fallback: 4 fail.
- every cline-pass/ model pinned: 6 fail, incl. "other models go as sent".
- vision asked always: 2 fail.

Not tried
- No real Cline account: magpie has no Cline sign-in (plugin-auth.json
  has none, providers.json none; ~/.cline holds only other vendors'
  keys), and api.cline.bot answers 401 before routing, so none of
  finalProvider, speed, creditsUsed, caching, the text-only
  deepseek-v4-pro under has: ["implicit-caching"], or the exact wording
  of the no-upstream refusal was measured here. Built from the
  reporter's description; the fallback covers a wrong guess about
  what the gateway refuses.
- Other Pass models (GLM, Kimi, Qwen, MiMo, MiniMax) may have private
  vs official upstreams too; unmeasured, left unpinned.
- magpie's own ClinePass tick still writes `only` alone before the
  plugin sees the body; fixed in magpie separately.
2026-10-23 22:14:18 +08:00
yetone f658842089 workbuddy 0.1.31: a 401 is renewed once and sent again; a refused sign-in says to sign in again
wenchen855443 on X: with WorkBuddy as the provider, requests return 401.
Until now a chat 401 was passed on as WorkBuddy's HTML APISIX page with
X-Magpie-Sign-In: kept. A token is renewed only near its end, and a
browser sign-in's token lasts about 340 days. So a token WorkBuddy
refused before then was sent again on every request, for months.
Nothing renewed it and nothing told the user what to do.

What changed (packages/workbuddy/index.mjs):
- A chat or usage summary answered 401 is renewed once, whatever the
  token's time, then sent once more. The request body is sent as it
  was, and only a body that can be resent is retried. The first 401's
  body is cancelled. A second 401 is never renewed.
- Before spending the refresh token, a newer token another process saved
  (getAuth) is taken first. This is also checked after a refused refresh,
  for the case where another process spent the refresh token at the same
  moment (part of plugins#332).
- A desktop sign-in never spends the app's refresh token here. The plugin
  drops the token it held, reads the app's file again, and retries only
  if the token there changed.
- When there is no new token, or the retry is refused too, the plugin
  answers 401 with authentication_error. The message names why ("it
  refused the refresh token too (…)", "there is no refresh token to renew
  it with", "it refused the token renewed for it too") and says where to
  sign in again: Providers → WorkBuddy [AI] → this account's Sign in again,
  or WorkBuddy desktop for a desktop sign-in. The >2 MiB ECONNRESET note
  stays in that message.
- readDesktop marks its result source: "desktop". Before this,
  unanswered's desktop wording could never show.

Marking the account expired:
- The plugin sends X-Magpie-Sign-In: expired (usage: signIn) only when
  WorkBuddy itself says the sign-in is gone:
  - the refresh token was refused (HTTP 401 / invalid_grant);
  - the access token was refused with WWW-Authenticate error=
    "invalid_token" and no refresh token was left, or one had ended;
  - a just-renewed token was refused with invalid_token.
- Why mark it at all: a marked account leaves routing, so the user's
  other accounts serve; the row says to sign in again; and a dead
  account stops spending a refresh on every request.
- Why not on every 401: WorkBuddy answers some paths with a bare 401
  even for a good sign-in (magpie's workbuddy_checkin_test). A refresh
  that fails for another reason (5xx, network) also leaves the account
  as it is.
- A desktop sign-in is never marked: the app's file is read on every
  request, so signing in to the app again fixes it.
- A success after a renewal sends "renewed", which clears a mark.
- auth.refresh (refreshed()) still never marks the account, because a
  refresh token spent by another process there could read as refused.

What WorkBuddy does (www.workbuddy.ai, 2026-10-23, the owner's real
workbuddy-ai sign-in copied into a sandbox HOME):
- Chat with a wrong or garbage token: 401, HTML APISIX page,
  WWW-Authenticate: Bearer realm="copilot", error="invalid_token".
- Chat with an empty token: 401, no WWW-Authenticate.
- The meter: the same 401. /v3/config: 200 to a bad token.
- Refresh with a wrong refresh token: HTTP 401 {"code":12153,"msg":"12153:
  refresh token failed:400 Bad Request: invalid_grant: Invalid refresh
  token"}. With garbage: 401, code 12153 "token format error".
- A real refresh: 200; both tokens rotate, and both expiries are about
  340 days out.
- The old access token still answered 200 after the refresh.
- The rotated tokens were written back to the live plugin-auth.json under
  its lock (temp + rename, only workbuddy-ai's entry changed). The live
  gateway answered workbuddy-ai/deepseek-v4.1-flash with 200 afterwards.

Run at this tree (652f06d + this change):
- HOME=$(mktemp -d) bun test: 2329 pass, 0 fail, 197 files.
- bun scripts/check.mjs: ok.
- New unauthorized.test.mjs (12 tests): renew then 200 (renewed, saved,
  new Bearer); refresh refused → sign in again, expired; transient refresh
  failure → kept; no second renew or retry; no refresh token
  (expired with invalid_token, kept on a bare 401); a token another
  process saved is taken; desktop re-read and never marked; usage renew;
  usage refused → expired.
- Existing tests that pinned the old pass-through were updated:
  signin.test.mjs, usage.test.mjs, reset.test.mjs.

Broken by hand:
- With origin/main's index.mjs, all 12 new tests are red.
- Without the renewed guard: the "isn't renewed twice" test goes red.
- With gone() always false: the 3 marking tests go red.
- Without the newer() check: the 2 "another process saved" tests go red.

Not tried:
- Reusing an old refresh token after rotation, which risks revoking the
  owner's session. Whether WorkBuddy refuses it, or revokes the session,
  is unknown.
- The China build (www.codebuddy.cn) was not probed for a real 401.
- A desktop sign-in with real accounts.
- The reporter's case is unknown: their site, their sign-in kind, and the
  401's body. So is what revokes a WorkBuddy access token before its end;
  a refresh by another process does not.
2026-10-23 22:13:05 +08:00
yetone 652f06dc4d commandcode 0.1.15: DeepSeek models that take reasoning_effort "off" offer an off level and are sent "off" for it (#334)
CHENJIAMIAN measured Command Code's Provider API on a GOAT key: "off"
gives 0 reasoning tokens on deepseek-v4-pro, v4-flash,
v4-flash-vision-exp, v4.1-flash and v4.1-flash-fast; "none" is refused
as no option, thinking {"type":"disabled"} is ignored, and
deepseek-v4-flash-fast and Kimi-K3 refuse "off". The plugin offered no
off level and passed magpie's none on unchanged, so every way of asking
for off still thought.

- THINK_OFF: those five models list none, low, high, max on the
  Provider API's list and in the default list (low/high/max are the
  levels magpie borrowed from DeepSeek for them before).
- The Provider API fetch sends reasoning_effort "off" for none or a
  client's "off" on those models, and drops the field for any other
  model, which refuses both spellings. Other levels go as they came.
- Go's /alpha/generate: not measured with "off", so its levels are
  unchanged and off (none or "off") is sent as no level, as none was.

magpie needs no change: a plugin model's variants are its levels
(pluginCatalog), and magpie sends none to a plugin model that lists it
(TestPluginThinkingOff).

Run at base 421117e (origin/main, fetched just before the commit):
- packages/commandcode: TMPDIR=$H HOME=$H/home bun test, 62 pass 0 fail.
- repo root: HOME=<temp> bun test, 2317 pass 0 fail; bun
  scripts/check.mjs ok.
- think-off.test.mjs against the old index.mjs: 5 of 6 red (none sent
  as "none", no "none" level listed, Go sent "off"); the sixth, other
  levels unchanged, passes on both, as it should.

Not tried: no real Command Code account was used. The "off" behaviour
rests on the reporter's measurements, and Go's /alpha/generate with
"off" is untested. The Responses API path (reasoning.effort) is not
rewritten: magpie and OpenCode ask these models on chat completions.
2026-10-23 15:58:40 +08:00
yetone 421117ef75 qoder 0.2.31: every call of one prompt's tool loop goes out as one task, as Qoder's client sends it, under the agent's own session (#330)
real-jacket (#330): one DSH task on qoder/dfmodel made 265 calls in 55
minutes, then Qoder answered 429 "Billing daily count exceeded". qoderBody
made every call a task of its own: request_set_id = chat_record_id =
request_id, a new business.id, begin_at = the call's own time and stage
"start" on every call.

What Qoder's client does, read (read-only) from the installed Qoder.app's
qoder-agent-sdk worker (dist/_worker/qoder-worker-runtime.obf.mjs):
- AgentLifecycle.create runs once per user prompt (driveQuery), with
  requestSetId = the prompt's requestSetId, else a preallocated one, else
  randomUUID(); business = {product, version, type, id: the prompt's
  requestSetId || randomUUID(), name, begin_at: Date.now(), stage: "init"}.
- changeBusinessState() moves init -> "start" right after create, so the
  first call goes with "start", and start -> "processing" after each
  answered call (it runs after the error check of a model reply).
- The chat body per call: request_id = chat_record_id = a new id,
  request_set_id = the lifecycle's requestSetId, business = the
  lifecycle's businessInfo. A retry renews request_id/chat_record_id only.

The plugin now keeps a task per session and last user turn (taskOf): one
UUID for request_set_id and business.id, one begin_at, stage "start" until
a call of it is answered, "processing" after; request_id/chat_record_id
stay new per call. A new user prompt is a new task. Tasks are an LRU map
held to 512 entries, each dropped 2h after its last call.

session_id: the plugin now has a chat.headers hook (as cursor and trae
do) that passes the session magpie hands it (provider.ConversationHeader,
which is DSH's x-deepseek-harness-session-id when DSH sends it, or another
agent's own session header; OpenCode's session in OpenCode) to its fetch
in x-magpie-qoder-session, which never goes to Qoder. session_id is its
hash; magpie's "magpie-<hash>" fallback names no session and the old hash
(prompt_cache_key, user, system + first user turn) stays the fallback, so
a DSH system prompt changing mid-task (yetone/magpie#3298) no longer
splits the session. The hook acts on its own site's provider only.

Run: in packages/qoder, TMPDIR=$H HOME=$H/home bun test: 201 pass, 0 fail
(task.test.mjs 6 new). Repo root, same sandbox: 2311 pass, 0 fail.
bun scripts/check.mjs qoder ok. Broken by hand, task.test.mjs red each
time: per-call request_set_id/business.id/begin_at (2 red), session_id
ignoring the named session (2), stage always "start" (2), no LRU/TTL
eviction (1), the hook unscoped to its provider (1); on origin/main's
index.mjs all 6 are red.

Not tried: a real Qoder account (none used) or a capture of the official
client's wire bytes. Whether Qoder's "Billing daily count" counts by
business.id / request_set_id is not known: the change makes the calls
look as the official client's do, it does not prove the count drops.
Not changed: Qoder's client also reports the end of its prompt to
/api/v2/service/ask/finish and sends a shorter model_config; the plugin
still doesn't.
2026-10-23 13:31:17 +08:00
Jeff Li 08ff18a438 nous: Nous Portal models with Nous Portal's device sign-in (#163, laojianzi)
New package @magpie-community/opencode-nous-auth (provider nous-portal): Nous Portal models, signed in with Nous Portal's own OAuth device flow (public hermes-cli client, inference:invoke scope). The plugin keeps its own sign-in (never reads ~/.hermes), renews the single-use refresh token through x-nous-refresh-token, and sends requests to the Nous inference API with the JWT, retrying once after a 401.

Review fixes in d2f8fa0 (from the review at e8831a8):
- A refresh refused with 401/403 and no OAuth error code (HTML or empty body from an edge or proxy) keeps the sign-in and retries after 30s. Only invalid_grant, invalid_token or refresh_token_reused ask for a new sign-in.
- registry.json and README describe the plugin as Nous Portal models with Nous Portal's device sign-in; plan sharing is one line pointing to Nous's docs.
- content-encoding and content-length are dropped from the decoded response, like grok and cline.
- A token reply with neither expires_in nor JWT exp is renewed after one hour, not every 30s. The fallback never extends an explicit expires_in or exp (the earlier bound wins).

Run at d2f8fa0 merged with origin/main 8e479f1 (clean merge), sandbox HOME/TMPDIR:
- bun test (whole repo): 2305 pass, 0 fail, 194 files.
- node --test packages/nous/index.test.mjs: 55 pass, 0 fail.
- bun scripts/check.mjs: ok, nous listed.
- Probe through createAuth with a stubbed request: 403 HTML, empty 401, empty 403 -> oauth_request_failed, kept (e8831a8: invalid_grant, expired); 400 invalid_grant, 401 invalid_token, 400 refresh_token_reused -> expired; 401 invalid_client -> kept. Expiry: none -> +3600s; expires_in 900 -> +900s; exp 600 -> +600s; expires_in 300 -> +300s; expires_in 0, exp in the past, or expires_in 7200 with a past exp -> 1.
- Broken by hand: restoring the old 401/403 -> invalid_grant mapping turns 3 tests red; fallback back to 1 turns 3 red; letting the fallback outrank explicit bounds turns 4 red; keeping content-encoding/content-length turns 2 red.

Not tried: a real Nous Portal sign-in or request.
Follow-up: #328 (null or string expires_in beside a valid JWT exp gives expires=1).
2026-10-23 12:16:41 +08:00
hspnick 8e479f1171 trae 0.2.20: every chat function's roster is read, and a model's levels are kept (#300)
Every chat function's roster is read, so each model's reasoning levels come from Trae's own config, and a model keeps its levels in magpie and in plain OpenCode (#300, sphuang1030-prog).

- A model in the fallback table keeps the levels its entry names, even though the host hands every model `variants: {}`.
- A variant's value is OpenCode's name (low/high/xhigh); effortOf takes either spelling and sends Trae's (light/high/extra_high), and nothing for a level the model doesn't name.
- The token-keyed record check that never fired is gone; the host's strict refresh reads the list again after a re-sign-in.

Reviewed at 4b968adb: bun test in packages/trae (temp HOME/TMPDIR) 203 pass / 0 fail on bun 1.4.2; bun scripts/check.mjs exit 0. The three new tests go red on the previous head 41904d9. Probes through the loader's fetch: low→light, high→high, xhigh→extra_high; medium/__proto__ send nothing; glm-5.2 fallback gives high, xhigh (was []). merge-tree against main clean; npm latest trae 0.2.19.
Not tried: a real Trae account; OpenCode's own source (whether it fills default variants first).
2026-10-23 09:57:37 +08:00
yetone 575f1e23e7 workbuddy 0.1.30: a refused line quoted back into an assistant message is reworded there too (#291)
tearslee measured on 0.1.29 that the "Web GUI whose URL the runtime
context names. When the user refers" line is refused as 11128 in an
assistant message, where the system-prompt move can't reach it, so a
long DeepSeek Harness chat stays refused for good. Its wording "...
names. The interface, when the user refers" went 400 -> 200 for them.
It joins FLAGGED, which unflag applies to every message, assistant
ones included. The README now says the move doesn't cover an assistant
message and that only a new chat clears words not in the list.

Run: bun test in packages/workbuddy (sandbox HOME), 112 pass; the new
test covers a string and a parts assistant message and a line break
between the sentences.
Not tried: the 400 itself. A short probe with the line through magpie
got 200, so the refusal needs more of the chat than I have; the 400 ->
200 is tearslee's measurement.
2026-10-23 09:31:24 +08:00
mola e7f65641df Add layerfs: LayerFS workspaces as tools for every agent (#318)
New community tools package @magpie-community/tools-layerfs 0.7.1 (Mola-maker): LayerFS workspaces as tools for every agent. It imports a source folder into a versioned workspace under MAGPIE_LAYERFS_HOME (default ~/.magpie-layerfs), with checkpoints, history and diffs. Running commands (exec) is off unless the user turns it on. No network access. registry.json gains its one entry.

Run at the reviewed head 4795df0 (merges cleanly onto origin/main 1ae89aa):
- bun scripts/check.mjs layerfs: ok
- bun test in the package under a temp HOME: 48 of 48 pass, worktree clean after
- the seven points from the last review, each re-run:
  1. source guard: ~/.Config/Magpie, a symlink to ~/.config/magpie, ~/.AWS, ~/.CONFIG and a symlinked parent are all refused
  2. names: project a / branch b--c and project a--b / branch c no longer share a workspace; Main and main are apart
  3. layerfs_history {limit:1} at 200 checkpoints: 0.1 ms (151 ms before), no trajectory.json written
  4. native backend and its SDK path removed; asking for it throws a clear error
  5. repository points at this repo; README images pinned
  6. runShell: cat returns in 32 ms (2005 before), a backgrounded sleep doesn't hold the call, a timeout kills the process
  7. storedBytes equals stored content plus checkpoint records; the description says so
- read every line changed since 1c9e4c1: no path escape, no writes outside its home

Not tried: a real agent using the tools through magpie.
Known: something exec starts in the background keeps running after a successful call, like a normal shell, and can land in the next checkpoint.
2026-10-23 08:16:30 +08:00
Guislabert 1ae89aa7b6 cloudflare-workers-ai 0.0.2: usage() checks the Account ID, one (Paid) rule, parser tests (#327)
Follow-up to #326 (Guislabert). usage() applies loader()'s 32-hex Account ID check, so an invalid id returns the fallback plan row and never reaches the /accounts/{id} path. The "(Paid)" name rule lives in one paidName helper. Two parser tests cover a non-HTTP(S) baseTemplate and an unknown placeholder. Version 0.0.2.

Run at the reviewed head afd7878 (based on origin/main):
- bun scripts/check.mjs cloudflare-workers-ai: ok
- node --test in the package under a temp HOME: 15 of 15 pass
- main's src/index.mjs with the new tests: the invalid-Account-ID usage test fails (14 of 15), so it guards the fix
- afd7878 against 114900a: README CHANGELOG links dropped, version 0.0.2; src and tests unchanged

Not tried here: a real Cloudflare account (the author's run on 0.0.1 is on #326).
2026-10-23 07:51:49 +08:00
yetone b0c0bcb782 cloudflare-workers-ai: (Paid) renders bold in the README and its Japanese copy
The English line had a space inside the bold markers ("** (Paid)**"),
and the Japanese one had no space before them after a kana, so neither
rendered bold. The Japanese line also said 半角括号, a Chinese word.
Docs only, no version bump; npm's copy changes with the next version.
2026-10-23 07:09:19 +08:00
Guislabert dbcd4e9464 add cloudflare-workers-ai: Cloudflare Workers AI provider plugin (#326)
New community provider plugin @magpie-community/opencode-cloudflare-workers-ai-auth 0.0.1 (Guislabert): signs in to Cloudflare Workers AI with an API token and Account ID, lists the models models.dev has under cloudflare-workers-ai, marks the 8 paid-only models "(Paid)", and adds a Neurons/day quota row. registry.json gains its one entry.

Run at the reviewed head 84b3aaf (based on origin/main):
- bun scripts/check.mjs cloudflare-workers-ai: ok
- node --test in the package under a temp HOME: 12 of 12 pass
- models.dev outage repro (stubbed fetch, discoveryTTLMs 1, catalog reachable then down): the second request still goes out ("down: sent 2"). At 6e9fd73 it failed; review asked for this.
- registry.json diff against main: the one new entry only

Not tried: a real Cloudflare account; no request reached Cloudflare.
2026-10-23 07:08:14 +08:00
yetone 5ab7df285b grok tests: no test finds an installed Grok Build (#325)
Some grok tests looked Grok Build up as the plugin does and ran what they
found (`grok --version`, `grok models`). On a machine with Grok Build
installed that ran the real CLI, which can reach xAI.

packages/grok/nocli.mjs is imported first by every grok test file, and
each calls noRealGrok() before reading its environment. It sets every
place executable() looks:
- PATH: /usr/bin and /bin only (the fakes' scripts run cat, rm, sleep),
  each left out if it holds a grok; empty on Windows.
- GROK_BIN_DIR: a folder that doesn't exist; GROK_HOME: an empty folder.
- HOME and USERPROFILE: an empty folder, for ~/.grok/bin and
  ~/.local/bin. Bun's os.homedir() keeps the HOME the process started
  with (checked: setting process.env.HOME doesn't change it), so the
  helper mock.module()s node:os with a homedir that reads HOME
  (USERPROFILE) at call time, as Node's does, before index.mjs loads.
  Other packages in the same run see Node's behaviour: the started HOME
  unless a test changed it.
A test that wants a CLI still puts its fake in GROK_BIN_DIR.

Marker proof: a fake grok (under a .grok folder, so it counts as Grok
Build) that appends its argv to a marker file, placed on the outer PATH,
in ~/.local/bin and ~/.grok/bin under the test HOME. Run as
TMPDIR=$H HOME=$H/home PATH=$H/outer:$PATH bun test:
- old tests (92d5557), packages/grok: marker written, 5 runs (1 `grok
  --version`, 4 `grok models`, from ~/.grok/bin under the test HOME),
  78 pass 4 fail
- new tests, packages/grok: no marker, 82 pass 0 fail
- new tests with the mock.module line commented out: marker written
  again (same 5 runs), 78 pass 4 fail
- new tests, whole repo: no marker, 2166 pass 0 fail across 189 files
- bun scripts/check.mjs: ok (no version bump: test-only change)

Not tried: Windows; a run with the real HOME (the marker run covers the
same folders under a test HOME); the real grok was never run.

Closes #325
2026-10-23 03:19:41 +08:00
yetone 92d555769b grok 0.2.1: a token Grok turns away is renewed once, and one Grok Build can't renew says so (#324)
Grok can reject a token hours before its expires_at. A 401 used to be
passed on (requests) or read as "Grok's sign-in has expired; run `grok
login`" (models), with no renewal tried: token(home, expired) was never
called with expired set. And an auth.json caught while the CLI rewrote
it read as "not signed in", which the refresh hook marks as an expired
sign-in.

- token(home, rejected): rejected is the token Grok turned away. A token
  on disk other than that one was renewed already and is used; else the
  CLI renews it (`grok models` in the home). A run that leaves the same
  token throws "Grok Build couldn't renew the sign-in (grok models
  <exited N | ran and left the same token>: <its last line>)", never
  "not signed in" or "expired".
- What it says helps: for Grok Build's own home (current()), open Grok
  Build and send it a message; for a home of the plugin's (a second
  device-code account, a CPA import) add the account in magpie again.
  No "run `grok login`" where that signs in a different home. A home of
  the plugin's with no sign-in left says to add the account again too.
- Requests: a 401 renews once and resends the same body with the new
  token. Unrenewable, the 401 carries that message plus Grok's own words
  (JSON error), still X-Magpie-Sign-In: kept. Models: a 401 renews once
  and lists again; a renewed token also refused says so. Usage: same
  retry once. auth.refresh's unrenewed case uses the same message.
- look(): an empty or non-JSON auth.json is torn. read() tries it again
  for ~0.5s (6 x 100ms), then keeps the last sign-in read whole there,
  as the CLI does ("auth reload: auth.json unreadable, keeping previous
  credentials", in its binary's strings). Torn with nothing read before
  is an error saying it couldn't be read, with no signIn mark. No
  auth.json.lock is taken: it is the CLI's flock around its renewal,
  Node can't take a flock, and holding it could only delay a renewal.

Changed tests: signin.test's 401 now has no CLI and expects the no-CLI
message beside Grok's body; usage.test and models.test the same; a
private home's "not signed in" says to add the account again.

Run (worktree at 59990e1, PATH without ~/.grok/bin and ~/.local/bin so
no real grok is found; TMPDIR and HOME in a fresh temp dir):
- packages/grok: bun test, 82 pass 0 fail
- repo: bun test, 2166 pass 0 fail across 189 files; bun scripts/check.mjs ok

Broken by hand (renew.test.mjs, 9 tests):
- old index.mjs: all 9 red
- TORN_TRIES = 1: the mid-write test red
- no last-good fallback: the stays-torn test red
- unchanged token not caught after renewal: the three couldn't-renew
  tests (request private home, request shared home, models) red
- shared() always false: the shared-home message test red

Not tried: the real Grok Build CLI or a real Grok account (the fake CLI is
/bin/sh, fetch is a stand-in); a real 401 from Grok before expires_at; a
CLI writing auth.json in place while it is read (the torn file is
written by the test); a body that is a stream (not resent, as before:
only a string or no body is retried); Windows. magpie's mover min for
grok is not raised here.
2026-10-23 03:02:09 +08:00
yetone 59990e1cdd autoclaw: README says a banned account keeps its sign-in (0.2.5's change)
Doc only, no version bump: the line ships in the next autoclaw version.
Nothing run beyond reading the rendered line.
2026-10-23 02:06:35 +08:00
yetone dd8caac45b autoclaw 0.2.5: a banned account keeps its sign-in and says the ban, not 登录已失效
小八 (Discord, 2026-10-23): a banned AutoClaw account answers
HTTP 403 {"code":410004,"message":"The account has been banned"}.
The plugin read every 401/403 as an expired sign-in, so magpie dropped
the token from plugin-auth.json and the user never saw why. Signing in
again gets the same account and the same refusal.

A body whose code field is 410004, or whose code/message field (message,
msg, error.message) names a ban or account restriction (banned, 封禁,
封号, 账号异常, account suspended/frozen/disabled/blocked/restricted,
账号被冻结/停用/禁用), is now the account's refusal, not the sign-in.
Only those fields are read, never the whole body. A true token expiry
(401/403 with any other code or message) is still expired.

Every route that mapped 401/403 to expired:
- overseas loader: 403 permission_error with the vendor's words and
  X-Magpie-Sign-In: kept; the second host isn't asked (a ban is the
  account's on every host, as a spent quota already was).
- CN managed loader: the same.
- refresh: an envelope ban throws "AutoClaw: <message>" with signIn
  "kept"; a non-envelope 401/403 naming a ban does too, every other one
  stays expired.
- usage: the wallets read said "积分接口无数据" for a ban; it now returns
  the vendor's words with signIn "kept".
- check-in: taskList threw 登录已失效 for any 403; a ban now says the ban
  and stops the host rotation.
- models: provider.models makes no request, nothing to change.

Siblings with "every 401/403 is expired" and no vendor-shaped ban
evidence, listed and left alone: qoder (refreshJob, patSignIn),
codearts (withSignInMark, 403 on chat), cline (clineApi default lapsed),
minimax (accountCall), kiro (refresh 400/401/403), opendesign (usage
preflight, models), trae (refresh 400/401/403).

Run at this head (worktree from origin/main 929a8b3):
- packages/autoclaw: bun test (sandbox TMPDIR/HOME) 34 pass, 0 fail.
- repo root: bun test 2157 pass, 0 fail across 188 files.
- bun scripts/check.mjs: exit 0.
- Broken by hand, each red: overseas loader back to quotaRefusal only,
  CN loader back to quotaRefusal only, refresh envelope ban check off,
  refresh non-envelope back to "expired", usage wallets ban throw off,
  check-in break-on-ban off, 410004 dropped from the codes. The new tests
  against origin/main's index.mjs: 6 of 6 red.
Not tried: a real banned account (none at hand); the bytes are the
reporter's.
2026-10-23 02:04:23 +08:00
yetone 929a8b3adf qoder 0.2.30: Qoder CN's check-in sends Qoder CN's own device identity, as its desktop and CLI do (yetone/magpie#2911, #304)
witt-bit (yetone/magpie#2911, 10-22): after Qoder CN's update moved its
daily 100 Credits into the desktop's 权益中心, magpie's Qoder CN check-in
stopped working; Andrew0767 (#304) sees the same with Qoder desktop
installed. The plugin sent Qoder CN's campaigns pages no device identity
at all ("Qoder CN does not need this local helper").

What Qoder CN's clients do, read from their own packages:
- Qoder CN desktop 0.4.9 (the .deb's out/main): its requests carry
  Cosy-ClientType 10 and, through createAuthorizedHeaders, the identity
  from <resources>/umid/runtime-info run with environment
  `regionCode === "global" ? 3 : 0`, i.e. 0 for Qoder CN, the uid on
  stdin (--account-stdin) on macOS and Windows. Campaigns are found
  through GET /sash/api/v1/me/notifications (hasClaimableCampaign,
  campaignPopupUrl). When the identity can't be read it sends the
  request without it (resolveMachineIdentity's catch returns null).
- qoderclicn (@qodercn-ai/qoderclicn 1.1.64, 1.1.70, 1.1.73):
  campaigns.list is GET /sash/api/v1/me/campaigns, needing the UMID from
  1.1.64 and requireMachineIdentity() from 1.1.70, UMID environment
  ONLINE = 0; its config dir is QODERCN_CONFIG_DIR, else QODERCN_CLI_HOME
  (or home) + QODERCN_CONFIG_DIR_NAME (or .qoder-cn), and it caches the
  helper in <config>/.bin/runtime-info-<platform>-<arch>-<hash>.
- Install places: Qoder CN.app/Contents/Resources/umid/runtime-info
  (seen inside Qoder-CN-Installer-mac-arm64.zip's payload, 0.4.9),
  /opt/Qoder-CN/resources/umid/runtime-info (the .deb), and on Windows
  umid/runtime-info.exe among Qoder-CN-win-x64-user.exe's owned files,
  with "Uninstall Qoder CN.exe" (electron-builder's
  %LOCALAPPDATA%\Programs\<productName>; the folder itself not seen).

The plugin now keeps a runtime per site (RUNTIMES): Qoder CN reads its own
helper (those paths, its CLI's folders, QODERCN_RUNTIME_INFO, never the
international Qoder's) with environment 0, and sends Cosy-MachineToken and
Cosy-MachineType on the list, the claim and the campaigns proxy. As the
desktop does, a Qoder CN request without a readable identity still goes
out, so an account that was claiming without Qoder CN installed (0.2.21's
live PAT claim) keeps doing so. When such a list offers no daily claim,
the check-in is ineligible for the day, saying to install Qoder CN desktop
or sign in to its CLI (no helper), or failed and asked again (a helper that
didn't answer), instead of "inactive". International Qoder is unchanged.

Run: in packages/qoder, TMPDIR=$H HOME=$H/home bun test: 195 pass, 0 fail.
On the old index.mjs the new tests are 9 red (checkin.test.mjs 5 lookup
tests and the env-0 proxy test, native-checkin.test.mjs the env-0 claim,
the ineligible and the failed cases). Repo root at this commit
(rebased on 26e3e5f): 2151 pass, 1 skip, 0 fail; bun scripts/check.mjs ok.

Not tried: a real Qoder CN account (none available) or a real Qoder CN
install, so whether Qoder CN now hides the daily claim from a request
without the identity is inferred from its clients, not seen on the wire;
the Windows install folder is electron-builder's default, not seen; the
desktop's own claim happens in a remote page (campaignPopupUrl) whose
calls weren't seen, so the list/claim pages stay those of 0.2.21;
Cosy-MachineCode, which both Qoder CN clients send, is not sent.
Version 0.2.29 is open PR #319's (QwenWork).
2026-10-23 00:29:25 +08:00
yetone 26e3e5f91a trae 0.2.19: Qwen's <function=…> and Anthropic's <function_calls><invoke> calls written as text are read as calls
01huadalang (magpie's Discord, trae 0.2.18, dsh, Kimi K3 and MiMo 2.6
Pro, sometimes): tool calls came back as the reply's text. The two
screenshots show the shapes:

  <function=compress><parameter=content>[{"endId": "m03680", …
  <function_calls><invoke name="mcp__magpie-image__generation_result">
  <parameter name="id">image-6636-24</parameter> </invoke> … </function_calls>

Root cause: TextTools only knew <tool_call> blocks (JSON, GLM's
arg_key/arg_value, name-attribute + <parameter>) and DeepSeek's DSML.
Neither shape opens with <tool_call>, so both went through as text; a
Qwen <function=…> inside <tool_call> lost the opener and leaked too.

- TextTools.xmlCall reads <function_calls> around one or more
  <invoke name="…"><parameter name="k">v</parameter></invoke> (each
  invoke a call; closes left off between invokes still split them), and
  Qwen's <function=name><parameter=k>v</parameter></function>, bare or
  in <tool_call>. Values go through paramArgs: text where the tool's
  schema says string, else JSON (compress's content array is an array).
- Only for a tool the request declared (toolNamed's match); an
  undeclared name, no tools at all, a tag in backticks or a code fence,
  or a tag with no parameter and no close stays text. This is stricter
  than <tool_call>, whose block is a call under any name: these tags
  are common in prose about the formats.
- Held back while streaming (MARKS, XML_HOLD), so a tag split across
  chunks never reaches the text; the closes and the wrapper are dropped
  as leftovers after a call. A parameter left open when the stream ends
  is cut short: the turn ends with the error plugins#38 gives, never text.
- README says so.

Sibling: qoder has its own Splitter that reads <function=…> only inside
<tool_call> and neither shape bare; not changed here, filed as
plugins#323. No other package parses text-written calls.

Run at this commit (base origin/main 1b06308), sandbox HOME/TMPDIR:
- packages/trae: bun test, 183 pass 0 fail (20 files; new
  xmlcall.test.mjs, 8 tests). Fixtures are the reporter's literal bytes:
  both samples whole and in pieces of 1/2/3/5/7/13/64, each split in two
  at every offset, sample 1 as shown (cut) and closed, a cut inside the
  second invoke, undeclared tools, prose/backticks/fence mentions, and
  sample 2 through the plugin over the fake Trae streamed and not
  (finish tool_calls, no text).
- bun scripts/check.mjs: 21 packages ok.
- Broken by hand, each red then restored: XML_AT never matching (6 of 8
  red), the declared-tool check removed (undeclared test red), the
  closes dropped from LEFTOVER (samples test red), XML_AT/XML_HOLD left
  out of the stream hold (5 of 8 red).

Not tried: a real Kimi K3 or MiMo 2.6 Pro turn on Trae; dsh's compress
tool schema wasn't found locally, so the test declares content as an
array (a string schema would keep it as text, as declared).
2026-10-23 00:26:05 +08:00
moxuanchen 1b06308fad raccoon 0.1.3: a desktop seat keeps its own account after the app switches (#320, moxuanchen)
A desktop seat keeps the token it was signed in with, saved on its own record through client.auth.set. It reads the app only to pick up a newer token for the same account. sameAccount requires the read token to carry the seat's uid, so a token without a uid, or with another account's uid, is never used for the seat. Before this, a seat could be billed to the app's current account, and report that account's credits, without anything saying so (#166). The README says what the change guarantees, and that the vendor revokes the previous account's session when the app signs in to another (#166's measurement). The registry summary is back to main's text. Version 0.1.3.

Run at the reviewed head 639da69 (origin/main 532e738):
- packages/raccoon: HOME=<temp> bun test gave 36 pass, 0 fail. bun scripts/check.mjs: all 21 packages pass.
- Broken by hand at b64dc95, each turning a test red: a uid-less read token agreeing (1), desktopSignIn storing access "" (3), no write-back (1), using the app's token for another account (5), ignoring the seat's own expiry (1).
- Broken by hand at 639da69, for the revoked-seat test: the loader retrying a desktop 401 with the app's token (red), and a desktop 401 reported as kept (red). With usage falling back to the app's token on a 401, it stays green, because the stub refuses every token. Other tests cover usage on the normal path (user=AccountA).

Not tried: a real Raccoon desktop app with two accounts. No real accounts were used.
2026-10-22 23:27:46 +08:00
yetone 532e738857 minimax: a check-in turned away with 401 is renewed and asked again, as MiniMax Code does (0.1.5)
Magic_zero (Discord, MiniMax Code international) saw "check-in: the sign-in
was refused (HTTP 401)" on every try while chats worked; signing in again,
reinstalling and a proxy didn't change it. 0.1.4 (4d73d22) added user_id and
the device fields and was never tried.

Diffed against the official client, @minimax-ai/code 0.6.12 from
registry.npmjs.org (npm pack), chunk-5ADYFF2U.js: its /checkin class (T9)
builds the request with Ej(). Given the same token and user id, 0.1.4's
international request is the same field for field: URL, method, query
(device_platform web, is_desktop, desktop_version, user_id, ...), Bearer
access token, yy, x-timestamp, x-signature, body "{}". So user_id was not
the cause. minimax-cloud answers a token it doesn't take with 401
{"error":"invalid access token"} (asked without credentials of
agent.minimax.io, agent.minimax.cn and agent.minimaxi.com). MiniMax Code
meets that 401 by renewing the sign-in (authContextResolver forceRefresh),
reading realUserID again and asking once more. The plugin's chat fetch
renews on a 401 too, which is why chats worked; the check-in gave up.

- checkin: on a 401 the token is renewed (fresh with the rejected token:
  a newer held one, else a refresh), the user id read again, and the
  check-in asked once more. A refresh refused as invalid_grant says
  signIn "expired"; any other failure keeps the first error and doesn't
  sign the account out. 403 is not retried.
- China sibling: the same missing retry, and the check-in went to the
  chat host agent.minimax.cn while MiniMax Code asks agent.minimaxi.com
  (HA() cn), the host the plugin's other China account calls already use.
  It now uses site.agent.
- README's Check-in section says both.

Tests (checkin.test.mjs), from the official request shape: a 401
"invalid access token" for the old token, then refresh, user info and
status/claim with "Bearer new", for both sites; still refused after the
renewal fails after two asks; invalid_grant says expired; 403 is not
renewed; the China panel is asked on the minimax-cloud host. Run against
origin/main's index.mjs, 5 of them fail (the 403 one passes on both).

Ran at 7ee60f8 + this change:
  packages/minimax: H=$(mktemp -d); HOME="$H" bun test -> 59 pass, 0 fail
  repo root: H=$(mktemp -d); HOME="$H" bun test -> 2127 pass, 0 fail
  bun scripts/check.mjs -> exit 0

Not tried: a real MiniMax account (none available), so neither that a
renewed token is taken by minimax-cloud nor the reporter's own case.
magpie has no MiniMax mover or min; plugins update themselves hourly.
2026-10-22 22:06:50 +08:00
yetone 7ee60f8253 zen-free 0.1.14: keyless single-identity sign-in (#205, LoKi) 2026-10-22 21:12:33 +08:00
lokic7123-starandLoKi 52968f2d34 zen-free: declare keyless single-identity access (#205, LoKi)
Marks Zen Free's api method keyless and its auth single, so magpie's host (yetone/magpie#2695, 5871f02dd) signs it in with no key field and Sign in again instead of another account. authorize is unchanged; older hosts and OpenCode keep the public-key flow.

Run at the PR head 29f0e9b38: bun test in packages/zen-free under a sandbox HOME, 175 pass, 0 fail. Checked against magpie main: host.js reads m.keyless (api method with authorize) and auth.single, the two fields this sets.

Co-authored-by: LoKi <317300729+lokic7123-star@users.noreply.github.com>
2026-10-22 21:12:09 +08:00
yetone 20396784c7 kiro 0.1.15: an API key is used as kiro-cli uses it, with or without a profile GetProfile finds (Hollowhere on Discord)
Hollowhere (magpie 0.1.1319, kiro-cli 2.33.1, macOS) signed in to Kiro in
magpie with a Kiro API key. /v1/models listed kiro/auto alone, and every
request failed with "Kiro: Kiro didn't take the API key: 400 Bad Request",
while kiro-cli listed claude-opus-5.5 and claude-sonnet-5.5 and chatted
with the same key.

Cause: the plugin asked GetProfile in us-east-1 only and threw on any
answer but a profile, so a key GetProfile has no profile for never got
further: the model list fell back to Auto and every request failed with
that 400. kiro-cli 2.32.0 (installed here), traced with KIRO_API_KEY set
to a made-up key in a sandbox HOME, every host behind a local proxy that
refused all of them (nothing left the machine), and then with
api.cps.service/api.krs.service/api.codewhisperer.service pointed at a
local recorder:
- asks GetProfile (POST management/, X-Amz-Target
  AmazonCodeWhispererService.GetProfile, body {}) in us-east-1, then
  eu-central-1, then GovCloud and ISO, and with every one refused goes on
  to list models and chat in us-east-1 all the same;
- lists models with the control plane's ListAvailableModels (POST
  management/?origin=KIRO_CLI, X-Amz-Target
  KiroControlPlaneBearerService.ListAvailableModels, body
  {"origin":"KIRO_CLI"}, paged with nextToken), not the REST
  List-Available-Models with a profileArn;
- reads credits with GetUsageLimits (same shape, body {"origin":"KIRO_CLI"});
- names no profileArn in generateAssistantResponse, ListAvailableModels
  or GetUsageLimits, even when GetProfile gave one;
- sends each with Content-Type application/x-amz-json-1.0,
  Authorization: Bearer <key>, tokentype: API_KEY (as the plugin did).

The plugin now does the same for an API key: GetProfile in us-east-1 then
eu-central-1, once per key; a found profile only picks the region; none
found means us-east-1. Its models are ListAvailableModels as above, its
credits GetUsageLimits as above, and its chat names no profile. Sign-ins
other than an API key are unchanged.

Run, in packages/kiro, H=$(mktemp -d); HOME="$H" bun test: 55 pass at
this head (rebased on origin/main 4d73d22, kiro 0.1.14). The new
apikey.test.mjs (fake management and runtime API built from the recorded
shapes: GetProfile 400 in both regions, a key whose profile is in
eu-central-1, two pages of models, GetUsageLimits) fails 4 of 4 with
origin/main's index.mjs (0.1.14) and passes with this one.
bun scripts/check.mjs kiro passes.

Not tried: no real API key was tried. None was used anywhere; the traces
used a made-up key against a local recorder only. That Kiro answers a
real key's GetProfile with 400 when it has no profile, and serves its
ListAvailableModels and chat in us-east-1 without one, is what kiro-cli
2.32.0 does and Hollowhere's kiro-cli 2.33.1 succeeds with, not seen
here. kiro-cli's own handling of a 400 (rather than a refused host) per
region was not traced, since its TLS goes through the system's trust and
was not intercepted. GovCloud and ISO regions are not asked.
2026-10-22 20:00:05 +08:00
yetone 4d73d22010 minimax 0.1.4: the check-in is asked as the account (its user id), as MiniMax Code's own /checkin asks it (Magic_zero on Discord)
Magic_zero's international (minimax-code-global) account failed the daily
check-in with "check-in: the sign-in was refused (HTTP 401)" while the same
account chatted through magpie and checked in by hand on agent.minimax.io.

Cause, from MiniMax Code's own bundle (@minimax-ai/code 0.6.12, read from
npm): its /checkin client (signin/status and signin/claim, chunk-5ADYFF2U)
signs the request as the account, with user_id = the account's
realUserID, and refuses to ask at all without one ("MiniMax Code sign-in
is required"). Every other minimax-cloud call it makes (desktop error
reports, feedback, connectors, plugin cloud) names the user too; the error
report sends nothing but user_id beside the Bearer token. The plugin's
check-in went through signed() with no userID, so user_id=0. The chat path
(/mavis) and user/info don't go through minimax-cloud, which is why the
token works there. The same client also sends device_platform web,
is_desktop 1 and desktop_version, where the plugin's account API sends
device_platform mcode. The host and signature already matched
(agent.minimax.io; x-signature/yy as before).

This is read from the client's source; the server's rule (a check-in as
user 0 is a 401 on the international site) is inferred, not observed. The
web page (agent.minimax.io, prod-web-va-0.1.220) sends its own web
token in a `token` header, so it isn't the reference for this token kind.

What changed:
- signed() takes query overrides; the check-in passes user_id (the
  saved realUserID, or user/info's answer when the sign-in didn't keep
  it) and MiniMax Code's device_platform web, is_desktop 1,
  desktop_version 0.6.12. A user id that can't be read fails the
  check-in without asking the panel.
- The China site gets the same request (MiniMax Code sends it on both).
  Its host stays agent.minimax.cn.
- README says how the check-in is asked. 0.1.3 -> 0.1.4.

Tests (checkin.test.mjs):
- "the international check-in is asked as the account, not as user 0":
  a fake that 401s any user_id but the account's. On origin/main's
  index.mjs it fails with the reporter's exact message, "check-in: the
  sign-in was refused (HTTP 401)".
- an account saved without its user id has it looked up first; one
  whose id can't be read fails without a check-in.
- the signing test now checks user_id, device_platform web, is_desktop
  and desktop_version.
Against origin/main 7fdc07f's index.mjs: 4 of 21 check-in tests fail.
(origin/main has since moved to 26ddabe, a qoder change only.)

Run at this commit, rebased on origin/main 26ddabe:
- packages/minimax, HOME=$(mktemp -d) bun test: 54 pass, 0 fail.
- repo root, HOME=$(mktemp -d) bun test: 2117 pass, 0 fail.
- bun scripts/check.mjs (all packages): ok.

Not tried: a real MiniMax account on either site (the owner's magpie has
none signed in, and no one's credentials were used). Whether the China
site now answers the same is not seen either; MiniMax Code sends these
params there too. If the 401 stays, the next evidence is the failing
request's reply body (`{"error": ...}`) from the user.
2026-10-22 19:01:07 +08:00