dsh-model-organizer 0.3.3 → 0.3.4

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/DEVELOPING.md CHANGED
@@ -1,130 +1,63 @@
1
1
  # 开发笔记
2
2
 
3
- 面向改这个插件的人(包括未来的我)。用户文档在 [README.md](./README.md)。
3
+ 面向改这个插件的人。用户文档在 [README.md](./README.md)。
4
4
 
5
- ## ⚠️ 改代码前务必先读:踩过的坑
5
+ ## 升级 DSH 后座位凭空消失?先查服务名
6
6
 
7
- 0. **服务改名会让座位"静默消失",必须注入新旧两个名字。**
8
- DSH 0.1.7 把客户端设置镜像服务从 `settingsScope` 改名为 `configForms`(由 `@deepseek-ai/dsh-client-ui-settings` 提供,`describe()` 返回的还是同一个 mirror 对象)。
9
- cordis 的 `ctx.inject([...])` **只要有一个服务永不出现,回调就永远不执行** —— 不报错、不打日志。所以 0.1.7 一升级,本插件的设置页浮窗就凭空消失了(输入框的模型菜单照常,因为它注入的 `slots/modelDirectories/sessions` 都没变)。
10
- 现在 `apply()` 里同时注入两个名字,用一次性标志保证只挂载一次:
11
- ```js
12
- ctx.inject(["slots", "configForms", "remote", "remote.settings"], (s) => mountOrderPanel(s, s.configForms.describe()));
13
- ctx.inject(["slots", "settingsScope", "remote", "remote.settings"], (s) => mountOrderPanel(s, s.settingsScope.describe()));
14
- ```
15
- **推论**:升级 DSH 后如果某个座位不见了,第一件事是去新版本的 `dsh-client-ui-*` 包里 grep 自己注入的每个服务名。
7
+ cordis 的 `ctx.inject([...])` **只要有一个服务永不出现,回调就永远不执行** —— 不报错、不打日志。所以服务改名会让整个座位静默消失。
16
8
 
17
- 1. **`file:` 依赖是打包快照,`link:` 才是符号链接 —— 改仓库可能根本不生效。**
18
- profile 里写 `"dsh-model-organizer": "file:../../../dsh-model-organizer"` 时,pnpm 把目录**打包复制**进自己的 store;只有 `pnpm add ./dir`(直接路径)或 `link:` 才是符号链接。
19
- 症状:改完仓库代码、强刷浏览器,界面毫无变化;查 `window.__dshModelOrganizerBuild` 会发现跑的还是旧构建号,而服务端 bundle 里明明是新代码 —— 因为 DSH 加载的是 `profiles/<p>/node_modules/dsh-model-organizer/lib/client.js` 那份**副本**。
20
- 排查:直接 grep 那份副本的 `BUILD` 常量,和仓库对比。
21
- 修法:`dsh plugin --profile web remove dsh-model-organizer && dsh plugin --profile web add link:./dsh-model-organizer`(换成符号链接后只改一处)。在此之前必须**两份同步改**。
9
+ 已发生一次:0.1.7 把客户端设置镜像服务 `settingsScope` 改名为 `configForms`(提供者仍是 `@deepseek-ai/dsh-client-ui-settings`,`describe()` 返回同一个 mirror)。设置页浮窗因此消失,而输入框菜单照常(它注入的 `slots/modelDirectories/sessions` 没变)。
22
10
 
23
- 2. **0.1.7 的菜单色 token 是半透明的,浮层必须配 `backdrop-filter`。**
24
- `--dsw-specific-menu` 现在解析成 `rgba(48,49,54,0.5)`,官方菜单靠 `backdrop-filter: var(--dsw-menu-backdrop-filter)` 配合。只取颜色不取模糊 → 面板是「透视」的,底下的官方卡片按钮直接透上来。
11
+ `apply()` 里同时注入两个名字,一次性标志保证只挂载一次:
25
12
 
