dsh-session-superagent 0.9.88 → 0.9.90

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.90] - 2026-11-02 —— 之前叫醒过的条目,消息里标出来
6
+
7
+ ### 为什么
8
+ `history` 里一直记着"哪次叫醒处理了哪几条",但**消息里完全没用**。
9
+ 结果同一个问题第二次被叫醒时,会话以为这是新问题,会从头分析一遍。
10
+
11
+ ### 改法
12
+ - 发消息前把 `entry.history` 压成 `{条目号: 最近一次叫醒时间}`;
13
+ - 条目行尾追加 `⏰ 之前叫醒过(2026-10-30)`(只标日期,不占版面)。
14
+
15
+ ### 测试
16
+ - 新增 1 例:叫醒过的标、没叫醒过的不标、没传 `seenBefore` 时行为不变。合计 **202 例**。
17
+ - 单行长度仍 ≤ 120(`audit-line-length` 通过);演练快照 62 行未变(示例历史为空,符合预期)。
18
+
19
+ ## [0.9.89] - 2026-11-02 —— watch_start 一次加多个仓库(客户三仓库不用点三次)
20
+
21
+ ### 为什么
22
+ `watch_start` 一次只收一个 `repo`,三个仓库要点三次、三个工具调用 —— 而它们的
23
+ 间隔/过滤/限流通常完全一样。
24
+
25
+ ### 改法
26
+ `repo` 支持 `a/b, c/d e/f`(逗号、空格、换行都认):
27
+ - 文本:每个仓库一行 `watching a/b → session s1 every 60s`;
28
+ - JSON:保留原字段(兼容),新增 `repos: [{repo,id,updated}]`;
29
+ - **有一个写错就整体拒绝**(`仓库要写成 owner/name,这些不对:…`),不会只加一半。
30
+
31
+ ### 过程中踩到的坑
32
+ 第一版把 `applyOne()` 包在原逻辑外面,但**原逻辑里还留着旧的 `format=json` 提前 return** ——
33
+ 于是多仓库时只返回第一个仓库的 JSON。删掉那段之后才对。
34
+
35
+ ### 测试
36
+ - 新增 1 例:三个仓库三行、守数=3;JSON 带 `repos`;一个写错时整体拒绝且不写入。
37
+ - `contract-stability.json` 登记 `repos: stable`(用例先红一次)。合计 **201 例**。
38
+
5
39
  ## [0.9.88] - 2026-11-02 —— 先量 /state 体积:100 条守 347 KB,加事件预算后 143 KB
6
40
 
7
41
  ### 先量(`scripts/measure-state.mjs`)
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.88-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.90-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
 
@@ -121,7 +121,7 @@ dsh plugin install /path/to/dsh-session-superagent
121
121
  ## 开发
122
122
 
123
123
  ```sh
124
- node --test # 200 项单测
124
+ node --test # 202 项单测
125
125
  ```
126
126
 
127
127
  ### 工具输出:文本给人和 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.88'
17
+ const CLIENT_VERSION = '0.9.90'
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.88'
43
+ export const SERVER_VERSION = '0.9.90'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  const DEFAULT_SESSION_WAKES = 12
@@ -1029,6 +1029,14 @@ async function pollOnce(ctx, entry, baseMs) {
1029
1029
  changedTotal: fresh.length,
1030
1030
  batchLimit: listed.length,
1031
1031
  skippedReasons: entry.filterCounts || {},
1032
+ // 这条以前被叫醒过吗?history 里一直有数据,但消息从没用过
1033
+ seenBefore: (() => {
1034
+ const map = {}
1035
+ for (const event of entry.history || []) {
1036
+ for (const n of event.numbers || []) map[String(n)] = map[String(n)] || event.at
1037
+ }
1038
+ return map
1039
+ })(),
1032
1040
  })
1033
1041
  entry.lastWakeCount = fresh.length
1034
1042
  entry.lastBatch = listed.map((item) => item.number)
@@ -2020,6 +2028,12 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2020
2028
  try { repo = JSON.parse(res.stdout).nameWithOwner } catch { return `[error: cannot infer repo]\n${redact(res.stderr)}` }
2021
2029
  }
