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

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
@@ -56,7 +56,7 @@ 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. 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.
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. An opt-in composer switch can also capture the current draft verbatim with its cwd and model—without sending the current Session or navigating away; drafts are kept by default, with optional clear-after-enqueue. 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).
@@ -68,11 +68,11 @@ The billing channel is detected from the current session's model: DeepSeek meter
68
68
 
69
69
  ![Sidebar trigger card: today's spend, delta badge and mini-trend](screenshots/sidebar.png)
70
70
 
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.
71
+ - **Eight-tab dashboard**: Overview / Queue / Billing / Usage / Trends / Agents / Rates / Settings — the hero and KPIs share today / last 7 days / this week / this month / all time / custom date ranges. Custom ranges default to yesterday, include both local calendar dates, and persist across reloads; comparisons, month projection, KPI definitions and a usage heatmap are also included. Trends switch between cost and tokens over 7/30 days; model prices, budgets (global + per model) and peak/off-peak alerts all live here. Settings support full-text search (zh/en keywords, empty state when nothing matches); tabs carry names only — no status badges.
72
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`.
73
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".
74
74
 
75
- ![Overview: month cost hero, year/today/month projection, KPIs and usage heatmap](screenshots/overview.png)
75
+ ![Overview: range-based hero, year/today/month projection, KPIs and usage heatmap](screenshots/overview.png)
76
76
  ![Agents: parent conversation → sub-agent delegation tree with chain totals](screenshots/agents.png)
77
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).
78
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.
@@ -130,7 +130,7 @@ The billing channel is detected from the current session's model: DeepSeek meter
130
130
 
131
131
  ## 🚀 Quick start
132
132
 
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`.
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.1-alpha.2`.
134
134
 
135
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:
136
136
 
@@ -268,7 +268,7 @@ For on-machine debugging: `dsh plugin --profile web add "link:<absolute path to
268
268
 
269
269
  ## 📦 Release
270
270
 
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).
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.1-alpha.2`; see [COMPATIBILITY.md](COMPATIBILITY.md).
272
272
 
273
273
  ```sh
274
274
  pnpm test && pnpm run build # full tests + build before release
@@ -283,7 +283,7 @@ The host discovers the browser side automatically via the `dsh.client` declarati
283
283
 
284
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.
285
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.
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`.
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.1-alpha.2` (npm `alpha`). Release channels and monitoring are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
287
287
  - **Lifecycle**: no `preinstall` / `install` / `postinstall` / `prepare` (ready on install).
