Conversation
…(v1.0.0) Add plugins/HaneWari/token-meter: a read-only MCP + Skill plugin that reports per-model token usage and prompt-cache hit rate from the local MiniMax Code runtime, including custom BYOK providers. Ships minute-precision trend queries, per-session reports, a widget visualizer skill, and a SessionEnd snapshot hook. Includes fixture-driven smoke tests.
…rial layout Single KPI strip with internal dividers instead of four boxed cards, segmented preset control, model share bar, legend with compact totals, tabular numerals and an 8px spacing rhythm. Keeps the mavis.widget.v1 contract, --mw-* token usage, and sendPrompt interactions unchanged.
Move window parsing, bucket picking, and bucket aggregation out of the MCP server into a shared module so local tooling (e.g. a loopback live preview) produces identical numbers. No behavior change; smoke tests pass 5/5.
Add token_meter_live_board: an explicit start/status/stop MCP tool that binds 127.0.0.1 (random free port by default) and serves an interactive live dashboard backed by the same trend pipeline as token_usage_trend. Agents can hand the URL to the user or open it directly with an in-app browser tool. Loopback-only, no remote requests, listener released on MCP exit; network behavior disclosed in README (EN/zh-CN). Includes a smoke test driving start/fetch/stop against the fixture data dir.
…findings Serve Chart.js from a vendored copy (lib/vendor/chart.umd.min.js, MIT, license banner retained) so opening the live dashboard makes zero external requests; disclose it in README (EN/zh-CN). Replace literal BOM characters in stdin-trim regexes with the \\uFEFF escape, and drop an unused export.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Adds the hosted Plugin
plugins/HaneWari/token-meter(v1.1.0) plus fixture-driven smoke tests attests/plugins/token-meter/smoke.test.mjs.User value
Track per-model token usage and prompt-cache hit rate in MiniMax Code — including custom BYOK providers (Kimi, StepFun, …).
Example prompt:
Summarize today's token usage by model with cache hit rates.Expected result: a per-provider/model table (custom providers first) with calls, input/output/cache-read tokens, cache hit rate, and a total row, e.g.
K3 — 68 calls, 97.8% cache hit, 4.0M tokens.More copyable prompts:
Show me the live token usage dashboard.→ the agent starts the loopback live board viatoken_meter_live_boardand returns (or, on hosts with an in-app browser tool, directly opens)http://127.0.0.1:<port>/— an interactive dashboard with minute-precision window selection, 30 s auto-refresh, and light/dark themes.Draw the token usage trend from 14:00 to 16:30 today.→ a widget dashboard (on hosts withmavis.widget.v1) with per-model stacked bars and a cache-hit-rate line.Which recent sessions consumed the most tokens?→ per-session totals with titles and model mix.Data comes only from the local MiniMax Code runtime state (read-only sqlite queries + observability-log enrichment + config display names). A
SessionEndhook (where supported) archives per-session snapshots so history survives runtime database cleanup.Plugin submission checklist
plugins/<github-owner>/<plugin-name>.plugin.jsonname matches the Plugin directory.README.mdincludes a real example prompt and expected result.LICENSEandplugin.jsondeclare an open-source license (Apache-2.0).TODOhas been replaced.npm run checkpasses.Evidence
node scripts/validate.mjs→OK plugin HaneWari/token-meter("Validated 29 hosted Plugins and all examples.")node --test tests/plugins/token-meter/smoke.test.mjs→ 6/6 pass: tools/list, custom-first grouping with exact cache-hit-rate math,fillEmptybucket filling,SessionEndhook snapshot archival, live board start/fetch/stop against the fixture data dir, snapshots empty state.npm run checkon Windows 11: 350 tests, 340 pass; the 7 failures reproduce identically on a pristineupstream/mainworktree (pre-existing environment issues: Windows symlink privileges,python3not on PATH, octopus-meme-maker smoke tests) and are unrelated to this PR; Ubuntu CI should be green.127.0.0.1(zero external requests, verified via browser network log),SessionEndhook writing snapshot lines.plugin.json+mcp.json(Agent Plugins 1.0),.claude-plugin/plugin.json(mcode 0.4.0+, inlineSessionEndhook),.minimax-plugin/plugin.json(Desktop),io.minimax.mcode/hooks/hooks.json(portable hook document). Skills:token-meter(text reports) andtoken-meter-visualizer(mavis.widget.v1 dashboard with self-contained GenUI foundation).Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.