dsh-life-pack 0.3.71 → 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.25/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.25/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.25/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.25/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,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.26/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.26/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,26 @@ ${note}${blocks.join("\n")}
3852
4038
  let disposed = false;
3853
4039
  let scheduled = null;
3854
4040
  let inFlight = false;
4041
+ const droppedByReason = {};
4042
+ const reportedDropReasons = /* @__PURE__ */ new Set();
3855
4043
  function noteDrop(row, reason) {
3856
4044
  dropped++;
4045
+ const key = typeof reason === "string" && reason ? reason : "unknown";
4046
+ droppedByReason[key] = (droppedByReason[key] ?? 0) + 1;
3857
4047
  if (!onDrop) return;
3858
4048
  try {
3859
4049
  onDrop(row, reason);
3860
4050
  } catch {}
3861
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
+ }
3862
4061
  function push(row) {
3863
4062
  if (count === capacity) {
3864
4063
  const evicted = slots[head];
@@ -3959,12 +4158,8 @@ ${note}${blocks.join("\n")}
3959
4158
  await delay(typeof wait === "number" && Number.isFinite(wait) ? wait : 0);
3960
4159
  }
3961
4160
  }
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
- }
4161
+ async function sendBuffered() {
4162
+ if (inFlight || count === 0) return;
3968
4163
  inFlight = true;
3969
4164
  const batch = [];
3970
4165
  while (batch.length < batchSize && count > 0) {
@@ -3989,10 +4184,41 @@ ${note}${blocks.join("\n")}
3989
4184
  } finally {
3990
4185
  inFlight = false;
3991
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();
3992
4197
  if (disposed) return;
3993
4198
  if (count >= batchSize) schedule(0);
3994
4199
  else if (count > 0) schedule(flushMs);
3995
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
+ }
3996
4222
  function onVisibilityChange() {
3997
4223
  try {
3998
4224
  const state = visibility?.visibilityState;
@@ -4032,59 +4258,24 @@ ${note}${blocks.join("\n")}
4032
4258
  timer.clear(scheduled);
4033
4259
  } catch {}
4034
4260
  scheduled = null;
4035
- while (count > 0) noteDrop(shift(), "disposed");
4036
4261
  if (visibility && typeof visibility.removeEventListener === "function") try {
4037
4262
  visibility.removeEventListener("visibilitychange", onVisibilityChange);
4038
4263
  } catch {}
4264
+ finalFlush();
4039
4265
  }
4040
4266
  return {
4041
4267
  emit,
4042
4268
  flush,
4043
4269
  pending: () => count,
4044
4270
  dropped: () => dropped,
4271
+ droppedByReason: () => ({ ...droppedByReason }),
4045
4272
  sent: () => sent,
4046
4273
  enabled,
4047
4274
  dispose
4048
4275
  };
4049
4276
  }
4050
4277
  //#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());
4085
- }
4086
- //#endregion
4087
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/commands.js
4278
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/commands.js
4088
4279
  const MANUAL_SUPPRESSING_REASONS = [
4089
4280
  "source-install",
4090
4281
  "unknown-profile",
@@ -4094,7 +4285,7 @@ ${note}${blocks.join("\n")}
4094
4285
  return reason !== null && reason !== void 0 && MANUAL_SUPPRESSING_REASONS.includes(reason);
4095
4286
  }
4096
4287
  //#endregion
4097
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/manual-absent.js
4288
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/manual-absent.js
4098
4289
  const REASON_KEYS = {
4099
4290
  "unknown-profile": "panel.manual.absent.unknown-profile",
4100
4291
  "source-install": "panel.manual.absent.source-install",
@@ -4130,7 +4321,7 @@ ${note}${blocks.join("\n")}
4130
4321
  return manualAbsentReasonTextOf(null, lang) + joiner + manualAbsentReasonTextOf(reason, lang);
4131
4322
  }
4132
4323
  //#endregion
4133
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/node_modules/dsh-plugin-update/dist/last-resort.js
4324
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/last-resort.js
4134
4325
  const STAGES = [
4135
4326
  "install",
4136
4327
  "check",
@@ -4230,7 +4421,7 @@ ${note}${blocks.join("\n")}
4230
4421
  return verdict("unknown");
4231
4422
  }
4232
4423
  //#endregion