26
- 3. **浮层要 `ReactDOM.createPortal` 到 `document.body`。**
27
- `settings.models.footer` 座位在设置页很深的子树里,`position: fixed` 会被困在那个子树的堆叠上下文里,被别的插件的悬浮组件(鲸鱼、地球图标等)盖住 —— 提高 z-index 也没用。挂到 body 之后 z-index 才是全局的(本插件用 10000,官方菜单是 1100)。
28
-
29
- 4. **profile bundle 必须声明 `dsh.bundle.patch`**(指向 `cordis.patch.yml`)。缺了它 dsh 启动即报
30
- `profile bundle "..." declares no dsh.bundle in its package.json`。
31
-
32
- 2. **顶层 `inject` 必须声明座位 standardProps 会读取的每一个服务**(本插件:`locale, slots, sessions, remote, remote.session, remote.settings`)。
33
- 少一个 → 渲染时抛 `cannot get property "remote.session" without inject` → **条目被静默弃权(abdicate)并回退到内置 UI**,界面无任何报错。
34
- 调用 `remote.settings.mutate` 还必须显式声明 **`remote.settings`**。
35
-
36
- 3. **owner props 以组件 props 传入,不经过座位的 `inject` 工厂**:`settings.models.provider-card` 的 `inject` 不接收参数,必须读 `props.provider`。
37
-
38
- 4. **`single` 座位优先级**:同优先级注册会**直接抛错**;运行时为非 chain 座位**自动分配**优先级(`--nextPriority` 递减),**后注册者胜出**。
39
-
40
- 5. **drop 事件会在行与容器上各触发一次**(冒泡),需用 ref 加锁,否则重复写入。
41
-
42
- 6. **边框必须用 longhand**(`borderWidth/borderStyle/borderColor`)。用 shorthand `border` 再叠加 `borderColor` 时,React 会把 shorthand 展开成 longhand;回退时移除 `borderColor`,`border-color` 就落回 **currentColor** —— 表现为「拖拽结束后高亮边框一直不消失」。
43
-
44
- 7. **拖拽会把源行留在焦点上**。行加 `tabIndex:-1`、drop/dragend 时 `blur()`;并且**不要给行画 `:focus-visible` 背景**(官方 `option` 类自带一条,会变成「拖完还留一块灰底」)。
45
-
46
- 8. **原生拖拽会让文字变成可拖对象**(浏览器弹「松开鼠标即可搜索」)。解决:`-webkit-user-drag:none` 加在**行的内容**上,不要加在行本身(加在行上会让行也拖不动)。这条是从侧边栏会话行的实现里学来的。
47
-
48
- 9. **primitive 图标不转发 inline `style`**:需要旋转/变色请传 `className`(本插件为此注入一张极小的自有样式表)。
49
-
50
- 10. **数组顺序可控,record 键顺序不可控**:`providers` 是 record,宿主要规范化键顺序,整体 `set` 与 `unset`+`set` 都实测无效 —— 所以供应商顺序只能存本机偏好。
51
-
52
- 11. **面板里用到的每个局部变量都要真的声明**:曾在 `ProviderModelOrder` 里用了 `C`(官方类名映射)却没定义 → `ReferenceError` → 条目再次被静默弃权,表现为「面板整个不见了」。
53
-
54
- 12. 浏览器半只需 `react` / `react-dom` / `@deepseek-ai/dsh-client-ui-primitives`(都在 shell 的 PLATFORM_MODULES 种子里),无需 `dsh.client.external`。
55
-
56
- ## 兼容性与鲁棒性(已核查)
57
-
58
- ### 已发现并修复的真实冲突
59
-
60
- **`settings.models.provider-card` 被 `@linxin666/dsh-client-ui-model-capabilities` 占用。**
61
- 该座位是 **keyed**,key 由官方页面固定派发为供应商的 settings namespace(`llm-pi-ai`);而该插件已经用同一个 key 注册了「模型能力」面板。SlotCore 对 keyed 座位**一个 key 只保留一个占用者**,且同 key 同优先级会直接抛错 —— 它用 `try/catch` 吞掉异常,所以**本插件早期版本一直在静默压制它的「模型能力」面板**(实测:让出该座位后,每个供应商卡片立刻出现「模型能力」)。
62
-
63
- **修复**:本插件不再占用该座位,模型排序改由自己拥有的 `settings.models.footer`(list 座位,`id: model-organizer-provider-order`)承载 —— list 座位按 id 去重,天然可与该插件的 `ui-model-capabilities` 共存。
64
-
65
- ### 其它已做的加固
66
-
67
- | 风险 | 处理 |
68
- | :-- | :-- |
69
- | 官方 CSS module 哈希变化 / 被别的模块误命中 | 运行时解析前缀,并用**只有该模块才有的第二个类**(`_optionCopy`)校验;缓存与样式表数量绑定;全部失败则退回内置回退样式 |
70
- | 座位契约变更(prop 改名等) | **不拦截**:让渲染抛错 → SlotCore 弃权该条目 → 官方内置组件自动回填 |
71
- | 座位被重命名 / 移除 | `slots.inject` 永不触发 → 对应面板静默消失,其它功能不受影响 |
72
- | 单个座位注册失败 | 每个座位注册独立 `guard`,失败只记一条 warn,**不会拖垮整个插件** |
73
- | 写入被拒绝 / ops 契约变化 | `mutate` 的同步抛错与 promise 拒绝都有捕获,并在表头显示失败原因 |
74
- | 本机偏好 | `localStorage` key 带命名空间,读写都有 try/catch |
75
- | 注入的样式表 | `<style id="dsh-model-organizer-style">`,类名统一 `dsh-mo-*` 前缀,注入幂等 |
76
- | 服务端半边 | 只有空 `apply()`,不注册任何宿主能力 |
77
-
78
- ### 仍然存在的风险(无法在插件侧消除)
13
+ ```js
14
+ ctx.inject(["slots", "configForms", "remote", "remote.settings"], (s) => mountOrderPanel(s, s.configForms.describe()));
15
+ ctx.inject(["slots", "settingsScope", "remote", "remote.settings"], (s) => mountOrderPanel(s, s.settingsScope.describe()));
16
+ ```
79
17
 
