dsh-spirit 0.6.1 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -17,6 +17,50 @@
17
17
  把静默为空读成了功能正常。不升 `warn`(那会造一屏假故障),只把 0 显示出来;未探到 ⇒ 不显示
18
18
  (**未知不当 0**)。
19
19
 
20
+ ## 0.8.0
21
+
22
+ 模型可写记忆 + 目的层(user 点单:对标 agent-soul 的 soul_memory,但**两本账必须分清**):
23
+
24
+ ### 两本账(schema v9:model_memory)
25
+ - **生涯账(scope=life)**:心里话、与主人的约定——全局,跟人格连续性走;pinned 以「心里记着:…」进**人格区**(稳定区,不逐轮变)。kind:bond/promise。
26
+ - **工作账(scope=work)**:长期工作的事实/决定/偏好/约定——**按工作区隔离**(workspace_id 空=跨区);pinned 只进对应工作区的**事务卡「记着」段**(最多 2 条)。kind:fact/decision/preference/promise。
27
+ - **日记(scope=diary)**:按条追加、**不写 md、不自动注入**;需要时工具 `recall` 按词取(或面板看)——按用户要求不落档,靠回响/检索通道调取。
28
+ - 纪律:写前脱敏(含密整条拒)、text 钳 200 字、同 scope 同文幂等(撞 id 只刷时间)、forget 置标记不物理删、kind 越界拒写。
29
+
30
+ ### 目的层(goal)
31
+ - 惦记的事(open/done/dropped),按工作区隔离;open 目标以「惦记:…」段进事务卡(最多 3 条);同标的重开会复用行。
32
+
33
+ ### 工具面(部署总闸关 ⇒ 不注册)
34
+ - `spirit_memory`:write/pin/unpin/forget/recall/list(scope 必选,描述里写明两本账边界)。
35
+ - `spirit_goal`:add/done/drop/list。
36
+
37
+ ### 观测与面板
38
+ - 新端点 `memory-list`(life/work/diary/goals 四组);翻阅·本体新增「记着」子页;回响页新增「生涯记忆补充(pinned)」段——回响通道能调到生涯记忆。
39
+ - 卡新段:「记着」(工作账 pinned)/「惦记」(open 目标),优先级在反馈/线程之后、事务之前;指纹随之扩展(关时逐字节不变)。
40
+
41
+ ### 迁移
42
+ - schema v8→v9:两张纯新表(model_memory + goal),老库走迁移链自动建。
43
+
44
+ ## 0.7.0
45
+
46
+ 对表 dsh-soul / dsh-agent-soul 的三项能力补齐(用户点单):
47
+
48
+ ### 人格配置编译器(对表 dsh-soul)
49
+ - **预设库**:5 张内置预设(安静记录者/如实记事/直白工程师/俏皮同伴/诗意守夜人)+ 自建预设(存/删,内置保护)。
50
+ - **激活 = 写正式人设**:走 `PersonaStore.save()` 唯一写路径(revision 推进/历史留档/md 重生全继承);预设库只记 activeId。
51
+ - **作用域覆盖(只读投影)**:会话 > 工作区 > 激活 > 当前卡;会话绑定 30 天回收(照 dsh-soul 的 sidecar 纪律);注入侧按 agent 的 workspace/session 实时解析,缓存键含命中预设 id。
52
+ - **审计**:activate/bind/unbind/preset-save/delete 追加 `persona-audit.jsonl`(面板回显尾部 20 条)。
53
+ - 面板:人设页新增预设行(选/激活/删/另存)+ 本会话绑定 + 生效来源徽标。
54
+ - 六新端点:`persona-presets / persona-activate / persona-preset-save / persona-preset-delete / persona-bind / persona-effective`。
55
+
56
+ ### 注入回响面(对表 prime-memory 的 memory 激活槽位)
57
+ - 每轮 pre-step 落一条快照:注入了什么(全文 + 指纹 + 分段行数)或为什么没注入(门名);进程内环形缓冲 200 条,不落库。
58
+ - 新端点 `inject-echo`;翻阅面新增「回响」子视图(时间/注入或跳过/门名/指纹/分段 chips/卡全文)+ 头部刷新接入。
59
+
60
+ ### 规则打分(对表 dsh-agent-soul,叠加在四级 salience 上)
61
+ - `recall/txn-score.ts`:档位基底(100/70/40/20) + 来源加分(user_explicit +20) + 结构加分(cue +10/summary +8) + 近因微调(24h 内 ≤ +12) - 噪声罚分(短句 -10);确定性、零 LLM、可重算不落库。
62
+ - 交付卡行从「最新一条」改为「窗口 12 条内取分最高」,同分仍新者胜;注入面仍只读 card_line 不进 summary。
63
+
20
64
  ## 0.6.1
21
65
 
22
66
  - **本体面可搜**(用户点单:本体类为什么不能搜索):「翻阅 · 本体」的实体/任务线子页新增搜索框(Enter 提交)——实体按名字/别名 LIKE、任务线按标题 LIKE;空词回全量,切子页自动清。反馈面是追加型真源,无搜索词表不提供。
