dsh-life-pack 0.3.70 → 0.3.72

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/dist/client.js CHANGED
@@ -471,7 +471,7 @@ window.__ModuleLoader__.load({
471
471
  path: "/api/ilife-manager"
472
472
  };
473
473
  //#endregion
474
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/config.js
474
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/config.js
475
475
  const DEFAULT_PANEL_POLL_MS = 1e3;
476
476
  function assertPrefix(value, role) {
477
477
  if (typeof value !== "string" || value.length === 0) throw new Error("[dsh-plugin-update] " + role + " 非法:须为非空字符串(收到 " + JSON.stringify(value) + ")");
@@ -493,7 +493,19 @@ window.__ModuleLoader__.load({
493
493
  return buildPhoneNames(prefix).logAppend;
494
494
  }
495
495
  //#endregion
496
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/version-judgment.js
496
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/hash.js
497
+ function hash8(value) {
498
+ try {
499
+ const text = String(value ?? "");
500
+ let h = 5381;
501
+ for (let i = 0; i < text.length; i += 1) h = (h << 5) + h + text.charCodeAt(i) >>> 0;
502
+ return `0000000${h.toString(16)}`.slice(-8);
503
+ } catch {
504
+ return "00000000";
505
+ }
506
+ }
507
+ //#endregion
508
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/version-judgment.js
497
509
  function updateError(code) {
498
510
  return Object.assign(new Error(code), { code });
499
511
  }
@@ -580,7 +592,45 @@ window.__ModuleLoader__.load({
580
592
  return 0;
581
593
  }
582
594
  //#endregion
583
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/lang.js
595
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/codes.js
596
+ const BLOCKED_REASONS = [
597
+ "unknown-profile",
598
+ "channel-mismatch",
599
+ "source-install",
600
+ "invalid-installation",
601
+ "installation-changed",
602
+ "pending-restart",
603
+ "registry-conflict",
604
+ "incompatible-node",
605
+ "incompatible-dsh",
606
+ "recovery-required",
607
+ "dev-source"
608
+ ];
609
+ const PHONE_FAILURE_CODES = [
610
+ "check-failed",
611
+ "invalid-release",
612
+ "check-expired",
613
+ "update-busy",
614
+ "install-failed"
615
+ ];
616
+ const CHECK_SIDE_FAILURE_CODES = [
617
+ "check-failed",
618
+ "invalid-release",
619
+ "check-expired"
620
+ ];
621
+ const INTERNAL_CODE = "internal";
622
+ [...BLOCKED_REASONS, ...PHONE_FAILURE_CODES];
623
+ const CORE_ERROR_CODES = [...PHONE_FAILURE_CODES, ...BLOCKED_REASONS];
624
+ [...CORE_ERROR_CODES];
625
+ function isOneOf(codes, code) {
626
+ return typeof code === "string" && codes.includes(code);
627
+ }
628
+ function isCheckSideFailureCode(code) {
629
+ return typeof code === "string" && isOneOf(CHECK_SIDE_FAILURE_CODES, code.trim());
630
+ }
631
+ [...CORE_ERROR_CODES];
632
+ //#endregion
633
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/lang.js
584
634
  function normalizeLangTag(tag) {
585
635
  if (typeof tag !== "string") return "zh";
586
636
  const s = tag.trim().toLowerCase().replace(/_/g, "-");
@@ -722,7 +772,7 @@ window.__ModuleLoader__.load({
722
772
  };
723
773
  }
724
774
  //#endregion
725
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/bilingual.js
775
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/bilingual.js
726
776
  const BILINGUAL_STRINGS = {
727
777
  "entry.label.idle": {
728
778
  en: "Check for updates",
@@ -1494,6 +1544,26 @@ window.__ModuleLoader__.load({
1494
1544
  zh: "尚未查询到新版本;查询到后将显示更新日志。",
1495
1545
  draft: true
1496
1546
  },
1547
+ "panel.changelog.status.empty": {
1548
+ en: "This release's changelog is an empty file - not a fetch failure.",
1549
+ zh: "该版本的更新说明是空文件,不是取数失败。",
1550
+ draft: true
1551
+ },
1552
+ "panel.changelog.status.missing": {
1553
+ en: "This release's package contains no changelog file - not a fetch failure.",
1554
+ zh: "该版本包里没有更新说明文件,不是取数失败。",
1555
+ draft: true
1556
+ },
1557
+ "panel.changelog.status.fetch-failed": {
1558
+ en: "The changelog could not be fetched (network or integrity check failed).",
1559
+ zh: "更新说明没取到(网络或完整性校验失败)。",
1560
+ draft: true
1561
+ },
1562
+ "panel.changelog.status.parse-degraded": {
1563
+ en: "The changelog has content, but no structure could be parsed out of it - it is not missing.",
1564
+ zh: "更新说明有内容,但没解析出结构,不是没有说明。",
1565
+ draft: true
1566
+ },
1497
1567
  "panel.changelog.toggle-title": {
1498
1568
  en: "Expand or collapse changelog",
1499
1569
  zh: "展开或收起更新日志",
@@ -1644,14 +1714,179 @@ window.__ModuleLoader__.load({
1644
1714
  zh: "凭上方请求/检查编号在 {eFail} 中匹配;基线耗时请查看 {eCall},执行结果请查看 {eExec}。",
1645
1715
  draft: true
1646
1716
  },
1717
+ "panel.loghealth.line": {
1718
+ en: "Log: {text}",
1719
+ zh: "日志:{text}",
1720
+ draft: true
1721
+ },
1722
+ "panel.loghealth.self": {
1723
+ en: "sink={sink} (own store built by this package); dir hash={dirHash}; on-demand info switch={switch}; dropped since start: {dropped} rows; last event={lastEvent}; event contract={contract}",
1724
+ zh: "落点={sink}(本包自建落点);目录指纹={dirHash};按需信息开关={switch};启动以来丢弃 {dropped} 行;最近事件={lastEvent};事件契约={contract}",
1725
+ draft: true
1726
+ },
1727
+ "panel.loghealth.external.open": {
1728
+ en: "sink={sink} (rows land in the integrator instance); the other engine confirms this package's events are allowed; dir hash not guessed (that is the other instance's directory); dropped since start: {dropped} rows (this package's emit side only); last event={lastEvent}; event contract={contract}",
1729
+ zh: "落点={sink}(落盘归集成方实例);对方引擎确认放行本包事件;目录指纹本包不猜(那是对方实例的目录);启动以来丢弃 {dropped} 行(只算本包发射口);最近事件={lastEvent};事件契约={contract}",
1730
+ draft: true
1731
+ },
1732
+ "panel.loghealth.external.closed": {
1733
+ en: "sink={sink} (rows land in the integrator instance); the other engine has not allowed this package's events (not on the always-on list, or the switch is off); dir hash not guessed (that is the other instance's directory); dropped since start: {dropped} rows (this package's emit side only); last event={lastEvent}; event contract={contract}",
1734
+ zh: "落点={sink}(落盘归集成方实例);对方引擎未放行本包事件(常驻名单没它,或开关没开);目录指纹本包不猜(那是对方实例的目录);启动以来丢弃 {dropped} 行(只算本包发射口);最近事件={lastEvent};事件契约={contract}",
1735
+ draft: true
1736
+ },
1737
+ "panel.loghealth.external.unknown": {
1738
+ en: "sink={sink} (rows land in the integrator instance); unverified (the other side gave no criterion; do not conclude that logs exist); dir hash not guessed (that is the other instance's directory); dropped since start: {dropped} rows (this package's emit side only); last event={lastEvent}; event contract={contract}",
1739
+ zh: "落点={sink}(落盘归集成方实例);未验证(对方没给判据,不能当有日志下结论);目录指纹本包不猜(那是对方实例的目录);启动以来丢弃 {dropped} 行(只算本包发射口);最近事件={lastEvent};事件契约={contract}",
1740
+ draft: true
1741
+ },
1742
+ "panel.loghealth.off": {
1743
+ en: "sink={sink} (not wired up); reason={reason}; this package will write no more rows to the log directory — rely on out-of-band evidence (status reply / this panel / copied diagnostics); dropped since start: {dropped} rows; event contract={contract}",
1744
+ zh: "落点={sink}(没接上);原因={reason};本包不会再往日志目录写行,请以带外证据为准(更新回包 / 本面板 / 复制诊断);启动以来丢弃 {dropped} 行;事件契约={contract}",
1745
+ draft: true
1746
+ },
1747
+ "panel.loghealth.pending": {
1748
+ en: "sink={sink} (the own store is still being created asynchronously); still wiring up, re-check shortly; dir hash={dirHash}; dropped since start: {dropped} rows; event contract={contract}",
1749
+ zh: "落点={sink}(自建实例正在异步建库);接线中,稍后重查;目录指纹={dirHash};启动以来丢弃 {dropped} 行;事件契约={contract}",
1750
+ draft: true
1751
+ },
1752
+ "panel.loghealth.unrecognized": {
1753
+ en: "sink reading not recognized (the panel and the updater may be different versions); treat it as unverified — do not judge whether logs exist",
1754
+ zh: "落点读数无法识别(可能是面板与更新器版本不一致);按未验证处理,不能据此判断日志有无",
1755
+ draft: true
1756
+ },
1757
+ "panel.loghealth.switch.on": {
1758
+ en: "on",
1759
+ zh: "开",
1760
+ draft: true
1761
+ },
1762
+ "panel.loghealth.switch.off": {
1763
+ en: "off",
1764
+ zh: "关",
1765
+ draft: true
1766
+ },
1767
+ "panel.loghealth.unknown": {
1768
+ en: "unknown",
1769
+ zh: "未知",
1770
+ draft: true
1771
+ },
1772
+ "panel.loghealth.last-event.never": {
1773
+ en: "never (no row has reached the sink since start)",
1774
+ zh: "从未(启动以来没有一行到过落点)",
1775
+ draft: true
1776
+ },
1777
+ "panel.loghealth.contract.ok": {
1778
+ en: "ok",
1779
+ zh: "正常",
1780
+ draft: true
1781
+ },
1782
+ "panel.loghealth.contract.unloaded": {
1783
+ en: "{state} (event contract not loaded)",
1784
+ zh: "未加载({state}):事件契约没读进来",
1785
+ draft: true
1786
+ },
1787
+ "panel.loghealth.contract.missing": {
1788
+ en: "{state} (field gate has no ruler this round)",
1789
+ zh: "缺失({state}):字段门禁这轮没有尺子",
1790
+ draft: true
1791
+ },
1792
+ "panel.loghealth.contract.invalid": {
1793
+ en: "{state} (field gate has no ruler this round)",
1794
+ zh: "非法({state}):字段门禁这轮没有尺子",
1795
+ draft: true
1796
+ },
1797
+ "panel.loghealth.reason.no-dsh-log": {
1798
+ en: "{code} (not installed / wrong version / failed to load)",
1799
+ zh: "{code}(没安装 / 版本不匹配 / 加载失败)",
1800
+ draft: true
1801
+ },
1802
+ "panel.loghealth.reason.lease-conflict": {
1803
+ en: "{code} (another writer on the same directory)",
1804
+ zh: "{code}(同目录写者冲突)",
1805
+ draft: true
1806
+ },
1807
+ "panel.loghealth.reason.write-fail": {
1808
+ en: "{code} (failed to create the store or write to disk)",
1809
+ zh: "{code}(建库或写盘失败)",
1810
+ draft: true
1811
+ },
1647
1812
  "panel.manual.heading": {
1648
1813
  en: "Manual fallback command (copy the full line to run):",
1649
1814
  zh: "手工备用命令(请复制整行执行):",
1650
1815
  draft: true
1651
1816
  },
1652
1817
  "panel.manual.absent": {
1653
- en: "No manual command available (unrecognized scope or source install).",
1654
- zh: "当前没有可用的手工命令(使用范围无法识别或源码安装场景不提供)。",
1818
+ en: "No manual command is available right now.",
1819
+ zh: "当前没有可用的手工命令。",
1820
+ draft: true
1821
+ },
1822
+ "panel.manual.absent.unknown-profile": {
1823
+ en: "The plugin scope cannot be recognized, so there is no scope name for the command. Restart the host and check again; if it still cannot be recognized, send the copied diagnostics to the plugin author.",
1824
+ zh: "认不出插件所在的使用范围,命令没有可指向的范围名。重启宿主后重新查询;若仍认不出来,请把复制诊断发给插件作者。",
1825
+ draft: true
1826
+ },
1827
+ "panel.manual.absent.source-install": {
1828
+ en: "This plugin was installed from source; installing by version would overwrite the source. To update, reinstall it by package name@version.",
1829
+ zh: "这是源码安装的插件,按版本安装会覆盖源码。如需更新,请按包名@版本号重新安装。",
1830
+ draft: true
1831
+ },
1832
+ "panel.manual.absent.dev-source": {
1833
+ en: "This is a dev-mode mount (source link); the update center only serves version installs. Edit the repo and restart the host to see the changes.",
1834
+ zh: "这是开发态挂载(源码链接),更新中心只服务按版本安装。改完仓库代码后重启宿主再看效果。",
1835
+ draft: true
1836
+ },
1837
+ "panel.manual.absent.running-unknown": {
1838
+ en: "The running version cannot be read, so no command can be guaranteed not to downgrade. Restart the host and check again; if it still cannot be read, send the copied diagnostics to the plugin author.",
1839
+ zh: "读不到正在运行的版本号,无法保证给出的命令不会降级。重启宿主后再查一次;若仍读不到,请把复制诊断发给插件作者。",
1840
+ draft: true
1841
+ },
1842
+ "panel.manual.absent.no-safe-candidate": {
1843
+ en: "No safe target version or argument set: candidates may all be older than the running version, outside the current channel, or the scope name/registry cannot be safely embedded in a command. Check again after a newer version ships, or fix the blocked reason in section 5.2 first.",
1844
+ zh: "没有可安全执行的目标版本或参数:可能候选都低于运行版、不在当前通道,或范围名/源地址无法安全拼进命令。请等新版发布后再查,或先按第 5.2 节的受阻原因修好环境。",
1845
+ draft: true
1846
+ },
1847
+ "panel.manual.stale": {
1848
+ en: "This manual command has not been confirmed against the current reading. Re-query before copying.",
1849
+ zh: "手工命令尚未按当帧读数确认,重新查询后再复制。",
1850
+ draft: true
1851
+ },
1852
+ "panel.lastresort.badge": {
1853
+ en: "Last resort",
1854
+ zh: "最后手段",
1855
+ draft: true
1856
+ },
1857
+ "panel.lastresort.status": {
1858
+ en: "No automatic recovery left",
1859
+ zh: "自动恢复不可用",
1860
+ draft: true
1861
+ },
1862
+ "panel.lastresort.reason": {
1863
+ en: "There is no automatic data path left; copying this command is the only way forward.",
1864
+ zh: "没有可用的自动数据路径;复制这条命令是唯一出路。",
1865
+ draft: true
1866
+ },
1867
+ "panel.lastresort.copy": {
1868
+ en: "Copy manual command",
1869
+ zh: "复制手工命令",
1870
+ draft: true
1871
+ },
1872
+ "panel.lastresort.copied": {
1873
+ en: "Copied",
1874
+ zh: "已复制",
1875
+ draft: true
1876
+ },
1877
+ "batch.lastresort.row-badge": {
1878
+ en: "Last resort",
1879
+ zh: "最后手段",
1880
+ draft: true
1881
+ },
1882
+ "panel.manual.absent-comment": {
1883
+ en: "no manual command ({reason})",
1884
+ zh: "无手工命令({reason})",
1885
+ draft: true
1886
+ },
1887
+ "panel.manual.absent-comment-unknown": {
1888
+ en: "no manual command (cause unknown)",
1889
+ zh: "无手工命令(原因未知)",
1655
1890
  draft: true
1656
1891
  },
1657
1892
  "panel.manual.updater-nested": {
@@ -1864,6 +2099,11 @@ window.__ModuleLoader__.load({
1864
2099
  zh: "怎么办:{remedy}",
1865
2100
  draft: true
1866
2101
  },
2102
+ "panel.diag.connection": {
2103
+ en: "Connection: transport failures {fails} · client dropped rows {drops}",
2104
+ zh: "连接:传输失败 {fails} 次 · 客户端丢弃 {drops} 行",
2105
+ draft: true
2106
+ },
1867
2107
  "batch.action.resume": {
1868
2108
  en: "Continue the unfinished batch ({count} left)",
1869
2109
  zh: "继续上次未完成的更新(剩余 {count} 个)。",
@@ -2619,7 +2859,7 @@ window.__ModuleLoader__.load({
2619
2859
  }
2620
2860
  const BILINGUAL_CSS = [".dsh-upd-bi{display:inline;overflow-wrap:anywhere}", ".dsh-upd-bi [lang]{overflow-wrap:anywhere}"].join("\n");
2621
2861
  //#endregion
2622
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/changelog.js
2862
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/changelog.js
2623
2863
  const CHANGELOG_MAX_CHARS = 65536;
2624
2864
  const CHANGELOG_ALL_CATEGORIES = [
2625
2865
  "Added",
@@ -3146,6 +3386,17 @@ window.__ModuleLoader__.load({
3146
3386
  };
3147
3387
  }
3148
3388
  }
3389
+ const CHANGELOG_STATUSES = [
3390
+ "ok",
3391
+ "empty",
3392
+ "missing",
3393
+ "fetch-failed",
3394
+ "parse-degraded",
3395
+ "cache-hit"
3396
+ ];
3397
+ function isChangelogStatus(value) {
3398
+ return typeof value === "string" && CHANGELOG_STATUSES.indexOf(value) >= 0;
3399
+ }
3149
3400
  function hasVisibleSections(entry) {
3150
3401
  if (!entry || typeof entry !== "object") return false;
3151
3402
  try {
@@ -3727,13 +3978,18 @@ ${note}${blocks.join("\n")}
3727
3978
  }
3728
3979
  }
3729
3980
  //#endregion
3730
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/log-events.js
3981
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/log-events.js
3731
3982
  const LOG_EVENT_CALL = "host.call";
3732
3983
  const LOG_EVENT_CALL_FAIL = "host.call.fail";
3733
3984
  const LOG_EVENT_INSTALL_EXEC = "update.install.exec";
3734
3985
  const CLIENT_LOG_FLUSH_MS = 1e3;
3735
3986
  const CLIENT_LOG_RETRY_DELAYS_MS = [250, 1e3];
3736
3987
  const CLIENT_LOG_SEND_TIMEOUT_MS = 5e3;
3988
+ const REPORTABLE_DROP_REASONS = [
3989
+ "overflow",
3990
+ "host-refused",
3991
+ "send-failed"
3992
+ ];
3737
3993
  function positiveInt(value, fallback) {
3738
3994
  const n = typeof value === "number" && Number.isFinite(value) ? Math.floor(value) : fallback;
3739
3995
  return n > 0 ? n : fallback;
@@ -3782,13 +4038,26 @@ ${note}${blocks.join("\n")}
3782
4038
  let disposed = false;
3783
4039
  let scheduled = null;
3784
4040
  let inFlight = false;
4041
+ const droppedByReason = {};
4042
+ const reportedDropReasons = /* @__PURE__ */ new Set();
3785
4043
  function noteDrop(row, reason) {
3786
4044
  dropped++;
4045
+ const key = typeof reason === "string" && reason ? reason : "unknown";
4046
+ droppedByReason[key] = (droppedByReason[key] ?? 0) + 1;
3787
4047
  if (!onDrop) return;
3788
4048
  try {
3789
4049
  onDrop(row, reason);
3790
4050
  } catch {}
3791
4051
  }
4052
+ function reportDrops() {
4053
+ if (disposed || call === null || phoneName === "") return;
4054
+ for (const reason of REPORTABLE_DROP_REASONS) {
4055
+ if (!(droppedByReason[reason] > 0)) continue;
4056
+ if (reportedDropReasons.has(reason)) continue;
4057
+ reportedDropReasons.add(reason);
4058
+ emit("warn", "update.log.degraded", { reason: `client-drop-${reason}` });
4059
+ }
4060
+ }
3792
4061
  function push(row) {
3793
4062
  if (count === capacity) {
3794
4063
  const evicted = slots[head];
@@ -3889,12 +4158,8 @@ ${note}${blocks.join("\n")}
3889
4158
  await delay(typeof wait === "number" && Number.isFinite(wait) ? wait : 0);
3890
4159
  }
3891
4160
  }
3892
- async function flush() {
3893
- if (disposed || inFlight || count === 0) return;
3894
- if (!enabled()) {
3895
- while (count > 0) noteDrop(shift(), "no-channel");
3896
- return;
3897
- }
4161
+ async function sendBuffered() {
4162
+ if (inFlight || count === 0) return;
3898
4163
  inFlight = true;
3899
4164
  const batch = [];
3900
4165
  while (batch.length < batchSize && count > 0) {
@@ -3919,10 +4184,41 @@ ${note}${blocks.join("\n")}
3919
4184
  } finally {
3920
4185
  inFlight = false;
3921
4186
  }
4187
+ }
4188
+ async function flush() {
4189
+ if (disposed || inFlight || count === 0) return;
4190
+ if (!enabled()) {
4191
+ while (count > 0) noteDrop(shift(), "no-channel");
4192
+ return;
4193
+ }
4194
+ await sendBuffered();
4195
+ if (disposed) return;
4196
+ reportDrops();
3922
4197
  if (disposed) return;
3923
4198
  if (count >= batchSize) schedule(0);
3924
4199
  else if (count > 0) schedule(flushMs);
3925
4200
  }
4201
+ async function finalFlush() {
4202
+ if (inFlight) {
4203
+ while (count > 0) noteDrop(shift(), "disposed");
4204
+ return;
4205
+ }
4206
+ if (call !== null && phoneName !== "") {
4207
+ for (const reason of REPORTABLE_DROP_REASONS) {
4208
+ if (!(droppedByReason[reason] > 0)) continue;
4209
+ if (reportedDropReasons.has(reason)) continue;
4210
+ reportedDropReasons.add(reason);
4211
+ push({
4212
+ level: "warn",
4213
+ event: "update.log.degraded",
4214
+ fields: { reason: `client-drop-${reason}` },
4215
+ ts: now()
4216
+ });
4217
+ }
4218
+ await sendBuffered();
4219
+ }
4220
+ while (count > 0) noteDrop(shift(), "disposed");
4221
+ }
3926
4222
  function onVisibilityChange() {
3927
4223
  try {
3928
4224
  const state = visibility?.visibilityState;
@@ -3962,59 +4258,170 @@ ${note}${blocks.join("\n")}
3962
4258
  timer.clear(scheduled);
3963
4259
  } catch {}
3964
4260
  scheduled = null;
3965
- while (count > 0) noteDrop(shift(), "disposed");
3966
4261
  if (visibility && typeof visibility.removeEventListener === "function") try {
3967
4262
  visibility.removeEventListener("visibilitychange", onVisibilityChange);
3968
4263
  } catch {}
4264
+ finalFlush();
3969
4265
  }
3970
4266
  return {
3971
4267
  emit,
3972
4268
  flush,
3973
4269
  pending: () => count,
3974
4270
  dropped: () => dropped,
4271
+ droppedByReason: () => ({ ...droppedByReason }),
3975
4272
  sent: () => sent,
3976
4273
  enabled,
3977
4274
  dispose
3978
4275
  };
3979
4276
  }
3980
4277
  //#endregion
3981
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/codes.js
3982
- const BLOCKED_REASONS = [
3983
- "unknown-profile",
3984
- "channel-mismatch",
4278
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/commands.js
4279
+ const MANUAL_SUPPRESSING_REASONS = [
3985
4280
  "source-install",
3986
- "invalid-installation",
3987
- "installation-changed",
3988
- "pending-restart",
3989
- "registry-conflict",
3990
- "incompatible-node",
3991
- "incompatible-dsh",
3992
- "recovery-required",
4281
+ "unknown-profile",
3993
4282
  "dev-source"
3994
4283
  ];
3995
- const PHONE_FAILURE_CODES = [
3996
- "check-failed",
3997
- "invalid-release",
3998
- "check-expired",
3999
- "update-busy",
4000
- "install-failed"
4284
+ function manualCommandSuppressedBy(reason) {
4285
+ return reason !== null && reason !== void 0 && MANUAL_SUPPRESSING_REASONS.includes(reason);
4286
+ }
4287
+ //#endregion
4288
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/manual-absent.js
4289
+ const REASON_KEYS = {
4290
+ "unknown-profile": "panel.manual.absent.unknown-profile",
4291
+ "source-install": "panel.manual.absent.source-install",
4292
+ "dev-source": "panel.manual.absent.dev-source",
4293
+ "running-unknown": "panel.manual.absent.running-unknown",
4294
+ "no-safe-candidate": "panel.manual.absent.no-safe-candidate"
4295
+ };
4296
+ function manualAbsentReasonOf(snapshot) {
4297
+ if (!snapshot || typeof snapshot !== "object") return null;
4298
+ const blocked = snapshot.blockedReason;
4299
+ if (manualCommandSuppressedBy(blocked)) return blocked;
4300
+ const running = snapshot.runningVersion;
4301
+ if (running === null || running === "") return "running-unknown";
4302
+ if (typeof running !== "string") return null;
4303
+ return "no-safe-candidate";
4304
+ }
4305
+ const MANUAL_APPLICABLE_BANNER_KINDS = [
4306
+ "failed",
4307
+ "restart",
4308
+ "blocked",
4309
+ "update"
4001
4310
  ];
4002
- const CHECK_SIDE_FAILURE_CODES = [
4003
- "check-failed",
4004
- "invalid-release",
4005
- "check-expired"
4311
+ function manualAppliesToBanner(kind) {
4312
+ return MANUAL_APPLICABLE_BANNER_KINDS.includes(kind);
4313
+ }
4314
+ function manualAbsentReasonTextOf(reason, lang) {
4315
+ if (!reason) return copyText("panel.manual.absent", lang);
4316
+ return copyText(REASON_KEYS[reason], lang);
4317
+ }
4318
+ function manualAbsentTextOf(reason, lang) {
4319
+ if (!reason) return manualAbsentReasonTextOf(null, lang);
4320
+ const joiner = normalizeLangTag(lang) === "en" ? " " : "";
4321
+ return manualAbsentReasonTextOf(null, lang) + joiner + manualAbsentReasonTextOf(reason, lang);
4322
+ }
4323
+ //#endregion
4324
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/last-resort.js
4325
+ const STAGES = [
4326
+ "install",
4327
+ "check",
4328
+ "busy",
4329
+ "restart",
4330
+ "blocked",
4331
+ "unknown"
4006
4332
  ];
4007
- const INTERNAL_CODE = "internal";
4008
- [...BLOCKED_REASONS, ...PHONE_FAILURE_CODES];
4009
- [...[...PHONE_FAILURE_CODES, ...BLOCKED_REASONS]];
4010
- function isOneOf(codes, code) {
4011
- return typeof code === "string" && codes.includes(code);
4333
+ const BLOCKED_RESCUE = {
4334
+ "unknown-profile": [],
4335
+ "source-install": [],
4336
+ "dev-source": [],
4337
+ "invalid-installation": [],
4338
+ "recovery-required": [],
4339
+ "installation-changed": ["recheck"],
4340
+ "pending-restart": ["restart-host"],
4341
+ "channel-mismatch": ["switch-channel"],
4342
+ "registry-conflict": ["fix-manifest"],
4343
+ "incompatible-node": ["upgrade-runtime"],
4344
+ "incompatible-dsh": ["upgrade-runtime"]
4345
+ };
4346
+ function asRecord(value) {
4347
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
4348
+ }
4349
+ function firstText(value) {
4350
+ if (typeof value !== "string") return null;
4351
+ const trimmed = value.trim();
4352
+ return trimmed ? trimmed : null;
4353
+ }
4354
+ function isBlockedReason(value) {
4355
+ return value !== null && BLOCKED_REASONS.includes(value);
4356
+ }
4357
+ function isStage(value) {
4358
+ return typeof value === "string" && STAGES.includes(value);
4359
+ }
4360
+ function stageOfCode(code, blocked) {
4361
+ if (isBlockedReason(blocked)) return "blocked";
4362
+ if (isBlockedReason(code)) return "blocked";
4363
+ if (code === null) return "unknown";
4364
+ if (code === "install-failed") return "install";
4365
+ if (CHECK_SIDE_FAILURE_CODES.includes(code)) return "check";
4366
+ if (code === "update-busy") return "busy";
4367
+ if (code === "internal") return "unknown";
4368
+ return "unknown";
4369
+ }
4370
+ function lastResortSubjectOf(input) {
4371
+ const rec = asRecord(input);
4372
+ const blocked = firstText(rec["blockedReason"]);
4373
+ const code = isBlockedReason(blocked) ? blocked : firstText(rec["code"]);
4374
+ const derived = stageOfCode(code, blocked);
4375
+ const explicit = isStage(rec["stage"]) ? rec["stage"] : null;
4376
+ const stage = derived === "unknown" && explicit !== null ? explicit : derived;
4377
+ const registeredRaw = rec["registered"];
4378
+ return {
4379
+ code,
4380
+ stage,
4381
+ registered: typeof registeredRaw === "boolean" ? registeredRaw : null
4382
+ };
4012
4383
  }
4013
- function isCheckSideFailureCode(code) {
4014
- return typeof code === "string" && isOneOf(CHECK_SIDE_FAILURE_CODES, code.trim());
4384
+ function rescueRoutesOf(subject) {
4385
+ const s = asRecord(subject);
4386
+ const code = firstText(s["code"]);
4387
+ const stage = isStage(s["stage"]) ? s["stage"] : "unknown";
4388
+ if (stage === "blocked") {
4389
+ if (!isBlockedReason(code)) return [];
4390
+ if (code === "pending-restart" && s["registered"] === false) return ["select-in-host"];
4391
+ return [...BLOCKED_RESCUE[code]];
4392
+ }
4393
+ if (stage === "check") return ["recheck"];
4394
+ if (stage === "busy") return ["wait-retry"];
4395
+ if (stage === "restart") return [s["registered"] === false ? "select-in-host" : "restart-host"];
4396
+ return [];
4397
+ }
4398
+ function manualSourceOf(value) {
4399
+ return value === "frame" || value === "carried-over" ? value : null;
4400
+ }
4401
+ function lastResortVerdictOf(input) {
4402
+ const rec = asRecord(input);
4403
+ const subject = lastResortSubjectOf(input);
4404
+ const manualSource = manualSourceOf(rec["manualSource"]);
4405
+ const manual = firstText(rec["manual"]);
4406
+ const routes = rescueRoutesOf(subject);
4407
+ const verdict = (kind, rs = routes) => ({
4408
+ kind,
4409
+ subject,
4410
+ routes: [...rs],
4411
+ manualSource
4412
+ });
4413
+ if (subject.stage === "unknown") return verdict("unknown", []);
4414
+ if (manualSource === "carried-over") return verdict("unknown");
4415
+ if (subject.stage === "blocked") return verdict(routes.length > 0 ? "salvageable" : "dead-end");
4416
+ if (routes.length > 0) return verdict("salvageable");
4417
+ if (rec["fallbackAvailable"] === true) return verdict("salvageable", ["install-compliant"]);
4418
+ if (rec["runningVersionKnown"] === false) return verdict("salvageable", ["recheck"]);
4419
+ if (manual !== null && manualSource === "frame") return verdict("last-resort");
4420
+ if (manualSource === null && manual === null) return verdict("dead-end");
4421
+ return verdict("unknown");
4015
4422
  }
4016
4423
  //#endregion
4017
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/install-cause.js
4424
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/install-cause.js
4018
4425
  const CAUSE_KINDS = ["minimum-release-age"];
4019
4426
  const CAUSE_SIGNATURES = [{
4020
4427
  kind: "minimum-release-age",
@@ -4134,7 +4541,7 @@ ${note}${blocks.join("\n")}
4134
4541
  }
4135
4542
  }
4136
4543
  //#endregion
4137
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/redaction.js
4544
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/redaction.js
4138
4545
  const COPY_BUDGET_CHARS = 1500;
4139
4546
  const REDACTED_PATH = "<路径>";
4140
4547
  const REDACTED_SECRET = "<脱敏>";
@@ -4214,7 +4621,7 @@ ${note}${blocks.join("\n")}
4214
4621
  return userinfo.masked ? truncateWithMaskNote(scrubbed, COPY_BUDGET_CHARS) : truncateForCopy(scrubbed);
4215
4622
  }
4216
4623
  //#endregion
4217
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/panel-copy.js
4624
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/panel-copy.js
4218
4625
  const BLOCKED_KEYS = {
4219
4626
  "unknown-profile": {
4220
4627
  title: "panel.blocked.unknown-profile.title",
@@ -4420,6 +4827,7 @@ ${note}${blocks.join("\n")}
4420
4827
  latestVersion: "string",
4421
4828
  environmentKind: "string",
4422
4829
  requestId: "string",
4830
+ intentHash: "string",
4423
4831
  checkId: "string",
4424
4832
  registryHost: "string",
4425
4833
  action: "string",
@@ -4441,6 +4849,7 @@ ${note}${blocks.join("\n")}
4441
4849
  latestVersion: null,
4442
4850
  environmentKind: null,
4443
4851
  requestId: null,
4852
+ intentHash: null,
4444
4853
  checkId: null,
4445
4854
  registryHost: null,
4446
4855
  action: null,
@@ -4495,6 +4904,78 @@ ${note}${blocks.join("\n")}
4495
4904
  return null;
4496
4905
  }
4497
4906
  }
4907
+ const LOG_HEALTH_CONTRACTS = [
4908
+ "ok",
4909
+ "unloaded",
4910
+ "missing",
4911
+ "invalid"
4912
+ ];
4913
+ const LOG_HEALTH_REASONS = [
4914
+ "no-dsh-log",
4915
+ "lease-conflict",
4916
+ "write-fail"
4917
+ ];
4918
+ function logHealthText(health, lang) {
4919
+ if (typeof health !== "object" || health === null) return null;
4920
+ const l = normalizeLangTag(lang ?? "zh");
4921
+ const h = health;
4922
+ try {
4923
+ const unknown = copyText("panel.loghealth.unknown", l);
4924
+ const droppedRaw = h["droppedSinceStart"];
4925
+ const dropped = typeof droppedRaw === "number" && Number.isFinite(droppedRaw) && droppedRaw >= 0 ? String(droppedRaw) : unknown;
4926
+ const contractRaw = typeof h["contract"] === "string" ? h["contract"].trim() : "";
4927
+ const contract = LOG_HEALTH_CONTRACTS.includes(contractRaw) ? copyText(`panel.loghealth.contract.${contractRaw}`, l, { state: contractRaw }) : unknown;
4928
+ const lastRaw = h["lastEventAt"];
4929
+ const lastEvent = lastRaw === null || lastRaw === void 0 ? copyText("panel.loghealth.last-event.never", l) : typeof lastRaw === "number" && Number.isFinite(lastRaw) && lastRaw > 0 ? formatUnlockAt(lastRaw, l) ?? unknown : unknown;
4930
+ const switchEnabled = h["switchEnabled"] === true ? copyText("panel.loghealth.switch.on", l) : h["switchEnabled"] === false ? copyText("panel.loghealth.switch.off", l) : unknown;
4931
+ const dirHash = (typeof h["dirHash"] === "string" ? h["dirHash"].trim() : "") || unknown;
4932
+ const sink = typeof h["sink"] === "string" ? h["sink"] : "";
4933
+ let body;
4934
+ if (sink === "self") body = copyText("panel.loghealth.self", l, {
4935
+ sink,
4936
+ dirHash,
4937
+ switch: switchEnabled,
4938
+ dropped,
4939
+ lastEvent,
4940
+ contract
4941
+ });
4942
+ else if (sink === "external") {
4943
+ const gateRaw = typeof h["external"] === "string" ? h["external"] : "";
4944
+ body = copyText(`panel.loghealth.external.${gateRaw === "open" || gateRaw === "closed" ? gateRaw : "unknown"}`, l, {
4945
+ sink,
4946
+ dropped,
4947
+ lastEvent,
4948
+ contract
4949
+ });
4950
+ } else if (sink === "off") {
4951
+ const reasonRaw = typeof h["reason"] === "string" ? h["reason"] : "";
4952
+ body = copyText("panel.loghealth.off", l, {
4953
+ sink,
4954
+ reason: LOG_HEALTH_REASONS.includes(reasonRaw) ? copyText(`panel.loghealth.reason.${reasonRaw}`, l, { code: reasonRaw }) : unknown,
4955
+ dropped,
4956
+ contract
4957
+ });
4958
+ } else if (sink === "pending") body = copyText("panel.loghealth.pending", l, {
4959
+ sink,
4960
+ dirHash,
4961
+ dropped,
4962
+ contract
4963
+ });
4964
+ else body = copyText("panel.loghealth.unrecognized", l);
4965
+ return redactForCopy(copyText("panel.loghealth.line", l, { text: body }));
4966
+ } catch {
4967
+ return null;
4968
+ }
4969
+ }
4970
+ function connectionText(transportFailStreak, clientDropped, lang) {
4971
+ const fails = typeof transportFailStreak === "number" && Number.isFinite(transportFailStreak) && transportFailStreak > 0 ? Math.floor(transportFailStreak) : 0;
4972
+ const drops = typeof clientDropped === "number" && Number.isFinite(clientDropped) && clientDropped > 0 ? Math.floor(clientDropped) : 0;
4973
+ if (fails === 0 && drops === 0) return null;
4974
+ return redactForCopy(copyText("panel.diag.connection", lang ?? "zh", {
4975
+ fails,
4976
+ drops
4977
+ }));
4978
+ }
4498
4979
  function buildUpdateDiagCopy(input, langOverride) {
4499
4980
  const l = normalizeLangTag(langOverride ?? input.lang ?? "zh");
4500
4981
  const unknown = copyText("panel.diag.copy.unknown", l);
@@ -4536,21 +5017,29 @@ ${note}${blocks.join("\n")}
4536
5017
  if (diag.action) prov.push(copyText("panel.diag.copy.field.action", l, { action: diag.action }));
4537
5018
  if (typeof requestRaw === "string" && requestRaw.trim()) prov.push(copyText("panel.diag.copy.field.request", l, { request: requestRaw.trim() }));
4538
5019
  if (typeof checkRaw === "string" && checkRaw.trim()) prov.push(copyText("panel.diag.copy.field.check", l, { check: checkRaw.trim() }));
5020
+ if (diag.intentHash) prov.push(`intent=${diag.intentHash}`);
4539
5021
  prov.push(copyText("panel.diag.copy.field.queue", l, { queue }));
4540
5022
  const updaterText = updaterFieldText(input.updater, l);
4541
5023
  if (updaterText) prov.push(updaterText);
4542
5024
  const format = input.format === "line" ? "line" : "block";
4543
5025
  const provLine = redactForCopy(prov.join(" · "));
4544
- if (format === "line") return redactForCopy(`[update-diag] code=${rawCode} \xB7 ${copy.zh} \xB7 ${copyText("panel.diag.copy.line.summary", l, { summary: detail })} \xB7 ${provLine} \xB7 ${copyText("panel.diag.copy.line.remedy", l, { remedy })}`);
4545
- return [
5026
+ const logHealth = logHealthText(input.logHealth ?? null, l);
5027
+ const healthTail = logHealth ? ` \xB7 ${logHealth}` : "";
5028
+ const connection = connectionText(input.transportFailStreak, input.clientDropped, l);
5029
+ const connectionTail = connection ? ` \xB7 ${connection}` : "";
5030
+ if (format === "line") return redactForCopy(`[update-diag] code=${rawCode} \xB7 ${copy.zh} \xB7 ${copyText("panel.diag.copy.line.summary", l, { summary: detail })} \xB7 ${provLine} \xB7 ${copyText("panel.diag.copy.line.remedy", l, { remedy })}${healthTail}${connectionTail}`);
5031
+ const blockLines = [
4546
5032
  `[update-diag] ${rawCode} \u2014 ${copy.zh}`,
4547
5033
  ` ${copyText("panel.diag.copy.block.summary", l, { summary: detail })}`,
4548
5034
  ` ${copyText("panel.diag.copy.block.source", l, { source: provLine })}`,
4549
5035
  ` ${copyText("panel.diag.copy.block.remedy", l, { remedy })}`
4550
- ].join("\n");
5036
+ ];
5037
+ if (logHealth) blockLines.push(` ${logHealth}`);
5038
+ if (connection) blockLines.push(` ${connection}`);
5039
+ return blockLines.join("\n");
4551
5040
  }
4552
5041
  //#endregion
4553
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/panel.js
5042
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/panel.js
4554
5043
  function normalizePanelTheme(value) {
4555
5044
  return value === "archive" ? "archive" : "default";
4556
5045
  }
@@ -5073,6 +5562,16 @@ ${note}${blocks.join("\n")}
5073
5562
  ".dsh-upd-banner[data-kind=\"failed\"],.dsh-upd-banner[data-kind=\"blocked\"]{border-color:var(--dsh-update-bad-border);background:var(--dsh-update-bad-bg)}",
5074
5563
  ".dsh-upd-banner[data-kind=\"update\"]{border-color:var(--dsh-update-ok-border);background:var(--dsh-update-ok-bg)}",
5075
5564
  ".dsh-upd-banner[data-kind=\"busy\"]{border-color:var(--dsh-update-busy-border);background:var(--dsh-update-busy-bg)}",
5565
+ ".dsh-upd-lastresort{display:flex;align-items:flex-start;gap:9px;flex-wrap:wrap;border:1px solid var(--dsh-update-bad-border,#dc2626);border-left:4px solid var(--dsh-update-bad-text,#b91c1c);background:var(--dsh-update-bad-bg,#fef2f2);padding:8px 10px;margin:0 0 8px}",
5566
+ ".dsh-upd-lr-ico{flex:none;width:18px;height:18px;color:var(--dsh-update-bad-border,#dc2626);margin-top:2px}",
5567
+ ".dsh-upd-lr-main{flex:1 1 220px;min-width:0}",
5568
+ ".dsh-upd-lr-line{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}",
5569
+ ".dsh-upd-lr-badge{display:inline-block;font-size:var(--dsh-update-panel-small-font-size,11px);font-weight:700;letter-spacing:.08em;border:1px solid currentColor;color:var(--dsh-update-bad-border,#dc2626);border-radius:3px;padding:0 5px}",
5570
+ ".dsh-upd-lr-status{font-weight:700}",
5571
+ ".dsh-upd-lr-reason{font-size:var(--dsh-update-panel-log-font-size,13px);opacity:.9;margin-top:2px;overflow-wrap:anywhere}",
5572
+ ".dsh-upd-lr-go{margin:0;padding:4px 10px;font-size:var(--dsh-update-panel-small-font-size,12.5px);align-self:center}",
5573
+ ".dsh-upd-lr-chap-badge{flex:none;display:inline-block;font-size:var(--dsh-update-panel-small-font-size,11px);font-weight:700;border:1px solid currentColor;color:var(--dsh-update-bad-border,#dc2626);border-radius:3px;padding:0 5px;margin-left:6px;vertical-align:baseline}",
5574
+ ".dsh-upd-copy-bubble{position:fixed;z-index:10000;transform:translate(-50%,-100%);background:var(--dsh-update-text,#1f2937);color:var(--dsh-update-bg,#ffffff);border-radius:4px;padding:3px 9px;font-size:var(--dsh-update-panel-small-font-size,12px);line-height:1.5;pointer-events:none;animation:dsh-upd-fadein .12s ease}",
5076
5575
  ".dsh-upd code{font-family:Consolas,Menlo,monospace;font-size:var(--dsh-update-panel-log-font-size,12px);word-break:break-all}",
5077
5576
  ".dsh-upd-manual,.dsh-upd-queue,.dsh-upd-log{margin:4px 0;font-size:var(--dsh-update-panel-log-font-size,13px)}",
5078
5577
  ".dsh-upd-changelog-wrap{margin:4px 0 0;font-size:var(--dsh-update-panel-log-font-size,13px)}",
@@ -5159,9 +5658,9 @@ ${note}${blocks.join("\n")}
5159
5658
  ".dsh-upd-tag{display:inline-block;border:1px dashed currentColor;border-radius:3px;padding:1px 8px;margin-right:8px;font-family:Consolas,Menlo,monospace;font-size:var(--dsh-update-panel-small-font-size,12px)}",
5160
5659
  ".dsh-upd-err{font-size:var(--dsh-update-panel-log-font-size,13px);margin:0 0 6px}",
5161
5660
  ".dsh-upd-log,.dsh-upd-err{overflow-wrap:anywhere}",
5162
- ".dsh-upd button{transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .06s ease}",
5163
- ".dsh-upd button:hover:not(:disabled){border-color:var(--dsh-update-focus,#2563eb)}",
5164
- ".dsh-upd button[data-primary=\"1\"]:hover:not(:disabled){filter:brightness(.93)}",
5661
+ ".dsh-upd button{transition:background-color .15s ease,border-color .15s ease,color .15s ease,transform .06s ease,box-shadow .15s ease}",
5662
+ ".dsh-upd button:hover:not(:disabled){border-color:var(--dsh-update-primary,#2563eb);box-shadow:0 0 0 2px var(--dsh-update-primary,#2563eb)}",
5663
+ ".dsh-upd button[data-primary=\"1\"]:hover:not(:disabled){border-color:var(--dsh-update-focus,#2563eb);box-shadow:0 0 0 2px var(--dsh-update-primary,#2563eb)}",
5165
5664
  ".dsh-upd button:active:not(:disabled){transform:translateY(1px)}",
5166
5665
  ".dsh-upd button[aria-busy=\"true\"]{cursor:wait;animation:dsh-upd-pulse 1s ease-in-out infinite}",
5167
5666
  "@keyframes dsh-upd-pulse{0%,100%{opacity:1}50%{opacity:.55}}",
@@ -5173,8 +5672,8 @@ ${note}${blocks.join("\n")}
5173
5672
  ".dsh-upd button[aria-busy=\"true\"]::after{content:\"\";display:inline-block;width:11px;height:11px;margin-left:8px;vertical-align:-1px;",
5174
5673
  "border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:dsh-upd-spin .8s linear infinite}",
5175
5674
  "@keyframes dsh-upd-spin{to{transform:rotate(360deg)}}",
5176
- "@media (prefers-reduced-motion: reduce){.dsh-upd button{transition:none}.dsh-upd button:active:not(:disabled){transform:none}.dsh-upd button[aria-busy=\"true\"]{animation:none}.dsh-upd-skv{animation:none}.dsh-upd-banner{animation:none}.dsh-upd-changelog-foldbox{transition:none}}",
5177
- "@media (forced-colors: active){.dsh-upd-overlay .dsh-upd-body .dsh-upd-chap-head{background:Canvas}}",
5675
+ "@media (prefers-reduced-motion: reduce){.dsh-upd button{transition:none}.dsh-upd button:active:not(:disabled){transform:none}.dsh-upd button[aria-busy=\"true\"]{animation:none}.dsh-upd-skv{animation:none}.dsh-upd-banner{animation:none}.dsh-upd-changelog-foldbox{transition:none}.dsh-upd-copy-bubble{animation:none}}",
5676
+ "@media (forced-colors: active){.dsh-upd-overlay .dsh-upd-body .dsh-upd-chap-head{background:Canvas}.dsh-upd-lastresort{border-color:CanvasText}.dsh-upd-lr-badge,.dsh-upd-lr-chap-badge{border-color:CanvasText;color:CanvasText}.dsh-upd-copy-bubble{border:1px solid CanvasText;background:Canvas;color:CanvasText}}",
5178
5677
  ".dsh-upd{overflow-anchor:none}",
5179
5678
  ".dsh-upd-body{overflow-anchor:none}",
5180
5679
  ".dsh-upd-actions{display:flex;flex-wrap:wrap;align-items:center;min-height:34px}",
@@ -5495,22 +5994,77 @@ ${note}${blocks.join("\n")}
5495
5994
  if (!profile) return null;
5496
5995
  return `dsh plugin --profile ${profile} add --save-exact dsh-plugin-update@latest`;
5497
5996
  }
5997
+ function manualSourceOfRender(input) {
5998
+ const value = input.manualSource;
5999
+ if (value === "carried-over") return "carried-over";
6000
+ if (value === null) return null;
6001
+ return "frame";
6002
+ }
6003
+ function manualTrustedOf(manual, source) {
6004
+ return typeof manual === "string" && manual.trim() !== "" && source === "frame";
6005
+ }
6006
+ function lastResortBarHTML(opts) {
6007
+ const verdict = opts.verdict;
6008
+ if (!verdict || verdict.kind !== "last-resort") return "";
6009
+ const l = normalizeLangTag(opts.lang ?? "zh");
6010
+ return "<div class=\"dsh-upd-lastresort\" data-last-resort=\"last-resort\"><svg class=\"dsh-upd-lr-ico\" viewBox=\"0 0 16 16\" width=\"18\" height=\"18\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"><path d=\"M8 1.8 12.4 3.6 14.2 8 12.4 12.4 8 14.2 3.6 12.4 1.8 8 3.6 3.6Z\"/><path d=\"M8 5.2v4\"/><circle cx=\"8\" cy=\"11.6\" r=\"0.85\" fill=\"currentColor\" stroke=\"none\"/></svg><div class=\"dsh-upd-lr-main\"><div class=\"dsh-upd-lr-line\"><span class=\"dsh-upd-lr-badge\">" + escapeHtml$3(copyText("panel.lastresort.badge", l)) + "</span><strong class=\"dsh-upd-lr-status\">" + escapeHtml$3(copyText("panel.lastresort.status", l)) + "</strong></div><div class=\"dsh-upd-lr-reason\">" + escapeHtml$3(copyText("panel.lastresort.reason", l)) + "</div></div>" + (opts.buttonHtml ?? "") + "</div>";
6011
+ }
6012
+ function lastResortCopyButtonHTML(lang) {
6013
+ const l = normalizeLangTag(lang ?? "zh");
6014
+ return "<button type=\"button\" class=\"dsh-upd-lr-go primary\" data-primary=\"1\" data-action=\"copy-manual\" data-copy-anchor=\"1\" title=\"" + escapeHtml$3(copyText("panel.lastresort.copy", l)) + "\"><svg class=\"dsh-upd-copy-ico\" viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"><rect x=\"5.5\" y=\"5.5\" width=\"7.5\" height=\"7.5\" rx=\"1\"/><path d=\"M10.5 5.5V4.2a1 1 0 0 0-1-1H4.2a1 1 0 0 0-1 1v5.3a1 1 0 0 0 1 1h1.3\"/></svg>" + escapeHtml$3(copyText("panel.lastresort.copy", l)) + "</button>";
6015
+ }
6016
+ function copyBubbleHTML(bubble) {
6017
+ if (!bubble) return "";
6018
+ const left = Number.isFinite(bubble.left) ? Math.round(bubble.left) : 0;
6019
+ const top = Number.isFinite(bubble.top) ? Math.round(bubble.top) : 0;
6020
+ return "<span class=\"dsh-upd-copy-bubble\" role=\"status\" style=\"position:fixed;left:" + left + "px;top:" + top + "px\">" + escapeHtml$3(bubble.text) + "</span>";
6021
+ }
6022
+ const CHANGELOG_STATUS_KEYS = {
6023
+ empty: "panel.changelog.status.empty",
6024
+ missing: "panel.changelog.status.missing",
6025
+ "fetch-failed": "panel.changelog.status.fetch-failed",
6026
+ "parse-degraded": "panel.changelog.status.parse-degraded"
6027
+ };
6028
+ function changelogStatusCopyKey(status) {
6029
+ if (!status) return null;
6030
+ return CHANGELOG_STATUS_KEYS[status] ?? null;
6031
+ }
5498
6032
  function renderUpdatePanelKernel(input, view, lang) {
5499
6033
  const { snapshot, manual, queue, mode, showOthers, pluginId, copyNotice } = input;
5500
6034
  const l = normalizeLangTag(lang ?? input.lang ?? "zh");
5501
6035
  const changelogMarkdown = input.changelogMarkdown ?? null;
6036
+ const rawChangelogStatus = input.changelogStatus;
6037
+ const changelogStatusValue = isChangelogStatus(rawChangelogStatus) ? rawChangelogStatus : null;
6038
+ const changelogStatusKey = changelogStatusValue === null ? null : changelogStatusCopyKey(changelogStatusValue);
5502
6039
  const profileName = typeof input.profileName === "string" && input.profileName ? input.profileName : null;
5503
6040
  const b = view.banner;
5504
6041
  const seal = view.seal;
5505
6042
  const parts = [];
6043
+ const manualSource = manualSourceOfRender(input);
6044
+ const manualTrusted = manualTrustedOf(manual, manualSource);
6045
+ const lastResort = lastResortVerdictOf({
6046
+ code: (typeof input.errorKind === "string" && input.errorKind.trim() ? input.errorKind.trim() : "") || (typeof input.lastError === "string" ? input.lastError.trim() : "") || null,
6047
+ blockedReason: snapshot ? snapshot.blockedReason : null,
6048
+ manual,
6049
+ manualSource,
6050
+ fallbackAvailable: input.fallbackAvailable === true || fallbackBlockedVersionOf(input.failure, pluginId) !== null,
6051
+ runningVersionKnown: typeof input.runningVersionKnown === "boolean" ? input.runningVersionKnown : snapshot ? snapshot.runningVersion !== null : null,
6052
+ registered: snapshot ? snapshot.registered ?? null : null
6053
+ });
6054
+ const showActions = input.actions !== "none";
5506
6055
  parts.push("<div class=\"dsh-upd-masthead\"><span class=\"dsh-upd-masthead-kicker\">" + escapeHtml$3(copyText("panel.masthead.kicker", l)) + "</span><span class=\"dsh-upd-masthead-title\">" + escapeHtml$3(copyText("panel.masthead.title", l)) + " <i>" + escapeHtml$3(copyText("panel.masthead.volume", l)) + "</i></span></div>");
5507
6056
  parts.push(`<div class="dsh-upd-head"><span class="dsh-upd-name">${escapeHtml$3(pluginId)}</span><span class="dsh-upd-meta">${escapeHtml$3(copyText("panel.meta.label", l))} <b>${escapeHtml$3(profileName ?? copyText("panel.meta.unknown", l))}</b><span class="dsh-upd-proftag">profile</span></span></div>`);
6057
+ const lastResortBarHtml = b.kind === "failed" || b.kind === "restart" || b.kind === "blocked" ? lastResortBarHTML({
6058
+ verdict: lastResort,
6059
+ lang: l,
6060
+ buttonHtml: showActions ? lastResortCopyButtonHTML(l) : ""
6061
+ }) : "";
6062
+ if (lastResortBarHtml) parts.push(lastResortBarHtml);
5508
6063
  parts.push(`<div class="dsh-upd-banner" data-kind="${b.kind}" data-mini="${escapeHtml$3(seal.mini)}" role="status" aria-live="polite">`);
5509
6064
  parts.push(`<div>${b.kind === "restart" ? "" : `<span class="dsh-upd-sealmini" aria-hidden="true">${escapeHtml$3(seal.mini)}</span>`}<strong>${escapeHtml$3(b.title)}</strong></div>`);
5510
6065
  parts.push("</div>");
5511
6066
  if (b.action) parts.push(`<div class="dsh-upd-banner-sub">${escapeHtml$3(b.action)}</div>`);
5512
6067
  parts.push(snapshot ? versionStrip(snapshot, l) : skeletonStrip(view.banner.kind === "loading", l));
5513
- const showActions = input.actions !== "none";
5514
6068
  const actions = [];
5515
6069
  if (showActions) {
5516
6070
  const busyAct = input.busyAct;
@@ -5530,7 +6084,7 @@ ${note}${blocks.join("\n")}
5530
6084
  if (snapshot?.latestVersion && !view.skippedLatest && view.banner.kind === "update") actions.push(`<button type="button" data-action="skip" title="${escapeHtml$3(copyText("panel.action.skip-title", l))}">${escapeHtml$3(copyText("panel.action.skip", l))}</button>`);
5531
6085
  if (gatePrejudge) actions.push(gateCandidate ? `<button type="button" data-action="install-fallback-confirm" data-primary="1" title="${escapeHtml$3(copyText("panel.action.install-fallback-confirm-title", l))}"${macroBusy || fallbackBusy ? " disabled" : ""}>${escapeHtml$3(copyText("panel.action.install-fallback-confirm", l, { version: gateCandidate }))}</button>` : fallbackBusy ? `<button type="button" data-action="install-fallback" data-primary="1" disabled aria-busy="true" title="${escapeHtml$3(copyText("panel.action.install-fallback-title", l))}">${escapeHtml$3(copyText("panel.action.install-fallback", l))}</button>` : `<button type="button" data-action="install-fallback" data-primary="1" title="${escapeHtml$3(copyText("panel.action.install-fallback-title", l))}"${macroBusy ? " disabled" : ""}>${escapeHtml$3(copyText("panel.action.install-fallback", l))}</button>`);
5532
6086
  if (view.showReset && snapshot?.latestVersion) actions.push(`<button type="button" data-action="reset-skip" title="${escapeHtml$3(copyText("panel.action.unskip-title", l))}">${escapeHtml$3(copyText("panel.action.unskip", l, { version: snapshot.latestVersion }))}</button>`);
5533
- if (view.showManual && manual) actions.push(`<button type="button" data-action="copy-manual" title="${escapeHtml$3(copyText("panel.action.copy-manual-title", l))}">${escapeHtml$3(copyText("panel.action.copy-manual", l))}</button>`);
6087
+ if (view.showManual && manualTrusted && !lastResortBarHtml) actions.push(`<button type="button" data-action="copy-manual" title="${escapeHtml$3(copyText("panel.action.copy-manual-title", l))}">${escapeHtml$3(copyText("panel.action.copy-manual", l))}</button>`);
5534
6088
  if (b.kind === "restart") actions.push(`<button type="button" data-action="restart-hint" title="${escapeHtml$3(copyText("panel.action.restart-host-title", l))}">${escapeHtml$3(copyText("panel.action.restart-host", l))}</button>`);
5535
6089
  const failureForFallback = input.failure ?? null;
5536
6090
  const fallbackBlocked = b.kind === "failed" ? fallbackBlockedVersionOf(failureForFallback, pluginId) : null;
@@ -5551,13 +6105,17 @@ ${note}${blocks.join("\n")}
5551
6105
  {
5552
6106
  let inner = "";
5553
6107
  let hasLog = false;
6108
+ const statusCopyText = changelogStatusKey === null ? "" : copyText(changelogStatusKey, l);
5554
6109
  if (snapshot && snapshot.latestVersion) try {
5555
6110
  const mdText = typeof changelogMarkdown === "string" ? changelogMarkdown : "";
5556
6111
  const report = parseChangelogReport(mdText);
5557
6112
  const entries = report.entries;
5558
6113
  const ranged = changelogForUpdate(entries, snapshot.runningVersion, snapshot.latestVersion, snapshot.installedVersion);
5559
6114
  if (ranged.length === 0 && mdText.trim() && entries.length === 0) {
5560
- inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(copyText("panel.changelog.unavailable", l))}</div>${truncationNoteHTML(report.truncation, l)}</div>`;
6115
+ inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$3((changelogStatusValue === "parse-degraded" ? statusCopyText : "") || copyText("panel.changelog.unavailable", l))}</div>${truncationNoteHTML(report.truncation, l)}</div>`;
6116
+ hasLog = false;
6117
+ } else if (!mdText.trim() && statusCopyText) {
6118
+ inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(statusCopyText)}</div></div>`;
5561
6119
  hasLog = false;
5562
6120
  } else {
5563
6121
  const changelogHTML = renderChangelogHTML(ranged, {
@@ -5592,7 +6150,7 @@ ${changelogHTML}
5592
6150
  } catch {
5593
6151
  inner = "";
5594
6152
  }
5595
- if (!inner) inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(snapshot && snapshot.latestVersion ? copyText("panel.changelog.unavailable", l) : copyText("panel.changelog.unavailable-empty", l))}</div></div>`;
6153
+ if (!inner) inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(snapshot && snapshot.latestVersion ? statusCopyText || copyText("panel.changelog.unavailable", l) : copyText("panel.changelog.unavailable-empty", l))}</div></div>`;
5596
6154
  const logCollapsed = input.changelogCollapsed === true;
5597
6155
  const logNote = showActions && hasLog ? "<span class=\"dsh-upd-chap-note\"><button type=\"button\" data-action=\"toggle-changelog\" title=\"" + escapeHtml$3(copyText("panel.changelog.toggle-title", l)) + `">${escapeHtml$3(logCollapsed ? copyText("panel.changelog.expand", l) : copyText("panel.changelog.collapse", l))}</button></span>` : "";
5598
6156
  chapters.push(chapterOf(2, inner, logNote, l));
@@ -5649,6 +6207,8 @@ ${changelogHTML}
5649
6207
  e2: `<code>${LOG_EVENT_CALL_FAIL}</code>`,
5650
6208
  e3: `<code>${LOG_EVENT_INSTALL_EXEC}</code>`
5651
6209
  })}</div>`);
6210
+ const healthLine = logHealthText(input.logHealth, l);
6211
+ if (healthLine) errLines.push(`<div class="dsh-upd-log">${escapeHtml$3(healthLine)}</div>`);
5652
6212
  if (b.kind === "failed" && failRef && (failRef.requestId || failRef.checkId)) errLines.push(`<div class="dsh-upd-log">${copyText("panel.error.log-follow", l, {
5653
6213
  eFail: `<code>${LOG_EVENT_CALL_FAIL}</code>`,
5654
6214
  eCall: `<code>${LOG_EVENT_CALL}</code>`,
@@ -5659,7 +6219,9 @@ ${changelogHTML}
5659
6219
  else errLines.push("<div class=\"dsh-upd-copy dsh-upd-copy--empty\" aria-hidden=\"true\"></div>");
5660
6220
  chapters.push(chapterOf(4, errLines.join(""), "", l));
5661
6221
  }
5662
- let manualHtml = view.showManual && manual ? `<div class="dsh-upd-manual"><div>${escapeHtml$3(copyText("panel.manual.heading", l))}</div><code>${escapeHtml$3(manual)}</code></div>` : `<div class="dsh-upd-manual"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(copyText("panel.manual.absent", l))}</div></div>`;
6222
+ const manualAbsentReason = !manual && manualAppliesToBanner(b.kind) ? manualAbsentReasonOf(snapshot) : null;
6223
+ const manualStale = manualSource === "carried-over" && Boolean(manual);
6224
+ let manualHtml = view.showManual && manualTrusted ? `<div class="dsh-upd-manual"><div>${escapeHtml$3(copyText("panel.manual.heading", l))}</div><code>${escapeHtml$3(manual ?? "")}</code></div>` : `<div class="dsh-upd-manual"><div class="dsh-upd-changelog-neutral">${manualStale ? escapeHtml$3(copyText("panel.manual.stale", l)) : escapeHtml$3(manualAbsentTextOf(manualAbsentReason, l))}</div></div>`;
5663
6225
  const selfParts = updaterPartsOf(input.updater);
5664
6226
  if (selfParts && selfParts.level === "nested") {
5665
6227
  const command = selfUpgradeCommandOf(profileName);
@@ -5670,9 +6232,11 @@ ${changelogHTML}
5670
6232
  }
5671
6233
  const updaterIdentity = updaterIdentityOf(input);
5672
6234
  if (updaterIdentity && !(showActions && mode === "dialog")) manualHtml += `<div class="dsh-upd-updater-id">${escapeHtml$3(updaterIdentity)}</div>`;
5673
- chapters.push(chapterOf(5, manualHtml, "", l));
6235
+ const manualChapNote = lastResortBarHtml && lastResort.kind === "last-resort" ? `<span class="dsh-upd-lr-chap-badge">${escapeHtml$3(copyText("panel.lastresort.badge", l))}</span>` : "";
6236
+ chapters.push(chapterOf(5, manualHtml, manualChapNote, l));
5674
6237
  parts.push("<div class=\"dsh-upd-body\">" + chapters.join("\n") + "</div>");
5675
6238
  if (showActions && mode === "dialog") parts.push("<div class=\"dsh-upd-footer\"><span class=\"dsh-upd-foot-note\">" + escapeHtml$3(copyText("panel.footer.note", l)) + "</span>" + (updaterIdentity ? `<span class="dsh-upd-updater-note">${escapeHtml$3(updaterIdentity)}</span>` : "") + `<button type="button" data-action="close-view" title="${escapeHtml$3(copyText("panel.footer.close-title", l))}">${escapeHtml$3(copyText("panel.footer.close", l))}</button></div>`);
6239
+ if (input.copyBubble) parts.push(copyBubbleHTML(input.copyBubble));
5676
6240
  return parts.join("\n");
5677
6241
  }
5678
6242
  function renderUpdatePanelHTML(input, lang) {
@@ -5694,7 +6258,7 @@ ${UPDATE_PANEL_ARCHIVE_CSS}` : UPDATE_PANEL_CSS}</style>
5694
6258
  ${body}`;
5695
6259
  }
5696
6260
  //#endregion
5697
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/entry.js
6261
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/entry.js
5698
6262
  const UPDATE_ENTRY_CSS = [
5699
6263
  ".dsh-upd-entry{display:inline-flex;align-items:center;gap:8px;font:13px/1.6 var(--dsh-update-font-sans,system-ui,\"Microsoft YaHei\",sans-serif);font-size:var(--dsh-update-entry-font-size,13px);color:var(--dsh-update-text,#1f2937)}",
5700
6264
  ".dsh-upd-entry-btn{font:inherit;border:1px solid var(--dsh-update-border,#d1d5db);border-radius:var(--dsh-update-entry-border-radius,6px);",
@@ -5808,7 +6372,7 @@ ${body}`;
5808
6372
  }
5809
6373
  }
5810
6374
  //#endregion
5811
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/panel-batch.js
6375
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/panel-batch.js
5812
6376
  const BATCH_PANEL_POLL = {
5813
6377
  defaultMs: 1500,
5814
6378
  minMs: 250
@@ -6313,7 +6877,10 @@ ${body}`;
6313
6877
  }).join("");
6314
6878
  const failedAct = batchText("batch.banner.failed-action", l);
6315
6879
  const manualAbsent = batchFailedManualText(failed, l, titles).commands === 0;
6316
- parts.push("<div class=\"dsh-upd-banner\" data-kind=\"failed\" data-mini=\"阻\" role=\"status\"><div><span class=\"dsh-upd-sealmini\" aria-hidden=\"true\">阻</span><strong>" + escapeHtml$2(batchText("batch.banner.failed-title", l, { n: String(failed.length) })) + "</strong></div><div class=\"dsh-upd-blist\">" + lines + "</div><div class=\"dsh-upd-browline\"><span class=\"dsh-upd-bcopy\"><button type=\"button\" data-act=\"copy-all-diag\">" + escapeHtml$2(batchText("batch.row-action.copy-diag", l)) + "</button><button type=\"button\" data-act=\"copy-all-manual\"" + (manualAbsent ? " disabled title=\"" + escapeHtml$2(batchText("panel.manual.absent", l)) + "\"" : "") + ">" + escapeHtml$2(batchText("batch.row-action.copy-manual", l)) + "</button></span></div></div>");
6880
+ const absentReasons = failed.map((row) => manualAbsentReasonOf(asSnapshotLike(row.snapshot)));
6881
+ const absentReasonSet = new Set(absentReasons.filter((reason) => reason !== null));
6882
+ const absentTitle = absentReasonSet.size === 1 && absentReasons.every((reason) => reason !== null) ? manualAbsentTextOf([...absentReasonSet][0], l) : manualAbsentTextOf(null, l);
6883
+ parts.push("<div class=\"dsh-upd-banner\" data-kind=\"failed\" data-mini=\"阻\" role=\"status\"><div><span class=\"dsh-upd-sealmini\" aria-hidden=\"true\">阻</span><strong>" + escapeHtml$2(batchText("batch.banner.failed-title", l, { n: String(failed.length) })) + "</strong></div><div class=\"dsh-upd-blist\">" + lines + "</div><div class=\"dsh-upd-browline\"><span class=\"dsh-upd-bcopy\"><button type=\"button\" data-act=\"copy-all-diag\">" + escapeHtml$2(batchText("batch.row-action.copy-diag", l)) + "</button><button type=\"button\" data-act=\"copy-all-manual\"" + (manualAbsent ? " disabled title=\"" + escapeHtml$2(absentTitle) + "\"" : "") + ">" + escapeHtml$2(batchText("batch.row-action.copy-manual", l)) + "</button></span></div></div>");
6317
6884
  if (failedAct) parts.push("<div class=\"dsh-upd-banner-sub\">" + escapeHtml$2(failedAct) + "</div>");
6318
6885
  }
6319
6886
  if (confirmList) parts.push("<div class=\"dsh-upd-banner\" data-kind=\"update\" role=\"status\"><div><strong>" + escapeHtml$2(batchText("batch.banner.compliant-confirm", l, { list: confirmList })) + "</strong></div><div class=\"dsh-upd-browline\"><span class=\"dsh-upd-blist\">" + escapeHtml$2(confirmList) + "</span><button type=\"button\" data-act=\"batch-fallback-confirm\" data-primary=\"1\"" + (compliantBusy ? " disabled" : "") + ">" + escapeHtml$2(batchText("batch.action.install-compliant-confirm", l, { n: String(confirmCount) })) + "</button></div></div>");
@@ -6361,6 +6928,25 @@ ${body}`;
6361
6928
  return "";
6362
6929
  }
6363
6930
  }
6931
+ function batchManualSourceOf(row) {
6932
+ return row.manualSource === "carried-over" ? "carried-over" : row.manualSource === null ? null : "frame";
6933
+ }
6934
+ function batchRowLastResortOf(row) {
6935
+ const snap = asSnapshotLike(row.snapshot);
6936
+ const manualSource = batchManualSourceOf(row);
6937
+ return lastResortVerdictOf({
6938
+ code: asBatchPhase(row.phase) === "failed" && typeof row.error === "string" && row.error ? row.error : null,
6939
+ blockedReason: snap && typeof snap.blockedReason === "string" ? snap.blockedReason : null,
6940
+ manual: typeof row.manual === "string" ? row.manual : null,
6941
+ manualSource,
6942
+ runningVersionKnown: snap ? snap.runningVersion !== null : null,
6943
+ fallbackAvailable: batchFallbackCauseOf(row) !== null,
6944
+ registered: snap && typeof snap.registered === "boolean" ? snap.registered : null
6945
+ });
6946
+ }
6947
+ function batchRowManualTrusted(row) {
6948
+ return typeof row.manual === "string" && row.manual.trim() !== "" && batchManualSourceOf(row) === "frame";
6949
+ }
6364
6950
  function rowSetHTML(row, ctx) {
6365
6951
  const phase = asBatchPhase(row.phase);
6366
6952
  const keyAttr = escapeHtml$2(row.key);
@@ -6370,6 +6956,7 @@ ${body}`;
6370
6956
  const rowDone = phase === "failed" && !queued ? compliantInstalledOf(row) : null;
6371
6957
  const versionHTML = batchRowVersionHTML(row, ctx.knowledge, ctx.lang);
6372
6958
  const rowStatusText = rowDone !== null ? rowDone.needsRestart ? batchText("batch.row.done-restart", ctx.lang) : batchText("batch.row.done", ctx.lang) : queued ? batchQueuedStatus(position, ctx.lang) : ctx.worldLatest !== null ? batchText("batch.row.update", ctx.lang, { version: ctx.worldLatest }) : ctx.inRound ? batchRowKnowledgeText(row, ctx.knowledge, ctx.lang) ?? batchRowStatus(row, skipped, ctx.lang) : batchRowPendingStatus(row, ctx.knowledge, ctx.lang) ?? batchRowStatus(row, skipped, ctx.lang);
6959
+ const lastResortBadge = batchRowLastResortOf(row).kind === "last-resort" ? "<span class=\"dsh-upd-lr-rowbadge\" data-last-resort=\"last-resort\">" + escapeHtml$2(batchText("batch.lastresort.row-badge", ctx.lang)) + "</span>" : "";
6373
6960
  const actions = [];
6374
6961
  const off = ctx.inFlight ? " disabled" : "";
6375
6962
  if (phase === "installing") actions.push("<button type=\"button\" data-act=\"row-install\" data-key=\"" + keyAttr + "\" disabled>" + escapeHtml$2(batchText("batch.row-action.installing", ctx.lang)) + "</button>");
@@ -6399,7 +6986,7 @@ ${body}`;
6399
6986
  const codeEsc = escapeHtml$2(failCode);
6400
6987
  return "<span class=\"dsh-upd-bfail\">" + (escaped.includes(codeEsc) ? escaped.replace(codeEsc, "<code>" + codeEsc + "</code>") : escaped) + "</span>";
6401
6988
  })() : "";
6402
- const main = "<button type=\"button\" class=\"dsh-upd-brow-main\" data-act=\"toggle-details\" data-key=\"" + keyAttr + "\" aria-expanded=\"" + (ctx.expanded ? "true" : "false") + "\"><span class=\"dsh-upd-updot\" data-tone=\"" + dotToneOf(row, phase, skipped, queued, ctx.worldLatest, rowDone === null ? null : rowDone.needsRestart) + "\"></span><span class=\"dsh-upd-bname\">" + escapeHtml$2(titleOf(row, ctx.titles)) + "</span>" + versionHTML + "<span class=\"dsh-upd-bstat\">" + escapeHtml$2(rowStatusText) + (ctx.inRound && !queued ? "(" + escapeHtml$2(batchText("batch.row.unfinished-tag", ctx.lang)) + ")" : "") + "</span>" + failLine + "</button>";
6989
+ const main = "<button type=\"button\" class=\"dsh-upd-brow-main\" data-act=\"toggle-details\" data-key=\"" + keyAttr + "\" aria-expanded=\"" + (ctx.expanded ? "true" : "false") + "\"><span class=\"dsh-upd-updot\" data-tone=\"" + dotToneOf(row, phase, skipped, queued, ctx.worldLatest, rowDone === null ? null : rowDone.needsRestart) + "\"></span><span class=\"dsh-upd-bname\">" + escapeHtml$2(titleOf(row, ctx.titles)) + "</span>" + versionHTML + "<span class=\"dsh-upd-bstat\">" + lastResortBadge + escapeHtml$2(rowStatusText) + (ctx.inRound && !queued ? "(" + escapeHtml$2(batchText("batch.row.unfinished-tag", ctx.lang)) + ")" : "") + "</span>" + failLine + "</button>";
6403
6990
  return "<div class=\"dsh-upd-brow-set\" data-key=\"" + keyAttr + "\"><div class=\"dsh-upd-brow\" data-phase=\"" + escapeHtml$2(phase) + "\" data-key=\"" + keyAttr + "\"" + (queued ? " data-queued=\"1\"" : "") + ">" + main + "<span class=\"dsh-upd-brow-actions\">" + actions.join("") + "</span></div></div>";
6404
6991
  }
6405
6992
  function detailActionsHTML(row, ctx) {
@@ -6422,7 +7009,7 @@ ${body}`;
6422
7009
  if (phase !== "installing" && singleCheckPhoneOf(row) !== null) buttons.push("<button type=\"button\" data-act=\"row-check\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.action.check", ctx.lang)) + "</button>");
6423
7010
  if (!queued && phase === "ready" && ctx.skipped === null && version !== null) buttons.push("<button type=\"button\" data-act=\"row-skip\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.row-action.skip", ctx.lang)) + "</button>");
6424
7011
  if (ctx.skipped !== null) buttons.push("<button type=\"button\" data-act=\"row-resume-skip\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.row-action.unskip", ctx.lang, { version: ctx.skipped })) + "</button>");
6425
- if (typeof row.manual === "string" && row.manual) buttons.push("<button type=\"button\" data-act=\"row-copy-manual\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.row-action.copy-manual", ctx.lang)) + "</button>");
7012
+ if (batchRowManualTrusted(row)) buttons.push("<button type=\"button\" data-act=\"row-copy-manual\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.row-action.copy-manual", ctx.lang)) + "</button>");
6426
7013
  buttons.push("<button type=\"button\" data-act=\"row-copy-diag\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.row-action.copy-diag", ctx.lang)) + "</button>");
6427
7014
  return "<span class=\"dsh-upd-bdetail-actions\">" + buttons.join("") + "</span>";
6428
7015
  }
@@ -6438,6 +7025,7 @@ ${body}`;
6438
7025
  const withoutStyle = stripActionButtons(renderUpdatePanelHTML({
6439
7026
  snapshot: asSnapshotLike(row.snapshot),
6440
7027
  manual: typeof row.manual === "string" ? row.manual : null,
7028
+ manualSource: batchManualSourceOf(row),
6441
7029
  changelogMarkdown: typeof ctx.changelogMarkdown === "string" ? ctx.changelogMarkdown : null,
6442
7030
  queue: asQueueLike(row.queue),
6443
7031
  skippedLatest: ctx.skipped !== null,
@@ -6501,6 +7089,8 @@ ${body}`;
6501
7089
  ".dsh-upd-bver-new{color:var(--dsh-update-new-text,#dc2626);font-weight:700}",
6502
7090
  ".dsh-upd-bver-new-ok{color:var(--dsh-update-new-ok-text,#047857);font-weight:700}",
6503
7091
  ".dsh-upd-bstat{font-size:var(--dsh-update-panel-small-font-size,12.5px);opacity:.9;min-width:0;overflow-wrap:anywhere}",
7092
+ ".dsh-upd-lr-rowbadge{display:inline-block;margin-right:5px;font-size:var(--dsh-update-panel-small-font-size,11px);font-weight:700;letter-spacing:.06em;border:1px solid currentColor;border-radius:3px;padding:0 4px;color:var(--dsh-update-bad-text,#b91c1c)}",
7093
+ ".dsh-upd-bdetail-dialog .dsh-upd-lr-ico{width:22px;height:22px}",
6504
7094
  ".dsh-upd-bfail{grid-column:1/-1;display:block;font-size:var(--dsh-update-panel-small-font-size,12.5px);color:var(--dsh-update-bad-border,#dc2626)}",
6505
7095
  "/* #156 finishing fact: ledger phase failed but the newest installable build did get installed — green, not red. */",
6506
7096
  ".dsh-upd-bdone{color:var(--dsh-update-ok-border,#059669)}",
@@ -6802,7 +7392,7 @@ ${body}`;
6802
7392
  pluginId: pluginIdOf(row),
6803
7393
  code: job !== null && job.code !== null ? job.code : row.error || "check-failed",
6804
7394
  detail,
6805
- runningVersion: text(snapshot ? snapshot["runningVersion"] : null),
7395
+ runningVersion: snapshot && snapshot["installed"] !== false ? text(snapshot["runningVersion"]) : null,
6806
7396
  installedVersion: text(snapshot ? snapshot["installedVersion"] : null),
6807
7397
  latestVersion: text(snapshot ? snapshot["latestVersion"] : null),
6808
7398
  hostKind: text(row.hostKind),
@@ -6827,7 +7417,9 @@ ${body}`;
6827
7417
  commands += 1;
6828
7418
  continue;
6829
7419
  }
6830
- lines.push("# " + titleOf(row, titles) + ":" + batchText("panel.manual.absent", l));
7420
+ const reason = manualAbsentReasonOf(asSnapshotLike(row.snapshot));
7421
+ const comment = reason ? batchText("panel.manual.absent-comment", l, { reason: manualAbsentReasonTextOf(reason, l) }) : batchText("panel.manual.absent-comment-unknown", l);
7422
+ lines.push("# " + titleOf(row, titles) + ":" + comment);
6831
7423
  }
6832
7424
  return {
6833
7425
  text: lines.join("\n"),
@@ -7969,7 +8561,7 @@ ${body}`;
7969
8561
  };
7970
8562
  }
7971
8563
  //#endregion
7972
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.24/node_modules/dsh-plugin-update/dist/entry-batch.js
8564
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/entry-batch.js
7973
8565
  function isObject$1(value) {
7974
8566
  return !!value && typeof value === "object" && !Array.isArray(value);
7975
8567
  }
@@ -8352,11 +8944,21 @@ ${body}`;
8352
8944
  ".dsh-upd-ib-status{font-weight:600;overflow-wrap:anywhere}",
8353
8945
  ".dsh-upd-ib-sub{opacity:.85;overflow-wrap:anywhere}",
8354
8946
  ".dsh-upd-ib-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
8355
- ".dsh-upd-ib button{cursor:pointer}",
8947
+ ".dsh-upd-ib button{cursor:pointer;transition:border-color 120ms ease,box-shadow 120ms ease,transform 80ms ease}",
8356
8948
  ".dsh-upd-ib button[disabled]{cursor:default}",
8949
+ ".dsh-upd-ib button:hover:not(:disabled){border-color:var(--dsh-update-primary,#2563eb);box-shadow:0 0 0 2px var(--dsh-update-primary,#2563eb)}",
8950
+ ".dsh-upd-ib button:active:not(:disabled){transform:translateY(1px)}",
8951
+ ".dsh-upd-ib button:focus-visible{outline:2px solid var(--dsh-update-primary,#2563eb);outline-offset:2px}",
8952
+ "@media (prefers-reduced-motion: reduce){.dsh-upd-ib button{transition:none}}",
8357
8953
  ".dsh-upd-ib-manual summary{cursor:pointer}",
8358
8954
  ".dsh-upd-ib-manual code{display:block;white-space:pre-wrap;overflow-wrap:anywhere}",
8955
+ ".dsh-upd-ib-manual .dsh-upd-lastresort{margin-top:6px}",
8956
+ ".dsh-upd-ib-manual .dsh-upd-lr-go{margin:0}",
8957
+ ".dsh-upd-ib-stale{color:var(--dsh-update-text-muted,inherit);font-size:var(--dsh-update-panel-small-font-size,12px)}",
8359
8958
  ".dsh-upd-ib-notice{opacity:.8}",
8959
+ ".dsh-upd-ib .dsh-upd-copy-bubble{position:fixed;z-index:10000;transform:translate(-50%,-100%);background:var(--dsh-update-text,#1f2937);color:var(--dsh-update-bg,#ffffff);border-radius:4px;padding:3px 9px;font-size:var(--dsh-update-panel-small-font-size,12px);line-height:1.5;pointer-events:none}",
8960
+ "@media (prefers-reduced-motion: reduce){.dsh-upd-ib .dsh-upd-copy-bubble{animation:none}}",
8961
+ "@media (forced-colors: active){.dsh-upd-ib .dsh-upd-copy-bubble{border:1px solid CanvasText;background:Canvas;color:CanvasText}}",
8360
8962
  ".dsh-upd-ib[data-theme=\"archive\"] .dsh-upd-ib-status{font-family:serif}"
8361
8963
  ].join("\n");
8362
8964
  function isObject(value) {
@@ -8557,6 +9159,16 @@ ${body}`;
8557
9159
  }
8558
9160
  function renderInstallButtonHTML(view, opts) {
8559
9161
  const l = opts.lang;
9162
+ const manualSource = opts.manualSource === "carried-over" ? "carried-over" : opts.manualSource === null ? null : "frame";
9163
+ const manualTrusted = typeof opts.manual === "string" && opts.manual.trim() !== "" && manualSource === "frame";
9164
+ const lastResort = lastResortVerdictOf({
9165
+ code: opts.failureCode ?? null,
9166
+ blockedReason: null,
9167
+ manual: typeof opts.manual === "string" ? opts.manual : null,
9168
+ manualSource,
9169
+ fallbackAvailable: opts.fallbackAvailable === true,
9170
+ registered: opts.registered ?? null
9171
+ });
8560
9172
  const parts = [];
8561
9173
  parts.push("<style>" + INSTALL_BUTTON_CSS + "</style>");
8562
9174
  parts.push("<div class=\"dsh-upd-ib\" data-theme=\"" + opts.theme + "\">");
@@ -8577,8 +9189,16 @@ ${body}`;
8577
9189
  parts.push("<div class=\"dsh-upd-ib-row\"><button type=\"button\" data-action=\"install-fallback\" data-primary=\"1\" title=\"" + escapeHtml(copyText("panel.action.install-fallback-title", l)) + "\"" + busy + ">" + escapeHtml(copyText("panel.action.install-fallback", l)) + "</button><button type=\"button\" data-action=\"wait-latest\" title=\"" + escapeHtml(copyText("panel.action.wait-latest-title", l)) + "\"" + (view.fallbackBusy || view.buttonBusy ? " disabled" : "") + ">" + escapeHtml(copyText("panel.action.wait-latest", l)) + "</button></div>");
8578
9190
  }
8579
9191
  if (view.bannerKind === "failed") parts.push("<div class=\"dsh-upd-ib-row\"><button type=\"button\" data-action=\"copy-diag\" title=\"" + escapeHtml(copyText("panel.action.copy-diag-title", l)) + "\">" + escapeHtml(copyText("panel.action.copy-diag", l)) + "</button></div>");
8580
- if (view.showManual && opts.manual) parts.push("<details class=\"dsh-upd-ib-manual\"><summary>" + escapeHtml(copyText("panel.chapter.manual", l)) + "</summary><code>" + escapeHtml(opts.manual) + "</code><button type=\"button\" data-action=\"copy-manual\" title=\"" + escapeHtml(copyText("panel.action.copy-manual-title", l)) + "\">" + escapeHtml(copyText("panel.action.copy-manual", l)) + "</button></details>");
9192
+ if (view.showManual && manualTrusted) {
9193
+ const bar = lastResortBarHTML({
9194
+ verdict: lastResort,
9195
+ lang: l,
9196
+ buttonHtml: lastResortCopyButtonHTML(l)
9197
+ });
9198
+ parts.push("<details class=\"dsh-upd-ib-manual\"><summary>" + escapeHtml(copyText("panel.chapter.manual", l)) + "</summary>" + bar + "<code>" + escapeHtml(opts.manual ?? "") + "</code>" + (bar ? "" : "<button type=\"button\" data-action=\"copy-manual\" title=\"" + escapeHtml(copyText("panel.action.copy-manual-title", l)) + "\">" + escapeHtml(copyText("panel.action.copy-manual", l)) + "</button>") + "</details>");
9199
+ } else if (view.showManual && manualSource === "carried-over" && opts.manual) parts.push("<details class=\"dsh-upd-ib-manual\"><summary>" + escapeHtml(copyText("panel.chapter.manual", l)) + "</summary><div class=\"dsh-upd-ib-stale\">" + escapeHtml(copyText("panel.manual.stale", l)) + "</div></details>");
8581
9200
  if (opts.notice) parts.push("<div class=\"dsh-upd-ib-notice\" role=\"status\">" + escapeHtml(opts.notice) + "</div>");
9201
+ parts.push(copyBubbleHTML(opts.bubble ?? null));
8582
9202
  parts.push("</div>");
8583
9203
  return parts.join("");
8584
9204
  }
