@mars-sea/dsh-commandcode-provider 0.11.7 → 0.11.9

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,7 +7,7 @@ import { Context } from "@deepseek-ai/cordis";
7
7
  import { AttachmentStore, ImageAttachmentRef } 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.58.0";
10
+ declare const COMMAND_CODE_CLI_VERSION = "1.62.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;
@@ -340,6 +340,11 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
340
340
  * failure accounting: the billing probe fails open silently, the usage
341
341
  * report books failures per endpoint. Non-2xx and non-record bodies come
342
342
  * back without a record; only a transport throw propagates to the caller.
343
+ *
344
+ * `timeoutMs` is the caller's budget for this one request. The default is the
345
+ * CATALOG probe's short cap, which fits the picker's fail-open reads; the
346
+ * usage report deliberately passes the connection's own request budget so an
347
+ * account query is not held to a stricter (and invisible) limit than chat.
343
348
  */
344
349
  private fetchEndpointJson;
345
350
  /**
@@ -411,6 +416,20 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
411
416
  * view. Requires a usable API key (throws `MISSING_CREDENTIAL` otherwise).
412
417
  * Pass `apiKey` to report on a specific account of a multi-account pool;
413
418
  * the default resolves the currently active account.
419
+ *
420
+ * Two failure modes are NOT "the network is down", and the report must say
421
+ * so rather than let {@link classifyTotalFailure} blame the connection:
422
+ *
423
+ * - A key that no HTTP header can carry (a stray newline from a paste, a
424
+ * full-width character) makes `fetch` throw a `TypeError` **before any
425
+ * I/O**, for every endpoint at once. The chat path refuses such a key
426
+ * through `assertUsableApiKey`; this path must too, and it answers
427
+ * `blocked: 'invalid-key'` instead of four phantom transport failures.
428
+ * - The four endpoints get the SAME per-request budget as a chat call
429
+ * (`connection.requestTimeoutMs`, default 60 s), not the catalog's 10 s
430
+ * probe budget: on a slow link a 10 s cap made every account query time
431
+ * out while chat kept working, which is exactly a "check your network"
432
+ * banner that never clears.
414
433
  */
415
434
  getUsage(apiKey?: string): Promise<CommandCodeUsageReport>;
416
435
  /**
@@ -809,7 +828,11 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
809
828
  * free `inclusionai/ling-3.0-flash-sante:free` (Go); command-code@1.53.0
810
829
  * added `deepseek/deepseek-v4.1-flash` (Go); command-code@1.56.0 added
811
830
  * `Qwen/Qwen3.8-Omni-Flash` (Go); command-code@1.57.0 added
812
- * `z-ai/glm-5.3-flashx` (Go).
831
+ * `z-ai/glm-5.3-flashx` (Go); command-code@1.59.0 added `xai/grok-4.7` (GOAT)
832
+ * and 1.60.0 added `stepfun/Step-5-Preview` (Go); command-code@1.62.0 added the
833
+ * MiMo V2.6 family — `xiaomi/mimo-v2.6-flash` + `xiaomi/mimo-v2.6-pro` (Go) and
834
+ * `xiaomi/mimo-v2.6-pro-ultraspeed` (GOAT) — so the 1.58.0 -> 1.62.0 window's
835
+ * only tier changes are additions and the superset chain still holds.
813
836
  *
814
837
  * The Provider API exposes no plan metadata, so this snapshot is the source of
815
838
  * truth for the picker's plan annotation — it answers "which plan do I need to
@@ -1368,7 +1391,10 @@ declare function validateCommandApiKey(fetchImpl: typeof fetch, apiBase: string,
1368
1391
  /**
1369
1392
  * One browser-login attempt machine. Single-flight by design: `begin()` while
1370
1393
  * waiting returns the live attempt's status instead of starting a second one;
1371
- * a terminal state makes the next `begin()` start fresh.
1394
+ * a start that is still binding its port is REJOINED through
1395
+ * {@link CommandCodeLoginFlow.begin}'s in-flight promise, because the status
1396
+ * face cannot say `waiting` until that bind settles; a terminal state makes the
1397
+ * next `begin()` start fresh.
1372
1398
  */
