dsh-galatea 0.4.6 → 0.4.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.
package/README.md CHANGED
@@ -187,6 +187,22 @@
187
187
  关着(0)也照常装定时器 —— 否则用户从 0 改成 5 的时候没人去装,又回到同一个坑。
188
188
  代价是每分钟空醒一次,读一个数字比大小。
189
189
 
190
+ ### 刚记下的事,不会马上被提起
191
+
192
+ 这是设计,不是缺陷 —— 但必须说清楚,否则用户会一直等一件不会发生的事。
193
+
194
+ `hasHardMaterial` 这一版没有判据,所以「有素材」不等于「必须说」。
195
+ 在接上真正的硬素材(承诺到期、上次没说完的)之前,自动心跳只有两条路开口:
196
+
197
+ - 掷色子中(`dice`,默认 0.15)
198
+ - 连续 `quietRounds` 轮没开口,撞到下限保护(默认 8 轮)
199
+
200
+ 所以「我刚记了一件事,它应该会跟我提」——这一版不成立。
201
+ 素材只让它「有东西可说」,说不说还是门控的事。
202
+
203
+ (同理,日志里那句「有素材,这次没掷中」和「记忆里一条都没有」是两件事。
204
+ 前者什么都别做,后者去记一条。)
205
+
190
206
  ## 三条教训:粒度、上限、旧数据
191
207
 
192
208
  ### 一 · 天粒度和秒粒度不能比较
@@ -262,7 +278,7 @@ $DSH_HOME/galatea/heartbeat-state.json # 心跳状态账本
262
278
  ## 本地开发
263
279
 
264
280
  ```bash
265
- npm test # 107 条,不依赖 DSH,纯 node
281
+ npm test # 109 条,不依赖 DSH,纯 node
266
282
  ```
267
283
 
268
284
  装了之后验证它真的加载了,只看一个东西:
@@ -283,7 +299,7 @@ dsh plugin add dsh-galatea
283
299
  或者在 profile 的 `package.json` 里手写:
284
300
 
285
301
  ```json
286
- "dependencies": { "dsh-galatea": "0.4.6" }
302
+ "dependencies": { "dsh-galatea": "0.4.7" }
287
303
  ```
288
304
 
289
305
  **版本号钉死,不要写 `^`。** 同一个版本号指向两个不同的包,以后就说不清你装的是哪一份。
