dsh-model-think-level 2.0.3 → 2.1.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.
Files changed (55) hide show
  1. package/README.md +38 -22
  2. package/lib/balance.d.ts +44 -0
  3. package/lib/client/ComposerSlider.d.ts +19 -0
  4. package/lib/client/ConfigPane.d.ts +47 -0
  5. package/lib/client/EffortEditor.d.ts +1 -8
  6. package/lib/client/KeyManager.d.ts +2 -2
  7. package/lib/client/balance-client.d.ts +34 -0
  8. package/lib/client/events.d.ts +31 -2
  9. package/lib/client/image-config-client.d.ts +75 -0
  10. package/lib/client/injection/autofill-run.d.ts +2 -2
  11. package/lib/client/injection/config-button-seat.d.ts +96 -0
  12. package/lib/client/injection/create-key-seat.d.ts +3 -3
  13. package/lib/client/injection/create-keys-pane.d.ts +4 -2
  14. package/lib/client/injection/editor-tab-bar.d.ts +1 -1
  15. package/lib/client/injection/editor-tabs.d.ts +1 -1
  16. package/lib/client/injection/image-card.d.ts +85 -0
  17. package/lib/client/injection/imagegen-completion.d.ts +43 -0
  18. package/lib/client/injection/imagegen-entry.d.ts +22 -0
  19. package/lib/client/injection/key-prefetch.d.ts +44 -0
  20. package/lib/client/injection/key-reveal.d.ts +2 -3
  21. package/lib/client/injection/models-page-editor.d.ts +24 -27
  22. package/lib/client/injection/models-page.d.ts +15 -3
  23. package/lib/client/injection/provider-balance.d.ts +83 -0
  24. package/lib/client/injection/provider-endpoints.d.ts +2 -2
  25. package/lib/client/injection/row-drag.d.ts +7 -0
  26. package/lib/client/injection/staged-keys.d.ts +24 -12
  27. package/lib/client/key-manager-client.d.ts +68 -17
  28. package/lib/client/locales.d.ts +60 -6
  29. package/lib/client/ops.d.ts +1 -0
  30. package/lib/client/styles.d.ts +1 -1
  31. package/lib/client/types.d.ts +4 -1
  32. package/lib/client.js +672 -13
  33. package/lib/client.js.map +4 -4
  34. package/lib/constants.d.ts +45 -0
  35. package/lib/fingerprint/estimate.d.ts +16 -0
  36. package/lib/fingerprint/run.d.ts +6 -0
  37. package/lib/fingerprint/store.d.ts +2 -2
  38. package/lib/fingerprint/verdict.d.ts +24 -0
  39. package/lib/headers-core.d.ts +3 -1
  40. package/lib/headers-fetch.d.ts +25 -0
  41. package/lib/image/command.d.ts +84 -0
  42. package/lib/image/config.d.ts +150 -0
  43. package/lib/image/generate.d.ts +135 -0
  44. package/lib/image/legacy-cleanup.d.ts +29 -0
  45. package/lib/image/sizes.d.ts +28 -0
  46. package/lib/image/tool.d.ts +107 -0
  47. package/lib/index.js +3666 -1534
  48. package/lib/index.js.map +4 -4
  49. package/lib/key-index.d.ts +37 -7
  50. package/lib/key-probe.d.ts +42 -17
  51. package/lib/key-refs.d.ts +43 -19
  52. package/lib/key-route-core.d.ts +100 -32
  53. package/lib/key-serves.d.ts +81 -0
  54. package/lib/listing.d.ts +18 -20
  55. package/package.json +1 -8
package/README.md CHANGED
@@ -8,7 +8,7 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
8
8
  ![思考等级与模型搜索](./docs/image2.png)
9
9
 
10
10
  - 每个模型行右侧会显示已声明的上下文窗口(如 `128K`、`1M`,留空则不显示),取自模型上配置的「上下文窗口」字段;该字段与「最大输出」都支持 `K`/`M`/`B`/`T` 简写(如 `200K`、`1M`),也接受纯数字与千分位写法。
11
- - 被标记为「生图」的模型不在选择器中展示(对话输入框无法使用它们),供应商计数也不计入。
11
+ - 输入框的模型切换器只列**对话模型**:被标记为「生图」的模型不再出现在切换器里(供应商计数也不含它们)。生图由对话模型调用插件的原生工具完成——见下文「生图的方式」。
12
12
 
13
13
  ## 供应商配置
14
14
 
@@ -16,13 +16,35 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
16
16
  ![模型能力配置](./docs/image4.png)
17
17
  ![供应商高级配置](./docs/image5.png)
18
18
 
19
+ ### 余额展示
20
+
21
+ 供应商卡的「API 地址」下方、「更多端点」展开区里多了一行**余额**:填写一个只读的余额接口地址(`http(s)://…`)后,该供应商在模型页列表中的**启用开关前**会显示「余额 12.34」。没有填写这一行的供应商不显示余额,也不预留位置;清空地址即撤下展示。
22
+
23
+ - 请求由宿主发起(浏览器直接请求会受 CORS 限制),并带上该路由密钥列表中的**第一把密钥**:OpenAI 系协议用 `Authorization: Bearer`,Anthropic 系协议用 `x-api-key`。同一供应商有多把密钥时只查第一把,其余不请求。请求超时 30 秒,且不跟随重定向,密钥只会发往填写的地址本身。
24
+ - 地址可以为空;空值或非 http(s) 地址不会被保存。地址保存在插件自己的 `key-index.json` 的 `balances` 字段里,与协议地址互不覆盖,改完立即生效、无需重启。
25
+ - 响应支持 JSON 或纯数字。JSON 会按键名识别余额:`balance`、`total_balance`、`available_balance`、`remaining`、`total_available`、`credit`/`credits`、`amount`、`left`、`remain`、`*_quota` 等(大小写、下划线、连字符不敏感),同层的 `currency`/`unit` 用来决定 `$`/`¥` 等符号;OpenRouter 风格的 `total_credits` / `total_usage` 会按两者之差计算。识别不到余额时按读取失败处理,不显示金额。
26
+ - **只在打开模型页时读取,不轮询**:每次打开模型页、每个供应商读取一次;停留在页面上不会反复请求,重新打开页面才会再读一次;在配置卡里改完地址会立即重读。
27
+ - 读取失败(超时、接口报错、或响应里认不出余额)时**继续显示上一次成功读取的金额**;只有从未成功过的供应商才显示「余额 —」,悬停可看到宿主返回的原因。完全没有配置地址的供应商仍然什么都不显示。
28
+ - 余额后面的**刷新图标**可以随时手动重取这一家的余额:刷新期间保留当前金额并转动图标;失败时仍沿用上一次成功读取的值。
29
+
19
30
  ### 输入模态与生图
