dsh-session-superagent 0.8.72 → 0.8.74

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,50 @@
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.8.74] - 2026-11-02 —— 「判过不做」又被重开的条目,要显眼
6
+
7
+ ### 学到的(知识库第 23 条)
8
+ issue 对象带 `state_reason`:`completed` / `not_planned` / `reopened`。
9
+ 本机实测 `cli/cli` 最近 5 条里 4 条是 `not_planned`。
10
+ <https://docs.github.com/en/rest/issues/issues>
11
+
12
+ 主理鱼默认跳过 closed,但**判过 not_planned 之后又被重开**说明"不做"的判断被推翻了 ——
13
+ 这是最该被人看一眼的信号。
14
+
15
+ ### 改了什么
16
+ 1. 轮询记住最近一条 `reopened` 的 issue 号(`entry.lastReopened`);
17
+ 2. 唤醒消息给重开条目加 `⚠ 这条被重新打开过(之前关过,判"不做"可能不对)`;
18
+ 3. 面板「需要关注」显示 `o/r #N 被重新打开过`;
19
+ 4. **正常的 not_planned / completed 在消息里不提示** —— 不喧哗。
20
+
21
+ ### 测试
22
+ - 新增 1 例(null / 无原因 / reopened / not_planned / completed / 只有重开带 ⚠)。合计 **126 例**。
23
+
24
+ ## [0.8.73] - 2026-11-02 —— 主轮询要不要换 GraphQL:测完结论是**不换**(并留下基准脚本)
25
+
26
+ ### 学到/测到的(知识库第 22 条)
27
+ 新增可复现基准 `node scripts/bench-api.mjs owner/name`,实测:
28
+
29
+ | 场景 | REST(我们现在的) | GraphQL |
30
+ |---|---|---|
31
+ | 小仓库 20 条 | 769ms / 13.9 KB | 709ms / 1.0 KB |
32
+ | 大仓库 20 条 | 1418ms / 113 KB | 1067ms / 6.9 KB |
33
+ | 取 3 条最后评论 | 逐条 1786ms | 批量 439ms |
34
+
35
+ ### 为什么**不**换主路径
36
+ 1. 我们已经用 **ETag**:没变化时整轮 304,**零解析零传输**。GraphQL 没有等价用法,
37
+ 换过去等于把"大多数轮次几乎免费"变成"每轮都拉一遍"——净亏。
38
+ 2. GraphQL 的优势只在"确实有变化"时兑现,而那时我们的评论请求已在 0.8.72 批量化了(快 4 倍)。
39
+ 3. 主路径是核心,收益要靠侧证;**侧证不支持就不动**。
40
+
41
+ ### 顺带证伪一个"想当然"
42
+ "用 `state=open` 代替 `state=all` 能减小响应" —— 实测同仓库同 20 条:
43
+ `all` **113,895 字节** vs `open` **130,274 字节**(反而更大)。所以这条优化不做。
44
+
45
+ ### 本版改动
46
+ - 新增 `scripts/bench-api.mjs`(这只是量具,不改变运行时行为);
47
+ - 版本号/文档同步。**没有改主轮询逻辑 —— 这是有意识的选择。**
48
+
5
49
  ## [0.8.72] - 2026-11-02 —— 取「最后评论」改成一次 GraphQL 批量
6
50
 
7
51
  ### 学到的(知识库第 21 条)
package/MAINTENANCE.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  ## 二、当前状态(2026-11-01)
11
11
 
12
- - [x] 七个工具可用(github / repo_here / watch_start / watch_status / watch_stop / watch_ack / watch_doctor),`node --test` 125/125 通过
12
+ - [x] 七个工具可用(github / repo_here / watch_start / watch_status / watch_stop / watch_ack / watch_doctor),`node --test` 126/126 通过
13
13
  - [x] 自回声抑制(逐条水位)
14
14
  - [x] 仅空闲注入(避免草稿回放)
15
15
  - [x] 唤醒失败不推进水位
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.8.72-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.8.74-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
 
@@ -99,7 +99,7 @@ dsh plugin install /path/to/dsh-session-superagent
99
99
  ## 开发
100
100
 
101
101
  ```sh
102
- node --test # 125 项单测
102
+ node --test # 126 项单测
103
103
  ```
104
104
 
