@mars-sea/dsh-commandcode-provider 0.10.0 → 0.10.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 +36 -0
- package/README.md +8 -4
- package/README.zh-CN.md +8 -4
- package/lib/client.js +519 -144
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +145 -31
- package/lib/index.js +991 -432
- package/lib/index.js.map +1 -1
- package/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,42 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.10.2] - 2026-09-08
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Searchable model-editor dropdowns with tier grouping and stale-id cleanup.** The routing-rule editor and the Visible models filter share one dropdown: a search box filters the 60+ model catalog by id/display-name substring, entries group under plan-tier headings (FREE → Go → GOAT → Pro → Provider/Max, mirroring the picker order), and selected models retired upstream render flagged instead of silently vanishing — the Visible models card offers a one-click cleanup that never auto-drops (an empty catalog from a fetch failure must not wipe the list).
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **Turning the web-search toggle off no longer silences other search plugins** ([#26](https://github.com/Mars-Sea/dsh-commandcode-provider/issues/26)). Disabling `webSearch` used to force the web seam back to the factory `deepseek-official` backend, so a sibling search plugin (e.g. modsearch) stayed dead even with Command Code search off. The plugin now remembers the backend it displaced when taking over and hands the selection back to it on toggle-off — and on unload, so disabling the plugin no longer leaves a stale `commandcode` pin that fails every search with `WEB_PROVIDER_CONFIGURED_MISSING`.
|
|
18
|
+
- **DSH STORE relisting.** Declare per-release compatibility for the latest DSH versions (`dsh.compatibility.dshReleases`: 0.1.2-rc.1, 0.1.3-alpha.1, 0.1.3-alpha.2 all `compatible`) so the catalog can restore the listing, and vendor the built runtime files (`lib/index.js`, `lib/index.d.ts`, `lib/client.js`) in git so the store review resolves the package entry points from the fixed commit.
|
|
19
|
+
- **A partially landed settings save no longer duplicates routing rules on retry.** When the rules write landed but a later write failed, the retry re-persisted staged additions a second time. Staged removals are now matched by row content (stored ids shift after any write), landed additions are dropped from staging, and the write dedupes by content — mirroring the existing account-staging behavior. A throwing settings write also counts as a failed (not dropped) save.
|
|
20
|
+
- **A stream whose final event lacks its trailing newline no longer emits a duplicate `finish`.**
|
|
21
|
+
- **Corrupt billing facts fail open.** A non-finite plan-tier weight no longer hides models, and sub-1K context windows render raw instead of `"0K"`.
|
|
22
|
+
- **The loopback login's body cap is now measured in wire bytes** (multibyte bodies previously passed ~1.5–2× the limit), and over-limit requests never process their partial body.
|
|
23
|
+
- **The zh `/commandcode` command no longer shows English for empty/error states.**
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **The usage report fetches faster.** `getUsage()` still reads whoami first (the subscriptions query needs its org id) but now fetches usage/credits/subscriptions in parallel instead of serially, and the four endpoint parsers plus the total-failure classifier are module-level functions.
|
|
28
|
+
- **`stream()` internals are now module-level.** The CLI/OpenAI body builders, the pre-stream connect attempt, the block assembler, and both transport event handlers take explicit parameters instead of closing over `stream()` locals — same wire behavior, pinned by the existing 80+ adapter tests. (The two message converters stay separate: their wire shapes are irreconcilable by design.)
|
|
29
|
+
- **The settings page's model catalog is now unfiltered.** The `commandcode/models` Remote serves the full catalog instead of the plan-filtered picker list, so a routing rule can target a model the picker hides (e.g. route a GOAT-only model to the GOAT account from a Go-plan view). The visible-models filter shares the same full-catalog candidate list. Each entry also carries its plan-tier key so the editor dropdowns can group under tier headings.
|
|
30
|
+
|
|
31
|
+
## [0.10.1] - 2026-09-07
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- **Support the Command Code Provider Chat Completions API** ([#22](https://github.com/Mars-Sea/dsh-commandcode-provider/pull/22)). Accounts with Provider API access now use the documented `POST /provider/v1/chat/completions` transport (a flat OpenAI-compatible request body) instead of the legacy CLI transport. Historical reasoning is replayed as `reasoning_content` for tool-loop continuity, and OpenAI SSE chunks (`reasoning` / `reasoning_content` / `content` / `tool_calls` / `usage`) are parsed into stream output. The legacy `POST /alpha/generate` transport is unchanged (including its no-reasoning-replay behavior) and remains the route for Go-plan accounts plus the automatic fallback when the Provider API answers `upgrade_required`.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **Switching to Command Code mid-session no longer fails with `input[N].call_id must be <= 64`** ([#23](https://github.com/Mars-Sea/dsh-commandcode-provider/issues/23)). Tool-call ids issued by another provider can exceed the Command Code gateway's 64-character limit and were replayed verbatim, so the stream was rejected once such history existed. Overlong paired ids are now remapped to short per-request aliases (`cc-1`, `cc-2`, …) on both transports, with each call and its result resolving through the same map so the pair stays correlated; ids within the limit still pass through unchanged.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **Synced with the official command-code@1.50.0 CLI** (2026-09-06: re-verified with no snapshot changes). `COMMAND_CODE_CLI_VERSION` is now `1.50.0`. Re-verified against the official sources: wire protocol (both the `/alpha/generate` CLI transport and the `/provider/v1/chat/completions` Provider transport), endpoints, auth flow, model catalog, subscription plan maps, deals, and peak/off-peak windows are all identical to 1.49.1.
|
|
44
|
+
|
|
9
45
|
## [0.10.0] - 2026-09-04
|
|
10
46
|
|
|
11
47
|
> **First stable release for the dsh 0.1.2 line.** This release requires **dsh 0.1.2-rc.1 or later** and is published on the `latest` npm tag. It graduates the 0.10.0-alpha.x line (command-code syncs up to 1.47.0) to stable. The previous stable line — 0.9.1 for older Harness releases (the 0.5.0 era) — is no longer under active maintenance; it stays on npm for existing users but receives no further updates.
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Unofficial [DeepSeek Harness](https://deepseek-harness.github.io/deepseek-harnes
|
|
|
23
23
|
- **Multi-account rotation** — when one account hits its usage limit, requests switch to the next account automatically. See [Account rotation](#account-rotation).
|
|
24
24
|
- **Flexible API key setup** — via the settings page, an environment variable, or the official CLI login file.
|
|
25
25
|
- **Model-picker annotations** — minimum plan, active deal or `FREE` badge, peak/off-peak state, image support, and context window; free models listed first.
|
|
26
|
-
- **Plan-aware picker** — models above your subscription tier are hidden by default (toggleable).
|
|
26
|
+
- **Plan-aware picker** — models above your subscription tier are hidden by default (toggleable); an optional **Visible models** allowlist keeps only your favorites in the picker.
|
|
27
27
|
- **Reasoning-effort support** — models with selectable reasoning effort levels expose them in the picker.
|
|
28
28
|
- **Image input** — Vision-capable models accept images.
|
|
29
29
|
- **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).
|
|
@@ -95,6 +95,7 @@ With several Command Code subscriptions, the plugin **switches to the next accou
|
|
|
95
95
|
- **Setup** — use the **Account rotation** card at Settings → **Command Code** to add accounts with a label and API key; the top-level key always serves first as the `default` account.
|
|
96
96
|
- **Manual switching** — the **Active account** dropdown pins a preferred account; if it is exhausted, requests fall back to other accounts and return once its window resets.
|
|
97
97
|
- **Route models to accounts** — the **Route models to accounts** card picks catalog models (multi-select, fetched from the live catalog) and routes them to an account. A request whose model is in a rule serves from that account while it is usable; an exhausted or invalid routed account falls back to the normal rotation. Rules match in list order — the first hit wins.
|
|
98
|
+
- **Show only favorite models** — the **Visible models** card keeps only the checked models in the model picker; unchecked shows all (the default).
|
|
98
99
|
- **Status** — the **Account usage** card and `/commandcode` report per-account state.
|
|
99
100
|
|
|
100
101
|
The equivalent YAML (`$DSH_HOME/settings.yaml` or composition config):
|
|
@@ -116,6 +117,9 @@ llm-commandcode:
|
|
|
116
117
|
- models:
|
|
117
118
|
- tencent/hy4-preview
|
|
118
119
|
account: default
|
|
120
|
+
visibleModels: # optional: show only these models in pickers (catalog model ids); unset shows all
|
|
121
|
+
- deepseek/deepseek-v4-pro
|
|
122
|
+
- tencent/hy4-preview
|
|
119
123
|
```
|
|
120
124
|
|
|
121
125
|
## Configure
|
|
@@ -138,10 +142,10 @@ llm-commandcode:
|
|
|
138
142
|
|
|
139
143
|
When your deployment's dsh shell mounts the web capability (`@deepseek-ai/dsh-web` + `@deepseek-ai/dsh-tool-web`), the model's `web_search` tool is served by this plugin's `commandcode` search provider — it calls the Command Code Provider API's `/alpha/web-search` endpoint with the **same API key and base URL** as chat. You do not configure a separate search key, endpoint, or model.
|
|
140
144
|
|
|
141
|
-
**On by default.** The plugin's **Settings → Command Code** page has a *"Serve dsh web search with Command Code"* toggle (`webSearch`, default on). When on, the plugin selects `commandcode` as the active search backend automatically; turn it off to
|
|
145
|
+
**On by default.** The plugin's **Settings → Command Code** page has a *"Serve dsh web search with Command Code"* toggle (`webSearch`, default on). When on, the plugin selects `commandcode` as the active search backend automatically; turn it off to hand the selection back to whichever backend was there before (a sibling search plugin such as modsearch keeps working — it is never forced back to dsh's shipped DeepSeek search). The toggle takes effect on the next search — no restart needed.
|
|
142
146
|
|
|
143
147
|
- The provider registers as `commandcode` on `ctx.web` only when the web service is present; without it this stays a chat-only plugin.
|
|
144
|
-
- The toggle works by selecting `commandcode` in the web seam at boot and on every settings change. If you'd rather pin it durably, set `searchProvider: commandcode` (or `$DSH_WEB_SEARCH_PROVIDER=commandcode`); that remains effective even if this plugin's runtime selection is unavailable.
|
|
148
|
+
- The toggle works by selecting `commandcode` in the web seam at boot and on every settings change, remembering the backend it displaced; turning the toggle off (or unloading the plugin) restores that backend. If you'd rather pin it durably, set `searchProvider: commandcode` (or `$DSH_WEB_SEARCH_PROVIDER=commandcode`); that remains effective even if this plugin's runtime selection is unavailable.
|
|
145
149
|
- `numResults` from the dsh tool is clamped to the Command Code range (1–10, default 5); results map to the dsh `WebSearchSource` shape (`url`/`title`/`snippet`).
|
|
146
150
|
|
|
147
151
|
> This reuses the Command Code Provider API directly (like the official CLI's built-in `web_search`), so it is distinct from a DeepSeek-native search backend.
|
|
@@ -151,7 +155,7 @@ When your deployment's dsh shell mounts the web capability (`@deepseek-ai/dsh-we
|
|
|
151
155
|
- **Image input is model-gated** — only Vision models accept images; text-only models refuse them.
|
|
152
156
|
- 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.
|
|
153
157
|
- **No `stop` sequences** — requests carrying one fail.
|
|
154
|
-
-
|
|
158
|
+
- On the legacy `/alpha/generate` transport, reasoning blocks are not replayed into later turns; on the `/provider/v1/chat/completions` transport, historical reasoning is passed back as `reasoning_content` so tool-calling loops can keep their chain of thought. Only tool calls with a paired tool result are replayed on both transports.
|
|
155
159
|
- The model catalog is browsable without a key; chat requests need one.
|
|
156
160
|
|
|
157
161
|
## Permissions & privacy
|
package/README.zh-CN.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
- **多账户轮换**:一个账户用量打满后,请求自动切换到下一个账户。详见[多账户轮换](#多账户轮换)。
|
|
24
24
|
- **key 配置灵活**:设置页填写、环境变量或官方 CLI 登录文件均可。
|
|
25
25
|
- **模型选择器标注**:每个模型标注最低套餐、折扣/FREE 徽章、峰谷时段、图片支持与上下文长度,免费模型置顶。
|
|
26
|
-
-
|
|
26
|
+
- **按套餐过滤**:默认隐藏超出订阅套餐的模型,可一键关闭;「显示的模型」白名单可进一步只保留常用模型。
|
|
27
27
|
- **推理强度支持**:支持推理强度的模型可在选择器中选择档位。
|
|
28
28
|
- **图片输入**:Vision 模型支持发送图片。
|
|
29
29
|
- **联网搜索**:dsh 的 `web_search` 工具由 Command Code Provider API(`/alpha/web-search`)承载,复用聊天同一个 key 与端点,无需单独配置搜索 key 或地址。详见[联网搜索](#联网搜索)。
|
|
@@ -93,6 +93,7 @@ cmd login # macOS/Linux;Windows 原生版:cmdc login
|
|
|
93
93
|
- **配置**:在 **设置 → Command Code** 的「多账户轮换」卡片添加账户并填写备注名与 API key;顶层 key 始终是第一顺位的 `default` 账户。
|
|
94
94
|
- **手动切换**:卡片上的「当前使用账户」下拉框可指定优先账户;所选账户耗尽时自动回落到其他账户,窗口重置后自动恢复。
|
|
95
95
|
- **按模型切换账户**:在「按模型切换账户」卡片从实时模型目录**多选**模型并固定到某个账户。请求的模型在规则列表中且该账户可用时使用该账户;账户耗尽或密钥失效时自动回落到常规轮换。规则按列表顺序匹配,第一条命中生效。
|
|
96
|
+
- **只显示常用模型**:在「显示的模型」卡片勾选要保留的模型,模型选择器只列出这些;不勾选则显示全部(默认行为不变)。
|
|
96
97
|
- **状态展示**:「账户用量」卡片与 `/commandcode` 均按账户分别显示状态。
|
|
97
98
|
|
|
98
99
|
等价的 YAML(`$DSH_HOME/settings.yaml` 或组合配置):
|
|
@@ -114,6 +115,9 @@ llm-commandcode:
|
|
|
114
115
|
- models:
|
|
115
116
|
- tencent/hy4-preview
|
|
116
117
|
account: default
|
|
118
|
+
visibleModels: # 可选:只在选择器中显示这些模型(目录模型 id),不填显示全部
|
|
119
|
+
- deepseek/deepseek-v4-pro
|
|
120
|
+
- tencent/hy4-preview
|
|
117
121
|
```
|
|
118
122
|
|
|
119
123
|
## 配置
|
|
@@ -136,10 +140,10 @@ llm-commandcode:
|
|
|
136
140
|
|
|
137
141
|
当你的 dsh 部署加载了 web 能力(`@deepseek-ai/dsh-web` + `@deepseek-ai/dsh-tool-web`)时,模型所用的 `web_search` 工具会由本插件的 `commandcode` 搜索 provider 承载——它用**与聊天相同的 API key 与 base URL** 调用 Command Code Provider API 的 `/alpha/web-search` 端点。你无需另外配置搜索 key、端点或模型。
|
|
138
142
|
|
|
139
|
-
**默认开启。** 插件的 **设置 → Command Code** 页里有一个「用 Command Code 承载联网搜索」开关(`webSearch`,默认开)。开启时插件会自动把 `commandcode`
|
|
143
|
+
**默认开启。** 插件的 **设置 → Command Code** 页里有一个「用 Command Code 承载联网搜索」开关(`webSearch`,默认开)。开启时插件会自动把 `commandcode` 选为当前搜索后端;关闭则把选择权交还给之前的后端(比如 modsearch 等其他搜索插件可继续工作——不会被强制回退到 dsh 自带的 DeepSeek 搜索)。该开关在**下一次搜索时生效**,无需重启。
|
|
140
144
|
|
|
141
145
|
- 该 provider 仅在 web 服务存在时以 `commandcode` 注册进 `ctx.web`;没有它,本插件仍是纯聊天插件。
|
|
142
|
-
- 开关通过启动时与每次设置变更时在 web 接缝里选中 `commandcode`
|
|
146
|
+
- 开关通过启动时与每次设置变更时在 web 接缝里选中 `commandcode` 来实现,同时记住被顶掉的后端;关闭开关(或卸载插件)时会恢复那个后端。若你想更稳妥地固定,可设置 `searchProvider: commandcode`(或 `$DSH_WEB_SEARCH_PROVIDER=commandcode`);即使本插件的运行时选中不可用,该配置仍然生效。
|
|
143
147
|
- dsh 工具的 `numResults` 会被收敛到 Command Code 的取值范围(1–10,默认 5);结果映射为 dsh 的 `WebSearchSource` 结构(`url`/`title`/`snippet`)。
|
|
144
148
|
|
|
145
149
|
> 这里直接使用 Command Code Provider API(与官方 CLI 内置的 `web_search` 相同),因此与 DeepSeek 原生搜索后端不同。
|
|
@@ -149,7 +153,7 @@ llm-commandcode:
|
|
|
149
153
|
- **图片输入按模型能力限制**:仅 Vision 模型接受图片,纯文本模型会直接拒绝。
|
|
150
154
|
- 含图片的会话切换到纯文本模型会被 dsh 拒绝——请改选带 *`Image`* 标记的模型,或先移除图片。
|
|
151
155
|
- **不支持 `stop` 序列**:携带它的请求会报错。
|
|
152
|
-
-
|
|
156
|
+
- 在旧版 `/alpha/generate` 传输中,推理块不会重放到后续轮次;在 `/provider/v1/chat/completions` 传输中,历史推理会以 `reasoning_content` 回传,以便工具调用循环保留思维链。两种传输都只重放带配对工具结果的工具调用。
|
|
153
157
|
- 模型目录无需 key 即可浏览;对话请求需要 key。
|
|
154
158
|
|
|
155
159
|
## 权限与隐私
|