main
28
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0135b7b0ea |
agy-cli 0.1.32: the first model list after warming has agy's Claude and GPT models (#1064)
On a signed-in agy, `agy models` takes about 4.4s and `agy acp`'s
session/new about 3s. provider.models() needed three calls before
claude-opus-5-5, claude-sonnet-5-5 and gpt-oss-120b showed up, and
OpenCode 2.x calls it once.
What changed:
- packages/agy-cli/index.mjs:
- The offered-model probe now starts in listAgyModels' .then, as soon as
a non-empty list arrives and a caller asked for probeOffered. It no
longer waits for the next models() call. A hung or failed `agy models`
still never spawns the probe.
- probeSignedIn reuses the `agy models` stdout it already has. The same
parser (parseAgyModels, split out of listAgyModels) fills
cachedModelCatalog, and the probe starts. Sign-in waits for the probe
for at most 3s.
- The offer (acpOfferedModels, acpOfferedKey, offeredProbeAt and any
in-flight probe) is forgotten when agyPath changes and after a new
sign-in finishes. A generation counter drops the answer of a probe
that started before the reset.
- provider.warming() returns a promise while a list or probe is still
running, and null when nothing is.
- scripts/opencode2.mjs, copied byte for byte to every
packages/*/opencode2.mjs: after the first background refresh, the
adapter awaits hooks.provider.warming() once, for at most 60s, and then
refreshes once more. It does not loop. Plugins without warming() behave
as before.
- Not done: the issue's on-disk catalog cache (point 3), skipped as asked.
Known gap: agy-cli has no `config` hook, so under OpenCode 2.x the adapter
lists no provider for it. refresh() returns before it calls
provider.models(), so the follow-up refresh can't add agy's models on 2.x
until agy-cli gets a config hook.
Tests: test/testkit.mjs's fake agy takes a sessionNewDelayMs. The new
tests in test/catalog.mjs set 1.5s on both `agy models` and session/new
and wait for state through warming(), with no fixed sleeps:
- On a slow cold start, the first models() after warming lists Claude and
GPT, from one probe spawn.
- authorize() on a signed-in agy fills the catalog, and the next models()
runs no second `agy models`.
- The sign-in wait is bounded: with a 6s session/new, sign-in returns in
about 4.5s.
- Changing agyPath probes again.
The hang test now awaits warming() before it counts acp spawns.
scripts/opencode2.test.mjs: the warming list is read a second time when
warming ends, and only once when nothing is warming.
Run on Linux (a separate test Mac was over its load limit):
- packages/agy-cli bun test: 17 pass, 0 fail.
- bun scripts/check.mjs agy-cli: ok.
- bun scripts/check.mjs (all packages): ok.
- Root bun test in a temp HOME: 8530 pass, 19 skip, 0 fail.
Broken by hand on Linux, each red, then restored green:
- No probe in the .then: the slow cold-start test.
- probeSignedIn drops the list: the authorize and bounded-wait tests.
- agyPath change keeps the old offer: the agyPath test.
- Unbounded sign-in wait: the bounded-wait test (7514ms).
- Probe also on a failed listing: the hang test.
- origin/main's index.mjs with the new tests: all four #1064 tests.
- Adapter reads the list once: the warming adapter test, and the
copy-identity check.
Not tried: a real agy (no Google sign-in, no network). The reset after
login.finish has no unit test of its own.
Reported-by: hiee3
|
||
|
|
92c20ffef6 |
Eight auth hooks declare rotating refresh tokens (#1027)
Eight auth hooks declare `rotating: true`: cline, codearts (and OfficeAce), factory, minimax, nous, qoder, sensenova, workbuddy. Each package's own code says the vendor refuses a spent refresh token. magpie then stops carrying these sign-ins to another computer through Sync, a backup or a Restore (internal/provider/signins_carry.go). Trae was dropped: its refresh keeps the old token when the answer has none, and there is no evidence it rotates. Each package's patch version is bumped (cline 0.1.15, codearts 0.3.13, factory 0.1.46, minimax 0.2.9, nous 0.1.3, qoder 0.2.66, sensenova 0.2.3, workbuddy 0.2.30). Each was checked against npm, or against origin/dist for the dist-only packages, before the merge. Fixes #884. Run at cc2f9199 (a fast-forward of origin/main), on mica with a temp HOME: bun test over the eight packages gave 1588 pass, 0 fail, and scripts/check.mjs exited 0. CI's test and on-npm jobs pass. At 45c8fdb4, mote gave 1834 pass with Trae included. Not tried: a real refresh against each vendor. Co-authored-by: yetihan <yetihan@users.noreply.github.com> |
||
|
|
97fdba8ca6 |
minimax 0.2.8: native Magpie image, video and web search (#1008)
MiniMax Code accounts now serve magpie's image, video and web search natively: /v1/images/generations and /v1/images/edits through generate_image, video through submit_video_generation, and search through the connector's web tools.
- Edits: magpie's multipart body (model, prompt, n, size, quality, image / image[] parts) is parsed, and each image goes through the live catalog's upload_temp_url signed-form flow. A mask part is refused with a 400 (generate_image takes no mask). A video frame sent as data: is uploaded the same way, and https refs pass through.
- A 401 is renewed per tool call, and only that call is sent again, so a 401 on get_asset_url never runs a paid generate_image twice.
- Upload hosts are https only. A video download drops content-encoding and content-length (fetch already decoded it).
- Envelope refusals carry a status: 1002, 1039, 1041, 1045, 2045, 2056 and 2062 are 429; 1008 and 2053 are 402 (MiniMax's published error codes, not confirmed for the MiniMax Code agent API).
- 0.2.8, since 0.2.7 (#1014) is on npm. native.mjs is in files.
What was run at c020d32e51f9b28e29528ea59d38bc167baf8624 (temp HOME, fake fetch only, no real MiniMax calls):
- mote (macOS): bun test packages/minimax, 193 pass, 0 fail. bun scripts/check.mjs exit 0.
- WSL Ubuntu 24.04: 193 pass, 0 fail.
- Broken by hand, one at a time, each turned a test red: no per-call 401 renewal (2), mask accepted (1), http upload host accepted (1), no envelope status (2), content-encoding kept (1). Earlier rounds broke multipart parsing, the status in toolHttpError and mediaRef's schemes, each red too.
- Merges cleanly onto main
|
||
|
|
2b87fad98d |
minimax 0.2.7: opt-in compactTools lists only the four dispatcher tools (#1014)
Adds the plugin option `compactTools` (default false, declared in package.json `magpie.options`). Only an explicit `true` leaves the sixteen named Matrix tools out of the tools plugin's advertised list; `list_tools`, `tool_schema`, `call_tool` and `web_search` stay, built by the same code, with descriptions and schemas unchanged. `call_tool` still checks arguments against the live catalog. This is option A as decided on #1005; option B (rewritten descriptions) is not in it. Run at the reviewed head a2d18183, on mote with a temp HOME: - bun test packages/minimax: 165 pass, 0 fail - bun scripts/check.mjs: exit 0 - Advertised list (name, description, args) hashed with MiniMaxCodeToolsPlugin at origin/main |
||
|
|
80c9b495fc |
minimax 0.2.6: a model takes the video its config says, in magpie (#985)
configModels() and modelOf() said image or nothing: video, audio and pdf
were hard-coded false, so MiniMax-M3.1-Flash and M3 (whose model config
says modalities.input ["text","image","video"], attachment true) showed
as text and image only in magpie's /v1/models, on both sites.
Now parseModels keeps the config's modalities.input (text, image, audio,
video, pdf; unknown kinds dropped) and attachment, and the built-in list
says video for M3.1-Flash-Preview and M3. Where the plugin runs decides
what is advertised:
- magpie's host (the plugin input has `magpie`): every kind said. magpie's
gateway writes the Anthropic body and the loader's fetch sends it to
MiniMax byte for byte; the new test sends the issue's video block and
checks the upstream got the same body.
- OpenCode: @ai-sdk/anthropic builds the body and throws on a file part
that isn't an image, a PDF or text ("media type: video/mp4",
dist/index.js in 4.0.102), so video and audio stay out there and
OpenCode keeps saying the model can't read them. pdf is passed on.
Still dropping video before it reaches this plugin: magpie's gateway
(parseAnthropicRequest has no video block, and groups don't merge
Inputs): yetone/magpie#6135, the reporter's own issue.
Run at the pushed head, rebased on
|
||
|
|
1ccd764e01 |
minimax 0.2.5: a chat asks for no compression, so the stream really streams (#978)
Flagwill: MiniMax answers a chat asked to compress as one gzip member
flushed at the end, so a streamed answer arrived whole. The chat request
(auth.loader's fetch, the one path every chat of both sites takes, CN and
global, streamed or not) now sets accept-encoding: identity, over any
caller value. Models, usage, check-in and the tool API keep Bun's default.
New stream.test.mjs; README "Requests"; 0.2.5 (npm and main had 0.2.4).
Run at 90fc6ff3 (Bun 1.4.2, temp HOME, WSL magpie-desktop):
- bun test packages/minimax: 151 pass 0 fail (713 expects)
- bun scripts/check.mjs: exit 0
- Windows (xiaomi-gpu, temp HOME/USERPROFILE): 151 pass 0 fail, check exit 0
- merged with origin/main
|
||
|
|
bf302fab7d |
minimax 0.2.4: generate_image takes the catalog's area, n, output_format and reference_images (#955)
hokaii6990-boop (Windows 11, magpie 0.1.3654, plugin 0.2.3, CN site):
`magpie tool minimax_generate_image --requests '{"prompt":"...","area":"2K"}'`
answered "bad arguments: arguments.requests[0].area is not an accepted
argument", while the account's catalog schema has area, and
minimax_call_tool with the same arguments generated the image.
Our first reply said execute checks against the catalog's
input_schema_json. It does, but createConnectorTools wraps every tool's
execute in checked(t.args, args) first, and a named Matrix tool's args
are the bundled matrix-tools.json copy (2026-11-03: resolution,
input_urls, a six-value aspect_ratio). So that check refused the call
before the catalog was ever read.
- A named Matrix tool's call is now checked up front only for its two
routing fields (site, account). Its own arguments are checked once, in
execute, against the catalog entry's input_schema_json, and against the
bundled copy only when the catalog gives none. A parameter MiniMax adds
later passes without a plugin release. A priced call still never goes
out with bad arguments; the catalog read now comes first.
list_tools, tool_schema and call_tool keep their up-front check.
- The refusal names whose schema it was: "(checked against the account's
catalog schema for connector__matrix__generate_image)", or the bundled
one when the catalog gave none.
- matrix-tools.json's generate_image input_schema is the reporter's
pasted `minimax_tool_schema --json` output, byte for byte after JSON
parsing (kept as testdata/generate-image-schema-955.json). It is what
agents are shown. Its description says reference_images, not
input_urls. The other 15 tools' copies are unchanged; no fresher
bytes for them.
- README says calls are checked against the live catalog.
Run:
- wsl-run (magpie-desktop, Bun 1.4.2), HOME=$(mktemp -d):
bun test packages/minimax 148 pass 0 fail; bun scripts/check.mjs exit 0.
- win-run (xiaomi-gpu Windows 11, Bun 1.4.2), HOME and USERPROFILE a
fresh temp dir: bun test packages/minimax 148 pass 0 fail;
bun scripts/check.mjs exit 0.
- Broken by hand (wsl-run, connector-tools.test.mjs):
- 0.2.3's code and bundle: 5 red, among them the area/n/output_format/
reference_images call.
- New code with 0.2.3's bundle: only the bundled-copy test red; the
area call passes, held to the catalog.
- New bundle with the old up-front check: 3 red (the catalog's
refusal message, the no-schema fallback message, and a refusal that
now reads the catalog first).
Not tried: no MiniMax Code account here, so no real generation; the
schema is the reporter's, from one CN-site account. The global site's
catalog was not seen. Codex desktop refusing area from the advertised
schema (the reporter's second path) was not reproduced; the refreshed
copy covers it for these fields. The get_asset_url /visible/ watermark
note is split out to #974.
Reported-by: hokaii6990-boop
Refs #955
|
||
|
|
087c36123d |
inkstone 0.1.3: image-caps preflight, a zero-prompt browser sign-in, key calls on the session cookie (#832)
inkstone 0.1.3 (#832, yunwang2442-creator): - Image requests are prechecked before they leave: 8 images, 10MB each, 40MB in all. - A request over a cap gets a local 400 shape refusal, so magpie asks the next account and rests none. - The plan's invalid_media / media_fetch_failed / unsupported_media_type errors become the same kind of refusal. - The body rewrite strips the reasoning fields and sets image detail to auto. - A zero-prompt browser sign-in comes first, and a second browser method reuses a pasted key. - Neither browser method is offered when no Chromium-family browser is found (#825). - The /keys calls ride the session cookie, without the pagination query. Key creation retries the console's -15100 "refresh page and retry". - The #826 metadata token read is kept, and its test is back. - The fake browser is built once per user and source hash (#824), and the title wait reads only on Windows. - maxConcurrency is 4. - The doubled comment line is dropped from every opencode2.mjs copy, agy-cli's included. Reviewed at 88e66bde, on mote (macOS, Bun 1.4.2) with a temp HOME: - full bun test: 6853 pass / 0 fail; both checks exit 0 - bun scripts/check.mjs and bun scripts/check.mjs inkstone: exit 0 - 21 hand breaks: 20 red, 1 not caught (the /keys pagination test calls protocol.listKeys directly; follow-up filed) Not tried: a real InkStone account or sign-in, Windows and Linux runs. |
||
|
|
e7004d9354 |
inkstone 0.1.0: Intern InkStone (书生·端砚) Token Plan, browser sign-in, credit card and ink-* key chat (#775)
New package @magpie-community/opencode-inkstone-auth 0.1.0 for Intern InkStone (书生·端砚, Shanghai AI Lab) Token Plan, provider id `intern-inkstone`. Community package by yunwang2442-creator. What it does: - Browser sign-in (Edge/Chrome, its own profile under $XDG_CONFIG_HOME or ~/.config/magpie/inkstone-browser, or %LOCALAPPDATA%\magpie\inkstone-browser). The login window has no debugging port. A headless CDP read takes the uaa-token cookie, and the same read renews it silently later. - Usage card: ink-credit balance, 5-hour and 7-day windows, credit packs. - Chat: a pasted ink-* API key, or one the sign-in creates, named ink-<host4>-<acct4>-<rand4> (18 of the console's 20 characters). An idempotency clash (-15109) retries with a fresh name, up to three times. Pruning is on by default. It only touches this machine's and account's prefix, keeps the newest two and the key this sign-in created, and never deletes manual keys or keys of unknown age. - Closing on Unix: SIGTERM, then SIGKILL only after a 15s grace. Leftover browsers are matched by --user-data-dir=<escaped profile>, and Windows uses .Contains(). - The login wait comes from an injected waitForLogin in tests. No env hook is left in production code. - Hosts: discovery.intern-ai.org.cn, discovery-api.intern-ai.org.cn, 127.0.0.1 (CDP). Outside the package: scripts/opencode2.mjs lets a prompt with `required: false` stay optional (`p.required !== false`). Every package's copy is synced byte for byte, so all 39 copies in the merged tree are blob |
||
|
|
24da52b8ca |
minimax 0.2.3: a China-site account call agent.minimaxi.com can't be reached goes once to agent.minimax.cn (#757)
youyo.p_10001 (Discord #feedback, Windows 11, magpie 0.1.2993): every China-site account call to agent.minimaxi.com (usage, check-in, account, membership) failed in magpie's plugin host with "unable to get issuer certificate" for ~16h, while chats on agent.minimax.cn worked. They checked that agent.minimax.cn serves the same account API with the same tokens and answers. accountCall now sends a call to site.agent once more to the site's agentFallback (China: https://agent.minimax.cn) only when the fetch got no HTTP answer: a TLS error, a refused/reset connection, a name that didn't resolve. A 401/403, any other status, a statusInfo/base_resp error, a redirect to another site (OtherSite) and a timeout or abort are the answer and are never sent twice. Both attempts share the one 15s deadline. When both hosts fail, the error names both hosts and why. The international site has no fallback. Tests (fallback.test.mjs): agent.minimaxi.com is played by a TLS server serving a leaf issued by an intermediate the client never saw (testdata/leaf.pem, generated for the test), so its fetch fails as the reporter's did; agent.minimax.cn by the fake. The usage card and the check-in claim go through the fallback; a 401, 404, 502, base_resp error and a 307 to another site are not sent to the fallback; both hosts failing names both; the global site doesn't fall back. Run: - mote (Bun 1.4.2): HOME=$(mktemp -d) bun test at the repo root: 5942 pass, 19 skip, 0 fail. bun scripts/check.mjs: registry.json and minimax ok. - xiaomi-gpu Windows 11 (win-run, Bun 1.4.2): fallback.test.mjs 9/9. - Broken by hand on mote: no fallback at all -> card, check-in and both-fail tests red; falling back on any non-ok status -> 401/404/502 red; falling back on OtherSite and on a body error -> redirect and business-error red. Not tried: no MiniMax China-site tokens here, so no real call to agent.minimax.cn's account API; that it answers the same is the reporter's check. The reporter's own Bun 1.4.4 was not run. |
||
|
|
d9a6c45c64 |
minimax: the China-site test reads 401 as a word, not inside the fake's port
region.test.mjs checked the account card's error with
not.toMatch(/refused|401/). The error names the fake's address,
127.0.0.1:<random port>, so any port with 401 in it (40199 on CI, the
publish run for
|
||
|
|
0ef2261681 |
minimax 0.2.2: the plan's windows and name from the console's own replies, within magpie's 20s (#705)
The usage card reads a plan's windows from the console's own token_plan/remains_percent (used and total per window, so a 150% week shows as "126 / 150 %"), with coding_plan/remains as the fallback (its share multiplied by weekly_boost_permille when that is over 1000). A general window at status 3 shows Unlimited; video windows show the console's counts. The plan is named by the console's current_subscribe_title, else by its tier: Plus, Max and Ultra as "Token Plan <tier>", the rest "M Plan <tier>". Time: magpie gives usage 20s. remains_percent and the title are asked together, each with a 5s timeout, and the fallback has 10s, so planQuota takes at most 15s, as 0.2.1 could. This answers the earlier review (30,030 ms with both console endpoints stalled). Review: both new paths are on the same host (site.platform) with the same bearer token and X-Group-Id coding_plan/remains already got; no new dependency or workflow change. 0.2.2 is free (main 0.2.1, npm 0.2.1, dist up to 0.2.1). Not mover-backed. Run at f383c5ea on mote (Bun 1.4.2): bun test packages/minimax 128 pass 0 fail; bun scripts/check.mjs exit 0. PR CI green. Broken by hand (usage.test.mjs): console timeout at 15s, or no timeout on remains_percent, turns the stall test red (15,001 ms); asking the title after the windows turns it red (10,006 ms); ignoring the console's used figure turns the two console-reply tests red. Not tried: MiniMax's real endpoints (no account here); the author ran one China-site account with a 150% week. |
||
|
|
1ed2f5544e |
minimax 0.2.1: a tool with no account named takes magpie's default account
0.2.0's tools took the first site key in plugin-auth.json's file order. magpie's host (accountsOf) takes the bare site id first, else the first site#... key by name. Once a removed sign-in is made again, the bare key sits last in the file, so a tool spent a different account from the one magpie uses by default. The tools now pick the same way the host does. Run on mote (sandbox HOME) at this tree: bun test in packages/minimax, 123 pass, 0 fail; bun scripts/check.mjs, minimax ok. Broken by hand: with file order back, the default-selection test goes red (1 fail). Not tried: a real MiniMax account. |
||
|
|
95f37f46fa |
minimax 0.2.0: MiniMax web search and Matrix media tools (#671)
Adds MiniMax Code's account tools to the minimax plugin, as a Magpie-only `exports["./server"]` entry (magpie.mjs): - `web_search`, MiniMax's own search, at /mavis/api/v1/mcp/web_search; - the Matrix connector tools: image, video, speech, music, media understanding, image search and enhancement, and asset URLs, plus `list_tools`, `tool_schema` and `call_tool` limited to connector__matrix__*. The schemas are bundled in matrix-tools.json, and each call is routed through the account's live catalog. - Tool requests reuse the chat sign-in's refresh logic per stored account key, and go through siteFetch: a cross-host redirect (Akamai's 307 to the other site) is an OtherSite hint and spends no refresh (#666). - With no `account` named, a tool uses the site's first stored account. An explicitly named account never falls back to another one. - No `web_fetch`: magpie's search MCP already serves one that refuses private addresses. - Tool descriptions don't name magpie (tested). - Version 0.2.0. The OpenCode entries still export only the two chat plugins. Run at the reviewed head e776afc, on mote (macOS, sandbox HOME): - `bun test` in packages/minimax: 123 pass, 0 fail, 12 files. - `bun scripts/check.mjs`: ok (minimax ✓). - Broken by hand: with `send` back on plain fetch, "tool redirects to another host stop before a 401 or token rotation" goes red (1 fail), and green again when restored. - The first review's probe (307 to another host, 401 there) spent 3 refreshes over 3 calls at 2467992. The new test covers the same case: 0 refreshes and 0 requests reaching the other host. - Checked against magpie's plugin host (internal/plugin/host.js): ./server is tried first, `directory` is magpie's config dir, and auth.set with a `minimax-code#…` id writes that key. Not tried: a real MiniMax account (search, generation, billing), and a real mainland-China network against the Global site. |
||
|
|
067f4503ce | minimax 0.1.9: MiniMax's redirect to its other site is named, and a site without the membership API shows its credits (#666) | ||
|
|
d119f4f789 |
minimax: a site without the membership API shows its credits and no plan (#666)
hetingyi's side note on #666: on agent.minimax.io both /matrix/api/v1/user/get_user_extra_info and /matrix/api/v1/commerce/get_membership_info answer 404 "404 page not found", even through a proxy. membership() fell back from the first to the second and threw the second's "membership: HTTP 404", so the international account's whole usage card was that error, its credits ledger never shown. Both answering 404 is now "no membership API here": no plan is said (not Free, which nothing read), and the card goes on with the credits ledger as before. Any other failure of either call is still the card's error, and a refused sign-in still throws. Run at this commit on mote: bun test packages/minimax 88 pass, 0 fail. The new usage test (the reporter's 404 body) is red against origin/main's index.mjs. Not tried: a real global account; whether such an account's M Plan lives elsewhere on the international site is unknown. |
||
|
|
0e072cdf09 |
minimax: a redirect to MiniMax's other site says so, not that the sign-in was refused (#666)
hetingyi (#666): from a mainland-China network, Akamai answers every agent.minimax.io request with 307 Location: https://agent.minimaxi.com/... (X-From: ak). fetch followed it, the China site turned the international token away, and MiniMax Code (Global) read as "account: the sign-in was refused (HTTP 401)" on the credits card and the check-in. The chat path was worse: its 401 forced a refresh (a refresh token spent) and sent the chat again, to the same redirect, on every request. - siteFetch: every request to a site's hosts (account API, check-in, credit ledger, M Plan, models, chats, OAuth device code, poll and refresh) goes with redirect "manual". A redirect on the same host is followed as fetch would (up to five; 301/302/303 turn a POST into a GET; a 307/308 resends only a string body). One to another host is an OtherSite error: "<what>: agent.minimax.io sent the request on to agent.minimaxi.com (HTTP 307), which doesn't take MiniMax Code (Global)'s sign-in. MiniMax does that for a network in mainland China; set a proxy outside mainland China for MiniMax Code (Global)." - It is never an AccountRefused: the card's sign-in stays "kept", the check-in's 401 retry isn't taken, and a chat answers 502 api_error with the message (X-Magpie-Sign-In kept), with no refresh and no second send. - The China site gets the same handling with a neutral hint, since nothing says which networks it sends elsewhere. - README: the international site needs a network outside mainland China. Run at this commit on mote: bun test packages/minimax 87 pass, 0 fail. region.test.mjs (the reporter's 307s: status, Location, X-From, an _abck cookie) against origin/main's index.mjs: the card, check-in, chat, models and refresh tests red; the same-host redirect test passes on both. Not tried: a real mainland-China egress or a real global account; the fixtures are the reporter's table. A proxy injected by magpie's plugin host passes init through (host.js spreads it), so redirect "manual" reaches Bun's fetch, checked by reading host.js only. |
||
|
|
17e5ef7457 |
all: load on OpenCode 2.x through a default {id, setup} (#657)
nbczw8750 (#657): trae 0.2.26 on OpenCode 2.2.5 fails with "Plugin must export a default definition with an id and an effect or setup function. (cause: SchemaError(Missing key at ["default"]))". 2.x imports a package's exports["."] (a plugin dir and an npm install alike) and has no V1 path at all, so every package here that serves models failed the same way, not only trae. Every one of the 32 model packages now has: - opencode2.mjs, exports["."]: a copy of scripts/opencode2.mjs, an adapter that runs the package's V1 plugins inside 2.x's promise API. Config providers become 2.x providers (package pinned so the aisdk sdk hook runs), V1 auth methods become integration methods (oauth auto/code with forms; api without authorize as a key method), V1 credentials are kept in metadata.v1, the loader's baseURL, apiKey, headers and fetch are applied through the sdk hook, an auth.set renewal is stored per credential, and credential.switched /updated reload the account's own model list. - opencode.mjs, main: re-exports the V1 plugin functions only. OpenCode 1.x and magpie's host.js take main. On 1.x, trae 0.2.26's main exported a non-plugin (_internal) and 1.19.5 refused it ("Plugin export is not a function"); the new main fixes that too. - both files in "files"; patch version bumped. devin already had 2.x and is unchanged. scripts/check.mjs fails a model package whose 2.x entry has no default {id, setup}, whose opencode2.mjs differs from the canonical one, whose entry is missing from files, or whose main exports a non-plugin. Run at this head (mote): - HOME=$(mktemp -d) bun test, as CI runs it: 4900 pass, 0 fail (4914 tests, 374 files). A first run set globalThis.fetch for the whole process from opencode2.test and failed 528 tests in other packages; the block is now set and put back around that file's tests. - bun scripts/check.mjs: every package passes. With the network blocked cloudflare-workers-ai fails on its fetched catalog, the same on origin/main. - Real OpenCode 2.2.5 (npm opencode-ai), sandbox HOME, packed trae 0.2.27: loads with no error; /api/integration lists trae-cn "Trae CN" and trae-global "Trae Global" with their browser sign-ins; `auth login` starts the trae.cn authorization and waits (cancelled there); with a fake credential POSTed to /api/credential, `opencode models` lists trae-cn's six models. - Real 2.2.5 with a fake V1 key plugin through the same adapter against a local fake server: `auth login` with a key, `models`, `opencode run` reached /real/v1/chat/completions with the loader's "Bearer loader-sk-fake" and header, and printed the fake's reply; with @ai-sdk/anthropic it reached /real/v1/messages with x-api-key from the loader. This run found the key method missing after 2.x's second integration transform (a once-only flag outside the transform); fixed, and opencode2.test checks a rebuild. - Real OpenCode 1.19.5, sandbox HOME, trae 0.2.27: `opencode models` lists trae-cn and trae-global models; 0.2.26 failed there. Broken by hand (scratch copy, bun test scripts/ and check.mjs): - trae's exports back to "./index.mjs": the trae 2.x test fails (default.id undefined), check fails trae with "OpenCode 2.x: ./index.mjs has no default {id, setup} (plugins#657)". - zed's opencode2.mjs changed: the copies test fails, check fails zed "differs from scripts/opencode2.mjs". - the key flag back outside the transform: the 1.x plugin test fails on the rebuilt sign-ins (key missing). Not tried: a real sign-in with a real account on 2.x; Windows (the reporter's OS); chat.headers, chat.params, usage and tool hooks, which the adapter doesn't carry to 2.x; the tools/pages packages (calc, goanyapi, layerfs, search1api, aelios, agent-console, chat, fingerprint, nowledge-mem, kimi-desktop), which still load only on 1.x. |
||
|
|
0ea458b4a5 |
minimax 0.1.7: device sign-in polling asks again after a transient failure (#382)
Releases #382 (
|
||
|
|
e228f291bc |
minimax: device sign-in polling asks again after a transient failure (#382)
MiniMax's device sign-in no longer ends on a connection reset, a non-JSON HTTP 400, a 408/429/5xx, or a body read that fails while polling. It asks again with the same device code and verifier, up to three times in a row and within the code's deadline. A pending answer resets the count. Denied, expired and bad-client answers still stop at once, and refresh stays single-attempt.
Run at 4b17063, merged onto main
|
||
|
|
07e643018e |
minimax 0.1.6: the credits show how much of them is used, from MiniMax's credit details (#393)
moxuanchen's card showed MiniMax's credits as a bare balance ("1200
credits"), with no share or bar. The membership answer has only what is
left. MiniMax's own web client (agent.minimaxi.com, prod-web-sh-0.1.230)
lists every batch in Settings → Usage → Credit details (积分明细): GET
/minimax-cloud/api/v1/credit/details with page_number, page_size 20 and
include_expired, answering { details, total_count }; each batch has
credit_type 1 purchased / 2 check-in, granted/consumed/remaining_amount as
decimal strings (commas allowed, a remaining below 0 read as 0) and
expire_at_ms. That is the reporter's endpoint, checked in the client's
own bundle (the npm CLI @minimax-ai/code 0.6.12 doesn't have it).
usage now reads every page of it (signed, to the account host, as the
check-in's minimax-cloud calls go) and adds a Credits window of the
batches not yet expired: used = granted - remaining, amount/limit/unit
"credits", and runsOutAt/runsOut for the soonest batch with credits left.
Beside an M Plan it is aside. A ledger that can't be read whole (an error,
a list shorter than total_count, an amount that isn't one) adds no window
and leaves the balance as before: a part of it would tell a wrong share.
Run: bun test in packages/minimax (nonet, fake hosts): 62 pass 0 fail. On
the old index.mjs the three new tests fail. bun scripts/check.mjs:
minimax ok.
Not tried: a real MiniMax account (no vendor credentials used), so
whether the account host answers this path signed as the check-in is
signed is not seen; if it refuses, the card is as it was.
|
||
|
|
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 ( |
||
|
|
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
|
||
|
|
15d536a3d0 |
minimax 0.1.3: the M3 family's real context and output limits (#250)
MiniMax Code's model list says 512K context / 128K output for MiniMax-M3, M3.1-Flash and M3.1-Flash-Preview (confirmed: GET /mavis/api/v1/models on agent.minimax.io and agent.minimax.cn answers that with no token). The author measured 1,048,576 input / 524,288 output on a live account on both sites. VERIFIED_LIMITS gives those three ids the measured pair in both the built-in list and the live list; M2.7 keeps what the list says. minimax 0.1.3. Run at head 20662230ca45eca72dab2d77f28631ef6e670718 (review, 10-22): - packages/minimax, sandbox HOME: 51 pass, 0 fail. - The two new/changed tests with origin/main's index.mjs: 2 fail (red without the change). - Head merged onto origin/main: full bun test 2076 pass, 0 fail; bun scripts/check.mjs ok. - Diff read in full: no new hosts, headers or credential handling. Not tried: the live limits were not re-measured here (no real account used). The output cap matches models.dev's minimax-cn entry (524,288). Whether input + max_tokens is checked against the window was not measured; any request that fit under the old 512K/128K still fits. The override wins over the live list, so a later vendor change to these ids needs a plugin release. |
||
|
|
fc9cf6a7b0 |
minimax 0.1.2: claim the account's daily check-in (签到) (#140)
minimax 0.1.2 adds an `auth.checkin` hook for MiniMax Code's daily check-in (每日签到).
- It reads the panel at `/minimax-cloud/api/v1/signin/status` and claims the day at `/signin/claim`.
- Both requests are signed by the package's own `accountCall()`: the same headers, query and x-signature as the rest of the account API, and a `{}` body on the claim.
- On the China site they go to `agent.minimax.cn` (`site.llm`), the host magpie's built-in check-in uses.
- Failed reads come back as `failed`: a non-2xx reply, no panel, or a malformed panel (not 7 days numbered 1-7, or more than one today or claimable day).
- With no day marked today it returns `inactive`, and nothing is claimed.
- The streak counts back from today's index. 401 and 403 are `failed` with the HTTP status.
- The README says the check-in is opt-in. OpenCode ignores the hook.
Run at d21543b76cf0fa19b6e345e6b2d2f0d29976ee93, merged locally onto origin/main
|
||
|
|
01acd0951c |
minimax 0.1.1: a refresh token is never sent twice, and magpie renews the sign-in ahead of time through auth.refresh (ARNO on Discord: minimax插件的登录状态容易掉登陆,几个小时就提示要重新登陆了)
MiniMax spends a refresh token once: sent again it is invalid_grant, which signs the account out (MiniMax Code takes a lock across its processes and keeps a generation for it). The plugin's refresh request is MiniMax Code's own, so what drops the account is a refresh token spent a second time: - auth.refresh + refreshLead (10 minutes): magpie renews the account once, before its requests, models and usage ask for it. The 2-minute check before each request stays for OpenCode. - A refresh whose save failed kept its tokens a minute, then went back to the spent refresh token on disk. They are kept now until saved, and latest() follows them. - invalid_grant when the store holds a newer refresh token than the one spent (another magpie process renewed it) uses that one, not a sign-out. - A 401 retries with a newer saved token when there is one, and refreshes only when the token turned away is still the newest. Five tests in refresh.test.mjs, all failing on 0.1.0. HOME=$(mktemp -d) bun test: 353 pass. |
||
|
|
8f25b63718 |
publish from GitHub Actions with npm's trusted publishing, no one-time password [skip ci]
.github/workflows/publish.yml runs the tests (in a throwaway HOME) and scripts/publish.sh on each package.json change pushed to main, or by hand; npm's OIDC exchange stands in for a token and an OTP. Every package now names magpie-community/plugins' publish.yml as its trusted publisher on npmjs.com, and gets the repository field npm checks it against. |
||
|
|
7c859cc532 |
minimax 0.1.0: MiniMax Code (mcode) accounts' credits and M Plan, China (minimax-code) and international (minimax-code-global), with MiniMax Code's own device sign-in (Magic_zero on Discord)
A new package, @magpie-community/opencode-minimax-auth, written from MiniMax Code 0.6.2's bundle. Sign-in: MiniMax Code's OAuth device flow, the same one mcode uses (account.minimax.cn / account.minimax.io, client mcode-public, scope agent.default, audience agent-backend, PKCE S256). It also handles MiniMax's own variant, where there is no device_code, the user_code is polled for, and expired_in may be an at-ms. The account is named from MiniMax's signed /v1/api/user/info. mcode's ~/.minimax sign-in is never read or written. Each account is a sign-in of its own, so magpie can hold several. Refresh: two minutes before the token ends, or once on a 401. One refresh runs per account (keyed by the refresh token it spends), and its result answers for the old token for a minute, so a late reader doesn't spend a rotated token twice. Only invalid_grant with HTTP 400 signs the account out (signIn: expired); any other failure keeps it and uses the token in hand while it lasts. Chats: Anthropic messages at <agent>/mavis/api/v1/llm/v1/messages, carrying: - Authorization: Bearer <token> - x-api-key sk-xxx (mcode's placeholder) - User-Agent MiniMaxAgent - X-Mavis-Agent-Id main - X-Mavis-Timezone-Offset - X-Mavis-Session-Id, from chat.headers' sessionID (otherwise a fixed id per run) A 402, 403 or 429 whose body says credits or quota ran out goes on as a 429 "usage limit reached". Models: the live config at GET /mavis/api/v1/models?region=&buildEnv=prod (asked again without auth on a 401/403), with mcode's built-in four as the fallback: MiniMax-M3.1-Flash-Preview, MiniMax-M3, MiniMax-M2.7 and MiniMax-M2.7-highspeed. Variants follow what mcode sends: adaptive thinking at an effort (output_config.effort), and none to turn thinking off. Usage: mcode's signed account API: user info, the type-0 workspace from get_user_extra_info, then get_membership_info. The card shows credits left (op_credit_summary / opcredit_balance), Free or "M Plan <tier>" with its end, and, for an M Plan, coding_plan/remains with X-Group-Id. That is read as magpie's readMiniMaxPlan reads it. There is no check-in. Tests: fakes only. nonet.mjs is imported first, so only 127.0.0.1 can be reached. They cover: - sign-in, the variant, refused, and other errors - refresh, a three-way race plus a late stale reader, per-account refreshes, invalid_grant, other failures, and 401 then refresh then retry - request headers and chat.headers - credits running out going on as a 429 - the live list, the retry without auth, and the fallback (the given object back) - signing, against fixed vectors and the bundle's formula - usage parsing (readMiniMaxPlan's own fixture), Free, M Plan, and a refused account bun test packages/minimax (27 pass) and bun scripts/check.mjs pass. End to end through magpie: origin/main b0486663, built with -tags nogui in a worktree since removed, under env -i with a sandbox HOME, a fake upstream on 127.0.0.1:47811, and a copy of the package with its hosts pointed there: - plugin add - plugin login minimax-code: the device flow and the account named; a second login of the same account merged into one - the live list: 2 models - provider test minimax-code: the chat went out with the headers above - quota: M Plan Plus, 321.5 credits, 5 hours and 7 days windows - an expired token refreshed and saved No request was made to MiniMax. |