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

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
@@ -75,7 +75,7 @@ Overview / Queue / Billing / Usage / Trends / Agents / Rates / Settings. The her
75
75
  <details>
76
76
  <summary><strong>Queue, agent and settings details</strong></summary>
77
77
 
78
- - **Queue**: price-band countdown and queued / running / needs-review / completed tasks; up to 50 JSON items per batch, validated atomically. Locks and leases prevent duplicate submission across instances sharing one `DSH_HOME`.
78
+ - **Queue**: price-band countdown and queued / running / needs-review / completed tasks; up to 50 JSON items per batch, validated atomically. Locks and leases prevent duplicate submission across instances sharing one `DSH_HOME`. With “Continue tasks in the source Session” enabled, a task queued from a Session continues inside that Session at the next off-peak window (keeping its context and workspace grouping); the card shows “Will continue in Session X” **before** the run and links to it. A deleted, busy or archived source falls back to a new Session with the reason on the card. New Sessions land in their workspace instead of being orphaned in the sidebar.
79
79
  - **Agents**: a parent conversation → sub-agent tree with own cost and chain total including every descendant.
80
80
  - **Settings**: full-text search, global and per-model budgets, peak alerts, custom prices, native host settings and plugin information; a hidden sidebar entry can be restored from host Settings.
81
81
 
@@ -118,12 +118,12 @@ Overview / Queue / Billing / Usage / Trends / Agents / Rates / Settings. The her
118
118
 
119
119
  ## 🚀 Quick start
120
120
 
121
- One codebase currently supports DSH `0.1.2-alpha.1` through `0.2.2-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.2` release; `alpha` points to `1.8.3-alpha.1` (the Hunyuan Hy4 GA catalog expansion).
121
+ One codebase currently supports DSH `0.1.2-alpha.1` through `0.2.2-rc.1`. 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.3` release (host `0.2.2-rc.1` compatibility, the composer-hover flicker fix and the Hunyuan Hy4 GA catalog expansion); `alpha` points to `1.8.3-alpha.3` (queue tasks continuing inside their source Session), and the next preview starts at `1.8.3-alpha.4`.
122
122
 
123
123
  `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:
124
124
 
125
125
  ```sh
126
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.2
126
+ dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.3
127
127
  ```
128
128
 
129
129
  Default installations can also use `@latest`. Check the host with `dsh --version` or `npm ls -g @deepseek-ai/dsh`.
@@ -261,7 +261,7 @@ For on-machine debugging: `dsh plugin --profile web add "link:<absolute path to
261
261
 
262
262
  ## 📦 Release
263
263
 
264
- 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.2` release, while `alpha` points to `1.8.3-alpha.1`; see [COMPATIBILITY.md](COMPATIBILITY.md).
264
+ 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.3` release, while `alpha` points to `1.8.3-alpha.3`; see [COMPATIBILITY.md](COMPATIBILITY.md).
265
265
 
266
266
  ```sh
267
267
  pnpm test && pnpm run build # full tests + build before release
@@ -276,7 +276,7 @@ The host discovers the browser side automatically via the `dsh.client` declarati
276
276
 
277
277
  - **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.
278
278
  - **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.
279
- - **Compatibility**: stable and preview releases from the current `main` share one matrix covering DSH `0.1.2-alpha.1` through `0.2.2-alpha.3`, with 33 per-version declarations. The current stable release is `1.8.2` (npm `latest`); the preview channel is `1.8.3-alpha.1` (npm `alpha`, the Hunyuan Hy4 GA catalog expansion). Release channels and monitoring are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
279
+ - **Compatibility**: stable and preview releases from the current `main` share one matrix covering DSH `0.1.2-alpha.1` through `0.2.2-rc.1`, with 34 per-version declarations. The current stable release is `1.8.3` (npm `latest`; host `0.2.2-rc.1` compatibility, the composer-hover flicker fix and the Hunyuan Hy4 GA catalog expansion); the preview channel is `1.8.3-alpha.3` (npm `alpha`, queue tasks continuing inside their source Session). Release channels and monitoring are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
280
280
  - **Lifecycle**: no `preinstall` / `install` / `postinstall` / `prepare` (ready on install).
