@mars-sea/dsh-commandcode-provider 0.11.11 → 0.11.12
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 +8 -0
- package/README.md +19 -16
- package/README.zh-CN.md +13 -16
- package/lib/client.js +62 -123
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +39 -75
- package/lib/index.js +198 -324
- package/lib/index.js.map +1 -1
- package/package.json +40 -48
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import { GenerateOptions, LlmAdapter, LlmImageRequestPricing, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo,
|
|
2
|
+
import { GenerateOptions, LlmAdapter, LlmImageRequestPricing, LlmModelInfo, LlmProviderInfo, LlmResolvedModelInfo, ResolvedRetryPolicy, StreamChunk, projectOffloadedImages, requiredImageOffload } from "@deepseek-ai/dsh-llm";
|
|
3
3
|
import { CredentialRef } from "@deepseek-ai/dsh-credentials";
|
|
4
4
|
import { TypertRemoteService, TypertSchema } from "@deepseek-ai/dsh-typert-protocol";
|
|
5
5
|
import { WebRuntime, WebSearchProvider, WebSearchRequest, WebSearchResult } from "@deepseek-ai/dsh-web";
|
|
6
6
|
import { Context } from "@deepseek-ai/cordis";
|
|
7
|
-
import { AttachmentStore
|
|
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.
|
|
10
|
+
declare const COMMAND_CODE_CLI_VERSION = "1.65.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;
|
|
@@ -22,26 +22,20 @@ declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 300000;
|
|
|
22
22
|
declare function projectSlugFromPath(pathName: string): string;
|
|
23
23
|
/** Read a usable Command Code credential from the official CLI auth file. */
|
|
24
24
|
declare function resolveAuthFileApiKey(): string | undefined;
|
|
25
|
-
/** One occurrence's exact request-version byte length, as the core counter wants it. */
|
|
26
|
-
type ImageVersionBytes = (block: {
|
|
27
|
-
attachment: ImageAttachmentRef;
|
|
28
|
-
}) => number;
|
|
29
25
|
/**
|
|
30
|
-
* The
|
|
26
|
+
* The engine's durable-offload contract, as one object.
|
|
31
27
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
28
|
+
* Both members are required together: a half-populated policy would either lose
|
|
29
|
+
* the surface's marks (re-sending evicted images as pixels) or lose the count
|
|
30
|
+
* (silently sending an over-budget body), and neither is worth a partial
|
|
31
|
+
* opt-in. The defaults are the engine's own helpers; the object exists so tests
|
|
32
|
+
* can substitute a counting stub.
|
|
37
33
|
*/
|
|
38
|
-
interface
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
/** ≥0.1.6: how many more leading retained occurrences must be offloaded. */
|
|
44
|
-
requiredImageOffload?: (messages: readonly Message[], budget: Record<string, unknown>, versionBytes: ImageVersionBytes) => number;
|
|
34
|
+
interface SurfaceImagePolicy {
|
|
35
|
+
/** Render the surface's durable offload marks as placeholder text. */
|
|
36
|
+
projectOffloadedImages: typeof projectOffloadedImages;
|
|
37
|
+
/** How many more leading retained occurrences must be offloaded. */
|
|
38
|
+
requiredImageOffload: typeof requiredImageOffload;
|
|
45
39
|
}
|
|
46
40
|
/** Connection facts resolved fresh per request by the plugin entry. */
|
|
47
41
|
interface CommandCodeConnectionOptions {
|
|
@@ -175,12 +169,11 @@ interface CommandCodeAdapterDeps<C extends CommandCodeConnectionOptions = Comman
|
|
|
175
169
|
/** Resolve the optional durable attachment service for image input (tests); defaults to none. */
|
|
176
170
|
resolveAttachments?: ResolveAttachments;
|
|
177
171
|
/**
|
|
178
|
-
* Request-image policy override (tests); defaults to the
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* still compiles against the 0.1.2 peers.
|
|
172
|
+
* Request-image policy override (tests); defaults to the engine's own
|
|
173
|
+
* `projectOffloadedImages`/`requiredImageOffload`. Injecting a stub is how a
|
|
174
|
+
* test observes the budget rungs a 413 walks.
|
|
182
175
|
*/
|
|
183
|
-
imageOffload?:
|
|
176
|
+
imageOffload?: SurfaceImagePolicy;
|
|
184
177
|
}
|
|
185
178
|
/** Account identity from `/alpha/whoami`. */
|
|
186
179
|
interface CommandCodeAccount {
|
|
@@ -282,13 +275,9 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
|
|
|
282
275
|
private catalog;
|
|
283
276
|
private readonly fetchImpl;
|
|
284
277
|
private readonly resolveAttachments;
|
|
285
|
-
/** The engine's request-image policy, resolved once (tests may inject one). */
|
|
286
|
-
private readonly imagePolicy;
|
|
287
278
|
/**
|
|
288
|
-
* The
|
|
289
|
-
*
|
|
290
|
-
* speaks cannot change while it runs, and resolving here keeps every request
|
|
291
|
-
* on the same branch (see {@link surfaceImagePolicy}).
|
|
279
|
+
* The durable-offload contract, resolved once (tests may inject a stub). The
|
|
280
|
+
* contract cannot change while the process runs.
|
|
292
281
|
*/
|
|
293
282
|
private readonly surfaceOffload;
|
|
294
283
|
private readonly billingAccess;
|
|
@@ -790,7 +779,7 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
|
|
|
790
779
|
declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
791
780
|
/**
|
|
792
781
|
* Models WITHOUT a zero-data-retention upstream, per the official CLI's own
|
|
793
|
-
* registry (`command-code@1.
|
|
782
|
+
* registry (`command-code@1.65.0` `dist/cli.mjs`: `modelSupportsZdr(id)` is
|
|
794
783
|
* exactly `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr`
|
|
795
784
|
* carries the same membership in the sibling route table — the union is this
|
|
796
785
|
* set). The official docs (commandcode.ai/docs/resources/zdr) put it in prose
|
|
@@ -816,9 +805,12 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
|
816
805
|
* is the snapshot of the exclusion set and nothing more. The 1.62.0 → 1.64.0
|
|
817
806
|
* diff of that union is EMPTY: both anchors were extracted from both bundles
|
|
818
807
|
* during the 2026-09-23 check and each carries the same 20 members — which is
|
|
819
|
-
* how rare a change here is expected to be.
|
|
820
|
-
*
|
|
821
|
-
*
|
|
808
|
+
* how rare a change here is expected to be. The 1.64.0 → 1.65.0 diff (2026-09-24)
|
|
809
|
+
* is the counterexample that proves the check still runs: exactly one member
|
|
810
|
+
* joins (`stealth/space-bunny-alpha`), and it is in both anchors. `meituan/
|
|
811
|
+
* LongCat-2.0` is the one member the two anchors disagree about (it is in
|
|
812
|
+
* `modelSupportsZdr`'s set in both releases and in neither `knownModelSupportsZdr`
|
|
813
|
+
* set), so the union is
|
|
822
814
|
* what this table follows; reading only the sibling route table would drop it.
|
|
823
815
|
*/
|
|
824
816
|
declare const KNOWN_NON_ZDR_MODELS: ReadonlySet<string>;
|
|
@@ -883,7 +875,11 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
|
883
875
|
* and 1.60.0 added `stepfun/Step-5-Preview` (Go); command-code@1.62.0 added the
|
|
884
876
|
* MiMo V2.6 family — `xiaomi/mimo-v2.6-flash` + `xiaomi/mimo-v2.6-pro` (Go) and
|
|
885
877
|
* `xiaomi/mimo-v2.6-pro-ultraspeed` (GOAT) — so the 1.58.0 -> 1.62.0 window's
|
|
886
|
-
* only tier changes are additions and the superset chain still holds.
|
|
878
|
+
* only tier changes are additions and the superset chain still holds. The
|
|
879
|
+
* 1.62.0 -> 1.65.0 window continues the pattern: 1.64.0 added
|
|
880
|
+
* `claude-opus-5-5` (Provider/Max), `gpt-6-sol` (Pro) and `gpt-6-luna` (Go),
|
|
881
|
+
* and 1.65.0 added `stealth/space-bunny-alpha` (Go, every tier) — additions
|
|
882
|
+
* only, no tier moves.
|
|
887
883
|
*
|
|
888
884
|
* The Provider API exposes no plan metadata, so this snapshot is the source of
|
|
889
885
|
* truth for the picker's plan annotation — it answers "which plan do I need to
|
|
@@ -1552,21 +1548,6 @@ declare const COMMANDCODE_SEARCH_PROVIDER_ID = "commandcode";
|
|
|
1552
1548
|
* modsearch even with Command Code search turned off (issue #26).
|
|
1553
1549
|
*/
|
|
1554
1550
|
declare const DEFAULT_WEB_SEARCH_PROVIDER_ID = "deepseek-official";
|
|
1555
|
-
/**
|
|
1556
|
-
* Point the web seam's search selection at this plugin's provider (`commandcode`).
|
|
1557
|
-
* Sets the runtime field; the next search call honours it because `search()`
|
|
1558
|
-
* re-reads `searchProviderId` each time. Returns the prior id (or undefined).
|
|
1559
|
-
* Never throws: a hardened/frozen runtime shape must not break the
|
|
1560
|
-
* settings-save path that calls this — the provider simply stays
|
|
1561
|
-
* registered-but-unselected (the boot-time `searchProvider: commandcode`
|
|
1562
|
-
* cordis patch is the durable alternative).
|
|
1563
|
-
*
|
|
1564
|
-
* @deprecated Prefer {@link applyCommandCodeSearchSelection}: this overload
|
|
1565
|
-
* always overwrites the displaced backend with the factory default on
|
|
1566
|
-
* disable, so turning Command Code search off silences whichever provider
|
|
1567
|
-
* was selected before (e.g. modsearch) instead of restoring it (issue #26).
|
|
1568
|
-
*/
|
|
1569
|
-
declare function selectCommandCodeSearchProvider(web: WebRuntime, enable: boolean): string | undefined;
|
|
1570
1551
|
/**
|
|
1571
1552
|
* Tracked web-search selection state for one mounted `WebRuntime`.
|
|
1572
1553
|
*
|
|
@@ -1979,34 +1960,17 @@ interface Config {
|
|
|
1979
1960
|
lang?: string;
|
|
1980
1961
|
}
|
|
1981
1962
|
/**
|
|
1982
|
-
* The
|
|
1983
|
-
*
|
|
1963
|
+
* The Config schema: every field volatile except the composition-only `apiKey`
|
|
1964
|
+
* secret.
|
|
1984
1965
|
*
|
|
1985
1966
|
* dsh 0.1.7's settings forms are projected from the schema's `meta.volatile`
|
|
1986
1967
|
* nodes, so an unmarked field would be invisible to AND unwritable from the
|
|
1987
|
-
* settings page and refused by form-edit path validation — and
|
|
1988
|
-
*
|
|
1989
|
-
*
|
|
1990
|
-
*
|
|
1991
|
-
* that are not re-derived per read). The mark is inert on engines whose
|
|
1992
|
-
* schemastery predates `.volatile()`.
|
|
1968
|
+
* settings page and refused by form-edit path validation — and the loader
|
|
1969
|
+
* hands `apply()` a live reference per marked field, committing later writes
|
|
1970
|
+
* without remounting this fiber (the `loader/volatile-update` listener at the
|
|
1971
|
+
* bottom of `apply` covers the facts that are not re-derived per read).
|
|
1993
1972
|
*/
|
|
1994
1973
|
declare const Config: z<Config>;
|
|
1995
|
-
/**
|
|
1996
|
-
* The ≤0.1.6-generation registration schema: the same fields, NO volatile
|
|
1997
|
-
* marks.
|
|
1998
|
-
*
|
|
1999
|
-
* The legacy `installSection(owner, ns, schema, entry, hooks)` re-validates the
|
|
2000
|
-
* `entry` it is handed (`register()` → `resolve()` → `schema(mergeLayers(base,
|
|
2001
|
-
* section))`) and its `describe()` structuredClones that same `entry`. Since
|
|
2002
|
-
* schemastery ≥3.18.3 creates references at parse time on EVERY generation —
|
|
2003
|
-
* `dsh-settings` through 0.1.6 declares `schemastery: ^3.18.2`, so old engines
|
|
2004
|
-
* freshly installed today resolve 3.18.3 — a marked schema plus the raw
|
|
2005
|
-
* reference-carrying `config` is a boot-time `ValidationError` there. This
|
|
2006
|
-
* schema is therefore unmarked, and `apply` pairs it with
|
|
2007
|
-
* `unwrapVolatileConfig(config)`.
|
|
2008
|
-
*/
|
|
2009
|
-
declare const LegacySettingsSchema: z<Config>;
|
|
2010
1974
|
/** One resolution's complete request facts: connection plus credential reference. */
|
|
2011
1975
|
interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
|
|
2012
1976
|
apiKeyEnv: CredentialRef;
|
|
@@ -2020,5 +1984,5 @@ interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
|
|
|
2020
1984
|
declare function resolveAdapterOptions(config: Config): ResolvedCommandCodeOptions;
|
|
2021
1985
|
declare function apply(ctx: Context, config: Config): void;
|
|
2022
1986
|
//#endregion
|
|
2023
|
-
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_NON_ZDR_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,
|
|
1987
|
+
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_NON_ZDR_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, studioBaseForApiBase, subscriptionPlanInfo, supportsZeroDataRetention, usageReportSchema, validateCommandApiKey };
|
|
2024
1988
|
//# sourceMappingURL=index.d.ts.map
|