dsh-life-pack 0.3.72 → 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.26/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,7 @@ window.__ModuleLoader__.load({
493
493
  return buildPhoneNames(prefix).logAppend;
494
494
  }
495
495
  //#endregion
496
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/hash.js
496
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/hash.js
497
497
  function hash8(value) {
498
498
  try {
499
499
  const text = String(value ?? "");
@@ -505,7 +505,7 @@ window.__ModuleLoader__.load({
505
505
  }
506
506
  }
507
507
  //#endregion
508
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/version-judgment.js
508
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/version-judgment.js
509
509
  function updateError(code) {
510
510
  return Object.assign(new Error(code), { code });
511
511
  }
@@ -592,7 +592,7 @@ window.__ModuleLoader__.load({
592
592
  return 0;
593
593
  }
594
594
  //#endregion
595
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/codes.js
595
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/codes.js
596
596
  const BLOCKED_REASONS = [
597
597
  "unknown-profile",
598
598
  "channel-mismatch",
@@ -630,7 +630,7 @@ window.__ModuleLoader__.load({
630
630
  }
631
631
  [...CORE_ERROR_CODES];
632
632
  //#endregion
633
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/lang.js
633
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/lang.js
634
634
  function normalizeLangTag(tag) {
635
635
  if (typeof tag !== "string") return "zh";
636
636
  const s = tag.trim().toLowerCase().replace(/_/g, "-");
@@ -772,7 +772,7 @@ window.__ModuleLoader__.load({
772
772
  };
773
773
  }
774
774
  //#endregion
775
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
776
776
  const BILINGUAL_STRINGS = {
777
777
  "entry.label.idle": {
778
778
  en: "Check for updates",
@@ -2859,7 +2859,7 @@ window.__ModuleLoader__.load({
2859
2859
  }
2860
2860
  const BILINGUAL_CSS = [".dsh-upd-bi{display:inline;overflow-wrap:anywhere}", ".dsh-upd-bi [lang]{overflow-wrap:anywhere}"].join("\n");
2861
2861
  //#endregion
2862
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
2863
2863
  const CHANGELOG_MAX_CHARS = 65536;
2864
2864
  const CHANGELOG_ALL_CATEGORIES = [
2865
2865
  "Added",
@@ -3978,7 +3978,7 @@ ${note}${blocks.join("\n")}
3978
3978
  }
3979
3979
  }
3980
3980
  //#endregion
3981
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
3982
3982
  const LOG_EVENT_CALL = "host.call";
3983
3983
  const LOG_EVENT_CALL_FAIL = "host.call.fail";
3984
3984
  const LOG_EVENT_INSTALL_EXEC = "update.install.exec";
@@ -4039,24 +4039,48 @@ ${note}${blocks.join("\n")}
4039
4039
  let scheduled = null;
4040
4040
  let inFlight = false;
4041
4041
  const droppedByReason = {};
4042
+ const droppedEventByReason = {};
4042
4043
  const reportedDropReasons = /* @__PURE__ */ new Set();
4043
4044
  function noteDrop(row, reason) {
4044
4045
  dropped++;
4045
4046
  const key = typeof reason === "string" && reason ? reason : "unknown";
4046
4047
  droppedByReason[key] = (droppedByReason[key] ?? 0) + 1;
4048
+ if (row && typeof row.event === "string" && row.event && !droppedEventByReason[key]) droppedEventByReason[key] = row.event;
4047
4049
  if (!onDrop) return;
4048
4050
  try {
4049
4051
  onDrop(row, reason);
4050
4052
  } catch {}
4051
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
+ }
4052
4066
  function reportDrops() {
4053
4067
  if (disposed || call === null || phoneName === "") return;
4068
+ let queued = false;
4054
4069
  for (const reason of REPORTABLE_DROP_REASONS) {
4055
4070
  if (!(droppedByReason[reason] > 0)) continue;
4056
4071
  if (reportedDropReasons.has(reason)) continue;
4057
4072
  reportedDropReasons.add(reason);
4058
- emit("warn", "update.log.degraded", { reason: `client-drop-${reason}` });
4073
+ push(makeDropReport(reason));
4074
+ queued = true;
4059
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();
4060
4084
  }
4061
4085
  function push(row) {
4062
4086
  if (count === capacity) {
@@ -4208,12 +4232,7 @@ ${note}${blocks.join("\n")}
4208
4232
  if (!(droppedByReason[reason] > 0)) continue;
4209
4233
  if (reportedDropReasons.has(reason)) continue;
4210
4234
  reportedDropReasons.add(reason);
4211
- push({
4212
- level: "warn",
4213
- event: "update.log.degraded",
4214
- fields: { reason: `client-drop-${reason}` },
4215
- ts: now()
4216
- });
4235
+ push(makeDropReport(reason));
4217
4236
  }
4218
4237
  await sendBuffered();
4219
4238
  }
@@ -4240,6 +4259,7 @@ ${note}${blocks.join("\n")}
4240
4259
  };
4241
4260
  if (disposed) {
4242
4261
  noteDrop(row, "disposed");
4262
+ reportDisposedDrop();
4243
4263
  return;
4244
4264
  }
4245
4265
  if (!enabled()) {
@@ -4275,7 +4295,148 @@ ${note}${blocks.join("\n")}
4275
4295
  };
4276
4296
  }
4277
4297
  //#endregion
4278
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/commands.js
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
+ };
4437
+ }
4438
+ //#endregion
4439
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.27/node_modules/dsh-plugin-update/dist/commands.js
4279
4440
  const MANUAL_SUPPRESSING_REASONS = [
4280
4441
  "source-install",
4281
4442
  "unknown-profile",
@@ -4285,7 +4446,7 @@ ${note}${blocks.join("\n")}
4285
4446
  return reason !== null && reason !== void 0 && MANUAL_SUPPRESSING_REASONS.includes(reason);
4286
4447
  }
4287
4448
  //#endregion
4288
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
4289
4450
  const REASON_KEYS = {
4290
4451
  "unknown-profile": "panel.manual.absent.unknown-profile",
4291
4452
  "source-install": "panel.manual.absent.source-install",
@@ -4321,7 +4482,7 @@ ${note}${blocks.join("\n")}
4321
4482
  return manualAbsentReasonTextOf(null, lang) + joiner + manualAbsentReasonTextOf(reason, lang);
4322
4483
  }
4323
4484
  //#endregion
4324
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
4325
4486
  const STAGES = [
4326
4487
  "install",
4327
4488
  "check",
@@ -4421,7 +4582,7 @@ ${note}${blocks.join("\n")}
4421
4582
  return verdict("unknown");
4422
4583
  }
4423
4584
  //#endregion
4424
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
4425
4586
  const CAUSE_KINDS = ["minimum-release-age"];
4426
4587
  const CAUSE_SIGNATURES = [{
4427
4588
  kind: "minimum-release-age",
@@ -4541,7 +4702,7 @@ ${note}${blocks.join("\n")}
4541
4702
  }
4542
4703
  }
4543
4704
  //#endregion
4544
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
4545
4706
  const COPY_BUDGET_CHARS = 1500;
4546
4707
  const REDACTED_PATH = "<路径>";
4547
4708
  const REDACTED_SECRET = "<脱敏>";
@@ -4621,7 +4782,7 @@ ${note}${blocks.join("\n")}
4621
4782
  return userinfo.masked ? truncateWithMaskNote(scrubbed, COPY_BUDGET_CHARS) : truncateForCopy(scrubbed);
4622
4783
  }
4623
4784
  //#endregion
4624
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
4625
4786
  const BLOCKED_KEYS = {
4626
4787
  "unknown-profile": {
4627
4788
  title: "panel.blocked.unknown-profile.title",
@@ -5039,7 +5200,7 @@ ${note}${blocks.join("\n")}
5039
5200
  return blockLines.join("\n");
5040
5201
  }
5041
5202
  //#endregion
5042
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
5043
5204
  function normalizePanelTheme(value) {
5044
5205
  return value === "archive" ? "archive" : "default";
5045
5206
  }
@@ -5703,7 +5864,7 @@ ${note}${blocks.join("\n")}
5703
5864
  const UPDATE_PANEL_ARCHIVE_CSS = [
5704
5865
  "/* Archive 档案卷可选主题:只换颜色/字体/间距;内核 DOM 顺序一字不动,不断复制诊断。 */",
5705
5866
  ".dsh-upd[data-theme=\"archive\"]{--dsh-update-bg-soft:#f7f3ea;--dsh-update-bg:#fffdf6;--dsh-update-text:#1a1a1a;--dsh-update-text-muted:#6f675a;",
5706
- "--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;",
5707
5868
  "--dsh-update-ok-text:#1a7f37;--dsh-update-ok-bg:#e9f4ea;--dsh-update-warn-text:#8a5a00;--dsh-update-warn-bg:#fbf0d0;",
5708
5869
  "--dsh-update-bad-text:#b3261e;--dsh-update-bad-bg:#fbe9e5;",
5709
5870
  "--dsh-update-font-serif:Georgia,\"Songti SC\",\"STSong\",\"SimSun\",\"Noto Serif CJK SC\",\"Source Han Serif SC\",serif;",
@@ -5828,7 +5989,7 @@ ${note}${blocks.join("\n")}
5828
5989
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-md-hr{border-top-color:var(--dsh-update-border-strong)}",
5829
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}}",
5830
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;",
5831
- "--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;",
5832
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);",
5833
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)}}",
5834
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)}}",
@@ -6258,7 +6419,7 @@ ${UPDATE_PANEL_ARCHIVE_CSS}` : UPDATE_PANEL_CSS}</style>
6258
6419
  ${body}`;
