dsh-session-superagent 0.8.77 → 0.8.79
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 +46 -0
- package/MAINTENANCE.md +1 -1
- package/README.md +2 -2
- package/client.js +15 -2
- package/lib/index.js +4 -2
- package/lib/watch.js +40 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,52 @@
|
|
|
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.8.79] - 2026-11-02 —— 「躺了 62 天」:积压看得见
|
|
6
|
+
|
|
7
|
+
### 学到的(知识库第 28 条)
|
|
8
|
+
`actions/stale` 的 `days-before-stale` 默认 **60 天**;社区 30/60 两档都常见。
|
|
9
|
+
<https://github.com/actions/stale#readme>
|
|
10
|
+
|
|
11
|
+
我们的定位不是清理而是**提醒还有积压**,所以用 **30 天**(早一档,留人工决策时间):
|
|
12
|
+
- 只标 `open`(closed 不吵);
|
|
13
|
+
- 默认**只展示**(`躺了 62 天`),加权默认关,开启后 +2;
|
|
14
|
+
- 阈值可配置。
|
|
15
|
+
|
|
16
|
+
### 写代码时踩的一个坑(已修)
|
|
17
|
+
```js
|
|
18
|
+
// 错:Number(now) || (Date.now() - at) —— 传了 now 就把 epoch 毫秒当成天数差
|
|
19
|
+
const days = Math.floor((Number(options.now) || Date.now() - at) / 86400000)
|
|
20
|
+
```
|
|
21
|
+
用例立刻抓到(显示成 `躺了 20759 天`)。运算符优先级这类错误,有测试就是一行红,没测试就上线错。
|
|
22
|
+
|
|
23
|
+
### 测试
|
|
24
|
+
- 新增 1 例(62 天会标/刚更新不标/closed 不标/无时间戳不猜/阈值可调/默认 0/开启 +2)。合计 **131 例**。
|
|
25
|
+
|
|
26
|
+
## [0.8.78] - 2026-11-02 —— 分诊信号收成一张表,界面上直接看
|
|
27
|
+
|
|
28
|
+
### 学到的(知识库第 27 条)
|
|
29
|
+
顺带核对了 `milestone` 与新版 `type` 字段:**存在但不稳定**(实测 `cli/cli` 多为 `null`),
|
|
30
|
+
所以不纳入权重。事实类信号仍只用 `state_reason` / `comments` / `labels` / `assignees`。
|
|
31
|
+
|
|
32
|
+
### 改了什么
|
|
33
|
+
`lib/watch.js` 里新增唯一口径 `TRIAGE_SIGNALS`(key / 标签 / 事实还是判断 / 权重 / 默认 / 理由),
|
|
34
|
+
`/state` 直接回传,面板「设置 → 分诊信号与取舍」原样展示:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
被重新打开 [事实][默认开] +100 分 之前判"不做"被推翻
|
|
38
|
+
有人评论 [事实][默认开] +10 分 在等回应
|
|
39
|
+
带标签 [事实][默认开] +5 分 命中过某个分类
|
|
40
|
+
无人认领 [判断][默认关] +3 分 团队经验,无官方依据
|
|
41
|
+
长期没动静 [事实][默认关] +0 分 仅展示
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 用例守着的两条不变量
|
|
45
|
+
1. **判断类默认必须是关的** —— 我们的判断不该默认生效;
|
|
46
|
+
2. **表里的权重必须和 `priorityScore` 实际打分一致** —— 防止文档与代码走偏。
|
|
47
|
+
|
|
48
|
+
### 测试
|
|
49
|
+
- 新增 1 例。合计 **130 例**。
|
|
50
|
+
|
|
5
51
|
## [0.8.77] - 2026-11-02 —— 标出"未认领",但不偷偷加权
|
|
6
52
|
|
|
7
53
|
### 学到的(知识库第 26 条)
|
package/MAINTENANCE.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## 二、当前状态(2026-11-01)
|
|
11
11
|
|
|
12
|
-
- [x] 七个工具可用(github / repo_here / watch_start / watch_status / watch_stop / watch_ack / watch_doctor),`node --test`
|
|
12
|
+
- [x] 七个工具可用(github / repo_here / watch_start / watch_status / watch_stop / watch_ack / watch_doctor),`node --test` 131/131 通过
|
|
13
13
|
- [x] 自回声抑制(逐条水位)
|
|
14
14
|
- [x] 仅空闲注入(避免草稿回放)
|
|
15
15
|
- [x] 唤醒失败不推进水位
|
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
|
|
|
@@ -99,7 +99,7 @@ dsh plugin install /path/to/dsh-session-superagent
|
|
|
99
99
|
## 开发
|
|
100
100
|
|
|
101
101
|
```sh
|
|
102
|
-
node --test #
|
|
102
|
+
node --test # 131 项单测
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
版本与发布流程见 [UPDATING.md](UPDATING.md),交付门见 [CHECKLIST.md](CHECKLIST.md),接手台账见 [MAINTENANCE.md](MAINTENANCE.md)。
|
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.8.
|
|
17
|
+
const CLIENT_VERSION = '0.8.79'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -910,6 +910,7 @@ window.__ModuleLoader__.load({
|
|
|
910
910
|
comments: draft.priorityComments !== false,
|
|
911
911
|
labels: draft.priorityLabels !== false,
|
|
912
912
|
unassigned: draft.priorityUnassigned === true,
|
|
913
|
+
stale: draft.priorityStale === true,
|
|
913
914
|
},
|
|
914
915
|
batchLimit: Number(draft.batchLimit) || undefined,
|
|
915
916
|
maxWakesPerHour: Number(draft.maxWakesPerHour) || undefined,
|
|
@@ -1009,6 +1010,7 @@ window.__ModuleLoader__.load({
|
|
|
1009
1010
|
priorityComments: (watcher.priority && watcher.priority.comments) !== false,
|
|
1010
1011
|
priorityLabels: (watcher.priority && watcher.priority.labels) !== false,
|
|
1011
1012
|
priorityUnassigned: Boolean(watcher.priority && watcher.priority.unassigned) === true,
|
|
1013
|
+
priorityStale: Boolean(watcher.priority && watcher.priority.stale) === true,
|
|
1012
1014
|
})
|
|
1013
1015
|
},
|
|
1014
1016
|
}, watcher.repo)),
|
|
@@ -1060,7 +1062,8 @@ window.__ModuleLoader__.load({
|
|
|
1060
1062
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityReopened !== false, onChange: (v) => setDraft({ ...draft, priorityReopened: v }), label: '重开优先' }), '被重开的排最前'),
|
|
1061
1063
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityComments !== false, onChange: (v) => setDraft({ ...draft, priorityComments: v }), label: '评论优先' }), '有人在等回应的靠前'),
|
|
1062
1064
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityLabels !== false, onChange: (v) => setDraft({ ...draft, priorityLabels: v }), label: '标签优先' }), '带标签的靠前'),
|
|
1063
|
-
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityUnassigned === true, onChange: (v) => setDraft({ ...draft, priorityUnassigned: v }), label: '未认领优先' }), '没人认领的靠前(默认关:这是我们的判断,不是规则)')
|
|
1065
|
+
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityUnassigned === true, onChange: (v) => setDraft({ ...draft, priorityUnassigned: v }), label: '未认领优先' }), '没人认领的靠前(默认关:这是我们的判断,不是规则)'),
|
|
1066
|
+
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityStale === true, onChange: (v) => setDraft({ ...draft, priorityStale: v }), label: '积压优先' }), '躺了 30 天以上的靠前(默认关,只展示)')), '全部关掉时按 GitHub 的「最近更新」顺序处理'),
|
|
1064
1067
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.observe, onChange: (v) => setDraft({ ...draft, observe: v }), label: '仅观察' }), '仅观察(只记录不唤醒)'),
|
|
1065
1068
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.isolated, onChange: (v) => setDraft({ ...draft, isolated: v }), label: '隔离执行' }), '隔离执行(每次唤醒开一次性 worktree)'),
|
|
1066
1069
|
draft.isolated ? field('隔离工作目录', h(Input, { value: draft.workdir || '', placeholder: '绝对路径,留空 = 当前工作目录', onChange: (e) => setDraft({ ...draft, workdir: e.target.value }) })) : null,
|
|
@@ -1249,6 +1252,16 @@ window.__ModuleLoader__.load({
|
|
|
1249
1252
|
h('div', { className: 'dt-actions' },
|
|
1250
1253
|
h(Btn, { size: 'sm', variant: 'ghost', onClick: () => checkUpdate(true), disabled: checking }, checking ? '检查中…' : '重新检查')),
|
|
1251
1254
|
h(Hint, null, '升级要改 profile,装完需要重载一次宿主才会用上新版本 —— 所以这里只给命令,不替你执行。')),
|
|
1255
|
+
h(Section, { key: 'diagnose', title: '分诊信号与取舍' },
|
|
1256
|
+
h(Hint, null, '一次只处理 N 条时,这些信号的加权决定先后。事实默认展示,判断默认关闭。'),
|
|
1257
|
+
h('div', { className: 'dt-rows' }, (body.triageSignals || []).map((sig) => h('div', { key: sig.key, className: 'dt-row' },
|
|
1258
|
+
h('div', { className: 'dt-row-main' },
|
|
1259
|
+
h('div', { className: 'dt-row-title' },
|
|
1260
|
+
h('span', { className: 'dt-row-name' }, sig.label),
|
|
1261
|
+
h(Tag, { tone: sig.kind === 'fact' ? 'success' : 'warning' }, sig.kind === 'fact' ? '事实' : '判断'),
|
|
1262
|
+
h(Tag, { tone: sig.default ? 'outline' : 'quiet' }, sig.default ? '默认开' : '默认关'),
|
|
1263
|
+
h('span', { className: 'dt-row-meta' }, '+' + sig.weight + ' 分')),
|
|
1264
|
+
h('div', { className: 'dt-hint' }, sig.why)))))),
|
|
1252
1265
|
h(Section, { key: 'diagnose', title: '诊断' },
|
|
1253
1266
|
h(Hint, null, '反馈问题时把这段贴给对方:里面有版本、挂载状态和每条值守的最近错误(凭证已脱敏)。'),
|
|
1254
1267
|
h('div', { className: 'dt-actions' },
|
package/lib/index.js
CHANGED
|
@@ -24,13 +24,13 @@ import { redact } from './redact.js'
|
|
|
24
24
|
import { decodeBody } from './body.js'
|
|
25
25
|
import {
|
|
26
26
|
advanceSeen, applyWatcherAction, batchFresh, decideWake, DEFAULT_ACK_LABEL, formatWatchText,
|
|
27
|
-
accessNote, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, pushFiltered, normalizeFilters, partitionItems, passesFilters,
|
|
27
|
+
TRIAGE_SIGNALS, accessNote, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, pushFiltered, normalizeFilters, partitionItems, passesFilters,
|
|
28
28
|
mergeFilters, mergePollResult, pruneSeen, pruneWakeTimes, pushHistory, recordReported, staleWorktrees, worktreePlan,
|
|
29
29
|
} from './watch.js'
|
|
30
30
|
|
|
31
31
|
export const name = 'dsh-session-superagent'
|
|
32
32
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
33
|
-
export const SERVER_VERSION = '0.8.
|
|
33
|
+
export const SERVER_VERSION = '0.8.79'
|
|
34
34
|
export const inject = ['tools', 'agents', 'webServer']
|
|
35
35
|
|
|
36
36
|
/** 仅供测试:读写状态文件(生产代码不要用)。 */
|
|
@@ -1098,6 +1098,7 @@ export function apply(ctx) {
|
|
|
1098
1098
|
credentials: secretsSummary(),
|
|
1099
1099
|
sessionGoal: goalView(ctx, focusSession),
|
|
1100
1100
|
stateSource,
|
|
1101
|
+
triageSignals: TRIAGE_SIGNALS,
|
|
1101
1102
|
tokenScopes: scopesCache.value || null,
|
|
1102
1103
|
isolation: isolationReport(Object.values(state.watchers || {})),
|
|
1103
1104
|
sessionTitle: sessionTitle(focusSession),
|
|
@@ -1221,6 +1222,7 @@ export function apply(ctx) {
|
|
|
1221
1222
|
labels: body.priority.labels !== false,
|
|
1222
1223
|
// 默认关:没有官方依据支持"无人认领更紧急"
|
|
1223
1224
|
unassigned: body.priority.unassigned === true,
|
|
1225
|
+
stale: body.priority.stale === true,
|
|
1224
1226
|
}
|
|
1225
1227
|
}
|
|
1226
1228
|
// 隔离执行(对标 DeepSeek DSec):每次唤醒开一次性 worktree,改副本不碰主工作区
|
package/lib/watch.js
CHANGED
|
@@ -104,6 +104,7 @@ export function formatWatchText(repo, fresh, options = {}) {
|
|
|
104
104
|
item.html_url,
|
|
105
105
|
(stateReasonNote(item) && String(item.state_reason || '') === 'reopened') ? '⚠ ' + stateReasonNote(item) : null,
|
|
106
106
|
assignmentNote(item) || null,
|
|
107
|
+
(item.state === 'open' ? stalenessNote(item) : '') || null,
|
|
107
108
|
item.lastComment
|
|
108
109
|
? '最后评论: ' + commentSummaryLine({
|
|
109
110
|
login: item.lastComment.self ? '' : item.lastComment.login,
|
|
@@ -260,6 +261,7 @@ export function priorityScore(item, options) {
|
|
|
260
261
|
if (on.labels !== false && Array.isArray(item.labels) && item.labels.length > 0) score += 5
|
|
261
262
|
// 默认关闭:这是产品判断而非规则,客户想用再开
|
|
262
263
|
if (on.unassigned === true && assignmentNote(item) !== '') score += 3
|
|
264
|
+
if (on.stale === true && stalenessNote(item) !== '') score += 2
|
|
263
265
|
return score
|
|
264
266
|
}
|
|
265
267
|
|
|
@@ -779,3 +781,41 @@ export function assignmentNote(item) {
|
|
|
779
781
|
if (list.length > 0) return ''
|
|
780
782
|
return '未认领'
|
|
781
783
|
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* 分诊信号表:单一口径,回答「我们到底看哪些信号、哪些是事实、哪些是判断、默认开不开」。
|
|
787
|
+
*
|
|
788
|
+
* 为什么要这张表:信号散落在代码里,客户看不见我们的取舍;写进这里之后
|
|
789
|
+
* `/state` 会回传、面板能直接展示,改权重也不用改两处。
|
|
790
|
+
*
|
|
791
|
+
* `kind`:fact = GitHub 给的事实;judgment = 我们的产品判断(无官方依据)。
|
|
792
|
+
*/
|
|
793
|
+
export const TRIAGE_SIGNALS = [
|
|
794
|
+
{ key: 'reopened', label: '被重新打开', kind: 'fact', weight: 100, default: true, why: 'state_reason=reopened,说明之前判"不做"被推翻' },
|
|
795
|
+
{ key: 'comments', label: '有人评论', kind: 'fact', weight: 10, default: true, why: '在等回应' },
|
|
796
|
+
{ key: 'labels', label: '带标签', kind: 'fact', weight: 5, default: true, why: '命中过某个分类' },
|
|
797
|
+
{ key: 'unassigned', label: '无人认领', kind: 'judgment', weight: 3, default: false, why: '团队经验:没人认领更该看 —— 无官方依据,故默认关' },
|
|
798
|
+
{ key: 'stale', label: '长期没动静', kind: 'fact', weight: 2, default: false, why: 'open 且超过 30 天没更新(stale bot 默认 60 天)—— 默认只展示,开启后 +2 分' },
|
|
799
|
+
]
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* 「躺了多久」:open 且长期没更新 —— stale bot 的世界标准是 60 天(actions/stale 默认值)。
|
|
803
|
+
*
|
|
804
|
+
* 依据:actions/stale 的 `days-before-stale` 默认 **60** 天
|
|
805
|
+
* (https://github.com/actions/stale#readme),社区普遍用 30/60 两档。
|
|
806
|
+
* 我们只**展示**,默认不参与排序(和 unassigned 一样:先给事实,判断交给用户)。
|
|
807
|
+
*/
|
|
808
|
+
export function stalenessNote(item, options = {}) {
|
|
809
|
+
if (!item || typeof item !== 'object') return ''
|
|
810
|
+
const state = String(item.state || '')
|
|
811
|
+
if (state && state !== 'open') return ''
|
|
812
|
+
const stamp = item.updated_at || item.updatedAt
|
|
813
|
+
const at = Date.parse(stamp || '')
|
|
814
|
+
if (!Number.isFinite(at)) return ''
|
|
815
|
+
// 括号别省:Number(now) || (Date.now() - at) 会把 now 自己当成毫秒差(写错过一次)
|
|
816
|
+
const days = Math.floor(((Number(options.now) || Date.now()) - at) / (24 * 3600 * 1000))
|
|
817
|
+
if (!Number.isFinite(days) || days < 0) return ''
|
|
818
|
+
const threshold = Number(options.thresholdDays) || 30
|
|
819
|
+
if (days < threshold) return ''
|
|
820
|
+
return '躺了 ' + days + ' 天'
|
|
821
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.79",
|
|
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",
|