返回目录
安全与治理 插件

dsh-minimax-auth

borncode-app/dsh-minimax-auth

The MiniMax Code OAuth grant reader and refresher shared by dsh-minimax-credit and dsh-minimax-checkin.

Stars
0
Forks
0
Issues
0
更新
9 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:borncode-app/dsh-minimax-auth

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

This repository has moved into one monorepo.

The whole MiniMax set — the credit proxy, the daily check-in, the model-list sync, the composer quota chip, the MiniMax Code bridge, and the shared grant reader — now lives in borncode-app/dsh-minimax-kit, one repository with one Plugins entry.

this repo new home
dsh-minimax-auth packages/dsh-minimax-auth
dsh-minimax-credit packages/dsh-minimax-credit
dsh-minimax-checkin packages/dsh-minimax-checkin
dsh-minimax-model-sync packages/dsh-minimax-model-sync
dsh-minimax-bridge packages/dsh-minimax-bridge
dsh-model-quota packages/dsh-model-quota

The code and its history are unchanged; only the repository is shared. Install dsh-minimax-kit instead of the individual bundles. This repository stays open so the old links keep working.

dsh-minimax-auth

The MiniMax Code OAuth grant reader and refresher, shared by dsh-minimax-credit and dsh-minimax-checkin.

Not a bundle: it declares no dsh.bundle.patch and inserts no Loader row. It is a plain library the two plugins import.

Why it exists

Both plugins borrow the same grant MiniMax Code wrote under ~/.minimax/auth/<buildEnv>/<region>/mcode-public/auth.json, and both refresh it in place. While each carried its own copy, two implementations wrote that one file: a refresh in one plugin could rotate the refresh token the other was about to use, and the second refresh then failed with invalid_grant even though the machine was still signed in.

One implementation, one code path, one place to fix.

API

export what it does
MinimaxCodeAuth reads the grant, refreshes it under MiniMax Code's own auth.lock, exposes token(), peekToken(), status(), paths()
AuthError the default error class, used when a caller passes no ErrorClass
AUTH_MESSAGES the user-facing wording, so both plugins say the same thing
numberOf, readConfig small config helpers both plugins also use
oauthAccountOrigin account.minimax.cn or account.minimax.io for a region
withAuthLock, writePrivateFile the lock and private-write primitives, exported for callers with their own store

A plugin keeps its own error class and code prefix:

import { MinimaxCodeAuth } from '@local/dsh-minimax-auth'

export class WidgetUnavailableError extends Error { /* … */ }

class WidgetAuth extends MinimaxCodeAuth {
  constructor(options) {
    super({ ...options, ErrorClass: WidgetUnavailableError, codePrefix: 'MINIMAX_WIDGET_' })
  }
}

token({ force: true }) refreshes even when the stored token still looks valid; that is what a caller does after the API answers 401 for it.

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类安全与治理
规则置信度高

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: auth。