@@ -8595,62 +9215,142 @@ ${body}`;
8595
9215
  channel.emit(level, event, fields);
8596
9216
  } catch {}
8597
9217
  }
8598
- function logMountFailure(kind) {
8599
- logClient("error", "update.panel.render.fail", { kind });
9218
+ const RENDER_FAIL_DEDUPE_MS = 6e4;
9219
+ const renderFailSeen = /* @__PURE__ */ new Map();
9220
+ function errorTextOf(err) {
9221
+ if (err && typeof err === "object" && typeof err.message === "string") return err.message;
9222
+ if (typeof err === "string") return err;
9223
+ try {
9224
+ return String(err ?? "");
9225
+ } catch {
9226
+ return "";
9227
+ }
8600
9228
  }
8601
- if (!container || typeof container.innerHTML !== "string") {
8602
- logMountFailure("container");
8603
- throw new Error("[dsh-plugin-update] install button needs a container with innerHTML");
9229
+ function emitRenderFail(phase, kind, message) {
9230
+ const errorHash = hash8(message);
9231
+ if (phase !== "mount") {
9232
+ const key = `${phase}|${kind}|${errorHash}`;
9233
+ const nowMs = Date.now();
9234
+ const last = renderFailSeen.get(key);
9235
+ if (last !== void 0 && nowMs - last < RENDER_FAIL_DEDUPE_MS) return;
9236
+ renderFailSeen.set(key, nowMs);
9237
+ }
9238
+ logClient("error", "update.panel.render.fail", {
9239
+ phase,
9240
+ kind,
9241
+ errorHash
9242
+ });
8604
9243
  }
8605
- if (!options || typeof options !== "object") {
8606
- logMountFailure("plugin-id");
8607
- throw new Error("[dsh-plugin-update] install button needs options: pluginId is required");
9244
+ function failMount(kind, message) {
9245
+ emitRenderFail("mount", kind, message);
9246
+ try {
9247
+ clientLog?.flush();
9248
+ } catch {}
8608
9249
  }
8609
- const pluginId = options.pluginId;
8610
- if (typeof pluginId !== "string" || !pluginId) {
8611
- logMountFailure("plugin-id");
8612
- throw new Error(`[dsh-plugin-update] install button needs pluginId: non-empty string (got ${JSON.stringify(pluginId)})`);
9250
+ function clientDroppedRows() {
9251
+ try {
9252
+ const map = clientLog?.droppedByReason?.() ?? {};
9253
+ let total = 0;
9254
+ for (const key of Object.keys(map)) {
9255
+ const n = map[key];
9256
+ if (typeof n === "number" && Number.isFinite(n) && n > 0) total += n;
9257
+ }
9258
+ return total;
9259
+ } catch {
9260
+ return 0;
9261
+ }
9262
+ }
9263
+ let removeGlobalHandlers = null;
9264
+ function installGlobalHandlers() {
9265
+ const g = globalThis;
9266
+ if (typeof g.addEventListener !== "function") return;
9267
+ const onError = (event) => {
9268
+ emitRenderFail("global", "uncaught", errorTextOf(event?.message ?? event) || "uncaught-error");
9269
+ };
9270
+ const onRejection = (event) => {
9271
+ const reason = event?.reason;
9272
+ emitRenderFail("global", "unhandled", errorTextOf(reason) || "unhandled-rejection");
9273
+ };
9274
+ let registered = false;
9275
+ try {
9276
+ g.addEventListener("error", onError);
9277
+ g.addEventListener("unhandledrejection", onRejection);
9278
+ registered = true;
9279
+ } catch {
9280
+ registered = false;
9281
+ }
9282
+ if (registered) removeGlobalHandlers = () => {
9283
+ try {
9284
+ g.removeEventListener?.("error", onError);
9285
+ g.removeEventListener?.("unhandledrejection", onRejection);
9286
+ } catch {}
9287
+ };
9288
+ }
9289
+ if (!options || typeof options !== "object") {
9290
+ const message = "[dsh-plugin-update] install button needs options: pluginId is required";
9291
+ failMount("plugin-id", message);
9292
+ throw new Error(message);
8613
9293
  }
8614
9294
  if (typeof options.call !== "function") {
8615
- logMountFailure("call");
8616
- throw new Error("[dsh-plugin-update] install button needs call (the only channel to host phones)");
9295
+ const message = "[dsh-plugin-update] install button needs call (the only channel to host phones)";
9296
+ failMount("call", message);
9297
+ throw new Error(message);
8617
9298
  }
8618
9299
  const prefix = options.prefix === void 0 ? "wf" : options.prefix;
8619
- let phoneNames;
9300
+ let channelPrefix = "wf";
8620
9301
  try {
8621
- phoneNames = buildPhoneNames(prefix);
8622
- } catch (err) {
8623
- logMountFailure("prefix");
8624
- throw err;
8625
- }
9302
+ buildLogAppendPhoneName(prefix);
9303
+ channelPrefix = String(prefix);
9304
+ } catch {}
8626
9305
  if (!clientLog && !clientLogDisabled) try {
8627
9306
  clientLog = createClientLogChannel({
8628
9307
  call: options.call,
8629
- phoneName: buildLogAppendPhoneName(prefix)
9308
+ phoneName: buildLogAppendPhoneName(channelPrefix)
8630
9309
  });
8631
9310
  clientLogOwned = true;
8632
9311
  } catch {
8633
9312
  clientLog = null;
8634
9313
  }
9314
+ if (!container || typeof container.innerHTML !== "string") {
9315
+ const message = "[dsh-plugin-update] install button needs a container with innerHTML";
9316
+ failMount("container", message);
9317
+ throw new Error(message);
9318
+ }
9319
+ const pluginId = options.pluginId;
9320
+ if (typeof pluginId !== "string" || !pluginId) {
9321
+ const message = `[dsh-plugin-update] install button needs pluginId: non-empty string (got ${JSON.stringify(pluginId)})`;
9322
+ failMount("plugin-id", message);
9323
+ throw new Error(message);
9324
+ }
9325
+ let phoneNames;
9326
+ try {
9327
+ phoneNames = buildPhoneNames(prefix);
9328
+ } catch (err) {
9329
+ failMount("prefix", errorTextOf(err));
9330
+ throw err;
9331
+ }
8635
9332
  const pollMs = options.pollMs === void 0 ? DEFAULT_PANEL_POLL_MS : options.pollMs;
8636
9333
  if (typeof pollMs !== "number" || !Number.isFinite(pollMs) || pollMs < 250) {
8637
- logMountFailure("poll-ms");
8638
- throw new Error(`[dsh-plugin-update] install button pollMs must be >= 250ms (got ${JSON.stringify(options.pollMs)})`);
9334
+ const message = `[dsh-plugin-update] install button pollMs must be >= 250ms (got ${JSON.stringify(options.pollMs)})`;
9335
+ failMount("poll-ms", message);
9336
+ throw new Error(message);
8639
9337
  }
8640
9338
  const autoCheck = options.autoCheck ?? "mount";
8641
9339
  if (autoCheck !== "mount" && autoCheck !== "never") {
8642
- logMountFailure("auto-check");
8643
- throw new Error(`[dsh-plugin-update] install button autoCheck must be mount or never (got ${JSON.stringify(options.autoCheck)})`);
9340
+ const message = `[dsh-plugin-update] install button autoCheck must be mount or never (got ${JSON.stringify(options.autoCheck)})`;
9341
+ failMount("auto-check", message);
9342
+ throw new Error(message);
8644
9343
  }
8645
9344
  if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive") {
8646
- logMountFailure("theme");
8647
- throw new Error(`[dsh-plugin-update] install button theme must be default or archive (got ${JSON.stringify(options.theme)})`);
9345
+ const message = `[dsh-plugin-update] install button theme must be default or archive (got ${JSON.stringify(options.theme)})`;
9346
+ failMount("theme", message);
9347
+ throw new Error(message);
8648
9348
  }
8649
9349
  const theme = options.theme ?? "default";
8650
9350
  try {
8651
9351
  themeTokensStyleFor(options.themeTokens ?? void 0);
8652
9352
  } catch (err) {
8653
- logMountFailure("theme-tokens");
9353
+ failMount("theme-tokens", errorTextOf(err));
8654
9354
  throw err;
8655
9355
  }
8656
9356
  const localeOpt = options.locale ?? void 0;
@@ -8658,12 +9358,14 @@ ${body}`;
8658
9358
  const isStr = typeof localeOpt === "string";
