dsh-snowbreak-heimdall 3.8.6 → 3.9.8

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/SHA256SUMS.txt CHANGED
@@ -1,74 +1,75 @@
1
- 15e003cd5d8d6a8140dbfe75ef847a78384580ebe9858f6e672ba0ee01109ad3 *.npmignore
2
- a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\app-512.png
3
- e6d98ef38fec73d647fb7dd2c33019fd71ecbb15b8236d2dbe3ab8e9d85da162 *assets\icons\app-light-512.png
4
- 8118e8d77764cb0bd998e280489e9408d27167d50a0dcdd4790a50536ba2f7a6 *assets\icons\app.ico
5
- d0bf225aef010c9f3079414a48974b6d9f44cc20b0bf6158ea68373ec3292269 *assets\icons\apple-touch-icon.png
6
- 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\favicon-dark.svg
7
- 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\favicon.svg
8
- 80f6d9cc7230a5529ec9290a75605e1b6918ad4eb80c0fce80aad9f9a3165e0e *assets\icons\icon-192.png
9
- a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\icon-512.png
10
- 38335ecc7668f2c682f05c735f0f595ccd6ffed04949f5c5cdd8ec7e24c11382 *assets\icons\icon-maskable-512.png
11
- 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\icon.svg
12
- 7d0cac53f595eeb723e2ec145305d9bc4d432f76d313924bd821a3f1f02ba853 *assets\icons\res-icon.png
13
- 7f8ab651531a32f8d6d50bd76cd350087b135d98d8fd9964adcc3308d80b62a0 *assets\icons\tray.ico
14
- f97fb8cb96c579159c4b5d6d1b0f1a767ead9895b71cfaa5aaa7c4248a3938ad *assets\previews\assets\hm-mark-blue.png
15
- add4e78e5c7ea2f70ba07d43d2fe0635125986ec92e060248fad9d449be57577 *assets\previews\brand-fix.png
16
- 67ba14dca5fff5fa144aa7986db3cf9d76afe5a64bcaf8d0c20e0ed44c9e5b06 *assets\previews\exe-icon-test.png
17
- bc0c3ed8efb73fd6aff7bee802bb1f1f1e550add77576b03cccdb56f8d8d7131 *assets\previews\loading-dark.html
18
- d0fc1230f9cc1fd444b4e41c13dd3a654c138b9ae78e2a4b7e06e21274ba54c9 *assets\previews\loading-dark.png
19
- aad4dc763d5379e44e17207ae5d287be3708220b8e990e618c778ee6cc7c58c5 *assets\previews\loading-fallback.html
20
- cc37692d24488d74ddcc480b8c82cb932102b10bb9f087baf395ee2bb15a7d5d *assets\previews\loading-fallback.png
21
- d370d25590c2acd93a7113aabbef54c779d74d624bebbe1e7a86835c3cab6f37 *assets\previews\loading-handoff.html
22
- 6442d8fd5ab7046f7f39d2f9900d414997e5defdf9d8eff525c20925f947ae2e *assets\previews\loading-light.html
23
- ea2a6dc80e61bd90cbb29f98eeeeff8bc9a803cdc2d9ec207aba665619db4164 *assets\previews\loading-light.png
24
- 633f757eaebbd7ae353a6a9a2a221d5c49ea7f0b3265a2bd1dc4d75546603141 *assets\previews\mask-test.png
25
- 5df2fdd499cea77f8dde1efcf9fd842a6e939cacbc24cf5ec39b4622c30ed2e4 *assets\previews\progress-winforms-complete.png
26
- b4019a637dc144f90d50336960a4e83531cf87ff94d1951dc0671ece70c333a5 *assets\previews\progress-winforms-restore.png
27
- 09128405ece6b38aa94b7e206f698d57ca50531b459ab14962662b9ffcbcadec *assets\previews\progress-winforms.png
28
- cd204b8ccd9107f9af140a41e78f963d8c41c61cf41b51834199643693dac9be *assets\previews\ui-chrome.html
29
- b5f2ff21b67a6a0c178d251af49331319eb42e9e140e279e391edda30112bf47 *assets\previews\ui-chrome.png
30
- 3ebaa8c085365385745ec2ceac437970a146581487c89ae4e4b4e4e15a5c5ec5 *assets\source\brand-client.js
31
- 12ea3ea272ae13b66f2875c42d466053516588057bb90775499e0fdb575fe624 *assets\source\client-template.js
32
- 54fc8e9c7394fc84dad497500021784d639d835bfa7e10abe39f04ab7f21f584 *assets\source\confirm-mark.png
33
- f97fb8cb96c579159c4b5d6d1b0f1a767ead9895b71cfaa5aaa7c4248a3938ad *assets\source\hm-mark-blue.png
34
- aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\hm-mark-ink.png
35
- 1591f7b426d79f71440d4d9c93518de14c88d5b69610beea03a2ecac5c3ac958 *assets\source\hm-mark-light.png
36
- f94ec6c169e0a0cbd11d84cdd0d06f7da684f21366bc8506f4e6daaee941d8f9 *assets\source\loading.css
37
- b7326e8f747b124547f19b8bbbf16ecb8d020778b360df28a7fec14efc55624c *assets\source\loading.html
38
- 9926df428efeceb92b3242b2c21025cae84ceade8734d258ba67a2c231c0fddd *assets\source\logo.webp
39
- 0a2e1c9c2a82487f414aaa68dbc01a59d9b1bbec973732bb32d08d90cc2ea982 *assets\source\mark-alpha.png
40
- ff37ef4ee56454e42d2d47cdbbdc634c6b0b34e43817d4139ef7831b049714ec *assets\source\mark-color.png
41
- 105b2913a0232daf52793edf7531b27b1fa2830aa861d1e6c97e60e4f5bbd7d7 *assets\source\progress.ps1
42
- 136e735fa49f5ba8b54425a70e6786b97b32627bc637a384e2a388fb066e01a9 *assets\source\restart-confirm.ps1
43
- e81ba1bccb95c4e3923b0140cc0615a5e92234777057eb2be614e7211de93965 *assets\source\shell.css
44
- 724f25bb1908f43180c7330669767dca05cbd61d3aee4b65401949a16e3c4a2d *assets\source\shell.js
45
- f39417379634fd601613323bf56c0226bf135a41e153b90929627edc89b1edfe *assets\source\update.css
46
- 36225c50dd0e7f5042548eddf6414b3e68ec6bba042caeb386e71973090a2f86 *assets\source\watermark-soft.png
47
- e2985ac72a36a9dd9982a41e9587368b2a06afebf7fb50468d5b1c299bad94a2 *assets\source\welcome-brand.svg
48
- aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\welcome-mark-ink.png
49
- 1591f7b426d79f71440d4d9c93518de14c88d5b69610beea03a2ecac5c3ac958 *assets\source\welcome-mark-light.png
50
- c8b835b1cb7c2fe3cb53288fbc7d1a28f7cefb3eac0d7574e3a5c0ea684ae22f *assets\source\welcome.css
51
- 7f49fb881ee31ae9fc109b1204d410848ada71b1110ec875a9341bea304bec36 *bump335.py
52
- 55dba68bc761c40338469e010c5d4ec1ecd15e06dc86dbeb525b29a87df05ab2 *bump336.py
53
- 2a0b4b9c68d5f4b87bb8fbb768a1933c40394fe4e6f23c144fae88052ebe4a02 *cordis.patch.yml
54
- 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *icon.svg
55
- 16e6b37076eb1d87496d03df49af614f9b40c095a3fa8fe5fcaa3145622a2301 *lib\client.js
56
- b2d0e5d8ba1c5c131861f8e4086730036df2b005975432412dae69786697a088 *lib\index.js
57
- 0794a24c333ef529e56c6eb7b1dee62f4f5b8da1c56fe001885824ce2a3f8b2f *LICENSE
58
- de949631618eb48bf5cd6c06698a28214c8e9cb4bca23d298cd89462f4fb260e *locale\en.json
59
- e931cfb8c9b64aa4e01363e603537afee392e8309fe07daaff3e07e028ab8010 *locale\zh.json
60
- 63efecbe21a7b1a782cd933daa0f14a6181351d446f43618624dd21aff992455 *package.json
61
- 8fa6aff9fa2ab7eb11cc813c7ed9cda2b9ae7757c039aad8d71d5b56b5b683d9 *patch\asar.py
62
- 577756bd6d0883839d20798916a1fb06b228429b092f5619e5a1958429654d18 *patch\patcher.py
63
- 3cd662a9ff72936946e67777c6ef1c7e12e8fe83b55cca2a9266981fdce2c09b *README.md
64
- 49ad162dab1fada0855ee7dbbac5c13f97aff6c0008ac7235fd7e41423572a62 *remove_prompt_marker.py
65
- 8978acd5618d9148ca20804d823af6decb0b20af4569b39e8a641f559277db0c *TEST-REPORT.md
66
- 73ac5fa42ee7de25615deb7315de7e2609f76b52e636b6a03397c7203bf17bc2 *tools\build_assets.py
67
- a8c0badcd2e0cac12cf03528a892c51ec1e6cbde0352ebfb5d5243cbe1f59f8e *tools\build_client.py
68
- 920b32904514c1429d05dfe9e645f1e04fbbef95b4f1e6cfd14bdb2ffdce4e72 *tools\test_lock.py
69
- 528b0820dd2418d521cea0fe0a710daaba20236cf4649eded241c855d345975b *tools\test_progress_launch.py
70
- 385915673000e558bdd070effb6b1054f63c316adc73e54877d3477641948e20 *tools\test_progress_ps1.py
71
- f8572e5d28ef412700689bc02e94ece4ff68561d6c2749d2e1640c44967d02e6 *tools\test_progress_ps1_complete.py
72
- 365e2e848090ff97ffc97197654e8a004bd2e13f9b216618fdee394ac016cf79 *vendor\rcedit\LICENSE
73
- 3e7801db1a5edbec91b49a24a094aad776cb4515488ea5a4ca2289c400eade2a *vendor\rcedit\rcedit-x64.exe
74
- d081051be5dad8854b894236fc273d631abf2b7556b94b277aa6bf782c44c56b *vendor\rcedit\README.md
1
+ 8118e8d77764cb0bd998e280489e9408d27167d50a0dcdd4790a50536ba2f7a6 *assets\icons\app.ico
2
+ a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\app-512.png
3
+ d0bf225aef010c9f3079414a48974b6d9f44cc20b0bf6158ea68373ec3292269 *assets\icons\apple-touch-icon.png
4
+ e6d98ef38fec73d647fb7dd2c33019fd71ecbb15b8236d2dbe3ab8e9d85da162 *assets\icons\app-light-512.png
5
+ 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\favicon.svg
6
+ 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\favicon-dark.svg
7
+ 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\icon.svg
8
+ 80f6d9cc7230a5529ec9290a75605e1b6918ad4eb80c0fce80aad9f9a3165e0e *assets\icons\icon-192.png
9
+ a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\icon-512.png
10
+ 38335ecc7668f2c682f05c735f0f595ccd6ffed04949f5c5cdd8ec7e24c11382 *assets\icons\icon-maskable-512.png
11
+ 7d0cac53f595eeb723e2ec145305d9bc4d432f76d313924bd821a3f1f02ba853 *assets\icons\res-icon.png
12
+ 7f8ab651531a32f8d6d50bd76cd350087b135d98d8fd9964adcc3308d80b62a0 *assets\icons\tray.ico
13
+ f97fb8cb96c579159c4b5d6d1b0f1a767ead9895b71cfaa5aaa7c4248a3938ad *assets\previews\assets\hm-mark-blue.png
14
+ add4e78e5c7ea2f70ba07d43d2fe0635125986ec92e060248fad9d449be57577 *assets\previews\brand-fix.png
15
+ 67ba14dca5fff5fa144aa7986db3cf9d76afe5a64bcaf8d0c20e0ed44c9e5b06 *assets\previews\exe-icon-test.png
16
+ bc0c3ed8efb73fd6aff7bee802bb1f1f1e550add77576b03cccdb56f8d8d7131 *assets\previews\loading-dark.html
17
+ d0fc1230f9cc1fd444b4e41c13dd3a654c138b9ae78e2a4b7e06e21274ba54c9 *assets\previews\loading-dark.png
18
+ aad4dc763d5379e44e17207ae5d287be3708220b8e990e618c778ee6cc7c58c5 *assets\previews\loading-fallback.html
19
+ cc37692d24488d74ddcc480b8c82cb932102b10bb9f087baf395ee2bb15a7d5d *assets\previews\loading-fallback.png
20
+ d370d25590c2acd93a7113aabbef54c779d74d624bebbe1e7a86835c3cab6f37 *assets\previews\loading-handoff.html
21
+ 6442d8fd5ab7046f7f39d2f9900d414997e5defdf9d8eff525c20925f947ae2e *assets\previews\loading-light.html
22
+ ea2a6dc80e61bd90cbb29f98eeeeff8bc9a803cdc2d9ec207aba665619db4164 *assets\previews\loading-light.png
23
+ 633f757eaebbd7ae353a6a9a2a221d5c49ea7f0b3265a2bd1dc4d75546603141 *assets\previews\mask-test.png
24
+ 09128405ece6b38aa94b7e206f698d57ca50531b459ab14962662b9ffcbcadec *assets\previews\progress-winforms.png
25
+ 5df2fdd499cea77f8dde1efcf9fd842a6e939cacbc24cf5ec39b4622c30ed2e4 *assets\previews\progress-winforms-complete.png
26
+ b4019a637dc144f90d50336960a4e83531cf87ff94d1951dc0671ece70c333a5 *assets\previews\progress-winforms-restore.png
27
+ cd204b8ccd9107f9af140a41e78f963d8c41c61cf41b51834199643693dac9be *assets\previews\ui-chrome.html
28
+ b5f2ff21b67a6a0c178d251af49331319eb42e9e140e279e391edda30112bf47 *assets\previews\ui-chrome.png
29
+ 3ebaa8c085365385745ec2ceac437970a146581487c89ae4e4b4e4e15a5c5ec5 *assets\source\brand-client.js
30
+ 12ea3ea272ae13b66f2875c42d466053516588057bb90775499e0fdb575fe624 *assets\source\client-template.js
31
+ 54fc8e9c7394fc84dad497500021784d639d835bfa7e10abe39f04ab7f21f584 *assets\source\confirm-mark.png
32
+ 3ae8046a945677788b289d8db464ae947cebaa9cc3f23ecdb8c5ff38bd8f02f8 *assets\source\extras.css
33
+ 97f61a89a8f1879cfd563bc1dee158f8665ebbc0742eb2fae0032671369da5a2 *assets\source\extras.js
34
+ f97fb8cb96c579159c4b5d6d1b0f1a767ead9895b71cfaa5aaa7c4248a3938ad *assets\source\hm-mark-blue.png
35
+ aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\hm-mark-ink.png
36
+ 1591f7b426d79f71440d4d9c93518de14c88d5b69610beea03a2ecac5c3ac958 *assets\source\hm-mark-light.png
37
+ 0d46d6fd3a5b4d176641e328e747be7047cafa7213d8db1ec73540e57a23f1bb *assets\source\loading.css
38
+ 78517dec7ed709162702e2424198b4b1a7e0c33895685b5efd42fc03d43f644e *assets\source\loading.html
39
+ 9926df428efeceb92b3242b2c21025cae84ceade8734d258ba67a2c231c0fddd *assets\source\logo.webp
40
+ 0a2e1c9c2a82487f414aaa68dbc01a59d9b1bbec973732bb32d08d90cc2ea982 *assets\source\mark-alpha.png
41
+ ff37ef4ee56454e42d2d47cdbbdc634c6b0b34e43817d4139ef7831b049714ec *assets\source\mark-color.png
42
+ 105b2913a0232daf52793edf7531b27b1fa2830aa861d1e6c97e60e4f5bbd7d7 *assets\source\progress.ps1
43
+ 6192be869b419b415ca5b44955e5e10cf84bbf1513cf358874f1fdb7116128a3 *assets\source\restart-confirm.ps1
44
+ e81ba1bccb95c4e3923b0140cc0615a5e92234777057eb2be614e7211de93965 *assets\source\shell.css
45
+ a5f5c45ca84c4d834d45d0a197aab76ca05fe05b0c1134077e75aeceb5ccde12 *assets\source\shell.js
46
+ f39417379634fd601613323bf56c0226bf135a41e153b90929627edc89b1edfe *assets\source\update.css
47
+ 36225c50dd0e7f5042548eddf6414b3e68ec6bba042caeb386e71973090a2f86 *assets\source\watermark-soft.png
48
+ c8b835b1cb7c2fe3cb53288fbc7d1a28f7cefb3eac0d7574e3a5c0ea684ae22f *assets\source\welcome.css
49
+ e2985ac72a36a9dd9982a41e9587368b2a06afebf7fb50468d5b1c299bad94a2 *assets\source\welcome-brand.svg
50
+ aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\welcome-mark-ink.png
51
+ 1591f7b426d79f71440d4d9c93518de14c88d5b69610beea03a2ecac5c3ac958 *assets\source\welcome-mark-light.png
52
+ 2a0b4b9c68d5f4b87bb8fbb768a1933c40394fe4e6f23c144fae88052ebe4a02 *cordis.patch.yml
53
+ 065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *icon.svg
54
+ bcb1d6e0762ab2b3bca86cb7cc17c194fdf76c2c3e44c4bcba81869bc5c4b42f *lib\client.js
55
+ 349e498371c9fb55dfd30b6d27b62fb06568e082a6ecf3939f54ed06db377681 *lib\index.js
56
+ b7a3b5add20b59e19942ecdb1054238ab26ca6277d3f2a9456e34229f2eba0f2 *lib\turns.js
57
+ 0794a24c333ef529e56c6eb7b1dee62f4f5b8da1c56fe001885824ce2a3f8b2f *LICENSE
58
+ de949631618eb48bf5cd6c06698a28214c8e9cb4bca23d298cd89462f4fb260e *locale\en.json
59
+ e931cfb8c9b64aa4e01363e603537afee392e8309fe07daaff3e07e028ab8010 *locale\zh.json
60
+ 896c3cfbf5aa7efcc4d82277af964b4134e8510aea900df161f8ab4d380f10fb *package.json
61
+ b39651c3299516bbae0a6844290425c2310085f2a7691edfbc04c4b832eb9e70 *patch\__pycache__\asar.cpython-314.pyc
62
+ 46e365afb82f22ca4071b2571ad7981be7f308f9196d8b4ffcefc0f15dba869c *patch\__pycache__\patcher.cpython-314.pyc
63
+ 8fa6aff9fa2ab7eb11cc813c7ed9cda2b9ae7757c039aad8d71d5b56b5b683d9 *patch\asar.py
64
+ 7136d4b1bcc2c7f9d964f3b20891417f35523d25d601a6881577761a9e7bd495 *patch\patcher.py
65
+ 2d68fa209103641bc66b301586a1ab32df0fc7cad06a830eda1c73cfd90da979 *README.md
66
+ 8978acd5618d9148ca20804d823af6decb0b20af4569b39e8a641f559277db0c *TEST-REPORT.md
67
+ 73ac5fa42ee7de25615deb7315de7e2609f76b52e636b6a03397c7203bf17bc2 *tools\build_assets.py
68
+ a8c0badcd2e0cac12cf03528a892c51ec1e6cbde0352ebfb5d5243cbe1f59f8e *tools\build_client.py
69
+ 920b32904514c1429d05dfe9e645f1e04fbbef95b4f1e6cfd14bdb2ffdce4e72 *tools\test_lock.py
70
+ 528b0820dd2418d521cea0fe0a710daaba20236cf4649eded241c855d345975b *tools\test_progress_launch.py
71
+ 385915673000e558bdd070effb6b1054f63c316adc73e54877d3477641948e20 *tools\test_progress_ps1.py
72
+ f8572e5d28ef412700689bc02e94ece4ff68561d6c2749d2e1640c44967d02e6 *tools\test_progress_ps1_complete.py
73
+ 365e2e848090ff97ffc97197654e8a004bd2e13f9b216618fdee394ac016cf79 *vendor\rcedit\LICENSE
74
+ 3e7801db1a5edbec91b49a24a094aad776cb4515488ea5a4ca2289c400eade2a *vendor\rcedit\rcedit-x64.exe
75
+ d081051be5dad8854b894236fc273d631abf2b7556b94b277aa6bf782c44c56b *vendor\rcedit\README.md
@@ -152,6 +152,19 @@ html[data-hm-night] #hm-ui-chrome .hm-ui-scan{opacity:.55;animation-duration:11s
152
152
  html[data-hm-night] #hm-extras .hm-hud__link b{color:#D97745}