20
31
 
21
- 模型行的「输入模态」有三档:**文本**、**图片**、**生图**。三档互斥——勾选「生图」即把模型标记为图像生成模型(写入模型行专属的 `inputImageGen` 标记,同时清除文本/图片声明),输入框的模型切换列表不再展示它;勾选文本或图片则回到普通对话模型并清除生图标记。「自动获取思考等级」与后台自动补全同样会识别生图模型:端点列表的输出模态(如 `output_modalities: ["image"]`)、知识库与模型命名(`gpt-image`、`dall-e`、`flux`、`seedream` 等)都会被识别并自动打上该标记。
32
+ 模型行的「输入模态」有三档:**文本**、**图片**、**生图**。三档互斥——勾选「生图」即把模型标记为图像生成模型(写入模型行专属的 `inputImageGen` 标记,同时清除文本/图片声明),该标记让插件在生成配置里登记这个模型,同时把该模型从输入框的切换器里隐藏;勾选文本或图片则回到普通对话模型并清除生图标记。「自动获取思考等级」与后台自动补全同样会识别生图模型:端点列表的输出模态(如 `output_modalities: ["image"]`)、知识库与模型命名(`gpt-image`、`dall-e`、`flux`、`seedream` 等)都会被识别并自动打上该标记。
33
+
34
+ ### 生图的方式
35
+
36
+ 插件不拦截任何对话请求:被标记为「生图」的模型只用来**生图**,对话模型需要图片时调用插件注册的**原生工具** `generate_image`(参数:`prompt` 必填,可选 `model`、`size`、`quality`、`n`、`reference_images` 本地路径、`reference_attachments` 对话附件 ID、`path` 落盘位置)。工具随插件进程内注册,**无需安装、无需重启配置**:DSH 启动即注册,图片以附件形式直接出现在对话里,不经过聊天 API。若与其他插件注册的 `generate_image` 撞名,工具自动改名为 `dsh_image_generate` 并在日志里说明。
37
+
38
+ - 多图:上游按 `n` 返回的每一张都会落盘、存为附件并全部附到对话(上游少给就少收,不会编造)。
39
+ - 改图(图生图):`reference_images` 填本地路径,`reference_attachments` 填对话内图片的附件 ID(`sha256:…` 或裸摘要均可,两者可混用);任何参考图非空即走 `/images/edits`。
40
+ - 「生图服务」配置页负责:列出所有被标记的模型、逐个测试端点。第一行选**默认参数**(尺寸 / 质量 / 张数,以及**超时**——下拉 5 / 10 / 15 / 30 / 60 分钟,默认 5 分钟,参数回退的每次重试都用这个上限),第二行用下拉列表选**默认生图模型**(未设默认时显示「未设置」)。尺寸/质量/张数只在第一行选一处生效,模型行只保留「测试」和「试一张」两个动作。
41
+ - 配置页底部的「内建生图工具」卡片显示工具的注册状态(工具名 + 是否已注册),并提供「生成测试」:按默认参数真实跑一次共享核心,验证 配置 → 密钥 → 端点 → 落盘 整条链路。
42
+ - 文本对话模型收到图片结果时会自动降级为一行占位文本(宿主行为),因此**对话模型不需要声明图片输入**也能安全调用;生成的图片始终在对话卡片里可见。
43
+ - 从 2.0.3 及更早版本升级:插件启动时会自动移除旧版「生图 MCP」写入 `cordis.patch.yml` 的标记块(带 `.bak` 备份),重启后旧工具不再加载。
22
44
 
23
45
  ### 指纹检测
24
46
 
25
- 指纹页签的每个检测结果卡可以逐行折叠/展开(默认展开):点行头的箭头或模型名即可收起,徽章、证据行与检测按钮始终在场。
47
+ 指纹页签的每个检测结果卡可以逐行折叠/展开(默认收起):点行头的箭头或模型名即可展开,徽章、证据行与检测按钮始终在场。行头只留「N / 3 题」的进度,相似度等明细放在展开的结果卡里。
26
48
 
27
49
  ## 兼容字段与已有配置
28
50
 
@@ -40,38 +62,32 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
40
62
 
41
63
  同一个供应商可以登记多把密钥,请求进来时按「模型 → 密钥」自动分流:
42
64
 
43
- - 密钥按列表顺序排队。一个模型如果多把密钥都能访问,先走列表靠前的那把;某把密钥对某模型请求失败(401/403/408/429/5xx)时,自动换下一把能访问该模型的密钥重试;400/404/422 这类请求本身的问题不重试,直接返回。被拒的那把密钥会记住这次失败(时长取自 `Retry-After`,没有就按「太频繁」60 秒、「额度耗尽」30 分钟、「连接被拒」60 秒推算,重复失败翻倍并封顶),下次请求自动排到健康密钥后面;冷却只是排序,密钥永远不会被真正丢弃——全体都在冷却时仍按原顺序尝试。
44
- - 密钥能访问哪些模型在密钥面板的「模型」里手动圈定(候选就是该供应商已添加的模型,做成多选胶囊),也可留空表示不限制。「获取模型」按钮会按「这把密钥实际会被派到哪些协议/地址」读取目录,见下节。
65
+ - 密钥按列表顺序排队。一个模型如果多把密钥都能访问,先走列表靠前的那把;某把密钥对某模型请求失败时:401/403/408/429/5xx 自动换下一把能访问该模型的密钥重试;**响应体说明「这个模型(或这个分组)没有它」**时也换下一把——`model_not_found`、`Model "…" is not supported by any configured account in this group`、`no available channel`,以及中文的「模型不存在/不支持/无可用渠道」等文案都算,因为这说的是**这把密钥所在的上游分组没有这个模型**,换一把密钥可能就有。**裸 404**(如 `404 page not found`)与 400/422 这类请求本身的问题仍然不重试,立即返回。所有密钥都拒绝同一个模型时,返回的错误里会补一句「这个供应商的全部 N 把密钥都拒绝了模型 X,通常是各密钥所在的分组不同」,而不是只留一句看不懂的 404。被拒的那把密钥会记住这次失败(时长取自 `Retry-After`,没有就按「模型没有」10 分钟、「太频繁」60 秒、「额度耗尽」30 分钟、「连接被拒」60 秒推算,重复失败翻倍并封顶),下次请求自动排到健康密钥后面;「模型没有」这条只冷却**这一对(密钥, 模型)**,同一把密钥的其它模型照常由它服务。冷却只是排序,密钥永远不会被真正丢弃——全体都在冷却时仍按原顺序尝试。
66
+ - 密钥能访问哪些模型在密钥面板的「模型」里圈定(候选就是该供应商已添加的模型,做成多选胶囊),也可留空表示不限制。需要更多模型时用模型页的「获取模型」手动读取并勾选,见下文。
67
+ - **保存后自动探测各密钥支持的模型**:供应商保存之后(以及新增/更换密钥、改动端点地址之后),插件会在后台按密钥逐把读取它自己的模型目录,并自动为每把密钥勾选「它列出的模型 ∩ 已添加到该供应商的模型」;某把密钥能服务全部已添加模型时保持「通吃」不再重复写。这套自动勾选的范围随每次保存重新校准。探测完全在后台进行,界面上没有任何中间过程——唯一可见的变化就是探测结束后密钥上的勾选直接更新。只要你在「模型」表单里手动保存过一次,这个范围就归你管,探测不再改动它。探测只读目录接口,不会用你的模型发请求。
45
68
  - 未圈定模型清单的密钥视为「通吃」,可以服务任何模型;圈定后只服务清单内的模型。
