dsh-life-pack 0.3.71 → 0.3.73

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.25/node_modules/dsh-plugin-update/dist/config.js
474
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/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.25/node_modules/dsh-plugin-update/dist/version-judgment.js
496
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/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.27/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.25/node_modules/dsh-plugin-update/dist/lang.js
595
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/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.27/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.25/node_modules/dsh-plugin-update/dist/bilingual.js
775
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/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,6 +1714,101 @@ 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: "手工备用命令(请复制整行执行):",
@@ -1934,6 +2099,11 @@ window.__ModuleLoader__.load({
1934
2099
  zh: "怎么办:{remedy}",
1935
2100
  draft: true
1936
2101
  },
2102
+ "panel.diag.connection": {
2103
+ en: "Connection: transport failures {fails} · client dropped rows {drops}",
2104
+ zh: "连接:传输失败 {fails} 次 · 客户端丢弃 {drops} 行",
2105
+ draft: true
2106
+ },
1937
2107
  "batch.action.resume": {
1938
2108
  en: "Continue the unfinished batch ({count} left)",
1939
2109
  zh: "继续上次未完成的更新(剩余 {count} 个)。",
@@ -2689,7 +2859,7 @@ window.__ModuleLoader__.load({
2689
2859
  }
2690
2860
  const BILINGUAL_CSS = [".dsh-upd-bi{display:inline;overflow-wrap:anywhere}", ".dsh-upd-bi [lang]{overflow-wrap:anywhere}"].join("\n");
2691
2861
  //#endregion
2692
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/changelog.js
2862
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/changelog.js
2693
2863
  const CHANGELOG_MAX_CHARS = 65536;
2694
2864
  const CHANGELOG_ALL_CATEGORIES = [
2695
2865
  "Added",
@@ -3216,6 +3386,17 @@ window.__ModuleLoader__.load({
3216
3386
  };
3217
3387
  }
3218
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
+ }
3219
3400
  function hasVisibleSections(entry) {
3220
3401
  if (!entry || typeof entry !== "object") return false;
3221
3402
  try {
@@ -3797,13 +3978,18 @@ ${note}${blocks.join("\n")}
3797
3978
  }
3798
3979
  }
3799
3980
  //#endregion
3800
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/log-events.js
3981
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/log-events.js
3801
3982
  const LOG_EVENT_CALL = "host.call";
3802
3983
  const LOG_EVENT_CALL_FAIL = "host.call.fail";
3803
3984
  const LOG_EVENT_INSTALL_EXEC = "update.install.exec";
3804
3985
  const CLIENT_LOG_FLUSH_MS = 1e3;
3805
3986
  const CLIENT_LOG_RETRY_DELAYS_MS = [250, 1e3];
3806
3987
  const CLIENT_LOG_SEND_TIMEOUT_MS = 5e3;
3988
+ const REPORTABLE_DROP_REASONS = [
3989
+ "overflow",
3990
+ "host-refused",
3991
+ "send-failed"
3992
+ ];
3807
3993
  function positiveInt(value, fallback) {
3808
3994
  const n = typeof value === "number" && Number.isFinite(value) ? Math.floor(value) : fallback;
3809
3995
  return n > 0 ? n : fallback;
@@ -3852,13 +4038,50 @@ ${note}${blocks.join("\n")}
3852
4038
  let disposed = false;
3853
4039
  let scheduled = null;
3854
4040
  let inFlight = false;
4041
+ const droppedByReason = {};
4042
+ const droppedEventByReason = {};
4043
+ const reportedDropReasons = /* @__PURE__ */ new Set();
3855
4044
  function noteDrop(row, reason) {
3856
4045
  dropped++;
4046
+ const key = typeof reason === "string" && reason ? reason : "unknown";
4047
+ droppedByReason[key] = (droppedByReason[key] ?? 0) + 1;
4048
+ if (row && typeof row.event === "string" && row.event && !droppedEventByReason[key]) droppedEventByReason[key] = row.event;
3857
4049
  if (!onDrop) return;
3858
4050
  try {
3859
4051
  onDrop(row, reason);
3860
4052
  } catch {}
3861
4053
  }
4054
+ function makeDropReport(reason) {
4055
+ const event = droppedEventByReason[reason];
4056
+ return {
4057
+ level: "warn",
4058
+ event: "update.log.degraded",
4059
+ fields: {
4060
+ reason: `client-drop-${reason}`,
4061
+ ...event ? { event } : {}
4062
+ },
4063
+ ts: now()
4064
+ };
4065
+ }
4066
+ function reportDrops() {
4067
+ if (disposed || call === null || phoneName === "") return;
4068
+ let queued = false;
4069
+ for (const reason of REPORTABLE_DROP_REASONS) {
4070
+ if (!(droppedByReason[reason] > 0)) continue;
4071
+ if (reportedDropReasons.has(reason)) continue;
4072
+ reportedDropReasons.add(reason);
4073
+ push(makeDropReport(reason));
4074
+ queued = true;
4075
+ }
4076
+ if (queued) schedule(0);
4077
+ }
4078
+ function reportDisposedDrop() {
4079
+ if (call === null || phoneName === "") return;
4080
+ if (reportedDropReasons.has("disposed")) return;
4081
+ reportedDropReasons.add("disposed");
4082
+ push(makeDropReport("disposed"));
4083
+ sendBuffered();
4084
+ }
3862
4085
  function push(row) {
3863
4086
  if (count === capacity) {
3864
4087
  const evicted = slots[head];
@@ -3959,12 +4182,8 @@ ${note}${blocks.join("\n")}
3959
4182
  await delay(typeof wait === "number" && Number.isFinite(wait) ? wait : 0);
3960
4183
  }
3961
4184
  }
3962
- async function flush() {
3963
- if (disposed || inFlight || count === 0) return;
3964
- if (!enabled()) {
3965
- while (count > 0) noteDrop(shift(), "no-channel");
3966
- return;
3967
- }
4185
+ async function sendBuffered() {
4186
+ if (inFlight || count === 0) return;
3968
4187
  inFlight = true;
3969
4188
  const batch = [];
3970
4189
  while (batch.length < batchSize && count > 0) {
@@ -3989,10 +4208,36 @@ ${note}${blocks.join("\n")}
3989
4208
  } finally {
3990
4209
  inFlight = false;
3991
4210
  }
4211
+ }
4212
+ async function flush() {
4213
+ if (disposed || inFlight || count === 0) return;
4214
+ if (!enabled()) {
4215
+ while (count > 0) noteDrop(shift(), "no-channel");
4216
+ return;
4217
+ }
4218
+ await sendBuffered();
4219
+ if (disposed) return;
4220
+ reportDrops();
3992
4221
  if (disposed) return;
3993
4222
  if (count >= batchSize) schedule(0);
3994
4223
  else if (count > 0) schedule(flushMs);
3995
4224
  }
4225
+ async function finalFlush() {
4226
+ if (inFlight) {
4227
+ while (count > 0) noteDrop(shift(), "disposed");
4228
+ return;
4229
+ }
4230
+ if (call !== null && phoneName !== "") {
4231
+ for (const reason of REPORTABLE_DROP_REASONS) {
4232
+ if (!(droppedByReason[reason] > 0)) continue;
4233
+ if (reportedDropReasons.has(reason)) continue;
4234
+ reportedDropReasons.add(reason);
4235
+ push(makeDropReport(reason));
4236
+ }
4237
+ await sendBuffered();
4238
+ }
4239
+ while (count > 0) noteDrop(shift(), "disposed");
4240
+ }
3996
4241
  function onVisibilityChange() {
3997
4242
  try {
3998
4243
  const state = visibility?.visibilityState;
@@ -4014,6 +4259,7 @@ ${note}${blocks.join("\n")}
4014
4259
  };
4015
4260
  if (disposed) {
4016
4261
  noteDrop(row, "disposed");
4262
+ reportDisposedDrop();
4017
4263
  return;
4018
4264
  }
4019
4265
  if (!enabled()) {
@@ -4032,59 +4278,165 @@ ${note}${blocks.join("\n")}
4032
4278
  timer.clear(scheduled);
4033
4279
  } catch {}
4034
4280
  scheduled = null;
4035
- while (count > 0) noteDrop(shift(), "disposed");
4036
4281
  if (visibility && typeof visibility.removeEventListener === "function") try {
4037
4282
  visibility.removeEventListener("visibilitychange", onVisibilityChange);
4038
4283
  } catch {}
4284
+ finalFlush();
4039
4285
  }
4040
4286
  return {
4041
4287
  emit,
4042
4288
  flush,
4043
4289
  pending: () => count,
4044
4290
  dropped: () => dropped,
4291
+ droppedByReason: () => ({ ...droppedByReason }),
4045
4292
  sent: () => sent,
4046
4293
  enabled,
4047
4294
  dispose
4048
4295
  };
4049
4296
  }
4050
4297
  //#endregion
4051
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/codes.js
4052
- const BLOCKED_REASONS = [
4053
- "unknown-profile",
4054
- "channel-mismatch",
4055
- "source-install",
4056
- "invalid-installation",
4057
- "installation-changed",
4058
- "pending-restart",
4059
- "registry-conflict",
4060
- "incompatible-node",
4061
- "incompatible-dsh",
4062
- "recovery-required",
4063
- "dev-source"
4064
- ];
4065
- const PHONE_FAILURE_CODES = [
4066
- "check-failed",
4067
- "invalid-release",
4068
- "check-expired",
4069
- "update-busy",
4070
- "install-failed"
4071
- ];
4072
- const CHECK_SIDE_FAILURE_CODES = [
4073
- "check-failed",
4074
- "invalid-release",
4075
- "check-expired"
4076
- ];
4077
- const INTERNAL_CODE = "internal";
4078
- [...BLOCKED_REASONS, ...PHONE_FAILURE_CODES];
4079
- [...[...PHONE_FAILURE_CODES, ...BLOCKED_REASONS]];
4080
- function isOneOf(codes, code) {
4081
- return typeof code === "string" && codes.includes(code);
4082
- }
4083
- function isCheckSideFailureCode(code) {
4084
- return typeof code === "string" && isOneOf(CHECK_SIDE_FAILURE_CODES, code.trim());
4298
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/log/panel-client.js
4299
+ const RENDER_FAIL_DEDUPE_MS = 6e4;
4300
+ function createPanelClientLogShell(options) {
4301
+ const option = options.clientLog;
4302
+ const disabled = option === null;
4303
+ const mountName = option && typeof option === "object" && typeof option.mount === "string" && option.mount ? option.mount : "";
4304
+ let channel = option && typeof option === "object" && option.channel ? option.channel : null;
4305
+ let owned = false;
4306
+ if (!channel && !disabled && typeof options.call === "function") {
4307
+ const call = options.call;
4308
+ try {
4309
+ channel = createClientLogChannel({
4310
+ call: options.coerceReply ? async (phoneName, args) => {
4311
+ const reply = await call(phoneName, args);
4312
+ return reply && typeof reply === "object" ? reply : {};
4313
+ } : (async (phoneName, args) => {
4314
+ return await call(phoneName, args);
4315
+ }),
4316
+ phoneName: options.logAppendPhone
4317
+ });
4318
+ owned = true;
4319
+ } catch {
4320
+ channel = null;
4321
+ }
4322
+ }
4323
+ function errorTextOf(err) {
4324
+ try {
4325
+ if (err && typeof err === "object" && typeof err.message === "string") return err.message;
4326
+ if (typeof err === "string") return err;
4327
+ return String(err ?? "");
4328
+ } catch {
4329
+ return "";
4330
+ }
4331
+ }
4332
+ function log(level, event, fields) {
4333
+ const current = channel;
4334
+ if (!current) return;
4335
+ try {
4336
+ current.emit(level, event, fields);
4337
+ } catch {}
4338
+ }
4339
+ const renderFailSeen = /* @__PURE__ */ new Map();
4340
+ function emitRenderFail(phase, kind, message) {
4341
+ const errorHash = hash8(message);
4342
+ if (phase !== "mount") {
4343
+ const key = `${phase}|${kind}|${errorHash}`;
4344
+ const nowMs = Date.now();
4345
+ const last = renderFailSeen.get(key);
4346
+ if (last !== void 0 && nowMs - last < RENDER_FAIL_DEDUPE_MS) return;
4347
+ renderFailSeen.set(key, nowMs);
4348
+ }
4349
+ log("error", "update.panel.render.fail", {
4350
+ phase,
4351
+ kind,
4352
+ errorHash
4353
+ });
4354
+ }
4355
+ function failMount(kind, message) {
4356
+ emitRenderFail("mount", kind, message);
4357
+ const current = channel;
4358
+ if (!current) return;
4359
+ try {
4360
+ Promise.resolve(current.flush()).catch(() => void 0).then(() => {
4361
+ if (owned) current.dispose();
4362
+ });
4363
+ } catch {}
4364
+ }
4365
+ function droppedRows() {
4366
+ try {
4367
+ const map = channel?.droppedByReason?.() ?? {};
4368
+ let total = 0;
4369
+ for (const key of Object.keys(map)) {
4370
+ const n = map[key];
4371
+ if (typeof n === "number" && Number.isFinite(n) && n > 0) total += n;
4372
+ }
4373
+ return total;
4374
+ } catch {
4375
+ return 0;
4376
+ }
4377
+ }
4378
+ let removeGlobalHandlers = null;
4379
+ function installGlobalHandlers() {
4380
+ const g = globalThis;
4381
+ if (typeof g.addEventListener !== "function") return;
4382
+ const onError = (event) => {
4383
+ emitRenderFail("global", "uncaught", errorTextOf(event?.message ?? event) || "uncaught-error");
4384
+ };
4385
+ const onRejection = (event) => {
4386
+ const reason = event?.reason;
4387
+ emitRenderFail("global", "unhandled", errorTextOf(reason) || "unhandled-rejection");
4388
+ };
4389
+ let registered = false;
4390
+ try {
4391
+ g.addEventListener("error", onError);
4392
+ g.addEventListener("unhandledrejection", onRejection);
4393
+ registered = true;
4394
+ } catch {
4395
+ registered = false;
4396
+ }
4397
+ if (!registered) return;
4398
+ removeGlobalHandlers = () => {
4399
+ try {
4400
+ g.removeEventListener?.("error", onError);
4401
+ } catch {}
4402
+ try {
4403
+ g.removeEventListener?.("unhandledrejection", onRejection);
4404
+ } catch {}
4405
+ };
4406
+ }
4407
+ function removeGlobalHandlersNow() {
4408
+ removeGlobalHandlers?.();
4409
+ removeGlobalHandlers = null;
4410
+ }
4411
+ function dispose() {
4412
+ removeGlobalHandlersNow();
4413
+ if (!owned || !channel) return;
4414
+ try {
4415
+ channel.dispose();
4416
+ } catch {}
4417
+ }
4418
+ return {
4419
+ get channel() {
4420
+ return channel;
4421
+ },
4422
+ get owned() {
4423
+ return owned;
4424
+ },
4425
+ get mountName() {
4426
+ return mountName;
4427
+ },
4428
+ errorTextOf,
4429
+ log,
4430
+ emitRenderFail,
4431
+ failMount,
4432
+ droppedRows,
4433
+ installGlobalHandlers,
4434
+ removeGlobalHandlers: removeGlobalHandlersNow,
4435
+ dispose
4436
+ };
4085
4437
  }
4086
4438
  //#endregion
4087
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/commands.js
4439
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/commands.js
4088
4440
  const MANUAL_SUPPRESSING_REASONS = [
4089
4441
  "source-install",
4090
4442
  "unknown-profile",
@@ -4094,7 +4446,7 @@ ${note}${blocks.join("\n")}
4094
4446
  return reason !== null && reason !== void 0 && MANUAL_SUPPRESSING_REASONS.includes(reason);
4095
4447
  }
4096
4448
  //#endregion
4097
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/manual-absent.js
4449
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/manual-absent.js
4098
4450
  const REASON_KEYS = {
4099
4451
  "unknown-profile": "panel.manual.absent.unknown-profile",
4100
4452
  "source-install": "panel.manual.absent.source-install",
@@ -4130,7 +4482,7 @@ ${note}${blocks.join("\n")}
4130
4482
  return manualAbsentReasonTextOf(null, lang) + joiner + manualAbsentReasonTextOf(reason, lang);
4131
4483
  }
4132
4484
  //#endregion
4133
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/last-resort.js
4485
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/last-resort.js
4134
4486
  const STAGES = [
4135
4487
  "install",
4136
4488
  "check",
@@ -4230,7 +4582,7 @@ ${note}${blocks.join("\n")}
4230
4582
  return verdict("unknown");
4231
4583
  }
4232
4584
  //#endregion
4233
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/install-cause.js
4585
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/install-cause.js
4234
4586
  const CAUSE_KINDS = ["minimum-release-age"];
4235
4587
  const CAUSE_SIGNATURES = [{
4236
4588
  kind: "minimum-release-age",
@@ -4350,7 +4702,7 @@ ${note}${blocks.join("\n")}
4350
4702
  }
4351
4703
  }
4352
4704
  //#endregion
4353
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/redaction.js
4705
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/redaction.js
4354
4706
  const COPY_BUDGET_CHARS = 1500;
4355
4707
  const REDACTED_PATH = "<路径>";
4356
4708
  const REDACTED_SECRET = "<脱敏>";
@@ -4430,7 +4782,7 @@ ${note}${blocks.join("\n")}
4430
4782
  return userinfo.masked ? truncateWithMaskNote(scrubbed, COPY_BUDGET_CHARS) : truncateForCopy(scrubbed);
4431
4783
  }
4432
4784
  //#endregion
4433
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/panel-copy.js
4785
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/panel-copy.js
4434
4786
  const BLOCKED_KEYS = {
4435
4787
  "unknown-profile": {
4436
4788
  title: "panel.blocked.unknown-profile.title",
@@ -4636,6 +4988,7 @@ ${note}${blocks.join("\n")}
4636
4988
  latestVersion: "string",
4637
4989
  environmentKind: "string",
4638
4990
  requestId: "string",
4991
+ intentHash: "string",
4639
4992
  checkId: "string",
4640
4993
  registryHost: "string",
4641
4994
  action: "string",
@@ -4657,6 +5010,7 @@ ${note}${blocks.join("\n")}
4657
5010
  latestVersion: null,
4658
5011
  environmentKind: null,
4659
5012
  requestId: null,
5013
+ intentHash: null,
4660
5014
  checkId: null,
4661
5015
  registryHost: null,
4662
5016
  action: null,
@@ -4711,6 +5065,78 @@ ${note}${blocks.join("\n")}
4711
5065
  return null;
4712
5066
  }
4713
5067
  }
5068
+ const LOG_HEALTH_CONTRACTS = [
5069
+ "ok",
5070
+ "unloaded",
5071
+ "missing",
5072
+ "invalid"
5073
+ ];
5074
+ const LOG_HEALTH_REASONS = [
5075
+ "no-dsh-log",
5076
+ "lease-conflict",
5077
+ "write-fail"
5078
+ ];
5079
+ function logHealthText(health, lang) {
5080
+ if (typeof health !== "object" || health === null) return null;
5081
+ const l = normalizeLangTag(lang ?? "zh");
5082
+ const h = health;
5083
+ try {
5084
+ const unknown = copyText("panel.loghealth.unknown", l);
5085
+ const droppedRaw = h["droppedSinceStart"];
5086
+ const dropped = typeof droppedRaw === "number" && Number.isFinite(droppedRaw) && droppedRaw >= 0 ? String(droppedRaw) : unknown;
5087
+ const contractRaw = typeof h["contract"] === "string" ? h["contract"].trim() : "";
5088
+ const contract = LOG_HEALTH_CONTRACTS.includes(contractRaw) ? copyText(`panel.loghealth.contract.${contractRaw}`, l, { state: contractRaw }) : unknown;
5089
+ const lastRaw = h["lastEventAt"];
5090
+ 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;
5091
+ const switchEnabled = h["switchEnabled"] === true ? copyText("panel.loghealth.switch.on", l) : h["switchEnabled"] === false ? copyText("panel.loghealth.switch.off", l) : unknown;
5092
+ const dirHash = (typeof h["dirHash"] === "string" ? h["dirHash"].trim() : "") || unknown;
5093
+ const sink = typeof h["sink"] === "string" ? h["sink"] : "";
5094
+ let body;
5095
+ if (sink === "self") body = copyText("panel.loghealth.self", l, {
5096
+ sink,
5097
+ dirHash,
5098
+ switch: switchEnabled,
5099
+ dropped,
5100
+ lastEvent,
5101
+ contract
5102
+ });
5103
+ else if (sink === "external") {
5104
+ const gateRaw = typeof h["external"] === "string" ? h["external"] : "";
5105
+ body = copyText(`panel.loghealth.external.${gateRaw === "open" || gateRaw === "closed" ? gateRaw : "unknown"}`, l, {
5106
+ sink,
5107
+ dropped,
5108
+ lastEvent,
5109
+ contract
5110
+ });
5111
+ } else if (sink === "off") {
5112
+ const reasonRaw = typeof h["reason"] === "string" ? h["reason"] : "";
5113
+ body = copyText("panel.loghealth.off", l, {
5114
+ sink,
5115
+ reason: LOG_HEALTH_REASONS.includes(reasonRaw) ? copyText(`panel.loghealth.reason.${reasonRaw}`, l, { code: reasonRaw }) : unknown,
5116
+ dropped,
5117
+ contract
5118
+ });
5119
+ } else if (sink === "pending") body = copyText("panel.loghealth.pending", l, {
5120
+ sink,
5121
+ dirHash,
5122
+ dropped,
5123
+ contract
5124
+ });
5125
+ else body = copyText("panel.loghealth.unrecognized", l);
5126
+ return redactForCopy(copyText("panel.loghealth.line", l, { text: body }));
5127
+ } catch {
5128
+ return null;
5129
+ }
5130
+ }
5131
+ function connectionText(transportFailStreak, clientDropped, lang) {
5132
+ const fails = typeof transportFailStreak === "number" && Number.isFinite(transportFailStreak) && transportFailStreak > 0 ? Math.floor(transportFailStreak) : 0;
5133
+ const drops = typeof clientDropped === "number" && Number.isFinite(clientDropped) && clientDropped > 0 ? Math.floor(clientDropped) : 0;
5134
+ if (fails === 0 && drops === 0) return null;
5135
+ return redactForCopy(copyText("panel.diag.connection", lang ?? "zh", {
5136
+ fails,
5137
+ drops
5138
+ }));
5139
+ }
4714
5140
  function buildUpdateDiagCopy(input, langOverride) {
4715
5141
  const l = normalizeLangTag(langOverride ?? input.lang ?? "zh");
4716
5142
  const unknown = copyText("panel.diag.copy.unknown", l);
@@ -4752,21 +5178,29 @@ ${note}${blocks.join("\n")}
4752
5178
  if (diag.action) prov.push(copyText("panel.diag.copy.field.action", l, { action: diag.action }));
4753
5179
  if (typeof requestRaw === "string" && requestRaw.trim()) prov.push(copyText("panel.diag.copy.field.request", l, { request: requestRaw.trim() }));
4754
5180
  if (typeof checkRaw === "string" && checkRaw.trim()) prov.push(copyText("panel.diag.copy.field.check", l, { check: checkRaw.trim() }));
5181
+ if (diag.intentHash) prov.push(`intent=${diag.intentHash}`);
4755
5182
  prov.push(copyText("panel.diag.copy.field.queue", l, { queue }));
4756
5183
  const updaterText = updaterFieldText(input.updater, l);
4757
5184
  if (updaterText) prov.push(updaterText);
4758
5185
  const format = input.format === "line" ? "line" : "block";
4759
5186
  const provLine = redactForCopy(prov.join(" · "));
4760
- 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 })}`);
4761
- return [
5187
+ const logHealth = logHealthText(input.logHealth ?? null, l);
5188
+ const healthTail = logHealth ? ` \xB7 ${logHealth}` : "";
5189
+ const connection = connectionText(input.transportFailStreak, input.clientDropped, l);
5190
+ const connectionTail = connection ? ` \xB7 ${connection}` : "";
5191
+ 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}`);
5192
+ const blockLines = [
4762
5193
  `[update-diag] ${rawCode} \u2014 ${copy.zh}`,
4763
5194
  ` ${copyText("panel.diag.copy.block.summary", l, { summary: detail })}`,
4764
5195
  ` ${copyText("panel.diag.copy.block.source", l, { source: provLine })}`,
4765
5196
  ` ${copyText("panel.diag.copy.block.remedy", l, { remedy })}`
4766
- ].join("\n");
5197
+ ];
5198
+ if (logHealth) blockLines.push(` ${logHealth}`);
5199
+ if (connection) blockLines.push(` ${connection}`);
5200
+ return blockLines.join("\n");
4767
5201
  }
