dsh-snowbreak-heimdall 3.7.2 → 3.8.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 CHANGED
@@ -1,183 +1,185 @@
1
- # 雪境 Heimdall Terminal
2
-
3
- > 《尘白禁区》风格的 DeepSeek Harness **源码层皮肤**。
4
- > 加载画面、主题、菜单、品牌、图标、欢迎页/更新页与主界面文案由 `app.asar` 和安装目录负责;插件只保留启动动画。
5
-
6
- ---
7
-
8
- ## 当前状态
9
-
10
- - 插件:`dsh-snowbreak-heimdall@3.3.8`,profile `desktop` 已启用。
11
- - 当前运行:`142164e9…9555`
12
- - `reapply=false`,这一版已经应用完成;**不需要再退出或重写 asar**。
13
- - **安装/启用后先确认再重启**:Host 检测到源码层未接入时弹「现在重启 DSH?」,选「是」才关闭当前 DSH、等待 helper 写入源码层,再自动启动 DSH;选「否」不重启。重启过程不弹进度窗。
14
- - `探索未至之境` → `接入零区`
15
- - DSH 鲸鱼图标 → 世界树 mark
16
- - `预览版` → `战术预览`
17
- - `工作区` → `作业区`
18
- - `工作区内修改` → `作业区内修改`
19
- - 模式名保留「标准模式」四字(不改成「标准接入」)
20
- - `新会话 / 会话` → `建立接入 / 接入`
21
- - `DeepSeek-V4.1-Flash` → `世界树-V4.1-Flash`(仅显示名,模型 id 不变)
22
- - 当前 `app.asar` 已没有底部 HUD 遮挡;CLI 管理弹窗已经是「管理终端指令 / 终端指令已接入 / 校准 / 解除」。
23
-
24
- ---
25
-
26
- ## 两个阶段,严格分开
27
-
28
- | 阶段 | 负责方 | 时机 | 内容 |
29
- |---|---|---|---|
30
- | **加载画面 / boot** | 源码层 | 应用加载完成前 | `index.html` 静态终端接入页、`#root` 内核加载样式、45 秒 failsafe |
31
- | **启动动画 / startup** | 插件 | 应用加载完成后 | `shell.overlay` 约 2.5 秒「接入完成 / 分析员,欢迎回来」,不阻塞点击 |
32
-
33
- 插件没有加载画面;源码没有启动动画。
34
-
35
- ---
36
-
37
- ## 源码层覆盖
38
-
39
- - 启动加载页:`index.html` + 预置 `loading.css` / `loading.html`
40
- - 明暗主题、官方 CSS 变量、1px 线框、0–2px 圆角
41
- - 主界面 HUD:外框、角线、竖排呼号、世界树水印、网格、暗角、顶部情报带
42
- - 品牌:官方 brand 客户端模块、welcome mark、favicon、app/tray/exe 图标
43
- - 文案:原生菜单、关于、退出、未捕获错误、CLI 管理弹窗、hero、工作区/会话、模式、模型显示名
44
- - 欢迎页 / 更新 shell:`renderer/welcome.html`、更新 renderer、品牌 SVG
45
- - `app.asar` 内部 `lib/main.js`、`lib/preload-app.cjs`、`lib/preload-welcome.cjs`
46
- - profile 配置:`dsh.profile.bundles` 与插件开关
47
- - 主界面 hero 的 DSH 鲸鱼图标由源码级 `heimdall-shell.js` 替换为世界树 mark
48
-
49
- `locales/*.pak` 与 `app.asar.unpacked` 不做品牌文案替换;扫描确认不含 DSH 品牌。
50
-
51
- ---
52
-
53
- ## 进度窗(WS_POPUP)
54
-
55
- DSH 完全退出后,helper 启动 **PowerShell WPF WS_POPUP**:
56
-
57
- - `WS_POPUP`,去掉 `WS_CAPTION` / `WS_THICKFRAME`
58
- - 无标题栏、无边框、固定居中、不可拖动
59
- - 760×520 DIP,DPI-aware,Windows 缩放后保持清晰
60
- - 显示「等待 / 备份 / 重打包 / 校验 / 写入」
61
- - 100% 后显示「接入链路已闭合」和「启动终端 / LAUNCH DSH」
62
- - 按钮 `Start-Process` 拉起 DSH 并关闭窗口
63
- - 失败时显示错误和关闭按钮
64
- - **还原模式**:100% 后显示「官方源码层已恢复」,3 秒后自动关闭,并删除 `resources\HeimdallTerminal`(progress、runtime、备份、日志、锁)——窗口和临时文件一起清掉。
65
- - 插件包本身由 DSH 插件管理器的卸载流程移除;helper 只清理安装目录内的运行状态。
66
-
67
- 预览:
68
-
69
- - `assets/previews/progress-winforms.png`(84% 进行中)
70
- - `assets/previews/progress-winforms-complete.png`(100% 应用完成页)
71
- - `assets/previews/progress-winforms-restore.png`(还原完成,3 秒后自删)
72
-
73
- ---
74
-
75
- ## 安装 / 重应用
76
-
77
- 正常路径:
78
-
79
- 1. 插件启用,profile `desired=on`
80
- 2. 完全退出 DSH
81
- 3. helper 自动还原旧层、备份原版、重打包、替换图标
82
- 4. 进度窗 100% 后点「启动终端」
83
-
84
- 手动兜底(DSH 已退出):
85
-
86
- ```bat
87
- %LOCALAPPDATA%\Programs\DeepSeek Harness\resources\HeimdallTerminal\apply.vbs
88
- ```
89
-
90
- 还原:
91
-
92
- ```bat
93
- %LOCALAPPDATA%\Programs\DeepSeek Harness\resources\HeimdallTerminal\restore.vbs
94
- ```
95
-
96
- `sync.lock` 只允许一个 helper;死 PID 会清理。
97
-
98
- ## 分享到其他机器
99
-
100
- 不是“复制文件夹后双击即用”。对方需要:
101
-
102
- 1. 同版本 DSH `0.2.2-rc.1`(补丁锚点按该版本校验,其他版本会拒绝写入)。
103
- 2. 在 DSH 插件管理器/安装指令中安装 npm 包 `dsh-snowbreak-heimdall@3.3.8`;安装后启用插件。
104
- 也可以手动把包安装到 profile 后加入 `dsh.profile.bundles`。
105
- 3. 启用插件,然后完整退出 DSH;helper 才会写入源码层。
106
- 4. Windows 用户;DSH 安装目录可写(默认 `%LOCALAPPDATA%\Programs\DeepSeek Harness`,自定义路径可设 `HEIMDALL_TARGET` / `HEIMDALL_RESOURCES`)。
107
- 5. 需要 DSH 自带的 Python runtime(`%DSH_HOME%\dsh-runtimes\dsh-primary-runtime\dependencies\python`);插件会复制它,不依赖系统 Python。
108
- 6. 接受会改写 `app.asar` 和 `DeepSeek Harness.exe` 图标;EXE 的 Authenticode 会失效。
109
-
110
- 不要分享:
111
-
112
- - `resources\HeimdallTerminal`(含原版 `app.asar` 备份、日志、state、helper)
113
- - 已打补丁的 `app.asar`
114
- - 只有插件文件夹是干净的;源码、图标、vendored `rcedit` 都在其中。
115
-
116
- 雪境/尘白禁区名称与设定属于原作权利方;这是非商业同人皮肤,分享时请保留此说明。
117
-
118
- ---
119
-
120
- ## 安全与回滚
121
-
122
- - 首次应用前备份原始 `app.asar`、`icon.png`、`tray.ico`、`DeepSeek Harness.exe`
123
- - 每个 asar 条目保留/重建 SHA-256 integrity
124
- - 写入前校验备份哈希;0 字节写入拒绝
125
- - 失败自动回滚并保留 `heimdall.log`
126
- - DSH 更新检测:版本/原始哈希不匹配时拒绝写入,避免覆盖新版本
127
- - 替换 EXE 图标会使原 Authenticode 失效;这是预期代价
128
- - 只改 DSH 安装目录与 DSH profile,不改启动项、计划任务、注册表、系统目录或其他软件
129
-
130
- ---
131
-
132
- ## 文件结构
133
-
134
- ```text
135
- snowbreak-heimdall/
136
- package.json
137
- cordis.patch.yml
138
- lib/
139
- index.js # Host:stage runtime、arm helper、写 apply/restore.vbs
140
- client.js # Client:只注册启动动画
141
- patch/
142
- patcher.py # apply/restore/sync/check、锁、进度窗
143
- asar.py # 无依赖 ASAR 读写 + integrity
144
- assets/source/
145
- shell.js # 源码级 HUD、文案映射、hero mark、加载交接
146
- shell.css # 主题 token、HUD、暗角/网格/水印
147
- progress.ps1 # WS_POPUP 进度/完成窗
148
- brand-client.js # 官方 brand 客户端替换模板
149
- loading.css/html # 静态加载层
150
- hm-mark-*.png # 世界树 mark
151
- watermark-soft.png
152
- assets/previews/
153
- vendor/rcedit/
154
- README.md
155
- TEST-REPORT.md
156
- SHA256SUMS.txt
157
- ```
158
-
159
- ---
160
-
161
- ## 外部资源
162
-
163
- - `icon.png`:`7d0cac53…a853`
164
- - `tray.ico`:`7f8ab651…62a0`
165
- - `DeepSeek Harness.exe`:`aee2de36…b096`
166
- - EXE Authenticode:`NotSigned`
167
-
168
- ---
169
-
170
- ## 当前哈希
171
-
172
- - 原始:`5fa8a6b2…e637`
173
- - 当前运行:`142164e9…9555`
174
- - 状态:已应用,`reapply=false`
175
-
176
- 详细测试见 [TEST-REPORT.md](TEST-REPORT.md)。
177
-
178
-
179
-
180
-
181
-
182
-
183
-
1
+ # 雪境 Heimdall Terminal
2
+
3
+ > 《尘白禁区》风格的 DeepSeek Harness **源码层皮肤**。
4
+ > 加载画面、主题、菜单、品牌、图标、欢迎页/更新页与主界面文案由 `app.asar` 和安装目录负责;插件只保留启动动画。
5
+
6
+ ---
7
+
8
+ ## 当前状态
9
+
10
+ - 插件:`dsh-snowbreak-heimdall@3.3.8`,profile `desktop` 已启用。
11
+ - 当前运行:`142164e9…9555`
12
+ - `reapply=false`,这一版已经应用完成;**不需要再退出或重写 asar**。
13
+ - **安装/启用后先确认再重启**:Host 检测到源码层未接入时弹「现在重启 DSH?」,选「是」才关闭当前 DSH、等待 helper 写入源码层,再自动启动 DSH;选「否」不重启。重启过程不弹进度窗。
14
+ - `探索未至之境` → `接入零区`
15
+ - DSH 鲸鱼图标 → 世界树 mark
16
+ - `预览版` → `战术预览`
17
+ - `工作区` → `作业区`
18
+ - `工作区内修改` → `作业区内修改`
19
+ - 模式名保留「标准模式」四字(不改成「标准接入」)
20
+ - `新会话 / 会话` → `建立接入 / 接入`
21
+ - `DeepSeek-V4.1-Flash` → `世界树-V4.1-Flash`(仅显示名,模型 id 不变)
22
+ - 当前 `app.asar` 已没有底部 HUD 遮挡;CLI 管理弹窗已经是「管理终端指令 / 终端指令已接入 / 校准 / 解除」。
23
+
24
+ ---
25
+
26
+ ## 两个阶段,严格分开
27
+
28
+ | 阶段 | 负责方 | 时机 | 内容 |
29
+ |---|---|---|---|
30
+ | **加载画面 / boot** | 源码层 | 应用加载完成前 | `index.html` 静态终端接入页、`#root` 内核加载样式、45 秒 failsafe |
31
+ | **启动动画 / startup** | 插件 | 应用加载完成后 | `shell.overlay` 约 2.5 秒「接入完成 / 分析员,欢迎回来」,不阻塞点击 |
32
+
33
+ 插件没有加载画面;源码没有启动动画。
34
+
35
+ ---
36
+
37
+ ## 源码层覆盖
38
+
39
+ - 启动加载页:`index.html` + 预置 `loading.css` / `loading.html`
40
+ - 明暗主题、官方 CSS 变量、1px 线框、0–2px 圆角
41
+ - 主界面 HUD:外框、角线、竖排呼号、世界树水印、网格、暗角、顶部情报带
42
+ - 品牌:官方 brand 客户端模块、welcome mark、favicon、app/tray/exe 图标
43
+ - 文案:原生菜单、关于、退出、未捕获错误、CLI 管理弹窗、hero、工作区/会话、模式、模型显示名
44
+ - 欢迎页 / 更新 shell:`renderer/welcome.html`、更新 renderer、品牌 SVG
45
+ - `app.asar` 内部 `lib/main.js`、`lib/preload-app.cjs`、`lib/preload-welcome.cjs`
46
+ - profile 配置:`dsh.profile.bundles` 与插件开关
47
+ - 主界面 hero 的 DSH 鲸鱼图标由源码级 `heimdall-shell.js` 替换为世界树 mark
48
+
49
+ `locales/*.pak` 与 `app.asar.unpacked` 不做品牌文案替换;扫描确认不含 DSH 品牌。
50
+
51
+ ---
52
+
53
+ ## 进度窗(WS_POPUP)
54
+
55
+ DSH 完全退出后,helper 启动 **PowerShell WPF WS_POPUP**:
56
+
57
+ - `WS_POPUP`,去掉 `WS_CAPTION` / `WS_THICKFRAME`
58
+ - 无标题栏、无边框、固定居中、不可拖动
59
+ - 760×520 DIP,DPI-aware,Windows 缩放后保持清晰
60
+ - 显示「等待 / 备份 / 重打包 / 校验 / 写入」
61
+ - 100% 后显示「接入链路已闭合」和「启动终端 / LAUNCH DSH」
62
+ - 按钮 `Start-Process` 拉起 DSH 并关闭窗口
63
+ - 失败时显示错误和关闭按钮
64
+ - **还原模式**:100% 后显示「官方源码层已恢复」,3 秒后自动关闭,并删除 `resources\HeimdallTerminal`(progress、runtime、备份、日志、锁)——窗口和临时文件一起清掉。
65
+ - 插件包本身由 DSH 插件管理器的卸载流程移除;helper 只清理安装目录内的运行状态。
66
+
67
+ 预览:
68
+
69
+ - `assets/previews/progress-winforms.png`(84% 进行中)
70
+ - `assets/previews/progress-winforms-complete.png`(100% 应用完成页)
71
+ - `assets/previews/progress-winforms-restore.png`(还原完成,3 秒后自删)
72
+
73
+ ---
74
+
75
+ ## 安装 / 重应用
76
+
77
+ 正常路径:
78
+
79
+ 1. 插件启用,profile `desired=on`
80
+ 2. 完全退出 DSH
81
+ 3. helper 自动还原旧层、备份原版、重打包、替换图标
82
+ 4. 进度窗 100% 后点「启动终端」
83
+
84
+ 手动兜底(DSH 已退出):
85
+
86
+ ```bat
87
+ %LOCALAPPDATA%\Programs\DeepSeek Harness\resources\HeimdallTerminal\apply.vbs
88
+ ```
89
+
90
+ 还原:
91
+
92
+ ```bat
93
+ %LOCALAPPDATA%\Programs\DeepSeek Harness\resources\HeimdallTerminal\restore.vbs
94
+ ```
95
+
96
+ `sync.lock` 只允许一个 helper;死 PID 会清理。
97
+
98
+ ## 分享到其他机器
99
+
100
+ 不是“复制文件夹后双击即用”。对方需要:
101
+
102
+ 1. DSH `>=0.2.2-rc.1 <0.3.0`(`engines.dsh` 声明,DSH 自己校验)。补丁按
103
+ **锚点**写入而不是按版本号放行:`index.html` / 前端 `dist` 路径 / 品牌模块
104
+ 等锚点对不上就整次拒绝,原始 `app.asar` 不会被动过。实测版本:`0.2.2-rc.1`、`0.2.2-rc.5`。
105
+ 2. 在 DSH 插件管理器/安装指令中安装 npm 包 `dsh-snowbreak-heimdall`(取 `latest` 即可);安装后启用插件。
106
+ 也可以手动把包安装到 profile 后加入 `dsh.profile.bundles`。
107
+ 3. 启用插件,然后完整退出 DSH;helper 才会写入源码层。
108
+ 4. Windows 用户;DSH 安装目录可写(默认 `%LOCALAPPDATA%\Programs\DeepSeek Harness`,自定义路径可设 `HEIMDALL_TARGET` / `HEIMDALL_RESOURCES`)。
109
+ 5. 需要 DSH 自带的 Python runtime(`%DSH_HOME%\dsh-runtimes\dsh-primary-runtime\dependencies\python`);插件会复制它,不依赖系统 Python。
110
+ 6. 接受会改写 `app.asar` 和 `DeepSeek Harness.exe` 图标;EXE 的 Authenticode 会失效。
111
+
112
+ 不要分享:
113
+
114
+ - `resources\HeimdallTerminal`(含原版 `app.asar` 备份、日志、state、helper)
115
+ - 已打补丁的 `app.asar`
116
+ - 只有插件文件夹是干净的;源码、图标、vendored `rcedit` 都在其中。
117
+
118
+ 雪境/尘白禁区名称与设定属于原作权利方;这是非商业同人皮肤,分享时请保留此说明。
119
+
120
+ ---
121
+
122
+ ## 安全与回滚
123
+
124
+ - 首次应用前备份原始 `app.asar`、`icon.png`、`tray.ico`、`DeepSeek Harness.exe`
125
+ - 每个 asar 条目保留/重建 SHA-256 integrity
126
+ - 写入前校验备份哈希;0 字节写入拒绝
127
+ - 失败自动回滚并保留 `heimdall.log`
128
+ - DSH 更新检测:版本/原始哈希不匹配时拒绝写入,避免覆盖新版本
129
+ - 替换 EXE 图标会使原 Authenticode 失效;这是预期代价
130
+ - 只改 DSH 安装目录与 DSH profile,不改启动项、计划任务、注册表、系统目录或其他软件
131
+
132
+ ---
133
+
134
+ ## 文件结构
135
+
136
+ ```text
137
+ snowbreak-heimdall/
138
+ package.json
139
+ cordis.patch.yml
140
+ lib/
141
+ index.js # Host:stage runtime、arm helper、写 apply/restore.vbs
142
+ client.js # Client:只注册启动动画
143
+ patch/
144
+ patcher.py # apply/restore/sync/check、锁、进度窗
145
+ asar.py # 无依赖 ASAR 读写 + integrity
146
+ assets/source/
147
+ shell.js # 源码级 HUD、文案映射、hero mark、加载交接
148
+ shell.css # 主题 token、HUD、暗角/网格/水印
149
+ progress.ps1 # WS_POPUP 进度/完成窗
150
+ brand-client.js # 官方 brand 客户端替换模板
151
+ loading.css/html # 静态加载层
152
+ hm-mark-*.png # 世界树 mark
153
+ watermark-soft.png
154
+ assets/previews/
155
+ vendor/rcedit/
156
+ README.md
157
+ TEST-REPORT.md
158
+ SHA256SUMS.txt
159
+ ```
160
+
161
+ ---
162
+
163
+ ## 外部资源
164
+
165
+ - `icon.png`:`7d0cac53…a853`
166
+ - `tray.ico`:`7f8ab651…62a0`
167
+ - `DeepSeek Harness.exe`:`aee2de36…b096`
168
+ - EXE Authenticode:`NotSigned`
169
+
170
+ ---
171
+
172
+ ## 当前哈希
173
+
174
+ - 原始:`5fa8a6b2…e637`
175
+ - 当前运行:`142164e9…9555`
176
+ - 状态:已应用,`reapply=false`
177
+
178
+ 详细测试见 [TEST-REPORT.md](TEST-REPORT.md)。
179
+
180
+
181
+
182
+
183
+
184
+
185
+
@@ -18,12 +18,36 @@
18
18
  @keyframes hm-link-pulse{0%,100%{opacity:.35}50%{opacity:1}}