153
153
  html[data-hm-night] #hm-extras .hm-hud__link i{background:#D97745}
154
154
 
155
+ /* ----------------------- 10 轨迹车道图:圆环线框(覆盖原图,不改数据) */
156
+ #hm-torus{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;
157
+ background:#F7F9FB;border-bottom:1px solid rgba(47,106,142,.14);
158
+ font-family:"Bahnschrift","Noto Sans SC","Segoe UI",sans-serif;user-select:none}
159
+ #hm-torus[hidden]{display:none}
160
+ #hm-torus .hm-torus__head{display:flex;align-items:baseline;gap:10px;padding:3px 6px 2px;
161
+ font-size:8px;letter-spacing:.14em;color:#7C8B99}
162
+ #hm-torus .hm-torus__head em{margin-left:auto;font-style:normal;
163
+ font-family:"Consolas",monospace;font-size:8px;letter-spacing:.06em;color:#8A98A6}
164
+ #hm-torus .hm-torus__scene{position:relative;flex:1;min-height:0;overflow:hidden}
165
+ #hm-torus canvas{display:block;width:100%;height:100%}
166
+ body[data-ds-dark-theme] #hm-torus{background:#0A0E13;border-bottom-color:rgba(127,178,208,.16)}
167
+
155
168
  /* ------------------------------------------------------- 10 启动层进度条 */