4768
5202
  //#endregion
4769
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/panel.js
5203
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/panel.js
4770
5204
  function normalizePanelTheme(value) {
4771
5205
  return value === "archive" ? "archive" : "default";
4772
5206
  }
@@ -5430,7 +5864,7 @@ ${note}${blocks.join("\n")}
5430
5864
  const UPDATE_PANEL_ARCHIVE_CSS = [
5431
5865
  "/* Archive 档案卷可选主题:只换颜色/字体/间距;内核 DOM 顺序一字不动,不断复制诊断。 */",
5432
5866
  ".dsh-upd[data-theme=\"archive\"]{--dsh-update-bg-soft:#f7f3ea;--dsh-update-bg:#fffdf6;--dsh-update-text:#1a1a1a;--dsh-update-text-muted:#6f675a;",
5433
- "--dsh-update-border:#e3d9c4;--dsh-update-border-strong:#c4b896;--dsh-update-primary:#c8402a;--dsh-update-primary-deep:#9c2e1d;",
5867
+ "--dsh-update-border:#e3d9c4;--dsh-update-border-strong:#c4b896;--dsh-update-primary:#c8402a;--dsh-update-primary-deep:#9c2e1d;--dsh-update-button-bg:#fbf6ec;",
5434
5868
  "--dsh-update-ok-text:#1a7f37;--dsh-update-ok-bg:#e9f4ea;--dsh-update-warn-text:#8a5a00;--dsh-update-warn-bg:#fbf0d0;",
5435
5869
  "--dsh-update-bad-text:#b3261e;--dsh-update-bad-bg:#fbe9e5;",
5436
5870
  "--dsh-update-font-serif:Georgia,\"Songti SC\",\"STSong\",\"SimSun\",\"Noto Serif CJK SC\",\"Source Han Serif SC\",serif;",
@@ -5555,7 +5989,7 @@ ${note}${blocks.join("\n")}
5555
5989
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-md-hr{border-top-color:var(--dsh-update-border-strong)}",
5556
5990
  "@media (max-width:640px){.dsh-upd[data-theme=\"archive\"]{padding:10px 12px}.dsh-upd[data-theme=\"archive\"]::before{top:12px;right:12px;width:56px;height:56px;font-size:15px;box-shadow:inset 0 0 0 4px var(--dsh-update-bg),inset 0 0 0 5px currentColor}.dsh-upd[data-theme=\"archive\"] .dsh-upd-masthead-title{font-size:19px}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner{padding-right:16px}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner .dsh-upd-sealmini{min-width:28px;height:28px;font-size:14px;line-height:20px}.dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>div:first-child{white-space:normal}}",
5557
5991
  "@media (prefers-color-scheme: dark){.dsh-upd[data-theme=\"archive\"]{--dsh-update-bg-soft:#141210;--dsh-update-bg:#1e1a15;--dsh-update-text:#ece5d3;--dsh-update-text-muted:#a89c83;",
5558
- "--dsh-update-border:#3a3226;--dsh-update-border-strong:#5c4e3b;--dsh-update-primary:#e0684e;--dsh-update-primary-deep:#f0866b;",
5992
+ "--dsh-update-border:#3a3226;--dsh-update-border-strong:#5c4e3b;--dsh-update-primary:#e0684e;--dsh-update-primary-deep:#f0866b;--dsh-update-button-bg:#2a2419;",
5559
5993
  "--dsh-update-ok-text:#8fd6a4;--dsh-update-ok-bg:rgba(80,180,120,.12);--dsh-update-warn-text:#e8c15a;--dsh-update-warn-bg:rgba(232,193,90,.12);",
5560
5994
  "--dsh-update-bad-text:#ef8a7d;--dsh-update-bad-bg:rgba(239,138,125,.12);--dsh-update-shadow:0 1px 2px rgba(0,0,0,.4),0 12px 32px rgba(0,0,0,.45)}}",
5561
5995
  "@media (prefers-color-scheme: dark){.dsh-upd[data-theme=\"archive\"] button[data-primary=\"1\"]{color:#141210}.dsh-upd[data-theme=\"archive\"] button:focus-visible{outline-color:var(--dsh-update-primary-deep)}}",
@@ -5746,10 +6180,23 @@ ${note}${blocks.join("\n")}
5746
6180
  const top = Number.isFinite(bubble.top) ? Math.round(bubble.top) : 0;
5747
6181
  return "<span class=\"dsh-upd-copy-bubble\" role=\"status\" style=\"position:fixed;left:" + left + "px;top:" + top + "px\">" + escapeHtml$3(bubble.text) + "</span>";
5748
6182
  }
