dsh-model-think-level 2.3.6 → 2.5.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/README.md +39 -0
- package/lib/camouflage-store.d.ts +55 -0
- package/lib/camouflage.d.ts +91 -0
- package/lib/client/AdvancedPane.d.ts +38 -0
- package/lib/client/AutoContinueController.d.ts +38 -0
- package/lib/client/CamouflageEditor.d.ts +100 -0
- package/lib/client/ConfigPane.d.ts +9 -1
- package/lib/client/HeadersEditor.d.ts +34 -1
- package/lib/client/HistoryCompatEditor.d.ts +67 -0
- package/lib/client/auto-continue-pref.d.ts +5 -2
- package/lib/client/auto-continue-rules.d.ts +33 -1
- package/lib/client/error-detail-pref.d.ts +18 -0
- package/lib/client/injection/auto-continue-run.d.ts +36 -4
- package/lib/client/injection/error-detail.d.ts +79 -0
- package/lib/client/injection/model-order-drag.d.ts +3 -1
- package/lib/client/locales.d.ts +70 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +520 -40
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +39 -0
- package/lib/headers-core.d.ts +27 -2
- package/lib/history-compat-store.d.ts +55 -0
- package/lib/history-compat.d.ts +98 -0
- package/lib/index.js +689 -98
- package/lib/index.js.map +4 -4
- package/package.json +13 -1
package/README.md
CHANGED
|
@@ -18,7 +18,9 @@ DSH 自带的 Models 页只认得它自己目录里的模型。中转站、自
|
|
|
18
18
|
- **多密钥** — 一个供应商放 N 把密钥,按把启停、按把圈定模型范围、按把指定协议;保存后自动探测每把密钥能服务哪些模型。
|
|
19
19
|
- **自动重试** — 401/403/408/429/5xx 和「分组里没有这个模型」自动换下一把密钥,配冷却排序,把还在冷却里的密钥排到最后;请求一旦开始输出内容就不再重放。
|
|
20
20
|
- **自定义请求头** — 每个路由可配任意请求头(含 `user-agent`),在 fetch 层按请求重新盖回去;同源冲突、与官方适配器或同类插件的争抢都会被检出。
|
|
21
|
+
- **请求伪装** — 每个路由可选 Codex / Claude 两种官方 CLI 身份:客户端请求头,以及 Claude 的 Messages 请求体身份段一并补齐;默认关闭,与自定义请求头同一区块。
|
|
21
22
|
- **生图** — 勾一下「生图」就能把任意模型变成生图模型,对话模型调用原生工具 `generate_image` 出图,支持参考图改图、多图并出、默认参数与超时。
|
|
23
|
+
- **旧话题恢复** — 换过 Azure 资源/中转的上游会拒收旧话题带来的历史项(`item`)。打开后同时识别 `400` 响应体与 `200` 流内 `response.failed` 的这句拒绝,在发送副本的消息上下文里逐级去掉旧资源签发的项(必要时连历史推理一起),再重放这次请求,不删本地历史。
|
|
22
24
|
- **自动继续** — 会话因为断线、超时、撞上输出上限停住时,替你补一条「继续」,可展开配置等待秒数和最多重试次数。
|
|
23
25
|
- **余额** — 每个供应商可选配一个只读余额接口,模型页直接显示余额,支持手动刷新。
|
|
24
26
|
|
|
@@ -96,6 +98,18 @@ dsh plugin add .
|
|
|
96
98
|
- `user-agent` 最长 512 字符。
|
|
97
99
|
- 冲突会被检出并提示:同源上别的路由已占用同名请求头、官方 `dsh-llm-pi-ai` 的 `transformHeaders` 已经在处理这组头、或者别的同类插件也在写同一个头。
|
|
98
100
|
|
|
101
|
+
### 高级配置:请求伪装
|
|
102
|
+
|
|
103
|
+
「请求头」下面是**同一个表单**里的第二个区块:**请求伪装**。默认关闭,按路由保存,可选 **Codex** 或 **Claude**——让该路由的请求以对应厂商官方 CLI 的身份发出,而不是以 SDK 的默认身份。
|
|
104
|
+
|
|
105
|
+
- 两个区块之间有一条分割线,**取消 / 保存只有一组,放在最下面**:它提交的是整个高级配置(请求头 + 伪装 + 旧话题恢复)。伪装和旧话题恢复都是草稿——点选项只是改了表单,按保存才写入;按取消回到已保存的值。
|
|
106
|
+
|
|
107
|
+
- 存的是插件自己的文件 `<DSH_HOME>/dsh-model-think-level/camouflage.json`,不写进官方供应商档案;换了版本、删了文件就回到关闭。
|
|
108
|
+
- **Codex**:改 `user-agent` 为 `codex_cli_rs/<版本>`,补 `originator: codex_cli_rs` 和一个稳定的 `x-codex-session-id`;请求体不动。
|
|
109
|
+
- **Claude**:改 `user-agent` 为 `claude-cli/<版本>`,补 `x-app: cli`、`anthropic-version`、`anthropic-beta`,并在 `/v1/messages` 的请求体里补上校验要看的身份 system 段与 `metadata.user_id`——tools、图片、签名块一律原样保留。请求体的改动会同步重算 `content-length`。
|
|
110
|
+
- 与自定义请求头的优先级:伪装先落,**请求头表里的同名项最后生效**——你在表里显式写了 `user-agent`,就以你的为准;`anthropic-version` 只有缺失时才补,已有值保留。
|
|
111
|
+
- 只影响这个路由真实发出的请求。探测密钥、余额、生图这类旁路请求不带伪装。
|
|
112
|
+
|
|
99
113
|
### 高级设置:生图默认参数与自动继续
|
|
100
114
|
|
|
101
115
|
模型页标题行的按钮打开「高级设置」浮层,目前有两张卡。浮层高度固定(折叠、展开都不变,内容超出时才在浮层内部滚动),两张卡都能点卡片名或右侧箭头展开:
|
|
@@ -179,6 +193,26 @@ dsh plugin add .
|
|
|
179
193
|
- 超时或停止会结束插件自己的等待,并向支持取消的依赖传递信号;忽略信号的外部操作或已被上游接受的生图任务不保证撤销,同步解码/文件操作也不能被抢占。热重载只更新后续调用,不替换已经在跑的旧调用。
|
|
180
194
|
- 从 2.0.3 及更早版本升级:启动时会自动移除旧版「生图 MCP」在 `cordis.patch.yml` 里留下的条目(带 `.bak` 备份),重启后旧的 `dsh-image` MCP 服务不再被拉起。带旧版标记注释的块和没有标记的裸 `- insert:` / `- id: dsh-image-mcp` 条目都能清掉;同一块里还插着别人的插件条目时不动它。
|
|
181
195
|
|
|
196
|
+
## 旧话题恢复
|
|
197
|
+
|
|
198
|
+
同一个供应商如果换过 Azure 资源、换过中转账号池,旧话题的下一条消息可能直接被拒:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
The requested item was created under a different Azure OpenAI resource. Use the same resource that created the item to access it.
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
旧话题的历史项带着上一个资源签发的标识和加密推理,新资源不认识它们。这是**历史与上游对不上**,不是密钥失效,也不是模型不存在——换密钥、切协议、把话题清空重来都不对症,而且本地那段历史还在,换个入口发出去照样被拒。
|
|
205
|
+
|
|
206
|
+
「高级配置」里的第三块**旧话题恢复**就是为这一句拒绝准备的,默认关闭,按路由打开:
|
|
207
|
+
|
|
208
|
+
- **认措辞,不认状态码**:这句拒绝可能以 `400` 出现(正文是 JSON,或中转把 400 当 SSE 流发回来),也可能以 `200` 的流内 `response.failed` 出现——流式 Responses 更常见的正是后者。两种都会识别,因为恢复引擎读的是那句精确措辞,而不是 HTTP 门牌。别的错误一律原样透传。
|
|
209
|
+
- **在原消息上下文上降级,逐级放宽**:第一次原样发送;命中后先只去掉重放历史里绑定旧资源的句柄——推理项 `thinkingSignature` 里的 `id`、文本项 `textSignature` 里的 `id`、工具调用 `id` 里的 `itemId` 半段;仍被拒就再停止重放历史推理(本地可见的思考文本不动)。恢复只发生在流还没把任何内容交给调用方之前;已经开始输出的回合不会被重放。
|
|
210
|
+
- **不动你保存的历史**:只改这一次请求的副本。`call_id`、工具调用与结果的配对、正文、顺序、`previous_response_id` 全部保留;`item_reference`、compaction 这类带密文的项不碰。
|
|
211
|
+
- **不牵连密钥与协议**:恢复在同一个候选密钥、同一个地址、模型和协议内完成;历史类失败不会把密钥记进冷却、不算协议失败、不触发自动继续。修不好时不换密钥——每把密钥都到同一个中转池,换只是把同样的失败多试几遍。
|
|
212
|
+
- **代价很小**:只有匹配到那句拒绝时才多读一次错误体(上限 64 KiB / 2 秒),或按需多跑一至两次降级重放;正常请求一个字节都不多看。
|
|
213
|
+
|
|
214
|
+
打开后仍报同一句错,说明上游还要别的项一起换(例如 compaction 或 `previous_response_id`),插件不会盲删这些密文——换回原资源,或开一个新话题继续。
|
|
215
|
+
|
|
182
216
|
## 自动继续
|
|
183
217
|
|
|
184
218
|
会话偶尔会因为断线、超时、输出达到上限停在半路,需要手动回一句「继续」才能跑完。「高级设置」里的**自动继续**默认关闭:点击名称或箭头展开配置,右侧开关控制是否启用。
|
|
@@ -188,6 +222,7 @@ dsh plugin add .
|
|
|
188
222
|
- **失败后等待多久、最多重试几次可配置**:默认失败后等待 2 秒、连续最多重试 5 次;等待时间可设为 1–3600 秒,重试次数可设为 1–100 次。输入整数后离开输入框或按 Enter 即保存,折叠、关闭开关和刷新页面都保留设置。每次失败后都先等这么久再发送「继续」,给限流留出冷却时间;上游 `Retry-After` 更长时按上游来(最多计入 2 分钟),不会缩短你设置的更长等待。你手动发送任何消息、或模型正常跑完一个回合,计数清零;等待期间手动发送消息或关闭开关会取消待发送的继续。
|
|
189
223
|
- **只看当前会话、只认亲眼所见的结束**:页面加载时历史里已有的失败不会被补发;切到别的会话后,原会话的失败也不再追发。发送前会再次确认回合确实已结束、你没有正在排队的新消息。
|
|
190
224
|
- 自动回复以一条普通用户消息(「继续」/ "Continue")出现在对话里,与手打的没有区别;多个标签页同时开着时,同一次中断只会有一个标签页发送。
|
|
225
|
+
- **输入框下方有本会话的控制器**:会话统计栏最右侧(`◔ 10%` 右边)只在自动继续进行中显示一枚胶囊,形如「第 2/5 次 · 21s」并带「停止」;点开可「立即继续 / 停止 / 设置…」。**会话里的操作只作用于本会话**:「停止」结束这条链并让胶囊消失,你在本会话再发一条消息后才会重新接管、且从第 1/5 次重新计数;自动继续正常跑完也会立刻收起,不留常驻条。全局开关与等待/次数/错误类型仍在设置页。详见 [docs/auto-continue-error-policy](docs/auto-continue-error-policy/README.md)。
|
|
191
226
|
|
|
192
227
|
## 数据文件
|
|
193
228
|
|
|
@@ -199,6 +234,10 @@ dsh plugin add .
|
|
|
199
234
|
| `key-index.json.history/` | 上面那份元数据的自动快照,最多 64 份 |
|
|
200
235
|
| `key-serves.json` | 自动探测得到的「哪把密钥能服务哪个模型」,只用于排序与提示 |
|
|
201
236
|
| `ui-order.json` | 供应商与模型的顺序、启用开关,供多机同步;不含任何秘密 |
|
|
237
|
+
| `camouflage.json` | 每个路由的请求伪装身份;只记开着的那几条 |
|
|
238
|
+
| `topic-recovery.json` | 每个路由是否启用旧话题恢复;只记开着的那几条 |
|
|
239
|
+
|
|
240
|
+
`camouflage.json` 和 `topic-recovery.json` 只有路由名与开关,没有秘密,也已在包的 `dsh.webdavSync.configFiles` 里声明,启用 dsh-webdav 的「已安装插件」后会随插件配置同步。文件名刻意不带 `history`:同步层把 `history` 段当会话历史,带这个词的文件一律不带走。旧版写下的 `history-compat.json` 不会被丢,第一次读取时自动迁移成 `topic-recovery.json`。
|
|
202
241
|
|
|
203
242
|
`ui-order.json` 的同步规则:页面上的实时状态在 localStorage,插件在后台防抖写这个文件,按「最后写入者胜」与本地状态对齐(文件更新就采纳文件,本地更新就回写文件)。采纳文件里的停用集合时会**写回 localStorage**,所以刷新、重开浏览器之后仍是文件那一份,不会出现「这台机器看着同步好了、一刷新又变回去并把它推回文件」。每次改动拿到严格递增的时间戳,重启后同一毫秒内的多次改动也不会互相覆盖;文件比本页新时立即采纳,本页时间戳不更新时**拒绝写入**(服务器回 409 并把赢得的那份带回来),旧标签页不会把别人的新顺序回滚。页面每分钟、以及切回标签页/窗口获得焦点时重新拉取一次,另一台电脑的改动不用重启就能出现。文件里只有供应商路由、模型 id 和停用名单,不含任何密钥,可以放心交给同步盘。
|
|
204
243
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The camouflage document: which client identity each provider route asks the
|
|
3
|
+
* wire to present.
|
|
4
|
+
*
|
|
5
|
+
* It lives in the plugin's own home directory rather than in the pi-ai profile
|
|
6
|
+
* for the same reason the key index does: the official add-provider card writes
|
|
7
|
+
* the WHOLE profile at `providers.<route>`, so a field the official schema does
|
|
8
|
+
* not know would be dropped by the first save. It also keeps the identity out of
|
|
9
|
+
* the user's `headers` dictionary — a preset expands into several headers, and
|
|
10
|
+
* unfolding them into the user's own list would make "turn it off" a manual
|
|
11
|
+
* cleanup instead of one switch.
|
|
12
|
+
*
|
|
13
|
+
* The document holds no secrets: route names and one of two preset names. It is
|
|
14
|
+
* parsed leniently (an unreadable file means "nothing camouflaged") and written
|
|
15
|
+
* atomically, like the key index and the UI order.
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-model-think-level/camouflage-store
|
|
18
|
+
*/
|
|
19
|
+
import { type CamouflagePreset } from './camouflage.js';
|
|
20
|
+
/** The whole stored document. */
|
|
21
|
+
export interface CamouflageDocument {
|
|
22
|
+
/** Schema version; a future shape can migrate by reading this. */
|
|
23
|
+
readonly version: 1;
|
|
24
|
+
/** Route → the identity its requests present. Absent means "as sent". */
|
|
25
|
+
readonly providers: Readonly<Record<string, CamouflagePreset>>;
|
|
26
|
+
}
|
|
27
|
+
/** A fresh, empty document. */
|
|
28
|
+
export declare function emptyCamouflage(): CamouflageDocument;
|
|
29
|
+
/** Absolute path of the document beside the key index. */
|
|
30
|
+
export declare function camouflageFilePath(home?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Parse an already-decoded document. Never throws and never trusts the input:
|
|
33
|
+
* an entry with an unknown preset is dropped, so a file written by a newer
|
|
34
|
+
* build costs only the settings this build cannot express.
|
|
35
|
+
* @param raw - the decoded JSON value (or anything else).
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseCamouflage(raw: unknown): CamouflageDocument;
|
|
38
|
+
/** Read the document. Never throws; an absent file means "nothing stored". */
|
|
39
|
+
export declare function readCamouflage(file?: string): CamouflageDocument;
|
|
40
|
+
/** Write the document at one path, atomically. */
|
|
41
|
+
export declare function writeCamouflage(document: CamouflageDocument, file?: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Set or clear one route's identity.
|
|
44
|
+
*
|
|
45
|
+
* `undefined` removes the entry rather than storing "off": the document then
|
|
46
|
+
* says exactly what it means, and a route deleted and re-created cannot inherit
|
|
47
|
+
* a stale identity.
|
|
48
|
+
* @param route - the provider route key.
|
|
49
|
+
* @param preset - the identity, or undefined to clear it.
|
|
50
|
+
* @param file - document path (tests pass a temp file).
|
|
51
|
+
* @returns the document as it now stands on disk.
|
|
52
|
+
*/
|
|
53
|
+
export declare function setRouteCamouflage(route: string, preset: CamouflagePreset | undefined, file?: string): CamouflageDocument;
|
|
54
|
+
/** One route's stored identity, never resolving through Object.prototype. */
|
|
55
|
+
export declare function camouflageOf(document: CamouflageDocument, route: string): CamouflagePreset | undefined;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request camouflage: the client identities a provider account may demand on
|
|
3
|
+
* the wire, and the exact headers/bodies that make a request look like the
|
|
4
|
+
* official CLI of that vendor.
|
|
5
|
+
*
|
|
6
|
+
* This module is deliberately pure: it owns no storage, no fetch wrapper and
|
|
7
|
+
* no settings document. The host reads the per-route choice from the plugin's
|
|
8
|
+
* own file (`camouflage-store.ts`), folds it into the header index as
|
|
9
|
+
* `HeaderOverride.camouflage`, and the two request seams
|
|
10
|
+
* (`headers-fetch.ts` for the wire headers and body, `headers-pi-ai.ts` for a
|
|
11
|
+
* protocol switch) call into the planners here.
|
|
12
|
+
*
|
|
13
|
+
* The two identities are modelled on what gateway projects actually check, not
|
|
14
|
+
* on what a browser can spoof:
|
|
15
|
+
*
|
|
16
|
+
* - `codex` — an OpenAI Codex CLI. The checks seen in the wild accept a
|
|
17
|
+
* `codex_cli_rs/...` user agent OR an `originator: codex_cli_rs` header, and
|
|
18
|
+
* then require at least one `x-codex-*` header to be present. The identity
|
|
19
|
+
* therefore ships all three: the agent string, the originator, and a session
|
|
20
|
+
* header carrying a stable per-process id.
|
|
21
|
+
* - `claude` — a Claude Code CLI. The checks require a
|
|
22
|
+
* `claude-cli/<major>.<minor>.<patch>` user agent, a non-empty `x-app`,
|
|
23
|
+
* `anthropic-beta` and `anthropic-version`, a Claude Code system block in the
|
|
24
|
+
* Messages body, and a parseable `metadata.user_id`. The planner supplies
|
|
25
|
+
* every one of those; `anthropic-version` is normally already set by the
|
|
26
|
+
* SDK and is only filled in when absent.
|
|
27
|
+
*
|
|
28
|
+
* Nothing here fabricates an OAuth token, an account id or a billing header:
|
|
29
|
+
* a fake credential is a different failure mode (a hard 401) and is not what
|
|
30
|
+
* these gates ask for. Camouflage only changes the CLIENT identity.
|
|
31
|
+
*
|
|
32
|
+
* @module dsh-model-think-level/camouflage
|
|
33
|
+
*/
|
|
34
|
+
/** The identities a provider editor may pick. */
|
|
35
|
+
export type CamouflagePreset = 'codex' | 'claude';
|
|
36
|
+
/** Every preset, in the order the editor lists them. */
|
|
37
|
+
export declare const CAMOUFLAGE_PRESETS: readonly CamouflagePreset[];
|
|
38
|
+
/** Whether a stored/downloaded value names a preset this build understands. */
|
|
39
|
+
export declare function isCamouflagePreset(value: unknown): value is CamouflagePreset;
|
|
40
|
+
/** A preset's display name, in the product's own words (the GUI translates). */
|
|
41
|
+
export declare const CAMOUFLAGE_LABEL: Readonly<Record<CamouflagePreset, string>>;
|
|
42
|
+
/** The `user-agent` a preset puts on the wire. */
|
|
43
|
+
export declare function camouflageUserAgent(preset: CamouflagePreset): string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether a URL speaks the Anthropic Messages wire, which is the only body
|
|
46
|
+
* shape the Claude identity patches. Path matching (not the route's declared
|
|
47
|
+
* protocol) is used because a key may switch the wire under a route.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isAnthropicMessagesUrl(url: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The headers a preset adds, as a plain record. Names are lower-case because
|
|
52
|
+
* `Headers` normalises them anyway and the index comparisons are name-based.
|
|
53
|
+
*
|
|
54
|
+
* A value already present on the request is only replaced for the identity's
|
|
55
|
+
* OWN marker headers; see {@link applyCamouflageHeaders}.
|
|
56
|
+
*/
|
|
57
|
+
export declare function camouflageHeaders(preset: CamouflagePreset): Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Apply a preset's headers to a request. The identity's own markers are forced
|
|
60
|
+
* (a leftover `user-agent` from a generic SDK is exactly what the gate rejects);
|
|
61
|
+
* `anthropic-version` is only filled in when absent, because the SDK's value is
|
|
62
|
+
* the protocol's own and newer than what this module could safely hard-code.
|
|
63
|
+
*
|
|
64
|
+
* @returns whether anything was written (the wrapper's cheap "no patch" test).
|
|
65
|
+
*/
|
|
66
|
+
export declare function applyCamouflageHeaders(headers: Headers, preset: CamouflagePreset): boolean;
|
|
67
|
+
/** The Claude Code identity block the Messages gate looks for. */
|
|
68
|
+
export declare const CLAUDE_CODE_SYSTEM_TEXT = "You are Claude Code, Anthropic's CLI for Claude.";
|
|
69
|
+
/**
|
|
70
|
+
* Build the `metadata.user_id` a Claude Code client sends.
|
|
71
|
+
*
|
|
72
|
+
* The shape is `user_<device>_account_<account>_session_<session>`; the gate
|
|
73
|
+
* only requires `device_id` and `session_id` to be present, so the account
|
|
74
|
+
* segment is a stable placeholder rather than a fabricated account.
|
|
75
|
+
*/
|
|
76
|
+
export declare function camouflageClaudeUserId(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Patch one JSON request body for a preset. Returns `undefined` when the body
|
|
79
|
+
* needs no change (or is not a JSON object), so callers can keep the original
|
|
80
|
+
* text and its identity.
|
|
81
|
+
*
|
|
82
|
+
* The Claude patch is the minimum the Messages gate reads: the identity system
|
|
83
|
+
* block (prepended, keeping the caller's own blocks intact) and a parseable
|
|
84
|
+
* `metadata.user_id`. Tools, images, signatures and thinking blocks are never
|
|
85
|
+
* touched — corrupting them would break the agent loop the request belongs to.
|
|
86
|
+
*
|
|
87
|
+
* @param text - the request body, already decoded as UTF-8.
|
|
88
|
+
* @param preset - the selected identity.
|
|
89
|
+
* @param url - the request URL, used to decide whether this is a Messages body.
|
|
90
|
+
*/
|
|
91
|
+
export declare function patchCamouflageBody(text: string, preset: CamouflagePreset, url: string): string | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The advanced-configuration pane of one provider card, assembled.
|
|
3
|
+
*
|
|
4
|
+
* The pane is one form over three sections — the request headers, how the route
|
|
5
|
+
* presents itself, and whether it recovers old Responses topics — and ends in
|
|
6
|
+
* ONE commit row under all three. Splitting the sections into separate
|
|
7
|
+
* components with separate commit rows would have made the pane read as several
|
|
8
|
+
* forms and put a 保存 between them, which is exactly the shape that was wrong:
|
|
9
|
+
* a Save above a section looked like a Save for the headers alone, and the
|
|
10
|
+
* sections below it looked left out of the form.
|
|
11
|
+
*
|
|
12
|
+
* So this component owns what the sections share: the disguise and
|
|
13
|
+
* history-compatibility drafts live here, the header editor renders them as
|
|
14
|
+
* {@link CamouflageEditor} and {@link HistoryCompatEditor} through its `extras`
|
|
15
|
+
* seat, and the editor's own Save commits all of them. A switch clicked and
|
|
16
|
+
* then abandoned with 取消 therefore leaves nothing behind.
|
|
17
|
+
*
|
|
18
|
+
* @module dsh-model-think-level/client/AdvancedPane
|
|
19
|
+
*/
|
|
20
|
+
import type { ReactNode } from 'react';
|
|
21
|
+
import type { RemoteApi } from './types.js';
|
|
22
|
+
/** Props of {@link AdvancedPane}. */
|
|
23
|
+
export interface AdvancedPaneProps {
|
|
24
|
+
/** The provider route this card edits. */
|
|
25
|
+
route: string;
|
|
26
|
+
/** The write seam for the header section. */
|
|
27
|
+
api: RemoteApi;
|
|
28
|
+
/** Localized copy. */
|
|
29
|
+
t: (key: string, params?: Record<string, string | number>) => string;
|
|
30
|
+
/** Close the whole card, as the official footer's 取消 does. */
|
|
31
|
+
onDismiss?: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Render the pane: headers, then the disguise, then the single commit row.
|
|
35
|
+
* @param props - route identity, write seam, copy and the card dismiss seam.
|
|
36
|
+
* @returns the pane.
|
|
37
|
+
*/
|
|
38
|
+
export declare function AdvancedPane({ route, api, t, onDismiss }: AdvancedPaneProps): ReactNode;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-session auto-continue controller.
|
|
3
|
+
*
|
|
4
|
+
* A small chip that lives on the composer's stat line — the row that already
|
|
5
|
+
* carries 「5 轮 · 185 步 · 115 tok/s」 and the context meter — and is inserted
|
|
6
|
+
* right of the context pill. It exists ONLY while a continue chain is running:
|
|
7
|
+
*
|
|
8
|
+
* waiting → `第 2/5 次 · 21s`, countdown, 停止 available
|
|
9
|
+
* sent → `已发送「继续」 第 2/5 次`
|
|
10
|
+
* exhausted → `连续 5 次后停手`, 重置 available
|
|
11
|
+
* idle → nothing at all (the chip unmounts, the slot stays empty)
|
|
12
|
+
*
|
|
13
|
+
* Every action is scoped to the CURRENT session: 「停止」 ends this chain and
|
|
14
|
+
* mutes the session until the user posts again; the global switch and the
|
|
15
|
+
* policy live in the settings pane, which 「设置…」 opens.
|
|
16
|
+
*
|
|
17
|
+
* Mounting is a foreign React root appended to the host's stat line. React owns
|
|
18
|
+
* that line, so a re-render removes unknown children; a MutationObserver plus a
|
|
19
|
+
* slow tick put the slot back (idempotent, and throttled so streaming cannot
|
|
20
|
+
* turn into a render storm).
|
|
21
|
+
*
|
|
22
|
+
* @module dsh-model-think-level/client/AutoContinueController
|
|
23
|
+
*/
|
|
24
|
+
import type { AutoContinueRunner } from './injection/auto-continue-run.js';
|
|
25
|
+
type Translate = (key: string, params?: Record<string, unknown>) => string;
|
|
26
|
+
/** What {@link mountAutoContinueController} needs. */
|
|
27
|
+
export interface AutoContinueControllerDeps {
|
|
28
|
+
runner: AutoContinueRunner;
|
|
29
|
+
t: Translate;
|
|
30
|
+
/** Open the settings pane (the auto-continue card lives there). */
|
|
31
|
+
onSettings: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Mount the chip on the composer stat line and keep it there.
|
|
35
|
+
* @returns a disposer that unmounts the root and stops observing.
|
|
36
|
+
*/
|
|
37
|
+
export declare function mountAutoContinueController(deps: AutoContinueControllerDeps): () => void;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The request-camouflage section of a provider's advanced configuration.
|
|
3
|
+
*
|
|
4
|
+
* It is a SECTION of the advanced pane, not a second card: it renders inside
|
|
5
|
+
* the request-header section's own container (`HeadersEditor` takes it as
|
|
6
|
+
* `extras`), below the header table and above the pane's single commit row, and
|
|
7
|
+
* separates itself from the headers with the same hairline the host draws
|
|
8
|
+
* between card sections. That is also what puts the pane's 取消/保存 under BOTH
|
|
9
|
+
* sections, which is the shape the pane was supposed to have: one form, one
|
|
10
|
+
* commit row.
|
|
11
|
+
*
|
|
12
|
+
* The choice is a DRAFT until the pane's Save runs. This module therefore only
|
|
13
|
+
* renders the switch; {@link useCamouflage} holds the draft, reads the stored
|
|
14
|
+
* value and commits it, and the pane wires the commit into its own Save. A
|
|
15
|
+
* preset that is clicked and then abandoned with 取消 never reaches the host.
|
|
16
|
+
*
|
|
17
|
+
* The create-provider card has no commit row of its own (its 保存 is the
|
|
18
|
+
* official one that declares the route), so it uses {@link CamouflageField}:
|
|
19
|
+
* the same switch, committed as soon as it is chosen — inert until the route
|
|
20
|
+
* exists, which is exactly the moment that card's 保存 creates it.
|
|
21
|
+
*
|
|
22
|
+
* @module dsh-model-think-level/client/CamouflageEditor
|
|
23
|
+
*/
|
|
24
|
+
import { type ReactNode } from 'react';
|
|
25
|
+
/** One identity the host understands. Kept in step with `camouflage.ts`. */
|
|
26
|
+
type CamouflagePreset = 'codex' | 'claude';
|
|
27
|
+
/** The switch's copy, as the host slot hands it down. */
|
|
28
|
+
type Copy = (key: string, params?: Record<string, string | number>) => string;
|
|
29
|
+
/** Everything the switch needs to paint: no reads, no writes. */
|
|
30
|
+
export interface CamouflageEditorProps {
|
|
31
|
+
/** Localized copy. */
|
|
32
|
+
t: Copy;
|
|
33
|
+
/** The draft the pane currently holds; `undefined` is 关闭. */
|
|
34
|
+
value: CamouflagePreset | undefined;
|
|
35
|
+
/** Whether this build's request seams are in place. */
|
|
36
|
+
installed: boolean;
|
|
37
|
+
/** Disable the options (the stored value is still being read). */
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/** Report a choice; the pane decides when it is written. */
|
|
40
|
+
onChange: (next: CamouflagePreset | undefined) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Render the disguise switch.
|
|
44
|
+
*
|
|
45
|
+
* Presentational on purpose: the pane's Save owns the write, so a click here
|
|
46
|
+
* changes what the form holds and nothing else.
|
|
47
|
+
* @param props - draft value, availability and the change sink.
|
|
48
|
+
* @returns the section.
|
|
49
|
+
*/
|
|
50
|
+
export declare function CamouflageEditor({ t, value, installed, disabled, onChange }: CamouflageEditorProps): ReactNode;
|
|
51
|
+
/** The draft one route's pane holds, plus the two seams the pane drives. */
|
|
52
|
+
export interface CamouflageDraft {
|
|
53
|
+
/** The value on screen — the draft, not necessarily the stored one. */
|
|
54
|
+
value: CamouflagePreset | undefined;
|
|
55
|
+
/** The value the host currently has, i.e. what 取消 restores. */
|
|
56
|
+
saved: CamouflagePreset | undefined;
|
|
57
|
+
/** Whether this build's request seams are in place. */
|
|
58
|
+
installed: boolean;
|
|
59
|
+
/** Whether the stored value is still being read. */
|
|
60
|
+
loading: boolean;
|
|
61
|
+
/** Replace the draft. Writes nothing. */
|
|
62
|
+
setValue: (next: CamouflagePreset | undefined) => void;
|
|
63
|
+
/** Restore the stored value (the pane's 取消). */
|
|
64
|
+
reset: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* Write the draft, if it differs from the stored value.
|
|
67
|
+
*
|
|
68
|
+
* Rejects when the host route could not be reached, so the pane can keep
|
|
69
|
+
* itself open instead of dismissing over a write that did not happen.
|
|
70
|
+
* @param next - the value to write instead of the one on screen (an
|
|
71
|
+
* immediate-mode caller passes its own choice: state updates are async).
|
|
72
|
+
*/
|
|
73
|
+
commit: (next?: {
|
|
74
|
+
preset: CamouflagePreset | undefined;
|
|
75
|
+
}) => Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Read, hold and commit one route's disguise.
|
|
79
|
+
*
|
|
80
|
+
* The stored value is read once per route and seeds the draft; nothing is
|
|
81
|
+
* written until {@link CamouflageDraft.commit} runs.
|
|
82
|
+
* @param route - the provider route this pane edits.
|
|
83
|
+
* @param t - localized copy (for the error the caller renders).
|
|
84
|
+
* @returns the draft and its seams.
|
|
85
|
+
*/
|
|
86
|
+
export declare function useCamouflage(route: string, t: Copy): CamouflageDraft;
|
|
87
|
+
/**
|
|
88
|
+
* The create-provider card's copy of the section: the same switch, committed
|
|
89
|
+
* on click.
|
|
90
|
+
*
|
|
91
|
+
* That card has no commit row — the official 保存 declares the route the
|
|
92
|
+
* disguise is addressed to — so holding a draft here would have nothing to
|
|
93
|
+
* release it. The write is inert until that route exists, so choosing here and
|
|
94
|
+
* saving the card is still the one moment the identity starts being sent.
|
|
95
|
+
*/
|
|
96
|
+
export declare function CamouflageField({ route, t }: {
|
|
97
|
+
route: string;
|
|
98
|
+
t: Copy;
|
|
99
|
+
}): ReactNode;
|
|
100
|
+
export {};
|
|
@@ -31,11 +31,19 @@ export declare function ImageGenCard(props: {
|
|
|
31
31
|
}): ReactNode;
|
|
32
32
|
/**
|
|
33
33
|
* The 「自动继续」 card: one folded settings entry with a quiet summary.
|
|
34
|
-
* The expanded card
|
|
34
|
+
* The expanded card holds the timing controls and the trigger conditions.
|
|
35
35
|
*/
|
|
36
36
|
export declare function AutoContinueCard(props: {
|
|
37
37
|
t: (key: string, params?: Record<string, unknown>) => string;
|
|
38
38
|
}): ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* The 「失败详情」 card: the switch that decides whether a failed turn grows the
|
|
41
|
+
* 「查看详情」 seat. Default ON — the seat only ever ADDS information, so the
|
|
42
|
+
* off state is the exception, and the folded body says what it adds.
|
|
43
|
+
*/
|
|
44
|
+
export declare function ErrorDetailCard(props: {
|
|
45
|
+
t: (key: string, params?: Record<string, unknown>) => string;
|
|
46
|
+
}): ReactNode;
|
|
39
47
|
/**
|
|
40
48
|
* The floating pane. Exported for tests: render it inside a chosen container.
|
|
41
49
|
*/
|
|
@@ -102,6 +102,26 @@ export interface HeadersEditorProps {
|
|
|
102
102
|
* which is the write that declares the route the draft is addressed to.
|
|
103
103
|
*/
|
|
104
104
|
deferred?: DeferredHeaders;
|
|
105
|
+
/**
|
|
106
|
+
* Further sections of this pane, rendered above the commit row.
|
|
107
|
+
*
|
|
108
|
+
* The pane is the route's whole advanced configuration, not just headers:
|
|
109
|
+
* these render after the header table, inside the same section container, so
|
|
110
|
+
* the pane keeps ONE commit row and that row sits under every section. A
|
|
111
|
+
* sibling section rendered outside would need a commit row of its own, and
|
|
112
|
+
* two rows would make the pane read as two forms.
|
|
113
|
+
*/
|
|
114
|
+
extras?: ReactNode;
|
|
115
|
+
/**
|
|
116
|
+
* Commit the extras' draft as part of this pane's Save.
|
|
117
|
+
*
|
|
118
|
+
* Runs after the header write, before the card is dismissed. Rejecting keeps
|
|
119
|
+
* the pane open and reports an error: a dismissal over a write that did not
|
|
120
|
+
* happen would present the old state as the saved one.
|
|
121
|
+
*/
|
|
122
|
+
onCommitExtras?: () => Promise<void>;
|
|
123
|
+
/** Drop the extras' draft (this pane's 取消). */
|
|
124
|
+
onResetExtras?: () => void;
|
|
105
125
|
}
|
|
106
126
|
/** One editable header row; a stable `id` keeps React keys off the name. */
|
|
107
127
|
interface DraftRow {
|
|
@@ -117,10 +137,23 @@ interface Draft {
|
|
|
117
137
|
}
|
|
118
138
|
/** The headers dict a draft stores: blank names are dropped. */
|
|
119
139
|
export declare function headersFromDraft(draft: Draft): Record<string, string>;
|
|
140
|
+
/**
|
|
141
|
+
* Whether a save would store exactly what is already stored.
|
|
142
|
+
*
|
|
143
|
+
* The section's save button commits the pane's other sections too, so it fires
|
|
144
|
+
* on saves that never touch these headers. Telling those apart is what lets
|
|
145
|
+
* {@link HeadersEditor} skip a settings write — and the full document rewrite,
|
|
146
|
+
* revision fence and list reload behind it — instead of repeating it to store
|
|
147
|
+
* the same values.
|
|
148
|
+
* @param stored - the headers the route carries now.
|
|
149
|
+
* @param next - the headers the draft would store.
|
|
150
|
+
* @returns true when both hold the same names and the same values.
|
|
151
|
+
*/
|
|
152
|
+
export declare function sameHeaders(stored: Record<string, string> | undefined, next: Record<string, string>): boolean;
|
|
120
153
|
/**
|
|
121
154
|
* Render the provider card's request-header section.
|
|
122
155
|
* @param props - route identity, write seam, copy and the card dismiss seam.
|
|
123
156
|
* @returns the section.
|
|
124
157
|
*/
|
|
125
|
-
export declare function HeadersEditor({ route, api, t, onDismiss, deferred }: HeadersEditorProps): ReactNode;
|
|
158
|
+
export declare function HeadersEditor({ route, api, t, onDismiss, deferred, extras, onCommitExtras, onResetExtras, }: HeadersEditorProps): ReactNode;
|
|
126
159
|
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Responses history-compatibility section of a provider's advanced
|
|
3
|
+
* configuration.
|
|
4
|
+
*
|
|
5
|
+
* It is a SECTION of the advanced pane, like the disguise switch: it renders
|
|
6
|
+
* inside the request-header section's container, below the headers table, and
|
|
7
|
+
* shares the pane's single commit row — a switch clicked and then abandoned
|
|
8
|
+
* with 取消 never reaches the host.
|
|
9
|
+
*
|
|
10
|
+
* The switch exists because a relay may answer a continued conversation with
|
|
11
|
+
* `The requested item was created under a different Azure OpenAI resource`
|
|
12
|
+
* whenever its upstream pool moved the topic to another account. Recovery
|
|
13
|
+
* replays the request with the foreign-looking parts of the history removed,
|
|
14
|
+
* which is why it is opt-in per route: it costs extra upstream calls, and only
|
|
15
|
+
* on a refusal that is worth them.
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-model-think-level/client/HistoryCompatEditor
|
|
18
|
+
*/
|
|
19
|
+
import { type ReactNode } from 'react';
|
|
20
|
+
/** The switch's copy, as the host slot hands it down. */
|
|
21
|
+
type Copy = (key: string, params?: Record<string, string | number>) => string;
|
|
22
|
+
/** Everything the switch needs to paint: no reads, no writes. */
|
|
23
|
+
export interface HistoryCompatEditorProps {
|
|
24
|
+
/** Localized copy. */
|
|
25
|
+
t: Copy;
|
|
26
|
+
/** The draft the pane currently holds. */
|
|
27
|
+
value: boolean;
|
|
28
|
+
/** Whether this build's request seams are in place. */
|
|
29
|
+
installed: boolean;
|
|
30
|
+
/** Disable the options (the stored value is still being read). */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Report a choice; the pane decides when it is written. */
|
|
33
|
+
onChange: (next: boolean) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Render the history-compatibility switch.
|
|
37
|
+
* @param props - draft value, availability and the change sink.
|
|
38
|
+
* @returns the section.
|
|
39
|
+
*/
|
|
40
|
+
export declare function HistoryCompatEditor({ t, value, installed, disabled, onChange }: HistoryCompatEditorProps): ReactNode;
|
|
41
|
+
/** The draft one route's pane holds, plus the two seams the pane drives. */
|
|
42
|
+
export interface HistoryCompatDraft {
|
|
43
|
+
/** The value on screen — the draft, not necessarily the stored one. */
|
|
44
|
+
value: boolean;
|
|
45
|
+
/** The value the host currently has, i.e. what 取消 restores. */
|
|
46
|
+
saved: boolean;
|
|
47
|
+
/** Whether this build's request seams are in place. */
|
|
48
|
+
installed: boolean;
|
|
49
|
+
/** Whether the stored value is still being read. */
|
|
50
|
+
loading: boolean;
|
|
51
|
+
/** Replace the draft. Writes nothing. */
|
|
52
|
+
setValue: (next: boolean) => void;
|
|
53
|
+
/** Restore the stored value (the pane's 取消). */
|
|
54
|
+
reset: () => void;
|
|
55
|
+
/** Write the draft, if it differs from the stored value. */
|
|
56
|
+
commit: () => Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Read, hold and commit one route's history-compatibility switch.
|
|
60
|
+
*
|
|
61
|
+
* The stored value is read once per route and seeds the draft; nothing is
|
|
62
|
+
* written until {@link HistoryCompatDraft.commit} runs.
|
|
63
|
+
* @param route - the provider route this pane edits.
|
|
64
|
+
* @returns the draft and its seams.
|
|
65
|
+
*/
|
|
66
|
+
export declare function useHistoryCompat(route: string): HistoryCompatDraft;
|
|
67
|
+
export {};
|
|
@@ -9,14 +9,17 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module dsh-model-think-level/client/auto-continue-pref
|
|
11
11
|
*/
|
|
12
|
+
import { type AutoContinuePolicy } from './auto-continue-rules.js';
|
|
12
13
|
/** localStorage key (own namespace, same convention as the slider pref). */
|
|
13
14
|
export declare const AUTO_CONTINUE_PREF_KEY = "dsh-model-think-level.auto-continue.enabled";
|
|
14
|
-
/** Timing and
|
|
15
|
+
/** Timing, retry limit and interruption policy, independent of the enable switch. */
|
|
15
16
|
export declare const AUTO_CONTINUE_CONFIG_KEY = "dsh-model-think-level.auto-continue.config";
|
|
16
17
|
/** Bounded, whole-number settings exposed by the advanced-config card. */
|
|
17
18
|
export interface AutoContinueConfig {
|
|
18
19
|
readonly waitSeconds: number;
|
|
19
20
|
readonly maxRetries: number;
|
|
21
|
+
/** Which interruption classes are answered with 「继续」. */
|
|
22
|
+
readonly policy: AutoContinuePolicy;
|
|
20
23
|
}
|
|
21
24
|
export declare const AUTO_CONTINUE_WAIT_MIN = 1;
|
|
22
25
|
export declare const AUTO_CONTINUE_WAIT_MAX = 3600;
|
|
@@ -37,7 +40,7 @@ export declare function setAutoContinueEnabled(next: boolean): void;
|
|
|
37
40
|
export declare function setAutoContinueConfig(patch: Partial<AutoContinueConfig>): void;
|
|
38
41
|
/** Apply a value incoming from another tab (the writer already persisted it). */
|
|
39
42
|
export declare function syncAutoContinueEnabled(next: boolean): void;
|
|
40
|
-
export declare function syncAutoContinueConfig(next: AutoContinueConfig): void;
|
|
43
|
+
export declare function syncAutoContinueConfig(next: Partial<AutoContinueConfig>): void;
|
|
41
44
|
/** Subscribe to enable changes; returns the disposer. */
|
|
42
45
|
export declare function subscribeAutoContinueEnabled(listener: () => void): () => void;
|
|
43
46
|
/** Subscribe to timing/retry-limit changes; returns the disposer. */
|
|
@@ -60,6 +60,36 @@ export interface LlmFailureLike {
|
|
|
60
60
|
readonly status?: unknown;
|
|
61
61
|
readonly providerRetryAfterMs?: unknown;
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Failure codes that mean "wait a moment and the same request may succeed":
|
|
65
|
+
* the transient class, mirroring the harness's own retryable set.
|
|
66
|
+
*/
|
|
67
|
+
export declare const TRANSIENT_ERROR_CODES: readonly string[];
|
|
68
|
+
/**
|
|
69
|
+
* The other codes the settings card can offer. None of them is retried by
|
|
70
|
+
* default: a fresh 「继续」 re-sends the very request that produced them.
|
|
71
|
+
*/
|
|
72
|
+
export declare const OTHER_ERROR_CODES: readonly string[];
|
|
73
|
+
/** Every code the policy can carry, in the settings card's order. */
|
|
74
|
+
export declare const KNOWN_ERROR_CODES: readonly string[];
|
|
75
|
+
/**
|
|
76
|
+
* Which interrupted turns a user wants answered. Stored beside the timing
|
|
77
|
+
* config; fields an old record does not carry fall back to today's
|
|
78
|
+
* behaviour (`max-tokens`, HTTP 408/425/429/5xx, the transient codes), so
|
|
79
|
+
* upgrading never changes what an existing installation retries.
|
|
80
|
+
*/
|
|
81
|
+
export interface AutoContinuePolicy {
|
|
82
|
+
/** Continue a turn cut off by the output-token ceiling. */
|
|
83
|
+
readonly maxTokens: boolean;
|
|
84
|
+
/** Continue an `error` whose structured HTTP status is 408/425/429/5xx. */
|
|
85
|
+
readonly httpStatus: boolean;
|
|
86
|
+
/** Per-code decision; only `KNOWN_ERROR_CODES` keys are honoured. */
|
|
87
|
+
readonly codes: Readonly<Record<string, boolean>>;
|
|
88
|
+
}
|
|
89
|
+
/** The behaviour in force when no policy was ever saved. */
|
|
90
|
+
export declare const DEFAULT_AUTO_CONTINUE_POLICY: AutoContinuePolicy;
|
|
91
|
+
/** Validate an untrusted policy record, filling every missing field from the default. */
|
|
92
|
+
export declare function normalizeAutoContinuePolicy(value: unknown): AutoContinuePolicy;
|
|
63
93
|
/** What the watcher should do with one ended turn. */
|
|
64
94
|
export type TurnEndClass = {
|
|
65
95
|
/** Reply 「继续」 automatically. */
|
|
@@ -91,6 +121,8 @@ export interface TurnTail {
|
|
|
91
121
|
/**
|
|
92
122
|
* Judge one ended turn.
|
|
93
123
|
* @param tail - the final `turn/end` plus that turn's events.
|
|
124
|
+
* @param policy - which interruption classes the user wants answered
|
|
125
|
+
* (defaults to the behaviour that shipped before the policy existed).
|
|
94
126
|
* @returns what the watcher should do.
|
|
95
127
|
*/
|
|
96
|
-
export declare function judgeTurnTail(tail: TurnTail): TurnEndClass;
|
|
128
|
+
export declare function judgeTurnTail(tail: TurnTail, policy?: AutoContinuePolicy): TurnEndClass;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The failure-detail preference: whether the chat renders a 「查看详情」 seat on
|
|
3
|
+
* each official failure row. Lives in localStorage beside the other client-side
|
|
4
|
+
* switches (never settings.yaml), and defaults to ON — the whole point of the
|
|
5
|
+
* seat is to stop the client from swallowing the provider's own error.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-model-think-level/client/error-detail-pref
|
|
8
|
+
*/
|
|
9
|
+
/** localStorage key (own namespace, same convention as the slider pref). */
|
|
10
|
+
export declare const ERROR_DETAIL_PREF_KEY = "dsh-model-think-level.error-detail.enabled";
|
|
11
|
+
/** Snapshot the current preference (default ON). */
|
|
12
|
+
export declare function errorDetailEnabled(): boolean;
|
|
13
|
+
/** Save the preference (persisted immediately; a failed write keeps the session value). */
|
|
14
|
+
export declare function setErrorDetailEnabled(next: boolean): void;
|
|
15
|
+
/** Apply a value incoming from another tab (the writer already persisted it). */
|
|
16
|
+
export declare function syncErrorDetailEnabled(next: boolean): void;
|
|
17
|
+
/** Subscribe to enable/disable changes; returns the unsubscribe seam. */
|
|
18
|
+
export declare function subscribeErrorDetailEnabled(listener: () => void): () => void;
|