package/dist/client.js CHANGED
@@ -143,6 +143,35 @@ var __defProp = Object.defineProperty;
143
143
  "sea.sourceDrsc": "历史",
144
144
  "sea.sourceOnto": "本体轨交付",
145
145
  "sea.detailDelivery": "工作交付(本体轨)",
146
+ // ── v0.7 人格预设库(人设页)──
147
+ "sea.presets": "人格预设",
148
+ "sea.presetBuiltin": "内置",
149
+ "sea.presetActivate": "激活",
150
+ "sea.presetDelete": "删除",
151
+ "sea.presetSaveName": "新预设名",
152
+ "sea.presetSave": "存为预设",
153
+ "sea.presetScope": "作用域",
154
+ "sea.presetBindSession": "绑定本会话",
155
+ "sea.presetUnbindSession": "解绑本会话",
156
+ "sea.presetEffective": "生效",
157
+ "sea.presetSourceSession": "会话绑定",
158
+ "sea.presetSourceWorkspace": "工作区绑定",
159
+ "sea.presetSourceActive": "全局激活",
160
+ "sea.presetSourceCurrent": "当前卡",
161
+ "sea.presetActivated": "已激活该预设(写入正式人设)",
162
+ "sea.presetSaved": "已存为新预设",
163
+ "sea.presetDeleted": "预设已删除",
164
+ "sea.presetBound": "已绑定到本会话",
165
+ "sea.presetUnbound": "已解绑本会话",
166
+ // ── v0.8 模型可写记忆(两本账 + 日记 + 目的)──
167
+ "onto.memory": "记着",
168
+ "memory.life": "生涯账(心里话/约定)",
169
+ "memory.work": "工作账(长期工作记忆)",
170
+ "memory.goals": "目的(惦记的事)",
171
+ "memory.diary": "日记(不自动注入)",
172
+ "memory.pinned": "进注入",
173
+ "memory.empty": "(空)",
174
+ "echo.lifeNote": "生涯记忆补充(pinned)",
146
175
  "sea.markImportant": "这条重要",
147
176
  "sea.unmark": "撤销标记",
148
177
  "sea.marked": "已记:这条重要",
@@ -243,6 +272,11 @@ var __defProp = Object.defineProperty;
243
272
  "rec.session": "会话",
244
273
  // ── v0.4 本周事务(timeline-query:只读工作记忆)──
245
274
  "rec.weekView": "本周",
275
+ "rec.echo": "回响",
276
+ "echo.empty": "还没有注入快照(跑几轮后回来;插件重启后归零属正常)",
277
+ "echo.injected": "注入",
278
+ "echo.skipped": "跳过",
279
+ "echo.fp": "指纹",
246
280
  "rec.weekTitle": "这周都做了什么",
247
281
  "rec.weekEmpty": "本周还没有记下的事务(开事务轨并攒够一批才会浮现)",
248
282
  // ── v0.5 本体层翻阅(entity-graph/entity-lookup/task-list/task-detail/evaluation-list)──
@@ -453,6 +487,35 @@ var __defProp = Object.defineProperty;
453
487
  "sea.sourceDrsc": "history",
454
488
  "sea.sourceOnto": "ontology delivery",
455
489
  "sea.detailDelivery": "Work delivery (ontology track)",
490
+ // ── v0.7 persona presets (persona tab) ──
491
+ "sea.presets": "Persona presets",
492
+ "sea.presetBuiltin": "built-in",
493
+ "sea.presetActivate": "Activate",
494
+ "sea.presetDelete": "Delete",
495
+ "sea.presetSaveName": "new preset name",
496
+ "sea.presetSave": "Save as preset",
497
+ "sea.presetScope": "Scope",
498
+ "sea.presetBindSession": "Bind this session",
499
+ "sea.presetUnbindSession": "Unbind this session",
500
+ "sea.presetEffective": "Effective",
501
+ "sea.presetSourceSession": "session binding",
502
+ "sea.presetSourceWorkspace": "workspace binding",
503
+ "sea.presetSourceActive": "global active",
504
+ "sea.presetSourceCurrent": "current card",
505
+ "sea.presetActivated": "Preset activated (written to the real persona)",
506
+ "sea.presetSaved": "Saved as a new preset",
507
+ "sea.presetDeleted": "Preset deleted",
508
+ "sea.presetBound": "Bound to this session",
509
+ "sea.presetUnbound": "Unbound from this session",
510
+ // ── v0.8 model-writable memory (two ledgers + diary + purpose) ──
511
+ "onto.memory": "Remembered",
512
+ "memory.life": "Life ledger (inner words / promises)",
513
+ "memory.work": "Work ledger (long-term work memory)",
514
+ "memory.goals": "Purpose (things I keep thinking about)",
515
+ "memory.diary": "Diary (never auto-injected)",
516
+ "memory.pinned": "injected",
517
+ "memory.empty": "(empty)",
518
+ "echo.lifeNote": "Life memory supplement (pinned)",
456
519
  "sea.markImportant": "This mattered",