8659
9359
  const isObj = typeof localeOpt === "object" && typeof localeOpt.getActive === "function";
8660
9360
  if (!isStr && !isObj) {
8661
- logMountFailure("locale");
8662
- throw new Error("[dsh-plugin-update] invalid locale: expected zh / en / BCP47 or { getActive(), subscribe? }");
9361
+ const message = "[dsh-plugin-update] invalid locale: expected zh / en / BCP47 or { getActive(), subscribe? }";
9362
+ failMount("locale", message);
9363
+ throw new Error(message);
8663
9364
  }
8664
9365
  if (isStr && !localeOpt.trim()) {
8665
- logMountFailure("locale");
8666
- throw new Error("[dsh-plugin-update] invalid locale: empty string");
9366
+ const message = "[dsh-plugin-update] invalid locale: empty string";
9367
+ failMount("locale", message);
9368
+ throw new Error(message);
8667
9369
  }
8668
9370
  }
8669
9371
  function currentLang() {
@@ -8673,9 +9375,12 @@ ${body}`;
8673
9375
  const profileNameOption = typeof options.profileName === "string" && options.profileName ? options.profileName : null;
8674
9376
  const copyTextOut = options.copyText ?? defaultCopyText;
8675
9377
  const call = options.call;
9378
+ const installSource = options.from ?? "entry";
8676
9379
  let mounted = true;
8677
9380
  let snapshot = null;
8678
9381
  let manual = null;
9382
+ let manualSource = null;
9383
+ let failureRereadDone = false;
8679
9384
  let queue = null;
8680
9385
  let receipt = null;
8681
9386
  let requestId = null;
@@ -8687,10 +9392,16 @@ ${body}`;
8687
9392
  let pollCapped = false;
8688
9393
  let envHostKind = null;
8689
9394
  let envProfileName = null;
9395
+ let envLogHealth = null;
8690
9396
  let copyNotice = null;
8691
9397
  let noticeExpiresAt = 0;
9398
+ let copyBubble = null;
9399
+ let copyBubbleTimer = null;
9400
+ let copyAnchorEl = null;
8692
9401
  let actionBytes = -1;
8693
9402
  let actionTruncated = false;
9403
+ let transportFailStreak = 0;
9404
+ let actionSkipped = false;
8694
9405
  function latchNow() {
8695
9406
  try {
8696
9407
  const n = Date.now();
@@ -8802,12 +9513,17 @@ ${body}`;
8802
9513
  atMs: latchNow()
8803
9514
  };
8804
9515
  }
9516
+ function adoptLogHealth(value) {
9517
+ envLogHealth = isObject(value) ? value : null;
9518
+ }
8805
9519
  function applyStatusReply(reply, via) {
8806
9520
  if (!isObject(reply)) return;
8807
9521
  if (reply["ok"] === true) {
8808
9522
  const s = asSnapshot(reply["snapshot"]);
8809
9523
  if (s) snapshot = s;
8810
9524
  manual = typeof reply["manual"] === "string" ? reply["manual"] : null;
9525
+ manualSource = manual !== null ? "frame" : null;
9526
+ failureRereadDone = false;
8811
9527
  if (reply["receipt"] && isObject(reply["receipt"]) && typeof reply["receipt"]["checkId"] === "string") receipt = { checkId: reply["receipt"]["checkId"] };
8812
9528
  const q = asQueue(reply["queue"]);
8813
9529
  if (q) queue = q;
@@ -8818,6 +9534,7 @@ ${body}`;
8818
9534
  if (typeof pn === "string" && pn.trim()) envProfileName = pn.trim();
8819
9535
  if (typeof hk === "string" && hk.trim()) envHostKind = hk.trim();
8820
9536
  }
9537
+ if (reply["logHealth"] !== void 0) adoptLogHealth(reply["logHealth"]);
8821
9538
  const jobState = snapshot?.job?.state ?? null;
8822
9539
  if (jobState === "installing" || jobState === "verifying") clearLatch();
8823
9540
  else if (jobState === "completed" || jobState === "restart-required") clearLatch();
@@ -8830,7 +9547,11 @@ ${body}`;
8830
9547
  } else {
8831
9548
  const kindText = typeof reply["errorKind"] === "string" ? reply["errorKind"].trim() : "";
8832
9549
  const errText = typeof reply["error"] === "string" ? reply["error"].trim() : "";
8833
- if ((kindText || errText) !== "update-busy") setLatch(latchFromReply(reply, via === "install" ? "install" : "check"));
9550
+ if ((kindText || errText) !== "update-busy") {
9551
+ setLatch(latchFromReply(reply, via === "install" ? "install" : "check"));
9552
+ manualSource = manual ? "carried-over" : null;
9553
+ scheduleFailureReread();
9554
+ }
8834
9555
  try {
8835
9556
  const env = reply["env"];
8836
9557
  if (isObject(env)) {
@@ -8846,6 +9567,25 @@ ${body}`;
8846
9567
  } catch {}
8847
9568
  }