6259
6420
  }
6260
6421
  //#endregion
6261
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
6262
6423
  const UPDATE_ENTRY_CSS = [
6263
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)}",
6264
6425
  ".dsh-upd-entry-btn{font:inherit;border:1px solid var(--dsh-update-border,#d1d5db);border-radius:var(--dsh-update-entry-border-radius,6px);",
@@ -6372,7 +6533,7 @@ ${body}`;
6372
6533
  }
6373
6534
  }
6374
6535
  //#endregion
6375
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
6376
6537
  const BATCH_PANEL_POLL = {
6377
6538
  defaultMs: 1500,
6378
6539
  minMs: 250
@@ -6959,7 +7120,7 @@ ${body}`;
6959
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>" : "";
6960
7121
  const actions = [];
6961
7122
  const off = ctx.inFlight ? " disabled" : "";
6962
- if (phase === "installing") actions.push("<button type=\"button\" data-act=\"row-install\" data-key=\"" + keyAttr + "\" disabled>" + escapeHtml$2(batchText("batch.row-action.installing", ctx.lang)) + "</button>");
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>");
6963
7124
  else if (queued) {
6964
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>");
6965
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>");
@@ -6996,7 +7157,7 @@ ${body}`;
6996
7157
  const queued = isQueuedRow(row);
6997
7158
  const off = ctx.inFlight ? " disabled" : "";
6998
7159
  const buttons = [];
6999
- 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>");
7000
7161
  else if (queued) {
7001
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>");
7002
7163
  } else if (phase === "failed") {
@@ -7119,6 +7280,11 @@ ${body}`;
7119
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)}",
7120
7281
  ".dsh-upd-bdetail-dialog-bar .dsh-upd-bdetail-actions{margin:0}",
