@sky_wing_dn/dsh-fairy-zzz 2.0.1 → 2.0.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.
package/README.en.md CHANGED
@@ -8,7 +8,7 @@ Boot animation → greeting → docked eye badge, plus a "Wire-Net Terminal" hos
8
8
 
9
9
  [中文](README.md) · [Changelog](docs/CHANGELOG.md) · [Technical notes](docs/TECHNICAL.md) · [Performance report](docs/PERFORMANCE.md)
10
10
 
11
- ![version](https://img.shields.io/badge/version-2.0.1-D8FA00?style=flat-square&labelColor=101110)
11
+ ![version](https://img.shields.io/badge/version-2.0.2-D8FA00?style=flat-square&labelColor=101110)
12
12
  [![npm](https://img.shields.io/npm/v/@sky_wing_dn%2Fdsh-fairy-zzz?style=flat-square&labelColor=101110&color=D8FA00)](https://www.npmjs.com/package/@sky_wing_dn/dsh-fairy-zzz)
13
13
  ![license](https://img.shields.io/badge/license-MIT-101110?style=flat-square)
14
14
  ![platform](https://img.shields.io/badge/DSH-Desktop%20%26%20Web-101110?style=flat-square)
@@ -32,7 +32,7 @@ It is not a pure theme pack. The plugin ships a small host half too: static asse
32
32
 
33
33
  **Zero runtime dependencies.** The host half only uses Node built-ins; the client half is a single hand-written ESM file with no bundler and no `node_modules`.
34
34
 
35
- **Self-update (since v2.0.0).** The plugin asks npm whether a newer version exists; a small 「可更新 / update available」 pill shows next to the Fairy wordmark in the sidebar, and one click on the confirmation popover installs it — refresh the page or restart DSH when prompted. This only works for copies installed from npm via `dsh plugin --profile <name> add ...`; a `link:` install pointing at a local folder has no registry source and never shows the button (edit the source and refresh the page instead). Failed updates explain the reason (network, unavailable or incompatible version, host refusing to replace a running plugin) and offer a re-check button; versions incompatible with the current DSH are skipped automatically.
35
+ **Self-update (since v2.0.0).** The plugin asks npm whether a newer version exists; a small 「可更新 / update available」 pill shows next to the Fairy wordmark in the sidebar, and one click on the confirmation popover installs it — refresh the page or restart DSH when prompted. This only works for copies installed from npm via `dsh plugin --profile <name> add ...`; a `link:` install pointing at a local folder has no registry source and never shows the button (edit the source and refresh the page instead). Failed updates explain the reason (network, unavailable or incompatible version, host refusing to replace a running plugin) and offer a re-check button; versions incompatible with the current DSH are skipped automatically. **2.0.2 fixes the chain itself** — in 2.0.0 / 2.0.1 the check never ran and the install always failed, so a machine on either version needs one manual install of 2.0.2 before the button can update it.
36
36
 
37
37
  ## Credits
38
38
 
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  [English](README.en.md) · [变更记录](docs/CHANGELOG.md) · [技术说明](docs/TECHNICAL.md) · [性能报告](docs/PERFORMANCE.md)
10
10
 
11
- ![version](https://img.shields.io/badge/version-2.0.1-D8FA00?style=flat-square&labelColor=101110)
11
+ ![version](https://img.shields.io/badge/version-2.0.2-D8FA00?style=flat-square&labelColor=101110)
12
12
  [![npm](https://img.shields.io/npm/v/@sky_wing_dn%2Fdsh-fairy-zzz?style=flat-square&labelColor=101110&color=D8FA00)](https://www.npmjs.com/package/@sky_wing_dn/dsh-fairy-zzz)
13
13
  ![license](https://img.shields.io/badge/license-MIT-101110?style=flat-square)
14
14
  ![platform](https://img.shields.io/badge/DSH-Desktop%20%26%20Web-101110?style=flat-square)
@@ -32,7 +32,7 @@ dsh plugin --profile desktop add @sky_wing_dn/dsh-fairy-zzz
32
32
 
33
33
  **运行时零依赖**:宿主半边只用 Node 内置模块,客户端半边是一份手写 ESM,不经过打包器,也不需要 `node_modules`。
34
34
 
35
- **自更新(v2.0.0 起)**:插件会自己问 npm 有没有新版本——侧栏 Fairy 字标右上出现「可更新」胶囊,点开确认就能装,装完按提示刷新页面或重启 DSH。只对 `dsh plugin --profile <name> add ...` 从 npm 装进来的插件生效;用 `link:` 指向本地目录的安装没有 registry 来源,不会显示这个按钮(改完源码照旧刷新页面即生效)。更新失败会说清原因(网络、版本不可用 / 与当前 DSH 不兼容、宿主正在使用等),可以点「重新检查」丢掉缓存重查;和当前 DSH 不兼容的新版本会被自动跳过。
35
+ **自更新(v2.0.0 起)**:插件会自己问 npm 有没有新版本——侧栏 Fairy 字标右上出现「可更新」胶囊,点开确认就能装,装完按提示刷新页面或重启 DSH。只对 `dsh plugin --profile <name> add ...` 从 npm 装进来的插件生效;用 `link:` 指向本地目录的安装没有 registry 来源,不会显示这个按钮(改完源码照旧刷新页面即生效)。更新失败会说清原因(网络、版本不可用 / 与当前 DSH 不兼容、宿主正在使用等),可以点「重新检查」丢掉缓存重查;和当前 DSH 不兼容的新版本会被自动跳过。**2.0.2 修好了这条链路本身**(2.0.0 / 2.0.1 的检查从未真正执行、安装也必然失败),装插件的那台机器需要手动装到 2.0.2 一次,之后才能用按钮更新。
36
36
 
37
37
  ## 来源与致谢
38
38
 
package/client.js CHANGED
@@ -448,6 +448,34 @@ window.__ModuleLoader__.load({
448
448
  }
449
449
  }
450
450
 
451
+ /* ————————————————————————————————————————————————————————————————
452
+ * v2.0.2:更新会把正在运行的插件「卸掉再装回来」,React 树随之重建,
453
+ * 浮层里的「安装完成 / 失败」在宿主 HMR 下会跟着消失(实测 2.0.0 → 2.0.1 时,
454
+ * 点完更新约 3 秒后浮层就没了,用户看不到结果)。
455
+ * 所以把这一次更新的上下文写进 localStorage:
456
+ * - 安装前写 phase:'running';
457
+ * - 拿到宿主结果后写 phase:'done'(application + 目标版本)或 phase:'error'(中文原因);
458
+ * - 重挂载(新版代码,或安装失败后回滚回来的旧版)读到就补一条结果浮层。
459
+ * 超过 30 分钟的旧记录直接丢弃,免得下次启动凭空弹出「刚更新完」。
460
+ * ———————————————————————————————————————————————————————————————— */
461
+ const UPDATE_RESUME_KEY = 'fairy.zzz.update.resume'
462
+ const UPDATE_RESUME_TTL = 30 * 60 * 1000
463
+
464
+ function writeUpdateResume(payload) {
465
+ try { writeStored(UPDATE_RESUME_KEY, payload) } catch (e) {}
466
+ }
467
+
468
+ function readUpdateResume() {
469
+ const raw = readStored(UPDATE_RESUME_KEY, null)
470
+ if (!raw || typeof raw !== 'object') return null
471
+ if (!Number.isFinite(raw.at) || Date.now() - raw.at > UPDATE_RESUME_TTL) return null
472
+ return raw
473
+ }
474
+
475
+ function clearUpdateResume() {
476
+ try { localStorage.removeItem(UPDATE_RESUME_KEY) } catch (e) {}
477
+ }
478
+
451
479
  function rememberUpdate(info) {
452
480
  updateCache.info = info
453
481
  updateCache.at = info.at
@@ -473,6 +501,22 @@ window.__ModuleLoader__.load({
473
501
  })
474
502
  }
475
503
 
504
+ /* 宿主把插件管理服务挂在 remote 命名空间上(服务名 remote.pluginManager)。
505
+ v2.0.2 修复:2.0.0/2.0.1 只 inject 了 remote.account,访问 ctx.remote.pluginManager
506
+ 时 cordis 会抛 `cannot get property "remote.pluginManager" without inject`,
507
+ 结果检查永远静默失败、胶囊从来不出现。这里除了补 inject,也做一层兜底。 */
508
+ function pluginManagerOf(ctx) {
509
+ try {
510
+ const direct = ctx && ctx.remote && ctx.remote.pluginManager
511
+ if (direct) return direct
512
+ } catch (e) {}
513
+ try {
514
+ return (ctx && ctx['remote.pluginManager']) || null
515
+ } catch (e) {
516
+ return null
517
+ }
518
+ }
519
+
476
520
  function checkPluginUpdate(force) {
477
521
  const debug = readUpdateDebug()
478
522
  if (debug) return Promise.resolve(debug)
@@ -488,7 +532,7 @@ window.__ModuleLoader__.load({
488
532
  }
489
533
  if (updateCache.promise) return updateCache.promise
490
534
  const ctx = runtime.ctx
491
- const manager = ctx && ctx.remote && ctx.remote.pluginManager
535
+ const manager = pluginManagerOf(ctx)
492
536
  if (!manager || typeof manager.listVersions !== 'function') return Promise.resolve(null)
493
537
  updateCache.promise = Promise.resolve()
494
538
  .then(() => manager.listVersions(PKG, {}))
@@ -3198,6 +3242,40 @@ html[data-fz3-theme="light"] [class*="_shortcut_"] [class*="_key"]{color:rgba(16
3198
3242
  }
3199
3243
  }, [phase])
3200
3244
 
3245
+ /* v2.0.2:安装期间插件会被卸载,浮层跟着消失 —— 挂载后读一次落盘的结果,
3246
+ 补一条「安装完成 / 失败」浮层。还在安装中(phase:'running')就隔几秒再看,
3247
+ 等宿主的最终结果或回滚后旧代码写下的错误原因。 */
3248
+ useEffect(() => {
3249
+ let alive = true
3250
+ let done = false
3251
+ let timers = []
3252
+ const tryApply = () => {
3253
+ if (!alive || done) return true
3254
+ const resume = readUpdateResume()
3255
+ if (!resume) return true
3256
+ if (resume.phase === 'running') return false
3257
+ done = true
3258
+ clearUpdateResume()
3259
+ setUpdateInfo({ installed: resume.from || '', latest: resume.to || '', resume: true })
3260
+ if (resume.phase === 'error') {
3261
+ setUpdateRun({ phase: 'error', cancelled: !!resume.cancelled, message: resume.message || '更新没有完成,请重试一次。' })
3262
+ } else {
3263
+ setUpdateRun({ phase: 'done', applied: resume.application === 'applied', restart: resume.application === 'restart-required', to: resume.to || '' })
3264
+ }
3265
+ setUpdateOpen(true)
3266
+ return true
3267
+ }
3268
+ if (!tryApply()) {
3269
+ timers = [800, 2000, 4000, 8000, 15000].map((ms) => setTimeout(() => {
3270
+ if (tryApply()) timers.forEach(clearTimeout)
3271
+ }, ms))
3272
+ }
3273
+ return () => {
3274
+ alive = false
3275
+ timers.forEach(clearTimeout)
3276
+ }
3277
+ }, [])
3278
+
3201
3279
  /* 浮层打开时订阅宿主的安装进度:requestId 对得上才认(可能同时有别的东西在装) */
3202
3280
  useEffect(() => {
3203
3281
  if (!updateOpen) return undefined
@@ -3244,21 +3322,36 @@ html[data-fz3-theme="light"] [class*="_shortcut_"] [class*="_key"]{color:rgba(16
3244
3322
  return
3245
3323
  }
3246
3324
  const ctx = runtime.ctx
3247
- const manager = ctx && ctx.remote && ctx.remote.pluginManager
3325
+ const manager = pluginManagerOf(ctx)
3248
3326
  if (!manager || typeof manager.updateBundle !== 'function') {
3249
3327
  return setUpdateRun({ phase: 'error', message: '宿主没有提供插件更新接口,请在 DSH 桌面端里重试。' })
3250
3328
  }
3329
+ /* v2.0.2:安装期间插件会被卸载,这个组件(连同浮层)随时可能消失;
3330
+ 先把上下文落盘,重挂载后由下面的 effect 补上结果。 */
3331
+ const resumeBase = { at: Date.now(), from: info.installed || '', to: info.latest, requestId }
3332
+ writeUpdateResume({ ...resumeBase, phase: 'running' })
3251
3333
  let answer
3252
3334
  try {
3253
- answer = await manager.updateBundle(PKG, info.latest, { registry: info.registry, requestId })
3335
+ /* v2.0.2:registry 不能传空串 —— 宿主会把任何 string 当 URL 正规化,
3336
+ 空串直接抛 "a registry must be an http(s) URL:"(gateway/internal)。
3337
+ 只有查询确实报告了自定义 registry 时才带上,否则让宿主用默认配置。 */
3338
+ const opts = { requestId }
3339
+ if (info.registry) opts.registry = info.registry
3340
+ answer = await manager.updateBundle(PKG, info.latest, opts)
3254
3341
  } catch (cause) {
3255
- return setUpdateRun({ phase: 'error', message: '调用更新接口失败:' + clipText(cause && cause.message ? cause.message : cause, 140) })
3342
+ const message = '调用更新接口失败:' + clipText(cause && cause.message ? cause.message : cause, 140)
3343
+ writeUpdateResume({ ...resumeBase, at: Date.now(), phase: 'error', message })
3344
+ return setUpdateRun({ phase: 'error', message })
3256
3345
  }
3257
3346
  if (!answer) {
3258
- return setUpdateRun({ phase: 'error', message: '宿主没有返回更新结果,请重试一次。' })
3347
+ const message = '宿主没有返回更新结果,请重试一次。'
3348
+ writeUpdateResume({ ...resumeBase, at: Date.now(), phase: 'error', message })
3349
+ return setUpdateRun({ phase: 'error', message })
3259
3350
  }
3260
3351
  if (answer.ok === false) {
3261
- return setUpdateRun({ phase: 'error', message: updateFailureMessage({ result: { error: answer.error } }) })
3352
+ const message = updateFailureMessage({ result: { error: answer.error } })
3353
+ writeUpdateResume({ ...resumeBase, at: Date.now(), phase: 'error', message })
3354
+ return setUpdateRun({ phase: 'error', message })
3262
3355
  }
3263
3356
  const value = answer.value || {}
3264
3357
  const result = value.result || {}
@@ -3268,12 +3361,13 @@ html[data-fz3-theme="light"] [class*="_shortcut_"] [class*="_key"]{color:rgba(16
3268
3361
  try { localStorage.removeItem(UPDATE_KEY) } catch (e) {}
3269
3362
  updateCache.info = null
3270
3363
  updateCache.at = 0
3364
+ writeUpdateResume({ ...resumeBase, at: Date.now(), to, phase: 'done', application: result.application })
3271
3365
  return setUpdateRun({ phase: 'done', applied: result.application === 'applied', restart: result.application === 'restart-required', to })
3272
3366
  }
3273
- if (result.application === 'cancelled') {
3274
- return setUpdateRun({ phase: 'error', cancelled: true, message: '更新被取消,当前版本没有变化。' })
3275
- }
3276
- return setUpdateRun({ phase: 'error', message: updateFailureMessage(value) })
3367
+ const message = result.application === 'cancelled' ? '更新被取消,当前版本没有变化。' : updateFailureMessage(value)
3368
+ writeUpdateResume({ ...resumeBase, at: Date.now(), phase: 'error', cancelled: result.application === 'cancelled', message })
3369
+ if (result.application === 'cancelled') return setUpdateRun({ phase: 'error', cancelled: true, message })
3370
+ return setUpdateRun({ phase: 'error', message })
3277
3371
  }, [updateInfo, updateRun])
3278
3372
 
3279
3373
  /* v2.0.1:失败后「重新检查」—— 丢掉缓存(含内存里的)再问一次 registry */
@@ -4154,7 +4248,11 @@ html[data-fz3-theme="light"] [class*="_shortcut_"] [class*="_key"]{color:rgba(16
4154
4248
  run: updateRun,
4155
4249
  onUpdate: runPluginUpdate,
4156
4250
  onRecheck: recheckPluginUpdate,
4157
- onClose: () => setUpdateOpen(false),
4251
+ onClose: () => {
4252
+ /* 关掉浮层就把「待补结果」清掉,免得下次重挂载又弹一遍 */
4253
+ if (!(updateRun && updateRun.phase === 'running')) clearUpdateResume()
4254
+ setUpdateOpen(false)
4255
+ },
4158
4256
  })
4159
4257
  : null,
4160
4258
 
@@ -4182,7 +4280,7 @@ html[data-fz3-theme="light"] [class*="_shortcut_"] [class*="_key"]{color:rgba(16
4182
4280
  * 挂载
4183
4281
  * ------------------------------------------------------------------ */
4184
4282
  return {
4185
- inject: ['slots', 'locale', 'theme', 'remote', 'remote.account'],
4283
+ inject: ['slots', 'locale', 'theme', 'remote', 'remote.account', 'remote.pluginManager'],
4186
4284
  apply(ctx) {
4187
4285
  /* 账户余额等接口要经过 ctx 上的远程服务,气泡里用 runtime.ctx 取 */
4188
4286
  runtime.ctx = ctx
package/docs/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@
4
4
 
5
5
  格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。记录原则:小改动一行带过,大版本 / 大功能才展开。
6
6
 
7
+ ## [2.0.2] — 2026-11-08
8
+
9
+ ### 修复
10
+
11
+ - **自更新从来没生效(检查永远静默失败)**:插件 `apply` 的 inject 少声明 `remote.pluginManager`,取 manager 时 cordis 直接抛 `cannot get property "remote.pluginManager" without inject`,异常被外层吞成「没有新版本」。2.0.0 / 2.0.1 的「可更新」胶囊因此从未出现过;现在补上 inject 并加兜底取值。
12
+ - **点「更新」必失败**:`updateBundle` 把查询结果里的空 registry 原样传给宿主,被 `normalizeRegistry` 当 URL 拒绝(`gateway/internal`)。现在只有非空才传。
13
+ - **装完看不到结果**:宿主 HMR 会先卸载旧版再装新版,插件界面连同结果浮层一起消失。现在安装上下文写入 `localStorage`,新版本挂载后补出「安装完成 / 更新失败」(30 分钟内有效)。
14
+
15
+ ### 变更
16
+
17
+ - 版本号 2.0.1 → 2.0.2。
18
+
7
19
  ## [2.0.1] — 2026-11-08
8
20
 
9
21
  ### 修复
package/docs/TECHNICAL.md CHANGED
@@ -1,7 +1,7 @@
1
- # dsh-fairy-zzz 插件技术说明(v2.0.1)
1
+ # dsh-fairy-zzz 插件技术说明(v2.0.2)
2
2
 
3
3
  > 目标读者:**没有参与过本项目、但要继续维护或修改这个插件的人 / AI 智能体**。读完这篇文档,应该能独立定位代码、改功能、打版本、发布到 GitHub,并复现验证。
4
- > 最后更新:2026-11-08,对应版本 v2.0.1。v2.0.1 修更新失败的提示(宿主只回 `error.code`,现在翻成中文、分三步、带上回滚结果)并在查询阶段跳过与当前 DSH 不兼容的新版本,见 §22.6。v2.0.0 新增插件自更新(§22:查 npm 版本 + 走宿主 `pluginManager.updateBundle` 安装;`link:` 安装不可更新),并修账户菜单快捷键的对比度(根因是 skin 里 kbd 选择器漏写容器前缀,见 §22.4)。v1.7.4–v1.7.6 的完整改动见 README 的中英版本段落,本节只留结构性的几条(§19 顶部两条)。v1.7.6 把眼徽呼吸拆成五层(巩膜 / 虹膜外圈 / 虹膜 / 瞳仁 / 高光各自幅度与相位,周期 1.4s),思考态眼皮随同一相位开合;上一轮基线 v1.7.3(v1.7.3 修底部状态栏透字:composer 座位渐变的终点改为不透明画布色;并把只被覆盖层子树消费的 `--fz3-dock-*` / `--fz3-brand-*` 从 `:root` 改写到 `.fz3-layer`、hero 标题同步改挂载 / 卸载事件、dock 测量改锚点退避重试、dock 相氛围层降为普通合成——4K 下打开 21k 字大会话 style 637→567 ms、long task 1254→1140 ms,见 §21.9;v1.7.2 修 v1.7.1 遗留的两处选中态边线伪影:侧栏 active 胶囊左端青柠月牙、顶栏 active tab 下缘青柠下划线,见 §21.8;v1.7.1 修 v1.7.0 皮肤期的 6 类用户回归:删 boot 左上 `// H.D.D. NORTH SEEK DATA SYSTEM`;问候 kicker / 中文标题回 Fairy 冰蓝;禁用插件后 `--dsw-*` token 残留改为自己挂 `ctx.effect` 释放 `overrideTokens` 的 disposer;重启用插件不再重播开机动画(`bootPlayed` 存到 `window`);设置弹窗几何恢复宿主默认、皮肤只换色;附件缩略图焦点环由外扩改内嵌、重绘移除按钮。v1.7.0 新增「绳网终端」宿主皮肤层,见 §21。此前:v1.6.2 删掉设置页「外观三档」,皮肤始终自动跟随宿主深浅色;「试听问候」改为每次点击都从本时段 5 条语音里重新随机抽一条并显示台词,不再复用开机抽中的那条。v1.6.0 把眼徽渲染从 v1.5.0 的「4 份 HTML 合成层 + CSS steps 动画」换回 **单 SVG + 15fps JS 向量重绘**:合成层的旋转 / 缩放动的是已经栅格化的位图副本,眼睑 clip 边、深蓝眼眶这类高对比边缘在重采样时会出现台阶 / 发虚(用户截图报「像素没覆盖到」);v1.6.0 每 66.7ms 直接写 `#corners` / `#fz3-lens` / `#fz3-drift` 的 SVG transform 属性,由 Skia 按设备像素重新抗锯齿,边缘始终干净。代价:隔离 harness GPU 0.99% → 1.52%(+0.5 点)、主线程 0% → 0.8%;真实页面同轮 A/B 在噪声内(2.28% → 2.10 / 1.98%),相对 v1.4.0 的 9.3–11.8% / 47–54% 仍是约 1/6 与 1/50;192px 原生截图清晰度 +2%–4%。没有新增常驻层,动画数量与 v1.5.0 相同(4 个,全部 15fps)。v1.5.1 修问候语音 greet-night-2 的断句停顿:v1.4.0 那 20 条 mp3 本就按早期草稿台词合成,其中全角「;」不在引擎 cut5 的切分符号里,导致「我值班 / 您不睡」连读;现按同一份草稿台词重新合成,把该处「;」改成「。」,并在合成后于该句号的自然停顿处补 0.20s 静音(总停顿约 0.44s);注意引擎 `merge_short_text_in_array(threshold=5)` 会把「我值班。」(4 字)与「您不睡,」(4 字)合并回同一片段,仅改标点只有模型自然的 ~0.2s 微停顿;屏幕字幕仍保留简洁版、与音频不强制逐字一致,V1 原版 5 条未动;v1.5.0 眼徽动效重做:4 份静态 SVG 副本 + 叶片公转 / 目光微动,持续动画用 steps() 量化到 15fps,GPU / CPU 再降约 80% / 90%;v1.4.0 新增问候语音库:每个时段 5 条(原 1 条 + 新录 4 条),按 Fairy 人设撰写 / 录制,随机播放且避免连续重复,屏幕台词为音频的简洁理解版;v1.3.4 修气泡脚注半句与眼标悬停原生提示;v1.3.0 新增:眼徽用量 / 花费气泡、眼徽拖拽与隐藏、外观三档(跟随 / 深色 / 浅色)、欢迎页文案改写,以及 host 侧 GET /fairy-zzz/usage 路由与 5 个稳定性修复;v1.3.1 把拖拽重写为 transform-only + 四边吸附 + 遮挡让位、用量改为预取缓存(点开即显)、气泡支持点外 / Esc 关闭、设置页删掉「(本地 CPU 推理)」后缀;v1.3.2 把拖拽与吸附范围从整个视口收进**会话内容区**(左 = 侧栏右缘、上 = 标题栏底缘,右 / 下 = 窗口边缘),边界在每次 pointerdown 时实时重量;v1.2.1 的死代码清理成果保留;v1.3.3 只改文案:气泡里的「用量 / 花费 / 峰谷」统一成「电费」口径(用量→电费、余额→电费余额、今日花费→今日电费、峰谷→五倍电费 / 十倍电费,峰段窗口提示为「十倍电费」),客户端对旧宿主的「高峰 / 空闲」字样做兜底改写)。
4
+ > 最后更新:2026-11-08,对应版本 v2.0.2。v2.0.2 修好自更新从发布起就没真正跑通过的两个根因:cordis 的 inject 少声明 `remote.pluginManager`(访问即抛 `cannot get property "remote.pluginManager" without inject`,检查永远静默失败、胶囊从不出现),以及 `updateBundle` 传了空 registry 被宿主当 URL 正规化而拒绝(`gateway/internal`);顺带把「安装期间插件被卸载、结果浮层跟着消失」改成结果落盘、重挂载后补显示(§22.7)。v2.0.1 修更新失败的提示(宿主只回 `error.code`,现在翻成中文、分三步、带上回滚结果)并在查询阶段跳过与当前 DSH 不兼容的新版本,见 §22.6。v2.0.0 新增插件自更新(§22:查 npm 版本 + 走宿主 `pluginManager.updateBundle` 安装;`link:` 安装不可更新),并修账户菜单快捷键的对比度(根因是 skin 里 kbd 选择器漏写容器前缀,见 §22.4)。v1.7.4–v1.7.6 的完整改动见 README 的中英版本段落,本节只留结构性的几条(§19 顶部两条)。v1.7.6 把眼徽呼吸拆成五层(巩膜 / 虹膜外圈 / 虹膜 / 瞳仁 / 高光各自幅度与相位,周期 1.4s),思考态眼皮随同一相位开合;上一轮基线 v1.7.3(v1.7.3 修底部状态栏透字:composer 座位渐变的终点改为不透明画布色;并把只被覆盖层子树消费的 `--fz3-dock-*` / `--fz3-brand-*` 从 `:root` 改写到 `.fz3-layer`、hero 标题同步改挂载 / 卸载事件、dock 测量改锚点退避重试、dock 相氛围层降为普通合成——4K 下打开 21k 字大会话 style 637→567 ms、long task 1254→1140 ms,见 §21.9;v1.7.2 修 v1.7.1 遗留的两处选中态边线伪影:侧栏 active 胶囊左端青柠月牙、顶栏 active tab 下缘青柠下划线,见 §21.8;v1.7.1 修 v1.7.0 皮肤期的 6 类用户回归:删 boot 左上 `// H.D.D. NORTH SEEK DATA SYSTEM`;问候 kicker / 中文标题回 Fairy 冰蓝;禁用插件后 `--dsw-*` token 残留改为自己挂 `ctx.effect` 释放 `overrideTokens` 的 disposer;重启用插件不再重播开机动画(`bootPlayed` 存到 `window`);设置弹窗几何恢复宿主默认、皮肤只换色;附件缩略图焦点环由外扩改内嵌、重绘移除按钮。v1.7.0 新增「绳网终端」宿主皮肤层,见 §21。此前:v1.6.2 删掉设置页「外观三档」,皮肤始终自动跟随宿主深浅色;「试听问候」改为每次点击都从本时段 5 条语音里重新随机抽一条并显示台词,不再复用开机抽中的那条。v1.6.0 把眼徽渲染从 v1.5.0 的「4 份 HTML 合成层 + CSS steps 动画」换回 **单 SVG + 15fps JS 向量重绘**:合成层的旋转 / 缩放动的是已经栅格化的位图副本,眼睑 clip 边、深蓝眼眶这类高对比边缘在重采样时会出现台阶 / 发虚(用户截图报「像素没覆盖到」);v1.6.0 每 66.7ms 直接写 `#corners` / `#fz3-lens` / `#fz3-drift` 的 SVG transform 属性,由 Skia 按设备像素重新抗锯齿,边缘始终干净。代价:隔离 harness GPU 0.99% → 1.52%(+0.5 点)、主线程 0% → 0.8%;真实页面同轮 A/B 在噪声内(2.28% → 2.10 / 1.98%),相对 v1.4.0 的 9.3–11.8% / 47–54% 仍是约 1/6 与 1/50;192px 原生截图清晰度 +2%–4%。没有新增常驻层,动画数量与 v1.5.0 相同(4 个,全部 15fps)。v1.5.1 修问候语音 greet-night-2 的断句停顿:v1.4.0 那 20 条 mp3 本就按早期草稿台词合成,其中全角「;」不在引擎 cut5 的切分符号里,导致「我值班 / 您不睡」连读;现按同一份草稿台词重新合成,把该处「;」改成「。」,并在合成后于该句号的自然停顿处补 0.20s 静音(总停顿约 0.44s);注意引擎 `merge_short_text_in_array(threshold=5)` 会把「我值班。」(4 字)与「您不睡,」(4 字)合并回同一片段,仅改标点只有模型自然的 ~0.2s 微停顿;屏幕字幕仍保留简洁版、与音频不强制逐字一致,V1 原版 5 条未动;v1.5.0 眼徽动效重做:4 份静态 SVG 副本 + 叶片公转 / 目光微动,持续动画用 steps() 量化到 15fps,GPU / CPU 再降约 80% / 90%;v1.4.0 新增问候语音库:每个时段 5 条(原 1 条 + 新录 4 条),按 Fairy 人设撰写 / 录制,随机播放且避免连续重复,屏幕台词为音频的简洁理解版;v1.3.4 修气泡脚注半句与眼标悬停原生提示;v1.3.0 新增:眼徽用量 / 花费气泡、眼徽拖拽与隐藏、外观三档(跟随 / 深色 / 浅色)、欢迎页文案改写,以及 host 侧 GET /fairy-zzz/usage 路由与 5 个稳定性修复;v1.3.1 把拖拽重写为 transform-only + 四边吸附 + 遮挡让位、用量改为预取缓存(点开即显)、气泡支持点外 / Esc 关闭、设置页删掉「(本地 CPU 推理)」后缀;v1.3.2 把拖拽与吸附范围从整个视口收进**会话内容区**(左 = 侧栏右缘、上 = 标题栏底缘,右 / 下 = 窗口边缘),边界在每次 pointerdown 时实时重量;v1.2.1 的死代码清理成果保留;v1.3.3 只改文案:气泡里的「用量 / 花费 / 峰谷」统一成「电费」口径(用量→电费、余额→电费余额、今日花费→今日电费、峰谷→五倍电费 / 十倍电费,峰段窗口提示为「十倍电费」),客户端对旧宿主的「高峰 / 空闲」字样做兜底改写)。
5
5
  > 姊妹文档:[docs/PERFORMANCE.md](PERFORMANCE.md)(性能优化报告:为什么这么改、数据怎么量出来的)。
6
6
 
7
7
  ---
@@ -746,6 +746,13 @@ v1.3.0 的回归 harness(`tmp/merge/`,一次性):`t7-routes.mjs`(8 个
746
746
 
747
747
  ## 19. 变更记录
748
748
 
749
+ ### 2.0.2(2026-11-08)
750
+
751
+ - **修「胶囊永远不出现」**:插件 `apply` 返回的 inject 只有 `remote.account`,而访问 `ctx.remote.pluginManager` 是 cordis 注入的硬检查——没有声明就抛 `cannot get property "remote.pluginManager" without inject`,`checkPluginUpdate()` 在取 manager 这一步就中断,2.0.0 / 2.0.1 的更新检查从来没有执行过。现在 inject 加上 `remote.pluginManager`,并加 `pluginManagerOf(ctx)` 兜底(先试 `ctx.remote.pluginManager`,抛错再试 `ctx['remote.pluginManager']`)。
752
+ - **修「点更新必失败」**:`updateBundle` 的 options 传了 `registry: info.registry`,而查询结果里 registry 为空串;宿主 `normalizeRegistry('')` 直接抛 `a registry must be an http(s) URL:`(包成 `gateway/internal`)。现在只有 registry 非空才带,否则用宿主默认 registry。
753
+ - **补「安装结果」浮层**:宿主 HMR 的更新会先卸载旧版再装新版,插件 React 树随之重建,`.fz3-upd` 浮层里的「安装完成 / 失败」跟着消失。现在安装前把上下文写进 `localStorage['fairy.zzz.update.resume']`(running / done / error),重挂载后读出来补一条结果浮层,30 分钟过期。
754
+ - `package.json` 2.0.1 → 2.0.2。
755
+
749
756
  ### 2.0.0(2026-11-08)
750
757
 
751
758
  - **插件自更新**:`client.js` 新增 `checkPluginUpdate()` / `runPluginUpdate()` 与 `.fz3-upd-pill` 胶囊、`.fz3-upd` 浮层(样式在 base CSS 段)。查询走 `ctx.remote.pluginManager.listVersions(PKG, {})`,安装走 `updateBundle(PKG, version, { registry, requestId })`;结果缓存 6 小时,失败静默;`status === 'refused'`(`link:` 安装)时不出按钮。面板打开时订阅 `plugin-manager/update-state` 显示 checking / removing / installing / restoring,按 `value.result.application` 区分「刷新页面」(applied)与「重启 DSH」(restart-required)。细节见 §22。
@@ -1141,4 +1148,48 @@ v2.0.0 两处改动(都在 `docs/skin/wire-net-terminal.css`):
1141
1148
  - **更新中途失败**:宿主有 HMR 时会自动 `installBundle(previous@from)` 回滚,`restore` 字段告诉客户端回滚结果;用户看到的是「旧版本已回滚 / 回滚失败」两档文案。
1142
1149
  - **用户取消**(`InstallCancelledError`):`application === 'cancelled'`,浮层显示「更新被取消,当前版本没有变化」。
1143
1150
 
1144
- 重试入口:失败态下按钮从「更新」变「重试」,另有「重新检查」清缓存后重新 `listVersions`(例如用户先发了新包、20 分钟后 CDN 才生效)。
1151
+ 重试入口:失败态下按钮从「更新」变「重试」,另有「重新检查」清缓存后重新 `listVersions`(例如用户先发了新包、20 分钟后 CDN 才生效)。
1152
+
1153
+ ### 22.7 v2.0.2:为什么 2.0.0 / 2.0.1 的自更新从来没生效
1154
+
1155
+ 三个独立的坑:前两个让功能完全不可用,第三个只在真安装时才暴露。
1156
+
1157
+ **坑一:inject 少一个服务名。** 插件 `apply` 返回的 `inject` 里只有 `['slots', 'locale', 'theme', 'remote', 'remote.account']`。`ctx.remote.pluginManager` 是 cordis 按服务名注入的,属性访问本身就是检查:没声明时 traceable ctx 的 get 直接抛 `cannot get property "remote.pluginManager" without inject`(错误串在 `@deepseek-ai/cordis/lib/index.js` 的 static handler 里)。`checkPluginUpdate()` 在 `const manager = ctx.remote.pluginManager` 那一行抛异常,后面的 `listVersions` 根本不执行;外层 `.catch(() => null)` 又把异常吃成「没有新版本」,于是胶囊永远不出现、localStorage 缓存也永远是 null。
1158
+
1159
+ 定位方法:在函数里按行埋 localStorage 探针(入口 → 读缓存 → 取 ctx → 取 manager),二分到「取 manager」那步为 false,再把异常字符串记下来。
1160
+
1161
+ 修复:inject 里补 `'remote.pluginManager'`,并写 `pluginManagerOf(ctx)` 做兜底(服务名带点,两种属性写法都可能出现):
1162
+
1163
+ ```js
1164
+ function pluginManagerOf(ctx) {
1165
+ try {
1166
+ const direct = ctx && ctx.remote && ctx.remote.pluginManager
1167
+ if (direct) return direct
1168
+ } catch (e) {}
1169
+ try {
1170
+ return (ctx && ctx['remote.pluginManager']) || null
1171
+ } catch (e) {
1172
+ return null
1173
+ }
1174
+ }
1175
+ ```
1176
+
1177
+ **坑二:空 registry 被当成 URL。** 宿主 `updateBundle(name, version, options)` 里:
1178
+
1179
+ ```js
1180
+ const plan = registryPlan(this.registryFor(name, options?.registry), await this.registries())
1181
+ ```
1182
+
1183
+ `normalizeRegistry(url)` 对任何**字符串**都做 `new URL(url)`,失败就抛 `a registry must be an http(s) URL: ${url}`,外层包成 `gateway/internal`。查询结果里 `value.registry` 在默认 registry 下是空串,客户端却无条件传了 `registry: ''`,于是每次点「更新」都在 check 阶段失败、什么都没装。修复:只有非空才放进 options,否则整个字段不传。
1184
+
1185
+ **坑三:安装期间浮层消失。** 有 HMR 时宿主会把已安装版本先卸载再装新版(见 `updateBundle` 注释),插件的 React 树连同 `.fz3-upd` 浮层一起被拆掉;`updateBundle` 的 Promise 在旧模块里继续 resolve,但已经没有 UI 显示结果——用户点完「更新」只看到浮层消失,不知道成没成。修复:安装前写 `localStorage['fairy.zzz.update.resume']`:
1186
+
1187
+ | 时机 | 写入内容 |
1188
+ | --- | --- |
1189
+ | 调 `updateBundle` 之前 | `{ phase: 'running', from, to, requestId, at }` |
1190
+ | 拿到 `applied` / `restart-required` | `{ phase: 'done', application, from, to, at }` |
1191
+ | 任何失败 / 取消 | `{ phase: 'error', message, cancelled?, at }` |
1192
+
1193
+ `FairySkin` 挂载后读这个键:`phase` 是 `done` / `error` 就直接补一条结果浮层;还是 `running` 就 0.8 / 2 / 4 / 8 / 15 秒各再看一次(等旧模块在卸载后写完最终结果)。超过 30 分钟的记录当作过期丢弃,避免下次启动凭空弹「刚更新完」;浮层关闭时顺手清掉这个键。
1194
+
1195
+ 验证记录(隔离 DSH_HOME + 独立 profile + 无头 Chrome CDP,2026-11-08):2.0.0 → 2.0.1 真实安装成功,磁盘 `node_modules/@sky_wing_dn/dsh-fairy-zzz/package.json` 版本从 2.0.0 变 2.0.1;安装瞬间页面里的 `.fz3-upd` 消失,新版本挂载后由 resume 记录补出「安装完成」。
package/docs/UI-DESIGN.md CHANGED
@@ -585,7 +585,13 @@ v1.7.2 的两处修复都是「边线装饰放错了形状」:
585
585
  - HMR 回滚结果追加在正文末尾:「已自动回滚到更新前的版本」或「旧版本回滚也失败了,请重启 DSH」。
586
586
  - 按钮:主按钮「重试」,次按钮「重新检查」(清缓存重查 registry),不再显示「稍后」。
587
587
 
588
- ### 16.4 账户菜单快捷键对比度
588
+ ### 16.4 安装结果的补显示(v2.0.2)
589
+
590
+ - 宿主更新走 HMR:先卸载旧版再装新版,插件的 React 树重建,正在显示的浮层会跟着消失(用户只看到「点一下就没了」)。
591
+ - 现在安装前把 `{phase, from, to, requestId, at}` 写进 `localStorage['fairy.zzz.update.resume']`;新版本挂载后读到 `done` / `error` 就补出同样的结果浮层,仍在 `running` 则 0.8 / 2 / 4 / 8 / 15 秒各再看一次,30 分钟过期。
592
+ - 视觉与 §16.2 完全一致:主按钮 `applied` 是「刷新页面」、`restart-required` 是「知道了」;失败态沿用 §16.3。
593
+
594
+ ### 16.5 账户菜单快捷键对比度
589
595
 
590
596
  - 「设置」右侧的 Ctrl+, 从几乎不可见抬到 `rgba(242,242,238,.56)`(浅色 `rgba(16,17,16,.52)`);菜单项标题仍是 label-primary `#f2f2ee`,快捷键低一个层级,不抢「设置」。
591
597
  - 根因记录:skin 里 `.wtg9ga_newSession [class*="_kbd"],[class*="_key"],[class*="_separator"]` 的后两个选择器漏了容器前缀,全局把菜单快捷键刷成墨黑;v2.0.0 补前缀 + K 段统一抬对比度(技术细节见 TECHNICAL §22.4)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sky_wing_dn/dsh-fairy-zzz",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Unofficial Zenless Zone Zero \"Fairy\" H.D.D skin for the DSH Web UI: boot animation, animated eye badge, hour-based greeting, Wire-Net Terminal host skin, always-on fee readout, and optional local GPT-SoVITS voice. Starts from AssassinVIX/fairy-zzz-plugin (MIT); eye artwork from Chengzhibense/Fairy-DSH (Apache-2.0); changelog in docs/CHANGELOG.md.",
5
5
  "type": "module",
6
6
  "license": "MIT",