dsh-galatea 0.3.6 → 0.3.7

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 +13 -1
  2. package/package.json +2 -2
package/lib/beat-tool.js CHANGED
@@ -13,6 +13,7 @@ import { defineTool } from '@deepseek-ai/dsh-tools';
13
13
  import { planBeat } from './beat.js';
14
14
  import { pickMaterial } from './material.js';
15
15
  import { renderJournal } from './journal.js';
16
+ import { commitDecision, saveState, stateFile } from './heartbeat-runner.js';
16
17
 
17
18
  /**
18
19
  * 把 agents 服务里的 live agent 统一成 { id, header }。
@@ -94,11 +95,17 @@ export function makeBeatTool(deps) {
94
95
  // 用户会得出「它每次都说话」的错误印象。
95
96
  // 写进去之后,手动跑一次就真的等于走了一次心跳。
96
97
  let committed = null;
98
+ let saveError = null;
97
99
  try {
98
100
  committed = commitDecision(state, { speak: r.speak, reason: r.reason, detail: r.detail }, new Date());
99
101
  saveState(committed, stateFile());
100
102
  } catch (err) {
101
- console.warn('[galatea] 心跳账本落盘失败:', err && err.message);
103
+ // 失败必须让人看见。
104
+ // 这几行原来只有 console.warn —— 宿主里看不到 warn 就等于没有,
105
+ // 于是账本从 0.3.0 起一直没写成功过,而工具每次返回都正常,
106
+ // 用户以为「它跑过了,只是还没到该说话的时候」。
107
+ saveError = (err && err.message) || String(err);
108
+ console.warn('[galatea] 心跳账本落盘失败:', saveError);
102
109
  }
103
110
 
104
111
  const lines = [];
@@ -108,6 +115,11 @@ export function makeBeatTool(deps) {
108
115
  if (r.switched) lines.push(`⚠ 换了目标会话:${r.previous} → ${r.sessionId}(连续在这里断过一次)`);
109
116
  if (picked) lines.push(`由头:${picked.id} ${picked.title}`);
110
117
  if (r.prompt) lines.push(`会带着这段由头开口:\n${r.prompt}`);
118
+ if (saveError) {
119
+ lines.push('');
120
+ lines.push(`⚠ 这次的心跳没有记进账本:${saveError}`);
121
+ lines.push(' (所以上面的「最近几次」不会长,节奏类规则也不会生效)');
122
+ }
111
123
  lines.push('');
112
124
  lines.push('—— 最近几次 ——');
113
125
  lines.push(journal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-galatea",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Galatea — memory, heartbeat and continuity for DeepSeek Harness agents.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "node": ">=20.18"
22
22
  },
23
23
  "scripts": {
24
- "test": "node --test test/store.test.mjs test/apply.test.mjs test/tools.test.mjs test/heartbeat.test.mjs test/heartbeat-runner.test.mjs test/target.test.mjs test/material.test.mjs test/beat.test.mjs test/contract.test.mjs test/journal.test.mjs"
24
+ "test": "node --test test/store.test.mjs test/apply.test.mjs test/tools.test.mjs test/heartbeat.test.mjs test/heartbeat-runner.test.mjs test/target.test.mjs test/material.test.mjs test/beat.test.mjs test/contract.test.mjs test/journal.test.mjs test/tool-execute.test.mjs"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@deepseek-ai/dsh-tools": "*",