19
19
 
20
20
  #hm-extras .hm-hud__env{display:flex;justify-content:space-between;align-items:baseline;
21
- gap:8px;margin-top:5px}
22
- #hm-extras .hm-hud__env div{display:flex;align-items:baseline;gap:3px;min-width:0}
23
- #hm-extras .hm-hud__env span{font-size:8px;letter-spacing:.08em;opacity:.8;white-space:nowrap}
24
- #hm-extras .hm-hud__env b{font-family:"Consolas",monospace;font-size:10px;font-weight:500;
21
+ gap:6px;margin-top:5px}
22
+ #hm-extras .hm-hud__env div{display:flex;align-items:baseline;gap:2px;min-width:0}
23
+ #hm-extras .hm-hud__env span{font-size:7.5px;letter-spacing:.04em;opacity:.8;white-space:nowrap}
24
+ #hm-extras .hm-hud__env b{font-family:"Consolas",monospace;font-size:9.5px;font-weight:500;
25
25
  color:#22303D;font-variant-numeric:tabular-nums}
26
- #hm-extras .hm-hud__env em{font-size:7px;font-style:normal;opacity:.7}
26
+ #hm-extras .hm-hud__env em{font-size:6.5px;font-style:normal;opacity:.7}
27
+
28
+ /* busy / failed link tones; ok/high/critical keep the palette below */
29
+ #hm-extras[data-hm-tone="busy"] .hm-hud__link b{color:#2F6A8E;animation:hm-link-breathe 1.4s ease-in-out infinite}
30
+ #hm-extras[data-hm-tone="fail"] .hm-hud__link b{color:#B3452F}
31
+ #hm-extras[data-hm-tone="fail"] .hm-hud__link i{background:#B3452F}
32
+ body[data-ds-dark-theme] #hm-extras[data-hm-tone="busy"] .hm-hud__link b{color:#8FBEDA}
33
+ body[data-ds-dark-theme] #hm-extras[data-hm-tone="fail"] .hm-hud__link b{color:#E07A5F}
34
+ @keyframes hm-link-breathe{0%,100%{opacity:.55}50%{opacity:1}}
35
+
36
+ /* update notice inside the HUD block */
37
+ #hm-extras .hm-hud__update{display:flex;align-items:center;gap:6px;margin:0 0 7px;
38
+ padding:4px 0 4px 6px;border-left:2px solid #A9481F;
39
+ font-size:8px;letter-spacing:.02em;color:#5A6875}
40
+ #hm-extras .hm-hud__update[hidden]{display:none}
41
+ #hm-extras .hm-hud__update b{font-family:"Consolas",monospace;font-weight:600;color:#A9481F}
42
+ #hm-extras .hm-hud__update button{
43
+ margin-left:auto;border:1px solid #A9481F;background:transparent;color:#A9481F;
44
+ font-size:8px;line-height:1;padding:3px 6px;border-radius:2px;cursor:pointer;
45
+ font-family:"Bahnschrift","Noto Sans SC",sans-serif;letter-spacing:.06em;
46
+ }
47
+ #hm-extras .hm-hud__update button:hover{background:rgba(169,72,31,.08)}
48
+ body[data-ds-dark-theme] #hm-extras .hm-hud__update{color:#A8B6C4;border-left-color:#D97745}
49
+ body[data-ds-dark-theme] #hm-extras .hm-hud__update b{color:#D97745}
50
+ body[data-ds-dark-theme] #hm-extras .hm-hud__update button{border-color:#D97745;color:#D97745}
27
51
 
