dsh-life-pack 0.3.72 → 0.3.74

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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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.30/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,12 @@ ${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[aria-busy=\"true\"]::after{content:none;display:none}",
7286
+ ".dsh-upd .dsh-upd-busy-btn[data-busy=\"1\"]{animation:dsh-upd-busy-pulse 1.4s ease-in-out infinite}",
7287
+ "@keyframes dsh-upd-busy-spin{to{transform:rotate(360deg)}}",
7288
+ "@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
7289
  "@media (prefers-reduced-motion: reduce){.dsh-upd-batch *{transition:none !important;animation:none !important}}",
7123
7290
  ".dsh-upd-batch{overflow-anchor:none}",
7124
7291
  ".dsh-upd-btable{overflow-anchor:none}",
@@ -7150,13 +7317,17 @@ ${body}`;
7150
7317
  ".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
7318
  ".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
7319
  ".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}",
7320
+ ".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}",
7321
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-brow-actions button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}",
7322
+ ".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}",
7323
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-bdetail-actions button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}",
7324
+ ".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}",
7325
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-batch-more button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}",
7156
7326
  ".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
7327
  ".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
7328
  ".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}"
7329
+ ".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}",
7330
+ ".dsh-upd[data-theme=\"archive\"] .dsh-upd-banner>.dsh-upd-browline button:not([data-primary=\"1\"]):not([data-busy=\"1\"]){background:transparent}"
7160
7331
  ].join(String.fromCharCode(10));
7161
7332
  function escapeHtml$2(text) {
7162
7333
  return String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -7334,11 +7505,14 @@ ${body}`;
7334
7505
  if (!isObject$2(snapshot)) return null;
7335
7506
  if (snapshot["installed"] === false) return null;
7336
7507
  const running = snapshot["runningVersion"];
7337
- if (typeof running === "string" && running) return running;
7508
+ if (typeof running === "string" && running && !isPlaceholderVersion(running)) return running;
7338
7509
  const installed = snapshot["installedVersion"];
7339
- if (typeof installed === "string" && installed) return installed;
7510
+ if (typeof installed === "string" && installed && !isPlaceholderVersion(installed)) return installed;
7340
7511
  return null;
7341
7512
  }
7513
+ function isPlaceholderVersion(version) {
7514
+ return version === "0.0.0";
7515
+ }
7342
7516
  function jobFailureOf(row) {
7343
7517
  const snapshot = isObject$2(row.snapshot) ? row.snapshot : null;
7344
7518
  if (!snapshot) return null;
@@ -7490,17 +7664,75 @@ ${body}`;
7490
7664
  };
7491
7665
  }
7492
7666
  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(面板调宿主电话的唯一接触面)");
7667
+ const channelPrefix = (() => {
7668
+ if (!options || typeof options !== "object") return "wf";
7669
+ const rawPrefix = options.prefix;
7670
+ if (typeof rawPrefix !== "string") return "wf";
7671
+ try {
7672
+ buildLogAppendPhoneName(rawPrefix);
7673
+ return rawPrefix;
7674
+ } catch {
7675
+ return "wf";
7676
+ }
7677
+ })();
7678
+ const logShell = createPanelClientLogShell({
7679
+ clientLog: options && typeof options === "object" ? options.clientLog : void 0,
7680
+ call: options && typeof options === "object" && typeof options.call === "function" ? options.call : null,
7681
+ logAppendPhone: buildLogAppendPhoneName(channelPrefix),
7682
+ coerceReply: true
7683
+ });
7684
+ const logClient = logShell.log;
7685
+ const emitRenderFail = logShell.emitRenderFail;
7686
+ const failMount = logShell.failMount;
7687
+ const errorTextOf = logShell.errorTextOf;
7688
+ const installGlobalHandlers = logShell.installGlobalHandlers;
7689
+ const clientLogMountName = logShell.mountName;
7690
+ if (!options || typeof options !== "object") {
7691
+ const message = "[dsh-plugin-update] 挂载批量面板缺少配置:批量电话前缀 prefix 必填";
7692
+ failMount("prefix", message);
7693
+ throw new Error(message);
7694
+ }
7695
+ if (typeof options.call !== "function") {
7696
+ const message = "[dsh-plugin-update] 挂载批量面板需要传输函数 call(面板调宿主电话的唯一接触面)";
7697
+ failMount("call", message);
7698
+ throw new Error(message);
7699
+ }
7700
+ if (!container || typeof container.innerHTML !== "string") {
7701
+ const message = "[dsh-plugin-update] 挂载批量面板需要一个有 innerHTML 的容器";
7702
+ failMount("container", message);
7703
+ throw new Error(message);
7704
+ }
7705
+ let phones;
7706
+ try {
7707
+ phones = buildBatchPhoneNames(options.prefix);
7708
+ } catch (err) {
7709
+ failMount("prefix", errorTextOf(err));
7710
+ throw err;
7711
+ }
7497
7712
  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) + ")");
7713
+ if (typeof pollMs !== "number" || !Number.isFinite(pollMs) || pollMs < BATCH_PANEL_POLL.minMs) {
7714
+ const message = "[dsh-plugin-update] 批量面板轮询间隔非法:不得小于 250 毫秒(收到 " + JSON.stringify(options.pollMs) + ")";
7715
+ failMount("poll-ms", message);
7716
+ throw new Error(message);
7717
+ }
7499
7718
  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) + ")");
7719
+ if (mode !== "embedded" && mode !== "dialog") {
7720
+ const message = "[dsh-plugin-update] 摆放形态非法:只收 embedded 或 dialog(收到 " + JSON.stringify(options.mode) + ")";
7721
+ failMount("mode", message);
7722
+ throw new Error(message);
7723
+ }
7724
+ if (options.theme !== void 0 && options.theme !== "default" && options.theme !== "archive") {
7725
+ const message = "[dsh-plugin-update] 主题非法:只收 default 或 archive(收到 " + JSON.stringify(options.theme) + ")";
7726
+ failMount("theme", message);
7727
+ throw new Error(message);
7728
+ }
7502
7729
  let theme = normalizePanelTheme(options.theme ?? "default");
7503
- themeTokensStyleFor(options.themeTokens ?? void 0);
7730
+ try {
7731
+ themeTokensStyleFor(options.themeTokens ?? void 0);
7732
+ } catch (err) {
7733
+ failMount("theme-tokens", errorTextOf(err));
7734
+ throw err;
7735
+ }
7504
7736
  let themeTokens = options.themeTokens;
7505
7737
  const call = options.call;
7506
7738
  const titles = options.titles && typeof options.titles === "object" ? options.titles : {};
@@ -7517,6 +7749,15 @@ ${body}`;
7517
7749
  let rows = [];
7518
7750
  let expandedKey = null;
7519
7751
  let lastError = null;
7752
+ let failureLatch = null;
7753
+ function noteFailure(code) {
7754
+ lastError = code;
7755
+ failureLatch = { code };
7756
+ }
7757
+ function clearFailure() {
7758
+ lastError = null;
7759
+ failureLatch = null;
7760
+ }
7520
7761
  let notice = null;
7521
7762
  let noticeKey = null;
7522
7763
  let inFlight = false;
@@ -7529,6 +7770,12 @@ ${body}`;
7529
7770
  function currentLang() {
7530
7771
  return langOf(localeOpt);
7531
7772
  }
7773
+ const mountRowFields = {
7774
+ mode: clientLogMountName || mode,
7775
+ theme,
7776
+ lang: currentLang(),
7777
+ pollMs
7778
+ };
7532
7779
  const checkOnOpenOption = options["checkOnOpen"] !== false;
7533
7780
  const autoResumeOption = options["autoResume"] !== false;
7534
7781
  let lastSession = null;
@@ -7537,6 +7784,10 @@ ${body}`;
7537
7784
  let lastCheckedAt = 0;
7538
7785
  let autoCheckDone = false;
7539
7786
  let autoResumeDone = false;
7787
+ let mountRowLogged = false;
7788
+ let firstRefreshFailed = false;
7789
+ let autoCheckOutcome = null;
7790
+ let currentActionSkips = null;
7540
7791
  const rowFallbackOffers = /* @__PURE__ */ new Map();
7541
7792
  let fallbackBusyKey = null;
7542
7793
  let batchCompliantKeys = [];
@@ -7681,6 +7932,13 @@ ${body}`;
7681
7932
  let lastHTML = "";
7682
7933
  function render() {
7683
7934
  if (!mounted) return;
7935
+ try {
7936
+ paint();
7937
+ } catch (err) {
7938
+ emitRenderFail("paint", "render", errorTextOf(err) || "render-failed");
7939
+ }
7940
+ }
7941
+ function paint() {
7684
7942
  const offers = {};
7685
7943
  for (const [k, v] of rowFallbackOffers) offers[k] = {
7686
7944
  candidate: v.candidate,
@@ -7908,7 +8166,7 @@ ${body}`;
7908
8166
  }
7909
8167
  function applyReply(reply) {
7910
8168
  if (!isObject$2(reply)) {
7911
- lastError = "internal";
8169
+ noteFailure("internal");
7912
8170
  return;
7913
8171
  }
7914
8172
  if (reply["ok"] === true) {
@@ -7936,13 +8194,13 @@ ${body}`;
7936
8194
  }
7937
8195
  if (isObject$2(reply["prefs"])) lastPrefs = reply["prefs"];
7938
8196
  loaded = true;
7939
- lastError = null;
8197
+ clearFailure();
7940
8198
  if (expandedKey !== null && !rows.some((row) => row.key === expandedKey)) expandedKey = null;
7941
8199
  pruneFallbackOffers();
7942
8200
  return;
7943
8201
  }
7944
8202
  const err = typeof reply["error"] === "string" ? reply["error"].trim() : "";
7945
- lastError = (typeof reply["errorKind"] === "string" ? reply["errorKind"].trim() : "") || err || "internal";
8203
+ noteFailure((typeof reply["errorKind"] === "string" ? reply["errorKind"].trim() : "") || err || "internal");
7946
8204
  }
7947
8205
  async function refresh() {
7948
8206
  if (!mounted || refreshing) return;
@@ -7951,9 +8209,11 @@ ${body}`;
7951
8209
  const reply = await call(phones.status, {});
7952
8210
  if (!mounted) return;
7953
8211
  applyReply(reply);
7954
- } catch {
8212
+ } catch (err) {
7955
8213
  if (!mounted) return;
7956
- lastError = "check-failed";
8214
+ noteFailure("check-failed");
8215
+ if (!mountRowLogged) firstRefreshFailed = true;
8216
+ emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
7957
8217
  } finally {
7958
8218
  refreshing = false;
7959
8219
  }
@@ -7962,7 +8222,10 @@ ${body}`;
7962
8222
  maybeAutoPlanCompliant();
7963
8223
  }
7964
8224
  async function phone(name, args, busyRowKey = null) {
7965
- if (!mounted || inFlight) return null;
8225
+ if (!mounted || inFlight) {
8226
+ if (currentActionSkips) currentActionSkips.busy = true;
8227
+ return null;
8228
+ }
7966
8229
  inFlight = true;
7967
8230
  inFlightIsCheck = name === phones.check;
7968
8231
  clearNotice();
@@ -7972,6 +8235,7 @@ ${body}`;
7972
8235
  const reply = await call(name, args);
7973
8236
  if (!mounted) return null;
7974
8237
  if (busyRowKey !== null && isBusyReply(reply)) {
8238
+ if (currentActionSkips) currentActionSkips.busy = true;
7975
8239
  say(batchText("batch.toast.queue-missed", currentLang()), busyRowKey);
7976
8240
  return null;
7977
8241
  }
@@ -7980,7 +8244,7 @@ ${body}`;
7980
8244
  out = isObject$2(reply) ? reply : null;
7981
8245
  } catch {
7982
8246
  if (!mounted) return null;
7983
- lastError = "check-failed";
8247
+ noteFailure("check-failed");
7984
8248
  out = null;
7985
8249
  } finally {
7986
8250
  inFlight = false;
@@ -8002,6 +8266,15 @@ ${body}`;
8002
8266
  }
8003
8267
  return checkOnOpenOption;
8004
8268
  }
