Files
plugins/packages/minimax/package.json
T
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

13 lines
623 B
JSON

{
"name": "@magpie-community/opencode-minimax-auth",
"version": "0.1.5",
"description": "OpenCode provider plugins for MiniMax Code accounts: their credits and M Plan, China (minimax-code) and international (minimax-code-global), with MiniMax Code's own device sign-in",
"type": "module",
"main": "./index.mjs",
"exports": "./index.mjs",
"files": ["index.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "minimax", "mcode", "minimax-code"],
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/minimax" }
}