dsh-session-superagent 0.9.61 → 0.9.63

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,39 @@
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.63] - 2026-11-02 —— 错误截断不再切掉建议(三处渲染统一拆开)
6
+
7
+ ### 问题
8
+ 面板把 `lastError` 整串 `slice(0, 160)`:错误一长,**先被切掉的恰好是末尾的建议**。
9
+ 0.9.62 刚给每类错误补了"下一步",结果它可能根本显示不出来。
10
+
11
+ ### 改法
12
+ `splitErrorText()`:把 `short +(hint)` 拆成 `{ main, hint }`(建议永远是末尾的括号)。
13
+ 三处渲染统一:
14
+ - 概览行:现象截 120 + 建议单独一行(`dt-hint`);
15
+ - Tickets 行:同上;
16
+ - 「需要关注」列表:现象截 120 + 建议完整保留。
17
+
18
+ ### 测试
19
+ - 新增 1 例:长错误里建议必须完整出现,且现象部分被截断(避免占满版面)。合计 **191 例**。
20
+
21
+ ## [0.9.62] - 2026-11-02 —— 每一类错误都必须给出"下一步"
22
+
23
+ ### 发现
24
+ `classifyGhError` 有 6 类,其中 **`other` 的 hint 是空字符串** ——
25
+ 客户碰到一条没归类的错误,面板上只有一句看不懂的原文,**没有任何下一步**。
26
+ 另外两条内部错误更糟:直接写 `bad json` / `unexpected payload`(内部术语,无动作)。
27
+
28
+ ### 改法
29
+ | 位置 | 原 | 现 |
30
+ |---|---|---|
31
+ | `classifyGhError` 兜底 | hint 为空 | 「已按退避自动重试;持续出现就跑 watch_doctor 看检查清单,或把这行贴给对方」 |
32
+ | 解析失败 | `bad json` | 「返回内容不是合法 JSON(可能是代理干扰)—— 已自动重试;持续出现请跑 watch_doctor」 |
33
+ | 结构不对 | `unexpected payload` | 「返回的数据结构不对(预期是数组)—— 已自动重试;持续出现请跑 watch_doctor」 |
34
+
35
+ ### 测试
36
+ - 新增 1 例:7 个样本(含兜底)都必须有非空 hint 与非空 short;兜底要匹配 `watch_doctor|重试`。合计 **190 例**。
37
+
5
38
  ## [0.9.61] - 2026-11-02 —— 把客户不认识的行业词换掉(3 处)+ 术语表补 3 条
6
39
 