8848
9569
  }
9570
+ function scheduleFailureReread() {
9571
+ if (failureRereadDone || !mounted) return;
9572
+ failureRereadDone = true;
9573
+ (async () => {
9574
+ try {
9575
+ const reply = await call(phoneNames.updateStatus, queueArgs());
9576
+ if (!mounted) return;
9577
+ if (!isObject(reply) || reply["ok"] !== true) return;
9578
+ const s = asSnapshot(reply["snapshot"]);
9579
+ if (s) snapshot = s;
9580
+ manual = typeof reply["manual"] === "string" ? reply["manual"] : null;
9581
+ manualSource = manual !== null ? "frame" : null;
9582
+ const q = asQueue(reply["queue"]);
9583
+ if (q) queue = q;
9584
+ if (reply["logHealth"] !== void 0) adoptLogHealth(reply["logHealth"]);
9585
+ paint();
9586
+ } catch {}
9587
+ })();
9588
+ }
8849
9589
  function queueArgs() {
8850
9590
  return {
8851
9591
  includeQueue: true,
@@ -8881,17 +9621,23 @@ ${body}`;
8881
9621
  noticeExpiresAt = 0;
8882
9622
  }
8883
9623
  const lang = currentLang();
8884
- const html = renderInstallButtonHTML(currentView(), {
9624
+ const view = currentView();
9625
+ const html = renderInstallButtonHTML(view, {
8885
9626
  manual,
8886
9627
  notice: copyNotice,
8887
9628
  theme,
8888
- lang
9629
+ lang,
9630
+ manualSource,
9631
+ failureCode: latch?.code ?? null,
9632
+ fallbackAvailable: view.fallbackStage !== null,
9633
+ registered: snapshot?.registered ?? null,
9634
+ bubble: copyBubble
8889
9635
  });
8890
9636
  try {
8891
9637
  container.innerHTML = html;
8892
9638
  } catch {}
8893
- } catch {
8894
- logClient("error", "update.panel.render.fail", { kind: "unknown" });
9639
+ } catch (err) {
9640
+ emitRenderFail("paint", "render", errorTextOf(err) || "render-failed");
8895
9641
  }
8896
9642
  }
8897
9643
  function sayCopyKey(key, params) {
@@ -8903,14 +9649,59 @@ ${body}`;
8903
9649
  noticeExpiresAt = 0;
8904
9650
  }
8905
9651
  }
