Repository navigation
Conversation
MyPrototypeWhat
left a comment
There was a problem hiding this comment.
Thanks for the Token Usage Widget PR. We re-checked on a95ba34d. This isn't ready to merge yet.
The merge blocker is that the plugin reads the MiniMax Code signed-in access token from the host's undocumented auth files by default, as soon as it is enabled. Opening the widget or the settings page calls GET /api/state, and that path always runs fetchAccount() / loadAuthProfile(). There is no separate setting that starts off and has to be turned on before this read happens. A hostAccess declaration is not present here, and in this contract it would only cover navigation.read anyway. It does not authorize reading login files.
Please add a default-off switch, keep the token read behind it, and document the switch in the README.
A few related notes, not merge blockers on their own:
- The README and the PR body say this package reads one host file (
auth.json) and no other host file. In the source, choosing a runtime root alsoreadFiles the wholev2/sqlite/runtime-state.sqlite, andreadAuthRegionreadsregionfromauth-state.json. Those contents are not placed into the/api/statepayload in the source we checked, but the sqlite file is read again whenever the 15-second snapshot cache expires. - If
MINIMAX_DATA_DIRis set and containsauth.json, but there is no sqlite file andauth/prodis a directory (pathExistsonly treats a file as a hit), root resolution falls through to~/.minimax, which may be a different login. - A missing or
0expiresAtMsstill sends the token. For account API errors other thanstatus_code0 or 1004, the rawstatus_msgis returned onaccount.message(this is not the token fromauth.json). Outboundfetchdoes not setredirect: 'error'. - There are no test files among the 18 changed files.
We confirmed from the source that parseAccountPayload does not include accessToken. A reviewer simulation also did not see the token in /api/state, /api/settings, page or asset responses, logs, or the package's own dataDir. We did not re-run that probe. Host, Electron, and the in-app Browser were not tested.
Happy to re-review once the default-off switch is in.
MyPrototypeWhat
left a comment
There was a problem hiding this comment.
Thanks for the two trend commits. We re-checked this head 8e4a08d8 on its own, without carrying over the conclusion from a95ba34d. It is still not ready to merge.
The original merge blocker is still in place. These two commits did not change the auth path. Opening the widget or the settings page still calls GET /api/state (widget.js refresh() / settings.js load()). When the snapshot cache has expired, that path unconditionally runs fetchAccount() / loadAuthProfile() and reads the signed-in access token from the host's undocumented auth/**/auth.json files. DEFAULT_SETTINGS and normalizeSettings still only cover metrics, refresh, theme, language, scale, the trend window, position, and the three dial assignments. There is still no default-off switch that has to be turned on before this read happens. The README Data & access section documents the token read as something that happens once the app is open, and it does not describe a switch. plugin.json and miniapp.json still do not declare hostAccess. Even if they did, this contract only covers navigation.read, which would not authorize reading login files.
Please add a default-off switch, keep the token read behind it, and document the switch in the README.
Separately, this branch cannot merge into current main as it stands. GitHub reports mergeable=false / dirty because the community catalog tables in the root README.md and README.zh-CN.md conflict. This PR inserts the Token Usage Widget row immediately under the table header, while main has since inserted Postman Lite, Weekly Planner, and 天气 · 新闻看板 at that same spot. That is a mechanical catalog conflict, not a logic issue introduced by the two trend commits, but it does block the merge. Please rebase onto current main and fold the new catalog rows together. Being behind main alone would not have been a reason to rebase. The conflict is.
A few related notes, still not merge blockers on their own:
- The README and the PR body say this package reads one host file (
auth.json) and no other host file. In the source, choosing a runtime root alsoreadFiles the wholev2/sqlite/runtime-state.sqlite, andreadAuthRegionreadsregionfromauth-state.json. Those contents are not placed into the/api/statepayload in the source we checked, but the sqlite file is read again whenever the 15-second snapshot cache expires. - If
MINIMAX_DATA_DIRis set and containsauth.json, but there is no sqlite file andauth/prodis a directory (pathExistsonly treats a file as a hit), root resolution falls through to~/.minimax, which may be a different login. - A missing or
0expiresAtMsstill sends the token. For account API errors other thanstatus_code0 or 1004, the rawstatus_msgis returned onaccount.message(this is not the token fromauth.json). Outboundfetchdoes not setredirect: 'error'. - There are still no package tests. The English accessible label for an empty window is
Idle(i18n.js), while the English README says "no consumption". The Chinese copy is 「无消耗」 on both sides. That is a wording mismatch from these commits, not a new merge blocker.
We confirmed from the source that parseAccountPayload does not include accessToken. We did not re-run a token-leak probe, and we did not test on Windows, a real host / Electron / in-app Browser, real login files, or the live account API. This head has no repository CI run. Only Proof was skipped.
Please update the branch, and we will look at the new head.
|
This branch now also has a real merge conflict with current |
8e4a08d to
8531325
Compare
|
Thanks for the review — the branch is updated. Rebased, not merged. The branch is now rebased onto the current The merge blocker: the account feed is behind a default-off switch. There is a new Account data switch in the settings page (
Turning it on starts the account feed on the next poll. The switch is documented in the README, in English and in 中文. The notes:
The PR body now covers the tested environment, the switch in both positions, and what was not verified. |
|
Thanks for rebasing Token Usage Widget earlier. After several merges landed on main this afternoon, including #208 Work Group, this branch now has a real merge conflict with current Please rebase this branch onto current
Your Token Usage Widget row and the newly merged Work Group row are both inserted just above Prompt Enhancer. Keep both rows after the rebase. Please don't use GitHub's Update branch button. That would merge |
The review asked for an explicit opt-in before the signed-in token is read from the host's auth files. The Account data switch in the settings page is now off by default. While it is off the service resolves no runtime root, reads no Host file, calls no account API and writes no sampling file; the dial turns grey and says where to turn the switch on. The review notes are addressed too: the runtime database is only stat-ed and never opened, the runtime root prefers the candidate that actually holds the credentials, only a record with an explicit unexpired expiry is sent, the account API's status_msg is no longer echoed, outbound requests refuse redirects, the English empty-window label now matches the README, and the package ships its own tests.
8531325 to
3aa7ca7
Compare
|
Rebased again onto the current The catalog conflict is resolved by hand in The code itself is unchanged since the last push; only the branch base moved. |
A floating dial that shows how much of your MiniMax account's Token quota is used, how fast it is being spent, and how much was used over the last 7 days — with an always-on-top popup window and a bilingual settings page that follows the system language. Every reading is account-side, and the trend curve always follows the account's live Token counter over a window you pick: 10 minutes, 30 minutes, 60 minutes or 2 hours.
The Account data switch in the settings page, after you turn it on.
Tested environment
surface.window, so older clients reject the package.main(655fdf6).mainwas not merged into the branch: the two README tables were resolved by hand and the table rows thatmainadded in the meantime were kept.--, one line says the account data is off, the service reportsaccount_disabled, the sampling file indataDirkeeps its old timestamp across two polls, and no Host file is read at all. On: the account feed returns, the readings come back and the trend curve draws again.npm run checkreportsplugins/nahyuw/token-usage-widget: OK— 0 errors, 0 warnings, nothing left to explain. The repository test suite passes 111 of 113 with 2 skipped and 0 failures. The package's ownnode --test tests/passes 12 of 12.Not verified
Access declared
No permission grants. The package declares no
agentAccess,toolAccess,deviceAccess,hostAccessorhostConnectorAccess, runs no Agent turn, reads no conversation, calls no tool, spawns no child process, and uses no microphone, camera or notification. The only feature beyond the plain manifest issurface.window.It does read two files that belong to MiniMax Code itself — the signed-in access token and the login region — because the Host offers no API for them. That now happens only after the user turns on the Account data switch: with the switch off (the default) the service resolves no runtime root, reads no Host file, calls no account API and writes no sampling file. The README names both files, says how they are located, and states plainly that this relies on an unspecified internal layout.
Written by MiniMax M3.1 Flash
What it does
The dial carries three readings at once, and each one is the user's choice:
Hovering opens a detail panel with every enabled metric, the last 7 days as a sparkline, and one line each naming the metric behind the centre, the water and the ring, so a rate-driven ring never leaves you guessing which reading it stands for.
Ten metrics are available, all of them account-side: usage in the current 5-hour cycle, usage in the current 7-day cycle, the two reset countdowns, today's Token total, the 7-day Token total, the account's 10-minute and 30-minute Token rate, today's cache hit rate and today's input / output split. The settings page covers the account-data switch, the enabled metrics and their order, the refresh rate, the window size and position, the trend window, the centre / water / ring assignment, the theme, and the language.
Until the account-data switch is turned on the dial is grey, the readout shows
--, and one line says where to turn it on — the readings are not faked and the metric rows are not drawn.Review feedback addressed
The two rounds of review on this pull request are answered here:
readAccountDatainsettings.jsonand off by default. With the switch off the service returnsaccount_disabledwithout resolving the runtime root, reading a file, calling the API or writing the sampling file; the dial turns grey and explains itself.main. The branch is rebased onto the currentmain(655fdf6) —mainis not merged into it — and the two README tables are merged by hand with the rowsmainadded in the meantime.status_msgwas echoed to the page. The wording is ours now — a small table of our own messages per status code — and only the status code is kept.redirect: 'error', so the credential cannot be handed to another host.tests/withnode --test tests/covering the switch (off means no Host file is read, on means it is), the expiry rules, the runtime-root resolution, the error wording, the error mapping and the trend buckets: 12 tests, all passing.No consumption, and the Chinese one is 「无消耗」, so the three texts agree.Notes on the implementation
miniapp/client/i18n.jsholds the whole string table for English and 简体中文. The locale follows the system by default and can be pinned in the settings page. The Node service sends every metric name and hint as a{ zh, en }pair so one catalog serves both languages, and the service's error messages carry an English variant next to the Chinese one.importinside an IIFE, which is invalid in a plain script, and inlining the same module twice would give a stateful module two copies — two locales at once. The bundler now collects the transitive dependencies, builds each one once in dependency order, and points every reference at the same instance.miniapp/node/host-access.mjsholds the file-type check, the runtime-root candidates, the credential collection and the record selection;miniapp/node/trend-buckets.mjsholds the bucket attribution.server.mjsstays the HTTP layer. Both modules are pure enough to test withnode --testwithout starting a server, which is what the new tests do.Package identity
The plugin ID in this pull request is
token-usage-widget. The author's local installation keeps the ID that the Host generated for it, so the two differ; the directory name andplugin.json.namehere match each other, which is what the contract requires.Data & access
The README documents every file read, every file written, every network host, the spawned processes and the state.
Two files belonging to MiniMax Code itself are read, and only while the Account data switch is on: the login token in
auth.json(a record is used only when it carries an explicit expiry that has not passed) and the region inauth-state.json. Locating them relies on an unspecified internal layout, because the Host offers no API for it; the README says so plainly.The access token stays inside the Node process: it never reaches the page, a log line, or a response body. The package spawns no child process and reads no other Host file. The runtime database is stat-ed, never read, and the account requests refuse redirects, so the credential cannot be handed to another host.
The package's own tests live in
tests/(outsideminiapp/, as the repository asks) and run withnode --test tests/.License
MIT.