New page plugin @magpie-community/page-usage-tree 0.1.0 by CHENZUDE: magpie's usage as a provider -> account -> model tree, served by a small server that reads the gateway's /v1/magpie/usage and /usage/requests.
The last round (f9e0907) gives the model row's calls cell the calls-cell class, so CALLS values sit under their right-aligned header, adds a test for it, and comments why the server's retry budget is 16 x 100ms.
What was run at f9e09079 (mote, macOS, sandbox HOME):
- In the package: node --test 50 pass; bun test 47 tests, 0 fail.
- f9e09079 merged onto main 8765cf8f: bun scripts/check.mjs ok; whole-repo bun test 6149 pass, 20 skip, 0 fail.
- Playwright against a fake gateway: CALLS header and value right edges 616/616 (1280px), 423/423 (900), 341/341 (760, 621) in Chromium and WebKit. Chromium 1280-620px, WebKit 900/760, both engines at 420px in en and zh: no clipped cell, no sideways scroll, no <select>, no page errors.
- Broken by hand: the old `model.errors ? "bad" : ""` puts values at 544 and 273 and turns "model calls sit under the right-aligned calls header" red (27 pass, 1 fail).
Not tried: a real magpie with real accounts, the desktop app, Windows and Linux.
72 lines
2.9 KiB
JSON
72 lines
2.9 KiB
JSON
{
|
|
"name": "@magpie-community/page-usage-tree",
|
|
"version": "0.1.0",
|
|
"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"
|
|
},
|
|
"options": {
|
|
"port": 3494,
|
|
"currency": "usd",
|
|
"chineseUnits": false,
|
|
"usdCny": 0
|
|
},
|
|
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4IiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgZmlsbD0ibm9uZSI+CiAgPHJlY3Qgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHJ4PSIyOCIgZmlsbD0iIzNhM2Y0YiIvPgogIDxnIHN0cm9rZT0iI2U5ZTdmMiIgc3Ryb2tlLXdpZHRoPSI5LjYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+CiAgICA8cmVjdCB4PSI0Mi40IiB5PSIxMy42IiB3aWR0aD0iNDMuMiIgaGVpZ2h0PSIyNi40IiByeD0iMTAuNCIvPgogICAgPHBhdGggZ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