8269
+ function logMountRowOnce() {
8270
+ if (mountRowLogged || !mounted) return;
8271
+ mountRowLogged = true;
8272
+ const autoCheck = autoCheckOutcome ?? (firstRefreshFailed ? "failed" : checkOnOpenEffective() ? "recent" : "disabled");
8273
+ logClient("info", "update.panel.mount", {
8274
+ ...mountRowFields,
8275
+ autoCheck
8276
+ });
8277
+ }
8005
8278
  function nowMs() {
8006
8279
  try {
8007
8280
  return Date.now();
@@ -8015,6 +8288,41 @@ ${body}`;
8015
8288
  confirmCancelArmed = false;
8016
8289
  render();
8017
8290
  }
8291
+ const startedAtMs = Date.now();
8292
+ const skipToken = { busy: false };
8293
+ currentActionSkips = skipToken;
8294
+ const latchBefore = failureLatch;
8295
+ let ok = true;
8296
+ let errorKind = null;
8297
+ let errorHash = null;
8298
+ try {
8299
+ await runAct(kind, key);
8300
+ } catch (err) {
8301
+ ok = false;
8302
+ errorKind = "thrown";
8303
+ errorHash = hash8(errorTextOf(err));
8304
+ throw err;
8305
+ } finally {
8306
+ if (ok && failureLatch !== latchBefore) {
8307
+ ok = false;
8308
+ errorKind = failureLatch?.code ?? lastError ?? "internal";
8309
+ errorHash = hash8(errorKind);
8310
+ } else if (ok && skipToken.busy) {
8311
+ ok = false;
8312
+ errorKind = "busy";
8313
+ }
8314
+ currentActionSkips = null;
8315
+ logClient("info", "update.panel.action", {
8316
+ action: kind,
8317
+ ok,
8318
+ errorKind,
8319
+ durationMs: Math.max(0, Date.now() - startedAtMs),
8320
+ ...errorHash ? { errorHash } : {}
8321
+ });
8322
+ }
8323
+ }
8324
+ async function runAct(kind, key) {
8325
+ if (!mounted) return;
8018
8326
  switch (kind) {
8019
8327
  case "check":
8020
8328
  await phone(phones.check, {});
@@ -8463,11 +8771,21 @@ ${body}`;
8463
8771
  } catch {}
8464
8772
  }
