@kenz1117/dsh-ui-usage-billing 1.8.12 → 1.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -131,12 +131,12 @@ Settings are stored in `DSH_HOME/.dsh-usage-peak-schedule.json`, configurable vi
131
131
 
132
132
  ## 🚀 Quick start
133
133
 
134
- One codebase currently supports DSH `0.1.2-alpha.1` through `0.2.3-alpha.3`. Stable and preview releases share the same compatibility matrix: stable releases use npm `latest`, while previews use `alpha`. npm `latest` currently points to the stable `1.8.11` release (ledger rows whose session logs were deleted are merged by catalog key and repriced from the catalog, issue #127; channel visibility; cache-write priced by each vendor's own rate; the dashboard shortcut; the `/usage` command registration-timing fix; an extra keyless FX source; host `0.2.2-rc.4` / `0.2.2-rc.5` compatibility; the sidebar footer card collapsing to a 36×36 icon button when it shares the slot with other plugins, issue #130; a catalog expansion adding 13 first-party vendor models); `alpha` points to `1.8.3-alpha.16` (content = `1.8.10` plus the issue #140 form-A fixes and the host `0.2.3-alpha.3` compatibility declaration), and the next preview starts at `1.8.3-alpha.17`.
134
+ One codebase currently supports DSH `0.1.2-alpha.1` through `0.2.3-alpha.3`. Stable and preview releases share the same compatibility matrix: stable releases use npm `latest`, while previews use `alpha`. npm `latest` currently points to stable `1.8.14` (everything in `1.8.13`, the verified `1.8.3-alpha.19` preview, and PR #151 — write endpoints behind a reverse proxy with `trustedHosts` no longer return 403); `alpha` remains at `1.8.3-alpha.19`, whose content is covered by this stable release, and the next preview starts at `1.8.3-alpha.20`.
135
135
 
136
136
  `dsh plugin add` requires an explicit `--profile`. Pinning an exact version is recommended so a package manager's release cooldown cannot resolve a different version. Install the current stable release with:
137
137
 
138
138
  ```sh
139
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.11
139
+ dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.14
140
140
  ```
141
141
 
142
142
  Default installations can also use `@latest`. Check the host with `dsh --version` or `npm ls -g @deepseek-ai/dsh`.
@@ -276,7 +276,7 @@ For on-machine debugging: `dsh plugin --profile web add "link:<absolute path to
276
276
 
277
277
  ## 📦 Release
278
278
 
279
- This standalone npm package maintains one `main` codebase. Stable releases use non-prerelease versions and npm `latest`; previews use prerelease versions and npm `alpha`. npm `latest` currently points to the stable `1.8.10` release, while `alpha` points to `1.8.3-alpha.15`; see [COMPATIBILITY.md](COMPATIBILITY.md).
279
+ This standalone npm package maintains one `main` codebase. Stable releases use non-prerelease versions and npm `latest`; previews use prerelease versions and npm `alpha`. npm `latest` currently points to stable `1.8.14`, while `alpha` remains at `1.8.3-alpha.19`; see [COMPATIBILITY.md](COMPATIBILITY.md).
280
280
 
281
281
  ```sh
282
282
  pnpm test && pnpm run build # full tests + build before release
@@ -291,7 +291,7 @@ The host discovers the browser side automatically via the `dsh.client` declarati
291
291
 
292
292
  - **Permission level: high**: reads durable Session logs, calls vendor / subscription / balance / pricing APIs, reads `apiKeyEnv` through the credentials seam, and writes the ledger, snapshots and task queue under the harness home. The plugin itself has **no** command-execution / shell capability; only explicit enqueueing creates a host Session and submits a Prompt, while Agent tools remain governed by the host's existing permissions and approvals.
293
293
  - **Update channel: `user-reviewed`**: with file / network / credential capabilities, DSH STORE requires local manual confirmation on every install; review the repo, pinned commit, lifecycle scripts, and impact scope before installing.
294
- - **Compatibility**: stable and preview releases from the current `main` share one matrix covering DSH `0.1.2-alpha.1` through `0.2.3-alpha.3`, with 41 per-version declarations. The current stable release is `1.8.11` (npm `latest`; ledger rows whose session logs were deleted are merged by catalog key and repriced from the catalog, issue #127; channel visibility; cache-write priced by each vendor's own rate; the dashboard shortcut; the `/usage` registration fix; an extra keyless FX source; host `0.2.2-rc.4` / `0.2.2-rc.5` compatibility; the sidebar footer card collapsing to a 36×36 icon button when it shares the slot with other plugins, issue #130; a catalog expansion adding 13 first-party vendor models); the preview channel is `1.8.3-alpha.16` (npm `alpha`; content = the stable release plus the issue #140 fixes and the host `0.2.3-alpha.3` compatibility declaration). Release channels and monitoring are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
294
+ - **Compatibility**: stable and preview releases from the current `main` share one matrix covering DSH `0.1.2-alpha.1` through `0.2.3-alpha.3`, with 41 per-version declarations. The current stable release is `1.8.14` (npm `latest`; `1.8.13`, the verified `1.8.3-alpha.19` preview, and PR #151 — write endpoints behind a reverse proxy with `trustedHosts` no longer return 403); the preview channel remains `1.8.3-alpha.19` (npm `alpha`), whose content is covered by this stable release. Release channels and monitoring are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
295
295
  - **Lifecycle**: no `preinstall` / `install` / `postinstall` / `prepare` (ready on install).
296
296
  - **No impersonation**: adds only its own entry id `ui-usage-billing`; `@deepseek-ai/dsh-*` packages are `peerDependencies` only (no reinstall / replace / shadowing of official components); the package uses the third-party namespace `@kenz1117/*`.
297
297
  - **Build artifacts**: runtime files `lib/*` and `cordis.patch.yml` are committed at the pinned commit and declared in `files`.
@@ -312,6 +312,7 @@ Boundaries: the tool reads only this plugin's own aggregates — never Session b
312
312
  ## ⚠️ Known Limitations and Deferred Work
313
313
 
314
314
  - **The off-peak queue is still a preview**: it accepts only time-of-day models on the host's built-in `deepseek-official` route; relays and custom routes are excluded. There is no automatic pause, cancellation or retry. With source-Session reuse on, the task keeps the source Session's **current** model (the plugin never switches it — that would change your global default model) and only continues there while the Session is idle; otherwise it falls back to a new Session with the reason recorded. After host shutdown, a dropped result stream or lease expiry, the task becomes "Needs review"; open its Session and decide manually whether to enqueue a new task.
315
+ - **An empty candidate list is explained by cause (issue #143)**: the dashboard queue tab and the composer entry share one verdict — "the host has no built-in official route (`deepseek-official`)", "the official route exposes no time-of-day model", "the host registered no workspace", and "the current Session model is not an official time-of-day model" each get their own next step; nothing collapses into a generic "model unsupported". The host's built-in sign-in route (`deepseek-account`) is not a queue candidate either: it is billed at the official time-of-day price, but enqueuing means spending the sign-in wallet unattended.
315
316
  - **Balance queries cover DeepSeek / Moonshot (Kimi) / StepFun / SiliconFlow / xAI / Zhipu GLM (Z.ai CN region) / Tencent Cloud TokenHub (token-plan quota)**: the first six use a standard Bearer API key; Tencent Cloud uses the cloud-API key pair (`<SecretId>:<SecretKey>`, TC3-signed management API). Other providers expose no public balance API or need non-Bearer auth (Xiaomi MiMo via console Cookie, SenseTime via AccessKey signing, MiniMax/Doubao via quota or AK/SK), so they currently show "not configured"; the extension point is `src/balance.ts` (add a querier per provider balance API).
316
317
  - **Relay quota depends on upstream private schemas**: New API / Sub2API interface fields are not public, so an unreadable station is labeled "no quota" rather than fabricating an amount; if a station's response fields differ, extend the parsers in `src/relay.ts`. An "unknown route" means that route exists neither in the current provider config nor in the host llm registry (deleted config, logs older than the install, …); historical call data is not lost — re-adding the same-named route restores attribution automatically. Cost in the unknown-route bucket is always 0 (issue #82): the spending party cannot be verified — same posture as uncatalogued models and subscription channels — while tokens are still counted, and the panel shows "—" for the group cost with an explanatory note. Channels registered by another plugin through `ctx.llm.registerAdapter` (e.g. CommandCode) are **not** unknown routes: the plugin discovers them from the host llm registry and bills them in the `direct:<provider>` bucket at the model's official catalog price (issue #91); the registry is read through `ctx.get('llm')` (no `inject` requirement), and an unreadable or empty registry warns once (panel numbers and the unknown policy are unchanged) so this class of failure is never silent again.
317
318
  - **Overspend notifications rely on the browser Notification API**: when permission is denied or the platform lacks support, only the in-UI red-pulse fallback remains — no host-level notification channel; notifications are capped at once per day.
@@ -342,6 +343,8 @@ Boundaries: the tool reads only this plugin's own aggregates — never Session b
342
343
  - [@yuxu4468-hash](https://github.com/yuxu4468-hash) — cataloging for bare relay-exposed model ids: Grok 4.5/4.6, GPT-5.5, GPT-6.1 Sol, Claude Opus 4.7/4.8 and Fable 5 (PR #87), plus the GPT image models `gpt-image-2` / `gpt-image-2.5-sunburst` (PR #88)
343
344
  - [@JinruiWang](https://github.com/JinruiWang) — workbuddy adapter channel pricing and the fold-before-live-catalog dual-caliber fix: the known-channel list, three lazy-reprice gates (ledger, cache hit, incremental cursor) and the stable-stamp reproduction test (issue #90)
344
345
  - [@gitfangj](https://github.com/gitfangj) — `sync.sh` brace-variable compatibility under the macOS default bash 3.2
346
+ - [@Calorios](https://github.com/Calorios) — per-source peak/valley schedules, pricing-picker candidates and source prices, attributable floating-card balances, the sign-in wallet row and sticky settings navigation (PR #134 ~ #138), plus the settings-navigation surface and scroll-container fixes (PR #142)
347
+ - [@python-rust](https://github.com/python-rust) — the cascade fix for the dashboard modal being narrowed by the host Modal's default styles (issue #146, PR #147)
345
348
 
346
349
  </details>
347
350
 
package/README.md CHANGED
@@ -130,12 +130,12 @@
130
130
 
131
131
  ## 🚀 快速开始
132
132
 
133
- 当前维护 DSH `0.1.2-alpha.1` ~ `0.2.3-alpha.3` 的一份代码。正式版与预览版共享同一兼容矩阵:正式版使用 npm `latest`,预览版使用 `alpha`。当前 `latest` 指向 `1.8.11` 正式版(日志已删的存量账本行按目录键归一并按目录价补价 + 通道可见性 + 缓存写入按厂商费率独立计价 + 仪表盘快捷键与 `/usage` 命令注册时机修正 + 汇率兜底源 + 宿主 0.2.2-rc.4 / rc.5 兼容声明 + 侧栏 footer 同槽共存收成 36×36 图标钮 + 目录扩容 13 条新模型);`alpha` 指向 `1.8.3-alpha.16`(内容 = `1.8.10` + issue #140 形态 A 两处失效的修复 + 宿主 `0.2.3-alpha.3` 兼容声明),下一轮预览从 `1.8.3-alpha.17` 起。
133
+ 当前维护 DSH `0.1.2-alpha.1` ~ `0.2.3-alpha.3` 的一份代码。正式版与预览版共享同一兼容矩阵:正式版使用 npm `latest`,预览版使用 `alpha`。当前 `latest` 指向 `1.8.14` 正式版(= `1.8.13` + 已验收的 `1.8.3-alpha.19` + PR #151 反代写操作 403 修复);`alpha` 仍指向 `1.8.3-alpha.19`(其内容已由本正式版覆盖),下一轮预览从 `1.8.3-alpha.20` 起。
134
134
 
135
135
  `dsh plugin add` 需要显式 `--profile`,且建议钉具体版本号,避免包管理器的发布冷静期解析到其他版本。当前正式版安装命令:
136
136
 
137
137
  ```sh
138
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.11
138
+ dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.14
139
139
  ```
140
140
 
141
141
  默认安装也可使用 `@latest`。可用 `dsh --version` 或 `npm ls -g @deepseek-ai/dsh` 确认宿主版本。
@@ -259,7 +259,7 @@ cost(CNY)= (missInput × p_input + cacheWrite × p_cacheWrite + cacheHit ×
259
259
 
260
260
  `GET /api/billing/peak-schedule` 返回可选来源/模型、当前规则、最近修订生效时间和读取提示。`POST /api/billing/peak-schedule` 接收 `{ "version": 3, "changes": { … } }`(键为来源/模型 JSON 数组字符串,值为规则或表示清除的 `null`)。响应的 `results` 逐键返回 `accepted`、`invalidRule` 或 `unavailableModel`。请求整体格式错误返回 400,宿主时钟冲突返回 409。端点限本机访问。
261
261
 
262
- 对外 HTTP 接口与字段定义详见源码:`GET /api/billing/pricing`、`/api/billing/balance`、`/api/billing/usage-stats`、`/api/billing/subscriptions`、`/api/billing/relay-quotas`、`GET/POST /api/billing/task-queue`、`GET /api/billing/task-queue-summary` 等(见 `src/index.ts`、`src/aggregate.ts`、`src/relay.ts`、`src/routes/task-queue.ts`)。其中 `usage-stats` 返回的 `bySite` 字段为按中转站归组后的用量分布,`relay-quotas` 返回额度与路由诊断;`task-queue` 返回能力、工作区、官方模型和持久任务快照,写操作为 `enqueue` / `enqueueMany`、移除未启动任务与清理已结束历史;`task-queue-summary` 只返回峰谷状态与待执行数量,不返回 Prompt。全部端点仅接受回环请求;队列写操作另校验回环 Origin、JSON Content-Type 与 10 MiB body 上限。
262
+ 对外 HTTP 接口与字段定义详见源码:`GET /api/billing/pricing`、`/api/billing/balance`、`/api/billing/usage-stats`、`/api/billing/subscriptions`、`/api/billing/relay-quotas`、`GET/POST /api/billing/task-queue`、`GET /api/billing/task-queue-summary` 等(见 `src/index.ts`、`src/aggregate.ts`、`src/relay.ts`、`src/routes/task-queue.ts`)。其中 `usage-stats` 返回的 `bySite` 字段为按中转站归组后的用量分布,`relay-quotas` 返回额度与路由诊断;`task-queue` 返回能力、工作区、官方模型、候选为空的根因(`blockedReason`)和持久任务快照,写操作为 `enqueue` / `enqueueMany`、移除未启动任务与清理已结束历史;`task-queue-summary` 只返回峰谷状态与待执行数量,不返回 Prompt。全部端点仅接受回环请求;队列写操作另校验回环 Origin、JSON Content-Type 与 10 MiB body 上限。
263
263
 
264
264
  ## ⚙️ 配置
265
265
 
@@ -295,7 +295,7 @@ pnpm run build # tsc -b && tsdown,产出 lib/index.js 与 lib/client.js
295
295
 
296
296
  ## 📦 发布
297
297
 
298
- 本包为独立 npm 包,只维护一份 `main` 代码。正式版使用非预发布版本号并切 `latest`,预览版使用预发布版本号并切 `alpha`;当前 `latest` 指向 `1.8.10` 正式版,`alpha` 指向 `1.8.3-alpha.15`,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
298
+ 本包为独立 npm 包,只维护一份 `main` 代码。正式版使用非预发布版本号并切 `latest`,预览版使用预发布版本号并切 `alpha`;当前 `latest` 指向 `1.8.14` 正式版,`alpha` 仍指向 `1.8.3-alpha.19`,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
299
299
 
300
300
  ```sh
301
301
  pnpm test && pnpm run build # 发版前全量测试 + 构建
@@ -310,7 +310,7 @@ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> latest # 正式版
310
310
 
311
311
  - **权限等级:high**:读取持久会话日志(文件)、访问多厂商官方 / 订阅 / 余额 / 定价 API(网络)、经凭据 seam 读取 `apiKeyEnv`(凭据)、写入 harness home 下的账本、快照与任务队列(持久状态)。插件自身**不含**命令执行 / Shell;仅用户显式入队时才经宿主创建会话并提交 Prompt,Agent 的工具调用仍由宿主原有权限与审批控制。
312
312
  - **更新通道:`user-reviewed`**:本插件具备文件 / 网络 / 凭据能力,DSH STORE 采用每次安装需本机人工确认的通道;安装前请复核仓库、固定 Commit、生命周期脚本与影响范围。
313
- - **兼容范围**:当前 `main` 的正式版与预览版共享同一兼容矩阵,适配 DSH `0.1.2-alpha.1` ~ `0.2.3-alpha.3`,共 41 项逐版本声明。当前正式版为 `1.8.11`(npm `latest`,日志已删的存量账本行按目录键归一并按目录价补价 + 通道可见性 + 缓存写入按厂商费率独立计价 + 仪表盘快捷键与 `/usage` 注册修正 + 汇率兜底源 + 宿主 0.2.2-rc.4 / rc.5 兼容声明 + 侧栏 footer 同槽共存收成 36×36 图标钮 + 目录扩容 13 条新模型),预览通道为 `1.8.3-alpha.16`(npm `alpha`,内容 = 正式版 + issue #140 修复 + 宿主 `0.2.3-alpha.3` 兼容声明)。发行通道与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
313
+ - **兼容范围**:当前 `main` 的正式版与预览版共享同一兼容矩阵,适配 DSH `0.1.2-alpha.1` ~ `0.2.3-alpha.3`,共 41 项逐版本声明。当前正式版为 `1.8.14`(npm `latest`,= `1.8.13` + 已验收的 `1.8.3-alpha.19` + PR #151 反代写操作 403 修复),预览通道仍为 `1.8.3-alpha.19`(npm `alpha`,其内容已由本正式版覆盖)。发行通道与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
314
314
  - **生命周期**:无 `preinstall` / `install` / `postinstall` / `prepare`(安装即用)。
315
315
  - **不冒用官方**:仅新增自有 entry id `ui-usage-billing`;对 `@deepseek-ai/dsh-*` 仅为 `peerDependencies` 依赖(不重复安装 / 不替换 / 不遮蔽官方组件),包名使用第三方命名空间 `@kenz1117/*`。
316
316
  - **打包产物**:运行文件 `lib/*` 与 `cordis.patch.yml` 已随固定 Commit 提交并声明在 `files`。
@@ -331,6 +331,7 @@ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> latest # 正式版
331
331
  ## ⚠️ Known Limitations and Deferred Work
332
332
 
333
333
  - **低谷队列仍是预览能力**:只接受宿主内置 `deepseek-official` 路由中具有官方峰谷价的模型,中转站和自定义路由一律排除;不提供自动暂停、取消或失败重试。开启「任务在来源会话继续」后,任务沿用来源会话**当时的模型**(不为它切换模型——那会改动你的全局默认模型),且只在来源会话空闲时续跑;不可用时一律回退为新建会话并注明原因。宿主停止、结果流中断或租约失效后,任务只标记「需核对」,用户应打开对应 Session 确认实际结果后手动决定是否重新入队。
334
+ - **候选为空时按根因分层提示(issue #143)**:面板与会话入队入口共用同一份判定——「宿主没有内置官方通道(`deepseek-official`)」「官方通道里没有带峰谷价的模型」「宿主没有登记工作区」「当前会话模型不是官方峰谷模型(订阅 / 中转通道没有官方峰谷价)」分别给出各自的下一步动作,不再笼统说「模型不支持」。宿主内置的登录账号通道(`deepseek-account`)同样不在候选内:它在账单里按官方分时价计入,但入队等于无人值守地用登录钱包付费,候选范围暂不放开。
334
335
  - **余额查询已接入 DeepSeek / 月之暗面(Kimi)/ 阶跃星辰(StepFun)/ 硅基流动 / xAI / 智谱 GLM(Z.ai 国内域)/ 腾讯云 TokenHub(Token Plan 余量)**:前六家用标准 Bearer API key,腾讯云用云 API 密钥对(TC3 签名)。其余厂商因无公开余额接口或需非 Bearer 鉴权(小米 MiMo 走控制台 Cookie、商汤走 AccessKey 签名、MiniMax/字节豆包走额度制或 AK/SK),暂显示「未配置」;扩展点在 `src/balance.ts`(按厂商余额 API 增加查询器)。
335
336
  - **中转站额度依赖上游私有 schema**:New API / Sub2API 的接口字段未公开,读不出时标「未读出额度」而非臆造金额;若某中转站响应字段不同,需按 `src/relay.ts` 的解析器扩展。未知路由表示该路由在当前 provider 配置与宿主 llm 注册表里都不存在(配置已删、日志比安装更早等),历史调用数据未丢,重新配置同名路由即可自动归位。未知路由桶的费用一律记 0(issue #82):支出主体无法核实,与未收录模型、订阅通道同姿态——token 照常统计,面板组头费用显示「—」并附说明。由独立插件经 `ctx.llm.registerAdapter` 注册的通道(如 CommandCode)不属于未知路由:插件从宿主 llm 注册表发现它们,按 `direct:<provider>` 桶以模型官方目录价计费(issue #91);注册表读取走 `ctx.get('llm')`(免 `inject` 声明),读不到/读到空集合时告警一次(面板数字不变,unknown 口径不变),避免这类失效无声无息。
336
337
  - **超支通知依赖浏览器 Notification**:权限被拒绝或平台不支持时只有界面红色脉冲兜底,没有宿主级通知通道;通知上限为每天一次。
@@ -362,6 +363,8 @@ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> latest # 正式版
362
363
  - [@yuxu4468-hash](https://github.com/yuxu4468-hash) — 中转站裸模型 id 计费补录:Grok 4.5/4.6、GPT-5.5、GPT-6.1 Sol、Claude Opus 4.7/4.8、Fable 5(PR #87),GPT 绘图模型 `gpt-image-2` / `gpt-image-2.5-sunburst`(PR #88)
363
364
  - [@JinruiWang](https://github.com/JinruiWang) — workbuddy adapter 通道计价与「折叠早于实时价目表」双口径修复:已知通道名单、惰性补折三门(账本 / cache 命中 / 增量游标)与 stable-stamp 复现测试(issue #90)
364
365
  - [@gitfangj](https://github.com/gitfangj) — `sync.sh` 在 macOS 缺省 bash 3.2 下的花括号变量兼容修复
366
+ - [@Calorios](https://github.com/Calorios) — 独立峰谷时段、补价候选与来源价、悬浮卡余额归属、登录钱包与设置页吸顶导航(PR #134 ~ #138),设置导航的面板底色与滚动容器修正(PR #142)
367
+ - [@python-rust](https://github.com/python-rust) — 仪表盘弹窗被宿主 Modal 默认样式压窄的层叠修复(issue #146、PR #147)
365
368
 
366
369
  </details>
367
370