7121
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)}}",
7122
7288
  "@media (prefers-reduced-motion: reduce){.dsh-upd-batch *{transition:none !important;animation:none !important}}",
7123
7289
  ".dsh-upd-batch{overflow-anchor:none}",
7124
7290
  ".dsh-upd-btable{overflow-anchor:none}",
@@ -7150,13 +7316,17 @@ ${body}`;
7150
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}",
7151
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}",
7152
7318
  ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-macros button:not([data-primary=\"1\"]){background:transparent}",
7153
- ".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}",
7154
- ".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}",
7155
- ".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}",
7156
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}",
7157
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}",
7158
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)}",
7159
- ".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}"
7160
7330
  ].join(String.fromCharCode(10));
7161
7331
  function escapeHtml$2(text) {
7162
7332
  return String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -7334,11 +7504,14 @@ ${body}`;
7334
7504
  if (!isObject$2(snapshot)) return null;
7335
7505
  if (snapshot["installed"] === false) return null;
7336
7506
  const running = snapshot["runningVersion"];
7337
- if (typeof running === "string" && running) return running;
7507
+ if (typeof running === "string" && running && !isPlaceholderVersion(running)) return running;
7338
7508
  const installed = snapshot["installedVersion"];
7339
- if (typeof installed === "string" && installed) return installed;
7509
+ if (typeof installed === "string" && installed && !isPlaceholderVersion(installed)) return installed;
7340
7510
  return null;