8465
8773
  async function autoOnce() {
8774
+ try {
8775
+ await runAutoOnce();
8776
+ } catch {
8777
+ if (autoCheckOutcome === null) autoCheckOutcome = "failed";
8778
+ } finally {
8779
+ logMountRowOnce();
8780
+ }
8781
+ }
8782
+ async function runAutoOnce() {
8466
8783
  if (!mounted) return;
8467
8784
  if (autoResumeOption && !autoResumeDone) {
8468
8785
  autoResumeDone = true;
8469
8786
  if (hasUnfinishedRows(rows, lastSession ?? void 0) && !inFlight && !refreshing) {
8470
8787
  const before = lastError;
8788
+ const latchBefore = failureLatch;
8471
8789
  try {
8472
8790
  const reply = await call(phones.resume, {});
8473
8791
  if (!mounted) return;
@@ -8477,11 +8795,13 @@ ${body}`;
8477
8795
  say(batchText("batch.notice.auto-resumed", currentLang(), { count: String(remainingCount()) }));
8478
8796
  rowFailedAt.clear();
8479
8797
  }
8798
+ autoCheckOutcome = "recent";
8480
8799
  render();
8481
8800
  maybeAutoRowChangelog(expandedKey);
8482
8801
  return;
8483
8802
  }
8484
8803
  lastError = before;
8804
+ failureLatch = latchBefore;
8485
8805
  render();
8486
8806
  } catch {
8487
8807
  if (mounted) render();
@@ -8490,23 +8810,37 @@ ${body}`;
8490
8810
  }
8491
8811
  if (!autoCheckDone) {
8492
8812
  autoCheckDone = true;
8493
- if (!checkOnOpenEffective()) return;
8494
- if (hasUnfinishedRows(rows, lastSession ?? void 0)) return;
8495
- if (!(lastCheckedAt <= 0 || nowMs() - lastCheckedAt >= 6e4) || inFlight || refreshing) return;
8813
+ if (!checkOnOpenEffective()) {
8814
+ autoCheckOutcome = "disabled";
8815
+ return;
8816
+ }
8817
+ if (hasUnfinishedRows(rows, lastSession ?? void 0)) {
8818
+ autoCheckOutcome = "recent";
8819
+ return;
8820
+ }
8821
+ if (!(lastCheckedAt <= 0 || nowMs() - lastCheckedAt >= 6e4) || inFlight || refreshing) {
8822
+ autoCheckOutcome = "recent";
8823
+ return;
8824
+ }
8496
8825
  const before = lastError;
8826
+ const latchBefore = failureLatch;
8497
8827
  try {
8498
8828
  const reply = await call(phones.check, {});
8499
8829
  if (!mounted) return;
8500
8830
  if (isObject$2(reply) && reply["ok"] === true) {
8501
8831
  applyReply(reply);
8502
8832
  rowFailedAt.clear();
8833
+ autoCheckOutcome = "started";
8503
8834
  render();
8504
8835
  maybeAutoRowChangelog(expandedKey);
8505
8836
  return;
8506
8837
  }
8507
8838
  lastError = before;
8839
+ failureLatch = latchBefore;
8840
+ autoCheckOutcome = "failed";
8508
8841
  render();
8509
8842
  } catch {
8843
+ autoCheckOutcome = "failed";
8510
8844
  if (mounted) render();
8511
8845
  }
8512
8846
  }
@@ -8528,6 +8862,7 @@ ${body}`;
8528
8862
  try {
8529
8863
  container.removeEventListener?.("keydown", onKeyDown);
8530
8864
  } catch {}
8865
+ logShell.dispose();
8531
8866
  }
8532
8867
  const unsubLang = subscribeLang(() => {
8533
8868
  render();
@@ -8539,6 +8874,7 @@ ${body}`;
8539
8874
  try {
8540
8875
  container.addEventListener?.("keydown", onKeyDown);
8541
8876
  } catch {}
8877
+ installGlobalHandlers();
8542
8878
  const timer = getTimer$1();
8543
8879
  const handle = timer.set(() => {
8544
8880
  if (inFlight && inFlightIsCheck) return;
@@ -8561,7 +8897,7 @@ ${body}`;
8561
8897
  };
8562
8898
  }
8563
8899
  //#endregion
8564
- //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.26/node_modules/dsh-plugin-update/dist/entry-batch.js
8900
+ //#region ../../node_modules/.pnpm/dsh-plugin-update@0.18.30/node_modules/dsh-plugin-update/dist/entry-batch.js
8565
8901
  function isObject$1(value) {
8566
8902
  return !!value && typeof value === "object" && !Array.isArray(value);
8567
8903
  }
@@ -8805,7 +9141,8 @@ ${body}`;
8805
9141
  checkOnOpen: options.checkOnOpen,
8806
9142
  autoResume: options.autoResume,
8807
9143
  onCloseRequested: () => close(),
8808
- call: panelCall
9144
+ call: panelCall,
9145
+ clientLog: { mount: "batch" }
8809
9146
  });
8810
9147
  panelMode = mode;
8811
9148
  }
@@ -9243,8 +9580,12 @@ ${body}`;
9243
9580
  }
9244
9581
  function failMount(kind, message) {
9245
9582
  emitRenderFail("mount", kind, message);
9583
+ const channel = clientLog;
9584
+ if (!channel) return;
9246
9585
  try {
9247
- clientLog?.flush();
9586
+ Promise.resolve(channel.flush()).catch(() => void 0).then(() => {
9587
+ if (clientLogOwned) channel.dispose();
9588
+ });
9248
9589
  } catch {}
9249
9590
  }
9250
9591
  function clientDroppedRows() {
@@ -9378,6 +9719,7 @@ ${body}`;
9378
9719
  const installSource = options.from ?? "entry";
9379
9720
  let mounted = true;
9380
9721
  let snapshot = null;
9722
+ let mountAutoCheckState = null;
9381
9723
  let manual = null;
9382
9724
  let manualSource = null;
9383
9725
  let failureRereadDone = false;
@@ -9401,7 +9743,7 @@ ${body}`;
9401
9743
  let actionBytes = -1;
9402
9744
  let actionTruncated = false;
9403
9745
  let transportFailStreak = 0;
9404
- let actionSkipped = false;
9746
+ let currentActionSkips = null;
9405
9747
  function latchNow() {
9406
9748
  try {
9407
9749
  const n = Date.now();
@@ -9693,6 +10035,7 @@ ${body}`;
9693
10035
  }
9694
10036
  async function refresh() {
9695
10037
  if (!mounted) return;
10038
+ let refreshFailed = false;
9696
10039
  try {
9697
10040
  const reply = await call(phoneNames.updateStatus, queueArgs());
9698
10041
  if (!mounted) return;
@@ -9700,12 +10043,16 @@ ${body}`;
9700
10043
  applyStatusReply(reply, "refresh");
9701
10044
  } catch (err) {
9702
10045
  if (!mounted) return;
10046
+ refreshFailed = true;
9703
10047
  transportFailStreak++;
9704
10048
  emitRenderFail("poll", "transport", errorTextOf(err) || "transport-failed");
9705
10049
  if (!thrownBusy(err)) setLatch(volatileLatch("check"));
9706
10050
  }
9707
10051
  if (!mounted) return;
9708
- if (autoCheck !== "never" && !busyAct && !ensuring && snapshot && !snapshot.latestVersion) {
10052
+ let autoCheckOutcome;
10053
+ if (refreshFailed || !snapshot) autoCheckOutcome = "failed";
10054
+ else if (autoCheck !== "never" && !busyAct && !ensuring && !snapshot.latestVersion) {
10055
+ autoCheckOutcome = "started";
9709
10056
  ensuring = true;
9710
10057
  try {
9711
10058
  const reply = await call(phoneNames.updateCheck, queueArgs());
@@ -9720,7 +10067,8 @@ ${body}`;
9720
10067
  } finally {
9721
10068
  ensuring = false;
9722
10069
  }
9723
- }
10070
+ } else autoCheckOutcome = "recent";
10071
+ if (mountAutoCheckState === null) mountAutoCheckState = autoCheckOutcome;
9724
10072
  paint();