4233
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/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
4234
4425
  const CAUSE_KINDS = ["minimum-release-age"];
4235
4426
  const CAUSE_SIGNATURES = [{
4236
4427
  kind: "minimum-release-age",
@@ -4350,7 +4541,7 @@ ${note}${blocks.join("\n")}
4350
4541
  }
4351
4542
  }
4352
4543
  //#endregion
4353
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/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
4354
4545
  const COPY_BUDGET_CHARS = 1500;
4355
4546
  const REDACTED_PATH = "<路径>";
4356
4547
  const REDACTED_SECRET = "<脱敏>";
@@ -4430,7 +4621,7 @@ ${note}${blocks.join("\n")}
4430
4621
  return userinfo.masked ? truncateWithMaskNote(scrubbed, COPY_BUDGET_CHARS) : truncateForCopy(scrubbed);
4431
4622
  }
4432
4623
  //#endregion
4433
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/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
4434
4625
  const BLOCKED_KEYS = {
4435
4626
  "unknown-profile": {
4436
4627
  title: "panel.blocked.unknown-profile.title",
@@ -4636,6 +4827,7 @@ ${note}${blocks.join("\n")}
4636
4827
  latestVersion: "string",
4637
4828
  environmentKind: "string",
4638
4829
  requestId: "string",
4830
+ intentHash: "string",
4639
4831
  checkId: "string",
4640
4832
  registryHost: "string",
4641
4833
  action: "string",
@@ -4657,6 +4849,7 @@ ${note}${blocks.join("\n")}
4657
4849
  latestVersion: null,
4658
4850
  environmentKind: null,
4659
4851
  requestId: null,
4852
+ intentHash: null,
4660
4853
  checkId: null,
4661
4854
  registryHost: null,
4662
4855
  action: null,
@@ -4711,6 +4904,78 @@ ${note}${blocks.join("\n")}
4711
4904
  return null;
4712
4905
  }
4713
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
+ }
4714
4979
  function buildUpdateDiagCopy(input, langOverride) {
4715
4980
  const l = normalizeLangTag(langOverride ?? input.lang ?? "zh");
4716
4981
  const unknown = copyText("panel.diag.copy.unknown", l);
@@ -4752,21 +5017,29 @@ ${note}${blocks.join("\n")}
4752
5017
  if (diag.action) prov.push(copyText("panel.diag.copy.field.action", l, { action: diag.action }));
4753
5018
  if (typeof requestRaw === "string" && requestRaw.trim()) prov.push(copyText("panel.diag.copy.field.request", l, { request: requestRaw.trim() }));
4754
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}`);
4755
5021
  prov.push(copyText("panel.diag.copy.field.queue", l, { queue }));
4756
5022
  const updaterText = updaterFieldText(input.updater, l);
4757
5023
  if (updaterText) prov.push(updaterText);
4758
5024
  const format = input.format === "line" ? "line" : "block";
4759
5025
  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 [
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 = [
4762
5032
  `[update-diag] ${rawCode} \u2014 ${copy.zh}`,
4763
5033
  ` ${copyText("panel.diag.copy.block.summary", l, { summary: detail })}`,
4764
5034
  ` ${copyText("panel.diag.copy.block.source", l, { source: provLine })}`,
4765
5035
  ` ${copyText("panel.diag.copy.block.remedy", l, { remedy })}`
4766
- ].join("\n");
5036
+ ];
5037
+ if (logHealth) blockLines.push(` ${logHealth}`);
5038
+ if (connection) blockLines.push(` ${connection}`);
5039
+ return blockLines.join("\n");
4767
5040
  }
4768
5041
  //#endregion
4769
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/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
4770
5043
  function normalizePanelTheme(value) {
4771
5044
  return value === "archive" ? "archive" : "default";
4772
5045
  }
@@ -5746,10 +6019,23 @@ ${note}${blocks.join("\n")}
5746
6019
  const top = Number.isFinite(bubble.top) ? Math.round(bubble.top) : 0;
5747
6020
  return "<span class=\"dsh-upd-copy-bubble\" role=\"status\" style=\"position:fixed;left:" + left + "px;top:" + top + "px\">" + escapeHtml$3(bubble.text) + "</span>";
5748
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
+ }
5749
6032
  function renderUpdatePanelKernel(input, view, lang) {
5750
6033
  const { snapshot, manual, queue, mode, showOthers, pluginId, copyNotice } = input;
5751
6034
  const l = normalizeLangTag(lang ?? input.lang ?? "zh");
5752
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);
5753
6039
  const profileName = typeof input.profileName === "string" && input.profileName ? input.profileName : null;
5754
6040
  const b = view.banner;
5755
6041
  const seal = view.seal;
@@ -5819,13 +6105,17 @@ ${note}${blocks.join("\n")}
5819
6105
  {
5820
6106
  let inner = "";
5821
6107
  let hasLog = false;
6108
+ const statusCopyText = changelogStatusKey === null ? "" : copyText(changelogStatusKey, l);
5822
6109
  if (snapshot && snapshot.latestVersion) try {
5823
6110
  const mdText = typeof changelogMarkdown === "string" ? changelogMarkdown : "";
5824
6111
  const report = parseChangelogReport(mdText);
5825
6112
  const entries = report.entries;
5826
6113
  const ranged = changelogForUpdate(entries, snapshot.runningVersion, snapshot.latestVersion, snapshot.installedVersion);
5827
6114
  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>`;
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>`;
5829
6119
  hasLog = false;
5830
6120
  } else {
5831
6121
  const changelogHTML = renderChangelogHTML(ranged, {
@@ -5860,7 +6150,7 @@ ${changelogHTML}
5860
6150
  } catch {
5861
6151
  inner = "";
5862
6152
  }
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>`;
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>`;
5864
6154
  const logCollapsed = input.changelogCollapsed === true;
5865
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>` : "";
5866
6156
  chapters.push(chapterOf(2, inner, logNote, l));
