@kanadego/dsh-heartbeat 2.0.1 → 2.1.1

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