457
520
  "sea.unmark": "Undo mark",
458
521
  "sea.marked": "Marked: this mattered",
@@ -550,6 +613,11 @@ var __defProp = Object.defineProperty;
550
613
  "rec.failed": "that did not work",
551
614
  "rec.session": "session",
552
615
  "rec.weekView": "This week",
616
+ "rec.echo": "Echo",
617
+ "echo.empty": "No injection snapshots yet (come back after a few turns; the buffer resets on plugin restart)",
618
+ "echo.injected": "injected",
619
+ "echo.skipped": "skipped",
620
+ "echo.fp": "fp",
553
621
  "rec.weekTitle": "What I did this week",
554
622
  "rec.weekEmpty": "No transactions logged this week yet (turn the transaction track on and let a batch build up)",
555
623
  "onto.tab": "Ontology",
@@ -663,7 +731,7 @@ var __defProp = Object.defineProperty;
663
731
  // src/contract.ts
664
732
  var SPIRIT_RPC_PREFIX = "dsh-spirit/";
665
733
  var SPIRIT_RPC_ROUTE = `/${SPIRIT_RPC_PREFIX.replace(/\/$/, "")}/rpc`;
666
- var SPIRIT_VERSION = "0.6.1";
734
+ var SPIRIT_VERSION = "0.8.0";
667
735
 
668
736
  // client/src/env.ts
669
737
  function sessionIdOf(props) {
@@ -800,6 +868,7 @@ var __defProp = Object.defineProperty;
800
868
 
801
869
  // client/src/sea/sea-persona.ts
802
870
  var H_STYLE = { margin: "0 0 6px", fontSize: 13, color: "#9fc1ff" };
871
+ var BTN_STYLE = { padding: "3px 10px", borderRadius: 6, border: "1px solid rgba(120,160,255,.28)", background: "rgba(20,28,48,.7)", color: "#cfe0ff", fontSize: 12, cursor: "pointer" };
803
872
  var ROW_STYLE = { display: "flex", gap: 8, alignItems: "center", marginTop: 8, flexWrap: "wrap" };
804
873
  var LABEL_STYLE = { fontSize: 12, color: "#8e9ab5", minWidth: 96 };
805
874
  var INPUT_STYLE = { flex: "1 1 180px", padding: "4px 8px", borderRadius: 6, border: "1px solid rgba(120,160,255,.22)", background: "rgba(8,11,20,.6)", color: "#e8eeff", fontSize: 12 };
@@ -831,12 +900,17 @@ var __defProp = Object.defineProperty;
831
900
  return text.split("\n").map((line) => line.trim()).filter((line) => line !== "");
832
901
  }
833
902
  function SeaPersona(props) {
834
- const { rpc } = props;
903
+ const { rpc, sessionId } = props;
835
904
  const copy = copyOf(typeof document === "undefined" ? void 0 : document.documentElement.lang);
836
905
  const [card, setCard] = (0, import_react.useState)(null);
837
906
  const [draft, setDraft] = (0, import_react.useState)({});
838
907
  const [preview, setPreview] = (0, import_react.useState)(null);
839
908
  const [history, setHistory] = (0, import_react.useState)(null);
909
+ const [presets, setPresets] = (0, import_react.useState)(null);
910
+ const [effective, setEffective] = (0, import_react.useState)(null);
911
+ const [presetPick, setPresetPick] = (0, import_react.useState)("");
912
+ const [presetName, setPresetName] = (0, import_react.useState)("");
913
+ const [presetBusy, setPresetBusy] = (0, import_react.useState)(false);
840
914
  const [owner, setOwner] = (0, import_react.useState)(null);
841
915
  const [ownerSelf, setOwnerSelf] = (0, import_react.useState)("");
842
916
  const [note, setNote] = (0, import_react.useState)(null);
@@ -861,11 +935,14 @@ var __defProp = Object.defineProperty;
861
935
  if (rpc === void 0) return;
862
936
  setError(null);
863
937
  try {
864
- const [got, hist, own] = await Promise.all([
938
+ const [got, hist, own, pres, eff] = await Promise.all([
865
939
  rpc("persona-get", {}),
866
940
  rpc("persona-history", { limit: 20 }),
867
941
  // 档案拉失败(老宿主报 unavailable)不拖挂人设主面:单独退 null,面板如实标
868
- rpc("owner-get", {}).catch(() => ({ ok: false }))
942
+ rpc("owner-get", {}).catch(() => ({ ok: false })),
943
+ // 预设库拉失败(老装配)不拖挂主面:退 null
944
+ rpc("persona-presets", {}).catch(() => ({ ok: false })),
945
+ rpc("persona-effective", sessionId === void 0 || sessionId === "" ? {} : { sessionId }).catch(() => ({ ok: false }))
869
946
  ]);
870
947
  if (!mountedRef.current) return;
871
948
  if (!got.ok) {
@@ -880,11 +957,18 @@ var __defProp = Object.defineProperty;
880
957
  } else {
881
958
  setOwner(null);
882
959
  }
960
+ if (pres.ok) {
961
+ setPresets(pres.value ?? null);
962
+ setPresetPick((prev) => prev !== "" ? prev : pres.value?.presets[0]?.id ?? "");
963
+ } else {
964
+ setPresets(null);
965
+ }
966
+ setEffective(eff.ok ? eff.value ?? null : null);
883
967
  } catch (err) {
884
968
  if (!mountedRef.current) return;
885
969
  setError(err instanceof Error ? err.message : String(err));
886
970
  }
887
- }, [rpc, fillFrom]);
971
+ }, [rpc, fillFrom, sessionId]);
888
972
  (0, import_react.useEffect)(() => {
889
973
  mountedRef.current = true;
890
974
  void load();
@@ -1028,6 +1112,66 @@ var __defProp = Object.defineProperty;
1028
1112
  }, 400);