80
- - **`conversation.input.model` 是 single 座位**:将来若另一个插件以相同优先级注册,SlotCore 会抛错(本插件的 `guard` 会记 warn,官方内置组件仍会渲染)。
81
- - **官方模型页若改变 keyed 派发约定**,依赖该座位的插件会失效 —— 本插件已不依赖它。
82
- - **官方 CSS module 若改名**(例如删掉 `optionCopy`),校验会失败并退回回退样式:功能可用、外观降级。
83
- - **卡片排序**是本插件唯一会改官方 DOM 的地方(给官方列表设 `display:flex` + 给 `li` 设 CSS `order`,不移动节点)。若 DSH 改那棵 DOM,该功能会静默降级,其余功能不受影响。
18
+ **规律**:升级后座位不见了,第一件事是去新版 `dsh-client-ui-*` 包里 grep 自己注入的每个服务名。
84
19
 
85
- ## 排查手册
20
+ ## 座位的失败模式(决定了代码结构)
86
21
 
87
- ### 让 agent 浏览器不显示窗口(消除抢焦点)
22
+ - **条目渲染时抛错 → 被静默弃权,官方内置 UI 自动回填**,界面上没有任何提示。
23
+ - **座位注册本身失败 → 该座位静默消失**,其它功能不受影响。
24
+ - 所以:每个座位注册各套一层 `guard`(失败只记 warn,不拖垮插件);组件外套 `PanelBoundary`(把抛错变成页面上的一行红字,而不是"凭空消失")。
25
+ - **顶层 `inject` 必须列全座位 standardProps 会读的每个服务**(本插件:`locale, slots, sessions, remote, remote.session, remote.settings`)。少一个 → 渲染抛 `cannot get property "..." without inject` → 弃权。用 `remote.settings.mutate` 必须显式声明 `remote.settings`。
26
+ - `single` 座位同优先级注册会**直接抛错**;运行时会为非 chain 座位自动分配优先级,后注册者胜出。
27
+ - 未声明的局部变量(`ReferenceError`)同样会导致弃权,表现就是"整个面板不见了"。
88
28
 
