@mars-sea/dsh-commandcode-provider 0.6.2 → 0.7.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 +20 -0
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/lib/client.js +26 -26
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +14 -9
- package/lib/index.js +34 -18
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
|
|
|
24
24
|
*/
|
|
25
25
|
declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
26
26
|
/**
|
|
27
|
-
* Models the official CLI's model table (
|
|
27
|
+
* Models the official CLI's model table (command-code@1.32.1) marks
|
|
28
28
|
* `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
|
|
29
29
|
* think automatically, with Command Code driving the depth. This is the
|
|
30
30
|
* authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
|
|
@@ -32,8 +32,10 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
|
32
32
|
* effort levels, and this snapshot is not surfaced in the picker's compact
|
|
33
33
|
* description — it exists for programmatic consumers.
|
|
34
34
|
*
|
|
35
|
-
* Source: the command-code@1.
|
|
36
|
-
*
|
|
35
|
+
* Source: the command-code@1.32.1 bundled model table (dist/cli.mjs),
|
|
36
|
+
* cross-checked with https://commandcode.ai/docs/reference/cli/models.
|
|
37
|
+
* (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
|
|
38
|
+
* selectable `['low', 'high', 'max']` efforts.)
|
|
37
39
|
* Keep in sync via the dsh-commandcode-upstream skill.
|
|
38
40
|
*/
|
|
39
41
|
declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
@@ -74,7 +76,8 @@ declare function compareByPlan(a: {
|
|
|
74
76
|
}): number;
|
|
75
77
|
/**
|
|
76
78
|
* Subscription plan table, synced from the official CLI bundle's plan maps
|
|
77
|
-
* (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs
|
|
79
|
+
* (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs`, re-verified unchanged
|
|
80
|
+
* against 1.32.1 where they appear as `Zn`/`er`): subscription `planId`
|
|
78
81
|
* prefix → display name and the plan's monthly credit total. This is the
|
|
79
82
|
* account's own subscription (from `/alpha/billing/subscriptions`) — distinct
|
|
80
83
|
* from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.
|
|
@@ -151,10 +154,12 @@ declare const KNOWN_DEALS: Readonly<Record<string, KnownDeal>>;
|
|
|
151
154
|
* Models with time-of-day (peak/off-peak) pricing, per the official pricing
|
|
152
155
|
* page (`/docs/resources/pricing-limits`). Since 2026-08-16 16:00 UTC, DeepSeek
|
|
153
156
|
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h/day,
|
|
154
|
-
* full price); the other 17 hours are off-peak at half price. The
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
157
|
+
* full price); the other 17 hours are off-peak at half price. The V4 Flash
|
|
158
|
+
* Vision (exp) variant (command-code@1.32.0) shares the V4 Flash windows and
|
|
159
|
+
* peak prices ($0.44/$1.32). The picker shows the *current* state as a compact
|
|
160
|
+
* label (`Peak`/`Half`) matching the English noun style of the other markers
|
|
161
|
+
* (`Image`, `FREE`), so a developer can tell at a glance whether calling the
|
|
162
|
+
* model right now is cheap or expensive.
|
|
158
163
|
*
|
|
159
164
|
* Keep in sync with the official pricing page when the model set or the peak
|
|
160
165
|
* windows change (see the dsh-commandcode-upstream skill).
|
|
@@ -173,7 +178,7 @@ declare function peakPricingState(modelId: string, now?: number): 'peak' | 'off-
|
|
|
173
178
|
* for models without time-of-day pricing.
|
|
174
179
|
*/
|
|
175
180
|
declare function peakPricingLabel(modelId: string, now?: number): string | undefined;
|
|
176
|
-
declare const COMMAND_CODE_CLI_VERSION = "1.
|
|
181
|
+
declare const COMMAND_CODE_CLI_VERSION = "1.32.1";
|
|
177
182
|
declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
|
|
178
183
|
declare const DEFAULT_GENERATE_MAX_TOKENS = 64000;
|
|
179
184
|
declare const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
|
package/lib/index.js
CHANGED
|
@@ -214,7 +214,7 @@ var CommandCodeAccountPool = class {
|
|
|
214
214
|
* and API key or subscription, and Command Code's terms apply.
|
|
215
215
|
*
|
|
216
216
|
* Wire protocol (reverse-engineered by the pi plugin, command-code@1.28.4;
|
|
217
|
-
* re-verified against command-code@1.
|
|
217
|
+
* re-verified against command-code@1.32.1 — endpoints, request shape, and
|
|
218
218
|
* stream events unchanged):
|
|
219
219
|
* POST {apiBase}/alpha/generate
|
|
220
220
|
* body: { config, memory, taste, skills, params: { model, messages, tools,
|
|
@@ -281,6 +281,7 @@ const KNOWN_EFFORTS = {
|
|
|
281
281
|
"max"
|
|
282
282
|
],
|
|
283
283
|
"deepseek/deepseek-v4-flash": ["high", "max"],
|
|
284
|
+
"deepseek/deepseek-v4-flash-vision-exp": ["high", "max"],
|
|
284
285
|
"deepseek/deepseek-v4-pro": ["high", "max"],
|
|
285
286
|
"google/gemini-3.1-flash-lite": [
|
|
286
287
|
"low",
|
|
@@ -352,6 +353,11 @@ const KNOWN_EFFORTS = {
|
|
|
352
353
|
"max"
|
|
353
354
|
],
|
|
354
355
|
"sakana/fugu-ultra": ["high", "xhigh"],
|
|
356
|
+
"stealth/ox-alpha": [
|
|
357
|
+
"low",
|
|
358
|
+
"high",
|
|
359
|
+
"max"
|
|
360
|
+
],
|
|
355
361
|
"xai/grok-4.5": [
|
|
356
362
|
"low",
|
|
357
363
|
"medium",
|
|
@@ -399,6 +405,7 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
399
405
|
"claude-opus-5",
|
|
400
406
|
"claude-sonnet-4-6",
|
|
401
407
|
"claude-sonnet-5",
|
|
408
|
+
"deepseek/deepseek-v4-flash-vision-exp",
|
|
402
409
|
"google/gemini-3.1-flash-lite",
|
|
403
410
|
"google/gemini-3.5-flash",
|
|
404
411
|
"google/gemini-3.5-flash-lite",
|
|
@@ -428,7 +435,7 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
428
435
|
"xiaomi/mimo-v2.5"
|
|
429
436
|
]);
|
|
430
437
|
/**
|
|
431
|
-
* Models the official CLI's model table (
|
|
438
|
+
* Models the official CLI's model table (command-code@1.32.1) marks
|
|
432
439
|
* `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
|
|
433
440
|
* think automatically, with Command Code driving the depth. This is the
|
|
434
441
|
* authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
|
|
@@ -436,8 +443,10 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
436
443
|
* effort levels, and this snapshot is not surfaced in the picker's compact
|
|
437
444
|
* description — it exists for programmatic consumers.
|
|
438
445
|
*
|
|
439
|
-
* Source: the command-code@1.
|
|
440
|
-
*
|
|
446
|
+
* Source: the command-code@1.32.1 bundled model table (dist/cli.mjs),
|
|
447
|
+
* cross-checked with https://commandcode.ai/docs/reference/cli/models.
|
|
448
|
+
* (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
|
|
449
|
+
* selectable `['low', 'high', 'max']` efforts.)
|
|
441
450
|
* Keep in sync via the dsh-commandcode-upstream skill.
|
|
442
451
|
*/
|
|
443
452
|
const KNOWN_THINKING_MODELS = /* @__PURE__ */ new Set([
|
|
@@ -459,8 +468,7 @@ const KNOWN_THINKING_MODELS = /* @__PURE__ */ new Set([
|
|
|
459
468
|
"poolside/laguna-s-2.1-free",
|
|
460
469
|
"meta/muse-spark-1.1",
|
|
461
470
|
"meta/muse-spark-1.2",
|
|
462
|
-
"meta/muse-spark-1.2-contributor"
|
|
463
|
-
"stealth/ox-alpha"
|
|
471
|
+
"meta/muse-spark-1.2-contributor"
|
|
464
472
|
]);
|
|
465
473
|
/**
|
|
466
474
|
* The minimum subscription plan a model is included in, per the official plan
|
|
@@ -489,6 +497,7 @@ const KNOWN_PLANS = {
|
|
|
489
497
|
"Qwen/Qwen3.8-27B": "go",
|
|
490
498
|
"Qwen/Qwen3.8-Max": "go",
|
|
491
499
|
"deepseek/deepseek-v4-flash": "go",
|
|
500
|
+
"deepseek/deepseek-v4-flash-vision-exp": "go",
|
|
492
501
|
"deepseek/deepseek-v4-pro": "go",
|
|
493
502
|
"gpt-5.6-luna": "go",
|
|
494
503
|
"meta/muse-spark-1.2-contributor": "go",
|
|
@@ -581,7 +590,8 @@ function compareByPlan(a, b) {
|
|
|
581
590
|
}
|
|
582
591
|
/**
|
|
583
592
|
* Subscription plan table, synced from the official CLI bundle's plan maps
|
|
584
|
-
* (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs
|
|
593
|
+
* (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs`, re-verified unchanged
|
|
594
|
+
* against 1.32.1 where they appear as `Zn`/`er`): subscription `planId`
|
|
585
595
|
* prefix → display name and the plan's monthly credit total. This is the
|
|
586
596
|
* account's own subscription (from `/alpha/billing/subscriptions`) — distinct
|
|
587
597
|
* from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.
|
|
@@ -683,15 +693,21 @@ const KNOWN_DEALS = {
|
|
|
683
693
|
* Models with time-of-day (peak/off-peak) pricing, per the official pricing
|
|
684
694
|
* page (`/docs/resources/pricing-limits`). Since 2026-08-16 16:00 UTC, DeepSeek
|
|
685
695
|
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h/day,
|
|
686
|
-
* full price); the other 17 hours are off-peak at half price. The
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
*
|
|
696
|
+
* full price); the other 17 hours are off-peak at half price. The V4 Flash
|
|
697
|
+
* Vision (exp) variant (command-code@1.32.0) shares the V4 Flash windows and
|
|
698
|
+
* peak prices ($0.44/$1.32). The picker shows the *current* state as a compact
|
|
699
|
+
* label (`Peak`/`Half`) matching the English noun style of the other markers
|
|
700
|
+
* (`Image`, `FREE`), so a developer can tell at a glance whether calling the
|
|
701
|
+
* model right now is cheap or expensive.
|
|
690
702
|
*
|
|
691
703
|
* Keep in sync with the official pricing page when the model set or the peak
|
|
692
704
|
* windows change (see the dsh-commandcode-upstream skill).
|
|
693
705
|
*/
|
|
694
|
-
const KNOWN_PEAK_PRICING = /* @__PURE__ */ new Set([
|
|
706
|
+
const KNOWN_PEAK_PRICING = /* @__PURE__ */ new Set([
|
|
707
|
+
"deepseek/deepseek-v4-pro",
|
|
708
|
+
"deepseek/deepseek-v4-flash",
|
|
709
|
+
"deepseek/deepseek-v4-flash-vision-exp"
|
|
710
|
+
]);
|
|
695
711
|
/** Peak hours (UTC, hour-of-day range end-exclusive): 01–03 and 06–09. */
|
|
696
712
|
const PEAK_HOUR_RANGES = [[1, 4], [6, 10]];
|
|
697
713
|
/**
|
|
@@ -715,7 +731,7 @@ function peakPricingLabel(modelId, now = Date.now()) {
|
|
|
715
731
|
if (state === void 0) return void 0;
|
|
716
732
|
return state === "peak" ? "Peak" : "Half";
|
|
717
733
|
}
|
|
718
|
-
const COMMAND_CODE_CLI_VERSION = "1.
|
|
734
|
+
const COMMAND_CODE_CLI_VERSION = "1.32.1";
|
|
719
735
|
const DEFAULT_API_BASE = "https://api.commandcode.ai";
|
|
720
736
|
const DEFAULT_GENERATE_MAX_TOKENS = 64e3;
|
|
721
737
|
const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
|
|
@@ -1423,8 +1439,8 @@ var CommandCodeAdapter = class extends LlmAdapter {
|
|
|
1423
1439
|
} catch (error) {
|
|
1424
1440
|
cleanup();
|
|
1425
1441
|
if (options.signal?.aborted) throw error;
|
|
1426
|
-
if (connectTimedOut || error instanceof DOMException && error.name === "TimeoutError") throw new LlmError(`Command Code API request to ${connection.apiBase}/alpha/generate did not respond within ${connection.requestTimeoutMs}ms: ${errorChain(error)}
|
|
1427
|
-
throw new LlmError(`Command Code API request to ${connection.apiBase}/alpha/generate failed: ${errorChain(error)}
|
|
1442
|
+
if (connectTimedOut || error instanceof DOMException && error.name === "TimeoutError") throw new LlmError(`Command Code API request to ${connection.apiBase}/alpha/generate did not respond within ${connection.requestTimeoutMs}ms: ${errorChain(error)};Command Code API 请求在 ${connection.requestTimeoutMs} 毫秒内未收到响应——通常是网络或代理问题,请检查后重试`, "TIMEOUT", { cause: error });
|
|
1443
|
+
throw new LlmError(`Command Code API request to ${connection.apiBase}/alpha/generate failed: ${errorChain(error)};Command Code API 请求连接失败——通常是网络或代理问题,请检查网络或代理设置后重试`, "TRANSPORT", { cause: error });
|
|
1428
1444
|
}
|
|
1429
1445
|
if (!response.ok) {
|
|
1430
1446
|
const errText = await response.text().catch(() => "");
|
|
@@ -1643,13 +1659,13 @@ var CommandCodeAdapter = class extends LlmAdapter {
|
|
|
1643
1659
|
read = await reader.read();
|
|
1644
1660
|
} catch (error) {
|
|
1645
1661
|
if (options.signal?.aborted) throw error;
|
|
1646
|
-
throw new LlmError(`Command Code API stream from ${connection.apiBase} failed while reading: ${errorChain(error)}
|
|
1662
|
+
throw new LlmError(`Command Code API stream from ${connection.apiBase} failed while reading: ${errorChain(error)};Command Code API 流式响应中途断开——网络波动所致,重试通常可恢复`, "TRANSPORT", { cause: error });
|
|
1647
1663
|
} finally {
|
|
1648
1664
|
clearIdle();
|
|
1649
1665
|
}
|
|
1650
1666
|
const { done, value } = read;
|
|
1651
1667
|
if (done) {
|
|
1652
|
-
if (idleFired) throw new LlmError(`Command Code API stream from ${connection.apiBase} was idle for ${connection.streamIdleTimeoutMs}ms (no events) and was treated as a dead connection
|
|
1668
|
+
if (idleFired) throw new LlmError(`Command Code API stream from ${connection.apiBase} was idle for ${connection.streamIdleTimeoutMs}ms (no events) and was treated as a dead connection;Command Code API 流式响应已 ${connection.streamIdleTimeoutMs} 毫秒无任何事件,被判定为死连接——长思考模型可在设置中调大流空闲超时`, "TIMEOUT");
|
|
1653
1669
|
if (buffer.trim()) for (const chunk of handleEvent(parseStreamEventLine(buffer))) yield chunk;
|
|
1654
1670
|
break;
|
|
1655
1671
|
}
|
|
@@ -1668,7 +1684,7 @@ var CommandCodeAdapter = class extends LlmAdapter {
|
|
|
1668
1684
|
if (!finished) {
|
|
1669
1685
|
yield* closeText();
|
|
1670
1686
|
yield* closeReasoning();
|
|
1671
|
-
if (!sawContent) throw new LlmError("Command Code returned an empty response", "EMPTY_RESPONSE");
|
|
1687
|
+
if (!sawContent) throw new LlmError("Command Code returned an empty response;Command Code 返回了空响应,重试通常可恢复", "EMPTY_RESPONSE");
|
|
1672
1688
|
yield {
|
|
1673
1689
|
type: "finish",
|
|
1674
1690
|
reason: { kind: "stop" }
|