dsh-model-think-level 2.0.2 → 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 (61) hide show
  1. package/README.md +49 -23
  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 +34 -16
  6. package/lib/client/KeyManager.d.ts +2 -2
  7. package/lib/client/balance-client.d.ts +34 -0
  8. package/lib/client/capacity.d.ts +20 -4
  9. package/lib/client/configured-inputs.d.ts +11 -2
  10. package/lib/client/events.d.ts +31 -2
  11. package/lib/client/fingerprint-runner.d.ts +13 -1
  12. package/lib/client/image-config-client.d.ts +75 -0
  13. package/lib/client/injection/autofill-run.d.ts +2 -2
  14. package/lib/client/injection/config-button-seat.d.ts +96 -0
  15. package/lib/client/injection/create-key-seat.d.ts +3 -3
  16. package/lib/client/injection/create-keys-pane.d.ts +4 -2
  17. package/lib/client/injection/editor-tab-bar.d.ts +1 -1
  18. package/lib/client/injection/editor-tabs.d.ts +1 -1
  19. package/lib/client/injection/image-card.d.ts +85 -0
  20. package/lib/client/injection/imagegen-completion.d.ts +43 -0
  21. package/lib/client/injection/imagegen-entry.d.ts +22 -0
  22. package/lib/client/injection/key-prefetch.d.ts +44 -0
  23. package/lib/client/injection/key-reveal.d.ts +2 -3
  24. package/lib/client/injection/models-page-editor.d.ts +59 -28
  25. package/lib/client/injection/models-page.d.ts +15 -3
  26. package/lib/client/injection/provider-balance.d.ts +83 -0
  27. package/lib/client/injection/provider-endpoints.d.ts +2 -2
  28. package/lib/client/injection/row-drag.d.ts +7 -0
  29. package/lib/client/injection/staged-keys.d.ts +24 -12
  30. package/lib/client/key-manager-client.d.ts +70 -18
  31. package/lib/client/locales.d.ts +65 -15
  32. package/lib/client/ops.d.ts +12 -2
  33. package/lib/client/styles.d.ts +1 -1
  34. package/lib/client/types.d.ts +21 -3
  35. package/lib/client.js +721 -78
  36. package/lib/client.js.map +4 -4
  37. package/lib/constants.d.ts +58 -0
  38. package/lib/detection.d.ts +7 -0
  39. package/lib/fingerprint/estimate.d.ts +16 -0
  40. package/lib/fingerprint/run.d.ts +24 -0
  41. package/lib/fingerprint/store.d.ts +2 -2
  42. package/lib/fingerprint/verdict.d.ts +53 -3
  43. package/lib/headers-core.d.ts +3 -1
  44. package/lib/headers-fetch.d.ts +25 -0
  45. package/lib/image/command.d.ts +84 -0
  46. package/lib/image/config.d.ts +150 -0
  47. package/lib/image/generate.d.ts +135 -0
  48. package/lib/image/legacy-cleanup.d.ts +29 -0
  49. package/lib/image/sizes.d.ts +28 -0
  50. package/lib/image/tool.d.ts +107 -0
  51. package/lib/index.js +3876 -1745
  52. package/lib/index.js.map +4 -4
  53. package/lib/key-index.d.ts +37 -7
  54. package/lib/key-probe.d.ts +39 -99
  55. package/lib/key-refs.d.ts +43 -19
  56. package/lib/key-route-core.d.ts +100 -32
  57. package/lib/key-serves.d.ts +81 -0
  58. package/lib/knowledge.d.ts +21 -0
  59. package/lib/listing.d.ts +18 -20
  60. package/lib/multi-key-listing.d.ts +3 -3
  61. package/package.json +1 -8
package/README.md CHANGED
@@ -7,12 +7,45 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
7
7
  ![供应商与模型选择器](./docs/image.png)
8
8
  ![思考等级与模型搜索](./docs/image2.png)
9
9
 
