dsh-snowbreak-heimdall 3.7.1 → 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 +185 -183
- package/assets/source/extras.css +125 -111
- package/assets/source/extras.js +187 -60
- package/assets/source/restart-confirm.ps1 +6 -4
- package/lib/index.js +14 -7
- package/package.json +1 -1
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.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
- `
|
|
166
|
-
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
+
|
package/assets/source/extras.css
CHANGED
|
@@ -1,111 +1,125 @@
|
|
|
1
|
-
/* ==========================================================================
|
|
2
|
-
HEIMDALL TERMINAL // worldbuilding extras
|
|
3
|
-
The HUD is a normal block inside the sidebar flow, placed just above the
|
|
4
|
-
account block. It is never fixed and never carries a stacking order, so it
|
|
5
|
-
cannot cover a menu, a popover, or the account row.
|
|
6
|
-
========================================================================== */
|
|
7
|
-
#hm-extras{
|
|
8
|
-
display:block;padding:6px 14px 8px;margin:0;
|
|
9
|
-
border-top:1px solid rgba(47,106,142,.18);
|
|
10
|
-
font-family:"Bahnschrift","Noto Sans SC","Segoe UI",sans-serif;
|
|
11
|
-
color:#4A5A69;user-select:none;pointer-events:none;
|
|
12
|
-
}
|
|
13
|
-
#hm-extras .hm-hud__link{display:flex;align-items:center;gap:7px;font-size:9px;letter-spacing:.13em}
|
|
14
|
-
#hm-extras .hm-hud__link i{width:4px;height:4px;background:#2F6A8E;flex:0 0 auto;
|
|
15
|
-
animation:hm-link-pulse 2.4s ease-in-out infinite}
|
|
16
|
-
#hm-extras .hm-hud__link span{opacity:.82}
|
|
17
|
-
#hm-extras .hm-hud__link b{font-weight:600;color:#2F6A8E;letter-spacing:.1em}
|
|
18
|
-
@keyframes hm-link-pulse{0%,100%{opacity:.35}50%{opacity:1}}
|
|
19
|
-
|
|
20
|
-
#hm-extras .hm-hud__env{display:flex;justify-content:space-between;align-items:baseline;
|
|
21
|
-
gap:
|
|
22
|
-
#hm-extras .hm-hud__env div{display:flex;align-items:baseline;gap:
|
|
23
|
-
#hm-extras .hm-hud__env span{font-size:
|
|
24
|
-
#hm-extras .hm-hud__env b{font-family:"Consolas",monospace;font-size:
|
|
25
|
-
color:#22303D;font-variant-numeric:tabular-nums}
|
|
26
|
-
#hm-extras .hm-hud__env em{font-size:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
body[data-ds-dark-theme] #hm-extras
|
|
55
|
-
body[data-ds-dark-theme] #hm-extras
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
.hm-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
HEIMDALL TERMINAL // worldbuilding extras
|
|
3
|
+
The HUD is a normal block inside the sidebar flow, placed just above the
|
|
4
|
+
account block. It is never fixed and never carries a stacking order, so it
|
|
5
|
+
cannot cover a menu, a popover, or the account row.
|
|
6
|
+
========================================================================== */
|
|
7
|
+
#hm-extras{
|
|
8
|
+
display:block;padding:6px 14px 8px;margin:0;
|
|
9
|
+
border-top:1px solid rgba(47,106,142,.18);
|
|
10
|
+
font-family:"Bahnschrift","Noto Sans SC","Segoe UI",sans-serif;
|
|
11
|
+
color:#4A5A69;user-select:none;pointer-events:none;
|
|
12
|
+
}
|
|
13
|
+
#hm-extras .hm-hud__link{display:flex;align-items:center;gap:7px;font-size:9px;letter-spacing:.13em}
|
|
14
|
+
#hm-extras .hm-hud__link i{width:4px;height:4px;background:#2F6A8E;flex:0 0 auto;
|
|
15
|
+
animation:hm-link-pulse 2.4s ease-in-out infinite}
|
|
16
|
+
#hm-extras .hm-hud__link span{opacity:.82}
|
|
17
|
+
#hm-extras .hm-hud__link b{font-weight:600;color:#2F6A8E;letter-spacing:.1em}
|
|
18
|
+
@keyframes hm-link-pulse{0%,100%{opacity:.35}50%{opacity:1}}
|
|
19
|
+
|
|
20
|
+
#hm-extras .hm-hud__env{display:flex;justify-content:space-between;align-items:baseline;
|
|
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
|
+
color:#22303D;font-variant-numeric:tabular-nums}
|
|
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}
|
|
51
|
+
|
|
52
|
+
body[data-ds-dark-theme] #hm-extras{color:#A8B6C4;border-top-color:rgba(127,178,208,.16)}
|
|
53
|
+
body[data-ds-dark-theme] #hm-extras .hm-hud__env b{color:#E2EBF3}
|
|
54
|
+
body[data-ds-dark-theme] #hm-extras .hm-hud__link b{color:#8FBEDA}
|
|
55
|
+
body[data-ds-dark-theme] #hm-extras .hm-hud__link i{background:#8FBEDA}
|
|
56
|
+
|
|
57
|
+
/* ------------------------------------------------ 1 接入记录编号 / 2 密级 */
|
|
58
|
+
.hm-row-code{
|
|
59
|
+
display:inline-block;margin-right:5px;font-family:"Consolas",monospace;
|
|
60
|
+
font-size:7.5px;letter-spacing:.04em;opacity:.55;vertical-align:middle;
|
|
61
|
+
}
|
|
62
|
+
.hm-row-level{
|
|
63
|
+
display:inline-block;margin-right:6px;padding:0 3px;border:1px solid currentColor;
|
|
64
|
+
border-radius:2px;font-size:7px;line-height:10px;letter-spacing:.04em;
|
|
65
|
+
opacity:.55;vertical-align:middle;
|
|
66
|
+
}
|
|
67
|
+
.hm-row-level--2,.hm-row-level--3{opacity:.85;color:#A9481F}
|
|
68
|
+
body[data-ds-dark-theme] .hm-row-level--2,
|
|
69
|
+
body[data-ds-dark-theme] .hm-row-level--3{color:#D97745}
|
|
70
|
+
|
|
71
|
+
/* -------------------------------- 2 零区污染度(真实上下文占用,分级着色) */
|
|
72
|
+
button[data-hm-contam="high"]{color:#C2542A}
|
|
73
|
+
button[data-hm-contam="critical"]{color:#D04A2A}
|
|
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}
|
|
80
|
+
@keyframes hm-contam-pulse{0%,100%{opacity:.6}50%{opacity:1}}
|
|
81
|
+
|
|
82
|
+
/* ------------------------------------------- 5 世界树授权编号(审批卡片) */
|
|
83
|
+
.hm-auth-code{
|
|
84
|
+
margin-left:auto;font-family:"Consolas",monospace;font-size:8px;
|
|
85
|
+
letter-spacing:.1em;opacity:.5;color:#A9481F;
|
|
86
|
+
}
|
|
87
|
+
body[data-ds-dark-theme] .hm-auth-code{color:#D97745;opacity:.72}
|
|
88
|
+
|
|
89
|
+
/* ------------------------------------------------------------ 7 空闲呼吸 */
|
|
90
|
+
html[data-hm-idle] #hm-ui-chrome .hm-ui-watermark{animation:hm-drift-a 16s ease-in-out infinite alternate}
|
|
91
|
+
html[data-hm-idle] #hm-ui-chrome .hm-ui-grid{animation:hm-drift-b 22s ease-in-out infinite alternate}
|
|
92
|
+
@keyframes hm-drift-a{from{transform:translate(0,0)}to{transform:translate(-14px,-10px) scale(1.02)}}
|
|
93
|
+
@keyframes hm-drift-b{from{transform:translate(0,0)}to{transform:translate(10px,6px)}}
|
|
94
|
+
|
|
95
|
+
/* -------------------------------------------------------------- 6 夜战模式 */
|
|
96
|
+
html[data-hm-night] #root{filter:brightness(.9) saturate(.88) contrast(1.02)}
|
|
97
|
+
html[data-hm-night] #hm-ui-chrome .hm-ui-scan{opacity:.55;animation-duration:11s}
|
|
98
|
+
html[data-hm-night] #hm-extras .hm-hud__link b{color:#D97745}
|
|
99
|
+
html[data-hm-night] #hm-extras .hm-hud__link i{background:#D97745}
|
|
100
|
+
|
|
101
|
+
/* ------------------------------------------------------- 10 启动层进度条 */
|
|
102
|
+
.hm-boot-progress{
|
|
103
|
+
position:absolute;left:48px;right:48px;bottom:44px;z-index:3;
|
|
104
|
+
display:flex;align-items:center;gap:14px;
|
|
105
|
+
font-family:"Bahnschrift","Consolas",monospace;
|
|
106
|
+
}
|
|
107
|
+
.hm-boot-progress i{position:relative;flex:1;height:1px;background:rgba(127,178,208,.18)}
|
|
108
|
+
.hm-boot-progress i::after{
|
|
109
|
+
content:"";position:absolute;left:0;top:-1px;height:3px;width:var(--hm-p,0);
|
|
110
|
+
background:linear-gradient(90deg,rgba(127,178,208,.2),#7FB2D0);
|
|
111
|
+
transition:width .18s linear;
|
|
112
|
+
}
|
|
113
|
+
.hm-boot-progress__num{
|
|
114
|
+
font-size:12px;letter-spacing:.12em;color:#E6EEF5;font-variant-numeric:tabular-nums;
|
|
115
|
+
min-width:44px;text-align:right;
|
|
116
|
+
}
|
|
117
|
+
.hm-boot-progress__tag{
|
|
118
|
+
font-family:"Noto Sans SC",sans-serif;font-size:10px;letter-spacing:.16em;
|
|
119
|
+
color:#7E8E9E;min-width:132px;
|
|
120
|
+
}
|
|
121
|
+
@media (prefers-color-scheme: light){
|
|
122
|
+
.hm-boot-progress__num{color:#101820}
|
|
123
|
+
.hm-boot-progress i{background:rgba(47,106,142,.2)}
|
|
124
|
+
.hm-boot-progress i::after{background:linear-gradient(90deg,rgba(47,106,142,.25),#2F6A8E)}
|
|
125
|
+
}
|
package/assets/source/extras.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* ==========================================================================
|
|
2
2
|
HEIMDALL TERMINAL // worldbuilding extras
|
|
3
3
|
1 接入记录编号 2 档案密级角标 3 战术链接状态条 4 权限身份行
|
|
4
|
-
5
|
|
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
|
|
58
|
-
' <div><span
|
|
59
|
-
' <div><span
|
|
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
|
-
|
|
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
|
|
148
|
-
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -351,31 +498,6 @@
|
|
|
351
498
|
}
|
|
352
499
|
}
|
|
353
500
|
|
|
354
|
-
/* ---------------------------------------------------------- 8 加密闪烁 */
|
|
355
|
-
var encryptEl = null;
|
|
356
|
-
function flashEncrypt() {
|
|
357
|
-
if (!flag("encrypt", true)) return;
|
|
358
|
-
if (!encryptEl) {
|
|
359
|
-
encryptEl = doc.createElement("div");
|
|
360
|
-
encryptEl.className = "hm-encrypt";
|
|
361
|
-
encryptEl.textContent = "ENCRYPTING…";
|
|
362
|
-
doc.body.appendChild(encryptEl);
|
|
363
|
-
}
|
|
364
|
-
encryptEl.classList.add("is-on");
|
|
365
|
-
setTimeout(function () { encryptEl.classList.remove("is-on"); }, 220);
|
|
366
|
-
}
|
|
367
|
-
doc.addEventListener("click", function (e) {
|
|
368
|
-
var el = e.target;
|
|
369
|
-
if (!el || !el.closest || !el.closest("button")) return;
|
|
370
|
-
var label = (el.textContent || "").trim();
|
|
371
|
-
if (label === "执行" || label === "发送" || el.getAttribute("aria-label") === "发送") flashEncrypt();
|
|
372
|
-
}, true);
|
|
373
|
-
doc.addEventListener("keydown", function (e) {
|
|
374
|
-
if (e.key !== "Enter" || e.shiftKey) return;
|
|
375
|
-
var t = e.target;
|
|
376
|
-
if (t && (t.tagName === "TEXTAREA" || t.getAttribute("contenteditable") === "true")) flashEncrypt();
|
|
377
|
-
}, true);
|
|
378
|
-
|
|
379
501
|
/* ---------------------------------------------------------- 9 错误措辞 */
|
|
380
502
|
var ERR = [
|
|
381
503
|
[/Failed to fetch/i, "链路中断 · 检查网络"],
|
|
@@ -442,7 +564,7 @@
|
|
|
442
564
|
pending = 0;
|
|
443
565
|
try {
|
|
444
566
|
ensureHud();
|
|
445
|
-
|
|
567
|
+
frameHud();
|
|
446
568
|
identityLine();
|
|
447
569
|
decorateRows();
|
|
448
570
|
trackContext();
|
|
@@ -456,16 +578,21 @@
|
|
|
456
578
|
function boot() {
|
|
457
579
|
try {
|
|
458
580
|
ensureHud();
|
|
459
|
-
pumpEnv();
|
|
460
581
|
identityLine();
|
|
461
582
|
trackContext();
|
|
583
|
+
frameHud();
|
|
462
584
|
bootProgress();
|
|
463
585
|
syncModelNames();
|
|
586
|
+
trackUpdate();
|
|
464
587
|
} catch (_) {}
|
|
465
588
|
// The meter re-renders on every turn: poll it rather than trust a one-shot read.
|
|
466
589
|
setInterval(function () {
|
|
467
590
|
try { trackContext(); } catch (_) {}
|
|
468
591
|
}, 2000);
|
|
592
|
+
// Execution state changes without a DOM mutation on our own subtree.
|
|
593
|
+
setInterval(function () {
|
|
594
|
+
try { frameHud(); } catch (_) {}
|
|
595
|
+
}, 1200);
|
|
469
596
|
// Menus open after the click; re-check the open overlay and the composer.
|
|
470
597
|
doc.addEventListener("pointerdown", function () {
|
|
471
598
|
setTimeout(function () {
|
|
@@ -104,10 +104,12 @@ $xaml = @'
|
|
|
104
104
|
|
|
105
105
|
$window = [Windows.Markup.XamlReader]::Parse($xaml)
|
|
106
106
|
$logo = '__LOGO__'
|
|
107
|
-
|
|
108
|
-
$window.FindName('
|
|
109
|
-
$window.FindName('
|
|
110
|
-
$window.FindName('
|
|
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.
|
|
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
|
-
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
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 // 等待重启')
|