1373
1399
  declare class CommandCodeLoginFlow {
1374
1400
  private readonly deps;
@@ -1386,6 +1412,17 @@ declare class CommandCodeLoginFlow {
1386
1412
  * the user cancelled and flipping the page back to success.
1387
1413
  */
1388
1414
  private attemptSeq;
1415
+ /**
1416
+ * The start currently binding a port, if any. Every `begin()` that arrives
1417
+ * before it settles joins it: two independent starts would each bind their
1418
+ * own loopback server, and only the LAST one is reachable by
1419
+ * {@link CommandCodeLoginFlow.teardown} — the orphan keeps listening and
1420
+ * answering `/callback` for the process's lifetime, and ten of them exhaust
1421
+ * the port window so browser login dies until the Host restarts.
1422
+ */
1423
+ private starting;
1424
+ /** A `cancel()` that arrived while a start was still binding (see {@link CommandCodeLoginFlow.cancel}). */
1425
+ private cancelPending;
1389
1426
  private disposed;
1390
1427
  constructor(deps: CommandCodeLoginFlowDeps);
1391
1428
  /** Subscribe to state transitions. @returns the disposer. */
@@ -1398,7 +1435,18 @@ declare class CommandCodeLoginFlow {
1398
1435
  * Rejects only when the flow cannot start at all (no free port, disposed).
1399
1436
  */
1400
1437
  begin(): Promise<CommandCodeLoginStatus>;
1401
- /** Cancel a waiting attempt; terminal states are untouched. */
1438
+ /**
1439
+ * The binding half of {@link CommandCodeLoginFlow.begin}: one attempt, one
1440
+ * server, one published `waiting` status. Callers reach it only through
1441
+ * `begin()`'s single-flight fence.
1442
+ */
1443
+ private startAttempt;
1444
+ /**
1445
+ * Cancel a waiting attempt; terminal states are untouched. A start that is
1446
+ * still binding a port is flagged instead of ignored — it cannot be torn
1447
+ * down from here (its server does not exist yet), so `startAttempt` observes
1448
+ * the flag once the bind settles and retires it.
1449
+ */
1402
1450
  cancel(): void;
1403
1451
  /** Stop everything; a waiting attempt ends cancelled. Idempotent. */
1404
1452
  dispose(): void;
@@ -1474,10 +1522,20 @@ declare function selectCommandCodeSearchProvider(web: WebRuntime, enable: boolea
1474
1522
  * configured, leave auto-select" and must round-trip untouched: writing the
1475
1523
  * factory default instead would still override a sibling plugin's own
1476
1524
  * constructor-time pin.
1525
+ *
1526
+ * `preexisting` is the one fact `displaced` cannot carry: an `undefined`
1527
+ * `displaced` means EITHER "the field was unset when we took over" (give
1528
+ * `undefined` back on disable) OR "the field already read `commandcode`"
1529
+ * (touch nothing on disable — see {@link applyCommandCodeSearchSelection}).
1530
+ * Collapsing the two is what turned a user's own `searchProvider: commandcode`
1531
+ * pin into an auto-select — and then into `WEB_PROVIDER_AMBIGUOUS` on every
1532
+ * search — the moment this plugin was disabled or unloaded.
1477
1533
  */
1478
1534
  interface CommandCodeSearchSelection {
1479
1535
  owner: boolean;
1480
1536
  displaced: string | undefined;
1537
+ /** Whether the field already read `commandcode` when this plugin first took it over. */
1538
+ preexisting: boolean;
1481
1539
  }
1482
1540
  /** Fresh selection state: the plugin starts out not owning the selection. */
1483
1541
  declare function commandCodeSearchSelection(): CommandCodeSearchSelection;
@@ -1496,8 +1554,14 @@ declare function commandCodeSearchSelection(): CommandCodeSearchSelection;
1496
1554
  * auto-select — already says what the user wants.
1497
1555
  * - When the field already reads `commandcode` at first touch (e.g. a
1498
1556
  * surviving runtime the plugin did not set, or a manual
1499
- * `searchProvider: commandcode` pin), `displaced` stays undefined so the
1500
- * later disable is a no-op rather than a guess at the factory default.
1557
+ * `searchProvider: commandcode` pin), `displaced` stays undefined and
1558
+ * `preexisting` is set, so the later disable is a no-op rather than a guess
1559
+ * at the factory default. A "no-op" means the field is left ALONE: writing
1560
+ * that `undefined` back would destroy the user's own pin, and dsh-web reads
1561
+ * a cleared `searchProviderId` as auto-select — where a second usable
1562
+ * provider (the shipped `deepseek-official` is usable whenever a DeepSeek
1563
+ * key resolves) makes EVERY later search throw
1564
+ * `WEB_PROVIDER_AMBIGUOUS`.
1501
1565
  *
1502
1566
  * Never throws: like the low-level rewrite, a hardened runtime shape degrades
1503
1567
  * to registered-but-unselected.
@@ -1821,7 +1885,35 @@ interface Config {
1821
1885
  */
1822
1886
  lang?: string;
1823
1887
  }
1888
+ /**
1889
+ * The 0.1.7-generation schema: every field volatile except the
1890
+ * composition-only `apiKey` secret.
1891
+ *
1892
+ * dsh 0.1.7's settings forms are projected from the schema's `meta.volatile`
1893
+ * nodes, so an unmarked field would be invisible to AND unwritable from the
1894
+ * settings page and refused by form-edit path validation — and on that
1895
+ * generation the loader hands `apply()` a live reference per marked field,
1896
+ * committing later writes without remounting this fiber (the
1897
+ * `loader/volatile-update` listener at the bottom of `apply` covers the facts
1898
+ * that are not re-derived per read). The mark is inert on engines whose
1899
+ * schemastery predates `.volatile()`.
1900
+ */
1824
1901
  declare const Config: z<Config>;
1902
+ /**
1903
+ * The ≤0.1.6-generation registration schema: the same fields, NO volatile
1904
+ * marks.
1905
+ *
1906
+ * The legacy `installSection(owner, ns, schema, entry, hooks)` re-validates the
1907
+ * `entry` it is handed (`register()` → `resolve()` → `schema(mergeLayers(base,
1908
+ * section))`) and its `describe()` structuredClones that same `entry`. Since
1909
+ * schemastery ≥3.18.3 creates references at parse time on EVERY generation —
1910
+ * `dsh-settings` through 0.1.6 declares `schemastery: ^3.18.2`, so old engines
1911
+ * freshly installed today resolve 3.18.3 — a marked schema plus the raw
1912
+ * reference-carrying `config` is a boot-time `ValidationError` there. This
1913
+ * schema is therefore unmarked, and `apply` pairs it with
1914
+ * `unwrapVolatileConfig(config)`.
1915
+ */
1916
+ declare const LegacySettingsSchema: z<Config>;
1825
1917
  /** One resolution's complete request facts: connection plus credential reference. */
1826
1918
  interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
1827
1919
  apiKeyEnv: CredentialRef;
@@ -1835,5 +1927,5 @@ interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
1835
1927
  declare function resolveAdapterOptions(config: Config): ResolvedCommandCodeOptions;
1836
1928
  declare function apply(ctx: Context, config: Config): void;
1837
1929
  //#endregion
1838
- export { ACTIVE_ACCOUNT_AUTO, type ApiKeyValidation, BILLING_ACCESS_TTL_MS, COMMANDCODE_SEARCH_PROVIDER_ID, COMMAND_CODE_CLI_VERSION, type CommandCodeAccountConfig, CommandCodeAccountPool, type CommandCodeAccountSlot, type CommandCodeAccountState, type CommandCodeAccountUsage, type CommandCodeAccountsReport, CommandCodeAdapter, type CommandCodeAdapterDeps, type CommandCodeBillingAccess, type CommandCodeCommandDeps, type CommandCodeConnectionOptions, type CommandCodeLoginCredentials, type CommandCodeLoginFailureReason, CommandCodeLoginFlow, type CommandCodeLoginFlowDeps, type CommandCodeLoginStatus, type CommandCodeModelAccountRule, CommandCodeSearchProvider, type CommandCodeSearchProviderDeps, type CommandCodeSearchSelection, type CommandCodeTuiSettingsDeps, type CommandCodeUsageDeps, type CommandCodeUsageReport, CommandCodeUsageService, Config, DEFAULT_API_BASE, DEFAULT_GENERATE_MAX_TOKENS, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_MODELS_CACHE_PATH, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_WEB_SEARCH_PROVIDER_ID, KNOWN_DEALS, KNOWN_EFFORTS, KNOWN_IMAGE_MODELS, KNOWN_PEAK_PRICING, KNOWN_PLANS, KNOWN_SUBSCRIPTION_PLANS, KNOWN_THINKING_MODELS, LANG_AUTO, LOGIN_ALLOWED_ORIGINS, LOGIN_BEGIN_ENDPOINT, LOGIN_BODY_LIMIT_BYTES, LOGIN_CANCEL_ENDPOINT, LOGIN_MAX_PORT_ATTEMPTS, LOGIN_START_PORT, LOGIN_STATUS_ENDPOINT, LOGIN_TIMEOUT_MS, type LoginFlowFacade, PLAN_LABELS, PLAN_ORDER, PROVIDER, type ResolveAttachments, ResolvedCommandCodeOptions, type TuiSettingsField, type TuiSettingsFieldOption, type TuiSettingsFieldWrite, type TuiSettingsGroup, type TuiSettingsSection, type TuiSettingsSectionsService, USAGE_REPORT_ENDPOINT, accountUsable, apply, applyCommandCodeSearchSelection, applyCommandCodeTuiSettings, applyCommands, applyUsageRemote, buildCommandAuthUrl, buildCommandCodeTuiSection, capabilityDescription, commandCodeSearchSelection, commandDefinition, compareByPlan, dealLabel, formatContext, inject, loginStatusSchema, matchModelRule, modelVisibleInPlan, name, parseLoginStatus, peakPricingLabel, peakPricingState, planLabel, projectSlugFromPath, resolveAdapterOptions, resolveAuthFileApiKey, selectAccountForModel, selectActiveAccount, selectCommandCodeSearchProvider, studioBaseForApiBase, subscriptionPlanInfo, usageReportSchema, validateCommandApiKey };
1930
+ export { ACTIVE_ACCOUNT_AUTO, type ApiKeyValidation, BILLING_ACCESS_TTL_MS, COMMANDCODE_SEARCH_PROVIDER_ID, COMMAND_CODE_CLI_VERSION, type CommandCodeAccountConfig, CommandCodeAccountPool, type CommandCodeAccountSlot, type CommandCodeAccountState, type CommandCodeAccountUsage, type CommandCodeAccountsReport, CommandCodeAdapter, type CommandCodeAdapterDeps, type CommandCodeBillingAccess, type CommandCodeCommandDeps, type CommandCodeConnectionOptions, type CommandCodeLoginCredentials, type CommandCodeLoginFailureReason, CommandCodeLoginFlow, type CommandCodeLoginFlowDeps, type CommandCodeLoginStatus, type CommandCodeModelAccountRule, CommandCodeSearchProvider, type CommandCodeSearchProviderDeps, type CommandCodeSearchSelection, type CommandCodeTuiSettingsDeps, type CommandCodeUsageDeps, type CommandCodeUsageReport, CommandCodeUsageService, Config, DEFAULT_API_BASE, DEFAULT_GENERATE_MAX_TOKENS, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_MODELS_CACHE_PATH, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_WEB_SEARCH_PROVIDER_ID, KNOWN_DEALS, KNOWN_EFFORTS, KNOWN_IMAGE_MODELS, KNOWN_PEAK_PRICING, KNOWN_PLANS, KNOWN_SUBSCRIPTION_PLANS, KNOWN_THINKING_MODELS, LANG_AUTO, LOGIN_ALLOWED_ORIGINS, LOGIN_BEGIN_ENDPOINT, LOGIN_BODY_LIMIT_BYTES, LOGIN_CANCEL_ENDPOINT, LOGIN_MAX_PORT_ATTEMPTS, LOGIN_START_PORT, LOGIN_STATUS_ENDPOINT, LOGIN_TIMEOUT_MS, LegacySettingsSchema, type LoginFlowFacade, PLAN_LABELS, PLAN_ORDER, PROVIDER, type ResolveAttachments, ResolvedCommandCodeOptions, type TuiSettingsField, type TuiSettingsFieldOption, type TuiSettingsFieldWrite, type TuiSettingsGroup, type TuiSettingsSection, type TuiSettingsSectionsService, USAGE_REPORT_ENDPOINT, accountUsable, apply, applyCommandCodeSearchSelection, applyCommandCodeTuiSettings, applyCommands, applyUsageRemote, buildCommandAuthUrl, buildCommandCodeTuiSection, capabilityDescription, commandCodeSearchSelection, commandDefinition, compareByPlan, dealLabel, formatContext, inject, loginStatusSchema, matchModelRule, modelVisibleInPlan, name, parseLoginStatus, peakPricingLabel, peakPricingState, planLabel, projectSlugFromPath, resolveAdapterOptions, resolveAuthFileApiKey, selectAccountForModel, selectActiveAccount, selectCommandCodeSearchProvider, studioBaseForApiBase, subscriptionPlanInfo, usageReportSchema, validateCommandApiKey };
1839
1931
  //# sourceMappingURL=index.d.ts.map