dsh-background-by-model 0.4.4 → 0.5.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.
package/README.md CHANGED
@@ -99,23 +99,15 @@ One interface, one config — only the current model differs:
99
99
  - **Conversation & Trajectory** — The message list is wrapped in a translucent card automatically, and the trajectory page gets whole-page opacity & blur controls, letting the wallpaper shine through the content.
100
100
  - **Right Panel** — The column that slides in from the right when you open a file now has a card of its own: its opacity follows **Main background** until you drag it (then this card owns it), and its blur stacks on top of the main-background blur. While closed it takes no space and costs nothing.
101
101
 
102
- ### Host check (Config tab)
103
-
104
- - **Every host interface, evaluated against the build you are running** — The plugin re-emits the host's design tokens, hangs backdrop filters on the host's structural elements and reads the host's session/model services; each of those is a contract with a dsh release, and each can be renamed without an error. The check reports, per point, whether it holds, what its loss looks like on screen, the literal it depends on, the host file that should define it and the plugin file that reads it.
105
- - **Three states, honestly** — *ok* (the host still provides it), *n/a* (it cannot be observed from here right now — the chat view is off screen while the settings dialog is open, the file-preview panel is not in the DOM until a file has been opened) and *broken* (it is gone while the surface that uses it is on screen). Only the third is a failure.
106
- - **Copy diagnostics** — One click copies both halves (the live probe and the offline scan of the installed files) as markdown, ready to paste into an issue.
107
- - **Offline equivalent** — `pnpm scan` runs the same contract table against the installed packages with no browser, and exits non-zero when a target is gone. Use it right after upgrading dsh.
108
-
109
102
  ## Settings
110
103
 
111
- Settings → **Theme** now has four tabs:
104
+ Settings → **Theme** now has three tabs:
112
105
 
113
106
  | Tab | Scope | Contents |
114
107
  | --- | --- | --- |
115
108
  | **Interface** | Global, shared by every model | Opacity & blur for the main background, left panel, right panel, cards & panels, input & controls, settings panel, conversation text box and trajectory page |
116
109
  | **Model Background** | Per rule | The ordered rule list, the live match readout, and each rule's wallpaper, theme color, layout mode, framing, opacity and blur |
117
110
  | **Config** | — | Import / export the whole rule set (`dsh-background-by-model-theme.json`) |
118
- | **Host check** | — | Every host interface this plugin depends on, evaluated against the running dsh: what holds, what broke, and a copyable report |
119
111
 
120
112
  The old **Color** tab is gone — the theme color is now a property of each rule. The old **Background** tab became **Model Background**.
121
113
 
@@ -188,17 +180,7 @@ To mount a working copy into a profile instead, add it to the profile's `package
188
180
 
189
181
  After changing anything under `src/`, run `pnpm run bundle` again — the mounted profile loads `lib/`, so edits do not take effect until the bundle is rebuilt.
190
182
 
191
- ### Checking a new dsh release
192
-
193
- The plugin talks to dsh through a small, explicit set of host interfaces (see [`src/host-contracts.ts`](src/host-contracts.ts)). After upgrading dsh, check them before wondering why something looks off:
194
-
195
- ```sh
196
- pnpm run bundle
197
- pnpm run scan # offline: fails when a contract target vanished from the installed dsh
198
- pnpm test # the contract table, the live probe's logic, the UI stylesheet, the version floor
199
- ```
200
-
201
- `pnpm scan` accepts `--host <dir>` (the `node_modules` directory holding `@deepseek-ai/dsh-app-boot`) and `--json`. The same check runs inside the app, against the live interface, on Settings → **Host check**.
183
+ `pnpm test` builds and typechecks (`tsdown && tsc -p tsconfig.json`).
202
184
 
203
185
  ## Compatibility
204
186
 
@@ -225,6 +207,17 @@ No. Both were removed in 0.3.0; each rule uses a static image.
225
207
 
226
208
  ## Recent Optimizations
227
209
 
