dsh-model-think-level 2.6.4 → 2.6.5
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 +7 -5
- package/lib/client/AutoContinueController.d.ts +7 -0
- package/lib/client/auto-continue-pref.d.ts +10 -0
- package/lib/client/auto-continue-rules.d.ts +8 -2
- package/lib/client/injection/auto-continue-ledger.d.ts +24 -0
- package/lib/client/injection/auto-continue-run.d.ts +5 -1
- package/lib/client/injection/auto-continue-runtime.d.ts +28 -0
- package/lib/client/injection/official-retry-policy.d.ts +27 -0
- package/lib/client/locales.d.ts +24 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +22 -6
- package/lib/client.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ DSH 自带的 Models 页只认得它自己目录里的模型。中转站、自
|
|
|
21
21
|
- **请求伪装** — 每个路由可选 Codex / Claude 两种官方 CLI 身份:客户端请求头,以及 Claude 的 Messages 请求体身份段一并补齐;默认关闭,与自定义请求头同一区块。
|
|
22
22
|
- **生图** — 勾一下「生图」就能把任意模型变成生图模型,对话模型调用原生工具 `generate_image` 出图,支持参考图改图、多图并出、默认参数与超时。
|
|
23
23
|
- **旧话题恢复** — 换过 Azure 资源/中转账号池的上游会拒收旧话题带来的历史项(`item`):要么说「created under a different … resource」,要么说某个历史项(`function_call` 或 `message`)缺少与它配对的那条 `reasoning`。打开后同时识别 `400` 响应体与 `200` 流内 `response.failed` 的这些拒绝,在发送副本的消息上下文里逐级去掉旧资源签发的句柄(必要时连历史推理一起),再重放这次请求,不删本地历史。
|
|
24
|
-
- **自动继续** —
|
|
24
|
+
- **自动继续** — 会话因为断线、超时、撞上输出上限停住时,替你补一条「继续」;支持退避、失败链预算和自定义错误码,区分供应商同轮重试与轮后继续。切走会话也能接管已持有的后台链。
|
|
25
25
|
- **余额** — 每个供应商可选配一个只读余额接口,模型页直接显示余额,支持手动刷新。
|
|
26
26
|
|
|
27
27
|
## 选择模型与思考等级
|
|
@@ -226,11 +226,13 @@ Item 'fc_04e5…' of type 'function_call' was provided without its required 'rea
|
|
|
226
226
|
会话偶尔会因为断线、超时、输出达到上限停在半路,需要手动回一句「继续」才能跑完。「高级设置」里的**自动继续**默认关闭:点击名称或箭头展开配置,右侧开关控制是否启用。
|
|
227
227
|
|
|
228
228
|
- **只继续「断在半路」的回合**:回合因传输错误(断线、流中断)、超时、5xx、限流、空响应而失败,或输出撞到令牌上限(`max-tokens`)时才自动发送;正常完成、你手动停止的回合、等待你审批或回答的回合一律不动。
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
229
|
+
- **修不好的错误默认不重试**:鉴权失败(401/403)、额度耗尽、请求无效(400/413)、上下文超长默认不会触发继续——再发一条「继续」通常无济于事。触发条件可以逐项修改;新增 `MODEL_SWITCH_COMPACTION_FAILED`、`CLI_TIMEOUT`、`QUOTA` 选项默认关闭。自定义错误码最多 24 个、每个 64 字符,按大小写精确匹配,添加后需单独勾选才启用;恢复推荐会移除自定义项。
|
|
230
|
+
- **有下限的退避**:默认基准等待 2 秒、连续最多继续 5 次;等待可设为 1–3600 秒,次数为 1–100 次。瞬时错误默认采用指数退避和小幅抖动,本地上限为基准等待与 120 秒的较大值;输出达到上限仍只等基准时间。上游 `Retry-After` 是不可截短的下限,即使超过 120 秒也遵守;若等待会超出失败链时限,就停止后续继续,而不是提前请求。可关闭指数退避,但仍遵守基准等待和上游下限。
|
|
231
|
+
- **失败链预算**:默认累计最多 30 分钟、已观察请求最多 36 次,可分别设为 1–1440 分钟、1–1000 次。任一预算耗尽都会停止插件继续。请求计数包含可见的模型步骤和官方重试,但旧宿主或分页历史可能缺事件,因此只是下界,**不是硬性计费上限,也不能取消官方已经发起的请求**。手动发送消息或正常结束会重置失败链;关闭开关会取消待发送的继续。输入框失焦或按 Enter 保存,折叠、关闭开关和刷新保留设置。会话预算账本最多保留 128 个会话、24 小时;浏览器存储失败时不能保证跨刷新恢复。
|
|
232
|
+
- **后台接管,有限恢复**:已持有的会话链切走后仍可继续,子智能体与后台任务保护保持不变;恢复仅考虑 24 小时内未被后续消息或新回合处理的失败,已处理的结束不会重放。本运行器已认领的待发倒计时可跨连接重置/绑定替换恢复原到期时间,不在新文档或其他标签页从持久账本重放。发送前再次确认回合已结束、没有排队的新消息,并使用跨标签页认领避免重复发送。
|
|
233
|
+
- **官方重试与插件继续分层**:控制器区分「供应商重试中」、插件倒计时、已发送与预算耗尽。供应商仍在同一轮请求中重试时,插件不会抢发「继续」。供应商配置中的官方「重试策略」入口被隐藏,但已有 `retryPolicy` 数据和官方执行器保持原样;停止自动继续只停止插件链,不代表取消官方 RPC。
|
|
232
234
|
- 自动回复以一条普通用户消息(「继续」/ "Continue")出现在对话里,与手打的没有区别;多个标签页同时开着时,同一次中断只会有一个标签页发送。
|
|
233
|
-
- **输入框下方有本会话的控制器**:会话统计栏最右侧(`◔ 10%` 右边)只在自动继续进行中显示一枚胶囊,形如「第 2/5 次 · 21s
|
|
235
|
+
- **输入框下方有本会话的控制器**:会话统计栏最右侧(`◔ 10%` 右边)只在自动继续进行中显示一枚胶囊,形如「第 2/5 次 · 21s」并带「停止」;点开可「跳过本地等待 / 停止 / 设置…」;手动跳过仍遵守上游 `Retry-After`,并受失败链预算约束。**会话里的操作只作用于本会话**:「停止」结束这条链并让胶囊消失,你在本会话再发一条消息后才会重新接管、且从第 1/5 次重新计数;自动继续正常跑完也会立刻收起,不留常驻条。全局开关与等待/次数/错误类型仍在设置页。详见 [docs/auto-continue-error-policy](docs/auto-continue-error-policy/README.md)。
|
|
234
236
|
|
|
235
237
|
## 数据文件
|
|
236
238
|
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* @module dsh-model-think-level/client/AutoContinueController
|
|
29
29
|
*/
|
|
30
|
+
import type { ReactNode } from 'react';
|
|
30
31
|
import type { AutoContinueRunner } from './injection/auto-continue-run.js';
|
|
31
32
|
type Translate = (key: string, params?: Record<string, unknown>) => string;
|
|
32
33
|
/**
|
|
@@ -43,6 +44,12 @@ type Translate = (key: string, params?: Record<string, unknown>) => string;
|
|
|
43
44
|
* @returns true when re-resolving the anchor could not move the chip.
|
|
44
45
|
*/
|
|
45
46
|
export declare function chipInPlace(host: HTMLElement | undefined, docks: ArrayLike<HTMLElement>): boolean;
|
|
47
|
+
/** The chip itself; renders nothing unless a chain is live. */
|
|
48
|
+
export declare function AutoContinueChip(props: {
|
|
49
|
+
runner: AutoContinueRunner;
|
|
50
|
+
t: Translate;
|
|
51
|
+
onSettings: () => void;
|
|
52
|
+
}): ReactNode;
|
|
46
53
|
/** What {@link mountAutoContinueController} needs. */
|
|
47
54
|
export interface AutoContinueControllerDeps {
|
|
48
55
|
runner: AutoContinueRunner;
|
|
@@ -18,6 +18,12 @@ export declare const AUTO_CONTINUE_CONFIG_KEY = "dsh-model-think-level.auto-cont
|
|
|
18
18
|
export interface AutoContinueConfig {
|
|
19
19
|
readonly waitSeconds: number;
|
|
20
20
|
readonly maxRetries: number;
|
|
21
|
+
/** Exponential backoff with jitter for error-driven continuations only. */
|
|
22
|
+
readonly backoff: boolean;
|
|
23
|
+
/** Elapsed failure-chain budget, starting at the first failure or official retry. */
|
|
24
|
+
readonly maxChainMinutes: number;
|
|
25
|
+
/** Observed request lower bound, including official retries. */
|
|
26
|
+
readonly maxRequests: number;
|
|
21
27
|
/** Which interruption classes are answered with 「继续」. */
|
|
22
28
|
readonly policy: AutoContinuePolicy;
|
|
23
29
|
}
|
|
@@ -25,6 +31,10 @@ export declare const AUTO_CONTINUE_WAIT_MIN = 1;
|
|
|
25
31
|
export declare const AUTO_CONTINUE_WAIT_MAX = 3600;
|
|
26
32
|
export declare const AUTO_CONTINUE_RETRIES_MIN = 1;
|
|
27
33
|
export declare const AUTO_CONTINUE_RETRIES_MAX = 100;
|
|
34
|
+
export declare const AUTO_CONTINUE_CHAIN_MINUTES_MIN = 1;
|
|
35
|
+
export declare const AUTO_CONTINUE_CHAIN_MINUTES_MAX = 1440;
|
|
36
|
+
export declare const AUTO_CONTINUE_REQUESTS_MIN = 1;
|
|
37
|
+
export declare const AUTO_CONTINUE_REQUESTS_MAX = 1000;
|
|
28
38
|
export declare const DEFAULT_AUTO_CONTINUE_CONFIG: AutoContinueConfig;
|
|
29
39
|
/** Validate untrusted storage/input without ever producing an unbounded timer or retry chain. */
|
|
30
40
|
export declare function normalizeAutoContinueConfig(value: unknown): AutoContinueConfig;
|
|
@@ -70,7 +70,7 @@ export declare const TRANSIENT_ERROR_CODES: readonly string[];
|
|
|
70
70
|
* default: a fresh 「继续」 re-sends the very request that produced them.
|
|
71
71
|
*/
|
|
72
72
|
export declare const OTHER_ERROR_CODES: readonly string[];
|
|
73
|
-
/**
|
|
73
|
+
/** Built-in codes in settings-card order; custom codes are bounded separately. */
|
|
74
74
|
export declare const KNOWN_ERROR_CODES: readonly string[];
|
|
75
75
|
/**
|
|
76
76
|
* Which interrupted turns a user wants answered. Stored beside the timing
|
|
@@ -83,9 +83,15 @@ export interface AutoContinuePolicy {
|
|
|
83
83
|
readonly maxTokens: boolean;
|
|
84
84
|
/** Continue an `error` whose structured HTTP status is 408/425/429/5xx. */
|
|
85
85
|
readonly httpStatus: boolean;
|
|
86
|
-
/**
|
|
86
|
+
/** Explicit per-code switch for built-in and validated, bounded custom codes. */
|
|
87
87
|
readonly codes: Readonly<Record<string, boolean>>;
|
|
88
|
+
/** Registered custom codes; adding one never enables it implicitly. */
|
|
89
|
+
readonly customCodes?: readonly string[];
|
|
88
90
|
}
|
|
91
|
+
export declare const AUTO_CONTINUE_CUSTOM_CODES_MAX = 24;
|
|
92
|
+
export declare const AUTO_CONTINUE_CUSTOM_CODE_LENGTH_MAX = 64;
|
|
93
|
+
/** Canonical validation for user-supplied, exact-match provider error codes. */
|
|
94
|
+
export declare function normalizeCustomErrorCode(value: unknown): string | undefined;
|
|
89
95
|
/** The behaviour in force when no policy was ever saved. */
|
|
90
96
|
export declare const DEFAULT_AUTO_CONTINUE_POLICY: AutoContinuePolicy;
|
|
91
97
|
/** Validate an untrusted policy record, filling every missing field from the default. */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface AutoContinueLedger {
|
|
2
|
+
readonly version: 1;
|
|
3
|
+
readonly savedAt: number;
|
|
4
|
+
readonly seq: number;
|
|
5
|
+
readonly lastUserSeq: number;
|
|
6
|
+
readonly lastHandledTurnEndSeq: number;
|
|
7
|
+
readonly consecutive: number;
|
|
8
|
+
readonly requests: number;
|
|
9
|
+
readonly startedAt?: number;
|
|
10
|
+
readonly transientFailures: number;
|
|
11
|
+
readonly reserved: boolean;
|
|
12
|
+
readonly hasInitial: boolean;
|
|
13
|
+
readonly hasStep: boolean;
|
|
14
|
+
readonly lastAutoSentAt: number;
|
|
15
|
+
readonly lastAutoSentText?: string;
|
|
16
|
+
readonly muted: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Missing/failed storage is deliberately undefined, not a zero-budget guarantee. */
|
|
19
|
+
export declare function loadAutoContinueLedger(sessionId: string, now?: number): AutoContinueLedger | undefined;
|
|
20
|
+
/** Persist one bounded session ledger; false means durability was not obtained. */
|
|
21
|
+
export declare function saveAutoContinueLedger(sessionId: string, value: Omit<AutoContinueLedger, 'version' | 'savedAt'>, now?: number): boolean;
|
|
22
|
+
export declare function clearAutoContinueLedger(sessionId: string): boolean;
|
|
23
|
+
export declare const AUTO_CONTINUE_LEDGER_TTL_MS: number;
|
|
24
|
+
export declare const AUTO_CONTINUE_LEDGER_PREFIX = "dsh-model-think-level.auto-continue.ledger.";
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
* @module dsh-model-think-level/client/injection/auto-continue-run
|
|
30
30
|
*/
|
|
31
|
+
import { type ExhaustedReason } from './auto-continue-runtime.js';
|
|
31
32
|
/** The context seats the watcher probes, lazily (services mount after boot). */
|
|
32
33
|
interface WatcherContext {
|
|
33
34
|
get?(name: string): unknown;
|
|
@@ -62,7 +63,7 @@ export interface AutoContinueRunner {
|
|
|
62
63
|
export interface AutoContinueStatus {
|
|
63
64
|
/** The watched session, undefined while nothing is open. */
|
|
64
65
|
readonly sessionId: string | undefined;
|
|
65
|
-
readonly phase: 'idle' | 'waiting' | 'sent' | 'exhausted';
|
|
66
|
+
readonly phase: 'idle' | 'waiting' | 'sent' | 'exhausted' | 'provider-retrying';
|
|
66
67
|
/** Automatic replies already sent in THIS chain. */
|
|
67
68
|
readonly consecutive: number;
|
|
68
69
|
readonly maxRetries: number;
|
|
@@ -74,6 +75,9 @@ export interface AutoContinueStatus {
|
|
|
74
75
|
readonly detail: string;
|
|
75
76
|
/** Whether the user stopped this session's chain. */
|
|
76
77
|
readonly muted: boolean;
|
|
78
|
+
readonly providerRetry?: number;
|
|
79
|
+
readonly requestCount?: number;
|
|
80
|
+
readonly exhaustedReason?: ExhaustedReason;
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
79
83
|
* Build the watcher. The poll runs for the fiber's whole life (memory-only
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DurableEventLike } from '../auto-continue-rules.js';
|
|
2
|
+
export type ExhaustedReason = 'attempts' | 'requests' | 'duration';
|
|
3
|
+
/** Constant-space visible-history ledger. Paged-out events and old hosts without
|
|
4
|
+
* retry events cannot reveal all requests; counts are a lower bound. Never
|
|
5
|
+
* synthesize session events or imply this ledger can stop host-owned requests. */
|
|
6
|
+
export interface ChainBudget {
|
|
7
|
+
seq: number;
|
|
8
|
+
requests: number;
|
|
9
|
+
startedAt: number | undefined;
|
|
10
|
+
transientFailures: number;
|
|
11
|
+
hasInitial: boolean;
|
|
12
|
+
hasStep: boolean;
|
|
13
|
+
reserved: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function newChainBudget(seq?: number): ChainBudget;
|
|
16
|
+
export declare function observeRequest(b: ChainBudget, e: DurableEventLike, now: number): void;
|
|
17
|
+
export declare function budgetReason(b: ChainBudget, config: {
|
|
18
|
+
maxRetries: number;
|
|
19
|
+
maxRequests?: number;
|
|
20
|
+
maxChainMinutes?: number;
|
|
21
|
+
}, attempts: number, now: number): ExhaustedReason | undefined;
|
|
22
|
+
export declare function retryDelay(base: number, failures: number, backoff: boolean, retryAfter: number | undefined, random: number): number;
|
|
23
|
+
/** Inspect only the latest unfinished turn; a settled historical retry is silent. */
|
|
24
|
+
export declare function providerRetryOf(events: readonly DurableEventLike[], running: boolean): {
|
|
25
|
+
retry: number;
|
|
26
|
+
nextSendAt: number;
|
|
27
|
+
waitMs: number;
|
|
28
|
+
} | undefined;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI-only adapter for the official provider RetryPolicyEditor. No settings,
|
|
3
|
+
* values, events, or runtime retry behavior are changed.
|
|
4
|
+
*
|
|
5
|
+
* Compatibility boundary: inspected dsh-client-ui-settings-models 0.2.2-rc.3.
|
|
6
|
+
* Its public slots expose provider-card extensions, not field visibility, so
|
|
7
|
+
* this adapter uses the existing Models-page CSS-module stem convention plus
|
|
8
|
+
* RetryPolicyEditor's specific failure-id/ARIA and mode-select structure.
|
|
9
|
+
* This is a DOM coupling, not a public API: unfamiliar forms are left alone.
|
|
10
|
+
*/
|
|
11
|
+
interface DisplaySnapshot {
|
|
12
|
+
value: string;
|
|
13
|
+
priority: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OfficialRetryPolicyState {
|
|
16
|
+
/** Strong references also allow restoration of detached/reused host nodes. */
|
|
17
|
+
readonly hidden: Map<HTMLElement, DisplaySnapshot>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createOfficialRetryPolicyState(): OfficialRetryPolicyState;
|
|
20
|
+
/** Match the full official form/field structure, never translated text. */
|
|
21
|
+
export declare function isOfficialRetryPolicyGroup(group: HTMLElement): boolean;
|
|
22
|
+
/** Hide all mounted official forms, including both halves of an add card. */
|
|
23
|
+
export declare function reconcileOfficialRetryPolicy(root: HTMLElement, state: OfficialRetryPolicyState): void;
|
|
24
|
+
/** Restore the exact prior inline display, also for detached nodes. */
|
|
25
|
+
export declare function teardownOfficialRetryPolicy(state: OfficialRetryPolicyState): void;
|
|
26
|
+
export declare const OFFICIAL_RETRY_POLICY_HIDDEN_ATTR = "data-bre-retry-policy-hidden";
|
|
27
|
+
export {};
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -309,10 +309,34 @@ export declare const en: {
|
|
|
309
309
|
autoContinueWhyUNSUPPORTED_REASONING_EFFORT: string;
|
|
310
310
|
autoContinueWhyMALFORMED_RESPONSE: string;
|
|
311
311
|
autoContinueWhyUNKNOWN_MODEL: string;
|
|
312
|
+
autoContinueWhyMODEL_SWITCH_COMPACTION_FAILED: string;
|
|
313
|
+
autoContinueWhyCLI_TIMEOUT: string;
|
|
314
|
+
autoContinueWhyQUOTA: string;
|
|
315
|
+
autoContinueBackoffLabel: string;
|
|
316
|
+
autoContinueBackoffHint: string;
|
|
317
|
+
autoContinueChainMinutesLabel: string;
|
|
318
|
+
autoContinueChainMinutesUnit: string;
|
|
319
|
+
autoContinueRequestsLabel: string;
|
|
320
|
+
autoContinueRequestsUnit: string;
|
|
321
|
+
autoContinueRequestsHint: string;
|
|
322
|
+
autoContinueCustomCodes: string;
|
|
323
|
+
autoContinueCustomCodePlaceholder: string;
|
|
324
|
+
autoContinueCustomCodeAdd: string;
|
|
325
|
+
autoContinueCustomCodeRemove: string;
|
|
326
|
+
autoContinueCustomCodeInvalid: string;
|
|
327
|
+
autoContinueCustomCodeLimit: string;
|
|
328
|
+
autoContinueControllerProviderRetry: string;
|
|
329
|
+
autoContinueControllerProviderRetryDesc: string;
|
|
330
|
+
autoContinueControllerRequestCount: string;
|
|
331
|
+
autoContinueControllerExhaustedRequests: string;
|
|
332
|
+
autoContinueControllerExhaustedDuration: string;
|
|
333
|
+
autoContinueControllerOfficialRetryHint: string;
|
|
334
|
+
autoContinueControllerProviderAttempt: string;
|
|
312
335
|
autoContinueControllerWaiting: string;
|
|
313
336
|
autoContinueControllerSeconds: string;
|
|
314
337
|
autoContinueControllerRatio: string;
|
|
315
338
|
autoContinueControllerSent: string;
|
|
339
|
+
autoContinueControllerSentDesc: string;
|
|
316
340
|
autoContinueControllerExhausted: string;
|
|
317
341
|
autoContinueControllerStop: string;
|
|
318
342
|
autoContinueControllerResume: string;
|