69
+ - 除了手写清单,插件还会**记住每把密钥各自的目录读到过什么**:宿主读取目录(模型页「获取模型」)时,插件按密钥逐把读取并把结果记在 `key-index.json` 同目录的 `key-serves.json`,只用于排序与提示,不写入你的清单。规则是「同一供应商下,别的密钥的目录里有这个模型、而这把没有」→ 这把不再作为该模型的候选;只有这一把的目录里有 → 它优先;没有任何密钥列出过(或还没读过)→ 当作未知,照旧都试。密钥面板的「模型」表单会显示这层观察结果,并给一个「用探测结果」按钮把它填进清单。某把密钥读取失败=未知,绝不会被当成「它什么模型都没有」;文件损坏时按空文件处理。
46
70
  - 每把密钥行首有一个圆形对勾开关:亮起表示参与路由,灰色表示暂停使用。停用只是把密钥移出分流池,别名、模型清单与协议指定全部保留,重新点亮即恢复;最后一把启用中的密钥不允许停用(否则请求会回落到适配器自身的单密钥路径,仍然用刚被停用的那把签名)。
71
+ - 「添加另一个密钥」会优先**填回已经列出、但凭据库里还没有值的引用**,而不是再铸一个新名字。这条是为跨机同步准备的:配置从另一台电脑同步过来时,点名的 `XXX_API_KEY_2` 在这台还没有值,直接填进去两台的名字就一致了;若改成铸 `XXX_API_KEY_3`,名字会分叉,旧名字还会在面板上留一行「未存储」的残行。填回时别名、模型清单与协议指定都保留(只补值,不改标签)。库里已有值的引用不会被顶掉——那种情况下仍然铸新名字。
47
72
  - 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json`,只记录引用、别名、模型清单、协议指定、各协议族地址与启停状态,绝不保存密钥值(密钥值始终由 DSH 凭据库保管)。
48
- - 新增供应商的表单在官方密钥输入框下方也带这套卡片式密钥列表:草稿密钥先暂存在本页,点「创建」供应商落库后自动写入,第一把草稿密钥自动成为启用密钥。挂载前已敲进官方输入框的值保留在原处——官方框保存的仍是那把密钥(卡片「获取模型」用的就是它),下方的列表只收之后新增的。刷新页面会丢弃草稿,与表单自身行为一致;若 id 撞上已存在的供应商,草稿不会写入对方。
73
+ - 新增供应商的表单在官方密钥输入框下方也带这套卡片式密钥列表:草稿密钥先暂存在本页,点「创建」供应商落库后自动写入,第一把草稿密钥自动成为启用密钥。挂载前已敲进官方输入框的值保留在原处——官方框保存的仍是那把密钥,下方的列表只收之后新增的。刷新页面会丢弃草稿,与表单自身行为一致;若 id 撞上已存在的供应商,草稿不会写入对方。
49
74
 
50
75
  ### 按密钥切换协议与多地址
51
76
 
52
77
  有些供应商同一把密钥只在某一种线上协议下可用(例如同一家既有 OpenAI Chat Completions 端点、又有 Anthropic Messages 端点)。插件支持在密钥面板里给每把密钥单独指定协议:
53
78
 
54
- - 「这个密钥可用的协议」默认「自动(按模型)」——每个请求按模型自己所属的协议族挑线路:claude 系模型走 Anthropic 地址、gemini 系走 Gemini 地址(前提是供应商配置了对应族的地址),其余模型沿用该供应商自身配置的协议。也可为密钥指定 Anthropic / Chat Completions / Responses / Gemini 中的一个;菜单只列出供应商已配置地址的那些档(已钉的档即使地址后来被清掉也会保留显示),选「自动」即解除指定。
79
+ - 「这个密钥可用的协议」默认「自动(按模型)」——每个请求按模型自己所属的协议族挑线路:claude 系模型走 Anthropic 地址(前提是供应商配置了对应族的地址),其余模型沿用该供应商自身配置的协议。也可为密钥指定 Anthropic / Chat Completions / Responses 中的一个;菜单只列出供应商已配置地址的那些档(已钉的档即使地址后来被清掉也会保留显示),选「自动」即解除指定。
55
80
  - 给某把密钥指定协议后,命中该密钥的请求会真正换用对应的线上协议(不只是换 URL/鉴权头:请求体也按该协议重新编码),由插件在 pi-ai 适配层重新派发到 `@earendil-works/pi-ai` 的对应协议实现。
56
- - 供应商可以按「地址家族」配置最多三个基础地址:一个 OpenAI 系(Chat Completions / Responses 共用)、一个 Anthropic 系、一个 Gemini 系。供应商卡片「API 地址」下方的「更多端点」会展开当前协议家族之外的其他家族地址行。密钥指定协议后,就用与之匹配的那个地址;「自动」档的密钥按模型所属族使用对应地址,模型不属任何已配地址的族时仍使用供应商自身的 `baseURL`。
57
- - 若密钥指定的协议跨了地址家族(如 OpenAI 系 ↔ Anthropic 系 ↔ Gemini 系)而供应商**没有**配置该家族的地址,这条指定不会生效:请求仍用供应商自身的协议和 `baseURL`,只由这把密钥签名。把 OpenAI 格式的请求体发到 Anthropic/Gemini 家族的地址只会换来网关的 `404`/`400`(模型根本不会被调用),所以宁可不换。这条在**每次调用时**都重新判定,供应商地址补上后同一个模型立刻换用该协议的密钥。「自动」档同理:某族没有地址就回落到供应商自身的协议。
81
+ - 供应商可以按「地址家族」配置最多两个基础地址:一个 OpenAI 系(Chat Completions / Responses 共用)、一个 Anthropic 系。供应商卡片「API 地址」下方的「更多端点」会展开当前协议家族之外的其他家族地址行。密钥指定协议后,就用与之匹配的那个地址;「自动」档的密钥按模型所属族使用对应地址,模型不属任何已配地址的族时仍使用供应商自身的 `baseURL`。
82
+ - 若密钥指定的协议跨了地址家族(如 OpenAI 系 ↔ Anthropic 系)而供应商**没有**配置该家族的地址,这条指定不会生效:请求仍用供应商自身的协议和 `baseURL`,只由这把密钥签名。把 OpenAI 格式的请求体发到 Anthropic 家族的地址只会换来网关的 `404`/`400`(模型根本不会被调用),所以宁可不换。这条在**每次调用时**都重新判定,供应商地址补上后同一个模型立刻换用该协议的密钥。「自动」档同理:某族没有地址就回落到供应商自身的协议。
58
83
  - 自动挑错线路有记忆:某族地址对一个模型返回了「还没产生内容就失败」(典型如网关 404)后,这个 (供应商, 模型) 组合的自动解析不再挑那一族,改用供应商自身协议,直到插件进程重启;成功过的线路也会被记住并优先使用。钉选协议的密钥不受这层记忆影响——钉选表达的是用户的明确意图,其失败只说明凭据问题。
59
- - 两把密钥指定了不同协议(或「自动」档解析出了不同协议)时,先试哪把不再取决于列表顺序,而是按「这个模型看起来属于哪一族」排:模型名(含 `anthropic/`、`openai/`、`google/gemini-…` 这类前缀或裸名;族名记号——`claude`、`gpt`、`gemini`、`gemma` 等——后跟 `-`/`/`/`:`/`.`/`_` 分隔符或位于名字结尾才算,Ollama 风格的 `gemma3:27b` 这类族名后直接跟数字的拼写不在此列)与密钥协议的家族一致者优先,其次是以本密钥自身地址就能直接服务的,再次是不一致但能回落到供应商主地址的,最后是跨族且没有自己地址的。请求会从排第一的密钥的协议开始——切协议意味着换请求体形状,一次只切一把密钥,失败后按此顺序换下一把。
84
+ - 两把密钥指定了不同协议(或「自动」档解析出了不同协议)时,先试哪把不再取决于列表顺序,而是按「这个模型看起来属于哪一族」排:模型名(含 `anthropic/`、`openai/` 这类前缀或裸名;族名记号——`claude`、`gpt`、`codex` 等——后跟 `-`/`/`/`:`/`.`/`_` 分隔符或位于名字结尾才算)与密钥协议的家族一致者优先,其次是以本密钥自身地址就能直接服务的,再次是不一致但能回落到供应商主地址的,最后是跨族且没有自己地址的。请求会从排第一的密钥的协议开始——切协议意味着换请求体形状,一次只切一把密钥,失败后按此顺序换下一把。
60
85
  - 同一协议(wire)的密钥会被当作一个池:先把这个池里的密钥都用完再换 wire,因为同一把密钥失败通常与协议无关;跨 wire 的切换排在池之后,且只有在上一次失败的请求还没开始产生内容时才会做。
61
86
  - 请求进行到一半再失败(已经开始流式输出、或调用方已经主动取消)不会触发换密钥——客户端已经消费了已经发出的内容,重放只会产生重复输出。
62
87
  - 密钥面板的「模型」选择是可点选的模型清单(该供应商已添加的模型做成多选胶囊),选中的模型才交给这把密钥;下面的「全部模型」表示不做限制。该项与其它操作按钮一样只在悬停时显示。
63
- - 模型页供应商卡片的「获取模型」按密钥逐一分担目录读取,每把密钥按它实际会被派到的协议/地址询问(见下条),结果合并为一份目录——这正是路由真正可用的模型全体:
64
- - 没指定协议的密钥,分别问供应商自身协议的地址、以及供应商配置了的其他族地址(配了几族就问几族),得到的模型取并集——这正是它实际会被派到的几条线。
65
- - 指定了协议的密钥只问它自己那条线:同族指定仍用供应商主地址,跨族指定用该族的基础地址(没配则沿用主地址,问不到就算这把这次没答)。
66
- - 每把密钥的结果互不影响:一把被拒不影响另一把把模型写进目录,且一把这次问不到不会让目录缩小——它上次读到的模型仍保留(内部记着「这把上次见过什么」,下次成功后自动刷新)。
67
- - 供应商本身的协议插件说不出(不是 Chat Completions / Responses / Anthropic Messages / Gemini 之一)时,该协议的地址不猜列目录路径;配了某一族的基础地址就只问配了地址的那几族。
68
- - **单个密钥也一样**——只要供应商配置了多个地址(或该密钥指定了协议),获取到的就是全部地址上模型的并集,而不是只有供应商自身协议那一份;供应商卡里原配的那把密钥(从未在密钥面板列出过的)同样按「自动(按模型)」参与这条合并。
69
-
70
- ### Gemini 原生协议
71
-
72
- - 「Gemini」档指 Google 原生协议(`gemini model: generateContent / streamGenerateContent`,鉴权用 `x-goog-api-key`)。受 DSH 宿主适配层限制,供应商卡片的「API 协议」下拉里不会有 Gemini;原生访问一律通过「更多端点里的 Gemini 地址行 + 密钥指定 Gemini」完成,供应商自身的协议保持 OpenAI/Anthropic 三选一即可(纯 Gemini 网关可把主地址指向该网关任意可答路径)。
73
- - Gemini 地址需包含版本段(官方为 `https://generativelanguage.googleapis.com/v1beta`);只填裸域名时插件会自动补 `/v1beta`,路径非空则按网关自己的拼写使用。列表探测走原生 `GET {地址}/models?pageSize=1000`,模型名会剥掉 `models/` 前缀,只保留支持 `generateContent` 的条目。
74
- - 思考等级沿用模型上声明的档位:pi-ai 会把 low/medium/high 翻译成 Gemini 的 `thinkingLevel`(Gemini 3 / Gemma 4)或 `thinkingBudget`(2.5 系);在插件的 Thinking 编辑器里为 gemini 模型声明等级后原生请求即会携带。
88
+ - 模型页供应商卡片的「获取模型」是宿主自带的一次普通目录读取:读到的模型在官方勾选列表里供你取舍,勾选后才写入供应商。插件不替你探测目录,也不会自动把任何模型写进供应商或密钥清单;模型清单的每一次变化都来自你的手动勾选、手动添加或密钥面板的「模型」圈定。插件只是顺带观察这次读取里每把密钥各自返回了什么(见上一条),并在多把密钥的目录合并时做一次保守过滤:只有当这个供应商的**每一把**启用密钥都成功给出了目录、且没有任何一把列出某模型时,该模型不出现在合并结果里(有密钥没读到=情况未知,不过滤)。
89
+
90
+ 插件不再支持 Gemini 原生协议或专用端点。旧的 `google-generative-ai` 密钥协议指定会按无效值回到「自动」,旧的 `gemini` 端点字段会在读取时忽略,并在下次保存插件密钥索引时移除。模型知识库中的 Gemini 思考档位仍保留,供支持 OpenAI 兼容协议的网关使用;不会根据 Gemini/Gemma 模型名自动切换到原生协议。若供应商主协议曾被手工设置为 `google-generative-ai`,仍需改回宿主支持的协议,并填写对应的兼容地址;插件不会自动改写宿主供应商配置。
75
91
 
