dsh-snowbreak-heimdall 3.0.4 → 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 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.4`,profile `desktop` 已启用。
10
+ - 插件:`dsh-snowbreak-heimdall@3.0.6`,profile `desktop` 已启用。
11
11
  - 当前运行:`142164e9…9555`
12
12
  - `reapply=false`,这一版已经应用完成;**不需要再退出或重写 asar**。
13
- - **DSH 右下角提示**:安装后客户端刷新/下次启动时检测源码层状态;未接入时显示「需要完全退出 DSH」的小窗提醒,可手动关闭。
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.4`;安装后启用插件。
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
@@ -42,14 +42,14 @@ aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\
42
42
  2a0b4b9c68d5f4b87bb8fbb768a1933c40394fe4e6f23c144fae88052ebe4a02 *cordis.patch.yml
43
43
  065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *icon.svg
44
44
  7370fd8aafe94e11442f61b8f4c2f272ef8f817adf217ee1f460516bec1f4067 *lib\client.js
45
- f2ac5f0991bcf6717a15b9ffd9b34cf1441c1b51bda72dfe8c1d3a47565f61f0 *lib\index.js
45
+ bacd3564b098bbd3ae49f73a99fdd958ef7813b8c240c7339fecd475d73f4755 *lib\index.js
46
46
  0794a24c333ef529e56c6eb7b1dee62f4f5b8da1c56fe001885824ce2a3f8b2f *LICENSE
47
47
  de949631618eb48bf5cd6c06698a28214c8e9cb4bca23d298cd89462f4fb260e *locale\en.json
48
48
  e931cfb8c9b64aa4e01363e603537afee392e8309fe07daaff3e07e028ab8010 *locale\zh.json
49
- 22b04215670159d1a980f082f8c4ef78bb1d840de0750460fa941bfcc6b042f4 *package.json
49
+ e2b3a39819f86948d2fc277ef46382f591432bfec2d3a92482290a111ceae259 *package.json
50
50
  8fa6aff9fa2ab7eb11cc813c7ed9cda2b9ae7757c039aad8d71d5b56b5b683d9 *patch\asar.py
51
- 771e160fc006714e373735a635638d33644eb686e0c7b41478262c136ad70710 *patch\patcher.py
52
- 20efbde7c2a613729fc179abdec91c4f5e8b6e5b87e6b82001620bf6855a3c5d *README.md
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/index.js CHANGED
@@ -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.0.4';
20
+ const VERSION = '3.0.6';
21
21
  const INSTALL = path.join(process.env.LOCALAPPDATA || '', 'Programs', 'DeepSeek Harness');
22
22
  const DEFAULT_RESOURCES = process.env.HEIMDALL_RESOURCES
23
23
  || (typeof process.resourcesPath === 'string' && /[\\/]resources$/i.test(process.resourcesPath)
@@ -176,7 +176,7 @@ function writeRecovery(pythonw) {
176
176
  }
177
177
  }
178
178
 
179
- function arm() {
179
+ function arm(autoRestart = false) {
180
180
  try {
181
181
  const pythonw = stageRuntime();
182
182
  if (!pythonw) throw new Error('python runtime not found');
@@ -190,13 +190,15 @@ function arm() {
190
190
  '--state-dir', vbsQuote(STATE_DIR),
191
191
  '--profile-dir', vbsQuote(PROFILE_DIR),
192
192
  '--wait-pid', String(process.pid),
193
- ].join(' ');
193
+ ];
194
+ if (autoRestart) command.push('--auto-restart');
195
+ const joined = command.join(' ');
194
196
  const syncVbs = path.join(STATE_DIR, 'sync.vbs');
195
197
  fs.writeFileSync(syncVbs, [
196
198
  'Option Explicit',
197
199
  'Dim sh',
198
200
  'Set sh = CreateObject("WScript.Shell")',
199
- 'sh.Run ' + vbsQuote(command) + ', 0, False',
201
+ 'sh.Run ' + vbsQuote(joined) + ', 0, False',
200
202
  '',
201
203
  ].join('\r\n'), 'utf8');
202
204
 
@@ -327,12 +329,98 @@ function showInjectedRestartNotice() {
327
329
  }
328
330
  }
329
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
+
330
408
  export function apply(ctx) {
331
409
  try {
332
410
  fs.mkdirSync(STATE_DIR, { recursive: true });
333
411
  writeState({ desired: 'on', pluginVersion: VERSION });
334
- showInjectedRestartNotice();
335
- arm();
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
+ }
336
424
  if (ctx && typeof ctx.effect === 'function') {
337
425
  ctx.effect(() => () => {
338
426
  log('plugin disposing; helper will reconcile from profile state');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-snowbreak-heimdall",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "《尘白禁区》海姆达尔终端 / 世界树公司源码级皮肤:加载画面、双主题、菜单/侧栏/图标,插件仅在加载后播放启动动画。Windows / DSH 0.2.2-rc.1。",
5
5
  "type": "module",
6
6
  "license": "MIT",
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