dsh-session-superagent 0.9.171 → 0.9.172

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,42 @@
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.172] - 2026-11-04 —— 真机第一轮唤醒就炸:`iso is not defined`
6
+
7
+ ### 现场(你截图的那条红色「异常」)
8
+ 给本仓库新建一条守之后,第一次真正要走「发唤醒消息」时,
9
+ 面板直接红 `iso is not defined`。
10
+
11
+ ### 根因
12
+ `lib/index.js` 的 `criteria: [...]` 里写着:
13
+
14
+ ```js
15
+ iso && iso.dir ? '回写到哪:推分支并开 PR…' : '回写到哪:在 issue 里留言…'
16
+ ```
17
+
18
+ 而那个作用域里的变量叫 **`isolation`**(上一行 `const isolation = await prepareIsolation(entry)`),
19
+ 从来没有 `iso`。所以只要真的走到"构造唤醒文本"这一步就抛 ReferenceError。
20
+
21
+ **为什么一直没被发现**:老那条守(dsh-go)长期停在 304 / 会话忙的提前 return 上,
22
+ 永远到不了这一行;而 269 个用例里没有一个覆盖"pollOnce 走到发消息"的完整路径。
23
+ 新建守 + 仓库真有新条目 = 第一次踩中。
24
+
25
+ ### 改法
26
+ 把三条完成标准抽成纯函数 `wakeCriteria({ isolation })`(`lib/watch.js`),`index.js` 调用它。
27
+ 这样这段逻辑第一次有了**能直接覆盖的入口**,而不是埋在 400 行 pollOnce 中间。
28
+
29
+ ### 测试
30
+ - 新:`wakeCriteria` 有/无隔离区两条分支都对(无隔离区时**不许**说"推分支");
31
+ - 新:静态守卫 —— `lib/index.js` 里出现裸 `iso` 标识符即失败(注释里出现不算)。
32
+
33
+ 合计 **269 例**。
34
+
35
+ ### 修复后的真机验证
36
+ ```
37
+ POST /watch {action:'poll', id:'MYCF711/dsh-session-superagent#…'}
38
+ → 202;下一轮 lastError 从「iso is not defined」变成「会话正忙,下一轮重试」(正常推迟)
39
+ ```
40
+
5
41
  ## [0.9.171] - 2026-11-04 —— 本地解析错误不该被说成「可能是代理干扰」
6
42
 
7
43
  ### 为什么(这是 PR #2 那句判断的落地)
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.171-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.172-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
 
@@ -123,7 +123,7 @@ dsh plugin install /path/to/dsh-session-superagent
123
123
  ## 开发
124
124
 
125
125
  ```sh
126
- node --test # 267 项单测
126
+ node --test # 269 项单测
127
127
  ```
128
128
 
129
129
  ### 工具输出:文本给人和 agent,JSON 给程序
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.171'
17
+ const CLIENT_VERSION = '0.9.172'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
package/lib/index.js CHANGED
@@ -25,7 +25,7 @@ import { redact } from './redact.js'
25
25
  import { decodeBody } from './body.js'
26
26
  import {
27
27
  advanceSeen, applyWatcherAction, batchFresh, decideWake, DEFAULT_ACK_LABEL, formatWatchText,
28
- TRIAGE_SIGNALS, accessNote, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, formatGhCall, diagnoseEmptyBody, diagnoseBadBody, isAuthBroken, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, enterActiveHoursDefer, recordOtherError, permanentBackoffMs, RETRY_BUDGET_ATTEMPTS, RETRY_SLOW_CAP_MINUTES, pushAbsorbed, pushFiltered, normalizeFilters, partitionItems, passesFilters,
28
+ TRIAGE_SIGNALS, accessNote, wakeCriteria, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, formatGhCall, diagnoseEmptyBody, diagnoseBadBody, isAuthBroken, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, enterActiveHoursDefer, recordOtherError, permanentBackoffMs, RETRY_BUDGET_ATTEMPTS, RETRY_SLOW_CAP_MINUTES, pushAbsorbed, pushFiltered, normalizeFilters, partitionItems, passesFilters,
29
29
  shouldRunCleanup,
30
30
  bumpDailyWakes,
31
31
  busierThanUsual,
@@ -40,7 +40,7 @@ import {
40
40
 
41
41
  export const name = 'dsh-session-superagent'
42
42
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
43
- export const SERVER_VERSION = '0.9.171'
43
+ export const SERVER_VERSION = '0.9.172'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
@@ -1169,11 +1169,9 @@ async function pollOnce(ctx, entry, baseMs) {
1169
1169
  // 只读仓库要在任务书里直说,否则会话会去试写然后吃 403
1170
1170
  access: accessNote(entry.repoAccess),
1171
1171
  // 完成标准要可观测(Given-When-Then 的思路):三件事缺一不算完成
1172
- criteria: [
1173
- '改了什么:文件清单 + 一句话为什么(别只写"已修复")',
1174
- '怎么验证的:跑过的测试/命令 + 结果;跑不了就写清为什么跑不了',
1175
- iso && iso.dir ? '回写到哪:推分支并开 PR,然后在 issue 里留言 + watch_ack 打标签' : '回写到哪:在 issue 里留言 + watch_ack 打标签',
1176
- ],
1172
+ // 三条完成标准抽在 lib/watch.js 里(纯函数,可被用例覆盖):
1173
+ // 这里曾经引用过不存在的 `iso`,只在"会话空闲真的发消息"时才爆 ReferenceError。
1174
+ criteria: wakeCriteria({ isolation }),
1177
1175
  // 「为什么是这几条」:把本轮的筛选依据一并写进任务书
1178
1176
  changedTotal: fresh.length,
1179
1177
  batchLimit: listed.length,
package/lib/watch.js CHANGED
@@ -90,6 +90,25 @@ export function advanceSeen(seen, fresh) {
90
90
  * 唤醒消息 = 任务书。竞品的触发都带足上下文(类型、状态、作者、标签、是否草稿),
91
91
  * 否则 agent 醒来还得自己查一遍。这里一次给全。
92
92
  */
93
+ /**
94
+ * 唤醒消息里的「完成标准」三条。
95
+ *
96
+ * 单独抽出来是因为它曾经写错过一次:`criteria` 里引用了不存在的 `iso`(实际变量叫 `isolation`),
97
+ * 只在**会话空闲、真的走到发消息**那一步才爆 `ReferenceError: iso is not defined` ——
98
+ * 有守但一直是 304/会话忙的话,永远看不到。抽成纯函数后,它就能被用例直接覆盖。
99
+ */
100
+ export function wakeCriteria({ isolation } = {}) {
101
+ const iso = isolation || {}
102
+ const where = iso.dir
103
+ ? '回写到哪:推分支并开 PR,然后在 issue 里留言 + watch_ack 打标签'
104
+ : '回写到哪:在 issue 里留言 + watch_ack 打标签'
105
+ return [
106
+ '改了什么:文件清单 + 一句话为什么(别只写"已修复")',
107
+ '怎么验证的:跑过的测试/命令 + 结果;跑不了就写清为什么跑不了',
108
+ where,
109
+ ]
110
+ }
111
+
93
112
  export function formatWatchText(repo, fresh, options = {}) {
94
113
  const list = fresh ?? []
95
114
  const more = Number(options.more) || 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.171",
3
+ "version": "0.9.172",
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",