@jeffreyjyz/opencode-command-code 0.5.24 → 0.5.26
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/README.md +2 -0
- package/dist/catalog.d.ts +3 -4
- package/dist/catalogLive.d.ts +48 -0
- package/dist/constants/timing.d.ts +6 -0
- package/dist/index.js +318 -87
- package/dist/tui.js +204 -53
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ The model list is fetched live from Command Code's listing API, split by wire, a
|
|
|
17
17
|
|
|
18
18
|
Each model is registered with Command Code's published $/1M rates, so opencode's own cost display works for a subscription provider instead of showing $0. Vision support and reasoning-effort variants come from a generated catalog, because the listing API publishes no capabilities.
|
|
19
19
|
|
|
20
|
+
That catalog is refreshed at runtime: the plugin fetches Command Code's own `models.md` (bundled in their published CLI, served from the npm CDN), caches it for a day under `~/.cache/command-code/catalog-live.json`, and overlays prices, context windows and efforts on the baked snapshot before each model refresh — so a price change reaches a running install without waiting for a plugin release. The baked table stays as the offline and first-run fallback, and vision stays baked because it only exists in the CLI bundle. `catalogSource()` reports which table a given lookup used.
|
|
21
|
+
|
|
20
22
|
Credentials resolve in one order everywhere: `CMD_API_KEY`, then opencode's credential store (the `commandcode`/`command-code` rows, active first, newest first), then opencode's legacy `auth.json`, then `~/.commandcode/auth.json` from `cmd login`. The store ranks first because a re-connect leaves both files on the key it replaced — and if the API still answers 401, the request is retried with the next candidate rather than failing the turn.
|
|
21
23
|
|
|
22
24
|
## Install
|
package/dist/catalog.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface CatalogEntry {
|
|
|
15
15
|
/** Cheapest plan that serves the model; plans.md names this the access rule. */
|
|
16
16
|
minPlan: string | null;
|
|
17
17
|
}
|
|
18
|
-
export declare const CATALOG_VERSION: "1.
|
|
18
|
+
export declare const CATALOG_VERSION: "1.88.5";
|
|
19
19
|
/** Every model the CLI table carried, keyed by the API's model id. */
|
|
20
20
|
export declare const MODEL_CATALOG: Readonly<Record<string, CatalogEntry>>;
|
|
21
21
|
/** Text-only default for any id this table does not list. */
|
|
@@ -23,9 +23,8 @@ export declare const TEXT_ONLY: readonly InputModality[];
|
|
|
23
23
|
export declare function inputModalities(id: string): readonly InputModality[];
|
|
24
24
|
export declare function supportsImage(id: string): boolean;
|
|
25
25
|
export declare function modelCost(id: string): ModelCost | undefined;
|
|
26
|
-
/** Context window the
|
|
27
|
-
*
|
|
28
|
-
* fallback and a 1M-context model compacts at a fraction of its real window. */
|
|
26
|
+
/** Context window the table carries, or undefined for an unknown id. The static
|
|
27
|
+
* seed needs this: contextLength 0 becomes the 128k fallback at the host. */
|
|
29
28
|
export declare function modelContext(id: string): number | undefined;
|
|
30
29
|
export declare function minPlan(id: string): string | null;
|
|
31
30
|
/** Reasoning-capable when it advertises explicit effort levels. */
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CatalogEntry, ModelCost } from "./catalog";
|
|
2
|
+
import { inputModalities, supportsImage } from "./catalog";
|
|
3
|
+
/** A live row: everything models.md carries except modalities, which only the
|
|
4
|
+
* CLI bundle has and stays baked. */
|
|
5
|
+
export type LiveEntry = Omit<CatalogEntry, "modalities">;
|
|
6
|
+
export type LiveCatalog = {
|
|
7
|
+
fetchedAt: number;
|
|
8
|
+
/** CLI version the document came from, for diagnostics. */
|
|
9
|
+
version: string;
|
|
10
|
+
entries: Record<string, LiveEntry>;
|
|
11
|
+
};
|
|
12
|
+
/** "1M" / "1.05M" / "256K" / "1050000" → tokens. */
|
|
13
|
+
export declare function parseCount(raw: string): number;
|
|
14
|
+
/** "Go and above" → "Go"; "—" → null. */
|
|
15
|
+
export declare function normalizeMinPlan(raw: string | undefined): string | null;
|
|
16
|
+
/** Parse the published models.md table. Rows that fail the rate match are dropped,
|
|
17
|
+
* exactly as the build-time extractor does, so live and baked agree. */
|
|
18
|
+
export declare function parseModelsMd(md: string): Record<string, LiveEntry>;
|
|
19
|
+
/** Install a live table. Exported for tests; production goes through `refreshLiveCatalog`. */
|
|
20
|
+
export declare function applyLiveCatalog(entries: Record<string, LiveEntry> | null, fetchedAt?: number): void;
|
|
21
|
+
/** Provenance for the sidebar/logs: baked snapshot or a live overlay. */
|
|
22
|
+
export declare function catalogSource(): {
|
|
23
|
+
kind: "baked" | "live";
|
|
24
|
+
version: string;
|
|
25
|
+
ageMs: number;
|
|
26
|
+
};
|
|
27
|
+
export declare function liveContext(id: string): number | undefined;
|
|
28
|
+
export declare function liveCost(id: string): ModelCost | undefined;
|
|
29
|
+
export declare function liveMinPlan(id: string): string | null;
|
|
30
|
+
export declare function liveEfforts(id: string): readonly string[] | null | undefined;
|
|
31
|
+
export declare function liveReasoningVariants(id: string): Record<string, {
|
|
32
|
+
reasoningEffort: string;
|
|
33
|
+
}> | undefined;
|
|
34
|
+
export declare function liveIsReasoningModel(id: string): boolean;
|
|
35
|
+
export { inputModalities, supportsImage };
|
|
36
|
+
/**
|
|
37
|
+
* Load the live catalogue: disk cache when fresh, else fetch and rewrite it. Any
|
|
38
|
+
* failure leaves the baked snapshot in place — an outage must never blank prices.
|
|
39
|
+
* Never throws.
|
|
40
|
+
*/
|
|
41
|
+
export declare function refreshLiveCatalog(options?: {
|
|
42
|
+
force?: boolean;
|
|
43
|
+
}): Promise<"disk" | "fetch" | "baked">;
|
|
44
|
+
/** Startup path: apply the disk copy synchronously-immediately, then refresh in
|
|
45
|
+
* the background so nothing waits on the network. */
|
|
46
|
+
export declare function primeLiveCatalog(): Promise<"disk" | "fetch" | "baked">;
|
|
47
|
+
/** Path for tests and diagnostics. */
|
|
48
|
+
export declare function liveCatalogPath(): string;
|
|
@@ -6,6 +6,12 @@ export declare const POLL_MS = 5000;
|
|
|
6
6
|
export declare const CHILD_TIMEOUT_MS = 30000;
|
|
7
7
|
/** Process-lifetime cache for the live model list (src/models.ts). */
|
|
8
8
|
export declare const MODELS_CACHE_TTL_MS: number;
|
|
9
|
+
/** Live model-catalogue document (prices, context, efforts) fetched from the
|
|
10
|
+
* published CLI package. A day: rates change on a release cadence, not hourly,
|
|
11
|
+
* and every fetch costs a CDN round trip at startup. */
|
|
12
|
+
export declare const CATALOG_LIVE_TTL_MS: number;
|
|
13
|
+
/** Hard stop for one catalogue download; a hung CDN must not delay startup. */
|
|
14
|
+
export declare const CATALOG_LIVE_TIMEOUT_MS = 10000;
|
|
9
15
|
/** Disk cache for mpc's per-model catalog (src/sidebar/data.ts). An hour, not
|
|
10
16
|
* six: a running panel then picks up new models and promotions. */
|
|
11
17
|
export declare const CATALOG_CACHE_TTL_MS: number;
|
package/dist/index.js
CHANGED
|
@@ -2414,7 +2414,7 @@ function superRefine(fn) {
|
|
|
2414
2414
|
// package.json
|
|
2415
2415
|
var package_default = {
|
|
2416
2416
|
name: "@jeffreyjyz/opencode-command-code",
|
|
2417
|
-
version: "0.5.
|
|
2417
|
+
version: "0.5.26",
|
|
2418
2418
|
description: "Command Code provider + usage dashboard for opencode: two providers (Anthropic wire for Claude, OpenAI wire for everything else) against api.commandcode.ai, live model list, plan gating, /cmd-usage. Requires the cmduse CLI for usage rendering.",
|
|
2419
2419
|
type: "module",
|
|
2420
2420
|
main: "dist/index.js",
|
|
@@ -2516,7 +2516,13 @@ async function providerModels(key) {
|
|
|
2516
2516
|
return getJson("/provider/v1/models", key, 15000);
|
|
2517
2517
|
}
|
|
2518
2518
|
|
|
2519
|
+
// src/catalogLive.ts
|
|
2520
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
2521
|
+
import { homedir } from "os";
|
|
2522
|
+
import { join } from "path";
|
|
2523
|
+
|
|
2519
2524
|
// src/catalog.ts
|
|
2525
|
+
var CATALOG_VERSION = "1.88.5";
|
|
2520
2526
|
var MODEL_CATALOG = {
|
|
2521
2527
|
"claude-fable-5": {
|
|
2522
2528
|
name: "Claude Fable 5",
|
|
@@ -2542,6 +2548,14 @@ var MODEL_CATALOG = {
|
|
|
2542
2548
|
modalities: ["text", "image"],
|
|
2543
2549
|
minPlan: "Pro"
|
|
2544
2550
|
},
|
|
2551
|
+
"claude-haiku-5-5": {
|
|
2552
|
+
name: "Claude Haiku 5.5",
|
|
2553
|
+
context: 1e6,
|
|
2554
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
2555
|
+
cost: { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125 },
|
|
2556
|
+
modalities: ["text", "image"],
|
|
2557
|
+
minPlan: "GOAT"
|
|
2558
|
+
},
|
|
2545
2559
|
"claude-opus-4-7": {
|
|
2546
2560
|
name: "Claude Opus 4.7",
|
|
2547
2561
|
context: 1e6,
|
|
@@ -2594,7 +2608,7 @@ var MODEL_CATALOG = {
|
|
|
2594
2608
|
name: "Claude Sonnet 5.5",
|
|
2595
2609
|
context: 1e6,
|
|
2596
2610
|
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
2597
|
-
cost: { input: 2, output: 10, cacheRead: 0.
|
|
2611
|
+
cost: { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5 },
|
|
2598
2612
|
modalities: ["text", "image"],
|
|
2599
2613
|
minPlan: "GOAT"
|
|
2600
2614
|
},
|
|
@@ -2631,7 +2645,7 @@ var MODEL_CATALOG = {
|
|
|
2631
2645
|
minPlan: "Go"
|
|
2632
2646
|
},
|
|
2633
2647
|
"deepseek/deepseek-v4.1-flash": {
|
|
2634
|
-
name: "DeepSeek V4.1 Flash",
|
|
2648
|
+
name: "DeepSeek V4.1 Flash (latest)",
|
|
2635
2649
|
context: 1e6,
|
|
2636
2650
|
efforts: ["off", "low", "high", "max"],
|
|
2637
2651
|
cost: { input: 0.15, output: 0.6, cacheRead: 0.003, cacheWrite: 0 },
|
|
@@ -2639,13 +2653,21 @@ var MODEL_CATALOG = {
|
|
|
2639
2653
|
minPlan: "Go"
|
|
2640
2654
|
},
|
|
2641
2655
|
"deepseek/deepseek-v4.1-flash-fast": {
|
|
2642
|
-
name: "DeepSeek V4.1 Flash Fast",
|
|
2656
|
+
name: "DeepSeek V4.1 Flash Fast (latest)",
|
|
2643
2657
|
context: 1e6,
|
|
2644
2658
|
efforts: ["off", "low", "high", "max"],
|
|
2645
2659
|
cost: { input: 0.16, output: 0.58, cacheRead: 0.016, cacheWrite: 0 },
|
|
2646
2660
|
modalities: ["text", "image"],
|
|
2647
2661
|
minPlan: "Go"
|
|
2648
2662
|
},
|
|
2663
|
+
"deepseek/deepseek-v4.1-flash-ultrafast": {
|
|
2664
|
+
name: "DeepSeek V4.1 Flash Ultrafast",
|
|
2665
|
+
context: 1050000,
|
|
2666
|
+
efforts: ["off", "low", "high", "max"],
|
|
2667
|
+
cost: { input: 2.4, output: 9.6, cacheRead: 0.048, cacheWrite: 0 },
|
|
2668
|
+
modalities: ["text", "image"],
|
|
2669
|
+
minPlan: "GOAT"
|
|
2670
|
+
},
|
|
2649
2671
|
"google/gemini-3.1-flash-lite": {
|
|
2650
2672
|
name: "Gemini 3.1 Flash Lite",
|
|
2651
2673
|
context: 1e6,
|
|
@@ -2694,6 +2716,14 @@ var MODEL_CATALOG = {
|
|
|
2694
2716
|
modalities: ["text", "image"],
|
|
2695
2717
|
minPlan: "GOAT"
|
|
2696
2718
|
},
|
|
2719
|
+
"google/gemini-4-argon": {
|
|
2720
|
+
name: "Gemini 4 Argon",
|
|
2721
|
+
context: 1e6,
|
|
2722
|
+
efforts: ["low", "medium", "high"],
|
|
2723
|
+
cost: { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 0 },
|
|
2724
|
+
modalities: ["text", "image"],
|
|
2725
|
+
minPlan: "Pro"
|
|
2726
|
+
},
|
|
2697
2727
|
"gpt-5.3-codex": {
|
|
2698
2728
|
name: "GPT-5.3 Codex",
|
|
2699
2729
|
context: 400000,
|
|
@@ -2782,19 +2812,27 @@ var MODEL_CATALOG = {
|
|
|
2782
2812
|
modalities: ["text", "image"],
|
|
2783
2813
|
minPlan: "Max"
|
|
2784
2814
|
},
|
|
2785
|
-
"
|
|
2786
|
-
name: "
|
|
2815
|
+
"gpt-6.1-terra": {
|
|
2816
|
+
name: "GPT-6.1 Terra",
|
|
2817
|
+
context: 1050000,
|
|
2818
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
2819
|
+
cost: { input: 1, output: 5, cacheRead: 0.05, cacheWrite: 1.25 },
|
|
2820
|
+
modalities: ["text", "image"],
|
|
2821
|
+
minPlan: "Pro"
|
|
2822
|
+
},
|
|
2823
|
+
"inclusionai/ling-3.1-flash": {
|
|
2824
|
+
name: "Ling 3.1 Flash",
|
|
2787
2825
|
context: 262000,
|
|
2788
|
-
efforts:
|
|
2789
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
2826
|
+
efforts: ["low", "medium", "high"],
|
|
2827
|
+
cost: { input: 0.3, output: 0.9, cacheRead: 0.06, cacheWrite: 0 },
|
|
2790
2828
|
modalities: ["text"],
|
|
2791
2829
|
minPlan: "Go"
|
|
2792
2830
|
},
|
|
2793
|
-
"inclusionai/ling-3.1-flash
|
|
2794
|
-
name: "Ling 3.1 Flash",
|
|
2795
|
-
context:
|
|
2831
|
+
"inclusionai/ling-3.1-flash-1019": {
|
|
2832
|
+
name: "Ling 3.1 Flash 1019",
|
|
2833
|
+
context: 1e6,
|
|
2796
2834
|
efforts: ["low", "medium", "high"],
|
|
2797
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
2835
|
+
cost: { input: 0.3, output: 0.9, cacheRead: 0.06, cacheWrite: 0 },
|
|
2798
2836
|
modalities: ["text"],
|
|
2799
2837
|
minPlan: "Go"
|
|
2800
2838
|
},
|
|
@@ -2846,6 +2884,30 @@ var MODEL_CATALOG = {
|
|
|
2846
2884
|
modalities: ["text", "image"],
|
|
2847
2885
|
minPlan: "Go"
|
|
2848
2886
|
},
|
|
2887
|
+
"meta/muse-spark-open": {
|
|
2888
|
+
name: "Muse Spark Open",
|
|
2889
|
+
context: 1050000,
|
|
2890
|
+
efforts: ["low", "medium", "high"],
|
|
2891
|
+
cost: { input: 1.25, output: 4.25, cacheRead: 0.15, cacheWrite: 0 },
|
|
2892
|
+
modalities: ["text", "image"],
|
|
2893
|
+
minPlan: "Go"
|
|
2894
|
+
},
|
|
2895
|
+
"meta/muse-wonder-1.0": {
|
|
2896
|
+
name: "Muse Wonder",
|
|
2897
|
+
context: 1050000,
|
|
2898
|
+
efforts: ["low", "medium", "high", "xhigh"],
|
|
2899
|
+
cost: { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 0 },
|
|
2900
|
+
modalities: ["text", "image"],
|
|
2901
|
+
minPlan: "Max"
|
|
2902
|
+
},
|
|
2903
|
+
"minimax/minimax-m3.1-flash": {
|
|
2904
|
+
name: "MiniMax M3.1 Flash",
|
|
2905
|
+
context: 1e6,
|
|
2906
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
2907
|
+
cost: { input: 0.15, output: 0.6, cacheRead: 0.015, cacheWrite: 0 },
|
|
2908
|
+
modalities: ["text", "image"],
|
|
2909
|
+
minPlan: "Go"
|
|
2910
|
+
},
|
|
2849
2911
|
"MiniMaxAI/MiniMax-M2.5": {
|
|
2850
2912
|
name: "MiniMax M2.5",
|
|
2851
2913
|
context: 200000,
|
|
@@ -2870,6 +2932,14 @@ var MODEL_CATALOG = {
|
|
|
2870
2932
|
modalities: ["text", "image"],
|
|
2871
2933
|
minPlan: "Go"
|
|
2872
2934
|
},
|
|
2935
|
+
"mistral/mistral-large-4": {
|
|
2936
|
+
name: "Mistral Large 4",
|
|
2937
|
+
context: 524000,
|
|
2938
|
+
efforts: ["low", "medium", "high"],
|
|
2939
|
+
cost: { input: 1.36, output: 4.18, cacheRead: 0.14, cacheWrite: 0 },
|
|
2940
|
+
modalities: ["text", "image"],
|
|
2941
|
+
minPlan: "Go"
|
|
2942
|
+
},
|
|
2873
2943
|
"moonshotai/Kimi-K2.5": {
|
|
2874
2944
|
name: "Kimi K2.5",
|
|
2875
2945
|
context: 256000,
|
|
@@ -2910,6 +2980,14 @@ var MODEL_CATALOG = {
|
|
|
2910
2980
|
modalities: ["text", "image"],
|
|
2911
2981
|
minPlan: "Go"
|
|
2912
2982
|
},
|
|
2983
|
+
"moonshotai/Kimi-K3.1-Pro": {
|
|
2984
|
+
name: "Kimi K3.1 Pro",
|
|
2985
|
+
context: 1050000,
|
|
2986
|
+
efforts: ["low", "high", "max"],
|
|
2987
|
+
cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 0 },
|
|
2988
|
+
modalities: ["text", "image"],
|
|
2989
|
+
minPlan: "Go"
|
|
2990
|
+
},
|
|
2913
2991
|
"nvidia/nemotron-3-ultra-550b-a55b": {
|
|
2914
2992
|
name: "Nemotron 3 Ultra",
|
|
2915
2993
|
context: 1e6,
|
|
@@ -2918,12 +2996,20 @@ var MODEL_CATALOG = {
|
|
|
2918
2996
|
modalities: ["text"],
|
|
2919
2997
|
minPlan: "Go"
|
|
2920
2998
|
},
|
|
2921
|
-
"
|
|
2922
|
-
name: "
|
|
2923
|
-
context:
|
|
2999
|
+
"nvidia/nemotron-3.5-super-vl": {
|
|
3000
|
+
name: "Nemotron 3.5 Super VL",
|
|
3001
|
+
context: 262000,
|
|
3002
|
+
efforts: ["low", "medium", "high"],
|
|
3003
|
+
cost: { input: 0.2, output: 0.5, cacheRead: 0.04, cacheWrite: 0 },
|
|
3004
|
+
modalities: ["text", "image"],
|
|
3005
|
+
minPlan: "Go"
|
|
3006
|
+
},
|
|
3007
|
+
"ornith/ornith-1.5-122b": {
|
|
3008
|
+
name: "Ornith 1.5 122B",
|
|
3009
|
+
context: 262000,
|
|
2924
3010
|
efforts: null,
|
|
2925
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
2926
|
-
modalities: ["text"],
|
|
3011
|
+
cost: { input: 0.16, output: 0.64, cacheRead: 0.02, cacheWrite: 0 },
|
|
3012
|
+
modalities: ["text", "image"],
|
|
2927
3013
|
minPlan: "Go"
|
|
2928
3014
|
},
|
|
2929
3015
|
"Qwen/Qwen3.6-Max-Preview": {
|
|
@@ -2946,12 +3032,7 @@ var MODEL_CATALOG = {
|
|
|
2946
3032
|
name: "Qwen 3.7 Flash",
|
|
2947
3033
|
context: 1e6,
|
|
2948
3034
|
efforts: null,
|
|
2949
|
-
cost: {
|
|
2950
|
-
input: 0.03,
|
|
2951
|
-
output: 0.13,
|
|
2952
|
-
cacheRead: 0.006,
|
|
2953
|
-
cacheWrite: 0.038
|
|
2954
|
-
},
|
|
3035
|
+
cost: { input: 0.03, output: 0.13, cacheRead: 0.006, cacheWrite: 0.038 },
|
|
2955
3036
|
modalities: ["text", "image"],
|
|
2956
3037
|
minPlan: "Go"
|
|
2957
3038
|
},
|
|
@@ -3003,6 +3084,14 @@ var MODEL_CATALOG = {
|
|
|
3003
3084
|
modalities: ["text", "image"],
|
|
3004
3085
|
minPlan: "Go"
|
|
3005
3086
|
},
|
|
3087
|
+
"Qwen/Qwen3.8-Max-Prime": {
|
|
3088
|
+
name: "Qwen 3.8 Max Prime",
|
|
3089
|
+
context: 1e6,
|
|
3090
|
+
efforts: ["low", "medium", "xhigh"],
|
|
3091
|
+
cost: { input: 4, output: 12, cacheRead: 0.5, cacheWrite: 5 },
|
|
3092
|
+
modalities: ["text", "image"],
|
|
3093
|
+
minPlan: "GOAT"
|
|
3094
|
+
},
|
|
3006
3095
|
"Qwen/Qwen3.8-Omni-Flash": {
|
|
3007
3096
|
name: "Qwen 3.8 Omni Flash",
|
|
3008
3097
|
context: 1e6,
|
|
@@ -3011,6 +3100,14 @@ var MODEL_CATALOG = {
|
|
|
3011
3100
|
modalities: ["text", "image"],
|
|
3012
3101
|
minPlan: "Go"
|
|
3013
3102
|
},
|
|
3103
|
+
"reflection/beam:free": {
|
|
3104
|
+
name: "Beam 1.0",
|
|
3105
|
+
context: 1050000,
|
|
3106
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
3107
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3108
|
+
modalities: ["text"],
|
|
3109
|
+
minPlan: "Go"
|
|
3110
|
+
},
|
|
3014
3111
|
"sakana/fugu-ultra": {
|
|
3015
3112
|
name: "Fugu Ultra",
|
|
3016
3113
|
context: 1e6,
|
|
@@ -3019,14 +3116,22 @@ var MODEL_CATALOG = {
|
|
|
3019
3116
|
modalities: ["text", "image"],
|
|
3020
3117
|
minPlan: "Max"
|
|
3021
3118
|
},
|
|
3022
|
-
"stealth/
|
|
3023
|
-
name: "
|
|
3024
|
-
context:
|
|
3025
|
-
efforts: ["low", "medium", "high", "max"],
|
|
3119
|
+
"stealth/crouton-alpha": {
|
|
3120
|
+
name: "Crouton Alpha",
|
|
3121
|
+
context: 1050000,
|
|
3122
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
3026
3123
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3027
3124
|
modalities: ["text", "image"],
|
|
3028
3125
|
minPlan: "Go"
|
|
3029
3126
|
},
|
|
3127
|
+
"stealth/glyph-cluster:free": {
|
|
3128
|
+
name: "Glyph Cluster",
|
|
3129
|
+
context: 256000,
|
|
3130
|
+
efforts: ["low", "medium", "high", "xhigh"],
|
|
3131
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
3132
|
+
modalities: ["text"],
|
|
3133
|
+
minPlan: "Go"
|
|
3134
|
+
},
|
|
3030
3135
|
"stepfun/Step-3.5-Flash": {
|
|
3031
3136
|
name: "Step 3.5 Flash",
|
|
3032
3137
|
context: 262000,
|
|
@@ -3107,22 +3212,6 @@ var MODEL_CATALOG = {
|
|
|
3107
3212
|
modalities: ["text", "image"],
|
|
3108
3213
|
minPlan: "GOAT"
|
|
3109
3214
|
},
|
|
3110
|
-
"xiaomi/mimo-v2.5": {
|
|
3111
|
-
name: "MiMo V2.5",
|
|
3112
|
-
context: 1e6,
|
|
3113
|
-
efforts: null,
|
|
3114
|
-
cost: { input: 0.14, output: 0.28, cacheRead: 0.0028, cacheWrite: 0 },
|
|
3115
|
-
modalities: ["text", "image"],
|
|
3116
|
-
minPlan: "Go"
|
|
3117
|
-
},
|
|
3118
|
-
"xiaomi/mimo-v2.5-pro": {
|
|
3119
|
-
name: "MiMo V2.5 Pro",
|
|
3120
|
-
context: 1e6,
|
|
3121
|
-
efforts: null,
|
|
3122
|
-
cost: { input: 0.435, output: 0.87, cacheRead: 0.0036, cacheWrite: 0 },
|
|
3123
|
-
modalities: ["text"],
|
|
3124
|
-
minPlan: "Go"
|
|
3125
|
-
},
|
|
3126
3215
|
"xiaomi/mimo-v2.6-flash": {
|
|
3127
3216
|
name: "MiMo V2.6 Flash",
|
|
3128
3217
|
context: 1050000,
|
|
@@ -3217,19 +3306,170 @@ function modelCost(id) {
|
|
|
3217
3306
|
function modelContext(id) {
|
|
3218
3307
|
return MODEL_CATALOG[id]?.context;
|
|
3219
3308
|
}
|
|
3220
|
-
|
|
3221
|
-
|
|
3309
|
+
|
|
3310
|
+
// src/constants/paths.ts
|
|
3311
|
+
var CACHE_DIR = "command-code";
|
|
3312
|
+
var MODELS_CACHE_FILE = "models.json";
|
|
3313
|
+
var STARTUP_LOG_FILE = "startup.log";
|
|
3314
|
+
|
|
3315
|
+
// src/constants/timing.ts
|
|
3316
|
+
var MODELS_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
3317
|
+
var CATALOG_LIVE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
3318
|
+
var CATALOG_LIVE_TIMEOUT_MS = 1e4;
|
|
3319
|
+
var CATALOG_CACHE_TTL_MS = 60 * 60 * 1000;
|
|
3320
|
+
|
|
3321
|
+
// src/catalogLive.ts
|
|
3322
|
+
var CDNS = ["https://cdn.jsdelivr.net/npm", "https://unpkg.com"];
|
|
3323
|
+
var DOC = (cdn) => `${cdn}/command-code@latest/dist/bundled/command-code-knowledge/reference/models.md`;
|
|
3324
|
+
var LIVE_FILE = "catalog-live.json";
|
|
3325
|
+
var RATE_RE = /^\$([\d.]+)\/\$([\d.]+)\s*\u00B7\s*cache\s*\$([\d.]+)(?:\s*\(write\s*\$([\d.]+)\))?$/;
|
|
3326
|
+
var PLAN_NAMES = {
|
|
3327
|
+
free: "Free",
|
|
3328
|
+
go: "Go",
|
|
3329
|
+
goat: "GOAT",
|
|
3330
|
+
pro: "Pro",
|
|
3331
|
+
teampro: "Team Pro"
|
|
3332
|
+
};
|
|
3333
|
+
function parseCount(raw) {
|
|
3334
|
+
const m = raw.trim().match(/^([\d.]+)\s*([MK])?$/i);
|
|
3335
|
+
if (!m)
|
|
3336
|
+
return 0;
|
|
3337
|
+
const value = Number(m[1]);
|
|
3338
|
+
if (!Number.isFinite(value))
|
|
3339
|
+
return 0;
|
|
3340
|
+
const unit = (m[2] ?? "").toUpperCase();
|
|
3341
|
+
return Math.round(value * (unit === "M" ? 1e6 : unit === "K" ? 1000 : 1));
|
|
3342
|
+
}
|
|
3343
|
+
function normalizeMinPlan(raw) {
|
|
3344
|
+
const text = (raw ?? "").trim().replace(/\s+and above$/i, "").toLowerCase();
|
|
3345
|
+
if (!text || text === "\u2014" || text === "-")
|
|
3346
|
+
return null;
|
|
3347
|
+
return PLAN_NAMES[text] ?? null;
|
|
3348
|
+
}
|
|
3349
|
+
function parseModelsMd(md) {
|
|
3350
|
+
const out = {};
|
|
3351
|
+
for (const line of md.split(`
|
|
3352
|
+
`)) {
|
|
3353
|
+
const cells = line.split("|").map((c) => c.trim());
|
|
3354
|
+
if (cells.length < 8 || !cells[1]?.startsWith("`") || !cells[1]?.endsWith("`"))
|
|
3355
|
+
continue;
|
|
3356
|
+
const rate = cells[5]?.match(RATE_RE);
|
|
3357
|
+
if (!rate)
|
|
3358
|
+
continue;
|
|
3359
|
+
const [, input, output, cacheRead, cacheWrite] = rate;
|
|
3360
|
+
const effortsRaw = (cells[4] ?? "").trim();
|
|
3361
|
+
out[cells[1].slice(1, -1)] = {
|
|
3362
|
+
name: (cells[2] ?? "").trim(),
|
|
3363
|
+
context: parseCount(cells[3] ?? ""),
|
|
3364
|
+
efforts: !effortsRaw || effortsRaw === "\u2014" || effortsRaw === "-" ? null : effortsRaw.split(",").map((e) => e.trim()).filter(Boolean),
|
|
3365
|
+
cost: {
|
|
3366
|
+
input: Number(input),
|
|
3367
|
+
output: Number(output),
|
|
3368
|
+
cacheRead: Number(cacheRead),
|
|
3369
|
+
cacheWrite: cacheWrite === undefined ? 0 : Number(cacheWrite)
|
|
3370
|
+
},
|
|
3371
|
+
minPlan: normalizeMinPlan(cells[6])
|
|
3372
|
+
};
|
|
3373
|
+
}
|
|
3374
|
+
return out;
|
|
3375
|
+
}
|
|
3376
|
+
var live = null;
|
|
3377
|
+
var liveFetchedAt = 0;
|
|
3378
|
+
function applyLiveCatalog(entries, fetchedAt = Date.now()) {
|
|
3379
|
+
live = entries && Object.keys(entries).length > 0 ? entries : null;
|
|
3380
|
+
liveFetchedAt = live ? fetchedAt : 0;
|
|
3381
|
+
}
|
|
3382
|
+
function entry(id) {
|
|
3383
|
+
return live?.[id] ?? MODEL_CATALOG[id] ?? {};
|
|
3384
|
+
}
|
|
3385
|
+
function liveContext(id) {
|
|
3386
|
+
const value = entry(id).context;
|
|
3387
|
+
return value && value > 0 ? value : modelContext(id);
|
|
3388
|
+
}
|
|
3389
|
+
function liveCost(id) {
|
|
3390
|
+
return live?.[id]?.cost ?? modelCost(id);
|
|
3391
|
+
}
|
|
3392
|
+
function liveEfforts(id) {
|
|
3393
|
+
return live?.[id]?.efforts ?? MODEL_CATALOG[id]?.efforts;
|
|
3394
|
+
}
|
|
3395
|
+
function liveReasoningVariants(id) {
|
|
3396
|
+
const efforts = liveEfforts(id);
|
|
3222
3397
|
if (!efforts || efforts.length === 0)
|
|
3223
3398
|
return;
|
|
3224
3399
|
return Object.fromEntries(efforts.map((effort) => [effort, { reasoningEffort: effort }]));
|
|
3225
3400
|
}
|
|
3401
|
+
function livePath() {
|
|
3402
|
+
const base = process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache");
|
|
3403
|
+
return join(base, CACHE_DIR, LIVE_FILE);
|
|
3404
|
+
}
|
|
3405
|
+
async function readDisk() {
|
|
3406
|
+
try {
|
|
3407
|
+
const parsed = JSON.parse(await readFile(livePath(), "utf8"));
|
|
3408
|
+
if (!parsed.entries || typeof parsed.fetchedAt !== "number")
|
|
3409
|
+
return;
|
|
3410
|
+
return parsed;
|
|
3411
|
+
} catch {
|
|
3412
|
+
return;
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
async function writeDisk(catalog) {
|
|
3416
|
+
try {
|
|
3417
|
+
const path = livePath();
|
|
3418
|
+
await mkdir(join(path, ".."), { recursive: true });
|
|
3419
|
+
await writeFile(path, JSON.stringify(catalog));
|
|
3420
|
+
} catch {}
|
|
3421
|
+
}
|
|
3422
|
+
async function fetchDoc() {
|
|
3423
|
+
for (const cdn of CDNS) {
|
|
3424
|
+
try {
|
|
3425
|
+
const response = await fetch(DOC(cdn), {
|
|
3426
|
+
signal: AbortSignal.timeout(CATALOG_LIVE_TIMEOUT_MS)
|
|
3427
|
+
});
|
|
3428
|
+
if (!response.ok)
|
|
3429
|
+
continue;
|
|
3430
|
+
const body = await response.text();
|
|
3431
|
+
if (body.includes("$/1M"))
|
|
3432
|
+
return body;
|
|
3433
|
+
} catch {}
|
|
3434
|
+
}
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
async function refreshLiveCatalog(options = {}) {
|
|
3438
|
+
const cached = await readDisk();
|
|
3439
|
+
if (cached && !options.force && Date.now() - cached.fetchedAt < CATALOG_LIVE_TTL_MS) {
|
|
3440
|
+
applyLiveCatalog(cached.entries, cached.fetchedAt);
|
|
3441
|
+
return "disk";
|
|
3442
|
+
}
|
|
3443
|
+
const doc = await fetchDoc();
|
|
3444
|
+
if (!doc) {
|
|
3445
|
+
if (cached)
|
|
3446
|
+
applyLiveCatalog(cached.entries, cached.fetchedAt);
|
|
3447
|
+
return "baked";
|
|
3448
|
+
}
|
|
3449
|
+
const entries = parseModelsMd(doc);
|
|
3450
|
+
if (Object.keys(entries).length === 0) {
|
|
3451
|
+
if (cached)
|
|
3452
|
+
applyLiveCatalog(cached.entries, cached.fetchedAt);
|
|
3453
|
+
return "baked";
|
|
3454
|
+
}
|
|
3455
|
+
const version = String(CATALOG_VERSION);
|
|
3456
|
+
applyLiveCatalog(entries);
|
|
3457
|
+
await writeDisk({ fetchedAt: Date.now(), version, entries });
|
|
3458
|
+
return "fetch";
|
|
3459
|
+
}
|
|
3460
|
+
async function primeLiveCatalog() {
|
|
3461
|
+
const cached = await readDisk();
|
|
3462
|
+
if (cached)
|
|
3463
|
+
applyLiveCatalog(cached.entries, cached.fetchedAt);
|
|
3464
|
+
return refreshLiveCatalog();
|
|
3465
|
+
}
|
|
3226
3466
|
|
|
3227
3467
|
// src/cli.ts
|
|
3228
3468
|
import { spawn } from "child_process";
|
|
3229
3469
|
|
|
3230
3470
|
// src/constants/binaries.ts
|
|
3231
|
-
import { homedir } from "os";
|
|
3232
|
-
import { join } from "path";
|
|
3471
|
+
import { homedir as homedir2 } from "os";
|
|
3472
|
+
import { join as join2 } from "path";
|
|
3233
3473
|
var CMDUSE_BIN_CANDIDATES = [
|
|
3234
3474
|
"cmduse",
|
|
3235
3475
|
"/opt/homebrew/bin/cmduse",
|
|
@@ -3237,7 +3477,7 @@ var CMDUSE_BIN_CANDIDATES = [
|
|
|
3237
3477
|
];
|
|
3238
3478
|
var MPC_BIN_CANDIDATES = [
|
|
3239
3479
|
"mpc",
|
|
3240
|
-
|
|
3480
|
+
join2(homedir2(), ".bun/bin/mpc"),
|
|
3241
3481
|
"/opt/homebrew/bin/mpc"
|
|
3242
3482
|
];
|
|
3243
3483
|
var OCUSE_BIN_CANDIDATES = [
|
|
@@ -3516,19 +3756,19 @@ var LANES = [
|
|
|
3516
3756
|
];
|
|
3517
3757
|
|
|
3518
3758
|
// src/key.ts
|
|
3519
|
-
import { readFile } from "fs/promises";
|
|
3520
|
-
import { homedir as
|
|
3521
|
-
import { join as
|
|
3759
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
3760
|
+
import { homedir as homedir3 } from "os";
|
|
3761
|
+
import { join as join3 } from "path";
|
|
3522
3762
|
var STORE_PROVIDERS = ["commandcode", "command-code"];
|
|
3523
3763
|
function home() {
|
|
3524
|
-
return process.env.HOME ??
|
|
3764
|
+
return process.env.HOME ?? homedir3();
|
|
3525
3765
|
}
|
|
3526
3766
|
function opencodeHome() {
|
|
3527
|
-
const base = process.env.XDG_DATA_HOME ??
|
|
3528
|
-
return
|
|
3767
|
+
const base = process.env.XDG_DATA_HOME ?? join3(home(), ".local", "share");
|
|
3768
|
+
return join3(base, "opencode");
|
|
3529
3769
|
}
|
|
3530
3770
|
async function storeRows() {
|
|
3531
|
-
const path = process.env.OPENCODE_DB ??
|
|
3771
|
+
const path = process.env.OPENCODE_DB ?? join3(opencodeHome(), "opencode.db");
|
|
3532
3772
|
let db;
|
|
3533
3773
|
try {
|
|
3534
3774
|
const sqlite = await import("node:sqlite");
|
|
@@ -3574,7 +3814,7 @@ async function storeRows() {
|
|
|
3574
3814
|
}
|
|
3575
3815
|
async function fileKey(path) {
|
|
3576
3816
|
try {
|
|
3577
|
-
const value = JSON.parse(await
|
|
3817
|
+
const value = JSON.parse(await readFile2(path, "utf8"));
|
|
3578
3818
|
const keys = [];
|
|
3579
3819
|
for (const provider of STORE_PROVIDERS) {
|
|
3580
3820
|
const entry = value[provider];
|
|
@@ -3595,8 +3835,8 @@ async function candidateKeys(getAuth) {
|
|
|
3595
3835
|
keys.push(env);
|
|
3596
3836
|
for (const row of await storeRows())
|
|
3597
3837
|
keys.push(row.key);
|
|
3598
|
-
keys.push(...await fileKey(
|
|
3599
|
-
keys.push(...await fileKey(
|
|
3838
|
+
keys.push(...await fileKey(join3(opencodeHome(), "auth.json")));
|
|
3839
|
+
keys.push(...await fileKey(join3(home(), ".commandcode", "auth.json")));
|
|
3600
3840
|
try {
|
|
3601
3841
|
const auth = await getAuth?.();
|
|
3602
3842
|
if (auth?.key)
|
|
@@ -3983,10 +4223,6 @@ function siblingCategory(model) {
|
|
|
3983
4223
|
return best ? MODEL_CATEGORIES[best] : undefined;
|
|
3984
4224
|
}
|
|
3985
4225
|
|
|
3986
|
-
// src/constants/timing.ts
|
|
3987
|
-
var MODELS_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
3988
|
-
var CATALOG_CACHE_TTL_MS = 60 * 60 * 1000;
|
|
3989
|
-
|
|
3990
4226
|
// src/models.ts
|
|
3991
4227
|
var cache = null;
|
|
3992
4228
|
function isClaude(id) {
|
|
@@ -4041,23 +4277,16 @@ async function loadModels(key) {
|
|
|
4041
4277
|
}
|
|
4042
4278
|
|
|
4043
4279
|
// src/modelsCache.ts
|
|
4044
|
-
import { mkdir, readFile as
|
|
4045
|
-
import { homedir as
|
|
4046
|
-
import { join as
|
|
4047
|
-
|
|
4048
|
-
// src/constants/paths.ts
|
|
4049
|
-
var CACHE_DIR = "command-code";
|
|
4050
|
-
var MODELS_CACHE_FILE = "models.json";
|
|
4051
|
-
var STARTUP_LOG_FILE = "startup.log";
|
|
4052
|
-
|
|
4053
|
-
// src/modelsCache.ts
|
|
4280
|
+
import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
|
|
4281
|
+
import { homedir as homedir4 } from "os";
|
|
4282
|
+
import { join as join4 } from "path";
|
|
4054
4283
|
function cachePath() {
|
|
4055
|
-
const base = process.env.XDG_CACHE_HOME ??
|
|
4056
|
-
return
|
|
4284
|
+
const base = process.env.XDG_CACHE_HOME ?? join4(homedir4(), ".cache");
|
|
4285
|
+
return join4(base, CACHE_DIR, MODELS_CACHE_FILE);
|
|
4057
4286
|
}
|
|
4058
4287
|
async function readModelsCache() {
|
|
4059
4288
|
try {
|
|
4060
|
-
const parsed = JSON.parse(await
|
|
4289
|
+
const parsed = JSON.parse(await readFile3(cachePath(), "utf8"));
|
|
4061
4290
|
if (!Array.isArray(parsed.claude) || !Array.isArray(parsed.open))
|
|
4062
4291
|
return;
|
|
4063
4292
|
return parsed;
|
|
@@ -4068,8 +4297,8 @@ async function readModelsCache() {
|
|
|
4068
4297
|
async function writeModelsCache(cache) {
|
|
4069
4298
|
try {
|
|
4070
4299
|
const path = cachePath();
|
|
4071
|
-
await
|
|
4072
|
-
await
|
|
4300
|
+
await mkdir2(join4(path, ".."), { recursive: true });
|
|
4301
|
+
await writeFile2(path, JSON.stringify(cache));
|
|
4073
4302
|
} catch {}
|
|
4074
4303
|
}
|
|
4075
4304
|
function idsDiffer(a, b) {
|
|
@@ -4885,20 +5114,20 @@ function createCommandCode(options = {}, images = () => false) {
|
|
|
4885
5114
|
}
|
|
4886
5115
|
|
|
4887
5116
|
// src/startupLog.ts
|
|
4888
|
-
import { appendFile, mkdir as
|
|
4889
|
-
import { homedir as
|
|
4890
|
-
import { join as
|
|
5117
|
+
import { appendFile, mkdir as mkdir3 } from "fs/promises";
|
|
5118
|
+
import { homedir as homedir5 } from "os";
|
|
5119
|
+
import { join as join5 } from "path";
|
|
4891
5120
|
function setupTimingLine(t) {
|
|
4892
5121
|
return `setup: key=${t.key}ms register=${t.register}ms connection=${t.connection}ms refresh=${t.refresh}ms models=${t.models}`;
|
|
4893
5122
|
}
|
|
4894
5123
|
function startupLogPath() {
|
|
4895
|
-
const base = process.env.XDG_CACHE_HOME ??
|
|
4896
|
-
return
|
|
5124
|
+
const base = process.env.XDG_CACHE_HOME ?? join5(homedir5(), ".cache");
|
|
5125
|
+
return join5(base, CACHE_DIR, STARTUP_LOG_FILE);
|
|
4897
5126
|
}
|
|
4898
5127
|
async function writeStartupLine(line) {
|
|
4899
5128
|
try {
|
|
4900
5129
|
const path = startupLogPath();
|
|
4901
|
-
await
|
|
5130
|
+
await mkdir3(join5(path, ".."), { recursive: true });
|
|
4902
5131
|
await appendFile(path, `[${new Date().toISOString()}] ${line}
|
|
4903
5132
|
`);
|
|
4904
5133
|
} catch {}
|
|
@@ -4906,7 +5135,7 @@ async function writeStartupLine(line) {
|
|
|
4906
5135
|
|
|
4907
5136
|
// src/v2.ts
|
|
4908
5137
|
function costEntry(id) {
|
|
4909
|
-
const cost =
|
|
5138
|
+
const cost = liveCost(id);
|
|
4910
5139
|
return cost ? [
|
|
4911
5140
|
{
|
|
4912
5141
|
input: cost.input,
|
|
@@ -4916,7 +5145,7 @@ function costEntry(id) {
|
|
|
4916
5145
|
] : [];
|
|
4917
5146
|
}
|
|
4918
5147
|
function toV2Model(m, lane) {
|
|
4919
|
-
const efforts =
|
|
5148
|
+
const efforts = liveReasoningVariants(m.id);
|
|
4920
5149
|
const variants = efforts ? Object.entries(efforts).map(([id, settings]) => ({ id, settings })) : [];
|
|
4921
5150
|
const info = {
|
|
4922
5151
|
id: m.id,
|
|
@@ -4947,7 +5176,7 @@ function staticSeedModels() {
|
|
|
4947
5176
|
"command-code-openai": []
|
|
4948
5177
|
};
|
|
4949
5178
|
for (const lane of LANES) {
|
|
4950
|
-
const models = KNOWN_MODELS.filter((id) => isClaude(id) === (lane.reasoningField === undefined)).map((id) => toV2Model({ id, name: id, contextLength:
|
|
5179
|
+
const models = KNOWN_MODELS.filter((id) => isClaude(id) === (lane.reasoningField === undefined)).map((id) => toV2Model({ id, name: id, contextLength: liveContext(id) ?? 0 }, lane));
|
|
4951
5180
|
seed[lane.id] = models;
|
|
4952
5181
|
}
|
|
4953
5182
|
return seed;
|
|
@@ -5182,6 +5411,7 @@ var commandCodeV2 = {
|
|
|
5182
5411
|
refreshing = true;
|
|
5183
5412
|
const refreshStart = Date.now();
|
|
5184
5413
|
try {
|
|
5414
|
+
await refreshLiveCatalog();
|
|
5185
5415
|
const key = await credentialKey(ctx);
|
|
5186
5416
|
if (!key)
|
|
5187
5417
|
return;
|
|
@@ -5217,6 +5447,7 @@ var commandCodeV2 = {
|
|
|
5217
5447
|
}
|
|
5218
5448
|
};
|
|
5219
5449
|
v2FirstRefresh = setTimeout(() => void refresh(), 3000);
|
|
5450
|
+
primeLiveCatalog();
|
|
5220
5451
|
v2Timer = setInterval(() => void refresh(), 30 * 60 * 1000);
|
|
5221
5452
|
return () => {
|
|
5222
5453
|
controller.abort();
|
|
@@ -5239,7 +5470,7 @@ function tool(input) {
|
|
|
5239
5470
|
return input;
|
|
5240
5471
|
}
|
|
5241
5472
|
function costFor(id) {
|
|
5242
|
-
const cost =
|
|
5473
|
+
const cost = liveCost(id);
|
|
5243
5474
|
return {
|
|
5244
5475
|
input: cost?.input ?? 0,
|
|
5245
5476
|
output: cost?.output ?? 0,
|
package/dist/tui.js
CHANGED
|
@@ -941,6 +941,7 @@ var PREFS_FILE = "command-code.json";
|
|
|
941
941
|
var POLL_MS = 5000;
|
|
942
942
|
var CHILD_TIMEOUT_MS = 30000;
|
|
943
943
|
var MODELS_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
944
|
+
var CATALOG_LIVE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
944
945
|
var CATALOG_CACHE_TTL_MS = 60 * 60 * 1000;
|
|
945
946
|
var PREFS_CACHE_MS = 5000;
|
|
946
947
|
var ARK_SNAPSHOT_TTL_MS = 60000;
|
|
@@ -1042,6 +1043,19 @@ var MODEL_CATALOG = {
|
|
|
1042
1043
|
modalities: ["text", "image"],
|
|
1043
1044
|
minPlan: "Pro"
|
|
1044
1045
|
},
|
|
1046
|
+
"claude-haiku-5-5": {
|
|
1047
|
+
name: "Claude Haiku 5.5",
|
|
1048
|
+
context: 1e6,
|
|
1049
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
1050
|
+
cost: {
|
|
1051
|
+
input: 0.1,
|
|
1052
|
+
output: 0.5,
|
|
1053
|
+
cacheRead: 0.01,
|
|
1054
|
+
cacheWrite: 0.125
|
|
1055
|
+
},
|
|
1056
|
+
modalities: ["text", "image"],
|
|
1057
|
+
minPlan: "GOAT"
|
|
1058
|
+
},
|
|
1045
1059
|
"claude-opus-4-7": {
|
|
1046
1060
|
name: "Claude Opus 4.7",
|
|
1047
1061
|
context: 1e6,
|
|
@@ -1127,7 +1141,7 @@ var MODEL_CATALOG = {
|
|
|
1127
1141
|
cost: {
|
|
1128
1142
|
input: 2,
|
|
1129
1143
|
output: 10,
|
|
1130
|
-
cacheRead: 0.
|
|
1144
|
+
cacheRead: 0.1,
|
|
1131
1145
|
cacheWrite: 2.5
|
|
1132
1146
|
},
|
|
1133
1147
|
modalities: ["text", "image"],
|
|
@@ -1186,7 +1200,7 @@ var MODEL_CATALOG = {
|
|
|
1186
1200
|
minPlan: "Go"
|
|
1187
1201
|
},
|
|
1188
1202
|
"deepseek/deepseek-v4.1-flash": {
|
|
1189
|
-
name: "DeepSeek V4.1 Flash",
|
|
1203
|
+
name: "DeepSeek V4.1 Flash (latest)",
|
|
1190
1204
|
context: 1e6,
|
|
1191
1205
|
efforts: ["off", "low", "high", "max"],
|
|
1192
1206
|
cost: {
|
|
@@ -1199,7 +1213,7 @@ var MODEL_CATALOG = {
|
|
|
1199
1213
|
minPlan: "Go"
|
|
1200
1214
|
},
|
|
1201
1215
|
"deepseek/deepseek-v4.1-flash-fast": {
|
|
1202
|
-
name: "DeepSeek V4.1 Flash Fast",
|
|
1216
|
+
name: "DeepSeek V4.1 Flash Fast (latest)",
|
|
1203
1217
|
context: 1e6,
|
|
1204
1218
|
efforts: ["off", "low", "high", "max"],
|
|
1205
1219
|
cost: {
|
|
@@ -1211,6 +1225,19 @@ var MODEL_CATALOG = {
|
|
|
1211
1225
|
modalities: ["text", "image"],
|
|
1212
1226
|
minPlan: "Go"
|
|
1213
1227
|
},
|
|
1228
|
+
"deepseek/deepseek-v4.1-flash-ultrafast": {
|
|
1229
|
+
name: "DeepSeek V4.1 Flash Ultrafast",
|
|
1230
|
+
context: 1050000,
|
|
1231
|
+
efforts: ["off", "low", "high", "max"],
|
|
1232
|
+
cost: {
|
|
1233
|
+
input: 2.4,
|
|
1234
|
+
output: 9.6,
|
|
1235
|
+
cacheRead: 0.048,
|
|
1236
|
+
cacheWrite: 0
|
|
1237
|
+
},
|
|
1238
|
+
modalities: ["text", "image"],
|
|
1239
|
+
minPlan: "GOAT"
|
|
1240
|
+
},
|
|
1214
1241
|
"google/gemini-3.1-flash-lite": {
|
|
1215
1242
|
name: "Gemini 3.1 Flash Lite",
|
|
1216
1243
|
context: 1e6,
|
|
@@ -1289,6 +1316,19 @@ var MODEL_CATALOG = {
|
|
|
1289
1316
|
modalities: ["text", "image"],
|
|
1290
1317
|
minPlan: "GOAT"
|
|
1291
1318
|
},
|
|
1319
|
+
"google/gemini-4-argon": {
|
|
1320
|
+
name: "Gemini 4 Argon",
|
|
1321
|
+
context: 1e6,
|
|
1322
|
+
efforts: ["low", "medium", "high"],
|
|
1323
|
+
cost: {
|
|
1324
|
+
input: 2,
|
|
1325
|
+
output: 10,
|
|
1326
|
+
cacheRead: 0.1,
|
|
1327
|
+
cacheWrite: 0
|
|
1328
|
+
},
|
|
1329
|
+
modalities: ["text", "image"],
|
|
1330
|
+
minPlan: "Pro"
|
|
1331
|
+
},
|
|
1292
1332
|
"gpt-5.3-codex": {
|
|
1293
1333
|
name: "GPT-5.3 Codex",
|
|
1294
1334
|
context: 400000,
|
|
@@ -1432,27 +1472,40 @@ var MODEL_CATALOG = {
|
|
|
1432
1472
|
modalities: ["text", "image"],
|
|
1433
1473
|
minPlan: "Max"
|
|
1434
1474
|
},
|
|
1435
|
-
"
|
|
1436
|
-
name: "
|
|
1475
|
+
"gpt-6.1-terra": {
|
|
1476
|
+
name: "GPT-6.1 Terra",
|
|
1477
|
+
context: 1050000,
|
|
1478
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
1479
|
+
cost: {
|
|
1480
|
+
input: 1,
|
|
1481
|
+
output: 5,
|
|
1482
|
+
cacheRead: 0.05,
|
|
1483
|
+
cacheWrite: 1.25
|
|
1484
|
+
},
|
|
1485
|
+
modalities: ["text", "image"],
|
|
1486
|
+
minPlan: "Pro"
|
|
1487
|
+
},
|
|
1488
|
+
"inclusionai/ling-3.1-flash": {
|
|
1489
|
+
name: "Ling 3.1 Flash",
|
|
1437
1490
|
context: 262000,
|
|
1438
|
-
efforts:
|
|
1491
|
+
efforts: ["low", "medium", "high"],
|
|
1439
1492
|
cost: {
|
|
1440
|
-
input: 0,
|
|
1441
|
-
output: 0,
|
|
1442
|
-
cacheRead: 0,
|
|
1493
|
+
input: 0.3,
|
|
1494
|
+
output: 0.9,
|
|
1495
|
+
cacheRead: 0.06,
|
|
1443
1496
|
cacheWrite: 0
|
|
1444
1497
|
},
|
|
1445
1498
|
modalities: ["text"],
|
|
1446
1499
|
minPlan: "Go"
|
|
1447
1500
|
},
|
|
1448
|
-
"inclusionai/ling-3.1-flash
|
|
1449
|
-
name: "Ling 3.1 Flash",
|
|
1450
|
-
context:
|
|
1501
|
+
"inclusionai/ling-3.1-flash-1019": {
|
|
1502
|
+
name: "Ling 3.1 Flash 1019",
|
|
1503
|
+
context: 1e6,
|
|
1451
1504
|
efforts: ["low", "medium", "high"],
|
|
1452
1505
|
cost: {
|
|
1453
|
-
input: 0,
|
|
1454
|
-
output: 0,
|
|
1455
|
-
cacheRead: 0,
|
|
1506
|
+
input: 0.3,
|
|
1507
|
+
output: 0.9,
|
|
1508
|
+
cacheRead: 0.06,
|
|
1456
1509
|
cacheWrite: 0
|
|
1457
1510
|
},
|
|
1458
1511
|
modalities: ["text"],
|
|
@@ -1536,6 +1589,45 @@ var MODEL_CATALOG = {
|
|
|
1536
1589
|
modalities: ["text", "image"],
|
|
1537
1590
|
minPlan: "Go"
|
|
1538
1591
|
},
|
|
1592
|
+
"meta/muse-spark-open": {
|
|
1593
|
+
name: "Muse Spark Open",
|
|
1594
|
+
context: 1050000,
|
|
1595
|
+
efforts: ["low", "medium", "high"],
|
|
1596
|
+
cost: {
|
|
1597
|
+
input: 1.25,
|
|
1598
|
+
output: 4.25,
|
|
1599
|
+
cacheRead: 0.15,
|
|
1600
|
+
cacheWrite: 0
|
|
1601
|
+
},
|
|
1602
|
+
modalities: ["text", "image"],
|
|
1603
|
+
minPlan: "Go"
|
|
1604
|
+
},
|
|
1605
|
+
"meta/muse-wonder-1.0": {
|
|
1606
|
+
name: "Muse Wonder",
|
|
1607
|
+
context: 1050000,
|
|
1608
|
+
efforts: ["low", "medium", "high", "xhigh"],
|
|
1609
|
+
cost: {
|
|
1610
|
+
input: 4,
|
|
1611
|
+
output: 20,
|
|
1612
|
+
cacheRead: 0.2,
|
|
1613
|
+
cacheWrite: 0
|
|
1614
|
+
},
|
|
1615
|
+
modalities: ["text", "image"],
|
|
1616
|
+
minPlan: "Max"
|
|
1617
|
+
},
|
|
1618
|
+
"minimax/minimax-m3.1-flash": {
|
|
1619
|
+
name: "MiniMax M3.1 Flash",
|
|
1620
|
+
context: 1e6,
|
|
1621
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
1622
|
+
cost: {
|
|
1623
|
+
input: 0.15,
|
|
1624
|
+
output: 0.6,
|
|
1625
|
+
cacheRead: 0.015,
|
|
1626
|
+
cacheWrite: 0
|
|
1627
|
+
},
|
|
1628
|
+
modalities: ["text", "image"],
|
|
1629
|
+
minPlan: "Go"
|
|
1630
|
+
},
|
|
1539
1631
|
"MiniMaxAI/MiniMax-M2.5": {
|
|
1540
1632
|
name: "MiniMax M2.5",
|
|
1541
1633
|
context: 200000,
|
|
@@ -1575,6 +1667,19 @@ var MODEL_CATALOG = {
|
|
|
1575
1667
|
modalities: ["text", "image"],
|
|
1576
1668
|
minPlan: "Go"
|
|
1577
1669
|
},
|
|
1670
|
+
"mistral/mistral-large-4": {
|
|
1671
|
+
name: "Mistral Large 4",
|
|
1672
|
+
context: 524000,
|
|
1673
|
+
efforts: ["low", "medium", "high"],
|
|
1674
|
+
cost: {
|
|
1675
|
+
input: 1.36,
|
|
1676
|
+
output: 4.18,
|
|
1677
|
+
cacheRead: 0.14,
|
|
1678
|
+
cacheWrite: 0
|
|
1679
|
+
},
|
|
1680
|
+
modalities: ["text", "image"],
|
|
1681
|
+
minPlan: "Go"
|
|
1682
|
+
},
|
|
1578
1683
|
"moonshotai/Kimi-K2.5": {
|
|
1579
1684
|
name: "Kimi K2.5",
|
|
1580
1685
|
context: 256000,
|
|
@@ -1640,6 +1745,19 @@ var MODEL_CATALOG = {
|
|
|
1640
1745
|
modalities: ["text", "image"],
|
|
1641
1746
|
minPlan: "Go"
|
|
1642
1747
|
},
|
|
1748
|
+
"moonshotai/Kimi-K3.1-Pro": {
|
|
1749
|
+
name: "Kimi K3.1 Pro",
|
|
1750
|
+
context: 1050000,
|
|
1751
|
+
efforts: ["low", "high", "max"],
|
|
1752
|
+
cost: {
|
|
1753
|
+
input: 2,
|
|
1754
|
+
output: 10,
|
|
1755
|
+
cacheRead: 0.2,
|
|
1756
|
+
cacheWrite: 0
|
|
1757
|
+
},
|
|
1758
|
+
modalities: ["text", "image"],
|
|
1759
|
+
minPlan: "Go"
|
|
1760
|
+
},
|
|
1643
1761
|
"nvidia/nemotron-3-ultra-550b-a55b": {
|
|
1644
1762
|
name: "Nemotron 3 Ultra",
|
|
1645
1763
|
context: 1e6,
|
|
@@ -1653,17 +1771,30 @@ var MODEL_CATALOG = {
|
|
|
1653
1771
|
modalities: ["text"],
|
|
1654
1772
|
minPlan: "Go"
|
|
1655
1773
|
},
|
|
1656
|
-
"
|
|
1657
|
-
name: "
|
|
1658
|
-
context:
|
|
1774
|
+
"nvidia/nemotron-3.5-super-vl": {
|
|
1775
|
+
name: "Nemotron 3.5 Super VL",
|
|
1776
|
+
context: 262000,
|
|
1777
|
+
efforts: ["low", "medium", "high"],
|
|
1778
|
+
cost: {
|
|
1779
|
+
input: 0.2,
|
|
1780
|
+
output: 0.5,
|
|
1781
|
+
cacheRead: 0.04,
|
|
1782
|
+
cacheWrite: 0
|
|
1783
|
+
},
|
|
1784
|
+
modalities: ["text", "image"],
|
|
1785
|
+
minPlan: "Go"
|
|
1786
|
+
},
|
|
1787
|
+
"ornith/ornith-1.5-122b": {
|
|
1788
|
+
name: "Ornith 1.5 122B",
|
|
1789
|
+
context: 262000,
|
|
1659
1790
|
efforts: null,
|
|
1660
1791
|
cost: {
|
|
1661
|
-
input: 0,
|
|
1662
|
-
output: 0,
|
|
1663
|
-
cacheRead: 0,
|
|
1792
|
+
input: 0.16,
|
|
1793
|
+
output: 0.64,
|
|
1794
|
+
cacheRead: 0.02,
|
|
1664
1795
|
cacheWrite: 0
|
|
1665
1796
|
},
|
|
1666
|
-
modalities: ["text"],
|
|
1797
|
+
modalities: ["text", "image"],
|
|
1667
1798
|
minPlan: "Go"
|
|
1668
1799
|
},
|
|
1669
1800
|
"Qwen/Qwen3.6-Max-Preview": {
|
|
@@ -1783,6 +1914,19 @@ var MODEL_CATALOG = {
|
|
|
1783
1914
|
modalities: ["text", "image"],
|
|
1784
1915
|
minPlan: "Go"
|
|
1785
1916
|
},
|
|
1917
|
+
"Qwen/Qwen3.8-Max-Prime": {
|
|
1918
|
+
name: "Qwen 3.8 Max Prime",
|
|
1919
|
+
context: 1e6,
|
|
1920
|
+
efforts: ["low", "medium", "xhigh"],
|
|
1921
|
+
cost: {
|
|
1922
|
+
input: 4,
|
|
1923
|
+
output: 12,
|
|
1924
|
+
cacheRead: 0.5,
|
|
1925
|
+
cacheWrite: 5
|
|
1926
|
+
},
|
|
1927
|
+
modalities: ["text", "image"],
|
|
1928
|
+
minPlan: "GOAT"
|
|
1929
|
+
},
|
|
1786
1930
|
"Qwen/Qwen3.8-Omni-Flash": {
|
|
1787
1931
|
name: "Qwen 3.8 Omni Flash",
|
|
1788
1932
|
context: 1e6,
|
|
@@ -1796,6 +1940,19 @@ var MODEL_CATALOG = {
|
|
|
1796
1940
|
modalities: ["text", "image"],
|
|
1797
1941
|
minPlan: "Go"
|
|
1798
1942
|
},
|
|
1943
|
+
"reflection/beam:free": {
|
|
1944
|
+
name: "Beam 1.0",
|
|
1945
|
+
context: 1050000,
|
|
1946
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
1947
|
+
cost: {
|
|
1948
|
+
input: 0,
|
|
1949
|
+
output: 0,
|
|
1950
|
+
cacheRead: 0,
|
|
1951
|
+
cacheWrite: 0
|
|
1952
|
+
},
|
|
1953
|
+
modalities: ["text"],
|
|
1954
|
+
minPlan: "Go"
|
|
1955
|
+
},
|
|
1799
1956
|
"sakana/fugu-ultra": {
|
|
1800
1957
|
name: "Fugu Ultra",
|
|
1801
1958
|
context: 1e6,
|
|
@@ -1809,10 +1966,10 @@ var MODEL_CATALOG = {
|
|
|
1809
1966
|
modalities: ["text", "image"],
|
|
1810
1967
|
minPlan: "Max"
|
|
1811
1968
|
},
|
|
1812
|
-
"stealth/
|
|
1813
|
-
name: "
|
|
1814
|
-
context:
|
|
1815
|
-
efforts: ["low", "medium", "high", "max"],
|
|
1969
|
+
"stealth/crouton-alpha": {
|
|
1970
|
+
name: "Crouton Alpha",
|
|
1971
|
+
context: 1050000,
|
|
1972
|
+
efforts: ["low", "medium", "high", "xhigh", "max"],
|
|
1816
1973
|
cost: {
|
|
1817
1974
|
input: 0,
|
|
1818
1975
|
output: 0,
|
|
@@ -1822,6 +1979,19 @@ var MODEL_CATALOG = {
|
|
|
1822
1979
|
modalities: ["text", "image"],
|
|
1823
1980
|
minPlan: "Go"
|
|
1824
1981
|
},
|
|
1982
|
+
"stealth/glyph-cluster:free": {
|
|
1983
|
+
name: "Glyph Cluster",
|
|
1984
|
+
context: 256000,
|
|
1985
|
+
efforts: ["low", "medium", "high", "xhigh"],
|
|
1986
|
+
cost: {
|
|
1987
|
+
input: 0,
|
|
1988
|
+
output: 0,
|
|
1989
|
+
cacheRead: 0,
|
|
1990
|
+
cacheWrite: 0
|
|
1991
|
+
},
|
|
1992
|
+
modalities: ["text"],
|
|
1993
|
+
minPlan: "Go"
|
|
1994
|
+
},
|
|
1825
1995
|
"stepfun/Step-3.5-Flash": {
|
|
1826
1996
|
name: "Step 3.5 Flash",
|
|
1827
1997
|
context: 262000,
|
|
@@ -1952,32 +2122,6 @@ var MODEL_CATALOG = {
|
|
|
1952
2122
|
modalities: ["text", "image"],
|
|
1953
2123
|
minPlan: "GOAT"
|
|
1954
2124
|
},
|
|
1955
|
-
"xiaomi/mimo-v2.5": {
|
|
1956
|
-
name: "MiMo V2.5",
|
|
1957
|
-
context: 1e6,
|
|
1958
|
-
efforts: null,
|
|
1959
|
-
cost: {
|
|
1960
|
-
input: 0.14,
|
|
1961
|
-
output: 0.28,
|
|
1962
|
-
cacheRead: 0.0028,
|
|
1963
|
-
cacheWrite: 0
|
|
1964
|
-
},
|
|
1965
|
-
modalities: ["text", "image"],
|
|
1966
|
-
minPlan: "Go"
|
|
1967
|
-
},
|
|
1968
|
-
"xiaomi/mimo-v2.5-pro": {
|
|
1969
|
-
name: "MiMo V2.5 Pro",
|
|
1970
|
-
context: 1e6,
|
|
1971
|
-
efforts: null,
|
|
1972
|
-
cost: {
|
|
1973
|
-
input: 0.435,
|
|
1974
|
-
output: 0.87,
|
|
1975
|
-
cacheRead: 0.0036,
|
|
1976
|
-
cacheWrite: 0
|
|
1977
|
-
},
|
|
1978
|
-
modalities: ["text"],
|
|
1979
|
-
minPlan: "Go"
|
|
1980
|
-
},
|
|
1981
2125
|
"xiaomi/mimo-v2.6-flash": {
|
|
1982
2126
|
name: "MiMo V2.6 Flash",
|
|
1983
2127
|
context: 1050000,
|
|
@@ -2113,6 +2257,13 @@ function minPlan(id) {
|
|
|
2113
2257
|
return MODEL_CATALOG[id]?.minPlan ?? null;
|
|
2114
2258
|
}
|
|
2115
2259
|
|
|
2260
|
+
// src/catalogLive.ts
|
|
2261
|
+
var live = null;
|
|
2262
|
+
function liveMinPlan(id) {
|
|
2263
|
+
const plan = live?.[id]?.minPlan;
|
|
2264
|
+
return plan === undefined ? minPlan(id) : plan;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2116
2267
|
// src/sidebar/ark.ts
|
|
2117
2268
|
function totals(value) {
|
|
2118
2269
|
const v = value ?? {};
|
|
@@ -2964,7 +3115,7 @@ function useRows(activeModelId, providerID, sessionID) {
|
|
|
2964
3115
|
const model = found ? {
|
|
2965
3116
|
...found,
|
|
2966
3117
|
tier: found.tier ?? (id ? tierFor(id) : undefined),
|
|
2967
|
-
minPlan: id ?
|
|
3118
|
+
minPlan: id ? liveMinPlan(id) : undefined
|
|
2968
3119
|
} : undefined;
|
|
2969
3120
|
return [...usage(), separator(), ...modelRows(model, usageFor(id), sessionUsage(), fallbackName)];
|
|
2970
3121
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffreyjyz/opencode-command-code",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.26",
|
|
4
4
|
"description": "Command Code provider + usage dashboard for opencode: two providers (Anthropic wire for Claude, OpenAI wire for everything else) against api.commandcode.ai, live model list, plan gating, /cmd-usage. Requires the cmduse CLI for usage rendering.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|