dsh-session-superagent 0.9.132 → 0.9.133

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.133] - 2026-11-03 —— 系统错误码各归其类;没见过的措辞自动留样本
6
+
7
+ ### 学到什么(出处)
8
+ Node 的系统错误表把每个码的含义写得很具体(本轮用 `gh api` 直接取到 `doc/api/errors.md`):
9
+
10
+ > `EACCES` (Permission denied): An attempt was made to access a file in a way forbidden by its file access permissions.
11
+ > `EPIPE` (Broken pipe): A write on a pipe, socket, or FIFO for which there is no process to read the data.
12
+
13
+ <https://nodejs.org/api/errors.html#common-system-errors>
14
+
15
+ ### 现场
16
+ 这四类原本全落 `other`("没归类的错误:已按退避自动重试"):
17
+
18
+ | 文本 | 改前 | 改后 |
19
+ |---|---|---|
20
+ | `spawn gh EACCES` | other | `permfile`(检查安装权限或重装) |
21
+ | `spawn gh EPERM` | other | `permfile` |
22
+ | `EPIPE: broken pipe` | other | `network`(连接被中断,不需要手动处理) |
23
+ | `ETIMEDOUT connect` | other | `network` |
24
+
25
+ ### 还有一个更根本的问题
26
+ 分类器只认**我们见过的措辞**。没见过的如果只显示"没归类的错误",下次还是收集不到 —— 死循环。
27
+ 所以新增 `recordOtherError()`:`other` 时把原始措辞(≤120 字)记进事件流,最多保留到事件上限。
28
+
29
+ ### 测试
30
+ 新增 2 例:系统错误码分类;`other` 留样本(空内容不记、事件流不无限增长)。合计 **249 例**。
31
+
5
32
  ## [0.9.132] - 2026-11-03 —— 代理塞回一个网页时,说清"是网页不是 JSON"
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.132-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.133-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 # 247 项单测
126
+ node --test # 249 项单测
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.132'
17
+ const CLIENT_VERSION = '0.9.133'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
package/lib/gh-format.js CHANGED
@@ -83,6 +83,14 @@ export function classifyGhError(detail) {
83
83
  if (/HTTP 50[0234]|Bad Gateway|Service Unavailable|Gateway Time-?out/i.test(text)) {
84
84
  return { kind: 'gateway', short, hint: '(GitHub 或本地代理短暂故障:已按退避自动重试,不需要手动处理;持续出现就检查代理)' }
85
85
  }
86
+ // 系统级错误码:含义与动作各不相同(找不到文件 / 没权限 / 管道断了 / 超时)
87
+ // 出处:https://nodejs.org/api/errors.html#common-system-errors
88
+ if (/EACCES|EPERM/i.test(text)) {
89
+ return { kind: 'permfile', short, hint: '(gh 没有执行权限:检查安装权限或重装 gh)' }
90
+ }
91
+ if (/EPIPE|ETIMEDOUT|ECONNRESET|socket hang up/i.test(text)) {
92
+ return { kind: 'network', short, hint: '(连接被中断:网络或代理不稳,已按退避自动重试,不需要手动处理)' }
93
+ }
86
94
  // Windows 的 cmd 报法不一样:'gh' is not recognized as an internal or external command
87
95
  // 出处(Node 的错误码语义):https://nodejs.org/api/errors.html#common-system-errors
88
96
  if (/ENOENT|not found.*gh|gh: command not found|not recognized as an internal or external command/i.test(text)) {
package/lib/index.js CHANGED
@@ -25,7 +25,7 @@ import { redact } from './redact.js'
25
25
  import { decodeBody } from './body.js'
26
26
  import {
27
27
  advanceSeen, applyWatcherAction, batchFresh, decideWake, DEFAULT_ACK_LABEL, formatWatchText,
28
- TRIAGE_SIGNALS, accessNote, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, formatGhCall, diagnoseEmptyBody, diagnoseBadBody, isAuthBroken, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, enterActiveHoursDefer, permanentBackoffMs, RETRY_BUDGET_ATTEMPTS, RETRY_SLOW_CAP_MINUTES, pushAbsorbed, pushFiltered, normalizeFilters, partitionItems, passesFilters,
28
+ TRIAGE_SIGNALS, accessNote, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, formatGhCall, diagnoseEmptyBody, diagnoseBadBody, isAuthBroken, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, enterActiveHoursDefer, recordOtherError, permanentBackoffMs, RETRY_BUDGET_ATTEMPTS, RETRY_SLOW_CAP_MINUTES, pushAbsorbed, pushFiltered, normalizeFilters, partitionItems, passesFilters,
29
29
  shouldRunCleanup,
30
30
  bumpDailyWakes,
31
31
  busierThanUsual,
@@ -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.132'
43
+ export const SERVER_VERSION = '0.9.133'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
@@ -955,6 +955,8 @@ async function pollOnce(ctx, entry, baseMs) {
955
955
  bumpFailure(entry, baseMs)
956
956
  // 凭证问题要显式标出来:它不会自己恢复,客户必须去 gh auth login
957
957
  if (classified.kind === 'auth') entry.needsReauth = true
958
+ // 没见过的措辞:留样本,下一轮才好补分类规则
959
+ if (classified.kind === 'other') recordOtherError(entry, detail)
958
960
  const permanent = permanentBackoffMs(classified.kind, baseMs)
959
961
  if (permanent > 0) {
960
962
  entry.nextAt = new Date(Date.now() + permanent).toISOString()
package/lib/watch.js CHANGED
@@ -325,6 +325,18 @@ export function batchFresh(fresh, limit = 3, priority) {
325
325
  * 为什么:时段外根本不轮询,旧的 lastError 会一直挂着,面板上就变成一条永不消停的「异常」。
326
326
  * 依据同 paused-means-no-new-facts:不再更新的状态不该继续代表「现在」。
327
327
  */
328
+ /**
329
+ * 未归类的错误:把原始措辞留一份样本(最多 3 条)到事件流。
330
+ *
331
+ * 为什么:分类器只认我们见过的措辞。没见过的如果只显示「没归类的错误」,
332
+ * 下次还是收集不到 —— 让它在事件流里留个样本,下一轮才能补规则。
333
+ */
334
+ export function recordOtherError(entry, detail) {
335
+ const text = String(detail || '').trim().slice(0, 120)
336
+ if (!text) return entry
337
+ entry.events = pushEvent(entry.events, { kind: 'other', text })
338
+ return entry
339
+ }
328
340
  export function enterActiveHoursDefer(entry, waitMs, hours, at = new Date()) {
329
341
  entry.nextAt = new Date(at.getTime() + Number(waitMs || 0)).toISOString()
330
342
  entry.lastDeferred = `不在活跃时段(${hours}),${Math.round(Number(waitMs || 0) / 60000)} 分钟后开始`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.132",
3
+ "version": "0.9.133",
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",