7341
7511
  }
7512
+ function isPlaceholderVersion(version) {
7513
+ return version === "0.0.0";
7514
+ }
7342
7515
  function jobFailureOf(row) {
7343
7516
  const snapshot = isObject$2(row.snapshot) ? row.snapshot : null;
7344
7517
  if (!snapshot) return null;
@@ -7490,17 +7663,75 @@ ${body}`;
7490
7663
  };
7491
7664
  }
7492
7665
  function mountUpdateBatchPanel(container, options) {
7493
- if (!container || typeof container.innerHTML !== "string") throw new Error("[dsh-plugin-update] 挂载批量面板需要一个有 innerHTML 的容器");
7494
- if (!options || typeof options !== "object") throw new Error("[dsh-plugin-update] 挂载批量面板缺少配置:批量电话前缀 prefix 必填");
7495
- const phones = buildBatchPhoneNames(options.prefix);
7496
- 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
+ }
7497
7711
  const pollMs = options.pollMs === void 0 ? BATCH_PANEL_POLL.defaultMs : options.pollMs;
7498
- 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
+ }
7499
7717
  let mode = options.mode === void 0 ? "embedded" : options.mode;
7500
- if (mode !== "embedded" && mode !== "dialog") throw new Error("[dsh-plugin-update] 摆放形态非法:只收 embedded 或 dialog(收到 " + JSON.stringify(options.mode) + ")");
7501
- 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
+ }
7502
7728
  let theme = normalizePanelTheme(options.theme ?? "default");
7503
- 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
+ }
7504
7735
  let themeTokens = options.themeTokens;
7505
7736
  const call = options.call;
7506
7737
  const titles = options.titles && typeof options.titles === "object" ? options.titles : {};
@@ -7517,6 +7748,15 @@ ${body}`;
7517
7748
  let rows = [];
7518
7749
  let expandedKey = null;
7519
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
+ }
7520
7760
  let notice = null;
7521
7761
  let noticeKey = null;
7522
7762
  let inFlight = false;
@@ -7529,6 +7769,12 @@ ${body}`;
7529
7769
  function currentLang() {
7530
7770
  return langOf(localeOpt);
7531
7771
  }
7772
+ const mountRowFields = {
7773
+ mode: clientLogMountName || mode,
7774
+ theme,
7775
+ lang: currentLang(),
7776
+ pollMs
7777
+ };
7532
7778
  const checkOnOpenOption = options["checkOnOpen"] !== false;
7533
7779
  const autoResumeOption = options["autoResume"] !== false;
7534
7780
  let lastSession = null;
@@ -7537,6 +7783,10 @@ ${body}`;
7537
7783
  let lastCheckedAt = 0;
7538
7784
  let autoCheckDone = false;
7539
7785
  let autoResumeDone = false;
7786
+ let mountRowLogged = false;
7787
+ let firstRefreshFailed = false;
7788
+ let autoCheckOutcome = null;
7789
+ let currentActionSkips = null;
7540
7790
  const rowFallbackOffers = /* @__PURE__ */ new Map();
