@mars-sea/dsh-commandcode-provider 0.11.9 → 0.11.11
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 +24 -1
- package/README.md +36 -6
- package/README.zh-CN.md +36 -6
- package/icon.svg +1 -5
- package/lib/client.js +244 -63
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +104 -11
- package/lib/index.js +1108 -58
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
10
|
+
declare const COMMAND_CODE_CLI_VERSION = "1.64.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;
|
|
@@ -93,6 +93,16 @@ interface CommandCodeConnectionOptions {
|
|
|
93
93
|
* the plugin's user settings schema.
|
|
94
94
|
*/
|
|
95
95
|
protocol?: 'auto' | CommandCodeProtocol;
|
|
96
|
+
/**
|
|
97
|
+
* Whether requests enforce zero data retention by sending the
|
|
98
|
+
* `x-cmd-zdr: 1` header (the same opt-in the official CLI exposes as
|
|
99
|
+
* `CMD_ZDR=1`). Default false. Every chat request carries the header when
|
|
100
|
+
* enabled. The provider refuses a model without a ZDR-capable upstream with
|
|
101
|
+
* 422 `cmd_zdr_no_providers`; never retry that request without the header.
|
|
102
|
+
* The decision endpoint (`/provider/v1/systemone`) is deliberately never
|
|
103
|
+
* reached through this connection option — see `./systemone.ts`.
|
|
104
|
+
*/
|
|
105
|
+
zdr?: boolean;
|
|
96
106
|
}
|
|
97
107
|
/**
|
|
98
108
|
* Resolve the durable attachment service, or undefined when the host does not
|
|
@@ -249,7 +259,7 @@ interface CommandCodePlan {
|
|
|
249
259
|
* at all, so the degraded per-endpoint view would hide the root cause behind
|
|
250
260
|
* a generic "partial data" note). Undefined for partial failures.
|
|
251
261
|
*/
|
|
252
|
-
type UsageBlockReason = 'invalid-key' | 'service-unavailable' | 'network';
|
|
262
|
+
type UsageBlockReason = 'invalid-key' | 'service-unavailable' | 'invalid-response' | 'network';
|
|
253
263
|
/** Everything the usage endpoints report, fetched together. */
|
|
254
264
|
interface CommandCodeUsageReport {
|
|
255
265
|
account?: CommandCodeAccount;
|
|
@@ -261,8 +271,9 @@ interface CommandCodeUsageReport {
|
|
|
261
271
|
/**
|
|
262
272
|
* The single reason every endpoint failed, when they all did: `invalid-key`
|
|
263
273
|
* (every call rejected with 401 — the stored key is wrong or expired),
|
|
264
|
-
* `service-unavailable` (every call answered 5xx),
|
|
265
|
-
*
|
|
274
|
+
* `service-unavailable` (every call answered 5xx), `invalid-response`
|
|
275
|
+
* (every call answered but its body was not usable JSON), or `network`
|
|
276
|
+
* (no HTTP response at all). Undefined when any endpoint succeeded.
|
|
266
277
|
*/
|
|
267
278
|
blocked?: UsageBlockReason;
|
|
268
279
|
}
|
|
@@ -338,8 +349,8 @@ declare class CommandCodeAdapter<C extends CommandCodeConnectionOptions = Comman
|
|
|
338
349
|
* Fetch one account endpoint and parse its JSON body. Returns the HTTP
|
|
339
350
|
* status alongside the parsed record so each caller applies its own
|
|
340
351
|
* failure accounting: the billing probe fails open silently, the usage
|
|
341
|
-
* report books failures per endpoint. Non-2xx and
|
|
342
|
-
* back without a record; only a
|
|
352
|
+
* report books failures per endpoint. Non-2xx and invalid JSON bodies come
|
|
353
|
+
* back without a record; only a fetch failure propagates to the caller.
|
|
343
354
|
*
|
|
344
355
|
* `timeoutMs` is the caller's budget for this one request. The default is the
|
|
345
356
|
* CATALOG probe's short cap, which fits the picker's fail-open reads; the
|
|
@@ -777,6 +788,46 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
|
|
|
777
788
|
* dsh-commandcode-upstream skill).
|
|
778
789
|
*/
|
|
779
790
|
declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
|
|
791
|
+
/**
|
|
792
|
+
* Models WITHOUT a zero-data-retention upstream, per the official CLI's own
|
|
793
|
+
* registry (`command-code@1.64.0` `dist/cli.mjs`: `modelSupportsZdr(id)` is
|
|
794
|
+
* exactly `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr`
|
|
795
|
+
* carries the same membership in the sibling route table — the union is this
|
|
796
|
+
* set). The official docs (commandcode.ai/docs/resources/zdr) put it in prose
|
|
797
|
+
* — "99% of our models have ZDR-capable upstreams … only a small handful of
|
|
798
|
+
* models are affected" — so the CLI's exclusion list is the only per-model
|
|
799
|
+
* evidence there is; a ZDR request naming one of these fails with HTTP 422
|
|
800
|
+
* `cmd_zdr_no_providers` instead of routing through a provider that retains.
|
|
801
|
+
*
|
|
802
|
+
* Why a NEGATIVE set, and why "not listed" answers TRUE: 99% of the catalog is
|
|
803
|
+
* covered, so the maintained difference is the exception list. This helper is
|
|
804
|
+
* informational; the adapter sends the ZDR header for EVERY request when the
|
|
805
|
+
* switch is on. The provider remains the routing authority and refuses an
|
|
806
|
+
* unsupported model rather than silently dropping the privacy guarantee.
|
|
807
|
+
*
|
|
808
|
+
* `minimax/minimax-m3-free` is the one entry the public catalog
|
|
809
|
+
* (`/provider/v1/models`) does not serve (it is CLI/pricing-visible and hidden
|
|
810
|
+
* from the picker); it stays listed because the CLI carries it and a Go-plan
|
|
811
|
+
* request can still name it.
|
|
812
|
+
*
|
|
813
|
+
* Keep in sync via the dsh-commandcode-upstream skill: the CLI's registry data
|
|
814
|
+
* (its `zdr:{only:[…]}` provider routes and the per-provider `zdr`/`noTraining`
|
|
815
|
+
* flags) is upstream-internal routing, not a per-model contract, so this table
|
|
816
|
+
* is the snapshot of the exclusion set and nothing more. The 1.62.0 → 1.64.0
|
|
817
|
+
* diff of that union is EMPTY: both anchors were extracted from both bundles
|
|
818
|
+
* 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. `meituan/LongCat-2.0` is the one
|
|
820
|
+
* member the two anchors disagree about (it is in `modelSupportsZdr`'s set in
|
|
821
|
+
* both releases and in neither `knownModelSupportsZdr` set), so the union is
|
|
822
|
+
* what this table follows; reading only the sibling route table would drop it.
|
|
823
|
+
*/
|
|
824
|
+
declare const KNOWN_NON_ZDR_MODELS: ReadonlySet<string>;
|
|
825
|
+
/**
|
|
826
|
+
* Whether the CLI snapshot lists a ZDR-capable upstream for `modelId`. This is
|
|
827
|
+
* informational, never a reason to omit the header when ZDR is enabled: the
|
|
828
|
+
* provider may add coverage or lack capacity after this snapshot was taken.
|
|
829
|
+
*/
|
|
830
|
+
declare function supportsZeroDataRetention(modelId: string): boolean;
|
|
780
831
|
/**
|
|
781
832
|
* Models the official CLI's model table (command-code@1.53.0) marks
|
|
782
833
|
* `reasoning:!0` but defines no selectable `reasoning_effort` levels — they
|
|
@@ -1234,7 +1285,7 @@ declare const loginStatusSchema: TypertSchema<CommandCodeLoginStatus>;
|
|
|
1234
1285
|
*/
|
|
1235
1286
|
interface LoginFlowFacade {
|
|
1236
1287
|
/** Start (or rejoin) an attempt; rejects when it cannot start at all. */
|
|
1237
|
-
begin(): Promise<CommandCodeLoginStatus>;
|
|
1288
|
+
begin(targetRef?: string): Promise<CommandCodeLoginStatus>;
|
|
1238
1289
|
/** The current attempt's status. */
|
|
1239
1290
|
status(): CommandCodeLoginStatus;
|
|
1240
1291
|
/** Cancel a waiting attempt. */
|
|
@@ -1311,7 +1362,7 @@ declare class CommandCodeUsageService<C extends CommandCodeConnectionOptions = C
|
|
|
1311
1362
|
* (no free loopback port, disposed plugin); the Gateway folds the throw
|
|
1312
1363
|
* into the failure branch the page renders.
|
|
1313
1364
|
*/
|
|
1314
|
-
loginBegin(): Promise<CommandCodeLoginStatus>;
|
|
1365
|
+
loginBegin(targetRef?: string): Promise<CommandCodeLoginStatus>;
|
|
1315
1366
|
/** Poll a login attempt's status. */
|
|
1316
1367
|
loginStatus(): Promise<CommandCodeLoginStatus>;
|
|
1317
1368
|
/** Cancel a waiting attempt; returns the post-cancel status. */
|
|
@@ -1372,7 +1423,9 @@ interface CommandCodeLoginFlowDeps {
|
|
|
1372
1423
|
* Receives the validated credentials after a successful login. Rejecting
|
|
1373
1424
|
* fails the attempt with `unavailable`.
|
|
1374
1425
|
*/
|
|
1375
|
-
storeKey(credentials: CommandCodeLoginCredentials): Promise<void>;
|
|
1426
|
+
storeKey(credentials: CommandCodeLoginCredentials, targetRef?: string): Promise<void>;
|
|
1427
|
+
/** Reject an account target that is not a saved slot before opening Studio. */
|
|
1428
|
+
validateTargetRef?(targetRef: string | undefined): void;
|
|
1376
1429
|
}
|
|
1377
1430
|
/** Compose the Studio authorization URL (pure, exported for tests). */
|
|
1378
1431
|
declare function buildCommandAuthUrl(options: {
|
|
@@ -1421,6 +1474,8 @@ declare class CommandCodeLoginFlow {
|
|
|
1421
1474
|
* the port window so browser login dies until the Host restarts.
|
|
1422
1475
|
*/
|
|
1423
1476
|
private starting;
|
|
1477
|
+
/** A live attempt's destination; different rows may not rejoin it. */
|
|
1478
|
+
private targetRef;
|
|
1424
1479
|
/** A `cancel()` that arrived while a start was still binding (see {@link CommandCodeLoginFlow.cancel}). */
|
|
1425
1480
|
private cancelPending;
|
|
1426
1481
|
private disposed;
|
|
@@ -1434,7 +1489,7 @@ declare class CommandCodeLoginFlow {
|
|
|
1434
1489
|
* `waiting` carrying the Studio URL once the loopback server is up.
|
|
1435
1490
|
* Rejects only when the flow cannot start at all (no free port, disposed).
|
|
1436
1491
|
*/
|
|
1437
|
-
begin(): Promise<CommandCodeLoginStatus>;
|
|
1492
|
+
begin(targetRef?: string): Promise<CommandCodeLoginStatus>;
|
|
1438
1493
|
/**
|
|
1439
1494
|
* The binding half of {@link CommandCodeLoginFlow.begin}: one attempt, one
|
|
1440
1495
|
* server, one published `waiting` status. Callers reach it only through
|
|
@@ -1872,6 +1927,44 @@ interface Config {
|
|
|
1872
1927
|
* the toggle is on. Read by the browser client; the adapter ignores it.
|
|
1873
1928
|
*/
|
|
1874
1929
|
showSidebarQuota?: boolean;
|
|
1930
|
+
/**
|
|
1931
|
+
* Whether the Command Code decision model (`typesafe/jev`) may auto-approve
|
|
1932
|
+
* shell commands that dsh was about to ask about. Defaults to FALSE: the
|
|
1933
|
+
* guard turns a model's opinion into a one-shot approval grant, so it is
|
|
1934
|
+
* opt-in, and the command text (plus the agent's own description of it) is
|
|
1935
|
+
* sent to Command Code to judge. Only commands a policy already wanted a
|
|
1936
|
+
* human to look at are ever judged, and only a confident "safe" verdict
|
|
1937
|
+
* (`commandGuardThreshold`) skips the prompt — every other outcome, including
|
|
1938
|
+
* any failure of the decision call itself, delegates to the normal approval
|
|
1939
|
+
* flow. See `./command-guard.ts`.
|
|
1940
|
+
*/
|
|
1941
|
+
commandGuard?: boolean;
|
|
1942
|
+
/**
|
|
1943
|
+
* Minimum probability of "safe" that lets the guard skip the approval prompt;
|
|
1944
|
+
* defaults to 0.9. Lowering it approves more, on less evidence.
|
|
1945
|
+
*/
|
|
1946
|
+
commandGuardThreshold?: number;
|
|
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;
|
|
1954
|
+
/**
|
|
1955
|
+
* Whether requests enforce zero data retention: the provider then routes
|
|
1956
|
+
* them only through upstreams that keep no prompts/completions and never
|
|
1957
|
+
* train on them (its own opt-in, `CMD_ZDR=1` in the CLI / `x-cmd-zdr: 1` on
|
|
1958
|
+
* the Provider API). Defaults to FALSE: `zdr` changes WHERE a request is
|
|
1959
|
+
* served. Every chat request carries the header when enabled; a model with
|
|
1960
|
+
* no ZDR-capable upstream fails with 422 `cmd_zdr_no_providers` instead of
|
|
1961
|
+
* being routed through an upstream that retains data. ZDR capacity is
|
|
1962
|
+
* priced pass-through and usually costs more, and the price readout keeps
|
|
1963
|
+
* quoting the ordinary catalog rates (the real per-request price shows in
|
|
1964
|
+
* Command Code's Studio). The decision endpoint behind the command guard is
|
|
1965
|
+
* never ZDR-enforced — see `./systemone.ts`.
|
|
1966
|
+
*/
|
|
1967
|
+
zdr?: boolean;
|
|
1875
1968
|
/**
|
|
1876
1969
|
* Language override for the `/commandcode` Host-side command's user-facing
|
|
1877
1970
|
* copy. Host commands cannot read the client's `ctx.locale`, so this is
|
|
@@ -1927,5 +2020,5 @@ interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
|
|
|
1927
2020
|
declare function resolveAdapterOptions(config: Config): ResolvedCommandCodeOptions;
|
|
1928
2021
|
declare function apply(ctx: Context, config: Config): void;
|
|
1929
2022
|
//#endregion
|
|
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 };
|
|
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, 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, supportsZeroDataRetention, usageReportSchema, validateCommandApiKey };
|
|
1931
2024
|
//# sourceMappingURL=index.d.ts.map
|