dsh-background-by-model 0.12.0-test.1 → 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 +9 -0
- package/CHANGELOG.zh.md +9 -0
- package/README.md +6 -19
- package/README.zh.md +6 -19
- package/lib/client.js +30 -0
- package/lib/index.js +6 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,8 +2,17 @@
|
|
|
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
|
|
|
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.
|
|
14
|
+
- **A picture the agent adds lands in `fill`** — the same mode the recommended profile's seven use; `fit` letterboxed every wallpaper that was not already the window's shape, and this is the one path with no panel to correct it afterwards.
|
|
15
|
+
|
|
7
16
|
- **Fix: "installing the profile turned my AI access back off"** — the profile is a LOOK (rules, wallpapers, interface numbers), and authorisation is not part of a look: it answers "may an agent change this", was given by hand, and no button may take it back. `recommendedConfig()` carried the shipped default of `false`, so installing a look silently revoked it.
|
|
8
17
|
- **The other half of the same rule** — the profile still ships `agentAccess: false`, so that installing it cannot GRANT access; what is added here is the symmetric half, that installing it cannot REVOKE it either. It is the same sentence the import path already follows, which keeps the importing machine's own value rather than the file's.
|
|
9
18
|
- **The grant is read before the wipe** — the same reason as the revision: after `resetStore` that config is gone, and reading late would always find the shipped default.
|
package/CHANGELOG.zh.md
CHANGED
|
@@ -2,8 +2,17 @@
|
|
|
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
|
|
|
13
|
+
- **两个工具现在把"主题自己会决定的事"说清楚了** —— 不必为适配当前深浅模式特意挑图(深浅跟着壁纸自身的亮度走,深色浅色都能用)、用户没点名就不传颜色(图片会用自身配色去定主题)、找图优先选中国大陆能访问的站点而不是 `raw.githubusercontent.com` 或 Google。这些都写在对应的参数上,不传该参数的调用一分上下文都不多花。
|
|
14
|
+
- **AI 加的图片落在「填充」** —— 和推荐配置那七张同一个模式;原来的「适应」会给所有不是窗口比例的壁纸加黑边,而这条路径之后没有面板可以补救。
|
|
15
|
+
|
|
7
16
|
- **修掉"开着 AI 授权去用推荐配置,开关被关掉"** —— 推荐配置是**一份外观**(规则、壁纸、界面数值),而授权不是外观的一部分:它回答的是"AI 能不能改这套东西",是用户亲手给的,没有任何按钮可以收回。之前 `recommendedConfig()` 带着出厂默认 `false`,于是"装一份外观"顺手把授权撤销了。
|
|
8
17
|
- **同一条规则的另一面** —— 推荐配置出厂仍带 `agentAccess: false`,这样**安装它不能授予**权限;现在补上对称的一半:**安装它也不能撤销**。这和导入主题的处理是同一句话——导入时也保留**本机**的值,而不是文件里的。
|
|
9
18
|
- **授权值在清空之前读** —— 和版本号同一个道理:`resetStore` 之后那份配置就没了,晚一步读到的永远是出厂默认。
|
package/README.md
CHANGED
|
@@ -146,6 +146,7 @@ The first card on the Config tab: one switch deciding whether **the AI may chang
|
|
|
146
146
|
- **What the AI can do** — add, edit and remove rules; add an image to a rule from a URL; set per-image layout, opacity, brightness, blur and theme colour; set the global interface opacities and the switch effect; adjust rotation; and **install the recommended profile**.
|
|
147
147
|
- **Installing the recommended profile asks separately** — it does exactly what the panel's button does (download seven pictures, empty the store, install seven rules), so the tool requires an explicit `confirm: true` and otherwise refuses **before touching anything**. Download first, wipe second: if any picture cannot be fetched, your rules are not touched at all.
|
|
148
148
|
- **What it cannot do** — touch the holiday art (that slot is read-only), or read image bytes (the tools answer with slot names, never megabytes of base64).
|
|
149
|
+
- **What it is told not to bother with** — matching a picture to the interface's current lightness (the scheme follows the wallpaper, so a dark one and a light one are equally fine), supplying a theme colour the user did not ask for (a picture's own palette is used instead), and sources that mainland China cannot reach. These live in the parameter they apply to, so a call that does not use one costs nothing for it.
|
|
149
150
|
- **Edits land immediately** — the panel checks the config's revision on disk every 3 seconds, so an agent's change repaints without a reload.
|
|
150
151
|
- **An export never carries the switch** — sending someone a theme file does not hand them "let the AI change my appearance", and a hand-edited file that says `true` is overruled by the **importing machine's** own value.
|
|
151
152
|
- **The AI and you cannot silently overwrite each other** — every write names the revision it was computed from, a write that has fallen behind is **refused** instead of overwriting, and the panel then adopts the copy that won.
|
|
@@ -308,34 +309,20 @@ The effect is **Instant**, or the duration is `0` — an effect and a duration a
|
|
|
308
309
|
|
|
309
310
|
> Only the two most recent releases are listed here; older ones live in [CHANGELOG.md](./CHANGELOG.md).
|
|
310
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
|
+
|
|
311
316
|
### v0.12.0
|
|
312
317
|
|
|
313
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
|
+
- **Their descriptions say what the theme decides for them** — a picture is not picked to suit the current light/dark interface (the scheme follows the wallpaper, so either works), no colour is passed unless the user named one, URLs come from hosts reachable in mainland China, and a picture the agent adds lands in `fill`.
|
|
314
320
|
- **The switch ships off** — a new `agentAccess` in the config. While it is off the tools are **absent from the model's tool table**, costing no context and impossible to call; the recommended profile does not turn it on — and installing it does not turn one OFF either.
|
|
315
321
|
- **An export never carries the grant** — a theme file describes an appearance; `agentAccess` and `rev` are stripped on the way out and the importing machine's own value wins on the way in.
|
|
316
322
|
- **The config carries a revision, and a stale write is refused** — the panel and the tools cannot silently overwrite each other; the loser is handed the config that won and adopts it. A successful write must record the new revision, or the next save refuses itself and the edit visibly undoes itself ("click + once, the card flashes and disappears"). Installing the recommended profile is one round trip, not "wipe then write".
|
|
317
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.
|
|
318
324
|
- **`SCHEMA_VERSION` is 11**, with a new `check:agent` and the stale-write and access round trips added to `check:node`.
|
|
319
325
|
|
|
320
|
-
### v0.11.0
|
|
321
|
-
|
|
322
|
-
- **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.
|
|
323
|
-
- **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.
|
|
324
|
-
- **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.
|
|
325
|
-
- **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.
|
|
326
|
-
- **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.
|
|
327
|
-
- **`SCHEMA_VERSION` stays 10** — nothing entered or left the config shape: what changed is where those numbers come from, not what they look like.
|
|
328
|
-
- **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.
|
|
329
|
-
|
|
330
|
-
### v0.10.0
|
|
331
|
-
|
|
332
|
-
- **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.
|
|
333
|
-
- **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.
|
|
334
|
-
- **`SCHEMA_VERSION` is 10** — the fields moved, and an older host would drop them in silence, so the browser half has to know.
|
|
335
|
-
- **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.
|
|
336
|
-
- **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.
|
|
337
|
-
- **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.
|
|
338
|
-
|
|
339
326
|
## Star History
|
|
340
327
|
[](https://www.star-history.com/?repos=HarmlessFunny%2Fdsh-background-by-model&type=timeline&legend=bottom-right)
|
|
341
328
|
|
package/README.zh.md
CHANGED
|
@@ -146,6 +146,7 @@
|
|
|
146
146
|
- **AI 能做** —— 增删改规则、给规则加图(按网址下载)、逐图改布局 / 透明度 / 亮度 / 模糊 / 主题色、改全局界面透明度与切换效果、改轮换设置,以及**换上推荐配置**。
|
|
147
147
|
- **「换上推荐配置」要单独确认** —— 它和面板上那个按钮做同一件事(下载七张图、清空存储、装上七条规则),所以工具要求调用方显式带 `confirm: true`,否则**在动任何东西之前**就拒绝。先下载、后清空:任何一张图取不到,你的规则一个字节都没动。
|
|
148
148
|
- **AI 不能做** —— 改节日画(那个槽位只读)、读图片字节(工具只回槽位名,不回几 MB 的 base64)。
|
|
149
|
+
- **它被告知不必操心的事** —— 挑一张和当前界面深浅相配的图(深浅跟着壁纸走,深色浅色都行)、用户没点名就传主题色(会直接用图片自己的配色)、以及中国大陆访问不到的图源。这些都写在各自的参数上,不用该参数的调用不会为它多花上下文。
|
|
149
150
|
- **改动即时生效** —— 面板每 3 秒核对一次磁盘上的配置版本号,AI 改完不用刷新页面。
|
|
150
151
|
- **导出不带这个开关** —— 把主题文件发给别人,不会顺手把"允许 AI 改外观"也送给对方;对方手动改过的文件里写着 `true` 也没用,导入时一律以**本机**的值说了算。
|
|
151
152
|
- **AI 和你同时改不会互相覆盖** —— 每次写入都带着"我基于哪个版本",落后的一方会被**拒绝**而不是覆盖,然后面板自动接盘最新的那份。
|
|
@@ -308,34 +309,20 @@ pnpm test # 构建 lib/、类型检查、跑十三道检查
|
|
|
308
309
|
|
|
309
310
|
> 这里只列最近两个版本;更早的版本见 [CHANGELOG.zh.md](./CHANGELOG.zh.md)。
|
|
310
311
|
|
|
312
|
+
### v0.12.1
|
|
313
|
+
|
|
314
|
+
- **修掉"AI 加的图片没有主题色"** —— 自动取色原来只挂在面板自己的上传路径上,而 AI 的 `add_image` 一条都不走:node 半边下载并写配置,浏览器半边只能接盘一个新版本号。现在两处接盘都会给"接盘前不存在的槽位"取色,AI 加的图和手动加的一样有主题色,工具描述里那句话才算数。
|
|
315
|
+
|
|
311
316
|
### v0.12.0
|
|
312
317
|
|
|
313
318
|
- **AI 可以通过两个工具改这套外观** —— `background_theme` 读,`background_edit` 写(增删改规则与图片、布局、透明度、亮度、模糊、主题色、全局界面透明度、切换效果、轮换,以及带 `confirm` 才执行的「换上推荐配置」)。它们调的是面板用的同一批 node 半边操作。
|
|
319
|
+
- **工具描述写清了主题替它决定的事** —— 不必为适配当前深浅模式挑图(深浅跟着壁纸走,深色浅色都能用)、用户没点名就不传颜色、找图优先选中国大陆能访问的站点、AI 加的图片落在「填充」。
|
|
314
320
|
- **授权开关默认关** —— 配置里新增 `agentAccess`。关着时工具**根本不在模型的工具表里**,不占上下文也不会被误调;推荐配置也不替你打开。
|
|
315
321
|
- **导出不带授权** —— 主题文件只描述外观,`agentAccess` 与 `rev` 在导出时被剥掉,导入时以本机的值为准。
|
|
316
322
|
- **配置带版本号,落后写入被拒绝** —— 面板与工具不能互相静默覆盖;被拒的一方拿到赢家的配置并接盘重绘。写入成功后必须记下新版本号,否则下一次保存会判自己陈旧、改动在画面上自己撤销("点一次 + 卡片闪一下后消失")。推荐配置是一个操作的往返,不是"清空再写"两步。
|
|
317
323
|
- **面板 3 秒核对一次版本号**,AI 改完不用刷新;授权关闭时是空操作。
|
|
318
324
|
- **`SCHEMA_VERSION` 升到 11**,新增 `check:agent`,`check:node` 补上陈旧写入与授权往返。
|
|
319
325
|
|
|
320
|
-
### v0.11.0
|
|
321
|
-
|
|
322
|
-
- **下载源换成 B 站图床** —— 推荐配置的七张壁纸与中秋、国庆两张节日画,全部改从 `i0/i1/i2.hdslb.com` 取,三个边缘互为回落;README 里那三张截图仍留在原处,它们不参与运行时。
|
|
323
|
-
- **推荐配置的规则改成随插件内置** —— 七条模型规则与那套界面数值编译进包里,按钮只下载七张图。于是它不再需要 GitHub 能通,也不再有「远端配置比插件新」这道闸和 `preset.json` 清单 —— 能被安装的规则永远就是这份构建自己写的那些。
|
|
324
|
-
- **请求清单变成一张常量表** —— 槽位 → BFS 路径编译期定死,而 BFS 路径是上传内容的哈希,所以壁纸地址天然不可变,不像 git tag 那样能被重新指向别的字节。
|
|
325
|
-
- **地址带 `@3840w.webp`** —— 上传的原图是 2.4–12 MB 的 PNG(九张合计 76 MB),加上这个后缀才是 250–365 KB 的 4K WebP,与现有数据目录里那几份字节的 sha1 完全一致。
|
|
326
|
-
- **节日画的缓存目录按内容哈希分代** —— 从 `holiday-cache/<tag>/` 改成 `holiday-cache/<哈希前八位>/`。换图就换地址、换目录、必然重下,那个「记得顺手把版本号也改了」的坑从此不存在;旧的 tag 目录会在新图落盘后由同一次清扫带走。
|
|
327
|
-
- **`SCHEMA_VERSION` 仍是 10** —— 这次没有字段进出配置形状:变的是这些数值从哪来,不是它们长什么样。
|
|
328
|
-
- **门禁** —— `check:preset` 改钉内置配置本身(规则顺序、槽位 ↔ 地址表、地址里的 webp 变换与内容哈希、缓存分代),`check:node` 重写节日与推荐配置两节(三个边缘的回落与重试预算、旧 `fetchPresetConfig` 方法已不存在、槽位白名单、tag 目录被清扫),`check:scheme` 第 3 节不再联网。
|
|
329
|
-
|
|
330
|
-
### v0.10.0
|
|
331
|
-
|
|
332
|
-
- **配置改成原子写,并留一份 `.bak`** —— 保存先写临时文件再改名覆盖,覆盖前把当前能解析的那份留成备份;主文件坏了就从备份恢复,而不是退回出厂默认、再被你下一次拖动覆盖掉。
|
|
333
|
-
- **透明度、亮度与模糊改成逐图保存** —— 与布局模式、取景、主题色同一层;schema-9 的规则级三个值读取时抬到每张图上,升级不改屏幕。
|
|
334
|
-
- **`SCHEMA_VERSION` 升到 10** —— 字段搬了位置,旧宿主会静默丢掉它们,所以必须让浏览器半边知道。
|
|
335
|
-
- **模糊的壁纸不再在视口四周画一圈黑边** —— 图层盒子向屏幕外各扩 2σ 再裁掉,取景位置补回同样的距离,模糊因此取样到屏幕之外,边缘不再透出背后页面的颜色。
|
|
336
|
-
- **透明度、亮度或模糊不同的两张图之间切换现在有动画了** —— 每个图层记住自己那张图的滤镜,壁纸透明度也跟着过渡走,不再直接切。
|
|
337
|
-
- **拖动这三个滑块不再每帧整块重绘** —— 拖动只写那个字段自己的属性,松手才走一次完整重绘。
|
|
338
|
-
|
|
339
326
|
## Star History
|
|
340
327
|
|
|
341
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/lib/index.js
CHANGED
|
@@ -8046,7 +8046,7 @@ function registerThemeTools(ctx, host) {
|
|
|
8046
8046
|
}), { when: () => host.permitted() });
|
|
8047
8047
|
ctx.tools.register(defineTool({
|
|
8048
8048
|
name: "background_edit",
|
|
8049
|
-
description: "Change the user's wallpaper configuration. One action per call. Rules are matched against the model name top-down (first hit wins, rule 1 is the fallback) and an edit takes effect on the next repaint. Image bytes are addressed by slot; add_image downloads a URL into a new slot.",
|
|
8049
|
+
description: "Change the user's wallpaper configuration. One action per call. Rules are matched against the model name top-down (first hit wins, rule 1 is the fallback) and an edit takes effect on the next repaint. Image bytes are addressed by slot; add_image downloads a URL into a new slot and lands it in fill.",
|
|
8050
8050
|
parameters: {
|
|
8051
8051
|
action: {
|
|
8052
8052
|
type: "string",
|
|
@@ -8081,7 +8081,7 @@ function registerThemeTools(ctx, host) {
|
|
|
8081
8081
|
},
|
|
8082
8082
|
matchColor: {
|
|
8083
8083
|
type: "string",
|
|
8084
|
-
description: "set_rule: the RULE's own color as \"#rrggbb\", or \"system\" to follow the system theme. Only paints when the rule has no image."
|
|
8084
|
+
description: "set_rule: the RULE's own color as \"#rrggbb\", or \"system\" to follow the system theme. Only paints when the rule has no image. Leave it out unless the user asked for a specific color."
|
|
8085
8085
|
},
|
|
8086
8086
|
slot: {
|
|
8087
8087
|
type: "string",
|
|
@@ -8090,7 +8090,7 @@ function registerThemeTools(ctx, host) {
|
|
|
8090
8090
|
layout: {
|
|
8091
8091
|
type: "string",
|
|
8092
8092
|
enum: BG_MODES,
|
|
8093
|
-
description: "set_image: how the picture meets the viewport. fit letterboxes, fill crops, stretch distorts, tile repeats, center is unscaled."
|
|
8093
|
+
description: "set_image: how the picture meets the viewport. fit letterboxes, fill crops, stretch distorts, tile repeats, center is unscaled. fill is the one to choose unless the user asks for another."
|
|
8094
8094
|
},
|
|
8095
8095
|
opacity: {
|
|
8096
8096
|
type: "number",
|
|
@@ -8106,11 +8106,11 @@ function registerThemeTools(ctx, host) {
|
|
|
8106
8106
|
},
|
|
8107
8107
|
imageColor: {
|
|
8108
8108
|
type: "string",
|
|
8109
|
-
description: "set_image: this image's theme color as \"#rrggbb\"
|
|
8109
|
+
description: "set_image: overrides this image's theme color, as \"#rrggbb\" or \"system\". Omit it unless the user named a color: an image is themed from its own bytes when it arrives, and needs nothing supplied."
|
|
8110
8110
|
},
|
|
8111
8111
|
url: {
|
|
8112
8112
|
type: "string",
|
|
8113
|
-
description: "add_image: an http(s) URL to download the picture from."
|
|
8113
|
+
description: "add_image: an http(s) URL to download the picture from. Choose by subject, never by brightness: a dark picture and a light one both work, because the light/dark scheme follows the wallpaper rather than the other way round. Prefer a host reachable from mainland China — raw.githubusercontent.com and Google usually are not."
|
|
8114
8114
|
},
|
|
8115
8115
|
intervalSeconds: {
|
|
8116
8116
|
type: "number",
|
|
@@ -8178,7 +8178,7 @@ function registerThemeTools(ctx, host) {
|
|
|
8178
8178
|
if (rule !== void 0 && "error" in rule) return rule;
|
|
8179
8179
|
const target = rule ?? config.rules[0];
|
|
8180
8180
|
if (target === void 0) return { error: "there is no rule to add an image to; create one with set_rule first" };
|
|
8181
|
-
target.images.push(defaultImage(got.slot));
|
|
8181
|
+
target.images.push(defaultImage(got.slot, null, "fill"));
|
|
8182
8182
|
return `added image ${got.slot} to rule ${target.id}`;
|
|
8183
8183
|
});
|
|
8184
8184
|
}
|
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",
|