dsh-snowbreak-heimdall 3.5.2 → 3.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,101 @@
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: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;
25
+ color:#22303D;font-variant-numeric:tabular-nums}
26
+ #hm-extras .hm-hud__env em{font-size:7px;font-style:normal;opacity:.7}
27
+
28
+ body[data-ds-dark-theme] #hm-extras{color:#A8B6C4;border-top-color:rgba(127,178,208,.16)}
29
+ body[data-ds-dark-theme] #hm-extras .hm-hud__env b{color:#E2EBF3}
30
+ body[data-ds-dark-theme] #hm-extras .hm-hud__link b{color:#8FBEDA}
31
+ body[data-ds-dark-theme] #hm-extras .hm-hud__link i{background:#8FBEDA}
32
+
33
+ /* ------------------------------------------------ 1 接入记录编号 / 2 密级 */
34
+ .hm-row-code{
35
+ display:inline-block;margin-right:5px;font-family:"Consolas",monospace;
36
+ font-size:7.5px;letter-spacing:.04em;opacity:.55;vertical-align:middle;
37
+ }
38
+ .hm-row-level{
39
+ display:inline-block;margin-right:6px;padding:0 3px;border:1px solid currentColor;
40
+ border-radius:2px;font-size:7px;line-height:10px;letter-spacing:.04em;
41
+ opacity:.55;vertical-align:middle;
42
+ }
43
+ .hm-row-level--2,.hm-row-level--3{opacity:.85;color:#A9481F}
44
+ body[data-ds-dark-theme] .hm-row-level--2,
45
+ body[data-ds-dark-theme] .hm-row-level--3{color:#D97745}
46
+
47
+ /* -------------------------------- 2 零区污染度(真实上下文占用,分级着色) */
48
+ button[data-hm-contam="high"]{color:#C2542A}
49
+ 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}
56
+ @keyframes hm-contam-pulse{0%,100%{opacity:.6}50%{opacity:1}}
57
+
58
+ /* ------------------------------------------- 5 世界树授权编号(审批卡片) */
59
+ .hm-auth-code{
60
+ margin-left:auto;font-family:"Consolas",monospace;font-size:8px;
61
+ letter-spacing:.1em;opacity:.5;color:#A9481F;
62
+ }
63
+ body[data-ds-dark-theme] .hm-auth-code{color:#D97745;opacity:.72}
64
+
65
+ /* ------------------------------------------------------------ 7 空闲呼吸 */
66
+ html[data-hm-idle] #hm-ui-chrome .hm-ui-watermark{animation:hm-drift-a 16s ease-in-out infinite alternate}
67
+ html[data-hm-idle] #hm-ui-chrome .hm-ui-grid{animation:hm-drift-b 22s ease-in-out infinite alternate}
68
+ @keyframes hm-drift-a{from{transform:translate(0,0)}to{transform:translate(-14px,-10px) scale(1.02)}}
69
+ @keyframes hm-drift-b{from{transform:translate(0,0)}to{transform:translate(10px,6px)}}
70
+
71
+ /* -------------------------------------------------------------- 6 夜战模式 */
72
+ html[data-hm-night] #root{filter:brightness(.9) saturate(.88) contrast(1.02)}
73
+ html[data-hm-night] #hm-ui-chrome .hm-ui-scan{opacity:.55;animation-duration:11s}
74
+ html[data-hm-night] #hm-extras .hm-hud__link b{color:#D97745}
75
+ html[data-hm-night] #hm-extras .hm-hud__link i{background:#D97745}
76
+
77
+ /* ------------------------------------------------------- 10 启动层进度条 */
78
+ .hm-boot-progress{
79
+ position:absolute;left:48px;right:48px;bottom:44px;z-index:3;
80
+ display:flex;align-items:center;gap:14px;
81
+ font-family:"Bahnschrift","Consolas",monospace;
82
+ }
83
+ .hm-boot-progress i{position:relative;flex:1;height:1px;background:rgba(127,178,208,.18)}
84
+ .hm-boot-progress i::after{
85
+ content:"";position:absolute;left:0;top:-1px;height:3px;width:var(--hm-p,0);
86
+ background:linear-gradient(90deg,rgba(127,178,208,.2),#7FB2D0);
87
+ transition:width .18s linear;
88
+ }
89
+ .hm-boot-progress__num{
90
+ font-size:12px;letter-spacing:.12em;color:#E6EEF5;font-variant-numeric:tabular-nums;
91
+ min-width:44px;text-align:right;
92
+ }
93
+ .hm-boot-progress__tag{
94
+ font-family:"Noto Sans SC",sans-serif;font-size:10px;letter-spacing:.16em;
95
+ color:#7E8E9E;min-width:132px;
96
+ }
97
+ @media (prefers-color-scheme: light){
98
+ .hm-boot-progress__num{color:#101820}
99
+ .hm-boot-progress i{background:rgba(47,106,142,.2)}
100
+ .hm-boot-progress i::after{background:linear-gradient(90deg,rgba(47,106,142,.25),#2F6A8E)}
101
+ }
@@ -0,0 +1,471 @@
1
+ /* ==========================================================================
2
+ HEIMDALL TERMINAL // worldbuilding extras
3
+ 1 接入记录编号 2 档案密级角标 3 战术链接状态条 4 权限身份行
4
+ 5 零区环境数据 6 夜战模式 7 空闲呼吸
5
+ 9 错误措辞 10 启动层真实进度
6
+
7
+ Rules learned the hard way:
8
+ - Never insert nodes into a row container: rows host buttons and the
9
+ primary action. Only the row's title span may be touched.
10
+ - The HUD must live in the sidebar flow, before the account block. It is
11
+ never position:fixed, so it can never cover a menu or the account row.
12
+ ========================================================================== */
13
+ (function () {
14
+ "use strict";
15
+ if (window.__hmExtras) return;
16
+ window.__hmExtras = true;
17
+
18
+ var doc = document;
19
+ var html = doc.documentElement;
20
+ var LS = window.localStorage;
21
+
22
+ function flag(name, fallback) {
23
+ try {
24
+ var v = LS.getItem("hm." + name);
25
+ return v === null ? fallback : v !== "0";
26
+ } catch (_) { return fallback; }
27
+ }
28
+
29
+ /* ---------------------------------------------------------------- 6 夜战 */
30
+ function nightMode() {
31
+ if (!flag("night", true)) { html.removeAttribute("data-hm-night"); return; }
32
+ var h = new Date().getHours();
33
+ if (h >= 23 || h < 5) html.setAttribute("data-hm-night", "on");
34
+ else html.removeAttribute("data-hm-night");
35
+ }
36
+ nightMode();
37
+ setInterval(nightMode, 5 * 60 * 1000);
38
+
39
+ /* ---------------------------------------------------------------- 7 空闲 */
40
+ var idleTimer = 0;
41
+ function wake() {
42
+ html.removeAttribute("data-hm-idle");
43
+ clearTimeout(idleTimer);
44
+ idleTimer = setTimeout(function () { html.setAttribute("data-hm-idle", "on"); }, 60000);
45
+ }
46
+ if (flag("idle", true)) {
47
+ ["pointermove", "pointerdown", "keydown", "wheel", "focusin"].forEach(function (name) {
48
+ window.addEventListener(name, wake, { passive: true });
49
+ });
50
+ wake();
51
+ }
52
+
53
+ /* --------------------------------------------------- 3+5 HUD(侧栏内嵌入) */
54
+ var HUD_HTML = [
55
+ '<div class="hm-hud__link"><i></i><span>战术链接</span><b>稳定</b></div>',
56
+ '<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>',
60
+ '</div>'
61
+ ].join("");
62
+
63
+ function createHud() {
64
+ var hud = doc.createElement("div");
65
+ hud.id = "hm-extras";
66
+ hud.setAttribute("aria-hidden", "true");
67
+ hud.style.display = "none";
68
+ hud.innerHTML = HUD_HTML;
69
+ return hud;
70
+ }
71
+
72
+ function findAccountLeaf() {
73
+ var nodes;
74
+ try { nodes = doc.querySelectorAll("span, div, p"); } catch (_) { return null; }
75
+ for (var i = nodes.length - 1; i >= 0; i -= 1) {
76
+ var el = nodes[i];
77
+ if (el.closest && el.closest("#hm-extras")) continue;
78
+ if (el.childElementCount) continue;
79
+ var text = (el.textContent || "").trim();
80
+ if (!/^(Blue Archive|ANALYST-04|分析员)/i.test(text)) continue;
81
+ return el;
82
+ }
83
+ return null;
84
+ }
85
+
86
+ // The sidebar root is the narrow container that also holds the panel <nav>.
87
+ function sidebarOf(el) {
88
+ var node = el;
89
+ for (var depth = 0; depth < 12 && node && node !== doc.body; depth += 1) {
90
+ if (node.tagName === "ASIDE") return node;
91
+ if (node.querySelector && node.querySelector("nav") && node.clientWidth > 160) return node;
92
+ node = node.parentElement;
93
+ }
94
+ return null;
95
+ }
96
+
97
+ function dock(hud) {
98
+ var root = null;
99
+ var block = null;
100
+ var leaf = findAccountLeaf();
101
+
102
+ if (leaf) {
103
+ root = sidebarOf(leaf);
104
+ if (root) {
105
+ block = leaf;
106
+ while (block.parentElement && block.parentElement !== root) block = block.parentElement;
107
+ if (block.parentElement !== root) block = null;
108
+ }
109
+ }
110
+ if (!root) {
111
+ var aside = doc.querySelector("aside");
112
+ if (aside && aside.querySelector("nav")) root = aside;
113
+ }
114
+ if (!root) {
115
+ hud.style.display = "none";
116
+ hud.removeAttribute("data-hm-docked");
117
+ return;
118
+ }
119
+ // Collapsed rail: there is no room for the card, so stay hidden instead of
120
+ // floating into the conversation area.
121
+ if (root.clientWidth && root.clientWidth < 160) {
122
+ hud.style.display = "none";
123
+ return;
124
+ }
125
+ if (!block || block === hud || !root.contains(block)) block = root.lastElementChild;
126
+ if (!block) {
127
+ hud.style.display = "none";
128
+ return;
129
+ }
130
+ if (hud.parentElement !== root || hud.nextElementSibling !== block) {
131
+ root.insertBefore(hud, block);
132
+ }
133
+ hud.style.display = "";
134
+ hud.setAttribute("data-hm-docked", "1");
135
+ }
136
+
137
+ // Idempotent: dock() only touches the DOM when the HUD is out of place, so
138
+ // re-running it keeps the card glued above the account block after a render.
139
+ function ensureHud() {
140
+ var hud = doc.getElementById("hm-extras");
141
+ if (!hud) hud = createHud();
142
+ dock(hud);
143
+ }
144
+
145
+ function pumpEnv() {
146
+ 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));
157
+ }
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);
174
+ }
175
+
176
+ /* ------------------------------------------ 2 零区污染度(真实上下文占用) */
177
+ // The composer ring is the only %-button carrying an svg circle; read it so
178
+ // the HUD reflects real context pressure instead of a random number.
179
+ var contam = null;
180
+ function trackContext() {
181
+ var buttons;
182
+ try { buttons = doc.querySelectorAll("button"); } catch (_) { return; }
183
+ var meter = null;
184
+ for (var i = 0; i < buttons.length; i += 1) {
185
+ if (!buttons[i].querySelector || !buttons[i].querySelector("svg circle")) continue;
186
+ meter = buttons[i];
187
+ break;
188
+ }
189
+ if (!meter) return;
190
+ var match = /^(\d{1,3})%$/.exec((meter.textContent || "").trim());
191
+ if (!match) return;
192
+ var pct = parseInt(match[1], 10);
193
+ contam = pct;
194
+ var stage = pct >= 85 ? "critical" : pct >= 65 ? "high" : "ok";
195
+ 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);
198
+ }
199
+
200
+ /* ------------------------------------------------- 5 授权编号(审批卡片) */
201
+ function authCodes() {
202
+ var cards;
203
+ try { cards = doc.querySelectorAll("[data-approval-key]"); } catch (_) { return; }
204
+ for (var i = 0; i < cards.length; i += 1) {
205
+ var card = cards[i];
206
+ var strip = card.querySelector("[class*='strip']");
207
+ if (!strip || strip.querySelector(".hm-auth-code")) continue;
208
+ var key = card.getAttribute("data-approval-key") || "";
209
+ var code = doc.createElement("span");
210
+ code.className = "hm-auth-code";
211
+ code.textContent = "AUTH-" + String(1000 + (hash(key) % 8999));
212
+ strip.appendChild(code);
213
+ }
214
+ }
215
+
216
+ /* ------------------------------------------------ 4 模型名兜底(显示层) */
217
+ // The catalog can arrive from a listing that carries its own display names,
218
+ // so the injected bundle rename alone is not always visible. Rewrite the few
219
+ // known model families wherever they are painted; anything else is untouched.
220
+ var MODEL_NAMES = [
221
+ ["世界树-V4.1-Flash", "优格-V4.1-Flash"],
222
+ ["世界树-V4-Pro", "优格-V4-Pro"],
223
+ ["DeepSeek-V4.1-Flash", "优格-V4.1-Flash"],
224
+ ["DeepSeek-V4-Pro", "优格-V4-Pro"],
225
+ ["WorldTree-V4.1-Flash", "优格-V4.1-Flash"],
226
+ ["WorldTree-V4-Pro", "优格-V4-Pro"]
227
+ ];
228
+
229
+ // Only chrome that paints a model name: the picker trigger and its overlays.
230
+ // Never the message stream, where the same words can be ordinary chat text.
231
+ var MODEL_SCOPE = "[aria-haspopup], [role='menu'], [role='listbox']";
232
+
233
+ function renameText(value) {
234
+ if (!value || value.length > 80) return value;
235
+ if (value.indexOf("-V4") < 0) return value;
236
+ var next = value;
237
+ for (var i = 0; i < MODEL_NAMES.length; i += 1) {
238
+ if (next.indexOf(MODEL_NAMES[i][0]) < 0) continue;
239
+ next = next.split(MODEL_NAMES[i][0]).join(MODEL_NAMES[i][1]);
240
+ }
241
+ return next;
242
+ }
243
+
244
+ function syncModelNames(scope) {
245
+ var roots;
246
+ if (scope) roots = [scope];
247
+ else {
248
+ try { roots = doc.querySelectorAll(MODEL_SCOPE); } catch (_) { return; }
249
+ }
250
+ for (var r = 0; r < roots.length; r += 1) {
251
+ var root = roots[r];
252
+ if (!root || !root.querySelectorAll) continue;
253
+ // The trigger carries the name on its own aria-label, not on a child.
254
+ renameAttribute(root, "aria-label");
255
+ renameAttribute(root, "title");
256
+ var nodes;
257
+ try { nodes = root.querySelectorAll("[aria-label], [title]"); } catch (_) { nodes = []; }
258
+ for (var i = 0; i < nodes.length; i += 1) {
259
+ var el = nodes[i];
260
+ renameAttribute(el, "aria-label");
261
+ renameAttribute(el, "title");
262
+ }
263
+ var walker;
264
+ try {
265
+ walker = doc.createTreeWalker(root, NodeFilter.SHOW_TEXT, null);
266
+ } catch (_) { continue; }
267
+ var node;
268
+ while ((node = walker.nextNode())) {
269
+ if (!node.nodeValue || node.nodeValue.length > 80 || node.nodeValue.indexOf("-V4") < 0) continue;
270
+ var next = renameText(node.nodeValue);
271
+ if (next !== node.nodeValue) { try { node.nodeValue = next; } catch (_) {} }
272
+ }
273
+ }
274
+ }
275
+
276
+ function renameAttribute(el, name) {
277
+ var value = el.getAttribute(name);
278
+ if (!value) return;
279
+ var next = renameText(value);
280
+ if (next !== value) el.setAttribute(name, next);
281
+ }
282
+
283
+ /* ------------------------------------------------------------ 4 身份行 */
284
+ function identityLine() {
285
+ if (!flag("identity", true)) return;
286
+ var nodes;
287
+ try { nodes = doc.querySelectorAll("span, div, p"); } catch (_) { return; }
288
+ for (var i = 0; i < nodes.length; i += 1) {
289
+ var el = nodes[i];
290
+ if (el.childElementCount || el.hasAttribute("data-hm-id")) continue;
291
+ if (el.closest && el.closest("#hm-extras")) continue;
292
+ var text = (el.textContent || "").trim();
293
+ if (!/^(ANALYST-04|分析员)$/i.test(text)) continue;
294
+ el.setAttribute("data-hm-id", "1");
295
+ try { el.textContent = "ANALYST-04 · 权限 A · 零区"; } catch (_) {}
296
+ return;
297
+ }
298
+ }
299
+
300
+ /* ------------------------------------------------- 1 编号 / 2 密级角标 */
301
+ var LEVELS = ["公开", "内部", "机密", "绝密"];
302
+ function hash(text) {
303
+ var h = 0;
304
+ for (var i = 0; i < text.length; i += 1) h = (h * 31 + text.charCodeAt(i)) | 0;
305
+ return Math.abs(h);
306
+ }
307
+
308
+ var ACTION_TEXT = /^(建立接入|新会话|新建会话|搜索|插件|模块|自动化任务|定时序列|更多|扩展|设置|终端设置|退出登录)$/;
309
+
310
+ function rowLabel(row) {
311
+ var label;
312
+ try { label = row.querySelector("[class*='title'], [class*='Title']"); } catch (_) { return null; }
313
+ if (!label) return null;
314
+ if (label.closest && label.closest("button")) return null;
315
+ if (label.childElementCount > 2) return null;
316
+ if (label.querySelector && label.querySelector(".hm-row-code")) return null;
317
+ var text = (label.textContent || "").trim();
318
+ if (!text || text.length > 60) return null;
319
+ if (ACTION_TEXT.test(text)) return null;
320
+ return { label: label, text: text };
321
+ }
322
+
323
+ function decorateRows() {
324
+ if (!flag("records", true)) return;
325
+ var rows;
326
+ try { rows = doc.querySelectorAll("[data-row-key][role='treeitem']"); } catch (_) { return; }
327
+ if (!rows.length) {
328
+ try { rows = doc.querySelectorAll("[class*='sessionRow'], [class*='SessionRow']"); } catch (_) { return; }
329
+ }
330
+ for (var i = 0; i < rows.length; i += 1) {
331
+ var row = rows[i];
332
+ if (row.hasAttribute("data-hm-row")) continue;
333
+ if (row.closest && row.closest("button")) continue;
334
+ var found = rowLabel(row);
335
+ if (!found) continue;
336
+ var label = found.label;
337
+ var text = found.text;
338
+ var seed = hash(text);
339
+ var code = doc.createElement("span");
340
+ code.className = "hm-row-code";
341
+ code.textContent = "HM-" + String(1000 + (seed % 8999));
342
+ var n = seed % 4;
343
+ var lvl = doc.createElement("span");
344
+ lvl.className = "hm-row-level hm-row-level--" + n;
345
+ lvl.textContent = LEVELS[n];
346
+ try {
347
+ label.insertBefore(code, label.firstChild);
348
+ label.insertBefore(lvl, code.nextSibling);
349
+ } catch (_) { continue; }
350
+ row.setAttribute("data-hm-row", "1");
351
+ }
352
+ }
353
+
354
+ /* ---------------------------------------------------------- 9 错误措辞 */
355
+ var ERR = [
356
+ [/Failed to fetch/i, "链路中断 · 检查网络"],
357
+ [/NetworkError/i, "链路中断 · 检查网络"],
358
+ [/timed? ?out/i, "链路超时 · 请重试"],
359
+ [/Unauthorized|401/i, "身份校验失败 · 权限不足"],
360
+ [/Maximum context/i, "上下文溢出 · 需要压缩"]
361
+ ];
362
+ function rewriteErrors() {
363
+ if (!flag("errors", true)) return;
364
+ var nodes;
365
+ try { nodes = doc.querySelectorAll("[role='alert'], [class*='error'], [class*='Error']"); } catch (_) { return; }
366
+ for (var i = 0; i < nodes.length; i += 1) {
367
+ var el = nodes[i];
368
+ if (el.hasAttribute("data-hm-err") || el.childElementCount) continue;
369
+ if (el.closest && el.closest("#hm-extras")) continue;
370
+ var text = (el.textContent || "").trim();
371
+ if (!text || text.length > 120) continue;
372
+ for (var j = 0; j < ERR.length; j += 1) {
373
+ if (ERR[j][0].test(text)) {
374
+ el.setAttribute("data-hm-err", "1");
375
+ try { el.textContent = ERR[j][1]; } catch (_) {}
376
+ break;
377
+ }
378
+ }
379
+ }
380
+ }
381
+
382
+ /* ------------------------------------------------------ 10 真实启动进度 */
383
+ function bootProgress() {
384
+ var boot = doc.getElementById("hm-boot");
385
+ if (!boot) return;
386
+ var bar = boot.querySelector(".hm-boot-progress");
387
+ if (!bar) {
388
+ bar = doc.createElement("div");
389
+ bar.className = "hm-boot-progress";
390
+ bar.innerHTML = '<i></i><span class="hm-boot-progress__num">08%</span>' +
391
+ '<span class="hm-boot-progress__tag">建立安全链路</span>';
392
+ boot.appendChild(bar);
393
+ }
394
+ var num = bar.querySelector(".hm-boot-progress__num");
395
+ var tag = bar.querySelector(".hm-boot-progress__tag");
396
+ var value = 8;
397
+ var t0 = Date.now();
398
+ var timer = setInterval(function () {
399
+ if (!doc.getElementById("hm-boot") || boot.classList.contains("hm-boot--out")) value = 100;
400
+ else if (Date.now() - t0 > 12000) value = Math.min(94, value + 1);
401
+ else if (value < 46) value += 2;
402
+ else value = Math.min(92, value + 1);
403
+ bar.style.setProperty("--hm-p", value + "%");
404
+ num.textContent = (value < 10 ? "0" : "") + Math.round(value) + "%";
405
+ tag.textContent = value < 30 ? "建立安全链路" : value < 60 ? "同步泰坦监测阵列"
406
+ : value < 95 ? "校验分析员权限" : "接入完成";
407
+ if (value >= 100) clearInterval(timer);
408
+ }, 130);
409
+ setTimeout(function () { clearInterval(timer); }, 60000);
410
+ }
411
+
412
+ /* ------------------------------------------------------------------ tick */
413
+ var pending = 0;
414
+ function tick() {
415
+ if (pending) return;
416
+ pending = setTimeout(function () {
417
+ pending = 0;
418
+ try {
419
+ ensureHud();
420
+ pumpEnv();
421
+ identityLine();
422
+ decorateRows();
423
+ trackContext();
424
+ authCodes();
425
+ rewriteErrors();
426
+ syncModelNames();
427
+ } catch (_) {}
428
+ }, 400);
429
+ }
430
+
431
+ function boot() {
432
+ try {
433
+ ensureHud();
434
+ pumpEnv();
435
+ identityLine();
436
+ trackContext();
437
+ bootProgress();
438
+ syncModelNames();
439
+ } catch (_) {}
440
+ // The meter re-renders on every turn: poll it rather than trust a one-shot read.
441
+ setInterval(function () {
442
+ try { trackContext(); } catch (_) {}
443
+ }, 2000);
444
+ // Menus open after the click; re-check the open overlay and the composer.
445
+ doc.addEventListener("pointerdown", function () {
446
+ setTimeout(function () {
447
+ try { syncModelNames(); } catch (_) {}
448
+ }, 80);
449
+ }, true);
450
+ setInterval(function () {
451
+ try { syncModelNames(); } catch (_) {}
452
+ }, 2500);
453
+ if (typeof MutationObserver === "function" && doc.body) {
454
+ try { new MutationObserver(tick).observe(doc.body, { childList: true, subtree: true }); } catch (_) {}
455
+ }
456
+ tick();
457
+ // the sidebar mounts late and re-renders; keep re-docking the HUD
458
+ var tries = 0;
459
+ var probe = setInterval(function () {
460
+ tries += 1;
461
+ try { ensureHud(); } catch (_) {}
462
+ if (tries > 60) clearInterval(probe);
463
+ }, 500);
464
+ setInterval(function () {
465
+ try { ensureHud(); } catch (_) {}
466
+ }, 4000);
467
+ }
468
+
469
+ if (doc.readyState === "loading") doc.addEventListener("DOMContentLoaded", boot);
470
+ else boot();
471
+ })();
@@ -244,7 +244,7 @@
244
244
  .hm-boot__steps{list-style:none;margin:18px 0 0;padding:0}
245
245
  .hm-boot__steps li{
246
246
  display:grid;
247
- grid-template-columns:26px 1fr auto;
247
+ grid-template-columns:26px 1fr auto 54px;
248
248
  align-items:center;
249
249
  gap:10px;
250
250
  min-height:38px;
@@ -267,6 +267,17 @@
267
267
  .hm-boot__steps .is-current{color:var(--hm-ink)}
268
268
  .hm-boot__steps .is-current span{color:var(--hm-amber)}
269
269
  .hm-boot__steps .is-current b{font-weight:600}
270
+ .hm-boot__verdict{
271
+ font-family:"Bahnschrift","Segoe UI Variable Display","Segoe UI",sans-serif;
272
+ font-style:normal;font-size:8px;letter-spacing:.08em;text-align:right;
273
+ color:var(--hm-ink-3);
274
+ }
275
+ .hm-boot__steps li[data-hm-state="ok"]{color:var(--hm-ink)}
276
+ .hm-boot__steps li[data-hm-state="ok"] span{color:var(--hm-blue)}
277
+ .hm-boot__steps li[data-hm-state="ok"] .hm-boot__verdict{color:var(--hm-blue)}
278
+ .hm-boot__steps li[data-hm-state="fail"]{color:#C2542A}
279
+ .hm-boot__steps li[data-hm-state="fail"] .hm-boot__verdict{color:#C2542A}
280
+ .hm-boot__steps li[data-hm-state="run"] .hm-boot__verdict{color:var(--hm-amber)}
270
281
  .hm-boot__hint{
271
282
  margin:14px 0 0;
272
283
  padding-top:12px;
@@ -40,11 +40,11 @@
40
40
  <span>正在建立安全链路</span>
41
41
  <span class="hm-boot__standby">STANDBY</span>
42
42
  </div>
43
- <ol class="hm-boot__steps">
44
- <li class="is-current"><span>01</span><b>身份核验</b><em>ANALYST</em></li>
45
- <li><span>02</span><b>指挥数据链</b><em>LINK</em></li>
46
- <li><span>03</span><b>泰坦物质监测</b><em>ARRAY</em></li>
47
- <li><span>04</span><b>权限等级 A</b><em>AUTH</em></li>
43
+ <ol class="hm-boot__steps" aria-label="接入自检">
44
+ <li class="is-current" data-hm-check="layer"><span>01</span><b>源码层校验</b><em>LAYER</em><i class="hm-boot__verdict">待</i></li>
45
+ <li data-hm-check="shell"><span>02</span><b>界面层挂载</b><em>SHELL</em><i class="hm-boot__verdict">待</i></li>
46
+ <li data-hm-check="extras"><span>03</span><b>扩展层挂载</b><em>EXTRAS</em><i class="hm-boot__verdict">待</i></li>
47
+ <li data-hm-check="app"><span>04</span><b>指挥数据链</b><em>LINK</em><i class="hm-boot__verdict">待</i></li>
48
48
  </ol>
49
49
  <p class="hm-boot__hint">首次接入或维护后,链路建立可能需要数秒。</p>
50
50
  </aside>