@mars-sea/dsh-commandcode-provider 0.6.0 → 0.6.2

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/lib/index.d.ts CHANGED
@@ -24,7 +24,7 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
24
24
  */
25
25
  declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
26
26
  /**
27
- * Models the official CLI's model table (`ZA` in command-code@1.28.4) marks
27
+ * Models the official CLI's model table (`ZA` in command-code@1.31.0) marks
28
28
  * `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
29
29
  * think automatically, with Command Code driving the depth. This is the
30
30
  * authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
@@ -32,7 +32,7 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
32
32
  * effort levels, and this snapshot is not surfaced in the picker's compact
33
33
  * description — it exists for programmatic consumers.
34
34
  *
35
- * Source: the command-code@1.28.4 bundled model table (dist/cli.mjs, the `ZA`
35
+ * Source: the command-code@1.31.0 bundled model table (dist/cli.mjs, the `ZA`
36
36
  * object), cross-checked with https://commandcode.ai/docs/reference/cli/models.
37
37
  * Keep in sync via the dsh-commandcode-upstream skill.
38
38
  */
@@ -61,8 +61,9 @@ declare const PLAN_LABELS: Readonly<Record<string, string>>;
61
61
  */
62
62
  declare const PLAN_ORDER: Readonly<Record<string, number>>;
63
63
  /**
64
- * Comparator for the model picker: sort by plan tier (lowest first), then by
65
- * model name, then by id as a tiebreak. Models with no known plan sort last.
64
+ * Comparator for the model picker: free models first (zero credit cost, usable
65
+ * by every account), then by plan tier (lowest first), then by model name,
66
+ * then by id as a tiebreak. Models with no known plan sort last.
66
67
  */
67
68
  declare function compareByPlan(a: {
68
69
  id: string;
@@ -73,7 +74,7 @@ declare function compareByPlan(a: {
73
74
  }): number;
74
75
  /**
75
76
  * Subscription plan table, synced from the official CLI bundle's plan maps
76
- * (`Nn`/`$n` in command-code@1.28.4 `dist/cli.mjs`): subscription `planId`
77
+ * (`Nn`/`$n` in command-code@1.31.0 `dist/cli.mjs`): subscription `planId`
77
78
  * prefix → display name and the plan's monthly credit total. This is the
78
79
  * account's own subscription (from `/alpha/billing/subscriptions`) — distinct
79
80
  * from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.
@@ -172,7 +173,7 @@ declare function peakPricingState(modelId: string, now?: number): 'peak' | 'off-
172
173
  * for models without time-of-day pricing.
173
174
  */
174
175
  declare function peakPricingLabel(modelId: string, now?: number): string | undefined;
175
- declare const COMMAND_CODE_CLI_VERSION = "1.28.4";
176
+ declare const COMMAND_CODE_CLI_VERSION = "1.31.0";
176
177
  declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
177
178
  declare const DEFAULT_GENERATE_MAX_TOKENS = 64000;
178
179
  declare const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
@@ -313,6 +314,12 @@ interface CommandCodePlan {
313
314
  /** Billing period end in millis; 0 when the endpoint did not report one. */
314
315
  currentPeriodEnd: number;
315
316
  }
317
+ /**
318
+ * Why every account endpoint failed at once (the report then carries no data
319
+ * at all, so the degraded per-endpoint view would hide the root cause behind
320
+ * a generic "partial data" note). Undefined for partial failures.
321
+ */
322
+ type UsageBlockReason = 'invalid-key' | 'service-unavailable' | 'network';
316
323
  /** Everything the usage endpoints report, fetched together. */
317
324
  interface CommandCodeUsageReport {
318
325
  account?: CommandCodeAccount;
@@ -321,6 +328,13 @@ interface CommandCodeUsageReport {
321
328
  plan?: CommandCodePlan;
322
329
  /** Endpoint failures degrade the report instead of failing it. */
323
330
  failures: string[];
331
+ /**
332
+ * The single reason every endpoint failed, when they all did: `invalid-key`
333
+ * (every call rejected with 401 — the stored key is wrong or expired),
334
+ * `service-unavailable` (every call answered 5xx), or `network` (no HTTP
335
+ * response at all). Undefined when any endpoint succeeded.
336
+ */
337
+ blocked?: UsageBlockReason;
324
338
  }
325
339
  declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = CommandCodeConnectionOptions> extends LlmAdapter {
326
340
  private readonly deps;
@@ -331,12 +345,21 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
331
345
  private readonly billingAccessInflight;
332
346
  constructor(deps: CommandCodeAdapterDeps<C>);
333
347
  /**
334
- * Command Code is a metered subscription API: 429 (rate limit) and 5xx
335
- * (transient server errors) are worth retrying at the agent-step boundary,
336
- * which is where dsh-llm-retry executes the policy returned here. The
337
- * default policy already retries `RATE_LIMIT` and `SERVER`; declaring it
338
- * explicitly documents the intent and gives the plugin entry a stable hook
339
- * to override (e.g. a stricter cap for a metered plan).
348
+ * Near-unbounded retry for transient failures only (`mode: 'normal'` with
349
+ * an explicit 1000-attempt cap opencode-style persistence without the
350
+ * unbounded loop): `RATE_LIMIT`/`SERVER`/`TIMEOUT`/`TRANSPORT`/
351
+ * `EMPTY_RESPONSE` retry up to 1000 times with waits doubling from 500 ms
352
+ * and capping at 15 minutes (±10% jitter), so an exhausted 5-hour window
353
+ * recovers in-session instead of failing after two tries. Permanent
354
+ * failures (an invalid key's `INVALID_CREDENTIAL`, `UNSUPPORTED_CONTENT`,
355
+ * plan rejections) are absent from the whitelist and surface immediately
356
+ * instead of looping. Waits the pool/adapter attach as
357
+ * `providerRetryAfterMs` are honored verbatim at or below the 15-minute
358
+ * cap and never attached above it (in normal mode a longer attached wait
359
+ * makes the executor abandon the retry outright — see RETRY_MAX_DELAY_MS).
360
+ *
361
+ * Captured once at route registration (dsh-llm snapshots this value), so a
362
+ * future config knob for it would apply on profile restart, not per request.
340
363
  */
341
364
  providerRetryPolicy(_provider: string): ResolvedRetryPolicy;
342
365
  /** Refresh the catalog (live fetch, cache fallback) and return it. */