@mars-sea/dsh-commandcode-provider 0.13.1 → 0.13.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/CHANGELOG.md +19 -0
- package/README.md +13 -7
- package/README.zh-CN.md +11 -5
- package/lib/client.js +55 -18
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +24 -1
- package/lib/index.js +175 -48
- package/lib/index.js.map +1 -1
- package/package.json +39 -38
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.13.2] - 2026-10-15
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- 采纳 dsh `0.2.1-alpha.3` 的 `LlmAdapter.imageRequestTarget`(图片请求目标):适配器把本路由**实际发送**的图片尺寸与编码字节上限(长边 1568、1 MiB)上报给宿主,替代基类默认的「归一化原图」。宿主的截图类调用方此前会按 2880×1800 这类原图尺寸和原始字节数估算,与本路由重新编码后真正上线的内容不一致。
|
|
12
|
+
- 把**压缩摘要请求**计入会话费用读数与历史模型分析。上下文压缩会额外发出一次模型请求,用量记在 `compaction/summary` 事件上;该请求走压缩器自己的 `ctx.llm.stream()`,不产生 `request/header` 与 `assistant/*` 结算事件,因此此前被系统性漏计——而 `0.2.1-alpha.3` 把自动压缩放进极简模式默认组合后,漏计从偶发变成常态。现在按事件自带的 provider 与 model 计价,只认 `commandcode`,其他路由写的摘要仍不计价。费用投影新增 `summaryTokens`,记录「已计入成本但不在宿主 `tokenUsage` 内」的那部分;读数端的对账等式改为 `groups 合计 − summaryTokens === tokenUsage` 并**保持严格相等**,两侧仍须描述同一个耐久切面。升级前持久化的会话状态没有该字段,解析时补零而不是被拒绝。
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- 引擎兼容替换为 `0.2.0-rc.2 || 0.2.1-alpha.3`:每条通道只保留官方最新且已验证的一版,`0.2.1-alpha.2` 由 `0.2.1-alpha.3` 替换(与 2026-10-14 核对的 npm `alpha` 标签一致)。`@deepseek-ai/dsh-*` peer 析取、`dsh.compatibility.dsh`、`engines.dsh`、`devDependencies`、`package-lock.json` 与 `dsh.compatibility.dshReleases` 同批同步;`@deepseek-ai/cordis`(`~4.0.4 || ~4.0.5-alpha.1`)与 `@deepseek-ai/schemastery`(`~3.18.4 || ~3.18.5-alpha.1`)范围**不变**——alpha.3 配对的正是 `4.0.5-alpha.2` 与 `3.18.5-alpha.2`,与该范围分支同 major.minor.patch,已被覆盖。逐文件对比与真实引擎验证确认**适配器与客户端运行时代码零改动**;`scripts/verify-engine-load.mjs` 的探针另做引擎感知适配,见下条。
|
|
17
|
+
- 测试采集脚本改为**引擎感知**:`0.2.1-alpha.3` 的 `TypertGatewayService` 新增必需注入 `remoteAccess`(缺失时 cordis 让网关停在未激活态),且 `InvokeRemoteRequest.peer` 由可选变必需。新增 `engineOwnerPeer()` 与 `pluginEngineRemoteAccess()` 两个探测式助手:新引擎构造 owner Peer 并注册远端访问服务,旧引擎没有 `dsh-api-remote-access` 包、`dsh-client-connection` 也没有 `Peer`(只有 `OperatorPeer`),按能力跳过。两个已声明引擎共用同一套探针,不按版本分叉。
|
|
18
|
+
- 凭据解析层序随上游反转,并落到文档与错误文案:`0.2.1-alpha.3` 起托管存储(`$DSH_HOME/.credentials.yaml`)**优先于**继承的进程环境(此前相反),`describe()` 恒返回 `writable: true`、写入不再因环境变量遮蔽被拒;同时 **headless(无头)profile 有意不再挂载凭据服务**,一次性任务只认启动环境与 `.env`,因此只在页面上保存过 key 的运行会报 `MISSING_CREDENTIAL`。插件对服务缺席本来就有回落守卫(process → 项目 `.env` → `$DSH_HOME/.env`),本次不改装配、只改 `MISSING_CREDENTIAL` 文案与两份 README、[账号与重试](docs/agent-reference/accounts-and-retry.md)的描述。
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- 问题 #85 的诊断缺口:通用 HTTP(网络响应)错误分别保留经过长度和字符校验的 `code`(错误码)与 `type`(错误类型),不回显上游正文;三个传输协议的错误分类、重试及失败请求号契约保持一致。
|
|
23
|
+
- 问题 #84:Messages(消息接口)端点以 403 加结构化 `permission_error`(权限错误)拒绝时,改用 CLI(命令行协议)直连 `/alpha/generate` 重试同一账号;触发面只认这一种标识,其余权限失败原样上报,且该回退不写入协议缓存。回退后仍失败时,错误文案以 CLI 结果为主并附先前的反代拒绝标识。核查日在本机 GOAT(`individual-goat`)账号实测:反代与 CLI 两条路径均正常返回,报告者的现象未能复现,本次按传输层缺口做防御性修复。
|
|
24
|
+
- 修复八条 CodeQL(代码安全分析)告警对应位置:六处测试/引擎验证的网址判断改为解析后精确比较来源;价格维护脚本改用 HTML(网页标记)解析器提取文本。同时补齐逐模型价格覆盖校验,缺行、歧义名称、不可解析或未公开数值时拒绝候选快照,免费行明确核对零价,避免总覆盖率通过却遗漏个别模型。
|
|
25
|
+
|
|
7
26
|
## [0.13.1] - 2026-10-14
|
|
8
27
|
|
|
9
28
|
### Changed
|
package/README.md
CHANGED
|
@@ -29,18 +29,18 @@ Unofficial [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harnes
|
|
|
29
29
|
- **Reasoning-effort support** — models with selectable reasoning effort levels expose them in the picker.
|
|
30
30
|
- **Image input** — Vision-capable models accept images.
|
|
31
31
|
- **Plans & quota panel** — an optional Command Code card at the bottom of the sidebar (directly above Settings) shows the serving account's plan and its 5-hour and weekly windows; clicking it opens a dashboard with the billing period, both windows as progress bars with reset times, monthly credit consumption, and the purchased/free balances. The dashboard's **×** button hands the center column back to your conversation (the current session is untouched). **Off by default** — turn on *"Show the quota card in the sidebar"* under **Settings → Command Code → Integrations & display** to show it, and the same switch hides it again (a hidden card draws nothing at all and runs no background usage poll); the change lands as soon as you save. The panel follows your harness language (中文 / English).
|
|
32
|
-
- **Session cost estimate** — published-rate estimates (`≈`) beside the composer token counter and in its usage dialog, using each request's model, request time and context tier from durable session history. Model switches and viewing the session later do not reprice earlier requests. Mixed-provider or unpriced usage shows a labeled subtotal (`≥`); missing history or wholly unpriceable usage stays hidden. These are estimates from the installed price snapshot, not provider invoices. Also English on every harness language.
|
|
32
|
+
- **Session cost estimate** — published-rate estimates (`≈`) beside the composer token counter and in its usage dialog, using each request's model, request time and context tier from durable session history. Model switches and viewing the session later do not reprice earlier requests. Mixed-provider or unpriced usage shows a labeled subtotal (`≥`); missing history or wholly unpriceable usage stays hidden. Automatic and manual compaction inside a session sends one extra model request, recorded on the `compaction/summary` event; that usage is now priced into the Command Code cost, and into the historical model analysis, while summaries written by other providers stay unpriced. These are estimates from the installed price snapshot, not provider invoices. Also English on every harness language.
|
|
33
33
|
- **Web search** — the dsh `web_search` tool is backed by the Command Code Provider API (`/alpha/web-search`) with the same key/endpoint as chat, so no separate search key or base URL is needed. See [Web search](#web-search).
|
|
34
34
|
|
|
35
35
|
See [Screenshots](#screenshots) below for what the UI looks like.
|
|
36
36
|
|
|
37
37
|
## Install
|
|
38
38
|
|
|
39
|
-
This release supports **dsh 0.2.0-rc.2 (RC) and dsh 0.2.1-alpha.
|
|
39
|
+
This release supports **dsh 0.2.0-rc.2 (RC) and dsh 0.2.1-alpha.3 (alpha)**.
|
|
40
40
|
The compatibility policy keeps the latest verified official release candidate
|
|
41
41
|
and alpha release, one per channel. These match npm's `latest` and `alpha` tags
|
|
42
|
-
as checked on 2026-10-
|
|
43
|
-
these two exact versions. A profile on `0.2.1-alpha.
|
|
42
|
+
as checked on 2026-10-14. The peer range and compatibility records name only
|
|
43
|
+
these two exact versions. A profile on `0.2.1-alpha.2` must upgrade its engine
|
|
44
44
|
before installing this build:
|
|
45
45
|
|
|
46
46
|
```sh
|
|
@@ -75,7 +75,7 @@ Fresh pnpm 10 marketplace generations are supported directly. Every Harness pack
|
|
|
75
75
|
Update with the same tag you installed with:
|
|
76
76
|
|
|
77
77
|
```sh
|
|
78
|
-
dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 or 0.2.1-alpha.
|
|
78
|
+
dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 or 0.2.1-alpha.3
|
|
79
79
|
dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@0.9.1 # older dsh (0.5.0 line, unmaintained)
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -128,7 +128,12 @@ Then pick the provider in the model selector, or name it directly:
|
|
|
128
128
|
|
|
129
129
|
**Picking models.** That page lists the whole catalog as checkboxes, grouped by plan tier (Go → GOAT → Pro → Provider) with the free models first, so nothing has to be typed from memory. Everything starts checked, because an unset allowlist means "show every model" — uncheck the ones you do not want in the picker. The choice is stored as per-model overrides next to the `visibleModels` list the web page edits, so both surfaces can be used interchangeably and a plain `visibleModels` written by hand still works.
|
|
130
130
|
|
|
131
|
-
Alternatively, set the key outside the TUI
|
|
131
|
+
Alternatively, set the key outside the TUI. The first match wins:
|
|
132
|
+
|
|
133
|
+
- A literal `apiKey` written into the composition config wins over everything else and is always used.
|
|
134
|
+
- Otherwise the credential reference is resolved (`apiKeyEnv`, `COMMANDCODE_API_KEY` by default). In a profile that **mounts the credentials service** — Web, desktop, SDK, ACP — that service owns the layer order: **from 0.2.1-alpha.3 on, a saved credential wins over the launching environment**, with the environment and `.env` as the fallback; 0.2.1-alpha.2 and earlier were the other way round, with the environment first.
|
|
135
|
+
- A **headless profile deliberately mounts no credentials service**, so only the launching environment, the project `.env`, and `$DSH_HOME/.env` apply — **a key saved on the page never reaches a headless run**. Export the variable or write a `.env` for those runs.
|
|
136
|
+
- The last resort is `~/.commandcode/auth.json`, written by the official CLI.
|
|
132
137
|
|
|
133
138
|
```sh
|
|
134
139
|
export COMMANDCODE_API_KEY="user_..." # launching environment
|
|
@@ -149,7 +154,7 @@ cmd login # writes ~/.commandcode/auth.json
|
|
|
149
154
|
cwd: !!js process.cwd()
|
|
150
155
|
```
|
|
151
156
|
|
|
152
|
-
**Engine version.** The plugin is maintained against two engines: **dsh 0.2.0-rc.2** and **dsh 0.2.1-alpha.
|
|
157
|
+
**Engine version.** The plugin is maintained against two engines: **dsh 0.2.0-rc.2** and **dsh 0.2.1-alpha.3**. Its `@deepseek-ai/dsh-*` peers use `0.2.0-rc.2 || 0.2.1-alpha.3`, while `@deepseek-ai/cordis` and `@deepseek-ai/schemastery` retain their engine-paired ranges `~4.0.4 || ~4.0.5-alpha.1` and `~3.18.4 || ~3.18.5-alpha.1`. Compatibility records contain exactly these two engines. Each channel upgrade replaces its previous version after verification; it does not accumulate supported releases or admit unverified neighbours. Both `npm run test:engine` and `npm run test:install` check each retained version. See [Install](#install) for older engines.
|
|
153
158
|
|
|
154
159
|
## Usage dashboard
|
|
155
160
|
|
|
@@ -244,6 +249,7 @@ Command Code can serve a request only through upstreams that retain no prompts o
|
|
|
244
249
|
## Notes & limitations
|
|
245
250
|
|
|
246
251
|
- **Image input is model-gated** — only Vision models accept images; text-only models refuse them.
|
|
252
|
+
- **Image size is reported as sent** — the adapter overrides `imageRequestTarget` with the target this route actually puts on the wire: long edge 1568, encoded bytes capped at 1 MiB. The harness's screenshot callers therefore size against what the gateway receives instead of the normalized original.
|
|
247
253
|
- Switching to a text-only model in an image-bearing session is rejected by dsh — pick a model marked *`Image`* or remove the images first.
|
|
248
254
|
- **Long image-heavy sessions keep working** — the provider caps the size of a single request (around 50 MB, and it is undocumented), so a session that accumulates many screenshots would otherwise start failing every request once it grew past that. The oldest images beyond the budget are replaced by a short "image omitted" note that names the attachment, the newest ones are sent as usual, and a request the provider still rejects as too large is retried once with a much smaller image budget before failing.
|
|
249
255
|
- **No `stop` sequences** — requests carrying one fail.
|
package/README.zh-CN.md
CHANGED
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
- **推理强度支持**:支持推理强度的模型可在选择器中选择档位。
|
|
30
30
|
- **图片输入**:Vision 模型支持发送图片。
|
|
31
31
|
- **套餐与配额面板**:可选的 Command Code 卡片位于侧边栏底部(Settings 正上方),显示当前服务账号的套餐与 5 小时 / 每周两个配额窗口;点击后在中间栏打开面板,包含计费周期、两个窗口的进度条与重置时间、月度额度消耗,以及已购买 / 赠送余额。面板右上角的 **×** 按钮可随时把中间栏交还给会话(不会切换当前会话)。**默认关闭**——在 **设置 → Command Code → 集成与显示** 中打开「在侧边栏显示额度卡片」即可显示,同一开关也能随时隐藏(隐藏时左侧不渲染任何内容,也不会为其后台刷新用量)。面板文案跟随 Harness 显示语言(中文 / English)。
|
|
32
|
-
- **会话费用估算**:在输入框下方的 token
|
|
32
|
+
- **会话费用估算**:在输入框下方的 token 计数旁及用量对话框中显示估算金额(`≈`),根据持久化历史中每次请求的模型、请求时间和上下文阶梯分别计价。切换模型或稍后查看不会重新定价之前的请求。混合供应商或缺少费率时显示已定价部分的小计(`≥`);缺少历史事实或完全无法定价时不显示金额。会话内的自动/手动 compaction(上下文压缩)会额外发一次模型请求,其用量记在 `compaction/summary` 事件上,现在同样计入 Command Code 成本(历史模型分析一并计入);其他 provider 写的摘要仍不计价。结果基于插件内的价格快照,不等同于供应商账单。同样固定为英文。
|
|
33
33
|
- **联网搜索**:dsh 的 `web_search` 工具由 Command Code Provider API(`/alpha/web-search`)承载,复用聊天同一个 key 与端点,无需单独配置搜索 key 或地址。详见[联网搜索](#联网搜索)。
|
|
34
34
|
|
|
35
35
|
## 安装
|
|
36
36
|
|
|
37
|
-
本版本**只支持 dsh 0.2.0-rc.2(RC,候选发布版)与 dsh 0.2.1-alpha.
|
|
37
|
+
本版本**只支持 dsh 0.2.0-rc.2(RC,候选发布版)与 dsh 0.2.1-alpha.3(alpha,早期测试版)**。维护策略为每条通道只保留官方最新且经过验证的一个版本;2026-10-14 核对时分别对应 npm 的 `latest` 与 `alpha` 发布标签。peer(对等依赖)范围和兼容记录只列这两个精确版本。使用 `0.2.1-alpha.2` 的配置需先升级引擎,再安装本构建:
|
|
38
38
|
|
|
39
39
|
```sh
|
|
40
40
|
dsh plugin --profile web add @mars-sea/dsh-commandcode-provider@latest
|
|
@@ -63,7 +63,7 @@ dsh plugin --profile web add @mars-sea/dsh-commandcode-provider@0.11.15
|
|
|
63
63
|
用与安装时相同的 tag 更新:
|
|
64
64
|
|
|
65
65
|
```sh
|
|
66
|
-
dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 或 0.2.1-alpha.
|
|
66
|
+
dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 或 0.2.1-alpha.3
|
|
67
67
|
dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@0.9.1 # 更早的 dsh(0.5.0 线,不再维护)
|
|
68
68
|
```
|
|
69
69
|
|
|
@@ -116,7 +116,12 @@ dsh plugin --profile dsh-tui add @mars-sea/dsh-commandcode-provider@0.11.15
|
|
|
116
116
|
|
|
117
117
|
**选择模型。** 同一页面把整个模型目录列成勾选框,按套餐档位分组(Go → GOAT → Pro → Provider),免费模型排在最前,不需要手打任何模型 id。默认全部勾选——未设置白名单就等于"显示全部模型";把不想在选择器里看到的取消勾选即可。选择会以「单模型覆盖」的形式保存在网页端编辑的 `visibleModels` 列表旁边,两个界面可以混用,手写的 `visibleModels` 也照常生效。
|
|
118
118
|
|
|
119
|
-
也可以在终端外配置 key
|
|
119
|
+
也可以在终端外配置 key。凭据解析先命中者生效,顺序如下:
|
|
120
|
+
|
|
121
|
+
- 组合配置里写死的字面量 `apiKey` 最优先,写了就一直用它。
|
|
122
|
+
- 否则按凭据引用解析(`apiKeyEnv`,默认 `COMMANDCODE_API_KEY`)。在 **Web、桌面端、SDK、ACP 等挂载了凭据服务的 profile** 里由凭据服务统一解析:**0.2.1-alpha.3 起已保存的凭据优先于启动环境变量**,启动环境变量与 `.env` 是其后的回退;0.2.1-alpha.2 及更早的顺序相反,那时环境变量优先。
|
|
123
|
+
- **headless(无头)profile 有意不挂载凭据服务**,因此只有启动环境变量、项目 `.env`、`$DSH_HOME/.env` 生效 —— **在页面上保存过的 key 不会到达 headless 运行**,请为这类运行导出变量或写 `.env`。
|
|
124
|
+
- 最后兜底是官方 CLI 写入的 `~/.commandcode/auth.json`。
|
|
120
125
|
|
|
121
126
|
```sh
|
|
122
127
|
export COMMANDCODE_API_KEY="user_..." # 启动环境变量
|
|
@@ -137,7 +142,7 @@ cmd login # 写入 ~/.commandcode/auth.json
|
|
|
137
142
|
cwd: !!js process.cwd()
|
|
138
143
|
```
|
|
139
144
|
|
|
140
|
-
**引擎版本要求。** 插件维护两个引擎:**dsh 0.2.0-rc.2** 与 **dsh 0.2.1-alpha.
|
|
145
|
+
**引擎版本要求。** 插件维护两个引擎:**dsh 0.2.0-rc.2** 与 **dsh 0.2.1-alpha.3**。`@deepseek-ai/dsh-*` 的 peer(对等依赖)为 `0.2.0-rc.2 || 0.2.1-alpha.3`;`@deepseek-ai/cordis` 与 `@deepseek-ai/schemastery` 仍使用随引擎配对的范围 `~4.0.4 || ~4.0.5-alpha.1` 与 `~3.18.4 || ~3.18.5-alpha.1`。兼容记录恰好包含两个版本,同通道升级验证后替换旧版,不累加已支持版本、不放行未验证的邻近版本。`npm run test:engine` 与 `npm run test:install` 均逐版本验证。旧引擎安装说明见[安装](#安装)。
|
|
141
146
|
|
|
142
147
|
## 用量面板
|
|
143
148
|
|
|
@@ -232,6 +237,7 @@ Command Code 可以让请求只经由「不留存提示词与回复、也不用
|
|
|
232
237
|
## 注意事项与限制
|
|
233
238
|
|
|
234
239
|
- **图片输入按模型能力限制**:仅 Vision 模型接受图片,纯文本模型会直接拒绝。
|
|
240
|
+
- **图片尺寸按实际请求上报**:适配器覆盖 `imageRequestTarget`(图片请求目标),把本路由真正发送的目标上报给宿主 —— 长边 1568、编码后上限 1 MiB;宿主的截图类调用方据此估算,拿到的是网关实际收到的尺寸与字节数,而不是归一化原图。
|
|
235
241
|
- 含图片的会话切换到纯文本模型会被 dsh 拒绝——请改选带 *`Image`* 标记的模型,或先移除图片。
|
|
236
242
|
- **图片很多的长会话不会中途失效**:服务端对单次请求体有大小上限(约 50 MB,官方未公开),会话累积大量截图后,原本会在此后每一次请求都失败。现在超出预算的最旧图片会被替换成一段标明附件的"图片已省略"文字,较新的图片照常发送;若请求仍被判为过大,会先以更小的图片预算重试一次,再报错。
|
|
237
243
|
- **不支持 `stop` 序列**:携带它的请求会报错。
|
package/lib/client.js
CHANGED
|
@@ -1538,6 +1538,14 @@ window.__ModuleLoader__.load({
|
|
|
1538
1538
|
function formatResetAt(ms) {
|
|
1539
1539
|
return ms <= 0 ? "" : new Date(ms).toLocaleString();
|
|
1540
1540
|
}
|
|
1541
|
+
/** 只有官方汇总与订阅共同确认同一起点,才展示完整账期;旧宿主和部分响应保持未知。 */
|
|
1542
|
+
function formatUsageBillingPeriod(usageStart, planStart, planEnd) {
|
|
1543
|
+
if (usageStart === void 0 || planStart !== usageStart || planEnd === void 0 || usageStart <= 0 || planEnd <= usageStart) return "";
|
|
1544
|
+
const start = new Date(usageStart);
|
|
1545
|
+
const end = new Date(planEnd);
|
|
1546
|
+
if (!Number.isFinite(start.getTime()) || !Number.isFinite(end.getTime())) return "";
|
|
1547
|
+
return `${start.toLocaleDateString()} – ${end.toLocaleDateString()}`;
|
|
1548
|
+
}
|
|
1541
1549
|
//#endregion
|
|
1542
1550
|
//#region src/client/usage.ts
|
|
1543
1551
|
const IDLE$1 = {
|
|
@@ -2203,6 +2211,7 @@ window.__ModuleLoader__.load({
|
|
|
2203
2211
|
totalCredits: numberField(usage, "totalCredits", "usage.totalCredits"),
|
|
2204
2212
|
periodBasis: stringField$1(usage, "periodBasis", "usage.periodBasis")
|
|
2205
2213
|
};
|
|
2214
|
+
if (usage.periodStart !== void 0) report.usage.periodStart = numberField(usage, "periodStart", "usage.periodStart");
|
|
2206
2215
|
}
|
|
2207
2216
|
if (source.credits !== void 0) {
|
|
2208
2217
|
const credits = record$1(source.credits, "credits");
|
|
@@ -2230,6 +2239,7 @@ window.__ModuleLoader__.load({
|
|
|
2230
2239
|
monthlyCredits: monthly,
|
|
2231
2240
|
currentPeriodEnd: numberField(plan, "currentPeriodEnd", "plan.currentPeriodEnd")
|
|
2232
2241
|
};
|
|
2242
|
+
if (plan.currentPeriodStart !== void 0) report.plan.currentPeriodStart = numberField(plan, "currentPeriodStart", "plan.currentPeriodStart");
|
|
2233
2243
|
}
|
|
2234
2244
|
return report;
|
|
2235
2245
|
}
|
|
@@ -2854,6 +2864,9 @@ window.__ModuleLoader__.load({
|
|
|
2854
2864
|
usageFailed: "失败",
|
|
2855
2865
|
usageSuccessRate: "成功率",
|
|
2856
2866
|
usageCost: "花费",
|
|
2867
|
+
usageCompleted: "成功",
|
|
2868
|
+
usageBillingPeriod: "官方账期用量",
|
|
2869
|
+
usagePeriodUnknown: "官方用量汇总,统计周期未确认",
|
|
2857
2870
|
usageTokens: "Token",
|
|
2858
2871
|
usageTokensIn: "入",
|
|
2859
2872
|
usageTokensOut: "出",
|
|
@@ -3029,6 +3042,9 @@ window.__ModuleLoader__.load({
|
|
|
3029
3042
|
usageFailed: "failed",
|
|
3030
3043
|
usageSuccessRate: "Success rate",
|
|
3031
3044
|
usageCost: "Spend",
|
|
3045
|
+
usageCompleted: "Completed",
|
|
3046
|
+
usageBillingPeriod: "Official billing-period usage",
|
|
3047
|
+
usagePeriodUnknown: "官方用量汇总,统计周期未确认",
|
|
3032
3048
|
usageTokens: "Tokens",
|
|
3033
3049
|
usageTokensIn: "in",
|
|
3034
3050
|
usageTokensOut: "out",
|
|
@@ -3275,7 +3291,7 @@ window.__ModuleLoader__.load({
|
|
|
3275
3291
|
}
|
|
3276
3292
|
//#endregion
|
|
3277
3293
|
//#region package.json
|
|
3278
|
-
var version = "0.13.
|
|
3294
|
+
var version = "0.13.2";
|
|
3279
3295
|
var repository = {
|
|
3280
3296
|
"type": "git",
|
|
3281
3297
|
"url": "git+https://github.com/Mars-Sea/dsh-commandcode-provider.git"
|
|
@@ -3684,6 +3700,7 @@ window.__ModuleLoader__.load({
|
|
|
3684
3700
|
const planStatus = plan !== void 0 && plan.status !== "" && plan.status !== "active" ? plan.status : "";
|
|
3685
3701
|
const showPeriod = plan !== void 0 && plan.currentPeriodEnd > 0;
|
|
3686
3702
|
const showPartial = report.failures.length > 0 && report.blocked === void 0;
|
|
3703
|
+
const usagePeriod = formatUsageBillingPeriod(report.usage?.periodStart, plan?.currentPeriodStart, plan?.currentPeriodEnd);
|
|
3687
3704
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3688
3705
|
className: "cc-accountReport",
|
|
3689
3706
|
children: [
|
|
@@ -3731,13 +3748,17 @@ window.__ModuleLoader__.load({
|
|
|
3731
3748
|
}) : null
|
|
3732
3749
|
]
|
|
3733
3750
|
}) : null,
|
|
3751
|
+
report.usage !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3752
|
+
className: "cc-usageUpdated",
|
|
3753
|
+
children: usagePeriod ? `${t("usageBillingPeriod")} ${usagePeriod}` : t("usagePeriodUnknown")
|
|
3754
|
+
}) : null,
|
|
3734
3755
|
report.usage !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3735
3756
|
className: "cc-usageStats cc-usageStatsActivity",
|
|
3736
3757
|
children: [
|
|
3737
3758
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageStat, {
|
|
3738
3759
|
label: t("usageRequests"),
|
|
3739
|
-
value: String(report.usage.
|
|
3740
|
-
sub: `${t("usageFailed")} ${report.usage.failedCount}`
|
|
3760
|
+
value: String(report.usage.totalCount),
|
|
3761
|
+
sub: `${t("usageCompleted")} ${report.usage.completedCount} / ${t("usageFailed")} ${report.usage.failedCount}`
|
|
3741
3762
|
}),
|
|
3742
3763
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageStat, {
|
|
3743
3764
|
label: t("usageSuccessRate"),
|
|
@@ -5774,6 +5795,9 @@ window.__ModuleLoader__.load({
|
|
|
5774
5795
|
credits: "额度",
|
|
5775
5796
|
limits: "配额窗口",
|
|
5776
5797
|
usage: "用量",
|
|
5798
|
+
completed: "成功",
|
|
5799
|
+
usageBillingPeriod: "官方账期用量",
|
|
5800
|
+
usagePeriodUnknown: "官方用量汇总,统计周期未确认",
|
|
5777
5801
|
monthly: "月额度",
|
|
5778
5802
|
monthlyLimit: "月额度上限",
|
|
5779
5803
|
monthlyUsed: "本月已用",
|
|
@@ -5829,6 +5853,9 @@ window.__ModuleLoader__.load({
|
|
|
5829
5853
|
credits: "Credits",
|
|
5830
5854
|
limits: "Quota windows",
|
|
5831
5855
|
usage: "Usage",
|
|
5856
|
+
completed: "completed",
|
|
5857
|
+
usageBillingPeriod: "Official billing-period usage",
|
|
5858
|
+
usagePeriodUnknown: "官方用量汇总,统计周期未确认",
|
|
5832
5859
|
monthly: "Monthly",
|
|
5833
5860
|
monthlyLimit: "Monthly limit",
|
|
5834
5861
|
monthlyUsed: "Monthly used",
|
|
@@ -5978,12 +6005,13 @@ window.__ModuleLoader__.load({
|
|
|
5978
6005
|
const plan = report.plan;
|
|
5979
6006
|
const credits = report.credits;
|
|
5980
6007
|
const usage = report.usage;
|
|
6008
|
+
const usageRange = formatUsageBillingPeriod(usage?.periodStart, plan?.currentPeriodStart, plan?.currentPeriodEnd);
|
|
5981
6009
|
const stats = [];
|
|
5982
6010
|
if (usage !== void 0) {
|
|
5983
6011
|
stats.push({
|
|
5984
6012
|
label: "requests",
|
|
5985
|
-
value: String(usage.
|
|
5986
|
-
sub: `${usage.failedCount} ${t("failed")}`
|
|
6013
|
+
value: String(usage.totalCount),
|
|
6014
|
+
sub: `${usage.completedCount} ${t("completed")} / ${usage.failedCount} ${t("failed")}`
|
|
5987
6015
|
});
|
|
5988
6016
|
stats.push({
|
|
5989
6017
|
label: "successRate",
|
|
@@ -6021,7 +6049,8 @@ window.__ModuleLoader__.load({
|
|
|
6021
6049
|
active: entry.active,
|
|
6022
6050
|
monthly: monthlyView(report),
|
|
6023
6051
|
windows,
|
|
6024
|
-
stats
|
|
6052
|
+
stats,
|
|
6053
|
+
usagePeriod: usage === void 0 ? "" : usageRange ? `${t("usageBillingPeriod")} ${usageRange}` : t("usagePeriodUnknown")
|
|
6025
6054
|
};
|
|
6026
6055
|
}
|
|
6027
6056
|
/** The report-level failure box, or undefined when the report is usable. */
|
|
@@ -7256,17 +7285,24 @@ window.__ModuleLoader__.load({
|
|
|
7256
7285
|
}) : null,
|
|
7257
7286
|
account.stats.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
7258
7287
|
className: "ccp-block",
|
|
7259
|
-
children: [
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7288
|
+
children: [
|
|
7289
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
|
|
7290
|
+
className: "ccp-blockTitle",
|
|
7291
|
+
children: text("usage")
|
|
7292
|
+
}),
|
|
7293
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
7294
|
+
className: "ccp-windowReset",
|
|
7295
|
+
children: account.usagePeriod
|
|
7296
|
+
}),
|
|
7297
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
7298
|
+
className: "ccp-tiles",
|
|
7299
|
+
children: account.stats.map((stat) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tile, {
|
|
7300
|
+
label: text(stat.label),
|
|
7301
|
+
value: stat.value,
|
|
7302
|
+
sub: stat.sub
|
|
7303
|
+
}, stat.label))
|
|
7304
|
+
})
|
|
7305
|
+
]
|
|
7270
7306
|
}) : null
|
|
7271
7307
|
]
|
|
7272
7308
|
});
|
|
@@ -7785,7 +7821,8 @@ window.__ModuleLoader__.load({
|
|
|
7785
7821
|
notes.push(isPeak ? SESSION_COST_COPY.peakRates : SESSION_COST_COPY.offPeakRates);
|
|
7786
7822
|
}
|
|
7787
7823
|
}
|
|
7788
|
-
|
|
7824
|
+
const summary = facts.summaryTokens ?? zeroCostTokens();
|
|
7825
|
+
if (COST_TOKEN_KEYS.some((key) => totals[key] - summary[key] !== count(usage[key])) || !priced) return void 0;
|
|
7789
7826
|
const { total, unpricedCacheWriteTokens } = breakdown;
|
|
7790
7827
|
partial ||= unpricedCacheWriteTokens > 0;
|
|
7791
7828
|
free &&= !partial;
|