210
+ ### v0.5.0
211
+
212
+ - **The host self-check is gone.** Removed together with everything that fed it: the settings page's **Host check** tab, the contract table (`src/host-contracts.ts`), the browser probe (`src/client/judge.ts`), the installed-file scan (`src/host-scan.ts`), the `hostCheck` RPC, the `pnpm scan` script and its test suite. The plugin keeps only what it does: rules, wallpapers and interface opacity/blur. What it cost to remove is in the diff — 28 contracts, three consumers and a report format, none of which ever agreed with reality for long enough to be worth the red lines it printed on a healthy host.
213
+
214
+ ### v0.4.5
215
+
216
+ - **`optionalWhen` finally means what its name says** — The field is documented as "the check runs while this surface is on screen", but the probe was evaluating the exact opposite: an anchor that was *not* in the DOM produced *n/a*, and one that *was* produced the failure. Two of the three dock contracts and both conversation-view contracts were therefore testing the wrong state — which is how a healthy dock came back as `停靠空位 失效` with "no element matches `[data-dockkit-empty]`". The helper now reads the anchor as a positive predicate, and every anchor was renamed to say what it means (`dockHasTab`, `dockHasNoTab`, `chatHasMessages`, `paneFloated`, …) so an anchor named for an absence can no longer invert a check silently. Four tests pin the resulting state table in both directions.
217
+ - **A contract about the message column stops firing on a session that has no messages** — `[data-chat-flow]` is rendered only when the session *has* messages, so its absence is the normal state of a brand-new session (the host's `data-content-phase="hero"` screen) and of the trajectory tab. The anchor was "the conversation scrollport exists", which is true in all three states, so the check reported a rename on the hero screen and on **轨迹** — the second failure the panel showed. It is now keyed on `[data-chat-turn]`, the host's own mark on every message row, which is the one thing that is present exactly when a column should exist. Measured: hero → 0 flow / 0 turn rows; after one message → 1 flow / 4 turn rows; trajectory tab → 0 flow / 0 turn rows.
218
+ - **`visible` — presence is not the same question as "on screen"** — A selector check marked `visible: true` now also requires the element to be on screen, so an element the host parks with `visibility:hidden` cannot satisfy a contract about a surface the user is looking at. The dock's empty seat is deliberately *not* marked: the host keeps it rendered and hidden as tabs open and close, so asking whether it is visible would be asking about a state the host uses both ways.
219
+ - **One more anchor rule, written down** — An anchor must name the state in which its attribute is **expected**, never a neighbour of it that happens to appear at the same time. All four false-red bugs in this feature have been the same mistake: a mounted surface that correctly renders nothing for the attribute to sit on.
220
+
228
221
  ### v0.4.4
229
222
 
230
223
  - **The dock contracts stop asking a stylesheet question about JS attributes** — `dockkit.content` and `dockkit.float` were `rule` checks ("does a host stylesheet mention this literal?"). The host sets both attributes from JavaScript — `data-dockkit-content` on a tab host that has a tab, `data-dockkit-float` on a pane the user has floated — and never writes a CSS rule for either, so that question could only ever be answered "no". Both are now **presence** checks, guarded by the host's own tab marker (`data-dockkit-tab`) and by float mode respectively, so a dock with no tab open reads as *n/a* rather than as a rename. `dockkit.empty` — the empty seat the host renders in place of a populated tab host — is a presence check too. Verified against a live host: with no tab open `data-dockkit-tab`/`data-dockkit-content` are absent; clicking the dock's `+` makes both appear (tab 0→1, content 0→1, empty 1→0), and the checks then answer instead of skipping.
package/README.zh.md CHANGED
@@ -99,23 +99,15 @@
99
99
  - **对话与轨迹页** — 消息列表自动包裹为半透明卡片,轨迹页可整页调节透明度与模糊,让壁纸从内容后方透出来。
100
100
  - **右侧栏** — 点开文件后从右侧滑出的那一栏有了自己的卡片:透明度默认跟随「主背景」(拖动后本卡片接管),模糊则在主背景模糊之上再叠加;关闭时不占位置、无副作用。
101
101
 
102
- ### 宿主自检(「宿主自检」页)
103
-
104
- - **逐条检查插件依赖的宿主接口** — 本插件会重新发出宿主的设计令牌、把毛玻璃挂在宿主的界面元素上、并读取宿主的会话与模型服务;这些每一条都是与某个 dsh 版本之间的约定,而任何一条被改名都不会报错。自检会逐条给出:是否仍然成立、失效时界面上会是什么样子、依赖的那个字面量、本应由哪个宿主文件定义、以及本插件哪个文件在读取它。
105
- - **三种状态,如实报告** — *正常*(宿主仍然提供)、*未观察*(当前无法从界面上看到:设置弹窗打开时对话页不在屏幕上,没开过文件时右侧栏也不在 DOM 里)、*失效*(界面在屏幕上,但接口已经没了)。只有第三种算故障。
106
- - **复制诊断报告** — 一键把两侧结果(实时探测 + 对安装目录的离线扫描)合并成一份 markdown,直接贴进 issue 即可。
107
- - **离线等价物** — `pnpm scan` 用同一张约定表检查已安装的包,不需要浏览器;一旦某个目标消失就以非零码退出。升级 dsh 后先跑它。
108
-
109
102
  ## 设置界面
110
103
 
111
- 设置的 **「主题」** 分类下现在有四个选项卡:
104
+ 设置的 **「主题」** 分类下现在有三个选项卡:
112
105
 
113
106
  | 选项卡 | 作用范围 | 内容 |
114
107
  | --- | --- | --- |
115
108
  | **界面** | 全局,所有模型共用 | 主背景、左侧栏、右侧栏、卡片面板、输入框与控件、设置面板、对话文本框、轨迹页的透明度与模糊度 |
116
109
  | **模型背景** | 每条规则 | 有序规则列表、顶部实时状态,以及每条规则的壁纸、主题色、布局模式、取景、透明度与模糊度 |
117
110
  | **配置** | — | 导入 / 导出整套规则(`dsh-background-by-model-theme.json`) |
118
- | **宿主自检** | — | 逐条检查本插件依赖的宿主接口在当前 dsh 上是否仍然成立,并给出可复制的诊断报告 |
119
111
 
120
112
  原先的 **「色彩」** 选项卡已删除——主题色改为每条规则自己的属性;原 **「背景」** 选项卡已改造成 **「模型背景」**。
121
113
 
@@ -188,17 +180,7 @@ pnpm run typecheck
188
180
 
189
181
  改完 `src/` 必须重新执行 `pnpm run bundle` 才会生效——挂载的 profile 加载的是 `lib/`。
190
182
 
191
- ### 升级 dsh 后怎么查
192
-
193
- 插件与 dsh 之间只通过一张明确列出的接口清单通信(见 [`src/host-contracts.ts`](src/host-contracts.ts))。升级 dsh 之后,先查它,再怀疑别的地方:
194
-
195
- ```sh
196
- pnpm run bundle
197
- pnpm run scan # 离线:某个约定目标从已安装的 dsh 里消失就以非零码退出
198
- pnpm test # 约定表、实时探测逻辑、界面样式表、版本下限
199
- ```
200
-
201
- `pnpm scan` 支持 `--host <dir>`(含 `@deepseek-ai/dsh-app-boot` 的 `node_modules` 目录)与 `--json`。同一套检查也在应用内运行:设置 → **宿主自检**,对着真实界面跑。
183
+ `pnpm test` 会构建并做类型检查(`tsdown && tsc -p tsconfig.json`)。
202
184
 
203
185
  ## 兼容性
204
186
 
@@ -225,6 +207,17 @@ pnpm test # 约定表、实时探测逻辑、界面样式表、版本下
225
207
 
226
208
  ## 近期优化
227
209
 
210
+ ### v0.5.0
211
+
212
+ - **宿主自检整块删掉了。** 连同它的一切:设置页的 **「宿主自检」** 选项卡、约定表(`src/host-contracts.ts`)、浏览器探测(`src/client/judge.ts`)、安装目录扫描(`src/host-scan.ts`)、`hostCheck` RPC、`pnpm scan` 脚本以及它的测试。插件只留下它真正做的事:规则、壁纸、界面透明度与模糊。删掉它的代价就在 diff 里 —— 28 条约定、三处消费方、一套报告格式,而这些东西从来没有哪一版能跟现实对上足够久,值得它在健康宿主上打出的那些红字。
213
+
214
+ ### v0.4.5
215
+
216
+ - **`optionalWhen` 终于按它名字的意思工作了** — 这个字段的文档写着「只有当这块界面在屏幕上时才检查」,但探测实现的是**反过来的**:锚点**不在** DOM 里时反而报 *未观察*,锚点**在**时才会去报失效。于是三条停靠约定里的两条、以及两条对话视图约定,全都在检查错误的状态 —— 这就是健康的停靠栏会报出「停靠空位 失效 / no element matches `[data-dockkit-empty]`」的原因。现在这个辅助函数把锚点当作**正向断言**来读,并且把所有锚点改名成它们真正的含义(`dockHasTab`、`dockHasNoTab`、`chatHasMessages`、`paneFloated` …),这样「用缺席来命名」的锚点再也不可能悄悄把检查反过来。四个测试把由此得到的状态表两个方向都钉住了。
217
+ - **关于消息列的约定不再对着「还没有任何消息」的会话开火** — `[data-chat-flow]` 只在会话**有消息**时才渲染,所以它不在,恰恰是全新会话(宿主的 `data-content-phase="hero"` 首屏)和轨迹页的正常状态。原来的锚点是「对话滚动区存在」,而这三个状态下它都存在,于是检查在首屏和**轨迹页**都报了「属性改名」—— 也就是面板上你看到的第二个失效。现在锚点改用 `[data-chat-turn]`,宿主给每条消息行打的标记,这是唯一「恰好只在消息列该存在时存在」的东西。实测:首屏 → 消息列 0 / 消息行 0;发一条消息后 → 1 / 4;轨迹页 → 0 / 0。
218
+ - **`visible` —— 「存在」和「在屏幕上」不是同一个问题** — 标记了 `visible: true` 的选择器检查现在要求元素真的在屏幕上,于是宿主用 `visibility:hidden` 停放在一边的元素,无法满足一条关于「用户正在看的界面」的约定。停靠空位**故意不标记**:宿主在开合 tab 时一直把它渲染着并隐藏,去问它可不可见,就是在问一个宿主两个方向都在用的状态。
219
+ - **再写死一条锚点规则** — 锚点必须命名「这个属性**预期出现**的状态」,绝不能是恰好同时出现的邻居。这个功能里四次「误报失效」全都是同一个错误:界面明明挂着、宿主行为也对,只是**没有任何东西**能让那个属性落上去。
220
+
228
221
  ### v0.4.4
229
222
 
230
223
  - **停靠相关的约定不再拿「样式表问题」去问 JS 属性** — `dockkit.content` 与 `dockkit.float` 原本是 `rule` 检查(「宿主样式表里有没有提到这个字面量」)。但这两个属性都是宿主从 **JavaScript** 打上去的:`data-dockkit-content` 只在**有 tab** 的停靠页宿主上,`data-dockkit-float` 只在用户真的把面板浮动起来时;宿主从来没为它们写过任何 CSS 规则。所以那个问题无论宿主健不健康都只会回答「没有」。现在两条都改成**存在性**检查,分别用宿主自己的 tab 标记(`data-dockkit-tab`)和浮动态做守卫,于是「没开 tab 的停靠」会报成 *未观察*,而不是「属性改名」。`dockkit.empty`(宿主在「有 tab」时用来替换空位的那个座位)同样改成存在性检查。已在真实宿主上验证:没开 tab 时 `data-dockkit-tab`/`data-dockkit-content` 都不存在;点一下停靠栏的 `+`,两者同时出现(tab 0→1、content 0→1、empty 1→0),此时检查会给出结论而不是跳过。