156
169
  .hm-boot-progress{
157
170
  position:absolute;left:48px;right:48px;bottom:44px;z-index:3;
@@ -715,6 +715,263 @@
715
715
  setTimeout(function () { clearInterval(timer); }, 60000);
716
716
  }
717
717
 
718
+ /* ---------------------------------------- 10 轨迹车道图:圆环(torus 线框) */
719
+ // A real torus drawn on canvas: latitude/longitude grid, perspective
720
+ // projection, depth-faded strokes and a continuous rotation. The current
721
+ // turn is highlighted as a band of tubes at the near side.
722
+ var TORUS_U = 56;
723
+ var TORUS_V = 18;
724
+ var TORUS_R = 1;
725
+ var TORUS_r = 0.42;
726
+
727
+ var torusEl = null;
728
+ var torusCanvas = null;
729
+ var torusCtx = null;
730
+ var torusHost = null;
731
+ var torusRaf = 0;
732
+ var torusAngle = 0.4;
733
+ var torusAngularSpeed = 0.45;
734
+ var torusBusyUntil = 0;
735
+ var torusTurns = null;
736
+ var torusSelected = -1;
737
+ var torusSpunAt = 0;
738
+
739
+ function torusLeaf(text) {
740
+ var nodes;
741
+ try { nodes = doc.querySelectorAll("span, div"); } catch (_) { return null; }
742
+ for (var i = 0; i < nodes.length; i += 1) {
743
+ var el = nodes[i];
744
+ if (!el.childElementCount && (el.textContent || "").trim() === text) return el;
745
+ }
746
+ return null;
747
+ }
748
+
749
+ function torusHostElement() {
750
+ // DSH marks every timeline span itself; anchor on those instead of guessing
751
+ // from label text. The band is the smallest ancestor that still holds most
752
+ // of the spans and stays short.
753
+ var spans;
754
+ try { spans = doc.querySelectorAll("[data-timeline-span]"); } catch (_) { spans = []; }
755
+ if (spans.length) {
756
+ var total = spans.length;
757
+ var node = spans[0].parentElement;
758
+ for (var depth = 0; depth < 7 && node; depth += 1) {
759
+ var rect = node.getBoundingClientRect();
760
+ var held = node.querySelectorAll("[data-timeline-span]").length;
761
+ if (rect.width > 240 && rect.height > 36 && rect.height < 340 && held >= total * 0.5) return node;
762
+ node = node.parentElement;
763
+ }
764
+ }
765
+ var first = torusLeaf("输入");
766
+ if (!first) return null;
767
+ var walker = first.parentElement;
768
+ for (var step = 0; step < 6 && walker; step += 1) {
769
+ var box = walker.getBoundingClientRect();
770
+ var text = walker.textContent || "";
771
+ if (box.width > 240 && box.height > 30 && box.height < 260 && text.indexOf("第 ") < 0) return walker;
772
+ walker = walker.parentElement;
773
+ }
774
+ return null;
775
+ }
776
+
777
+ function torusTheme() {
778
+ var dark = false;
779
+ try { dark = doc.body.getAttribute("data-ds-dark-theme") !== null; } catch (_) {}
780
+ return dark
781
+ ? { ink: "200,220,236", accent: "217,119,69", grid: 0.34 }
782
+ : { ink: "22,32,44", accent: "169,72,31", grid: 0.42 };
783
+ }
784
+
785
+ function torusBuild() {
786
+ var wrap = doc.createElement("div");
787
+ wrap.id = "hm-torus";
788
+ wrap.innerHTML =
789
+ '<div class="hm-torus__head"><span>回合环</span><em data-hm="torus-meta"></em></div>' +
790
+ '<div class="hm-torus__scene"><canvas></canvas></div>';
791
+ return wrap;
792
+ }
793
+
794
+ function torusResize() {
795
+ if (!torusEl || !torusCanvas) return;
796
+ var scene = torusEl.querySelector(".hm-torus__scene");
797
+ if (!scene) return;
798
+ var dpr = Math.min(2, window.devicePixelRatio || 1);
799
+ var w = Math.max(40, scene.clientWidth);
800
+ var h = Math.max(40, scene.clientHeight);
801
+ if (torusCanvas.width !== Math.round(w * dpr) || torusCanvas.height !== Math.round(h * dpr)) {
802
+ torusCanvas.width = Math.round(w * dpr);
803
+ torusCanvas.height = Math.round(h * dpr);
804
+ torusCanvas.style.width = w + "px";
805
+ torusCanvas.style.height = h + "px";
806
+ }
807
+ torusCtx = torusCanvas.getContext("2d");
808
+ torusCtx.setTransform(dpr, 0, 0, dpr, 0, 0);
809
+ }
810
+
811
+ function torusDraw(ts) {
812
+ if (!torusCanvas || !torusCtx) return;
813
+ var w = torusCanvas.width / (Math.min(2, window.devicePixelRatio || 1));
814
+ var h = torusCanvas.height / (Math.min(2, window.devicePixelRatio || 1));
815
+ var ctx = torusCtx;
816
+ var theme = torusTheme();
817
+ ctx.clearRect(0, 0, w, h);
818
+
819
+ var cosA = Math.cos(torusAngle), sinA = Math.sin(torusAngle);
820
+ var fov = 3.4;
821
+ var size = Math.min(w * 0.34, h * 2.4) * 0.5;
822
+ var cx = w / 2;
823
+ var cy = h / 2;
824
+ var tiltX = -0.92;
825
+ var cosX = Math.cos(tiltX), sinX = Math.sin(tiltX);
826
+
827
+ function project(theta, phi) {
828
+ var rr = TORUS_R + TORUS_r * Math.cos(phi);
829
+ var x = rr * Math.cos(theta);
830
+ var y = rr * Math.sin(theta);
831
+ var z = TORUS_r * Math.sin(phi);
832
+ var x1 = x * cosA - y * sinA;
833
+ var y1 = x * sinA + y * cosA;
834
+ var y2 = y1 * cosX - z * sinX;
835
+ var z2 = y1 * sinX + z * cosX;
836
+ var depth = fov + z2;
837
+ if (depth < 0.25) depth = 0.25;
838
+ var s = size / depth;
839
+ return { x: cx + x1 * s, y: cy + y2 * s, depth: depth };
840
+ }
841
+
842
+ var points = [];
843
+ for (var u = 0; u <= TORUS_U; u += 1) {
844
+ var theta = (u / TORUS_U) * Math.PI * 2;
845
+ var row = [];
846
+ for (var v = 0; v <= TORUS_V; v += 1) {
847
+ row.push(project(theta, (v / TORUS_V) * Math.PI * 2));
848
+ }
849
+ points.push(row);
850
+ }
851
+
852
+ // depth range for alpha normalisation
853
+ var minD = Infinity, maxD = 0;
854
+ for (var i = 0; i < points.length; i += 1) {
855
+ for (var j = 0; j < points[i].length; j += 1) {
856
+ var d = points[i][j].depth;
857
+ if (d < minD) minD = d;
858
+ if (d > maxD) maxD = d;
859
+ }
860
+ }
861
+ var span = Math.max(0.001, maxD - minD);
862
+
863
+ function strokeLine(a, b) {
864
+ var depth = (a.depth + b.depth) / 2;
865
+ var near = 1 - (depth - minD) / span;
866
+ var alpha = theme.grid * (0.35 + near * 0.9);
867
+ ctx.strokeStyle = "rgba(" + theme.ink + "," + alpha.toFixed(3) + ")";
868
+ ctx.lineWidth = 0.5 + near * 0.9;
869
+ ctx.beginPath();
870
+ ctx.moveTo(a.x, a.y);
871
+ ctx.lineTo(b.x, b.y);
872
+ ctx.stroke();
873
+ }
874
+
875
+ // longitude lines (along theta)
876
+ for (var vIdx = 0; vIdx <= TORUS_V; vIdx += 1) {
877
+ for (var uIdx = 0; uIdx < TORUS_U; uIdx += 1) {
878
+ strokeLine(points[uIdx][vIdx], points[uIdx + 1][vIdx]);
879
+ }
880
+ }
881
+ // latitude lines (along phi)
882
+ for (var uL = 0; uL <= TORUS_U; uL += 2) {
883
+ for (var vL = 0; vL < TORUS_V; vL += 1) {
884
+ strokeLine(points[uL][vL], points[uL][vL + 1]);
885
+ }
886
+ }
887
+
888
+ // highlight the selected turn as a saturated band of tubes
889
+ if (torusTurns && torusTurns.length && torusSelected >= 0) {
890
+ var share = (torusSelected / torusTurns.length) * Math.PI * 2;
891
+ var center = Math.round((share / (Math.PI * 2)) * TORUS_U);
892
+ ctx.strokeStyle = "rgba(" + theme.accent + ",0.9)";
893
+ ctx.lineWidth = 1.8;
894
+ for (var band = 0; band < 2; band += 1) {
895
+ var uBand = ((center + band) % TORUS_U + TORUS_U) % TORUS_U;
896
+ for (var hv = 0; hv < TORUS_V; hv += 1) {
897
+ var a = points[uBand][hv];
898
+ var b = points[uBand][hv + 1];
899
+ ctx.beginPath();
900
+ ctx.moveTo(a.x, a.y);
901
+ ctx.lineTo(b.x, b.y);
902
+ ctx.stroke();
903
+ }
904
+ }
905
+ }
906
+
907
+ var meta = torusEl && torusEl.querySelector('[data-hm="torus-meta"]');
908
+ if (meta && torusTurns) {
909
+ var current = torusTurns[torusSelected] || null;
910
+ var text = torusTurns.length + " 回合 · T-" + String(current ? current.n : 0);
911
+ if (meta.textContent !== text) meta.textContent = text;
912
+ }
913
+ }
914
+
915
+ function torusLoop(ts) {
916
+ var reduce = false;
917
+ try { reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches; } catch (_) {}
918
+ if (!reduce) {
919
+ var dt = torusSpunAt ? Math.min(64, ts - torusSpunAt) : 16;
920
+ torusSpunAt = ts;
921
+ torusAngle += (torusAngularSpeed * dt) / 1000;
922
+ }
923
+ torusDraw(ts);
924
+ torusRaf = window.requestAnimationFrame(torusLoop);
925
+ }
926
+
927
+ function ensureTorus() {
928
+ if (Date.now() < torusBusyUntil) return;
929
+ var host = torusHostElement();
930
+ if (!host) {
931
+ if (torusEl) torusEl.hidden = true;
932
+ return;
933
+ }
934
+ torusBusyUntil = Date.now() + 60;
935
+ if (!torusEl) {
936
+ torusEl = torusBuild();
937
+ torusCanvas = torusEl.querySelector("canvas");
938
+ }
939
+ if (torusEl.parentElement !== host) {
940
+ try {
941
+ host.style.position = "relative";
942
+ host.style.minHeight = "150px";
943
+ host.style.marginBottom = "8px";
944
+ host.appendChild(torusEl);
945
+ } catch (_) { return; }
946
+ }
947
+ torusHost = host;
948
+ torusEl.hidden = false;
949
+ torusResize();
950
+ if (!torusRaf) torusLoop(0);
951
+ }
952
+
953
+ function fetchTorusTurns() {
954
+ if (typeof window.fetch !== "function") return;
955
+ window.fetch("/api/heimdall/turns", { cache: "no-store" })
956
+ .then(function (response) { return response.ok ? response.json() : null; })
957
+ .then(function (data) {
958
+ if (!data || !data.turns || !data.turns.length) return;
959
+ torusTurns = data.turns;
960
+ if (torusSelected < 0 || torusSelected >= torusTurns.length) torusSelected = torusTurns.length - 1;
961
+ ensureTorus();
962
+ }, function () {});
963
+ }
964
+
965
+ doc.addEventListener("wheel", function (event) {
966
+ var target = event.target;
967
+ if (!target || !target.closest || !target.closest("#hm-torus")) return;
968
+ event.preventDefault();
969
+ if (!torusTurns || !torusTurns.length) return;
970
+ torusSelected = Math.min(torusTurns.length - 1, Math.max(0, torusSelected + (event.deltaY > 0 ? 1 : -1)));
971
+ torusAngularSpeed = 3.2;
972
+ setTimeout(function () { torusAngularSpeed = 0.45; }, 320);
973
+ }, { passive: false, capture: true });
974
+
718
975
  /* ------------------------------------------------------------------ tick */
