dsh-background-by-model 0.12.0 → 0.12.1
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/CHANGELOG.md +6 -0
- package/CHANGELOG.zh.md +6 -0
- package/README.md +4 -19
- package/README.zh.md +4 -19
- package/lib/client.js +30 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
> The full release history lives here; the **Recent optimizations** section of [README.md](./README.md#recent-optimizations) lists only the two most recent releases (v0.12.0 / v0.11.0).
|
|
4
4
|
|
|
5
|
+
## v0.12.1
|
|
6
|
+
|
|
7
|
+
- **Fix: "a picture the agent added has no theme colour"** — the auto-extract was hooked to the panel's own three upload paths, and the agent's `add_image` reaches this half by none of them: the node half downloads and writes the config, and the browser half only ever adopts a newer revision. Both adoption sites (the 3 s poll and the refused-write handler) now theme the slots that were not there before the adopt.
|
|
8
|
+
- **The trigger is the slot set, not `color === null`** — null is also what the clear button stores, so re-theming on it would refill a colour the user deliberately removed.
|
|
9
|
+
- **`check:repaint` pins both adoption sites** — each must sample the slot set BEFORE `adoptConfig`, and the call is matched to its own site, so dropping one of the two puts the bug back through the adjacent door.
|
|
10
|
+
|
|
5
11
|
## v0.12.0
|
|
6
12
|
|
|
7
13
|
- **The two tools now say what the theme already decides for them** — a picture is not chosen to match the current light or dark interface (the scheme follows the wallpaper's own luminance, so both work), a colour is not supplied unless the user named one (a picture themes the interface from its own bytes), and the URL is picked from a host reachable in mainland China rather than `raw.githubusercontent.com` or Google. Guidance on the parameter it applies to, so it costs nothing on a call that does not use it.
|
package/CHANGELOG.zh.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
> 这里保留完整的历史记录;[README.zh.md](./README.zh.md#近期优化) 的「近期优化」一节只列最近两个版本(v0.12.0 / v0.11.0)。
|
|
4
4
|
|
|
5
|
+
## v0.12.1
|
|
6
|
+
|
|
7
|
+
- **修掉"AI 加的图片没有主题色"** —— 自动取色原来只挂在面板自己的三条上传路径上,而 AI 的 `add_image` 一条都不走:node 半边下载并写配置,浏览器半边只能接盘一个新版本号。现在两处接盘(3 秒轮询与陈旧写入处理器)都会给"接盘前不存在的槽位"取色。
|
|
8
|
+
- **判据是槽位集合,不是 `color === null`** —— `null` 同时也是「清除颜色」按钮存的值,拿它当"没提取过"会把用户故意清掉的颜色填回来。
|
|
9
|
+
- **`check:repaint` 钉住两处接盘** —— 各自必须在 `adoptConfig` **之前**采样槽位集合,且调用要对得上自己那一处;少一处就是从这个 bug 隔壁那扇门把它放回来。
|
|
10
|
+
|
|
5
11
|
## v0.12.0
|
|
6
12
|
|
|
7
13
|
- **两个工具现在把"主题自己会决定的事"说清楚了** —— 不必为适配当前深浅模式特意挑图(深浅跟着壁纸自身的亮度走,深色浅色都能用)、用户没点名就不传颜色(图片会用自身配色去定主题)、找图优先选中国大陆能访问的站点而不是 `raw.githubusercontent.com` 或 Google。这些都写在对应的参数上,不传该参数的调用一分上下文都不多花。
|
package/README.md
CHANGED
|
@@ -309,6 +309,10 @@ The effect is **Instant**, or the duration is `0` — an effect and a duration a
|
|
|
309
309
|
|
|
310
310
|
> Only the two most recent releases are listed here; older ones live in [CHANGELOG.md](./CHANGELOG.md).
|
|
311
311
|
|
|
312
|
+
### v0.12.1
|
|
313
|
+
|
|
314
|
+
- **Fix: a picture the agent added had no theme colour** — the automatic extraction was hooked to the panel's own upload paths, and the agent's `add_image` reaches this half by none of them: the node half downloads and writes the config, and the browser half only adopts a newer revision. Both adoption sites now theme the slots that were not there before, so a picture added by the agent is themed like one added by hand, and the tools' own descriptions are finally true.
|
|
315
|
+
|
|
312
316
|
### v0.12.0
|
|
313
317
|
|
|
314
318
|
- **The agent can change the appearance through two tools** — `background_theme` reads; `background_edit` writes (add/edit/remove rules and images, layout, opacity, brightness, blur, theme colour, the global interface opacities, the switch effect, rotation, and installing the recommended profile behind a `confirm`). Both call the same node-half operations the settings panel does.
|
|
@@ -319,25 +323,6 @@ The effect is **Instant**, or the duration is `0` — an effect and a duration a
|
|
|
319
323
|
- **The panel checks the revision every 3 s**, so an agent's edit repaints without a reload — a no-op while access is off.
|
|
320
324
|
- **`SCHEMA_VERSION` is 11**, with a new `check:agent` and the stale-write and access round trips added to `check:node`.
|
|
321
325
|
|
|
322
|
-
### v0.11.0
|
|
323
|
-
|
|
324
|
-
- **The download source moves to Bilibili's image CDN** — the recommended profile's seven wallpapers and both holiday pictures now come from `i0`/`i1`/`i2.hdslb.com`, three edges falling back to each other; the three screenshots in this README stay where they are, since they play no part at runtime.
|
|
325
|
-
- **The recommended profile's rules ship inside the plugin** — seven model rules and their interface numbers are compiled into the bundle, and the button downloads only the seven pictures. It no longer needs GitHub to be reachable, and there is no "the remote profile is newer than this build" gate left, nor a `preset.json` manifest — what gets installed is always what this build itself writes.
|
|
326
|
-
- **The request set is a constant table** — slot → BFS path, fixed at build time, and a BFS path is a hash of the upload. So a wallpaper URL is immutable in a way a git tag is not.
|
|
327
|
-
- **The addresses carry `@3840w.webp`** — the uploads are 2.4–12 MB PNGs (76 MB for the set); with that suffix they are the 250–365 KB 4K WebPs whose sha1 matches what is already in a data directory.
|
|
328
|
-
- **The festival cache is keyed by content hash** — `holiday-cache/<tag>/` became `holiday-cache/<first eight of the hash>/`. New art means a new address, therefore a new directory and a guaranteed re-download; the "remember to bump the version too" trap is gone, and the old tag directories are taken by the same sweep once the new art lands.
|
|
329
|
-
- **`SCHEMA_VERSION` stays 10** — nothing entered or left the config shape: what changed is where those numbers come from, not what they look like.
|
|
330
|
-
- **Checks** — `check:preset` now pins the built-in profile itself (rule order, the slot ↔ URL table, the webp transform and content hash in each address, the cache generation); `check:node` rewrites the holiday and profile sections (three-edge fallback and the retry budget, the old `fetchPresetConfig` method being gone, the slot whitelist, tag directories being swept); section 3 of `check:scheme` no longer reaches the network.
|
|
331
|
-
|
|
332
|
-
### v0.10.0
|
|
333
|
-
|
|
334
|
-
- **The config is written atomically, with a `.bak` of the last good file** — a save writes a temp file and renames it over the live one, keeping the previous parseable file as the backup; a corrupt live file is restored from it instead of falling back to the factory defaults and then being overwritten by your next drag.
|
|
335
|
-
- **Opacity, brightness and blur are saved per image** — the same layer as the layout mode, framing and theme color; a schema-9 config's rule-level values are lifted onto every image on read, so nothing changes on screen.
|
|
336
|
-
- **`SCHEMA_VERSION` is 10** — the fields moved, and an older host would drop them in silence, so the browser half has to know.
|
|
337
|
-
- **A blurred wallpaper no longer paints a dark rim around the viewport** — the layer's box is grown 2σ past the screen edge and clipped, with the framing moved back by the same amount, so the blur samples off screen instead of fading into the page behind it.
|
|
338
|
-
- **A switch between two different opacity, brightness or blur values animates now** — each layer keeps its own picture's filter, and the wallpaper's opacity rides the transition instead of snapping.
|
|
339
|
-
- **Dragging one of the three sliders no longer repaints everything per frame** — a drag frame writes only that field's property, and one full repaint lands when the gesture ends.
|
|
340
|
-
|
|
341
326
|
## Star History
|
|
342
327
|
[](https://www.star-history.com/?repos=HarmlessFunny%2Fdsh-background-by-model&type=timeline&legend=bottom-right)
|
|
343
328
|
|
package/README.zh.md
CHANGED
|
@@ -309,6 +309,10 @@ pnpm test # 构建 lib/、类型检查、跑十三道检查
|
|
|
309
309
|
|
|
310
310
|
> 这里只列最近两个版本;更早的版本见 [CHANGELOG.zh.md](./CHANGELOG.zh.md)。
|
|
311
311
|
|
|
312
|
+
### v0.12.1
|
|
313
|
+
|
|
314
|
+
- **修掉"AI 加的图片没有主题色"** —— 自动取色原来只挂在面板自己的上传路径上,而 AI 的 `add_image` 一条都不走:node 半边下载并写配置,浏览器半边只能接盘一个新版本号。现在两处接盘都会给"接盘前不存在的槽位"取色,AI 加的图和手动加的一样有主题色,工具描述里那句话才算数。
|
|
315
|
+
|
|
312
316
|
### v0.12.0
|
|
313
317
|
|
|
314
318
|
- **AI 可以通过两个工具改这套外观** —— `background_theme` 读,`background_edit` 写(增删改规则与图片、布局、透明度、亮度、模糊、主题色、全局界面透明度、切换效果、轮换,以及带 `confirm` 才执行的「换上推荐配置」)。它们调的是面板用的同一批 node 半边操作。
|
|
@@ -319,25 +323,6 @@ pnpm test # 构建 lib/、类型检查、跑十三道检查
|
|
|
319
323
|
- **面板 3 秒核对一次版本号**,AI 改完不用刷新;授权关闭时是空操作。
|
|
320
324
|
- **`SCHEMA_VERSION` 升到 11**,新增 `check:agent`,`check:node` 补上陈旧写入与授权往返。
|
|
321
325
|
|
|
322
|
-
### v0.11.0
|
|
323
|
-
|
|
324
|
-
- **下载源换成 B 站图床** —— 推荐配置的七张壁纸与中秋、国庆两张节日画,全部改从 `i0/i1/i2.hdslb.com` 取,三个边缘互为回落;README 里那三张截图仍留在原处,它们不参与运行时。
|
|
325
|
-
- **推荐配置的规则改成随插件内置** —— 七条模型规则与那套界面数值编译进包里,按钮只下载七张图。于是它不再需要 GitHub 能通,也不再有「远端配置比插件新」这道闸和 `preset.json` 清单 —— 能被安装的规则永远就是这份构建自己写的那些。
|
|
326
|
-
- **请求清单变成一张常量表** —— 槽位 → BFS 路径编译期定死,而 BFS 路径是上传内容的哈希,所以壁纸地址天然不可变,不像 git tag 那样能被重新指向别的字节。
|
|
327
|
-
- **地址带 `@3840w.webp`** —— 上传的原图是 2.4–12 MB 的 PNG(九张合计 76 MB),加上这个后缀才是 250–365 KB 的 4K WebP,与现有数据目录里那几份字节的 sha1 完全一致。
|
|
328
|
-
- **节日画的缓存目录按内容哈希分代** —— 从 `holiday-cache/<tag>/` 改成 `holiday-cache/<哈希前八位>/`。换图就换地址、换目录、必然重下,那个「记得顺手把版本号也改了」的坑从此不存在;旧的 tag 目录会在新图落盘后由同一次清扫带走。
|
|
329
|
-
- **`SCHEMA_VERSION` 仍是 10** —— 这次没有字段进出配置形状:变的是这些数值从哪来,不是它们长什么样。
|
|
330
|
-
- **门禁** —— `check:preset` 改钉内置配置本身(规则顺序、槽位 ↔ 地址表、地址里的 webp 变换与内容哈希、缓存分代),`check:node` 重写节日与推荐配置两节(三个边缘的回落与重试预算、旧 `fetchPresetConfig` 方法已不存在、槽位白名单、tag 目录被清扫),`check:scheme` 第 3 节不再联网。
|
|
331
|
-
|
|
332
|
-
### v0.10.0
|
|
333
|
-
|
|
334
|
-
- **配置改成原子写,并留一份 `.bak`** —— 保存先写临时文件再改名覆盖,覆盖前把当前能解析的那份留成备份;主文件坏了就从备份恢复,而不是退回出厂默认、再被你下一次拖动覆盖掉。
|
|
335
|
-
- **透明度、亮度与模糊改成逐图保存** —— 与布局模式、取景、主题色同一层;schema-9 的规则级三个值读取时抬到每张图上,升级不改屏幕。
|
|
336
|
-
- **`SCHEMA_VERSION` 升到 10** —— 字段搬了位置,旧宿主会静默丢掉它们,所以必须让浏览器半边知道。
|
|
337
|
-
- **模糊的壁纸不再在视口四周画一圈黑边** —— 图层盒子向屏幕外各扩 2σ 再裁掉,取景位置补回同样的距离,模糊因此取样到屏幕之外,边缘不再透出背后页面的颜色。
|
|
338
|
-
- **透明度、亮度或模糊不同的两张图之间切换现在有动画了** —— 每个图层记住自己那张图的滤镜,壁纸透明度也跟着过渡走,不再直接切。
|
|
339
|
-
- **拖动这三个滑块不再每帧整块重绘** —— 拖动只写那个字段自己的属性,松手才走一次完整重绘。
|
|
340
|
-
|
|
341
326
|
## Star History
|
|
342
327
|
|
|
343
328
|
[](https://www.star-history.com/?repos=HarmlessFunny%2Fdsh-background-by-model&type=timeline&legend=bottom-right)
|
package/lib/client.js
CHANGED
|
@@ -9024,9 +9024,11 @@ window.__ModuleLoader__.load({
|
|
|
9024
9024
|
if (rev === null || rev === cfg.rev) return;
|
|
9025
9025
|
const persisted = await loadPersisted();
|
|
9026
9026
|
if (persisted === null) return;
|
|
9027
|
+
const before = new Set(cfg.rules.flatMap(ruleSlots));
|
|
9027
9028
|
adoptConfig(persisted.config);
|
|
9028
9029
|
for (const slot of cfg.rules.flatMap(ruleSlots)) if (displayImageOf(slot) === null) await loadSlot(slot);
|
|
9029
9030
|
applyActive();
|
|
9031
|
+
themeArrivedPictures(before);
|
|
9030
9032
|
})();
|
|
9031
9033
|
}
|
|
9032
9034
|
});
|
|
@@ -9042,10 +9044,12 @@ window.__ModuleLoader__.load({
|
|
|
9042
9044
|
applyActive();
|
|
9043
9045
|
})();
|
|
9044
9046
|
setConflictHandler((config) => {
|
|
9047
|
+
const before = new Set(cfg.rules.flatMap(ruleSlots));
|
|
9045
9048
|
adoptConfig(config);
|
|
9046
9049
|
(async () => {
|
|
9047
9050
|
for (const slot of cfg.rules.flatMap(ruleSlots)) if (displayImageOf(slot) === null) await loadSlot(slot);
|
|
9048
9051
|
applyActive();
|
|
9052
|
+
themeArrivedPictures(before);
|
|
9049
9053
|
})();
|
|
9050
9054
|
});
|
|
9051
9055
|
ctx.effect(() => () => {
|
|
@@ -9106,6 +9110,32 @@ window.__ModuleLoader__.load({
|
|
|
9106
9110
|
});
|
|
9107
9111
|
const maybeAutoExtract = (id, slot) => extract.one(id, slot);
|
|
9108
9112
|
const maybeAutoExtractEach = (id, slots) => extract.each(id, slots);
|
|
9113
|
+
/**
|
|
9114
|
+
* Theme the pictures an EXTERNAL writer added.
|
|
9115
|
+
*
|
|
9116
|
+
* The panel's own uploads call `maybeAutoExtract` themselves, because they know
|
|
9117
|
+
* which slots they just appended. The agent's `add_image` does not come through
|
|
9118
|
+
* any of them: it downloads inside the node half, writes the config, and this
|
|
9119
|
+
* half learns about the picture only by adopting a newer revision — the poll
|
|
9120
|
+
* above, or the stale-write handler below. Nothing on that road asked for a
|
|
9121
|
+
* colour, which is why a tool-added picture stayed on the system theme while the
|
|
9122
|
+
* same picture added by hand was themed.
|
|
9123
|
+
*
|
|
9124
|
+
* `before` is the slot set this half held BEFORE adopting, so "new" means a slot
|
|
9125
|
+
* that was not there a moment ago. That comparison is the whole point:
|
|
9126
|
+
* `color === null` cannot be the test, because null is ALSO what the clear
|
|
9127
|
+
* button stores, and re-theming a picture whose colour the user deliberately
|
|
9128
|
+
* removed would be this feature fighting that choice.
|
|
9129
|
+
*
|
|
9130
|
+
* Holiday art is excluded by construction — this walks `rules`, and a festival
|
|
9131
|
+
* slot is read-only.
|
|
9132
|
+
*/
|
|
9133
|
+
const themeArrivedPictures = (before) => {
|
|
9134
|
+
for (const rule of cfg.rules) {
|
|
9135
|
+
const fresh = rule.images.filter((i) => !before.has(i.slot)).map((i) => i.slot);
|
|
9136
|
+
if (fresh.length > 0) maybeAutoExtractEach(rule.id, fresh);
|
|
9137
|
+
}
|
|
9138
|
+
};
|
|
9109
9139
|
const activeLang = () => {
|
|
9110
9140
|
try {
|
|
9111
9141
|
const snapshot = ctx.locale.getSnapshot();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-background-by-model",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Appearance plugin for DeepSeek Harness: an ordered list of model rules, each carrying its own wallpapers — every image with its own framing and theme color — plus layout mode, opacity, brightness and blur; the background follows the model you switch to, a rule can rotate through several images on its own rhythm, and an off-by-default switch lets the agent change any of it through two tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|