10
+ - 每个模型行右侧会显示已声明的上下文窗口(如 `128K`、`1M`,留空则不显示),取自模型上配置的「上下文窗口」字段;该字段与「最大输出」都支持 `K`/`M`/`B`/`T` 简写(如 `200K`、`1M`),也接受纯数字与千分位写法。
11
+ - 输入框的模型切换器只列**对话模型**:被标记为「生图」的模型不再出现在切换器里(供应商计数也不含它们)。生图由对话模型调用插件的原生工具完成——见下文「生图的方式」。
12
+
10
13
  ## 供应商配置
11
14
 
12
15
  ![供应商配置面板](./docs/image3.png)
13
16
  ![模型能力配置](./docs/image4.png)
14
17
  ![供应商高级配置](./docs/image5.png)
15
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
+
30
+ ### 输入模态与生图
31
+
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` 备份),重启后旧工具不再加载。
44
+
45
+ ### 指纹检测
46
+
47
+ 指纹页签的每个检测结果卡可以逐行折叠/展开(默认收起):点行头的箭头或模型名即可展开,徽章、证据行与检测按钮始终在场。行头只留「N / 3 题」的进度,相似度等明细放在展开的结果卡里。
48
+
16
49
  ## 兼容字段与已有配置
17
50
 
18
51
  1.1.4 起不再提供 `thinkingTokenBudgetField`、`vllmPriority`、`supportsMaxOutputTokens` 的专用编辑控件。已有值仍由 DSH 的 pi-ai 适配器使用;修改模型的思考档位或输入模态时,插件会保留这些值和其他手动兼容配置,避免覆盖供应商的定制行为。
@@ -29,39 +62,32 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
29
62
 
30
63
  同一个供应商可以登记多把密钥,请求进来时按「模型 → 密钥」自动分流:
31
64
 
32
- - 密钥按列表顺序排队。一个模型如果多把密钥都能访问,先走列表靠前的那把;某把密钥对某模型请求失败(401/403/408/429/5xx)时,自动换下一把能访问该模型的密钥重试;400/404/422 这类请求本身的问题不重试,直接返回。被拒的那把密钥会记住这次失败(时长取自 `Retry-After`,没有就按「太频繁」60 秒、「额度耗尽」30 分钟、「连接被拒」60 秒推算,重复失败翻倍并封顶),下次请求自动排到健康密钥后面;冷却只是排序,密钥永远不会被真正丢弃——全体都在冷却时仍按原顺序尝试。
33
- - 密钥能访问哪些模型可自动探测(密钥面板的「探测模型」按钮会逐一读取每把密钥各自的 `/models` 列表并记录),也可在「模型」里手动填写覆盖。探测按「这把密钥实际会被派到哪些协议/地址」进行,见下节。
34
- - 未探测过的密钥视为「通吃」,可以服务任何模型;探测后只服务列表内的模型。
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
+ - **保存后自动探测各密钥支持的模型**:供应商保存之后(以及新增/更换密钥、改动端点地址之后),插件会在后台按密钥逐把读取它自己的模型目录,并自动为每把密钥勾选「它列出的模型 ∩ 已添加到该供应商的模型」;某把密钥能服务全部已添加模型时保持「通吃」不再重复写。这套自动勾选的范围随每次保存重新校准。探测完全在后台进行,界面上没有任何中间过程——唯一可见的变化就是探测结束后密钥上的勾选直接更新。只要你在「模型」表单里手动保存过一次,这个范围就归你管,探测不再改动它。探测只读目录接口,不会用你的模型发请求。
68
+ - 未圈定模型清单的密钥视为「通吃」,可以服务任何模型;圈定后只服务清单内的模型。
69
+ - 除了手写清单,插件还会**记住每把密钥各自的目录读到过什么**:宿主读取目录(模型页「获取模型」)时,插件按密钥逐把读取并把结果记在 `key-index.json` 同目录的 `key-serves.json`,只用于排序与提示,不写入你的清单。规则是「同一供应商下,别的密钥的目录里有这个模型、而这把没有」→ 这把不再作为该模型的候选;只有这一把的目录里有 → 它优先;没有任何密钥列出过(或还没读过)→ 当作未知,照旧都试。密钥面板的「模型」表单会显示这层观察结果,并给一个「用探测结果」按钮把它填进清单。某把密钥读取失败=未知,绝不会被当成「它什么模型都没有」;文件损坏时按空文件处理。
35
70
  - 每把密钥行首有一个圆形对勾开关:亮起表示参与路由,灰色表示暂停使用。停用只是把密钥移出分流池,别名、模型清单与协议指定全部保留,重新点亮即恢复;最后一把启用中的密钥不允许停用(否则请求会回落到适配器自身的单密钥路径,仍然用刚被停用的那把签名)。
36
- - 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json`,只记录引用、别名、模型清单、协议指定与启停状态,绝不保存密钥值(密钥值始终由 DSH 凭据库保管)。
37
- - 新增供应商的表单也是这套卡片式密钥列表(不再是单个密钥输入框):密钥先暂存在本页,点「创建」供应商落库后自动写入,第一把自动成为启用密钥;挂载前已敲进官方输入框的值会自动收进列表第一行。刷新页面会丢弃草稿,与表单自身行为一致;若 id 撞上已存在的供应商,草稿不会写入对方。
71
+ - 「添加另一个密钥」会优先**填回已经列出、但凭据库里还没有值的引用**,而不是再铸一个新名字。这条是为跨机同步准备的:配置从另一台电脑同步过来时,点名的 `XXX_API_KEY_2` 在这台还没有值,直接填进去两台的名字就一致了;若改成铸 `XXX_API_KEY_3`,名字会分叉,旧名字还会在面板上留一行「未存储」的残行。填回时别名、模型清单与协议指定都保留(只补值,不改标签)。库里已有值的引用不会被顶掉——那种情况下仍然铸新名字。
72
+ - 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json`,只记录引用、别名、模型清单、协议指定、各协议族地址与启停状态,绝不保存密钥值(密钥值始终由 DSH 凭据库保管)。
73
+ - 新增供应商的表单在官方密钥输入框下方也带这套卡片式密钥列表:草稿密钥先暂存在本页,点「创建」供应商落库后自动写入,第一把草稿密钥自动成为启用密钥。挂载前已敲进官方输入框的值保留在原处——官方框保存的仍是那把密钥,下方的列表只收之后新增的。刷新页面会丢弃草稿,与表单自身行为一致;若 id 撞上已存在的供应商,草稿不会写入对方。
38
74
 
39
75
  ### 按密钥切换协议与多地址
40
76
 
41
77
  有些供应商同一把密钥只在某一种线上协议下可用(例如同一家既有 OpenAI Chat Completions 端点、又有 Anthropic Messages 端点)。插件支持在密钥面板里给每把密钥单独指定协议:
42
78
 
43
- - 「这个密钥可用的协议」有「自动(按模型)」「Anthropic」「Chat Completions」「Responses」「Gemini」五档,默认「自动(按模型)」——每个请求按模型自己所属的协议族挑线路:claude 系模型走 Anthropic 地址、gemini 系走 Gemini 地址(前提是供应商配置了对应族的地址),其余模型沿用该供应商自身配置的协议。
79
+ - 「这个密钥可用的协议」默认「自动(按模型)」——每个请求按模型自己所属的协议族挑线路:claude 系模型走 Anthropic 地址(前提是供应商配置了对应族的地址),其余模型沿用该供应商自身配置的协议。也可为密钥指定 Anthropic / Chat Completions / Responses 中的一个;菜单只列出供应商已配置地址的那些档(已钉的档即使地址后来被清掉也会保留显示),选「自动」即解除指定。
44
80
  - 给某把密钥指定协议后,命中该密钥的请求会真正换用对应的线上协议(不只是换 URL/鉴权头:请求体也按该协议重新编码),由插件在 pi-ai 适配层重新派发到 `@earendil-works/pi-ai` 的对应协议实现。
45
- - 供应商可以按「地址家族」配置最多三个基础地址:一个 OpenAI 系(Chat Completions / Responses 共用)、一个 Anthropic 系、一个 Gemini 系。供应商卡片「API 地址」下方的「更多端点」会展开当前协议家族之外的其他家族地址行。密钥指定协议后,就用与之匹配的那个地址;「自动」档的密钥按模型所属族使用对应地址,模型不属任何已配地址的族时仍使用供应商自身的 `baseURL`。
46
- - 若密钥指定的协议跨了地址家族(如 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`(模型根本不会被调用),所以宁可不换。这条在**每次调用时**都重新判定,供应商地址补上后同一个模型立刻换用该协议的密钥。「自动」档同理:某族没有地址就回落到供应商自身的协议。
47
83
  - 自动挑错线路有记忆:某族地址对一个模型返回了「还没产生内容就失败」(典型如网关 404)后,这个 (供应商, 模型) 组合的自动解析不再挑那一族,改用供应商自身协议,直到插件进程重启;成功过的线路也会被记住并优先使用。钉选协议的密钥不受这层记忆影响——钉选表达的是用户的明确意图,其失败只说明凭据问题。