719
976
  var pending = 0;
720
977
  function tick() {
@@ -730,6 +987,7 @@
730
987
  authCodes();
731
988
  rewriteErrors();
732
989
  syncModelNames();
990
+ ensureTorus();
733
991
  } catch (_) {}
734
992
  }, 400);
735
993
  }
@@ -744,6 +1002,7 @@
744
1002
  syncModelNames();
745
1003
  trackUpdate();
746
1004
  fetchStatus();
1005
+ fetchTorusTurns();
747
1006
  } catch (_) {}
748
1007
  // The meter re-renders on every turn: poll it rather than trust a one-shot read.
749
1008
  setInterval(function () {
@@ -752,6 +1011,9 @@
752
1011
  setInterval(function () {
753
1012
  try { fetchStatus(); } catch (_) {}
754
1013
  }, 60000);
1014
+ setInterval(function () {
1015
+ try { fetchTorusTurns(); } catch (_) {}
1016
+ }, 30000);
755
1017
  // Execution state changes without a DOM mutation on our own subtree.
756
1018
  setInterval(function () {
757
1019
  try { frameHud(); } catch (_) {}
package/lib/client.js CHANGED
@@ -248,6 +248,7 @@ window.__ModuleLoader__.load({
248
248
  try { window.dispatchEvent(new CustomEvent('heimdall-plugin-disabled')); } catch (_) {}
249
249
  };
250
250
  }, 'snowbreak-heimdall: post-load startup animation');
251
+
251
252
  }
252
253
 
253
254
  return { inject: ['slots'], apply };
package/lib/index.js CHANGED
@@ -12,13 +12,14 @@ import os from 'node:os';
12
12
  import path from 'node:path';
13
13
  import { createHash } from 'node:crypto';
14
14
  import { createRequire } from 'node:module';
15
+ import { readTurns } from './turns.js';
15
16
  import { spawn } from 'node:child_process';
16
17
  import { fileURLToPath } from 'node:url';
17
18
 
18
19
  const requireFromHere = createRequire(import.meta.url);
19
20
 
20
21
  const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
21
- const VERSION = '3.8.6';
22
+ const VERSION = '3.9.8';
22
23
  let restartPrompted = false;
23
24
  const INSTALL = path.join(process.env.LOCALAPPDATA || '', 'Programs', 'DeepSeek Harness');
24
25
  const DEFAULT_RESOURCES = process.env.HEIMDALL_RESOURCES
@@ -129,6 +130,10 @@ function buildStatus() {
129
130
  hashError,
130
131
  report: state.report || null,
131
132
  warnings: Array.isArray(state.warnings) ? state.warnings : [],
133
+ failure: state.failure || null,
134
+ pythonRuntime: fs.existsSync(path.join(RUNTIME, 'python', 'pythonw.exe'))
135
+ ? path.join(RUNTIME, 'python')
136
+ : findPythonSource(),
132
137
  checkedAt: new Date().toISOString(),
133
138
  };
134
139
  }
@@ -150,6 +155,68 @@ function warmStatus() {
150
155
  statusSnapshot().catch(() => { /* warmed best effort */ });
151
156
  }
152
157
 
158
+ const SESSIONS_ROOT = path.join(process.env.DSH_HOME || path.join(os.homedir(), '.dsh'), 'sessions');
159
+ const turnsCache = new Map();
160
+
161
+ function sessionLogPath(sessionId) {
162
+ let newest = null;
163
+ let buckets = [];
164
+ try {
165
+ buckets = fs.readdirSync(SESSIONS_ROOT, { withFileTypes: true }).filter((e) => e.isDirectory());
166
+ } catch (_) {
167
+ return null;
168
+ }
169
+ for (const bucket of buckets) {
170
+ const bucketPath = path.join(SESSIONS_ROOT, bucket.name);
171
+ let entries = [];
172
+ try {
173
+ entries = fs.readdirSync(bucketPath, { withFileTypes: true }).filter((e) => e.isDirectory());
174
+ } catch (_) {
175
+ continue;
176
+ }
177
+ for (const entry of entries) {
178
+ if (!entry.name.startsWith('session-')) continue;
179
+ const candidate = path.join(bucketPath, entry.name, 'session.v4.jsonl.zstd');
180
+ try {
181
+ if (!fs.existsSync(candidate)) continue;
182
+ if (sessionId && !entry.name.slice('session-'.length).startsWith(sessionId.replace(/^session-/, ''))) continue;
183
+ const stat = fs.statSync(candidate);
184
+ if (!newest || stat.mtimeMs > newest.mtime) newest = { file: candidate, mtime: stat.mtimeMs, size: stat.size };
185
+ } catch (_) { /* skip unreadable entry */ }
186
+ }
187
+ }
188
+ return newest;
189
+ }
190
+
191
+ function handleTurns(req, res) {
192
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
193
+ sendJson(res, 405, { error: 'method not allowed' });
194
+ return;
195
+ }
196
+ let sessionId = '';
197
+ try {
198
+ const url = new URL(String(req.url || '/'), 'http://localhost');
199
+ sessionId = url.searchParams.get('session') || '';
200
+ } catch (_) { sessionId = ''; }
201
+ const found = sessionLogPath(sessionId);
202
+ if (!found) {
203
+ sendJson(res, 404, { error: 'session log not found' });
204
+ return;
205
+ }
206
+ try {
207
+ const key = found.file + ':' + found.mtime + ':' + found.size;
208
+ let data = turnsCache.get(key);
209
+ if (!data) {
210
+ data = readTurns(found.file);
211
+ if (turnsCache.size > 8) turnsCache.clear();
212
+ turnsCache.set(key, data);
213
+ }
214
+ sendJson(res, 200, { file: found.file, title: data.title, turns: data.turns, totals: data.totals });
215
+ } catch (error) {
216
+ sendJson(res, 500, { error: String(error && error.message ? error.message : error) });
217
+ }
218
+ }
219
+
153
220
  function sendJson(res, code, payload) {
154
221
  try {
155
222
  res.writeHead(code, {
@@ -211,7 +278,8 @@ function registerRoutes(ctx) {
211
278
  const disposers = [
212
279
  server.register({ kind: 'exact', path: '/api/heimdall/status', handler: handleStatus }),
213
280
  server.register({ kind: 'exact', path: '/api/heimdall/apply', handler: handleApply }),
214
- server.register({ kind: 'exact', path: '/api/heimdall/restore', handler: handleRestore }),
281
+ server.register({ kind: 'exact', path: '/api/heimdall/turns', handler: handleTurns }),
282
+ server.register({ kind: 'exact', path: '/api/heimdall/restore', handler: handleRestore }),
215
283
  ];
216
284
  routesRegistered = true;
217
285
  log('terminal status route registered');
@@ -282,9 +350,39 @@ function copyTree(source, destination, filter) {
282
350
  }
283
351
  }
284
352
 
285
- function findPythonSource() {
353
+ // The desktop installer always carries a primary runtime payload under
354
+ // resources\*. The copy in the DSH home only appears after the SDK python tool
355
+ // has run once, so a fresh machine has the packaged payload and nothing else.
356
+ export function pythonSources(resources = RESOURCES) {
286
357
  const home = process.env.DSH_HOME || path.join(os.homedir(), '.dsh');
287
- return path.join(home, 'dsh-runtimes', 'dsh-primary-runtime', 'dependencies', 'python');
358
+ const list = [];
359
+ const push = (dir) => {
360
+ if (!dir) return;
361
+ const normalized = path.normalize(dir);
362
+ if (!list.includes(normalized)) list.push(normalized);
363
+ };
364
+ const override = process.env.DSH_PRIMARY_RUNTIME;
365
+ if (override) {
366
+ push(path.join(override, 'dependencies', 'python'));
367
+ push(path.join(override, 'python'));
368
+ }
369
+ for (const root of [path.join(resources, 'runtime'), path.join(resources, 'primary-runtime')]) {
370
+ try {
371
+ for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
372
+ if (entry.isDirectory()) push(path.join(root, entry.name, 'dependencies', 'python'));
373
+ }
374
+ } catch (_) { /* this build ships the payload elsewhere */ }
375
+ push(path.join(root, 'dependencies', 'python'));
376
+ }
377
+ push(path.join(home, 'dsh-runtimes', 'dsh-primary-runtime', 'dependencies', 'python'));
378
+ return list;
379
+ }
380
+
381
+ function findPythonSource() {
382
+ for (const candidate of pythonSources()) {
383
+ if (fs.existsSync(path.join(candidate, 'pythonw.exe'))) return candidate;
384
+ }
385
+ return null;
288
386
  }
289
387
 
290
388
  function ensurePython() {
@@ -292,10 +390,11 @@ function ensurePython() {
292
390
  const pythonw = path.join(dest, 'pythonw.exe');
293
391
  if (fs.existsSync(pythonw)) return pythonw;
294
392
  const source = findPythonSource();
295
- if (!fs.existsSync(path.join(source, 'pythonw.exe'))) {
296
- log('bundled python runtime unavailable');
393
+ if (!source) {
394
+ log('bundled python runtime unavailable; looked in: ' + pythonSources().join(' | '));
297
395
  return null;
298
396
  }
397
+ log('staging python runtime from ' + source);
299
398
  fs.mkdirSync(dest, { recursive: true });
300
399
  for (const name of fs.readdirSync(source)) {
301
400
  if (!/^(python|pythonw|python3|python312|vcruntime.*)\.(exe|dll)$/i.test(name)) continue;
@@ -369,6 +468,47 @@ function writeRecovery(pythonw) {
369
468
  }
370
469
  }
371
470
 
471
+ // A silent failure is the worst outcome: the plugin is installed, the user
472
+ // restarts, and the window looks exactly the same. Say it out loud instead.
473
+ function reportSetupFailure(error) {
474
+ try {
475
+ const marker = path.join(STATE_DIR, 'setup-failed.pid');
476
+ if (fs.existsSync(marker) && fs.readFileSync(marker, 'utf8').trim() === String(process.pid)) return;
477
+ fs.mkdirSync(STATE_DIR, { recursive: true });
478
+ fs.writeFileSync(marker, String(process.pid), 'utf8');
479
+ writeState({ failure: String((error && error.message) || error || 'unknown') });
480
+ const state = readState();
481
+ const patched = state.status === 'patched';
482
+ const text = [
483
+ patched ? '源码层还在,但这次同步没有启动。' : '源码层没有写入,界面不会有任何变化。',
484
+ '',
485
+ '原因:' + String((error && error.message) || error || 'unknown'),
486
+ '',
487
+ '这台机器上查过的运行时路径:',
488
+ pythonSources().join('\r\n'),
489
+ '',
490
+ '日志:' + LOG,
491
+ '',
492
+ '把 host.log 发给作者即可定位。',
493
+ ].join('\r\n');
494
+ const script = 'Add-Type -AssemblyName PresentationFramework; '
495
+ + '[System.Windows.MessageBox]::Show(' + psQuote(text)
496
+ + ", '海姆达尔终端 // 源码层接入失败', 'OK', 'Warning') | Out-Null";
497
+ const encoded = Buffer.from(script, 'utf16le').toString('base64');
498
+ const powershell = path.join(
499
+ process.env.SystemRoot || 'C:\\Windows',
500
+ 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe',
501
+ );
502
+ const child = spawn(powershell, [
503
+ '-NoProfile', '-STA', '-WindowStyle', 'Hidden', '-EncodedCommand', encoded,
504
+ ], { detached: true, stdio: 'ignore', windowsHide: true });
505
+ child.unref();
506
+ log('setup failure reported to the user');
507
+ } catch (failure) {
508
+ log('setup failure dialog failed: ' + failure.message);
509
+ }
510
+ }
511
+
372
512
  function arm(autoRestart = false) {
373
513
  try {
374
514
  const pythonw = stageRuntime();
@@ -416,8 +556,10 @@ function arm(autoRestart = false) {
416
556
  });
417
557
  child.unref();
418
558
  log('one-shot source helper armed');
559
+ writeState({ failure: null });
419
560
  } catch (error) {
420
561
  log('arm failed: ' + error.message);
562
+ reportSetupFailure(error);
421
563
  }
422
564
  }
423
565
 
@@ -529,6 +671,12 @@ function writeRestartScript() {
529
671
  const appExe = path.join(path.dirname(RESOURCES), 'DeepSeek Harness.exe');
530
672
  const script = [
531
673
  "$ErrorActionPreference = 'SilentlyContinue'",
674
+ '$statePath = ' + psQuote(statePath),
675
+ // Snapshot the state timestamp first: a reapply leaves an old "patched"
676
+ // document behind, so waiting for the word alone relaunches DSH in the
677
+ // middle of the restore/apply pass.
678
+ '$marker = 0',
679
+ 'if (Test-Path -LiteralPath $statePath) { $marker = (Get-Item -LiteralPath $statePath).LastWriteTimeUtc.Ticks }',
532
680
  'Start-Sleep -Seconds 3',
533
681
  "$name = 'DeepSeek Harness'",
534
682
  '$procs = Get-Process -Name $name',
@@ -538,21 +686,22 @@ function writeRestartScript() {
538
686
  'if ($procs) { $procs | Stop-Process -Force }',
539
687
  '$deadline = (Get-Date).AddSeconds(180)',
540
688
  'while ((Get-Date) -lt $deadline) {',
541
- ' Start-Sleep -Seconds 2',
542
- ' if (Test-Path -LiteralPath ' + psQuote(statePath) + ') {',
689
+ ' Start-Sleep -Seconds 1',
690
+ ' if (Test-Path -LiteralPath $statePath) {',
543
691
  ' try {',
544
- ' $s = Get-Content -LiteralPath ' + psQuote(statePath) + ' -Raw | ConvertFrom-Json',
545
- " if ($s.status -eq 'patched') { break }",
692
+ ' $ticks = (Get-Item -LiteralPath $statePath).LastWriteTimeUtc.Ticks',
693
+ ' $s = Get-Content -LiteralPath $statePath -Raw | ConvertFrom-Json',
694
+ ' if ($ticks -gt $marker -and -not ($s.reapply -eq $true) -and ($s.status -eq ' + psQuote('patched')
695
+ + ' -or $s.status -eq ' + psQuote('original') + ')) { break }',
546
696
  ' } catch {}',
547
697
  ' }',
548
698
  '}',
549
- 'Start-Sleep -Seconds 2',
699
+ 'Start-Sleep -Seconds 3',
550
700
  'if (-not (Get-Process -Name $name)) { Start-Process -FilePath ' + psQuote(appExe) + ' }',
551
701
  '',
552
702
  ].join('\r\n');
553
- const file = path.join(STATE_DIR, 'restart-dsh.ps1');
554
- fs.writeFileSync(file, '\ufeff' + script, 'utf8');
555
- return file;
703
+ fs.writeFileSync(path.join(STATE_DIR, 'restart-dsh.ps1'), '\ufeff' + script, 'utf8');
704
+ return path.join(STATE_DIR, 'restart-dsh.ps1');
556
705
  } catch (error) {
557
706
  log('auto restart script failed: ' + error.message);
558
707
  return null;
@@ -618,6 +767,33 @@ function askRestartConfirmation(restartScript, mode = 'apply') {
618
767
  }
619
768
  }
620
769
 
770
+ // A DSH auto-update replaces app.asar under the skin. The plugin still believes
771
+ // it is applied, so the user restarts, sees plain DSH and reports "nothing
772
+ // happened". Compare the archive once, after startup, and queue a rebuild.
773
+ function watchArchive() {
774
+ const timer = setTimeout(() => {
775
+ try {
776
+ const state = readState();
777
+ if (state.status !== 'patched') return;
778
+ if (!fs.existsSync(TARGET)) return;
779
+ const current = sha256File(TARGET);
780
+ if (current === state.patchedSha256) return;
781
+ if (current === state.originalSha256) {
782
+ log('archive is the pristine build again; skin is gone');
783
+ writeState({ status: 'original', warnings: ['官方 asar 已恢复(DSH 更新或手动还原)'] });
784
+ return;
785
+ }
786
+ log('archive changed underneath the skin; reapply queued');
787
+ writeState({ reapply: true });
788
+ arm(true);
789
+ askRestartConfirmation(writeRestartScript());
790
+ } catch (error) {
791
+ log('archive watch failed: ' + error.message);
792
+ }
793
+ }, 8000);
794
+ if (typeof timer.unref === 'function') timer.unref();
795
+ }
796
+
621
797
  export function apply(ctx) {
622
798
  try {
623
799
  fs.mkdirSync(STATE_DIR, { recursive: true });
@@ -640,6 +816,7 @@ export function apply(ctx) {
640
816
  arm(false);
641
817
  }
642
818
  registerRoutes(ctx);
819
+ watchArchive();
643
820
  if (ctx && typeof ctx.effect === 'function') {
644
821
  const loadedAt = Date.now();
645
822
  ctx.effect(() => () => {
@@ -668,5 +845,6 @@ export function apply(ctx) {
668
845
  }
669
846
  } catch (error) {
670
847
  log('apply failed: ' + error.message);
848
+ reportSetupFailure(error);
671
849
  }
672
850
  }
package/lib/turns.js ADDED
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Turn index for the "行动记录" conversation view.
3
+ *
4
+ * DSH appends one zstd frame per write to `session.v4.jsonl.zstd`, so the file
5
+ * is a concatenation of frames rather than a single stream. Splitting on the
6
+ * zstd magic and decoding each frame individually recovers the whole JSONL log.
7
+ */
8
+ import fs from 'node:fs';
9
+ import zlib from 'node:zlib';
10
+
11
+ const MAGIC = Buffer.from([0x28, 0xb5, 0x2f, 0xfd]);
12
+
13
+ /**
14
+ * Decode every zstd frame in a session log.
15
+ * @param {Buffer} buffer raw file contents
16
+ * @returns {string} concatenated UTF-8 JSONL text
17
+ */
18
+ export function decodeFrames(buffer) {
19
+ const offsets = [];
20
+ let at = 0;
21
+ for (;;) {
22
+ const hit = buffer.indexOf(MAGIC, at);
23
+ if (hit < 0) break;
24
+ offsets.push(hit);
25
+ at = hit + MAGIC.length;
26
+ }
27
+ if (offsets.length === 0) return '';
28
+ const parts = [];
29
+ for (let i = 0; i < offsets.length; i += 1) {
30
+ const start = offsets[i];
31
+ const end = i + 1 < offsets.length ? offsets[i + 1] : buffer.length;
32
+ try {
33
+ parts.push(zlib.zstdDecompressSync(buffer.subarray(start, end)));
34
+ } catch {
35
+ // A frame that the writer never finished: stop here rather than skip it.
36
+ break;
37
+ }
38
+ }
39
+ return Buffer.concat(parts).toString('utf8');
40
+ }
41
+
42
+ function textOf(content) {
43
+ if (!Array.isArray(content)) return '';
44
+ const out = [];
45
+ for (const part of content) {
46
+ if (part && part.type === 'text' && typeof part.text === 'string') out.push(part.text);
47
+ }
48
+ return out.join('\n').trim();
49
+ }
50
+
51
+ function firstLine(value, limit) {
52
+ const line = String(value || '').replace(/\s+/g, ' ').trim();
53
+ if (line.length <= limit) return line;
54
+ return line.slice(0, limit - 1) + '…';
55
+ }
56
+
57
+ /**
58
+ * Fold the log into one record per turn.
59
+ * @param {string} jsonl decoded log text
60
+ * @returns {{title: string, turns: Array<object>, totals: object}}
61
+ */
62
+ export function foldTurns(jsonl) {
63
+ const turns = new Map();
64
+ let title = '';
65
+ const order = [];
66
+
67
+ const get = (n) => {
68
+ let entry = turns.get(n);
69
+ if (!entry) {
70
+ entry = {
71
+ n, start: 0, end: 0, prompt: '', summary: '', tools: 0,
72
+ retries: 0, aborted: false, steps: 0,
73
+ };
74
+ turns.set(n, entry);
75
+ order.push(entry);
76
+ }
77
+ return entry;
78
+ };
79
+
80
+ for (const line of jsonl.split('\n')) {
81
+ if (!line) continue;
82
+ let event;
83
+ try {
84
+ event = JSON.parse(line);
85
+ } catch {
86
+ continue;
87
+ }
88
+ const type = event.type;
89
+ const data = event.data || {};
90
+ const time = typeof event.time === 'number' ? event.time : 0;
91
+
92
+ if (type === 'session/title' && typeof data.title === 'string' && data.title.trim()) {
93
+ title = data.title.trim();
94
+ continue;
95
+ }
96
+ if (type === 'turn/start' && Number.isInteger(data.turn)) {
97
+ const entry = get(data.turn);
98
+ entry.start = time;
99
+ continue;
100
+ }
101
+ if (type === 'turn/end' && Number.isInteger(data.turn)) {
102
+ const entry = get(data.turn);
103
+ entry.end = time;
104
+ const reason = data.reason || {};
105
+ if (reason.kind === 'aborted') entry.aborted = true;
106
+ continue;
107
+ }
108
+ if (type === 'user/message' && Number.isInteger(data.turn)) {
109
+ const entry = get(data.turn);
110
+ const source = data.source && data.source.kind;
111
+ const text = textOf(data.content);
112
+ if (!entry.prompt && text && (source === 'user' || source === 'user-approval')) {
113
+ entry.prompt = firstLine(text, 120);
114
+ }
115
+ continue;
116
+ }
117
+ if (type === 'assistant/message' && Number.isInteger(data.turn)) {
118
+ const entry = get(data.turn);
119
+ const text = textOf(data.message && data.message.content);
120
+ if (!entry.summary && text) entry.summary = firstLine(text, 96);
121
+ continue;
122
+ }
123
+ if (type === 'tool/call' && Number.isInteger(data.turn)) {
124
+ get(data.turn).tools += 1;
125
+ continue;
126
+ }
127
+ if (type === 'llm/retry' && Number.isInteger(data.turn)) {
128
+ get(data.turn).retries += 1;
129
+ }
130
+ }
131
+
132
+ const list = order
133
+ .filter((entry) => entry.start > 0)
134
+ .sort((a, b) => a.n - b.n)
135
+ .map((entry) => ({
136
+ n: entry.n,
137
+ start: entry.start,
138
+ durationMs: entry.end > entry.start ? entry.end - entry.start : 0,
139
+ tools: entry.tools,
140
+ retries: entry.retries,
141
+ aborted: entry.aborted,
142
+ prompt: entry.prompt,
143
+ summary: entry.summary,
144
+ }));
145
+
146
+ const totals = {
147
+ turns: list.length,
148
+ durationMs: list.reduce((sum, t) => sum + t.durationMs, 0),
149
+ tools: list.reduce((sum, t) => sum + t.tools, 0),
150
+ retries: list.reduce((sum, t) => sum + t.retries, 0),
151
+ aborted: list.filter((t) => t.aborted).length,
152
+ };
153
+ return { title, turns: list, totals };
154
+ }
155
+
156
+ /**
157
+ * Read and fold one session log.
158
+ * @param {string} file absolute path to session.v4.jsonl.zstd
159
+ * @returns {{title: string, turns: Array<object>, totals: object}}
160
+ */
161
+ export function readTurns(file) {
162
+ const buffer = fs.readFileSync(file);
163
+ return foldTurns(decodeFrames(buffer));
164
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-snowbreak-heimdall",
3
- "version": "3.8.6",
3
+ "version": "3.9.8",
4
4
  "description": "《尘白禁区》海姆达尔终端 / 世界树公司源码级皮肤:加载画面、双主题、菜单/侧栏/图标,插件仅在加载后播放启动动画。Windows / DSH 0.2.2-rc.x。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "files": [
23
23
  "lib/index.js",
24
+ "lib/turns.js",
24
25
  "lib/client.js",
25
26
  "cordis.patch.yml",
26
27
  "locale/*.json",