76
92
  ## 开发与验证
77
93
 
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Reading a provider's balance out of its balance endpoint's answer.
3
+ *
4
+ * Balance APIs are not standardised: a DeepSeek-compatible gateway answers
5
+ * `balance_infos[].total_balance`, an OpenAI-compatible one usually carries
6
+ * `total_available`, a Moonshot-style one nests `available_balance` under
7
+ * `data`, and some return a bare number. The host therefore does not try to
8
+ * understand a vendor: it walks the decoded JSON and picks the first value
9
+ * whose FIELD reads like a balance, preferring the loudest spelling (`balance`)
10
+ * over weaker synonyms (`remaining`, `credit`, `amount`) and shallower values
11
+ * over deeper ones. A response with no recognisable field yields no reading, so
12
+ * the page shows nothing rather than a made-up zero.
13
+ *
14
+ * This module is deliberately free of `node:` imports: the browser half uses
15
+ * {@link formatBalance} to render the chip, and the host half uses
16
+ * {@link parseBalancePayload} on the raw response. Pure functions only, so both
17
+ * sides share one definition of "a balance".
18
+ *
19
+ * @module dsh-model-think-level/balance
20
+ */
21
+ /** A balance read from a provider endpoint. */
22
+ export interface BalanceReading {
23
+ /** The amount itself, in the endpoint's own currency/unit. */
24
+ readonly amount: number;
25
+ /** ISO code or symbol the endpoint named, when it named one. */
26
+ readonly currency?: string;
27
+ }
28
+ /**
29
+ * Read one balance endpoint's raw response body.
30
+ *
31
+ * JSON is preferred; a body that is not JSON is accepted only when the whole
32
+ * (trimmed) body is a number, which covers the plain-text balance endpoints.
33
+ * @param text - the raw response body, as text.
34
+ * @returns the reading, or undefined when nothing in it names a balance.
35
+ */
36
+ export declare function parseBalancePayload(text: string): BalanceReading | undefined;
37
+ /**
38
+ * Render a reading for the provider row: `$12.34` when the endpoint named a
39
+ * currency the plugin knows, `12.34 USD` for other codes, and the bare number
40
+ * when it named no currency at all.
41
+ * @param reading - the parsed balance.
42
+ * @returns the display text, never empty.
43
+ */
44
+ export declare function formatBalance(reading: BalanceReading): string;
@@ -21,6 +21,18 @@ export interface ComposerSliderProps {
21
21
  /** Localized copy (the plugin's bound translator). */
22
22
  t: Translator;
23
23
  }
