dsh-model-think-level 2.0.2 → 2.0.3
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 +23 -13
- package/lib/client/EffortEditor.d.ts +34 -9
- package/lib/client/capacity.d.ts +20 -4
- package/lib/client/configured-inputs.d.ts +11 -2
- package/lib/client/fingerprint-runner.d.ts +13 -1
- package/lib/client/injection/models-page-editor.d.ts +35 -1
- package/lib/client/key-manager-client.d.ts +2 -1
- package/lib/client/locales.d.ts +5 -9
- package/lib/client/ops.d.ts +11 -2
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +17 -2
- package/lib/client.js +53 -69
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +13 -0
- package/lib/detection.d.ts +7 -0
- package/lib/fingerprint/run.d.ts +18 -0
- package/lib/fingerprint/store.d.ts +2 -2
- package/lib/fingerprint/verdict.d.ts +29 -3
- package/lib/index.js +251 -252
- package/lib/index.js.map +3 -3
- package/lib/key-probe.d.ts +13 -98
- package/lib/knowledge.d.ts +21 -0
- package/lib/multi-key-listing.d.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,12 +7,23 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|
|
|
10
|
+
- 每个模型行右侧会显示已声明的上下文窗口(如 `128K`、`1M`,留空则不显示),取自模型上配置的「上下文窗口」字段;该字段与「最大输出」都支持 `K`/`M`/`B`/`T` 简写(如 `200K`、`1M`),也接受纯数字与千分位写法。
|
|
11
|
+
- 被标记为「生图」的模型不在选择器中展示(对话输入框无法使用它们),供应商计数也不计入。
|
|
12
|
+
|
|
10
13
|
## 供应商配置
|
|
11
14
|
|
|
12
15
|

|
|
13
16
|

|
|
14
17
|