48
- - 两把密钥指定了不同协议(或「自动」档解析出了不同协议)时,先试哪把不再取决于列表顺序,而是按「这个模型看起来属于哪一族」排:模型名(含 `anthropic/`、`openai/`、`google/gemini-…` 这类前缀或裸名,`gemini`/`gemma` 开头的名字属于 Gemini 族)与密钥协议的家族一致者优先,其次是以本密钥自身地址就能直接服务的,再次是不一致但能回落到供应商主地址的,最后是跨族且没有自己地址的。请求会从排第一的密钥的协议开始——切协议意味着换请求体形状,一次只切一把密钥,失败后按此顺序换下一把。
84
+ - 两把密钥指定了不同协议(或「自动」档解析出了不同协议)时,先试哪把不再取决于列表顺序,而是按「这个模型看起来属于哪一族」排:模型名(含 `anthropic/`、`openai/` 这类前缀或裸名;族名记号——`claude`、`gpt`、`codex` 等——后跟 `-`/`/`/`:`/`.`/`_` 分隔符或位于名字结尾才算)与密钥协议的家族一致者优先,其次是以本密钥自身地址就能直接服务的,再次是不一致但能回落到供应商主地址的,最后是跨族且没有自己地址的。请求会从排第一的密钥的协议开始——切协议意味着换请求体形状,一次只切一把密钥,失败后按此顺序换下一把。
49
85
  - 同一协议(wire)的密钥会被当作一个池:先把这个池里的密钥都用完再换 wire,因为同一把密钥失败通常与协议无关;跨 wire 的切换排在池之后,且只有在上一次失败的请求还没开始产生内容时才会做。