89
- `dsh-ego-browser` 驱动的 Chromium 是 DSH 的子进程,默认以真实窗口存在,并且**每次动作工具都会 `Target.activateTarget` 把它顶到前台**(这就是「用着用着 Chrome 跳出来」的原因)。让它完全不出现窗口:
29
+ ## 与官方模块的耦合
90
30
 
91
- ```powershell
92
- # 只对当前终端会话生效(先这样试)
93
- $env:EGO_LINUX_HEADLESS = 1
94
- dsh web
31
+ - **官方 CSS-module 类名靠运行时解析**:锚定只有该模块才有的类名,并用第二个类名(如 `_optionCopy`)校验;解析失败退回内置回退样式(功能可用、外观降级)。
32
+ - **0.1.7-rc.1 的构建丢了官方菜单规则的两条属性**:线上生效的 `_7KE1Ra_menu` 里既没有 `background` 也没有 `border-radius`(源码里是 `var(--dsw-specific-menu)` 和 `16px`),所以**官方菜单本身表现为全透明+直角**。本插件不依赖那条规则:运行时从 `document.body` 解析 `--dsw-specific-menu` 内联补上背景,并补 `var(--dsw-radius-lg)` 圆角。升级后可重新检查这条规则是否已修复。
33
+ - **浮层必须 `ReactDOM.createPortal` 到 `document.body`**:座位在设置页很深的子树里,`position: fixed` 会被困在那个子树的堆叠上下文,被别的插件的悬浮组件盖住 —— 提高 z-index 也没用。
34
+ - **不要占用 `settings.models.provider-card`**:它是 keyed 座位,key 是供应商的 settings namespace,已被 `@linxin666/dsh-client-ui-model-capabilities` 占用;keyed 座位一个 key 只留一个占用者,同 key 同优先级注册会抛错(而且对方用 try/catch 吞掉,等于静默压制它)。本插件只用自己的 `settings.models.footer`(list 座位,按 id 去重)。
95
35
 
96
- # 永久生效(设完必须重开终端,再启动 DSH)
97
- setx EGO_LINUX_HEADLESS 1
98
- ```
36
+ ## 开发环境
99
37
 
100
- - 显式设置 `1/true/yes/on` **优先于**「有没有显示环境」的自动推断(含 Windows)。
101
- - 浏览器是**单例常驻**进程:改完要重启 DSH(或 `ego-browser --stop`)才冷启动生效。
102
- - **代价**:只损失「实时观察窗」;其余 `ego_*` 工具(导航/点击/输入/JS/截图/下载)全部照常。
103
- - 不要用 `chromeArgs` 传 `--headless` —— 它在 `CHROME_BLOCKED` 黑名单里,会被过滤掉。
38
+ - **`file:` 依赖是打包快照,`link:` 才是符号链接。** profile 里写 `"file:../../../dsh-model-organizer"` 时 pnpm 把目录打包**复制**进 store,DSH 加载的是 `profiles/<p>/node_modules/.../lib/client.js` 那份副本 —— 改仓库**不生效**。
39
+ 排查:grep 那份副本的 `BUILD` 常量,和仓库对比。
40
+ 修法:`dsh plugin --profile web remove dsh-model-organizer && dsh plugin --profile web add link:./dsh-model-organizer`
41
+ - **改完要 Ctrl+Shift+R**:客户端 bundle 以 `Cache-Control: immutable, max-age=31536000` 下发,且 URL 不随代码变化,普通刷新一直用缓存。
42
+ - **浏览器半只需 `react` / `react-dom` / `@deepseek-ai/dsh-client-ui-primitives`**(都在 shell 的 PLATFORM_MODULES 种子里),不需要 `dsh.client.external`。
43
+ - profile bundle 必须声明 `dsh.bundle.patch`(指向 `cordis.patch.yml`),否则 dsh 启动即报 `declares no dsh.bundle`。
104
44
 
105
- ### 改了插件代码但界面没变化
45
+ ## 写 UI 时踩过的坑
106
46
 