1029
1113
  return () => clearTimeout(timer);
1030
1114
  }, [rpc, card, doPreview]);
1115
+ const reloadPresets = (0, import_react.useCallback)(async () => {
1116
+ if (rpc === void 0) return;
1117
+ const [pres, eff] = await Promise.all([
1118
+ rpc("persona-presets", {}).catch(() => ({ ok: false })),
1119
+ rpc("persona-effective", sessionId === void 0 || sessionId === "" ? {} : { sessionId }).catch(() => ({ ok: false }))
1120
+ ]);
1121
+ if (!mountedRef.current) return;
1122
+ if (pres.ok) setPresets(pres.value);
1123
+ if (eff.ok) setEffective(eff.value);
1124
+ }, [rpc, sessionId]);
1125
+ const runPresetAction = (0, import_react.useCallback)((label, action) => {
1126
+ if (rpc === void 0 || presetBusy) return;
1127
+ setPresetBusy(true);
1128
+ setNote(null);
1129
+ setError(null);
1130
+ void action().then(async (result) => {
1131
+ if (!mountedRef.current) return;
1132
+ if (!result.ok) {
1133
+ setError(result.error?.message ?? "操作失败");
1134
+ return;
1135
+ }
1136
+ setNote(label);
1137
+ await reloadPresets();
1138
+ }).catch((err) => {
1139
+ if (mountedRef.current) setError(err instanceof Error ? err.message : String(err));
1140
+ }).finally(() => {
1141
+ if (mountedRef.current) setPresetBusy(false);
1142
+ });
1143
+ }, [rpc, presetBusy, reloadPresets]);
1144
+ const doActivate = () => {
1145
+ if (rpc === void 0 || presetPick === "") return;
1146
+ runPresetAction(copy["sea.presetActivated"], async () => {
1147
+ const result = await rpc("persona-activate", { presetId: presetPick });
1148
+ if (result.ok && result.value.ok && result.value.persona !== void 0) fillFrom(result.value.persona);
1149
+ return result.ok ? { ok: result.value.ok, ...result.value.reason === void 0 ? {} : { error: { message: result.value.reason } } } : result;
1150
+ });
1151
+ };
1152
+ const doSavePreset = () => {
1153
+ if (rpc === void 0 || presetName.trim() === "") return;
1154
+ const name = presetName.trim();
1155
+ runPresetAction(copy["sea.presetSaved"], async () => {
1156
+ const result = await rpc("persona-preset-save", { name });
1157
+ if (result.ok && result.value.ok) setPresetName("");
1158
+ return result.ok ? { ok: result.value.ok, ...result.value.reason === void 0 ? {} : { error: { message: result.value.reason } } } : result;
1159
+ });
1160
+ };
1161
+ const doDeletePreset = () => {
1162
+ if (rpc === void 0 || presetPick === "") return;
1163
+ runPresetAction(copy["sea.presetDeleted"], async () => {
1164
+ const result = await rpc("persona-preset-delete", { presetId: presetPick });
1165
+ return result.ok ? { ok: result.value.ok, ...result.value.reason === void 0 ? {} : { error: { message: result.value.reason } } } : result;
1166
+ });
1167
+ };
1168
+ const doBindSession = (presetId) => {
1169
+ if (rpc === void 0 || sessionId === void 0 || sessionId === "") return;
1170
+ runPresetAction(presetId === null ? copy["sea.presetUnbound"] : copy["sea.presetBound"], async () => {
1171
+ const result = await rpc("persona-bind", { scope: "session", sessionId, presetId });
1172
+ return result.ok ? { ok: result.value.ok, ...result.value.reason === void 0 ? {} : { error: { message: result.value.reason } } } : result;
1173
+ });
1174
+ };
1031
1175
  return (0, import_react.createElement)(
1032
1176
  "div",
1033
1177
  { style: { padding: "12px 16px", overflowY: "auto" } },
@@ -1035,6 +1179,33 @@ var __defProp = Object.defineProperty;
1035
1179
  "div",
1036
1180
  null,
1037
1181
  (0, import_react.createElement)("h4", { style: H_STYLE }, `${copy["sea.personaName"]} · revision ${card.revision}`),
1182
+ // v0.7 预设库:选 → 激活(写正式人设);另存为预设;当前会话可临时绑定
1183
+ presets === null ? null : (0, import_react.createElement)(
1184
+ "div",
1185
+ { style: ROW_STYLE },
1186
+ (0, import_react.createElement)("span", { style: LABEL_STYLE }, copy["sea.presets"]),
1187
+ (0, import_react.createElement)(
1188
+ "select",
1189
+ { style: { ...INPUT_STYLE, flex: "0 0 auto", minWidth: 120 }, value: presetPick, onChange: (event) => setPresetPick(event.target.value) },
1190
+ ...presets.presets.map((preset) => (0, import_react.createElement)("option", { key: preset.id, value: preset.id }, `${preset.name}${preset.builtin ? ` · ${copy["sea.presetBuiltin"]}` : ""}`))
1191
+ ),
1192
+ (0, import_react.createElement)("button", { type: "button", style: BTN_STYLE, disabled: presetBusy || presetPick === "", onClick: () => doActivate() }, copy["sea.presetActivate"]),
1193
+ (0, import_react.createElement)("button", { type: "button", style: BTN_STYLE, disabled: presetBusy || presetPick === "", onClick: () => doDeletePreset() }, copy["sea.presetDelete"]),
1194
+ (0, import_react.createElement)("input", { style: { ...INPUT_STYLE, flex: "0 0 120px" }, placeholder: copy["sea.presetSaveName"], value: presetName, onChange: (event) => setPresetName(event.target.value) }),
1195
+ (0, import_react.createElement)("button", { type: "button", style: BTN_STYLE, disabled: presetBusy || presetName.trim() === "", onClick: () => doSavePreset() }, copy["sea.presetSave"])
1196
+ ),
1197
+ sessionId === void 0 || sessionId === "" || presets === null ? null : (0, import_react.createElement)(
1198
+ "div",
1199
+ { style: ROW_STYLE },
1200
+ (0, import_react.createElement)("span", { style: LABEL_STYLE }, copy["sea.presetScope"]),
1201
+ (0, import_react.createElement)("button", { type: "button", style: BTN_STYLE, disabled: presetBusy || presetPick === "", onClick: () => doBindSession(presetPick) }, copy["sea.presetBindSession"]),
1202
+ (0, import_react.createElement)("button", { type: "button", style: BTN_STYLE, disabled: presetBusy, onClick: () => doBindSession(null) }, copy["sea.presetUnbindSession"])
1203
+ ),
1204
+ effective === null ? null : (0, import_react.createElement)(
1205
+ "div",
1206
+ { style: { ...MUTED_STYLE, marginTop: 6 } },
1207
+ `${copy["sea.presetEffective"]}:${effective.source === "session" ? copy["sea.presetSourceSession"] : effective.source === "workspace" ? copy["sea.presetSourceWorkspace"] : effective.source === "active" ? copy["sea.presetSourceActive"] : copy["sea.presetSourceCurrent"]}${effective.presetName !== void 0 ? `(${effective.presetName})` : ""}`
1208
+ ),
1038
1209
  (0, import_react.createElement)(
1039
1210
  "div",
1040
1211
  { style: ROW_STYLE },
@@ -1397,6 +1568,9 @@ var __defProp = Object.defineProperty;
1397
1568
  const [ontoDetail, setOntoDetail] = (0, import_react3.useState)(null);
1398
1569
  const [ontoBusy, setOntoBusy] = (0, import_react3.useState)(false);
1399
1570
  const [ontoBackfilling, setOntoBackfilling] = (0, import_react3.useState)(false);
1571
+ const [echoRows, setEchoRows] = (0, import_react3.useState)([]);
1572
+ const [echoBusy, setEchoBusy] = (0, import_react3.useState)(false);
1573
+ const [memoryView, setMemoryView] = (0, import_react3.useState)(null);
1400
1574
  const [ontoQueryInput, setOntoQueryInput] = (0, import_react3.useState)("");
1401
1575
  const [ontoQuery, setOntoQuery] = (0, import_react3.useState)("");
1402
1576
  const [editingId, setEditingId] = (0, import_react3.useState)(null);
@@ -1478,7 +1652,9 @@ var __defProp = Object.defineProperty;
1478
1652
  rpc("entity-graph", { limit: 60 }),
1479
1653
  rpc("evaluation-list", { limit: 100 })
1480
1654
  ]);