9652
+ function showCopyBubble(anchor) {
9653
+ if (copyBubbleTimer !== null) {
9654
+ try {
9655
+ clearTimeout(copyBubbleTimer);
9656
+ } catch {}
9657
+ copyBubbleTimer = null;
9658
+ }
9659
+ let left = 0;
9660
+ let top = 0;
9661
+ try {
9662
+ const el = anchor;
9663
+ const rect = el && typeof el.getBoundingClientRect === "function" ? el.getBoundingClientRect() : null;
9664
+ if (rect) {
9665
+ const l = Number(rect.left);
9666
+ const t = Number(rect.top);
9667
+ const w = Number(rect.width);
9668
+ if (Number.isFinite(l)) left = l + (Number.isFinite(w) ? w / 2 : 0);
9669
+ if (Number.isFinite(t)) top = t - 6;
9670
+ }
9671
+ } catch {
9672
+ left = 0;
9673
+ top = 0;
9674
+ }
9675
+ try {
9676
+ copyBubble = {
9677
+ text: copyText("panel.lastresort.copied", currentLang()),
9678
+ left,
9679
+ top
9680
+ };
9681
+ } catch {
9682
+ copyBubble = null;
9683
+ }
9684
+ try {
9685
+ copyBubbleTimer = setTimeout(() => {
9686
+ copyBubbleTimer = null;
9687
+ copyBubble = null;
9688
+ if (mounted) paint();
9689
+ }, 1400);
9690
+ } catch {
9691
+ copyBubbleTimer = null;
9692
+ }
9693
+ }
8906
9694
  async function refresh() {
8907
9695
  if (!mounted) return;
8908
9696
  try {
8909
9697
  const reply = await call(phoneNames.updateStatus, queueArgs());
8910
9698
  if (!mounted) return;
9699
+ transportFailStreak = 0;
8911
9700
  applyStatusReply(reply, "refresh");
8912
9701
  } catch (err) {
8913
9702
  if (!mounted) return;
9703
+ transportFailStreak++;
9704
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
8914
9705
  if (!thrownBusy(err)) setLatch(volatileLatch("check"));
8915
9706
  }
8916
9707
  if (!mounted) return;
@@ -8919,9 +9710,12 @@ ${body}`;
8919
9710
  try {
8920
9711
  const reply = await call(phoneNames.updateCheck, queueArgs());
8921
9712
  if (!mounted) return;
9713
+ transportFailStreak = 0;
8922
9714
  applyStatusReply(reply, "check");
8923
- } catch {
9715
+ } catch (err) {
8924
9716
  if (!mounted) return;
9717
+ transportFailStreak++;
9718
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
8925
9719
  setLatch(volatileLatch("check"));
8926
9720
  } finally {
8927
9721
  ensuring = false;
@@ -9013,6 +9807,7 @@ ${body}`;
9013
9807
  reply = await call(phoneNames.updateInstall, {
9014
9808
  checkId: receipt.checkId,
9015
9809
  requestId,
9810
+ from: installSource,
9016
9811
  ...queueArgs()
9017
9812
  });
9018
9813
  } catch (err) {
@@ -9072,21 +9867,51 @@ ${body}`;
9072
9867
  targetVersion: latch.targetVersion,
9073
9868
  diag: latch.diag,
9074
9869
  checkId: latch.checkId,
9870
+ logHealth: envLogHealth,
9871
+ transportFailStreak,
9872
+ clientDropped: clientDroppedRows(),
9075
9873
  lang: currentLang()
9076
9874
  }, currentLang());
9077
9875
  } catch {
9078
9876
  return null;
9079
9877
  }
9080
9878
  }
9081
- async function act(kind) {
9879
+ async function act(kind, anchor = null) {
9082
9880
  if (!mounted) return;
9881
+ const startedAtMs = Date.now();
9882
+ copyAnchorEl = anchor;
9083
9883
  actionBytes = -1;
9084
9884
  actionTruncated = false;
9885
+ actionSkipped = false;
9886
+ const latchBefore = latch;
9887
+ let ok = true;
9888
+ let errorKind = null;
9889
+ let errorHash = null;
9085
9890
  try {
9086
9891
  await runAction(kind);
9892
+ } catch (err) {
9893
+ ok = false;
9894
+ errorKind = "thrown";
9895
+ errorHash = hash8(errorTextOf(err));
9896
+ throw err;
9087
9897
  } finally {
9898
+ if (ok) {
9899
+ const latchAfter = latch;
9900
+ if (latchAfter && latchAfter !== latchBefore) {
9901
+ ok = false;
9902
+ errorKind = latchAfter.code;
9903
+ errorHash = hash8(`${latchAfter.code}|${latchAfter.detail ?? ""}`);
9904
+ } else if (actionSkipped) {
9905
+ ok = false;
9906
+ errorKind = "busy";
9907
+ }
9908
+ }
9088
9909
  logClient("info", "update.panel.action", {
9089
9910
  action: kind,
9911
+ ok,
9912
+ errorKind,
9913
+ durationMs: Math.max(0, Date.now() - startedAtMs),
9914
+ ...errorHash ? { errorHash } : {},
9090
9915
  ...actionBytes >= 0 ? {
9091
9916
  bytes: actionBytes,
9092
9917
  truncated: actionTruncated
@@ -9168,6 +9993,7 @@ ${body}`;
9168
9993
  checkId: offer.checkId,
9169
9994
  requestId,
9170
9995
  version: offer.candidate,
9996
+ from: installSource,
9171
9997
  ...queueArgs()
9172
9998
  });
