page-usage-tree 0.1.1 (CHENZUDE): - A failed refresh is kept on the cache entry the page reads, so "Refresh failed; showing the previous data" shows when a refresh threw (on 0.1.0 it was written to an entry already replaced and never shown). Only a loader that threw counts: an older disk cache marked stale does not, and a retry from a failed entry stays failed until a loader succeeds. The page takes the server's X-Usage-Tree-Refresh on every answer, quiet follow-ups included, so the warning clears once the gateway recovers. - Hit rate uses magpie's hitPct rounding (0.9996 shows 99.96%, not 100%). - A failed per-account model-detail read keeps the account totals and says model details are incomplete (zh, en). Disk cache v8. - Not in the PR body: a /bridge.js shim served by the service (talks only to parent: hello, options.get/set, theme and visibility), request timeout 10s -> 30s, narrow breakpoint 620px -> 700px, model split on narrow screens, "permissions": [] added (same as absent), zh warnings joined with ";". Run at the reviewed head 74363201570d9f69866ac0e4afff7a2b898e6dab: - WSL (magpie-desktop), fresh HOME: bun test packages/page-usage-tree 62 pass 1 skip (parity needs a live magpie); node --test 68 pass 1 skip; bun scripts/check.mjs ok. - Windows (xiaomi-gpu), fresh HOME and USERPROFILE: bun test packages/page-usage-tree exit 0; bun scripts/check.mjs ok. CI green. - Playwright 1.62 Chromium and WebKit on WSL, sandbox server with fake data, 1280 and 420px, en and zh: a first open from a stale disk cache never shows the refresh warning; a failed manual refresh shows it, it stays while the gateway is down, and clears on the quiet follow-ups after recovery while the model-detail warning stays; no page errors, no horizontal scroll. The same probe on e3da32bed fails 3 checks (false warning on open, warning never clears, zh joined by a space). - Broken by hand: counting data.stale as failed, a retry entry forgetting the failure, and a quiet load never clearing each turn a test red. Not covered by a test: dropping warningStateChanged (render also runs renderWarnings) and the zh join between two data warnings. - Host/Origin/token handling on /api/tree unchanged from main; /bridge.js is static and behind the Host check. dist had only 0.1.0.
73 lines
3.0 KiB
JSON
73 lines
3.0 KiB
JSON
{
|
|
"name": "@magpie-community/page-usage-tree",
|
|
"version": "0.1.1",
|
|
"description": "在 Magpie 窗口中按供应商 -> 账号 -> 模型查看用量,逐级展开调用、错误、Token 与费用。A page in Magpie's window: usage as provider -> account -> model, each level expandable, with calls, errors, tokens and cost from Magpie's local usage API.",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"files": [
|
|
"index.mjs",
|
|
"serve.mjs",
|
|
"lib",
|
|
"page",
|
|
"ui",
|
|
"assets",
|
|
"LICENSE",
|
|
"README.md"
|
|
],
|
|
"scripts": {
|
|
"start": "node serve.mjs",
|
|
"test": "node --test test/*.test.mjs"
|
|
},
|
|
"engines": {
|
|
"magpie": ">=0.1.1340"
|
|
},
|
|
"keywords": [
|
|
"magpie",
|
|
"magpie-page",
|
|
"magpie-plugin",
|
|
"usage",
|
|
"accounts",
|
|
"models",
|
|
"tokens",
|
|
"cost"
|
|
],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/page-usage-tree"
|
|
},
|
|
"homepage": "https://github.com/magpie-community/plugins/tree/main/packages/page-usage-tree",
|
|
"bugs": {
|
|
"url": "https://github.com/magpie-community/plugins/issues"
|
|
},
|
|
"magpie": {
|
|
"name": "账号用量 / Account usage",
|
|
"summary": {
|
|
"en": "A provider -> account -> model usage tree with per-account calls, errors, tokens and cost. Adds the account layer that Usage Glance's usage:summary does not contain, read from Magpie's local usage API.",
|
|
"zh": "按供应商 -> 账号 -> 模型查看用量,逐级展开调用、错误、Token 与费用。补充用量速览没有的账号层,数据来自 Magpie 本地用量 API。"
|
|
},
|
|
"page": {
|
|
"title": "Account usage",
|
|
"titles": {
|
|
"en": "Account usage",
|
|
"zh": "账号用量"
|
|
},
|
|
"file": "page/index.html",
|
|
"service": {
|
|
"port": 3494,
|
|
"option": "port"
|
|
},
|
|
"icon": "page/icon.svg"
|
|
},
|
|
"permissions": [],
|
|
"options": {
|
|
"port": 3494,
|
|
"currency": "usd",
|
|
"chineseUnits": false,
|
|
"usdCny": 0
|
|
},
|
|
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmc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