@mars-sea/dsh-commandcode-provider 0.13.0 → 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 CHANGED
@@ -4,6 +4,33 @@ 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
+
26
+ ## [0.13.1] - 2026-10-14
27
+
28
+ ### Changed
29
+
30
+ - 模型分析第二版沿用宿主字体、语义主题、按钮与分段控件,统一筛选控件高度、卡片和明细布局。历史与价格试算分别呈现,可在窄面板中恢复逐指标标签和两列分组,保留键盘页签、展开及缺失提示;不改变统计口径、后端契约或历史读取时机。
31
+ - 历史模型显示名称与已知成本占比,名称复用同一报告的试算目录,比例为模型已知成本除以全部已知成本小计;没有计价样本或零小计时显示“无占比”,已知零成本仍显示零金额。价格试算单独展示计价覆盖、超上下文与未知数量,明确不同覆盖的金额不能直接比较。新增占比边界回归用例,生成客户端产物与实现说明同步。
32
+ - npm 发布改用 GitHub Actions(自动化工作流)手动触发的 Trusted Publishing(可信发布),通过 OIDC(开放身份连接)认证,不保存长期发布令牌。工作流默认仅检查,实际发布须显式开启;校验版本标签、仓库、构建产物及重复版本,并执行全部发布检查后上传同一发布包。
33
+
7
34
  ## [0.13.0] - 2026-10-14
8
35
 
9
36
  ### Added
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.2 (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-11. The peer range and compatibility records name only
43
- these two exact versions. A profile on `0.2.1-alpha.1` must upgrade its engine
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.2
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 — any of these work, in this order of precedence:
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.2**. Its `@deepseek-ai/dsh-*` peers use `0.2.0-rc.2 || 0.2.1-alpha.2`, 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.
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.2(alpha,早期测试版)**。维护策略为每条通道只保留官方最新且经过验证的一个版本;2026-10-11 核对时分别对应 npm 的 `latest` 与 `alpha` 发布标签。对等依赖范围和兼容记录只列这两个精确版本。使用 `0.2.1-alpha.1` 的配置需先升级引擎,再安装本构建:
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.2
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.2**。`@deepseek-ai/dsh-*` 对等依赖为 `0.2.0-rc.2 || 0.2.1-alpha.2`;`@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` 均逐版本验证。旧引擎安装说明见[安装](#安装)。
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` 序列**:携带它的请求会报错。