dsh-snowbreak-heimdall 3.0.3 → 3.0.6
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 +6 -4
- package/SHA256SUMS.txt +5 -5
- package/lib/client.js +19 -24
- package/lib/index.js +160 -6
- package/package.json +1 -1
- package/patch/__pycache__/patcher.cpython-314.pyc +0 -0
- package/patch/patcher.py +10 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# 雪境 Heimdall Terminal
|
|
1
|
+
# 雪境 Heimdall Terminal
|
|
2
2
|
|
|
3
3
|
> 《尘白禁区》风格的 DeepSeek Harness **源码层皮肤**。
|
|
4
4
|
> 加载画面、主题、菜单、品牌、图标、欢迎页/更新页与主界面文案由 `app.asar` 和安装目录负责;插件只保留启动动画。
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
## 当前状态
|
|
9
9
|
|
|
10
|
-
- 插件:`dsh-snowbreak-heimdall@3.0.
|
|
10
|
+
- 插件:`dsh-snowbreak-heimdall@3.0.6`,profile `desktop` 已启用。
|
|
11
11
|
- 当前运行:`142164e9…9555`
|
|
12
12
|
- `reapply=false`,这一版已经应用完成;**不需要再退出或重写 asar**。
|
|
13
|
-
-
|
|
13
|
+
- **安装/启用后先确认再重启**:Host 检测到源码层未接入时弹「现在重启 DSH?」,选「是」才关闭当前 DSH、等待 helper 写入源码层,再自动启动 DSH;选「否」不重启。重启过程不弹进度窗。
|
|
14
14
|
- `探索未至之境` → `接入零区`
|
|
15
15
|
- DSH 鲸鱼图标 → 世界树 mark
|
|
16
16
|
- `预览版` → `战术预览`
|
|
@@ -100,7 +100,7 @@ DSH 完全退出后,helper 启动 **PowerShell WPF WS_POPUP**:
|
|
|
100
100
|
不是“复制文件夹后双击即用”。对方需要:
|
|
101
101
|
|
|
102
102
|
1. 同版本 DSH `0.2.2-rc.1`(补丁锚点按该版本校验,其他版本会拒绝写入)。
|
|
103
|
-
2. 在 DSH 插件管理器/安装指令中安装 npm 包 `dsh-snowbreak-heimdall@3.0.
|
|
103
|
+
2. 在 DSH 插件管理器/安装指令中安装 npm 包 `dsh-snowbreak-heimdall@3.0.6`;安装后启用插件。
|
|
104
104
|
也可以手动把包安装到 profile 后加入 `dsh.profile.bundles`。
|
|
105
105
|
3. 启用插件,然后完整退出 DSH;helper 才会写入源码层。
|
|
106
106
|
4. Windows 用户;DSH 安装目录可写(默认 `%LOCALAPPDATA%\Programs\DeepSeek Harness`,自定义路径可设 `HEIMDALL_TARGET` / `HEIMDALL_RESOURCES`)。
|
|
@@ -179,3 +179,5 @@ snowbreak-heimdall/
|
|
|
179
179
|
|
|
180
180
|
|
|
181
181
|
|
|
182
|
+
|
|
183
|
+
|
package/SHA256SUMS.txt
CHANGED
|
@@ -41,15 +41,15 @@ aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\
|
|
|
41
41
|
1591f7b426d79f71440d4d9c93518de14c88d5b69610beea03a2ecac5c3ac958 *assets\source\welcome-mark-light.png
|
|
42
42
|
2a0b4b9c68d5f4b87bb8fbb768a1933c40394fe4e6f23c144fae88052ebe4a02 *cordis.patch.yml
|
|
43
43
|
065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *icon.svg
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
7370fd8aafe94e11442f61b8f4c2f272ef8f817adf217ee1f460516bec1f4067 *lib\client.js
|
|
45
|
+
bacd3564b098bbd3ae49f73a99fdd958ef7813b8c240c7339fecd475d73f4755 *lib\index.js
|
|
46
46
|
0794a24c333ef529e56c6eb7b1dee62f4f5b8da1c56fe001885824ce2a3f8b2f *LICENSE
|
|
47
47
|
de949631618eb48bf5cd6c06698a28214c8e9cb4bca23d298cd89462f4fb260e *locale\en.json
|
|
48
48
|
e931cfb8c9b64aa4e01363e603537afee392e8309fe07daaff3e07e028ab8010 *locale\zh.json
|
|
49
|
-
|
|
49
|
+
e2b3a39819f86948d2fc277ef46382f591432bfec2d3a92482290a111ceae259 *package.json
|
|
50
50
|
8fa6aff9fa2ab7eb11cc813c7ed9cda2b9ae7757c039aad8d71d5b56b5b683d9 *patch\asar.py
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
c9400731101b46a609b9318b8da85e2dfb00ceaa2d65c7e69f7d513c549b0e3c *patch\patcher.py
|
|
52
|
+
133d4811a854085f2e919319962154741041754e2d9d90ff615e3318b0543401 *README.md
|
|
53
53
|
8978acd5618d9148ca20804d823af6decb0b20af4569b39e8a641f559277db0c *TEST-REPORT.md
|
|
54
54
|
73ac5fa42ee7de25615deb7315de7e2609f76b52e636b6a03397c7203bf17bc2 *tools\build_assets.py
|
|
55
55
|
a8c0badcd2e0cac12cf03528a892c51ec1e6cbde0352ebfb5d5243cbe1f59f8e *tools\build_client.py
|
package/lib/client.js
CHANGED
|
@@ -83,50 +83,45 @@ window.__ModuleLoader__.load({
|
|
|
83
83
|
animation: hm-startup-scan 3.2s linear infinite;
|
|
84
84
|
}
|
|
85
85
|
#hm-pending {
|
|
86
|
-
position: fixed;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
color: #E6EEF5;
|
|
86
|
+
position: fixed; right: 20px; bottom: 20px; z-index: 2147483003;
|
|
87
|
+
width: min(440px, calc(100vw - 40px)); pointer-events: auto;
|
|
88
|
+
border: 1px solid #2C3A46; border-radius: 2px; background: #0B1118;
|
|
89
|
+
color: #E6EEF5; box-shadow: 0 0 0 1px rgba(0,0,0,.24), 0 18px 50px rgba(0,0,0,.45);
|
|
91
90
|
font-family: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
|
|
92
91
|
}
|
|
93
|
-
#hm-pending .hm-p-card {
|
|
94
|
-
width: min(560px, calc(100vw - 48px)); border: 1px solid #2C3A46;
|
|
95
|
-
border-radius: 2px; background: #0B1118;
|
|
96
|
-
box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 24px 80px rgba(0,0,0,.55);
|
|
97
|
-
}
|
|
92
|
+
#hm-pending .hm-p-card { width: 100%; border: 0; background: transparent; box-shadow: none; }
|
|
98
93
|
#hm-pending .hm-p-head {
|
|
99
94
|
display: flex; align-items: center; justify-content: space-between;
|
|
100
|
-
height:
|
|
95
|
+
height: 30px; padding: 0 12px; border-bottom: 1px solid #263440;
|
|
101
96
|
font-family: "Bahnschrift", "Segoe UI", sans-serif;
|
|
102
97
|
font-size: 8px; letter-spacing: .2em; color: #7E8E9E;
|
|
103
98
|
}
|
|
104
|
-
#hm-pending .hm-p-body { padding:
|
|
99
|
+
#hm-pending .hm-p-body { padding: 14px 16px 16px; }
|
|
105
100
|
#hm-pending .hm-p-kicker {
|
|
106
101
|
font-family: "Bahnschrift", "Segoe UI", sans-serif;
|
|
107
|
-
font-size:
|
|
102
|
+
font-size: 8px; letter-spacing: .22em; color: #7FB2D0; margin-bottom: 7px;
|
|
108
103
|
}
|
|
109
104
|
#hm-pending .hm-p-title {
|
|
110
|
-
margin: 0; font-size:
|
|
111
|
-
line-height: 1.
|
|
105
|
+
margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .02em;
|
|
106
|
+
line-height: 1.45; color: #E6EEF5;
|
|
112
107
|
}
|
|
113
108
|
#hm-pending .hm-p-text {
|
|
114
|
-
margin:
|
|
109
|
+
margin: 8px 0 0; font-size: 12px; line-height: 1.7; color: #AAB8C5;
|
|
115
110
|
}
|
|
116
111
|
#hm-pending .hm-p-env {
|
|
117
|
-
display: flex; flex-wrap: wrap; gap:
|
|
118
|
-
padding: 10px
|
|
119
|
-
font-size:
|
|
112
|
+
display: flex; flex-wrap: wrap; gap: 4px 7px; margin-top: 11px;
|
|
113
|
+
padding: 8px 10px; border: 1px solid #263440; background: #0F1720;
|
|
114
|
+
font-size: 10px; color: #7E8E9E;
|
|
120
115
|
}
|
|
121
116
|
#hm-pending .hm-p-env b { color: #D97745; font-weight: 500; }
|
|
122
117
|
#hm-pending .hm-p-actions {
|
|
123
|
-
display: flex; justify-content: flex-end; margin-top:
|
|
118
|
+
display: flex; justify-content: flex-end; margin-top: 12px;
|
|
124
119
|
}
|
|
125
120
|
#hm-pending button {
|
|
126
|
-
width: auto; height:
|
|
121
|
+
width: auto; height: 30px; padding: 0 14px; border: 1px solid #D97745;
|
|
127
122
|
background: #D97745; color: #0A0F14; cursor: pointer; border-radius: 1px;
|
|
128
123
|
font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
|
|
129
|
-
font-size:
|
|
124
|
+
font-size: 11px; font-weight: 600;
|
|
130
125
|
}
|
|
131
126
|
@keyframes hm-startup-sweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(260%); } }
|
|
132
127
|
@keyframes hm-startup-scan { 0% { top: 12%; opacity: 0; } 12% { opacity: 1; } 88% { opacity: .7; } 100% { top: 76%; opacity: 0; } }
|
|
@@ -150,8 +145,8 @@ window.__ModuleLoader__.load({
|
|
|
150
145
|
#hm-startup .hm-start-kicker { color: #2F6A8E; }
|
|
151
146
|
#hm-startup .hm-start-meta, #hm-startup .hm-start-foot { color: #71808E; }
|
|
152
147
|
#hm-startup .hm-start-meta b { color: #A9481F; }
|
|
153
|
-
#hm-pending { border-color: #C8D3DD; background:
|
|
154
|
-
#hm-pending .hm-p-card { border-color:
|
|
148
|
+
#hm-pending { border-color: #C8D3DD; background: #F7F9FB; color: #101820; }
|
|
149
|
+
#hm-pending .hm-p-card { border-color: transparent; background: transparent; }
|
|
155
150
|
#hm-pending .hm-p-head { border-color: #D2DCE4; color: #71808E; }
|
|
156
151
|
#hm-pending .hm-p-kicker { color: #2F6A8E; }
|
|
157
152
|
#hm-pending .hm-p-title { color: #101820; }
|
package/lib/index.js
CHANGED
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
import fs from 'node:fs';
|
|
11
11
|
import os from 'node:os';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
+
import { createRequire } from 'node:module';
|
|
13
14
|
import { spawn } from 'node:child_process';
|
|
14
15
|
import { fileURLToPath } from 'node:url';
|
|
15
16
|
|
|
17
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
18
|
+
|
|
16
19
|
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
17
|
-
const VERSION = '3.0.
|
|
20
|
+
const VERSION = '3.0.6';
|
|
18
21
|
const INSTALL = path.join(process.env.LOCALAPPDATA || '', 'Programs', 'DeepSeek Harness');
|
|
19
22
|
const DEFAULT_RESOURCES = process.env.HEIMDALL_RESOURCES
|
|
20
23
|
|| (typeof process.resourcesPath === 'string' && /[\\/]resources$/i.test(process.resourcesPath)
|
|
@@ -173,7 +176,7 @@ function writeRecovery(pythonw) {
|
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
|
|
176
|
-
function arm() {
|
|
179
|
+
function arm(autoRestart = false) {
|
|
177
180
|
try {
|
|
178
181
|
const pythonw = stageRuntime();
|
|
179
182
|
if (!pythonw) throw new Error('python runtime not found');
|
|
@@ -187,13 +190,15 @@ function arm() {
|
|
|
187
190
|
'--state-dir', vbsQuote(STATE_DIR),
|
|
188
191
|
'--profile-dir', vbsQuote(PROFILE_DIR),
|
|
189
192
|
'--wait-pid', String(process.pid),
|
|
190
|
-
]
|
|
193
|
+
];
|
|
194
|
+
if (autoRestart) command.push('--auto-restart');
|
|
195
|
+
const joined = command.join(' ');
|
|
191
196
|
const syncVbs = path.join(STATE_DIR, 'sync.vbs');
|
|
192
197
|
fs.writeFileSync(syncVbs, [
|
|
193
198
|
'Option Explicit',
|
|
194
199
|
'Dim sh',
|
|
195
200
|
'Set sh = CreateObject("WScript.Shell")',
|
|
196
|
-
'sh.Run ' + vbsQuote(
|
|
201
|
+
'sh.Run ' + vbsQuote(joined) + ', 0, False',
|
|
197
202
|
'',
|
|
198
203
|
].join('\r\n'), 'utf8');
|
|
199
204
|
|
|
@@ -261,12 +266,161 @@ function showRestartPrompt() {
|
|
|
261
266
|
}
|
|
262
267
|
}
|
|
263
268
|
|
|
269
|
+
function injectedRestartNoticeScript() {
|
|
270
|
+
const platform = process.platform + ' ' + process.arch;
|
|
271
|
+
return `(() => {
|
|
272
|
+
if (document.getElementById('hm-restart-notice')) return;
|
|
273
|
+
const css = [
|
|
274
|
+
'#hm-restart-notice{position:fixed;right:20px;bottom:20px;z-index:2147483003;width:min(440px,calc(100vw - 40px));',
|
|
275
|
+
'border:1px solid #2C3A46;border-radius:2px;background:#0B1118;color:#E6EEF5;',
|
|
276
|
+
'box-shadow:0 0 0 1px rgba(0,0,0,.24),0 18px 50px rgba(0,0,0,.45);',
|
|
277
|
+
'font-family:"Noto Sans SC","Microsoft YaHei UI","Microsoft YaHei","Segoe UI",sans-serif;}',
|
|
278
|
+
'#hm-restart-notice .hm-r-head{display:flex;align-items:center;justify-content:space-between;height:30px;padding:0 12px;',
|
|
279
|
+
'border-bottom:1px solid #263440;font:8px "Bahnschrift","Segoe UI",sans-serif;letter-spacing:.2em;color:#7E8E9E;}',
|
|
280
|
+
'#hm-restart-notice .hm-r-body{padding:14px 16px 16px;}',
|
|
281
|
+
'#hm-restart-notice .hm-r-kicker{font:8px "Bahnschrift","Segoe UI",sans-serif;letter-spacing:.22em;color:#7FB2D0;margin-bottom:7px;}',
|
|
282
|
+
'#hm-restart-notice .hm-r-title{margin:0;font-size:17px;font-weight:600;line-height:1.45;color:#E6EEF5;}',
|
|
283
|
+
'#hm-restart-notice .hm-r-text{margin:8px 0 0;font-size:12px;line-height:1.7;color:#AAB8C5;}',
|
|
284
|
+
'#hm-restart-notice .hm-r-env{display:flex;flex-wrap:wrap;gap:4px 7px;margin-top:11px;padding:8px 10px;',
|
|
285
|
+
'border:1px solid #263440;background:#0F1720;font-size:10px;color:#7E8E9E;}',
|
|
286
|
+
'#hm-restart-notice .hm-r-env b{color:#D97745;font-weight:500;}',
|
|
287
|
+
'#hm-restart-notice .hm-r-actions{display:flex;justify-content:flex-end;margin-top:12px;}',
|
|
288
|
+
'#hm-restart-notice button{height:30px;padding:0 14px;border:1px solid #D97745;background:#D97745;color:#0A0F14;',
|
|
289
|
+
'cursor:pointer;border-radius:1px;font:600 11px "Microsoft YaHei UI","Segoe UI",sans-serif;}'
|
|
290
|
+
].join('');
|
|
291
|
+
const style = document.createElement('style');
|
|
292
|
+
style.textContent = css;
|
|
293
|
+
document.head.appendChild(style);
|
|
294
|
+
const el = document.createElement('section');
|
|
295
|
+
el.id = 'hm-restart-notice';
|
|
296
|
+
el.setAttribute('role', 'status');
|
|
297
|
+
el.innerHTML = '<div class="hm-r-head"><span>HEIMDALL // RESTART REQUIRED</span><span>SOURCE LAYER</span></div>'
|
|
298
|
+
+ '<div class="hm-r-body">'
|
|
299
|
+
+ '<div class="hm-r-kicker">环境检测:源码层尚未接入</div>'
|
|
300
|
+
+ '<h2 class="hm-r-title">安装完成,需要完全退出 DSH</h2>'
|
|
301
|
+
+ '<p class="hm-r-text">当前 DSH 仍在运行,皮肤还没有写入。请完全退出 DSH(托盘退出或退出程序,不是关闭窗口),下一次启动才会应用加载画面、主题、菜单和图标。</p>'
|
|
302
|
+
+ '<div class="hm-r-env"><span>平台:<b>${platform}</b></span><span>源码层:<b>未接入</b></span><span>操作:<b>完全退出 DSH</b></span></div>'
|
|
303
|
+
+ '<div class="hm-r-actions"><button type="button">我知道了</button></div>'
|
|
304
|
+
+ '</div>';
|
|
305
|
+
document.body.appendChild(el);
|
|
306
|
+
el.querySelector('button').addEventListener('click', () => el.remove());
|
|
307
|
+
})()`;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function showInjectedRestartNotice() {
|
|
311
|
+
try {
|
|
312
|
+
const state = readState();
|
|
313
|
+
if (state.status === 'patched') return;
|
|
314
|
+
const electron = requireFromHere('electron');
|
|
315
|
+
const windows = electron && electron.BrowserWindow ? electron.BrowserWindow.getAllWindows() : [];
|
|
316
|
+
if (!windows.length) {
|
|
317
|
+
log('no BrowserWindow for restart notice');
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const script = injectedRestartNoticeScript();
|
|
321
|
+
for (const win of windows) {
|
|
322
|
+
win.webContents.executeJavaScript(script, true).catch((error) => {
|
|
323
|
+
log('restart notice inject failed: ' + error.message);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
log('restart notice injected');
|
|
327
|
+
} catch (error) {
|
|
328
|
+
log('restart notice unavailable: ' + error.message);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function writeRestartScript() {
|
|
333
|
+
try {
|
|
334
|
+
const statePath = path.join(STATE_DIR, 'state.json');
|
|
335
|
+
const appExe = path.join(path.dirname(RESOURCES), 'DeepSeek Harness.exe');
|
|
336
|
+
const script = [
|
|
337
|
+
"$ErrorActionPreference = 'SilentlyContinue'",
|
|
338
|
+
'Start-Sleep -Seconds 3',
|
|
339
|
+
"$name = 'DeepSeek Harness'",
|
|
340
|
+
'$procs = Get-Process -Name $name',
|
|
341
|
+
'foreach ($p in $procs) { if ($p.MainWindowHandle -ne 0) { [void]$p.CloseMainWindow() } }',
|
|
342
|
+
'Start-Sleep -Seconds 6',
|
|
343
|
+
'$procs = Get-Process -Name $name',
|
|
344
|
+
'if ($procs) { $procs | Stop-Process -Force }',
|
|
345
|
+
'$deadline = (Get-Date).AddSeconds(180)',
|
|
346
|
+
'while ((Get-Date) -lt $deadline) {',
|
|
347
|
+
' Start-Sleep -Seconds 2',
|
|
348
|
+
' if (Test-Path -LiteralPath ' + psQuote(statePath) + ') {',
|
|
349
|
+
' try {',
|
|
350
|
+
' $s = Get-Content -LiteralPath ' + psQuote(statePath) + ' -Raw | ConvertFrom-Json',
|
|
351
|
+
" if ($s.status -eq 'patched') { break }",
|
|
352
|
+
' } catch {}',
|
|
353
|
+
' }',
|
|
354
|
+
'}',
|
|
355
|
+
'Start-Sleep -Seconds 2',
|
|
356
|
+
'if (-not (Get-Process -Name $name)) { Start-Process -FilePath ' + psQuote(appExe) + ' }',
|
|
357
|
+
'',
|
|
358
|
+
].join('\r\n');
|
|
359
|
+
const file = path.join(STATE_DIR, 'restart-dsh.ps1');
|
|
360
|
+
fs.writeFileSync(file, '\ufeff' + script, 'utf8');
|
|
361
|
+
return file;
|
|
362
|
+
} catch (error) {
|
|
363
|
+
log('auto restart script failed: ' + error.message);
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function askRestartConfirmation(restartScript) {
|
|
369
|
+
if (!restartScript) return;
|
|
370
|
+
try {
|
|
371
|
+
const text = [
|
|
372
|
+
'安装/启用完成。',
|
|
373
|
+
'',
|
|
374
|
+
'平台:' + process.platform + ' ' + process.arch,
|
|
375
|
+
'源码层:尚未接入',
|
|
376
|
+
'',
|
|
377
|
+
'需要重启 DSH 才能应用皮肤。现在重启吗?',
|
|
378
|
+
'重启会关闭当前窗口,写入完成后自动启动。',
|
|
379
|
+
].join('\r\n');
|
|
380
|
+
const lines = text.split('\r\n').map((line) => vbsQuote(line)).join(' & vbCrLf & ');
|
|
381
|
+
const command = 'powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "' + restartScript + '"';
|
|
382
|
+
const vbs = [
|
|
383
|
+
'Option Explicit',
|
|
384
|
+
'Dim shell, answer',
|
|
385
|
+
'Set shell = CreateObject("WScript.Shell")',
|
|
386
|
+
'answer = MsgBox ' + lines + ', 4132, "海姆达尔终端 // 需要重启"',
|
|
387
|
+
'If answer = 6 Then',
|
|
388
|
+
' shell.Run ' + vbsQuote(command) + ', 0, False',
|
|
389
|
+
'End If',
|
|
390
|
+
'',
|
|
391
|
+
].join('\r\n');
|
|
392
|
+
const file = path.join(STATE_DIR, 'restart-confirm.vbs');
|
|
393
|
+
fs.writeFileSync(file, '\ufeff' + vbs, 'utf16le');
|
|
394
|
+
const wscript = path.join(
|
|
395
|
+
process.env.SystemRoot || 'C:\\Windows',
|
|
396
|
+
'System32', 'wscript.exe',
|
|
397
|
+
);
|
|
398
|
+
const child = spawn(wscript, [file], {
|
|
399
|
+
detached: true, stdio: 'ignore', windowsHide: false,
|
|
400
|
+
});
|
|
401
|
+
child.unref();
|
|
402
|
+
log('restart confirmation shown');
|
|
403
|
+
} catch (error) {
|
|
404
|
+
log('restart confirmation failed: ' + error.message);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
264
408
|
export function apply(ctx) {
|
|
265
409
|
try {
|
|
266
410
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
267
411
|
writeState({ desired: 'on', pluginVersion: VERSION });
|
|
268
|
-
|
|
269
|
-
|
|
412
|
+
const state = readState();
|
|
413
|
+
const isPatched = state.status === 'patched';
|
|
414
|
+
const marker = path.join(STATE_DIR, 'restart-confirm.pid');
|
|
415
|
+
const alreadyAsked = fs.existsSync(marker)
|
|
416
|
+
&& fs.readFileSync(marker, 'utf8').trim() === String(process.pid);
|
|
417
|
+
if (!isPatched && !alreadyAsked) {
|
|
418
|
+
fs.writeFileSync(marker, String(process.pid), 'utf8');
|
|
419
|
+
arm(true);
|
|
420
|
+
askRestartConfirmation(writeRestartScript());
|
|
421
|
+
} else {
|
|
422
|
+
arm(false);
|
|
423
|
+
}
|
|
270
424
|
if (ctx && typeof ctx.effect === 'function') {
|
|
271
425
|
ctx.effect(() => () => {
|
|
272
426
|
log('plugin disposing; helper will reconcile from profile state');
|
package/package.json
CHANGED
|
Binary file
|
package/patch/patcher.py
CHANGED
|
@@ -46,6 +46,7 @@ PROFILE_DIR = ""
|
|
|
46
46
|
TEST_MODE = False
|
|
47
47
|
PROGRESS_STARTED = False
|
|
48
48
|
PROGRESS_MODE = "apply"
|
|
49
|
+
AUTO_RESTART = False
|
|
49
50
|
APP_EXE = ""
|
|
50
51
|
|
|
51
52
|
|
|
@@ -96,6 +97,10 @@ def schedule_state_cleanup(delay_seconds=8):
|
|
|
96
97
|
def launch_progress(mode="apply"):
|
|
97
98
|
"""Show a fixed, borderless WS_POPUP progress window after DSH has exited."""
|
|
98
99
|
global PROGRESS_STARTED, PROGRESS_MODE
|
|
100
|
+
if AUTO_RESTART:
|
|
101
|
+
log("auto restart: progress window suppressed")
|
|
102
|
+
PROGRESS_STARTED = True
|
|
103
|
+
return
|
|
99
104
|
if PROGRESS_STARTED:
|
|
100
105
|
return
|
|
101
106
|
PROGRESS_MODE = "restore" if mode == "restore" else "apply"
|
|
@@ -296,9 +301,10 @@ def now():
|
|
|
296
301
|
return time.strftime("%Y-%m-%dT%H:%M:%S%z")
|
|
297
302
|
|
|
298
303
|
|
|
299
|
-
def configure(target, state_dir=None, profile_dir=None, test_mode=False):
|
|
300
|
-
global STATE_DIR, LOG_FILE, BACKUP_ROOT, PROFILE_DIR, TEST_MODE, APP_EXE
|
|
304
|
+
def configure(target, state_dir=None, profile_dir=None, test_mode=False, auto_restart=False):
|
|
305
|
+
global STATE_DIR, LOG_FILE, BACKUP_ROOT, PROFILE_DIR, TEST_MODE, APP_EXE, AUTO_RESTART
|
|
301
306
|
TEST_MODE = bool(test_mode)
|
|
307
|
+
AUTO_RESTART = bool(auto_restart)
|
|
302
308
|
resources = os.path.dirname(os.path.abspath(target))
|
|
303
309
|
APP_EXE = os.path.join(os.path.dirname(resources), "DeepSeek Harness.exe")
|
|
304
310
|
STATE_DIR = os.path.abspath(state_dir or os.environ.get("HEIMDALL_STATE_DIR")
|
|
@@ -1308,8 +1314,9 @@ def main():
|
|
|
1308
1314
|
parser.add_argument("--dry-run", action="store_true")
|
|
1309
1315
|
parser.add_argument("--test-mode", action="store_true")
|
|
1310
1316
|
parser.add_argument("--wait-pid", type=int, default=0)
|
|
1317
|
+
parser.add_argument("--auto-restart", action="store_true")
|
|
1311
1318
|
args = parser.parse_args()
|
|
1312
|
-
configure(args.target, args.state_dir, args.profile_dir, args.test_mode)
|
|
1319
|
+
configure(args.target, args.state_dir, args.profile_dir, args.test_mode, args.auto_restart)
|
|
1313
1320
|
if args.mode == "check":
|
|
1314
1321
|
print(json.dumps(check_target(args.target), ensure_ascii=False))
|
|
1315
1322
|
return 0
|