dsh-session-superagent 0.9.10 → 0.9.11

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
@@ -2,6 +2,27 @@
2
2
 
3
3
  格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.9.11] - 2026-11-02 —— "叫醒了但没回音"现在看得见了
6
+
7
+ ### 学到的(知识库第 60 条)
8
+ RabbitMQ 的 ack 语义:**投递成功不代表处理完成**,消费者必须显式 ack。
9
+ <https://www.rabbitmq.com/docs/confirms>
10
+
11
+ 搬过来就是:`wake()` 成功只说明消息进了会话,真正"处理了"的证据是后来出现 `watch_ack`。
12
+
13
+ ### 原盲区
14
+ `wakeTimes` 一直在涨、面板显示"唤醒过 N 次",看起来正常。
15
+ 但客户真实遇到的是「守在工作、消息也进去了、会话没动手」——
16
+ 因为仓库 `AGENTS.md` 没给规则。现有指标**完全看不到**。
17
+
18
+ ### 改法
19
+ `silentStreak`:上一次唤醒之后有 ack → 清零;没有 → +1;ack 在唤醒之前不算。
20
+ 连续 ≥2 次时面板「需要关注」提示:
21
+ > repo 已连续 3 次唤醒后没有回音(没看到 watch_ack)—— 检查这个仓库的 AGENTS.md
22
+
23
+ ### 测试
24
+ - 新增 1 例(6 种情况)。合计 **155 例**。
25
+
5
26
  ## [0.9.10] - 2026-11-02 —— 事件带上「持续了多久」
6
27
 