105
105
  版本与发布流程见 [UPDATING.md](UPDATING.md),交付门见 [CHECKLIST.md](CHECKLIST.md),接手台账见 [MAINTENANCE.md](MAINTENANCE.md)。
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.8.72'
17
+ const CLIENT_VERSION = '0.8.74'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -1071,6 +1071,10 @@ window.__ModuleLoader__.load({
1071
1071
  for (const watcher of watchers) {
1072
1072
  // 仓库结构问题(关闭 Issues / 是 fork)比轮询失败更早该说:它注定收不到条目
1073
1073
  const structure = repoStructureNote(watcher.repoAccess)
1074
+ // 被反复重开的条目:说明"之前判过不做"可能有问题,值得人看一眼
1075
+ if (watcher.lastReopened) {
1076
+ problems.push({ key: 'r-' + watcher.repo, text: watcher.repo + ' #' + watcher.lastReopened + ' 被重新打开过 —— 之前判"不做"可能不对' })
1077
+ }
1074
1078
  if (structure) problems.push({ key: 's-' + watcher.repo, text: structure })
1075
1079
  if (watcher.lastError) problems.push({ key: 'e-' + watcher.repo, text: watcher.repo + ' 轮询失败:' + watcher.lastError })
1076
1080
  else if (watcher.lastDeferred) problems.push({ key: 'd-' + watcher.repo, text: watcher.repo + ' 暂停唤醒:' + watcher.lastDeferred })
package/lib/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
 
31
31
  export const name = 'dsh-session-superagent'
32
32
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
33
- export const SERVER_VERSION = '0.8.72'
33
+ export const SERVER_VERSION = '0.8.74'
34
34
  export const inject = ['tools', 'agents', 'webServer']
35
35
 
36
36
  /** 仅供测试:读写状态文件(生产代码不要用)。 */
@@ -756,6 +756,9 @@ async function pollOnce(ctx, entry, baseMs) {
756
756
  entry.lastError = null
757
757
  entry.consecutiveFailures = 0
758
758
  entry.nextAt = null
759
+ // 记住最近一条"被重新打开"的 issue:这是最该被看见的信号(之前判过不做)
760
+ const reopened = items.find((item) => (item.state_reason || '') === 'reopened')
761
+ if (reopened) entry.lastReopened = reopened.number
759
762
 
760
763
  // 触发要有许可:过滤器不通过的条目根本不进候选集,也不写 seen 水位
761
764
  // 记忆要有遗忘:seen 只增不减会问成几 MB 的字典
@@ -1072,6 +1075,7 @@ export function apply(ctx) {
1072
1075
  filteredLog: (w.filteredLog ?? []).slice(-5),
1073
1076
  filterCounts: w.filterCounts ?? {},
1074
1077
  repoAccess: w.repoAccess ?? null,
1078
+ lastReopened: w.lastReopened ?? null,
1075
1079
  lastBatch: w.lastBatch ?? [],
1076
1080
  isolated: w.isolated === true,
1077
1081
  workdir: w.workdir ?? null,
package/lib/watch.js CHANGED
@@ -102,6 +102,7 @@ export function formatWatchText(repo, fresh, options = {}) {
102
102
  labels.length > 0 ? `标签: ${labels.join(', ')}` : null,
103
103
  (item.assignees ?? []).length > 0 ? `指派: ${item.assignees.map((a) => '@' + a.login).join(' ')}` : null,
104
104
  item.html_url,
105
+ (stateReasonNote(item) && String(item.state_reason || '') === 'reopened') ? '⚠ ' + stateReasonNote(item) : null,
105
106
  item.lastComment
106
107
  ? '最后评论: ' + commentSummaryLine({
107
108
  login: item.lastComment.self ? '' : item.lastComment.login,
@@ -709,3 +710,22 @@ export function parseCommentBatch(payload) {
709
710
  }
710
711
  return out
711
712
  }
713
+
714
+ /**
715
+ * 关闭原因 / 反复重开的提示。
716
+ *
717
+ * 依据:issue 对象有 `state_reason`(本机实测 `cli/cli` 上大量 `not_planned`;
718
+ * 重新打开时会变成 `reopened`)。出处:https://docs.github.com/en/rest/issues/issues
719
+ *
720
+ * 为什么要它:主理鱼看到 closed 就跳过,但"被标成 not_planned 后又被重开"的条目
721
+ * 恰恰是最需要人看一眼的 —— 说明之前判断"不做"是错的,或者有人在坚持。
722
+ */
723
+ export function stateReasonNote(item) {
724
+ if (!item || typeof item !== 'object') return ''
725
+ const reason = item.state_reason || item.stateReason
726
+ if (!reason) return ''
727
+ if (reason === 'reopened') return '这条被重新打开过(之前关过,判"不做"可能不对)'
728
+ if (item.state === 'closed' && reason === 'not_planned') return '关闭原因:不做(not planned)'
729
+ if (item.state === 'closed' && reason === 'completed') return '关闭原因:已完成'
730
+ return ''
731
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.8.72",
3
+ "version": "0.8.74",
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",