9173
9999
  } catch (err) {
@@ -9216,7 +10042,10 @@ ${body}`;
9216
10042
  copyNotice = null;
9217
10043
  switch (kind) {
9218
10044
  case "check":
9219
- if (busyAct) return;
10045
+ if (busyAct) {
10046
+ actionSkipped = true;
10047
+ return;
10048
+ }
9220
10049
  busyAct = "check";
9221
10050
  copyNotice = copyText("panel.toast.checking", currentLang());
9222
10051
  paint();
@@ -9228,7 +10057,10 @@ ${body}`;
9228
10057
  paint();
9229
10058
  return;
9230
10059
  case "install":
9231
- if (busyAct) return;
10060
+ if (busyAct) {
10061
+ actionSkipped = true;
10062
+ return;
10063
+ }
9232
10064
  busyAct = "install";
9233
10065
  copyNotice = copyText("panel.toast.installing", currentLang());
9234
10066
  paint();
@@ -9240,12 +10072,13 @@ ${body}`;
9240
10072
  paint();
9241
10073
  return;
9242
10074
  case "copy-manual":
9243
- if (manual) try {
10075
+ if (manual && manualSource === "frame") try {
9244
10076
  await copyTextOut(manual);
9245
- sayCopyKey("panel.toast.copy-manual-ok");
10077
+ showCopyBubble(copyAnchorEl);
9246
10078
  } catch {
9247
10079
  sayCopyKey("panel.toast.copy-manual-fail");
9248
10080
  }
10081
+ copyAnchorEl = null;
9249
10082
  paint();
9250
10083
  return;
9251
10084
  case "copy-diag": {
@@ -9264,11 +10097,18 @@ ${body}`;
9264
10097
  return;
9265
10098
  }