6183
+ const CHANGELOG_STATUS_KEYS = {
6184
+ empty: "panel.changelog.status.empty",
6185
+ missing: "panel.changelog.status.missing",
6186
+ "fetch-failed": "panel.changelog.status.fetch-failed",
6187
+ "parse-degraded": "panel.changelog.status.parse-degraded"
6188
+ };
6189
+ function changelogStatusCopyKey(status) {
6190
+ if (!status) return null;
6191
+ return CHANGELOG_STATUS_KEYS[status] ?? null;
6192
+ }
5749
6193
  function renderUpdatePanelKernel(input, view, lang) {
5750
6194
  const { snapshot, manual, queue, mode, showOthers, pluginId, copyNotice } = input;
5751
6195
  const l = normalizeLangTag(lang ?? input.lang ?? "zh");
5752
6196
  const changelogMarkdown = input.changelogMarkdown ?? null;
6197
+ const rawChangelogStatus = input.changelogStatus;
6198
+ const changelogStatusValue = isChangelogStatus(rawChangelogStatus) ? rawChangelogStatus : null;
6199
+ const changelogStatusKey = changelogStatusValue === null ? null : changelogStatusCopyKey(changelogStatusValue);
5753
6200
  const profileName = typeof input.profileName === "string" && input.profileName ? input.profileName : null;
5754
6201
  const b = view.banner;
5755
6202
  const seal = view.seal;
@@ -5819,13 +6266,17 @@ ${note}${blocks.join("\n")}
5819
6266
  {
5820
6267
  let inner = "";
5821
6268
  let hasLog = false;
6269
+ const statusCopyText = changelogStatusKey === null ? "" : copyText(changelogStatusKey, l);
5822
6270
  if (snapshot && snapshot.latestVersion) try {
5823
6271
  const mdText = typeof changelogMarkdown === "string" ? changelogMarkdown : "";
5824
6272
  const report = parseChangelogReport(mdText);
5825
6273
  const entries = report.entries;
5826
6274
  const ranged = changelogForUpdate(entries, snapshot.runningVersion, snapshot.latestVersion, snapshot.installedVersion);
5827
6275
  if (ranged.length === 0 && mdText.trim() && entries.length === 0) {
5828
- 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>`;
6276
+ 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>`;
6277
+ hasLog = false;
6278
+ } else if (!mdText.trim() && statusCopyText) {
6279
+ inner = `<div class="dsh-upd-changelog-wrap"><div class="dsh-upd-changelog-neutral">${escapeHtml$3(statusCopyText)}</div></div>`;
5829
6280
  hasLog = false;
5830
6281
  } else {
5831
6282
  const changelogHTML = renderChangelogHTML(ranged, {
@@ -5860,7 +6311,7 @@ ${changelogHTML}
5860
6311
  } catch {
5861
6312
  inner = "";
5862
6313
  }
5863
- 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>`;
6314
+ 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>`;
5864
6315
  const logCollapsed = input.changelogCollapsed === true;
5865
6316
  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>` : "";
5866
6317
  chapters.push(chapterOf(2, inner, logNote, l));
@@ -5917,6 +6368,8 @@ ${changelogHTML}
5917
6368
  e2: `<code>${LOG_EVENT_CALL_FAIL}</code>`,
5918
6369
  e3: `<code>${LOG_EVENT_INSTALL_EXEC}</code>`
5919
6370
  })}</div>`);
6371
+ const healthLine = logHealthText(input.logHealth, l);
6372
+ if (healthLine) errLines.push(`<div class="dsh-upd-log">${escapeHtml$3(healthLine)}</div>`);
5920
6373
  if (b.kind === "failed" && failRef && (failRef.requestId || failRef.checkId)) errLines.push(`<div class="dsh-upd-log">${copyText("panel.error.log-follow", l, {
5921
6374
  eFail: `<code>${LOG_EVENT_CALL_FAIL}</code>`,
5922
6375
  eCall: `<code>${LOG_EVENT_CALL}</code>`,
@@ -5966,7 +6419,7 @@ ${UPDATE_PANEL_ARCHIVE_CSS}` : UPDATE_PANEL_CSS}</style>
5966
6419
  ${body}`;
5967
6420
  }
5968
6421
  //#endregion
5969
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/entry.js
6422
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/entry.js
5970
6423
  const UPDATE_ENTRY_CSS = [
5971
6424
  ".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)}",
5972
6425
  ".dsh-upd-entry-btn{font:inherit;border:1px solid var(--dsh-update-border,#d1d5db);border-radius:var(--dsh-update-entry-border-radius,6px);",
@@ -6080,7 +6533,7 @@ ${body}`;
6080
6533
  }
6081
6534
  }
6082
6535
  //#endregion
6083
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/panel-batch.js
6536
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/panel-batch.js
6084
6537
  const BATCH_PANEL_POLL = {
6085
6538
  defaultMs: 1500,
6086
6539
  minMs: 250
@@ -6667,7 +7120,7 @@ ${body}`;
6667
7120
  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>" : "";
6668
7121
  const actions = [];
6669
7122
  const off = ctx.inFlight ? " disabled" : "";
6670
- 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>");
7123
+ if (phase === "installing") actions.push("<button type=\"button\" class=\"dsh-upd-busy-btn\" data-act=\"row-install\" data-key=\"" + keyAttr + "\" data-busy=\"1\" aria-busy=\"true\" disabled>" + escapeHtml$2(batchText("batch.row-action.installing", ctx.lang)) + "</button>");
6671
7124
  else if (queued) {
6672
7125
  if (cancelQueuePhoneOf(row) !== null && queuedRequestIdOf(row) !== null) actions.push("<button type=\"button\" data-act=\"row-cancel-queue\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.row-action.cancel-queue", ctx.lang)) + "</button>");
6673
7126
  } else if (phase === "ready" && skipped === null) actions.push("<button type=\"button\" data-act=\"row-install\" data-key=\"" + keyAttr + "\" data-primary=\"1\"" + off + ">" + escapeHtml$2(ctx.busy ? batchText("batch.row-action.queue", ctx.lang) : batchText("batch.row-action.install-row", ctx.lang)) + "</button>");
@@ -6704,7 +7157,7 @@ ${body}`;
6704
7157
  const queued = isQueuedRow(row);
6705
7158
  const off = ctx.inFlight ? " disabled" : "";
6706
7159
  const buttons = [];
6707
- if (phase === "installing") buttons.push("<button type=\"button\" data-act=\"row-install\" data-key=\"" + keyAttr + "\" disabled>" + escapeHtml$2(batchText("batch.row-action.installing", ctx.lang)) + "</button>");
7160
+ if (phase === "installing") buttons.push("<button type=\"button\" class=\"dsh-upd-busy-btn\" data-act=\"row-install\" data-key=\"" + keyAttr + "\" data-busy=\"1\" aria-busy=\"true\" disabled>" + escapeHtml$2(batchText("batch.row-action.installing", ctx.lang)) + "</button>");
6708
7161
  else if (queued) {
6709
7162
  if (cancelQueuePhoneOf(row) !== null && queuedRequestIdOf(row) !== null) buttons.push("<button type=\"button\" data-act=\"row-cancel-queue\" data-key=\"" + keyAttr + "\"" + off + ">" + escapeHtml$2(batchText("batch.row-action.cancel-queue", ctx.lang)) + "</button>");
6710
7163
  } else if (phase === "failed") {
@@ -6827,6 +7280,11 @@ ${body}`;
6827
7280
  ".dsh-upd-bdetail-dialog-bar{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:8px 0;margin-bottom:8px;border-bottom:1px dashed var(--dsh-update-border,#e5e7eb)}",
6828
7281
  ".dsh-upd-bdetail-dialog-bar .dsh-upd-bdetail-actions{margin:0}",
6829
7282
  "@media (prefers-color-scheme: dark){.dsh-upd-batch-title i{color:var(--dsh-update-focus,#93c5fd)}}",
7283
+ ".dsh-upd .dsh-upd-busy-btn:disabled{opacity:1;cursor:progress;font-weight:700;border-color:var(--dsh-update-busy-border,#2563eb);color:var(--dsh-update-busy-border,#2563eb);background:var(--dsh-update-busy-bg,#eff6ff)}",
7284
+ ".dsh-upd .dsh-upd-busy-btn:disabled::before{content:\"\";display:inline-block;width:9px;height:9px;margin-right:6px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;vertical-align:-1px;animation:dsh-upd-busy-spin .8s linear infinite}",
7285
+ ".dsh-upd .dsh-upd-busy-btn[data-busy=\"1\"]{animation:dsh-upd-busy-pulse 1.4s ease-in-out infinite}",
7286
+ "@keyframes dsh-upd-busy-spin{to{transform:rotate(360deg)}}",
7287
+ "@keyframes dsh-upd-busy-pulse{0%,100%{box-shadow:0 0 0 0 rgba(37,99,235,.35)}50%{box-shadow:0 0 0 4px rgba(37,99,235,0)}}",
6830
7288
  "@media (prefers-reduced-motion: reduce){.dsh-upd-batch *{transition:none !important;animation:none !important}}",
6831
7289
  ".dsh-upd-batch{overflow-anchor:none}",
6832
7290
  ".dsh-upd-btable{overflow-anchor:none}",
@@ -6858,13 +7316,17 @@ ${body}`;
6858
7316
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-macros button{font-size:13px;line-height:1.45;padding:6px 12px;margin:0;min-width:0}",
6859
7317
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-macros button:first-child,.dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-macros button[data-primary=\"1\"]{min-width:0}",
6860
7318
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-macros button:not([data-primary=\"1\"]){background:transparent}",
6861
- ".dsh-upd[data-theme=\"archive\"] .dsh-upd-brow-actions button{font-size:12px;line-height:1.45;padding:4px 10px;margin:0;min-width:0;background:transparent}",
6862
- ".dsh-upd[data-theme=\"archive\"] .dsh-upd-bdetail-actions button{font-size:12px;line-height:1.45;padding:4px 10px;margin:0;min-width:0;background:transparent}",
6863
- ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-more button{font-size:12px;line-height:1.45;padding:4px 10px;margin:0;min-width:0;background:transparent}",
7319
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-brow-actions button{font-size:12px;line-height:1.45;padding:4px 10px;margin:0;min-width:0}",
7320
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-brow-actions button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}",
7321
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-bdetail-actions button{font-size:12px;line-height:1.45;padding:4px 10px;margin:0;min-width:0}",
7322
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-bdetail-actions button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}",
7323
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-more button{font-size:12px;line-height:1.45;padding:4px 10px;margin:0;min-width:0}",
7324
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-more button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}",
6864
7325
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-prefs button{font-size:13px;line-height:1.45;padding:6px 12px;margin:0;min-width:0;background:transparent}",
6865
7326
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>.dsh-upd-browline{align-self:stretch;display:flex;align-items:center;gap:10px;flex-wrap:wrap}",
6866
7327
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>.dsh-upd-browline .dsh-upd-blist{flex:1 1 auto;min-width:220px;text-align:left;margin:0;color:var(--dsh-update-text-muted)}",
6867
- ".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>.dsh-upd-browline button{flex:none;margin:0;margin-left:auto;font-size:13px;line-height:1.45;padding:6px 12px;min-width:0;background:transparent}"
7328
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>.dsh-upd-browline button{flex:none;margin:0;margin-left:auto;font-size:13px;line-height:1.45;padding:6px 12px;min-width:0}",
7329
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>.dsh-upd-browline button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}"
6868
7330
  ].join(String.fromCharCode(10));
6869
7331
  function escapeHtml$2(text) {
6870
7332
  return String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -7042,11 +7504,14 @@ ${body}`;
7042
7504
  if (!isObject$2(snapshot)) return null;
7043
7505
  if (snapshot["installed"] === false) return null;
7044
7506
  const running = snapshot["runningVersion"];
7045
- if (typeof running === "string" && running) return running;
7507
+ if (typeof running === "string" && running && !isPlaceholderVersion(running)) return running;
7046
7508
  const installed = snapshot["installedVersion"];
7047
- if (typeof installed === "string" && installed) return installed;
7509
+ if (typeof installed === "string" && installed && !isPlaceholderVersion(installed)) return installed;
7048
7510
  return null;
7049
7511
  }
7512
+ function isPlaceholderVersion(version) {
7513
+ return version === "0.0.0";
7514
+ }
7050
7515
  function jobFailureOf(row) {
7051
7516
  const snapshot = isObject$2(row.snapshot) ? row.snapshot : null;
7052
7517
  if (!snapshot) return null;
@@ -7100,7 +7565,7 @@ ${body}`;
7100
7565
  pluginId: pluginIdOf(row),
7101
7566
  code: job !== null && job.code !== null ? job.code : row.error || "check-failed",
7102
7567
  detail,
7103
- runningVersion: text(snapshot ? snapshot["runningVersion"] : null),
7568
+ runningVersion: snapshot && snapshot["installed"] !== false ? text(snapshot["runningVersion"]) : null,
7104
7569
  installedVersion: text(snapshot ? snapshot["installedVersion"] : null),
7105
7570
  latestVersion: text(snapshot ? snapshot["latestVersion"] : null),
7106
7571
  hostKind: text(row.hostKind),
@@ -7198,17 +7663,75 @@ ${body}`;
7198
7663
  };
7199
7664
  }
7200
7665
  function mountUpdateBatchPanel(container, options) {
7201
- if (!container || typeof container.innerHTML !== "string") throw new Error("[dsh-plugin-update] 挂载批量面板需要一个有 innerHTML 的容器");
7202
- if (!options || typeof options !== "object") throw new Error("[dsh-plugin-update] 挂载批量面板缺少配置:批量电话前缀 prefix 必填");
7203
- const phones = buildBatchPhoneNames(options.prefix);
7204
- if (typeof options.call !== "function") throw new Error("[dsh-plugin-update] 挂载批量面板需要传输函数 call(面板调宿主电话的唯一接触面)");
7666
+ const channelPrefix = (() => {
7667
+ if (!options || typeof options !== "object") return "wf";
7668
+ const rawPrefix = options.prefix;
7669
+ if (typeof rawPrefix !== "string") return "wf";
7670
+ try {
7671
+ buildLogAppendPhoneName(rawPrefix);
7672
+ return rawPrefix;
7673
+ } catch {
7674
+ return "wf";
7675
+ }
7676
+ })();
7677
+ const logShell = createPanelClientLogShell({
7678
+ clientLog: options && typeof options === "object" ? options.clientLog : void 0,
7679
+ call: options && typeof options === "object" && typeof options.call === "function" ? options.call : null,
7680
+ logAppendPhone: buildLogAppendPhoneName(channelPrefix),
7681
+ coerceReply: true
7682
+ });
7683
+ const logClient = logShell.log;
7684
+ const emitRenderFail = logShell.emitRenderFail;
7685
+ const failMount = logShell.failMount;
7686
+ const errorTextOf = logShell.errorTextOf;
7687
+ const installGlobalHandlers = logShell.installGlobalHandlers;
7688
+ const clientLogMountName = logShell.mountName;
7689
+ if (!options || typeof options !== "object") {
7690
+ const message = "[dsh-plugin-update] 挂载批量面板缺少配置:批量电话前缀 prefix 必填";
7691
+ failMount("prefix", message);
7692
+ throw new Error(message);
7693
+ }
7694
+ if (typeof options.call !== "function") {
7695
+ const message = "[dsh-plugin-update] 挂载批量面板需要传输函数 call(面板调宿主电话的唯一接触面)";
7696
+ failMount("call", message);
7697
+ throw new Error(message);
7698
+ }
7699
+ if (!container || typeof container.innerHTML !== "string") {
7700
+ const message = "[dsh-plugin-update] 挂载批量面板需要一个有 innerHTML 的容器";
7701
+ failMount("container", message);
7702
+ throw new Error(message);
7703
+ }
7704
+ let phones;
7705
+ try {
7706
+ phones = buildBatchPhoneNames(options.prefix);
7707
+ } catch (err) {
7708
+ failMount("prefix", errorTextOf(err));
7709
+ throw err;
7710
+ }
7205
7711
  const pollMs = options.pollMs === void 0 ? BATCH_PANEL_POLL.defaultMs : options.pollMs;
7206
- if (typeof pollMs !== "number" || !Number.isFinite(pollMs) || pollMs < BATCH_PANEL_POLL.minMs) throw new Error("[dsh-plugin-update] 批量面板轮询间隔非法:不得小于 250 毫秒(收到 " + JSON.stringify(options.pollMs) + ")");
7712
+ if (typeof pollMs !== "number" || !Number.isFinite(pollMs) || pollMs < BATCH_PANEL_POLL.minMs) {
7713
+ const message = "[dsh-plugin-update] 批量面板轮询间隔非法:不得小于 250 毫秒(收到 " + JSON.stringify(options.pollMs) + ")";
7714
+ failMount("poll-ms", message);
7715
+ throw new Error(message);
7716
+ }
7207
7717
  let mode = options.mode === void 0 ? "embedded" : options.mode;
7208
- if (mode !== "embedded" && mode !== "dialog") throw new Error("[dsh-plugin-update] 摆放形态非法:只收 embedded 或 dialog(收到 " + JSON.stringify(options.mode) + ")");
7209
- if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive") throw new Error("[dsh-plugin-update] 主题非法:只收 default 或 archive(收到 " + JSON.stringify(options.theme) + ")");
7718
+ if (mode !== "embedded" && mode !== "dialog") {
7719
+ const message = "[dsh-plugin-update] 摆放形态非法:只收 embedded 或 dialog(收到 " + JSON.stringify(options.mode) + ")";
7720
+ failMount("mode", message);
7721
+ throw new Error(message);
7722
+ }
7723
+ if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive") {
7724
+ const message = "[dsh-plugin-update] 主题非法:只收 default 或 archive(收到 " + JSON.stringify(options.theme) + ")";
7725
+ failMount("theme", message);
7726
+ throw new Error(message);
7727
+ }
7210
7728
  let theme = normalizePanelTheme(options.theme ?? "default");
7211
- themeTokensStyleFor(options.themeTokens ?? void 0);
7729
+ try {
7730
+ themeTokensStyleFor(options.themeTokens ?? void 0);
7731
+ } catch (err) {
7732
+ failMount("theme-tokens", errorTextOf(err));
7733
+ throw err;
7734
+ }
7212
7735
  let themeTokens = options.themeTokens;
7213
7736
  const call = options.call;
7214
7737
  const titles = options.titles && typeof options.titles === "object" ? options.titles : {};
@@ -7225,6 +7748,15 @@ ${body}`;
7225
7748
  let rows = [];
7226
7749
  let expandedKey = null;
7227
7750
  let lastError = null;
7751
+ let failureLatch = null;
7752
+ function noteFailure(code) {
7753
+ lastError = code;
7754
+ failureLatch = { code };
7755
+ }
7756
+ function clearFailure() {
7757
+ lastError = null;
7758
+ failureLatch = null;
7759
+ }
7228
7760
  let notice = null;
7229
7761
  let noticeKey = null;
7230
7762
  let inFlight = false;
@@ -7237,6 +7769,12 @@ ${body}`;
7237
7769
  function currentLang() {
7238
7770
  return langOf(localeOpt);
7239
7771
  }
7772
+ const mountRowFields = {
7773
+ mode: clientLogMountName || mode,
7774
+ theme,
7775
+ lang: currentLang(),
7776
+ pollMs
7777
+ };
7240
7778
  const checkOnOpenOption = options["checkOnOpen"] !== false;
7241
7779
  const autoResumeOption = options["autoResume"] !== false;
7242
7780
  let lastSession = null;
@@ -7245,6 +7783,10 @@ ${body}`;
7245
7783
  let lastCheckedAt = 0;
7246
7784
  let autoCheckDone = false;
7247
7785
  let autoResumeDone = false;
7786
+ let mountRowLogged = false;
7787
+ let firstRefreshFailed = false;
7788
+ let autoCheckOutcome = null;
7789
+ let currentActionSkips = null;
7248
7790
  const rowFallbackOffers = /* @__PURE__ */ new Map();
7249
7791
  let fallbackBusyKey = null;
7250
7792
  let batchCompliantKeys = [];
@@ -7389,6 +7931,13 @@ ${body}`;
7389
7931
  let lastHTML = "";
7390
7932
  function render() {
7391
7933
  if (!mounted) return;
7934
+ try {
7935
+ paint();
7936
+ } catch (err) {
7937
+ emitRenderFail("paint", "render", errorTextOf(err) || "render-failed");
7938
+ }
7939
+ }
7940
+ function paint() {
7392
7941
  const offers = {};
7393
7942
  for (const [k, v] of rowFallbackOffers) offers[k] = {
7394
7943
  candidate: v.candidate,
@@ -7616,7 +8165,7 @@ ${body}`;
7616
8165
  }
7617
8166
  function applyReply(reply) {
7618
8167
  if (!isObject$2(reply)) {
7619
- lastError = "internal";
8168
+ noteFailure("internal");
7620
8169
  return;
7621
8170
  }
7622
8171
  if (reply["ok"] === true) {
@@ -7644,13 +8193,13 @@ ${body}`;
7644
8193
  }
7645
8194
  if (isObject$2(reply["prefs"])) lastPrefs = reply["prefs"];
7646
8195
  loaded = true;
7647
- lastError = null;
8196
+ clearFailure();
7648
8197
  if (expandedKey !== null && !rows.some((row) => row.key === expandedKey)) expandedKey = null;
7649
8198
  pruneFallbackOffers();
7650
8199
  return;
7651
8200
  }
7652
8201
  const err = typeof reply["error"] === "string" ? reply["error"].trim() : "";
7653
- lastError = (typeof reply["errorKind"] === "string" ? reply["errorKind"].trim() : "") || err || "internal";
8202
+ noteFailure((typeof reply["errorKind"] === "string" ? reply["errorKind"].trim() : "") || err || "internal");
7654
8203
  }
7655
8204
  async function refresh() {
7656
8205
  if (!mounted || refreshing) return;
@@ -7659,9 +8208,11 @@ ${body}`;
7659
8208
  const reply = await call(phones.status, {});
7660
8209
  if (!mounted) return;
7661
8210
  applyReply(reply);
7662
- } catch {
8211
+ } catch (err) {
7663
8212
  if (!mounted) return;
7664
- lastError = "check-failed";
8213
+ noteFailure("check-failed");
8214
+ if (!mountRowLogged) firstRefreshFailed = true;
8215
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
7665
8216
  } finally {
7666
8217
  refreshing = false;
7667
8218
  }
@@ -7670,7 +8221,10 @@ ${body}`;
7670
8221
  maybeAutoPlanCompliant();
7671
8222
  }
7672
8223
  async function phone(name, args, busyRowKey = null) {
7673
- if (!mounted || inFlight) return null;
8224
+ if (!mounted || inFlight) {
8225
+ if (currentActionSkips) currentActionSkips.busy = true;
8226
+ return null;
8227
+ }
7674
8228
  inFlight = true;
7675
8229
  inFlightIsCheck = name === phones.check;
7676
8230
  clearNotice();
@@ -7680,6 +8234,7 @@ ${body}`;
7680
8234
  const reply = await call(name, args);
7681
8235
  if (!mounted) return null;
7682
8236
  if (busyRowKey !== null && isBusyReply(reply)) {
8237
+ if (currentActionSkips) currentActionSkips.busy = true;
7683
8238
  say(batchText("batch.toast.queue-missed", currentLang()), busyRowKey);
7684
8239
  return null;
7685
8240
  }
@@ -7688,7 +8243,7 @@ ${body}`;
7688
8243
  out = isObject$2(reply) ? reply : null;
7689
8244
  } catch {
7690
8245
  if (!mounted) return null;
7691
- lastError = "check-failed";
8246
+ noteFailure("check-failed");
7692
8247
  out = null;
7693
8248
  } finally {
7694
8249
  inFlight = false;
@@ -7710,6 +8265,15 @@ ${body}`;
7710
8265
  }
7711
8266
  return checkOnOpenOption;
7712
8267
  }
8268
+ function logMountRowOnce() {
8269
+ if (mountRowLogged || !mounted) return;
8270
+ mountRowLogged = true;
8271
+ const autoCheck = autoCheckOutcome ?? (firstRefreshFailed ? "failed" : checkOnOpenEffective() ? "recent" : "disabled");
8272
+ logClient("info", "update.panel.mount", {
8273
+ ...mountRowFields,
8274
+ autoCheck
8275
+ });
8276
+ }
7713
8277
  function nowMs() {
7714
8278
  try {
7715
8279
  return Date.now();
@@ -7723,6 +8287,41 @@ ${body}`;
7723
8287
  confirmCancelArmed = false;
7724
8288
  render();
7725
8289
  }
8290
+ const startedAtMs = Date.now();
8291
+ const skipToken = { busy: false };
8292
+ currentActionSkips = skipToken;
8293
+ const latchBefore = failureLatch;
8294
+ let ok = true;
8295
+ let errorKind = null;
8296
+ let errorHash = null;
8297
+ try {
8298
+ await runAct(kind, key);
8299
+ } catch (err) {
8300
+ ok = false;
8301
+ errorKind = "thrown";
8302
+ errorHash = hash8(errorTextOf(err));
8303
+ throw err;
8304
+ } finally {
8305
+ if (ok && failureLatch !== latchBefore) {
8306
+ ok = false;
8307
+ errorKind = failureLatch?.code ?? lastError ?? "internal";
8308
+ errorHash = hash8(errorKind);
8309
+ } else if (ok && skipToken.busy) {
8310
+ ok = false;
8311
+ errorKind = "busy";
8312
+ }
8313
+ currentActionSkips = null;
8314
+ logClient("info", "update.panel.action", {
8315
+ action: kind,
8316
+ ok,
8317
+ errorKind,
8318
+ durationMs: Math.max(0, Date.now() - startedAtMs),
8319
+ ...errorHash ? { errorHash } : {}
8320
+ });
8321
+ }
8322
+ }
8323
+ async function runAct(kind, key) {
8324
+ if (!mounted) return;
7726
8325
  switch (kind) {
7727
8326
  case "check":
7728
8327
  await phone(phones.check, {});
@@ -8171,11 +8770,21 @@ ${body}`;
8171
8770
  } catch {}
8172
8771
  }
8173
8772
  async function autoOnce() {
8773
+ try {
8774
+ await runAutoOnce();
8775
+ } catch {
8776
+ if (autoCheckOutcome === null) autoCheckOutcome = "failed";
8777
+ } finally {
8778
+ logMountRowOnce();
8779
+ }
8780
+ }
8781
+ async function runAutoOnce() {
8174
8782
  if (!mounted) return;
8175
8783
  if (autoResumeOption && !autoResumeDone) {
8176
8784
  autoResumeDone = true;
8177
8785
  if (hasUnfinishedRows(rows, lastSession ?? void 0) && !inFlight && !refreshing) {
8178
8786
  const before = lastError;
8787
+ const latchBefore = failureLatch;
8179
8788
  try {
8180
8789
  const reply = await call(phones.resume, {});
8181
8790
  if (!mounted) return;
@@ -8185,11 +8794,13 @@ ${body}`;
8185
8794
  say(batchText("batch.notice.auto-resumed", currentLang(), { count: String(remainingCount()) }));
8186
8795
  rowFailedAt.clear();
8187
8796
  }
8797
+ autoCheckOutcome = "recent";
8188
8798
  render();
8189
8799
  maybeAutoRowChangelog(expandedKey);
8190
8800
  return;
8191
8801
  }
8192
8802
  lastError = before;
8803
+ failureLatch = latchBefore;
8193
8804
  render();
8194
8805
  } catch {
8195
8806
  if (mounted) render();
@@ -8198,23 +8809,37 @@ ${body}`;
8198
8809
  }
8199
8810
  if (!autoCheckDone) {
8200
8811
  autoCheckDone = true;
8201
- if (!checkOnOpenEffective()) return;
8202
- if (hasUnfinishedRows(rows, lastSession ?? void 0)) return;
8203
- if (!(lastCheckedAt <= 0 || nowMs() - lastCheckedAt >= 6e4) || inFlight || refreshing) return;
8812
+ if (!checkOnOpenEffective()) {
8813
+ autoCheckOutcome = "disabled";
8814
+ return;
8815
+ }
8816
+ if (hasUnfinishedRows(rows, lastSession ?? void 0)) {
8817
+ autoCheckOutcome = "recent";
8818
+ return;
8819
+ }
8820
+ if (!(lastCheckedAt <= 0 || nowMs() - lastCheckedAt >= 6e4) || inFlight || refreshing) {
8821
+ autoCheckOutcome = "recent";
8822
+ return;
8823
+ }
8204
8824
  const before = lastError;
8825
+ const latchBefore = failureLatch;
8205
8826
  try {
8206
8827
  const reply = await call(phones.check, {});
8207
8828
  if (!mounted) return;
8208
8829
  if (isObject$2(reply) && reply["ok"] === true) {
8209
8830
  applyReply(reply);
8210
8831
  rowFailedAt.clear();
8832
+ autoCheckOutcome = "started";
8211
8833
  render();
8212
8834
  maybeAutoRowChangelog(expandedKey);
8213
8835
  return;
8214
8836
  }
8215
8837
  lastError = before;
8838
+ failureLatch = latchBefore;
8839
+ autoCheckOutcome = "failed";
8216
8840
  render();
8217
8841
  } catch {
8842
+ autoCheckOutcome = "failed";
8218
8843
  if (mounted) render();
8219
8844
  }
8220
8845
  }
@@ -8236,6 +8861,7 @@ ${body}`;
8236
8861
  try {
8237
8862
  container.removeEventListener?.("keydown", onKeyDown);
8238
8863
  } catch {}
8864
+ logShell.dispose();
8239
8865
  }
8240
8866
  const unsubLang = subscribeLang(() => {
8241
8867
  render();
@@ -8247,6 +8873,7 @@ ${body}`;
8247
8873
  try {
8248
8874
  container.addEventListener?.("keydown", onKeyDown);
8249
8875
  } catch {}
8876
+ installGlobalHandlers();
8250
8877
  const timer = getTimer$1();
8251
8878
  const handle = timer.set(() => {
8252
8879
  if (inFlight && inFlightIsCheck) return;
@@ -8269,7 +8896,7 @@ ${body}`;
8269
8896
  };
8270
8897
  }
8271
8898
  //#endregion
8272
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/entry-batch.js
8899
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/entry-batch.js
8273
8900
  function isObject$1(value) {
8274
8901
  return !!value && typeof value === "object" && !Array.isArray(value);
8275
8902
  }
@@ -8513,7 +9140,8 @@ ${body}`;
8513
9140
  checkOnOpen: options.checkOnOpen,
8514
9141
  autoResume: options.autoResume,
8515
9142
  onCloseRequested: () => close(),
8516
- call: panelCall
9143
+ call: panelCall,
9144
+ clientLog: { mount: "batch" }
8517
9145
  });
8518
9146
  panelMode = mode;
8519
9147
  }
@@ -8923,62 +9551,146 @@ ${body}`;
8923
9551
  channel.emit(level, event, fields);
8924
9552
  } catch {}
8925
9553
  }
8926
- function logMountFailure(kind) {
8927
- logClient("error", "update.panel.render.fail", { kind });
9554
+ const RENDER_FAIL_DEDUPE_MS = 6e4;
9555
+ const renderFailSeen = /* @__PURE__ */ new Map();
9556
+ function errorTextOf(err) {
9557
+ if (err && typeof err === "object" && typeof err.message === "string") return err.message;
9558
+ if (typeof err === "string") return err;
9559
+ try {
9560
+ return String(err ?? "");
9561
+ } catch {
9562
+ return "";
9563
+ }
8928
9564
  }
8929
- if (!container || typeof container.innerHTML !== "string") {
8930
- logMountFailure("container");
8931
- throw new Error("[dsh-plugin-update] install button needs a container with innerHTML");
9565
+ function emitRenderFail(phase, kind, message) {
9566
+ const errorHash = hash8(message);
9567
+ if (phase !== "mount") {
9568
+ const key = `${phase}|${kind}|${errorHash}`;
9569
+ const nowMs = Date.now();
9570
+ const last = renderFailSeen.get(key);
9571
+ if (last !== void 0 && nowMs - last < RENDER_FAIL_DEDUPE_MS) return;
9572
+ renderFailSeen.set(key, nowMs);
9573
+ }
9574
+ logClient("error", "update.panel.render.fail", {
9575
+ phase,
9576
+ kind,
9577
+ errorHash
9578
+ });
8932
9579
  }
8933
- if (!options || typeof options !== "object") {
8934
- logMountFailure("plugin-id");
8935
- throw new Error("[dsh-plugin-update] install button needs options: pluginId is required");
9580
+ function failMount(kind, message) {
9581
+ emitRenderFail("mount", kind, message);
9582
+ const channel = clientLog;
9583
+ if (!channel) return;
9584
+ try {
9585
+ Promise.resolve(channel.flush()).catch(() => void 0).then(() => {
9586
+ if (clientLogOwned) channel.dispose();
9587
+ });
9588
+ } catch {}
8936
9589
  }
8937
- const pluginId = options.pluginId;
8938
- if (typeof pluginId !== "string" || !pluginId) {
8939
- logMountFailure("plugin-id");
8940
- throw new Error(`[dsh-plugin-update] install button needs pluginId: non-empty string (got ${JSON.stringify(pluginId)})`);
9590
+ function clientDroppedRows() {
9591
+ try {
9592
+ const map = clientLog?.droppedByReason?.() ?? {};
9593
+ let total = 0;
9594
+ for (const key of Object.keys(map)) {
9595
+ const n = map[key];
9596
+ if (typeof n === "number" && Number.isFinite(n) && n > 0) total += n;
9597
+ }
9598
+ return total;
9599
+ } catch {
9600
+ return 0;
9601
+ }
9602
+ }
9603
+ let removeGlobalHandlers = null;
9604
+ function installGlobalHandlers() {
9605
+ const g = globalThis;
9606
+ if (typeof g.addEventListener !== "function") return;
9607
+ const onError = (event) => {
9608
+ emitRenderFail("global", "uncaught", errorTextOf(event?.message ?? event) || "uncaught-error");
9609
+ };
9610
+ const onRejection = (event) => {
9611
+ const reason = event?.reason;
9612
+ emitRenderFail("global", "unhandled", errorTextOf(reason) || "unhandled-rejection");
9613
+ };
9614
+ let registered = false;
9615
+ try {
9616
+ g.addEventListener("error", onError);
9617
+ g.addEventListener("unhandledrejection", onRejection);
9618
+ registered = true;
9619
+ } catch {
9620
+ registered = false;
9621
+ }
9622
+ if (registered) removeGlobalHandlers = () => {
9623
+ try {
9624
+ g.removeEventListener?.("error", onError);
9625
+ g.removeEventListener?.("unhandledrejection", onRejection);
9626
+ } catch {}
9627
+ };
9628
+ }
9629
+ if (!options || typeof options !== "object") {
9630
+ const message = "[dsh-plugin-update] install button needs options: pluginId is required";
9631
+ failMount("plugin-id", message);
9632
+ throw new Error(message);
8941
9633
  }
8942
9634
  if (typeof options.call !== "function") {
8943
- logMountFailure("call");
8944
- throw new Error("[dsh-plugin-update] install button needs call (the only channel to host phones)");
9635
+ const message = "[dsh-plugin-update] install button needs call (the only channel to host phones)";
9636
+ failMount("call", message);
9637
+ throw new Error(message);
8945
9638
  }
8946
9639
  const prefix = options.prefix === void 0 ? "wf" : options.prefix;
8947
- let phoneNames;
9640
+ let channelPrefix = "wf";
8948
9641
  try {
8949
- phoneNames = buildPhoneNames(prefix);
8950
- } catch (err) {
8951
- logMountFailure("prefix");
8952
- throw err;
8953
- }
9642
+ buildLogAppendPhoneName(prefix);
9643
+ channelPrefix = String(prefix);
9644
+ } catch {}
8954
9645
  if (!clientLog && !clientLogDisabled) try {
8955
9646
  clientLog = createClientLogChannel({
8956
9647
  call: options.call,
8957
- phoneName: buildLogAppendPhoneName(prefix)
9648
+ phoneName: buildLogAppendPhoneName(channelPrefix)
8958
9649
  });
8959
9650
  clientLogOwned = true;
8960
9651
  } catch {
8961
9652
  clientLog = null;
8962
9653
  }
9654
+ if (!container || typeof container.innerHTML !== "string") {
9655
+ const message = "[dsh-plugin-update] install button needs a container with innerHTML";
9656
+ failMount("container", message);
9657
+ throw new Error(message);
9658
+ }
9659
+ const pluginId = options.pluginId;
9660
+ if (typeof pluginId !== "string" || !pluginId) {
9661
+ const message = `[dsh-plugin-update] install button needs pluginId: non-empty string (got ${JSON.stringify(pluginId)})`;
9662
+ failMount("plugin-id", message);
9663
+ throw new Error(message);
9664
+ }
9665
+ let phoneNames;
9666
+ try {
9667
+ phoneNames = buildPhoneNames(prefix);
9668
+ } catch (err) {
9669
+ failMount("prefix", errorTextOf(err));
9670
+ throw err;
9671
+ }
8963
9672
  const pollMs = options.pollMs === void 0 ? DEFAULT_PANEL_POLL_MS : options.pollMs;
8964
9673
  if (typeof pollMs !== "number" || !Number.isFinite(pollMs) || pollMs < 250) {
8965
- logMountFailure("poll-ms");
8966
- throw new Error(`[dsh-plugin-update] install button pollMs must be >= 250ms (got ${JSON.stringify(options.pollMs)})`);
9674
+ const message = `[dsh-plugin-update] install button pollMs must be >= 250ms (got ${JSON.stringify(options.pollMs)})`;
9675
+ failMount("poll-ms", message);
9676
+ throw new Error(message);
8967
9677
  }
8968
9678
  const autoCheck = options.autoCheck ?? "mount";
8969
9679
  if (autoCheck !== "mount" && autoCheck !== "never") {
8970
- logMountFailure("auto-check");
8971
- throw new Error(`[dsh-plugin-update] install button autoCheck must be mount or never (got ${JSON.stringify(options.autoCheck)})`);
9680
+ const message = `[dsh-plugin-update] install button autoCheck must be mount or never (got ${JSON.stringify(options.autoCheck)})`;
9681
+ failMount("auto-check", message);
9682
+ throw new Error(message);
8972
9683
  }
8973
9684
  if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive") {
8974
- logMountFailure("theme");
8975
- throw new Error(`[dsh-plugin-update] install button theme must be default or archive (got ${JSON.stringify(options.theme)})`);
9685
+ const message = `[dsh-plugin-update] install button theme must be default or archive (got ${JSON.stringify(options.theme)})`;
9686
+ failMount("theme", message);
9687
+ throw new Error(message);
8976
9688
  }
8977
9689
  const theme = options.theme ?? "default";
8978
9690
  try {
8979
9691
  themeTokensStyleFor(options.themeTokens ?? void 0);
8980
9692
  } catch (err) {
8981
- logMountFailure("theme-tokens");
9693
+ failMount("theme-tokens", errorTextOf(err));
8982
9694
  throw err;
8983
9695
  }
8984
9696
  const localeOpt = options.locale ?? void 0;
@@ -8986,12 +9698,14 @@ ${body}`;
8986
9698
  const isStr = typeof localeOpt === "string";
8987
9699
  const isObj = typeof localeOpt === "object" && typeof localeOpt.getActive === "function";
8988
9700
  if (!isStr && !isObj) {
8989
- logMountFailure("locale");
8990
- throw new Error("[dsh-plugin-update] invalid locale: expected zh / en / BCP47 or { getActive(), subscribe? }");
9701
+ const message = "[dsh-plugin-update] invalid locale: expected zh / en / BCP47 or { getActive(), subscribe? }";
9702
+ failMount("locale", message);
9703
+ throw new Error(message);
8991
9704
  }
8992
9705
  if (isStr && !localeOpt.trim()) {
8993
- logMountFailure("locale");
8994
- throw new Error("[dsh-plugin-update] invalid locale: empty string");
9706
+ const message = "[dsh-plugin-update] invalid locale: empty string";
9707
+ failMount("locale", message);
9708
+ throw new Error(message);
8995
9709
  }
8996
9710
  }
8997
9711
  function currentLang() {
@@ -9001,8 +9715,10 @@ ${body}`;
9001
9715
  const profileNameOption = typeof options.profileName === "string" && options.profileName ? options.profileName : null;
9002
9716
  const copyTextOut = options.copyText ?? defaultCopyText;
9003
9717
  const call = options.call;
9718
+ const installSource = options.from ?? "entry";
9004
9719
  let mounted = true;
9005
9720
  let snapshot = null;
9721
+ let mountAutoCheckState = null;
9006
9722
  let manual = null;
9007
9723
  let manualSource = null;
9008
9724
  let failureRereadDone = false;
@@ -9017,6 +9733,7 @@ ${body}`;
9017
9733
  let pollCapped = false;
9018
9734
  let envHostKind = null;
9019
9735
  let envProfileName = null;
9736
+ let envLogHealth = null;
9020
9737
  let copyNotice = null;
9021
9738
  let noticeExpiresAt = 0;
9022
9739
  let copyBubble = null;
@@ -9024,6 +9741,8 @@ ${body}`;
9024
9741
  let copyAnchorEl = null;
9025
9742
  let actionBytes = -1;
9026
9743
  let actionTruncated = false;
9744
+ let transportFailStreak = 0;
9745
+ let currentActionSkips = null;
9027
9746
  function latchNow() {
9028
9747
  try {
9029
9748
  const n = Date.now();
@@ -9135,6 +9854,9 @@ ${body}`;
9135
9854
  atMs: latchNow()
9136
9855
  };
9137
9856
  }
9857
+ function adoptLogHealth(value) {
9858
+ envLogHealth = isObject(value) ? value : null;
9859
+ }
9138
9860
  function applyStatusReply(reply, via) {
9139
9861
  if (!isObject(reply)) return;
9140
9862
  if (reply["ok"] === true) {
@@ -9153,6 +9875,7 @@ ${body}`;
9153
9875
  if (typeof pn === "string" && pn.trim()) envProfileName = pn.trim();
9154
9876
  if (typeof hk === "string" && hk.trim()) envHostKind = hk.trim();
9155
9877
  }
9878
+ if (reply["logHealth"] !== void 0) adoptLogHealth(reply["logHealth"]);
9156
9879
  const jobState = snapshot?.job?.state ?? null;
9157
9880
  if (jobState === "installing" || jobState === "verifying") clearLatch();
9158
9881
  else if (jobState === "completed" || jobState === "restart-required") clearLatch();
@@ -9199,6 +9922,7 @@ ${body}`;
9199
9922
  manualSource = manual !== null ? "frame" : null;
9200
9923
  const q = asQueue(reply["queue"]);
9201
9924
  if (q) queue = q;
9925
+ if (reply["logHealth"] !== void 0) adoptLogHealth(reply["logHealth"]);
9202
9926
  paint();
9203
9927
  } catch {}
9204
9928
  })();