50
86
  - 请求进行到一半再失败(已经开始流式输出、或调用方已经主动取消)不会触发换密钥——客户端已经消费了已经发出的内容,重放只会产生重复输出。
51
- - 密钥面板的「模型」选择改为可点选的真实模型清单(探测得到的模型做成多选胶囊),选中的模型才交给这把密钥;下面的「全部模型」表示不做限制。该项与其它操作按钮一样只在悬停时显示。
52
- - 「探测模型」现在按协议探测,而不是把每把密钥都按供应商默认协议问一遍:
53
- - 没指定协议的密钥,分别问供应商自身协议的地址、以及供应商配置了的其他族地址(配了几族就问几族),得到的模型取并集——这正是它实际会被派到的几条线。
54
- - 指定了协议的密钥只问它自己那条线:同族指定仍用供应商主地址,跨族指定必须用该族的基础地址。
55
- - 跨族指定但供应商没配该族地址的密钥会被**跳过**,原有模型清单保持不变(不会因为问不到就被清空)。
56
- - 供应商本身的协议既不是 Chat Completions / Responses 也不是 Anthropic Messages(插件说不出的协议)时不猜地址,直接提示无法探测;除非面板里配了某一族的基础地址,那就只问配了地址的那几族。
57
- - 探测结果在响应里逐条返回(协议、脱敏后的地址、HTTP 状态、模型数、失败原因),每把密钥的结果互不影响:一族被拒不影响另一族把模型写进清单。
58
- - 模型页供应商卡片的「获取模型」走同一套合并:按上面的规则问过每把密钥实际会被派到的几条线后取并集。**单个密钥也一样**——只要供应商配置了多个地址(或该密钥指定了协议),获取到的就是全部地址上模型的并集,而不是只有供应商自身协议那一份;供应商卡里原配的那把密钥(从未在密钥面板列出过的)同样按「自动(按模型)」参与这条合并。
59
-
60
- ### Gemini 原生协议
61
-
62
- - 「Gemini」档指 Google 原生协议(`gemini model: generateContent / streamGenerateContent`,鉴权用 `x-goog-api-key`)。受 DSH 宿主适配层限制,供应商卡片的「API 协议」下拉里不会有 Gemini;原生访问一律通过「更多端点里的 Gemini 地址行 + 密钥指定 Gemini」完成,供应商自身的协议保持 OpenAI/Anthropic 三选一即可(纯 Gemini 网关可把主地址指向该网关任意可答路径)。
63
- - Gemini 地址需包含版本段(官方为 `https://generativelanguage.googleapis.com/v1beta`);只填裸域名时插件会自动补 `/v1beta`,路径非空则按网关自己的拼写使用。列表探测走原生 `GET {地址}/models?pageSize=1000`,模型名会剥掉 `models/` 前缀,只保留支持 `generateContent` 的条目。
64
- - 思考等级沿用模型上声明的档位:pi-ai 会把 low/medium/high 翻译成 Gemini 的 `thinkingLevel`(Gemini 3 / Gemma 4)或 `thinkingBudget`(2.5 系);在插件的 Thinking 编辑器里为 gemini 模型声明等级后原生请求即会携带。
87
+ - 密钥面板的「模型」选择是可点选的模型清单(该供应商已添加的模型做成多选胶囊),选中的模型才交给这把密钥;下面的「全部模型」表示不做限制。该项与其它操作按钮一样只在悬停时显示。
88
+ - 模型页供应商卡片的「获取模型」是宿主自带的一次普通目录读取:读到的模型在官方勾选列表里供你取舍,勾选后才写入供应商。插件不替你探测目录,也不会自动把任何模型写进供应商或密钥清单;模型清单的每一次变化都来自你的手动勾选、手动添加或密钥面板的「模型」圈定。插件只是顺带观察这次读取里每把密钥各自返回了什么(见上一条),并在多把密钥的目录合并时做一次保守过滤:只有当这个供应商的**每一把**启用密钥都成功给出了目录、且没有任何一把列出某模型时,该模型不出现在合并结果里(有密钥没读到=情况未知,不过滤)。
89
+
90
+ 插件不再支持 Gemini 原生协议或专用端点。旧的 `google-generative-ai` 密钥协议指定会按无效值回到「自动」,旧的 `gemini` 端点字段会在读取时忽略,并在下次保存插件密钥索引时移除。模型知识库中的 Gemini 思考档位仍保留,供支持 OpenAI 兼容协议的网关使用;不会根据 Gemini/Gemma 模型名自动切换到原生协议。若供应商主协议曾被手工设置为 `google-generative-ai`,仍需改回宿主支持的协议,并填写对应的兼容地址;插件不会自动改写宿主供应商配置。
65
91
 
