@mars-sea/dsh-commandcode-provider 0.13.2 → 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 +50 -0
- package/README.md +23 -7
- package/README.zh-CN.md +18 -5
- package/lib/client.js +570 -64
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +64 -17
- package/lib/index.js +237 -59
- package/lib/index.js.map +1 -1
- package/package.json +38 -38
package/lib/index.js
CHANGED
|
@@ -103,7 +103,7 @@ const PLAN_ORDER = Object.fromEntries(PLAN_TIER_ORDER.map((tier, index) => [tier
|
|
|
103
103
|
* subscription-plan labels, deals, and hourly (peak/off-peak) pricing.
|
|
104
104
|
*
|
|
105
105
|
* Everything here is synced from official sources — the command-code CLI
|
|
106
|
-
* bundle's model table (`dist/cli.mjs`, re-verified at command-code@1.82.
|
|
106
|
+
* bundle's model table (`dist/cli.mjs`, re-verified at command-code@1.82.5) and
|
|
107
107
|
* the official plan/pricing/model docs; see the dsh-commandcode-upstream skill
|
|
108
108
|
* for the extraction procedures. Keeping the snapshot in its own module
|
|
109
109
|
* confines those frequent sync diffs here: src/adapter.ts holds only the stable
|
|
@@ -138,6 +138,11 @@ const KNOWN_EFFORTS = {
|
|
|
138
138
|
"medium",
|
|
139
139
|
"xhigh"
|
|
140
140
|
],
|
|
141
|
+
"Qwen/Qwen3.8-Max-Prime": [
|
|
142
|
+
"low",
|
|
143
|
+
"medium",
|
|
144
|
+
"xhigh"
|
|
145
|
+
],
|
|
141
146
|
"claude-fable-5-1": [
|
|
142
147
|
"low",
|
|
143
148
|
"medium",
|
|
@@ -391,6 +396,16 @@ const KNOWN_EFFORTS = {
|
|
|
391
396
|
"high",
|
|
392
397
|
"xhigh"
|
|
393
398
|
],
|
|
399
|
+
"meta/muse-spark-open": [
|
|
400
|
+
"low",
|
|
401
|
+
"medium",
|
|
402
|
+
"high"
|
|
403
|
+
],
|
|
404
|
+
"nvidia/nemotron-3.5-super-vl": [
|
|
405
|
+
"low",
|
|
406
|
+
"medium",
|
|
407
|
+
"high"
|
|
408
|
+
],
|
|
394
409
|
"gpt-6-astra": [
|
|
395
410
|
"low",
|
|
396
411
|
"medium",
|
|
@@ -431,7 +446,7 @@ const KNOWN_EFFORTS = {
|
|
|
431
446
|
"xhigh",
|
|
432
447
|
"max"
|
|
433
448
|
],
|
|
434
|
-
"inclusionai/ling-3.1-flash
|
|
449
|
+
"inclusionai/ling-3.1-flash": [
|
|
435
450
|
"low",
|
|
436
451
|
"medium",
|
|
437
452
|
"high"
|
|
@@ -453,6 +468,13 @@ const KNOWN_EFFORTS = {
|
|
|
453
468
|
"medium",
|
|
454
469
|
"high",
|
|
455
470
|
"xhigh"
|
|
471
|
+
],
|
|
472
|
+
"stealth/cat-jam:free": [
|
|
473
|
+
"low",
|
|
474
|
+
"medium",
|
|
475
|
+
"high",
|
|
476
|
+
"xhigh",
|
|
477
|
+
"max"
|
|
456
478
|
]
|
|
457
479
|
};
|
|
458
480
|
/**
|
|
@@ -480,6 +502,7 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
480
502
|
"Qwen/Qwen3.8-Max",
|
|
481
503
|
"Qwen/Qwen3.8-Max-0902",
|
|
482
504
|
"Qwen/Qwen3.8-Omni-Flash",
|
|
505
|
+
"Qwen/Qwen3.8-Max-Prime",
|
|
483
506
|
"claude-fable-5-1",
|
|
484
507
|
"claude-fable-5",
|
|
485
508
|
"claude-haiku-4-5-20251001",
|
|
@@ -518,6 +541,8 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
518
541
|
"meta/muse-spark-1.3",
|
|
519
542
|
"meta/muse-spark-1.3-contributor",
|
|
520
543
|
"meta/muse-wonder-1.0",
|
|
544
|
+
"meta/muse-spark-open",
|
|
545
|
+
"nvidia/nemotron-3.5-super-vl",
|
|
521
546
|
"mistral/mistral-large-4",
|
|
522
547
|
"moonshotai/Kimi-K2.5",
|
|
523
548
|
"moonshotai/Kimi-K2.6",
|
|
@@ -540,14 +565,16 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
540
565
|
"z-ai/glm-5.3-flashx"
|
|
541
566
|
]);
|
|
542
567
|
/**
|
|
543
|
-
* Models WITHOUT a zero-data-retention upstream
|
|
544
|
-
* registry
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
* 1.
|
|
550
|
-
*
|
|
568
|
+
* Models WITHOUT a zero-data-retention upstream. Through command-code@1.82.2
|
|
569
|
+
* the CLI's own registry answered this: `modelSupportsZdr(id)` was exactly
|
|
570
|
+
* `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr` carried the
|
|
571
|
+
* membership in the sibling route table — the UNION of both was this set, and
|
|
572
|
+
* the two anchors disagreed by one id (`meituan/LongCat-2.0:free`, which 1.74.1
|
|
573
|
+
* dropped from the first anchor while the canonical helper kept it).
|
|
574
|
+
* command-code@1.82.4 removes that disagreement by making the verdict a catalog
|
|
575
|
+
* lookup — `resolveKnownCatalogModel({model,catalog})?.zdr ?? false` — so this
|
|
576
|
+
* set is now the live catalog's `zdr:false` membership and nothing more. The
|
|
577
|
+
* official docs (commandcode.ai/docs/resources/
|
|
551
578
|
* zdr) put coverage in prose — "99% of our models have ZDR-capable upstreams … only
|
|
552
579
|
* a small handful of models are affected" — so the CLI's exclusion list is
|
|
553
580
|
* the only per-model evidence there is; a ZDR request naming one of these
|
|
@@ -560,10 +587,19 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
560
587
|
* switch is on — the provider remains the routing authority and refuses an
|
|
561
588
|
* unsupported model rather than silently dropping the privacy guarantee.
|
|
562
589
|
*
|
|
563
|
-
* `minimax/minimax-m3-free` is the one entry the public catalog
|
|
564
|
-
* (`/provider/v1/models`) does not serve (it is CLI/pricing-visible
|
|
565
|
-
* from the picker); it stays listed because the CLI carries it and a Go-plan
|
|
566
|
-
* request can still name it.
|
|
590
|
+
* `minimax/minimax-m3-free` is the one entry the public catalog's default view
|
|
591
|
+
* (`/provider/v1/models`) does not serve through the picker (it is CLI/pricing-visible
|
|
592
|
+
* and hidden from the picker); it stays listed because the CLI carries it and a Go-plan
|
|
593
|
+
* request can still name it. Both this row and `stealth/cat-jam:free` ARE served
|
|
594
|
+
* by the `?view=client` catalog, which is where the 1.82.4 verdict comes from.
|
|
595
|
+
*
|
|
596
|
+
* command-code@1.82.4 moved the authority for this verdict: `knownModelSupportsZdr`
|
|
597
|
+
* no longer negates a bundled Set, it returns `resolveKnownCatalogModel({model,
|
|
598
|
+
* catalog})?.zdr ?? false`, so an id the catalog does not carry (or carries with
|
|
599
|
+
* `zdr:false`) is NOT covered. That inverts the default this helper was built on
|
|
600
|
+
* ("not listed" answered TRUE); the snapshot keeps its negative-set shape because
|
|
601
|
+
* 99% of the catalog is still covered, but membership is now read from the
|
|
602
|
+
* `?view=client` catalog and confirmed against the canonical helper set.
|
|
567
603
|
*
|
|
568
604
|
* Keep in sync via the dsh-commandcode-upstream skill: the CLI's registry data
|
|
569
605
|
* (its `zdr:{only:[…]}` provider routes and the per-provider `zdr`/`noTraining`
|
|
@@ -584,6 +620,11 @@ const KNOWN_IMAGE_MODELS = /* @__PURE__ */ new Set([
|
|
|
584
620
|
* `listSelectableModelIds()`, so they are pruned along with the rest of the
|
|
585
621
|
* tables and `supportsZeroDataRetention` now answers TRUE for them, matching
|
|
586
622
|
* what the current CLI says.
|
|
623
|
+
*
|
|
624
|
+
* 1.82.4 then reversed 1.74.1's removal of `meituan/LongCat-2.0:free` and added
|
|
625
|
+
* the `stealth/cat-jam:free` preview, taking this set to 24 members — the size
|
|
626
|
+
* of the live catalog's `zdr:false` list. The canonical helper set still carries
|
|
627
|
+
* 23 because `cat-jam:free` postdates the artifact's embedded snapshot.
|
|
587
628
|
*/
|
|
588
629
|
const KNOWN_NON_ZDR_MODELS = /* @__PURE__ */ new Set([
|
|
589
630
|
"MiniMaxAI/MiniMax-M3",
|
|
@@ -595,10 +636,12 @@ const KNOWN_NON_ZDR_MODELS = /* @__PURE__ */ new Set([
|
|
|
595
636
|
"meta/muse-spark-1.3",
|
|
596
637
|
"meta/muse-spark-1.3-contributor",
|
|
597
638
|
"meta/muse-wonder-1.0",
|
|
639
|
+
"meituan/LongCat-2.0:free",
|
|
598
640
|
"minimax/minimax-m3-free",
|
|
599
641
|
"poolside/laguna-s-2.1-free",
|
|
600
642
|
"sakana/fugu-ultra",
|
|
601
643
|
"stealth/glyph-cluster:free",
|
|
644
|
+
"stealth/cat-jam:free",
|
|
602
645
|
"stepfun/Step-3.7-Flash",
|
|
603
646
|
"stepfun/Step-5-Preview",
|
|
604
647
|
"xai/grok-4.5",
|
|
@@ -646,8 +689,7 @@ const KNOWN_THINKING_MODELS = /* @__PURE__ */ new Set([
|
|
|
646
689
|
"thinkingmachines/inkling",
|
|
647
690
|
"thinkingmachines/inkling-small",
|
|
648
691
|
"poolside/laguna-s-2.1-free",
|
|
649
|
-
"meituan/LongCat-2.0"
|
|
650
|
-
"inclusionai/ling-3.0-flash-sante:free"
|
|
692
|
+
"meituan/LongCat-2.0"
|
|
651
693
|
]);
|
|
652
694
|
/**
|
|
653
695
|
* Catalog models the Provider API serves ONLY through `/provider/v1/messages`
|
|
@@ -711,22 +753,21 @@ function requiresMessagesEndpoint(modelId) {
|
|
|
711
753
|
* **Generated — do not hand-edit.** `scripts/sync-output-limits.mjs` rewrites
|
|
712
754
|
* this literal from models.dev; run it after a catalog sync, and use its
|
|
713
755
|
* `--check` in CI. Command Code resells these models through their VENDOR's own
|
|
714
|
-
* API, so the vendor's published ceiling is the value recorded:
|
|
715
|
-
* catalog ids as of 2026-10-
|
|
756
|
+
* API, so the vendor's published ceiling is the value recorded: 76 of the 89
|
|
757
|
+
* catalog ids as of 2026-10-15. Each row carries a comment naming the entry it
|
|
716
758
|
* came from.
|
|
717
759
|
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
720
|
-
* and
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
* The 12 unlisted models are ones no vendor publishes and the aggregators
|
|
760
|
+
* No row needs a hand-recorded pin as of 2026-10-16: the one that did
|
|
761
|
+
* (`inclusionai/ling-3.0-flash-sante:free`, pinned at 32768 because it had lost
|
|
762
|
+
* both its vendor row and its unanimous third-party vote) left the live catalog
|
|
763
|
+
* with the 1.82.4 catalog migration, so the script's `MANUAL_CEILINGS` map is
|
|
764
|
+
* now empty and every remaining row resolves from a vendor row or a unanimous
|
|
765
|
+
* third-party vote. (`gpt-6.1-sol` (128000) never needed a pin — OpenAI's own row
|
|
766
|
+
* carries it and every other provider carrying the id agrees.) All are still
|
|
767
|
+
* correctable — a stricter gateway costs one refused request, and
|
|
768
|
+
* `streamRequest()` remembers what the endpoint said.
|
|
769
|
+
*
|
|
770
|
+
* The 13 unlisted models are ones no vendor publishes and the aggregators
|
|
730
771
|
* disagree about. They are NOT a gap: a refusal states the ceiling in full, and
|
|
731
772
|
* `streamRequest()` reads it off, retries once and remembers it for the model
|
|
732
773
|
* (issue #71). A vendor figure the gateway turns out to be stricter than costs
|
|
@@ -771,8 +812,6 @@ const MODEL_OUTPUT_TOKEN_LIMITS = /* @__PURE__ */ new Map([
|
|
|
771
812
|
["gpt-6-luna", 128e3],
|
|
772
813
|
["gpt-6-sol", 128e3],
|
|
773
814
|
["gpt-6.1-sol", 128e3],
|
|
774
|
-
["inclusionai/ling-3.0-flash-sante:free", 32768],
|
|
775
|
-
["inclusionai/ling-3.1-flash:free", 32768],
|
|
776
815
|
["meituan/LongCat-2.0", 131072],
|
|
777
816
|
["meta/muse-spark-1.1", 131072],
|
|
778
817
|
["meta/muse-spark-1.2", 131072],
|
|
@@ -823,15 +862,20 @@ const MODEL_OUTPUT_TOKEN_LIMITS = /* @__PURE__ */ new Map([
|
|
|
823
862
|
* `/docs/plans/max` and `/docs/resources/pricing-limits`). Each plan's model
|
|
824
863
|
* list is a superset of the one below it: Go ⊂ GOAT ⊂ Pro ⊂ Provider/Max.
|
|
825
864
|
* Models absent from every plan list (Claude Opus/Fable, Fugu Ultra) are
|
|
826
|
-
* Provider-tier. Re-verified at command-code@1.82.
|
|
827
|
-
*
|
|
865
|
+
* Provider-tier. Re-verified at command-code@1.82.4 (2026-10-16) against the
|
|
866
|
+
* live `?view=client` catalog: 93 ids, still a strict superset chain. Mistral
|
|
867
|
+
* Large 4
|
|
828
868
|
* (1.75.0) was the only addition at the 1.77.0 check; the 1.78.0/1.79.0 pair
|
|
829
869
|
* added Claude Haiku 5.5 at Pro and the free Glyph Cluster preview at Go.
|
|
830
870
|
* 1.79.2 lowers Haiku 5.5's minimum plan to GOAT; 1.80.0 adds Muse Wonder at
|
|
831
|
-
* Max; 1.82.0 adds Gemini 4 Argon at Pro and nothing else moves.
|
|
871
|
+
* Max; 1.82.0 adds Gemini 4 Argon at Pro and nothing else moves. The 1.82.4
|
|
872
|
+
* train adds Qwen 3.8 Max Prime at GOAT plus Muse Spark Open, Nemotron 3.5
|
|
873
|
+
* Super VL and the free Cat Jam preview at Go, and drops Ling 3.0 Flash Sante,
|
|
874
|
+
* which left the live catalog. Every other
|
|
832
875
|
* tier is unchanged.
|
|
833
876
|
* The only removals since 1.49.0 are the two retired stealth previews (Pixel
|
|
834
|
-
* Canary at 1.73.1, Space Bunny Alpha at 1.74.3)
|
|
877
|
+
* Canary at 1.73.1, Space Bunny Alpha at 1.74.3) and Ling 3.0 Flash Sante
|
|
878
|
+
* (2026-10-16). Per-entry tags below name the
|
|
835
879
|
* releases that added or moved each row.
|
|
836
880
|
*
|
|
837
881
|
* The Provider API exposes no plan metadata, so this snapshot is the source of
|
|
@@ -855,6 +899,7 @@ const KNOWN_PLANS = {
|
|
|
855
899
|
"Qwen/Qwen3.8-Flash": "go",
|
|
856
900
|
"Qwen/Qwen3.8-Max": "go",
|
|
857
901
|
"Qwen/Qwen3.8-Max-0902": "go",
|
|
902
|
+
"Qwen/Qwen3.8-Max-Prime": "goat",
|
|
858
903
|
"Qwen/Qwen3.8-Omni-Flash": "go",
|
|
859
904
|
"deepseek/deepseek-v4-flash-fast": "go",
|
|
860
905
|
"deepseek/deepseek-v4.1-flash": "go",
|
|
@@ -865,10 +910,10 @@ const KNOWN_PLANS = {
|
|
|
865
910
|
"gpt-5.6-luna": "go",
|
|
866
911
|
"gpt-6-luna": "go",
|
|
867
912
|
"meituan/LongCat-2.0": "go",
|
|
868
|
-
"inclusionai/ling-3.
|
|
869
|
-
"inclusionai/ling-3.1-flash:free": "go",
|
|
913
|
+
"inclusionai/ling-3.1-flash": "go",
|
|
870
914
|
"meta/muse-spark-1.2-contributor": "go",
|
|
871
915
|
"meta/muse-spark-1.3-contributor": "go",
|
|
916
|
+
"meta/muse-spark-open": "go",
|
|
872
917
|
"mistral/mistral-large-4": "go",
|
|
873
918
|
"moonshotai/Kimi-K2.5": "go",
|
|
874
919
|
"moonshotai/Kimi-K2.6": "go",
|
|
@@ -876,10 +921,12 @@ const KNOWN_PLANS = {
|
|
|
876
921
|
"moonshotai/Kimi-K2.7-Code-Highspeed": "go",
|
|
877
922
|
"moonshotai/Kimi-K3": "go",
|
|
878
923
|
"nvidia/nemotron-3-ultra-550b-a55b": "go",
|
|
924
|
+
"nvidia/nemotron-3.5-super-vl": "go",
|
|
879
925
|
"poolside/laguna-s-2.1-free": "go",
|
|
880
926
|
"stepfun/Step-3.5-Flash": "go",
|
|
881
927
|
"stepfun/Step-3.7-Flash": "go",
|
|
882
928
|
"stepfun/Step-5-Preview": "go",
|
|
929
|
+
"stealth/cat-jam:free": "go",
|
|
883
930
|
"stealth/glyph-cluster:free": "go",
|
|
884
931
|
"tencent/hy3-paid": "go",
|
|
885
932
|
"tencent/hy4-preview": "go",
|
|
@@ -1072,11 +1119,7 @@ const KNOWN_DEALS = {
|
|
|
1072
1119
|
label: "FREE",
|
|
1073
1120
|
free: true
|
|
1074
1121
|
},
|
|
1075
|
-
"
|
|
1076
|
-
label: "FREE",
|
|
1077
|
-
free: true
|
|
1078
|
-
},
|
|
1079
|
-
"inclusionai/ling-3.1-flash:free": {
|
|
1122
|
+
"stealth/cat-jam:free": {
|
|
1080
1123
|
label: "FREE",
|
|
1081
1124
|
free: true
|
|
1082
1125
|
},
|
|
@@ -1721,8 +1764,8 @@ const MODEL_PRICE_ROWS = [
|
|
|
1721
1764
|
],
|
|
1722
1765
|
allowance: {
|
|
1723
1766
|
go: 10,
|
|
1724
|
-
goat:
|
|
1725
|
-
pro:
|
|
1767
|
+
goat: 100,
|
|
1768
|
+
pro: 100
|
|
1726
1769
|
}
|
|
1727
1770
|
},
|
|
1728
1771
|
{
|
|
@@ -1832,8 +1875,8 @@ const MODEL_PRICE_ROWS = [
|
|
|
1832
1875
|
],
|
|
1833
1876
|
allowance: {
|
|
1834
1877
|
go: 6,
|
|
1835
|
-
goat:
|
|
1836
|
-
pro:
|
|
1878
|
+
goat: 20,
|
|
1879
|
+
pro: 30
|
|
1837
1880
|
},
|
|
1838
1881
|
contextTiers: [{
|
|
1839
1882
|
"maxContext": 272e3,
|
|
@@ -2144,6 +2187,19 @@ const MODEL_PRICE_ROWS = [
|
|
|
2144
2187
|
pro: 30
|
|
2145
2188
|
}
|
|
2146
2189
|
},
|
|
2190
|
+
{
|
|
2191
|
+
id: "ling-3.1-flash",
|
|
2192
|
+
rates: [
|
|
2193
|
+
.3,
|
|
2194
|
+
.9,
|
|
2195
|
+
.06
|
|
2196
|
+
],
|
|
2197
|
+
allowance: {
|
|
2198
|
+
go: 6,
|
|
2199
|
+
goat: 100,
|
|
2200
|
+
pro: 110
|
|
2201
|
+
}
|
|
2202
|
+
},
|
|
2147
2203
|
{
|
|
2148
2204
|
id: "longcat-2.0",
|
|
2149
2205
|
rates: [
|
|
@@ -2354,6 +2410,19 @@ const MODEL_PRICE_ROWS = [
|
|
|
2354
2410
|
pro: 30
|
|
2355
2411
|
}
|
|
2356
2412
|
},
|
|
2413
|
+
{
|
|
2414
|
+
id: "muse-spark-open",
|
|
2415
|
+
rates: [
|
|
2416
|
+
1.25,
|
|
2417
|
+
4.25,
|
|
2418
|
+
.15
|
|
2419
|
+
],
|
|
2420
|
+
allowance: {
|
|
2421
|
+
go: 6,
|
|
2422
|
+
goat: 20,
|
|
2423
|
+
pro: 30
|
|
2424
|
+
}
|
|
2425
|
+
},
|
|
2357
2426
|
{
|
|
2358
2427
|
id: "muse-wonder-1.0",
|
|
2359
2428
|
rates: [
|
|
@@ -2380,6 +2449,19 @@ const MODEL_PRICE_ROWS = [
|
|
|
2380
2449
|
pro: 30
|
|
2381
2450
|
}
|
|
2382
2451
|
},
|
|
2452
|
+
{
|
|
2453
|
+
id: "nemotron-3.5-super-vl",
|
|
2454
|
+
rates: [
|
|
2455
|
+
.2,
|
|
2456
|
+
.5,
|
|
2457
|
+
.04
|
|
2458
|
+
],
|
|
2459
|
+
allowance: {
|
|
2460
|
+
go: 6,
|
|
2461
|
+
goat: 20,
|
|
2462
|
+
pro: 30
|
|
2463
|
+
}
|
|
2464
|
+
},
|
|
2383
2465
|
{
|
|
2384
2466
|
id: "qwen-3.6-max",
|
|
2385
2467
|
rates: [
|
|
@@ -2554,6 +2636,20 @@ const MODEL_PRICE_ROWS = [
|
|
|
2554
2636
|
pro: 30
|
|
2555
2637
|
}
|
|
2556
2638
|
},
|
|
2639
|
+
{
|
|
2640
|
+
id: "qwen-3.8-max-prime",
|
|
2641
|
+
rates: [
|
|
2642
|
+
4,
|
|
2643
|
+
12,
|
|
2644
|
+
.5,
|
|
2645
|
+
5
|
|
2646
|
+
],
|
|
2647
|
+
allowance: {
|
|
2648
|
+
go: 6,
|
|
2649
|
+
goat: 20,
|
|
2650
|
+
pro: 30
|
|
2651
|
+
}
|
|
2652
|
+
},
|
|
2557
2653
|
{
|
|
2558
2654
|
id: "qwen-3.8-omni-flash",
|
|
2559
2655
|
rates: [
|
|
@@ -2644,6 +2740,19 @@ const MODEL_PRICE_ROWS = [
|
|
|
2644
2740
|
goat: 20,
|
|
2645
2741
|
pro: 30
|
|
2646
2742
|
}
|
|
2743
|
+
},
|
|
2744
|
+
{
|
|
2745
|
+
id: "typesafe/jev-1.14.0",
|
|
2746
|
+
rates: [
|
|
2747
|
+
.042,
|
|
2748
|
+
0,
|
|
2749
|
+
0
|
|
2750
|
+
],
|
|
2751
|
+
allowance: {
|
|
2752
|
+
go: 6,
|
|
2753
|
+
goat: 20,
|
|
2754
|
+
pro: 30
|
|
2755
|
+
}
|
|
2647
2756
|
}
|
|
2648
2757
|
];
|
|
2649
2758
|
/**
|
|
@@ -3532,6 +3641,41 @@ function modelIsVisible(id, allowlist, overrides) {
|
|
|
3532
3641
|
const flag = overrides !== null && typeof overrides === "object" && !Array.isArray(overrides) ? overrides[id] : void 0;
|
|
3533
3642
|
return typeof flag === "boolean" ? flag : allowlist.length === 0 || allowlist.includes(id);
|
|
3534
3643
|
}
|
|
3644
|
+
/** 自定义上下文长度接受的上界(token);覆盖任何已知模型窗口仍留有余量。 */
|
|
3645
|
+
const CONTEXT_WINDOW_MAX = 1e7;
|
|
3646
|
+
/**
|
|
3647
|
+
* 判定一个值能否作为自定义上下文长度:边界内的安全整数,符合宿主模型元数据约束。
|
|
3648
|
+
*
|
|
3649
|
+
* 程序化构造的连接可能绕过 schemastery 归一化,所以 `resolveAdapterOptions`
|
|
3650
|
+
* 也要重新判定——越界或非数值直接丢弃,回落到目录公布值,而不是让请求带着
|
|
3651
|
+
* 一个网关会拒绝的窗口上线。
|
|
3652
|
+
*/
|
|
3653
|
+
function isValidContextWindow(value) {
|
|
3654
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 1 && value <= 1e7;
|
|
3655
|
+
}
|
|
3656
|
+
/**
|
|
3657
|
+
* 只接收合法条目的按模型覆盖表;空表、非对象与非法数值一律视为未设置。
|
|
3658
|
+
* 配置校验会拒绝非整数或越界值;本函数额外保护绕过配置校验的程序化调用,
|
|
3659
|
+
* 丢弃坏条目,不把非法窗口交给宿主。返回新对象;未设置时为 `undefined`。
|
|
3660
|
+
*/
|
|
3661
|
+
function readContextWindowOverrides(raw) {
|
|
3662
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
3663
|
+
const entries = Object.entries(raw).filter((entry) => entry[0] !== "" && isValidContextWindow(entry[1]));
|
|
3664
|
+
return entries.length === 0 ? void 0 : Object.fromEntries(entries);
|
|
3665
|
+
}
|
|
3666
|
+
/**
|
|
3667
|
+
* 一次模型解析的有效上下文长度:按模型覆盖 → 全局值 → 目录公布值。
|
|
3668
|
+
*
|
|
3669
|
+
* 适配器只在有目录条目时调用(未知模型保持既有的「无上下文宣告」形状),
|
|
3670
|
+
* 所以 `catalog` 是已知的正数;按模型覆盖与全局值在 `resolveAdapterOptions`
|
|
3671
|
+
* 已清洗,这里对程序化构造的连接再判一次,坏值静默回落到目录值。
|
|
3672
|
+
*/
|
|
3673
|
+
function effectiveContextWindow(catalog, model, options) {
|
|
3674
|
+
const perModel = options.contextWindowOverrides?.[model];
|
|
3675
|
+
if (isValidContextWindow(perModel)) return perModel;
|
|
3676
|
+
if (isValidContextWindow(options.contextWindow)) return options.contextWindow;
|
|
3677
|
+
return catalog;
|
|
3678
|
+
}
|
|
3535
3679
|
const THROTTLED_CODE = "THROTTLED";
|
|
3536
3680
|
const boundedCodes = /* @__PURE__ */ new Set([
|
|
3537
3681
|
"EMPTY_RESPONSE",
|
|
@@ -5838,6 +5982,13 @@ function learnedOutputLimit(apiBase, model) {
|
|
|
5838
5982
|
function modelOutputTokenLimit(apiBase, model) {
|
|
5839
5983
|
return Math.min(published.get(apiBase)?.get(model) ?? fallbackLimit(model), learnedOutputLimit(apiBase, model));
|
|
5840
5984
|
}
|
|
5985
|
+
/**
|
|
5986
|
+
* 从本次目录记录的独立输出上限重新推导预算,不能复用已经被旧窗口压低的 maxTokens。
|
|
5987
|
+
* 公布值固定在该记录,不读取并发刷新后的共享目录;只继续采纳同网关更低的学习上限。
|
|
5988
|
+
*/
|
|
5989
|
+
function catalogModelMaxTokens(apiBase, model, contextWindow = model.contextWindow) {
|
|
5990
|
+
return Math.min(contextWindow, model.publishedMaxTokens ?? fallbackLimit(model.id), learnedOutputLimit(apiBase, model.id));
|
|
5991
|
+
}
|
|
5841
5992
|
/** 是否更新共享事实与是否值得重试是两个问题;以本次实发预算判断拒绝。 */
|
|
5842
5993
|
function outputCeilingRefusal(apiBase, model, sent, error) {
|
|
5843
5994
|
if (!(error instanceof LlmError) || !OUTPUT_LIMIT_REJECTION.test(error.message)) return void 0;
|
|
@@ -5993,7 +6144,7 @@ var GatewayFacts = class {
|
|
|
5993
6144
|
* per-request options thunk and an API-key resolver from the plugin entry
|
|
5994
6145
|
* (src/index.ts), so a settings change reaches the very next request.
|
|
5995
6146
|
*/
|
|
5996
|
-
const COMMAND_CODE_CLI_VERSION = "1.82.
|
|
6147
|
+
const COMMAND_CODE_CLI_VERSION = "1.82.5";
|
|
5997
6148
|
const DEFAULT_API_BASE = "https://api.commandcode.ai";
|
|
5998
6149
|
/**
|
|
5999
6150
|
* The output budget this bundle asks for, and the ceiling it will never exceed.
|
|
@@ -7656,7 +7807,7 @@ var CommandCodeAdapter = class CommandCodeAdapter extends LlmAdapter {
|
|
|
7656
7807
|
provider,
|
|
7657
7808
|
id: model.id,
|
|
7658
7809
|
name: `${model.name} (CC)`,
|
|
7659
|
-
description: capabilityDescription(model.id, model.contextWindow),
|
|
7810
|
+
description: capabilityDescription(model.id, effectiveContextWindow(model.contextWindow, model.id, connection)),
|
|
7660
7811
|
inputModalities: vision ? ["text", "image"] : ["text"]
|
|
7661
7812
|
};
|
|
7662
7813
|
};
|
|
@@ -7696,16 +7847,17 @@ var CommandCodeAdapter = class CommandCodeAdapter extends LlmAdapter {
|
|
|
7696
7847
|
const entry = this.gatewayFacts.knownModel(connection, model) ?? (await this.gatewayFacts.refresh(connection, signal)).find((m) => m.id === model);
|
|
7697
7848
|
const efforts = KNOWN_EFFORTS[model];
|
|
7698
7849
|
const vision = KNOWN_IMAGE_MODELS.has(model);
|
|
7850
|
+
const contextWindow = entry === void 0 ? void 0 : effectiveContextWindow(entry.contextWindow, model, connection);
|
|
7699
7851
|
return {
|
|
7700
7852
|
provider,
|
|
7701
7853
|
id: model,
|
|
7702
7854
|
name: entry ? `${entry.name} (CC)` : model,
|
|
7703
|
-
description: capabilityDescription(model,
|
|
7855
|
+
description: capabilityDescription(model, contextWindow),
|
|
7704
7856
|
inputModalities: vision ? ["text", "image"] : ["text"],
|
|
7705
7857
|
toolUpdate: "addition-only",
|
|
7706
|
-
...entry ? {
|
|
7707
|
-
context: { contextWindow
|
|
7708
|
-
defaultMaxTokens: Math.min(
|
|
7858
|
+
...entry !== void 0 && contextWindow !== void 0 ? {
|
|
7859
|
+
context: { contextWindow },
|
|
7860
|
+
defaultMaxTokens: Math.min(catalogModelMaxTokens(connection.apiBase, entry, contextWindow), DEFAULT_GENERATE_MAX_TOKENS)
|
|
7709
7861
|
} : {},
|
|
7710
7862
|
...efforts ? { reasoning: { efforts: efforts.map((effort) => ({
|
|
7711
7863
|
id: ReasoningEffortId(effort),
|
|
@@ -8128,7 +8280,8 @@ var CommandCodeAdapter = class CommandCodeAdapter extends LlmAdapter {
|
|
|
8128
8280
|
const catalog = await facts.catalog;
|
|
8129
8281
|
options.signal?.throwIfAborted();
|
|
8130
8282
|
const modelEntry = catalog.find((row) => row.id === options.model);
|
|
8131
|
-
const
|
|
8283
|
+
const modelMax = modelEntry === void 0 ? facts.fallbackLimit : catalogModelMaxTokens(connection.apiBase, modelEntry, effectiveContextWindow(modelEntry.contextWindow, options.model, connection));
|
|
8284
|
+
const initialMax = Math.min(options.maxTokens ?? Infinity, modelMax, DEFAULT_GENERATE_MAX_TOKENS);
|
|
8132
8285
|
const budget = {
|
|
8133
8286
|
max: initialMax,
|
|
8134
8287
|
sent: initialMax
|
|
@@ -8168,8 +8321,8 @@ var CommandCodeAdapter = class CommandCodeAdapter extends LlmAdapter {
|
|
|
8168
8321
|
}
|
|
8169
8322
|
options.signal?.throwIfAborted();
|
|
8170
8323
|
let maxTokens = Math.min(budget.max, learnedOutputLimit(connection.apiBase, options.model));
|
|
8171
|
-
const effort = options.reasoningEffort;
|
|
8172
8324
|
const supported = KNOWN_EFFORTS[options.model];
|
|
8325
|
+
const effort = options.purpose === "session-title" && supported?.includes("off") ? "off" : options.reasoningEffort;
|
|
8173
8326
|
const declared = effort !== void 0 && supported?.includes(effort) ? effort : void 0;
|
|
8174
8327
|
const reasoningEffort = effort === "off" && declared === void 0 ? void 0 : declared;
|
|
8175
8328
|
const systemText = [options.system ?? "", ...options.messages.filter((m) => m.role === "system").map((m) => m.content.map(blockText).filter(Boolean).join("\n"))].filter(Boolean).join("\n\n");
|
|
@@ -8427,12 +8580,33 @@ function formatMoney(value) {
|
|
|
8427
8580
|
function formatMoneyExact(value) {
|
|
8428
8581
|
return `$${value.toFixed(4)}`;
|
|
8429
8582
|
}
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8583
|
+
/**
|
|
8584
|
+
* 紧凑数字:K/M/B 三级,一切档位决策的唯一实现。
|
|
8585
|
+
*
|
|
8586
|
+
* 档位必须**回头判断**:先除以档位再四舍五入会算出 `999_999 → "1000.0K"`、
|
|
8587
|
+
* `999_999_999 → "1000.0M"` 这类既超长、又落在并不存在的档位上的结果,
|
|
8588
|
+
* 因此每个档位算完后若已经够到下一档,就改用下一档重算一次。
|
|
8589
|
+
*
|
|
8590
|
+
* @param value - 非负计数或词元数。
|
|
8591
|
+
* @param keepZeroDecimal - 整数值是否保留一位小数。词元显示沿用 `3.0B` 的旧样式;
|
|
8592
|
+
* 计数显示去掉多余的 `.0`,见 {@link formatCompactCount}。
|
|
8593
|
+
* @returns 紧凑文本;不足 1000 时原样返回该整数。
|
|
8594
|
+
*/
|
|
8595
|
+
function compact(value, keepZeroDecimal) {
|
|
8596
|
+
const rounded = (scaled) => Math.round(scaled * 10) / 10;
|
|
8597
|
+
const text = (scaled) => {
|
|
8598
|
+
const fixed = rounded(scaled);
|
|
8599
|
+
return keepZeroDecimal ? fixed.toFixed(1) : String(fixed);
|
|
8600
|
+
};
|
|
8601
|
+
if (value >= 1e9) return `${text(value / 1e9)}B`;
|
|
8602
|
+
if (value >= 1e6) return rounded(value / 1e6) >= 1e3 ? `${text(value / 1e9)}B` : `${text(value / 1e6)}M`;
|
|
8603
|
+
if (value >= 1e3) return rounded(value / 1e3) >= 1e3 ? `${text(value / 1e6)}M` : `${text(value / 1e3)}K`;
|
|
8434
8604
|
return String(value);
|
|
8435
8605
|
}
|
|
8606
|
+
/** 紧凑词元数:与 {@link formatCompactCount} 共用档位,但整数值保留一位小数(`3.0B`)。 */
|
|
8607
|
+
function formatTokensCompact(value) {
|
|
8608
|
+
return compact(value, true);
|
|
8609
|
+
}
|
|
8436
8610
|
/** The input is already in percent units; callers add the percent sign. */
|
|
8437
8611
|
function formatSuccessRate(value) {
|
|
8438
8612
|
return String(Number(value.toFixed(2)));
|
|
@@ -10760,6 +10934,8 @@ const Config = z.object(markVolatileFields({
|
|
|
10760
10934
|
filterModelsByPlan: z.boolean(),
|
|
10761
10935
|
visibleModels: z.array(z.string()),
|
|
10762
10936
|
modelVisibility: z.dict(z.boolean()),
|
|
10937
|
+
contextWindow: z.number().min(1).max(CONTEXT_WINDOW_MAX).step(1),
|
|
10938
|
+
contextWindowOverrides: z.dict(z.number().min(1).max(CONTEXT_WINDOW_MAX).step(1)),
|
|
10763
10939
|
webSearch: z.boolean().default(true),
|
|
10764
10940
|
showSidebarQuota: z.boolean().default(false),
|
|
10765
10941
|
accounts: z.array(z.object({
|
|
@@ -10805,6 +10981,8 @@ function resolveAdapterOptions(config) {
|
|
|
10805
10981
|
filterModelsByPlan: config.filterModelsByPlan ?? true,
|
|
10806
10982
|
visibleModels: Array.isArray(config.visibleModels) ? config.visibleModels.filter((id) => typeof id === "string" && id !== "") : void 0,
|
|
10807
10983
|
modelVisibility: readModelVisibility(config.modelVisibility),
|
|
10984
|
+
contextWindow: isValidContextWindow(config.contextWindow) ? config.contextWindow : void 0,
|
|
10985
|
+
contextWindowOverrides: readContextWindowOverrides(config.contextWindowOverrides),
|
|
10808
10986
|
zdr: config.zdr === true
|
|
10809
10987
|
};
|
|
10810
10988
|
}
|