Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The MiniMax Code Agent communicates through the host MCP client. Business reques

| MiniApp | What it does | Author |
| --- | --- | --- |
| [蹬王之王 / Expiry Sentinel](plugins/hylouis233/expiry-sentinel/) | Track MiniMax Code credit and reset card expiry, then automatically spend whichever lapses first | [hylouis233](https://github.com/hylouis233) |
| [Token Usage Board](plugins/amszuidas/mcode-token-usage-board/) | Explore local Token usage by date, model, and session, including input, output, and cache usage | [amszuidas](https://github.com/amszuidas) |
| [Token Usage Board](plugins/yanhy2000/mcode-usage-monitor/) | Watch local Token usage, output speed, and cache hit rate in near real time; filter by time range, model, and session | [yanhy2000](https://github.com/yanhy2000) |
| [Model Manager](plugins/ocoomber/openrouter-model-manager/) | Browse, search, and enable/disable models in your `~/.minimax/config.yaml` with instant save, bulk actions, one-click undo, and automatic backups | [ocoomber](https://github.com/ocoomber) |
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ MiniMax Code Agent 通过宿主 MCP 客户端与 MiniApp 协作。业务请求

| MiniApp | 功能 | 作者 |
| --- | --- | --- |
| [蹬王之王](plugins/hylouis233/expiry-sentinel/README.zh-CN.md) | 追踪 MiniMax Code 积分与重置卡的到期时间,自动按「先过期先用」消耗 | [hylouis233](https://github.com/hylouis233) |
| [Token 用量看板](plugins/amszuidas/mcode-token-usage-board/README.zh-CN.md) | 按时间、模型和会话查看本机 Token 用量,包含输入、输出和缓存用量 | [amszuidas](https://github.com/amszuidas) |
| [Token 用量看板](plugins/yanhy2000/mcode-usage-monitor/README.zh-CN.md) | 近实时查看本机 Token 用量、输出速度与缓存命中率,可按时间范围、模型和会话筛选 | [yanhy2000](https://github.com/yanhy2000) |
| [模型管理器](plugins/ocoomber/openrouter-model-manager/README.zh-CN.md) | 浏览、搜索并启用/停用 `~/.minimax/config.yaml` 中的模型,支持即时保存、批量操作、一键撤销和自动备份 | [ocoomber](https://github.com/ocoomber) |
Expand Down
18 changes: 18 additions & 0 deletions plugins/hylouis233/expiry-sentinel/.minimax-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"schemaVersion": 1,
"name": "expiry-sentinel",
"displayName": "蹬王之王",
"version": "1.0.0",
"description": "实时追踪 MiniMax Code 积分与重置卡的到期时间,自动按「先过期先用」决定用卡还是留积分,榨干最后一点算力。",
"author": "hylouis233",
"icon": "icon.png",
"category": "Productivity",
"exampleQueries": [
"打开蹬王之王",
"看看我的积分和重置卡什么时候过期",
"我的额度快用完了,该用重置卡还是留着?"
],
"apps": [],
"mcpServers": [],
"skills": []
}
21 changes: 21 additions & 0 deletions plugins/hylouis233/expiry-sentinel/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Hylouis233

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
147 changes: 147 additions & 0 deletions plugins/hylouis233/expiry-sentinel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<div align="center">

<img src="icon.png" alt="蹬王之王" width="120" />

# 蹬王之王 · Expiry Sentinel

**Track what expires first, then spend exactly that.**

English | [简体中文](README.zh-CN.md)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

</div>

---

MiniMax Code credits and reset cards both expire on a timer. Left alone, the
shortest-dated balance quietly evaporates while you keep using the one that
lasts longest. **蹬王之王** shows every balance with its expiry date, then spends
whichever runs out first — so nothing is wasted and nothing expires unused.

## Screenshot

<div align="center">
<img src="docs/preview.png" alt="Dashboard: expiry alerts, quota, credit and card expiry" width="820" />
</div>

The header answers the only question that matters: *how much is about to expire?*
Below it, the 5-hour quota, total credit balance, the next expiry, and how many
reset cards are left.

<div align="center">
<img src="docs/preview-cards.png" alt="Reset card expiry list and usage tally" width="820" />
</div>

Credit detail, reset cards by expiry, and platform credit pools each get their own
table, sorted by the date they lapse.

> **Note on the screenshots.** They were captured from a real account, so the
> balances, dates, and totals in them are genuine numbers rather than samples.
> No card IDs are shown anywhere in the UI.

## How the decision works

When the 5-hour or weekly quota runs out, requests start spending credits. That is
the moment to act, and the app compares two dates:

| Situation | Decision | Why |
| --- | --- | --- |
| Reset card expires **before** the oldest credit | **Spend the card** | Restores the quota, so the longer-lived credit is preserved |
| Credit expires **before** the card | **Keep the card** | Let the credit lapse first; the card still has value later |
| Quota not exhausted | **Do nothing** | No credits are being burned yet |

Both the Node service and the background daemon implement this rule, and a
parity test compares them character by character so the two cannot drift apart.

## Install

Copy this entire directory — including the hidden `.minimax-plugin` directory —
into your MiniMax Code data directory. By default that is `.minimax` in your home
folder, so the default path is:

```text
<dataDir>/plugins/expiry-sentinel/
```

If you configured a different data directory, use that instead. Restart MiniMax
Code, confirm the plugin is recognized and enabled, then open **蹬王之王**, or ask
the Agent to open it.

## Use it

**Watch only (default).** Open the board and read it. Nothing is spent.

**Auto-spend inside the page.** Turn on 自动执行 and pick an interval (seconds or
minutes). The page decides and spends on that interval while it stays open.
「立即判定一次」 always triggers one check immediately, with no throttle.

**Auto-spend around the clock.** Turn on 后台服务. This installs a launchd agent
that keeps running with the page closed, and starts at login on macOS. The page
shows its PID and lets you stop it.

Both paths share one decision rule, and the server deduplicates by idempotency
key, so a card is never spent twice even if both are active.

## Background daemon (optional)

The `daemon/` directory contains a Rust rewrite of the same decision logic,
built for low overhead while it runs unattended:

```bash
cd daemon
cargo build --release
```

It needs a token. It obtains one through the desktop app's OAuth lease socket
(`~/.minimax/run/mcode-auth-lease-v1.sock`), so it must run while MiniMax Code is
running. Set `MCODE_TOKEN` to use a fixed token instead.

Typical resident memory is under 1 MB, and it polls one endpoint per cycle and
caches the rest by how often each changes.

## Tested environment

- MiniMax Code desktop app on macOS (Apple Silicon)
- Verified against a live account: quota polling, credit detail, card listing,
card spending, and the auto-spend path that fired on quota exhaustion
- Cross-platform behaviour and other client versions are **unconfirmed** — the
daemon path uses launchd and has only been exercised on macOS
- The endpoints are private APIs. They may change without notice, and the app
will report a parse or read error rather than invent data when they do

## Data & access

**Files read.** The desktop app's OAuth lease capability file
(`~/.minimax/run/mcode-auth-lease-v1.cap`) and the lease socket beside it, to
obtain the same session the desktop app uses. These paths are an internal
implementation detail of the client, not a documented interface; the background
daemon will stop working if they change.

**Files written.**

- `~/.config/mcode-reset-card/token` — only when you provide `MCODE_TOKEN`
- `~/.config/mcode-reset-card/bg-state.json` — the daemon's record of which cards
it already attempted, so a restart cannot spend the same card twice
- `~/Library/LaunchAgents/com.local.mcode-reset-card.plist` — written only when you
enable 后台服务

**Network hosts.** Two, both MiniMax:

- `https://www.minimaxi.com` — quota, platform credit pools, reset cards
- `https://agent.minimaxi.com` — MiniMax Code credit detail, membership summary

**Processes spawned.** `launchctl load` / `unload` for the background service,
and `launchctl list` to read its status. Nothing else.

**Agent turns.** None. The app never invokes the Agent.

**Secrets.** The session token lives only in the Node process and the daemon.
It is never placed in HTML, client JavaScript, logs, or API responses.

**Spending is a real write.** Enabling auto-spend spends real reset cards on your
account. Start with the dashboard in watch-only mode.

## License

MIT — see [LICENSE](LICENSE).
128 changes: 128 additions & 0 deletions plugins/hylouis233/expiry-sentinel/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<div align="center">

<img src="icon.png" alt="蹬王之王" width="120" />

# 蹬王之王 · Expiry Sentinel

**看清谁先过期,就先用哪一个。**

[English](README.md) | 简体中文

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

</div>

---

MiniMax Code 的积分和重置卡都会到期。放着不管,最快到期的那笔会悄悄作废,
而你一直在用最耐放的那笔。**蹬王之王**把每笔余额和到期日摊开给你看,然后
「先过期先用」——不浪费,也不过期。

## 界面

<div align="center">
<img src="docs/preview.png" alt="看板:到期预警、额度、积分与重置卡到期" width="820" />
</div>

顶部只回答一个最要紧的问题:**有多少快要过期了**。下面是 5 小时限额、积分总余额、
最早到期日和剩余重置卡数量。

<div align="center">
<img src="docs/preview-cards.png" alt="重置卡到期列表与已用统计" width="820" />
</div>

积分明细、重置卡、平台积分池各一张表,全部按到期日排序。

> **关于截图**:截图取自真实账号,因此其中的余额、日期与合计都是真实数据,
> 并非示意样例。界面任何位置都不展示卡号。

## 决策规则

5 小时或周限额耗尽时,请求开始扣积分——这就是该动手的时刻。应用会比两个日期:

| 情况 | 决策 | 原因 |
| --- | --- | --- |
| 重置卡比最早到期的积分**更早**过期 | **用卡** | 重置额度,保住更耐放的积分 |
| 积分比重置卡**更早**过期 | **留卡** | 让积分先消耗掉,卡留到以后更有价值 |
| 额度未耗尽 | **不动** | 还没在烧积分 |

Node 服务和后台守护进程实现同一套规则,并有逐字比对的一致性校验,防止两边漂移。

## 安装

把整个目录(含隐藏的 `.minimax-plugin` 目录)复制到 MiniMax Code 的数据目录。
默认为用户目录下的 `.minimax`,即:

```text
<dataDir>/plugins/expiry-sentinel/
```

如果你配置了其他数据目录,请用那个目录。重启 MiniMax Code,确认插件已被识别并启用,
然后打开 **蹬王之王**,也可以直接让 Agent 帮你打开。

## 使用

**只看不动(默认)。** 打开看板读数据,不消耗任何东西。

**页面内自动执行。** 打开「自动执行」并设置间隔(秒或分钟)。页面开着时按间隔
判定并执行。「立即判定一次」可随时手动触发,无节流。

**全天候后台执行。** 打开「后台服务」。它会安装一个 launchd 代理,关掉页面也在跑,
macOS 上开机自启。页面上能看到它的 PID,也可以随时停掉。

两条路径共用同一套决策规则,服务端按幂等键去重——即使同时开着,卡也不会被扣两次。

## 后台守护进程(可选)

`daemon/` 里是同一套决策逻辑的 Rust 版本,为长时间无人值守而写:

```bash
cd daemon
cargo build --release
```

它需要 token:通过桌面端的 OAuth lease socket
(`~/.minimax/run/mcode-auth-lease-v1.sock`)获取,也就是说 MiniMax Code 需要在运行。
也可以设置 `MCODE_TOKEN` 使用固定凭据。

实测常驻内存不到 1 MB,每轮只请求一个接口,其余按各自变化频率缓存。

## 测试环境

- macOS(Apple Silicon)上的 MiniMax Code 桌面端
- 已在真实账号验证:额度轮询、积分明细、卡列表、扣卡,以及额度耗尽时触发的自动执行
- **未验证**:跨平台表现与其他客户端版本——守护进程走 launchd,目前只在 macOS 上跑过
- 所用接口是私有接口,可能随时变化;接口变化时应用会如实报错,不会编造数据

## 数据与访问

**读取的文件。** 桌面端的 OAuth lease capability 文件
(`~/.minimax/run/mcode-auth-lease-v1.cap`)及其同目录的 lease socket,
用于获取与桌面端相同的登录态。这些路径是客户端内部实现细节,并非公开接口;
一旦变化,后台守护进程会失效。

**写入的文件。**

- `~/.config/mcode-reset-card/token` —— 仅当你提供 `MCODE_TOKEN` 时
- `~/.config/mcode-reset-card/bg-state.json` —— 守护进程记录已尝试过的卡,
避免重启后重复扣同一张
- `~/Library/LaunchAgents/com.local.mcode-reset-card.plist` —— 仅在启用「后台服务」时写入

**网络地址。** 两个,均为 MiniMax:

- `https://www.minimaxi.com` —— 额度、平台积分池、重置卡
- `https://agent.minimaxi.com` —— MiniMax Code 积分明细、会员汇总

**启动的进程。** 仅 `launchctl load` / `unload`(后台服务)与 `launchctl list`(读状态)。

**Agent 调用。** 无。本应用从不调用 Agent。

**凭据。** 会话 token 只存在于 Node 进程和守护进程内存中,绝不进入 HTML、
客户端 JavaScript、日志或 API 响应。

**扣卡是真实写操作。** 开启自动执行会在你的账号上真实消耗重置卡。
建议先用只读模式熟悉一下。

## 许可证

MIT —— 见 [LICENSE](LICENSE)。
Loading
Loading