dsh-model-think-level 2.3.0 → 2.3.1
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 +11 -1
- package/lib/client/ConfigPane.d.ts +16 -7
- package/lib/client/KeyManager.d.ts +3 -0
- package/lib/client/auto-continue-pref.d.ts +33 -0
- package/lib/client/auto-continue-rules.d.ts +96 -0
- package/lib/client/image-config-client.d.ts +10 -1
- package/lib/client/index.d.ts +1 -0
- package/lib/client/injection/auto-continue-run.d.ts +53 -0
- package/lib/client/injection/config-button-seat.d.ts +2 -2
- package/lib/client/injection/session-directory.d.ts +44 -0
- package/lib/client/locales.d.ts +17 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +150 -8
- package/lib/client.js.map +4 -4
- package/lib/image/config.d.ts +6 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +105 -27
- package/lib/index.js.map +2 -2
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -48,6 +48,16 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
|
|
|
48
48
|
|
|
49
49
|
指纹页签的每个检测结果卡可以逐行折叠/展开(默认收起):点行头的箭头或模型名即可展开,徽章、证据行与检测按钮始终在场。行头只留「N / 3 题」的进度,相似度等明细放在展开的结果卡里。
|
|
50
50
|
|
|
51
|
+
## 自动继续
|
|
52
|
+
|
|
53
|
+
会话偶尔会因为断线、超时、输出达到上限等原因停在半路,需要手动回复「继续」才能跑完。「高级设置」页(模型页标题行的按钮)新增**自动继续**卡片,打开开关后插件会替你补上这条回复。默认关闭。
|
|
54
|
+
|
|
55
|
+
- **只继续"断在半路"的回合**:回合因传输错误(断线、流中断)、超时、5xx、限流、空响应而失败,或输出撞到令牌上限(`max-tokens`)时才自动发送;正常完成、你手动停止的回合、等待你审批/回答的回合一律不动。
|
|
56
|
+
- **修不好的错误不重试**:鉴权失败(401/403)、额度耗尽、请求无效(400/413)、上下文超长等错误不会触发继续——再发一条「继续」也无济于事。
|
|
57
|
+
- **连击上限**:连续自动回复最多 5 次(间隔逐次拉长:2s → 4s → 8s → 16s → 30s,限流时尊重上游 `Retry-After`,封顶 2 分钟),防止对宕机的供应商或原地打转的模型无休止地喂消息。你手动发送任何消息、或模型正常跑完一个回合,计数都会清零。
|
|
58
|
+
- **只看当前会话、只认"亲眼所见"的结束**:页面加载时历史里已有的失败不会被补发;切到别的会话后,原会话的失败也不再追发。发送前会再次确认回合确实已结束、你没有正在排队的新消息。
|
|
59
|
+
- 自动回复以一条普通用户消息(「继续」/ "Continue")出现在对话里,与手打的没有区别;多个标签页同时开着时,同一次中断只会有一个标签页发送。
|
|
60
|
+
|
|
51
61
|
## 兼容字段与已有配置
|
|
52
62
|
|
|
53
63
|
1.1.4 起不再提供 `thinkingTokenBudgetField`、`vllmPriority`、`supportsMaxOutputTokens` 的专用编辑控件。已有值仍由 DSH 的 pi-ai 适配器使用;修改模型的思考档位或输入模态时,插件会保留这些值和其他手动兼容配置,避免覆盖供应商的定制行为。
|
|
@@ -71,7 +81,7 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
|
|
|
71
81
|
- 除了手写清单,插件还会**记住每把密钥各自的目录读到过什么**:宿主读取目录(模型页「获取模型」)时,插件按密钥逐把读取并把结果记在 `key-index.json` 同目录的 `key-serves.json`,只用于排序与提示,不写入你的清单。规则是「同一供应商下,别的密钥的目录里有这个模型、而这把没有」→ 这把不再作为该模型的候选;只有这一把的目录里有 → 它优先;没有任何密钥列出过(或还没读过)→ 当作未知,照旧都试。密钥面板的「模型」表单会显示这层观察结果,并给一个「用探测结果」按钮把它填进清单。某把密钥读取失败=未知,绝不会被当成「它什么模型都没有」;文件损坏时按空文件处理。
|
|
72
82
|
- 每把密钥行首有一个圆形对勾开关:亮起表示参与路由,灰色表示暂停使用。停用只是把密钥移出分流池,别名、模型清单与协议指定全部保留,重新点亮即恢复;最后一把启用中的密钥不允许停用(否则请求会回落到适配器自身的单密钥路径,仍然用刚被停用的那把签名)。
|
|
73
83
|
- 「添加另一个密钥」会优先**填回已经列出、但凭据库里还没有值的引用**,而不是再铸一个新名字。这条是为跨机同步准备的:配置从另一台电脑同步过来时,点名的 `XXX_API_KEY_2` 在这台还没有值,直接填进去两台的名字就一致了;若改成铸 `XXX_API_KEY_3`,名字会分叉,旧名字还会在面板上留一行「未存储」的残行。填回时别名、模型清单与协议指定都保留(只补值,不改标签)。库里已有值的引用不会被顶掉——那种情况下仍然铸新名字。
|
|
74
|
-
- 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json`,只记录引用、别名、模型清单、协议指定、各协议族地址与启停状态,绝不保存密钥值(密钥值始终由 DSH
|
|
84
|
+
- 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json`,只记录引用、别名、模型清单、协议指定、各协议族地址与启停状态,绝不保存密钥值(密钥值始终由 DSH 凭据库保管)。供应商从设置里**删除后**,它在 `key-index.json` 里的密钥、协议族地址与余额地址会在**宽限期(默认 30 秒,`routeSweepGraceMs` 可调,0 为读不到即清)**过后一并清掉,对应的孤立凭据也随之删除;期间若供应商重新出现(例如一次设置写入被读到半截、或启动时第一次可读快照还不全),清理自动取消,什么都不会丢。真正执行清理时会在宿主控制台留一行日志说明清了哪个供应商的哪些数据。
|
|
75
85
|
- 模型页拖出来的**供应商排序、各供应商的模型排序,以及供应商启用开关**也会镜像到同目录的 `ui-order.json`:页面上每次改动照旧即时生效(实时状态在 localStorage),插件在后台防抖写入这个文件,并按「最后写入者胜」与本地状态对齐(文件更新就采纳文件,本地更新就回写文件)。采纳文件里的停用集合时会**写回 localStorage**,所以刷新、重开浏览器之后仍是文件那一份,不会出现「这台机器看着同步好了、一刷新又变回去并把它推回文件」;每次改动都会拿到严格递增的时间戳,重启后同一毫秒内的多次改动也不会互相覆盖。文件比本页新时会立即采纳,本页的时间戳不更新时就**拒绝写入**(服务器回 409 并把赢得的那份文档带回来),旧标签页不会把别人的新顺序或新开关回滚回去。页面每分钟、以及切回标签页/窗口获得焦点时重新拉取一次,另一台电脑的改动不用重启就能出现。文件里只有供应商路由、模型 id 和停用名单,不含任何密钥,可以放心交给同步盘/网盘携带,实现多台机器的排序与启停同步。
|
|
76
86
|
- 新增供应商的表单在官方密钥输入框下方也带这套卡片式密钥列表:草稿密钥先暂存在本页,点「创建」供应商落库后自动写入,第一把草稿密钥自动成为启用密钥。挂载前已敲进官方输入框的值保留在原处——官方框保存的仍是那把密钥,下方的列表只收之后新增的。刷新页面会丢弃草稿,与表单自身行为一致;若 id 撞上已存在的供应商,草稿不会写入对方。
|
|
77
87
|
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* (z-index 1010 — the dialog's own opaque mask sits at 1000), opened from the
|
|
4
4
|
* Models-page title-row button.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* Cards, per the design's folded card-list shape: 「生图」 (enable switch on
|
|
7
|
+
* the head line; the params row and the default-model select in the folded
|
|
8
|
+
* body, plus the host's verbatim reason when `tools.register` threw) and
|
|
9
|
+
* 「自动继续」 (the session watcher switch). The marked image models surface
|
|
10
|
+
* as the select's options; marking itself lives on the Models page (展开模型行
|
|
11
|
+
* → 输入模态 → 勾选「生图」), so the pane keeps no list and no empty state of
|
|
12
|
+
* its own.
|
|
13
13
|
*
|
|
14
14
|
* Esc / backdrop / ✕ close it; the wrapper unmounts and the page keeps
|
|
15
15
|
* whatever the pane saved.
|
|
@@ -29,6 +29,15 @@ export declare function ImageGenCard(props: {
|
|
|
29
29
|
api: RemoteApi;
|
|
30
30
|
t: (key: string, params?: Record<string, unknown>) => string;
|
|
31
31
|
}): ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* The 「自动继续」 card: one folded settings entry — the switch sits on the
|
|
34
|
+
* head line (flipping it never unfolds the card). The one-line streak cap
|
|
35
|
+
* stays under the head, so the folded card keeps the same height as the
|
|
36
|
+
* 「生图」 card; the full what-triggers description folds into the body.
|
|
37
|
+
*/
|
|
38
|
+
export declare function AutoContinueCard(props: {
|
|
39
|
+
t: (key: string, params?: Record<string, unknown>) => string;
|
|
40
|
+
}): ReactNode;
|
|
32
41
|
/**
|
|
33
42
|
* The floating pane. Exported for tests: render it inside a chosen container.
|
|
34
43
|
*/
|
|
@@ -56,6 +56,9 @@ export interface KeyManagerProps {
|
|
|
56
56
|
readonly t: Translate;
|
|
57
57
|
/** Transport; injectable for tests. */
|
|
58
58
|
readonly client?: KeyManagerClient | undefined;
|
|
59
|
+
/** Plugin-owned seat beside the official API-key label; standalone lists
|
|
60
|
+
* keep their own probe row when no field seat is supplied. */
|
|
61
|
+
readonly probeHost?: HTMLElement | undefined;
|
|
59
62
|
/**
|
|
60
63
|
* Draft mode — the create-provider card's list over an in-memory store
|
|
61
64
|
* instead of the host's. Rows read as "saved on create" rather than probed,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The auto-continue preference: a localStorage-backed enable flag, deliberately
|
|
3
|
+
* NOT settings.yaml — it is a UI preference like the slider toggle, and it
|
|
4
|
+
* sends chat messages on the user's behalf, so it defaults to OFF and turns on
|
|
5
|
+
* only by an explicit switch.
|
|
6
|
+
*
|
|
7
|
+
* Also here: the per-turn CLAIM one tab takes before sending. Two open tabs
|
|
8
|
+
* would each watch the same session and both answer a cut-off turn with
|
|
9
|
+
* 「继续」; the claim (first writer wins, a fresh read losing to a stale one is
|
|
10
|
+
* bounded by the TTL) makes the second tab stand down. The claim outlives a
|
|
11
|
+
* reload on purpose: a page that reopens during the backoff window must not
|
|
12
|
+
* resend for a turn it already claimed.
|
|
13
|
+
*
|
|
14
|
+
* @module dsh-model-think-level/client/auto-continue-pref
|
|
15
|
+
*/
|
|
16
|
+
/** localStorage key (own namespace, same convention as the slider pref). */
|
|
17
|
+
export declare const AUTO_CONTINUE_PREF_KEY = "dsh-model-think-level.auto-continue.enabled";
|
|
18
|
+
/** Snapshot the current preference (default OFF). */
|
|
19
|
+
export declare function autoContinueEnabled(): boolean;
|
|
20
|
+
/** Save the preference (persisted immediately; a failed write keeps the session value). */
|
|
21
|
+
export declare function setAutoContinueEnabled(next: boolean): void;
|
|
22
|
+
/** Apply a value incoming from another tab (no persist: the writer already stored it). */
|
|
23
|
+
export declare function syncAutoContinueEnabled(next: boolean): void;
|
|
24
|
+
/** Subscribe to preference changes; returns the disposer. */
|
|
25
|
+
export declare function subscribeAutoContinueEnabled(listener: () => void): () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Try to claim one ended turn for THIS tab.
|
|
28
|
+
* @param sessionId - the session the turn belongs to.
|
|
29
|
+
* @param seq - the `turn/end` event's seq, unique per ending.
|
|
30
|
+
* @returns true when this tab holds the claim and may send; false when
|
|
31
|
+
* another tab claimed it first (or recently enough that its claim stands).
|
|
32
|
+
*/
|
|
33
|
+
export declare function claimTurn(sessionId: string, seq: number): boolean;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The auto-continue decision: which ended turns are worth replying 「继续」
|
|
3
|
+
* to, and which are not.
|
|
4
|
+
*
|
|
5
|
+
* A turn ends for a reason the session log records durably (`turn/end`,
|
|
6
|
+
* merge-extensible `TurnEndReason`). The classes split three ways:
|
|
7
|
+
*
|
|
8
|
+
* - `continue` — the turn was cut off while it was still working: the
|
|
9
|
+
* output hit its token ceiling (`max-tokens`), or the model call failed
|
|
10
|
+
* with a TRANSIENT failure (a disconnect, a timeout, a 5xx, a rate
|
|
11
|
+
* limit, an empty response). These are the endings a user today
|
|
12
|
+
* answers with a manual 「继续」; the same reply sent automatically is
|
|
13
|
+
* meaningful.
|
|
14
|
+
* - `settled` — the turn reached a safe end on its own: `completed`
|
|
15
|
+
* (nothing to continue), `aborted` (the user stopped it on purpose),
|
|
16
|
+
* `blocked` (waiting on the user, e.g. an approval). Never continued,
|
|
17
|
+
* and each one RESETS the watcher's consecutive-attempt streak — a
|
|
18
|
+
* finished turn is evidence the session is not stuck.
|
|
19
|
+
* - `refuse` — continuing cannot help or must not happen: non-transient
|
|
20
|
+
* failures (auth, quota, an invalid request, a context-window
|
|
21
|
+
* overflow, anything unclassified), lifecycle closers (`forked`,
|
|
22
|
+
* `orphaned`), and every future reason vocabulary this file does not
|
|
23
|
+
* know. Failing CLOSED on the unknown is what keeps the feature from
|
|
24
|
+
* ever firing blindly.
|
|
25
|
+
*
|
|
26
|
+
* The transient-code set mirrors the harness's own step retry policy
|
|
27
|
+
* (`DEFAULT_RETRYABLE_CODES` in dsh-llm): by the time the turn ends with
|
|
28
|
+
* one of these, the in-step retries are exhausted, so one more nudge is
|
|
29
|
+
* the same thing the user would do by hand. Everything else fails closed.
|
|
30
|
+
*
|
|
31
|
+
* One more meaningfulness gate lives here rather than in the watcher: a
|
|
32
|
+
* turn that logged NO input and NO activity (a `turn/start` closed with
|
|
33
|
+
* nothing under it) has nothing to continue, whatever the reason says.
|
|
34
|
+
*
|
|
35
|
+
* Pure module: no DOM, no services — the watcher feeds it the tail of the
|
|
36
|
+
* session's event window and acts on the verdict.
|
|
37
|
+
*
|
|
38
|
+
* @module dsh-model-think-level/client/auto-continue-rules
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Consecutive automatic replies allowed before the watcher stands down: a
|
|
42
|
+
* dead provider or a model looping on the output ceiling must not be fed
|
|
43
|
+
* forever. Anything the user sends by hand — and every turn that ends
|
|
44
|
+
* completed, aborted or blocked — resets the streak.
|
|
45
|
+
*/
|
|
46
|
+
export declare const MAX_CONSECUTIVE = 5;
|
|
47
|
+
/** Minimal structural view of one durable session event (`SessionEvent`). */
|
|
48
|
+
export interface DurableEventLike {
|
|
49
|
+
readonly type: string;
|
|
50
|
+
/** Monotonic sequence number within the session. */
|
|
51
|
+
readonly seq: number;
|
|
52
|
+
/** Unix epoch milliseconds, as the host logged it. */
|
|
53
|
+
readonly time?: number;
|
|
54
|
+
readonly data?: unknown;
|
|
55
|
+
}
|
|
56
|
+
/** The structured failure facts a `turn/end` `error` reason carries (`LlmFailure`). */
|
|
57
|
+
export interface LlmFailureLike {
|
|
58
|
+
readonly message?: unknown;
|
|
59
|
+
readonly code?: unknown;
|
|
60
|
+
readonly status?: unknown;
|
|
61
|
+
readonly providerRetryAfterMs?: unknown;
|
|
62
|
+
}
|
|
63
|
+
/** What the watcher should do with one ended turn. */
|
|
64
|
+
export type TurnEndClass = {
|
|
65
|
+
/** Reply 「继续」 automatically. */
|
|
66
|
+
readonly kind: 'continue';
|
|
67
|
+
/** Which cut-off shape matched. */
|
|
68
|
+
readonly reason: 'max-tokens' | 'transient-error';
|
|
69
|
+
/** Failure code or status the verdict came from (diagnostics only). */
|
|
70
|
+
readonly detail: string;
|
|
71
|
+
/** The provider's requested delay, when the failure carried one. */
|
|
72
|
+
readonly waitMs?: number;
|
|
73
|
+
} | {
|
|
74
|
+
/** Never continue; the streak resets (the turn reached a safe end). */
|
|
75
|
+
readonly kind: 'settled';
|
|
76
|
+
readonly detail: string;
|
|
77
|
+
} | {
|
|
78
|
+
/** Never continue; the streak does NOT reset (the session is broken). */
|
|
79
|
+
readonly kind: 'refuse';
|
|
80
|
+
readonly detail: string;
|
|
81
|
+
};
|
|
82
|
+
/** The final turn's events, as the watcher cuts them out of the window. */
|
|
83
|
+
export interface TurnTail {
|
|
84
|
+
/** The `turn/end` event that just landed. */
|
|
85
|
+
readonly turnEnd: DurableEventLike;
|
|
86
|
+
/** That turn's events, oldest first: everything after the PREVIOUS
|
|
87
|
+
* `turn/end`, this one included. May be short when the window's oldest
|
|
88
|
+
* page boundary falls inside the turn. */
|
|
89
|
+
readonly turnEvents: readonly DurableEventLike[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Judge one ended turn.
|
|
93
|
+
* @param tail - the final `turn/end` plus that turn's events.
|
|
94
|
+
* @returns what the watcher should do.
|
|
95
|
+
*/
|
|
96
|
+
export declare function judgeTurnTail(tail: TurnTail): TurnEndClass;
|
|
@@ -20,6 +20,7 @@ export interface ImageToolView {
|
|
|
20
20
|
}
|
|
21
21
|
/** GET image-config 的应答体(结构声明:浏览器不 import host-only 模块)。 */
|
|
22
22
|
export interface ImageConfigView {
|
|
23
|
+
enabled: boolean;
|
|
23
24
|
models: ImageModel[];
|
|
24
25
|
defaultModel: string | null;
|
|
25
26
|
defaults: {
|
|
@@ -32,12 +33,19 @@ export interface ImageConfigView {
|
|
|
32
33
|
syncedAt?: string;
|
|
33
34
|
tool: ImageToolView;
|
|
34
35
|
}
|
|
36
|
+
/** Completion caches must not outlive a successful settings write. */
|
|
37
|
+
export declare function imageConfigRevision(): number;
|
|
38
|
+
/**
|
|
39
|
+
* Listen for a successful config write (the switch changes what other surfaces
|
|
40
|
+
* may offer). @returns the unsubscribe.
|
|
41
|
+
*/
|
|
42
|
+
export declare function onImageConfigChanged(listener: () => void): () => void;
|
|
35
43
|
/** 画配置页之前就能拿到的快照(没有过就读不到)。 */
|
|
36
44
|
export declare function cachedImageConfigView(): ImageConfigView | undefined;
|
|
37
45
|
/** 丢掉缓存:测试重置用,登出/换账号时也可以先清一次。 */
|
|
38
46
|
export declare function clearImageConfigCache(): void;
|
|
39
47
|
/**
|
|
40
|
-
* 预热配置:模型页一挂载就发一次 GET
|
|
48
|
+
* 预热配置:模型页一挂载就发一次 GET,用户点「高级设置」时缓存已经就位。
|
|
41
49
|
* 失败不管——真正打开时会再读一次并把错误显示出来。
|
|
42
50
|
*/
|
|
43
51
|
export declare function prefetchImageConfigView(): void;
|
|
@@ -47,6 +55,7 @@ export declare function prefetchImageConfigView(): void;
|
|
|
47
55
|
export declare function readImageConfigView(): Promise<TransportAnswer<ImageConfigView>>;
|
|
48
56
|
/** 保存默认模型/默认参数/输出目录。 */
|
|
49
57
|
export declare function saveImageConfig(patch: {
|
|
58
|
+
enabled?: boolean;
|
|
50
59
|
defaultModel?: string | null;
|
|
51
60
|
defaults?: Partial<{
|
|
52
61
|
size: string;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* provider-toggle.ts the Models-page per-provider enable switch
|
|
19
19
|
* provider-enabled.ts the stored disabled providers (settings page + composer)
|
|
20
20
|
* autofill-run.ts the running auto-fill complement (issue #7)
|
|
21
|
+
* auto-continue-run.ts the session watcher behind the pane's 自动继续 switch
|
|
21
22
|
* mount.tsx foreign React roots and the render boundary
|
|
22
23
|
* model-menu.ts locating the official composer model menu
|
|
23
24
|
*
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The auto-continue watcher: replies 「继续」 to the current session's turn
|
|
3
|
+
* when it ended in a way worth continuing, and stays silent otherwise.
|
|
4
|
+
*
|
|
5
|
+
* The decision is {@link judgeTurnTail} (auto-continue-rules.ts); this module
|
|
6
|
+
* owns the OBSERVATION and the GUARDS around it:
|
|
7
|
+
*
|
|
8
|
+
* - Only the CURRENT session is watched, and only LIVE endings: the running
|
|
9
|
+
* edge (`running` true → false) must be observed on the attached session
|
|
10
|
+
* before anything is evaluated. A page that loads into a session whose
|
|
11
|
+
* last turn failed yesterday does nothing — auto-continuing stale
|
|
12
|
+
* failures is exactly the mindless behaviour the switch must not have.
|
|
13
|
+
* - The durable `turn/end` is what is judged, not the running edge, so the
|
|
14
|
+
* evaluation waits briefly for the settlement to reach the event window.
|
|
15
|
+
* - Guards at send time: the switch still on, the turn still ended, nothing
|
|
16
|
+
* the user submitted pending, the session still the one on screen.
|
|
17
|
+
* - A streak cap bounds every chain of automatic replies (a dead provider
|
|
18
|
+
* or a model looping on the ceiling must not be fed forever); anything
|
|
19
|
+
* the user sends by hand, and every turn that ends completed / aborted /
|
|
20
|
+
* blocked, resets it.
|
|
21
|
+
* - A per-turn claim (auto-continue-pref.ts) keeps a second open tab from
|
|
22
|
+
* double-answering the same ending.
|
|
23
|
+
*
|
|
24
|
+
* The services are probed structurally and lazily exactly like the
|
|
25
|
+
* session-directory tracker does: a kernel without the session-controller
|
|
26
|
+
* client layer simply never arms the watcher.
|
|
27
|
+
*
|
|
28
|
+
* @module dsh-model-think-level/client/injection/auto-continue-run
|
|
29
|
+
*/
|
|
30
|
+
/** The context seats the watcher probes, lazily (services mount after boot). */
|
|
31
|
+
interface WatcherContext {
|
|
32
|
+
get?(name: string): unknown;
|
|
33
|
+
on?(event: string, listener: () => void): () => void;
|
|
34
|
+
}
|
|
35
|
+
/** What the watcher needs from its host. */
|
|
36
|
+
export interface AutoContinueDeps {
|
|
37
|
+
/** The client root context, probed lazily for its service seats. */
|
|
38
|
+
ctx: WatcherContext;
|
|
39
|
+
/** The plugin translator, for the reply text (`autoContinueMessage`). */
|
|
40
|
+
t: (key: string, params?: Record<string, unknown>) => string;
|
|
41
|
+
}
|
|
42
|
+
/** The watcher's face. */
|
|
43
|
+
export interface AutoContinueRunner {
|
|
44
|
+
/** Stop the poll, detach every listener and cancel every pending send. */
|
|
45
|
+
dispose: () => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Build the watcher. The poll runs for the fiber's whole life (memory-only
|
|
49
|
+
* reads while idle); the switch is only consulted when a turn ends, so
|
|
50
|
+
* enabling it mid-session takes effect from the NEXT ending.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createAutoContinue(deps: AutoContinueDeps): AutoContinueRunner;
|
|
53
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Models-page title-row seat: the
|
|
2
|
+
* The Models-page title-row seat: the 「高级设置」 button at the right end of
|
|
3
3
|
* the 「模型」 heading line, opening the plugin's image-service config pane.
|
|
4
4
|
*
|
|
5
5
|
* The official `settings.action` slot lands in the DIALOG's top bar (beside
|
|
@@ -83,7 +83,7 @@ export declare function dropSeat(row: HTMLElement, state: ConfigButtonSeatState)
|
|
|
83
83
|
/** Take every seat down, including strays a dead fiber left behind. */
|
|
84
84
|
export declare function teardownConfigButtonSeats(state: ConfigButtonSeatState): void;
|
|
85
85
|
/**
|
|
86
|
-
* The
|
|
86
|
+
* The 「高级设置」 button: a round icon-only seat. The copy lives only in the
|
|
87
87
|
* button's attributes (`title` tooltip + `aria-label`), never as a text node —
|
|
88
88
|
* the Models page heading line is tight, and a labelled pill there competed
|
|
89
89
|
* with the host's own title. The circle keeps the same hit area as the pills
|
|
@@ -12,6 +12,50 @@
|
|
|
12
12
|
* @module dsh-model-think-level/client/injection/session-directory
|
|
13
13
|
*/
|
|
14
14
|
import type { ModelDirectoryLike } from '../types.js';
|
|
15
|
+
/**
|
|
16
|
+
* The `sessions` service face this needs: the current session id.
|
|
17
|
+
*
|
|
18
|
+
* Through 0.1.6-alpha.1 the catalog snapshot carried the selection as
|
|
19
|
+
* `current`; 0.1.6-alpha.2 dropped it (navigation moved to the view owner) and
|
|
20
|
+
* reports rows as `byId`, each with its `retainedBy` source counts.
|
|
21
|
+
*/
|
|
22
|
+
export interface SessionsLike {
|
|
23
|
+
list?: {
|
|
24
|
+
getSnapshot(): {
|
|
25
|
+
current?: string;
|
|
26
|
+
byId?: Record<string, {
|
|
27
|
+
id?: string;
|
|
28
|
+
retainedBy?: Record<string, number>;
|
|
29
|
+
} | undefined>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The `ui-session` service face (0.1.6-alpha.2+): its scope adapter exposes the
|
|
35
|
+
* main-view binding, whose `key` is the current session id.
|
|
36
|
+
*/
|
|
37
|
+
export interface UiSessionLike {
|
|
38
|
+
adapter?: {
|
|
39
|
+
current?: {
|
|
40
|
+
getSnapshot(): {
|
|
41
|
+
key?: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the current session id across kernel lines:
|
|
48
|
+
* 1. the list snapshot's `current` (0.1.6-alpha.1 and earlier);
|
|
49
|
+
* 2. the ui-session main binding (0.1.6-alpha.2's authoritative source);
|
|
50
|
+
* 3. the first main-view-retained catalog row — the same preference
|
|
51
|
+
* ui-session itself applies, used when that service is absent.
|
|
52
|
+
* A non-empty string is required at every step: an empty id would resolve no
|
|
53
|
+
* session scope and only throw inside the resolver.
|
|
54
|
+
* @param sessions - the sessions service face, when mounted.
|
|
55
|
+
* @param uiSession - the ui-session service face, when mounted.
|
|
56
|
+
* @returns the current session id, or undefined in the boot window.
|
|
57
|
+
*/
|
|
58
|
+
export declare function currentSessionId(sessions: SessionsLike | undefined, uiSession: UiSessionLike | undefined): string | undefined;
|
|
15
59
|
/** What the tracker needs from its host. */
|
|
16
60
|
export interface SessionDirectoryDeps {
|
|
17
61
|
/** The client root context, probed lazily for its service seats. */
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -229,6 +229,15 @@ export declare const en: {
|
|
|
229
229
|
configPaneClose: string;
|
|
230
230
|
configPaneFailed: string;
|
|
231
231
|
imagegenSectionTitle: string;
|
|
232
|
+
imagegenEnable: string;
|
|
233
|
+
imagegenEnabled: string;
|
|
234
|
+
imagegenDisabled: string;
|
|
235
|
+
imagegenEnabledHint: string;
|
|
236
|
+
imagegenDisabledHint: string;
|
|
237
|
+
imagegenExpand: string;
|
|
238
|
+
imagegenCollapse: string;
|
|
239
|
+
imagegenSaving: string;
|
|
240
|
+
imagegenRefreshFailed: string;
|
|
232
241
|
imagegenLoading: string;
|
|
233
242
|
imagegenLoadFailed: string;
|
|
234
243
|
imagegenDefaultsLabel: string;
|
|
@@ -243,6 +252,14 @@ export declare const en: {
|
|
|
243
252
|
imagegenCardRunning: string;
|
|
244
253
|
imagegenToolMissing: string;
|
|
245
254
|
imagegenToolMissingWhy: string;
|
|
255
|
+
autoContinueSectionTitle: string;
|
|
256
|
+
autoContinueExpand: string;
|
|
257
|
+
autoContinueCollapse: string;
|
|
258
|
+
autoContinueTitle: string;
|
|
259
|
+
autoContinueDescription: string;
|
|
260
|
+
autoContinueHint: string;
|
|
261
|
+
autoContinueAria: string;
|
|
262
|
+
autoContinueMessage: string;
|
|
246
263
|
};
|
|
247
264
|
/** The plugin's locale key union. */
|
|
248
265
|
export type BreKey = keyof typeof en;
|