@mars-sea/dsh-commandcode-provider 0.10.0 → 0.10.1

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
@@ -6,6 +6,20 @@ 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.1] - 2026-09-07
10
+
11
+ ### Added
12
+
13
+ - **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`.
14
+
15
+ ### Fixed
16
+
17
+ - **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.
18
+
19
+ ### Changed
20
+
21
+ - **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.
22
+
9
23
  ## [0.10.0] - 2026-09-04
10
24
 
11
25
  > **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
@@ -151,7 +151,7 @@ When your deployment's dsh shell mounts the web capability (`@deepseek-ai/dsh-we
151
151
  - **Image input is model-gated** — only Vision models accept images; text-only models refuse them.
152
152
  - 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
153
  - **No `stop` sequences** — requests carrying one fail.
154
- - Reasoning blocks are not replayed into later turns; only tool calls with a paired tool result are replayed.
154
+ - 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
155
  - The model catalog is browsable without a key; chat requests need one.
156
156
 
157
157
  ## Permissions & privacy
package/README.zh-CN.md CHANGED
@@ -149,7 +149,7 @@ llm-commandcode:
149
149
  - **图片输入按模型能力限制**:仅 Vision 模型接受图片,纯文本模型会直接拒绝。
150
150
  - 含图片的会话切换到纯文本模型会被 dsh 拒绝——请改选带 *`Image`* 标记的模型,或先移除图片。
151
151
  - **不支持 `stop` 序列**:携带它的请求会报错。
152
- - 推理块不会重放到后续轮次;只有带配对工具结果的工具调用会被重放。
152
+ - 在旧版 `/alpha/generate` 传输中,推理块不会重放到后续轮次;在 `/provider/v1/chat/completions` 传输中,历史推理会以 `reasoning_content` 回传,以便工具调用循环保留思维链。两种传输都只重放带配对工具结果的工具调用。
153
153
  - 模型目录无需 key 即可浏览;对话请求需要 key。
154
154
 
155
155
  ## 权限与隐私
package/lib/client.js CHANGED
@@ -1736,7 +1736,7 @@ window.__ModuleLoader__.load({
1736
1736
  }
1737
1737
  //#endregion
1738
1738
  //#region package.json
1739
- var version = "0.10.0";
1739
+ var version = "0.10.1";
1740
1740
  var repository = {
1741
1741
  "type": "git",
1742
1742
  "url": "git+https://github.com/Mars-Sea/dsh-commandcode-provider.git"
package/lib/index.d.ts CHANGED
@@ -7,12 +7,14 @@ import { Context } from "@deepseek-ai/cordis";
7
7
  import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
8
8
  import { CommandDefinition } from "@deepseek-ai/dsh-commands";
9
9
  //#region src/adapter.d.ts
10
- declare const COMMAND_CODE_CLI_VERSION = "1.47.0";
10
+ declare const COMMAND_CODE_CLI_VERSION = "1.50.0";
11
11
  declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
12
12
  declare const DEFAULT_GENERATE_MAX_TOKENS = 64000;
13
13
  declare const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
14
14
  /** How long the picker's plan-filter billing facts stay cached before refetching. */
15
15
  declare const BILLING_ACCESS_TTL_MS: number;
16
+ /** Endpoint protocol selected for one generate call. */
17
+ type CommandCodeProtocol = 'cli' | 'openai';
16
18
  /** Head-of-request timeout: how long to wait for the first response byte. */
17
19
  declare const DEFAULT_REQUEST_TIMEOUT_MS = 60000;
18
20
  /** Stream idle timeout: a generation that stalls this long is a dead connection. */
@@ -43,6 +45,13 @@ interface CommandCodeConnectionOptions {
43
45
  * keep the full catalog visible. Set false to always list every model.
44
46
  */
45
47
  filterModelsByPlan?: boolean;
48
+ /**
49
+ * Optional protocol override. `'auto'` (default) uses billing/cache plus
50
+ * Provider API fallback; `'cli'` forces `/alpha/generate`; `'openai'` forces
51
+ * `/provider/v1/chat/completions`. This is a connection-level test/operator
52
+ * seam and is intentionally not part of the plugin's user settings schema.
53
+ */
54
+ protocol?: 'auto' | CommandCodeProtocol;
46
55
  }
47
56
  /**
48
57
  * Resolve the durable attachment service, or undefined when the host does not
@@ -154,6 +163,7 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
154
163
  private readonly resolveAttachments;
155
164
  private readonly billingAccess;
156
165
  private readonly billingAccessInflight;
166
+ private readonly protocolCache;
157
167
  constructor(deps: CommandCodeAdapterDeps<C>);
158
168
  /**
159
169
  * Display metadata for the picker's provider group header. The base class
@@ -203,6 +213,18 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
203
213
  * to `undefined` (fail-open) rather than breaking the picker.
204
214
  */
205
215
  private fetchBillingAccess;
216
+ /** Fresh cached billing tier weight for a key, or undefined when not known. */
217
+ private cachedBillingTierWeight;
218
+ /** Cached protocol decision for a key, or undefined when expired/unknown. */
219
+ private cachedProtocolUseCli;
220
+ private rememberProtocol;
221
+ /**
222
+ * Choose the initial protocol for one request. A fresh protocol cache entry
223
+ * wins; otherwise a cached (not network-fetched) billing tier of Go is
224
+ * treated as CLI-only. Unknown accounts default to Provider API and fall
225
+ * back only after an `upgrade_required` rejection.
226
+ */
227
+ private resolveProtocol;
206
228
  /**
207
229
  * Fetch account, usage, credit, and subscription state from the Command
208
230
  * Code account endpoints (`/alpha/whoami`, `/alpha/usage/summary`,
@@ -445,7 +467,7 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
445
467
  */
446
468
  declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
447
469
  /**
448
- * Models the official CLI's model table (command-code@1.46.0) marks
470
+ * Models the official CLI's model table (command-code@1.50.0) marks
449
471
  * `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
450
472
  * think automatically, with Command Code driving the depth. This is the
451
473
  * authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
@@ -453,7 +475,7 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
453
475
  * effort levels, and this snapshot is not surfaced in the picker's compact
454
476
  * description — it exists for programmatic consumers.
455
477
  *
456
- * Source: the command-code@1.46.0 bundled model table (dist/cli.mjs),
478
+ * Source: the command-code@1.50.0 bundled model table (dist/cli.mjs),
457
479
  * cross-checked with https://commandcode.ai/docs/reference/cli/models.
458
480
  * (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
459
481
  * selectable `['low', 'high', 'max']` efforts; the preview then ended in
@@ -515,8 +537,8 @@ declare function compareByPlan(a: {
515
537
  }): number;
516
538
  /**
517
539
  * Subscription plan table, synced from the official CLI bundle's plan maps
518
- * (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs`, re-verified unchanged
519
- * against 1.32.2 where they appear as `Zn`/`er`): subscription `planId`
540
+ * (located by the `"individual-go"` key in command-code@1.50.0 `dist/cli.mjs`,
541
+ * re-verified unchanged through 1.50.0): subscription `planId`
520
542
  * prefix → display name and the plan's monthly credit total. This is the
521
543
  * account's own subscription (from `/alpha/billing/subscriptions`) — distinct
522
544
  * from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.