@@ -5917,6 +6207,8 @@ ${changelogHTML}
5917
6207
  e2: `<code>${LOG_EVENT_CALL_FAIL}</code>`,
5918
6208
  e3: `<code>${LOG_EVENT_INSTALL_EXEC}</code>`
5919
6209
  })}</div>`);
6210
+ const healthLine = logHealthText(input.logHealth, l);
6211
+ if (healthLine) errLines.push(`<div class="dsh-upd-log">${escapeHtml$3(healthLine)}</div>`);
5920
6212
  if (b.kind === "failed" && failRef && (failRef.requestId || failRef.checkId)) errLines.push(`<div class="dsh-upd-log">${copyText("panel.error.log-follow", l, {
5921
6213
  eFail: `<code>${LOG_EVENT_CALL_FAIL}</code>`,
5922
6214
  eCall: `<code>${LOG_EVENT_CALL}</code>`,
@@ -5966,7 +6258,7 @@ ${UPDATE_PANEL_ARCHIVE_CSS}` : UPDATE_PANEL_CSS}</style>
5966
6258
  ${body}`;
5967
6259
  }
5968
6260
  //#endregion
5969
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/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
5970
6262
  const UPDATE_ENTRY_CSS = [
5971
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)}",
5972
6264
  ".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 +6372,7 @@ ${body}`;
6080
6372
  }
6081
6373
  }
6082
6374
  //#endregion
6083
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/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
6084
6376
  const BATCH_PANEL_POLL = {
6085
6377
  defaultMs: 1500,
6086
6378
  minMs: 250
@@ -7100,7 +7392,7 @@ ${body}`;
7100
7392
  pluginId: pluginIdOf(row),
7101
7393
  code: job !== null && job.code !== null ? job.code : row.error || "check-failed",
7102
7394
  detail,
7103
- runningVersion: text(snapshot ? snapshot["runningVersion"] : null),
7395
+ runningVersion: snapshot && snapshot["installed"] !== false ? text(snapshot["runningVersion"]) : null,
7104
7396
  installedVersion: text(snapshot ? snapshot["installedVersion"] : null),
7105
7397
  latestVersion: text(snapshot ? snapshot["latestVersion"] : null),
7106
7398
  hostKind: text(row.hostKind),
@@ -8269,7 +8561,7 @@ ${body}`;
8269
8561
  };
8270
8562
  }
8271
8563
  //#endregion
8272
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.25/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
8273
8565
  function isObject$1(value) {
8274
8566
  return !!value && typeof value === "object" && !Array.isArray(value);
8275
8567
  }
