dsh-session-superagent 0.9.76 → 0.9.77

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,23 @@
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.77] - 2026-11-02 —— doctor 补两项:定时器丢了、隔离目录不可写
6
+
7
+ ### 为什么要补
8
+ `watch_doctor` 原来只检查:版本、挂载、gh 登录、仓库可访问、ack 标签、隔离目录**是否存在**。
9
+ 两类真实故障它看不见:
10
+
11
+ 1. **定时器丢了**:进程被挂起、`setInterval` 被清掉后,`lastPoll` 会一直是几小时前,
12
+ 但面板上一切显示"运行中、正常";
13
+ 2. **隔离目录存在但不可写**:权限/磁盘问题下,第一次唤醒建 worktree 就会失败。
14
+
15
+ ### 改法
16
+ - 停滞:`age > max(3×interval, 5min)` 时报 `WARN … 已经 N 分钟没轮询过`;
17
+ - 可写:在 `workdir` 里写一个探针文件再删,失败报 `FAIL 隔离工作目录不可写(EPERM/EACCES/ENOSPC)`。
18
+
19
+ ### 测试
20
+ - 新增 1 例:造一个 2 小时没轮询的守,`watch_doctor` 输出必须包含「没轮询过」。合计 **194 例**。
21
+
5
22
  ## [0.9.76] - 2026-11-02 —— 只有一条变化时,不再解释"为什么是这几条"
6
23
 
7
24
  ### 为什么改
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.76-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.77-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 # 193 项单测
124
+ node --test # 194 项单测
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.76'
17
+ const CLIENT_VERSION = '0.9.77'
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.76'
43
+ export const SERVER_VERSION = '0.9.77'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  const DEFAULT_SESSION_WAKES = 12
@@ -1886,10 +1886,28 @@ export function apply(ctx) {
1886
1886
  else {
1887
1887
  const gitRes = await run('git', ['-C', wd, 'rev-parse', '--is-inside-work-tree'], { timeoutMs: 15000 })
1888
1888
  lines.push(`${gitRes.code === 0 ? 'OK ' : 'FAIL'} 隔离工作目录 ${wd}:${gitRes.code === 0 ? '是 git 仓库' : '不是 git 仓库'}`)
1889
+ // 目录在但不可写时,第一次唤醒建 worktree 就会失败(真机上更常见的是权限/磁盘)
1890
+ const probe = join(wd, '.dsh-doctor-probe')
1891
+ try {
1892
+ writeFileSync(probe, String(Date.now()))
1893
+ rmSync(probe, { force: true })
1894
+ } catch (error) {
1895
+ lines.push(`FAIL 隔离工作目录不可写:${wd}(${String((error && error.code) || error).slice(0, 40)})`)
1896
+ }
1897
+ }
1898
+ }
1899
+
1900
+ // 5. 轮询停滞:定时器丢了或进程被挂起时,面板上一切「正常」,其实早就不看了
1901
+ if (entry.enabled !== false && entry.lastPoll) {
1902
+ const intervalMs = (Number(entry.intervalSec) || 60) * 1000
1903
+ const staleMs = Math.max(intervalMs * 3, 5 * 60 * 1000)
1904
+ const age = Date.now() - Date.parse(entry.lastPoll)
1905
+ if (Number.isFinite(age) && age > staleMs) {
1906
+ lines.push(`WARN ${entry.repo} 已经 ${Math.round(age / 60000)} 分钟没轮询过(预期每 ${Math.round(intervalMs / 1000)} 秒)—— 定时器可能丢了`)
1889
1907
  }
1890
1908
  }
1891
1909
 
1892
- // 5. 最近一次状态
1910
+ // 6. 最近一次状态
1893
1911
  const last = entry.lastError ? `错误:${entry.lastError}` : entry.lastDeferred ? `等待:${entry.lastDeferred}` : '正常'
1894
1912
  lines.push(`INFO ${entry.enabled === false ? '已暂停' : '运行中'} · 上次轮询 ${entry.lastPoll || '无'} · ${last}`)
1895
1913
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.76",
3
+ "version": "0.9.77",
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",