deepseek-harness-background 0.2.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/LICENSE +21 -0
- package/README.md +129 -0
- package/README.zh.md +129 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +1116 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +540 -0
- package/package.json +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HaoyueQin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# DeepSeek Harness Background
|
|
2
|
+
|
|
3
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/stargazers)
|
|
4
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/releases)
|
|
5
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/actions)
|
|
6
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/issues)
|
|
7
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/commits)
|
|
8
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background)
|
|
9
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
[English](README.md) | [中文](README.zh.md)
|
|
13
|
+
|
|
14
|
+
A custom **background image plugin** for the DeepSeek Harness Web GUI (`dsh web`): upload a local picture, or paste an image URL, and render it behind the whole app surface with adjustable **opacity**, **readability scrim**, **panel transparency** and **frosted-glass blur** — everything live-previewed inside the settings panel and committed automatically on release.
|
|
15
|
+
|
|
16
|
+
The look (fixed wallpaper layer + theme-aware scrim + translucent glass panels driven by `--dsw-*` design tokens) is modeled on the community `dsh-wallpaper-engine` implementation.
|
|
17
|
+
|
|
18
|
+
## Screenshots
|
|
19
|
+
|
|
20
|
+
| | |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| **Home** | <img src="docs/images/home.jpg" alt="Custom background on the home screen" width="640"> |
|
|
23
|
+
| **Conversation** | <img src="docs/images/conversation.jpg" alt="Custom background behind the conversation" width="640"> |
|
|
24
|
+
| **Settings** | <img src="docs/images/settings.jpg" alt="Background settings row with live preview" width="640"> |
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **Local upload** — pick a JPG / PNG / WebP / GIF from your computer; the plugin stores it under the harness home and serves it over a same-origin route (admitted only when the declared MIME, detected signature and extension all agree).
|
|
29
|
+
- **Paste a URL** — drop an `http(s)` image link and press Enter.
|
|
30
|
+
- **In-panel live preview** — a preview surface at the top of the row renders the image + scrim + a frosted glass bubble; dragging any slider repaints it instantly.
|
|
31
|
+
- **Stepped sliders** — ratio controls snap in **5% steps**, blur radii in 1/2px steps; dragging only repaints, **release commits** (one write per gesture, no jank).
|
|
32
|
+
- **Five controls** — wallpaper opacity, readability scrim, panel opacity, frosted-glass blur, and wallpaper blur.
|
|
33
|
+
- **Fit modes** — `cover` (fill, crop) or `contain` (whole image).
|
|
34
|
+
- **Theme-aware scrim** — the light theme uses a white veil (lifts the art so dark text keeps contrast); the dark theme automatically switches to a black veil (dims the art so light text keeps contrast).
|
|
35
|
+
- **Frosted glass** — while a background is active, the composer card and message bubbles turn into translucent glass over the wallpaper (specular sheen + `backdrop-filter`), with the blur radius driven by the glass-blur slider. `panelOpacity` at 100% restores the official opaque surfaces.
|
|
36
|
+
- **Persisted in the official settings document** (`$DSH_HOME/settings.yaml`), waits out restarts.
|
|
37
|
+
- **Clean teardown** — disabling, clearing or uninstalling restores the original background exactly; the plugin only ever removes what it wrote.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
The plugin is a standard out-of-tree dsh bundle, published on npm:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
dsh plugin --profile web add deepseek-harness-background
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
From a local checkout (development):
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
dsh plugin --profile web add /path/to/deepseek-harness-background
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
From a source checkout:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm dsh plugin --profile web add /path/to/deepseek-harness-background
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or from git:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
dsh plugin --profile web add github:<you>/deepseek-harness-background#<commit>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Restart to load it:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
dsh --profile web
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
1. Start the Web UI (`dsh --profile web`) and open it in a browser.
|
|
74
|
+
2. Open **Settings** (bottom-left) → **General** → the **Custom Background** row (in the same area as the Appearance row).
|
|
75
|
+
3. **Upload** an image or **paste a URL** — the background applies immediately and the preview surface above updates in sync.
|
|
76
|
+
4. Tune the controls — sliders snap in steps and **commit on release**:
|
|
77
|
+
|
|
78
|
+
| Control | Meaning |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| 不透明度 / Opacity | `0..100%` image opacity (5% steps); lowering it fades the wallpaper toward the surface. |
|
|
81
|
+
| 遮罩 / Scrim | `0..95%` readability veil over the image (5% steps); white in light mode, black in dark mode. |
|
|
82
|
+
| 面板不透明度 / Panel opacity | `0..100%` surface transparency (5% steps); at `100%` the official panels stay opaque (no glass). |
|
|
83
|
+
| 毛玻璃模糊 / Glass blur | `0..40px` `backdrop-filter` blur on the translucent surfaces (1px steps). |
|
|
84
|
+
| 壁纸模糊 / Wallpaper blur | `0..60px` blur of the wallpaper image itself (2px steps). |
|
|
85
|
+
| 填充方式 / Fit | `cover` or `contain`. |
|
|
86
|
+
|
|
87
|
+
5. **清除背景** removes the background and restores the stock look.
|
|
88
|
+
|
|
89
|
+
## How it works
|
|
90
|
+
|
|
91
|
+
- The **settings row** lives in the official General settings section (`settings.general.item` slot), next to the Appearance row. Its chrome uses only `--dsw-alias-*` design tokens (buttons / pills / segmented control / slider track match the official shell); sliders are native `input[type=range]` with 5% / 1–2px steps and release-commit.
|
|
92
|
+
- The plugin's own host routes (`/api/bg-wallpaper/*`: `settings`, `upload`, `image/<id>`) read/write the section and serve uploads with same-origin + size caps + MIME/signature checks + a path-escape fence. A custom route family is used because the api-proxy settings allowlist does not expose third-party namespaces over the settings RPC.
|
|
93
|
+
- The background is drawn as a fixed `z-index:-2` wallpaper layer plus a `z-index:-1` scrim on `body`, toggled by the `data-dsh-bg` attribute; the scrim switches white/black by `data-ds-dark-theme` in the injected stylesheet; the frosted-glass effect overrides the shell's surface design tokens.
|
|
94
|
+
- Uploads live under `$DSH_HOME/deepseek-harness-background/` (content-addressed ids). Switching to a new image or clearing the background deletes the superseded upload file, so the directory never accumulates dead images. Disable / uninstall leaves nothing behind.
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
pnpm install # first time; runs prepare (build)
|
|
100
|
+
pnpm run typecheck # tsc
|
|
101
|
+
pnpm test # vitest contract tests
|
|
102
|
+
pnpm run build # tsdown: lib/index.js (host) + lib/client.js (browser bundle)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
deepseek-harness-background/ # the plugin repo (package name stays the npm-style id)
|
|
107
|
+
├── package.json # dsh.bundle.patch + dsh.client.inject declarations
|
|
108
|
+
├── cordis.patch.yml # inserts the deepseek-harness-background row into the web roster
|
|
109
|
+
├── tsdown.config.ts # official clientBundle preset
|
|
110
|
+
├── src/
|
|
111
|
+
│ ├── index.ts # host half: ui-background namespace + API routes
|
|
112
|
+
│ ├── routes.ts # /api/bg-wallpaper/{settings,upload,image/<id>}
|
|
113
|
+
│ ├── schema.ts # host-side schemastery schema
|
|
114
|
+
│ ├── settings.ts # constants/types shared with the client
|
|
115
|
+
│ ├── harness-home.ts # $DSH_HOME / ~/.dsh resolution
|
|
116
|
+
│ └── client/
|
|
117
|
+
│ ├── index.ts # painter lifecycle + settings row registration
|
|
118
|
+
│ ├── backdrop.ts # fixed wallpaper layer + scrim + glass surface + preview vars
|
|
119
|
+
│ ├── background-css.ts # injected stylesheet (layers, glass, light/dark scrim, variables)
|
|
120
|
+
│ ├── SettingsRow.tsx # the General-settings row (preview surface + stepped sliders)
|
|
121
|
+
│ ├── SettingsRow.module.css # row styles (official tokens)
|
|
122
|
+
│ ├── settings-client.ts# fetch transport (read/write/upload)
|
|
123
|
+
│ └── locales.ts # zh/en copy
|
|
124
|
+
└── tests/ # schema, routes, apply (painter), settings-row contracts
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# DeepSeek Harness Background
|
|
2
|
+
|
|
3
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/stargazers)
|
|
4
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/releases)
|
|
5
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/actions)
|
|
6
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/issues)
|
|
7
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background/commits)
|
|
8
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background)
|
|
9
|
+
[](https://github.com/HaoyueQin/deepseek-harness-background)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
[English](README.md) | 中文
|
|
13
|
+
|
|
14
|
+
一个 **DeepSeek Harness Web GUI**(`dsh web`)的**自定义背景图片插件**:上传一张本地图片,或粘贴一个图片链接,把它绘制在整个应用界面背后,并可调节**不透明度**、**可读性遮罩**、**面板透明**与**毛玻璃模糊** —— 全部在设置面板内实时预览、松手自动保存。
|
|
15
|
+
|
|
16
|
+
外观(固定壁纸层 + 主题自适应遮罩 + 由 `--dsw-*` 设计 token 驱动的半透明玻璃面板)借鉴了社区 `dsh-wallpaper-engine` 的实现。
|
|
17
|
+
|
|
18
|
+
## 截图
|
|
19
|
+
|
|
20
|
+
| | |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| **首页** | <img src="docs/images/home.jpg" alt="首页上的自定义背景" width="640"> |
|
|
23
|
+
| **会话界面** | <img src="docs/images/conversation.jpg" alt="会话背后的自定义背景" width="640"> |
|
|
24
|
+
| **设置界面** | <img src="docs/images/settings.jpg" alt="带实时预览的背景设置行" width="640"> |
|
|
25
|
+
|
|
26
|
+
## 功能
|
|
27
|
+
|
|
28
|
+
- **本地上传** —— 从电脑选择 JPG / PNG / WebP / GIF 图片;插件存入 harness home 目录,经同源路由提供(仅当声明的 MIME、探测到的文件签名与扩展名三者一致才被接受)。
|
|
29
|
+
- **粘贴 URL** —— 输入 `http(s)` 图片链接后回车即可。
|
|
30
|
+
- **面板内实时预览** —— 设置行顶部有预览卡:图片 + 遮罩 + 毛玻璃气泡;拖动任意滑块即时重绘,所见即所存。
|
|
31
|
+
- **阻尼滑块** —— 比例类滑块按 **5% 步进**、模糊类按 1/2px 步进吸附;拖动过程只改画面,**松手才保存**(每次手势一次写入,不再抖动)。
|
|
32
|
+
- **五个调节项** —— 壁纸不透明度、可读性遮罩、面板不透明度、毛玻璃模糊、壁纸模糊。
|
|
33
|
+
- **填充方式** —— `cover`(铺满、裁剪)或 `contain`(完整、留白)。
|
|
34
|
+
- **主题自适应遮罩** —— 浅色主题用白色纱帘(把图片提亮保持深色文字对比度),深色主题自动换成黑色纱帘(压暗图片保持浅色文字对比度)。
|
|
35
|
+
- **毛玻璃** —— 启用背景后,输入框卡片与消息气泡变成覆盖在壁纸上的半透明玻璃(顶部白色高光渐变 + `backdrop-filter`),模糊半径由「毛玻璃模糊」滑块驱动;「面板不透明度」调至 100% 即恢复官方不透明表面。
|
|
36
|
+
- **持久化到官方设置文档** —— 存于 `$DSH_HOME/settings.yaml`,跨重启保留。
|
|
37
|
+
- **干净卸载** —— 关闭、清除或卸载后完整恢复原背景;插件只移除自己写过的内容。
|
|
38
|
+
|
|
39
|
+
## 安装
|
|
40
|
+
|
|
41
|
+
这是一个标准的 out-of-tree dsh bundle,已发布到 npm:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
dsh plugin --profile web add deepseek-harness-background
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
从本地 checkout 安装(开发用):
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
dsh plugin --profile web add /path/to/deepseek-harness-background
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
从源代码检出安装:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
pnpm dsh plugin --profile web add /path/to/deepseek-harness-background
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
或从 git 安装:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
dsh plugin --profile web add github:<you>/deepseek-harness-background#<commit>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
安装后重启:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
dsh --profile web
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 使用
|
|
72
|
+
|
|
73
|
+
1. 启动 Web UI(`dsh --profile web`)并在浏览器打开。
|
|
74
|
+
2. 打开 **设置**(左下角)→ **通用** → 找到 **自定义背景** 一行(与「外观」行同一区域)。
|
|
75
|
+
3. **上传**图片或**粘贴 URL** —— 背景立即生效,面板顶部的预览卡同步显示。
|
|
76
|
+
4. 调整控件,滑块均为阻尼步进、**松手才保存**:
|
|
77
|
+
|
|
78
|
+
| 控件 | 说明 |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| 不透明度 | `0..100%` 图片不透明度(5% 步进);调低让壁纸向表面色淡出。 |
|
|
81
|
+
| 遮罩 | `0..95%` 图片上方的可读性纱帘(5% 步进),浅色主题白色、深色主题黑色。 |
|
|
82
|
+
| 面板不透明度 | `0..100%` 表面透明程度(5% 步进);为 `100%` 时官方面板保持不透明(无玻璃)。 |
|
|
83
|
+
| 毛玻璃模糊 | `0..40px` 半透明表面上的 `backdrop-filter` 模糊(1px 步进)。 |
|
|
84
|
+
| 壁纸模糊 | `0..60px` 壁纸图片本身的模糊(2px 步进)。 |
|
|
85
|
+
| 填充方式 | `cover`(铺满)或 `contain`(完整)。 |
|
|
86
|
+
|
|
87
|
+
5. 点 **清除背景** 移除背景,恢复默认外观。
|
|
88
|
+
|
|
89
|
+
## 原理
|
|
90
|
+
|
|
91
|
+
- **设置行**位于官方「通用」设置分区的 `settings.general.item` 槽中,紧挨「外观」行。控件样式全部使用 `--dsw-alias-*` 设计 token(按钮 / 胶囊 / 分段控件 / 滑块轨道与官方 chrome 一致),滑块为原生 `input[type=range]` 的 5% / 1–2px 步进 + 松手提交。
|
|
92
|
+
- 插件自有的 host 路由(`/api/bg-wallpaper/*`:`settings`、`upload`、`image/<id>`)负责读写设置与提供上传图片,带同源校验、大小上限、MIME/签名校验与路径穿越防护。使用自定义路由族,是因为 api-proxy 的 settings 白名单不向第三方命名空间开放 settings RPC。
|
|
93
|
+
- 背景以 `body` 上一张固定的 `z-index:-2` 壁纸层 + `z-index:-1` 遮罩绘制,由 `data-dsh-bg` 属性开关;遮罩在注入样式表里按 `data-ds-dark-theme` 切换白/黑纱帘;毛玻璃效果通过覆盖外壳的 surface 设计 token 实现。
|
|
94
|
+
- 上传文件存放在 `$DSH_HOME/deepseek-harness-background/`(内容寻址 id)。切换新图片或清除背景时,被替换的旧上传文件会被自动回收,目录不会堆积死图片。关闭 / 卸载后不留残留。
|
|
95
|
+
|
|
96
|
+
## 开发
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
pnpm install # 首次;会运行 prepare(构建)
|
|
100
|
+
pnpm run typecheck # tsc
|
|
101
|
+
pnpm test # vitest 契约测试
|
|
102
|
+
pnpm run build # tsdown:lib/index.js(host)+ lib/client.js(浏览器 bundle)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
deepseek-harness-background/ # 插件仓库(包名保留 npm 风格 id)
|
|
107
|
+
├── package.json # dsh.bundle.patch + dsh.client.inject 声明
|
|
108
|
+
├── cordis.patch.yml # 向 web 插件名册插入 deepseek-harness-background 一行
|
|
109
|
+
├── tsdown.config.ts # 官方 clientBundle 预设
|
|
110
|
+
├── src/
|
|
111
|
+
│ ├── index.ts # host 半部:ui-background 命名空间 + API 路由
|
|
112
|
+
│ ├── routes.ts # /api/bg-wallpaper/{settings,upload,image/<id>}
|
|
113
|
+
│ ├── schema.ts # host 侧 schemastery schema
|
|
114
|
+
│ ├── settings.ts # 两端共享的常量/类型
|
|
115
|
+
│ ├── harness-home.ts # $DSH_HOME / ~/.dsh 解析
|
|
116
|
+
│ └── client/
|
|
117
|
+
│ ├── index.ts # painter 生命周期 + 设置行注册
|
|
118
|
+
│ ├── backdrop.ts # 固定壁纸层 + 遮罩 + 玻璃表面 + 预览变量
|
|
119
|
+
│ ├── background-css.ts # 注入的样式表(层、玻璃、明暗遮罩、变量)
|
|
120
|
+
│ ├── SettingsRow.tsx # 通用设置中的设置行(预览卡 + 阻尼滑块)
|
|
121
|
+
│ ├── SettingsRow.module.css # 设置行样式(官方 token)
|
|
122
|
+
│ ├── settings-client.ts# fetch 传输层(读/写/上传)
|
|
123
|
+
│ └── locales.ts # 中/英文案
|
|
124
|
+
└── tests/ # 契约测试(schema、routes、apply/painter、设置行)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# deepseek-harness-background bundle patch: inserts its dshClient row into
|
|
2
|
+
# the web plugin roster. The bundle is the official dsh plugin shape — install
|
|
3
|
+
# it with `dsh plugin --profile <name> add <path-or-git-url>` (or `pnpm dsh ...`
|
|
4
|
+
# from a fresh source checkout).
|
|
5
|
+
- insert:
|
|
6
|
+
- id: deepseek-harness-background
|
|
7
|
+
name: 'deepseek-harness-background'
|