@@ -9253,8 +9977,8 @@ ${body}`;
9253
9977
  try {
9254
9978
  container.innerHTML = html;
9255
9979
  } catch {}
9256
- } catch {
9257
- logClient("error", "update.panel.render.fail", { kind: "unknown" });
9980
+ } catch (err) {
9981
+ emitRenderFail("paint", "render", errorTextOf(err) || "render-failed");
9258
9982
  }
9259
9983
  }
9260
9984
  function sayCopyKey(key, params) {
@@ -9310,28 +10034,40 @@ ${body}`;
9310
10034
  }
9311
10035
  async function refresh() {
9312
10036
  if (!mounted) return;
10037
+ let refreshFailed = false;
9313
10038
  try {
9314
10039
  const reply = await call(phoneNames.updateStatus, queueArgs());
9315
10040
  if (!mounted) return;
10041
+ transportFailStreak = 0;
9316
10042
  applyStatusReply(reply, "refresh");
9317
10043
  } catch (err) {
9318
10044
  if (!mounted) return;
10045
+ refreshFailed = true;
10046
+ transportFailStreak++;
10047
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
9319
10048
  if (!thrownBusy(err)) setLatch(volatileLatch("check"));
9320
10049
  }
9321
10050
  if (!mounted) return;
9322
- if (autoCheck !== "never" && !busyAct && !ensuring && snapshot && !snapshot.latestVersion) {
10051
+ let autoCheckOutcome;
10052
+ if (refreshFailed || !snapshot) autoCheckOutcome = "failed";
10053
+ else if (autoCheck !== "never" && !busyAct && !ensuring && !snapshot.latestVersion) {
10054
+ autoCheckOutcome = "started";
9323
10055
  ensuring = true;
9324
10056
  try {
9325
10057
  const reply = await call(phoneNames.updateCheck, queueArgs());
9326
10058
  if (!mounted) return;
10059
+ transportFailStreak = 0;
9327
10060
  applyStatusReply(reply, "check");
9328
- } catch {
10061
+ } catch (err) {
9329
10062
  if (!mounted) return;
10063
+ transportFailStreak++;
10064
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
9330
10065
  setLatch(volatileLatch("check"));
9331
10066
  } finally {
9332
10067
  ensuring = false;
9333
10068
  }
9334
- }
10069
+ } else autoCheckOutcome = "recent";
10070
+ if (mountAutoCheckState === null) mountAutoCheckState = autoCheckOutcome;
9335
10071
  paint();
9336
10072
  }