7
28
  ### 补的是上一轮自己记下的缺口
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <img src="assets/icon-180.png" width="88" height="88" alt="">
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
- [![Version](https://img.shields.io/badge/version-0.9.10-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.11-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
7
7
  [![npm](https://img.shields.io/npm/v/dsh-session-superagent.svg)](https://www.npmjs.com/package/dsh-session-superagent)
8
8
  [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-plugin-orange.svg)](https://github.com/topics/dsh-plugin)
9
9
 
package/client.js CHANGED
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
14
14
  const { useCallback, useEffect, useRef, useState } = React
15
15
 
16
16
  // 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
17
- const CLIENT_VERSION = '0.9.10'
17
+ const CLIENT_VERSION = '0.9.11'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -1109,6 +1109,13 @@ window.__ModuleLoader__.load({
1109
1109
  for (const watcher of watchers) {
1110
1110
  // 仓库结构问题(关闭 Issues / 是 fork)比轮询失败更早该说:它注定收不到条目
1111
1111
  const structure = repoStructureNote(watcher.repoAccess)
1112
+ // 叫醒了但没回音:守在工作、消息也进去了,但会话没动手(规则缺失或被忽略)
1113
+ if (Number(watcher.silentWakes) >= 2) {
1114
+ problems.push({
1115
+ key: 'silent-' + watcher.repo,
1116
+ text: watcher.repo + ' 已连续 ' + watcher.silentWakes + ' 次唤醒后没有回音(没看到 watch_ack)—— 检查这个仓库的 AGENTS.md 有没有给出处理规则',
1117
+ })
1118
+ }
1112
1119
  // 被反复重开的条目:说明"之前判过不做"可能有问题,值得人看一眼
1113
1120
  if (watcher.lastReopened) {
1114
1121
  problems.push({ key: 'r-' + watcher.repo, text: watcher.repo + ' #' + watcher.lastReopened + ' 被重新打开过 —— 之前判"不做"可能不对' })
package/lib/index.js CHANGED
@@ -27,12 +27,12 @@ import {
27
27
  advanceSeen, applyWatcherAction, batchFresh, decideWake, DEFAULT_ACK_LABEL, formatWatchText,
28
28
  TRIAGE_SIGNALS, accessNote, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, pushFiltered, normalizeFilters, partitionItems, passesFilters,
29
29
  shouldRunCleanup,
30
- mergeFilters, mergePollResult, mergeWakeTexts, pushEvent, msUntilActiveWindow, nextWaketimeAt, pruneSeen, sessionWakesLastHour, pruneWakeTimes, pushHistory, recordReported, staleWorktrees, worktreePlan,
30
+ mergeFilters, mergePollResult, mergeWakeTexts, pushEvent, silentStreak, msUntilActiveWindow, nextWaketimeAt, pruneSeen, sessionWakesLastHour, pruneWakeTimes, pushHistory, recordReported, staleWorktrees, worktreePlan,
31
31
  } from './watch.js'
32
32
 
33
33
  export const name = 'dsh-session-superagent'
34
34
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
35
- export const SERVER_VERSION = '0.9.10'
35
+ export const SERVER_VERSION = '0.9.11'
36
36
  export const inject = ['tools', 'agents', 'webServer']
37
37
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
38
38
  const DEFAULT_SESSION_WAKES = 12
@@ -1001,6 +1001,14 @@ async function pollOnce(ctx, entry, baseMs) {
1001
1001
  reason: result.ok ? null : String(result.reason || '').slice(0, 120),
1002
1002
  })
1003
1003
  if (result.ok) {
1004
+ // 上一次唤醒之后有没有 ack?没有就累计"叫醒了没回音"
1005
+ entry.silentWakes = silentStreak({
1006
+ previousWakeAt: entry.prevWakeAt,
1007
+ lastAckedAt: entry.lastAcked && entry.lastAcked.at,
1008
+ previousStreak: entry.silentWakes,
1009
+ })
1010
+ if (entry.silentWakes === 0 && entry.prevWakeAt) noteEvent(entry, 'acked', '上一次唤醒有回音(ack 出现过了)')
1011
+ entry.prevWakeAt = new Date().toISOString()
1004
1012
  entry.wakeTimes.push(Date.now())
1005
1013
  entry.lastDeferred = null
1006
1014
  noteEvent(entry, 'wake', '唤醒了 ' + (entry.lastBatch || []).length + ' 条:' + (entry.lastBatch || []).map((n) => '#' + n).join(' '))
@@ -1209,6 +1217,7 @@ export function apply(ctx) {
1209
1217
  maxIsolated: w.maxIsolated ?? 5,
1210
1218
  history: (w.history ?? []).slice(-5),
1211
1219
  events: (w.events ?? []).slice(-20),
1220
+ silentWakes: w.silentWakes ?? 0,
1212
1221
  note: w.goal ?? '',
1213
1222
  title: sessionTitle(w.sessionId),
1214
1223
  }))
package/lib/watch.js CHANGED
@@ -670,3 +670,26 @@ export function durationText(sinceIso, untilIso) {
670
670
  const rest = minutes % 60
671
671
  return rest > 0 ? hours + ' 小时 ' + rest + ' 分' : hours + ' 小时'
672
672
  }
673
+
674
+ /**
675
+ * "叫醒了但没回音"的连续次数。
676
+ *
677
+ * 为什么值得统计:唤醒只保证**消息送到了**,不保证**有人动手**。
678
+ * 客户最容易遇到的情况恰恰是"守在工作、消息也进去了,但会话没处理" ——
679
+ * 因为仓库的 AGENTS.md 没给规则、或者任务书里的完成标准被忽略。
680
+ * 这类问题在现有指标里完全看不到(wake 计数还在涨)。
681
+ *
682
+ * 判据:上一次唤醒之后有没有出现过 ack:
683
+ * - 有 ack → 连续次数清零;
684
+ * - 没有 → 次数 +1。
685
+ * 依据(ack 语义):RabbitMQ 的 consumer acknowledgement —— 投递成功不代表处理完成,
686
+ * 必须由消费者显式 ack 才能确认。(https://www.rabbitmq.com/docs/confirms)
687
+ */
688
+ export function silentStreak({ previousWakeAt, lastAckedAt, previousStreak = 0 } = {}) {
689
+ const streak = Math.max(0, Number(previousStreak) || 0)
690
+ const wakeAt = Date.parse(String(previousWakeAt || ''))
691
+ if (!Number.isFinite(wakeAt)) return streak // 还没唤醒过:保持原状
692
+ const ackAt = Date.parse(String(lastAckedAt || ''))
693
+ if (Number.isFinite(ackAt) && ackAt >= wakeAt) return 0
694
+ return streak + 1
695
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",