dsh-session-superagent 0.9.56 → 0.9.59

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,64 @@
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.59] - 2026-11-02 —— 把唯一会走网络的单测改成离线(消除偶发红)
6
+
7
+ ### 发现
8
+ `/update` 那条用例会真的去请求 `registry.npmjs.org` —— 本小时它就让 `node --test` 偶发红一次
9
+ (`176/177` 之类),重跑又绿。**门禁偶发红比不绿更糟:会让人开始怀疑门禁。**
10
+
11
+ ### 改法
12
+ - `checkUpdate` 增加离线开关:`DSH_SUPERAGENT_UPDATE_OFFLINE=1` 时跳过网络、只回 current + 命令模板;
13
+ - 该用例显式打开开关 —— 从此不受 npm registry 抖动影响。
14
+
15
+ ### 验证
16
+ 连跑 3 次 `node --test`:`187/187` ×3。
17
+
18
+ ## [0.9.58] - 2026-11-02 —— 文案长度改成预算制:超过 80 字符的最多 3 条
19
+
20
+ ### 学到的(知识库第 100 条)
21
+ 一刀切的行宽在真实文案里会误伤;**预算制**(允许少量例外)才既挡趋势又不逼着把话说半截。
22
+ (同 performance budget 思路)
23
+
24
+ ### 做法
25
+ `render-panel-copy.mjs --check` 现在同时报统计并执行上限:
26
+ ```
27
+ PASS 面板文案与当前实现一致(129 行;最长 77 字符;超过 80 字符的 0 条(上限 3))
28
+ ```
29
+
30
+ ### 验证(不是"应该有效")
31
+ 把阈值调到 `-1`:
32
+ ```
33
+ $ node scripts/render-panel-copy.mjs --check --limit -1
34
+ FAIL 最长 77 字符;超过 80 字符的 0 条(上限 -1)
35
+ $ echo $?
36
+ 1
37
+ ```
38
+ 恢复正常阈值 → 0。
39
+
40
+ ### 当前数据
41
+ 104 条面板文案 / 最长 77 字符 / 超 80 字符 **0 条**。
42
+
43
+ ## [0.9.57] - 2026-11-02 —— 对着全文抽检文案:最长 10 条里两处真问题
44
+
45
+ ### 学到的(知识库第 99 条)
46
+ 错误信息三原则里最容易破的一条:**别让用户猜主语**。
47
+
48
+ ### 抓到两处
49
+ 1. **占位符没填**(真 bug):`accessNoteForPanel(access)` 拿不到仓库名,
50
+ 输出"你对 **这个仓库** 只有读权限" —— 读着像半成品。
51
+ 改成传 `watcher.repo`:`你对 acme/widgets 只有读权限:…`;用例锁死不许再出现"你对 这个仓库"。
52
+ 2. **按钮旁边还教一遍**:没回音那行右侧本来就有「看建议规则」,正文又写"检查 AGENTS.md",
53
+ 72 字重复。改成说清后果:`连续 2 次被叫醒后没有回音 —— 会话可能没按规则处理`(55 字)。
54
+
55
+ ### 判据(写进 KB)
56
+ 1. 主语必须具体(不许"这个仓库""它");
57
+ 2. 旁边有按钮时,正文不重复动作;
58
+ 3. 单条 ≤ 80 字符。
59
+
60
+ ### 测试
61
+ - 新增 1 例。合计 **187 例**;面板文案快照 129 行已刷新。
62
+
5
63
  ## [0.9.56] - 2026-11-02 —— README 被自己清空过一次(已恢复;原因记进知识库)
6
64
 
7
65
  ### 事件
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.56-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.59-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 # 186 项单测
124
+ node --test # 187 项单测
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.56'
17
+ const CLIENT_VERSION = '0.9.59'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -1129,13 +1129,13 @@ window.__ModuleLoader__.load({
1129
1129
  const structure = repoStructureNote(watcher.repoAccess)
1130
1130
  if (structure) problems.push({ key: 's-' + watcher.repo, text: structure })
1131
1131
  // 只读:以前只在行内显示一个徽章,客户在「需要关注」里看不到,也不知道回写会 403
1132
- const readOnly = accessNoteForPanel(watcher.repoAccess)
1132
+ const readOnly = accessNoteForPanel(watcher.repoAccess, watcher.repo)
1133
1133
  if (readOnly) problems.push({ key: 'ro-' + watcher.repo, text: readOnly })
1134
1134
  // 叫醒了但没回音:守在工作、消息也进去了,但会话没动手(规则缺失或被忽略)
1135
1135
  if (Number(watcher.silentWakes) >= 2) {
1136
1136
  problems.push({
1137
1137
  key: 'silent-' + watcher.repo,
1138
- text: watcher.repo + ' 已连续 ' + watcher.silentWakes + ' 次唤醒后没有回音(没看到 watch_ack)—— 检查这个仓库的 AGENTS.md 有没有给出处理规则',
1138
+ text: watcher.repo + ' 连续 ' + watcher.silentWakes + ' 次被叫醒后没有回音(没看到 watch_ack)—— 会话可能没按规则处理',
1139
1139
  action: { label: '看建议规则', onClick: () => setGlossary('rules:' + watcher.repo) },
1140
1140
  })
1141
1141
  }
@@ -1577,11 +1577,11 @@ window.__ModuleLoader__.load({
1577
1577
  }
1578
1578
 
1579
1579
  /** 只读仓库的提示(与服务端 gh-format.js:accessNote 同语义;面板要独立一份)。 */
1580
- function accessNoteForPanel(access) {
1580
+ function accessNoteForPanel(access, repo) {
1581
1581
  if (!access || typeof access !== 'object') return ''
1582
1582
  if (access.push === true) return ''
1583
1583
  if (access.push !== false) return ''
1584
- return '你对 ' + String(access.repo || '这个仓库') + ' 只有读权限:能看、能被叫醒,但没法回写评论或打标签 —— ' +
1584
+ return '你对 ' + String(access.repo || repo || '这个仓库') + ' 只有读权限:能看、能被叫醒,但没法回写评论或打标签 —— ' +
1585
1585
  '要么换有写权限的 token,要么把结论写在本地/PR 描述里。'
1586
1586
  }
1587
1587
 
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.56'
43
+ export const SERVER_VERSION = '0.9.59'
44
44
  export const inject = ['tools', 'agents', 'webServer']
45
45
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
46
46
  const DEFAULT_SESSION_WAKES = 12
@@ -1165,6 +1165,12 @@ export function apply(ctx) {
1165
1165
  if (!force && updateCache && Date.now() - updateCache.at < UPDATE_CACHE_MS) return updateCache.value
1166
1166
  const current = SERVER_VERSION
1167
1167
  const value = { current, latest: null, publishedAt: null, hasUpdate: false, command: '', error: null }
1168
+ // 离线开关:单测不该依赖 npm registry(一次网络抖动就会让整条门禁变红)
1169
+ if (process.env.DSH_SUPERAGENT_UPDATE_OFFLINE === '1') {
1170
+ value.command = 'dsh plugin --profile <你的 profile> add dsh-session-superagent@latest'
1171
+ updateCache = { at: Date.now(), value }
1172
+ return value
1173
+ }
1168
1174
  try {
1169
1175
  const res = await fetch('https://registry.npmjs.org/' + encodeURIComponent('dsh-session-superagent') + '/latest', {
1170
1176
  signal: AbortSignal.timeout(5000),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.56",
3
+ "version": "0.9.59",
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",