7541
7791
  let fallbackBusyKey = null;
7542
7792
  let batchCompliantKeys = [];
@@ -7681,6 +7931,13 @@ ${body}`;
7681
7931
  let lastHTML = "";
7682
7932
  function render() {
7683
7933
  if (!mounted) return;
7934
+ try {
7935
+ paint();
7936
+ } catch (err) {
7937
+ emitRenderFail("paint", "render", errorTextOf(err) || "render-failed");
7938
+ }
7939
+ }
7940
+ function paint() {
7684
7941
  const offers = {};
7685
7942
  for (const [k, v] of rowFallbackOffers) offers[k] = {
7686
7943
  candidate: v.candidate,
@@ -7908,7 +8165,7 @@ ${body}`;
7908
8165
  }
7909
8166
  function applyReply(reply) {
7910
8167
  if (!isObject$2(reply)) {
7911
- lastError = "internal";
8168
+ noteFailure("internal");
7912
8169
  return;
7913
8170
  }
7914
8171
  if (reply["ok"] === true) {
@@ -7936,13 +8193,13 @@ ${body}`;
7936
8193
  }
7937
8194
  if (isObject$2(reply["prefs"])) lastPrefs = reply["prefs"];
7938
8195
  loaded = true;
7939
- lastError = null;
8196
+ clearFailure();
7940
8197
  if (expandedKey !== null && !rows.some((row) => row.key === expandedKey)) expandedKey = null;
7941
8198
  pruneFallbackOffers();
7942
8199
  return;
7943
8200
  }
7944
8201
  const err = typeof reply["error"] === "string" ? reply["error"].trim() : "";
7945
- lastError = (typeof reply["errorKind"] === "string" ? reply["errorKind"].trim() : "") || err || "internal";
8202
+ noteFailure((typeof reply["errorKind"] === "string" ? reply["errorKind"].trim() : "") || err || "internal");
7946
8203
  }
7947
8204
  async function refresh() {
7948
8205
  if (!mounted || refreshing) return;
@@ -7951,9 +8208,11 @@ ${body}`;
7951
8208
  const reply = await call(phones.status, {});
7952
8209
  if (!mounted) return;
7953
8210
  applyReply(reply);
7954
- } catch {
8211
+ } catch (err) {
7955
8212
  if (!mounted) return;
7956
- lastError = "check-failed";
8213
+ noteFailure("check-failed");
8214
+ if (!mountRowLogged) firstRefreshFailed = true;
8215
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
7957
8216
  } finally {
7958
8217
  refreshing = false;
7959
8218
  }
@@ -7962,7 +8221,10 @@ ${body}`;
7962
8221
  maybeAutoPlanCompliant();
7963
8222
  }
7964
8223
  async function phone(name, args, busyRowKey = null) {
7965
- if (!mounted || inFlight) return null;
8224
+ if (!mounted || inFlight) {
8225
+ if (currentActionSkips) currentActionSkips.busy = true;
8226
+ return null;
8227
+ }
7966
8228
  inFlight = true;
7967
8229
  inFlightIsCheck = name === phones.check;
7968
8230
  clearNotice();
@@ -7972,6 +8234,7 @@ ${body}`;
7972
8234
  const reply = await call(name, args);
7973
8235
  if (!mounted) return null;
7974
8236
  if (busyRowKey !== null && isBusyReply(reply)) {
8237
+ if (currentActionSkips) currentActionSkips.busy = true;
7975
8238
  say(batchText("batch.toast.queue-missed", currentLang()), busyRowKey);
7976
8239
  return null;
7977
8240
  }
@@ -7980,7 +8243,7 @@ ${body}`;
7980
8243
  out = isObject$2(reply) ? reply : null;
7981
8244
  } catch {
7982
8245
  if (!mounted) return null;
7983
- lastError = "check-failed";
8246
+ noteFailure("check-failed");
7984
8247
  out = null;
7985
8248
  } finally {
7986
8249
  inFlight = false;
@@ -8002,6 +8265,15 @@ ${body}`;
8002
8265
  }