9337
10073
  function jobActive() {
@@ -9418,6 +10154,7 @@ ${body}`;
9418
10154
  reply = await call(phoneNames.updateInstall, {
9419
10155
  checkId: receipt.checkId,
9420
10156
  requestId,
10157
+ from: installSource,
9421
10158
  ...queueArgs()
9422
10159
  });
9423
10160
  } catch (err) {
@@ -9460,7 +10197,7 @@ ${body}`;
9460
10197
  }
9461
10198
  }
9462
10199
  function diagText() {
9463
- if (!latch || latch.volatile) return null;
10200
+ if (!latch) return null;
9464
10201
  try {
9465
10202
  return buildUpdateDiagCopy({
9466
10203
  pluginId,
@@ -9477,6 +10214,9 @@ ${body}`;
9477
10214
  targetVersion: latch.targetVersion,
9478
10215
  diag: latch.diag,
9479
10216
  checkId: latch.checkId,
10217
+ logHealth: envLogHealth,
10218
+ transportFailStreak,
10219
+ clientDropped: clientDroppedRows(),
9480
10220
  lang: currentLang()
9481
10221
  }, currentLang());
9482
10222
  } catch {
@@ -9485,14 +10225,42 @@ ${body}`;
9485
10225
  }
9486
10226
  async function act(kind, anchor = null) {
9487
10227
  if (!mounted) return;
10228
+ const startedAtMs = Date.now();
9488
10229
  copyAnchorEl = anchor;
9489
10230
  actionBytes = -1;
9490
10231
  actionTruncated = false;
10232
+ const skipToken = { skipped: false };
10233
+ currentActionSkips = skipToken;
10234
+ const latchBefore = latch;
10235
+ let ok = true;
10236
+ let errorKind = null;
10237
+ let errorHash = null;
9491
10238
  try {
9492
10239
  await runAction(kind);
10240
+ } catch (err) {
10241
+ ok = false;
10242
+ errorKind = "thrown";
10243
+ errorHash = hash8(errorTextOf(err));
10244
+ throw err;
9493
10245
  } finally {
10246
+ if (ok) {
10247
+ const latchAfter = latch;
10248
+ if (latchAfter && latchAfter !== latchBefore) {
10249
+ ok = false;
10250
+ errorKind = latchAfter.code;
10251
+ errorHash = hash8(`${latchAfter.code}|${latchAfter.detail ?? ""}`);
10252
+ } else if (skipToken.skipped) {
10253
+ ok = false;
10254
+ errorKind = "busy";
10255
+ }
10256
+ }
10257
+ currentActionSkips = null;
9494
10258
  logClient("info", "update.panel.action", {
9495
10259
  action: kind,
10260
+ ok,
10261
+ errorKind,
10262
+ durationMs: Math.max(0, Date.now() - startedAtMs),
10263
+ ...errorHash ? { errorHash } : {},
9496
10264
  ...actionBytes >= 0 ? {
9497
10265
  bytes: actionBytes,
9498
10266
  truncated: actionTruncated
@@ -9574,6 +10342,7 @@ ${body}`;
9574
10342
  checkId: offer.checkId,
9575
10343
  requestId,
9576
10344
  version: offer.candidate,
10345
+ from: installSource,
9577
10346
  ...queueArgs()
9578
10347
  });
9579
10348
  } catch (err) {
@@ -9622,7 +10391,10 @@ ${body}`;
9622
10391
  copyNotice = null;
9623
10392
  switch (kind) {
9624
10393
  case "check":
9625
- if (busyAct) return;
10394
+ if (busyAct) {
10395
+ if (currentActionSkips) currentActionSkips.skipped = true;
10396
+ return;
10397
+ }
9626
10398
  busyAct = "check";
9627
10399
  copyNotice = copyText("panel.toast.checking", currentLang());
9628
10400
  paint();
@@ -9634,7 +10406,10 @@ ${body}`;
9634
10406
  paint();
9635
10407
  return;
9636
10408
  case "install":
9637
- if (busyAct) return;
10409
+ if (busyAct) {
10410
+ if (currentActionSkips) currentActionSkips.skipped = true;
10411
+ return;
10412
+ }
9638
10413
  busyAct = "install";
9639
10414
  copyNotice = copyText("panel.toast.installing", currentLang());
9640
10415
  paint();
@@ -9671,11 +10446,18 @@ ${body}`;
9671
10446
  return;
9672
10447
  }
9673
10448
  case "install-fallback":
9674
- if (busyAct) return;
10449
+ if (busyAct) {
10450
+ if (currentActionSkips) currentActionSkips.skipped = true;
10451
+ return;
10452
+ }
9675
10453
  await doFallbackResolve();
9676
10454
  return;
9677
10455
  case "install-fallback-confirm":
9678
- if (busyAct || !fallbackOffer) return;
10456
+ if (busyAct) {
10457
+ if (currentActionSkips) currentActionSkips.skipped = true;
10458
+ return;
10459
+ }
10460
+ if (!fallbackOffer) return;
9679
10461
  await doFallbackConfirm();
9680
10462
  return;
9681
10463
  case "wait-latest":
@@ -9698,6 +10480,9 @@ ${body}`;
9698
10480
  function unmount() {
9699
10481
  if (!mounted) return;
9700
10482
  mounted = false;
10483
+ removeGlobalHandlers?.();
10484
+ removeGlobalHandlers = null;
10485
+ renderFailSeen.clear();
9701
10486
  try {
9702
10487
  unsubLang();
9703
10488
  } catch {}
@@ -9724,6 +10509,7 @@ ${body}`;
9724
10509
  try {
9725
10510
  container.addEventListener?.("click", onClick);
9726
10511
  } catch {}
10512
+ installGlobalHandlers();
9727
10513
  const timer = getTimer();
9728
10514
  const handle = timer.set(() => {
9729
10515
  if (!mounted || busyAct || pollCapped) return;
@@ -9739,7 +10525,6 @@ ${body}`;
9739
10525
  pollCount += 1;
9740
10526
  refresh();
9741
10527
  }, pollMs);
9742
- if (autoCheck === "mount") refresh();
9743
10528
  function state() {
9744
10529
  const jobState = snapshot?.job?.state ?? null;
9745
10530
  return {
@@ -9750,12 +10535,20 @@ ${body}`;
9750
10535
  busy: !!busyAct || jobState === "installing" || jobState === "verifying"
9751
10536
  };
9752
10537
  }
9753
- logClient("info", "update.panel.mount", {
9754
- mode: clientLogMountName || "install-button",
9755
- theme,
9756
- lang: currentLang(),
9757
- pollMs
10538
+ function emitMountRow(autoCheck2) {
10539
+ logClient("info", "update.panel.mount", {
10540
+ mode: clientLogMountName || "install-button",
10541
+ theme,
10542
+ lang: currentLang(),
10543
+ pollMs,
10544
+ autoCheck: autoCheck2
10545
+ });
10546
+ }
10547
+ if (autoCheck === "mount") refresh().then(() => {
10548
+ if (!mounted || mountAutoCheckState === null) return;
10549
+ emitMountRow(mountAutoCheckState);
9758
10550
  });
10551
+ else emitMountRow("disabled");
9759
10552
  return {
9760
10553
  state,
9761
10554
  refresh,
@@ -12554,7 +13347,7 @@ ${body}`;
12554
13347
  }, 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)))));
12555
13348
  }
12556
13349
  /** 版本胶囊那一行字:只在这里拼一次,屏上与用例读的是同一串。 */
12557
- const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.71";
13350
+ const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.73";
12558
13351
  /** 右下角那本书离面板两沿的距离:用户口径「一直处于面板右下角、不随列表滑动消失」
12559
13352
  * ⇒ sticky 吸附(面板相对,视口多大都落在面板角上);INSET=右沿,BOTTOM=底沿。 */
12560
13353
  const MANUAL_ENTRY_INSET = 16;