@@ -8923,62 +9215,142 @@ ${body}`;
8923
9215
  channel.emit(level, event, fields);
8924
9216
  } catch {}
8925
9217
  }
8926
- function logMountFailure(kind) {
8927
- 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
+ }
8928
9228
  }
8929
- if (!container || typeof container.innerHTML !== "string") {
8930
- logMountFailure("container");
8931
- 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
+ });
8932
9243
  }
8933
- if (!options || typeof options !== "object") {
8934
- logMountFailure("plugin-id");
8935
- 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 {}
8936
9249
  }
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)})`);
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);
8941
9293
  }
8942
9294
  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)");
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);
8945
9298
  }
8946
9299
  const prefix = options.prefix === void 0 ? "wf" : options.prefix;
8947
- let phoneNames;
9300
+ let channelPrefix = "wf";
8948
9301
  try {
8949
- phoneNames = buildPhoneNames(prefix);
8950
- } catch (err) {
8951
- logMountFailure("prefix");
8952
- throw err;
8953
- }
9302
+ buildLogAppendPhoneName(prefix);
9303
+ channelPrefix = String(prefix);
9304
+ } catch {}
8954
9305
  if (!clientLog && !clientLogDisabled) try {
8955
9306
  clientLog = createClientLogChannel({
8956
9307
  call: options.call,
8957
- phoneName: buildLogAppendPhoneName(prefix)
9308
+ phoneName: buildLogAppendPhoneName(channelPrefix)
8958
9309
  });
8959
9310
  clientLogOwned = true;
8960
9311
  } catch {
8961
9312
  clientLog = null;
8962
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
+ }
8963
9332
  const pollMs = options.pollMs === void 0 ? DEFAULT_PANEL_POLL_MS : options.pollMs;
8964
9333
  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)})`);
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);
8967
9337
  }
8968
9338
  const autoCheck = options.autoCheck ?? "mount";
8969
9339
  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)})`);
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);
8972
9343
  }
8973
9344
  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)})`);
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);
8976
9348
  }
8977
9349
  const theme = options.theme ?? "default";
8978
9350
  try {
8979
9351
  themeTokensStyleFor(options.themeTokens ?? void 0);
8980
9352
  } catch (err) {
8981
- logMountFailure("theme-tokens");
9353
+ failMount("theme-tokens", errorTextOf(err));
8982
9354
  throw err;
8983
9355
  }
8984
9356
  const localeOpt = options.locale ?? void 0;
@@ -8986,12 +9358,14 @@ ${body}`;
8986
9358
  const isStr = typeof localeOpt === "string";
8987
9359
  const isObj = typeof localeOpt === "object" && typeof localeOpt.getActive === "function";
8988
9360
  if (!isStr && !isObj) {
8989
- logMountFailure("locale");
8990
- 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);
8991
9364
  }
8992
9365
  if (isStr && !localeOpt.trim()) {
8993
- logMountFailure("locale");
8994
- 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);
8995
9369
  }
8996
9370
  }
8997
9371
  function currentLang() {
@@ -9001,6 +9375,7 @@ ${body}`;
9001
9375
  const profileNameOption = typeof options.profileName === "string" && options.profileName ? options.profileName : null;
9002
9376
  const copyTextOut = options.copyText ?? defaultCopyText;
9003
9377
  const call = options.call;
9378
+ const installSource = options.from ?? "entry";
9004
9379
  let mounted = true;
9005
9380
  let snapshot = null;
9006
9381
  let manual = null;
@@ -9017,6 +9392,7 @@ ${body}`;
9017
9392
  let pollCapped = false;
9018
9393
  let envHostKind = null;
9019
9394
  let envProfileName = null;
9395
+ let envLogHealth = null;
9020
9396
  let copyNotice = null;
9021
9397
  let noticeExpiresAt = 0;
9022
9398
  let copyBubble = null;
@@ -9024,6 +9400,8 @@ ${body}`;
9024
9400
  let copyAnchorEl = null;
9025
9401
  let actionBytes = -1;
9026
9402
  let actionTruncated = false;
9403
+ let transportFailStreak = 0;
9404
+ let actionSkipped = false;
9027
9405
  function latchNow() {
9028
9406
  try {
9029
9407
  const n = Date.now();
@@ -9135,6 +9513,9 @@ ${body}`;
9135
9513
  atMs: latchNow()
9136
9514
  };