1655
+ const mem = await rpc("memory-list", { limit: 50 }).catch(() => ({ ok: false }));
1481
1656
  if (token !== seqRef.current) return;
1657
+ if (mem.ok) setMemoryView(mem.value);
1482
1658
  if (tasks.ok) setOntoTasks(tasks.value.tasks);
1483
1659
  if (graph.ok) setOntoEntities(graph.value.nodes);
1484
1660
  if (evals.ok) setOntoEvals(evals.value.rows);
@@ -1528,11 +1704,38 @@ var __defProp = Object.defineProperty;
1528
1704
  (0, import_react3.useEffect)(() => {
1529
1705
  if (view === "onto") void fetchOnto();
1530
1706
  }, [view, fetchOnto]);
1707
+ const fetchEcho = (0, import_react3.useCallback)(async () => {
1708
+ if (rpc === void 0) return;
1709
+ const token = ++seqRef.current;
1710
+ setEchoBusy(true);
1711
+ setError(null);
1712
+ try {
1713
+ const result = await rpc("inject-echo", { limit: 50 });
1714
+ if (token !== seqRef.current) return;
1715
+ if (!result.ok) {
1716
+ setError(result.error.message);
1717
+ return;
1718
+ }
1719
+ setEchoRows(result.value.items);
1720
+ const mem = await rpc("memory-list", { limit: 20 }).catch(() => ({ ok: false }));
1721
+ if (token !== seqRef.current) return;
1722
+ if (mem.ok) setMemoryView(mem.value);
1723
+ } catch (err) {
1724
+ if (token !== seqRef.current) return;
1725
+ setError(err instanceof Error ? err.message : String(err));
1726
+ } finally {
1727
+ setEchoBusy(false);
1728
+ }
1729
+ }, [rpc]);
1730
+ (0, import_react3.useEffect)(() => {
1731
+ if (view === "echo") void fetchEcho();
1732
+ }, [view, fetchEcho]);
1531
1733
  (0, import_react3.useEffect)(() => {
1532
1734
  if (refreshToken === void 0 || refreshToken === 0) return;
1533
1735
  reload();
1534
1736
  if (view === "week") void fetchWeek();
1535
1737
  if (view === "onto") void fetchOnto();
1738
+ if (view === "echo") void fetchEcho();
1536
1739
  }, [refreshToken]);
