dsh-session-superagent 0.9.239 → 0.9.240
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 +40 -0
- package/README.md +22 -22
- package/client.js +4 -1
- package/lib/gh-format.js +8 -0
- package/lib/index.js +1 -1
- package/lib/watch.js +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,46 @@
|
|
|
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.240] - 2026-11-05 —— 让代码指着知识库:引用从 3 条到 16 条
|
|
6
|
+
|
|
7
|
+
### 问题
|
|
8
|
+
|
|
9
|
+
T34 反查发现:182 条知识库里,**生产代码 `lib/` + `client.js` 只引用了 3 条**,`client.js` 是 **0 条**。
|
|
10
|
+
|
|
11
|
+
- 「通知与消息设计」8 条 → **0%**
|
|
12
|
+
- 「判定与优先级」12 条 → **0%**
|
|
13
|
+
- 「安全」2 条 → **0%**
|
|
14
|
+
|
|
15
|
+
**一个 bug 能烂 160 个版本,土壤就是这里**:规则写在知识库里,代码里没有任何东西指着它。
|
|
16
|
+
下一个改这段代码的人(和下一轮的我)根本不知道「这里有规矩」。
|
|
17
|
+
|
|
18
|
+
### 改法
|
|
19
|
+
|
|
20
|
+
给**行为类**条目在代码的可读位置加上 `// KB: xxx.md` 引用,覆盖两个 0 引用板块:
|
|
21
|
+
|
|
22
|
+
| 文件 | 引用 |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `lib/watch.js` | `priority-configurable` / `batch-priority` / `filter-explainability` / `actionable-suggestion` / `actionable-does-not-mean-repeated` / `error-must-have-next-step` |
|
|
25
|
+
| `lib/gh-format.js` | `assignment-signal` / `state-reason` / `stale-threshold` / `linked-pull-requests` / `draft-pr-signal` / `pr-blocked-state` / `ci-status-on-linked-pr` / `triage-signal-table` |
|
|
26
|
+
| `client.js` | `error-must-have-next-step` / `error-needs-a-button` / `paused-means-no-new-facts` |
|
|
27
|
+
|
|
28
|
+
**3 条 → 16 条。**
|
|
29
|
+
|
|
30
|
+
### 新增门禁 `audit-kb-links.mjs`(已挂进 preflight)
|
|
31
|
+
|
|
32
|
+
三条判据:
|
|
33
|
+
|
|
34
|
+
1. 每个引用都要指到**真实存在**的条目(改名后悬空会红);
|
|
35
|
+
2. 引用数**不许倒退**(有人删注释就红,基线 16);
|
|
36
|
+
3. 5 条关键行为类条目**必须**被代码引用。
|
|
37
|
+
|
|
38
|
+
### 证据
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
npm test → 381/381
|
|
42
|
+
preflight --fast → 知识库反查 PASS(17 处引用,关键行为类条目都有)
|
|
43
|
+
```
|
|
44
|
+
|
|
5
45
|
## [0.9.239] - 2026-11-05 —— 知识库里那条规则,从落地那天起就没成立过
|
|
6
46
|
|
|
7
47
|
### ① `attention-list-order-is-a-decision.md` 已失效
|
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)
|
|
6
|
-
[](https://github.com/MYCF711/dsh-session-superagent/releases)
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-session-superagent)
|
|
8
8
|
[](https://github.com/topics/dsh-plugin)
|
|
9
9
|
[](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
|
|
@@ -80,27 +80,27 @@ dsh plugin --profile desktop add /path/to/dsh-session-superagent
|
|
|
80
80
|
装进 profile 后是 `file:` 硬链接:改源码即改线上;**但新增文件不会被自动带过去**,
|
|
81
81
|
加完文件要跑 `pnpm run sync:profile`(否则下次重启插件会整体不挂载,这坑踩过一次)。
|
|
82
82
|
|
|
83
|
-
## 盯 Gitee 仓库(0.9.177 起)
|
|
84
|
-
|
|
85
|
-
同一个插件既盯 GitHub 也盯 Gitee。写法三种,随便挑一种:
|
|
86
|
-
|
|
87
|
-
```text
|
|
88
|
-
owner/name # GitHub(默认)
|
|
89
|
-
gitee:owner/name # Gitee
|
|
90
|
-
https://gitee.com/owner/name # 直接粘地址栏(.git 结尾也行)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
区别在这里(用之前该知道):
|
|
94
|
-
|
|
95
|
-
| | GitHub | Gitee |
|
|
96
|
-
|---|---|---|
|
|
97
|
-
| 走什么 | `gh` CLI 或面板 token | REST v5 + 私人令牌 |
|
|
98
|
-
| 条件请求 | 有 ETag,没变化时 304 **不计额度** | **没有** ETag,每轮都真读一次列表 |
|
|
99
|
-
| 批量取评论 | GraphQL 一次查多条 | 逐条 REST(最多前 3 条) |
|
|
100
|
-
| ack 标签 | 不存在会自动建 | 标签必须先存在,否则打不上 |
|
|
101
|
-
|
|
102
|
-
Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不填也能读,但打不了 ack 标签。
|
|
103
|
-
|
|
83
|
+
## 盯 Gitee 仓库(0.9.177 起)
|
|
84
|
+
|
|
85
|
+
同一个插件既盯 GitHub 也盯 Gitee。写法三种,随便挑一种:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
owner/name # GitHub(默认)
|
|
89
|
+
gitee:owner/name # Gitee
|
|
90
|
+
https://gitee.com/owner/name # 直接粘地址栏(.git 结尾也行)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
区别在这里(用之前该知道):
|
|
94
|
+
|
|
95
|
+
| | GitHub | Gitee |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| 走什么 | `gh` CLI 或面板 token | REST v5 + 私人令牌 |
|
|
98
|
+
| 条件请求 | 有 ETag,没变化时 304 **不计额度** | **没有** ETag,每轮都真读一次列表 |
|
|
99
|
+
| 批量取评论 | GraphQL 一次查多条 | 逐条 REST(最多前 3 条) |
|
|
100
|
+
| ack 标签 | 不存在会自动建 | 标签必须先存在,否则打不上 |
|
|
101
|
+
|
|
102
|
+
Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不填也能读,但打不了 ack 标签。
|
|
103
|
+
|
|
104
104
|
## 一次真实运行长什么样
|
|
105
105
|
|
|
106
106
|
1. `watch_start` 登记 watcher(状态存 `~/.dsh/state/session-superagent/watchers.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.
|
|
17
|
+
const CLIENT_VERSION = '0.9.240'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -681,8 +681,11 @@ window.__ModuleLoader__.load({
|
|
|
681
681
|
/** Dock entry: the machine-wide ring plus its click-through detail list. */
|
|
682
682
|
/** 把错误拆成「现象」和「建议」:服务端存的是 short +(hint),建议在末尾的括号里。 */
|
|
683
683
|
// 唤醒失败 vs 轮询失败:前者轮询是成功的,说成「轮询失败」会让客户去查网络
|
|
684
|
+
// KB: paused-means-no-new-facts.md —— 暂停=不再产生新事实(不要拿旧数据冒充当前状态)
|
|
684
685
|
function isWakeFailure(text) { return /^wake:/.test(String(text || '')) }
|
|
685
686
|
|
|
687
|
+
// KB: error-must-have-next-step.md —— 每个错误都要带下一步(现象与建议分开存)
|
|
688
|
+
// KB: error-needs-a-button.md —— 能一键解决的错误,不要只给一句话
|
|
686
689
|
function splitErrorText(text) {
|
|
687
690
|
const value = String(text || '')
|
|
688
691
|
const match = /([^()]*)\s*$/.exec(value)
|
package/lib/gh-format.js
CHANGED
|
@@ -460,6 +460,7 @@ export function parseCommentBatch(payload) {
|
|
|
460
460
|
* 为什么要它:主理鱼看到 closed 就跳过,但"被标成 not_planned 后又被重开"的条目
|
|
461
461
|
* 恰恰是最需要人看一眼的 —— 说明之前判断"不做"是错的,或者有人在坚持。
|
|
462
462
|
*/
|
|
463
|
+
// KB: state-reason.md —— 「判过不做」又被重开才是信号(只有 reopened 值得抬优先级)
|
|
463
464
|
export function stateReasonNote(item) {
|
|
464
465
|
if (!item || typeof item !== 'object') return ''
|
|
465
466
|
const reason = item.state_reason || item.stateReason
|
|
@@ -480,6 +481,7 @@ export function stateReasonNote(item) {
|
|
|
480
481
|
* 注意:**"无人认领更紧急"是产品判断,不是 GitHub 的规则**(本轮没找到官方依据),
|
|
481
482
|
* 所以只在消息里如实标注,加权默认关闭。
|
|
482
483
|
*/
|
|
484
|
+
// KB: assignment-signal.md —— 认领状态:事实默认展示,判断默认关闭(见 watch.js 的 DEFAULT_PRIORITY)
|
|
483
485
|
export function assignmentNote(item) {
|
|
484
486
|
if (!item || typeof item !== 'object') return ''
|
|
485
487
|
const list = Array.isArray(item.assignees) ? item.assignees.filter(Boolean) : []
|
|
@@ -495,6 +497,7 @@ export function assignmentNote(item) {
|
|
|
495
497
|
*
|
|
496
498
|
* `kind`:fact = GitHub 给的事实;judgment = 我们的产品判断(无官方依据)。
|
|
497
499
|
*/
|
|
500
|
+
// KB: triage-signal-table.md —— 一张表说清分诊信号与取舍(事实 vs 判断、默认开不开)
|
|
498
501
|
export const TRIAGE_SIGNALS = [
|
|
499
502
|
{ key: 'reopened', label: '被重新打开', kind: 'fact', weight: 100, default: true, why: 'state_reason=reopened,说明之前判"不做"被推翻' },
|
|
500
503
|
{ key: 'comments', label: '有人评论', kind: 'fact', weight: 10, default: true, why: '在等回应' },
|
|
@@ -510,6 +513,7 @@ export const TRIAGE_SIGNALS = [
|
|
|
510
513
|
* (https://github.com/actions/stale#readme),社区普遍用 30/60 两档。
|
|
511
514
|
* 我们只**展示**,默认不参与排序(和 unassigned 一样:先给事实,判断交给用户)。
|
|
512
515
|
*/
|
|
516
|
+
// KB: stale-threshold.md —— 60 天是社区默认,我们用 30 天
|
|
513
517
|
export function stalenessNote(item, options = {}) {
|
|
514
518
|
if (!item || typeof item !== 'object') return ''
|
|
515
519
|
const state = String(item.state || '')
|
|
@@ -558,6 +562,10 @@ export function pickLinkedPullRequests(nodes) {
|
|
|
558
562
|
}
|
|
559
563
|
|
|
560
564
|
/** 「已经有 PR 在做了」——避免会话重复干活。 */
|
|
565
|
+
// KB: linked-pull-requests.md —— 「已有 PR 在做」比评论更硬的信号
|
|
566
|
+
// KB: draft-pr-signal.md —— 草稿 PR ≠ 有人在推进
|
|
567
|
+
// KB: pr-blocked-state.md —— 「有 PR」不够,要说清卡在哪
|
|
568
|
+
// KB: ci-status-on-linked-pr.md —— CI 红绿零成本拿到,值得展示
|
|
561
569
|
export function linkedPrNote(linked) {
|
|
562
570
|
const list = Array.isArray(linked) ? linked.filter((item) => item && item.number) : []
|
|
563
571
|
if (list.length === 0) return ''
|
package/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
|
|
45
45
|
export const name = 'dsh-session-superagent'
|
|
46
46
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
47
|
-
export const SERVER_VERSION = '0.9.
|
|
47
|
+
export const SERVER_VERSION = '0.9.240'
|
|
48
48
|
export const inject = ['tools', 'agents', 'webServer']
|
|
49
49
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
50
50
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
package/lib/watch.js
CHANGED
|
@@ -114,6 +114,9 @@ export function wakeCriteria({ isolation } = {}) {
|
|
|
114
114
|
]
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
// KB: actionable-suggestion.md —— 每个提示都要能回答「我现在该做什么」
|
|
118
|
+
// KB: actionable-does-not-mean-repeated.md —— 可执行 ≠ 把同一份指令印 N 遍(见 mergeWakeTexts)
|
|
119
|
+
// KB: error-must-have-next-step.md —— 每个错误都要带下一步
|
|
117
120
|
export function formatWatchText(repo, fresh, options = {}) {
|
|
118
121
|
const list = fresh ?? []
|
|
119
122
|
const more = Number(options.more) || 0
|
|
@@ -293,6 +296,7 @@ const isBot = (item) => {
|
|
|
293
296
|
* 拆出原因是为了面板能展示「最近被过滤了什么、因为哪条规则」——
|
|
294
297
|
* 否则「不在干活」和「在过滤」在界面上长得一样。
|
|
295
298
|
*/
|
|
299
|
+
// KB: filter-explainability.md —— 让「为什么没叫醒」有答案(每条被过滤的都要留原因)
|
|
296
300
|
export function filterReason(item, filters = DEFAULT_FILTERS) {
|
|
297
301
|
const f = { ...DEFAULT_FILTERS, ...(filters || {}) }
|
|
298
302
|
if (f.skipClosed && item.state && item.state !== 'open') return '已关闭'
|
|
@@ -354,6 +358,8 @@ export function pushAbsorbed(log, items, at, max = 20) {
|
|
|
354
358
|
*/
|
|
355
359
|
export const DEFAULT_PRIORITY = { reopened: true, comments: true, labels: true, unassigned: false }
|
|
356
360
|
|
|
361
|
+
// KB: priority-configurable.md —— 权重是产品判断,别写死(客户可开关每一项)
|
|
362
|
+
// KB: batch-priority.md —— 一次 N 条时先处理更该处理的
|
|
357
363
|
export function priorityScore(item, options) {
|
|
358
364
|
if (!item || typeof item !== 'object') return 0
|
|
359
365
|
const on = { ...DEFAULT_PRIORITY, ...(options || {}) }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.240",
|
|
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",
|