24
+ /** A model row of one provider group, as the directory exposes it. */
25
+ interface ModelChoiceLike {
26
+ id: string;
27
+ name?: string;
28
+ /** The declared effort ladder; present when the model reasons at all. */
29
+ reasoning?: {
30
+ efforts?: readonly unknown[];
31
+ defaultEffort?: string;
32
+ };
33
+ /** Declared request modalities in core vocabulary (`image` = vision). */
34
+ input?: readonly string[];
35
+ }
24
36
  /** Provider label: the SDK face names it differently across kernel lines. */
25
37
  export declare function providerLabelOf(group: DirectoryGroupLike): string;
26
38
  /**
@@ -30,6 +42,13 @@ export declare function providerLabelOf(group: DirectoryGroupLike): string;
30
42
  * intensity whatever the ladder spells its levels.
31
43
  */
32
44
  export declare function effortRampColor(t: number): string;
45
+ /**
46
+ * The capability badges of one model, or null when it declares none: the eye
47
+ * for image input, the sparkle for a declared ladder, the frame-with-sparkle
48
+ * for a 生图 generator. Exported for the order regression (视觉 → 思考 → 生图)
49
+ * the image-generation design pins.
50
+ */
51
+ export declare function modelTags(model: ModelChoiceLike, t: Translator, configuredInput?: readonly string[], imageGen?: boolean): ReactNode;
33
52
  /**
34
53
  * Render the model switcher and the reasoning-level footer. Both values come
35
54
  * from the store; the commit travels through {@link ModelDirectoryLike.select}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The plugin's config pane: a floating panel ABOVE the settings dialog
3
+ * (z-index 1010 — the dialog's own opaque mask sits at 1000), opened from the
4
+ * Models-page title-row button.
5
+ *
6
+ * One card today, 「生图」, per the design's card-list shape with room for
7
+ * more: the params row, the default-model select under it, the derived
8
+ * image-model list (per-row endpoint badge + test/probe actions), the empty
9
+ * state with one-click marking of suspected
10
+ * image models (written through the SAME settings channel the Models page
11
+ * editor uses — never a raw file edit), and the built-in-tool status card
12
+ * whose state the host reports from its live tools/attachments registration.
13
+ *
14
+ * Esc / backdrop / ✕ close it; the wrapper unmounts and the page keeps
15
+ * whatever the pane saved.
16
+ *
17
+ * @module dsh-model-think-level/client/ConfigPane
18
+ */
19
+ import type { ReactNode } from 'react';
20
+ import type { RemoteApi } from './types.js';
21
+ /** The pane's deps: the settings write/read face and the plugin translator. */
22
+ export interface ConfigPaneProps {
23
+ readonly api: RemoteApi;
24
+ readonly t: (key: string, params?: Record<string, unknown>) => string;
25
+ readonly onClose: () => void;
26
+ }
27
+ /** The 「生图」 card. */
28
+ export declare function ImageGenCard(props: {
29
+ api: RemoteApi;
30
+ t: (key: string, params?: Record<string, unknown>) => string;
31
+ }): ReactNode;
32
+ /**
33
+ * The floating pane. Exported for tests: render it inside a chosen container.
34
+ */
35
+ export declare function ConfigPane(props: ConfigPaneProps): ReactNode;
36
+ /** The pane's mount face: a disposer that closes and unmounts. */
37
+ export interface ConfigPaneMount {
38
+ close(): void;
39
+ }
40
+ /**
41
+ * Mount the pane at body level (the same shape the other floating seats use).
42
+ * @returns a disposer; the pane also disposes itself on Esc/backdrop/✕.
43
+ */
44
+ export declare function mountConfigPane(deps: {
45
+ api: RemoteApi;
46
+ t: (key: string, params?: Record<string, unknown>) => string;
47
+ }): ConfigPaneMount;
@@ -77,13 +77,6 @@ export interface EffortEditorProps {
77
77
  * split and is no longer read.
78
78
  */
79
79
  officialInputTypes?: boolean;
80
- /**
81
- * Report whether this card currently covers the official capacity and
82
- * input-type chrome. The card exists only while the thinking switch is on;
83
- * when it is off the row's own official controls have to come back, or a
84
- * model that declares no reasoning would lose every way to edit its window.
85
- */
86
- onCoverageChange?: (covered: boolean) => void;
87
80
  /** The write seam (settings.mutate plus the suggestion engine). */
88
81
  api: EffortEditorApi;
89
82
  /** Read-only (settings document not writable). */
@@ -158,5 +151,5 @@ export declare function pendingWriteOf(parts: PendingWriteParts): PendingWrite;
158
151
  * checkboxes, the modality toggle, the auto-adapt action, and the
159
152
  * apply/reset actions that own both sections.
160
153
  */
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;
154
+ export declare function EffortEditor({ route, routeApi, routeBaseURL, modelId, modelName, efforts: initialEfforts, effortsUnset, input: initialInput, imageGen: initialImageGen, compat: initialCompat, defaultEffort: initialDefaultEffort, index, staged, officialInputTypes, api, readOnly, t }: EffortEditorProps): ReactNode;
162
155
  export type { DraftLevels };
@@ -31,8 +31,8 @@
31
31
  * that API shape (Anthropic Messages, Chat Completions or Responses) instead
32
32
  * of the provider's default, and uses the matching base URL. A key left on
33
33
  * "auto" speaks each model's own wire: claude models against the Anthropic
34
- * address, gemini models against the Gemini one, the rest the provider's
35
- * protocol — wherever that address is configured. The protocol picker lives
34
+ * address, the rest the provider's protocol — wherever that address is
35
+ * configured. The protocol picker lives
36
36
  * in the same hover-revealed action tray as the other actions.
37
37
  * - **a value is shown masked, or not at all.** The host reads the stored
38
38
  * secret and answers a head-and-tail preview; the middle never leaves it,
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The browser half's client for one provider's balance.
3
+ *
4
+ * The request itself is host-side ({@link BALANCE_PATH}): the balance URL is a
5
+ * third-party origin that the page could not read through CORS, and the call is
6
+ * signed with a key only the host can resolve. This module only carries the
7
+ * route name and the host's answer.
8
+ *
9
+ * `configured: false` is a SUCCESS: it means the provider has no balance
10
+ * endpoint, which is the normal state for most routes and the reason no chip is
11
+ * painted. A refusal (`ok: false`) is kept separate so a broken endpoint never
12
+ * reads as "never configured" and the next scan can try again.
13
+ *
14
+ * @module dsh-model-think-level/client/balance-client
15
+ */
16
+ /** The host's answer for one route. */
17
+ export interface ProviderBalanceAnswer {
18
+ readonly ok: boolean;
19
+ /** False when the route has no balance endpoint at all. */
20
+ readonly configured?: boolean;
21
+ /** The parsed amount, when the endpoint answered one. */
22
+ readonly amount?: number;
23
+ /** ISO code or symbol the endpoint named. */
24
+ readonly currency?: string;
25
+ /** The host's wording when the read failed. */
26
+ readonly error?: string;
27
+ }
28
+ /** The transport, injectable so the row can be tested without a host. */
29
+ export interface BalanceClient {
30
+ /** Read one route's balance from the host. */
31
+ read(route: string): Promise<ProviderBalanceAnswer>;
32
+ }
33
+ /** The live client: same-origin fetch against the host's balance route. */
34
+ export declare const httpBalanceClient: BalanceClient;
@@ -21,6 +21,35 @@ export interface EndpointsChangedDetail {
21
21
  readonly openai: string;
22
22
  /** Its Anthropic-family base URL, '' when unset. */
23
23
  readonly anthropic: string;
24
- /** Its Gemini-family base URL, '' when unset (absent from older events). */
25
- readonly gemini?: string;
24
+ }
25
+ /**
26
+ * Fired on `document` when the settings document moved (the pi-ai namespace,
27
+ * whose provider routes this page edits).
28
+ *
29
+ * The key panels are separate mounts from the page's scan, and a save is
30
+ * exactly the moment their route's facts changed: the panel re-reads on this
31
+ * event instead of waiting for a remount, which is also how the host's silent
32
+ * post-save scope probe reaches an already-open panel.
33
+ */
34
+ export declare const SETTINGS_CHANGED_EVENT = "bre:settings-changed";
35
+ /** What {@link SETTINGS_CHANGED_EVENT} carries. */
36
+ export interface SettingsChangedDetail {
37
+ /** The namespace that moved. */
38
+ readonly ns: unknown;
39
+ }
40
+ /**
41
+ * Fired on `document` when a route's BALANCE endpoint moved.
42
+ *
43
+ * The URL is written from the provider card's balance row, which lives in a
44
+ * different mount from the provider list that shows the amount. The card cannot
45
+ * reach that list, so it says the URL changed and the Models page re-reads the
46
+ * route immediately instead of waiting out the chip's refresh window.
47
+ */
48
+ export declare const BALANCE_CHANGED_EVENT = "bre:balance-changed";
49
+ /** What {@link BALANCE_CHANGED_EVENT} carries. */
50
+ export interface BalanceChangedDetail {
51
+ /** The route whose balance endpoint moved. */
52
+ readonly route: string;
53
+ /** The stored URL, '' when the row was cleared. */
54
+ readonly endpoint: string;
26
55
  }
@@ -0,0 +1,75 @@
1
+ import type { ImageModel } from '../image/config.js';
2
+ /** 传输层的失败:一句面向用户的原因。 */
3
+ export type TransportAnswer<T> = {
4
+ ok: true;
5
+ data: T;
6
+ } | {
7
+ ok: false;
8
+ error: string;
9
+ };
10
+ /** GET image-config 的 tool 块:原生 generate_image 的注册状态。 */
11
+ export interface ImageToolView {
12
+ registered: boolean;
13
+ name: string | null;
14
+ }
15
+ /** GET image-config 的应答体(结构声明:浏览器不 import host-only 模块)。 */
16
+ export interface ImageConfigView {
17
+ models: ImageModel[];
18
+ defaultModel: string | null;
19
+ defaults: {
20
+ size: string;
21
+ quality: string;
22
+ n: number;
23
+ timeoutMs: number;
24
+ };
25
+ outputDir: string;
26
+ syncedAt?: string;
27
+ tool: ImageToolView;
28
+ }
29
+ /** 画配置页之前就能拿到的快照(没有过就读不到)。 */
30
+ export declare function cachedImageConfigView(): ImageConfigView | undefined;
31
+ /** 丢掉缓存:测试重置用,登出/换账号时也可以先清一次。 */
32
+ export declare function clearImageConfigCache(): void;
33
+ /**
34
+ * 预热配置:模型页一挂载就发一次 GET,用户点「生图服务」时缓存已经就位。
35
+ * 失败不管——真正打开时会再读一次并把错误显示出来。
36
+ */
37
+ export declare function prefetchImageConfigView(): void;
38
+ /**
39
+ * 读生图配置(宿主先重同步再回答,所以快照不会过期)。
40
+ */
41
+ export declare function readImageConfigView(): Promise<TransportAnswer<ImageConfigView>>;
42
+ /** 保存默认模型/默认参数/输出目录。 */
43
+ export declare function saveImageConfig(patch: {
44
+ defaultModel?: string | null;
45
+ defaults?: Partial<{
46
+ size: string;
47
+ quality: string;
48
+ n: number;
49
+ timeoutMs: number;
50
+ }>;
51
+ outputDir?: string;
52
+ }): Promise<TransportAnswer<undefined>>;
53
+ /** 对一行模型发起端点测试(n:1、最小尺寸的真实请求)。 */
54
+ export declare function testImageEndpoint(id: string): Promise<TransportAnswer<{
55
+ status: string;
56
+ checkedAt?: string;
57
+ }>>;
58
+ /** 显式生成(辅通道):拿全部落盘路径直接弹预览。 */
59
+ export declare function generateImageDirect(request: {
60
+ model?: string;
61
+ prompt: string;
62
+ size?: string;
63
+ quality?: string;
64
+ n?: number;
65
+ referenceImages?: readonly string[];
66
+ }): Promise<TransportAnswer<{
67
+ images: readonly string[];
68
+ model: string;
69
+ paramsUsed: {
70
+ size: string;
71
+ quality: string;
72
+ n: number;
73
+ };
74
+ warning?: string;
75
+ }>>;
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module dsh-model-think-level/client/injection/autofill-run
9
9
  */
10
- import type { RemoteApi } from '../types.js';
10
+ import type { RemoteApi, SettingsJoin } from '../types.js';
11
11
  /** What the complement needs from its host. */
12
12
  export interface IdleAutofillDeps {
13
13
  /** The settings remote. */
@@ -16,7 +16,7 @@ export interface IdleAutofillDeps {
16
16
  /** The complement's face. */
17
17
  export interface IdleAutofill {
18
18
  /** Run the complement; fire-and-forget on the injector's idle pass. */
19
- run: () => void;
19
+ run: (join?: SettingsJoin) => void;
20
20
  /** Drop the host-switch snapshot; the next idle run reads it again. */
21
21
  invalidate: () => void;
22
22
  }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * The Models-page title-row seat: the 「生图服务」 button at the right end of
3
+ * the 「模型」 heading line, opening the plugin's image-service config pane.
4
+ *
5
+ * The official `settings.action` slot lands in the DIALOG's top bar (beside
6
+ * 「打开配置文件」), not on the heading — and the Models page itself exposes
7
+ * only footer/provider-card/sign-in slots. So the seat is built the way
8
+ * add-card.ts builds its pane host: a plugin-owned `div.bre-config-host`
9
+ * appended to the heading's row, compare-before-write, idempotent via the
10
+ * host node's presence.
11
+ *
12
+ * The heading anchor is deliberately a pure function ({@link findModelsTitleRow})
13
+ * with fixture tests, and it FAILS CLOSED: on any structural drift it returns
14
+ * null and the button does not render — a wrong element must never receive a
15
+ * plugin button.
16
+ *
17
+ * This anchor rides a DOM coincidence (the host's Models page heading is the
18
+ * sole element whose whole text reads 「模型」/“Models” in the section that
19
+ * carries the provider row cards). The host nests the cards in a `ul` and
20
+ * puts the heading as its SIBLING in `div.jrmgQW_section`; an earlier host
21
+ * version kept both as direct children of the content column. The anchor
22
+ * therefore climbs from the cards to the nearest scope that holds the heading,
23
+ * instead of assuming the cards' parent is the content column. The coincidence
24
+ * is asserted by tests/fixtures; when a host change breaks it, the function
25
+ * returns null and the fallback is the `settings.action` slot (see the design's
26
+ * §4.1 备选).
27
+ *
28
+ * @module dsh-model-think-level/client/injection/config-button-seat
29
+ */
30
+ import { createElement } from 'react';
31
+ import { type ForeignMount } from './mount.js';
32
+ /**
33
+ * Locate the Models page's title LINE, or null. Two gates, both required:
34
+ * 1. the current surface carries the provider-row-card family (the Models
35
+ * page's own anchors — a dialog or panel without them is another page);
36
+ * 2. climbing from the cards to the nearest ancestor that also holds the
37
+ * heading (the host puts `h2.jrmgQW_title` beside `ul.jrmgQW_rows` inside
38
+ * `div.jrmgQW_section`), exactly one element reads as the heading copy and
39
+ * is not a row/nav label.
40
+ * Returns the heading's line element (the heading itself when the host gives
41
+ * it no wrapper), so the seat can append to the line's right end.
42
+ */
43
+ export declare function findModelsTitleRow(root: ParentNode): HTMLElement | null;
44
+ /** The seat's host class (one per Models page, like add-card's pane host). */
45
+ export declare const CONFIG_HOST_CLASS = "bre-config-host";
46
+ /**
47
+ * The class that turns the anchor into the title LINE (flex + vertical
48
+ * centring), so the seat sits at the line's right end via `margin-left:auto`
49
+ * even when the host gives the heading no wrapper of its own. Plugin-owned and
50
+ * removed with the seat.
51
+ *
52
+ * The same two declarations are ALSO written inline by
53
+ * {@link ensureConfigButtonSeat}: the host is React, and its next render of the
54
+ * heading sets `className` back to the hashed title class, silently dropping
55
+ * this class. Inline styles are not part of the host's vdom, so they survive
56
+ * that render — without them the seat keeps existing while the line stops being
57
+ * a flex row, and the button slides back next to the 「模型」 text until the
58
+ * seat happens to be rebuilt.
59
+ */
60
+ export declare const CONFIG_TITLE_LINE_CLASS = "bre-config-title-line";
61
+ /** What the seat needs. `onOpen` opens the config pane. */
62
+ export interface ConfigButtonSeatDeps {
63
+ /** The plugin's translator. */
64
+ readonly t: (key: string, params?: Record<string, unknown>) => string;
65
+ /** Open the config pane (the button's single job). */
66
+ readonly onOpen: () => void;
67
+ }
68
+ /** One scan's seat state: the row the seat lives on and its React root. */
69
+ export interface ConfigButtonSeatState {
70
+ readonly mounts: Map<HTMLElement, ForeignMount>;
71
+ }
72
+ export declare function createConfigButtonSeatState(): ConfigButtonSeatState;
73
+ /**
74
+ * Ensure the title line carries the button — and, just as important, still
75
+ * LOOKS like a line. Idempotent in the settled case, with one re-assertion:
76
+ * when the host re-rendered the heading and reset `className` (dropping the
77
+ * flex class but leaving our seat in place), the line mechanics are put back
78
+ * instead of trusting the class.
79
+ */
80
+ export declare function ensureConfigButtonSeat(row: HTMLElement, deps: ConfigButtonSeatDeps, state: ConfigButtonSeatState): void;
81
+ /** Take one line's seat down (restoring the host's own line styling). */
82
+ export declare function dropSeat(row: HTMLElement, state: ConfigButtonSeatState): void;
83
+ /** Take every seat down, including strays a dead fiber left behind. */
84
+ export declare function teardownConfigButtonSeats(state: ConfigButtonSeatState): void;
85
+ /**
86
+ * The 「生图服务」 button: a round icon-only seat. The copy lives only in the
87
+ * button's attributes (`title` tooltip + `aria-label`), never as a text node —
88
+ * the Models page heading line is tight, and a labelled pill there competed
89
+ * with the host's own title. The circle keeps the same hit area as the pills
90
+ * beside it (28px) while the label stays available on hover and to assistive
91
+ * tech.
92
+ */
93
+ export declare function ConfigButton(props: {
94
+ t: (key: string) => string;
95
+ onOpen: () => void;
96
+ }): ReturnType<typeof createElement>;
@@ -7,9 +7,9 @@
7
7
  * list by — the id is being typed, and the drafts wait in the session ledger
8
8
  * (`staged-keys`) for the route the card's own 保存 declares — so the list is
9
9
  * the draft pane (`create-keys-pane`), not the host-backed one. Second, the
10
- * official box keeps what the user typed into it: the create card is a FORM,
11
- * and its own 保存 is what stores the provider's first key. The list below is
12
- * for adding further keys, and lands once the route is declared.
10
+ * official box mirrors the first enabled list key: the create card uses its
11
+ * own draft for Fetch models and 保存. The ledger reuses that saved key and
12
+ * stores the rest of the list once the route is declared.
13
13
  *
14
14
  * The field keeps the edit card's managed-field handover: `bre-key-managed`
15
15
  * stands the official input down (the list below says the same thing once per
@@ -23,7 +23,7 @@
23
23
  import type { ReactNode } from 'react';
24
24
  import type { Translate } from '@deepseek-ai/dsh-client-ui-slots';
25
25
  import type { RemoteApi } from '../types.js';
26
- import { type DraftKeyStore, type StagedKeysState } from './staged-keys.js';
26
+ import { type DraftKeyStore, type StagedKeysState, type StagedKeyDraft } from './staged-keys.js';
27
27
  export interface CreateKeysPaneProps {
28
28
  /** The plugin's seat right after the official key field; the id read and the
29
29
  * input listener both resolve the card from it. */
@@ -41,6 +41,8 @@ export interface CreateKeysPaneProps {
41
41
  routeIdLabels: () => readonly string[];
42
42
  /** The session's deferred-key ledger. */
43
43
  staged: StagedKeysState;
44
+ /** Mirror the enabled draft key into the official form used by Fetch models. */
45
+ onChange?: (drafts: readonly StagedKeyDraft[]) => void;
44
46
  }
45
47
  /** One create card's key list: the draft list itself, wired to the live id. */
46
- export declare function CreateKeysPane({ host, store, api, t, routeIdLabels, staged }: CreateKeysPaneProps): ReactNode;
48
+ export declare function CreateKeysPane({ host, store, api, t, routeIdLabels, staged, onChange }: CreateKeysPaneProps): ReactNode;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The provider editor's segmented control
3
- * (供应商配置 / 模型配置 / 指纹检测 / 高级配置).
3
+ * (供应商配置 / 模型配置 / 高级配置 / 指纹检测).
4
4
  *
5
5
  * This is the bar the editor-tabs pass drives. It lives HERE, in the plugin's
6
6
  * own React subtree, rather than being built by the pass and inserted into the
@@ -46,7 +46,7 @@
46
46
  *
47
47
  * @module dsh-model-think-level/client/injection/editor-tabs
48
48
  */
49
- declare const TAB_IDS: readonly ["provider", "models", "fingerprint", "advanced"];
49
+ declare const TAB_IDS: readonly ["provider", "models", "advanced", "fingerprint"];
50
50
  /** A tab id, as both the bar and the card attribute spell it. */
51
51
  export type EditorTabId = (typeof TAB_IDS)[number];
52
52
  /** The tab ids, in display order, for the tab-bar component. */