8003
8266
  return checkOnOpenOption;
8004
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
+ }
8005
8277
  function nowMs() {
8006
8278
  try {
8007
8279
  return Date.now();
@@ -8015,6 +8287,41 @@ ${body}`;
8015
8287
  confirmCancelArmed = false;
8016
8288
  render();
8017
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;
8018
8325
  switch (kind) {
8019
8326
  case "check":
8020
8327
  await phone(phones.check, {});
@@ -8463,11 +8770,21 @@ ${body}`;
8463
8770
  } catch {}
8464
8771
  }
8465
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() {
8466
8782
  if (!mounted) return;
8467
8783
  if (autoResumeOption && !autoResumeDone) {
8468
8784
  autoResumeDone = true;
8469
8785
  if (hasUnfinishedRows(rows, lastSession ?? void 0) && !inFlight && !refreshing) {
8470
8786
  const before = lastError;
8787
+ const latchBefore = failureLatch;
8471
8788
  try {
8472
8789
  const reply = await call(phones.resume, {});
8473
8790
  if (!mounted) return;
@@ -8477,11 +8794,13 @@ ${body}`;
8477
8794
  say(batchText("batch.notice.auto-resumed", currentLang(), { count: String(remainingCount()) }));
8478
8795
  rowFailedAt.clear();
8479
8796
  }
8797
+ autoCheckOutcome = "recent";
8480
8798
  render();
8481
8799
  maybeAutoRowChangelog(expandedKey);
8482
8800
  return;
8483
8801
  }
8484
8802
  lastError = before;
8803
+ failureLatch = latchBefore;
8485
8804
  render();
8486
8805
  } catch {
8487
8806
  if (mounted) render();
@@ -8490,23 +8809,37 @@ ${body}`;
8490
8809
  }
8491
8810
  if (!autoCheckDone) {
8492
8811
  autoCheckDone = true;
8493
- if (!checkOnOpenEffective()) return;
8494
- if (hasUnfinishedRows(rows, lastSession ?? void 0)) return;
8495
- 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
+ }
8496
8824
  const before = lastError;
8825
+ const latchBefore = failureLatch;
8497
8826
  try {
8498
8827
  const reply = await call(phones.check, {});
8499
8828
  if (!mounted) return;
8500
8829
  if (isObject$2(reply) && reply["ok"] === true) {
8501
8830
  applyReply(reply);
8502
8831
  rowFailedAt.clear();
8832
+ autoCheckOutcome = "started";
8503
8833
  render();
8504
8834
  maybeAutoRowChangelog(expandedKey);
8505
8835
  return;
8506
8836
  }
8507
8837
  lastError = before;
8838
+ failureLatch = latchBefore;
8839
+ autoCheckOutcome = "failed";
8508
8840
  render();
8509
8841
  } catch {
8842
+ autoCheckOutcome = "failed";
8510
8843
  if (mounted) render();
8511
8844
  }
8512
8845
  }
@@ -8528,6 +8861,7 @@ ${body}`;
8528
8861
  try {
8529
8862
  container.removeEventListener?.("keydown", onKeyDown);
8530
8863
  } catch {}
8864
+ logShell.dispose();
8531
8865
  }
8532
8866
  const unsubLang = subscribeLang(() => {
8533
8867
  render();
@@ -8539,6 +8873,7 @@ ${body}`;
8539
8873
  try {
8540
8874
  container.addEventListener?.("keydown", onKeyDown);
8541
8875
  } catch {}
8876
+ installGlobalHandlers();
8542
8877
  const timer = getTimer$1();
8543
8878
  const handle = timer.set(() => {
8544
8879
  if (inFlight && inFlightIsCheck) return;
@@ -8561,7 +8896,7 @@ ${body}`;
8561
8896
  };
8562
8897
  }
8563
8898
  //#endregion
8564
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/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
8565
8900
  function isObject$1(value) {
8566
8901
  return !!value && typeof value === "object" && !Array.isArray(value);
8567
8902
  }
@@ -8805,7 +9140,8 @@ ${body}`;
8805
9140
  checkOnOpen: options.checkOnOpen,
8806
9141
  autoResume: options.autoResume,
8807
9142
  onCloseRequested: () => close(),
8808
- call: panelCall
9143
+ call: panelCall,
9144
+ clientLog: { mount: "batch" }
8809
9145
  });
8810
9146
  panelMode = mode;
8811
9147
  }
@@ -9243,8 +9579,12 @@ ${body}`;
9243
9579
  }
9244
9580
  function failMount(kind, message) {
9245
9581
  emitRenderFail("mount", kind, message);
9582
+ const channel = clientLog;
9583
+ if (!channel) return;
9246
9584
  try {
9247
- clientLog?.flush();
9585
+ Promise.resolve(channel.flush()).catch(() => void 0).then(() => {
9586
+ if (clientLogOwned) channel.dispose();
9587
+ });
9248
9588
  } catch {}
9249
9589
  }
9250
9590
  function clientDroppedRows() {
@@ -9378,6 +9718,7 @@ ${body}`;
9378
9718
  const installSource = options.from ?? "entry";
9379
9719
  let mounted = true;
9380
9720
  let snapshot = null;
9721
+ let mountAutoCheckState = null;
9381
9722
  let manual = null;
9382
9723
  let manualSource = null;
9383
9724
  let failureRereadDone = false;
@@ -9401,7 +9742,7 @@ ${body}`;
9401
9742
  let actionBytes = -1;
9402
9743
  let actionTruncated = false;
9403
9744
  let transportFailStreak = 0;
9404
- let actionSkipped = false;
9745
+ let currentActionSkips = null;
9405
9746
  function latchNow() {
9406
9747
  try {
9407
9748
  const n = Date.now();
@@ -9693,6 +10034,7 @@ ${body}`;
9693
10034
  }
