dsh-galatea 0.3.7 → 0.3.8

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 (2) hide show
  1. package/lib/beat-tool.js +50 -1
  2. package/package.json +1 -1
package/lib/beat-tool.js CHANGED
@@ -38,6 +38,44 @@ export function snapshotAgents(agentsService) {
38
38
  * @param {() => object} deps.loadState
39
39
  * @param {object} [deps.config]
40
40
  */
41
+ /**
42
+ * 它记得什么 —— 给「人」看的一份。
43
+ *
44
+ * 正文不进这里(那是这个插件唯一的设计判断:正文只在被问到的时候才读)。
45
+ * 只列 id 和标题,按新到旧。
46
+ *
47
+ * 末尾那行同时回答两个问题:
48
+ * 用户问「它背着我记了什么」⟹ 给总条数
49
+ * 它自己问「有没有东西值得去说」⟹ 给还没说过的条数
50
+ * 这两个问题共用一行,是因为它们本来就是同一件事的两面。
51
+ */
52
+ function journalMemory(entries, pending) {
53
+ const list = Array.isArray(entries) ? entries : [];
54
+ if (list.length === 0) {
55
+ return '(一条都没有。要它记事,让它调 galatea_remember。)';
56
+ }
57
+
58
+ const MAX = 10;
59
+ const shown = list
60
+ .slice()
61
+ .sort((a, b) => String(b.id).localeCompare(String(a.id)))
62
+ .slice(0, MAX);
63
+
64
+ const lines = shown.map((e) => {
65
+ const t = String(e.title ?? '').trim();
66
+ return `${e.id} ${t.length > 40 ? `${t.slice(0, 40)}…` : t}`;
67
+ });
68
+ if (list.length > MAX) lines.push(`…… 还有 ${list.length - MAX} 条`);
69
+
70
+ lines.push('');
71
+ lines.push(
72
+ typeof pending === 'number' && pending > 0
73
+ ? `共 ${list.length} 条,其中 ${pending} 条还没跟人说过`
74
+ : `共 ${list.length} 条,都说过了`,
75
+ );
76
+ return lines.join('\n');
77
+ }
78
+
41
79
  export function makeBeatTool(deps) {
42
80
  return defineTool({
43
81
  name: 'galatea_beat',
@@ -84,7 +122,15 @@ export function makeBeatTool(deps) {
84
122
  });
85
123
 
86
124
  const material = entries.find((e) => e.id === r.materialId) ?? null;
87
- const picked = material ?? pickMaterial(entries, state.lastSpokeAt ?? null).entry;
125
+ const mat = pickMaterial(entries, state.lastSpokeAt ?? null);
126
+ const picked = material ?? mat.entry;
127
+
128
+ // 它现在记得什么 —— 给「人」看的那一份。
129
+ // 之前只有 galatea_recall 能列标题,而那是给 Agent 用的工具;
130
+ // 用户想确认「它背着我记了什么」,只能自己去翻 Markdown 目录。
131
+ // 末尾那个「还没说过的」不只是统计:它同时回答两个问题 ——
132
+ // 用户问「它记了什么」,我问「有没有东西值得去说」。
133
+ const memoryLines = journalMemory(entries, mat.pending);
88
134
 
89
135
  // 给人看的那几行:把它自己最近的决定翻成人话。
90
136
  const journal = renderJournal(state, { quietRounds: liveCfg.quietRounds });
@@ -121,6 +167,9 @@ export function makeBeatTool(deps) {
121
167
  lines.push(' (所以上面的「最近几次」不会长,节奏类规则也不会生效)');
122
168
  }
123
169
  lines.push('');
170
+ lines.push('—— 它记得的这些 ——');
171
+ lines.push(memoryLines);
172
+ lines.push('');
124
173
  lines.push('—— 最近几次 ——');
125
174
  lines.push(journal);
126
175
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-galatea",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Galatea — memory, heartbeat and continuity for DeepSeek Harness agents.",
5
5
  "repository": {
6
6
  "type": "git",