@mars-sea/dsh-commandcode-provider 0.10.0-alpha.7 → 0.10.1

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
@@ -7,12 +7,14 @@ import { Context } from "@deepseek-ai/cordis";
7
7
  import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
8
8
  import { CommandDefinition } from "@deepseek-ai/dsh-commands";
9
9
  //#region src/adapter.d.ts
10
- declare const COMMAND_CODE_CLI_VERSION = "1.46.0";
10
+ declare const COMMAND_CODE_CLI_VERSION = "1.50.0";
11
11
  declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
12
12
  declare const DEFAULT_GENERATE_MAX_TOKENS = 64000;
13
13
  declare const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
14
14
  /** How long the picker's plan-filter billing facts stay cached before refetching. */
15
15
  declare const BILLING_ACCESS_TTL_MS: number;
16
+ /** Endpoint protocol selected for one generate call. */
17
+ type CommandCodeProtocol = 'cli' | 'openai';
16
18
  /** Head-of-request timeout: how long to wait for the first response byte. */
17
19
  declare const DEFAULT_REQUEST_TIMEOUT_MS = 60000;
18
20
  /** Stream idle timeout: a generation that stalls this long is a dead connection. */
@@ -43,6 +45,13 @@ interface CommandCodeConnectionOptions {
43
45
  * keep the full catalog visible. Set false to always list every model.
44
46
  */
45
47
  filterModelsByPlan?: boolean;
48
+ /**
49
+ * Optional protocol override. `'auto'` (default) uses billing/cache plus
50
+ * Provider API fallback; `'cli'` forces `/alpha/generate`; `'openai'` forces
51
+ * `/provider/v1/chat/completions`. This is a connection-level test/operator
52
+ * seam and is intentionally not part of the plugin's user settings schema.
53
+ */
54
+ protocol?: 'auto' | CommandCodeProtocol;
46
55
  }
47
56
  /**
48
57
  * Resolve the durable attachment service, or undefined when the host does not
@@ -154,6 +163,7 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
154
163
  private readonly resolveAttachments;
155
164
  private readonly billingAccess;
156
165
  private readonly billingAccessInflight;
166
+ private readonly protocolCache;
157
167
  constructor(deps: CommandCodeAdapterDeps<C>);
158
168
  /**
159
169
  * Display metadata for the picker's provider group header. The base class
@@ -203,6 +213,18 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
203
213
  * to `undefined` (fail-open) rather than breaking the picker.
204
214
  */
205
215
  private fetchBillingAccess;
216
+ /** Fresh cached billing tier weight for a key, or undefined when not known. */
217
+ private cachedBillingTierWeight;
218
+ /** Cached protocol decision for a key, or undefined when expired/unknown. */
219
+ private cachedProtocolUseCli;
220
+ private rememberProtocol;
221
+ /**
222
+ * Choose the initial protocol for one request. A fresh protocol cache entry
223
+ * wins; otherwise a cached (not network-fetched) billing tier of Go is
224
+ * treated as CLI-only. Unknown accounts default to Provider API and fall
225
+ * back only after an `upgrade_required` rejection.
226
+ */
227
+ private resolveProtocol;
206
228
  /**
207
229
  * Fetch account, usage, credit, and subscription state from the Command
208
230
  * Code account endpoints (`/alpha/whoami`, `/alpha/usage/summary`,
@@ -445,7 +467,7 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
445
467
  */
446
468
  declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
447
469
  /**
448
- * Models the official CLI's model table (command-code@1.46.0) marks
470
+ * Models the official CLI's model table (command-code@1.50.0) marks
449
471
  * `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
450
472
  * think automatically, with Command Code driving the depth. This is the
451
473
  * authoritative "thinks, effort not adjustable" set: `KNOWN_EFFORTS` (which
@@ -453,7 +475,7 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
453
475
  * effort levels, and this snapshot is not surfaced in the picker's compact
454
476
  * description — it exists for programmatic consumers.
455
477
  *
456
- * Source: the command-code@1.46.0 bundled model table (dist/cli.mjs),
478
+ * Source: the command-code@1.50.0 bundled model table (dist/cli.mjs),
457
479
  * cross-checked with https://commandcode.ai/docs/reference/cli/models.
458
480
  * (`stealth/ox-alpha` left this set in command-code@1.32.1, which gave it
459
481
  * selectable `['low', 'high', 'max']` efforts; the preview then ended in
@@ -515,8 +537,8 @@ declare function compareByPlan(a: {
515
537
  }): number;
516
538
  /**
517
539
  * 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`
540
+ * (located by the `"individual-go"` key in command-code@1.50.0 `dist/cli.mjs`,
541
+ * re-verified unchanged through 1.50.0): subscription `planId`
520
542
  * prefix → display name and the plan's monthly credit total. This is the
521
543
  * account's own subscription (from `/alpha/billing/subscriptions`) — distinct
522
544
  * from {@link KNOWN_PLANS}, which maps catalog models to their minimum tier.