9694
10035
  async function refresh() {
9695
10036
  if (!mounted) return;
10037
+ let refreshFailed = false;
9696
10038
  try {
9697
10039
  const reply = await call(phoneNames.updateStatus, queueArgs());
9698
10040
  if (!mounted) return;
@@ -9700,12 +10042,16 @@ ${body}`;
9700
10042
  applyStatusReply(reply, "refresh");
9701
10043
  } catch (err) {
9702
10044
  if (!mounted) return;
10045
+ refreshFailed = true;
9703
10046
  transportFailStreak++;
9704
10047
  emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
9705
10048
  if (!thrownBusy(err)) setLatch(volatileLatch("check"));
9706
10049
  }
9707
10050
  if (!mounted) return;
9708
- 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";
9709
10055
  ensuring = true;
9710
10056
  try {
9711
10057
  const reply = await call(phoneNames.updateCheck, queueArgs());
@@ -9720,7 +10066,8 @@ ${body}`;
9720
10066
  } finally {
9721
10067
  ensuring = false;
9722
10068
  }
9723
- }
10069
+ } else autoCheckOutcome = "recent";
10070
+ if (mountAutoCheckState === null) mountAutoCheckState = autoCheckOutcome;
9724
10071
  paint();
9725
10072
  }
9726
10073
  function jobActive() {
@@ -9850,7 +10197,7 @@ ${body}`;
9850
10197
  }
9851
10198
  }
9852
10199
  function diagText() {
9853
- if (!latch || latch.volatile) return null;
10200
+ if (!latch) return null;
9854
10201
  try {
9855
10202
  return buildUpdateDiagCopy({
9856
10203
  pluginId,
@@ -9882,7 +10229,8 @@ ${body}`;
9882
10229
  copyAnchorEl = anchor;
9883
10230
  actionBytes = -1;
9884
10231
  actionTruncated = false;
9885
- actionSkipped = false;
10232
+ const skipToken = { skipped: false };
10233
+ currentActionSkips = skipToken;
9886
10234
  const latchBefore = latch;
9887
10235
  let ok = true;
9888
10236
  let errorKind = null;
@@ -9901,11 +10249,12 @@ ${body}`;
9901
10249
  ok = false;
9902
10250
  errorKind = latchAfter.code;
9903
10251
  errorHash = hash8(`${latchAfter.code}|${latchAfter.detail ?? ""}`);
9904
- } else if (actionSkipped) {
10252
+ } else if (skipToken.skipped) {
9905
10253
  ok = false;
9906
10254
  errorKind = "busy";
9907
10255
  }
9908
10256
  }
10257
+ currentActionSkips = null;
9909
10258
  logClient("info", "update.panel.action", {
9910
10259
  action: kind,
9911
10260
  ok,
@@ -10043,7 +10392,7 @@ ${body}`;
10043
10392
  switch (kind) {
10044
10393
  case "check":
10045
10394
  if (busyAct) {
10046
- actionSkipped = true;
10395
+ if (currentActionSkips) currentActionSkips.skipped = true;
10047
10396
  return;
10048
10397
  }
10049
10398
  busyAct = "check";
@@ -10058,7 +10407,7 @@ ${body}`;
10058
10407
  return;
10059
10408
  case "install":
10060
10409
  if (busyAct) {
10061
- actionSkipped = true;
10410
+ if (currentActionSkips) currentActionSkips.skipped = true;
10062
10411
  return;
10063
10412
  }
10064
10413
  busyAct = "install";
@@ -10098,14 +10447,14 @@ ${body}`;
10098
10447
  }
10099
10448
  case "install-fallback":
10100
10449
  if (busyAct) {
10101
- actionSkipped = true;
10450
+ if (currentActionSkips) currentActionSkips.skipped = true;
10102
10451
  return;
10103
10452
  }
10104
10453
  await doFallbackResolve();
10105
10454
  return;
10106
10455
  case "install-fallback-confirm":
10107
10456
  if (busyAct) {
10108
- actionSkipped = true;
10457
+ if (currentActionSkips) currentActionSkips.skipped = true;
10109
10458
  return;
10110
10459
  }
10111
10460
  if (!fallbackOffer) return;
@@ -10133,6 +10482,7 @@ ${body}`;
10133
10482
  mounted = false;
10134
10483
  removeGlobalHandlers?.();
10135
10484
  removeGlobalHandlers = null;
10485
+ renderFailSeen.clear();
10136
10486
  try {
10137
10487
  unsubLang();
10138
10488
  } catch {}
@@ -10175,7 +10525,6 @@ ${body}`;
10175
10525
  pollCount += 1;
10176
10526
  refresh();
10177
10527
  }, pollMs);
