dsh-session-superagent 0.9.12 → 0.9.13
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 +22 -0
- package/README.md +1 -1
- package/client.js +37 -1
- package/lib/index.js +1 -1
- package/lib/watch.js +30 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
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.13] - 2026-11-02 —— 总览加「按仓库」汇总
|
|
6
|
+
|
|
7
|
+
### 学到的(知识库第 62 条)
|
|
8
|
+
NN/g《Progressive Disclosure》:把细节推迟到第二层,先给概览。
|
|
9
|
+
<https://www.nngroup.com/articles/progressive-disclosure/>
|
|
10
|
+
|
|
11
|
+
### 问题
|
|
12
|
+
总览把所有守平铺,守 5 个仓库时客户要一行行读才知道"哪个健康/哪个一直跳过"。仓库越多越像日志。
|
|
13
|
+
|
|
14
|
+
### 改法
|
|
15
|
+
`summarizeByRepo()` 按仓库聚合,总览顶部多一个「按仓库」小节:
|
|
16
|
+
状态点 + 仓库名 + 徽章(去重)+ `N 条守(启用 M)` + 最近唤醒 + 未回音 + 报错数。
|
|
17
|
+
排序:**报错 > 未回音≥2 > 其它**。
|
|
18
|
+
|
|
19
|
+
### 两个实现坑(都被用例抓到)
|
|
20
|
+
1. **必须跟随筛选**:用 `visible` 而不是 `watchers`,否则"只看只读"时下面的列表空了、上面还列着别的仓库;
|
|
21
|
+
2. `repoBadges` 在拆分后的 `gh-format.js` 里,`watch.js` 之前只做了 re-export 没 import ——
|
|
22
|
+
运行时 `repoBadges is not defined`。
|
|
23
|
+
|
|
24
|
+
### 测试
|
|
25
|
+
- 新增 1 例。合计 **157 例**。
|
|
26
|
+
|
|
5
27
|
## [0.9.12] - 2026-11-02 —— "叫醒了没回音"现在有下一步动作
|
|
6
28
|
|
|
7
29
|
### 学到的(知识库第 61 条)
|
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
|
|
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.13'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -1253,6 +1253,20 @@ window.__ModuleLoader__.load({
|
|
|
1253
1253
|
h('span', { className: 'dt-row-meta' }, ageText(event.at))),
|
|
1254
1254
|
h('div', { className: 'dt-hint' }, watcher.repo + ' · ' + event.text)))))))
|
|
1255
1255
|
|
|
1256
|
+
// 按仓库汇总:守多个仓库时先看哪个健康,再看明细(渐进披露)
|
|
1257
|
+
const repoSummary = visible.length === 0 ? null : h(Section, { key: 'repo-summary', title: '按仓库' },
|
|
1258
|
+
h('div', { className: 'dt-rows' }, ...summarizeByRepo(visible).map((group) => h('div', { key: 'repo-' + group.repo, className: 'dt-row' },
|
|
1259
|
+
h('div', { className: 'dt-row-main' },
|
|
1260
|
+
h('div', { className: 'dt-row-title' },
|
|
1261
|
+
h(StateDot, { state: group.errors > 0 ? 'error' : group.silentWakes >= 2 ? 'warning' : 'done' }),
|
|
1262
|
+
h('span', { className: 'dt-row-name' }, group.repo),
|
|
1263
|
+
...group.badges.map((badge) => h(Tag, { key: 'rb-' + badge.text, tone: badge.tone }, badge.text))),
|
|
1264
|
+
h('div', { className: 'dt-row-meta' },
|
|
1265
|
+
h('span', null, group.count + ' 条守(启用 ' + group.enabled + ')'),
|
|
1266
|
+
h('span', null, group.lastWake ? '最近唤醒 ' + ageText(group.lastWake) : '还没唤醒过'),
|
|
1267
|
+
group.silentWakes > 0 ? h('span', { className: 'dt-error-text' }, '未回音 ' + group.silentWakes + ' 次') : null,
|
|
1268
|
+
group.errors > 0 ? h('span', { className: 'dt-error-text' }, group.errors + ' 条报错') : null))))))
|
|
1269
|
+
|
|
1256
1270
|
const trigger = h(Section, { title: '新增主理鱼' },
|
|
1257
1271
|
h('div', { className: 'dt-form' },
|
|
1258
1272
|
field('仓库', h(Input, { value: form.repo, placeholder: 'owner/name', onChange: (e) => setForm({ ...form, repo: e.target.value }) })),
|
|
@@ -1420,6 +1434,27 @@ window.__ModuleLoader__.load({
|
|
|
1420
1434
|
'- **无论做还是不做,最后都要 watch_ack 打标签**,否则下一轮会被再次唤醒。',
|
|
1421
1435
|
].join(String.fromCharCode(10))
|
|
1422
1436
|
|
|
1437
|
+
/** 按仓库汇总(与服务端 watch.js:summarizeByRepo 同语义)。 */
|
|
1438
|
+
function summarizeByRepo(list) {
|
|
1439
|
+
const groups = new Map()
|
|
1440
|
+
for (const watcher of Array.isArray(list) ? list : []) {
|
|
1441
|
+
if (!watcher || !watcher.repo) continue
|
|
1442
|
+
const repo = String(watcher.repo)
|
|
1443
|
+
const group = groups.get(repo) || { repo, count: 0, lastWake: null, silentWakes: 0, errors: 0, enabled: 0, badges: [] }
|
|
1444
|
+
group.count += 1
|
|
1445
|
+
if (watcher.enabled !== false) group.enabled += 1
|
|
1446
|
+
if (watcher.lastWake && (!group.lastWake || String(watcher.lastWake) > String(group.lastWake))) group.lastWake = watcher.lastWake
|
|
1447
|
+
group.silentWakes = Math.max(group.silentWakes, Number(watcher.silentWakes) || 0)
|
|
1448
|
+
if (watcher.lastError) group.errors += 1
|
|
1449
|
+
for (const badge of repoBadges(watcher.repoAccess) || []) {
|
|
1450
|
+
if (!group.badges.some((b) => b.text === badge.text)) group.badges.push(badge)
|
|
1451
|
+
}
|
|
1452
|
+
groups.set(repo, group)
|
|
1453
|
+
}
|
|
1454
|
+
const weight = (g) => (g.errors > 0 ? 0 : g.silentWakes >= 2 ? 1 : 2)
|
|
1455
|
+
return [...groups.values()].sort((a, b) => (weight(a) - weight(b)) || a.repo.localeCompare(b.repo))
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1423
1458
|
/** 持续时长(与服务端 watch.js:durationText 同语义)。 */
|
|
1424
1459
|
function durationText(sinceIso, untilIso) {
|
|
1425
1460
|
const from = Date.parse(String(sinceIso || ''))
|
|
@@ -1508,6 +1543,7 @@ window.__ModuleLoader__.load({
|
|
|
1508
1543
|
snap.error ? h('div', { className: 'dt-banner dt-danger' }, '读取失败:' + humanizeError(snap.error)) : null,
|
|
1509
1544
|
snap.loading && !snap.body ? h(Hint, null, '正在读取…') : null,
|
|
1510
1545
|
tab === 'overview' ? overview : null,
|
|
1546
|
+
tab === 'overview' ? repoSummary : null,
|
|
1511
1547
|
tab === 'judge' ? judge : null,
|
|
1512
1548
|
tab === 'judge' ? timeline : null,
|
|
1513
1549
|
tab === 'trigger' ? trigger : null,
|
package/lib/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
|
|
33
33
|
export const name = 'dsh-session-superagent'
|
|
34
34
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
35
|
-
export const SERVER_VERSION = '0.9.
|
|
35
|
+
export const SERVER_VERSION = '0.9.13'
|
|
36
36
|
export const inject = ['tools', 'agents', 'webServer']
|
|
37
37
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
38
38
|
const DEFAULT_SESSION_WAKES = 12
|
package/lib/watch.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Kept separate so the behaviour that matters (what counts as news, when a wake
|
|
5
5
|
* is allowed, what the wake text says) is unit-testable without a DSH host.
|
|
6
6
|
*/
|
|
7
|
+
import { repoBadges } from './gh-format.js'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Split items into "report now" and "absorb silently".
|
|
@@ -693,3 +694,32 @@ export function silentStreak({ previousWakeAt, lastAckedAt, previousStreak = 0 }
|
|
|
693
694
|
if (Number.isFinite(ackAt) && ackAt >= wakeAt) return 0
|
|
694
695
|
return streak + 1
|
|
695
696
|
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* 按仓库汇总:守 5 个仓库时,平铺的列表看不出"哪个健康、哪个一直跳过"。
|
|
700
|
+
*
|
|
701
|
+
* 这是渐进披露(progressive disclosure)在数据层的落实:
|
|
702
|
+
* 先给每仓库一行摘要,细节留在下面的明细里。
|
|
703
|
+
* 出处:https://www.nngroup.com/articles/progressive-disclosure/
|
|
704
|
+
*/
|
|
705
|
+
export function summarizeByRepo(watchers) {
|
|
706
|
+
const list = Array.isArray(watchers) ? watchers.filter((w) => w && w.repo) : []
|
|
707
|
+
const groups = new Map()
|
|
708
|
+
for (const watcher of list) {
|
|
709
|
+
const repo = String(watcher.repo)
|
|
710
|
+
const group = groups.get(repo) || { repo, count: 0, lastWake: null, lastPoll: null, silentWakes: 0, errors: 0, enabled: 0, badges: [] }
|
|
711
|
+
group.count += 1
|
|
712
|
+
if (watcher.enabled !== false) group.enabled += 1
|
|
713
|
+
if (watcher.lastWake && (!group.lastWake || String(watcher.lastWake) > String(group.lastWake))) group.lastWake = watcher.lastWake
|
|
714
|
+
if (watcher.lastPoll && (!group.lastPoll || String(watcher.lastPoll) > String(group.lastPoll))) group.lastPoll = watcher.lastPoll
|
|
715
|
+
group.silentWakes = Math.max(group.silentWakes, Number(watcher.silentWakes) || 0)
|
|
716
|
+
if (watcher.lastError) group.errors += 1
|
|
717
|
+
for (const badge of repoBadges(watcher.repoAccess) || []) {
|
|
718
|
+
if (!group.badges.some((b) => b.text === badge.text)) group.badges.push(badge)
|
|
719
|
+
}
|
|
720
|
+
groups.set(repo, group)
|
|
721
|
+
}
|
|
722
|
+
// 有问题的排前面:错误 > 未回音 >= 2 > 其余;同类按仓库名
|
|
723
|
+
const weight = (g) => (g.errors > 0 ? 0 : g.silentWakes >= 2 ? 1 : 2)
|
|
724
|
+
return [...groups.values()].sort((a, b) => (weight(a) - weight(b)) || a.repo.localeCompare(b.repo))
|
|
725
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.13",
|
|
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",
|