dsh-any-background 0.2.10 → 0.3.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 +32 -19
- package/README.zh.md +33 -19
- package/lib/client.js +534 -43
- package/lib/client.js.map +1 -1
- package/lib/index.js +67 -5
- package/package.json +18 -10
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { access, mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
2
2
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
3
|
+
import { basename, dirname, join } from "node:path";
|
|
3
4
|
import { Readable } from "node:stream";
|
|
4
5
|
import { dshHomePath } from "@deepseek-ai/dsh-home-paths";
|
|
5
6
|
//#region src/index.ts
|
|
@@ -100,7 +101,8 @@ const DEFAULT_CONFIG = {
|
|
|
100
101
|
trajectory: 30,
|
|
101
102
|
input: 30,
|
|
102
103
|
panel: 30,
|
|
103
|
-
produced: 30
|
|
104
|
+
produced: 30,
|
|
105
|
+
header: 30
|
|
104
106
|
},
|
|
105
107
|
strokes: {
|
|
106
108
|
bg: {
|
|
@@ -147,6 +149,11 @@ const DEFAULT_CONFIG = {
|
|
|
147
149
|
width: 0,
|
|
148
150
|
color: "auto",
|
|
149
151
|
customColor: "#808080"
|
|
152
|
+
},
|
|
153
|
+
header: {
|
|
154
|
+
width: 0,
|
|
155
|
+
color: "auto",
|
|
156
|
+
customColor: "#808080"
|
|
150
157
|
}
|
|
151
158
|
},
|
|
152
159
|
settingsOpacity: .5,
|
|
@@ -177,6 +184,7 @@ const DEFAULT_CONFIG = {
|
|
|
177
184
|
trajectoryOpacity: .5,
|
|
178
185
|
panelOpacity: .5,
|
|
179
186
|
producedOpacity: .5,
|
|
187
|
+
headerOpacity: .5,
|
|
180
188
|
profiles: [],
|
|
181
189
|
rotation: {
|
|
182
190
|
enabled: false,
|
|
@@ -197,6 +205,55 @@ const DEFAULT_CONFIG = {
|
|
|
197
205
|
schemeOverride: "auto",
|
|
198
206
|
activeProfile: null
|
|
199
207
|
};
|
|
208
|
+
const VERSION_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
209
|
+
/** True when a string looks like a release version (a bare `~/.dsh` basename does not). */
|
|
210
|
+
function looksLikeVersion(value) {
|
|
211
|
+
return VERSION_RE.test(value);
|
|
212
|
+
}
|
|
213
|
+
/** Read the installed `@deepseek-ai/dsh` manifest version for a launcher dir,
|
|
214
|
+
* or null when the layout does not apply (plain `~/.dsh`, non-launcher hosts). */
|
|
215
|
+
async function readInstalledVersion(homeDir) {
|
|
216
|
+
const root = dirname(dirname(homeDir));
|
|
217
|
+
const versionSeg = basename(homeDir);
|
|
218
|
+
const manifest = join(root, "versions", versionSeg, "node_modules", "@deepseek-ai", "dsh", "package.json");
|
|
219
|
+
try {
|
|
220
|
+
const raw = JSON.parse(await readFile(manifest, "utf8"));
|
|
221
|
+
if (typeof raw.version === "string" && raw.version.trim() !== "") return raw.version.trim();
|
|
222
|
+
} catch {}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
/** Cached verdict: the probe touches the filesystem, and the host version never
|
|
226
|
+
* changes within a process lifetime. */
|
|
227
|
+
let hostInfoCache;
|
|
228
|
+
/** Map a release string onto the generation bucket the plugin gates features by.
|
|
229
|
+
* The published lines are `0.1.5`, `0.1.6` and `0.1.7`, so the bucket is the
|
|
230
|
+
* `major.minor.patch` prefix — every rc/alpha within a line shares it. */
|
|
231
|
+
function generationOf(version) {
|
|
232
|
+
if (version === null) return "unknown";
|
|
233
|
+
const m = /^(\d+\.\d+\.\d+)/.exec(version);
|
|
234
|
+
if (m === null) return "unknown";
|
|
235
|
+
const key = m[1];
|
|
236
|
+
return key === "0.1.5" || key === "0.1.6" || key === "0.1.7" ? key : "unknown";
|
|
237
|
+
}
|
|
238
|
+
/** Resolve (and cache) the host release + generation. */
|
|
239
|
+
async function resolveHostInfo() {
|
|
240
|
+
if (hostInfoCache !== void 0) return hostInfoCache;
|
|
241
|
+
const homeDir = dshHomePath();
|
|
242
|
+
let version = null;
|
|
243
|
+
try {
|
|
244
|
+
version = await readInstalledVersion(homeDir);
|
|
245
|
+
} catch {}
|
|
246
|
+
if (version === null) {
|
|
247
|
+
const seg = basename(homeDir);
|
|
248
|
+
if (looksLikeVersion(seg)) version = seg;
|
|
249
|
+
}
|
|
250
|
+
if (version !== null && !looksLikeVersion(version)) version = null;
|
|
251
|
+
hostInfoCache = {
|
|
252
|
+
version,
|
|
253
|
+
generation: generationOf(version)
|
|
254
|
+
};
|
|
255
|
+
return hostInfoCache;
|
|
256
|
+
}
|
|
200
257
|
const dataDir = () => dshHomePath(DATA_DIR);
|
|
201
258
|
const configPath = () => dshHomePath(DATA_DIR, CONFIG_FILE);
|
|
202
259
|
const wallpaperPath = () => dshHomePath(DATA_DIR, WALLPAPER_FILE);
|
|
@@ -297,7 +354,8 @@ const STROKE_GROUPS = [
|
|
|
297
354
|
"trajectory",
|
|
298
355
|
"input",
|
|
299
356
|
"panel",
|
|
300
|
-
"produced"
|
|
357
|
+
"produced",
|
|
358
|
+
"header"
|
|
301
359
|
];
|
|
302
360
|
const STROKE_COLOR_KEYS = [
|
|
303
361
|
"auto",
|
|
@@ -359,7 +417,8 @@ function normalizeConfig(raw) {
|
|
|
359
417
|
"trajectory",
|
|
360
418
|
"input",
|
|
361
419
|
"panel",
|
|
362
|
-
"produced"
|
|
420
|
+
"produced",
|
|
421
|
+
"header"
|
|
363
422
|
]) blurs[k] = clamp(bl[k], 0, 60, DEFAULT_CONFIG.blurs[k]);
|
|
364
423
|
return {
|
|
365
424
|
color,
|
|
@@ -387,6 +446,7 @@ function normalizeConfig(raw) {
|
|
|
387
446
|
trajectoryOpacity: clamp(r.trajectoryOpacity, 0, 1, DEFAULT_CONFIG.trajectoryOpacity),
|
|
388
447
|
panelOpacity: clamp(r.panelOpacity, 0, 1, DEFAULT_CONFIG.panelOpacity),
|
|
389
448
|
producedOpacity: clamp(r.producedOpacity, 0, 1, DEFAULT_CONFIG.producedOpacity),
|
|
449
|
+
headerOpacity: clamp(r.headerOpacity, 0, 1, DEFAULT_CONFIG.headerOpacity),
|
|
390
450
|
profiles: normalizeProfiles(r.profiles),
|
|
391
451
|
rotation: normalizeRotation(r.rotation),
|
|
392
452
|
schedule: normalizeSchedule(r.schedule),
|
|
@@ -471,7 +531,8 @@ function normalizeProfileAppearance(raw) {
|
|
|
471
531
|
chatTextOpacity: clamp(a.chatTextOpacity, 0, 1, DEFAULT_CONFIG.chatTextOpacity),
|
|
472
532
|
trajectoryOpacity: clamp(a.trajectoryOpacity, 0, 1, DEFAULT_CONFIG.trajectoryOpacity),
|
|
473
533
|
panelOpacity: clamp(a.panelOpacity, 0, 1, DEFAULT_CONFIG.panelOpacity),
|
|
474
|
-
producedOpacity: clamp(a.producedOpacity, 0, 1, DEFAULT_CONFIG.producedOpacity)
|
|
534
|
+
producedOpacity: clamp(a.producedOpacity, 0, 1, DEFAULT_CONFIG.producedOpacity),
|
|
535
|
+
headerOpacity: clamp(a.headerOpacity, 0, 1, DEFAULT_CONFIG.headerOpacity)
|
|
475
536
|
};
|
|
476
537
|
}
|
|
477
538
|
function normalizeProfiles(raw) {
|
|
@@ -1584,7 +1645,8 @@ async function handleRpcMethod(endpoint, payload) {
|
|
|
1584
1645
|
videoUrl: await videoUrl(),
|
|
1585
1646
|
fontUrl: await fontUrl(),
|
|
1586
1647
|
rotated,
|
|
1587
|
-
firstRun
|
|
1648
|
+
firstRun,
|
|
1649
|
+
host: await resolveHostInfo()
|
|
1588
1650
|
}
|
|
1589
1651
|
};
|
|
1590
1652
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-any-background",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Appearance plugin for DeepSeek Harness: custom theme color (PS-style color wheel), background wallpaper with opacity/blur controls, and separate main/settings interface opacity.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"author": "Tkingxiao",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"engines": {
|
|
26
|
-
"dsh": "
|
|
26
|
+
"dsh": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
@@ -67,12 +67,13 @@
|
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
70
|
-
"@deepseek-ai/dsh-client-locale": "
|
|
71
|
-
"@deepseek-ai/dsh-client-store": "
|
|
72
|
-
"@deepseek-ai/dsh-client-connection": "
|
|
73
|
-
"@deepseek-ai/dsh-client-ui-settings": "
|
|
74
|
-
"@deepseek-ai/dsh-client-ui-
|
|
75
|
-
"@deepseek-ai/dsh-
|
|
70
|
+
"@deepseek-ai/dsh-client-locale": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
71
|
+
"@deepseek-ai/dsh-client-store": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
72
|
+
"@deepseek-ai/dsh-client-connection": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
73
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
74
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-theme": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
76
|
+
"@deepseek-ai/dsh-invariants": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
76
77
|
"react": "^18.2.0",
|
|
77
78
|
"dsh-better-sidebar": ">=0.4.0"
|
|
78
79
|
},
|
|
@@ -80,6 +81,9 @@
|
|
|
80
81
|
"dsh-better-sidebar": {
|
|
81
82
|
"optional": true
|
|
82
83
|
},
|
|
84
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
83
87
|
"react": {
|
|
84
88
|
"optional": true
|
|
85
89
|
},
|
|
@@ -107,9 +111,13 @@
|
|
|
107
111
|
},
|
|
108
112
|
"dsh": {
|
|
109
113
|
"compatibility": {
|
|
110
|
-
"dsh": "0.1.5-rc.2",
|
|
114
|
+
"dsh": "0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1",
|
|
111
115
|
"dshReleases": {
|
|
112
|
-
"0.1.5-rc.2": "compatible"
|
|
116
|
+
"0.1.5-rc.2": "compatible",
|
|
117
|
+
"0.1.5-rc.3": "compatible",
|
|
118
|
+
"0.1.6-alpha.1": "compatible",
|
|
119
|
+
"0.1.6-alpha.2": "compatible",
|
|
120
|
+
"0.1.7-alpha.1": "compatible"
|
|
113
121
|
}
|
|
114
122
|
},
|
|
115
123
|
"bundle": {
|