|
|
15
18
|
|
|
19
|
+
### 输入模态与生图
|
|
20
|
+
|
|
21
|
+
模型行的「输入模态」有三档:**文本**、**图片**、**生图**。三档互斥——勾选「生图」即把模型标记为图像生成模型(写入模型行专属的 `inputImageGen` 标记,同时清除文本/图片声明),输入框的模型切换列表不再展示它;勾选文本或图片则回到普通对话模型并清除生图标记。「自动获取思考等级」与后台自动补全同样会识别生图模型:端点列表的输出模态(如 `output_modalities: ["image"]`)、知识库与模型命名(`gpt-image`、`dall-e`、`flux`、`seedream` 等)都会被识别并自动打上该标记。
|
|
22
|
+
|
|
23
|
+
### 指纹检测
|
|
24
|
+
|
|
25
|
+
指纹页签的每个检测结果卡可以逐行折叠/展开(默认展开):点行头的箭头或模型名即可收起,徽章、证据行与检测按钮始终在场。
|
|
26
|
+
|
|
16
27
|
## 兼容字段与已有配置
|
|
17
28
|
|
|
18
29
|
1.1.4 起不再提供 `thinkingTokenBudgetField`、`vllmPriority`、`supportsMaxOutputTokens` 的专用编辑控件。已有值仍由 DSH 的 pi-ai 适配器使用;修改模型的思考档位或输入模态时,插件会保留这些值和其他手动兼容配置,避免覆盖供应商的定制行为。
|
|
@@ -30,32 +41,31 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
|
|
|
30
41
|
同一个供应商可以登记多把密钥,请求进来时按「模型 → 密钥」自动分流:
|
|
31
42
|
|
|
32
43
|
- 密钥按列表顺序排队。一个模型如果多把密钥都能访问,先走列表靠前的那把;某把密钥对某模型请求失败(401/403/408/429/5xx)时,自动换下一把能访问该模型的密钥重试;400/404/422 这类请求本身的问题不重试,直接返回。被拒的那把密钥会记住这次失败(时长取自 `Retry-After`,没有就按「太频繁」60 秒、「额度耗尽」30 分钟、「连接被拒」60 秒推算,重复失败翻倍并封顶),下次请求自动排到健康密钥后面;冷却只是排序,密钥永远不会被真正丢弃——全体都在冷却时仍按原顺序尝试。
|
|
33
|
-
-
|
|
34
|
-
-
|
|
44
|
+
- 密钥能访问哪些模型在密钥面板的「模型」里手动圈定(候选就是该供应商已添加的模型,做成多选胶囊),也可留空表示不限制。「获取模型」按钮会按「这把密钥实际会被派到哪些协议/地址」读取目录,见下节。
|
|
45
|
+
- 未圈定模型清单的密钥视为「通吃」,可以服务任何模型;圈定后只服务清单内的模型。
|
|
35
46
|
- 每把密钥行首有一个圆形对勾开关:亮起表示参与路由,灰色表示暂停使用。停用只是把密钥移出分流池,别名、模型清单与协议指定全部保留,重新点亮即恢复;最后一把启用中的密钥不允许停用(否则请求会回落到适配器自身的单密钥路径,仍然用刚被停用的那把签名)。
|
|
36
|
-
- 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json
|
|
37
|
-
-
|
|
47
|
+
- 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json`,只记录引用、别名、模型清单、协议指定、各协议族地址与启停状态,绝不保存密钥值(密钥值始终由 DSH 凭据库保管)。
|
|
48
|
+
- 新增供应商的表单在官方密钥输入框下方也带这套卡片式密钥列表:草稿密钥先暂存在本页,点「创建」供应商落库后自动写入,第一把草稿密钥自动成为启用密钥。挂载前已敲进官方输入框的值保留在原处——官方框保存的仍是那把密钥(卡片「获取模型」用的就是它),下方的列表只收之后新增的。刷新页面会丢弃草稿,与表单自身行为一致;若 id 撞上已存在的供应商,草稿不会写入对方。
|
|
38
49
|
|
|
39
50
|
### 按密钥切换协议与多地址
|
|
40
51
|
|
|
41
52
|
有些供应商同一把密钥只在某一种线上协议下可用(例如同一家既有 OpenAI Chat Completions 端点、又有 Anthropic Messages 端点)。插件支持在密钥面板里给每把密钥单独指定协议:
|
|
42
53
|
|
|
43
|
-
-
|
|
54
|
+
- 「这个密钥可用的协议」默认「自动(按模型)」——每个请求按模型自己所属的协议族挑线路:claude 系模型走 Anthropic 地址、gemini 系走 Gemini 地址(前提是供应商配置了对应族的地址),其余模型沿用该供应商自身配置的协议。也可为密钥指定 Anthropic / Chat Completions / Responses / Gemini 中的一个;菜单只列出供应商已配置地址的那些档(已钉的档即使地址后来被清掉也会保留显示),选「自动」即解除指定。
|
|
44
55
|
- 给某把密钥指定协议后,命中该密钥的请求会真正换用对应的线上协议(不只是换 URL/鉴权头:请求体也按该协议重新编码),由插件在 pi-ai 适配层重新派发到 `@earendil-works/pi-ai` 的对应协议实现。
|
|
45
56
|
- 供应商可以按「地址家族」配置最多三个基础地址:一个 OpenAI 系(Chat Completions / Responses 共用)、一个 Anthropic 系、一个 Gemini 系。供应商卡片「API 地址」下方的「更多端点」会展开当前协议家族之外的其他家族地址行。密钥指定协议后,就用与之匹配的那个地址;「自动」档的密钥按模型所属族使用对应地址,模型不属任何已配地址的族时仍使用供应商自身的 `baseURL`。
|
|
46
57
|
- 若密钥指定的协议跨了地址家族(如 OpenAI 系 ↔ Anthropic 系 ↔ Gemini 系)而供应商**没有**配置该家族的地址,这条指定不会生效:请求仍用供应商自身的协议和 `baseURL`,只由这把密钥签名。把 OpenAI 格式的请求体发到 Anthropic/Gemini 家族的地址只会换来网关的 `404`/`400`(模型根本不会被调用),所以宁可不换。这条在**每次调用时**都重新判定,供应商地址补上后同一个模型立刻换用该协议的密钥。「自动」档同理:某族没有地址就回落到供应商自身的协议。
|
|
47
58
|
- 自动挑错线路有记忆:某族地址对一个模型返回了「还没产生内容就失败」(典型如网关 404)后,这个 (供应商, 模型) 组合的自动解析不再挑那一族,改用供应商自身协议,直到插件进程重启;成功过的线路也会被记住并优先使用。钉选协议的密钥不受这层记忆影响——钉选表达的是用户的明确意图,其失败只说明凭据问题。
|
|
48
|
-
- 两把密钥指定了不同协议(或「自动」档解析出了不同协议)时,先试哪把不再取决于列表顺序,而是按「这个模型看起来属于哪一族」排:模型名(含 `anthropic/`、`openai/`、`google/gemini-…`
|
|
59
|
+
- 两把密钥指定了不同协议(或「自动」档解析出了不同协议)时,先试哪把不再取决于列表顺序,而是按「这个模型看起来属于哪一族」排:模型名(含 `anthropic/`、`openai/`、`google/gemini-…` 这类前缀或裸名;族名记号——`claude`、`gpt`、`gemini`、`gemma` 等——后跟 `-`/`/`/`:`/`.`/`_` 分隔符或位于名字结尾才算,Ollama 风格的 `gemma3:27b` 这类族名后直接跟数字的拼写不在此列)与密钥协议的家族一致者优先,其次是以本密钥自身地址就能直接服务的,再次是不一致但能回落到供应商主地址的,最后是跨族且没有自己地址的。请求会从排第一的密钥的协议开始——切协议意味着换请求体形状,一次只切一把密钥,失败后按此顺序换下一把。
|
|
49
60
|
- 同一协议(wire)的密钥会被当作一个池:先把这个池里的密钥都用完再换 wire,因为同一把密钥失败通常与协议无关;跨 wire 的切换排在池之后,且只有在上一次失败的请求还没开始产生内容时才会做。
|
|
50
61
|
- 请求进行到一半再失败(已经开始流式输出、或调用方已经主动取消)不会触发换密钥——客户端已经消费了已经发出的内容,重放只会产生重复输出。
|
|
51
|
-
-
|
|
52
|
-
-
|
|
62
|
+
- 密钥面板的「模型」选择是可点选的模型清单(该供应商已添加的模型做成多选胶囊),选中的模型才交给这把密钥;下面的「全部模型」表示不做限制。该项与其它操作按钮一样只在悬停时显示。
|
|
63
|
+
- 模型页供应商卡片的「获取模型」按密钥逐一分担目录读取,每把密钥按它实际会被派到的协议/地址询问(见下条),结果合并为一份目录——这正是路由真正可用的模型全体:
|
|
53
64
|
- 没指定协议的密钥,分别问供应商自身协议的地址、以及供应商配置了的其他族地址(配了几族就问几族),得到的模型取并集——这正是它实际会被派到的几条线。
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
- 模型页供应商卡片的「获取模型」走同一套合并:按上面的规则问过每把密钥实际会被派到的几条线后取并集。**单个密钥也一样**——只要供应商配置了多个地址(或该密钥指定了协议),获取到的就是全部地址上模型的并集,而不是只有供应商自身协议那一份;供应商卡里原配的那把密钥(从未在密钥面板列出过的)同样按「自动(按模型)」参与这条合并。
|
|
65
|
+
- 指定了协议的密钥只问它自己那条线:同族指定仍用供应商主地址,跨族指定用该族的基础地址(没配则沿用主地址,问不到就算这把这次没答)。
|
|
66
|
+
- 每把密钥的结果互不影响:一把被拒不影响另一把把模型写进目录,且一把这次问不到不会让目录缩小——它上次读到的模型仍保留(内部记着「这把上次见过什么」,下次成功后自动刷新)。
|
|
67
|
+
- 供应商本身的协议插件说不出(不是 Chat Completions / Responses / Anthropic Messages / Gemini 之一)时,该协议的地址不猜列目录路径;配了某一族的基础地址就只问配了地址的那几族。
|
|
68
|
+
- **单个密钥也一样**——只要供应商配置了多个地址(或该密钥指定了协议),获取到的就是全部地址上模型的并集,而不是只有供应商自身协议那一份;供应商卡里原配的那把密钥(从未在密钥面板列出过的)同样按「自动(按模型)」参与这条合并。
|
|
59
69
|
|
|
60
70
|
### Gemini 原生协议
|
|
61
71
|
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* everything arrives through a plain props face, so it stays testable in
|
|
6
6
|
* isolation. The draft/intent rules live in the client/effort module.
|
|
7
7
|
*
|
|
8
|
-
* The shape is the design board's: one head line (the switch
|
|
9
|
-
* default X" state
|
|
8
|
+
* The shape is the design board's: one head line (the switch and the
|
|
9
|
+
* "declared N · default X" state) over a sunk
|
|
10
10
|
* panel with no outline of its own. Inside it, each decision is a section — a
|
|
11
11
|
* label row with its trailing action, the hint on its own line, and the control
|
|
12
12
|
* group under both: the level ladder as 28px chips, the armed levels' wire
|
|
@@ -55,6 +55,8 @@ export interface EffortEditorProps {
|
|
|
55
55
|
effortsUnset?: boolean;
|
|
56
56
|
/** The model's current input-modality declaration. */
|
|
57
57
|
input?: InputModalities;
|
|
58
|
+
/** Whether the model is declared an image generator (生图). */
|
|
59
|
+
imageGen?: boolean;
|
|
58
60
|
/** The model's stored compat block (passthrough; suggestions merge over it). */
|
|
59
61
|
compat?: CompatSuggestion;
|
|
60
62
|
/** The model's stored per-model default-effort pick, when one is set. */
|
|
@@ -89,19 +91,42 @@ export interface EffortEditorProps {
|
|
|
89
91
|
/** Localized copy. */
|
|
90
92
|
t: (key: string, params?: Record<string, string | number>) => string;
|
|
91
93
|
}
|
|
92
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Draft state of the modality part. The three pills are mutually exclusive
|
|
96
|
+
* by construction: 生图 (`imageGen`) stands alone — an image generator is a
|
|
97
|
+
* different kind of model, not a request-modality answer — while the 文本/图片
|
|
98
|
+
* pair is the ordinary chat-input declaration (`declared`).
|
|
99
|
+
*/
|
|
93
100
|
export interface DraftModality {
|
|
101
|
+
/** The 文本/图片 declaration is made (text always, image when `image`). */
|
|
94
102
|
declared: boolean;
|
|
103
|
+
/** The declared pair takes images. Meaningful only while `declared`. */
|
|
95
104
|
image: boolean;
|
|
105
|
+
/** The row is an image generator; text/image carry no answer beside it. */
|
|
106
|
+
imageGen: boolean;
|
|
96
107
|
}
|
|
97
108
|
/** Read the stored declaration into a draft. Empty mirrors undefined: the
|
|
98
109
|
* resolved settings layer materializes absent arrays as [], and core reads
|
|
99
110
|
* that as "no answer here" -- never as a phantom text-only declaration. */
|
|
100
|
-
export declare function modalityFrom(input: InputModalities | undefined): DraftModality;
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
export declare function modalityFrom(input: InputModalities | undefined, imageGen?: boolean): DraftModality;
|
|
112
|
+
/**
|
|
113
|
+
* The modality part of a write, from a draft. The parts are exact: a declared
|
|
114
|
+
* pair also clears the image-generation marker, and marking the row an image
|
|
115
|
+
* generator also unsets the chat-input declaration (its `null` — the durable
|
|
116
|
+
* unset — which is what keeps host auto-fill from refilling text/image under a
|
|
117
|
+
* model that cannot serve a chat turn). `undefined` members mean "touch
|
|
118
|
+
* nothing", which {@link sameModality} is what decides.
|
|
119
|
+
*/
|
|
120
|
+
export declare function buildModalityWrite(draft: DraftModality): {
|
|
121
|
+
input?: InputModalities | null;
|
|
122
|
+
imageGen?: boolean;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Semantic equality between a modality draft and the row's stored state: the
|
|
126
|
+
* declaration AND the image-generation marker must both agree, or the draft is
|
|
127
|
+
* an edit.
|
|
128
|
+
*/
|
|
129
|
+
export declare function sameModality(draft: DraftModality, stored: InputModalities | undefined, storedImageGen?: boolean): boolean;
|
|
105
130
|
/**
|
|
106
131
|
* The ladder part of a write, from a switch state and the draft it resolves to.
|
|
107
132
|
*
|
|
@@ -133,5 +158,5 @@ export declare function pendingWriteOf(parts: PendingWriteParts): PendingWrite;
|
|
|
133
158
|
* checkboxes, the modality toggle, the auto-adapt action, and the
|
|
134
159
|
* apply/reset actions that own both sections.
|
|
135
160
|
*/
|
|
136
|
-
export declare function EffortEditor({ route, routeApi, routeBaseURL, modelId, modelName, efforts: initialEfforts, effortsUnset, input: initialInput, compat: initialCompat, defaultEffort: initialDefaultEffort, index, staged, officialInputTypes, onCoverageChange, api, readOnly, t }: EffortEditorProps): ReactNode;
|
|
161
|
+
export declare function EffortEditor({ route, routeApi, routeBaseURL, modelId, modelName, efforts: initialEfforts, effortsUnset, input: initialInput, imageGen: initialImageGen, compat: initialCompat, defaultEffort: initialDefaultEffort, index, staged, officialInputTypes, onCoverageChange, api, readOnly, t }: EffortEditorProps): ReactNode;
|
|
137
162
|
export type { DraftLevels };
|
package/lib/client/capacity.d.ts
CHANGED
|
@@ -9,15 +9,18 @@
|
|
|
9
9
|
* form is `1048576`, not `1M`, because that form's own parser only knows
|
|
10
10
|
* digits and its Save is what persists.
|
|
11
11
|
*
|
|
12
|
+
* A second formatter spells a count the way switchers and catalogues do —
|
|
13
|
+
* `200K`, `1M`, `1B` — for the model menu's capacity tag.
|
|
14
|
+
*
|
|
12
15
|
* @module dsh-model-think-level/client/capacity
|
|
13
16
|
*/
|
|
14
17
|
/**
|
|
15
18
|
* Parse a capacity field into a token count.
|
|
16
19
|
*
|
|
17
|
-
* Accepts thousands separators and a `K`/`M` suffix (case-insensitive),
|
|
18
|
-
* or without spaces, e.g. `1M`, `128 K`, `1,048,576`. A blank or
|
|
19
|
-
* value is `undefined`: the caller writes an empty official field,
|
|
20
|
-
* how a capacity goes back to inheriting the catalogue value.
|
|
20
|
+
* Accepts thousands separators and a `K`/`M`/`B`/`T` suffix (case-insensitive),
|
|
21
|
+
* with or without spaces, e.g. `1M`, `128 K`, `2B`, `1,048,576`. A blank or
|
|
22
|
+
* malformed value is `undefined`: the caller writes an empty official field,
|
|
23
|
+
* which is how a capacity goes back to inheriting the catalogue value.
|
|
21
24
|
* @param text - the field's text as typed.
|
|
22
25
|
* @returns the token count, or undefined when the text is blank/invalid.
|
|
23
26
|
*/
|
|
@@ -28,3 +31,16 @@ export declare function parseCapacity(text: string): number | undefined;
|
|
|
28
31
|
* @returns the grouped digits, or an empty string.
|
|
29
32
|
*/
|
|
30
33
|
export declare function capacityText(value: number | undefined): string;
|
|
34
|
+
/**
|
|
35
|
+
* A capacity count as a switcher tag spells it — `200K`, `1M`, `1B` — the way
|
|
36
|
+
* the model catalogues themselves write these numbers.
|
|
37
|
+
*
|
|
38
|
+
* The unit is picked by the value's decimal scale (catalogue numbers are
|
|
39
|
+
* decimal), then the spelling tries the binary units first — `131072` is
|
|
40
|
+
* `128K`, `1048576` is `1M` — before the decimal ones (`272000` is `272K`).
|
|
41
|
+
* A value neither family divides falls back to one binary decimal (`1536` →
|
|
42
|
+
* `1.5K`). Below a thousand the plain digits show.
|
|
43
|
+
* @param value - the token count, or undefined for "nothing declared".
|
|
44
|
+
* @returns the compact spelling, or an empty string.
|
|
45
|
+
*/
|
|
46
|
+
export declare function capacityShort(value: number | undefined): string;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { RemoteApi } from './types.js';
|
|
2
|
-
|
|
2
|
+
/** What the document says about one model, as the composer surfaces consume it. */
|
|
3
|
+
export interface ModelFacts {
|
|
4
|
+
/** The saved input-modality declaration, when the model declares one. */
|
|
5
|
+
input?: readonly string[];
|
|
6
|
+
/** Whether the model is declared an image generator (生图). */
|
|
7
|
+
imageGen?: boolean;
|
|
8
|
+
/** The declared context window, when the model carries one. */
|
|
9
|
+
contextWindow?: number;
|
|
10
|
+
}
|
|
11
|
+
export type ConfiguredInputSnapshot = ReadonlyMap<string, ReadonlyMap<string, ModelFacts>>;
|
|
3
12
|
/** Stable empty snapshot for a composer mounted without a settings reader. */
|
|
4
13
|
export declare const EMPTY_CONFIGURED_INPUTS: ConfiguredInputSnapshot;
|
|
5
|
-
/** Saved model
|
|
14
|
+
/** Saved model facts, shared by composer mounts and refreshed on settings pushes. */
|
|
6
15
|
export interface ConfiguredInputs {
|
|
7
16
|
getSnapshot(): ConfiguredInputSnapshot;
|
|
8
17
|
subscribe(listener: () => void): () => void;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { FingerprintRecord } from '../fingerprint/verdict.js';
|
|
2
2
|
import { readFingerprints, type FingerprintLine } from './fingerprint-client.js';
|
|
3
|
+
/** 默认同时检测几个模型。 */
|
|
4
|
+
export declare const DEFAULT_FINGERPRINT_CONCURRENCY = 2;
|
|
5
|
+
/** 命中限流后的退避时长。 */
|
|
6
|
+
export declare const RATE_LIMIT_BACKOFF_MS = 15000;
|
|
7
|
+
/** Runner 的可调参数;测试用它注入假时钟与假并发。 */
|
|
8
|
+
export interface FingerprintRunnerOptions {
|
|
9
|
+
/** 同时检测的模型数上限,默认 {@link DEFAULT_FINGERPRINT_CONCURRENCY}。 */
|
|
10
|
+
concurrency?: number;
|
|
11
|
+
/** 限流退避时长,默认 {@link RATE_LIMIT_BACKOFF_MS}。 */
|
|
12
|
+
backoffMs?: number;
|
|
13
|
+
}
|
|
3
14
|
/** 一个面板订阅到的、可安全渲染的快照(引用稳定,改了才换)。 */
|
|
4
15
|
export interface FingerprintRunnerState {
|
|
5
16
|
/** 正在跑的模型 → 已完成的题数。 */
|
|
@@ -48,8 +59,9 @@ export interface FingerprintSender {
|
|
|
48
59
|
* 取(或建)一个供应商的后台检测器。同一路由永远同一个实例,所以页签来回
|
|
49
60
|
* 挂载不会把队列弄丢。
|
|
50
61
|
* @param route - 供应商的设置键。
|
|
62
|
+
* @param options - 并发与退避的可调参数;只在实例首次创建时生效。
|
|
51
63
|
*/
|
|
52
|
-
export declare function fingerprintRunner(route: string): FingerprintRunner;
|
|
64
|
+
export declare function fingerprintRunner(route: string, options?: FingerprintRunnerOptions): FingerprintRunner;
|
|
53
65
|
/**
|
|
54
66
|
* 测试接缝:给一条路由换上传输实现。传 undefined 恢复真实传输。
|
|
55
67
|
* @param route - 供应商的设置键。
|
|
@@ -96,6 +96,14 @@ export interface HostLabels {
|
|
|
96
96
|
contextWindow: readonly string[];
|
|
97
97
|
/** The disclosure's max-output input ("Max output" / "最大输出"). */
|
|
98
98
|
maxOutput: readonly string[];
|
|
99
|
+
/**
|
|
100
|
+
* The model list's add button ("Add model" / "添加模型"). Clicking it appends
|
|
101
|
+
* a row and focuses its first input, and the browser's own scroll into view
|
|
102
|
+
* (plus the anchoring around the growth) is what made the whole card appear
|
|
103
|
+
* to squeeze upward — the capture-phase pin wired on it answers that (see
|
|
104
|
+
* {@link wireAddModelRepin}).
|
|
105
|
+
*/
|
|
106
|
+
addModel: readonly string[];
|
|
99
107
|
}
|
|
100
108
|
/** The join the injector renders from. */
|
|
101
109
|
export interface InjectorDeps {
|
|
@@ -159,6 +167,8 @@ export interface EditorMountProps {
|
|
|
159
167
|
effortsUnset?: boolean;
|
|
160
168
|
/** The model's current input-modality declaration. */
|
|
161
169
|
input?: InputModalities;
|
|
170
|
+
/** Whether the model is declared an image generator (生图). */
|
|
171
|
+
imageGen?: boolean;
|
|
162
172
|
/** The model's stored compat block (passthrough; the editor merges suggestions over it). */
|
|
163
173
|
compat?: CompatSuggestion;
|
|
164
174
|
/** The model's stored per-model default-effort pick, when one is set. */
|
|
@@ -268,6 +278,8 @@ export interface ScanState {
|
|
|
268
278
|
disclosureWired: WeakSet<Element>;
|
|
269
279
|
/** Provider-row Edit buttons already wired for the top re-pin. */
|
|
270
280
|
editWired: WeakSet<Element>;
|
|
281
|
+
/** The model lists' add-model buttons already wired for the top re-pin. */
|
|
282
|
+
addModelWired: WeakSet<Element>;
|
|
271
283
|
}
|
|
272
284
|
/**
|
|
273
285
|
* One staged declaration: the level set plus the suggestion's compat block and
|
|
@@ -285,6 +297,11 @@ export interface StagedDeclaration {
|
|
|
285
297
|
efforts: Exclude<EffortWriteIntent, undefined>;
|
|
286
298
|
compat?: CompatSuggestion;
|
|
287
299
|
input?: InputModalities;
|
|
300
|
+
/**
|
|
301
|
+
* The image-generation part, when the staging carried one: true marks the
|
|
302
|
+
* row 生图, false clears the marker. Undefined touches nothing.
|
|
303
|
+
*/
|
|
304
|
+
imageGen?: boolean;
|
|
288
305
|
defaultEffort?: string | null;
|
|
289
306
|
}
|
|
290
307
|
/**
|
|
@@ -317,7 +334,12 @@ export declare function stageEffortsInto(state: ScanState, route: string, modelI
|
|
|
317
334
|
* declaration" on an unsaved route) and stores as such: the staged flush
|
|
318
335
|
* reads it back verbatim, exactly like the saved-row seam does.
|
|
319
336
|
*/
|
|
320
|
-
input?: InputModalities | null, defaultEffort?: string | null
|
|
337
|
+
input?: InputModalities | null, defaultEffort?: string | null,
|
|
338
|
+
/**
|
|
339
|
+
* The image-generation part as the write carried it: true marks the row 生图,
|
|
340
|
+
* false or null clears the marker, undefined touches nothing.
|
|
341
|
+
*/
|
|
342
|
+
imageGen?: boolean | null): void;
|
|
321
343
|
/**
|
|
322
344
|
* Record (or replace) the write an on-screen editor asked for while the
|
|
323
345
|
* official card held the document. The latest intent for a row wins: the user
|
|
@@ -390,6 +412,8 @@ export interface EffectiveStagedIntents {
|
|
|
390
412
|
efforts: EffortWriteIntent;
|
|
391
413
|
compat?: CompatSuggestion;
|
|
392
414
|
input?: InputModalities;
|
|
415
|
+
/** The staged image-generation intent, when it is a change. */
|
|
416
|
+
imageGen?: boolean;
|
|
393
417
|
/** The staged default-effort pick, when the staging carried one. */
|
|
394
418
|
defaultEffort?: string | null;
|
|
395
419
|
}
|
|
@@ -770,6 +794,16 @@ export declare function unwatchModelListOffsets(): void;
|
|
|
770
794
|
* @param windowMs - how long each found card stays pinned.
|
|
771
795
|
*/
|
|
772
796
|
export declare function pinModelListCards(root: HTMLElement, windowMs?: number): void;
|
|
797
|
+
/**
|
|
798
|
+
* The model list's add-model buttons, found by the host's own copy.
|
|
799
|
+
*
|
|
800
|
+
* Matched like every other official control — by the resolved dictionary copy,
|
|
801
|
+
* never by a class — but through BOTH channels the button may carry: an
|
|
802
|
+
* aria-label when the host gave it one, else its own text content (the DSH
|
|
803
|
+
* host renders it as a plain labelled button). Buttons inside this plugin's
|
|
804
|
+
* own DOM are skipped, exactly like the Edit buttons above.
|
|
805
|
+
*/
|
|
806
|
+
export declare function addModelTriggersOf(scope: HTMLElement, labels: HostLabels): HTMLElement[];
|
|
773
807
|
/**
|
|
774
808
|
* Scan the settings DOM for official model rows and reconcile the injected
|
|
775
809
|
* editors. Idempotent: existing editors are left alone, new disclosures get
|
|
@@ -64,7 +64,8 @@ export interface KeyRow {
|
|
|
64
64
|
* The key's cooldown, when it is resting after a failure: how long until it
|
|
65
65
|
* is a normal candidate again, and how many consecutive failures produced
|
|
66
66
|
* the period. Absent means the key is a normal candidate right now — the
|
|
67
|
-
* state the
|
|
67
|
+
* state the routing pool sees as healthy. (No row paints it any more; the
|
|
68
|
+
* field carries what the pool sees.)
|
|
68
69
|
*/
|
|
69
70
|
readonly rest?: {
|
|
70
71
|
/** Milliseconds until the key is a normal candidate again (>= 0). */
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -23,12 +23,6 @@ export declare const en: {
|
|
|
23
23
|
autoAdaptBlockedHint: string;
|
|
24
24
|
apply: string;
|
|
25
25
|
reset: string;
|
|
26
|
-
pendingSave: string;
|
|
27
|
-
pendingHint: string;
|
|
28
|
-
appliedHint: string;
|
|
29
|
-
inputHintEndpoint: string;
|
|
30
|
-
inputHintKnowledge: string;
|
|
31
|
-
inputHintHeuristic: string;
|
|
32
26
|
referenceTitle: string;
|
|
33
27
|
contextWindowLabel: string;
|
|
34
28
|
maxTokensLabel: string;
|
|
@@ -38,13 +32,12 @@ export declare const en: {
|
|
|
38
32
|
tokensUnit: string;
|
|
39
33
|
inputModality: string;
|
|
40
34
|
modalityImage: string;
|
|
35
|
+
modalityImageGen: string;
|
|
36
|
+
modalityImageGenHint: string;
|
|
41
37
|
modalityInherit: string;
|
|
42
38
|
modalityDeclared: string;
|
|
43
39
|
capacityInherit: string;
|
|
44
40
|
clearDeclaration: string;
|
|
45
|
-
confidence_high: string;
|
|
46
|
-
confidence_medium: string;
|
|
47
|
-
confidence_low: string;
|
|
48
41
|
noSuggestion: string;
|
|
49
42
|
writeError: string;
|
|
50
43
|
renderFailed: string;
|
|
@@ -112,10 +105,13 @@ export declare const en: {
|
|
|
112
105
|
fpStateFailed: string;
|
|
113
106
|
fpQueued: string;
|
|
114
107
|
fpEvidence: string;
|
|
108
|
+
fpDetailShow: string;
|
|
109
|
+
fpDetailHide: string;
|
|
115
110
|
fpFamily: string;
|
|
116
111
|
fpCandidates: string;
|
|
117
112
|
fpClosedSet: string;
|
|
118
113
|
fpCheckedAt: string;
|
|
114
|
+
fpTiming: string;
|
|
119
115
|
fpLoadFailed: string;
|
|
120
116
|
fpRunFailed: string;
|
|
121
117
|
keyRevealShow: string;
|
package/lib/client/ops.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module dsh-model-think-level/client/ops
|
|
7
7
|
*/
|
|
8
8
|
import { type CompatSuggestion, type InputModalities, type ReasoningEfforts } from '../knowledge.js';
|
|
9
|
-
import type { DefaultEffortIntent, EffortEditorApi, EffortWriteIntent, HeldWrite, InputIntent, RemoteApi, SettingsJoin, SettingsNamespaceView } from './types.js';
|
|
9
|
+
import type { DefaultEffortIntent, EffortEditorApi, EffortWriteIntent, HeldWrite, ImageGenIntent, InputIntent, RemoteApi, SettingsJoin, SettingsNamespaceView } from './types.js';
|
|
10
10
|
/** The user-layer providers dict of the pi-ai namespace, as records. */
|
|
11
11
|
export declare function providersOf(namespace: SettingsNamespaceView | undefined): Record<string, Record<string, unknown>>;
|
|
12
12
|
/**
|
|
@@ -43,6 +43,13 @@ export declare function effortsOf(models: Record<string, unknown>[], modelId: st
|
|
|
43
43
|
export declare function inputOf(models: Record<string, unknown>[], modelId: string): InputModalities | undefined;
|
|
44
44
|
/** The stored compat block of one model in a route's models (unvalidated passthrough). */
|
|
45
45
|
export declare function compatOf(models: Record<string, unknown>[], modelId: string): CompatSuggestion | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Whether one model in a route's models is declared an IMAGE GENERATOR (生图).
|
|
48
|
+
* The marker is plugin-owned and truthy-only: any value other than `true`
|
|
49
|
+
* reads as "not an image generator", so a hostile or stale document can never
|
|
50
|
+
* half-apply the state.
|
|
51
|
+
*/
|
|
52
|
+
export declare function imageGenOf(models: Record<string, unknown>[], modelId: string): boolean;
|
|
46
53
|
/** The display name of one model in a route's models. */
|
|
47
54
|
export declare function nameOf(models: Record<string, unknown>[], modelId: string): string | undefined;
|
|
48
55
|
/**
|
|
@@ -63,7 +70,7 @@ export declare function invalidateProbeCache(): void;
|
|
|
63
70
|
* @param stage - sink for declarations staged against a route that is not
|
|
64
71
|
* saved yet; the injector owns the store and flushes it once the route exists.
|
|
65
72
|
*/
|
|
66
|
-
export declare function createEditorApi(api: RemoteApi, describe?: () => Promise<SettingsJoin>, stage?: (route: string, modelId: string, efforts: EffortWriteIntent, compat?: CompatSuggestion, input?: InputModalities | null, defaultEffort?: string | null) => void,
|
|
73
|
+
export declare function createEditorApi(api: RemoteApi, describe?: () => Promise<SettingsJoin>, stage?: (route: string, modelId: string, efforts: EffortWriteIntent, compat?: CompatSuggestion, input?: InputModalities | null, defaultEffort?: string | null, imageGen?: ImageGenIntent) => void,
|
|
67
74
|
/**
|
|
68
75
|
* Present only on a seam an ON-SCREEN editor drives: while the official card
|
|
69
76
|
* is open its own frozen revision baseline makes any write here break the
|
|
@@ -96,6 +103,8 @@ export interface RowIntent {
|
|
|
96
103
|
efforts: EffortWriteIntent;
|
|
97
104
|
compat?: CompatSuggestion;
|
|
98
105
|
input?: InputIntent;
|
|
106
|
+
/** The image-generation part; undefined leaves the marker untouched. */
|
|
107
|
+
imageGen?: ImageGenIntent;
|
|
99
108
|
defaultEffort?: DefaultEffortIntent;
|
|
100
109
|
}
|
|
101
110
|
/** The outcome of one batch write, as the caller's ledgers need it. */
|