dsh-session-superagent 0.9.23 → 0.9.25

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,51 @@
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.25] - 2026-11-02 —— 首次演练脚本一跑,就抓到唤醒消息里的重复条目
6
+
7
+ ### 新增:`scripts/first-run.mjs`
8
+ 不需要宿主、不需要 gh,用 `lib/watch.js` 的真实函数把
9
+ 「轮询 → 挑批 → 唤醒消息 → 面板 → 异常文案」完整跑一遍并打印。
10
+ 任何人(包括我改文案时)都能直接看到客户会读到什么。
11
+
12
+ ### 它当场抓到的 bug
13
+ 唤醒消息里同一条出现两次:
14
+ ```
15
+ #77 [open] 修复表头错位 … (PR)
16
+ 【为什么是这几条】本轮共 3 条变化;按「最近更新」取前 2 条
17
+ (另有 1 条:#77,处理完这批再看) ← 已在上面的列表里
18
+ ```
19
+
20
+ 根因:剩余写成 `fresh.slice(listed.length)`,而 `batchFresh` 会**按优先级重排**,
21
+ 切片拿到的是原始顺序的尾巴,里面可能包含已选中的条目。
22
+
23
+ ### 改法
24
+ 抽出 `splitBatch(fresh, limit, priority)` → `{ listed, rest }`,用**编号差集**算剩余;
25
+ 产品与演练脚本都改用它。用例锁死:两边加起来等于全部、且不重叠。
26
+
27
+ ### 测试
28
+ - 新增 1 例。合计 **168 例**。
29
+
30
+ ## [0.9.24] - 2026-11-02 —— KB 里的文件路径也交叉验证,抓到 1 个真实漂移
31
+
32
+ ### 做法(延续上一条"KB 要能被审计")
33
+ 审计脚本再扫一遍 KB 里形如 `scripts/…` / `lib/…` / `docs/…` 的路径,逐个 `existsSync`。
34
+
35
+ ### 实测
36
+ ```
37
+ 提到的文件路径 26 个
38
+ FAIL 这些路径在仓库里不存在(重构后忘了改 KB):
39
+ docs/UPDATING.md <- docs-four-kinds.md
40
+ PASS KB 提到的每个文件路径都真实存在(修正后)
41
+ ```
42
+ `UPDATING.md` 真实位置是**仓库根目录**,KB 里多写了 `docs/` 前缀 ——
43
+ 这种错客户照着找会直接掉进死胡同。
44
+
45
+ (顺带把自己也修了一遍:审计文档里描述这条错误时又写了一次该路径,导致自检红;改成描述性说法。)
46
+
47
+ ### 门禁
48
+ 已并入 `preflight --fast` 的「知识库有据」一项,输出改为同时包含 ✅ 与路径两项结论。
49
+
5
50
  ## [0.9.23] - 2026-11-02 —— 知识库的 ✅ 现在要能被 CHANGELOG 交叉验证
6
51
 
7
52
  ### 学到的(知识库第 72 条)
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.23-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.25-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.23'
17
+ const CLIENT_VERSION = '0.9.25'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
package/lib/index.js CHANGED
@@ -28,12 +28,13 @@ import {
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
30
  countCapped,
31
+ splitBatch,
31
32
  mergeFilters, mergePollResult, mergeWakeTexts, pushEvent, silentStreak, msUntilActiveWindow, nextWaketimeAt, pruneSeen, sessionWakesLastHour, pruneWakeTimes, pushHistory, recordReported, staleWorktrees, worktreePlan,
32
33
  } from './watch.js'
33
34
 
34
35
  export const name = 'dsh-session-superagent'
35
36
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
36
- export const SERVER_VERSION = '0.9.23'
37
+ export const SERVER_VERSION = '0.9.25'
37
38
  export const inject = ['tools', 'agents', 'webServer']
38
39
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
39
40
  const DEFAULT_SESSION_WAKES = 12
@@ -937,8 +938,7 @@ async function pollOnce(ctx, entry, baseMs) {
937
938
 
938
939
  // 条目不丢:水位照常全部前移,消息里只铺开前 N 条,其余给编号
939
940
  const limit = Math.max(1, Number(entry.batchLimit) || 5)
940
- const listed = batchFresh(fresh, limit, entry.priority)
941
- const rest = fresh.slice(listed.length)
941
+ const { listed, rest } = splitBatch(fresh, Number(entry.batchLimit) || 3, entry.priorityOrder || entry.priority)
942
942
  // 暂停/删除可能发生在这一轮轮询期间:以盘上为准
943
943
  const liveEntry = (readState().watchers || {})[entry.id]
944
944
  if (!liveEntry || liveEntry.enabled === false) {
package/lib/watch.js CHANGED
@@ -736,3 +736,17 @@ export function countCapped(watchers) {
736
736
  const list = Array.isArray(watchers) ? watchers : Object.values(watchers || {})
737
737
  return list.filter((w) => w && CAP_REASONS.includes(w.deferReason)).length
738
738
  }
739
+
740
+ /**
741
+ * 把一批新条目拆成「这次唤醒的」和「剩下的」。
742
+ *
743
+ * 为什么单独成一个函数:剩余绝不能写成 `fresh.slice(listed.length)` ——
744
+ * `batchFresh` 会按优先级重排,切片会把已经选中的条目又算进剩余,
745
+ * 于是唤醒消息里会出现「#77 …(另有 1 条:#77)」这种重复(首次演练脚本抓到过)。
746
+ */
747
+ export function splitBatch(fresh, limit = 3, priority) {
748
+ const listed = batchFresh(fresh, limit, priority)
749
+ const picked = new Set(listed.map((item) => item.number))
750
+ const rest = (Array.isArray(fresh) ? fresh : []).filter((item) => !picked.has(item.number))
751
+ return { listed, rest }
752
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.23",
3
+ "version": "0.9.25",
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",