@kanadego/dsh-heartbeat 2.0.1 → 2.1.0

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.
Files changed (50) hide show
  1. package/README.md +77 -23
  2. package/client.js +498 -125
  3. package/config/interests.json +1 -1
  4. package/config/policy.json +3 -2
  5. package/dist/{chunk-TVX4HV4Y.js → chunk-63E5OYSI.js} +56 -5
  6. package/dist/chunk-63E5OYSI.js.map +1 -0
  7. package/dist/{chunk-NCPKOWS7.js → chunk-AT32XCCI.js} +2 -2
  8. package/dist/{chunk-DC5HMCJC.js → chunk-DLOYERAK.js} +3 -3
  9. package/dist/{chunk-544QOJN5.js → chunk-ECXYNTEV.js} +2 -2
  10. package/dist/{chunk-IFRMKVIC.js → chunk-HE6IF6OU.js} +5 -2
  11. package/dist/chunk-HE6IF6OU.js.map +1 -0
  12. package/dist/{chunk-DZ7YCFGX.js → chunk-KZLVR4J7.js} +2 -2
  13. package/dist/{chunk-6XM6KY7M.js → chunk-LPPRI53J.js} +39 -37
  14. package/dist/chunk-LPPRI53J.js.map +1 -0
  15. package/dist/chunk-LQKOYTRL.js +59 -0
  16. package/dist/chunk-LQKOYTRL.js.map +1 -0
  17. package/dist/{chunk-AKIJ4LS2.js → chunk-M72T5MZU.js} +44 -1
  18. package/dist/chunk-M72T5MZU.js.map +1 -0
  19. package/dist/{chunk-6MVKWICX.js → chunk-XCMGPIUQ.js} +99 -23
  20. package/dist/chunk-XCMGPIUQ.js.map +1 -0
  21. package/dist/cli/index.js +51 -11
  22. package/dist/cli/index.js.map +1 -1
  23. package/dist/focus-store-RNHBAFYS.js +20 -0
  24. package/dist/{inbox-OWBK6PE2.js → inbox-ZLX2MH7A.js} +3 -3
  25. package/dist/index.d.ts +16 -3
  26. package/dist/index.js +119 -69
  27. package/dist/index.js.map +1 -1
  28. package/dist/{migrate-TQ5PB2DI.js → migrate-XFZU5EBE.js} +3 -3
  29. package/dist/{orchestrator-P7AEWVYR.js → orchestrator-MNFCPH43.js} +27 -8
  30. package/dist/{pool-2T6TVS2L.js → pool-MAABBHC4.js} +9 -3
  31. package/dist/{snapshot-F5B2DD56.js → snapshot-SU2VGM4C.js} +4 -4
  32. package/dist/snapshot-SU2VGM4C.js.map +1 -0
  33. package/icon.svg +11 -0
  34. package/locale/en.json +6 -0
  35. package/locale/zh.json +6 -0
  36. package/package.json +11 -6
  37. package/dist/chunk-6MVKWICX.js.map +0 -1
  38. package/dist/chunk-6XM6KY7M.js.map +0 -1
  39. package/dist/chunk-AKIJ4LS2.js.map +0 -1
  40. package/dist/chunk-IFRMKVIC.js.map +0 -1
  41. package/dist/chunk-TVX4HV4Y.js.map +0 -1
  42. /package/dist/{chunk-NCPKOWS7.js.map → chunk-AT32XCCI.js.map} +0 -0
  43. /package/dist/{chunk-DC5HMCJC.js.map → chunk-DLOYERAK.js.map} +0 -0
  44. /package/dist/{chunk-544QOJN5.js.map → chunk-ECXYNTEV.js.map} +0 -0
  45. /package/dist/{chunk-DZ7YCFGX.js.map → chunk-KZLVR4J7.js.map} +0 -0
  46. /package/dist/{inbox-OWBK6PE2.js.map → focus-store-RNHBAFYS.js.map} +0 -0
  47. /package/dist/{migrate-TQ5PB2DI.js.map → inbox-ZLX2MH7A.js.map} +0 -0
  48. /package/dist/{orchestrator-P7AEWVYR.js.map → migrate-XFZU5EBE.js.map} +0 -0
  49. /package/dist/{pool-2T6TVS2L.js.map → orchestrator-MNFCPH43.js.map} +0 -0
  50. /package/dist/{snapshot-F5B2DD56.js.map → pool-MAABBHC4.js.map} +0 -0
package/client.js CHANGED
@@ -1,12 +1,11 @@
1
- // dsh-heartbeat client half (M6): settings-page card.
1
+ // dsh-heartbeat client half: native bundle panel (v2.1.0+).
2
2
  //
3
3
  // Contract notes (verified against dsh-vision-router + dsh-client-ui-settings
4
4
  // types on 0.1.1-rc.2; reworked for 0.1.7-rc.2 in v1.7.0):
5
5
  // - the client module is applied as a CLIENT-SIDE cordis plugin; the
6
6
  // ModuleLoader factory must return an object with an "apply" method;
7
- // - the settings page renders entries contributed to the 'settings.section'
8
- // slot; each entry = {name, id, order, label} + a React component (the
9
- // slot survives 0.1.7; the per-namespace settingsScope service does not);
7
+ // - the panel is an entry on 'plugins.bundle.config' (keyed by the bundle
8
+ // short name); the old settings.section card was retired in v2.1.0;
10
9
  // - the rhythm editor rides the /api RPC channel (host persists to
11
10
  // data/settings/ui.json and applies live) — no host settings API needed;
12
11
  // - custom host data flows through an exact Fetch route under /api:
@@ -21,10 +20,84 @@ window.__ModuleLoader__.load({
21
20
 
22
21
  // Locale namespace and dictionary. zh is the source of truth: a host
23
22
  // without @deepseek-ai/dsh-client-locale falls back to it unchanged.
24
- const LOCALE_NS = "heartbeat";
23
+ // ── 原生面板样式(一次注入,类名统一 hb- 前缀)──────────────────
24
+ // 只依赖宿主主题变量 + 半透明叠色,深浅色主题下都不会糊成一团。
25
+ const PANEL_CSS = [
26
+ ".hb-panel{display:flex;flex-direction:column;gap:14px}",
27
+ ".hb-hero{position:relative;overflow:hidden;border-radius:16px;padding:16px 18px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.25));background:linear-gradient(120deg,rgba(51,156,255,.20),rgba(124,92,255,.14) 46%,rgba(51,156,255,0) 82%)}",
28
+ ".hb-hero::after{content:\"\";position:absolute;right:-40px;top:-70px;width:220px;height:220px;border-radius:50%;background:radial-gradient(circle,rgba(51,156,255,.34),transparent 68%);filter:blur(6px);pointer-events:none}",
29
+ ".hb-heroTop{position:relative;display:flex;align-items:center;gap:12px}",
30
+ ".hb-logo{flex:none;width:40px;height:40px;border-radius:13px;display:grid;place-items:center;font-size:19px;line-height:1;background:linear-gradient(135deg,#339CFF,#7C5CFF);box-shadow:0 8px 20px rgba(51,156,255,.38)}",
31
+ ".hb-heroText{display:flex;flex-direction:column;gap:3px;min-width:0}",
32
+ ".hb-heroTitle{font-size:16px;font-weight:700;letter-spacing:.3px;color:var(--dsw-alias-label-primary)}",
33
+ ".hb-heroSub{font-size:11.5px;letter-spacing:.6px;color:var(--dsw-alias-label-tertiary)}",
34
+ ".hb-heroRight{margin-left:auto;display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}",
35
+ // hero 在蓝色渐变上,普通 hb-badgeInfo 的深蓝字对比不足,这里覆盖成白字半透明底
36
+ ".hb-heroRight .hb-badge{background:rgba(255,255,255,.22);color:#fff;border:1px solid rgba(255,255,255,.46)}",
37
+ ".hb-badge{display:inline-flex;align-items:center;gap:6px;height:24px;padding:0 10px;border-radius:999px;font-size:11.5px;font-weight:600;white-space:nowrap}",
38
+ ".hb-badgeOk{background:rgba(61,220,151,.16);color:#2fbf7f}",
39
+ ".hb-badgeInfo{background:rgba(51,156,255,.16);color:#2b8fe8}",
40
+ ".hb-badgeWarn{background:rgba(245,184,61,.20);color:#c98b12}",
41
+ ".hb-badgeOff{background:rgba(140,150,170,.18);color:var(--dsw-alias-label-tertiary)}",
42
+ ".hb-dot{width:7px;height:7px;border-radius:50%;background:currentColor;box-shadow:0 0 8px currentColor}",
43
+ ".hb-tabs{display:flex;flex-wrap:wrap;gap:5px;padding:5px;border-radius:14px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.25));background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.08))}",
44
+ ".hb-tab{height:30px;padding:0 14px;border-radius:10px;border:none;background:transparent;color:var(--dsw-alias-label-secondary);font-size:12.5px;cursor:pointer;transition:background .15s,color .15s,box-shadow .15s}",
45
+ ".hb-tab:hover{background:rgba(51,156,255,.12);color:var(--dsw-alias-label-primary)}",
46
+ ".hb-tabOn,.hb-tabOn:hover{background:linear-gradient(135deg,#339CFF,#6b8bff);color:#fff;font-weight:600;box-shadow:0 5px 16px rgba(51,156,255,.34)}",
47
+ ".hb-body{display:flex;flex-direction:column;gap:12px}",
48
+ ".hb-card{border-radius:14px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.25));background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.06));padding:14px 16px;display:flex;flex-direction:column;gap:10px}",
49
+ ".hb-cardHead{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}",
50
+ ".hb-cardTitle{display:flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;color:var(--dsw-alias-label-primary)}",
51
+ ".hb-cardTitle::before{content:\"\";flex:none;width:3px;height:15px;border-radius:2px;background:linear-gradient(180deg,#339CFF,#7C5CFF)}",
52
+ ".hb-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(158px,1fr));gap:10px}",
53
+ ".hb-tile{border-radius:13px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.22));background:var(--dsw-alias-bg-layer-1,rgba(127,127,127,.04));padding:11px 13px;display:flex;flex-direction:column;gap:5px;transition:transform .16s,border-color .16s,box-shadow .16s}",
54
+ ".hb-tile:hover{transform:translateY(-2px);border-color:rgba(51,156,255,.55);box-shadow:0 8px 22px rgba(0,0,0,.16)}",
55
+ ".hb-tileWide{grid-column:span 2}",
56
+ ".hb-tileLabel{font-size:11px;letter-spacing:.5px;color:var(--dsw-alias-label-tertiary)}",
57
+ ".hb-tileValue{font-size:14.5px;font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary);word-break:break-word}",
58
+ ".hb-tileMono{font-family:ui-monospace,Consolas,monospace;font-size:12.5px;letter-spacing:-.2px}",
59
+ ".hb-tileHint{font-size:11.5px;color:var(--dsw-alias-label-tertiary);word-break:break-word}",
60
+ ".hb-tileAccent{background:linear-gradient(135deg,rgba(51,156,255,.16),rgba(124,92,255,.10))}",
61
+ ".hb-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
62
+ ".hb-hint{font-size:12px;color:var(--dsw-alias-label-tertiary)}",
63
+ ".hb-mono{font-family:ui-monospace,Consolas,monospace;font-size:12px;word-break:break-all}",
64
+ ".hb-btn{height:28px;padding:0 13px;border-radius:9px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.3));background:transparent;color:var(--dsw-alias-label-primary);font-size:12px;cursor:pointer;flex:none;transition:background .15s,border-color .15s,transform .1s}",
65
+ ".hb-btn:hover{border-color:rgba(51,156,255,.6);background:rgba(51,156,255,.10)}",
66
+ ".hb-btn:active{transform:translateY(1px)}",
67
+ ".hb-btnOn{border-color:rgba(51,156,255,.65);background:rgba(51,156,255,.18);color:#2b8fe8;font-weight:600}",
68
+ ".hb-btnPrimary{border:none;background:linear-gradient(135deg,#339CFF,#6b8bff);color:#fff;font-weight:600;box-shadow:0 5px 16px rgba(51,156,255,.32)}",
69
+ ".hb-btnPrimary:hover{background:linear-gradient(135deg,#2f8fe8,#5f7ff0)}",
70
+ ".hb-btnDanger{border:none;background:#e5484d;color:#fff;font-weight:600}",
71
+ ".hb-input{height:28px;border-radius:9px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.3));background:var(--dsw-alias-bg-layer-1,transparent);color:var(--dsw-alias-label-primary);padding:0 9px;font-size:12.5px;outline:none;transition:border-color .15s,box-shadow .15s}",
72
+ ".hb-input:focus{border-color:rgba(51,156,255,.7);box-shadow:0 0 0 3px rgba(51,156,255,.18)}",
73
+ ".hb-chip{display:inline-flex;align-items:center;height:20px;padding:0 7px;border-radius:6px;font-size:11px;background:rgba(127,127,127,.16);color:var(--dsw-alias-label-secondary)}",
74
+ ".hb-divider{height:1px;background:var(--dsw-alias-border-l2,rgba(127,127,127,.2));margin:2px 0}",
75
+ ".hb-list{display:flex;flex-direction:column;gap:7px}",
76
+ ".hb-item{border-radius:10px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.2));padding:8px 10px;display:flex;flex-direction:column;gap:5px;font-size:12px;transition:border-color .15s}",
77
+ ".hb-item:hover{border-color:rgba(51,156,255,.45)}",
78
+ ".hb-itemHead{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
79
+ ".hb-bar{height:8px;border-radius:999px;overflow:hidden;background:rgba(127,127,127,.22)}",
80
+ ".hb-barFill{height:100%;border-radius:999px;background:linear-gradient(90deg,#339CFF,#7C5CFF);transition:width .3s}",
81
+ ".hb-barFillWarn{background:linear-gradient(90deg,#f5b83d,#e5484d)}",
82
+ ".hb-err{font-size:12px;color:#e5484d;border:1px solid rgba(229,72,77,.5);border-radius:9px;padding:6px 10px;word-break:break-all;background:rgba(229,72,77,.08)}",
83
+ ".hb-ok{font-size:12px;color:#2fbf7f;border:1px solid rgba(61,220,151,.5);border-radius:9px;padding:6px 10px;word-break:break-all;background:rgba(61,220,151,.08)}",
84
+ ".hb-scroll{max-height:340px;overflow-y:auto;padding:2px}",
85
+ ".hb-pre{margin:0;font-family:ui-monospace,Consolas,monospace;font-size:11px;line-height:1.6;white-space:pre-wrap;word-break:break-word;max-height:320px;overflow:auto;border-radius:9px;padding:8px 10px;background:rgba(127,127,127,.10)}",
86
+ ].join("");
87
+ function ensurePanelStyle() {
88
+ try {
89
+ if (typeof document === "undefined" || !document.head) return;
90
+ if (document.getElementById("dsh-heartbeat-style")) return;
91
+ const tag = document.createElement("style");
92
+ tag.id = "dsh-heartbeat-style";
93
+ tag.textContent = PANEL_CSS;
94
+ document.head.appendChild(tag);
95
+ } catch { /* 非 DOM 环境(冒烟测试)忽略 */ }
96
+ }
97
+
98
+ const LOCALE_NS = "heartbeat";
25
99
  const DICT = {
26
100
  zh: {
27
- "settings.row.label": "心跳",
28
101
  "common.loading": "加载中…",
29
102
  "common.loadFailed": "加载失败:{error}",
30
103
  "common.confirmDelete": "确认删除",
@@ -58,6 +131,12 @@ window.__ModuleLoader__.load({
58
131
  "status.statusbarOff": "{status}(状态栏已关闭)",
59
132
  "status.timeInject": "时间注入:",
60
133
  "status.timeInjectOff": "已关闭",
134
+ "status.lastBeatShort": "上次心跳",
135
+ "status.resultShort": "上次结果",
136
+ "status.versionShort": "插件版本",
137
+ "status.todaySimple": "今日表达",
138
+ "status.timeInjectShort": "时间注入",
139
+ "status.currentShort": "此刻动态",
61
140
  "status.timeInjectEvery": "每 {interval} 分钟,最近 {last}",
62
141
  "status.never": "未发生过",
63
142
  "scene.quietHours": "静默时段,世界睡了",
@@ -146,6 +225,13 @@ window.__ModuleLoader__.load({
146
225
  "config.psy": "psy 分区",
147
226
  "config.psyHint": "允许画像记录 psy 分区(警告,开启后模型会主动猜测用户心理并计入用户画像,关闭时画像内容计入内容较少)",
148
227
  "config.saveHint": "全部参数保存后即时生效,无需重启",
228
+ "config.focus": "专注模式",
229
+ "config.focusHint": "暂停期间不心跳、不计每日条数、不耗 token,到点自动恢复",
230
+ "config.focusPause": "暂停",
231
+ "config.focusResume": "恢复",
232
+ "config.focusPaused": "已暂停至 {clock}",
233
+ "config.focusMinutes": "分钟",
234
+ "config.focusFailed": "操作失败:{error}",
149
235
  "weekly.intro": "每 7 天生成一份:本周表达与静默、新认识、账本、素材池与活跃高峰。报告只陈述事实,由后台「心跳」署名。",
150
236
  "weekly.empty": "(还没有周报——装好一周后自动出第一期)",
151
237
  "migrate.processing": "处理中…",
@@ -181,9 +267,18 @@ window.__ModuleLoader__.load({
181
267
  "excerpt.failed": "失败:{error}",
182
268
  "excerpt.open": "一键打开摘抄本",
183
269
  "excerpt.hint": "留句子和小事的地方:只增不减,直接手编也不会被覆盖",
270
+ "panel.title": "心跳",
271
+ "panel.subtitle": "dsh-heartbeat",
272
+ "panel.badgeNative": "原生面板",
273
+ "panel.tab.status": "状态",
274
+ "panel.tab.sessions": "会话",
275
+ "panel.tab.seeds": "素材",
276
+ "panel.tab.interests": "兴趣",
277
+ "panel.tab.profile": "画像",
278
+ "panel.tab.weekly": "周报",
279
+ "panel.tab.config": "设置",
184
280
  },
185
281
  en: {
186
- "settings.row.label": "Heartbeat",
187
282
  "common.loading": "Loading…",
188
283
  "common.loadFailed": "Failed to load: {error}",
189
284
  "common.confirmDelete": "Confirm delete",
@@ -217,6 +312,12 @@ window.__ModuleLoader__.load({
217
312
  "status.statusbarOff": "{status} (status bar off)",
218
313
  "status.timeInject": "Time injection:",
219
314
  "status.timeInjectOff": "Off",
315
+ "status.lastBeatShort": "Last beat",
316
+ "status.resultShort": "Last result",
317
+ "status.versionShort": "Version",
318
+ "status.todaySimple": "Spoken today",
319
+ "status.timeInjectShort": "Time injection",
320
+ "status.currentShort": "Right now",
220
321
  "status.timeInjectEvery": "Every {interval} min, last {last}",
221
322
  "status.never": "never",
222
323
  "scene.quietHours": "Quiet hours — the world is asleep",
@@ -305,6 +406,13 @@ window.__ModuleLoader__.load({
305
406
  "config.psy": "Psychology partition",
306
407
  "config.psyHint": "Allow the profile to record the psychology partition (warning: when enabled, the model will guess your psychology and add it to your profile; when disabled, the profile contains less content)",
307
408
  "config.saveHint": "All settings take effect immediately after saving, no restart needed",
409
+ "config.focus": "Focus mode",
410
+ "config.focusHint": "While paused: no beats, no daily count, no tokens; resumes automatically at the lift time",
411
+ "config.focusPause": "Pause",
412
+ "config.focusResume": "Resume",
413
+ "config.focusPaused": "Paused until {clock}",
414
+ "config.focusMinutes": "min",
415
+ "config.focusFailed": "Failed: {error}",
308
416
  "weekly.intro": "Generated every 7 days: this week's expressions and silences, new acquaintances, ledger, material pool, and activity peaks. The report states facts only and is signed by the background Heartbeat.",
309
417
  "weekly.empty": "(No weekly report yet — the first one appears a week after installation)",
310
418
  "migrate.processing": "Working…",
@@ -340,6 +448,16 @@ window.__ModuleLoader__.load({
340
448
  "excerpt.failed": "Failed: {error}",
341
449
  "excerpt.open": "Open the excerpt book",
342
450
  "excerpt.hint": "A place for sentences and small things: it only grows, and hand edits are never overwritten",
451
+ "panel.title": "Heartbeat",
452
+ "panel.subtitle": "dsh-heartbeat",
453
+ "panel.badgeNative": "Native panel",
454
+ "panel.tab.status": "Status",
455
+ "panel.tab.sessions": "Sessions",
456
+ "panel.tab.seeds": "Material",
457
+ "panel.tab.interests": "Interests",
458
+ "panel.tab.profile": "Profile",
459
+ "panel.tab.weekly": "Weekly",
460
+ "panel.tab.config": "Settings",
343
461
  },
344
462
  };
345
463
  const fill = (text, params) => String(text).replace(/\{(\w+)\}/g, (match, key) => (params && key in params ? String(params[key]) : match));
@@ -353,14 +471,22 @@ window.__ModuleLoader__.load({
353
471
 
354
472
  const rowStyle = { display: "flex", alignItems: "center", gap: 8, margin: "6px 0" };
355
473
  const labelStyle = { minWidth: 140, fontSize: 13, color: "var(--dsw-alias-label-secondary)", flex: "none" };
356
- const inputStyle = { width: 90, height: 28, borderRadius: 8, border: "1px solid var(--dsw-alias-border-l2)", background: "var(--dsw-specific-input-bg, transparent)", color: "var(--dsw-alias-label-primary)", padding: "0 8px", fontSize: 13 };
357
- const buttonStyle = { height: 26, padding: "0 12px", borderRadius: 8, border: "none", background: "#339CFF", color: "#fff", fontSize: 12, cursor: "pointer", flex: "none" };
358
- const buttonGhost = { ...buttonStyle, background: "var(--dsw-alias-interactive-bg-hover, #444)", color: "var(--dsw-alias-label-primary)" };
359
- const hintStyle = { fontSize: 12, color: "var(--dsw-alias-label-tertiary)", margin: "4px 0" };
360
- const sectionStyle = { borderTop: "1px solid var(--dsw-alias-border-l2)", marginTop: 10, paddingTop: 6 };
361
- const summaryStyle = { fontSize: 13, fontWeight: 600, color: "var(--dsw-alias-label-primary)", cursor: "pointer" };
362
- const listStyle = { listStyle: "none", margin: "4px 0", padding: 0, fontSize: 12, color: "var(--dsw-alias-label-secondary)" };
363
- const rowList = { display: "flex", alignItems: "center", gap: 8, padding: "3px 0" };
474
+ const inputStyle = { width: 90, height: 30, borderRadius: 9, border: "1px solid var(--dsw-alias-border-l2)", background: "var(--dsw-specific-input-bg, rgba(127,127,127,.08))", color: "var(--dsw-alias-label-primary)", padding: "0 10px", fontSize: 12.5, outline: "none" };
475
+ const buttonStyle = { height: 28, padding: "0 14px", borderRadius: 9, border: "none", background: "linear-gradient(135deg, #339CFF, #5b8cff)", color: "#fff", fontSize: 12, fontWeight: 600, cursor: "pointer", flex: "none", boxShadow: "0 4px 14px rgba(51,156,255,.26)" };
476
+ const buttonGhost = { ...buttonStyle, background: "rgba(127,127,127,.14)", color: "var(--dsw-alias-label-primary)", border: "1px solid var(--dsw-alias-border-l2)", boxShadow: "none" };
477
+ const hintStyle = { fontSize: 12, lineHeight: 1.6, color: "var(--dsw-alias-label-tertiary)", margin: "5px 0" };
478
+
479
+ const summaryStyle = { fontSize: 13, fontWeight: 600, color: "var(--dsw-alias-label-primary)", cursor: "pointer", padding: "6px 0" };
480
+ const listStyle = { listStyle: "none", margin: "4px 0", padding: 0, fontSize: 12.5, color: "var(--dsw-alias-label-secondary)", display: "flex", flexDirection: "column", gap: 6 };
481
+ const rowList = { display: "flex", alignItems: "center", gap: 10, padding: "5px 0" };
482
+ const panelBox = { padding: "2px 0" };
483
+ const panelHead = { display: "flex", alignItems: "baseline", justifyContent: "space-between", margin: "2px 0 8px" };
484
+ const panelTitle = { fontSize: 15, fontWeight: 600, color: "var(--dsw-alias-label-primary)" };
485
+ const panelSub = { fontSize: 12, color: "var(--dsw-alias-label-tertiary)" };
486
+ const panelTabs = { display: "flex", flexWrap: "wrap", gap: 6, margin: "0 0 8px", borderBottom: "1px solid var(--dsw-alias-border-l2)", paddingBottom: 8 };
487
+ const panelTab = { height: 27, padding: "0 13px", borderRadius: 9, border: "1px solid var(--dsw-alias-border-l2)", background: "transparent", color: "var(--dsw-alias-label-secondary)", fontSize: 12, cursor: "pointer" };
488
+ const panelTabOn = { ...panelTab, background: "#339CFF", borderColor: "#339CFF", color: "#fff" };
489
+ const blockHead = { fontSize: 13, fontWeight: 600, color: "var(--dsw-alias-label-primary)", margin: "14px 0 6px", paddingLeft: 9, borderLeft: "3px solid #339CFF" };
364
490
 
365
491
  function apply(ctx) {
366
492
  // settingsScope was removed in DSH 0.1.7 — never bound here again.
@@ -387,26 +513,9 @@ window.__ModuleLoader__.load({
387
513
  }
388
514
  return result.value;
389
515
  };
390
- // 会话名来自 client 自己的会话存储(侧边栏同名数据源);拿不到则回退 id。
391
- const sessionName = (id) => {
392
- try {
393
- const list = typeof ctx.sessions?.list === "function" ? ctx.sessions.list() : undefined;
394
- const hit = Array.isArray(list) ? list.find((s) => s && (s.id === id || s.sessionId === id)) : undefined;
395
- const name = hit && (hit.title || hit.name || hit.displayName);
396
- return name ? String(name) : null;
397
- } catch { return null; }
398
- };
399
516
 
400
517
  // ── 通用小组件 ────────────────────────────────────────────────
401
- function Section(props) {
402
- const [open, setOpen] = React.useState(props.open === true);
403
- return React.createElement(
404
- "details",
405
- { open, style: sectionStyle, onToggle: (e) => setOpen(e.target.open) },
406
- React.createElement("summary", { style: summaryStyle }, props.title),
407
- open ? React.createElement("div", { style: { paddingTop: 4 } }, props.children) : null,
408
- );
409
- }
518
+
410
519
  function useAsync(fetcher, deps) {
411
520
  const [state, setState] = React.useState({ loading: true, error: null, value: null });
412
521
  React.useEffect(() => {
@@ -420,8 +529,23 @@ window.__ModuleLoader__.load({
420
529
  }, deps || []);
421
530
  return state;
422
531
  }
532
+ // 时间格式跟随界面语言:宿主 locale 服务的快照带 active('zh' | 'en'),
533
+ // zh 映射成 zh-CN,其余直接当 BCP 47 用。取不到就退回 zh-CN——和旧行为一致,
534
+ // 不会因为宿主版本差异把时间显示成空。
535
+ const localeTag = () => {
536
+ try {
537
+ const snap = localeSvc && typeof localeSvc.getLocale === "function" ? localeSvc.getLocale() : null;
538
+ const active = snap && snap.active;
539
+ if (!active) return "zh-CN";
540
+ return active === "zh" ? "zh-CN" : String(active);
541
+ } catch { return "zh-CN"; }
542
+ };
423
543
  const fmtTime = (iso) => {
424
- try { return new Date(iso).toLocaleString("zh-CN", { hour12: false }); } catch { return String(iso); }
544
+ try {
545
+ const d = new Date(iso);
546
+ if (Number.isNaN(d.getTime())) return String(iso);
547
+ return d.toLocaleString(localeTag(), { hour12: false });
548
+ } catch { return String(iso); }
425
549
  };
426
550
 
427
551
  // ── 心跳状态卡片 ──────────────────────────────────────────────
@@ -457,18 +581,48 @@ window.__ModuleLoader__.load({
457
581
  ? L("status.currentWithNote", { scene: sceneLabel, note: sb.lastStatus.note })
458
582
  : L("status.current", { scene: sceneLabel }))
459
583
  : t("status.currentEmpty");
584
+ const usedNum = (view.cap && Number(view.cap.used)) || 0;
585
+ const maxNum = (view.cap && Number(view.cap.max)) || 0;
586
+ const ratio = maxNum > 0 ? Math.min(1, usedNum / maxNum) : 0;
587
+ const tile = (label, value, hint, extra) => React.createElement(
588
+ "div",
589
+ { className: "hb-tile" + (extra ? " " + extra : "") },
590
+ React.createElement("span", { className: "hb-tileLabel" }, label),
591
+ React.createElement("span", { className: "hb-tileValue" }, value),
592
+ hint ? React.createElement("span", { className: "hb-tileHint" }, hint) : null,
593
+ );
594
+ const mood = view.quiet
595
+ ? { cls: "hb-badgeOff", text: t("status.quiet") }
596
+ : { cls: "hb-badgeOk", text: L("status.rhythm", { interval: view.intervalMin }) };
597
+ const timeInjectText = sb.timeInjectMin === 0 ? t("status.timeInjectOff")
598
+ : L("status.timeInjectEvery", { interval: sb.timeInjectMin, last: sb.lastTimeInjectAt ? fmtTime(sb.lastTimeInjectAt) : t("status.never") });
599
+ const barClass = ratio >= 1 ? "hb-barFill hb-barFillWarn" : "hb-barFill";
460
600
  return React.createElement(
461
601
  "div",
462
- { style: listStyle },
463
- React.createElement("div", null, L("status.version", { version: view.version || t("common.unknown") })),
464
- React.createElement("div", null, t("status.lastBeat"), fmtTime(lb.at)),
465
- React.createElement("div", null, t("status.result"), verdictText),
466
- React.createElement("div", null, L("status.today", { used: view.cap.used, max: view.cap.max })),
467
- React.createElement("div", null, view.quiet ? t("status.quiet") : L("status.rhythm", { interval: view.intervalMin })),
468
- React.createElement("div", null, sb.enabled === false ? L("status.statusbarOff", { status: statusText }) : statusText),
469
- React.createElement("div", { style: hintStyle },
470
- t("status.timeInject"), sb.timeInjectMin === 0 ? t("status.timeInjectOff")
471
- : L("status.timeInjectEvery", { interval: sb.timeInjectMin, last: sb.lastTimeInjectAt ? fmtTime(sb.lastTimeInjectAt) : t("status.never") })),
602
+ { className: "hb-body" },
603
+ React.createElement(
604
+ "div",
605
+ { className: "hb-card" },
606
+ React.createElement("div", { className: "hb-cardHead" },
607
+ React.createElement("span", { className: "hb-cardTitle" }, t("section.status")),
608
+ React.createElement("span", { className: "hb-badge " + mood.cls },
609
+ React.createElement("i", { className: "hb-dot" }),
610
+ mood.text)),
611
+ React.createElement("div", { className: "hb-grid" },
612
+ tile(t("status.lastBeatShort"), lb.at ? fmtTime(lb.at) : t("common.unknown")),
613
+ tile(t("status.versionShort"), "v" + (view.version || t("common.unknown"))),
614
+ React.createElement("div", { className: "hb-tile" },
615
+ React.createElement("span", { className: "hb-tileLabel" }, t("status.todaySimple")),
616
+ React.createElement("span", { className: "hb-tileValue" }, usedNum + " / " + maxNum),
617
+ React.createElement("div", { className: "hb-bar" },
618
+ React.createElement("div", { className: barClass, style: { width: Math.round(ratio * 100) + "%" } }))),
619
+ tile(t("status.timeInjectShort"), timeInjectText),
620
+ tile(t("status.resultShort"), verdictText, null, "hb-tileWide"),
621
+ tile(t("status.currentShort"),
622
+ sb.enabled === false ? L("status.statusbarOff", { status: statusText }) : statusText,
623
+ null, "hb-tileWide hb-tileAccent"),
624
+ ),
625
+ ),
472
626
  );
473
627
  }
474
628
 
@@ -508,6 +662,7 @@ window.__ModuleLoader__.load({
508
662
  return React.createElement(
509
663
  "div",
510
664
  null,
665
+ React.createElement("div", { style: blockHead }, t("section.sessions")),
511
666
  React.createElement("div", { style: hintStyle }, t("sessions.hint")),
512
667
  bound.map((s) => React.createElement("div", { key: s.id, style: rowList },
513
668
  React.createElement("span", { style: { flex: 1, fontSize: 12 } },
@@ -543,10 +698,19 @@ window.__ModuleLoader__.load({
543
698
  // ── 素材池(v1.9.3 三版):话题 / 聊天 × 活跃 / 归档,四个按钮各看一类 ──
544
699
  // 和画像分区同一套 tab 交互,风格统一;一次只看一类。
545
700
  function SeedsSection() {
701
+ // 面板版新增文案(不改 DICT,仅本函数使用)
702
+ const TXT = {
703
+ filterPlaceholder: "关键字过滤(匹配 文本 / 标签 / 来源)",
704
+ filterClear: "清除",
705
+ filterNoMatch: "没有匹配关键字的条目,换个词试试",
706
+ filterHint: (n) => "过滤后剩 " + n + " 条",
707
+ used: (n) => "已用 " + n + " 次",
708
+ };
546
709
  const [data, setData] = React.useState(null);
547
710
  const [error, setError] = React.useState(null);
548
711
  const [tab, setTab] = React.useState("topic");
549
712
  const [confirmId, setConfirmId] = React.useState(null);
713
+ const [filter, setFilter] = React.useState("");
550
714
  const reload = React.useCallback(() => {
551
715
  rpc("seeds.list").then(setData, (e) => setError(String(e).slice(0, 100)));
552
716
  }, []);
@@ -554,15 +718,28 @@ window.__ModuleLoader__.load({
554
718
  if (error) return React.createElement("div", { style: hintStyle }, L("common.loadFailed", { error }));
555
719
  if (!data) return React.createElement("div", { style: hintStyle }, t("common.loading"));
556
720
  const act = (endpoint, id) => rpc(endpoint, { id }).then(reload, (e) => setError(String(e).slice(0, 100)));
557
- const row = (s, archived) => React.createElement("div", { key: s.id, style: rowList },
558
- React.createElement("span", { style: { flex: 1, fontSize: 12, wordBreak: "break-word" } },
559
- "[", s.tag, "/", s.source, "] ", s.text.slice(0, 60), L("seeds.used", { used: s.used })),
560
- archived
561
- ? React.createElement("button", { style: buttonGhost, onClick: () => act("seeds.restore", s.id) }, t("seeds.restore"))
562
- : React.createElement("button", { style: buttonGhost, onClick: () => act("seeds.archive", s.id) }, t("seeds.archive")),
563
- confirmId === s.id
564
- ? React.createElement("button", { style: { ...buttonStyle, background: "#e5484d" }, onClick: () => { setConfirmId(null); act("seeds.delete", s.id); } }, t("common.confirmDelete"))
565
- : React.createElement("button", { style: buttonGhost, onClick: () => setConfirmId(s.id) }, t("common.delete")),
721
+ // 两栏行:左侧标签行(tag/source 徽标 + 使用次数)+ 截断正文,
722
+ // 右侧操作按钮组;鼠标悬停正文可通过 title 看全文。
723
+ const seedRow = { ...rowList, alignItems: "flex-start", padding: "5px 0", borderBottom: "1px solid var(--dsw-alias-border-l2)" };
724
+ const chip = { flex: "none", fontSize: 11, lineHeight: "18px", padding: "0 6px", borderRadius: 6, background: "var(--dsw-alias-interactive-bg-hover, #444)", color: "var(--dsw-alias-label-secondary)" };
725
+ const row = (s, archived) => React.createElement("div", { key: s.id, style: seedRow },
726
+ React.createElement("div", { style: { flex: 1, minWidth: 0 } },
727
+ React.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap", marginBottom: 2 } },
728
+ React.createElement("span", { style: chip }, String(s.tag)),
729
+ React.createElement("span", { style: chip }, String(s.source)),
730
+ React.createElement("span", { style: hintStyle }, TXT.used(s.used || 0)),
731
+ ),
732
+ React.createElement("div", { style: { fontSize: 12.5, wordBreak: "break-word", color: "var(--dsw-alias-label-secondary)" }, title: s.text },
733
+ String(s.text || "").length > 80 ? String(s.text).slice(0, 80) + "…" : String(s.text || "")),
734
+ ),
735
+ React.createElement("span", { style: { display: "flex", gap: 4, flex: "none", paddingTop: 2 } },
736
+ archived
737
+ ? React.createElement("button", { style: buttonGhost, onClick: () => act("seeds.restore", s.id) }, t("seeds.restore"))
738
+ : React.createElement("button", { style: buttonGhost, onClick: () => act("seeds.archive", s.id) }, t("seeds.archive")),
739
+ confirmId === s.id
740
+ ? React.createElement("button", { style: { ...buttonStyle, background: "#e5484d" }, onClick: () => { setConfirmId(null); act("seeds.delete", s.id); } }, t("common.confirmDelete"))
741
+ : React.createElement("button", { style: buttonGhost, onClick: () => setConfirmId(s.id) }, t("common.delete")),
742
+ ),
566
743
  );
567
744
  const isChat = (s) => (s.category || "topic") === "chat";
568
745
  const topics = data.active.filter((s) => !isChat(s));
@@ -571,16 +748,29 @@ window.__ModuleLoader__.load({
571
748
  const arcChats = data.archived.filter(isChat);
572
749
  const archived = tab.indexOf("arc") === 0;
573
750
  const chat = tab.indexOf("chat") >= 0;
574
- const list = archived ? (chat ? arcChats : arcTopics) : (chat ? chats : topics);
751
+ const fullList = archived ? (chat ? arcChats : arcTopics) : (chat ? chats : topics);
752
+ // 本地关键字过滤:匹配 text / tag / source,大小写不敏感,不发请求
753
+ const kw = filter.trim().toLowerCase();
754
+ const hit = (s) => !kw
755
+ || String(s.text || "").toLowerCase().indexOf(kw) >= 0
756
+ || String(s.tag || "").toLowerCase().indexOf(kw) >= 0
757
+ || String(s.source || "").toLowerCase().indexOf(kw) >= 0;
758
+ const list = fullList.filter(hit);
575
759
  const tabButton = (key, label, count) => React.createElement("button", {
576
760
  key,
577
761
  style: tab === key ? buttonStyle : buttonGhost,
578
762
  onClick: () => setTab(key),
579
763
  }, L("common.labelWithCount", { label, count }));
764
+ // 空态二分:分类本身为空 vs 有关键字过滤后无结果,文案分开
765
+ const categoryEmpty = fullList.length === 0;
580
766
  return React.createElement(
581
767
  "div",
582
768
  null,
583
769
  React.createElement("div", { style: hintStyle }, L("seeds.activeSummary", { active: data.active.length, cap: data.cap, archived: data.archived.length })),
770
+ React.createElement("div", { style: rowStyle },
771
+ React.createElement("input", { style: { ...inputStyle, width: "100%", boxSizing: "border-box" }, placeholder: TXT.filterPlaceholder, value: filter, onChange: (e) => setFilter(e.target.value) }),
772
+ kw ? React.createElement("button", { style: buttonGhost, onClick: () => setFilter("") }, TXT.filterClear) : null,
773
+ ),
584
774
  React.createElement("div", { style: tabRow },
585
775
  tabButton("topic", t("seeds.tabTopic"), topics.length),
586
776
  tabButton("chat", t("seeds.tabChat"), chats.length),
@@ -590,8 +780,13 @@ window.__ModuleLoader__.load({
590
780
  ? (chat ? t("seeds.hintArchivedChat") : t("seeds.hintArchivedTopic"))
591
781
  : (chat ? t("seeds.hintChat") : t("seeds.hintTopic"))),
592
782
  list.length === 0
593
- ? React.createElement("div", { style: hintStyle }, archived ? t("seeds.emptyArchived") : t("seeds.empty"))
594
- : React.createElement("div", { style: scrollBox }, list.map((s) => row(s, archived))),
783
+ ? React.createElement("div", { style: hintStyle },
784
+ categoryEmpty
785
+ ? (archived ? t("seeds.emptyArchived") : t("seeds.empty"))
786
+ : TXT.filterNoMatch)
787
+ : React.createElement("div", { style: scrollBox },
788
+ kw ? React.createElement("div", { style: { ...hintStyle, padding: "2px 0" } }, TXT.filterHint(list.length)) : null,
789
+ list.map((s) => row(s, archived))),
595
790
  );
596
791
  }
597
792
 
@@ -599,6 +794,12 @@ window.__ModuleLoader__.load({
599
794
  // 首编继承出厂:第一次增删/存时段时,插件自动把出厂 interests.json
600
795
  // 完整复制进 data/settings/interests.json,之后卡片就是唯一入口。
601
796
  function InterestsSection() {
797
+ // 面板版新增文案(不改 DICT,仅本函数使用)
798
+ const TXT = {
799
+ stats: (n, m) => "当前兴趣 " + n + " 条 · 浏览时段 " + m + " 个",
800
+ // 如实说明:rpc 没有返回「出厂默认 / 已改过」标记字段,只能显示当前生效条数
801
+ statsNote: "面板暂无法区分出厂默认与已改过(接口未返回该标记),以上为当前生效条数",
802
+ };
602
803
  const [data, setData] = React.useState(null);
603
804
  const [error, setError] = React.useState(null);
604
805
  const [status, setStatus] = React.useState("");
@@ -615,6 +816,7 @@ window.__ModuleLoader__.load({
615
816
  if (error) return React.createElement("div", { style: hintStyle }, L("common.loadFailed", { error }));
616
817
  if (!data) return React.createElement("div", { style: hintStyle }, t("common.loading"));
617
818
  const interests = data.interests || [];
819
+ const windowsCount = (data._schedule?.windows || []).length;
618
820
  const doAdd = () => {
619
821
  const text = draft.trim();
620
822
  if (!text) return;
@@ -637,6 +839,9 @@ window.__ModuleLoader__.load({
637
839
  return React.createElement(
638
840
  "div",
639
841
  null,
842
+ React.createElement("div", { style: { ...hintStyle, fontWeight: 600, color: "var(--dsw-alias-label-secondary)" } },
843
+ TXT.stats(interests.length, windowsCount)),
844
+ React.createElement("div", { style: hintStyle }, TXT.statsNote),
640
845
  React.createElement("div", { style: hintStyle }, t("interests.hint")),
641
846
  interests.map((item) => React.createElement("div", { key: item, style: rowList },
642
847
  React.createElement("span", { style: { flex: 1, fontSize: 12 } }, item),
@@ -664,9 +869,7 @@ window.__ModuleLoader__.load({
664
869
  );
665
870
  }
666
871
 
667
- // ── 画像入口(v2.0):四个分区 + 引擎室输入 ─────────────────────
668
- // 一次只看一个分区,条目一条一块、正文自动换行;另给一个只读的
669
- // 「引擎室输入」视图,直接回答「截断后引擎室到底看到了什么」。
872
+ // ── 画像入口共享常量(仅 ProfileSection 使用)────────────────────
670
873
  const PARTITIONS = [
671
874
  { key: "interest", labelKey: "profile.tabInterest" },
672
875
  { key: "projects", labelKey: "profile.tabProjects" },
@@ -676,16 +879,24 @@ window.__ModuleLoader__.load({
676
879
  const entryBox = { borderLeft: "2px solid var(--dsw-alias-border-l2)", paddingLeft: 8, margin: "6px 0" };
677
880
  // v1.9.3:分区条目一多就顶到屏幕外,给个固定高度的滚动区。
678
881
  const scrollBox = { maxHeight: 320, overflowY: "auto", padding: "4px 6px", border: "1px solid var(--dsw-alias-border-l2)", borderRadius: 6 };
679
- const groupHead = { fontSize: 12.5, fontWeight: 600, margin: "10px 0 2px" };
882
+
680
883
  const entryHead = { fontSize: 12, color: "var(--dsw-alias-label-tertiary)", marginBottom: 2, wordBreak: "break-word" };
681
884
  const entryBody = { fontSize: 12.5, lineHeight: 1.65, whiteSpace: "pre-wrap", wordBreak: "break-word", color: "var(--dsw-alias-label-secondary)", margin: "2px 0" };
682
885
  const tabRow = { display: "flex", flexWrap: "wrap", gap: 6, margin: "6px 0" };
886
+
887
+ // ── 画像入口(v2.0 → v2.1.0 面板版):四个分区 + 引擎室输入 ─────
888
+ // 一次只看一个分区,条目一条一块、正文自动换行;另给一个只读的
889
+ // 「引擎室输入」视图。新增:单条正文过长(约超 4 行)时默认收起,
890
+ // 点「展开全文」看全文;刷新 / 导出按钮保留。
683
891
  function ProfileSection() {
892
+ // 面板版新增文案(不改 DICT,仅本函数使用)
893
+ const TXT = { expand: "展开全文", collapse: "收起" };
684
894
  const [data, setData] = React.useState(null);
685
895
  const [digest, setDigest] = React.useState(null);
686
896
  const [tab, setTab] = React.useState("interest");
687
897
  const [error, setError] = React.useState(null);
688
898
  const [status, setStatus] = React.useState("");
899
+ const [expanded, setExpanded] = React.useState({});
689
900
  const load = React.useCallback(() => {
690
901
  rpc("profile.partitions").then(setData, (e) => setError(String(e).slice(0, 120)));
691
902
  rpc("profile.digest").then(setDigest, () => { /* 引擎室输入是附加视图,失败不挡分区 */ });
@@ -705,6 +916,30 @@ window.__ModuleLoader__.load({
705
916
  style: tab === key ? buttonStyle : buttonGhost,
706
917
  onClick: () => setTab(key),
707
918
  }, count === undefined ? label : L("common.labelWithCount", { label, count }));
919
+ // 单条折叠:超过约 4 行(>160 字符或 >4 个换行)才给折叠按钮;
920
+ // 展开状态按条目 key 记在组件 state,切换 tab / 刷新后回到收起态。
921
+ const isLong = (str) => { const s = String(str || ""); return s.length > 160 || s.split("\n").length > 4; };
922
+ const bodyStyle = (open) => open ? entryBody : {
923
+ ...entryBody, display: "-webkit-box", WebkitLineClamp: 4, WebkitBoxOrient: "vertical", overflow: "hidden",
924
+ };
925
+ const entryKey = (e) => e.id || (String(e.topic) + String(e.content).slice(0, 12));
926
+ const entryView = (e) => {
927
+ const key = entryKey(e);
928
+ const open = expanded[key] === true;
929
+ return React.createElement("div", { key, style: entryBox },
930
+ React.createElement("div", { style: entryHead },
931
+ (e.topic || "") + "/" + (e.subTopic || "")
932
+ + L("profile.conf", { value: Number(e.confidence || 0).toFixed(2) })
933
+ + (e.temporal ? L("profile.temporal", { value: e.temporal }) : "")
934
+ + (e.lowActivity ? t("profile.stale") : "")
935
+ + (e.updatedAt ? L("profile.updated", { date: String(e.updatedAt).slice(0, 10) }) : "")),
936
+ React.createElement("div", { style: bodyStyle(open) }, e.content || ""),
937
+ isLong(e.content) ? React.createElement("button", {
938
+ style: { ...buttonGhost, height: 20, fontSize: 11, padding: "0 8px", marginTop: 2 },
939
+ onClick: () => setExpanded((m) => ({ ...m, [key]: !open })),
940
+ }, open ? TXT.collapse : TXT.expand) : null,
941
+ );
942
+ };
708
943
  const om = (digest && digest.omitted) || { tact: 0, topic: 0, wander: 0 };
709
944
  return React.createElement(
710
945
  "div",
@@ -731,14 +966,7 @@ window.__ModuleLoader__.load({
731
966
  React.createElement("div", { style: hintStyle }, L("profile.valid", { valid: group.valid, historical: group.total - group.valid })),
732
967
  entries.length === 0
733
968
  ? React.createElement("div", { style: hintStyle }, t("profile.emptyPartition"))
734
- : React.createElement("div", { style: scrollBox }, entries.map((e) => React.createElement("div", { key: e.id || (String(e.topic) + String(e.content).slice(0, 12)), style: entryBox },
735
- React.createElement("div", { style: entryHead },
736
- (e.topic || "") + "/" + (e.subTopic || "")
737
- + L("profile.conf", { value: Number(e.confidence || 0).toFixed(2) })
738
- + (e.temporal ? L("profile.temporal", { value: e.temporal }) : "")
739
- + (e.lowActivity ? t("profile.stale") : "")
740
- + (e.updatedAt ? L("profile.updated", { date: String(e.updatedAt).slice(0, 10) }) : "")),
741
- React.createElement("div", { style: entryBody }, e.content || ""))))),
969
+ : React.createElement("div", { style: scrollBox }, entries.map((e) => entryView(e)))),
742
970
  React.createElement("div", { style: rowStyle },
743
971
  React.createElement("button", { style: buttonGhost, onClick: () => { load(); } }, t("common.refresh")),
744
972
  React.createElement("button", { style: buttonGhost, onClick: () => { void doExport(); } }, t("profile.exportMarkdown"))),
@@ -772,6 +1000,45 @@ window.__ModuleLoader__.load({
772
1000
  const [draftPsy, setDraftPsy] = React.useState(psyEnabled);
773
1001
  const [status, setStatus] = React.useState("");
774
1002
  React.useEffect(() => { setDraftInterval(interval); setDraftCap(cap); setDraftTimeInject(timeInject); setDraftStatusbar(statusbar); setDraftIdle(idleMode); setDraftTokenSaver(tokenSaver); setDraftPsy(psyEnabled); }, [interval, cap, timeInject, statusbar, idleMode, tokenSaver, psyEnabled]);
1003
+ // v2.1.0 面板改造:分组小节文案(局部常量,不进 DICT,暂只做中文)。
1004
+ const GROUP_RHYTHM = "节律";
1005
+ const GROUP_RHYTHM_DESC = "心跳多久跳一次、一天最多说几条。";
1006
+ const GROUP_TIME = "时间与状态栏";
1007
+ const GROUP_TIME_DESC = "给日常会话注入精确时间、在会话里挂一条心跳状态。";
1008
+ const GROUP_EXPRESS = "表达";
1009
+ const GROUP_EXPRESS_DESC = "心跳说话的方式与开销。";
1010
+ const GROUP_FOCUS = "专注模式";
1011
+ const GROUP_FOCUS_DESC = "需要安静时手动暂停心跳,到点自动恢复。它是即时生效的独立开关:点按钮立刻暂停/恢复,不走下面的「保存」。";
1012
+ // 「多久生效」依据 src/rpc.ts 的 config.set 实现判定:
1013
+ // intervalMin → applyHeartbeatInterval 立即重排定时器(保存后立刻生效);
1014
+ // 其余字段写入活引用/运行时 policy,每跳判定时读取(下一跳生效)。详见 manifest.md。
1015
+ const EFFECT_NOW = "多久生效:保存后定时器立刻按新间隔重排,下一次心跳就按新间隔走(无需重启)。";
1016
+ const EFFECT_NEXT = "多久生效:保存后从下一跳开始生效(无需重启)。";
1017
+ // 专注模式(v2.1.0 ①):即时动作,不走「保存」,和上面那堆参数分开。
1018
+ // 状态取 rpc 合并值(内存 + data/focus.json),所以 CLI 设的暂停这里也看得见。
1019
+ const [focus, setFocus] = React.useState(null);
1020
+ const [draftFocusMin, setDraftFocusMin] = React.useState(30);
1021
+ const [focusBusy, setFocusBusy] = React.useState(false);
1022
+ React.useEffect(() => {
1023
+ rpc("focus.status").then(setFocus, () => { /* 旧宿主无此端点:不显示状态,按钮仍可试 */ });
1024
+ }, []);
1025
+ const toggleFocus = async (pause) => {
1026
+ if (focusBusy) return;
1027
+ setFocusBusy(true);
1028
+ try {
1029
+ if (pause) {
1030
+ const minutes = Math.max(1, Math.min(1440, Math.floor(Number(draftFocusMin) || 30)));
1031
+ setFocus(await rpc("focus.pause", { minutes }));
1032
+ } else {
1033
+ await rpc("focus.resume");
1034
+ setFocus({ paused: false });
1035
+ }
1036
+ } catch (e) {
1037
+ setStatus(L("config.focusFailed", { error: String(e).slice(0, 80) }));
1038
+ } finally {
1039
+ setFocusBusy(false);
1040
+ }
1041
+ };
775
1042
  const save = async () => {
776
1043
  try {
777
1044
  const di = Math.max(1, Math.min(1440, Math.floor(Number(draftInterval) || 0)));
@@ -794,38 +1061,57 @@ window.__ModuleLoader__.load({
794
1061
  };
795
1062
  if (loadErr && !value) return React.createElement("div", { style: hintStyle }, L("common.loadFailed", { error: loadErr }));
796
1063
  if (!value) return React.createElement("div", { style: hintStyle }, t("common.loading"));
797
- return React.createElement(
1064
+ // 分组小节的标题 + 一句人话说明;生效说明按 label 宽度(140 + gap 8)缩进对齐。
1065
+ const groupTitle = (title, desc) => React.createElement(
798
1066
  "div",
799
1067
  null,
1068
+ React.createElement("div", { style: { fontSize: 13, fontWeight: 600, margin: "10px 0 0" } }, title),
1069
+ React.createElement("div", { style: { ...hintStyle, margin: "2px 0" } }, desc));
1070
+ const paramRow = (label, control, hint, effect) => React.createElement(
1071
+ "div",
1072
+ { style: { margin: "4px 0" } },
800
1073
  React.createElement("div", { style: rowStyle },
801
- React.createElement("span", { style: labelStyle }, t("config.interval")),
802
- React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 1440, value: draftInterval, onChange: (e) => setDraftInterval(e.target.value) })),
803
- React.createElement("div", { style: rowStyle },
804
- React.createElement("span", { style: labelStyle }, t("config.cap")),
805
- React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 50, value: draftCap, onChange: (e) => setDraftCap(e.target.value) })),
806
- React.createElement("div", { style: rowStyle },
807
- React.createElement("span", { style: labelStyle }, t("config.timeInject")),
1074
+ React.createElement("span", { style: labelStyle }, label),
1075
+ control,
1076
+ hint ? React.createElement("span", { style: hintStyle }, hint) : null),
1077
+ effect ? React.createElement("div", { style: { ...hintStyle, marginLeft: 148 } }, effect) : null);
1078
+ const toggleBtn = (on, set) => React.createElement("button", { style: on ? buttonStyle : buttonGhost, onClick: () => set(!on) }, on ? "☑ " + t("common.on") : "☐ " + t("common.off"));
1079
+ return React.createElement(
1080
+ "div",
1081
+ null,
1082
+ // ── 节律 ──
1083
+ groupTitle(GROUP_RHYTHM, GROUP_RHYTHM_DESC),
1084
+ paramRow(t("config.interval"),
1085
+ React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 1440, value: draftInterval, onChange: (e) => setDraftInterval(e.target.value) }),
1086
+ null, EFFECT_NOW),
1087
+ paramRow(t("config.cap"),
1088
+ React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 50, value: draftCap, onChange: (e) => setDraftCap(e.target.value) }),
1089
+ null, EFFECT_NEXT),
1090
+ // ── 时间与状态栏 ──
1091
+ groupTitle(GROUP_TIME, GROUP_TIME_DESC),
1092
+ paramRow(t("config.timeInject"),
808
1093
  React.createElement("input", { style: inputStyle, type: "number", min: 0, max: 1440, value: draftTimeInject, onChange: (e) => setDraftTimeInject(e.target.value) }),
809
- React.createElement("span", { style: hintStyle }, t("config.timeInjectOff"))),
810
- React.createElement("div", { style: rowStyle },
811
- React.createElement("span", { style: labelStyle }, t("config.statusbar")),
812
- React.createElement("button", { style: draftStatusbar ? buttonStyle : buttonGhost, onClick: () => setDraftStatusbar(!draftStatusbar) }, draftStatusbar ? "☑ " + t("common.on") : "☐ " + t("common.off")),
813
- React.createElement("span", { style: hintStyle }, t("config.statusbarHint"))),
814
- React.createElement("div", { style: rowStyle },
815
- React.createElement("span", { style: labelStyle }, t("config.idle")),
816
- React.createElement("button", { style: draftIdle ? buttonStyle : buttonGhost, onClick: () => setDraftIdle(!draftIdle) }, draftIdle ? "☑ " + t("common.on") : "☐ " + t("common.off")),
817
- React.createElement("span", { style: hintStyle }, t("config.idleHint"))),
1094
+ t("config.timeInjectOff"), EFFECT_NEXT),
1095
+ paramRow(t("config.statusbar"), toggleBtn(draftStatusbar, setDraftStatusbar), t("config.statusbarHint"), EFFECT_NEXT),
1096
+ // ── 表达 ──
1097
+ groupTitle(GROUP_EXPRESS, GROUP_EXPRESS_DESC),
1098
+ paramRow(t("config.tokenSaver"), toggleBtn(draftTokenSaver, setDraftTokenSaver), t("config.tokenSaverHint"), EFFECT_NEXT),
1099
+ paramRow(t("config.psy"), toggleBtn(draftPsy, setDraftPsy), t("config.psyHint"), EFFECT_NEXT),
1100
+ paramRow(t("config.idle"), toggleBtn(draftIdle, setDraftIdle), t("config.idleHint"), EFFECT_NEXT),
1101
+ // ── 专注模式:即时动作,不进 draft 体系 ──
1102
+ groupTitle(GROUP_FOCUS, GROUP_FOCUS_DESC),
818
1103
  React.createElement("div", { style: rowStyle },
819
- React.createElement("span", { style: labelStyle }, t("config.tokenSaver")),
820
- React.createElement("button", { style: draftTokenSaver ? buttonStyle : buttonGhost, onClick: () => setDraftTokenSaver(!draftTokenSaver) }, draftTokenSaver ? "☑ " + t("common.on") : "☐ " + t("common.off")),
821
- React.createElement("span", { style: hintStyle }, t("config.tokenSaverHint"))),
822
- React.createElement("div", { style: rowStyle },
823
- React.createElement("span", { style: labelStyle }, t("config.psy")),
824
- React.createElement("button", { style: draftPsy ? buttonStyle : buttonGhost, onClick: () => setDraftPsy(!draftPsy) }, draftPsy ? "☑ " + t("common.on") : "☐ " + t("common.off")),
825
- React.createElement("span", { style: hintStyle }, t("config.psyHint"))),
1104
+ React.createElement("span", { style: labelStyle }, t("config.focus")),
1105
+ React.createElement("input", { style: inputStyle, type: "number", min: 1, max: 1440, value: draftFocusMin, onChange: (e) => setDraftFocusMin(e.target.value) }),
1106
+ React.createElement("span", { style: hintStyle }, t("config.focusMinutes")),
1107
+ focus && focus.paused
1108
+ ? React.createElement("button", { style: buttonStyle, disabled: focusBusy, onClick: () => { void toggleFocus(false); } }, t("config.focusResume"))
1109
+ : React.createElement("button", { style: buttonGhost, disabled: focusBusy, onClick: () => { void toggleFocus(true); } }, t("config.focusPause"))),
1110
+ React.createElement("div", { style: { ...hintStyle, marginLeft: 148 } }, focus && focus.paused ? L("config.focusPaused", { clock: focus.clock || "" }) : t("config.focusHint")),
1111
+ // ── 保存固定在分组最后;成功/失败提示沿用现有 status 逻辑 ──
826
1112
  React.createElement("div", { style: rowStyle },
827
1113
  React.createElement("button", { style: buttonStyle, onClick: () => { void save(); } }, t("common.save")),
828
- React.createElement("span", { style: hintStyle }, status || t("config.saveHint"))),
1114
+ React.createElement("span", { style: status ? { ...hintStyle, fontWeight: 600 } : hintStyle }, status || t("config.saveHint"))),
829
1115
  );
830
1116
  }
831
1117
 
@@ -837,6 +1123,8 @@ window.__ModuleLoader__.load({
837
1123
  const [error, setError] = React.useState(null);
838
1124
  const [selected, setSelected] = React.useState("");
839
1125
  const [text, setText] = React.useState(null);
1126
+ // v2.1.0 面板改造:正文收进「展开查看」折叠块,默认收起;列表与加载逻辑原样保留。
1127
+ const WEEKLY_SHOW = "展开查看报告正文";
840
1128
  const loadReport = React.useCallback((file) => {
841
1129
  setSelected(file);
842
1130
  rpc("weekly.get", { file }).then((r) => setText(r.text), (e) => setError(String(e).slice(0, 100)));
@@ -866,7 +1154,10 @@ window.__ModuleLoader__.load({
866
1154
  onClick: () => loadReport(r.file),
867
1155
  }, r.end.slice(0, 10))),
868
1156
  ) : null,
869
- text ? React.createElement("pre", { style: { whiteSpace: "pre-wrap", margin: "4px 0", fontSize: 12 } }, text) : null,
1157
+ text ? React.createElement("details", { style: { margin: "4px 0" } },
1158
+ React.createElement("summary", { style: summaryStyle }, WEEKLY_SHOW),
1159
+ React.createElement("pre", { style: { whiteSpace: "pre-wrap", margin: "4px 0", fontSize: 12 } }, text),
1160
+ ) : null,
870
1161
  React.createElement("div", { style: rowStyle },
871
1162
  React.createElement("button", { style: buttonGhost, onClick: () => { void reload(); } }, t("common.refresh"))),
872
1163
  );
@@ -882,6 +1173,11 @@ window.__ModuleLoader__.load({
882
1173
  const [importPw, setImportPw] = React.useState("");
883
1174
  const [status, setStatus] = React.useState("");
884
1175
  const busy = React.useRef(false);
1176
+ // v2.1.0 面板改造:导入是危险操作(会用迁移包覆盖本机数据),加二次确认——
1177
+ // 第一次点只亮红色确认态并提示,再点一次才真正执行。
1178
+ const IMPORT_CONFIRM_LABEL = "确认导入(覆盖本机数据)";
1179
+ const IMPORT_CONFIRM_HINT = "⚠ 危险操作:导入会用迁移包覆盖本机的心跳数据(被替换的文件会自动备份)。确认路径和口令无误后,再点一次「确认导入」才会执行。";
1180
+ const [confirmImport, setConfirmImport] = React.useState(false);
885
1181
  const run = (fn) => {
886
1182
  if (busy.current) return;
887
1183
  busy.current = true;
@@ -900,6 +1196,15 @@ window.__ModuleLoader__.load({
900
1196
  setImportPw("");
901
1197
  setStatus(L("migrate.imported", { restored: v.restored.length, backedUp: v.backedUp.length, skipped: v.skipped.length }));
902
1198
  });
1199
+ const onImportClick = () => {
1200
+ if (!confirmImport) {
1201
+ setConfirmImport(true);
1202
+ setStatus(IMPORT_CONFIRM_HINT);
1203
+ return;
1204
+ }
1205
+ setConfirmImport(false);
1206
+ void doImport();
1207
+ };
903
1208
  return React.createElement(
904
1209
  "div",
905
1210
  null,
@@ -912,16 +1217,28 @@ window.__ModuleLoader__.load({
912
1217
  ),
913
1218
  React.createElement("div", { style: { ...hintStyle, marginTop: 6, fontWeight: 600 } }, t("migrate.importHeading")),
914
1219
  React.createElement("div", { style: rowStyle },
915
- React.createElement("input", { style: { ...inputStyle, width: 220 }, placeholder: t("migrate.filePlaceholder"), value: importFile, onChange: (e) => setImportFile(e.target.value) }),
916
- React.createElement("input", { style: inputStyle, type: "password", placeholder: t("migrate.pwPlaceholderShort"), value: importPw, onChange: (e) => setImportPw(e.target.value) }),
917
- React.createElement("button", { style: buttonStyle, onClick: () => { void doImport(); } }, t("migrate.importButton")),
1220
+ React.createElement("input", { style: { ...inputStyle, width: 220 }, placeholder: t("migrate.filePlaceholder"), value: importFile, onChange: (e) => { setImportFile(e.target.value); setConfirmImport(false); } }),
1221
+ React.createElement("input", { style: inputStyle, type: "password", placeholder: t("migrate.pwPlaceholderShort"), value: importPw, onChange: (e) => { setImportPw(e.target.value); setConfirmImport(false); } }),
1222
+ confirmImport
1223
+ ? React.createElement("button", { style: { ...buttonStyle, background: "#e5484d" }, onClick: onImportClick }, IMPORT_CONFIRM_LABEL)
1224
+ : React.createElement("button", { style: buttonStyle, onClick: onImportClick }, t("migrate.importButton")),
918
1225
  ),
919
1226
  status ? React.createElement("div", { style: hintStyle }, status) : null,
920
1227
  );
921
1228
  }
922
1229
 
923
1230
  // ── 主卡片 ────────────────────────────────────────────────────
924
- function HeartbeatSection() {
1231
+ const PANEL_TABS = [
1232
+ { id: "status", labelKey: "panel.tab.status" },
1233
+ { id: "sessions", labelKey: "panel.tab.sessions" },
1234
+ { id: "seeds", labelKey: "panel.tab.seeds" },
1235
+ { id: "interests", labelKey: "panel.tab.interests" },
1236
+ { id: "profile", labelKey: "panel.tab.profile" },
1237
+ { id: "weekly", labelKey: "panel.tab.weekly" },
1238
+ { id: "config", labelKey: "panel.tab.config" },
1239
+ ];
1240
+ // 账本 + 摘抄本:原 HeartbeatSection 内联块原样迁出(含两条 rpc 调用)。
1241
+ function LedgerExcerptBlocks() {
925
1242
  const [ledgerMsg, setLedgerMsg] = React.useState("");
926
1243
  const openLedger = () => rpc("ledger.open").then(
927
1244
  (v) => setLedgerMsg(L("ledger.opened", { path: v.path })),
@@ -934,41 +1251,97 @@ window.__ModuleLoader__.load({
934
1251
  );
935
1252
  return React.createElement(
936
1253
  "div",
937
- { style: { padding: "2px 0" } },
938
- React.createElement(Section, { title: t("section.status"), open: true }, React.createElement(StatusCard, null)),
939
- React.createElement(Section, { title: t("section.sessions") }, React.createElement(SessionsSection, null)),
940
- React.createElement(Section, { title: t("section.seeds") }, React.createElement(SeedsSection, null)),
941
- React.createElement(Section, { title: t("section.interests") }, React.createElement(InterestsSection, null)),
942
- React.createElement(Section, { title: t("section.profile") }, React.createElement(ProfileSection, null)),
943
- React.createElement(Section, { title: t("section.ledger") }, React.createElement(
944
- "div",
945
- null,
946
- React.createElement("div", { style: rowStyle },
947
- React.createElement("button", { style: buttonStyle, onClick: () => { void openLedger(); } }, t("ledger.open")),
948
- React.createElement("span", { style: hintStyle }, ledgerMsg || t("ledger.hint"))),
949
- )),
950
- React.createElement(Section, { title: t("section.excerpt") }, React.createElement(
951
- "div",
952
- null,
953
- React.createElement("div", { style: rowStyle },
954
- React.createElement("button", { style: buttonStyle, onClick: () => { void openExcerpt(); } }, t("excerpt.open")),
955
- React.createElement("span", { style: hintStyle }, excerptMsg || t("excerpt.hint"))),
956
- )),
957
- React.createElement(Section, { title: t("section.weekly") }, React.createElement(WeeklySection, null)),
958
- React.createElement(Section, { title: t("section.migrate") }, React.createElement(MigrateSection, null)),
959
- React.createElement(Section, { title: t("section.config") }, React.createElement(ConfigSection, null)),
1254
+ null,
1255
+ React.createElement("div", { style: blockHead }, t("section.ledger")),
1256
+ React.createElement("div", { style: rowStyle },
1257
+ React.createElement("button", { style: buttonStyle, onClick: () => { void openLedger(); } }, t("ledger.open")),
1258
+ React.createElement("span", { style: hintStyle }, ledgerMsg || t("ledger.hint"))),
1259
+ React.createElement("div", { style: blockHead }, t("section.excerpt")),
1260
+ React.createElement("div", { style: rowStyle },
1261
+ React.createElement("button", { style: buttonStyle, onClick: () => { void openExcerpt(); } }, t("excerpt.open")),
1262
+ React.createElement("span", { style: hintStyle }, excerptMsg || t("excerpt.hint"))),
1263
+ );
1264
+ }
1265
+ function HeartbeatSection(props) {
1266
+ ensurePanelStyle();
1267
+ const [tab, setTab] = React.useState("status");
1268
+ // 槽位契约(PluginConfigViewProps.view):'page' 是主视图;'summary' 只回
1269
+ // 一行标题。shiori 参考实现完全忽略 view 且生产可用(契约也标注 page
1270
+ // only),这里防御性处理,不影响 page 路径。
1271
+ if (props && props.view === "summary") {
1272
+ return React.createElement("div", { className: "hb-row" },
1273
+ React.createElement("span", { className: "hb-badge hb-badgeInfo" }, t("panel.title")));
1274
+ }
1275
+ // 非状态页统一套一张卡(带卡头标题),视觉上和其他卡对齐
1276
+ const card = (title, node) => React.createElement("div", { className: "hb-card" },
1277
+ React.createElement("div", { className: "hb-cardHead" },
1278
+ React.createElement("span", { className: "hb-cardTitle" }, title)),
1279
+ node);
1280
+ return React.createElement(
1281
+ "div",
1282
+ { className: "hb-panel" },
1283
+ React.createElement("div", { className: "hb-hero" },
1284
+ React.createElement("div", { className: "hb-heroTop" },
1285
+ React.createElement("div", { className: "hb-logo" },
1286
+ React.createElement("svg", { width: 21, height: 21, viewBox: "0 0 24 24", fill: "none" },
1287
+ React.createElement("path", {
1288
+ d: "M2 12h4l2.2-5.2 3.2 10.4 2.6-5.2H22",
1289
+ stroke: "#fff", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round",
1290
+ }))),
1291
+ React.createElement("div", { className: "hb-heroText" },
1292
+ React.createElement("span", { className: "hb-heroTitle" }, t("panel.title")),
1293
+ React.createElement("span", { className: "hb-heroSub" }, t("panel.subtitle"))),
1294
+ React.createElement("div", { className: "hb-heroRight" },
1295
+ React.createElement("span", { className: "hb-badge hb-badgeInfo" }, t("panel.badgeNative"))))),
1296
+ // tab 栏:状态 / 会话 / 素材 / 兴趣 / 画像 / 周报 / 设置,状态默认选中
1297
+ React.createElement("div", { className: "hb-tabs" }, PANEL_TABS.map((entry) =>
1298
+ React.createElement("button", {
1299
+ key: entry.id,
1300
+ className: tab === entry.id ? "hb-tab hb-tabOn" : "hb-tab",
1301
+ onClick: () => setTab(entry.id),
1302
+ }, t(entry.labelKey)))),
1303
+ // 内容区:容器只切换,不装业务逻辑
1304
+ React.createElement("div", { className: "hb-body" },
1305
+ tab === "status" ? React.createElement(StatusCard, null) : null,
1306
+ tab === "sessions" ? card(t("panel.tab.sessions"), React.createElement(SessionsSection, null)) : null,
1307
+ tab === "seeds" ? card(t("panel.tab.seeds"), React.createElement(SeedsSection, null)) : null,
1308
+ tab === "interests" ? card(t("panel.tab.interests"), React.createElement(InterestsSection, null)) : null,
1309
+ tab === "profile" ? card(t("panel.tab.profile"), React.createElement(ProfileSection, null)) : null,
1310
+ tab === "weekly" ? card(t("panel.tab.weekly"), React.createElement(WeeklySection, null)) : null,
1311
+ tab === "config" ? React.createElement(
1312
+ "div",
1313
+ { className: "hb-body" },
1314
+ React.createElement("div", { className: "hb-card" },
1315
+ React.createElement("div", { className: "hb-cardHead" },
1316
+ React.createElement("span", { className: "hb-cardTitle" }, t("section.config"))),
1317
+ React.createElement(ConfigSection, null)),
1318
+ React.createElement("div", { className: "hb-card" },
1319
+ React.createElement("div", { className: "hb-cardHead" },
1320
+ React.createElement("span", { className: "hb-cardTitle" }, t("section.migrate"))),
1321
+ React.createElement(MigrateSection, null)),
1322
+ React.createElement("div", { className: "hb-card" },
1323
+ React.createElement(LedgerExcerptBlocks, null)),
1324
+ ) : null,
1325
+ ),
960
1326
  );
961
1327
  }
962
1328
 
963
1329
  try {
964
- ctx.slots.inject("settings.section", function* () {
965
- yield ctx.slots.register(
966
- { name: "settings.section", id: "dsh-heartbeat", order: 20, locale: LOCALE_NS, label: () => t("settings.row.label") },
1330
+ ctx.slots.inject("plugins.bundle.config", function () {
1331
+ const disposer = ctx.slots.register(
1332
+ // key 必须等于宿主报的 bundle 名(pkg.name),不是 npm 包名:
1333
+ // package.json 是 @kanadego/dsh-heartbeat,但 plugin-manager 的
1334
+ // packageView 取的是 bundle.name = "dsh-heartbeat"(详情页 data-plugin-name)。
1335
+ { name: "plugins.bundle.config", key: "dsh-heartbeat" },
967
1336
  HeartbeatSection,
968
1337
  );
1338
+ return disposer;
969
1339
  });
970
1340
  } catch (e) {
971
- console.warn("[dsh-heartbeat] settings.section slot unavailable", e);
1341
+ // v2.1.0 起旧设置页面板退役:不再往 settings.section 挂第二份 UI。
1342
+ // 宿主 0.2.1 起就有 plugins.bundle.config,宿主过旧时面板不可用,
1343
+ // 这里只留下一条明确提示,不再造一个观感落后的降级副本。
1344
+ console.warn("[dsh-heartbeat] plugins.bundle.config 注册失败,面板不可用(需要 DSH 0.2.1 及以上):" + ((e && e.message) || e));
972
1345
  }
973
1346
  }
974
1347