dsh-snowbreak-heimdall 3.3.8 → 3.5.2
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/lib/index.js +34 -5
- package/package.json +3 -3
- package/patch/__pycache__/asar.cpython-314.pyc +0 -0
- package/patch/patcher.py +11 -25
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
2
|
* Snowbreak: Heimdall Terminal — source-layer companion.
|
|
3
3
|
*
|
|
4
4
|
* The plugin does NOT paint the loading screen and does NOT own the palette.
|
|
@@ -17,7 +17,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
17
17
|
const requireFromHere = createRequire(import.meta.url);
|
|
18
18
|
|
|
19
19
|
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
20
|
-
const VERSION = '3.
|
|
20
|
+
const VERSION = '3.5.2';
|
|
21
21
|
let restartPrompted = false;
|
|
22
22
|
const INSTALL = path.join(process.env.LOCALAPPDATA || '', 'Programs', 'DeepSeek Harness');
|
|
23
23
|
const DEFAULT_RESOURCES = process.env.HEIMDALL_RESOURCES
|
|
@@ -366,7 +366,7 @@ function writeRestartScript() {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
function askRestartConfirmation(restartScript) {
|
|
369
|
+
function askRestartConfirmation(restartScript, mode = 'apply') {
|
|
370
370
|
if (!restartScript) return;
|
|
371
371
|
try {
|
|
372
372
|
const templatePath = path.join(ROOT, 'assets', 'source', 'restart-confirm.ps1');
|
|
@@ -377,6 +377,15 @@ function askRestartConfirmation(restartScript) {
|
|
|
377
377
|
script = script.replace('__MARK__', mark);
|
|
378
378
|
const logo = path.join(ROOT, 'assets', 'source', 'hm-mark-light.png').replace(/\\/g, '/');
|
|
379
379
|
script = script.replace('__LOGO__', logo);
|
|
380
|
+
if (mode === 'disable') {
|
|
381
|
+
script = script
|
|
382
|
+
.replace('RESTART REQUIRED // 需要重启', 'DISABLE PENDING // 等待重启')
|
|
383
|
+
.replace('安装完成,需要重启', '皮肤已关闭,重启后还原')
|
|
384
|
+
.replace('源码层尚未接入 · 完全退出 DSH 后写入', '原始档案将在 DSH 完全退出后写回')
|
|
385
|
+
.replace('点击「现在重启」后关闭 DSH,应用源码层并自动重新启动',
|
|
386
|
+
'点击「立即重启」退出并还原;也可以稍后自己重启')
|
|
387
|
+
.replace('现在重启', '立即重启');
|
|
388
|
+
}
|
|
380
389
|
const confirmPath = path.join(STATE_DIR, 'restart-confirm.ps1');
|
|
381
390
|
fs.writeFileSync(confirmPath, '\ufeff' + script, 'utf8');
|
|
382
391
|
|
|
@@ -422,9 +431,29 @@ export function apply(ctx) {
|
|
|
422
431
|
arm(false);
|
|
423
432
|
}
|
|
424
433
|
if (ctx && typeof ctx.effect === 'function') {
|
|
434
|
+
const loadedAt = Date.now();
|
|
425
435
|
ctx.effect(() => () => {
|
|
426
|
-
|
|
427
|
-
|
|
436
|
+
try {
|
|
437
|
+
const live = (() => {
|
|
438
|
+
try {
|
|
439
|
+
const gw = ctx.get('typertGateway');
|
|
440
|
+
return gw && typeof gw.hasLiveClient === 'function' ? gw.hasLiveClient() : false;
|
|
441
|
+
} catch (_) { return false; }
|
|
442
|
+
})();
|
|
443
|
+
const st = readState();
|
|
444
|
+
const applied = st.status === 'patched';
|
|
445
|
+
writeState({ desired: 'off', pluginVersion: VERSION });
|
|
446
|
+
log('plugin disposing; applied=' + applied + ' live=' + live
|
|
447
|
+
+ ' after=' + Math.round((Date.now() - loadedAt) / 1000) + 's');
|
|
448
|
+
arm(false);
|
|
449
|
+
// Only surface the prompt when the app keeps running (a disable),
|
|
450
|
+
// not when this disposer runs during shutdown.
|
|
451
|
+
if (applied && live && Date.now() - loadedAt > 3000) {
|
|
452
|
+
askRestartConfirmation(writeRestartScript(), 'disable');
|
|
453
|
+
}
|
|
454
|
+
} catch (error) {
|
|
455
|
+
log('dispose failed: ' + error.message);
|
|
456
|
+
}
|
|
428
457
|
}, 'snowbreak-heimdall: source reconciliation');
|
|
429
458
|
}
|
|
430
459
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-snowbreak-heimdall",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "《尘白禁区》海姆达尔终端 / 世界树公司源码级皮肤:加载画面、双主题、菜单/侧栏/图标,插件仅在加载后播放启动动画。Windows / DSH 0.2.2-rc.
|
|
3
|
+
"version": "3.5.2",
|
|
4
|
+
"description": "《尘白禁区》海姆达尔终端 / 世界树公司源码级皮肤:加载画面、双主题、菜单/侧栏/图标,插件仅在加载后播放启动动画。Windows / DSH 0.2.2-rc.x。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
|
-
"dsh": "0.2.2-rc.1"
|
|
8
|
+
"dsh": ">=0.2.2-rc.1 <0.3.0-0"
|
|
9
9
|
},
|
|
10
10
|
"os": [
|
|
11
11
|
"win32"
|
|
Binary file
|
package/patch/patcher.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
"""Snowbreak / Heimdall Terminal source-layer installer for DSH 0.2.2-rc.
|
|
2
|
+
"""Snowbreak / Heimdall Terminal source-layer installer for DSH 0.2.2-rc.x.
|
|
3
3
|
|
|
4
4
|
This is intentionally narrow: it patches the installed DSH resources, keeps a
|
|
5
5
|
verified backup inside the DSH installation, and restores only when the current
|
|
@@ -1241,31 +1241,17 @@ def sync(target, skip_wait=False, wait_pid=0):
|
|
|
1241
1241
|
if not skip_wait:
|
|
1242
1242
|
log("waiting for DSH host pid %s" % (wait_pid or "unknown"))
|
|
1243
1243
|
waited = wait_for_pid(wait_pid)
|
|
1244
|
-
if waited:
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
absent = 0
|
|
1250
|
-
else:
|
|
1251
|
-
absent += 1
|
|
1252
|
-
if absent >= 2:
|
|
1253
|
-
break
|
|
1244
|
+
if not waited:
|
|
1245
|
+
# Unknown host pid: fall back to a bounded wait, never unbounded.
|
|
1246
|
+
log("host pid unknown; waiting for DSH to disappear (bounded)")
|
|
1247
|
+
deadline = time.time() + 300
|
|
1248
|
+
while dsh_running() and time.time() < deadline:
|
|
1254
1249
|
time.sleep(2)
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
absent = 0
|
|
1261
|
-
else:
|
|
1262
|
-
absent += 1
|
|
1263
|
-
if absent >= 2:
|
|
1264
|
-
break
|
|
1265
|
-
time.sleep(2)
|
|
1266
|
-
else:
|
|
1267
|
-
log("wait timed out")
|
|
1268
|
-
return 1
|
|
1250
|
+
# Do not require an empty DSH process list here. The restart script
|
|
1251
|
+
# relaunches as soon as the layer is written, so insisting on "no DSH
|
|
1252
|
+
# running" can hold sync.lock forever and trap the user in a restart
|
|
1253
|
+
# loop. wait_unlocked() below already retries a busy archive.
|
|
1254
|
+
time.sleep(1.5)
|
|
1269
1255
|
if not wait_unlocked(target, 180):
|
|
1270
1256
|
log("archive stayed locked")
|
|
1271
1257
|
return 3
|