281
281
  - **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/*`.
282
282
  - **Build artifacts**: runtime files `lib/*` and `cordis.patch.yml` are committed at the pinned commit and declared in `files`.
@@ -292,11 +292,11 @@ After the user explicitly enables that setting, exactly **one** read-only tool i
292
292
  | --- | --- | --- |
293
293
  | `usage_stats` | `range`: `today` / `month` / `session` / `all` / `bySite` / `relay` | Queries the usage and estimated cost this plugin already aggregated (CNY, estimated from the official price catalog — not a bill); `session` requires an agent session context |
294
294
 
295
- Boundaries: the tool reads only this plugin's own aggregates — never Session bodies or Prompts — and never writes back to the log or touches Session KV cache. The plugin injects no system prompt. The off-peak queue is not a model tool: it is a separate, explicitly authorized action whose Prompt becomes a user message in a new Session, so it must not be confused with this read-only tool boundary. The tool consumes context on every request, which is why it stays off by default.
295
+ Boundaries: the tool reads only this plugin's own aggregates — never Session bodies or Prompts — and never writes back to the log or touches Session KV cache. The plugin injects no system prompt. The off-peak queue is not a model tool: it is a separate, explicitly authorized action whose Prompt becomes a user message in a host Session (its own new Session by default, or the source Session when “Continue tasks in the source Session” is on), so it must not be confused with this read-only tool boundary. The tool consumes context on every request, which is why it stays off by default.
296
296
 
297
297
  ## ⚠️ Known Limitations and Deferred Work
298
298
 
299
- - **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. 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.
299
+ - **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.
300
300
  - **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).
301
301
  - **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.
302
302
  - **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.
package/README.md CHANGED
@@ -75,7 +75,7 @@
75
75
  <details>
76
76
  <summary><strong>队列、智能体与设置细节</strong></summary>
77
77
 
78
- - **队列**:显示峰谷倒计时和待执行 / 执行中 / 需核对 / 已完成任务;JSON 单批最多 50 条,任一无效则整批不写入。文件锁与租约避免同一 `DSH_HOME` 多实例重复提交。
78
+ - **队列**:显示峰谷倒计时和待执行 / 执行中 / 需核对 / 已完成任务;JSON 单批最多 50 条,任一无效则整批不写入。文件锁与租约避免同一 `DSH_HOME` 多实例重复提交。开启设置里的「任务在来源会话继续」后,从会话入队的任务到点优先在该会话内续跑(保留上下文与工作区分组),卡片上会**事前**显示「计划在会话 X 继续」并可一键跳转;来源会话已删除 / 正在使用 / 已归档时回退为新建会话,卡片注明原因。新建的会话落在其所属工作区下,不再是侧栏里没有分组的孤立会话。
79
79
  - **智能体**:按委派关系还原父对话 → 子智能体树,每行同时给出自身费用与包含全部后代的链合计。
80
80
  - **设置**:全文搜索、全局与按模型预算、峰谷提醒、自定义单价、原生设置页和插件信息卡;侧栏隐藏后可从宿主设置恢复。
81
81
 
@@ -118,12 +118,12 @@
118
118
 
119
119
  ## 🚀 快速开始
120
120
 
121
- 当前维护 DSH `0.1.2-alpha.1` ~ `0.2.2-alpha.3` 的一份代码。正式版与预览版共享同一兼容矩阵:正式版使用 npm `latest`,预览版使用 `alpha`。当前 `latest` 指向 `1.8.2` 正式版;`alpha` 指向 `1.8.3-alpha.1`(混元 Hy4 正式版目录扩容,下一轮预览从 `1.8.3-alpha.2` 起)。
121
+ 当前维护 DSH `0.1.2-alpha.1` ~ `0.2.2-rc.1` 的一份代码。正式版与预览版共享同一兼容矩阵:正式版使用 npm `latest`,预览版使用 `alpha`。当前 `latest` 指向 `1.8.3` 正式版(宿主 0.2.2-rc.1 兼容 + 输入栏悬浮闪烁修复 + 混元 Hy4 正式版目录扩容);`alpha` 指向 `1.8.3-alpha.3`(队列任务在来源会话续跑),下一轮预览从 `1.8.3-alpha.4` 起。
122
122
 
123
123
  `dsh plugin add` 需要显式 `--profile`,且建议钉具体版本号,避免包管理器的发布冷静期解析到其他版本。当前正式版安装命令:
124
124
 
125
125
  ```sh
126
- dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.2
126
+ dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@1.8.3
127
127
  ```
128
128
 
129
129
  默认安装也可使用 `@latest`。可用 `dsh --version` 或 `npm ls -g @deepseek-ai/dsh` 确认宿主版本。
@@ -269,7 +269,7 @@ pnpm run build # tsc -b && tsdown,产出 lib/index.js 与 lib/client.js
269
269
 
270
270
  ## 📦 发布
271
271
 
272
- 本包为独立 npm 包,只维护一份 `main` 代码。正式版使用非预发布版本号并切 `latest`,预览版使用预发布版本号并切 `alpha`;当前 `latest` 指向 `1.8.2` 正式版,`alpha` 指向 `1.8.3-alpha.1`,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
272
+ 本包为独立 npm 包,只维护一份 `main` 代码。正式版使用非预发布版本号并切 `latest`,预览版使用预发布版本号并切 `alpha`;当前 `latest` 指向 `1.8.3` 正式版,`alpha` 指向 `1.8.3-alpha.3`,详见 [COMPATIBILITY.md](COMPATIBILITY.md)。
273
273
 
274
274
  ```sh
275
275
  pnpm test && pnpm run build # 发版前全量测试 + 构建
@@ -284,7 +284,7 @@ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> latest # 正式版
284
284
 
285
285
  - **权限等级:high**:读取持久会话日志(文件)、访问多厂商官方 / 订阅 / 余额 / 定价 API(网络)、经凭据 seam 读取 `apiKeyEnv`(凭据)、写入 harness home 下的账本、快照与任务队列(持久状态)。插件自身**不含**命令执行 / Shell;仅用户显式入队时才经宿主创建会话并提交 Prompt,Agent 的工具调用仍由宿主原有权限与审批控制。
286
286
  - **更新通道:`user-reviewed`**:本插件具备文件 / 网络 / 凭据能力,DSH STORE 采用每次安装需本机人工确认的通道;安装前请复核仓库、固定 Commit、生命周期脚本与影响范围。
287
- - **兼容范围**:当前 `main` 的正式版与预览版共享同一兼容矩阵,适配 DSH `0.1.2-alpha.1` ~ `0.2.2-alpha.3`,共 33 项逐版本声明。当前正式版为 `1.8.2`(npm `latest`),预览通道为 `1.8.3-alpha.1`(npm `alpha`,混元 Hy4 正式版目录扩容)。发行通道与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
287
+ - **兼容范围**:当前 `main` 的正式版与预览版共享同一兼容矩阵,适配 DSH `0.1.2-alpha.1` ~ `0.2.2-rc.1`,共 34 项逐版本声明。当前正式版为 `1.8.3`(npm `latest`,宿主 0.2.2-rc.1 兼容 + 输入栏悬浮闪烁修复 + 混元 Hy4 正式版目录扩容),预览通道为 `1.8.3-alpha.3`(npm `alpha`,队列任务可在来源会话内继续执行)。发行通道与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
288
288
  - **生命周期**:无 `preinstall` / `install` / `postinstall` / `prepare`(安装即用)。
289
289
  - **不冒用官方**:仅新增自有 entry id `ui-usage-billing`;对 `@deepseek-ai/dsh-*` 仅为 `peerDependencies` 依赖(不重复安装 / 不替换 / 不遮蔽官方组件),包名使用第三方命名空间 `@kenz1117/*`。
290
290
  - **打包产物**:运行文件 `lib/*` 与 `cordis.patch.yml` 已随固定 Commit 提交并声明在 `files`。
@@ -300,11 +300,11 @@ npm dist-tag add @kenz1117/dsh-ui-usage-billing@<版本> latest # 正式版
300
300
  | --- | --- | --- |
301
301
  | `usage_stats` | `range`:`today` / `month` / `session` / `all` / `bySite` / `relay` | 查询本插件已聚合的用量与估算费用(人民币,按官方目录价估算,非账单);`session` 需处于 agent 会话上下文 |
302
302
 
303
- 边界声明:该工具只读本插件自己的聚合结果,**不读会话正文、不读提示词、不写回会话日志**,也不触及会话 KV 缓存;插件不注入系统提示。低谷队列不是模型工具,而是用户显式授权的独立路径:入队 Prompt 会作为用户消息写入新会话,不能与前述只读工具边界混为一谈。工具会占用每次请求的上下文,因此保持默认关闭。
303
+ 边界声明:该工具只读本插件自己的聚合结果,**不读会话正文、不读提示词、不写回会话日志**,也不触及会话 KV 缓存;插件不注入系统提示。低谷队列不是模型工具,而是用户显式授权的独立路径:入队 Prompt 会作为用户消息写入宿主会话(默认写入任务自己的新会话;开启「任务在来源会话继续」后写入入队时的那个会话),不能与前述只读工具边界混为一谈。工具会占用每次请求的上下文,因此保持默认关闭。
304
304
 
305
305
  ## ⚠️ Known Limitations and Deferred Work
306
306
 
307
- - **低谷队列仍是预览能力**:只接受宿主内置 `deepseek-official` 路由中具有官方峰谷价的模型,中转站和自定义路由一律排除;不提供自动暂停、取消或失败重试。宿主停止、结果流中断或租约失效后,任务只标记「需核对」,用户应打开对应 Session 确认实际结果后手动决定是否重新入队。
307
+ - **低谷队列仍是预览能力**:只接受宿主内置 `deepseek-official` 路由中具有官方峰谷价的模型,中转站和自定义路由一律排除;不提供自动暂停、取消或失败重试。开启「任务在来源会话继续」后,任务沿用来源会话**当时的模型**(不为它切换模型——那会改动你的全局默认模型),且只在来源会话空闲时续跑;不可用时一律回退为新建会话并注明原因。宿主停止、结果流中断或租约失效后,任务只标记「需核对」,用户应打开对应 Session 确认实际结果后手动决定是否重新入队。
308
308
  - **余额查询已接入 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 增加查询器)。
309
309
  - **中转站额度依赖上游私有 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 口径不变),避免这类失效无声无息。
310
310
  - **超支通知依赖浏览器 Notification**:权限被拒绝或平台不支持时只有界面红色脉冲兜底,没有宿主级通知通道;通知上限为每天一次。