1537
1740
  const runBackfill = (0, import_react3.useCallback)(() => {
1538
1741
  if (rpc === void 0 || ontoBackfilling) return;
@@ -1593,7 +1796,8 @@ var __defProp = Object.defineProperty;
1593
1796
  (0, import_react3.createElement)("button", { key: "e", type: "button", style: active === "entries" ? BUTTON_ON_STYLE : BUTTON_STYLE3, onClick: () => setView("entries") }, copy["panel.recent"]),
1594
1797
  (0, import_react3.createElement)("button", { key: "t", type: "button", style: active === "topics" ? BUTTON_ON_STYLE : BUTTON_STYLE3, onClick: () => setView("topics") }, copy["topic.view"]),
1595
1798
  (0, import_react3.createElement)("button", { key: "w", type: "button", style: active === "week" ? BUTTON_ON_STYLE : BUTTON_STYLE3, onClick: () => setView("week") }, copy["rec.weekView"]),
1596
- (0, import_react3.createElement)("button", { key: "o", type: "button", style: active === "onto" ? BUTTON_ON_STYLE : BUTTON_STYLE3, onClick: () => setView("onto") }, copy["onto.tab"])
1799
+ (0, import_react3.createElement)("button", { key: "o", type: "button", style: active === "onto" ? BUTTON_ON_STYLE : BUTTON_STYLE3, onClick: () => setView("onto") }, copy["onto.tab"]),
1800
+ (0, import_react3.createElement)("button", { key: "h", type: "button", style: active === "echo" ? BUTTON_ON_STYLE : BUTTON_STYLE3, onClick: () => setView("echo") }, copy["rec.echo"])
1597
1801
  ];
1598
1802
  if (view === "week") {
1599
1803
  return (0, import_react3.createElement)(
@@ -1629,7 +1833,66 @@ var __defProp = Object.defineProperty;
1629
1833
  )
1630
1834
  );
1631
1835
  }