107
- DSH 把客户端 bundle 以 `Cache-Control: public, max-age=31536000, immutable` 下发,而 URL 不随代码变化 —— 普通刷新会一直用缓存。**必须 Ctrl+Shift+R**(或在 DevTools → Network 勾 Disable cache)。
47
+ - **边框必须用 longhand**(`borderWidth/borderStyle/borderColor`)。用 shorthand `border` 再叠加 `borderColor` 时 React 会展开 shorthand;回退时移除 `borderColor`,`border-color` 落回 `currentColor` → "拖拽结束后高亮边框一直不消失"。
48
+ - **拖拽会把源行留在焦点上**:行加 `tabIndex:-1`,drop/dragend 时 `blur()`;并且不要给行画 `:focus-visible` 背景(官方 `option` 类自带一条 → "拖完还留一块灰底")。
49
+ - **原生拖拽会让文字变成可拖对象**(浏览器弹「松开鼠标即可搜索」):`-webkit-user-drag:none` 加在**行的内容**上,不要加在行本身(加在行上会让行也拖不动)。
50
+ - **drop 会在行与容器上各触发一次**(冒泡),需加锁,否则重复写入。
51
+ - **primitive 图标不转发 inline `style`**:需要旋转/变色请传 `className`。
52
+ - **`providers` 是 record,键顺序由宿主规范化**:整体 `set` 与 `unset`+`set` 都实测无效,所以供应商顺序只能存 `localStorage`(模型顺序是数组,可以写进文档)。
108
53
 
109
- ## 发版流程
54
+ ## 发版
110
55
 
111
56
  ```sh
112
- # 1. 改代码后升版本号(npm 不允许覆盖已发布的版本)
113
- # package.json 的 version:0.3.2 → 0.3.3
114
- # 2. 提交并推送
57
+ # npm 不允许覆盖已发布的版本号:先升版本,再提交,最后发布
58
+ npm version patch # 或手改 package.json 的 version
115
59
  git add -A && git commit -m "..." && git push
116
- # 3. 发布
117
60
  npm publish
118
61
  ```
119
62
 
120
- 发布需要带 **Bypass 2FA** 的 Granular Access Token(npm 2025-11 起只支持 granular token)。配置方式:
121
- npmjs.com → 头像 → Access Tokens → Generate New Token → Packages 选 **All Packages + Read and write (publish and stage)**、**Organizations 选 No access**、勾 **Bypass two-factor authentication**;然后
122
- `npm config set //registry.npmjs.org/:_authToken=npm_xxx`(写进用户级 `.npmrc`,不要放进仓库)。
123
-
124
- ## 附:关于「(modlens vision)」供应商分组
125
-
126
- 这些是 **`@liustack/modlens` 自动生成的「视觉变体」路由**,不是配置重复项:
127
-
128
- - 机制:modlens 扫描已注册 provider,找出上游元数据声明为 `text` 且不含 image 的模型(默认按 `deepseek` / `glm` / `mimo` 前缀族匹配),为它们注册一条**声明支持图片输入**的伴随路由,界面名加 `(modlens vision)`。
129
- - 用途:选中该分组下的模型后,粘贴/拖拽图片会走 DSH 原生附件流程,在调用(纯文本)模型前把图片转成证据文本。不选这个分组时,纯文本模型无法接收图片。
130
- - 调整:编辑 `$DSH_HOME/profiles/<profile>/cordis.patch.yml` 里的 `modlens` 配置(`families` / `discover`),整条关掉用 `visionProvider: false`。视觉引擎配置在 `~/.modlens/config.json`。
63
+ 发布需要带 **Bypass 2FA** 的 Granular Access Token(npm 2025-11 起只支持 granular token):npmjs.com → 头像 → Access Tokens → Generate New Token → Packages 选 **All Packages + Read and write (publish and stage)**、**Organizations 选 No access**、勾 **Bypass two-factor authentication**;然后 `npm config set //registry.npmjs.org/:_authToken=npm_xxx`(写进用户级 `.npmrc`,不要放进仓库)。
package/README.md CHANGED
@@ -36,9 +36,9 @@ dsh plugin --profile web add github:NimoXie15/dsh-model-organizer
36
36
  dsh plugin --profile web add link:/absolute/path/to/dsh-model-organizer
