Skip to content

Releases: HaneWari/mcode-token-meter

Token 仪表盘 v1.10.0 —— 删会话后看板数据不再永久丢失

Choose a tag to compare

@HaneWari HaneWari released this 24 Oct 13:17

Token 仪表盘 v1.10.0

修一个真问题:删掉会话后,看板的数据会永久消失。

客户端里删除会话是硬删除。宿主自己的实现(SessionArtifactService.deleteSession)一次做掉这些事:

() => this.owners.usage.deleteSession(sessionId)      // DELETE FROM local_runtime_token_usage WHERE session_id = ?
() => this.owners.messages.deleteSessionData(sessionId)
() => this.deleteLegacyHistory(sessionId)
() => this.owners.canonicalHistory.delete(sessionId)  // transcript 目录

连会话记录文件(transcript)也一起删。所以删完之后没有任何只读数据源能把它找回来——看板上的调用数、token 总量、逐次台账、对话明细会跟着一起消失,从此对不上实际使用情况。

这一版怎么解决

看板在自己的一份本地归档里保存它算出来的每一次调用,位置在宿主为插件提供的可写目录:

<dataDir>/v2/plugin-data/liveboards/token-meter-board/archive.sqlite
  • 运行时数据库、观测日志、config.yaml 仍然只读,一个字节都不写
  • 归档用的是看板同一条计算路径,不是第二套实现——所以补回来的模型名、decode 计时、状态码和当初显示的一模一样
  • 合并以运行时自带的用量行 id 为主键去重,活会话永远不会被重复计数
  • 运行时已经不拥有的会话会从归档补回,并在会话排行里标一个 「已删除」 徽标;顶栏会告诉你本次窗口有多少次调用来自归档
  • 归档写不进去时(目录只读等),看板照常工作,只是被删会话补不回来

实测

用 VACUUM INTO 把运行时库快照成副本,在副本上按宿主的方式删掉一个会话(2,107 条用量行 + 2,240 条消息行 + 会话行):

指标 删除前 删除后
窗口调用总数 13,759 13,759
窗口 token 总数 2,223,875,834 2,223,875,834
被删会话的调用数 2,107 2,107
被删会话的 token 457,805,553 457,805,553
被删会话的标题 「token-meter」 保留
被删会话的对话明细 23 轮 23 轮,含用户原文预览

9/9 断言全部通过。

性能:归档对端点延迟的影响在 ±3 ms 噪声内(各端点连续 5 次取中位数,归档开 vs 关)。首次同步会做一次全量归档(13,775 次调用 + 98 个观测日志文件),冷启动首请求 1,345 ms;此后每次进程启动 57 ms。归档文件 4.20 MiB。

安装(三选一)

  1. 下载下面的 ZIP,解压后把目录(或直接把 ZIP)交给 MiniMax Code 的 Agent,让它按成品包流程发布。
  2. 手动复制:把整个插件目录(含隐藏的 .minimax-plugin)复制到 <dataDir>/plugins/token-meter-board/,默认即 ~/.minimax/plugins/token-meter-board/。不要多留一层目录。
  3. 直接克隆:git clone https://github.com/HaneWari/mcode-token-meter.git ~/.minimax/plugins/token-meter-board

装完重启 MiniMax Code,确认插件已启用,然后打开 Token 仪表盘。

桌面端的「从 GitHub 导入插件」入口不支持 Mini App 包,必须手动安装。

请先了解

  • 这是非官方的社区项目,未经 MiniMax 制作、审核或认可。
  • 本版本读的是客户端的内部存储(运行时 SQLite 数据库、观测日志、config.yaml)。这些路径与表结构不是公开 API,客户端更新可能使其失效。
  • 它另外会写出一个属于它自己的文件(上面那个本地归档)。除它之外不落任何数据,不出网,无遥测。
  • 需要 Node.js ≥ 23.4(node:sqlite)。

详细说明见 README(中文),验证记录见 docs/validation.md。


Token Meter Board v1.10.0

Fixes a real problem: deleting a conversation made the dashboard's data disappear for good.

Deleting a session in MiniMax Code is a hard delete. The Host's own implementation (SessionArtifactService.deleteSession) does this in one go:

() => this.owners.usage.deleteSession(sessionId)      // DELETE FROM local_runtime_token_usage WHERE session_id = ?
() => this.owners.messages.deleteSessionData(sessionId)
() => this.deleteLegacyHistory(sessionId)
() => this.owners.canonicalHistory.delete(sessionId)  // the transcript directory

The transcript goes with it, so afterwards nothing read-only can bring it back — the call count, the token totals, the per-call ledger and the conversation table all vanished with it, and the board no longer matched reality.

What this release does

The board keeps its own local archive of every call it has computed, inside the writable directory the Host provides for the plugin:

<dataDir>/v2/plugin-data/liveboards/token-meter-board/archive.sqlite
  • The runtime database, the observability logs and config.yaml are still read-only — not one byte is written to them
  • The archive is the output of the board's own computation path, not a second implementation, so the model, the decode timing and the HTTP status come back exactly as they were displayed
  • Rows are merged back keyed on the runtime's own usage-row id, so a live session can never be counted twice
  • Sessions the runtime no longer lists are served from the archive and marked 已删除; the header says how many of the window's calls came from the archive
  • If the archive cannot be written, the board still works — deleted sessions just cannot be restored

Measured

Snapshot the runtime database with VACUUM INTO, delete one session from the copy the way the Host does (2,107 usage rows + 2,240 message rows + the session row):

before after
calls in the window 13,759 13,759
tokens in the window 2,223,875,834 2,223,875,834
the deleted session's calls 2,107 2,107
the deleted session's tokens 457,805,553 457,805,553
its title "token-meter" kept
its conversation rows 23 turns 23 turns, with the message previews

9/9 assertions passed.

Performance: the archive moves endpoint latency by ±3 ms (median of 5, archive on vs off). The first sync archives the whole history (13,775 calls + 98 observability log files), so the first request after a cold start takes 1,345 ms; every later process start is 57 ms. The archive is 4.20 MiB.

Install (pick one)

  1. Download the ZIP below, unpack it, and give the folder (or the ZIP itself) to your MiniMax Code Agent to publish as a finished package.
  2. Copy it manually: copy the whole plugin directory (including the hidden .minimax-plugin folder) into <dataDir>/plugins/token-meter-board/ — by default ~/.minimax/plugins/token-meter-board/. Do not add an extra folder level.
  3. Clone it: git clone https://github.com/HaneWari/mcode-token-meter.git ~/.minimax/plugins/token-meter-board

Restart MiniMax Code afterwards, confirm the plugin is enabled, then open Token 仪表盘.

The desktop client's "import plugin from GitHub" flow does not support Mini App packages — manual install is required.

Before you install

  • This is an unofficial community project. It is not built, reviewed, or endorsed by MiniMax.
  • This build reads your client's internal storage (the runtime SQLite database, the observability logs, config.yaml). Those paths and their layout are not a public API and may break on a client update.
  • It also writes one file of its own — the local archive above. Beyond that: no writes, no network, no telemetry.
  • Requires Node.js ≥ 23.4 (node:sqlite).

See the README and the validation record.

Token 仪表盘 / Token Meter Board v1.9.0

Choose a tag to compare

@HaneWari HaneWari released this 24 Oct 09:09

Token 仪表盘 v1.9.0

本机 MiniMax Code 的实时 token 用量看板。看用量趋势、逐次调用台账、每轮对话明细、缓存命中率与输出速率。

安装(三选一)

  1. 下载下面的 ZIP,解压后把目录(或直接把 ZIP)交给 MiniMax Code 的 Agent,让它按成品包流程发布。
  2. 手动复制:把整个插件目录(含隐藏的 .minimax-plugin)复制到 <dataDir>/plugins/token-meter-board/,默认即 ~/.minimax/plugins/token-meter-board/。不要多留一层目录。
  3. 直接克隆:git clone https://github.com/HaneWari/mcode-token-meter.git ~/.minimax/plugins/token-meter-board

装完重启 MiniMax Code,确认插件已启用,然后打开 Token 仪表盘。

桌面端的「从 GitHub 导入插件」入口不支持 Mini App 包,必须手动安装。

请先了解

  • 这是非官方的社区项目,未经 MiniMax 制作、审核或认可。
  • 本版本读的是客户端的内部存储(运行时 SQLite 数据库、观测日志、config.yaml)。这些路径与表结构不是公开 API,客户端更新可能使其失效。
  • 严格只读:不写文件、不出网、无遥测。页面上的内容全部来自本机。
  • 需要 Node.js ≥ 23.4(node:sqlite)。

详细说明见 README(中文)。


Token Meter Board v1.9.0

A near-real-time token-usage dashboard for MiniMax Code, running entirely on your own machine.

Install (pick one)

  1. Download the ZIP below, unpack it, and give the folder (or the ZIP itself) to your MiniMax Code Agent to publish as a finished package.
  2. Copy it manually: copy the whole plugin directory (including the hidden .minimax-plugin folder) into <dataDir>/plugins/token-meter-board/ — by default ~/.minimax/plugins/token-meter-board/. Do not add an extra folder level.
  3. Clone it: git clone https://github.com/HaneWari/mcode-token-meter.git ~/.minimax/plugins/token-meter-board

Restart MiniMax Code afterwards, confirm the plugin is enabled, then open Token 仪表盘.

The desktop client's "import plugin from GitHub" flow does not support Mini App packages — manual install is required.

Before you install

  • This is an unofficial community project. It is not built, reviewed, or endorsed by MiniMax.
  • This build reads your client's internal storage (the runtime SQLite database, the observability logs, config.yaml). Those paths and their layout are not a public API and may break on a client update.
  • Strictly read-only: no writes, no network, no telemetry. Everything on the page comes from your machine.
  • Requires Node.js ≥ 23.4 (node:sqlite).

See the README for the full picture.