dsh-session-superagent 0.9.173 → 0.9.174

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,40 @@
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.174] - 2026-11-04 —— 首次同步不该说「有 N 条新动态」
6
+
7
+ ### 现场(本轮唤醒)
8
+ 刚给本仓库新建守,第一轮唤醒就是:
9
+
10
+ ```
11
+ 【主理鱼】MYCF711/dsh-session-superagent 有 1 条新动态:
12
+ #7 [open] feat: ghConfigDir … 最后评论: 2026-11-04T06:41:38Z我(上一轮留的)
13
+ ```
14
+
15
+ 两条都不对:
16
+ 1. **它不是"新动态"** —— 是接上之前就开着的 PR;
17
+ 2. **"最后评论"是我自己留的** —— 等于自己叫醒自己,还以为有人在等回复。
18
+
19
+ ### 改法
20
+ `formatWatchText` 新增 `firstSync`(判据:`entry.cursor === null`,即这条守还没成功同步过):
21
+
22
+ ```
23
+ 首次: 【主理鱼】<repo> 首次同步:仓库里现有 N 条待处理(接上之前就在的,不是刚刚发生):
24
+ 平时: 【主理鱼】<repo> 有 N 条新动态:
25
+ ```
26
+
27
+ 事件类型也从 `wake` 记成 `baseline`(判定页能看到"这是基线,不是这一小时的新增")。
28
+
29
+ ### 顺带
30
+ `watch_ack` 的默认标签 `主理鱼:已处理` 在这个仓库里**原本不存在**(gh 加标签返回 422)。
31
+ 已建该标签并把 PR #7 标上 —— 插件里的 `watch_ack` 本来就会幂等创建,只是这个仓库从没跑过。
32
+
33
+ ### 证据
34
+ ```
35
+ node --test → 272/272(新增:首次同步不得出现「新动态」,平时仍是「新动态」)
36
+ 真机:gh pr view 7 → labels: ["主理鱼:已处理"]
37
+ ```
38
+
5
39
  ## [0.9.173] - 2026-11-04 —— 重启后的「会话已不在」误报:给 10 分钟宽限期
6
40
 
7
41
  ### 现场(重启后你看到的那条红字)
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.173-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.174-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 # 271 项单测
126
+ node --test # 272 项单测
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.173'
17
+ const CLIENT_VERSION = '0.9.174'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
package/lib/index.js CHANGED
@@ -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.173'
43
+ export const SERVER_VERSION = '0.9.174'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
@@ -1171,8 +1171,12 @@ async function pollOnce(ctx, entry, baseMs) {
1171
1171
  if (isolation && isolation.dir) entry.lastWorktree = isolation.dir
1172
1172
  // 批次前几条补「最后是谁在说话」(最多 3 条,失败静默)
1173
1173
  await fetchLastComments(entry.repo, listed)
1174
+ // 首次同步:这条守刚建好,或者宿主换了机器(cursor 还是 null)。
1175
+ // 此时"有动态"其实是"仓库里本来就有这些待处理",说成新动态会让人以为刚刚发生。
1176
+ const firstSync = !entry.cursor
1174
1177
  const wakeText = formatWatchText(entry.repo, listed, {
1175
1178
  more: rest.length,
1179
+ firstSync,
1176
1180
  restNumbers: rest.map((item) => item.number),
1177
1181
  isolation,
1178
1182
  // entry.goal 之前只写不读:现在真的进唤醒消息
@@ -1222,7 +1226,9 @@ async function pollOnce(ctx, entry, baseMs) {
1222
1226
  entry.dailyWakes = bumpDailyWakes(entry.dailyWakes)
1223
1227
  entry.lastDeferred = null
1224
1228
  entry.deferReason = null
1225
- noteEvent(entry, 'wake', '唤醒了 ' + (entry.lastBatch || []).length + ' 条:' + (entry.lastBatch || []).map((n) => '#' + n).join(' '))
1229
+ noteEvent(entry, firstSync ? 'baseline' : 'wake',
1230
+ (firstSync ? '首次同步(存量 ' : '唤醒了 ') + (entry.lastBatch || []).length + ' 条' + (firstSync ? ')' : '') +
1231
+ ':' + (entry.lastBatch || []).map((n) => '#' + n).join(' '))
1226
1232
  entry.seen = advanceSeen(entry.seen, fresh)
1227
1233
  entry.lastReported = recordReported(entry, fresh)
1228
1234
  entry.cursor = newestUpdatedAt(fresh)
package/lib/watch.js CHANGED
@@ -188,7 +188,9 @@ export function formatWatchText(repo, fresh, options = {}) {
188
188
  + criteria.map((line, i) => (i + 1) + '. ' + line).join(String.fromCharCode(10))
189
189
  : ''
190
190
  return (
191
- `【主理鱼】${repo} 有 ${lines.length} 条新动态:\n` +
191
+ (options.firstSync
192
+ ? `【主理鱼】${repo} 首次同步:仓库里现有 ${lines.length} 条待处理(接上之前就在的,不是刚刚发生):`
193
+ : `【主理鱼】${repo} 有 ${lines.length} 条新动态:`) + String.fromCharCode(10) +
192
194
  lines.join('\n') +
193
195
  whyLine +
194
196
  moreLine +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.173",
3
+ "version": "0.9.174",
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",