@mars-sea/dsh-commandcode-provider 0.11.11 → 0.11.13
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 +20 -0
- package/README.md +34 -31
- package/README.zh-CN.md +28 -31
- package/lib/client.js +2073 -1837
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +55 -86
- package/lib/index.js +350 -390
- 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;
|
|
@@ -749,6 +738,16 @@ declare class CommandCodeAccountPool {
|
|
|
749
738
|
private pick;
|
|
750
739
|
}
|
|
751
740
|
//#endregion
|
|
741
|
+
//#region src/command-guard.d.ts
|
|
742
|
+
/**
|
|
743
|
+
* The auto-approve strictness a user picks (`Config.commandGuardLevel`). Each
|
|
744
|
+
* level is the probability every verdict must reach before the guard grants
|
|
745
|
+
* `allowed-once`; a higher level approves less, on stronger evidence. Three
|
|
746
|
+
* presets replace a free-form probability because the useful range is narrow
|
|
747
|
+
* and a hand-typed 0.6 silently turns the guard into a rubber stamp.
|
|
748
|
+
*/
|
|
749
|
+
type CommandGuardLevel = 'high' | 'medium' | 'low';
|
|
750
|
+
//#endregion
|
|
752
751
|
//#region src/capabilities.d.ts
|
|
753
752
|
/**
|
|
754
753
|
* Static capability snapshot for the Command Code provider: model →
|
|
@@ -790,7 +789,7 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
|
|
|
790
789
|
declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
791
790
|
/**
|
|
792
791
|
* Models WITHOUT a zero-data-retention upstream, per the official CLI's own
|
|
793
|
-
* registry (`command-code@1.
|
|
792
|
+
* registry (`command-code@1.65.0` `dist/cli.mjs`: `modelSupportsZdr(id)` is
|
|
794
793
|
* exactly `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr`
|
|
795
794
|
* carries the same membership in the sibling route table — the union is this
|
|
796
795
|
* set). The official docs (commandcode.ai/docs/resources/zdr) put it in prose
|
|
@@ -816,9 +815,12 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
|
816
815
|
* is the snapshot of the exclusion set and nothing more. The 1.62.0 → 1.64.0
|
|
817
816
|
* diff of that union is EMPTY: both anchors were extracted from both bundles
|
|
818
817
|
* 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
|
-
*
|
|
818
|
+
* how rare a change here is expected to be. The 1.64.0 → 1.65.0 diff (2026-09-24)
|
|
819
|
+
* is the counterexample that proves the check still runs: exactly one member
|
|
820
|
+
* joins (`stealth/space-bunny-alpha`), and it is in both anchors. `meituan/
|
|
821
|
+
* LongCat-2.0` is the one member the two anchors disagree about (it is in
|
|
822
|
+
* `modelSupportsZdr`'s set in both releases and in neither `knownModelSupportsZdr`
|
|
823
|
+
* set), so the union is
|
|
822
824
|
* what this table follows; reading only the sibling route table would drop it.
|
|
823
825
|
*/
|
|
824
826
|
declare const KNOWN_NON_ZDR_MODELS: ReadonlySet<string>;
|
|
@@ -883,7 +885,11 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
|
883
885
|
* and 1.60.0 added `stepfun/Step-5-Preview` (Go); command-code@1.62.0 added the
|
|
884
886
|
* MiMo V2.6 family — `xiaomi/mimo-v2.6-flash` + `xiaomi/mimo-v2.6-pro` (Go) and
|
|
885
887
|
* `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.
|
|
888
|
+
* only tier changes are additions and the superset chain still holds. The
|
|
889
|
+
* 1.62.0 -> 1.65.0 window continues the pattern: 1.64.0 added
|
|
890
|
+
* `claude-opus-5-5` (Provider/Max), `gpt-6-sol` (Pro) and `gpt-6-luna` (Go),
|
|
891
|
+
* and 1.65.0 added `stealth/space-bunny-alpha` (Go, every tier) — additions
|
|
892
|
+
* only, no tier moves.
|
|
887
893
|
*
|
|
888
894
|
* The Provider API exposes no plan metadata, so this snapshot is the source of
|
|
889
895
|
* truth for the picker's plan annotation — it answers "which plan do I need to
|
|
@@ -1552,21 +1558,6 @@ declare const COMMANDCODE_SEARCH_PROVIDER_ID = "commandcode";
|
|
|
1552
1558
|
* modsearch even with Command Code search turned off (issue #26).
|
|
1553
1559
|
*/
|
|
1554
1560
|
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
1561
|
/**
|
|
1571
1562
|
* Tracked web-search selection state for one mounted `WebRuntime`.
|
|
1572
1563
|
*
|
|
@@ -1934,23 +1925,18 @@ interface Config {
|
|
|
1934
1925
|
* opt-in, and the command text (plus the agent's own description of it) is
|
|
1935
1926
|
* sent to Command Code to judge. Only commands a policy already wanted a
|
|
1936
1927
|
* human to look at are ever judged, and only a confident "safe" verdict
|
|
1937
|
-
* (`
|
|
1928
|
+
* (`commandGuardLevel`) skips the prompt — every other outcome, including
|
|
1938
1929
|
* any failure of the decision call itself, delegates to the normal approval
|
|
1939
1930
|
* flow. See `./command-guard.ts`.
|
|
1940
1931
|
*/
|
|
1941
1932
|
commandGuard?: boolean;
|
|
1942
1933
|
/**
|
|
1943
|
-
*
|
|
1944
|
-
*
|
|
1934
|
+
* How confident every verdict must be before the guard skips the approval
|
|
1935
|
+
* prompt: `high` (0.95), `medium` (0.9, the default) or `low` (0.8). A lower
|
|
1936
|
+
* level approves more, on less evidence. The decision budget is fixed
|
|
1937
|
+
* (`COMMAND_GUARD_TIMEOUT_MS`), so this is the guard's only tuning knob.
|
|
1945
1938
|
*/
|
|
1946
|
-
|
|
1947
|
-
/**
|
|
1948
|
-
* Milliseconds the guard waits for a decision before falling back to the
|
|
1949
|
-
* human prompt; defaults to 1500. This is a latency budget for an interactive
|
|
1950
|
-
* approval, not a request timeout — a decision that arrives late is useless,
|
|
1951
|
-
* because the user is staring at a prompt.
|
|
1952
|
-
*/
|
|
1953
|
-
commandGuardTimeoutMs?: number;
|
|
1939
|
+
commandGuardLevel?: CommandGuardLevel;
|
|
1954
1940
|
/**
|
|
1955
1941
|
* Whether requests enforce zero data retention: the provider then routes
|
|
1956
1942
|
* them only through upstreams that keep no prompts/completions and never
|
|
@@ -1979,34 +1965,17 @@ interface Config {
|
|
|
1979
1965
|
lang?: string;
|
|
1980
1966
|
}
|
|
1981
1967
|
/**
|
|
1982
|
-
* The
|
|
1983
|
-
*
|
|
1968
|
+
* The Config schema: every field volatile except the composition-only `apiKey`
|
|
1969
|
+
* secret.
|
|
1984
1970
|
*
|
|
1985
1971
|
* dsh 0.1.7's settings forms are projected from the schema's `meta.volatile`
|
|
1986
1972
|
* 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()`.
|
|
1973
|
+
* settings page and refused by form-edit path validation — and the loader
|
|
1974
|
+
* hands `apply()` a live reference per marked field, committing later writes
|
|
1975
|
+
* without remounting this fiber (the `loader/volatile-update` listener at the
|
|
1976
|
+
* bottom of `apply` covers the facts that are not re-derived per read).
|
|
1993
1977
|
*/
|
|
1994
1978
|
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
1979
|
/** One resolution's complete request facts: connection plus credential reference. */
|
|
2011
1980
|
interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
|
|
2012
1981
|
apiKeyEnv: CredentialRef;
|
|
@@ -2020,5 +1989,5 @@ interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
|
|
|
2020
1989
|
declare function resolveAdapterOptions(config: Config): ResolvedCommandCodeOptions;
|
|
2021
1990
|
declare function apply(ctx: Context, config: Config): void;
|
|
2022
1991
|
//#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,
|
|
1992
|
+
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
1993
|
//# sourceMappingURL=index.d.ts.map
|