7
40
  ### 学到的(知识库第 103 条)
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.61-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.63-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 # 189 项单测
124
+ node --test # 191 项单测
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.61'
17
+ const CLIENT_VERSION = '0.9.63'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -612,6 +612,13 @@ window.__ModuleLoader__.load({
612
612
  const BORDER = '1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.22))'
613
613
 
614
614
  /** Dock entry: the machine-wide ring plus its click-through detail list. */
615
+ /** 把错误拆成「现象」和「建议」:服务端存的是 short +(hint),建议在末尾的括号里。 */
616
+ function splitErrorText(text) {
617
+ const value = String(text || '')
618
+ const match = /([^()]*)\s*$/.exec(value)
619
+ if (!match) return { main: value, hint: '' }
620
+ return { main: value.slice(0, match.index).trim(), hint: match[0].trim() }
621
+ }
615
622
  function StatusOrbit() {
616
623
  const [watchers, setWatchers] = useState(null)
617
624
  const [open, setOpen] = useState(false)
@@ -743,7 +750,13 @@ window.__ModuleLoader__.load({
743
750
  w.goal && w.goal.objective
744
751
  ? h('div', { className: 'dt-hint' }, 'goal · ' + String(w.goal.objective).slice(0, 60))
745
752
  : null,
746
- w.lastError ? h('div', { className: 'dt-error' }, String(w.lastError).slice(0, 160)) : null),
753
+ w.lastError ? (() => {
754
+ // 之前整串 slice(0,160):错误一长就先切掉后面的建议 —— 恰好是最有用的部分
755
+ const parts = splitErrorText(w.lastError)
756
+ return h('div', { className: 'dt-error' },
757
+ parts.main.slice(0, 120) + (parts.main.length > 120 ? '…' : ''),
758
+ parts.hint ? h('div', { className: 'dt-hint' }, parts.hint) : null)
759
+ })() : null),
747
760
  h('div', { className: 'dt-row-actions' },
748
761
  h(Btn, { size: 'sm', variant: 'ghost', onClick: () => act(w, 'poll') }, '立刻'),
749
762
  h(Btn, { size: 'sm', variant: 'ghost', onClick: () => act(w, w.enabled ? 'pause' : 'resume') },
@@ -1069,7 +1082,12 @@ window.__ModuleLoader__.load({
1069
1082
  watcher.note ? '目标: ' + String(watcher.note).slice(0, 40) : '',
1070
1083
  ].filter(Boolean).join(' · ')),
1071
1084
  watcher.lastDeferred ? h('div', { className: 'dt-ticket-note' }, watcher.lastDeferred) : null,
1072
- watcher.lastError ? h('div', { className: 'dt-ticket-note dt-ticket-note-error' }, String(watcher.lastError).slice(0, 160)) : null,
1085
+ watcher.lastError ? (() => {
1086
+ const parts = splitErrorText(watcher.lastError)
1087
+ return h('div', { className: 'dt-ticket-note dt-ticket-note-error' },
1088
+ parts.main.slice(0, 120) + (parts.main.length > 120 ? '…' : ''),
1089
+ parts.hint ? h('div', { className: 'dt-hint' }, parts.hint) : null)
1090
+ })() : null,
1073
1091
  h('div', { className: 'dt-ticket-actions' },
1074
1092
  h(Btn, { size: 'sm', variant: 'outline', icon: h(Icon, { name: 'refresh' }), onClick: () => act(watcher, 'poll') }, '立刻'),
1075
1093
  h(Btn, {
@@ -1144,7 +1162,14 @@ window.__ModuleLoader__.load({
1144
1162
  problems.push({ key: 'r-' + watcher.repo, text: watcher.repo + ' #' + watcher.lastReopened + ' 被重新打开过 —— 之前判"不做"可能不对' })
1145
1163
  }
1146
1164
  if (structure) problems.push({ key: 's-' + watcher.repo, text: structure })
1147
- if (watcher.lastError) problems.push({ key: 'e-' + watcher.repo, text: watcher.repo + ' 轮询失败:' + watcher.lastError })
1165
+ if (watcher.lastError) {
1166
+ // 同样拆开:现象截断、建议保留(这里原来是整串塞进「需要关注」)
1167
+ const parts = splitErrorText(watcher.lastError)
1168
+ problems.push({
1169
+ key: 'e-' + watcher.repo,
1170
+ text: watcher.repo + ' 轮询失败:' + parts.main.slice(0, 120) + (parts.main.length > 120 ? '…' : '') + ' ' + parts.hint,
1171
+ })
1172
+ }
1148
1173
  else if (watcher.lastDeferred) problems.push({ key: 'd-' + watcher.repo, text: watcher.repo + ' 暂停唤醒:' + watcher.lastDeferred })
1149
1174
  }
1150
1175
  if (body.gh && body.gh.ok === false && credentials.token === 'none') {
package/lib/gh-format.js CHANGED
@@ -32,7 +32,8 @@ export function classifyGhError(detail) {
32
32
  if (/EOF|i\/o timeout|connection reset|dial tcp|TLS handshake|no such host|proxyconnect|timeout|context deadline exceeded|certificate|x509|self.signed|unable to get local issuer/i.test(text)) {
33
33
  return { kind: 'network', short, hint: '(网络抖动:这一轮没连上 GitHub,已按退避自动重试,不需要手动处理)' }
34
34
  }
35
- return { kind: 'other', short, hint: '' }
35
+ // 兜底也要给下一步:客户看到一条没归类的错误,最怕「那我该做什么」
36
+ return { kind: 'other', short, hint: '(没归类的错误:已按退避自动重试;持续出现就跑 watch_doctor 看检查清单,或把这行贴给对方)' }
36
37
  }
37
38
 
38
39
  /**
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.61'
43
+ export const SERVER_VERSION = '0.9.63'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  const DEFAULT_SESSION_WAKES = 12
@@ -884,8 +884,8 @@ async function pollOnce(ctx, entry, baseMs) {
884
884
  }
885
885
  if (parsed.etag) entry.etag = parsed.etag
886
886
  let items
887
- try { items = JSON.parse(parsed.body) } catch { entry.lastError = 'bad json'; bumpFailure(entry, baseMs); return }
888
- if (!Array.isArray(items)) { entry.lastError = 'unexpected payload'; bumpFailure(entry, baseMs); return }
887
+ try { items = JSON.parse(parsed.body) } catch { entry.lastError = '返回内容不是合法 JSON(可能是代理干扰)—— 已按退避自动重试;持续出现请跑 watch_doctor'; bumpFailure(entry, baseMs); return }
888
+ if (!Array.isArray(items)) { entry.lastError = '返回的数据结构不对(预期是数组)—— 已按退避自动重试;持续出现请跑 watch_doctor'; bumpFailure(entry, baseMs); return }
889
889
 
890
890
  entry.lastError = null
891
891
  entry.consecutiveFailures = 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.61",
3
+ "version": "0.9.63",
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",