@mars-sea/dsh-commandcode-provider 0.14.5 → 0.15.0
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 +43 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/lib/client.js +1952 -839
- package/lib/index.d.ts +60 -2
- package/lib/index.js +300 -84
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ type CommandCodeProtocol = 'cli' | 'openai' | 'messages';
|
|
|
61
61
|
declare const DEFAULT_MAX_OUTPUT_TOKENS = 131072;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/adapter.d.ts
|
|
64
|
-
declare const COMMAND_CODE_CLI_VERSION = "1.86.
|
|
64
|
+
declare const COMMAND_CODE_CLI_VERSION = "1.86.3";
|
|
65
65
|
declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
|
|
66
66
|
/**
|
|
67
67
|
* The output budget this bundle asks for, and the ceiling it will never exceed.
|
|
@@ -798,6 +798,11 @@ declare class CommandCodeAccountPool {
|
|
|
798
798
|
private states;
|
|
799
799
|
/** 当前网关与密钥的显式探测时间,限制失败探测的频率。 */
|
|
800
800
|
private explicitProbes;
|
|
801
|
+
/**
|
|
802
|
+
* 模型级 `unavailable` 软标记:`key\0model` → 过期时刻(毫秒)。
|
|
803
|
+
* 只影响选择顺序,从不参与 {@link accountUsable},所以免费模型仍可用。
|
|
804
|
+
*/
|
|
805
|
+
private modelUnavailable;
|
|
801
806
|
private scopedStates;
|
|
802
807
|
constructor(deps: CommandCodeAccountPoolDeps);
|
|
803
808
|
/** 每个调用持有自己的定义和探测,只有同网关的健康事实共享;不临时改写全局依赖。 */
|
|
@@ -874,6 +879,30 @@ declare class CommandCodeAccountPool {
|
|
|
874
879
|
* keeps its window unknown on purpose, so a probe can still find out.
|
|
875
880
|
*/
|
|
876
881
|
markRejected(apiKey: string, rejection: AccountRejection, resetAtMs?: number): void;
|
|
882
|
+
/**
|
|
883
|
+
* Record a model-scoped `unavailable` rejection (no credits, or a model
|
|
884
|
+
* outside this account's plan) as a SHORT-LIVED PREFERENCE demotion.
|
|
885
|
+
*
|
|
886
|
+
* 职责:让同一模型的后续请求先跳过这个账号,而不是每一步都重撞一次
|
|
887
|
+
* `400 insufficient credits`;同时刻意不写进 `states`,所以
|
|
888
|
+
* {@link accountUsable} 与 {@link activeAccount} 都不受影响——余额为空的
|
|
889
|
+
* 账号仍然能服务 `:free` 模型,账号卡片也不会把它标成"不可用"。
|
|
890
|
+
*
|
|
891
|
+
* 为什么按时限而非永久:余额/套餐是可以不换密钥就改变的事实(充值、升级),
|
|
892
|
+
* 而进程内没有任何事件能通知这改变,所以只能靠时钟自行恢复。
|
|
893
|
+
*/
|
|
894
|
+
markModelUnavailable(apiKey: string, model: string): void;
|
|
895
|
+
/** Drop every model-scoped mark for one key (a new credential invalidates them). */
|
|
896
|
+
private clearModelUnavailable;
|
|
897
|
+
/**
|
|
898
|
+
* The candidates for THIS model, in preference order: accounts without a live
|
|
899
|
+
* model-scoped mark first, everything else after them.
|
|
900
|
+
*
|
|
901
|
+
* 为什么要"排后"而不是"剔除":软标记只是偏好(见
|
|
902
|
+
* {@link markModelUnavailable})。全部候选都被标记时必须退回全量,否则唯一
|
|
903
|
+
* 账号的池子会变成"没有可用账号",把一次余额不足误报成额度耗尽。
|
|
904
|
+
*/
|
|
905
|
+
private withoutModelUnavailable;
|
|
877
906
|
/**
|
|
878
907
|
* One account's key: literal → credential seam → auth file (default slot).
|
|
879
908
|
*
|
|
@@ -1136,7 +1165,7 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
|
|
|
1136
1165
|
* `/docs/plans/max` and `/docs/resources/pricing-limits`). Each plan's model
|
|
1137
1166
|
* list is a superset of the one below it: Go ⊂ GOAT ⊂ Pro ⊂ Provider/Max.
|
|
1138
1167
|
* Models absent from every plan list (Claude Opus/Fable, Fugu Ultra) are
|
|
1139
|
-
* Provider-tier. Re-verified at command-code@1.86.
|
|
1168
|
+
* Provider-tier. Re-verified at command-code@1.86.3 (2026-10-21) against the
|
|
1140
1169
|
* live `?view=client` catalog: 104 ids, still a strict superset chain. Mistral
|
|
1141
1170
|
* Large 4
|
|
1142
1171
|
* (1.75.0) was the only addition at the 1.77.0 check; the 1.78.0/1.79.0 pair
|
|
@@ -1856,6 +1885,20 @@ interface AnalyticsReport {
|
|
|
1856
1885
|
monthlyEstimate: number | null;
|
|
1857
1886
|
}
|
|
1858
1887
|
//#endregion
|
|
1888
|
+
//#region src/service-probe-wire.d.ts
|
|
1889
|
+
/** How the probe ended; the browser maps each value to localized copy. */
|
|
1890
|
+
type ProbeOutcome = 'ok' | 'http-error' | 'timeout' | 'unreachable';
|
|
1891
|
+
/** The probe facts the Host returns; the browser owns every string. */
|
|
1892
|
+
interface CommandCodeProbeResult {
|
|
1893
|
+
outcome: ProbeOutcome;
|
|
1894
|
+
/** HTTP status when a response arrived; 0 when it did not. */
|
|
1895
|
+
status: number;
|
|
1896
|
+
/** Round-trip time in milliseconds; 0 when no response arrived. */
|
|
1897
|
+
latencyMs: number;
|
|
1898
|
+
/** When the Host finished the probe (epoch ms, Host clock). */
|
|
1899
|
+
checkedAt: number;
|
|
1900
|
+
}
|
|
1901
|
+
//#endregion
|
|
1859
1902
|
//#region src/usage-remote.d.ts
|
|
1860
1903
|
/**
|
|
1861
1904
|
* The browser-login face the usage service exposes (`commandcode/login*`).
|
|
@@ -1899,6 +1942,13 @@ interface CommandCodeUsageDeps<C extends CommandCodeConnectionOptions = CommandC
|
|
|
1899
1942
|
login?: LoginFlowFacade;
|
|
1900
1943
|
enrollment?: AccountEnrollmentManager;
|
|
1901
1944
|
analytics?: (query: AnalyticsQuery, signal?: AbortSignal) => Promise<AnalyticsReport>;
|
|
1945
|
+
/**
|
|
1946
|
+
* Host-side connectivity probe for the settings page's service-status row
|
|
1947
|
+
* (wired by the plugin entry against the live API base). Absent, the
|
|
1948
|
+
* `commandcode/probe` endpoint rejects and the row shows the local
|
|
1949
|
+
* connectivity as unknown instead of inventing a result.
|
|
1950
|
+
*/
|
|
1951
|
+
probe?: () => Promise<CommandCodeProbeResult>;
|
|
1902
1952
|
}
|
|
1903
1953
|
/**
|
|
1904
1954
|
* The Remote receiver: a Cordis service the Gateway resolves by key
|
|
@@ -1931,6 +1981,14 @@ declare class CommandCodeUsageService<C extends CommandCodeConnectionOptions = C
|
|
|
1931
1981
|
* open page without a rebuild.
|
|
1932
1982
|
*/
|
|
1933
1983
|
prices(): Promise<CommandCodePriceTable>;
|
|
1984
|
+
/**
|
|
1985
|
+
* One live connectivity probe of the configured API base, run on this Host.
|
|
1986
|
+
* The status page's own data lags by design (Upptime publishes on change or
|
|
1987
|
+
* once a day), so this is the only real-time half of the status row. The
|
|
1988
|
+
* plugin entry wires the probe; a programmatic setup without it gets an
|
|
1989
|
+
* explicit failure, which the row renders as unknown.
|
|
1990
|
+
*/
|
|
1991
|
+
probe(): Promise<CommandCodeProbeResult>;
|
|
1934
1992
|
analytics(query: AnalyticsQuery): Promise<AnalyticsReport>;
|
|
1935
1993
|
/**
|
|
1936
1994
|
* Start (or rejoin) a browser-login attempt and return its fresh status —
|