@mars-sea/dsh-commandcode-provider 0.13.3 → 0.14.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,35 +61,13 @@ 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.82.2";
64
+ declare const COMMAND_CODE_CLI_VERSION = "1.82.5";
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.
68
- *
69
- * 131 072, chosen against a measured provider limit rather than a round guess.
70
- * Probing `/alpha/generate` directly on 2026-09-28: 64 000 → 200, 131 072 → 200,
71
- * 196 608 → 200, **200 000 → 200, 200 704 → 400**, 1 000 000 → 400. The server
72
- * therefore caps `max_tokens` at 200 000, and it does so identically for a
73
- * 262 144-window model (`stealth/pixel-canary`, retired by Command Code on
74
- * 2026-10-01 and named here only as the probe's subject) and a 1 000 000-window
75
- * one (`stealth/space-bunny-alpha`) — the cap is global, not per model. 131 072
76
- * keeps a 35 % margin under it while covering the real output ceiling of the
77
- * models that have one (Claude 64 K, Gemini 64 K, several at 128 K).
78
- *
79
- * The old 64 000 was never a provider requirement: it cost nothing in latency
80
- * (a 64 000 request answered headers in 1.28 s against 1.57 s for 131 072) but
81
- * it did cap what a model could ever say in one turn.
82
- *
83
- * No client-side clamp is applied on top of this: an earlier version pre-shrank
84
- * `max_tokens` from an estimate of the prompt already sent (`requestContextBudget()`,
85
- * issue #67), but that estimate over-corrected on ordinary long conversations —
86
- * exactly the "output gets cut short as the conversation grows" symptom issue #74
87
- * reported — while a live A/B probe (2026-09-30, `stealth/space-bunny-alpha`,
88
- * ~19.6% over its 1,000,000-token window with no client-side shrink) showed the
89
- * endpoint answers a genuine overflow with an unambiguous `400 … exceeds the
90
- * model's context window`, which `isContextOverflowDetail()` below already
91
- * classifies as `CONTEXT_WINDOW_EXCEEDED` independently of this constant. See
92
- * [决策记录](../docs/决策记录.md).
68
+ * The figure and its probe evidence live in `./output-budget.ts` — the module
69
+ * the browser settings page also bounds its input by — and are re-exported here
70
+ * under the historical name so existing importers are unaffected.
93
71
  */
94
72
  declare const DEFAULT_GENERATE_MAX_TOKENS = 131072;
95
73
  /** How long the picker's plan-filter billing facts stay cached before refetching. */
@@ -184,6 +162,26 @@ interface CommandCodeConnectionOptions {
184
162
  * before, so composition configs and the web page are unaffected.
185
163
  */
186
164
  modelVisibility?: Readonly<Record<string, boolean>> | undefined;
165
+ /**
166
+ * 自定义上下文长度(全局值,issue #86):对没有 {@link contextWindowOverrides}
167
+ * 条目的目录模型,宣告给宿主的上下文窗口改用此值而非目录的
168
+ * `context_length`;选择器标注、`defaultMaxTokens` 预算同样跟随。
169
+ * 留空表示完全跟随目录。
170
+ */
171
+ contextWindow?: number | undefined;
172
+ /**
173
+ * 按模型的自定义上下文长度,键为目录模型 id;优先于 {@link contextWindow}。
174
+ * 非法条目在 `resolveAdapterOptions` 已被清洗,这里只读已判定的值。
175
+ */
176
+ contextWindowOverrides?: Readonly<Record<string, number>> | undefined;
177
+ /**
178
+ * 输出预算上限(issue #74)。未设置=沿用既有推导(模型公布/学习上限、
179
+ * 网关总上限)。正整数=用户上限,与推导值取较小者,永远不会超过网关总上限。
180
+ * `0`=不发送 `max_tokens`,把单轮输出规模交回平台——仅 CLI 与 OpenAI 传输
181
+ * 支持;Messages 端点必填该字段,因此那条链路仍按推导值发送(见
182
+ * `omitOutputTokens()`)。
183
+ */
184
+ maxOutputTokens?: number | undefined;
187
185
  /**
188
186
  * Optional protocol hint. `'auto'` (default) uses billing/cache plus
189
187
  * Provider API fallback; `'cli'` forces `/alpha/generate`; `'openai'`
@@ -955,11 +953,28 @@ interface EnrollmentInput {
955
953
  key?: string;
956
954
  }
957
955
  type EnrollmentPhase = 'creating' | 'waiting' | 'writing' | 'naming' | 'finished' | 'cancelling' | 'cancelled' | 'failed' | 'cleanup-needed';
956
+ /**
957
+ * 账号开通状态的语义消息键。
958
+ *
959
+ * 状态消息传键而不是成品文案:界面语言由浏览器侧持有,宿主没有立场去猜;同一条状态
960
+ * 要在中文与英文界面下各自显示,而 `phase` 不足以唯一确定它——`naming` 既有「正在
961
+ * 保存名称」也有「名称保存失败」,`cleanup-needed` 既有「收尾未完成」也有「清理未
962
+ * 完成」,`cancelled` 既有「已取消」也有「已取消并清理」。客户端拿这些键走 `t()`
963
+ * 渲染,不必再匹配自由文本;`SettingsCommandCodeKey` 收录本类型,因此新增键漏写
964
+ * 中文或英文字典都会被类型检查拦下。
965
+ *
966
+ * 其中十五条由宿主产出(`src/enrollment.ts`),`enrollmentCleanupPending` 也在此列——
967
+ * 它在「收尾未完成」时由宿主与页面两侧共用同一个键;另外七条是浏览器侧控制器的专属键
968
+ * (`src/client/enrollment.ts`),只在传输失败或连接断开时由该侧自己产出。宿主抛出的
969
+ * 异常消息不在此列:它们不上屏,客户端在所有失败路径都用自己这一侧的文案覆盖。
970
+ */
971
+ type EnrollmentMessageKey = 'enrollmentCreating' | 'enrollmentWaiting' | 'enrollmentWriting' | 'enrollmentNaming' | 'enrollmentNameFailed' | 'enrollmentFinished' | 'enrollmentCancelling' | 'enrollmentCancelled' | 'enrollmentCancelledCleaned' | 'enrollmentFailed' | 'enrollmentFailedCleaned' | 'enrollmentCleanupPending' | 'enrollmentCleanupFailed' | 'enrollmentRecordNaming' | 'enrollmentRecordCleanup' | 'enrollmentBeginFailed' | 'enrollmentCancelUnconfirmed' | 'enrollmentNameRequestFailed' | 'enrollmentCleanupRequestFailed' | 'enrollmentDisconnected' | 'enrollmentHostUnavailable' | 'enrollmentStatusUnavailable';
958
972
  interface EnrollmentState {
959
973
  id: string;
960
974
  ref: string;
961
975
  phase: EnrollmentPhase;
962
- message: string;
976
+ /** 要显示的语义键;文案由浏览器侧按界面语言渲染,见 {@link EnrollmentMessageKey}。 */
977
+ messageKey: EnrollmentMessageKey;
963
978
  authUrl?: string;
964
979
  suggestedName?: string;
965
980
  }
@@ -1001,14 +1016,16 @@ declare const KNOWN_EFFORTS: Readonly<Record<string, readonly string[]>>;
1001
1016
  */
1002
1017
  declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
1003
1018
  /**
1004
- * Models WITHOUT a zero-data-retention upstream, per the official CLI's own
1005
- * registry (`command-code@1.82.1` `dist/cli.mjs`): `modelSupportsZdr(id)` is
1006
- * exactly `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr`
1007
- * carries the same membership in the sibling route table — the UNION of both
1008
- * is this set. Reading only the sibling route table dropped
1009
- * `meituan/LongCat-2.0`, which sat in `modelSupportsZdr` alone through
1010
- * 1.73.0; the 1.74.3 table lists it in NEITHER set, so as of this snapshot it
1011
- * is no longer excluded. The official docs (commandcode.ai/docs/resources/
1019
+ * Models WITHOUT a zero-data-retention upstream. Through command-code@1.82.2
1020
+ * the CLI's own registry answered this: `modelSupportsZdr(id)` was exactly
1021
+ * `!nonZdrSet.has(canonicalize(id))`, and `knownModelSupportsZdr` carried the
1022
+ * membership in the sibling route table — the UNION of both was this set, and
1023
+ * the two anchors disagreed by one id (`meituan/LongCat-2.0:free`, which 1.74.1
1024
+ * dropped from the first anchor while the canonical helper kept it).
1025
+ * command-code@1.82.4 removes that disagreement by making the verdict a catalog
1026
+ * lookup — `resolveKnownCatalogModel({model,catalog})?.zdr ?? false` — so this
1027
+ * set is now the live catalog's `zdr:false` membership and nothing more. The
1028
+ * official docs (commandcode.ai/docs/resources/
1012
1029
  * zdr) put coverage in prose — "99% of our models have ZDR-capable upstreams … only
1013
1030
  * a small handful of models are affected" — so the CLI's exclusion list is
1014
1031
  * the only per-model evidence there is; a ZDR request naming one of these
@@ -1021,10 +1038,19 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
1021
1038
  * switch is on — the provider remains the routing authority and refuses an
1022
1039
  * unsupported model rather than silently dropping the privacy guarantee.
1023
1040
  *
1024
- * `minimax/minimax-m3-free` is the one entry the public catalog
1025
- * (`/provider/v1/models`) does not serve (it is CLI/pricing-visible and hidden
1026
- * from the picker); it stays listed because the CLI carries it and a Go-plan
1027
- * request can still name it.
1041
+ * `minimax/minimax-m3-free` is the one entry the public catalog's default view
1042
+ * (`/provider/v1/models`) does not serve through the picker (it is CLI/pricing-visible
1043
+ * and hidden from the picker); it stays listed because the CLI carries it and a Go-plan
1044
+ * request can still name it. Both this row and `stealth/cat-jam:free` ARE served
1045
+ * by the `?view=client` catalog, which is where the 1.82.4 verdict comes from.
1046
+ *
1047
+ * command-code@1.82.4 moved the authority for this verdict: `knownModelSupportsZdr`
1048
+ * no longer negates a bundled Set, it returns `resolveKnownCatalogModel({model,
1049
+ * catalog})?.zdr ?? false`, so an id the catalog does not carry (or carries with
1050
+ * `zdr:false`) is NOT covered. That inverts the default this helper was built on
1051
+ * ("not listed" answered TRUE); the snapshot keeps its negative-set shape because
1052
+ * 99% of the catalog is still covered, but membership is now read from the
1053
+ * `?view=client` catalog and confirmed against the canonical helper set.
1028
1054
  *
1029
1055
  * Keep in sync via the dsh-commandcode-upstream skill: the CLI's registry data
1030
1056
  * (its `zdr:{only:[…]}` provider routes and the per-provider `zdr`/`noTraining`
@@ -1045,6 +1071,11 @@ declare const KNOWN_IMAGE_MODELS: ReadonlySet<string>;
1045
1071
  * `listSelectableModelIds()`, so they are pruned along with the rest of the
1046
1072
  * tables and `supportsZeroDataRetention` now answers TRUE for them, matching
1047
1073
  * what the current CLI says.
1074
+ *
1075
+ * 1.82.4 then reversed 1.74.1's removal of `meituan/LongCat-2.0:free` and added
1076
+ * the `stealth/cat-jam:free` preview, taking this set to 24 members — the size
1077
+ * of the live catalog's `zdr:false` list. The canonical helper set still carries
1078
+ * 23 because `cat-jam:free` postdates the artifact's embedded snapshot.
1048
1079
  */
1049
1080
  declare const KNOWN_NON_ZDR_MODELS: ReadonlySet<string>;
1050
1081
  /**
@@ -1074,15 +1105,20 @@ declare const KNOWN_THINKING_MODELS: ReadonlySet<string>;
1074
1105
  * `/docs/plans/max` and `/docs/resources/pricing-limits`). Each plan's model
1075
1106
  * list is a superset of the one below it: Go ⊂ GOAT ⊂ Pro ⊂ Provider/Max.
1076
1107
  * Models absent from every plan list (Claude Opus/Fable, Fugu Ultra) are
1077
- * Provider-tier. Re-verified at command-code@1.82.1 (2026-10-14): 89 catalog
1078
- * ids at 54/64/79/87/89 cumulative, a strict superset chain. Mistral Large 4
1108
+ * Provider-tier. Re-verified at command-code@1.82.4 (2026-10-16) against the
1109
+ * live `?view=client` catalog: 93 ids, still a strict superset chain. Mistral
1110
+ * Large 4
1079
1111
  * (1.75.0) was the only addition at the 1.77.0 check; the 1.78.0/1.79.0 pair
1080
1112
  * added Claude Haiku 5.5 at Pro and the free Glyph Cluster preview at Go.
1081
1113
  * 1.79.2 lowers Haiku 5.5's minimum plan to GOAT; 1.80.0 adds Muse Wonder at
1082
- * Max; 1.82.0 adds Gemini 4 Argon at Pro and nothing else moves. Every other
1114
+ * Max; 1.82.0 adds Gemini 4 Argon at Pro and nothing else moves. The 1.82.4
1115
+ * train adds Qwen 3.8 Max Prime at GOAT plus Muse Spark Open, Nemotron 3.5
1116
+ * Super VL and the free Cat Jam preview at Go, and drops Ling 3.0 Flash Sante,
1117
+ * which left the live catalog. Every other
1083
1118
  * tier is unchanged.
1084
1119
  * The only removals since 1.49.0 are the two retired stealth previews (Pixel
1085
- * Canary at 1.73.1, Space Bunny Alpha at 1.74.3). Per-entry tags below name the
1120
+ * Canary at 1.73.1, Space Bunny Alpha at 1.74.3) and Ling 3.0 Flash Sante
1121
+ * (2026-10-16). Per-entry tags below name the
1086
1122
  * releases that added or moved each row.
1087
1123
  *
1088
1124
  * The Provider API exposes no plan metadata, so this snapshot is the source of
@@ -1904,47 +1940,120 @@ declare const COMMANDCODE_SEARCH_PROVIDER_ID = "commandcode";
1904
1940
  */
1905
1941
  declare const DEFAULT_WEB_SEARCH_PROVIDER_ID = "deepseek-official";
1906
1942
  /**
1907
- * Tracked web-search selection state for one mounted `WebRuntime`.
1943
+ * Profile entry id whose volatile `searchProvider` selects the search backend.
1944
+ *
1945
+ * The hosting profile declares it in `dsh-base`'s cordis patch as
1946
+ * `- id: web` / `name: '@deepseek-ai/dsh-web'`, and the shipped web-search
1947
+ * settings page addresses the very same namespace — that page and this plugin
1948
+ * are therefore two writers of ONE field (see
1949
+ * {@link createCommandCodeSearchSelection} for how they avoid fighting).
1950
+ */
1951
+ declare const WEB_SELECTION_NAMESPACE = "web";
1952
+ /**
1953
+ * Structural view of the host settings service.
1908
1954
  *
1909
- * `owner` marks whether this plugin currently owns the selection. `displaced`
1910
- * is the backend it took over — restored on disable or unload — and
1911
- * `undefined` means "nothing was configured, leave auto-select" and must
1912
- * round-trip untouched.
1955
+ * Spelled structurally rather than imported: only these three members are used,
1956
+ * and a narrower contract keeps the tests' double honest. Every member is
1957
+ * called inside a `try`, because a host mounted without `configEditor` /
1958
+ * `profileContext` throws from `describe()` rather than answering empty.
1959
+ */
1960
+ interface WebSelectionSettings {
1961
+ /** Every configurable entry's form view; the `web` row is absent when it has no volatile field. */
1962
+ describe(): unknown;
1963
+ /** Merge fields into that entry's live config (the official volatile write). */
1964
+ update(ns: string, patch: object): Promise<void>;
1965
+ /** Reset the entry's live fields, then set the supplied ones. */
1966
+ replace(ns: string, section: object): Promise<void>;
1967
+ }
1968
+ /** Failure and visibility sink; implementations must never throw. */
1969
+ interface WebSelectionLogger {
1970
+ warn(message: string): void;
1971
+ info(message: string): void;
1972
+ }
1973
+ /**
1974
+ * Tracked web-search selection state.
1975
+ *
1976
+ * `owner` is true while this plugin is the one asserting the selection: it
1977
+ * wrote the value, or found it already equal to ours AND attributed it to a
1978
+ * user-layer pin. Disabling only ever gives back what `owner` covers.
1979
+ *
1980
+ * `preexisting` marks the one case where the value is NOT ours to give back:
1981
+ * the field already read `commandcode` while the USER LAYER held nothing, so
1982
+ * the value came from the deployment's composed config or
1983
+ * `$DSH_WEB_SEARCH_PROVIDER`. Restoring there would write over a pin this
1984
+ * plugin never took.
1913
1985
  *
1914
- * `preexisting` is the one fact `displaced` cannot carry: an `undefined`
1915
- * `displaced` means EITHER "the field was unset when we took over" (give
1916
- * `undefined` back) OR "the field already read `commandcode`" (touch
1917
- * nothing). Collapsing the two is what turned a user's own
1918
- * `searchProvider: commandcode` pin into an auto-select, and then into
1919
- * `WEB_PROVIDER_AMBIGUOUS` on every search.
1986
+ * `foreign` is a non-`commandcode` pin found in the user layer — the shipped
1987
+ * web-search settings page writes `deepseek-search-api`, and any sibling plugin
1988
+ * may pin its own id. A foreign pin is never displaced; `foreign` keeps the
1989
+ * value so the state (and the log line) can name who owns the backend.
1990
+ *
1991
+ * `displaced` is the config value at takeover time. It is what the DEGRADED
1992
+ * (memory-only) restore writes back; the persisted path restores the composed
1993
+ * base instead, because a copy of it in the user layer would outlive a later
1994
+ * deployment change.
1920
1995
  */
1921
1996
  interface CommandCodeSearchSelection {
1922
1997
  owner: boolean;
1923
- displaced: string | undefined;
1924
- /** Whether the field already read `commandcode` when this plugin first took it over. */
1925
1998
  preexisting: boolean;
1999
+ foreign: string | undefined;
2000
+ displaced: string | undefined;
1926
2001
  }
1927
2002
  /** Fresh selection state: the plugin starts out not owning the selection. */
1928
2003
  declare function commandCodeSearchSelection(): CommandCodeSearchSelection;
2004
+ /** Dependencies {@link createCommandCodeSearchSelection} resolves per call. */
2005
+ interface WebSearchSelectionDeps {
2006
+ /** The running `web` service whose volatile reference backs the degraded write. */
2007
+ web: WebRuntime;
2008
+ /** Host settings service, resolved per use because it may activate after `web`. */
2009
+ settings: () => WebSelectionSettings | undefined;
2010
+ /** Failure and visibility sink. */
2011
+ logger: WebSelectionLogger;
2012
+ }
2013
+ /** The handle `src/index.ts` drives; every member is synchronous and non-throwing. */
2014
+ interface WebSearchSelectionHandle {
2015
+ /** Live state, for callers that surface who currently owns the backend. */
2016
+ readonly state: CommandCodeSearchSelection;
2017
+ /** Align the selection with one end of the `webSearch` toggle. Never throws. */
2018
+ apply(enable: boolean): void;
2019
+ /** Resolve once every queued write has settled. */
2020
+ settled(): Promise<void>;
2021
+ /** Fiber release: drop queued writes and restore in memory ONLY — never on disk. */
2022
+ release(): void;
2023
+ }
1929
2024
  /**
1930
- * Reach one end of the `webSearch` toggle without trampling sibling search
1931
- * providers (issue #26).
2025
+ * The selection seam over `ctx.web`.
1932
2026
  *
1933
- * - Enabling writes `commandcode` and remembers whatever it displaced. When
1934
- * the plugin already owns the selection, the original `displaced` is kept —
1935
- * the field currently holds our own id, which must never be mistaken for the
1936
- * user's backend.
1937
- * - Disabling hands the selection back to the remembered backend only when
1938
- * this plugin actually took it over. A fresh boot straight into
1939
- * `webSearch: false`, or a `preexisting` field, leaves it ALONE: writing the
1940
- * empty memory back would clear the user's own `searchProvider: commandcode`
1941
- * pin and hand the selection to dsh-web's auto-select, where a second usable
1942
- * provider makes every later search throw `WEB_PROVIDER_AMBIGUOUS`.
2027
+ * ## Why settings rather than the runtime instance
1943
2028
  *
1944
- * Never throws: like the low-level rewrite, a hardened runtime shape degrades
1945
- * to registered-but-unselected.
2029
+ * 0.2.1-rc.2's `WebRuntime` reads `this.config.searchProvider.get()` on EVERY
2030
+ * search and fetch, and the loader commits a settings write into that same
2031
+ * reference in place (`Entry._commitVolatile`) without remounting the entry.
2032
+ * Writing the reference directly therefore works, but leaves the value out of
2033
+ * the profile: the next commit for that entry — including one caused by an
2034
+ * unrelated field such as `fetchProvider` — re-resolves the raw config and
2035
+ * overwrites it. `ctx.settings.update()` / `replace()` is the documented path
2036
+ * and the one the shipped web-search settings page uses, so this plugin takes
2037
+ * it first and falls back to the reference only when settings is unavailable or
2038
+ * refuses (see `volatileWrite`).
2039
+ *
2040
+ * ## Two writers, one field
2041
+ *
2042
+ * The shipped web-search settings page writes `web.searchProvider` too
2043
+ * (`deepseek-search-api` / `deepseek-official`). This seam never displaces a
2044
+ * pin it did not write: a non-`commandcode` value in the USER LAYER stops the
2045
+ * takeover, the value is recorded on {@link CommandCodeSearchSelection.foreign}
2046
+ * and named in one `info` line, and the provider stays registered but
2047
+ * unselected. A value the user layer does not carry is the deployment's own
2048
+ * default, and taking it over is the toggle's whole purpose. A user-layer
2049
+ * `commandcode` is treated as ours: nothing else writes that id, so it can only
2050
+ * be a previous run of this plugin or a deliberate manual pin, and turning the
2051
+ * toggle off restores the composed default in both cases.
2052
+ *
2053
+ * @param deps - the running `web` service, a settings resolver, and a log sink.
2054
+ * @returns a synchronous handle; failures are logged, never thrown.
1946
2055
  */
1947
- declare function applyCommandCodeSearchSelection(web: WebRuntime, state: CommandCodeSearchSelection, enable: boolean): void;
2056
+ declare function createCommandCodeSearchSelection(deps: WebSearchSelectionDeps): WebSearchSelectionHandle;
1948
2057
  /** Per-request facts the provider needs, all injected so the class stays cordis-free and testable. */
1949
2058
  interface CommandCodeSearchProviderDeps {
1950
2059
  /** 使用搜索已捕获的网关解析账号,探测不能在等待后转到另一个网关。 */
@@ -2152,7 +2261,7 @@ interface Config {
2152
2261
  workingDir?: string;
2153
2262
  /** Model catalog cache path; defaults to `~/.commandcode/models-cache.json`. */
2154
2263
  modelsCachePath?: string;
2155
- /** Milliseconds to wait for the generate response's first byte; defaults to 60s. */
2264
+ /** Milliseconds to wait for the generate response's first byte; defaults to 300s. */
2156
2265
  requestTimeoutMs?: number;
2157
2266
  /** Milliseconds a stream may stall before being treated as a dead connection; defaults to 300s. */
2158
2267
  streamIdleTimeoutMs?: number;
@@ -2192,6 +2301,31 @@ interface Config {
2192
2301
  * path per model — a map.
2193
2302
  */
2194
2303
  modelVisibility?: Record<string, boolean>;
2304
+ /**
2305
+ * 自定义上下文长度(全局值,issue #86):宣告给宿主的上下文窗口不再取
2306
+ * 模型目录的 `context_length`,而用这个值——上下文计量、自动压缩时机与
2307
+ * 选择器上的上下文标注都跟随它。对没有 {@link contextWindowOverrides}
2308
+ * 条目的每个目录模型生效;留空(默认)跟随目录。只对目录中存在的模型
2309
+ * 生效,未知模型保持既有的「无上下文宣告」。范围 1 – 10 000 000 个整数 token。
2310
+ */
2311
+ contextWindow?: number;
2312
+ /**
2313
+ * 按模型的自定义上下文长度,键为目录模型 id;优先于全局
2314
+ * {@link contextWindow}。配置校验拒绝非整数及越界值;绕过校验的程序化
2315
+ * 调用还会丢弃无效条目,按全局值、目录值的顺序回落。
2316
+ */
2317
+ contextWindowOverrides?: Record<string, number>;
2318
+ /**
2319
+ * 单轮输出预算上限(issue #74)。不填(默认)=沿用既有推导:模型公布或
2320
+ * 运行时学到的输出上限、以及网关总上限(131 072)三者取最小。填正整数=
2321
+ * 再与推导值取最小,永远不会突破三者;越界值由配置校验拒绝。
2322
+ * 填 `0`=**不发送** `max_tokens` 字段,把单轮输出规模交回平台自行限制——
2323
+ * 这是报告者要的「不再被硬切」,但仅 CLI(`/alpha/generate`)与 OpenAI
2324
+ * (`/provider/v1/chat/completions`)两条传输支持:Anthropic Messages 端点
2325
+ * 必填该字段,缺失会被上游拒绝,因此 Claude 链路仍按推导值发送。
2326
+ * 宿主显式传入的每次调用预算(如会话标题的 64)优先于此设置。
2327
+ */
2328
+ maxOutputTokens?: number;
2195
2329
  /**
2196
2330
  * Extra accounts for multi-account rotation. The top-level
2197
2331
  * `apiKey`/`apiKeyEnv` (plus the CLI auth file) always form the first
@@ -2219,12 +2353,16 @@ interface Config {
2219
2353
  /**
2220
2354
  * Whether to use Command Code as the backend for dsh's model-facing
2221
2355
  * `web_search` tool. Enabled registers a `commandcode` search provider on
2222
- * `ctx.web` AND selects it over the shipped `deepseek-official` (or a
2223
- * sibling plugin's pin), reusing the SAME key and apiBase as chat. Disabling
2224
- * hands the selection back to whichever backend was there before, so a
2225
- * sibling search plugin (e.g. modsearch) keeps working (issue #26). The
2226
- * write rides dsh's internal `searchProviderId`, read per search call, so a
2227
- * setting change lands on the next search without a restart. Defaults true.
2356
+ * `ctx.web` AND selects it over the shipped `deepseek-official` (or a sibling
2357
+ * plugin's pin), reusing the SAME key and apiBase as chat. Selection is the
2358
+ * `web` profile entry's volatile `searchProvider`, written through the host
2359
+ * settings service and read by `WebRuntime.search()` on the next call, so a
2360
+ * toggle change lands without a restart or a remount. Disabling gives the
2361
+ * field back to the deployment's composed value, so a sibling search plugin
2362
+ * (e.g. modsearch) keeps working (issue #26) — EXCEPT when the user layer
2363
+ * already carries someone else's explicit pin (the shipped web-search
2364
+ * settings page writes `deepseek-search-api`): that choice is never
2365
+ * displaced, and the provider stays registered but unselected. Defaults true.
2228
2366
  */
2229
2367
  webSearch?: boolean;
2230
2368
  /**
@@ -2284,5 +2422,5 @@ interface ResolvedCommandCodeOptions extends CommandCodeConnectionOptions {
2284
2422
  declare function resolveAdapterOptions(config: Config): ResolvedCommandCodeOptions;
2285
2423
  declare function apply(ctx: Context, config: Config): void;
2286
2424
  //#endregion
2287
- 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 };
2425
+ 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, WEB_SELECTION_NAMESPACE, type WebSearchSelectionHandle, type WebSelectionLogger, type WebSelectionSettings, accountUsable, apply, applyCommandCodeTuiSettings, applyCommands, applyUsageRemote, buildCommandAuthUrl, buildCommandCodeTuiSection, capabilityDescription, commandCodeSearchSelection, commandDefinition, compareByPlan, createCommandCodeSearchSelection, dealLabel, formatContext, inject, loginStatusSchema, matchModelRule, modelVisibleInPlan, name, parseLoginStatus, peakPricingLabel, peakPricingState, planLabel, projectSlugFromPath, resolveAdapterOptions, resolveAuthFileApiKey, selectAccountForModel, selectActiveAccount, studioBaseForApiBase, subscriptionPlanInfo, supportsZeroDataRetention, usageReportSchema, validateCommandApiKey };
2288
2426
  //# sourceMappingURL=index.d.ts.map