9725
10073
  }
9726
10074
  function jobActive() {
@@ -9850,7 +10198,7 @@ ${body}`;
9850
10198
  }
9851
10199
  }
9852
10200
  function diagText() {
9853
- if (!latch || latch.volatile) return null;
10201
+ if (!latch) return null;
9854
10202
  try {
9855
10203
  return buildUpdateDiagCopy({
9856
10204
  pluginId,
@@ -9882,7 +10230,8 @@ ${body}`;
9882
10230
  copyAnchorEl = anchor;
9883
10231
  actionBytes = -1;
9884
10232
  actionTruncated = false;
9885
- actionSkipped = false;
10233
+ const skipToken = { skipped: false };
10234
+ currentActionSkips = skipToken;
9886
10235
  const latchBefore = latch;
9887
10236
  let ok = true;
9888
10237
  let errorKind = null;
@@ -9901,11 +10250,12 @@ ${body}`;
9901
10250
  ok = false;
9902
10251
  errorKind = latchAfter.code;
9903
10252
  errorHash = hash8(`${latchAfter.code}|${latchAfter.detail ?? ""}`);
9904
- } else if (actionSkipped) {
10253
+ } else if (skipToken.skipped) {
9905
10254
  ok = false;
9906
10255
  errorKind = "busy";
9907
10256
  }
9908
10257
  }
10258
+ currentActionSkips = null;
9909
10259
  logClient("info", "update.panel.action", {
9910
10260
  action: kind,
9911
10261
  ok,
@@ -10043,7 +10393,7 @@ ${body}`;
10043
10393
  switch (kind) {
10044
10394
  case "check":
10045
10395
  if (busyAct) {
10046
- actionSkipped = true;
10396
+ if (currentActionSkips) currentActionSkips.skipped = true;
10047
10397
  return;
10048
10398
  }
10049
10399
  busyAct = "check";
@@ -10058,7 +10408,7 @@ ${body}`;
10058
10408
  return;
10059
10409
  case "install":
10060
10410
  if (busyAct) {
10061
- actionSkipped = true;
10411
+ if (currentActionSkips) currentActionSkips.skipped = true;
10062
10412
  return;
10063
10413
  }
10064
10414
  busyAct = "install";
@@ -10098,14 +10448,14 @@ ${body}`;
10098
10448
  }
10099
10449
  case "install-fallback":
10100
10450
  if (busyAct) {
10101
- actionSkipped = true;
10451
+ if (currentActionSkips) currentActionSkips.skipped = true;
10102
10452
  return;
10103
10453
  }
10104
10454
  await doFallbackResolve();
10105
10455
  return;
10106
10456
  case "install-fallback-confirm":
10107
10457
  if (busyAct) {
10108
- actionSkipped = true;
10458
+ if (currentActionSkips) currentActionSkips.skipped = true;
10109
10459
  return;
10110
10460
  }
10111
10461
  if (!fallbackOffer) return;
@@ -10133,6 +10483,7 @@ ${body}`;
10133
10483
  mounted = false;
10134
10484
  removeGlobalHandlers?.();
10135
10485
  removeGlobalHandlers = null;
10486
+ renderFailSeen.clear();
10136
10487
  try {
10137
10488
  unsubLang();
10138
10489
  } catch {}
@@ -10175,7 +10526,6 @@ ${body}`;
10175
10526
  pollCount += 1;
10176
10527
  refresh();
10177
10528
  }, pollMs);