1836
+ if (view === "echo") {
1837
+ return (0, import_react3.createElement)(
1838
+ "div",
1839
+ { style: { display: "flex", flexDirection: "column", flex: "1 1 auto", minHeight: 0, colorScheme: "dark" } },
1840
+ (0, import_react3.createElement)(
1841
+ "header",
1842
+ { style: HEAD_STYLE2 },
1843
+ ...switchTabs("echo"),
1844
+ (0, import_react3.createElement)("button", { type: "button", style: BUTTON_STYLE3, onClick: () => void fetchEcho() }, copy["sea.refresh"])
1845
+ ),
1846
+ error !== null ? (0, import_react3.createElement)("p", { style: { margin: "8px 14px", color: "#ff9a9a", fontSize: 12 } }, `${copy["sea.loadFailed"]}: ${error}`) : null,
1847
+ // 生涯补充(v0.8):pinned 的心里话/约定——回响页也能调生涯记忆
1848
+ (memoryView?.life ?? []).some((row) => row.pinned) ? (0, import_react3.createElement)(
1849
+ "div",
1850
+ { style: { padding: "6px 14px", borderBottom: "1px solid rgba(120,160,255,.12)" } },
1851
+ (0, import_react3.createElement)("div", { style: { fontSize: 12, color: "#8e9ab5" } }, copy["echo.lifeNote"]),
1852
+ ...(memoryView?.life ?? []).filter((row) => row.pinned).map(
1853
+ (row) => (0, import_react3.createElement)("div", { key: row.id, style: { ...MUTED_STYLE3, marginTop: 2, whiteSpace: "pre-wrap" } }, `· ${row.text}`)
1854
+ )
1855
+ ) : null,
1856
+ echoRows.length === 0 && !echoBusy ? (0, import_react3.createElement)("p", { style: { margin: "18px 14px", ...MUTED_STYLE3 } }, copy["echo.empty"]) : (0, import_react3.createElement)(
1857
+ "div",
1858
+ { style: { overflowY: "auto", flex: "1 1 auto", minHeight: 0, padding: "8px 14px" } },
1859
+ ...echoRows.map((item) => (0, import_react3.createElement)(
1860
+ "div",
1861
+ { key: `${item.at}-${item.fingerprint}-${item.sessionId}`, style: { border: "1px solid rgba(120,160,255,.14)", borderRadius: 8, padding: "8px 10px", marginBottom: 8, background: "rgba(10,14,26,.45)" } },
1862
+ (0, import_react3.createElement)(
1863
+ "div",
1864
+ { style: { display: "flex", gap: 8, alignItems: "center", flexWrap: "wrap", fontSize: 12 } },
1865
+ (0, import_react3.createElement)("span", { style: { color: "#8e9ab5" } }, new Date(item.at).toLocaleString()),
1866
+ (0, import_react3.createElement)("span", { style: { color: item.kind === "injected" ? "#8fe0b0" : "#e8c07f" } }, item.kind === "injected" ? copy["echo.injected"] : `${copy["echo.skipped"]} · ${item.reason}`),
1867
+ item.kind === "injected" ? (0, import_react3.createElement)("span", { style: MUTED_STYLE3 }, `${item.bytes}B · ${copy["echo.fp"]} ${item.fingerprint.slice(0, 12)}`) : null,
1868
+ ...item.segments.map((seg) => (0, import_react3.createElement)("span", { key: seg.name, style: CUE_STYLE }, `${seg.name} ${seg.lines}`))
1869
+ ),
1870
+ item.text !== "" ? (0, import_react3.createElement)("div", { style: { marginTop: 6, fontSize: 13, lineHeight: 1.6, whiteSpace: "pre-wrap", color: "#e8eeff" } }, item.text) : null
1871
+ ))
1872
+ )
1873
+ );
1874
+ }
1632
1875
  if (view === "onto") {
1876
+ const memGroup = (title, rows2) => (0, import_react3.createElement)(
1877
+ "div",
1878
+ { key: title, style: { marginTop: 10 } },
1879
+ (0, import_react3.createElement)("div", { style: { fontSize: 12, color: "#8e9ab5" } }, `${title}(${rows2.length})`),
1880
+ rows2.length === 0 ? (0, import_react3.createElement)("div", { style: { ...MUTED_STYLE3, marginTop: 4 } }, copy["memory.empty"]) : (0, import_react3.createElement)(
1881
+ "ul",
1882
+ { style: LIST_STYLE2 },
1883
+ ...rows2.map((row) => (0, import_react3.createElement)(
1884
+ "li",
1885
+ { key: row.id, style: ITEM_STYLE2 },
1886
+ (0, import_react3.createElement)(
1887
+ "div",
1888
+ { style: { display: "flex", gap: 6, alignItems: "center", flexWrap: "wrap" } },
1889
+ (0, import_react3.createElement)("span", { style: BADGE_STYLE2 }, row.kind),
1890
+ row.pinned ? (0, import_react3.createElement)("span", { style: CUE_STYLE }, copy["memory.pinned"]) : null
1891
+ ),
1892
+ (0, import_react3.createElement)("div", { style: { fontSize: 13, lineHeight: 1.6, color: "#e8eeff", marginTop: 4, whiteSpace: "pre-wrap" } }, row.text)
1893
+ ))
1894
+ )
1895
+ );
1633
1896
  const innerTab = (k, label) => (0, import_react3.createElement)("button", { key: k, type: "button", style: ontoTab === k ? BUTTON_ON_STYLE : BUTTON_STYLE3, onClick: () => {
1634
1897
  setOntoTab(k);
1635
1898
  setOntoDetail(null);
@@ -1637,7 +1900,7 @@ var __defProp = Object.defineProperty;
1637
1900
  setOntoQueryInput("");
1638
1901
  void fetchOnto();
1639
1902
  } }, label);
1640
- const empty = ontoTab === "tasks" ? ontoTasks.length === 0 : ontoTab === "entities" ? ontoEntities.length === 0 : ontoEvals.length === 0;
1903
+ const empty = ontoTab === "tasks" ? ontoTasks.length === 0 : ontoTab === "entities" ? ontoEntities.length === 0 : ontoTab === "memory" ? memoryView === null || memoryView.life.length + memoryView.work.length + memoryView.diary.length + memoryView.goals.length === 0 : ontoEvals.length === 0;
1641
1904
  return (0, import_react3.createElement)(
1642
1905
  "div",
1643
1906
  { style: { display: "flex", flexDirection: "column", flex: "1 1 auto", minHeight: 0, colorScheme: "dark" } },
@@ -1648,6 +1911,7 @@ var __defProp = Object.defineProperty;
1648
1911
  innerTab("tasks", copy["onto.tasks"]),
1649
1912
  innerTab("entities", copy["onto.entities"]),
1650
1913
  innerTab("feedback", copy["onto.feedback"]),
1914
+ innerTab("memory", copy["onto.memory"]),
1651
1915
  ontoTab === "feedback" ? null : (0, import_react3.createElement)("input", {
1652
1916
  key: "onto-q",
1653
1917
  style: { ...INPUT_STYLE2, width: 160 },
@@ -1728,7 +1992,7 @@ var __defProp = Object.defineProperty;
1728
1992
  (0, import_react3.createElement)("button", { type: "button", style: { ...BUTTON_STYLE3, marginTop: 6 }, onClick: () => openEntity(entity) }, copy["sea.detail"])
1729
1993
  )
1730
1994
  )
1731
- ) : (0, import_react3.createElement)(
1995
+ ) : ontoTab === "feedback" ? (0, import_react3.createElement)(
1732
1996
  "ul",
1733
1997
  { style: LIST_STYLE2 },
1734
1998
  ontoEvals.map(
@@ -1749,6 +2013,15 @@ var __defProp = Object.defineProperty;
1749
2013
  )
1750
2014
  )
1751
2015
  )