2022
2030
 
2031
+ // 一次可以加多个仓库:客户三个仓库不用点三次(逗号/空格/换行都认)
2032
+ const repoList = String(repo).split(/[,\s]+/).map((item) => item.trim()).filter(Boolean)
2033
+ const bad = repoList.filter((item) => !/^[^/\s]+\/[^/\s]+$/.test(item))
2034
+ if (bad.length > 0) return '[error: 仓库要写成 owner/name,这些不对:' + bad.join(', ') + ']'
2035
+ if (repoList.length === 0) return '[error: 至少给一个仓库(owner/name)]'
2036
+ const applyOne = (repo) => {
2023
2037
  const id = `${repo}#${sessionId}`
2024
2038
  const state = readState()
2025
2039
  const existing = state.watchers && state.watchers[id]
@@ -2074,14 +2088,28 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2074
2088
  if (entry.batchLimit) flags.push('batch=' + entry.batchLimit)
2075
2089
  if (entry.maxWakesPerHour) flags.push('perHour=' + entry.maxWakesPerHour)
2076
2090
  if (entry.goal) flags.push('goal=' + JSON.stringify(entry.goal.slice(0, 40)))
2091
+ return { entry, existing, flags, id, repo }
2092
+
2093
+ }
2094
+ const applied = []
2095
+ for (const name of repoList) {
2096
+ const result = applyOne(name)
2097
+ // 单条校验失败(比如相对路径的 workdir)要原地返回,不能继续加后面的
2098
+ if (typeof result === 'string') return result
2099
+ applied.push(result)
2100
+ }
2077
2101
  if (args && args.format === 'json') {
2078
- return JSON.stringify({ schemaVersion: 1, ok: true, repo, sessionId, id, intervalSec: entry.intervalSec,
2079
- flags, filters: entry.filters || {}, updated: Boolean(existing), observe: entry.observe === true,
2080
- isolated: entry.isolated === true, activeHours: entry.activeHours || null }, null, 2)
2102
+ const first = applied[0]
2103
+ const base = JSON.parse(JSON.stringify({ schemaVersion: 1, ok: true, repo: first.repo, sessionId, id: first.id, intervalSec: first.entry.intervalSec,
2104
+ flags: first.flags, filters: first.entry.filters || {}, updated: Boolean(first.existing), observe: first.entry.observe === true,
2105
+ isolated: first.entry.isolated === true, activeHours: first.entry.activeHours || null }))
2106
+ base.repos = applied.map((item) => ({ repo: item.repo, id: item.id, updated: Boolean(item.existing) }))
2107
+ return JSON.stringify(base, null, 2)
2081
2108
  }
2082
- return `watching ${repo} → session ${sessionId} every ${entry.intervalSec}s` +
2083
- (flags.length ? ' [' + flags.join(' ') + ']' : '') +
2084
- (existing ? ' (updated existing watcher)' : '')
2109
+ const lines = applied.map((item) => `watching ${item.repo} → session ${sessionId} every ${item.entry.intervalSec}s`
2110
+ + (item.flags.length ? ' [' + item.flags.join(' ') + ']' : '')
2111
+ + (item.existing ? ' (updated existing watcher)' : ''))
2112
+ return lines.join(String.fromCharCode(10))
2085
2113
  },
2086
2114
  }))
2087
2115
 
package/lib/watch.js CHANGED
@@ -107,6 +107,10 @@ export function formatWatchText(repo, fresh, options = {}) {
107
107
  assignmentNote(item) || null,
108
108
  (item.state === 'open' ? stalenessNote(item) : '') || null,
109
109
  linkedPrNote(item.linkedPr) || null,
110
+ // 之前叫醒过这条:会话该知道「这不是新问题」
111
+ (options.seenBefore && options.seenBefore[String(item.number)])
112
+ ? '⏰ 之前叫醒过(' + String(options.seenBefore[String(item.number)]).slice(0, 10) + ')'
113
+ : null,
110
114
  item.lastComment
111
115
  ? '最后评论: ' + commentSummaryLine({
112
116
  login: item.lastComment.self ? '' : item.lastComment.login,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.88",
3
+ "version": "0.9.90",
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",