9137
9515
  }
9516
+ function adoptLogHealth(value) {
9517
+ envLogHealth = isObject(value) ? value : null;
9518
+ }
9138
9519
  function applyStatusReply(reply, via) {
9139
9520
  if (!isObject(reply)) return;
9140
9521
  if (reply["ok"] === true) {
@@ -9153,6 +9534,7 @@ ${body}`;
9153
9534
  if (typeof pn === "string" && pn.trim()) envProfileName = pn.trim();
9154
9535
  if (typeof hk === "string" && hk.trim()) envHostKind = hk.trim();
9155
9536
  }
9537
+ if (reply["logHealth"] !== void 0) adoptLogHealth(reply["logHealth"]);
9156
9538
  const jobState = snapshot?.job?.state ?? null;
9157
9539
  if (jobState === "installing" || jobState === "verifying") clearLatch();
9158
9540
  else if (jobState === "completed" || jobState === "restart-required") clearLatch();
@@ -9199,6 +9581,7 @@ ${body}`;
9199
9581
  manualSource = manual !== null ? "frame" : null;
9200
9582
  const q = asQueue(reply["queue"]);
9201
9583
  if (q) queue = q;
9584
+ if (reply["logHealth"] !== void 0) adoptLogHealth(reply["logHealth"]);
9202
9585
  paint();
9203
9586
  } catch {}
9204
9587
  })();
@@ -9253,8 +9636,8 @@ ${body}`;
9253
9636
  try {
9254
9637
  container.innerHTML = html;
9255
9638
  } catch {}
9256
- } catch {
9257
- logClient("error", "update.panel.render.fail", { kind: "unknown" });
9639
+ } catch (err) {
9640
+ emitRenderFail("paint", "render", errorTextOf(err) || "render-failed");
9258
9641
  }
9259
9642
  }
9260
9643
  function sayCopyKey(key, params) {
@@ -9313,9 +9696,12 @@ ${body}`;
9313
9696
  try {
9314
9697
  const reply = await call(phoneNames.updateStatus, queueArgs());
9315
9698
  if (!mounted) return;
9699
+ transportFailStreak = 0;
9316
9700
  applyStatusReply(reply, "refresh");
9317
9701
  } catch (err) {
9318
9702
  if (!mounted) return;
9703
+ transportFailStreak++;
9704
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
9319
9705
  if (!thrownBusy(err)) setLatch(volatileLatch("check"));
9320
9706
  }
9321
9707
  if (!mounted) return;
@@ -9324,9 +9710,12 @@ ${body}`;
9324
9710
  try {
9325
9711
  const reply = await call(phoneNames.updateCheck, queueArgs());
9326
9712
  if (!mounted) return;
9713
+ transportFailStreak = 0;
9327
9714
  applyStatusReply(reply, "check");
9328
- } catch {
9715
+ } catch (err) {
9329
9716
  if (!mounted) return;
9717
+ transportFailStreak++;
9718
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
9330
9719
  setLatch(volatileLatch("check"));
9331
9720
  } finally {
9332
9721
  ensuring = false;
@@ -9418,6 +9807,7 @@ ${body}`;
9418
9807
  reply = await call(phoneNames.updateInstall, {
9419
9808
  checkId: receipt.checkId,
9420
9809
  requestId,
9810
+ from: installSource,
9421
9811
  ...queueArgs()
9422
9812
  });
9423
9813
  } catch (err) {
@@ -9477,6 +9867,9 @@ ${body}`;
9477
9867
  targetVersion: latch.targetVersion,
9478
9868
  diag: latch.diag,
9479
9869
  checkId: latch.checkId,
9870
+ logHealth: envLogHealth,
9871
+ transportFailStreak,
9872
+ clientDropped: clientDroppedRows(),
9480
9873
  lang: currentLang()
9481
9874
  }, currentLang());
9482
9875
  } catch {
@@ -9485,14 +9878,40 @@ ${body}`;
9485
9878
  }