10178
- if (autoCheck === "mount") refresh();
10179
10528
  function state() {
10180
10529
  const jobState = snapshot?.job?.state ?? null;
10181
10530
  return {
@@ -10186,12 +10535,20 @@ ${body}`;
10186
10535
  busy: !!busyAct || jobState === "installing" || jobState === "verifying"
10187
10536
  };
10188
10537
  }
10189
- logClient("info", "update.panel.mount", {
10190
- mode: clientLogMountName || "install-button",
10191
- theme,
10192
- lang: currentLang(),
10193
- 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);
10194
10550
  });
10551
+ else emitMountRow("disabled");
10195
10552
  return {
10196
10553
  state,
10197
10554
  refresh,
@@ -12990,7 +13347,7 @@ ${body}`;
12990
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)))));
12991
13348
  }
12992
13349
  /** 版本胶囊那一行字:只在这里拼一次,屏上与用例读的是同一串。 */
12993
- const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.72";
13350
+ const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.73";
12994
13351
  /** 右下角那本书离面板两沿的距离:用户口径「一直处于面板右下角、不随列表滑动消失」
12995
13352
  * ⇒ sticky 吸附(面板相对,视口多大都落在面板角上);INSET=右沿,BOTTOM=底沿。 */
12996
13353
  const MANUAL_ENTRY_INSET = 16;