10178
- if (autoCheck === "mount") refresh();
10179
10529
  function state() {
10180
10530
  const jobState = snapshot?.job?.state ?? null;
10181
10531
  return {
@@ -10186,12 +10536,20 @@ ${body}`;
10186
10536
  busy: !!busyAct || jobState === "installing" || jobState === "verifying"
10187
10537
  };
10188
10538
  }
10189
- logClient("info", "update.panel.mount", {
10190
- mode: clientLogMountName || "install-button",
10191
- theme,
10192
- lang: currentLang(),
10193
- pollMs
10539
+ function emitMountRow(autoCheck2) {
10540
+ logClient("info", "update.panel.mount", {
10541
+ mode: clientLogMountName || "install-button",
10542
+ theme,
10543
+ lang: currentLang(),
10544
+ pollMs,
10545
+ autoCheck: autoCheck2
10546
+ });
10547
+ }
10548
+ if (autoCheck === "mount") refresh().then(() => {
10549
+ if (!mounted || mountAutoCheckState === null) return;
10550
+ emitMountRow(mountAutoCheckState);
10194
10551
  });
10552
+ else emitMountRow("disabled");
10195
10553
  return {
10196
10554
  state,
10197
10555
  refresh,
@@ -12990,7 +13348,7 @@ ${body}`;
12990
13348
  }, 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
13349
  }
12992
13350
  /** 版本胶囊那一行字:只在这里拼一次,屏上与用例读的是同一串。 */
12993
- const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.72";
13351
+ const MANAGER_VERSION_TEXT = "dsh-life-pack · 0.3.74";
12994
13352
  /** 右下角那本书离面板两沿的距离:用户口径「一直处于面板右下角、不随列表滑动消失」
12995
13353
  * ⇒ sticky 吸附(面板相对,视口多大都落在面板角上);INSET=右沿,BOTTOM=底沿。 */
12996
13354
  const MANUAL_ENTRY_INSET = 16;