dsh-light-guard 0.7.3 → 0.7.4

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/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@
6
6
 
7
7
  ---
8
8
 
9
+ ## v0.7.4 (2026-11-27)
10
+ - **发现的问题**:高频实用功能「软刷新前端界面」此前藏在第二个 Tab「体检与快照」里,打开插件第一屏不容易发现;若直接挤在标题行右侧又容易把标题和徽章挤换行。
11
+ - **改了什么**:
12
+ - 在顶部驾驶舱 4 个 KPI 指标卡正下方新增独立**「快捷操作栏」**,将「立即体检」与「↻ 软刷新前端界面」等高舒展并排呈现,既突出醒目又不挤占标题和指标卡宽度;
13
+ - 软刷新确认卡片与减负回执同步支持在顶部操作栏直接展开与展示,并在真机 DSH 桌面端完成无报错端到端验证。
14
+
9
15
  ## v0.7.3 (2026-11-27)
10
16
  - **发现的问题**:
11
17
  1. 设置页中部分深色强调字(`#b45309` / `#059669`)在 DSH 深色模式下对比度偏低;
package/lib/client.js CHANGED
@@ -20,7 +20,7 @@ window.__ModuleLoader__.load({
20
20
  var h = React.createElement;
21
21
 
22
22
  var PLUGIN_NAME = "dsh-light-guard";
23
- var VERSION = "0.7.3";
23
+ var VERSION = "0.7.4";
24
24
  var API_PREFIX = "dsh-light-guard";
25
25
  var LOCAL_CACHE_KEY = "dsh.lightGuard.config.v1";
26
26
  var SOFT_RELOAD_KEY = "dsh.lightGuard.softReload.v1";
@@ -690,7 +690,7 @@ window.__ModuleLoader__.load({
690
690
  var snapLabel = _snapLabel[0], setSnapLabel = _snapLabel[1];
691
691
  var _liveDom = React.useState({ domNodes: 0, longTasks: 0, maxLtMs: 0 });
692
692
  var liveDom = _liveDom[0], setLiveDom = _liveDom[1];
693
- var _srConfirm = React.useState(false);
693
+ var _srConfirm = React.useState(null); // "hero" | "doctor" | null
694
694
  var srConfirm = _srConfirm[0], setSrConfirm = _srConfirm[1];
695
695
  var _srState = React.useState(readSoftReloadState);
696
696
  var srState = _srState[0], setSrState = _srState[1];
@@ -1088,6 +1088,30 @@ window.__ModuleLoader__.load({
1088
1088
  { id: "archive", label: "冷归档库" + (archList ? " (" + archList.totalCount + ")" : "") }
1089
1089
  ];
1090
1090
 
1091
+ var heroIsDesktop = typeof window !== "undefined" && window.location && window.location.protocol === "dsh-app:";
1092
+ var heroSr = readSoftReloadState();
1093
+ var heroSrFailed = heroSr && heroSr.status === "failed";
1094
+ var heroSrVerified = heroSr && heroSr.status === "verified";
1095
+
1096
+ function renderSoftReloadConfirmBox(isDesktopEnv, verifiedEnv) {
1097
+ return h("div", { style: { marginTop: "10px", fontSize: "12px", padding: "10px 12px", borderRadius: "8px", background: "rgba(245,158,11,0.1)", border: "1px solid rgba(245,158,11,0.4)", lineHeight: 1.6 } },
1098
+ h("div", { style: { fontWeight: 700, marginBottom: "4px", color: "#f59e0b" } },
1099
+ isDesktopEnv && !verifiedEnv ? "使用前必看(请花 3 秒确认,别担心数据安全)" : "确认立即软刷新前端界面?"
1100
+ ),
1101
+ h("div", null, "1. 作用:仅重载前端界面释放 Chromium 渲染内存,不重启后端、不中断后台正在运行的 Agent 任务;输入栏未发送的草稿请先复制保存。"),
1102
+ isDesktopEnv && !verifiedEnv
1103
+ ? h("div", null, "2. 兼容提醒:如果您装了多个第三方插件,个别插件在桌面端重载时可能触发 web-boot 报错弹窗。")
1104
+ : null,
1105
+ isDesktopEnv && !verifiedEnv
1106
+ ? h("div", null, "3. 万一弹窗别慌:您的数据、会话和插件绝对不会丢失——直接点弹窗里的「重启」(不要点「禁用第三方插件」),几秒即可恢复正常;本插件会自动记住冲突,后续不再推荐。")
1107
+ : null,
1108
+ h("div", { style: { display: "flex", gap: "8px", marginTop: "8px" } },
1109
+ h("button", { style: btnPrimary, onClick: executeSoftReload }, "我已知晓,开始软刷新"),
1110
+ h("button", { style: btnBase, onClick: function () { setSrConfirm(null); } }, "取消")
1111
+ )
1112
+ );
1113
+ }
1114
+
1091
1115
  return h("div", { style: { fontSize: "13px", lineHeight: 1.5, maxWidth: "820px" } },
1092
1116
 
1093
1117
  // ── Hero Performance Cockpit ──
@@ -1109,11 +1133,6 @@ window.__ModuleLoader__.load({
1109
1133
  ? h(Pill, { bg: "rgba(245,158,11,0.18)", color: "#f59e0b" }, "后端 v" + (verInfo.hostVersion || "旧版") + " · 待热重载/重启")
1110
1134
  : null
1111
1135
  ),
1112
- h("button", {
1113
- style: Object.assign({}, btnPrimary, { padding: "6px 14px", fontWeight: 600 }),
1114
- disabled: scanning,
1115
- onClick: function () { doScan(true); }
1116
- }, scanning ? "扫描中…" : "立即体检")
1117
1136
  ),
1118
1137
  h("div", { style: { fontSize: "12px", opacity: 0.78, marginBottom: "10px" } },
1119
1138
  "零后台轮询 · 官方 API 冷归档 · 前后端内存归因 · 可调参流瘦身"
@@ -1137,7 +1156,46 @@ window.__ModuleLoader__.load({
1137
1156
  )
1138
1157
  )
1139
1158
  )
1140
- )
1159
+ ),
1160
+ // ── Dedicated Quick Action Bar below KPIs ──
1161
+ h("div", {
1162
+ style: {
1163
+ display: "flex",
1164
+ justifyContent: "space-between",
1165
+ alignItems: "center",
1166
+ gap: "10px",
1167
+ flexWrap: "wrap",
1168
+ marginTop: "12px",
1169
+ paddingTop: "11px",
1170
+ borderTop: "1px solid rgba(128,128,128,0.14)"
1171
+ }
1172
+ },
1173
+ h("div", { style: { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap" } },
1174
+ h("button", {
1175
+ style: Object.assign({}, btnPrimary, { padding: "7px 16px", fontWeight: 600 }),
1176
+ disabled: scanning,
1177
+ onClick: function () { doScan(true); }
1178
+ }, scanning ? "扫描中…" : "立即体检"),
1179
+ h("button", {
1180
+ style: Object.assign({}, btnBase, {
1181
+ padding: "7px 14px",
1182
+ fontWeight: 600,
1183
+ borderColor: heroSrFailed ? "rgba(245,158,11,0.5)" : "rgba(59,130,246,0.45)",
1184
+ background: heroSrFailed ? "rgba(245,158,11,0.1)" : "rgba(59,130,246,0.09)",
1185
+ color: heroSrFailed ? "#f59e0b" : "#3b82f6"
1186
+ }),
1187
+ onClick: function () { setSrConfirm(srConfirm === "hero" ? null : "hero"); }
1188
+ }, (heroSrFailed ? "↻ 重新测试软刷新" : "↻ 软刷新前端界面") + (heroSrVerified ? " ✓" : ""))
1189
+ ),
1190
+ h("div", { style: { fontSize: "11px", opacity: 0.72 } },
1191
+ heroSrVerified && typeof heroSr.beforeDom === "number" && typeof heroSr.afterDom === "number"
1192
+ ? ("✓ 上次软刷新:DOM " + heroSr.beforeDom.toLocaleString() + " → " + heroSr.afterDom.toLocaleString())
1193
+ : heroSrFailed
1194
+ ? "⚠ 上次软刷新异常,建议正常重启 DSH"
1195
+ : "软刷新仅重载界面,不中断后台任务"
1196
+ )
1197
+ ),
1198
+ srConfirm === "hero" ? renderSoftReloadConfirmBox(heroIsDesktop, heroSrVerified) : null
1141
1199
  ),
1142
1200
 
1143
1201
  // Long uptime gentle reminder
@@ -1469,7 +1527,7 @@ window.__ModuleLoader__.load({
1469
1527
  ),
1470
1528
  h("button", {
1471
1529
  style: (!srFailed && memDiag.suggestSoftReload) ? btnPrimary : btnBase,
1472
- onClick: function () { setSrConfirm(!srConfirm); }
1530
+ onClick: function () { setSrConfirm(srConfirm === "doctor" ? null : "doctor"); }
1473
1531
  }, srFailed ? "重新测试软刷新" : "软刷新前端界面")
1474
1532
  ),
1475
1533
  h("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))", gap: "8px", marginBottom: "8px", fontSize: "12px" } },
@@ -1509,24 +1567,7 @@ window.__ModuleLoader__.load({
1509
1567
  )
1510
1568
  : null,
1511
1569
  // Clear, reassuring 2-step confirmation panel before triggering reload
1512
- srConfirm
1513
- ? h("div", { style: { marginTop: "8px", fontSize: "12px", padding: "10px 12px", borderRadius: "8px", background: "rgba(245,158,11,0.1)", border: "1px solid rgba(245,158,11,0.4)", lineHeight: 1.6 } },
1514
- h("div", { style: { fontWeight: 700, marginBottom: "4px", color: "#f59e0b" } },
1515
- isDesktop && !srVerified ? "使用前必看(请花 3 秒确认,别担心数据安全)" : "确认立即软刷新前端界面?"
1516
- ),
1517
- h("div", null, "1. 作用:仅重载前端界面释放 Chromium 渲染内存,不重启后端、不中断后台正在运行的 Agent 任务;输入栏未发送的草稿请先复制保存。"),
1518
- isDesktop && !srVerified
1519
- ? h("div", null, "2. 兼容提醒:如果您装了多个第三方插件,个别插件在桌面端重载时可能触发 web-boot 报错弹窗。")
1520
- : null,
1521
- isDesktop && !srVerified
1522
- ? h("div", null, "3. 万一弹窗别慌:您的数据、会话和插件绝对不会丢失——直接点弹窗里的「重启」(不要点「禁用第三方插件」),几秒即可恢复正常;本插件会自动记住冲突,后续不再推荐。")
1523
- : null,
1524
- h("div", { style: { display: "flex", gap: "8px", marginTop: "8px" } },
1525
- h("button", { style: btnPrimary, onClick: executeSoftReload }, "我已知晓,开始软刷新"),
1526
- h("button", { style: btnBase, onClick: function () { setSrConfirm(false); } }, "取消")
1527
- )
1528
- )
1529
- : null
1570
+ srConfirm === "doctor" ? renderSoftReloadConfirmBox(isDesktop, srVerified) : null
1530
1571
  ),
1531
1572
 
1532
1573
  h("div", { style: surfaceCard },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-light-guard",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "author": "unifilitence",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",