dsh-theme-engine 26.12.5-161500 → 26.12.5-162000
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/bin/lg-capture.exe +0 -0
- package/client/client.js +25 -4
- package/client/src/03-settings.js +8 -2
- package/client/src/12-apply.js +16 -1
- package/host/audio.js +9 -3
- package/host/helper.js +18 -0
- package/index.js +57 -3
- package/package.json +1 -1
- package/scripts/build-capture.mjs +16 -1
- package/tools/capture/lg-capture.cpp +23 -2
package/bin/lg-capture.exe
CHANGED
|
Binary file
|
package/client/client.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
const LEGACY_STORAGE_KEYS = ["dsh-liquid-glass.settings.v2"];
|
|
10
10
|
const API = "/liquid-glass";
|
|
11
11
|
/** Bumped whenever the mapping or the settings contract changes; visible via /liquid-glass/state. */
|
|
12
|
-
const CLIENT_BUILD = "v.26.12.05.
|
|
12
|
+
const CLIENT_BUILD = "v.26.12.05.161542";
|
|
13
13
|
const LOAD_TAG = String((globalThis.__lgLoadCount = (globalThis.__lgLoadCount || 0) + 1));
|
|
14
14
|
/**
|
|
15
15
|
* Appearance values are archived per colour mode. These ids and keys are
|
|
@@ -922,8 +922,14 @@
|
|
|
922
922
|
try {
|
|
923
923
|
// Only repair a profile that already had this plugin installed: a fresh
|
|
924
924
|
// install must start from DEFAULT_SETTINGS, not from someone else's taste.
|
|
925
|
-
|
|
926
|
-
|
|
925
|
+
// Only a profile that predates v3 may be repaired. Counting the live
|
|
926
|
+
// v3 key as "had this plugin installed" rewrote a user's current
|
|
927
|
+
// settings with RECOVERED_SETTINGS whenever the marker was missing
|
|
928
|
+
// (a fresh checkout of the marker, a cleaned profile), which is a
|
|
929
|
+
// silent data loss rather than a repair.
|
|
930
|
+
const hadLegacy = LEGACY_STORAGE_KEYS.some((key) => localStorage.getItem(key) !== null);
|
|
931
|
+
const hasCurrent = localStorage.getItem(STORAGE_KEY) !== null;
|
|
932
|
+
if (hadLegacy && !hasCurrent && !localStorage.getItem(RECOVERY_KEY)) {
|
|
927
933
|
const restored = normalize(RECOVERED_SETTINGS);
|
|
928
934
|
persistSettings(restored);
|
|
929
935
|
localStorage.setItem(LEGACY_STORAGE_KEYS[0], JSON.stringify(restored));
|
|
@@ -6621,9 +6627,24 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
|
|
|
6621
6627
|
const sample = inkRef.current;
|
|
6622
6628
|
// The tokens actually applied, so readability problems can be
|
|
6623
6629
|
// diagnosed from the host log instead of a DevTools session.
|
|
6630
|
+
// Only the guard state, never the counters: `frames` grows on
|
|
6631
|
+
// every frame, so including it made the signature change once a
|
|
6632
|
+
// second and turned this into a permanent HTTP log stream.
|
|
6633
|
+
const stable = stats
|
|
6634
|
+
? {
|
|
6635
|
+
mode: stats.mode,
|
|
6636
|
+
scale: stats.scale,
|
|
6637
|
+
fps: stats.fps,
|
|
6638
|
+
paused: stats.paused,
|
|
6639
|
+
focus: stats.focus,
|
|
6640
|
+
vis: stats.vis,
|
|
6641
|
+
vp: stats.vp,
|
|
6642
|
+
dpr: stats.dpr
|
|
6643
|
+
}
|
|
6644
|
+
: null;
|
|
6624
6645
|
const signature = JSON.stringify({
|
|
6625
6646
|
degrade,
|
|
6626
|
-
stats,
|
|
6647
|
+
stats: stable,
|
|
6627
6648
|
build: CLIENT_BUILD,
|
|
6628
6649
|
ink: sample ? { c: sample.content, b: sample.busy } : null,
|
|
6629
6650
|
label: getComputedStyle(document.body).getPropertyValue("--dsw-alias-label-primary").trim(),
|
|
@@ -205,8 +205,14 @@
|
|
|
205
205
|
try {
|
|
206
206
|
// Only repair a profile that already had this plugin installed: a fresh
|
|
207
207
|
// install must start from DEFAULT_SETTINGS, not from someone else's taste.
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
// Only a profile that predates v3 may be repaired. Counting the live
|
|
209
|
+
// v3 key as "had this plugin installed" rewrote a user's current
|
|
210
|
+
// settings with RECOVERED_SETTINGS whenever the marker was missing
|
|
211
|
+
// (a fresh checkout of the marker, a cleaned profile), which is a
|
|
212
|
+
// silent data loss rather than a repair.
|
|
213
|
+
const hadLegacy = LEGACY_STORAGE_KEYS.some((key) => localStorage.getItem(key) !== null);
|
|
214
|
+
const hasCurrent = localStorage.getItem(STORAGE_KEY) !== null;
|
|
215
|
+
if (hadLegacy && !hasCurrent && !localStorage.getItem(RECOVERY_KEY)) {
|
|
210
216
|
const restored = normalize(RECOVERED_SETTINGS);
|
|
211
217
|
persistSettings(restored);
|
|
212
218
|
localStorage.setItem(LEGACY_STORAGE_KEYS[0], JSON.stringify(restored));
|
package/client/src/12-apply.js
CHANGED
|
@@ -1236,9 +1236,24 @@
|
|
|
1236
1236
|
const sample = inkRef.current;
|
|
1237
1237
|
// The tokens actually applied, so readability problems can be
|
|
1238
1238
|
// diagnosed from the host log instead of a DevTools session.
|
|
1239
|
+
// Only the guard state, never the counters: `frames` grows on
|
|
1240
|
+
// every frame, so including it made the signature change once a
|
|
1241
|
+
// second and turned this into a permanent HTTP log stream.
|
|
1242
|
+
const stable = stats
|
|
1243
|
+
? {
|
|
1244
|
+
mode: stats.mode,
|
|
1245
|
+
scale: stats.scale,
|
|
1246
|
+
fps: stats.fps,
|
|
1247
|
+
paused: stats.paused,
|
|
1248
|
+
focus: stats.focus,
|
|
1249
|
+
vis: stats.vis,
|
|
1250
|
+
vp: stats.vp,
|
|
1251
|
+
dpr: stats.dpr
|
|
1252
|
+
}
|
|
1253
|
+
: null;
|
|
1239
1254
|
const signature = JSON.stringify({
|
|
1240
1255
|
degrade,
|
|
1241
|
-
stats,
|
|
1256
|
+
stats: stable,
|
|
1242
1257
|
build: CLIENT_BUILD,
|
|
1243
1258
|
ink: sample ? { c: sample.content, b: sample.busy } : null,
|
|
1244
1259
|
label: getComputedStyle(document.body).getPropertyValue("--dsw-alias-label-primary").trim(),
|
package/host/audio.js
CHANGED
|
@@ -157,6 +157,10 @@ export function startSpectrum() {
|
|
|
157
157
|
return spectrumStatus();
|
|
158
158
|
}
|
|
159
159
|
spectrum.error = null;
|
|
160
|
+
// Handlers close over this child, not the module variable: a stop/start pair
|
|
161
|
+
// leaves the old process's exit event pending, and clearing `spectrumChild`
|
|
162
|
+
// unconditionally there would orphan the new one.
|
|
163
|
+
const child = spectrumChild;
|
|
160
164
|
let pending = '';
|
|
161
165
|
spectrumChild.stdout.setEncoding('utf8');
|
|
162
166
|
spectrumChild.stdout.on('data', (chunk) => {
|
|
@@ -189,12 +193,14 @@ export function startSpectrum() {
|
|
|
189
193
|
// handler clear the child.
|
|
190
194
|
spectrumChild.stdout.on('error', () => {});
|
|
191
195
|
spectrumChild.stderr.on('error', () => {});
|
|
192
|
-
|
|
196
|
+
child.on('error', (error) => {
|
|
193
197
|
spectrum.error = 'child: ' + ((error && error.message) || error);
|
|
194
|
-
spectrumChild = null;
|
|
198
|
+
if (spectrumChild === child) spectrumChild = null;
|
|
195
199
|
});
|
|
196
|
-
|
|
200
|
+
child.on('exit', (code) => {
|
|
197
201
|
if (code) spectrum.error = 'exit ' + code + (spectrum.error ? ': ' + spectrum.error : '');
|
|
202
|
+
// A newer helper may already be running; only the current one may clear state.
|
|
203
|
+
if (spectrumChild !== child) return;
|
|
198
204
|
spectrum.bins = null;
|
|
199
205
|
spectrumChild = null;
|
|
200
206
|
});
|
package/host/helper.js
CHANGED
|
@@ -181,6 +181,24 @@ export async function startHelper() {
|
|
|
181
181
|
acceptStreamFrame(line);
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
184
|
+
// The engine reports a capture/encode streak instead of going quiet:
|
|
185
|
+
// silence would look like a still desktop and the page would keep the
|
|
186
|
+
// last frame forever. Drop to the on-demand path so the wallpaper at
|
|
187
|
+
// least keeps following the desktop, more slowly.
|
|
188
|
+
if (line.includes('"event":"error"')) {
|
|
189
|
+
let message = '';
|
|
190
|
+
try {
|
|
191
|
+
message = String(JSON.parse(line).msg || '');
|
|
192
|
+
} catch {
|
|
193
|
+
message = line.slice(0, 120);
|
|
194
|
+
}
|
|
195
|
+
captureStats.error = 'stream: ' + (message || 'engine reported an error').slice(0, 200);
|
|
196
|
+
captureStats.fallback = 'engine failed, on-demand capture resumed';
|
|
197
|
+
captureStats.streaming = false;
|
|
198
|
+
captureStats.live = false;
|
|
199
|
+
void helperCommand('stop\n', 3000).catch(() => {});
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
184
202
|
if (!helperPending) continue;
|
|
185
203
|
const pending = helperPending;
|
|
186
204
|
helperPending = null;
|
package/index.js
CHANGED
|
@@ -121,6 +121,28 @@ export function apply(ctx, config) {
|
|
|
121
121
|
/** @type {Promise<any> | null} */
|
|
122
122
|
let weInFlight = null;
|
|
123
123
|
|
|
124
|
+
// elysia395 detection stats several profile package.json files and folder
|
|
125
|
+
// listings, and /state asks for it ~4.5 times a second while a stream runs.
|
|
126
|
+
// Cache it like the wallpaper-engine scan so the poll stays cheap.
|
|
127
|
+
/** @type {{ at: number, value: any } | null} */
|
|
128
|
+
let elysiaCache = null;
|
|
129
|
+
/** @type {Promise<any> | null} */
|
|
130
|
+
let elysiaInFlight = null;
|
|
131
|
+
|
|
132
|
+
function elysiaStatus() {
|
|
133
|
+
if (elysiaCache && Date.now() - elysiaCache.at < 30_000) return Promise.resolve(elysiaCache.value);
|
|
134
|
+
if (!elysiaInFlight) {
|
|
135
|
+
elysiaInFlight = elysiaEngineStatus()
|
|
136
|
+
.catch(() => null)
|
|
137
|
+
.then((value) => {
|
|
138
|
+
elysiaCache = { at: Date.now(), value };
|
|
139
|
+
elysiaInFlight = null;
|
|
140
|
+
return value;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return elysiaInFlight;
|
|
144
|
+
}
|
|
145
|
+
|
|
124
146
|
function captureOnce(behind = true) {
|
|
125
147
|
if (!captureInFlight) {
|
|
126
148
|
captureBehind = behind;
|
|
@@ -193,11 +215,37 @@ export function apply(ctx, config) {
|
|
|
193
215
|
return captureOnce(behind);
|
|
194
216
|
}
|
|
195
217
|
|
|
218
|
+
/** Consecutive probes a "streaming" helper failed to answer. */
|
|
219
|
+
let streamMisses = 0;
|
|
220
|
+
|
|
196
221
|
/** Poll the cheap fingerprint so a window switch is picked up within ~1 s. */
|
|
197
222
|
function startDesktopWatch() {
|
|
198
223
|
if (desktopWatcher) return;
|
|
199
224
|
desktopWatcher = setInterval(() => {
|
|
200
225
|
if (captureInFlight) return;
|
|
226
|
+
if (captureStats.streaming && helperAlive()) {
|
|
227
|
+
// A stream whose engine died without exiting (a wedged capture thread,
|
|
228
|
+
// a device reset) answers nothing: probe is the cheapest liveness test
|
|
229
|
+
// that a still desktop cannot fake, because it always answers.
|
|
230
|
+
void probeViaHelper()
|
|
231
|
+
.catch(() => null)
|
|
232
|
+
.then((probe) => {
|
|
233
|
+
if (probe) {
|
|
234
|
+
streamMisses = 0;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
streamMisses += 1;
|
|
238
|
+
if (streamMisses < 3) return;
|
|
239
|
+
streamMisses = 0;
|
|
240
|
+
captureStats.error = 'stream stopped answering, falling back to on-demand capture';
|
|
241
|
+
captureStats.fallback = 'stream watchdog';
|
|
242
|
+
captureStats.streaming = false;
|
|
243
|
+
captureStats.live = false;
|
|
244
|
+
void stopStreaming().catch(() => {});
|
|
245
|
+
void captureIfChanged(captureBehind ?? true).catch(() => {});
|
|
246
|
+
});
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
201
249
|
void captureIfChanged(captureBehind ?? true).catch(() => {});
|
|
202
250
|
}, 1100);
|
|
203
251
|
desktopWatcher.unref?.();
|
|
@@ -455,7 +503,7 @@ export function apply(ctx, config) {
|
|
|
455
503
|
clientHardware: lastHardware,
|
|
456
504
|
bench: Number(options.bench) || 0,
|
|
457
505
|
clientBench: lastClientBench,
|
|
458
|
-
elysia: await
|
|
506
|
+
elysia: await elysiaStatus(),
|
|
459
507
|
});
|
|
460
508
|
} catch (error) {
|
|
461
509
|
return jsonResponse({ ok: false, error: String(error instanceof Error ? error.message : error) }, 500);
|
|
@@ -538,7 +586,7 @@ export function apply(ctx, config) {
|
|
|
538
586
|
bench: lastClientBench,
|
|
539
587
|
},
|
|
540
588
|
wallpaperEngine: engine,
|
|
541
|
-
elysia: await
|
|
589
|
+
elysia: await elysiaStatus().catch(() => null),
|
|
542
590
|
facts: hostFacts(),
|
|
543
591
|
config: options,
|
|
544
592
|
},
|
|
@@ -836,8 +884,14 @@ export function apply(ctx, config) {
|
|
|
836
884
|
if (desktopWatcher) clearInterval(desktopWatcher);
|
|
837
885
|
desktopWatcher = null;
|
|
838
886
|
for (const dispose of disposers) dispose();
|
|
839
|
-
// Never leave the resident
|
|
887
|
+
// Never leave the resident helpers (or their loops) behind — the spectrum
|
|
888
|
+
// one keeps recording system audio otherwise.
|
|
840
889
|
void stopStreaming().catch(() => {});
|
|
890
|
+
try {
|
|
891
|
+
stopSpectrum();
|
|
892
|
+
} catch {
|
|
893
|
+
// Unloading must not fail because a helper was already gone.
|
|
894
|
+
}
|
|
841
895
|
resetHelper('');
|
|
842
896
|
});
|
|
843
897
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-theme-engine",
|
|
3
|
-
"version": "26.12.5-
|
|
3
|
+
"version": "26.12.5-162000",
|
|
4
4
|
"description": "Live wallpaper + liquid-glass background for DeepSeek Harness: native desktop capture, 0.8-grade water shader, contrast-driven adaptive ink, frost-density and tint controls, hardware-adaptive profiles, occluded-window compositing, WebGL/WebGPU backends, five-layer performance guard.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -58,7 +58,22 @@ if (!compiler) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
mkdirSync(dirname(output), { recursive: true });
|
|
61
|
-
|
|
61
|
+
// The binary ships inside the npm package, so it has to stand on its own: a
|
|
62
|
+
// dynamic libstdc++/libgcc/libwinpthread silently breaks the fast capture path
|
|
63
|
+
// on any machine without MSYS2 on PATH (the host then falls back to the
|
|
64
|
+
// PowerShell compositor, which costs seconds per frame).
|
|
65
|
+
const args = [
|
|
66
|
+
'-std=c++20',
|
|
67
|
+
'-O2',
|
|
68
|
+
'-static',
|
|
69
|
+
'-static-libgcc',
|
|
70
|
+
'-static-libstdc++',
|
|
71
|
+
'-s',
|
|
72
|
+
'-o',
|
|
73
|
+
output,
|
|
74
|
+
source,
|
|
75
|
+
...linkLibraries,
|
|
76
|
+
];
|
|
62
77
|
console.log(`${compiler} ${args.join(' ')}`);
|
|
63
78
|
execFileSync(compiler, args, { stdio: 'inherit' });
|
|
64
79
|
const { size } = statSync(output);
|
|
@@ -891,6 +891,8 @@ struct Engine {
|
|
|
891
891
|
std::vector<uint8_t> hash;
|
|
892
892
|
uint64_t seq = 0;
|
|
893
893
|
int darkRun = 0;
|
|
894
|
+
int failRun = 0; // consecutive buildFrame() failures
|
|
895
|
+
int encodeFail = 0; // consecutive encodeFrame() failures
|
|
894
896
|
double lastLum = -1;
|
|
895
897
|
Composer::Frame frame; // reused: its pixel buffer is the 33 MB allocation
|
|
896
898
|
|
|
@@ -906,7 +908,17 @@ struct Engine {
|
|
|
906
908
|
next = now + interval;
|
|
907
909
|
std::lock_guard<std::mutex> lock(busy);
|
|
908
910
|
const ULONGLONG started = GetTickCount64();
|
|
909
|
-
if (composer->buildFrame(behind, frame)) {
|
|
911
|
+
if (!composer->buildFrame(behind, frame)) {
|
|
912
|
+
// A capture session can die while the process stays healthy (device
|
|
913
|
+
// reset, an RDP session taking the desktop, an old driver). Going
|
|
914
|
+
// quiet here reads as "still desktop" to the host, which would serve
|
|
915
|
+
// the last frame forever, so report the streak instead.
|
|
916
|
+
if (++failRun == 12) {
|
|
917
|
+
emit("{\"event\":\"error\",\"msg\":\"buildFrame failed 12 times\"}");
|
|
918
|
+
failRun = 1000;
|
|
919
|
+
}
|
|
920
|
+
} else {
|
|
921
|
+
failRun = 0;
|
|
910
922
|
// DWM sometimes hands back a desktop frame without the wallpaper
|
|
911
923
|
// layer: icons are there but everything around them is black. That
|
|
912
924
|
// frame has roughly 1/20th of the normal light, so hold the picture
|
|
@@ -928,10 +940,14 @@ struct Engine {
|
|
|
928
940
|
}
|
|
929
941
|
}
|
|
930
942
|
if (force || sig != hash) {
|
|
931
|
-
hash = std::move(sig);
|
|
932
943
|
const int elapsed = (int)(GetTickCount64() - started);
|
|
933
944
|
std::string written = composer->encodeFrame(frame, path, elapsed);
|
|
934
945
|
if (written.find("\"ok\":true") != std::string::npos) {
|
|
946
|
+
// Remember the fingerprint only once the frame is on disk: a
|
|
947
|
+
// failed encode used to advance it anyway, which made every later
|
|
948
|
+
// identical frame skip the write and freeze the stream for good.
|
|
949
|
+
hash = std::move(sig);
|
|
950
|
+
encodeFail = 0;
|
|
935
951
|
seq++;
|
|
936
952
|
lastLum = frame.lum;
|
|
937
953
|
std::string event = "{\"event\":\"frame\",\"seq\":" + std::to_string(seq);
|
|
@@ -943,6 +959,11 @@ struct Engine {
|
|
|
943
959
|
event += ",\"w\":" + std::to_string(frame.w) + ",\"h\":" + std::to_string(frame.h);
|
|
944
960
|
event += ",\"ms\":" + std::to_string(elapsed) + "}";
|
|
945
961
|
emit(event);
|
|
962
|
+
} else if (++encodeFail == 5) {
|
|
963
|
+
// Disk full, a locked file, a torn staging path: the host has to
|
|
964
|
+
// hear about it or it will keep the old picture indefinitely.
|
|
965
|
+
emit("{\"event\":\"error\",\"msg\":\"encode failed 5 times\"}");
|
|
966
|
+
encodeFail = 1000;
|
|
946
967
|
}
|
|
947
968
|
}
|
|
948
969
|
}
|