package/lib/beat-tool.js CHANGED
@@ -143,7 +143,20 @@ export function makeBeatTool(deps) {
143
143
  let committed = null;
144
144
  let saveError = null;
145
145
  try {
146
- committed = commitDecision(state, { speak: r.speak, reason: r.reason, detail: r.detail }, new Date());
146
+ // 手动档是「看一眼」,不是「跳一次」。
147
+ //
148
+ // 它照常记账(decisions 会多一条,quietStreak 也照实算),
149
+ // 但**不推进 lastBeatAt** —— 否则用户每查一次状态,自动心跳就往后推一个
150
+ // minGap(默认 20 分钟)。连查三次,一小时内不会真正判定,
151
+ // 而用户完全不知道,只会觉得「它怎么不动了」。
152
+ //
153
+ // 这一条是外面的人真机测出来的:18:37 手动 beat,19:08 才跨过 minGap。
154
+ committed = commitDecision(
155
+ state,
156
+ { speak: r.speak, reason: r.reason, detail: r.detail },
157
+ new Date(),
158
+ { manual: true },
159
+ );
147
160
  saveState(committed, stateFile());
148
161
  } catch (err) {
149
162
  // 失败必须让人看见。
package/lib/beat.js CHANGED
@@ -47,7 +47,7 @@ export function planBeat(input) {
47
47
  const material = pickMaterial(input.entries ?? [], state.lastSpokeAt ?? null);
48
48
  if (!material.entry) {
49
49
  return no(
50
- material.reason === 'noEntries' ? 'noMaterial' : 'nothingNew',
50
+ material.reason === 'noEntries' ? 'noEntries' : 'nothingNew',
51
51
  material.reason === 'noEntries'
52
52
  ? '记忆里一条可用的都没有 —— 没有出处的话不说'
53
53
  : '写了的东西都说过了 —— 没有新的就不开口',
@@ -103,7 +103,10 @@ export function commitDecision(state, decision, now = new Date(), opts = {}) {
103
103
  //
104
104
  // 默认 true:老调用点(不带这个字段的)行为不变,不会因为升级而卡住。
105
105
  if (decision.touchBeat !== false) {
106
- next.lastBeatAt = at;
106
+ // 手动档(galatea_beat)也算一次判定 —— 它确实问了一遍「要不要说」,
107
+ // 所以 quietStreak 照涨。但它不该推进 lastBeatAt:那是**自动节奏**的基准,
108
+ // 手动查一次状态就把后台往后推 20 分钟,用户完全看不出来。
109
+ if (opts.manual !== true) next.lastBeatAt = at;
107
110
  next.quietStreak = decision.speak ? 0 : (state.quietStreak ?? 0) + 1;
108
111
  }
109
112
  if (decision.speak) next.lastSpokeAt = at;
package/lib/heartbeat.js CHANGED
@@ -186,10 +186,13 @@ export function decide(input) {
186
186
  if (r < cfg.dice) {
187
187
  return { speak: true, reason: 'dice', detail: `色子 ${r.toFixed(3)} < ${cfg.dice}`, touchBeat: true };
188
188
  }
189
+ // 名字要准:这次「不说」不是因为没素材 —— 素材层早就给出结论了。
190
+ // 是「有东西可说,但这次没掷中」。叫 noMaterial 会让 journal 翻成
191
+ // 「记忆里没有可用的东西」,用户第一反应是去查库是不是没存上。
189
192
  return {
190
193
  speak: false,
191
- reason: 'noMaterial',
192
- detail: `没硬素材,色子 ${r.toFixed(3)} ≥ ${cfg.dice}`,
194
+ reason: 'notChosen',
195
+ detail: `有素材,但这次色子 ${r.toFixed(3)} ≥ ${cfg.dice}`,
193
196
  touchBeat: true,
194
197
  };
195
198
  }
@@ -203,4 +206,4 @@ function toMs(v) {
203
206
  }
204
207
 
205
208
  /** 所有可能的 reason —— 用来保证「没有第七种情况」。 */
206
- export const REASONS = ['quiet', 'tooSoon', 'cooldown', 'hard', 'floor', 'dice', 'noMaterial'];
209
+ export const REASONS = ['quiet', 'tooSoon', 'cooldown', 'hard', 'floor', 'dice', 'notChosen'];
package/lib/journal.js CHANGED
@@ -23,9 +23,16 @@ export const REASON_TEXT = {
23
23
  hard: '有具体的事要说',
24
24
  floor: '太久没开口,这次强制说一句',
25
25
  dice: '随机决定要说',
26
- noMaterial: '记忆里没有可用的东西',
26
+ // 「没说」的三种必须分得开 —— 用户看到之后该做什么,三种完全不同:
27
+ // noEntries → 去记一条
28
+ // notChosen → 什么都不用做,这次没掷中
29
+ // nothingNew → 去记一条新的
30
+ noEntries: '记忆里一条都没有',
31
+ notChosen: '有素材,这次没掷中',
27
32
  nothingNew: '记下的都说过了',
28
33
  noHuman: '没有正在进行的对话',
34
+ // 旧账本里躺着的名字。0.4.7 之前,上面 noEntries 和 notChosen 都被记成 noMaterial。
35
+ noMaterial: '(旧版)没有可用的素材',
29
36
  };
30
37
 
31
38
  /** HH:MM,本地时区。认不出的时间原样标出来,不替它猜一个像样的值。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-galatea",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Galatea — memory, heartbeat and continuity for DeepSeek Harness agents.",
5
5
  "repository": {
6
6
  "type": "git",