@mars-sea/dsh-commandcode-provider 0.13.3 → 0.13.4

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,46 @@ 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.4] - 2026-10-16
8
+
9
+ ### Added
10
+
11
+ - 问题 #79:价格试算新增逐模型 30 天折算,以及相对所选历史完整工作量的成本差额与比例;主行保留计价覆盖,能力与排除明细可展开。缺价、超上下文、读取不完整或观察不足一天时明确说明原因,基准为零不制造百分比。指标复用同一份报告,不增加历史读取、远端字段或模型调用。
12
+
13
+ - 支持**自定义上下文长度**(#86):新增全局 `contextWindow` 与按模型 `contextWindowOverrides`,解析顺序为按模型 → 全局 → 目录;网页设置页与配置文件均可设置,终端设置页尚未接入。接受 1~10,000,000 的整数,输入支持二进制 `32K`/`1M` 简写。按模型行只列白名单可见模型,已有覆盖保留;清空整表写 `{}` 遮蔽基础层。选择器、宿主计量与默认输出预算跟随有效窗口。
14
+
15
+ ### Changed
16
+
17
+ - 同步 Command Code CLI `1.82.2` → `1.82.4`:请求版本标识(`x-command-code-version`)随之上调。官方日志**没有 1.82.1–1.82.4 任何条目**(CLI 通道最新仍是 `1.82.0`/2026-10-13,页面最新条目 `0.1.55` 属 Desktop 应用版本线,两条产品线混排在同一时间轴),因此结论全部来自产物级比对:逐字节比对两版 `dist/cli.mjs` 与本仓库固定的 `1.82.2` 基线,并用实时目录与官方定价页交叉验证。
18
+
19
+ - **能力数据的权威来源换了**:`1.82.4` 的 `getSupportedEfforts()` 不再从 CLI 内置 Map 取数(`xn.get(n) ?? null`),改为 `resolveKnownCatalogModel({model, catalog})?.reasoningEfforts`;`knownModelSupportsZdr()` 同样由「取反硬编码集合」改为读目录的每模型 `zdr` 字段(`?.zdr ?? false`),**默认值语义随之反转——过去「未列出」视为已覆盖,现在「未列出或不为 true」即不覆盖**。CLI 新增内嵌快照 + 远程覆盖机制(`schemaVersion`/`catalogVersion`/`refreshAfterSeconds: 900`),远程端点为 `GET /provider/v1/models?view=client`——该视图才带 `reasoningEfforts`/`zdr`/`inputModalities`/`minimumPlan`/`pricing`,默认视图(92 条)没有这些字段。内嵌快照只是兜底:它发布后约两天即过期(`f3eebbb3…`/99 条 对 远程 `d6177bab…`/100 条,仅成员增减、共同 id 字段零漂移),因此本插件的 `KNOWN_*` 快照以实时目录为准。**这次迁移也让技能的 `extract-cli.mjs` 失效**(锚点按 minified 函数名与 `.get()`/`.has()` 调用形态取数,而 `1.82.4` 把语义名移入 `__name(fn,"…")`、真实声明改名 `getSupportedEfforts2`/`modelSupportsZdr2`),先报 `Missing/ambiguous effort map`、短路后再报 `Missing/ambiguous ZDR exception set`;`buildModelGroups` 与 `getPlanInfo` 两个锚点仍可正常提取。本轮差异由人工提取补齐,巡检脚本与 `audit.py` 的适配另行处理。
20
+
21
+ - 模型快照同步(以实时 `?view=client` 目录为准):新增 4 个模型——`Qwen/Qwen3.8-Max-Prime`(最低 **GOAT** 档、100 万上下文、支持图像输入、三档 `low`/`medium`/`xhigh`)、`meta/muse-spark-open`(2026-10-15 上线、Go 档、图像、三档)、`nvidia/nemotron-3.5-super-vl`(2026-10-14、Go 档、图像、三档)、`stealth/cat-jam:free`(免费隐身预览、Go 档、仅文本、五档 `low`/`medium`/`high`/`xhigh`/`max`,免费促销无结束日期)。推理档位表 60 → 64 条,图像表 67 → 70 条,最低套餐表 89 → 92 条(严格超集链不变)。`Qwen/Qwen3.8-Max-Prime` 在 `0.13.3` 曾因「CLI 未注册」而不予录入,`1.82.4` 已把它写进内嵌目录与实时目录,这条待观察项就此结清。
22
+
23
+ - **零数据保留例外集 22 → 24 条**:新增 `meituan/LongCat-2.0:free` 与 `stealth/cat-jam:free`。LongCat 是对 `1.74.1` 的**有意回退**——那次只把它从提取器读取的锚点里移除,canonical 辅助函数一直保留着它,两个锚点集因此相差恰好这一个 id(22 对 23)并持续了八个版本;`1.82.4` 让两者都改读目录的 `zdr` 字段,该行取值为 `false`,于是本表跟随目录判决把它收回。`stealth/cat-jam:free` 同理(目录 `zdr:false`,且不在任何锚点集里)。两处都已更新注释与测试断言。
24
+
25
+ - 退役清理:`inclusionai/ling-3.0-flash-sante:free` 从**全部**快照表移除(最低套餐、免费促销、自动推理、输出上限,以及生成器的手工上限映射 `MANUAL_CEILINGS`,该映射随之清空)——它已从实时目录、定价页与 `1.82.4` 内嵌快照三处同时消失,没有任何官方来源再提名它。价格表随官方页面重新生成(92 行):新增 `muse-spark-open`($1.25/$4.25/$0.15)、`nemotron-3.5-super-vl`($0.2/$0.5/$0.04)、`typesafe/jev-1.14.0`($0.042 输入、输出免费)三行,`gpt-5.6-sol` 的每月额度由 Go $6/GOAT $70/Pro $80 下调为 **$6/$20/$30**、`ling-3.1-flash` 由 **$20/$30 上调为 $100/$110**(`0.13.3` 记录的 `planBudgetSteps` 预生效额度,本次随之结清);费率与峰谷窗口零变化。`node scripts/sync-model-prices.mjs --check` 与 `sync-output-limits.mjs --check` 均已干净。
26
+
27
+ - 同步收官到 `1.82.5`:同一轮巡检中官方又发布了 `1.82.5`(`1.82.4` 之上一个补丁)。产物级比对确认**协议与数据面零差异**——`1.82.5` 唯一的变化是把实时目录里那三个新模型(`meta/muse-spark-open`、`nvidia/nemotron-3.5-super-vl`、`stealth/cat-jam:free`)与 `stealth/cat-jam:free` 的 ZDR 判定**折回内嵌快照**,也就是把本轮同步依据的实时目录结果固化进产物。因此本次只需上调请求版本标识;`candidateDiffs` 对 `KNOWN_EFFORTS`/`KNOWN_NON_ZDR_MODELS`/`KNOWN_IMAGE_MODELS` 三张表均为零差异,证明按实时目录同步的快照已完全覆盖 `1.82.5` 的内嵌表。
28
+
29
+ - 复核**无变化**的项:峰谷计价仍是 5 个 DeepSeek 模型、窗口 `01–04 & 06–10 UTC, Mon–Fri` 与本地常量逐值一致(官方 `/pricing` 营销页另展示 15 个含 GLM/MiniMax 的峰谷行,与生成器数据源 `/docs/resources/pricing-limits` 的 5 行冲突,属上游两页不一致,本插件继续以生成器数据源为准);订阅标签与月额度、`minimumPlan` 与目录逐条一致;自动推理模型 22 个逐 id 不变;effort 词汇表两版都是 `off|low|medium|high|xhigh|max`。
30
+
31
+ - 引擎兼容范围的 alpha(早期测试版)通道由 `0.2.1-alpha.3` 替换为 **`0.2.1-alpha.4`**;RC(候选发布版)通道 `0.2.0-rc.2` 本次未变动。**这一版必须升级**:dsh 自 `0.2.1-alpha.4` 起把插件兼容性判定改为**只读 `engines.dsh`**、完全忽略 `@deepseek-ai/dsh*` 对等依赖(只有缺少该字段时才回落到 peer 规则),旧声明在新引擎上会被宿主拒绝——插件行被预检禁用、作为 bundle 被静默跳过、`dsh plugin add` 在 pnpm 之前就拒绝,而本地 `npm run test:engine` 仍然全绿。`engines.dsh`、`dsh.compatibility.dsh`、`dsh.compatibility.dshReleases`、全部 Harness 对等依赖与开发依赖、`package-lock.json` 同批同步;锁文件采用精准替换(29 个 dsh 条目加根声明面),非 dsh 依赖零漂移,平台可选依赖分支 10 个保持完整。插件 `src/` 与 `lib/` 运行时零改动,测试夹具也零改动。
32
+
33
+ - `npm run test:engine` 新增**准入判定检查**:对每个已声明引擎真实调用该引擎自己的 `evaluatePluginCompatibility`(`checkEngineAdmission`)。该脚本此前的检查全都走「把发布面装进引擎的 peer 树再加载」,看不见宿主准入判定本身,正是这个盲区让上面那个破坏点在全绿的情况下依然存在。红绿对照已实测:alpha.4 通过,已退出兼容范围的 alpha.3 被拒并报出未满足项。
34
+
35
+ - 设置页信息架构调整:原本独立成组的「上下文长度」并入「模型」分组,分组标题改为**「模型与上下文」**(英文 **Models & context**),顶级分组由 6 个减为 5 个:账户 → 模型与上下文 → 隐私与安全 → 集成与显示 → 高级设置(默认折叠)。组内顺序为隐藏套餐外模型开关 → 可见模型白名单 → **自定义上下文长度**字段 → **按模型覆盖**标题行与覆盖行列表;这些控件直接平铺,**不设子节标题、不画分隔线**——中间版本曾把它们做成带次级标题与细分隔线的子节(`SettingsSubGroup`、locale 键 `contextTitle`),用户在实际页面上查看后判定视觉冗余,随即改为平铺并删除该组件与键。**行为零变化**:`contextWindow` 与 `contextWindowOverrides` 两个配置项、解析优先级(按模型 → 全局 → 目录)与保存路径都没有改动,仅位置与呈现调整。
36
+
37
+ ### Fixed
38
+
39
+ - 问题 #88:会话标题调用在模型明确支持 `off`(关闭思考)时自动发送该档位,避免默认 64 词元预算耗在思考上;两种聊天协议及协议回退均生效,普通对话、上下文压缩和其他模型保留原策略,输出预算不变。
40
+
41
+ - 设置页与侧边栏面板的**请求计数自动换算**:`成功 1234567 / 失败 123` 在四列等宽卡片里是单行不换行文本,宽度不够时省略号从右侧吃掉「失败 …」——恰好是最该看见的那个数。现在计数按 `K`/`M`/`B` 紧凑显示(`1234567` → `1.2M`、`12000` → `12K`,整数不带多余的 `.0`),精确值改由悬停 `title` 给出,且**只在确实换算过时才挂**(未换算时悬停弹出的文字与卡片上写的一模一样)。卡片主数字(请求总数)一并换算。新增 `formatCompactCount` 与 `compactCountTitle`(`src/display-format.ts`,设置页与面板共用同一实现与同一档位规则),并修好既有 `formatTokensCompact` 的**进位边界**:`999999` 过去显示为 `1000.0K`、`999999999` 显示为 `1000.0M`,现在分别是 `1.0M` 与 `1.0B`——先除以档位再四舍五入会落到并不存在的档位上。终端命令的用量行保持不换算:终端宽度充足,且那里更需要精确值。
42
+
43
+
44
+ - 自定义上下文普通小数在网页及配置结构中均被拒绝,避免宿主报无效模型上下文;程序化绕过校验时仍清洗无效值。
45
+ - 调大窗口时解除旧目录窗口对输出预算的限制;三协议默认及显式请求仍遵守有效窗口、模型公布或快照输出上限、运行时学习上限和网关总上限。
46
+
7
47
  ## [0.13.3] - 2026-10-15
8
48
 
9
49
  ### Changed
package/README.md CHANGED
@@ -25,6 +25,7 @@ Unofficial [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harnes
25
25
  - **Multi-account rotation** — when one account hits its usage limit, requests switch to the next account automatically. See [Account rotation](#account-rotation).
26
26
  - **Flexible API key setup** — via the settings page, an environment variable, or the official CLI login file.
27
27
  - **Model-picker annotations** — minimum plan, active deal or `FREE` badge, peak/off-peak state, image support, and context window; free models listed first.
28
+ - **Custom context length** — override the context window the harness meters and compacts against: one global value plus per-model overrides, edited on the settings page or in config (issue #86); unset follows the catalog.
28
29
  - **Plan-aware picker** — models above your subscription tier are hidden by default (toggleable); an optional **Model allowlist** keeps only your favorites in the picker.
29
30
  - **Reasoning-effort support** — models with selectable reasoning effort levels expose them in the picker.
30
31
  - **Image input** — Vision-capable models accept images.
@@ -36,11 +37,14 @@ See [Screenshots](#screenshots) below for what the UI looks like.
36
37
 
37
38
  ## Install
38
39
 
39
- This release supports **dsh 0.2.0-rc.2 (RC) and dsh 0.2.1-alpha.3 (alpha)**.
40
+ This release supports **dsh 0.2.0-rc.2 (RC) and dsh 0.2.1-alpha.4 (alpha)**.
40
41
  The compatibility policy keeps the latest verified official release candidate
41
42
  and alpha release, one per channel. These match npm's `latest` and `alpha` tags
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
43
+ as checked on 2026-10-15. The peer range and compatibility records name only
44
+ these two exact versions. Note that **dsh 0.2.1-alpha.4 reads `engines.dsh`
45
+ alone** when it decides whether a plugin is compatible; the dsh peer ranges are
46
+ consulted only when that field is absent, so a build that declares the wrong
47
+ `engines.dsh` is refused outright. A profile on `0.2.1-alpha.3` must upgrade its engine
44
48
  before installing this build:
45
49
 
46
50
  ```sh
@@ -75,7 +79,7 @@ Fresh pnpm 10 marketplace generations are supported directly. Every Harness pack
75
79
  Update with the same tag you installed with:
76
80
 
77
81
  ```sh
78
- dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 or 0.2.1-alpha.3
82
+ dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 or 0.2.1-alpha.4
79
83
  dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@0.9.1 # older dsh (0.5.0 line, unmaintained)
80
84
  ```
81
85
 
@@ -154,7 +158,7 @@ cmd login # writes ~/.commandcode/auth.json
154
158
  cwd: !!js process.cwd()
155
159
  ```
156
160
 
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.
161
+ **Engine version.** The plugin is maintained against two engines: **dsh 0.2.0-rc.2** and **dsh 0.2.1-alpha.4**. Its `@deepseek-ai/dsh-*` peers use `0.2.0-rc.2 || 0.2.1-alpha.4`, 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` (alpha.4 pairs the same Cordis and Schemastery versions as alpha.3, so those ranges do not move). 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, and `test:engine` also calls that engine's own `evaluatePluginCompatibility` on the published manifest — from alpha.4 on, that verdict reads `engines.dsh` alone, so a wrong engine declaration fails there instead of only at install time. See [Install](#install) for older engines.
158
162
 
159
163
  ## Usage dashboard
160
164
 
@@ -173,7 +177,7 @@ With several Command Code subscriptions, the plugin **switches to the next accou
173
177
  - **Setup** — click **Add account** in the **Accounts** card at Settings → **Command Code**, optionally name it, then either **Sign in to Command Code** (the key is stored when you approve in the browser; a sign-in that does not complete leaves no empty account behind) or paste an API key. Account actions — add, rename, replace or clear a key, remove, pin — apply immediately; only the other settings on the page wait for the Save bar. The top-level key always serves first as the `default` account.
174
178
  - **Manual switching** — **Pin this account** in an account's **⋯** menu makes it the preferred account; if it is exhausted, requests fall back to other accounts and return once its window resets. **Unpin** returns to automatic rotation.
175
179
  - **Dedicated models** — expand an account and pick its **Dedicated models** from the live catalog. A request for one of those models serves from that account while it is usable; an exhausted or invalid account falls back to the normal rotation. A model belongs to one account at a time — picking it for another account moves it. (Stored as `modelAccountRules`.)
176
- - **Show only favorite models** — the **Visible models** picker in the **Models** card keeps only the checked models in the model picker; unchecked shows all (the default).
180
+ - **Show only favorite models** — the **Visible models** picker in the **Models & context** card keeps only the checked models in the model picker; unchecked shows all (the default).
177
181
  - **Status** — each account row shows its plan, status and 5-hour/weekly meters; expand it for the full report. `/commandcode` reports the same per-account state.
178
182
 
179
183
  The equivalent YAML (`$DSH_HOME/settings.yaml` or composition config):
@@ -202,7 +206,7 @@ llm-commandcode:
202
206
 
203
207
  ## Configure
204
208
 
205
- **Settings → Command Code** is organized as **Accounts** (keys, sign-in, live quota, pinning, dedicated models), **Models** (hide out-of-plan models, visible models), **Privacy & security** (zero data retention, off by default, see below), **Integrations & display** (serve web search with Command Code, show the quota card in the sidebar, off by default), and a collapsed **Advanced** section (API base URL, request/stream timeouts, transport retries, cache-aware image offload). The working directory is no longer on the page; `workingDir` in config still works.
209
+ **Settings → Command Code** is organized as **Accounts** (keys, sign-in, live quota, pinning, dedicated models), **Models & context** (hide out-of-plan models, visible models, then the **Custom context length** field and the **Per-model overrides** rows right after the allowlist — global and per model, see below), **Privacy & security** (zero data retention, off by default, see below), **Integrations & display** (serve web search with Command Code, show the quota card in the sidebar, off by default), and a collapsed **Advanced** section (API base URL, request/stream timeouts, transport retries, cache-aware image offload). The working directory is no longer on the page; `workingDir` in config still works.
206
210
 
207
211
  The same options live in `$DSH_HOME/settings.yaml` (changes apply immediately, no restart):
208
212
 
@@ -217,8 +221,20 @@ llm-commandcode:
217
221
  # offloadSeenImagesForCache: true # opt in to CLI cache mitigation; later requests omit old pixels
218
222
  showSidebarQuota: true # optional: show the plans & quota card in the sidebar (default off)
219
223
  zdr: true # optional: route requests only through zero-data-retention upstreams (default off)
224
+ # contextWindow: 131072 # optional: custom context length (tokens) for every model; unset follows the catalog
225
+ # contextWindowOverrides: # optional: per-model custom context lengths; wins over contextWindow
226
+ # deepseek/deepseek-v4-pro: 65536
220
227
  ```
221
228
 
229
+ ### Custom context length
230
+
231
+ The context window the harness meters against — and when it compacts — normally comes from the model catalog's `context_length`. The opt-in **Custom context length** field and **Per-model overrides** rows inside **Settings → Command Code → Models & context**, directly after the visible-models allowlist (or the two config fields above, issue #86), replace it per your own numbers: `contextWindow` is the global custom value applied to every model without its own row, and `contextWindowOverrides` sets one model by catalog id, winning over the global value. Unset follows the catalog; nothing changes by default.
232
+
233
+ - **When it helps**: a catalog window that over-reports turns into `context_length_exceeded` failures once a session grows past the model's real capacity — advertise the lower real number and the harness compacts before the gateway refuses. An under-reported window makes long sessions compact earlier than they need to; raise it to match the model's true capacity.
234
+ - The model-picker context annotation, `defaultMaxTokens` default and actual requests follow the same resolution. Raising the window removes the old catalog-window output cap while retaining the model's independent output ceiling, runtime-learned ceiling and gateway-wide cap; explicit output counts obey those caps too. Session-cost tier pricing keeps using each request's actual token counts.
235
+ - Values must be whole token counts in 1 – 10,000,000. The page blocks invalid input; config-file non-numbers, fractions and out-of-range values fail schema validation rather than silently falling back. Only programmatic calls that bypass the schema discard invalid values and fall through valid per-model override → valid global value → catalog. A model the catalog does not list keeps its "no context advertised" shape.
236
+ - The inputs accept compact shorthand in binary units: `32K` = 32,768 and `1M` = 1,048,576 (so `128K`/`256K` write the exact power-of-two windows 131,072/262,144); the stored value is always a plain number. The per-model override's model dropdown lists only the models kept by the **visible-models allowlist** (the whole catalog while showing all), and the rows carry "Model / Context length" column heads.
237
+
222
238
  ### Repeated image cache misses
223
239
 
224
240
  On the CLI transport (`/alpha/generate`), a new image can make Command Code's reported prompt cache retreat to the first historical image even when every previous request message is byte-identical. The opt-in **Stop replaying images already seen** setting (`offloadSeenImagesForCache`) asks dsh's durable `image/offload` surface to replace an older image with a stable text placeholder after this same model has answered with it. The next request keeps its new image; later text can be cached without replaying old pixels. The default is off because the model cannot inspect an offloaded image again unless it rereads the source file or the user reattaches it. This mitigates the observed cost spike; it does not repair Command Code's underlying multimodal cache behavior. [Live evidence and limits](docs/issue-64-cache-review.md).
package/README.zh-CN.md CHANGED
@@ -25,6 +25,7 @@
25
25
  - **多账户轮换**:一个账户用量打满后,请求自动切换到下一个账户。详见[多账户轮换](#多账户轮换)。
26
26
  - **key 配置灵活**:设置页填写、环境变量或官方 CLI 登录文件均可。
27
27
  - **模型选择器标注**:每个模型标注最低套餐、折扣/FREE 徽章、峰谷时段、图片支持与上下文长度,免费模型置顶。
28
+ - **自定义上下文长度**:覆盖宿主用于上下文计量与自动压缩的上下文窗口——一个全局值加按模型覆盖,可在设置页或配置中设置(issue #86),不填则跟随模型目录。
28
29
  - **按套餐过滤**:默认隐藏超出订阅套餐的模型,可一键关闭;「模型白名单」可进一步只保留常用模型。
29
30
  - **推理强度支持**:支持推理强度的模型可在选择器中选择档位。
30
31
  - **图片输入**:Vision 模型支持发送图片。
@@ -34,7 +35,7 @@
34
35
 
35
36
  ## 安装
36
37
 
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
+ 本版本**只支持 dsh 0.2.0-rc.2(RC,候选发布版)与 dsh 0.2.1-alpha.4(alpha,早期测试版)**。维护策略为每条通道只保留官方最新且经过验证的一个版本;2026-10-15 核对时分别对应 npm 的 `latest` 与 `alpha` 发布标签。peer(对等依赖)范围和兼容记录只列这两个精确版本。注意 **dsh 0.2.1-alpha.4 判定插件兼容性时只读 `engines.dsh`**,dsh 对等依赖范围仅在该字段缺失时才被参考,因此 `engines.dsh` 声明错误会被直接拒绝。使用 `0.2.1-alpha.3` 及更早的配置需先升级引擎,再安装本构建:
38
39
 
39
40
  ```sh
40
41
  dsh plugin --profile web add @mars-sea/dsh-commandcode-provider@latest
@@ -63,7 +64,7 @@ dsh plugin --profile web add @mars-sea/dsh-commandcode-provider@0.11.15
63
64
  用与安装时相同的 tag 更新:
64
65
 
65
66
  ```sh
66
- dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 或 0.2.1-alpha.3
67
+ dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@latest # dsh 0.2.0-rc.2 或 0.2.1-alpha.4
67
68
  dsh plugin --profile web update @mars-sea/dsh-commandcode-provider@0.9.1 # 更早的 dsh(0.5.0 线,不再维护)
68
69
  ```
69
70
 
@@ -142,7 +143,7 @@ cmd login # 写入 ~/.commandcode/auth.json
142
143
  cwd: !!js process.cwd()
143
144
  ```
144
145
 
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` 均逐版本验证。旧引擎安装说明见[安装](#安装)。
146
+ **引擎版本要求。** 插件维护两个引擎:**dsh 0.2.0-rc.2** 与 **dsh 0.2.1-alpha.4**。`@deepseek-ai/dsh-*` 的 peer(对等依赖)为 `0.2.0-rc.2 || 0.2.1-alpha.4`;`@deepseek-ai/cordis` 与 `@deepseek-ai/schemastery` 仍使用随引擎配对的范围 `~4.0.4 || ~4.0.5-alpha.1` 与 `~3.18.4 || ~3.18.5-alpha.1`(alpha.4 与 alpha.3 配对同两个版本,因此范围不动)。兼容记录恰好包含两个版本,同通道升级验证后替换旧版,不累加已支持版本、不放行未验证的邻近版本。`npm run test:engine` 与 `npm run test:install` 均逐版本验证,前者还会用该引擎自己的 `evaluatePluginCompatibility` 对发布清单求值——自 alpha.4 起该判定只读 `engines.dsh`,因此引擎声明写错会在这一步失败,而不是拖到安装时才暴露。旧引擎安装说明见[安装](#安装)。
146
147
 
147
148
  ## 用量面板
148
149
 
@@ -161,7 +162,7 @@ cmd login # 写入 ~/.commandcode/auth.json
161
162
  - **配置**:在 **设置 → Command Code** 的「账户」卡片点击「添加账户」,可填写备注名,然后选择「网页登录」(在浏览器授权后自动保存 key;登录未完成不会留下空账户)或「粘贴密钥」。添加、重命名、更换或清除密钥、移除、固定等账户操作**立即生效**,无需点击页面底部的「保存」;「保存」只作用于页面上的其他设置。顶层 key 始终是第一顺位的 `default` 账户。
162
163
  - **手动切换**:在账户行的「⋯」菜单中选择「固定使用此账户」即可指定优先账户;所选账户耗尽时自动回落到其他账户,窗口重置后自动恢复。「取消固定」回到自动轮换。
163
164
  - **专用模型**:展开某个账户,从实时模型目录**多选**它的「专用模型」。请求这些模型且该账户可用时使用该账户;账户耗尽或密钥失效时自动回落到常规轮换。一个模型同一时间只属于一个账户,给另一个账户选择它会自动移过去(仍保存为 `modelAccountRules`)。
164
- - **只显示常用模型**:在「模型」卡片的「可见模型」中勾选要保留的模型,模型选择器只列出这些;不勾选则显示全部(默认行为不变)。
165
+ - **只显示常用模型**:在「模型与上下文」卡片的「可见模型」中勾选要保留的模型,模型选择器只列出这些;不勾选则显示全部(默认行为不变)。
165
166
  - **状态展示**:每个账户行直接显示套餐、状态以及 5 小时 / 每周额度条,展开可查看完整报告;`/commandcode` 同样按账户显示状态。
166
167
 
167
168
  等价的 YAML(`$DSH_HOME/settings.yaml` 或组合配置):
@@ -190,7 +191,7 @@ llm-commandcode:
190
191
 
191
192
  ## 配置
192
193
 
193
- **设置 → Command Code** 分为:**账户**(密钥、网页登录、实时额度、固定账户、专用模型)、**模型**(隐藏套餐外模型、可见模型)、**隐私与安全**(零数据保留 ZDR,默认关闭,见下)、**集成与显示**(用 Command Code 承载联网搜索、在侧边栏显示额度卡片,默认关闭),以及默认折叠的**高级设置**(API 地址、请求/流超时、传输重试次数、历史图片缓存优化)。工作目录已不在页面上显示,配置中的 `workingDir` 仍然有效。
194
+ **设置 → Command Code** 分为:**账户**(密钥、网页登录、实时额度、固定账户、专用模型)、**模型与上下文**(隐藏套餐外模型、可见模型,以及紧随白名单之后的**自定义上下文长度**字段与**按模型覆盖**列表,全局与按模型,见下)、**隐私与安全**(零数据保留 ZDR,默认关闭,见下)、**集成与显示**(用 Command Code 承载联网搜索、在侧边栏显示额度卡片,默认关闭),以及默认折叠的**高级设置**(API 地址、请求/流超时、传输重试次数、历史图片缓存优化)。工作目录已不在页面上显示,配置中的 `workingDir` 仍然有效。
194
195
 
195
196
  同一组选项也位于 `$DSH_HOME/settings.yaml`(修改即刻生效,无需重启):
196
197
 
@@ -205,8 +206,20 @@ llm-commandcode:
205
206
  # offloadSeenImagesForCache: true # 可选:模型回复后不再重发旧图片,默认关闭
206
207
  showSidebarQuota: true # 可选:在侧边栏显示套餐与配额卡片(默认关闭)
207
208
  zdr: true # 可选:请求只经由零数据保留上游(默认关闭)
209
+ # contextWindow: 131072 # 可选:自定义上下文长度(token),对所有模型生效;不填跟随目录
210
+ # contextWindowOverrides: # 可选:按模型的自定义上下文长度;优先于 contextWindow
211
+ # deepseek/deepseek-v4-pro: 65536
208
212
  ```
209
213
 
214
+ ### 自定义上下文长度
215
+
216
+ 宿主用于上下文计量、并据此触发自动压缩的上下文窗口,通常来自模型目录的 `context_length`。**设置 → Command Code → 模型与上下文**中、紧随可见模型白名单之后的**自定义上下文长度**输入框与**按模型覆盖**列表(或上面的两个配置项,issue #86)可以用你自己的数值替换它:`contextWindow` 是对所有没有单独条目的模型生效的全局值,`contextWindowOverrides` 按目录模型 id 单独设置、优先于全局值。不填则完全跟随目录,默认无任何变化。
217
+
218
+ - **适用场景**:目录值偏大时,会话一长就会撞上真实的模型容量、请求以 `context_length_exceeded` 失败——填入更小的真实值,宿主会在服务端拒绝之前先压缩;目录值偏小时,长会话会比实际需要更早压缩——调大以匹配模型真实容量。
219
+ - 模型选择器的上下文标注、`defaultMaxTokens` 默认预算与实际请求都跟随同一解析结果。调大窗口会解除旧目录窗口对输出的限制,但仍受模型独立输出上限、运行时学习上限和网关总上限约束;显式指定的输出数也受这些上限约束。会话费用的上下文分层计价仍按每次请求的实际 token 数。
220
+ - 取值单位为 token,范围 1 – 10 000 000,必须为整数。网页阻止保存无效输入;配置文件中的非数值、小数或越界值由配置校验拒绝,不会静默回落。只有绕过配置校验的程序化调用会丢弃无效值,按「有效按模型值 → 有效全局值 → 目录」回落。目录没有的模型保持「无上下文宣告」的既有形状。
221
+ - 输入框接受 `32K`、`1M` 这样的简写(二进制换算:`32K` = 32 768、`1M` = 1 048 576,131 072、262 144 这类 2 的幂窗口可直接写成 `128K`、`256K`;落盘仍是纯数字)。按模型覆盖的模型下拉只列出**模型白名单**中可见的模型(白名单为「显示全部」时即整个目录),行列表带「模型 / 上下文长度」列头。
222
+
210
223
  ### 连续图片导致的缓存回退
211
224
 
212
225
  在 CLI 传输(`/alpha/generate`)上,即使此前所有请求消息逐字节一致,新图片也可能让服务端报告的缓存命中量退回第一张历史图片处。可在「高级设置」打开「已看过的图片不再重复发送」(`offloadSeenImagesForCache`):同一模型看过图片并回复后,插件通过 dsh 持久的 `image/offload` 事件把旧图替换成稳定文字占位;当前新图仍会送给模型,后续文本更容易保持缓存。**默认关闭**,因为模型如需重新查看已 offload 的图片,必须重新读取原文件或由用户再次附加。这是费用缓解方案,未修复 Command Code 服务端的多模态缓存行为。[实测证据与限制](docs/issue-64-cache-review.md)。