37
37
  ```
38
38
 
39
- > **兼容性**:已在 DSH `0.1.7-rc.1` 上验证,同时兼容 `0.1.5`/`0.1.6`(0.1.7 把客户端设置镜像服务从 `settingsScope` 改名为 `configForms`,本插件两个名字都注入,所以两个版本都能用)。
39
+ > **兼容性**:已在 DSH `0.1.7` 上实测,`0.1.5` 起都可用(0.1.7 调整了一处内部接口,本插件已做兼容处理)。
40
40
  >
41
- > 升级插件后如果界面没变化,按 **Ctrl+Shift+R** 强刷一次(DSH 的客户端 bundle 带一年 immutable 缓存,普通刷新不会重新下载)。
41
+ > 升级插件后如果界面没变化,按 **Ctrl+Shift+R** 强刷一次(浏览器可能还在用缓存的旧版本)。
42
42
 
43
43
  ## 截图
44
44
 
@@ -58,9 +58,9 @@ dsh plugin --profile web add link:/absolute/path/to/dsh-model-organizer
58
58
 
59
59
  ## 已知限制
60
60
 
61
- - 只处理 `llm-pi-ai` 命名空间下的供应商(DeepSeek 官方供应商不在其中)
62
- - 供应商顺序、浮窗位置是本机偏好,不跨设备同步
63
- - 只占用两个官方扩展点(`conversation.input.model`、`settings.models.footer`),不改官方代码
61
+ - 只对「设置 → 模型」里自己添加的供应商生效,**DeepSeek 官方供应商不在其中**
62
+ - 供应商顺序、浮窗位置只保存在本机浏览器,不跨设备同步;模型顺序写在设置里,会跟着走
63
+ - 不修改 DSH 本体,只通过官方提供的扩展点接入
64
64
 
65
65
  ## 许可
66
66
 
@@ -68,4 +68,4 @@ MIT
68
68
 
69
69
  ---
70
70
 
71
- 开发笔记、兼容性审计、排查手册见 [DEVELOPING.md](./DEVELOPING.md)。
71
+ 想自己改这个插件、或者想了解它内部怎么实现的,见 [DEVELOPING.md](./DEVELOPING.md)。
package/lib/client.js CHANGED
@@ -41,7 +41,7 @@ window.__ModuleLoader__.load({
41
41
  "order.unsaved": "有未保存改动",
42
42
  "order.readonly": "当前环境不可写入该设置",
43
43
  "providers.title": "供应商与模型顺序",
44
- "providers.hint": "拖动行即可调整顺序",
44
+ "providers.hint": "点击收起/展开,长按拖拽调整",
45
45
  "providers.expand": "展开顺序面板",
46
46
  "providers.collapse": "收起顺序面板",
47
47
  "providers.saved": "已保存 ✓",
@@ -66,7 +66,7 @@ window.__ModuleLoader__.load({
66
66
  "order.unsaved": "Unsaved changes",
67
67
  "order.readonly": "This settings document is read-only here",
68
68
  "providers.title": "Provider and model order",
69
- "providers.hint": "Drag a row to reorder",
69
+ "providers.hint": "Click to collapse/expand, press and drag to reorder",
70
70
  "providers.expand": "Expand the order panel",
71
71
  "providers.collapse": "Collapse the order panel",
72
72
  "providers.saved": "Saved ✓",
@@ -268,11 +268,11 @@ window.__ModuleLoader__.load({
268
268
  position: "fixed", right: 20, bottom: 20, zIndex: 10000, width: 380, maxWidth: "calc(100vw - 40px)",
269
269
  display: "flex", flexDirection: "column", padding: 4,
270
270
  border: "1px solid var(--dsw-alias-border-l1)", borderRadius: 14,
271
- background: "var(--dsw-specific-menu, var(--dsw-alias-bg-module, #222))",
272
- /* 0.1.7's menu token is translucent and the shipped menu pairs it with this
273
- blur; without it the panel reads as see-through and the cards behind it
274
- bleed through. The elevation shadow matches the shipped menu too. */
275
- backdropFilter: "var(--dsw-menu-backdrop-filter)",
271
+ /* The theme's menu token is an OPAQUE colour (a color-mix), so using it as-is
272
+ makes this panel a solid box and the blur below has nothing to show. Mixing
273
+ it back toward transparent restores the frosted look in the theme's colour. */
274
+ background: "color-mix(in srgb, var(--dsw-specific-menu, #26262a) 50%, transparent)",
275
+ backdropFilter: "var(--dsw-menu-backdrop-filter, blur(28px) saturate(1.6))",
276
276
  boxShadow: "var(--dsw-elevation-prominent, 0 10px 30px rgba(0,0,0,.34))",
277
277
  color: "var(--dsw-alias-label-primary)"
278
278
  },
@@ -858,9 +858,26 @@ window.__ModuleLoader__.load({
858
858
  ref: menuRef,
859
859
  id: idRef.current + "-menu",
860
860
  className: C !== null ? C.menu : undefined,
861
- style: C !== null
862
- ? (menuPos !== null ? menuPos : MEASURE_STYLE)
863
- : Object.assign({}, S.fallbackMenu, menuPos !== null ? menuPos : MEASURE_STYLE),
861
+ /* The shipped `_menu` rule asks for var(--dsw-specific-menu), but that lookup
862
+ comes out transparent on this node while the same token is defined on <body>.
863
+ Resolving it here and setting it inline is what makes the menu look like the
864
+ shipped one instead of a see-through pane. */
865
+ style: Object.assign({
866
+ background: (function () {
867
+ try {
868
+ const v = getComputedStyle(document.body).getPropertyValue("--dsw-specific-menu").trim();
869
+ if (v.length > 0) return v;
870
+ } catch (e) {}
871
+ return "#26262a";
872
+ })(),
873
+ /* This build ships _7KE1Ra_menu without its background or radius (the source
874
+ declares both), so the shipped menu renders as a square transparent pane.
875
+ Both are restored here from the theme's own tokens. */
876
+ borderRadius: "var(--dsw-radius-lg, 16px)"
877
+ },
878
+ C !== null
879
+ ? (menuPos !== null ? menuPos : MEASURE_STYLE)
880
+ : Object.assign({}, S.fallbackMenu, menuPos !== null ? menuPos : MEASURE_STYLE)),
864
881
  role: "menu",
865
882
  "aria-label": t("composer.title"),
866
883
  "aria-busy": loading || busy
@@ -1132,7 +1149,7 @@ window.__ModuleLoader__.load({
1132
1149
  border: "1px solid var(--dsw-alias-state-error-primary, #f85149)",
1133
1150
  color: "var(--dsw-alias-state-error-primary, #f85149)"
1134
1151
  }
1135
- }, "dsh-model-organizer 面板渲染失败:" + message);
1152
+ }, "dsh-model-organizer 渲染失败:" + message);
1136
1153
  }
1137
1154
  return this.props.children;
1138
1155
  }
@@ -1142,6 +1159,10 @@ window.__ModuleLoader__.load({
1142
1159
  return h(PanelBoundary, null, h(ProviderOrderPanel, props));
1143
1160
  }
1144
1161
 
1162
+ function ProviderGroupedModelSelectGuarded(props) {
1163
+ return h(PanelBoundary, null, h(ProviderGroupedModelSelect, props));
1164
+ }
1165
+
1145
1166
  function ProviderOrderPanel(props) {
1146
1167
  const C = resolveOfficialClasses();
1147
1168
  ensureOwnStyles();
@@ -1477,7 +1498,7 @@ window.__ModuleLoader__.load({
1477
1498
  t: t
1478
1499
  };
1479
1500
  }
1480
- }, ProviderGroupedModelSelect); });
1501
+ }, ProviderGroupedModelSelectGuarded); });
1481
1502
  });
1482
1503
  });
1483
1504
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-model-organizer",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "DSH 模型整理插件:输入框的模型下拉改为「供应商分组 + 模型二级折叠菜单」(含推理等级),并在模型设置页提供一个可拖拽的「供应商与模型顺序」浮窗。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",