66
92
  ## 开发与验证
67
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;
@@ -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, the "declared N ·
9
- * default X" state, and the applied suggestion's provenance pill) over a sunk
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. */
@@ -75,13 +77,6 @@ export interface EffortEditorProps {
75
77
  * split and is no longer read.
76
78
  */
77
79
  officialInputTypes?: boolean;
78
- /**
79
- * Report whether this card currently covers the official capacity and
80
- * input-type chrome. The card exists only while the thinking switch is on;
81
- * when it is off the row's own official controls have to come back, or a
82
- * model that declares no reasoning would lose every way to edit its window.
83
- */
84
- onCoverageChange?: (covered: boolean) => void;
85
80
  /** The write seam (settings.mutate plus the suggestion engine). */
86
81
  api: EffortEditorApi;
87
82
  /** Read-only (settings document not writable). */
@@ -89,19 +84,42 @@ export interface EffortEditorProps {
89
84
  /** Localized copy. */
90
85
  t: (key: string, params?: Record<string, string | number>) => string;
91
86
  }
92
- /** Draft state of the modality part: declared or inheriting, image or not. */
87
+ /**
88
+ * Draft state of the modality part. The three pills are mutually exclusive
89
+ * by construction: 生图 (`imageGen`) stands alone — an image generator is a
90
+ * different kind of model, not a request-modality answer — while the 文本/图片
91
+ * pair is the ordinary chat-input declaration (`declared`).
92
+ */
93
93
  export interface DraftModality {
94
+ /** The 文本/图片 declaration is made (text always, image when `image`). */
94
95
  declared: boolean;
96
+ /** The declared pair takes images. Meaningful only while `declared`. */
95
97
  image: boolean;
98
+ /** The row is an image generator; text/image carry no answer beside it. */
99
+ imageGen: boolean;
96
100
  }
97
101
  /** Read the stored declaration into a draft. Empty mirrors undefined: the
98
102
  * resolved settings layer materializes absent arrays as [], and core reads
99
103
  * that as "no answer here" -- never as a phantom text-only declaration. */
100
- export declare function modalityFrom(input: InputModalities | undefined): DraftModality;
101
- /** Resolve a modality draft to the write intent (null = durably unset). */
102
- export declare function buildModalityIntent(draft: DraftModality): InputModalities | null;
103
- /** Semantic equality between a modality draft and a stored declaration. */
104
- export declare function sameModality(draft: DraftModality, stored: InputModalities | undefined): boolean;
104
+ export declare function modalityFrom(input: InputModalities | undefined, imageGen?: boolean): DraftModality;
105
+ /**
106
+ * The modality part of a write, from a draft. The parts are exact: a declared
107
+ * pair also clears the image-generation marker, and marking the row an image
108
+ * generator also unsets the chat-input declaration (its `null` — the durable
109
+ * unset — which is what keeps host auto-fill from refilling text/image under a
110
+ * model that cannot serve a chat turn). `undefined` members mean "touch
111
+ * nothing", which {@link sameModality} is what decides.
112
+ */
113
+ export declare function buildModalityWrite(draft: DraftModality): {
114
+ input?: InputModalities | null;
115
+ imageGen?: boolean;
116
+ };
117
+ /**
118
+ * Semantic equality between a modality draft and the row's stored state: the
119
+ * declaration AND the image-generation marker must both agree, or the draft is
120
+ * an edit.
121
+ */
122
+ export declare function sameModality(draft: DraftModality, stored: InputModalities | undefined, storedImageGen?: boolean): boolean;
105
123
  /**
106
124
  * The ladder part of a write, from a switch state and the draft it resolves to.
107
125
  *
@@ -133,5 +151,5 @@ export declare function pendingWriteOf(parts: PendingWriteParts): PendingWrite;
133
151
  * checkboxes, the modality toggle, the auto-adapt action, and the
134
152
  * apply/reset actions that own both sections.
135
153
  */
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;
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;
137
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;
@@ -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), with
18
- * or without spaces, e.g. `1M`, `128 K`, `1,048,576`. A blank or malformed
19
- * value is `undefined`: the caller writes an empty official field, which is
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
- export type ConfiguredInputSnapshot = ReadonlyMap<string, ReadonlyMap<string, readonly string[]>>;
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 inputs, shared by composer mounts and refreshed on settings pushes. */
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;
@@ -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
  }
@@ -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 - 供应商的设置键。
@@ -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
  }