@kenz1117/dsh-ui-usage-billing 1.8.0-alpha.1 → 1.8.0

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
@@ -9,7 +9,7 @@
9
9
  <a href="https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing"><img alt="npm version" src="https://img.shields.io/npm/v/@kenz1117/dsh-ui-usage-billing?logo=npm"></a>
10
10
  <a href="https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@kenz1117/dsh-ui-usage-billing?logo=npm"></a>
11
11
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/kenz1117/dsh-ui-usage-billing/actions/workflows/ci.yml/badge.svg"></a>
12
- <a href="https://github.com/kenz1117/dsh-ui-usage-billing/blob/main/COMPATIBILITY.md"><img alt="DSH compat" src="https://img.shields.io/badge/DSH-0.1.2_%7E_0.2.1--rc.3_%7C_0.1.0--rc.8%2B-blue"></a>
12
+ <a href="https://github.com/kenz1117/dsh-ui-usage-billing/blob/main/COMPATIBILITY.md"><img alt="DSH compat" src="https://img.shields.io/badge/DSH-0.1.2_%7E_0.2.1--rc.4-blue"></a>
13
13
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing/blob/main/LICENSE"><img alt="License MIT" src="https://img.shields.io/github/license/kenz1117/dsh-ui-usage-billing"></a>
14
14
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing/pulls"><img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen"></a>
15
15
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/kenz1117/dsh-ui-usage-billing?logo=github"></a>
@@ -30,7 +30,7 @@
30
30
 
31
31
  ### Demo GIF
32
32
 
33
- The eight dashboard tabs in turn (Overview / Billing / Usage / Trends / Context / Agents / Rates / Settings):
33
+ The eight dashboard tabs in turn (Overview / Queue / Billing / Usage / Trends / Agents / Rates / Settings):
34
34
 
35
35
  ![Demo](screenshots/demo.gif)
36
36
 
@@ -56,11 +56,10 @@ The billing channel is detected from the current session's model: DeepSeek meter
56
56
  - A performance panel: per-model TTFT mean/P50/P90 and generation speed.
57
57
  - Uncatalogued models are explicitly marked and never silently billed 0; one alias entry prices an out-of-catalog model.
58
58
  - An optional `usage_stats` tool lets the model answer "what did I spend today" or "which site used the most".
59
- - **Off-peak task queue (preview)**: nothing is queued until the user explicitly chooses a workspace, a built-in DeepSeek official model and a Prompt. Tasks run FIFO in independent Sessions, start only in the official off-peak window, continue across peak once admitted, and become "Needs review" without automatic replay after failures or unknown outcomes. Relay mirrors are excluded; hosts without Session control fall back to read-only and never create placeholder tasks.
59
+ - **Off-peak task queue (preview)**: nothing is queued until the user explicitly chooses a workspace, a built-in DeepSeek official model and a Prompt. JSON files can be imported in batches; the whole batch is validated before one atomic enqueue, so any invalid item means zero writes. Tasks run FIFO in independent Sessions, start only in the official off-peak window, continue across peak once admitted, and become "Needs review" without automatic replay after failures or unknown outcomes. Relay mirrors are excluded; hosts without Session control fall back to read-only and never create placeholder tasks.
60
60
  - Zero tools registered by default: the single read-only `usage_stats` tool is registered **only** after the user explicitly turns on "inject usage query" in the settings (off by default). No system-prompt injection.
61
61
  - Chinese / English and ¥ / ≈$ toggles; no chart library, no external CDN, offline & self-contained.