2016
+ ) : (0, import_react3.createElement)(
2017
+ "div",
2018
+ { style: { padding: "4px 14px 18px", overflowY: "auto", flex: "1 1 auto", minHeight: 0 } },
2019
+ ...memoryView === null ? [(0, import_react3.createElement)("p", { style: MUTED_STYLE3 }, copy["memory.empty"])] : [
2020
+ memGroup(copy["memory.life"], memoryView.life.map((m) => ({ id: m.id, kind: m.kind, text: m.text, pinned: m.pinned }))),
2021
+ memGroup(copy["memory.work"], memoryView.work.map((m) => ({ id: m.id, kind: m.kind, text: m.text, pinned: m.pinned }))),
2022
+ memGroup(copy["memory.goals"], memoryView.goals.map((g) => ({ id: g.id, kind: g.status, text: g.title, pinned: false }))),
2023
+ memGroup(copy["memory.diary"], memoryView.diary.map((m) => ({ id: m.id, kind: m.kind, text: m.text, pinned: m.pinned })))
2024
+ ]
1752
2025
  )
1753
2026
  );
1754
2027
  }
@@ -3745,7 +4018,7 @@ var __defProp = Object.defineProperty;
3745
4018
  // DRSC 短提示(v0.3.3):只在 warn 时出现(skipped 是中性无据不进故障提示);
3746
4019
  // 完整指引在设置卡,这里只指路不开第二份 banner(两处文案不一致是最难对账的债)。
3747
4020
  graph?.drscVerdict === "warn" ? (0, import_react6.createElement)("p", { style: { margin: "6px 14px", ...MUTED_STYLE5, color: "#ffca7a" } }, copy["drscHint.seaShort"]) : null,
3748
- tab === "persona" ? (0, import_react6.createElement)("div", { style: { flex: "1 1 auto", overflowY: "auto" } }, (0, import_react6.createElement)(SeaPersona, { rpc })) : tab === "records" ? (0, import_react6.createElement)("div", { style: { flex: "1 1 auto", minHeight: 0, display: "flex" } }, (0, import_react6.createElement)(SeaRecords, { rpc, refreshToken })) : tab === "dream" ? (0, import_react6.createElement)("div", { style: { flex: "1 1 auto", overflowY: "auto" } }, (0, import_react6.createElement)(SeaDream, { rpc })) : (0, import_react6.createElement)(
4021
+ tab === "persona" ? (0, import_react6.createElement)("div", { style: { flex: "1 1 auto", overflowY: "auto" } }, (0, import_react6.createElement)(SeaPersona, { rpc, sessionId: seatSessionId })) : tab === "records" ? (0, import_react6.createElement)("div", { style: { flex: "1 1 auto", minHeight: 0, display: "flex" } }, (0, import_react6.createElement)(SeaRecords, { rpc, refreshToken })) : tab === "dream" ? (0, import_react6.createElement)("div", { style: { flex: "1 1 auto", overflowY: "auto" } }, (0, import_react6.createElement)(SeaDream, { rpc })) : (0, import_react6.createElement)(
3749
4022
  "div",
3750
4023
  { style: BODY_STYLE },
3751
4024
  points.length === 0 && error === null ? (0, import_react6.createElement)("p", { style: { margin: "18px 14px", ...MUTED_STYLE5 } }, copy["sea.empty"]) : (0, import_react6.createElement)(SeaView, {