288
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/*`.
289
289
  - **Build artifacts**: runtime files `lib/*` and `cordis.patch.yml` are committed at the pinned commit and declared in `files`.
package/README.md CHANGED
@@ -57,7 +57,7 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
57
57
  - 性能面板:各模型首字延时(TTFT)均值 / P50 / P90 与生成速度,同类少有。
58
58
  - 未收录模型显著标注「未收录」、绝不静默计 0;目录外模型配一条别名即完成识别与计价。
59
59
  - 可选的 `usage_stats` 工具让模型直接回答「今天花了多少」「哪个站点用得最多」。
60
- - **低谷任务队列(预览)**:用户显式选择工作区、内置 DeepSeek 官方模型并提交 Prompt 后,任务才持久化入队;支持 JSON 文件批量导入,整批校验后一次原子入队,任一无效则零写入。FIFO 串行、每任务独立会话,只在官方低谷启动,已提交任务跨峰继续,失败或结果未知标「需核对」且绝不自动重放。中转站同名模型不参与;宿主缺少会话控制能力时只读降级,不创建假任务。
60
+ - **低谷任务队列(预览)**:用户显式选择工作区、内置 DeepSeek 官方模型并提交 Prompt 后,任务才持久化入队;也可在对话页开启默认关闭的「低谷队列」开关,将当前草稿按原文一键入队,沿用当前 cwd 与模型,不发送当前会话、不跳转,默认保留草稿并可选入队后清稿。支持 JSON 文件批量导入,整批校验后一次原子入队,任一无效则零写入。FIFO 串行、每任务独立会话,只在官方低谷启动,已提交任务跨峰继续,失败或结果未知标「需核对」且绝不自动重放。中转站同名模型不参与;宿主缺少会话控制能力时只读降级,不创建假任务。
61
61
  - 默认零工具注入:**仅**当用户在设置里显式开启「注入用量查询」后,才向模型注册 `usage_stats` 这一个只读工具(默认关闭);不注入系统提示。
62
62
  - 中文 / English 语言切换,¥ / ≈$ / ≈€ 币种切换(二者独立);无图表库、无外部 CDN、离线自包含。
63
63
  - **会话行可跳转**:面板里的会话标题点一下直接打开宿主对话(双代会话选择通道自动探测;宿主不支持时给出可读提示,不静默无反应)。
@@ -69,11 +69,11 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
69
69
 
70
70
  ![侧边栏触发卡:今日消耗金额、涨跌徽章与迷你趋势](screenshots/sidebar.png)
71
71
 
72
- - **八区仪表盘**:概览 / 队列 / 账单 / 用量 / 趋势 / 智能体 / 费率 / 设置——Hero 大数字 + 环比 + 本月预计 + KPI(悬停显示口径说明)+ 用量热力图,趋势 7/30 天可切费用 / Token,模型单价表、预算(全局 + 按模型)与峰谷提醒都在;设置页支持全文搜索(中英关键词过滤分区,全不命中显示空态);克制冷调、深浅主题自适应。Tab 只保留名称,不再挂状态徽标(信息都在各自分区里)。
72
+ - **八区仪表盘**:概览 / 队列 / 账单 / 用量 / 趋势 / 智能体 / 费率 / 设置——Hero 与 KPI 支持今天 / 近 7 天 / 本周 / 本月 / 累计 / 自定义日期,自定义按本地完整日历日闭区间统计,默认昨天并持久化起止日期;另有环比、本月预计、KPI 口径提示与用量热力图,趋势 7/30 天可切费用 / Token,模型单价表、预算(全局 + 按模型)与峰谷提醒都在;设置页支持全文搜索(中英关键词过滤分区,全不命中显示空态);克制冷调、深浅主题自适应。Tab 只保留名称,不再挂状态徽标(信息都在各自分区里)。
73
73
  - **队列分区**:显示当前峰谷与切换倒计时、待执行 / 执行中 / 需核对 / 已完成任务及宿主会话入口;支持 JSON 批量导入(单批最多 50 条),任一条目无效则整批不写入。可移除尚未启动的任务或清除已结束历史,执行中的任务不可从队列删除。队列文件与文件锁 / 租约防止同一 `DSH_HOME` 的多实例重复提交。
74
74
  - **智能体分区**:按委派关系还原的智能体网络——父对话 → 子智能体的层级树,每行给调用数、自身费用与**链合计**(自身 + 全部后代),直接回答「哪次委派最贵」。
75
75
 
76
- ![概览:本月费用 Hero、本年 / 今日 / 本月预计、KPI 与用量热力图](screenshots/overview.png)
76
+ ![概览:按所选范围显示的 Hero、本年 / 今日 / 本月预计、KPI 与用量热力图](screenshots/overview.png)
77
77
  ![智能体:父对话 → 子智能体的委派树与链合计](screenshots/agents.png)
78
78
  - **即时代费用条**:常驻「本轮 / 会话」费用,位置三档可选(输入框内部工具行 / 上方 / 下方,默认工具行);峰谷档位与切换倒计时只在当前模型涉及峰谷时出现;订阅额度预警 chips 剩余 ≤20% 浮现、≤10% 标红;可在设置 Tab 整条隐藏(偏好本地持久化,统计与提醒不受影响)。
79
79
  - **峰 / 谷切换提醒**:切档前弹窗 + 可选系统通知,提前量 / 位置 / 模式 / 预览均可配;文案按计费通道区分(DeepSeek 价格减半、智谱积分 5 折)。有待执行任务时补充队列说明:排队任务等待下一低谷、低谷按顺序启动、已开始任务跨峰继续;不自动暂停或重放任务。
@@ -131,7 +131,7 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
131
131
 
132
132
  ## 🚀 快速开始
133
133
 
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` 预览版。
134
+ 当前维护 DSH `0.1.2-alpha.1` ~ `0.2.2-alpha.2` 的一份代码。正式版与预览版共享同一兼容矩阵:正式版使用 npm `latest`,预览版使用 `alpha`。当前 `latest` 指向 `1.8.0` 正式版,`alpha` 指向 `1.8.1-alpha.2` 预览版。
135
135
 
136
136
  `dsh plugin add` 需要显式 `--profile`,且建议钉具体版本号,避免包管理器的发布冷静期解析到其他版本。当前正式版安装命令:
137
137
 
@@ -277,7 +277,7 @@ pnpm run build # tsc -b && tsdown,产出 lib/index.js 与 lib/client.js
277
277
 
278
278
  ## 📦 发布
279
279
 
280
- 本包为独立 npm 包,只维护一份 `main` 代码。正式版使用非预发布版本号并切 `latest`,预览版使用预发布版本号并切 `alpha`;当前 `latest` 指向 `1.8.0` 正式版,`alpha` 指向 `1.8.0-alpha.2`,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
280
+ 本包为独立 npm 包,只维护一份 `main` 代码。正式版使用非预发布版本号并切 `latest`,预览版使用预发布版本号并切 `alpha`;当前 `latest` 指向 `1.8.0` 正式版,`alpha` 指向 `1.8.1-alpha.2`,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
281
281
 
282
282
  ```sh
283
283
  pnpm test && pnpm run build # 发版前全量测试 + 构建
@@ -292,7 +292,7 @@ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> latest # 正式版
292
292
 
293
293
  - **权限等级:high**:读取持久会话日志(文件)、访问多厂商官方 / 订阅 / 余额 / 定价 API(网络)、经凭据 seam 读取 `apiKeyEnv`(凭据)、写入 harness home 下的账本、快照与任务队列(持久状态)。插件自身**不含**命令执行 / Shell;仅用户显式入队时才经宿主创建会话并提交 Prompt,Agent 的工具调用仍由宿主原有权限与审批控制。
294
294
  - **更新通道:`user-reviewed`**:本插件具备文件 / 网络 / 凭据能力,DSH STORE 采用每次安装需本机人工确认的通道;安装前请复核仓库、固定 Commit、生命周期脚本与影响范围。
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`。
295
+ - **兼容范围**:当前 `main` 的正式版与预览版共享同一兼容矩阵,适配 DSH `0.1.2-alpha.1` ~ `0.2.2-alpha.2`,共 31 项逐版本声明。当前正式版为 `1.8.0`(npm `latest`),预览版为 `1.8.1-alpha.2`(npm `alpha`)。发行通道与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
296
296
  - **生命周期**:无 `preinstall` / `install` / `postinstall` / `prepare`(安装即用)。
297
297
  - **不冒用官方**:仅新增自有 entry id `ui-usage-billing`;对 `@deepseek-ai/dsh-*` 仅为 `peerDependencies` 依赖(不重复安装 / 不替换 / 不遮蔽官方组件),包名使用第三方命名空间 `@kenz1117/*`。
298
298
  - **打包产物**:运行文件 `lib/*` 与 `cordis.patch.yml` 已随固定 Commit 提交并声明在 `files`。