dsh-session-superagent 0.9.129 → 0.9.130

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,33 @@
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.130] - 2026-11-03 —— 重启后真机复验:新代码生效了,但"暂停的守还挂着旧错误"
6
+
7
+ ### 真机复验(重启后)
8
+ ```
9
+ GET /state → serverVersion 0.9.129
10
+ defaults: { sessionMaxWakes: 12, maxWakesPerHour: 6, isolateKeepDays: 3 }
11
+ retryPolicy: { budgetAttempts: 6, slowCapMinutes: 120 }
12
+ ```
13
+ 说明 0.9.12x 的新字段与短路逻辑都已上线。`gh auth status` 也已恢复正常(`✓ Logged in`),
14
+ `gh api repos/MYCF711/dsh-go` 返回正常。
15
+
16
+ 启用的那条守在 07:02:50Z 完成了一轮成功轮询:`lastError` 已清空、`nextAt` 归 null。
17
+
18
+ **但另一条(已暂停,来自更早的会话)仍然挂着**:
19
+ `lastError: 返回内容不是合法 JSON(可能是代理干扰)` + `consecutiveFailures: 1`。
20
+
21
+ ### 根因
22
+ 0.9.111 只在**暂停动作发生时**清错误。这条守是在那之前就暂停的,所以旧错误一直冻在状态文件里 ——
23
+ 面板上永远显示「异常」,而它其实只是"停着"。
24
+
25
+ ### 改法
26
+ `normalizePaused()`:`readState()` 读出来时,对 `enabled === false` 的条目清掉
27
+ `lastError` / `lastErrorAt` / `consecutiveFailures` / `needsReauth`(幂等、无副作用,下次写盘自然带走)。
28
+
29
+ ### 测试
30
+ 新增 1 例:手写一份"老版本留下的(暂停 + 旧错误)"状态,读出来后错误为空。合计 **245 例**。
31
+
5
32
  ## [0.9.129] - 2026-11-03 —— Windows 上找不到 gh 会说"不是命令",我们原来不认
6
33
 
7
34
  ### 学到什么(出处)
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.129-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.130-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 # 244 项单测
126
+ node --test # 245 项单测
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.129'
17
+ const CLIENT_VERSION = '0.9.130'
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.129'
43
+ export const SERVER_VERSION = '0.9.130'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
@@ -121,12 +121,14 @@ function readState() {
121
121
  }
122
122
  try {
123
123
  const parsed = JSON.parse(raw)
124
+ for (const entry of Object.values(parsed.watchers || {})) normalizePaused(entry)
124
125
  stateSource = 'ok'
125
126
  return parsed
126
127
  } catch {
127
128
  // 主文件坏了:试试备份
128
129
  try {
129
130
  const backup = JSON.parse(readFileSync(STATE_FILE + '.bak', 'utf8'))
131
+ for (const entry of Object.values(backup.watchers || {})) normalizePaused(entry)
130
132
  stateSource = 'backup'
131
133
  // 把备份写回主文件,避免下次还走恢复路径
132
134
  try { writeFileSync(STATE_FILE, JSON.stringify(backup, null, 2)) } catch {}
@@ -140,6 +142,19 @@ function readState() {
140
142
  }
141
143
  }
142
144
 
145
+ // 暂停的守不再轮询,它的 lastError 就不是「现在」的事实了。
146
+ // 真机现场:一条停在旧版本暂停的守,重启后仍显示「异常」,红点一直在。
147
+ // 依据同 KB paused-means-no-new-facts.md。读取时顺手归一,写盘时自然带走。
148
+ function normalizePaused(entry) {
149
+ if (!entry || entry.enabled !== false) return entry
150
+ if (entry.lastError || entry.lastErrorAt || entry.consecutiveFailures) {
151
+ entry.lastError = null
152
+ entry.lastErrorAt = null
153
+ entry.consecutiveFailures = 0
154
+ entry.needsReauth = false
155
+ }
156
+ return entry
157
+ }
143
158
  function writeState(state) {
144
159
  try {
145
160
  mkdirSync(STATE_DIR, { recursive: true })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.129",
3
+ "version": "0.9.130",
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",