62
62
  - **Jump from a session row**: click a session title in the dashboard to open that conversation in the host (both generations of the host's session-selection channel are probed; hosts without one show a readable notice instead of silently doing nothing).
63
- - **Context occupancy**: the overview shows the current session's context occupancy, window capacity, and composition (system / tools / messages), read from the host's official context projections. Sessions without a projection hide the whole card — it never shows a fabricated 0.
64
63
  - **In-conversation entry**: the `/usage` command opens the billing dashboard directly (hosts without that capability degrade silently and leave the dashboard untouched).
65
64
 
66
65
  ## 📊 Dashboard
@@ -69,16 +68,14 @@ The billing channel is detected from the current session's model: DeepSeek meter
69
68
 
70
69
  ![Sidebar trigger card: today's spend, delta badge and mini-trend](screenshots/sidebar.png)
71
70
 
72
- - **Nine-tab dashboard**: Overview / Queue / Billing / Usage / Trends / Context / Agents / Rates / Settings — hero figures + comparisons + month projection + KPIs (hover for the metric definition) + usage heatmap, trends switchable between cost and tokens over 7/30 days, model price table, budgets (global + per model) and peak/off-peak alerts all live here; the settings page supports full-text search (zh/en keywords, empty state when nothing matches); tabs carry names only — no status badges.
73
- - **Queue section**: shows the current price band and switch countdown, queued / starting / running / needs-review / completed tasks and their host Session links. Queued tasks can be removed and finished history cleared; admitted tasks cannot be removed through the queue. A queue file, file lock and owner lease prevent duplicate submission by multiple instances sharing one `DSH_HOME`.
74
- - **Context section**: an occupancy bar plus next-request / last-request occupancy, window capacity and the composition split (system / tools / messages). The figures come from the host's official context projections; a session without one hides the whole section rather than showing a fabricated 0.
71
+ - **Eight-tab dashboard**: Overview / Queue / Billing / Usage / Trends / Agents / Rates / Settings — hero figures + comparisons + month projection + KPIs (hover for the metric definition) + usage heatmap, trends switchable between cost and tokens over 7/30 days, model price table, budgets (global + per model) and peak/off-peak alerts all live here; the settings page supports full-text search (zh/en keywords, empty state when nothing matches); tabs carry names only — no status badges.
72
+ - **Queue section**: shows the current price band and switch countdown, queued / starting / running / needs-review / completed tasks and their host Session links. JSON batch import accepts up to 50 tasks; one invalid item rejects the entire batch without writes. Queued tasks can be removed and finished history cleared; admitted tasks cannot be removed through the queue. A queue file, file lock and owner lease prevent duplicate submission by multiple instances sharing one `DSH_HOME`.
75
73
  - **Agents section**: the agent network rebuilt from delegation relations — a parent conversation → sub-agent tree where each row carries its call count, own cost and **chain total** (itself + all descendants), which directly answers "which delegation was the most expensive".
76
74
 
77
75
  ![Overview: month cost hero, year/today/month projection, KPIs and usage heatmap](screenshots/overview.png)
78
- ![Context: occupancy, window capacity and the system / tools / messages split](screenshots/context.png)
79
76
  ![Agents: parent conversation → sub-agent delegation tree with chain totals](screenshots/agents.png)
80
77
  - **Live cost bar**: persistent "this turn / session" cost with three positions (composer toolbar row / above / below, toolbar by default); the peak/off-peak tier & countdown section appears only when the current model involves peak/off-peak pricing; subscription low-quota chips appear at ≤20% remaining, red at ≤10%; hideable via the settings-tab toggle (display-only preference persisted locally; stats and alerts unaffected).
81
- - **Peak/off-peak switch alert**: a popover plus an optional system notification before a switch; lead time / position / mode / preview configurable; copy differs by billing channel (DeepSeek price halves, Zhipu credits at 50%).
78
+ - **Peak/off-peak switch alert**: a popover plus an optional system notification before a switch; lead time / position / mode / preview configurable; copy differs by billing channel (DeepSeek price halves, Zhipu credits at 50%). When tasks are queued, the alert also explains that they wait for the next off-peak window, start FIFO during off-peak, and continue across peak once started; it never automatically pauses or replays them.
82
79
  - **Session completion notification**: an optional system notification when a session transitions running → completed (off by default, enable it in the panel); multi-window / multi-instance dedup through the claim endpoint, so each session notifies once.
83
80
  - **Plugin info card**: a persistent "About" card in the Settings tab — version read server-side from the package's `package.json` (single source of truth, correct on publish), author / repo / npm / license one click away.
84
81
 
@@ -133,19 +130,15 @@ The billing channel is detected from the current session's model: DeepSeek meter
133
130
 
134
131
  ## 🚀 Quick start
135
132
 
136
- Check your host generation first (`dsh --version`), then pick the matching install command — **a mismatched line is rejected by the DSH Store via the `engines.dsh` declaration** (declared since v1.0.41). Note that `dsh plugin add` requires an explicit `--profile` (otherwise it fails with `required option '--profile <name>' not specified`), and prefer **pinning an exact version** over `@latest` (pnpm's `minimumReleaseAge` cooldown skips freshly published versions and may fall back to the other line):
133
+ One codebase currently supports DSH `0.1.2-alpha.1` through `0.2.2-alpha.2`. 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.0` release, while `alpha` points to `1.8.0-alpha.2`.
137
134
 
138
- - **DSH 0.1.2 ~ 0.2.1 era** (0.1.2-alpha.1 and later; the host's npm `latest` is currently 0.2.1-rc.2 and the preview line has reached 0.2.1-rc.4; `npm ls -g @deepseek-ai/dsh` shows 0.1.2-* ~ 0.2.1-*):
135
+ `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:
139
136
 
140
- ```sh
141
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@latest
142
- ```
143
-
144
- - **DSH 0.1.0-rc.8 ~ 0.1.1-rc.2** (legacy hosts; **this line is frozen** — `stable` points permanently at the final v1.1.17, so existing installs keep working but receive no further releases; rationale and the formal EOL trigger are in [COMPATIBILITY.md](COMPATIBILITY.md)):
137
+ ```sh
138
+ dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.0
139
+ ```
145
140
 
146
- ```sh
147
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@stable
148
- ```
141
+ Default installations can also use `@latest`. Check the host with `dsh --version` or `npm ls -g @deepseek-ai/dsh`.
149
142
 
150
143
  Alternatively, add it to the host `cordis.patch.yml` by hand:
151
144
 
@@ -165,7 +158,7 @@ This plugin also publishes a catalog entry using the Market's **Path A standard
165
158
  https://kenz1117.github.io/dsh-ui-usage-billing/catalog-source.json
166
159
  ```
167
160
 
168
- Market-hosted installs resolve an exact stable version from the npm registry (the Host resolves the install target from npm `latest`; the version listed in the catalog is display-only). The catalog files live in `catalog/` in this repository and are validated in CI before being published by GitHub Pages.
161
+ Market-hosted installs resolve an exact registry release from npm (the Host resolves the install target from npm `latest`; the version listed in the catalog is display-only). The catalog files live in `catalog/` in this repository and are validated in CI before being published by GitHub Pages.
169
162
 
170
163
  ## ⚙️ How it works
171
164
 
@@ -239,7 +232,7 @@ To add a model: append an entry to `BUILTIN_MODEL_CATALOG` in `src/builtin-catal
239
232
 
240
233
  ## 🔌 HTTP API
241
234
 
242
- The public HTTP endpoints and field definitions are documented in source, including usage, pricing, balances, subscriptions, relay quotas and `GET/POST /api/billing/task-queue` (see `src/index.ts`, `src/aggregate.ts`, `src/relay.ts`, `src/routes/task-queue.ts`). The queue returns host capability, workspaces, official models and durable tasks; mutations are limited to enqueue, remove-not-started and clear-finished. All endpoints accept loopback requests only; queue writes additionally require a loopback Origin, JSON Content-Type and a body no larger than 256 KiB.
235
+ The public HTTP endpoints and field definitions are documented in source, including usage, pricing, balances, subscriptions, relay quotas, `GET/POST /api/billing/task-queue` and `GET /api/billing/task-queue-summary` (see `src/index.ts`, `src/aggregate.ts`, `src/relay.ts`, `src/routes/task-queue.ts`). The queue returns host capability, workspaces, official models and durable tasks; mutations are `enqueue` / `enqueueMany`, remove-not-started and clear-finished. The summary returns only the price-band state and queued count, never Prompts. All endpoints accept loopback requests only; queue writes additionally require a loopback Origin, JSON Content-Type and a body no larger than 10 MiB.
243
236
 
244
237
  ## ⚙️ Configuration
245
238
 
@@ -275,21 +268,22 @@ For on-machine debugging: `dsh plugin --profile web add "link:<absolute path to
275
268
 
276
269
  ## 📦 Release
277
270
 
278
- This package is a standalone npm package. Releases go through the preview line (`latest` + `alpha` tags switched together); the stable line (`stable`) is frozen — see [COMPATIBILITY.md](COMPATIBILITY.md).
271
+ 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.0` release, while `alpha` points to `1.8.0-alpha.2`; see [COMPATIBILITY.md](COMPATIBILITY.md).
279
272
 
280
273
  ```sh
281
274
  pnpm test && pnpm run build # full tests + build before release
282
275
  npm publish --access public
283
- npm dist-tag add @kenz1117/dsh-ui-usage-billing@<version> alpha
276
+ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<version> alpha # preview
277
+ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<version> latest # stable
284
278
  ```
285
279
 
286
- The host discovers the browser side automatically via the `dsh.client` declaration (`platform: web`) and the `exports["./client"]` bundle in `package.json` — no registry registration needed. The compatibility matrix is declared per version from real-device testing (`dsh.compatibility.dshReleases`); run `node scripts/check-compat.mjs --peer package.json` before and after publishing to re-verify.
280
+ The host discovers the browser side automatically via the `dsh.client` declaration (`platform: web`) and the `exports["./client"]` bundle in `package.json` — no registry registration needed. The compatibility matrix is declared per version from actual verification (`dsh.compatibility.dshReleases`); run `node scripts/check-compat.mjs` before and after publishing to re-verify.
287
281
 
288
282
  ## 🔐 Permissions & Compatibility (DSH STORE)
289
283
 
290
284
  - **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.
291
285
  - **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.
292
- - **Compatibility**: the preview line (npm `latest`/`alpha`, 1.8.x — kept above the stable line to kill the version inversion) targets DSH `0.1.2-alpha.1` ~ `0.2.1-rc.4` (the host's `latest` currently at 0.2.1-rc.2, preview at 0.2.1-rc.4; the full 0.2.1 series is declared per version); the stable line (npm `stable`, 1.1.x, **frozen**, final v1.1.17) targets legacy hosts `0.1.0-rc.8` ~ `0.1.1-rc.2`. Per-version declarations live in `package.json` under `dsh.compatibility`; the two-line mapping and monitoring mechanism are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
286
+ - **Compatibility**: stable and preview releases from the current `main` share one matrix covering DSH `0.1.2-alpha.1` through `0.2.2-alpha.2`, with 31 per-version declarations. The current stable release is `1.8.0` (npm `latest`), and the current preview is `1.8.0-alpha.2` (npm `alpha`). Release channels and monitoring are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
293
287
  - **Lifecycle**: no `preinstall` / `install` / `postinstall` / `prepare` (ready on install).
294
288
  - **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/*`.
295
289
  - **Build artifacts**: runtime files `lib/*` and `cordis.patch.yml` are committed at the pinned commit and declared in `files`.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/kenz1117/dsh-ui-usage-billing?logo=github"></a>
10
10
  <a href="https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing"><img alt="npm version" src="https://img.shields.io/npm/v/@kenz1117/dsh-ui-usage-billing?logo=npm"></a>
11
11
  <a href="https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@kenz1117/dsh-ui-usage-billing?logo=npm"></a>
12
- <a href="https://github.com/kenz1117/dsh-ui-usage-billing/blob/main/COMPATIBILITY.md"><img alt="DSH 兼容" src="https://img.shields.io/badge/DSH-0.1.2_%7E_0.2.1--rc.3_%7C_0.1.0--rc.8%2B-blue"></a>
12
+ <a href="https://github.com/kenz1117/dsh-ui-usage-billing/blob/main/COMPATIBILITY.md"><img alt="DSH 兼容" src="https://img.shields.io/badge/DSH-0.1.2_%7E_0.2.1--rc.4-blue"></a>
13
13
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing/blob/main/LICENSE"><img alt="License MIT" src="https://img.shields.io/github/license/kenz1117/dsh-ui-usage-billing"></a>
14
14
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing/pulls"><img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen"></a>
15
15
  <a href="https://github.com/kenz1117/dsh-ui-usage-billing"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/kenz1117/dsh-ui-usage-billing?logo=github"></a>
@@ -30,7 +30,7 @@
30
30
 
31
31
  ### 演示动图
32
32
 
33
- 新版仪表盘八个分区逐个切换(概览 / 账单 / 用量 / 趋势 / 上下文 / 智能体 / 费率 / 设置):
33
+ 新版仪表盘八个分区逐个切换(概览 / 队列 / 账单 / 用量 / 趋势 / 智能体 / 费率 / 设置):
34
34
 
35
35
  ![演示](screenshots/demo.gif)
36
36
 
@@ -57,11 +57,10 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
57
57
  - 性能面板:各模型首字延时(TTFT)均值 / P50 / P90 与生成速度,同类少有。
58
58
  - 未收录模型显著标注「未收录」、绝不静默计 0;目录外模型配一条别名即完成识别与计价。
59
59
  - 可选的 `usage_stats` 工具让模型直接回答「今天花了多少」「哪个站点用得最多」。
60
- - **低谷任务队列(预览)**:用户显式选择工作区、内置 DeepSeek 官方模型并提交 Prompt 后,任务才持久化入队;FIFO 串行、每任务独立会话,只在官方低谷启动,已提交任务跨峰继续,失败或结果未知标「需核对」且绝不自动重放。中转站同名模型不参与;宿主缺少会话控制能力时只读降级,不创建假任务。
60
+ - **低谷任务队列(预览)**:用户显式选择工作区、内置 DeepSeek 官方模型并提交 Prompt 后,任务才持久化入队;支持 JSON 文件批量导入,整批校验后一次原子入队,任一无效则零写入。FIFO 串行、每任务独立会话,只在官方低谷启动,已提交任务跨峰继续,失败或结果未知标「需核对」且绝不自动重放。中转站同名模型不参与;宿主缺少会话控制能力时只读降级,不创建假任务。
61
61
  - 默认零工具注入:**仅**当用户在设置里显式开启「注入用量查询」后,才向模型注册 `usage_stats` 这一个只读工具(默认关闭);不注入系统提示。
62
62
  - 中文 / English 语言切换,¥ / ≈$ / ≈€ 币种切换(二者独立);无图表库、无外部 CDN、离线自包含。
63
63
  - **会话行可跳转**:面板里的会话标题点一下直接打开宿主对话(双代会话选择通道自动探测;宿主不支持时给出可读提示,不静默无反应)。
64
- - **上下文占用维度**:概览页显示当前会话的上下文占用率、窗口上限与构成拆解(系统 / 工具 / 消息)——数据取自宿主官方的 context 投影,**没有投影的会话整块不显示**(不拿 0 冒充)。
65
64
  - **对话内入口**:`/usage` 命令直接拉起计费仪表盘(宿主无该能力时静默降级,不影响面板)。
66
65
 
67
66
  ## 📊 仪表盘
@@ -70,16 +69,14 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
70
69
 
71
70
  ![侧边栏触发卡:今日消耗金额、涨跌徽章与迷你趋势](screenshots/sidebar.png)
72
71
 
73
- - **九区仪表盘**:概览 / 队列 / 账单 / 用量 / 趋势 / 上下文 / 智能体 / 费率 / 设置——Hero 大数字 + 环比 + 本月预计 + KPI(悬停显示口径说明)+ 用量热力图,趋势 7/30 天可切费用 / Token,模型单价表、预算(全局 + 按模型)与峰谷提醒都在;设置页支持全文搜索(中英关键词过滤分区,全不命中显示空态);克制冷调、深浅主题自适应。Tab 只保留名称,不再挂状态徽标(信息都在各自分区里)。
74
- - **队列分区**:显示当前峰谷与切换倒计时、待执行 / 执行中 / 需核对 / 已完成任务及宿主会话入口;可移除尚未启动的任务或清除已结束历史,执行中的任务不可从队列删除。队列文件与文件锁 / 租约防止同一 `DSH_HOME` 的多实例重复提交。
75
- - **上下文分区**:占用率进度条 + 下一次 / 最近一次请求占用 + 窗口上限 + 构成拆解(系统 / 工具 / 消息)。数据取自宿主官方 context 投影;**没有投影的会话整块不显示**,不拿 0 冒充。
72
+ - **八区仪表盘**:概览 / 队列 / 账单 / 用量 / 趋势 / 智能体 / 费率 / 设置——Hero 大数字 + 环比 + 本月预计 + KPI(悬停显示口径说明)+ 用量热力图,趋势 7/30 天可切费用 / Token,模型单价表、预算(全局 + 按模型)与峰谷提醒都在;设置页支持全文搜索(中英关键词过滤分区,全不命中显示空态);克制冷调、深浅主题自适应。Tab 只保留名称,不再挂状态徽标(信息都在各自分区里)。
73
+ - **队列分区**:显示当前峰谷与切换倒计时、待执行 / 执行中 / 需核对 / 已完成任务及宿主会话入口;支持 JSON 批量导入(单批最多 50 条),任一条目无效则整批不写入。可移除尚未启动的任务或清除已结束历史,执行中的任务不可从队列删除。队列文件与文件锁 / 租约防止同一 `DSH_HOME` 的多实例重复提交。
76
74
  - **智能体分区**:按委派关系还原的智能体网络——父对话 → 子智能体的层级树,每行给调用数、自身费用与**链合计**(自身 + 全部后代),直接回答「哪次委派最贵」。
77
75
 
78
76
  ![概览:本月费用 Hero、本年 / 今日 / 本月预计、KPI 与用量热力图](screenshots/overview.png)
79
- ![上下文:占用率、窗口上限与系统 / 工具 / 消息构成拆解](screenshots/context.png)
80
77
  ![智能体:父对话 → 子智能体的委派树与链合计](screenshots/agents.png)
81
78
  - **即时代费用条**:常驻「本轮 / 会话」费用,位置三档可选(输入框内部工具行 / 上方 / 下方,默认工具行);峰谷档位与切换倒计时只在当前模型涉及峰谷时出现;订阅额度预警 chips 剩余 ≤20% 浮现、≤10% 标红;可在设置 Tab 整条隐藏(偏好本地持久化,统计与提醒不受影响)。
82
- - **峰 / 谷切换提醒**:切档前弹窗 + 可选系统通知,提前量 / 位置 / 模式 / 预览均可配;文案按计费通道区分(DeepSeek 价格减半、智谱积分 5 折)。
79
+ - **峰 / 谷切换提醒**:切档前弹窗 + 可选系统通知,提前量 / 位置 / 模式 / 预览均可配;文案按计费通道区分(DeepSeek 价格减半、智谱积分 5 折)。有待执行任务时补充队列说明:排队任务等待下一低谷、低谷按顺序启动、已开始任务跨峰继续;不自动暂停或重放任务。
83
80
  - **会话完成提醒**:会话 running → completed 时弹系统通知(默认关闭,面板设置开启);多窗口 / 多实例按认领端点去重,同一会话只提醒一次。
84
81
  - **插件信息卡**:设置 Tab 常驻「关于」卡——版本号服务端读自包 `package.json`(单一来源,发布自动正确),作者 / 仓库 / npm / 许可证一键可达。
85
82
 
@@ -134,19 +131,15 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
134
131
 
135
132
  ## 🚀 快速开始
136
133
 
137
- 先确认宿主代际(`dsh --version`),再按代际选安装命令——**装错线会在市场侧被 `engines.dsh` 声明拦截**(v1.0.41 起声明生效)。注意 `dsh plugin add` 需要显式 `--profile`(缺省会报 `required option '--profile <name>' not specified`),且建议**钉具体版本号**而非 `@latest`(pnpm 的 `minimumReleaseAge` 冷静期会让刚发布的版本被跳过、回退到旧线):
134
+ 当前维护 DSH `0.1.2-alpha.1` ~ `0.2.2-alpha.2` 的一份代码。正式版与预览版共享同一兼容矩阵:正式版使用 npm `latest`,预览版使用 `alpha`。当前 `latest` 指向 `1.8.0` 正式版,`alpha` 指向 `1.8.0-alpha.2` 预览版。
138
135
 
139
- - **DSH 0.1.2 ~ 0.2.1 系**(0.1.2-alpha.1 起,宿主 `latest` 现为 0.2.1-rc.2、预览线已到 0.2.1-rc.4;`npm ls -g @deepseek-ai/dsh` 显示 0.1.2-* ~ 0.2.1-*):
136
+ `dsh plugin add` 需要显式 `--profile`,且建议钉具体版本号,避免包管理器的发布冷静期解析到其他版本。当前正式版安装命令:
140
137
 
141
- ```sh
142
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@latest
143
- ```
144
-
145
- - **DSH 0.1.0-rc.8 ~ 0.1.1-rc.2**(旧宿主,**该线已冻结**——`stable` 永久指向终版 v1.1.17,存量用户照常安装使用,但不再有新版本;冻结依据与正式停用时机见 [COMPATIBILITY.md](COMPATIBILITY.md)):
138
+ ```sh
139
+ dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.0
140
+ ```
146
141
 
147
- ```sh
148
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@stable
149
- ```
142
+ 默认安装也可使用 `@latest`。可用 `dsh --version` 或 `npm ls -g @deepseek-ai/dsh` 确认宿主版本。
150
143
 
151
144
  也可以在宿主 `cordis.patch.yml` 中手动加入:
152
145
 
@@ -168,7 +161,7 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
168
161
  https://kenz1117.github.io/dsh-ui-usage-billing/catalog-source.json
169
162
  ```
170
163
 
171
- 市场托管安装只走 npm registry 的精确稳定版本(安装目标由 Host 解析 npm `latest` 决定,
164
+ 市场托管安装只走 npm registry 的精确发行版本(安装目标由 Host 解析 npm `latest` 决定,
172
165
  目录里列出的版本仅用于展示)。目录文件在本仓 `catalog/` 下,改动由 CI 校验后随
173
166
  GitHub Pages 发布。
174
167
 
@@ -248,7 +241,7 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
248
241
 
249
242
  ## 🔌 HTTP API
250
243
 
251
- 对外 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` 等(见 `src/index.ts`、`src/aggregate.ts`、`src/relay.ts`、`src/routes/task-queue.ts`)。其中 `usage-stats` 返回的 `bySite` 字段为按中转站归组后的用量分布,`relay-quotas` 返回额度与路由诊断;`task-queue` 返回能力、工作区、官方模型和持久任务快照,写操作仅允许入队、移除未启动任务与清理已结束历史。全部端点仅接受回环请求;队列写操作另校验回环 Origin、JSON Content-Type 与 256 KiB body 上限。
244
+ 对外 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 上限。
252
245
 
253
246
  ## ⚙️ 配置
254
247
 
@@ -280,25 +273,26 @@ pnpm lint # 纪律守卫:类型 / 日志 / 空 catch / CSS↔TSX 类
280
273
  pnpm run build # tsc -b && tsdown,产出 lib/index.js 与 lib/client.js
281
274
  ```
282
275
 
283
- 本地真机调试:`dsh plugin --profile web add "link:<本仓绝对路径>"` 把宿主指向本仓,此后改代码 → `pnpm run build` → 重启宿主即生效,无需发 npm(加载链路详解见 [docs/DEV-MODE.md](docs/DEV-MODE.md))。HTTP 契约 e2e 用 `pnpm test:e2e`(需本地 dev host 在跑)。工程约定(双线发布策略、宿主升级 SOP、验收清单)见 [AGENTS.md](AGENTS.md)。
276
+ 本地真机调试:`dsh plugin --profile web add "link:<本仓绝对路径>"` 把宿主指向本仓,此后改代码 → `pnpm run build` → 重启宿主即生效,无需发 npm(加载链路详解见 [docs/DEV-MODE.md](docs/DEV-MODE.md))。HTTP 契约 e2e 用 `pnpm test:e2e`(需本地 dev host 在跑)。工程约定(正式版 / 预览版发布策略、宿主升级 SOP、验收清单)见 [AGENTS.md](AGENTS.md)。
284
277
 
285
278
  ## 📦 发布
286
279
 
287
- 本包为独立 npm 包,发布走预览线(`latest` + `alpha` 双 tag 同步切换);稳定线(`stable`)已冻结,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
280
+ 本包为独立 npm 包,只维护一份 `main` 代码。正式版使用非预发布版本号并切 `latest`,预览版使用预发布版本号并切 `alpha`;当前 `latest` 指向 `1.8.0` 正式版,`alpha` 指向 `1.8.0-alpha.2`,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
288
281
 
289
282
  ```sh
290
283
  pnpm test && pnpm run build # 发版前全量测试 + 构建
291
284
  npm publish --access public
292
- npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> alpha
285
+ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> alpha # 预览版
286
+ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> latest # 正式版
293
287
  ```
294
288
 
295
- 宿主通过 `package.json` 的 `dsh.client` 声明(`platform: web`)与 `exports["./client"]` bundle 自动发现浏览器端,无需注册中心登记。兼容矩阵以真机实测为准、逐版本精确声明(`dsh.compatibility.dshReleases`),发布前后跑 `node scripts/check-compat.mjs --peer package.json` 复核。
289
+ 宿主通过 `package.json` 的 `dsh.client` 声明(`platform: web`)与 `exports["./client"]` bundle 自动发现浏览器端,无需注册中心登记。兼容矩阵以实际验证为准、逐版本精确声明(`dsh.compatibility.dshReleases`),发布前后跑 `node scripts/check-compat.mjs` 复核。
296
290
 
297
291
  ## 🔐 权限与兼容声明(DSH STORE)
298
292
 
299
293
  - **权限等级:high**:读取持久会话日志(文件)、访问多厂商官方 / 订阅 / 余额 / 定价 API(网络)、经凭据 seam 读取 `apiKeyEnv`(凭据)、写入 harness home 下的账本、快照与任务队列(持久状态)。插件自身**不含**命令执行 / Shell;仅用户显式入队时才经宿主创建会话并提交 Prompt,Agent 的工具调用仍由宿主原有权限与审批控制。
300
294
  - **更新通道:`user-reviewed`**:本插件具备文件 / 网络 / 凭据能力,DSH STORE 采用每次安装需本机人工确认的通道;安装前请复核仓库、固定 Commit、生命周期脚本与影响范围。
301
- - **兼容范围**:预览线(npm `latest`/`alpha`,1.8.x,自 v1.2.0 起恒高于稳定线以消除版本号倒挂)适配 DSH `0.1.2-alpha.1` ~ `0.2.1-rc.4`(宿主 `latest` 现指向 0.2.1-rc.2、预览线已到 0.2.1-rc.4;0.2.1 全系列逐版本声明);稳定线(npm `stable`,1.1.x,**已冻结**,终版 v1.1.17)适配旧宿主 `0.1.0-rc.8` ~ `0.1.1-rc.2`。逐版本声明见 `package.json` 的 `dsh.compatibility`,双线对照与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
295
+ - **兼容范围**:当前 `main` 的正式版与预览版共享同一兼容矩阵,适配 DSH `0.1.2-alpha.1` ~ `0.2.2-alpha.2`,共 31 项逐版本声明。当前正式版为 `1.8.0`(npm `latest`),预览版为 `1.8.0-alpha.2`(npm `alpha`)。发行通道与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
302
296
  - **生命周期**:无 `preinstall` / `install` / `postinstall` / `prepare`(安装即用)。
303
297
  - **不冒用官方**:仅新增自有 entry id `ui-usage-billing`;对 `@deepseek-ai/dsh-*` 仅为 `peerDependencies` 依赖(不重复安装 / 不替换 / 不遮蔽官方组件),包名使用第三方命名空间 `@kenz1117/*`。
304
298
  - **打包产物**:运行文件 `lib/*` 与 `cordis.patch.yml` 已随固定 Commit 提交并声明在 `files`。