9266
10099
  case "install-fallback":
9267
- if (busyAct) return;
10100
+ if (busyAct) {
10101
+ actionSkipped = true;
10102
+ return;
10103
+ }
9268
10104
  await doFallbackResolve();
9269
10105
  return;
9270
10106
  case "install-fallback-confirm":
9271
- if (busyAct || !fallbackOffer) return;
10107
+ if (busyAct) {
10108
+ actionSkipped = true;
10109
+ return;
10110
+ }
10111
+ if (!fallbackOffer) return;
9272
10112
  await doFallbackConfirm();
9273
10113
  return;
9274
10114
  case "wait-latest":
@@ -9285,18 +10125,26 @@ ${body}`;
9285
10125
  const btn = t?.target && typeof t.target.closest === "function" ? t.target.closest("[data-action]") : null;
9286
10126
  const kind = btn?.getAttribute ? btn.getAttribute("data-action") : null;
9287
10127
  if (kind !== "install" && kind !== "check" && kind !== "copy-manual" && kind !== "copy-diag" && kind !== "install-fallback" && kind !== "install-fallback-confirm" && kind !== "wait-latest") return;
9288
- act(kind);
10128
+ act(kind, btn ?? null);
9289
10129
  } catch {}
9290
10130
  }
9291
10131
  function unmount() {
9292
10132
  if (!mounted) return;
9293
10133
  mounted = false;
10134
+ removeGlobalHandlers?.();
10135
+ removeGlobalHandlers = null;
9294
10136
  try {
9295
10137
  unsubLang();
9296
10138
  } catch {}
9297
10139
  try {
9298
10140
  timer.clear(handle);
9299
10141
  } catch {}
10142
+ if (copyBubbleTimer !== null) {
10143
+ try {
10144
+ clearTimeout(copyBubbleTimer);
10145
+ } catch {}
10146
+ copyBubbleTimer = null;
10147
+ }
9300
10148
  try {
9301
10149
  container.removeEventListener?.("click", onClick);
9302
10150
  } catch {}
@@ -9311,6 +10159,7 @@ ${body}`;
9311
10159
  try {
9312
10160
  container.addEventListener?.("click", onClick);
9313
10161
  } catch {}
10162
+ installGlobalHandlers();
9314
10163
  const timer = getTimer();
9315
10164
  const handle = timer.set(() => {
9316
10165
  if (!mounted || busyAct || pollCapped) return;
@@ -12141,7 +12990,7 @@ ${body}`;
12141
12990
  }, react.createElement("span", { style: S.morePkg }, row.pkg), react.createElement("span", { style: S.moreDesc }, row.desc), react.createElement("span", { style: S.moreIcon }, react.createElement(ExternalIcon, null)))));
12142
12991
  }
12143
12992
  /** 版本胶囊那一行字:只在这里拼一次,屏上与用例读的是同一串。 */
12144
- const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.70";
12993
+ const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.72";
12145
12994
  /** 右下角那本书离面板两沿的距离:用户口径「一直处于面板右下角、不随列表滑动消失」
12146
12995
  * ⇒ sticky 吸附(面板相对,视口多大都落在面板角上);INSET=右沿,BOTTOM=底沿。 */
12147
12996
  const MANUAL_ENTRY_INSET = 16;