28
52
  body[data-ds-dark-theme] #hm-extras{color:#A8B6C4;border-top-color:rgba(127,178,208,.16)}
29
53
  body[data-ds-dark-theme] #hm-extras .hm-hud__env b{color:#E2EBF3}
@@ -47,12 +71,12 @@ body[data-ds-dark-theme] .hm-row-level--3{color:#D97745}
47
71
  /* -------------------------------- 2 零区污染度(真实上下文占用,分级着色) */
48
72
  button[data-hm-contam="high"]{color:#C2542A}
49
73
  button[data-hm-contam="critical"]{color:#D04A2A}
50
- #hm-extras[data-hm-stage="high"] .hm-hud__link b{color:#C2542A}
51
- #hm-extras[data-hm-stage="high"] .hm-hud__link i{background:#C2542A}
52
- #hm-extras[data-hm-stage="critical"] .hm-hud__link b{color:#D04A2A;animation:hm-contam-pulse 1.6s ease-in-out infinite}
53
- #hm-extras[data-hm-stage="critical"] .hm-hud__link i{background:#D04A2A}
54
- body[data-ds-dark-theme] #hm-extras[data-hm-stage="high"] .hm-hud__link b,
55
- body[data-ds-dark-theme] #hm-extras[data-hm-stage="critical"] .hm-hud__link b{color:#E08A55}
74
+ #hm-extras[data-hm-tone="high"] .hm-hud__link b{color:#C2542A}
75
+ #hm-extras[data-hm-tone="high"] .hm-hud__link i{background:#C2542A}
76
+ #hm-extras[data-hm-tone="critical"] .hm-hud__link b{color:#D04A2A;animation:hm-contam-pulse 1.6s ease-in-out infinite}
77
+ #hm-extras[data-hm-tone="critical"] .hm-hud__link i{background:#D04A2A}
78
+ body[data-ds-dark-theme] #hm-extras[data-hm-tone="high"] .hm-hud__link b,
79
+ body[data-ds-dark-theme] #hm-extras[data-hm-tone="critical"] .hm-hud__link b{color:#E08A55}
56
80
  @keyframes hm-contam-pulse{0%,100%{opacity:.6}50%{opacity:1}}
57
81
 
58
82
  /* ------------------------------------------- 5 世界树授权编号(审批卡片) */
@@ -1,7 +1,7 @@
1
1
  /* ==========================================================================
2
2
  HEIMDALL TERMINAL // worldbuilding extras
3
3
  1 接入记录编号 2 档案密级角标 3 战术链接状态条 4 权限身份行
4
- 5 零区环境数据 6 夜战模式 7 空闲呼吸
4
+ 5 HUD 真实读数 6 夜战模式 7 空闲呼吸
5
5
  9 错误措辞 10 启动层真实进度
6
6
 
7
7
  Rules learned the hard way:
@@ -52,11 +52,15 @@
52
52
 
53
53
  /* --------------------------------------------------- 3+5 HUD(侧栏内嵌入) */
54
54
  var HUD_HTML = [
55
+ '<div class="hm-hud__update" data-hm="updatebar" hidden>',
56
+ ' <span>海姆达尔终端 <b data-hm="next"></b> 可用</span>',
57
+ ' <button type="button" data-hm="updatebtn">更新</button>',
58
+ '</div>',
55
59
  '<div class="hm-hud__link"><i></i><span>战术链接</span><b>稳定</b></div>',
56
60
  '<div class="hm-hud__env">',
57
- ' <div><span>风速</span><b data-hm="wind">13.1</b><em>m/s</em></div>',
58
- ' <div><span>地表</span><b data-hm="temp">-31</b><em>°C</em></div>',
59
- ' <div><span>泰坦粒子</span><b data-hm="part">0.04</b><em>%</em></div>',
61
+ ' <div data-hm="turnbox" hidden><span>回合</span><b data-hm="turn">--</b><em>s</em></div>',
62
+ ' <div><span>内存</span><b data-hm="mem">--</b><em>MB</em></div>',
63
+ ' <div><span>污染</span><b data-hm="contam">--</b><em>%</em></div>',
60
64
  '</div>'
61
65
  ].join("");
62
66
 
@@ -142,35 +146,95 @@
142
146
  dock(hud);
143
147
  }
144
148
 
145
- function pumpEnv() {
149
+ /* ------------------------------------------- HUD:真实读数 + 链路即时状态 */
150
+ var lastErrorAt = 0;
151
+ var streamingSince = 0;
152
+ var lastTurnMs = 0;
153
+
154
+ // The RPC is a long-lived stream, so a single request duration says nothing;
155
+ // time the turn itself instead: from the stop button appearing to its removal.
156
+ (function tapFetch() {
157
+ if (typeof window.fetch !== "function" || window.fetch.__hmTap) return;
158
+ var original = window.fetch;
159
+ var tap = function (input, init) {
160
+ var url = typeof input === "string" ? input : (input && input.url) || "";
161
+ if (url.indexOf("/api") < 0) return original.apply(this, arguments);
162
+ var pending = original.apply(this, arguments);
163
+ if (pending && typeof pending.then === "function") {
164
+ pending.then(function () {}, function () { lastErrorAt = Date.now(); });
165
+ }
166
+ return pending;
167
+ };
168
+ tap.__hmTap = true;
169
+ try { window.fetch = tap; } catch (_) {}
170
+ })();
171
+
172
+ function heapMegabytes() {
173
+ var memory = window.performance && window.performance.memory;
174
+ if (!memory || !memory.usedJSHeapSize) return null;
175
+ return Math.round(memory.usedJSHeapSize / (1024 * 1024));
176
+ }
177
+
178
+ function runningTools() {
179
+ try {
180
+ return doc.querySelectorAll(
181
+ "[data-tool][data-state='running'], [data-tool][data-state='preparing']").length;
182
+ } catch (_) { return 0; }
183
+ }
184
+
185
+ function streaming() {
186
+ try { return !!doc.querySelector("button[aria-label*='停止']"); } catch (_) { return false; }
187
+ }
188
+
189
+ function linkState() {
190
+ var running = runningTools();
191
+ if (running > 0) return { text: "执行中 · " + running + " 个指令", tone: "busy" };
192
+ if (streaming()) return { text: "同步中", tone: "busy" };
193
+ if (lastErrorAt && Date.now() - lastErrorAt < 20000) return { text: "中断", tone: "fail" };
194
+ if (contam !== null && contam >= 85) return { text: "污染临界", tone: "critical" };
195
+ if (contam !== null && contam >= 65) return { text: "污染升高", tone: "high" };
196
+ return { text: "稳定", tone: "ok" };
197
+ }
198
+
199
+ function frameHud() {
146
200
  var hud = doc.getElementById("hm-extras");
147
- if (!hud || hud.hasAttribute("data-hm-live")) return;
148
- hud.setAttribute("data-hm-live", "1");
149
- var wind = hud.querySelector('[data-hm="wind"]');
150
- var temp = hud.querySelector('[data-hm="temp"]');
151
- var part = hud.querySelector('[data-hm="part"]');
152
- var s = { wind: 12.4, temp: -31, part: 0.04 };
153
- function drift(v, step, min, max, digits) {
154
- v += (Math.random() - 0.5) * step;
155
- v = Math.max(min, Math.min(max, v));
156
- return Number(v.toFixed(digits));
201
+ if (!hud) return;
202
+
203
+ var busy = streaming() || runningTools() > 0;
204
+ if (busy && !streamingSince) streamingSince = Date.now();
205
+ else if (!busy && streamingSince) {
206
+ lastTurnMs = Date.now() - streamingSince;
207
+ streamingSince = 0;
157
208
  }
158
- setInterval(function () {
159
- if (!doc.getElementById("hm-extras")) return;
160
- s.wind = drift(s.wind, 1.6, 3, 28, 1);
161
- s.temp = drift(s.temp, 0.8, -42, -18, 0);
162
- s.part = drift(s.part, 0.02, 0.01, 0.4, 2);
163
- var link = hud.querySelector(".hm-hud__link b");
164
- if (link) {
165
- var level = contam === null ? "稳定"
166
- : contam >= 85 ? "污染临界" : contam >= 65 ? "污染升高" : "稳定";
167
- if (link.textContent !== level) link.textContent = level;
168
- if (contam !== null && contam >= 85) s.part = Math.max(s.part, 0.72);
169
- }
170
- wind.textContent = s.wind.toFixed(1);
171
- temp.textContent = String(s.temp);
172
- part.textContent = s.part.toFixed(2);
173
- }, 2400);
209
+
210
+ var turnBox = hud.querySelector('[data-hm="turnbox"]');
211
+ var turn = hud.querySelector('[data-hm="turn"]');
212
+ var mem = hud.querySelector('[data-hm="mem"]');
213
+ var pol = hud.querySelector('[data-hm="contam"]');
214
+ var link = hud.querySelector(".hm-hud__link b");
215
+
216
+ var seconds = streamingSince
217
+ ? Math.max(1, Math.round((Date.now() - streamingSince) / 1000))
218
+ : (lastTurnMs ? Math.max(1, Math.round(lastTurnMs / 1000)) : null);
219
+ if (turnBox) turnBox.hidden = seconds === null;
220
+ if (turn && seconds !== null) {
221
+ var turnText = String(seconds);
222
+ if (turn.textContent !== turnText) turn.textContent = turnText;
223
+ }
224
+
225
+ if (mem) {
226
+ var megabytes = heapMegabytes();
227
+ var memText = megabytes === null ? "--" : String(megabytes);
228
+ if (mem.textContent !== memText) mem.textContent = memText;
229
+ }
230
+ if (pol) {
231
+ var polText = contam === null ? "--" : String(contam);
232
+ if (pol.textContent !== polText) pol.textContent = polText;
233
+ }
234
+
235
+ var state = linkState();
236
+ if (link && link.textContent !== state.text) link.textContent = state.text;
237
+ if (hud.getAttribute("data-hm-tone") !== state.tone) hud.setAttribute("data-hm-tone", state.tone);
174
238
  }
175
239
 
176
240
  /* ------------------------------------------ 2 零区污染度(真实上下文占用) */
@@ -193,8 +257,7 @@
193
257
  contam = pct;
194
258
  var stage = pct >= 85 ? "critical" : pct >= 65 ? "high" : "ok";
195
259
  if (meter.getAttribute("data-hm-contam") !== stage) meter.setAttribute("data-hm-contam", stage);
196
- var hud = doc.getElementById("hm-extras");
197
- if (hud && hud.getAttribute("data-hm-stage") !== stage) hud.setAttribute("data-hm-stage", stage);
260
+ frameHud();
198
261
  }
199
262
 
200
263
  /* ------------------------------------------------- 5 授权编号(审批卡片) */
@@ -280,6 +343,90 @@
280
343
  if (next !== value) el.setAttribute(name, next);
281
344
  }
282
345
 
346
+ /* --------------------------------------------------- 7 维护包更新提示 */
347
+ var UPDATE_KEY = "hm.upd";
348
+ var UPDATE_EVERY = 6 * 60 * 60 * 1000;
349
+
350
+ function currentVersion() {
351
+ try {
352
+ var meta = doc.querySelector('meta[name="hm-layer"]');
353
+ var raw = meta ? (meta.getAttribute("content") || "") : "";
354
+ return raw.replace(/^v/i, "").trim();
355
+ } catch (_) { return ""; }
356
+ }
357
+
358
+ function versionParts(value) {
359
+ var core = String(value).split("-")[0].split(".").map(function (n) {
360
+ return parseInt(n, 10) || 0;
361
+ });
362
+ while (core.length < 3) core.push(0);
363
+ return core;
364
+ }
365
+
366
+ function newer(candidate, current) {
367
+ var a = versionParts(candidate);
368
+ var b = versionParts(current);
369
+ for (var i = 0; i < 3; i += 1) {
370
+ if (a[i] !== b[i]) return a[i] > b[i];
371
+ }
372
+ return false;
373
+ }
374
+
375
+ function paintUpdate(next) {
376
+ var hud = doc.getElementById("hm-extras");
377
+ if (!hud) return;
378
+ var bar = hud.querySelector('[data-hm="updatebar"]');
379
+ var label = hud.querySelector('[data-hm="next"]');
380
+ if (!bar || !label) return;
381
+ if (!next) { bar.hidden = true; return; }
382
+ label.textContent = next;
383
+ bar.hidden = false;
384
+ }
385
+
386
+ // The layer version is stamped into index.html at patch time, so this needs
387
+ // no host round trip: compare it with the published latest and cache for 6h.
388
+ function trackUpdate() {
389
+ var current = currentVersion();
390
+ var cached = null;
391
+ try { cached = JSON.parse(LS.getItem(UPDATE_KEY) || "null"); } catch (_) {}
392
+ if (cached && cached.at && Date.now() - cached.at < UPDATE_EVERY) {
393
+ if (cached.version && current && newer(cached.version, current)) paintUpdate(cached.version);
394
+ return;
395
+ }
396
+ if (typeof window.fetch !== "function") return;
397
+ window.fetch("https://registry.npmmirror.com/dsh-snowbreak-heimdall/latest", { cache: "no-store" })
398
+ .then(function (response) { return response.json(); })
399
+ .then(function (data) {
400
+ var version = data && data.version;
401
+ try {
402
+ LS.setItem(UPDATE_KEY, JSON.stringify({ at: Date.now(), version: version }));
403
+ } catch (_) {}
404
+ if (version && current && newer(version, current)) paintUpdate(version);
405
+ }, function () { /* offline: keep the current notice state */ });
406
+ }
407
+
408
+ function copyText(value) {
409
+ try {
410
+ if (navigator.clipboard && navigator.clipboard.writeText) {
411
+ navigator.clipboard.writeText(value);
412
+ return true;
413
+ }
414
+ } catch (_) {}
415
+ return false;
416
+ }
417
+
418
+ doc.addEventListener("click", function (event) {
419
+ var target = event.target;
420
+ var button = target && target.closest ? target.closest('[data-hm="updatebtn"]') : null;
421
+ if (!button) return;
422
+ var hud = doc.getElementById("hm-extras");
423
+ var label = hud && hud.querySelector('[data-hm="next"]');
424
+ var version = label ? (label.textContent || "").trim() : "";
425
+ copyText("npm install dsh-snowbreak-heimdall@" + version);
426
+ button.textContent = "已复制指令";
427
+ setTimeout(function () { button.textContent = "更新"; }, 2400);
428
+ }, true);
429
+
283
430
  /* ------------------------------------------------------------ 4 身份行 */
284
431
  function identityLine() {
285
432
  if (!flag("identity", true)) return;
@@ -417,7 +564,7 @@
417
564
  pending = 0;
418
565
  try {
419
566
  ensureHud();
420
- pumpEnv();
567
+ frameHud();
421
568
  identityLine();
422
569
  decorateRows();
423
570
  trackContext();
@@ -431,16 +578,21 @@
431
578
  function boot() {
432
579
  try {
433
580
  ensureHud();
434
- pumpEnv();
435
581
  identityLine();
436
582
  trackContext();
583
+ frameHud();
437
584
  bootProgress();
438
585
  syncModelNames();
586
+ trackUpdate();
439
587
  } catch (_) {}
440
588
  // The meter re-renders on every turn: poll it rather than trust a one-shot read.
441
589
  setInterval(function () {
442
590
  try { trackContext(); } catch (_) {}
443
591
  }, 2000);
592
+ // Execution state changes without a DOM mutation on our own subtree.
593
+ setInterval(function () {
594
+ try { frameHud(); } catch (_) {}
595
+ }, 1200);
444
596
  // Menus open after the click; re-check the open overlay and the composer.
445
597
  doc.addEventListener("pointerdown", function () {
446
598
  setTimeout(function () {
@@ -104,10 +104,12 @@ $xaml = @'
104
104
 
105
105
  $window = [Windows.Markup.XamlReader]::Parse($xaml)
106
106
  $logo = '__LOGO__'
107
- $window.FindName('Logo').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
108
- $window.FindName('CompleteLogo').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
109
- $window.FindName('Watermark').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
110
- $window.FindName('CompleteWatermark').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
107
+ if ($logo) {
108
+ $window.FindName('Logo').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
109
+ $window.FindName('CompleteLogo').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
110
+ $window.FindName('Watermark').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
111
+ $window.FindName('CompleteWatermark').Source = New-Object Windows.Media.Imaging.BitmapImage([Uri]$logo)
112
+ }
111
113
  $window.FindName('Pct').Text = '100'
112
114
  $window.FindName('Stage').Text = 'READY'
113
115
  $window.FindName('Status').Text = '源码层尚未接入'
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.7.2';
20
+ const VERSION = '3.8.0';
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
@@ -374,12 +374,19 @@ function askRestartConfirmation(restartScript, mode = 'apply') {
374
374
  try {
375
375
  const templatePath = path.join(ROOT, 'assets', 'source', 'restart-confirm.ps1');
376
376
  let script = fs.readFileSync(templatePath, 'utf8').replace(/^\uFEFF/, '');
377
- const background = path.join(ROOT, 'assets', 'previews', 'loading-dark.png').replace(/\\/g, '/');
378
- script = script.replace('__BACKGROUND__', background);
379
- const mark = path.join(ROOT, 'assets', 'source', 'confirm-mark.png').replace(/\\/g, '/');
380
- script = script.replace('__MARK__', mark);
381
- const logo = path.join(ROOT, 'assets', 'source', 'hm-mark-light.png').replace(/\\/g, '/');
382
- script = script.replace('__LOGO__', logo);
377
+ // A pruned install can lose the mark asset; try the known names in order and
378
+ // fall back to no image at all instead of an empty frame.
379
+ const assetRoot = path.join(ROOT, 'assets', 'source');
380
+ const pickAsset = (...names) => {
381
+ for (const name of names) {
382
+ const candidate = path.join(assetRoot, name);
383
+ if (fs.existsSync(candidate)) return candidate;
384
+ }
385
+ return null;
386
+ };
387
+ const logo = pickAsset('hm-mark-light.png', 'confirm-mark.png', 'welcome-mark-light.png');
388
+ if (!logo) log('restart prompt: no mark asset found; rendering without logo');
389
+ script = script.replace('__LOGO__', logo ? 'file:///' + logo.replace(/\\/g, '/') : '');
383
390
  if (mode === 'disable') {
384
391
  script = script
385
392
  .replace('RESTART REQUIRED // 需要重启', 'DISABLE PENDING // 等待重启')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-snowbreak-heimdall",
3
- "version": "3.7.2",
3
+ "version": "3.8.0",
4
4
  "description": "《尘白禁区》海姆达尔终端 / 世界树公司源码级皮肤:加载画面、双主题、菜单/侧栏/图标,插件仅在加载后播放启动动画。Windows / DSH 0.2.2-rc.x。",
5
5
  "type": "module",
6
6
  "license": "MIT",