9486
9879
  async function act(kind, anchor = null) {
9487
9880
  if (!mounted) return;
9881
+ const startedAtMs = Date.now();
9488
9882
  copyAnchorEl = anchor;
9489
9883
  actionBytes = -1;
9490
9884
  actionTruncated = false;
9885
+ actionSkipped = false;
9886
+ const latchBefore = latch;
9887
+ let ok = true;
9888
+ let errorKind = null;
9889
+ let errorHash = null;
9491
9890
  try {
9492
9891
  await runAction(kind);
9892
+ } catch (err) {
9893
+ ok = false;
9894
+ errorKind = "thrown";
9895
+ errorHash = hash8(errorTextOf(err));
9896
+ throw err;
9493
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
+ }
9494
9909
  logClient("info", "update.panel.action", {
9495
9910
  action: kind,
9911
+ ok,
9912
+ errorKind,
9913
+ durationMs: Math.max(0, Date.now() - startedAtMs),
9914
+ ...errorHash ? { errorHash } : {},
9496
9915
  ...actionBytes >= 0 ? {
9497
9916
  bytes: actionBytes,
9498
9917
  truncated: actionTruncated
@@ -9574,6 +9993,7 @@ ${body}`;
9574
9993
  checkId: offer.checkId,
9575
9994
  requestId,
9576
9995
  version: offer.candidate,
9996
+ from: installSource,
9577
9997
  ...queueArgs()
9578
9998
  });
9579
9999
  } catch (err) {
@@ -9622,7 +10042,10 @@ ${body}`;
9622
10042
  copyNotice = null;
9623
10043
  switch (kind) {
9624
10044
  case "check":
9625
- if (busyAct) return;
10045
+ if (busyAct) {
10046
+ actionSkipped = true;
10047
+ return;
10048
+ }
9626
10049
  busyAct = "check";
9627
10050
  copyNotice = copyText("panel.toast.checking", currentLang());
9628
10051
  paint();
@@ -9634,7 +10057,10 @@ ${body}`;
9634
10057
  paint();
9635
10058
  return;
9636
10059
  case "install":
9637
- if (busyAct) return;
10060
+ if (busyAct) {
10061
+ actionSkipped = true;
10062
+ return;
10063
+ }
9638
10064
  busyAct = "install";
9639
10065
  copyNotice = copyText("panel.toast.installing", currentLang());
9640
10066
  paint();
@@ -9671,11 +10097,18 @@ ${body}`;
9671
10097
  return;
9672
10098
  }
9673
10099
  case "install-fallback":
9674
- if (busyAct) return;
10100
+ if (busyAct) {
10101
+ actionSkipped = true;
10102
+ return;
10103
+ }
9675
10104
  await doFallbackResolve();
9676
10105
  return;
9677
10106
  case "install-fallback-confirm":
9678
- if (busyAct || !fallbackOffer) return;
10107
+ if (busyAct) {
10108
+ actionSkipped = true;
10109
+ return;
10110
+ }
10111
+ if (!fallbackOffer) return;
9679
10112
  await doFallbackConfirm();
9680
10113
  return;
9681
10114
  case "wait-latest":
@@ -9698,6 +10131,8 @@ ${body}`;
9698
10131
  function unmount() {
9699
10132
  if (!mounted) return;
9700
10133
  mounted = false;
10134
+ removeGlobalHandlers?.();
10135
+ removeGlobalHandlers = null;
9701
10136
  try {
9702
10137
  unsubLang();
9703
10138
  } catch {}
@@ -9724,6 +10159,7 @@ ${body}`;
9724
10159
  try {
9725
10160
  container.addEventListener?.("click", onClick);
9726
10161
  } catch {}
10162
+ installGlobalHandlers();
9727
10163
  const timer = getTimer();
9728
10164
  const handle = timer.set(() => {
9729
10165
  if (!mounted || busyAct || pollCapped) return;
@@ -12554,7 +12990,7 @@ ${body}`;
12554
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)))));
12555
12991
  }
12556
12992
  /** 版本胶囊那一行字:只在这里拼一次,屏上与用例读的是同一串。 */
12557
- const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.71";
12993
+ const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.72";
12558
12994
  /** 右下角那本书离面板两沿的距离:用户口径「一直处于面板右下角、不随列表滑动消失」
12559
12995
  * ⇒ sticky 吸附(面板相对,视口多大都落在面板角上);INSET=右沿,BOTTOM=底沿。 */
12560
12996
  const MANUAL_ENTRY_INSET = 16;