@mars-sea/dsh-commandcode-provider 0.14.4 → 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/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.84.0";
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
  *
@@ -1050,7 +1079,7 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
1050
1079
  * request can still name it. At the 1.84.0 sync both this row and
1051
1080
  * `stealth/cat-jam:free` were also served by the `?view=client` catalog, which
1052
1081
  * is where the 1.82.4 verdict came from; the catalog stopped serving cat-jam on
1053
- * 2026-10-20, so the artifact's exclusion set is now its only evidence.
1082
+ * 2026-10-20, and the artifact followed at 1.86.1 (see the prune note below).
1054
1083
  *
1055
1084
  * command-code@1.82.4 moved the authority for this verdict: `knownModelSupportsZdr`
1056
1085
  * no longer negates a bundled Set, it returns `resolveKnownCatalogModel({model,
@@ -1089,11 +1118,24 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
1089
1118
  * neither source alone is complete, which is why this set is not simply "what
1090
1119
  * the CLI says".
1091
1120
  *
1092
- * The 2026-10-20 catalog-only sync changes no membership: `stealth/cat-jam:free`
1121
+ * The 2026-10-20 catalog-only sync changed no membership: `stealth/cat-jam:free`
1093
1122
  * left both catalog views (its `zdr:false` verdict is no longer served), but the
1094
- * 1.84.0 artifact's exclusion set still names it and this set is the union, so
1095
- * membership stays at 25. The MiniMax M3.1 Flash launch pair is ZDR-covered
1123
+ * 1.84.0 artifact's exclusion set still named it and this set is the union, so
1124
+ * membership stayed at 25. The MiniMax M3.1 Flash launch pair is ZDR-covered
1096
1125
  * (`zdr:true` on both ids) and joins no set.
1126
+ *
1127
+ * 2026-10-21 (command-code@1.86.1 sync) prunes the set 25 -> 18, and for the
1128
+ * first time the two sources agree exactly: the 1.86.1 artifact's
1129
+ * `modelSupportsZdr` set and the live catalog's `zdr:false` rows are the same 18
1130
+ * ids (`knownModelSupportsZdr` is gone from the artifact). +3: `claude-fable-5`,
1131
+ * `claude-fable-5-1` and `tencent/hy4-preview`. -10: the nine models the catalog
1132
+ * flipped to `zdr:true` (Muse Spark 1.1 / 1.2 / 1.3, Muse Wonder 1.0, Grok 4.5 /
1133
+ * 4.6, MiMo V2.6 Flash / Pro, GLM-5.2 Fast) plus `stealth/cat-jam:free`, which
1134
+ * no source serves any more. Cat-jam is removed by explicit decision (see the
1135
+ * decision record, chapter 7 item 13): keeping a retired id in the negative set
1136
+ * is defense for stale sessions, not evidence, and the 1.86.1 artifact itself
1137
+ * dropped it. A verdict flip here is positive evidence, never "listed before,
1138
+ * absent now".
1097
1139
  */
1098
1140
  declare const KNOWN_NON_ZDR_MODELS: ReadonlySet<string>;
1099
1141
  /**
@@ -1123,8 +1165,8 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
1123
1165
  * `/docs/plans/max` and `/docs/resources/pricing-limits`). Each plan's model
1124
1166
  * list is a superset of the one below it: Go ⊂ GOAT ⊂ Pro ⊂ Provider/Max.
1125
1167
  * Models absent from every plan list (Claude Opus/Fable, Fugu Ultra) are
1126
- * Provider-tier. Re-verified at command-code@1.82.4 (2026-10-16) against the
1127
- * live `?view=client` catalog: 93 ids, still a strict superset chain. Mistral
1168
+ * Provider-tier. Re-verified at command-code@1.86.3 (2026-10-21) against the
1169
+ * live `?view=client` catalog: 104 ids, still a strict superset chain. Mistral
1128
1170
  * Large 4
1129
1171
  * (1.75.0) was the only addition at the 1.77.0 check; the 1.78.0/1.79.0 pair
1130
1172
  * added Claude Haiku 5.5 at Pro and the free Glyph Cluster preview at Go.
@@ -1133,11 +1175,12 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
1133
1175
  * train adds Qwen 3.8 Max Prime at GOAT plus Muse Spark Open, Nemotron 3.5
1134
1176
  * Super VL and the free Cat Jam preview at Go, and drops Ling 3.0 Flash Sante,
1135
1177
  * which left the live catalog. Every other
1136
- * tier is unchanged.
1178
+ * tier is unchanged. The 1.86.1 sync (2026-10-21) adds only the Ornith 1.5 122B
1179
+ * launch pair at Go.
1137
1180
  * The only removals since 1.49.0 are the two retired stealth previews (Pixel
1138
- * Canary at 1.73.1, Space Bunny Alpha at 1.74.3) and Ling 3.0 Flash Sante
1139
- * (2026-10-16). Per-entry tags below name the
1140
- * releases that added or moved each row.
1181
+ * Canary at 1.73.1, Space Bunny Alpha at 1.74.3), Ling 3.0 Flash Sante
1182
+ * (2026-10-16) and the retired Cat Jam preview (2026-10-20). Per-entry tags
1183
+ * below name the releases that added or moved each row.
1141
1184
  *
1142
1185
  * The Provider API exposes no plan metadata, so this snapshot is the source of
1143
1186
  * truth for the picker's plan annotation — it answers "which plan do I need to
@@ -1842,6 +1885,20 @@ interface AnalyticsReport {
1842
1885
  monthlyEstimate: number | null;
1843
1886
  }
1844
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
1845
1902
  //#region src/usage-remote.d.ts
1846
1903
  /**
1847
1904
  * The browser-login face the usage service exposes (`commandcode/login*`).
@@ -1885,6 +1942,13 @@ interface CommandCodeUsageDeps<C extends CommandCodeConnectionOptions = CommandC
1885
1942
  login?: LoginFlowFacade;
1886
1943
  enrollment?: AccountEnrollmentManager;
1887
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>;
1888
1952
  }
1889
1953
  /**
1890
1954
  * The Remote receiver: a Cordis service the Gateway resolves by key
@@ -1917,6 +1981,14 @@ declare class CommandCodeUsageService<C extends CommandCodeConnectionOptions = C
1917
1981
  * open page without a rebuild.
1918
1982
  */
1919
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>;
1920
1992
  analytics(query: AnalyticsQuery): Promise<AnalyticsReport>;
1921
1993
  /**
1922
1994
  * Start (or rejoin) a browser-login attempt and return its fresh status —