@mars-sea/dsh-commandcode-provider 0.10.2 → 0.10.3
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 +19 -1
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/lib/client.js +18 -8
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +43 -21
- package/lib/index.js +81 -28
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ 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.
|
|
10
|
+
declare const COMMAND_CODE_CLI_VERSION = "1.53.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;
|
|
@@ -487,7 +487,7 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
|
|
|
487
487
|
*/
|
|
488
488
|
declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
489
489
|
/**
|
|
490
|
-
* Models the official CLI's model table (command-code@1.
|
|
490
|
+
* Models the official CLI's model table (command-code@1.53.0) marks
|
|
491
491
|
* `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
|
|
492
492
|
* think automatically, with Command Code driving the depth. This is the
|
|
493
493
|
* authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
|
|
@@ -495,7 +495,7 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
|
495
495
|
* effort levels, and this snapshot is not surfaced in the picker's compact
|
|
496
496
|
* description — it exists for programmatic consumers.
|
|
497
497
|
*
|
|
498
|
-
* Source: the command-code@1.
|
|
498
|
+
* Source: the command-code@1.53.0 bundled model table (dist/cli.mjs),
|
|
499
499
|
* cross-checked with https://commandcode.ai/docs/reference/cli/models.
|
|
500
500
|
* (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
|
|
501
501
|
* selectable `['low', 'high', 'max']` efforts; the preview then ended in
|
|
@@ -508,7 +508,13 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
|
508
508
|
* to `KNOWN_EFFORTS`. command-code@1.42.0 added `meituan/LongCat-2.0:free`
|
|
509
509
|
* (reasoning:!0, no efforts). command-code@1.45.0 gave the Muse Spark family
|
|
510
510
|
* (1.1, 1.2, 1.2-contributor, 1.3, 1.3-contributor) selectable
|
|
511
|
-
* `['low', 'medium', 'high', 'xhigh']` efforts — they moved to `KNOWN_EFFORTS`.
|
|
511
|
+
* `['low', 'medium', 'high', 'xhigh']` efforts — they moved to `KNOWN_EFFORTS`.
|
|
512
|
+
* command-code@1.51.3 gave `MiniMaxAI/MiniMax-M3` selectable
|
|
513
|
+
* `['low', 'medium', 'high']` efforts — it moved to `KNOWN_EFFORTS` too.
|
|
514
|
+
* command-code@1.52.0 added `inclusionai/ling-3.0-flash-sante:free`
|
|
515
|
+
* (reasoning:!0, no efforts).)
|
|
516
|
+
* command-code@1.53.0 added `deepseek/deepseek-v4.1-flash` with selectable
|
|
517
|
+
* ['low', 'high', 'max'] efforts, so it lives in `KNOWN_EFFORTS`, not here.)
|
|
512
518
|
* Keep in sync via the dsh-commandcode-upstream skill.
|
|
513
519
|
*/
|
|
514
520
|
declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
@@ -525,7 +531,9 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
|
525
531
|
* command-code@1.41.0 added `Qwen/Qwen3.8-Max-0902` (Go) and 1.42.0 added
|
|
526
532
|
* `meituan/LongCat-2.0:free` (Go, free promo); command-code@1.43.0 added
|
|
527
533
|
* `google/gemini-3.8-flash` (GOAT) and 1.44.0 added `meta/muse-spark-1.3`
|
|
528
|
-
* (GOAT) plus its Contributor sibling (Go).
|
|
534
|
+
* (GOAT) plus its Contributor sibling (Go); command-code@1.52.0 added the
|
|
535
|
+
* free `inclusionai/ling-3.0-flash-sante:free` (Go); command-code@1.53.0
|
|
536
|
+
* added `deepseek/deepseek-v4.1-flash` (Go).
|
|
529
537
|
*
|
|
530
538
|
* The Provider API exposes no plan metadata, so this snapshot is the source of
|
|
531
539
|
* truth for the picker's plan annotation — it answers "which plan do I need to
|
|
@@ -557,8 +565,8 @@ declare function compareByPlan(a: {
|
|
|
557
565
|
}): number;
|
|
558
566
|
/**
|
|
559
567
|
* Subscription plan table, synced from the official CLI bundle's plan maps
|
|
560
|
-
* (located by the `"individual-go"` key in command-code@1.
|
|
561
|
-
* re-verified unchanged through 1.
|
|
568
|
+
* (located by the `"individual-go"` key in command-code@1.53.0 `dist/cli.mjs`,
|
|
569
|
+
* re-verified unchanged through 1.53.0): subscription `planId`
|
|
562
570
|
* prefix → display name and the plan's monthly credit total. This is the
|
|
563
571
|
* account's own subscription (from `/alpha/billing/subscriptions`) — distinct
|
|
564
572
|
* from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.
|
|
@@ -635,29 +643,43 @@ declare const KNOWN_DEALS: Readonly<Record<string, KnownDeal>>;
|
|
|
635
643
|
/**
|
|
636
644
|
* Models with time-of-day (peak/off-peak) pricing, per the official pricing
|
|
637
645
|
* page (`/docs/resources/pricing-limits`). Since 2026-08-16 16:00 UTC, DeepSeek
|
|
638
|
-
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h
|
|
639
|
-
* full price)
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
646
|
+
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h per
|
|
647
|
+
* weekday, full price) **Monday to Friday only**; the other 17 hours of a
|
|
648
|
+
* weekday and every hour of Saturday/Sunday (UTC) are off-peak at half price.
|
|
649
|
+
* The V4 Flash Vision (exp) variant (command-code@1.32.0) shares the V4 Flash
|
|
650
|
+
* windows and peak prices ($0.44/$1.32) — each row's hover annotation states
|
|
651
|
+
* exactly 2× that row's displayed off-peak prices. The picker shows the
|
|
643
652
|
* *current* state as a compact
|
|
644
653
|
* label (`Peak`/`Half`) matching the English noun style of the other markers
|
|
645
654
|
* (`Image`, `FREE`), so a developer can tell at a glance whether calling the
|
|
646
655
|
* model right now is cheap or expensive.
|
|
647
656
|
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
*
|
|
651
|
-
*
|
|
652
|
-
*
|
|
657
|
+
* Authoritative extraction: the pricing page embeds a model JSON array whose
|
|
658
|
+
* hourly-priced entries carry a `timeOfDay` block
|
|
659
|
+
* (`{ windows: "01–04 & 06–10 UTC, Mon–Fri", peakHoursPerDay: 7,
|
|
660
|
+
* offPeakHoursPerDay: 17, peak: {...}, offPeak: {...} }`). Exactly four models
|
|
661
|
+
* carry it: V4 Pro, V4 Flash, V4 Flash Vision (exp), and V4.1 Flash (added in
|
|
662
|
+
* command-code@1.53.0 at $0.15/$0.60 off-peak, $0.30/$1.20 peak — the same
|
|
663
|
+
* schedule as the other three).
|
|
653
664
|
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
665
|
+
* Extraction caution: the rendered HTML rows are a trap. Each annotation div
|
|
666
|
+
* sits inside its OWN row's container, immediately before the NEXT row starts,
|
|
667
|
+
* so flattening the page to text makes every annotation look like it belongs
|
|
668
|
+
* to the model printed after it — that is how `deepseek/deepseek-v4-flash-fast`
|
|
669
|
+
* was wrongly added here (its row is flat-priced at $0.28/$0.56/$0.07 and has
|
|
670
|
+
* no `timeOfDay` block). Trust the embedded JSON's `timeOfDay` membership and
|
|
671
|
+
* the 2× price relation, never the flat-text neighbor.
|
|
672
|
+
*
|
|
673
|
+
* Keep in sync with the official pricing page when the model set, the peak
|
|
674
|
+
* windows, or the weekday rule change (see the dsh-commandcode-upstream skill).
|
|
656
675
|
*/
|
|
657
676
|
declare const KNOWN_PEAK_PRICING: ReadonlySet<string>;
|
|
658
677
|
/**
|
|
659
|
-
* Whether `now` (defaults to `Date.now()`) falls in a peak-pricing
|
|
660
|
-
* time-of-day-priced models.
|
|
678
|
+
* Whether `now` (defaults to `Date.now()`) falls in a peak-pricing window for
|
|
679
|
+
* time-of-day-priced models. Peak rates apply Monday–Friday (UTC) only: the
|
|
680
|
+
* official rule charges Saturday and Sunday completely off-peak for all 24
|
|
681
|
+
* hours, so a weekend timestamp is off-peak even inside `PEAK_HOUR_RANGES`.
|
|
682
|
+
* `undefined` for models outside the snapshot.
|
|
661
683
|
*/
|
|
662
684
|
declare function peakPricingState(modelId: string, now?: number): 'peak' | 'off-peak' | undefined;
|
|
663
685
|
/**
|
package/lib/index.js
CHANGED
|
@@ -338,6 +338,11 @@ const KNOWN_EFFORTS = {
|
|
|
338
338
|
"high",
|
|
339
339
|
"max"
|
|
340
340
|
],
|
|
341
|
+
"deepseek/deepseek-v4.1-flash": [
|
|
342
|
+
"low",
|
|
343
|
+
"high",
|
|
344
|
+
"max"
|
|
345
|
+
],
|
|
341
346
|
"deepseek/deepseek-v4-flash": ["high", "max"],
|
|
342
347
|
"deepseek/deepseek-v4-flash-vision-exp": ["high", "max"],
|
|
343
348
|
"deepseek/deepseek-v4-pro": ["high", "max"],
|
|
@@ -485,6 +490,11 @@ const KNOWN_EFFORTS = {
|
|
|
485
490
|
"high",
|
|
486
491
|
"xhigh",
|
|
487
492
|
"max"
|
|
493
|
+
],
|
|
494
|
+
"MiniMaxAI/MiniMax-M3": [
|
|
495
|
+
"low",
|
|
496
|
+
"medium",
|
|
497
|
+
"high"
|
|
488
498
|
]
|
|
489
499
|
};
|
|
490
500
|
/**
|
|
@@ -520,6 +530,7 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
520
530
|
"claude-sonnet-4-6",
|
|
521
531
|
"claude-sonnet-5",
|
|
522
532
|
"deepseek/deepseek-v4-flash-vision-exp",
|
|
533
|
+
"deepseek/deepseek-v4.1-flash",
|
|
523
534
|
"google/gemini-3.1-flash-lite",
|
|
524
535
|
"google/gemini-3.5-flash",
|
|
525
536
|
"google/gemini-3.5-flash-lite",
|
|
@@ -554,7 +565,7 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
554
565
|
"z-ai/glm-5.3-flash"
|
|
555
566
|
]);
|
|
556
567
|
/**
|
|
557
|
-
* Models the official CLI's model table (command-code@1.
|
|
568
|
+
* Models the official CLI's model table (command-code@1.53.0) marks
|
|
558
569
|
* `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
|
|
559
570
|
* think automatically, with Command Code driving the depth. This is the
|
|
560
571
|
* authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
|
|
@@ -562,7 +573,7 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
562
573
|
* effort levels, and this snapshot is not surfaced in the picker's compact
|
|
563
574
|
* description — it exists for programmatic consumers.
|
|
564
575
|
*
|
|
565
|
-
* Source: the command-code@1.
|
|
576
|
+
* Source: the command-code@1.53.0 bundled model table (dist/cli.mjs),
|
|
566
577
|
* cross-checked with https://commandcode.ai/docs/reference/cli/models.
|
|
567
578
|
* (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
|
|
568
579
|
* selectable `['low', 'high', 'max']` efforts; the preview then ended in
|
|
@@ -575,11 +586,16 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
575
586
|
* to `KNOWN_EFFORTS`. command-code@1.42.0 added `meituan/LongCat-2.0:free`
|
|
576
587
|
* (reasoning:!0, no efforts). command-code@1.45.0 gave the Muse Spark family
|
|
577
588
|
* (1.1, 1.2, 1.2-contributor, 1.3, 1.3-contributor) selectable
|
|
578
|
-
* `['low', 'medium', 'high', 'xhigh']` efforts — they moved to `KNOWN_EFFORTS`.
|
|
589
|
+
* `['low', 'medium', 'high', 'xhigh']` efforts — they moved to `KNOWN_EFFORTS`.
|
|
590
|
+
* command-code@1.51.3 gave `MiniMaxAI/MiniMax-M3` selectable
|
|
591
|
+
* `['low', 'medium', 'high']` efforts — it moved to `KNOWN_EFFORTS` too.
|
|
592
|
+
* command-code@1.52.0 added `inclusionai/ling-3.0-flash-sante:free`
|
|
593
|
+
* (reasoning:!0, no efforts).)
|
|
594
|
+
* command-code@1.53.0 added `deepseek/deepseek-v4.1-flash` with selectable
|
|
595
|
+
* ['low', 'high', 'max'] efforts, so it lives in `KNOWN_EFFORTS`, not here.)
|
|
579
596
|
* Keep in sync via the dsh-commandcode-upstream skill.
|
|
580
597
|
*/
|
|
581
598
|
const KNOWN_THINKING_MODELS = /* @__PURE__ */ new Set([
|
|
582
|
-
"MiniMaxAI/MiniMax-M3",
|
|
583
599
|
"Qwen/Qwen3.6-Max-Preview",
|
|
584
600
|
"Qwen/Qwen3.6-Plus",
|
|
585
601
|
"Qwen/Qwen3.7-Flash",
|
|
@@ -594,7 +610,8 @@ const KNOWN_THINKING_MODELS = /* @__PURE__ */ new Set([
|
|
|
594
610
|
"thinkingmachines/inkling",
|
|
595
611
|
"thinkingmachines/inkling-small",
|
|
596
612
|
"poolside/laguna-s-2.1-free",
|
|
597
|
-
"meituan/LongCat-2.0:free"
|
|
613
|
+
"meituan/LongCat-2.0:free",
|
|
614
|
+
"inclusionai/ling-3.0-flash-sante:free"
|
|
598
615
|
]);
|
|
599
616
|
/**
|
|
600
617
|
* The minimum subscription plan a model is included in, per the official plan
|
|
@@ -609,7 +626,9 @@ const KNOWN_THINKING_MODELS = /* @__PURE__ */ new Set([
|
|
|
609
626
|
* command-code@1.41.0 added `Qwen/Qwen3.8-Max-0902` (Go) and 1.42.0 added
|
|
610
627
|
* `meituan/LongCat-2.0:free` (Go, free promo); command-code@1.43.0 added
|
|
611
628
|
* `google/gemini-3.8-flash` (GOAT) and 1.44.0 added `meta/muse-spark-1.3`
|
|
612
|
-
* (GOAT) plus its Contributor sibling (Go).
|
|
629
|
+
* (GOAT) plus its Contributor sibling (Go); command-code@1.52.0 added the
|
|
630
|
+
* free `inclusionai/ling-3.0-flash-sante:free` (Go); command-code@1.53.0
|
|
631
|
+
* added `deepseek/deepseek-v4.1-flash` (Go).
|
|
613
632
|
*
|
|
614
633
|
* The Provider API exposes no plan metadata, so this snapshot is the source of
|
|
615
634
|
* truth for the picker's plan annotation — it answers "which plan do I need to
|
|
@@ -633,11 +652,13 @@ const KNOWN_PLANS = {
|
|
|
633
652
|
"Qwen/Qwen3.8-Max": "go",
|
|
634
653
|
"Qwen/Qwen3.8-Max-0902": "go",
|
|
635
654
|
"deepseek/deepseek-v4-flash-fast": "go",
|
|
655
|
+
"deepseek/deepseek-v4.1-flash": "go",
|
|
636
656
|
"deepseek/deepseek-v4-flash": "go",
|
|
637
657
|
"deepseek/deepseek-v4-flash-vision-exp": "go",
|
|
638
658
|
"deepseek/deepseek-v4-pro": "go",
|
|
639
659
|
"gpt-5.6-luna": "go",
|
|
640
660
|
"meituan/LongCat-2.0:free": "go",
|
|
661
|
+
"inclusionai/ling-3.0-flash-sante:free": "go",
|
|
641
662
|
"meta/muse-spark-1.2-contributor": "go",
|
|
642
663
|
"meta/muse-spark-1.3-contributor": "go",
|
|
643
664
|
"moonshotai/Kimi-K2.5": "go",
|
|
@@ -734,8 +755,8 @@ function compareByPlan(a, b) {
|
|
|
734
755
|
}
|
|
735
756
|
/**
|
|
736
757
|
* Subscription plan table, synced from the official CLI bundle's plan maps
|
|
737
|
-
* (located by the `"individual-go"` key in command-code@1.
|
|
738
|
-
* re-verified unchanged through 1.
|
|
758
|
+
* (located by the `"individual-go"` key in command-code@1.53.0 `dist/cli.mjs`,
|
|
759
|
+
* re-verified unchanged through 1.53.0): subscription `planId`
|
|
739
760
|
* prefix → display name and the plan's monthly credit total. This is the
|
|
740
761
|
* account's own subscription (from `/alpha/billing/subscriptions`) — distinct
|
|
741
762
|
* from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.
|
|
@@ -828,45 +849,69 @@ const KNOWN_DEALS = {
|
|
|
828
849
|
"meituan/LongCat-2.0:free": {
|
|
829
850
|
label: "FREE",
|
|
830
851
|
free: true
|
|
852
|
+
},
|
|
853
|
+
"inclusionai/ling-3.0-flash-sante:free": {
|
|
854
|
+
label: "FREE",
|
|
855
|
+
free: true
|
|
831
856
|
}
|
|
832
857
|
};
|
|
833
858
|
/**
|
|
834
859
|
* Models with time-of-day (peak/off-peak) pricing, per the official pricing
|
|
835
860
|
* page (`/docs/resources/pricing-limits`). Since 2026-08-16 16:00 UTC, DeepSeek
|
|
836
|
-
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h
|
|
837
|
-
* full price)
|
|
838
|
-
*
|
|
839
|
-
*
|
|
840
|
-
*
|
|
861
|
+
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h per
|
|
862
|
+
* weekday, full price) **Monday to Friday only**; the other 17 hours of a
|
|
863
|
+
* weekday and every hour of Saturday/Sunday (UTC) are off-peak at half price.
|
|
864
|
+
* The V4 Flash Vision (exp) variant (command-code@1.32.0) shares the V4 Flash
|
|
865
|
+
* windows and peak prices ($0.44/$1.32) — each row's hover annotation states
|
|
866
|
+
* exactly 2× that row's displayed off-peak prices. The picker shows the
|
|
841
867
|
* *current* state as a compact
|
|
842
868
|
* label (`Peak`/`Half`) matching the English noun style of the other markers
|
|
843
869
|
* (`Image`, `FREE`), so a developer can tell at a glance whether calling the
|
|
844
870
|
* model right now is cheap or expensive.
|
|
845
871
|
*
|
|
846
|
-
*
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
872
|
+
* Authoritative extraction: the pricing page embeds a model JSON array whose
|
|
873
|
+
* hourly-priced entries carry a `timeOfDay` block
|
|
874
|
+
* (`{ windows: "01–04 & 06–10 UTC, Mon–Fri", peakHoursPerDay: 7,
|
|
875
|
+
* offPeakHoursPerDay: 17, peak: {...}, offPeak: {...} }`). Exactly four models
|
|
876
|
+
* carry it: V4 Pro, V4 Flash, V4 Flash Vision (exp), and V4.1 Flash (added in
|
|
877
|
+
* command-code@1.53.0 at $0.15/$0.60 off-peak, $0.30/$1.20 peak — the same
|
|
878
|
+
* schedule as the other three).
|
|
851
879
|
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
880
|
+
* Extraction caution: the rendered HTML rows are a trap. Each annotation div
|
|
881
|
+
* sits inside its OWN row's container, immediately before the NEXT row starts,
|
|
882
|
+
* so flattening the page to text makes every annotation look like it belongs
|
|
883
|
+
* to the model printed after it — that is how `deepseek/deepseek-v4-flash-fast`
|
|
884
|
+
* was wrongly added here (its row is flat-priced at $0.28/$0.56/$0.07 and has
|
|
885
|
+
* no `timeOfDay` block). Trust the embedded JSON's `timeOfDay` membership and
|
|
886
|
+
* the 2× price relation, never the flat-text neighbor.
|
|
887
|
+
*
|
|
888
|
+
* Keep in sync with the official pricing page when the model set, the peak
|
|
889
|
+
* windows, or the weekday rule change (see the dsh-commandcode-upstream skill).
|
|
854
890
|
*/
|
|
855
891
|
const KNOWN_PEAK_PRICING = /* @__PURE__ */ new Set([
|
|
856
892
|
"deepseek/deepseek-v4-pro",
|
|
857
893
|
"deepseek/deepseek-v4-flash",
|
|
858
894
|
"deepseek/deepseek-v4-flash-vision-exp",
|
|
859
|
-
"deepseek/deepseek-v4-flash
|
|
895
|
+
"deepseek/deepseek-v4.1-flash"
|
|
860
896
|
]);
|
|
861
|
-
/**
|
|
897
|
+
/**
|
|
898
|
+
* Peak hours (UTC, hour-of-day range end-exclusive): 01–03 and 06–09.
|
|
899
|
+
* Weekday-only — see `peakPricingState()`; weekends are fully off-peak.
|
|
900
|
+
*/
|
|
862
901
|
const PEAK_HOUR_RANGES = [[1, 4], [6, 10]];
|
|
863
902
|
/**
|
|
864
|
-
* Whether `now` (defaults to `Date.now()`) falls in a peak-pricing
|
|
865
|
-
* time-of-day-priced models.
|
|
903
|
+
* Whether `now` (defaults to `Date.now()`) falls in a peak-pricing window for
|
|
904
|
+
* time-of-day-priced models. Peak rates apply Monday–Friday (UTC) only: the
|
|
905
|
+
* official rule charges Saturday and Sunday completely off-peak for all 24
|
|
906
|
+
* hours, so a weekend timestamp is off-peak even inside `PEAK_HOUR_RANGES`.
|
|
907
|
+
* `undefined` for models outside the snapshot.
|
|
866
908
|
*/
|
|
867
909
|
function peakPricingState(modelId, now = Date.now()) {
|
|
868
910
|
if (!KNOWN_PEAK_PRICING.has(modelId)) return void 0;
|
|
869
|
-
const
|
|
911
|
+
const at = new Date(now);
|
|
912
|
+
const day = at.getUTCDay();
|
|
913
|
+
if (day === 0 || day === 6) return "off-peak";
|
|
914
|
+
const hour = at.getUTCHours();
|
|
870
915
|
return PEAK_HOUR_RANGES.some(([start, end]) => hour >= start && hour < end) ? "peak" : "off-peak";
|
|
871
916
|
}
|
|
872
917
|
/**
|
|
@@ -947,7 +992,7 @@ function capabilityDescription(modelId, contextWindow, now = Date.now()) {
|
|
|
947
992
|
* and API key or subscription, and Command Code's terms apply.
|
|
948
993
|
*
|
|
949
994
|
* Wire protocol (reverse-engineered by the pi plugin, command-code@1.28.4;
|
|
950
|
-
* re-verified against command-code@1.
|
|
995
|
+
* re-verified against command-code@1.53.0 — endpoints, request shape, and
|
|
951
996
|
* stream events unchanged):
|
|
952
997
|
* POST {apiBase}/alpha/generate
|
|
953
998
|
* body: { config, memory, taste, skills, params: { model, messages, tools,
|
|
@@ -960,7 +1005,7 @@ function capabilityDescription(modelId, contextWindow, now = Date.now()) {
|
|
|
960
1005
|
* per-request options thunk and an API-key resolver from the plugin entry
|
|
961
1006
|
* (src/index.ts), so a settings change reaches the very next request.
|
|
962
1007
|
*/
|
|
963
|
-
const COMMAND_CODE_CLI_VERSION = "1.
|
|
1008
|
+
const COMMAND_CODE_CLI_VERSION = "1.53.0";
|
|
964
1009
|
const DEFAULT_API_BASE = "https://api.commandcode.ai";
|
|
965
1010
|
const DEFAULT_GENERATE_MAX_TOKENS = 64e3;
|
|
966
1011
|
const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
|
|
@@ -2514,6 +2559,14 @@ function tokensCompact(value) {
|
|
|
2514
2559
|
if (value >= 1e3) return `${(value / 1e3).toFixed(1)}K`;
|
|
2515
2560
|
return String(value);
|
|
2516
2561
|
}
|
|
2562
|
+
/**
|
|
2563
|
+
* Format a success-rate percentage (already in percent units): at most two
|
|
2564
|
+
* decimals, trailing zeros trimmed — mirrors `formatSuccessRate` in
|
|
2565
|
+
* `./client/usage.ts`, which the settings card uses.
|
|
2566
|
+
*/
|
|
2567
|
+
function successRateText(value) {
|
|
2568
|
+
return String(Number(value.toFixed(2)));
|
|
2569
|
+
}
|
|
2517
2570
|
/** Format a millis timestamp as a local date; `n/a` when unset. */
|
|
2518
2571
|
function resetLabel(ms) {
|
|
2519
2572
|
if (ms <= 0) return "n/a";
|
|
@@ -2552,7 +2605,7 @@ function renderReport(report, locale, title) {
|
|
|
2552
2605
|
}
|
|
2553
2606
|
if (report.usage) {
|
|
2554
2607
|
const u = report.usage;
|
|
2555
|
-
lines.push(commandCopy(locale, "usageHeader"), commandCopy(locale, "requestsLine").replace("{n}", String(u.completedCount)).replace("{f}", String(u.failedCount)).replace("{r}",
|
|
2608
|
+
lines.push(commandCopy(locale, "usageHeader"), commandCopy(locale, "requestsLine").replace("{n}", String(u.completedCount)).replace("{f}", String(u.failedCount)).replace("{r}", successRateText(u.successRate)), commandCopy(locale, "costLine").replace("{money}", money(u.totalCost)).replace("{credits}", moneyShort(u.totalCredits)), commandCopy(locale, "tokensLine").replace("{in}", tokensCompact(u.totalTokensIn)).replace("{out}", tokensCompact(u.totalTokensOut)), "");
|
|
2556
2609
|
}
|
|
2557
2610
|
if (report.credits) {
|
|
2558
2611
|
const c = report.credits;
|