@mars-sea/dsh-commandcode-provider 0.10.0-alpha.5 → 0.10.0-alpha.6
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 +15 -1
- package/lib/client.js +183 -227
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +249 -215
- package/lib/index.js +194 -119
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -7,194 +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
|
|
11
|
-
/**
|
|
12
|
-
* Models whose Capabilities include Vision, per the official Command Code
|
|
13
|
-
* model registry (`https://commandcode.ai/docs/reference/cli/models`, generated
|
|
14
|
-
* from the same registry as `cmd --list-models` / the `/model` picker).
|
|
15
|
-
*
|
|
16
|
-
* The Provider API does not expose modality metadata, so this snapshot is the
|
|
17
|
-
* source of truth for image-input gating. Command Code's own CLI falls back to
|
|
18
|
-
* a client-side VISION side-call for text-only models; this adapter does not
|
|
19
|
-
* reproduce that interactive feature, so images sent to a model outside this
|
|
20
|
-
* list are refused loudly (`UNSUPPORTED_CONTENT`) instead of being dropped or
|
|
21
|
-
* sent to a model that cannot read them.
|
|
22
|
-
*
|
|
23
|
-
* Keep in sync with the official registry when new models ship (see the
|
|
24
|
-
* dsh-commandcode-upstream skill).
|
|
25
|
-
*/
|
|
26
|
-
declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Models the official CLI's model table (command-code@1.40.1) marks
|
|
29
|
-
* `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
|
|
30
|
-
* think automatically, with Command Code driving the depth. This is the
|
|
31
|
-
* authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
|
|
32
|
-
* mirrors the CLI's effort map exactly) stays the sole source for selectable
|
|
33
|
-
* effort levels, and this snapshot is not surfaced in the picker's compact
|
|
34
|
-
* description — it exists for programmatic consumers.
|
|
35
|
-
*
|
|
36
|
-
* Source: the command-code@1.40.1 bundled model table (dist/cli.mjs),
|
|
37
|
-
* cross-checked with https://commandcode.ai/docs/reference/cli/models.
|
|
38
|
-
* (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
|
|
39
|
-
* selectable `['low', 'high', 'max']` efforts; the preview then ended in
|
|
40
|
-
* 1.34.0, removing the model from the catalog entirely. `tencent/hy4-preview`
|
|
41
|
-
* joined this set in command-code@1.37.0 — reasoning:!0, no efforts, 1M
|
|
42
|
-
* context, routed through OpenRouter — then gained selectable
|
|
43
|
-
* `['low', 'medium', 'high']` efforts in command-code@1.38.0 and moved to
|
|
44
|
-
* `KNOWN_EFFORTS`. `moonshotai/Kimi-K3` followed the same path in
|
|
45
|
-
* command-code@1.39.3 — it gained `['low', 'high', 'max']` efforts and moved
|
|
46
|
-
* to `KNOWN_EFFORTS`.)
|
|
47
|
-
* Keep in sync via the dsh-commandcode-upstream skill.
|
|
48
|
-
*/
|
|
49
|
-
declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
50
|
-
/**
|
|
51
|
-
* The minimum subscription plan a model is included in, per the official plan
|
|
52
|
-
* pages (`/docs/plans/go`, `/docs/plans/goat`, `/docs/plans/pro`, `/docs/plans/max`
|
|
53
|
-
* and `/docs/resources/pricing-limits`). Each plan's model list is a superset of
|
|
54
|
-
* the one below it: Go ⊂ GOAT ⊂ Pro ⊂ Provider/Max. Models absent from every
|
|
55
|
-
* plan list (Claude Opus/Fable, Fugu Ultra) are Provider-tier.
|
|
56
|
-
*
|
|
57
|
-
* The Provider API exposes no plan metadata, so this snapshot is the source of
|
|
58
|
-
* truth for the picker's plan annotation — it answers "which plan do I need to
|
|
59
|
-
* actually use this model?" at a glance. Plan labels use the official tier
|
|
60
|
-
* names (`Go`, `GOAT`, `Pro`, `Provider`), with `Max` implying Provider.
|
|
61
|
-
*
|
|
62
|
-
* Keep in sync with the official plan pages when they change (see the
|
|
63
|
-
* dsh-commandcode-upstream skill).
|
|
64
|
-
*/
|
|
65
|
-
declare const KNOWN_PLANS: Readonly<Record<string, string>>;
|
|
66
|
-
/** Official display labels for each plan tier. */
|
|
67
|
-
declare const PLAN_LABELS: Readonly<Record<string, string>>;
|
|
68
|
-
/**
|
|
69
|
-
* Plan-tier sort weights, low to high. Models outside the snapshot (unknown
|
|
70
|
-
* plans) sort after every known tier, keeping known models predictable.
|
|
71
|
-
*/
|
|
72
|
-
declare const PLAN_ORDER: Readonly<Record<string, number>>;
|
|
73
|
-
/**
|
|
74
|
-
* Comparator for the model picker: free models first (zero credit cost, usable
|
|
75
|
-
* by every account), then by plan tier (lowest first), then by model name,
|
|
76
|
-
* then by id as a tiebreak. Models with no known plan sort last.
|
|
77
|
-
*/
|
|
78
|
-
declare function compareByPlan(a: {
|
|
79
|
-
id: string;
|
|
80
|
-
name: string;
|
|
81
|
-
}, b: {
|
|
82
|
-
id: string;
|
|
83
|
-
name: string;
|
|
84
|
-
}): number;
|
|
85
|
-
/**
|
|
86
|
-
* Subscription plan table, synced from the official CLI bundle's plan maps
|
|
87
|
-
* (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs`, re-verified unchanged
|
|
88
|
-
* against 1.32.2 where they appear as `Zn`/`er`): subscription `planId`
|
|
89
|
-
* prefix → display name and the plan's monthly credit total. This is the
|
|
90
|
-
* account's own subscription (from `/alpha/billing/subscriptions`) — distinct
|
|
91
|
-
* from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.
|
|
92
|
-
*
|
|
93
|
-
* `tierWeight` is plugin-added (not from the CLI maps): the plan's rank on
|
|
94
|
-
* the {@link PLAN_ORDER} scale, used by the picker's plan filter
|
|
95
|
-
* ({@link modelVisibleInPlan}) to hide models above the account's tier.
|
|
96
|
-
*/
|
|
97
|
-
declare const KNOWN_SUBSCRIPTION_PLANS: Readonly<Record<string, {
|
|
98
|
-
name: string;
|
|
99
|
-
monthlyCredits: number;
|
|
100
|
-
tierWeight: number;
|
|
101
|
-
}>>;
|
|
102
|
-
/**
|
|
103
|
-
* Resolve a subscription `planId` (e.g. `individual-pro-v1`) to its display
|
|
104
|
-
* name and monthly credit total, mirroring the CLI's `getPlanInfo`:
|
|
105
|
-
* normalize (lowercase, `_` → `-`), then longest-prefix match so
|
|
106
|
-
* `individual-pro-v1` wins over `individual-pro`. Unknown ids return
|
|
107
|
-
* `undefined`.
|
|
108
|
-
*/
|
|
109
|
-
declare function subscriptionPlanInfo(planId: string): {
|
|
110
|
-
name: string;
|
|
111
|
-
monthlyCredits: number;
|
|
112
|
-
tierWeight: number;
|
|
113
|
-
} | undefined;
|
|
114
|
-
/**
|
|
115
|
-
* The billing facts the picker's plan filter needs, fetched by mirroring the
|
|
116
|
-
* CLI's `createBilling` flow (whoami → orgId, then `/alpha/billing/subscriptions`
|
|
117
|
-
* for the plan id and `/alpha/billing/credits` for the on-demand balances).
|
|
118
|
-
*/
|
|
119
|
-
interface CommandCodeBillingAccess {
|
|
120
|
-
/** Account plan tier weight on the {@link PLAN_ORDER} scale; undefined when the plan is unknown. */
|
|
121
|
-
tierWeight: number | undefined;
|
|
122
|
-
/**
|
|
123
|
-
* Purchased + free on-demand credit balance. The official access model
|
|
124
|
-
* (`evaluateModelAccess` in the CLI) allows every model when the account
|
|
125
|
-
* holds any on-demand credits — the plan gate only applies at zero balance.
|
|
126
|
-
*/
|
|
127
|
-
onDemandCredits: number;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Whether the picker lists `modelId` for an account with the given billing
|
|
131
|
-
* access. Fails open at every uncertainty: no billing data, an unknown plan,
|
|
132
|
-
* or a model outside {@link KNOWN_PLANS} all keep the model visible — the
|
|
133
|
-
* server remains the final gate (`403 MODEL_NOT_IN_PLAN`).
|
|
134
|
-
*/
|
|
135
|
-
declare function modelVisibleInPlan(modelId: string, access: CommandCodeBillingAccess | undefined): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Active pricing deals per the official pricing page
|
|
138
|
-
* (`/docs/resources/pricing-limits#deals`). Each entry records the model's
|
|
139
|
-
* promotional label and — critically — when it expires, so the picker never
|
|
140
|
-
* shows a stale discount after the plugin's snapshot has gone out of date.
|
|
141
|
-
*
|
|
142
|
-
* - `expiresAt` is an ISO timestamp. When it is in the past (checked at
|
|
143
|
-
* render time against `Date.now()`), the deal label is hidden until the
|
|
144
|
-
* snapshot is refreshed from the official page. `undefined` means
|
|
145
|
-
* "no expiry" (permanent).
|
|
146
|
-
* - `free` marks models whose requests cost no credits (Laguna S 2.1), shown
|
|
147
|
-
* as a `FREE` badge; it degrades to a plain discount once the deal lapses.
|
|
148
|
-
*
|
|
149
|
-
* Keep in sync with the official pricing page when deals change (see the
|
|
150
|
-
* dsh-commandcode-upstream skill).
|
|
151
|
-
*/
|
|
152
|
-
interface KnownDeal {
|
|
153
|
-
/** Promotional label, e.g. "50% off" or "2× usage". */
|
|
154
|
-
label: string;
|
|
155
|
-
/** Deal end date (ISO). `undefined` = permanent / no expiry. */
|
|
156
|
-
expiresAt?: string;
|
|
157
|
-
/** Model is free (requests cost no credits). */
|
|
158
|
-
free?: boolean;
|
|
159
|
-
}
|
|
160
|
-
declare const KNOWN_DEALS: Readonly<Record<string, KnownDeal>>;
|
|
161
|
-
/**
|
|
162
|
-
* Models with time-of-day (peak/off-peak) pricing, per the official pricing
|
|
163
|
-
* page (`/docs/resources/pricing-limits`). Since 2026-08-16 16:00 UTC, DeepSeek
|
|
164
|
-
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h/day,
|
|
165
|
-
* full price); the other 17 hours are off-peak at half price. The V4 Flash
|
|
166
|
-
* Vision (exp) variant (command-code@1.32.0) shares the V4 Flash windows and
|
|
167
|
-
* peak prices ($0.44/$1.32) — each row's hover annotation states exactly 2×
|
|
168
|
-
* that row's displayed off-peak prices. The picker shows the
|
|
169
|
-
* *current* state as a compact
|
|
170
|
-
* label (`Peak`/`Half`) matching the English noun style of the other markers
|
|
171
|
-
* (`Image`, `FREE`), so a developer can tell at a glance whether calling the
|
|
172
|
-
* model right now is cheap or expensive.
|
|
173
|
-
*
|
|
174
|
-
* Extraction caution: in the page's HTML each annotation div sits inside its
|
|
175
|
-
* OWN row's container, immediately before the NEXT row starts — flattening
|
|
176
|
-
* the page to text makes every annotation look like it belongs to the model
|
|
177
|
-
* printed after it. Verify membership against the enclosing row and the 2×
|
|
178
|
-
* price relation, not the flat-text neighbor.
|
|
179
|
-
*
|
|
180
|
-
* Keep in sync with the official pricing page when the model set or the peak
|
|
181
|
-
* windows change (see the dsh-commandcode-upstream skill).
|
|
182
|
-
*/
|
|
183
|
-
declare const KNOWN_PEAK_PRICING: ReadonlySet<string>;
|
|
184
|
-
/**
|
|
185
|
-
* Whether `now` (defaults to `Date.now()`) falls in a peak-pricing hour for
|
|
186
|
-
* time-of-day-priced models. `undefined` for models outside the snapshot.
|
|
187
|
-
*/
|
|
188
|
-
declare function peakPricingState(modelId: string, now?: number): 'peak' | 'off-peak' | undefined;
|
|
189
|
-
/**
|
|
190
|
-
* Compact label for the current peak/off-peak state: `Peak` (full price) or
|
|
191
|
-
* `Half` (off-peak, half price). These English nouns match the picker's other
|
|
192
|
-
* markers (`Go`, `Image`, `FREE`), and since they appear only on time-of-day
|
|
193
|
-
* priced models they double as a "priced by the hour" signal. Returns undefined
|
|
194
|
-
* for models without time-of-day pricing.
|
|
195
|
-
*/
|
|
196
|
-
declare function peakPricingLabel(modelId: string, now?: number): string | undefined;
|
|
197
|
-
declare const COMMAND_CODE_CLI_VERSION = "1.40.1";
|
|
10
|
+
declare const COMMAND_CODE_CLI_VERSION = "1.44.0";
|
|
198
11
|
declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
|
|
199
12
|
declare const DEFAULT_GENERATE_MAX_TOKENS = 64000;
|
|
200
13
|
declare const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
|
|
@@ -204,33 +17,6 @@ declare const BILLING_ACCESS_TTL_MS: number;
|
|
|
204
17
|
declare const DEFAULT_REQUEST_TIMEOUT_MS = 60000;
|
|
205
18
|
/** Stream idle timeout: a generation that stalls this long is a dead connection. */
|
|
206
19
|
declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 300000;
|
|
207
|
-
/**
|
|
208
|
-
* Official display label for a model's minimum plan, or undefined for models
|
|
209
|
-
* outside the snapshot (e.g. future catalog additions).
|
|
210
|
-
*/
|
|
211
|
-
declare function planLabel(modelId: string): string | undefined;
|
|
212
|
-
/**
|
|
213
|
-
* The active deal label for a model, or undefined when the model has no deal
|
|
214
|
-
* or the deal has expired. Expiry is judged against `now` (defaults to
|
|
215
|
-
* `Date.now()`), so a snapshot that has gone stale stops showing its discount
|
|
216
|
-
* the moment the official end date passes — the user never believes a lapsed
|
|
217
|
-
* deal is still live. Permanent deals (no `expiresAt`) never lapse.
|
|
218
|
-
*/
|
|
219
|
-
declare function dealLabel(modelId: string, now?: number): string | undefined;
|
|
220
|
-
/**
|
|
221
|
-
* Compact human-readable context window, e.g. `1_000_000 -> "1M"`,
|
|
222
|
-
* `256_000 -> "256K"`, `262_144 -> "256K"` (floor to the nearest K).
|
|
223
|
-
* Returns undefined for unknown/absent sizes.
|
|
224
|
-
*/
|
|
225
|
-
declare function formatContext(contextWindow: number | undefined): string | undefined;
|
|
226
|
-
/**
|
|
227
|
-
* Compact one-line summary for the model picker: plan tier, then any active
|
|
228
|
-
* deal (discount or FREE), then the current peak/off-peak state (`Peak`/`Half`)
|
|
229
|
-
* for time-of-day-priced models, then `Image` for Vision-capable models, then
|
|
230
|
-
* the context window. Text-only models simply omit the Image marker — "Text
|
|
231
|
-
* only" adds nothing the picker needs to show.
|
|
232
|
-
*/
|
|
233
|
-
declare function capabilityDescription(modelId: string, contextWindow?: number, now?: number): string;
|
|
234
20
|
declare function projectSlugFromPath(pathName: string): string;
|
|
235
21
|
/** Read a usable Command Code credential from the official CLI auth file. */
|
|
236
22
|
declare function resolveAuthFileApiKey(): string | undefined;
|
|
@@ -619,6 +405,254 @@ declare class CommandCodeAccountPool {
|
|
|
619
405
|
private pick;
|
|
620
406
|
}
|
|
621
407
|
//#endregion
|
|
408
|
+
//#region src/capabilities.d.ts
|
|
409
|
+
/**
|
|
410
|
+
* Static capability snapshot for the Command Code provider: model →
|
|
411
|
+
* reasoning-effort levels, vision/thinking flags, model → minimum plan tier,
|
|
412
|
+
* subscription-plan labels, deals, and hourly (peak/off-peak) pricing.
|
|
413
|
+
*
|
|
414
|
+
* Everything in this module is synced from official sources (the command-code
|
|
415
|
+
* CLI bundle's model table and the official plan/pricing/model docs — see the
|
|
416
|
+
* dsh-commandcode-upstream skill for the exact extraction procedures), and
|
|
417
|
+
* changes whenever an upstream CLI release reshuffles models/plans/prices.
|
|
418
|
+
* Keeping the snapshot in its own module confines those frequent sync diffs
|
|
419
|
+
* here: src/adapter.ts holds only the stable wire/runtime logic and imports
|
|
420
|
+
* these tables + read helpers.
|
|
421
|
+
*
|
|
422
|
+
* Snapshot read helpers (planLabel, dealLabel, formatContext,
|
|
423
|
+
* capabilityDescription, peakPricing*, compareByPlan, modelVisibleInPlan,
|
|
424
|
+
* subscriptionPlanInfo, isFreeModel) live here too — they exist only to read
|
|
425
|
+
* the tables, so a sync never has to touch src/adapter.ts.
|
|
426
|
+
*
|
|
427
|
+
* Ported from pi-commandcode-provider (MIT); originally part of src/adapter.ts
|
|
428
|
+
* and split out so upstream syncs stay reviewable.
|
|
429
|
+
*/
|
|
430
|
+
declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
|
|
431
|
+
/**
|
|
432
|
+
* Models whose Capabilities include Vision, per the official Command Code
|
|
433
|
+
* model registry (`https://commandcode.ai/docs/reference/cli/models`, generated
|
|
434
|
+
* from the same registry as `cmd --list-models` / the `/model` picker).
|
|
435
|
+
*
|
|
436
|
+
* The Provider API does not expose modality metadata, so this snapshot is the
|
|
437
|
+
* source of truth for image-input gating. Command Code's own CLI falls back to
|
|
438
|
+
* a client-side VISION side-call for text-only models; this adapter does not
|
|
439
|
+
* reproduce that interactive feature, so images sent to a model outside this
|
|
440
|
+
* list are refused loudly (`UNSUPPORTED_CONTENT`) instead of being dropped or
|
|
441
|
+
* sent to a model that cannot read them.
|
|
442
|
+
*
|
|
443
|
+
* Keep in sync with the official registry when new models ship (see the
|
|
444
|
+
* dsh-commandcode-upstream skill).
|
|
445
|
+
*/
|
|
446
|
+
declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
447
|
+
/**
|
|
448
|
+
* Models the official CLI's model table (command-code@1.44.0) marks
|
|
449
|
+
* `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
|
|
450
|
+
* think automatically, with Command Code driving the depth. This is the
|
|
451
|
+
* authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
|
|
452
|
+
* mirrors the CLI's effort map exactly) stays the sole source for selectable
|
|
453
|
+
* effort levels, and this snapshot is not surfaced in the picker's compact
|
|
454
|
+
* description — it exists for programmatic consumers.
|
|
455
|
+
*
|
|
456
|
+
* Source: the command-code@1.44.0 bundled model table (dist/cli.mjs),
|
|
457
|
+
* cross-checked with https://commandcode.ai/docs/reference/cli/models.
|
|
458
|
+
* (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
|
|
459
|
+
* selectable `['low', 'high', 'max']` efforts; the preview then ended in
|
|
460
|
+
* 1.34.0, removing the model from the catalog entirely. `tencent/hy4-preview`
|
|
461
|
+
* joined this set in command-code@1.37.0 — reasoning:!0, no efforts, 1M
|
|
462
|
+
* context, routed through OpenRouter — then gained selectable
|
|
463
|
+
* `['low', 'medium', 'high']` efforts in command-code@1.38.0 and moved to
|
|
464
|
+
* `KNOWN_EFFORTS`. `moonshotai/Kimi-K3` followed the same path in
|
|
465
|
+
* command-code@1.39.3 — it gained `['low', 'high', 'max']` efforts and moved
|
|
466
|
+
* to `KNOWN_EFFORTS`. command-code@1.42.0 added `meituan/LongCat-2.0:free`
|
|
467
|
+
* (reasoning:!0, no efforts) and command-code@1.44.0 added both
|
|
468
|
+
* `meta/muse-spark-1.3` variants — all think automatically with no
|
|
469
|
+
* selectable levels.)
|
|
470
|
+
* Keep in sync via the dsh-commandcode-upstream skill.
|
|
471
|
+
*/
|
|
472
|
+
declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
473
|
+
/**
|
|
474
|
+
* The minimum subscription plan a model is included in, per the official plan
|
|
475
|
+
* pages (`/docs/plans/go`, `/docs/plans/goat`, `/docs/plans/pro`, `/docs/plans/max`
|
|
476
|
+
* and `/docs/resources/pricing-limits`). Each plan's model list is a superset of
|
|
477
|
+
* the one below it: Go ⊂ GOAT ⊂ Pro ⊂ Provider/Max. Models absent from every
|
|
478
|
+
* plan list (Claude Opus/Fable, Fugu Ultra) are Provider-tier.
|
|
479
|
+
* `claude-fable-5-1` (Claude Fable 5.1, added in command-code@1.40.0) is
|
|
480
|
+
* Provider/Max-tier exactly like `claude-fable-5` — its availability matrix on
|
|
481
|
+
* the official plan/pricing pages grants individual-provider/max/ultra and
|
|
482
|
+
* teams-pro only, and the CLI's plan-access map blocks it on Go/GOAT/Pro.
|
|
483
|
+
* command-code@1.41.0 added `Qwen/Qwen3.8-Max-0902` (Go) and 1.42.0 added
|
|
484
|
+
* `meituan/LongCat-2.0:free` (Go, free promo); command-code@1.43.0 added
|
|
485
|
+
* `google/gemini-3.8-flash` (GOAT) and 1.44.0 added `meta/muse-spark-1.3`
|
|
486
|
+
* (GOAT) plus its Contributor sibling (Go).
|
|
487
|
+
*
|
|
488
|
+
* The Provider API exposes no plan metadata, so this snapshot is the source of
|
|
489
|
+
* truth for the picker's plan annotation — it answers "which plan do I need to
|
|
490
|
+
* actually use this model?" at a glance. Plan labels use the official tier
|
|
491
|
+
* names (`Go`, `GOAT`, `Pro`, `Provider`), with `Max` implying Provider.
|
|
492
|
+
*
|
|
493
|
+
* Keep in sync with the official plan pages when they change (see the
|
|
494
|
+
* dsh-commandcode-upstream skill).
|
|
495
|
+
*/
|
|
496
|
+
declare const KNOWN_PLANS: Readonly<Record<string, string>>;
|
|
497
|
+
/** Official display labels for each plan tier. */
|
|
498
|
+
declare const PLAN_LABELS: Readonly<Record<string, string>>;
|
|
499
|
+
/**
|
|
500
|
+
* Plan-tier sort weights, low to high. Models outside the snapshot (unknown
|
|
501
|
+
* plans) sort after every known tier, keeping known models predictable.
|
|
502
|
+
*/
|
|
503
|
+
declare const PLAN_ORDER: Readonly<Record<string, number>>;
|
|
504
|
+
/**
|
|
505
|
+
* Comparator for the model picker: free models first (zero credit cost, usable
|
|
506
|
+
* by every account), then by plan tier (lowest first), then by model name,
|
|
507
|
+
* then by id as a tiebreak. Models with no known plan sort last.
|
|
508
|
+
*/
|
|
509
|
+
declare function compareByPlan(a: {
|
|
510
|
+
id: string;
|
|
511
|
+
name: string;
|
|
512
|
+
}, b: {
|
|
513
|
+
id: string;
|
|
514
|
+
name: string;
|
|
515
|
+
}): number;
|
|
516
|
+
/**
|
|
517
|
+
* Subscription plan table, synced from the official CLI bundle's plan maps
|
|
518
|
+
* (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs`, re-verified unchanged
|
|
519
|
+
* against 1.32.2 where they appear as `Zn`/`er`): subscription `planId`
|
|
520
|
+
* prefix → display name and the plan's monthly credit total. This is the
|
|
521
|
+
* account's own subscription (from `/alpha/billing/subscriptions`) — distinct
|
|
522
|
+
* from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.
|
|
523
|
+
*
|
|
524
|
+
* `tierWeight` is plugin-added (not from the CLI maps): the plan's rank on
|
|
525
|
+
* the {@link PLAN_ORDER} scale, used by the picker's plan filter
|
|
526
|
+
* ({@link modelVisibleInPlan}) to hide models above the account's tier.
|
|
527
|
+
*/
|
|
528
|
+
declare const KNOWN_SUBSCRIPTION_PLANS: Readonly<Record<string, {
|
|
529
|
+
name: string;
|
|
530
|
+
monthlyCredits: number;
|
|
531
|
+
tierWeight: number;
|
|
532
|
+
}>>;
|
|
533
|
+
/**
|
|
534
|
+
* Resolve a subscription `planId` (e.g. `individual-pro-v1`) to its display
|
|
535
|
+
* name and monthly credit total, mirroring the CLI's `getPlanInfo`:
|
|
536
|
+
* normalize (lowercase, `_` → `-`), then longest-prefix match so
|
|
537
|
+
* `individual-pro-v1` wins over `individual-pro`. Unknown ids return
|
|
538
|
+
* `undefined`.
|
|
539
|
+
*/
|
|
540
|
+
declare function subscriptionPlanInfo(planId: string): {
|
|
541
|
+
name: string;
|
|
542
|
+
monthlyCredits: number;
|
|
543
|
+
tierWeight: number;
|
|
544
|
+
} | undefined;
|
|
545
|
+
/**
|
|
546
|
+
* The billing facts the picker's plan filter needs, fetched by mirroring the
|
|
547
|
+
* CLI's `createBilling` flow (whoami → orgId, then `/alpha/billing/subscriptions`
|
|
548
|
+
* for the plan id and `/alpha/billing/credits` for the on-demand balances).
|
|
549
|
+
*/
|
|
550
|
+
interface CommandCodeBillingAccess {
|
|
551
|
+
/** Account plan tier weight on the {@link PLAN_ORDER} scale; undefined when the plan is unknown. */
|
|
552
|
+
tierWeight: number | undefined;
|
|
553
|
+
/**
|
|
554
|
+
* Purchased + free on-demand credit balance. The official access model
|
|
555
|
+
* (`evaluateModelAccess` in the CLI) allows every model when the account
|
|
556
|
+
* holds any on-demand credits — the plan gate only applies at zero balance.
|
|
557
|
+
*/
|
|
558
|
+
onDemandCredits: number;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Whether the picker lists `modelId` for an account with the given billing
|
|
562
|
+
* access. Fails open at every uncertainty: no billing data, an unknown plan,
|
|
563
|
+
* or a model outside {@link KNOWN_PLANS} all keep the model visible — the
|
|
564
|
+
* server remains the final gate (`403 MODEL_NOT_IN_PLAN`).
|
|
565
|
+
*/
|
|
566
|
+
declare function modelVisibleInPlan(modelId: string, access: CommandCodeBillingAccess | undefined): boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Active pricing deals per the official pricing page
|
|
569
|
+
* (`/docs/resources/pricing-limits#deals`). Each entry records the model's
|
|
570
|
+
* promotional label and — critically — when it expires, so the picker never
|
|
571
|
+
* shows a stale discount after the plugin's snapshot has gone out of date.
|
|
572
|
+
*
|
|
573
|
+
* - `expiresAt` is an ISO timestamp. When it is in the past (checked at
|
|
574
|
+
* render time against `Date.now()`), the deal label is hidden until the
|
|
575
|
+
* snapshot is refreshed from the official page. `undefined` means
|
|
576
|
+
* "no expiry" (permanent).
|
|
577
|
+
* - `free` marks models whose requests cost no credits (Laguna S 2.1), shown
|
|
578
|
+
* as a `FREE` badge; it degrades to a plain discount once the deal lapses.
|
|
579
|
+
*
|
|
580
|
+
* Keep in sync with the official pricing page when deals change (see the
|
|
581
|
+
* dsh-commandcode-upstream skill).
|
|
582
|
+
*/
|
|
583
|
+
interface KnownDeal {
|
|
584
|
+
/** Promotional label, e.g. "50% off" or "2× usage". */
|
|
585
|
+
label: string;
|
|
586
|
+
/** Deal end date (ISO). `undefined` = permanent / no expiry. */
|
|
587
|
+
expiresAt?: string;
|
|
588
|
+
/** Model is free (requests cost no credits). */
|
|
589
|
+
free?: boolean;
|
|
590
|
+
}
|
|
591
|
+
declare const KNOWN_DEALS: Readonly<Record<string, KnownDeal>>;
|
|
592
|
+
/**
|
|
593
|
+
* Models with time-of-day (peak/off-peak) pricing, per the official pricing
|
|
594
|
+
* page (`/docs/resources/pricing-limits`). Since 2026-08-16 16:00 UTC, DeepSeek
|
|
595
|
+
* charges by the hour: peak hours are 01:00–04:00 and 06:00–10:00 UTC (7h/day,
|
|
596
|
+
* full price); the other 17 hours are off-peak at half price. The V4 Flash
|
|
597
|
+
* Vision (exp) variant (command-code@1.32.0) shares the V4 Flash windows and
|
|
598
|
+
* peak prices ($0.44/$1.32) — each row's hover annotation states exactly 2×
|
|
599
|
+
* that row's displayed off-peak prices. The picker shows the
|
|
600
|
+
* *current* state as a compact
|
|
601
|
+
* label (`Peak`/`Half`) matching the English noun style of the other markers
|
|
602
|
+
* (`Image`, `FREE`), so a developer can tell at a glance whether calling the
|
|
603
|
+
* model right now is cheap or expensive.
|
|
604
|
+
*
|
|
605
|
+
* Extraction caution: in the page's HTML each annotation div sits inside its
|
|
606
|
+
* OWN row's container, immediately before the NEXT row starts — flattening
|
|
607
|
+
* the page to text makes every annotation look like it belongs to the model
|
|
608
|
+
* printed after it. Verify membership against the enclosing row and the 2×
|
|
609
|
+
* price relation, not the flat-text neighbor.
|
|
610
|
+
*
|
|
611
|
+
* Keep in sync with the official pricing page when the model set or the peak
|
|
612
|
+
* windows change (see the dsh-commandcode-upstream skill).
|
|
613
|
+
*/
|
|
614
|
+
declare const KNOWN_PEAK_PRICING: ReadonlySet<string>;
|
|
615
|
+
/**
|
|
616
|
+
* Whether `now` (defaults to `Date.now()`) falls in a peak-pricing hour for
|
|
617
|
+
* time-of-day-priced models. `undefined` for models outside the snapshot.
|
|
618
|
+
*/
|
|
619
|
+
declare function peakPricingState(modelId: string, now?: number): 'peak' | 'off-peak' | undefined;
|
|
620
|
+
/**
|
|
621
|
+
* Compact label for the current peak/off-peak state: `Peak` (full price) or
|
|
622
|
+
* `Half` (off-peak, half price). These English nouns match the picker's other
|
|
623
|
+
* markers (`Go`, `Image`, `FREE`), and since they appear only on time-of-day
|
|
624
|
+
* priced models they double as a "priced by the hour" signal. Returns undefined
|
|
625
|
+
* for models without time-of-day pricing.
|
|
626
|
+
*/
|
|
627
|
+
declare function peakPricingLabel(modelId: string, now?: number): string | undefined;
|
|
628
|
+
/**
|
|
629
|
+
* Official display label for a model's minimum plan, or undefined for models
|
|
630
|
+
* outside the snapshot (e.g. future catalog additions).
|
|
631
|
+
*/
|
|
632
|
+
declare function planLabel(modelId: string): string | undefined;
|
|
633
|
+
/**
|
|
634
|
+
* The active deal label for a model, or undefined when the model has no deal
|
|
635
|
+
* or the deal has expired. Expiry is judged against `now` (defaults to
|
|
636
|
+
* `Date.now()`), so a snapshot that has gone stale stops showing its discount
|
|
637
|
+
* the moment the official end date passes — the user never believes a lapsed
|
|
638
|
+
* deal is still live. Permanent deals (no `expiresAt`) never lapse.
|
|
639
|
+
*/
|
|
640
|
+
declare function dealLabel(modelId: string, now?: number): string | undefined;
|
|
641
|
+
/**
|
|
642
|
+
* Compact human-readable context window, e.g. `1_000_000 -> "1M"`,
|
|
643
|
+
* `256_000 -> "256K"`, `262_144 -> "256K"` (floor to the nearest K).
|
|
644
|
+
* Returns undefined for unknown/absent sizes.
|
|
645
|
+
*/
|
|
646
|
+
declare function formatContext(contextWindow: number | undefined): string | undefined;
|
|
647
|
+
/**
|
|
648
|
+
* Compact one-line summary for the model picker: plan tier, then any active
|
|
649
|
+
* deal (discount or FREE), then the current peak/off-peak state (`Peak`/`Half`)
|
|
650
|
+
* for time-of-day-priced models, then `Image` for Vision-capable models, then
|
|
651
|
+
* the context window. Text-only models simply omit the Image marker — "Text
|
|
652
|
+
* only" adds nothing the picker needs to show.
|
|
653
|
+
*/
|
|
654
|
+
declare function capabilityDescription(modelId: string, contextWindow?: number, now?: number): string;
|
|
655
|
+
//#endregion
|
|
622
656
|
//#region src/usage-wire.d.ts
|
|
623
657
|
/** One account's usage entry in the multi-account report. */
|
|
624
658
|
interface CommandCodeAccountUsage {
|