dsh-session-superagent 0.8.67 → 0.8.68
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 +16 -0
- package/MAINTENANCE.md +1 -1
- package/README.md +2 -2
- package/client.js +8 -3
- package/lib/index.js +56 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
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.68] - 2026-11-02 —— 添加时就告诉你仓库有问题,不用等十几秒
|
|
6
|
+
|
|
7
|
+
### 学到的(知识库第 17 条)
|
|
8
|
+
`GET /repos/{owner}/{repo}` 对**不存在**和**无权访问**都返回 404 —— 所以文案必须同时覆盖两种可能,
|
|
9
|
+
否则会误导。而 `has_issues` / `archived` / `permissions.push` 都是"读一次就知道"的事实,
|
|
10
|
+
没有理由等运行失败才说。
|
|
11
|
+
<https://docs.github.com/en/rest/repos/repos#get-a-repository>
|
|
12
|
+
|
|
13
|
+
### 改了什么
|
|
14
|
+
- 新建守时**同步**体检(10 秒超时),结论直接放进 `POST /watch` 的响应 `warnings`;
|
|
15
|
+
- 面板拿到就立刻提示:`已添加,但注意:仓库 o/x 不存在,或当前 token 没有访问权限 …`;
|
|
16
|
+
- **只告警不阻断**(网络抖动不该让人加不了守);编辑已有守不做体检;测试环境跳过网络但字段保留。
|
|
17
|
+
|
|
18
|
+
### 测试
|
|
19
|
+
- 新增 1 例:`POST /watch` 的 `warnings` 必须始终是数组。合计 **121 例**。
|
|
20
|
+
|
|
5
21
|
## [0.8.67] - 2026-11-02 —— 能力徽章可点筛选;顺手记下「限流是分池的」
|
|
6
22
|
|
|
7
23
|
### 学到的(知识库第 16 条,判断准则)
|
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` 121/121 通过
|
|
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 # 121 项单测
|
|
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.68'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -925,7 +925,7 @@ window.__ModuleLoader__.load({
|
|
|
925
925
|
}, action === 'pause' ? '全部已暂停' : '全部已恢复')
|
|
926
926
|
|
|
927
927
|
const addWatcher = () => run(async () => {
|
|
928
|
-
await call('/watch', {
|
|
928
|
+
const created = await call('/watch', {
|
|
929
929
|
method: 'POST',
|
|
930
930
|
body: JSON.stringify({
|
|
931
931
|
repo: form.repo.trim(),
|
|
@@ -945,7 +945,12 @@ window.__ModuleLoader__.load({
|
|
|
945
945
|
}),
|
|
946
946
|
})
|
|
947
947
|
setForm({ repo: '', intervalSec: form.intervalSec, goal: '', labels: '', onlyAssigned: false, activeHours: form.activeHours, isolated: form.isolated, workdir: form.workdir, observe: form.observe })
|
|
948
|
-
|
|
948
|
+
// 添加前体检的警告直接说出来:填错仓库名 / 只读 / 归档,这一刻讲最省事
|
|
949
|
+
const warnings = (created && Array.isArray(created.warnings)) ? created.warnings : []
|
|
950
|
+
if (warnings.length > 0) notify('已添加,但注意:' + warnings.join(' / '), 'error')
|
|
951
|
+
else notify('已添加,首轮立即开始轮询', 'info')
|
|
952
|
+
return warnings
|
|
953
|
+
}, null)
|
|
949
954
|
|
|
950
955
|
const saveCredentials = () => run(async () => {
|
|
951
956
|
const payload = {}
|
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
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.68'
|
|
34
34
|
export const inject = ['tools', 'agents', 'webServer']
|
|
35
35
|
|
|
36
36
|
/** 仅供测试:读写状态文件(生产代码不要用)。 */
|
|
@@ -549,6 +549,51 @@ async function tokenScopes() {
|
|
|
549
549
|
return value
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* 新增守之前的即时体检:仓库在不在、能不能写、有没有 issue。
|
|
555
|
+
*
|
|
556
|
+
* 为什么放在这里:`probeAccess` 是后台跑的,客户要等到下一次 /state 才看到提示;
|
|
557
|
+
* 而"填错仓库名"是最常见的输入错误,应该在点「添加」那一刻就说。
|
|
558
|
+
*
|
|
559
|
+
* 依据:`GET /repos/{owner}/{repo}` 对不存在的仓库(或无权访问的私有仓库)返回 404 ——
|
|
560
|
+
* 官方文档把这两种情况归为同一个响应,所以文案要一起说「不存在或没有权限」。
|
|
561
|
+
* 出处:https://docs.github.com/en/rest/repos/repos#get-a-repository
|
|
562
|
+
*
|
|
563
|
+
* 注意:**只产出警告,不阻止创建** —— 网络抖动不该让客户没法添加;
|
|
564
|
+
* 测试环境(DSH_SUPERAGENT_NO_POLL=1)直接跳过,避免单测依赖网络。
|
|
565
|
+
*/
|
|
566
|
+
async function precheckRepo(repo) {
|
|
567
|
+
const warnings = []
|
|
568
|
+
if (process.env.DSH_SUPERAGENT_NO_POLL === '1') return { warnings, skipped: true }
|
|
569
|
+
const res = await run('gh', ['api', 'repos/' + repo, '--jq',
|
|
570
|
+
'{push: .permissions.push, hasIssues: .has_issues, archived: .archived, disabled: .disabled, private: .private, fork: .fork, parent: (.parent.full_name // null)}',
|
|
571
|
+
], { timeoutMs: 10000, env: ghEnv() })
|
|
572
|
+
if (res.code !== 0) {
|
|
573
|
+
const detail = redact(res.stderr)
|
|
574
|
+
if (detail.includes('404')) {
|
|
575
|
+
warnings.push('仓库 ' + repo + ' 不存在,或当前 token 没有访问权限 —— 先确认名字(owner/name)与权限。')
|
|
576
|
+
return { warnings, notFound: true }
|
|
577
|
+
}
|
|
578
|
+
warnings.push('添加前没能确认这个仓库(' + detail.slice(0, 100) + '),稍后会在面板里再次探测。')
|
|
579
|
+
return { warnings }
|
|
580
|
+
}
|
|
581
|
+
let info = {}
|
|
582
|
+
try { info = JSON.parse(res.stdout) } catch { return { warnings } }
|
|
583
|
+
const note = repoStructureNote({
|
|
584
|
+
repo,
|
|
585
|
+
hasIssues: info.hasIssues !== false,
|
|
586
|
+
archived: info.archived === true,
|
|
587
|
+
disabled: info.disabled === true,
|
|
588
|
+
fork: info.fork === true,
|
|
589
|
+
parent: info.parent || null,
|
|
590
|
+
push: info.push === true,
|
|
591
|
+
private: info.private === true,
|
|
592
|
+
})
|
|
593
|
+
if (note) warnings.push(note)
|
|
594
|
+
return { warnings, access: { repo, push: info.push === true, private: info.private === true, fork: info.fork === true, hasIssues: info.hasIssues !== false, archived: info.archived === true, disabled: info.disabled === true, parent: info.parent || null, checkedAt: new Date().toISOString() } }
|
|
595
|
+
}
|
|
596
|
+
|
|
552
597
|
/** 隔离区占用:客户长期运行会攒下一堆一次性 worktree,面板上得看得见。 */
|
|
553
598
|
function isolationReport(entries) {
|
|
554
599
|
const roots = new Map()
|
|
@@ -1074,6 +1119,7 @@ export function apply(ctx) {
|
|
|
1074
1119
|
const state = readState()
|
|
1075
1120
|
state.watchers = state.watchers || {}
|
|
1076
1121
|
const id = repo + '#' + sessionId
|
|
1122
|
+
const created = !(state.watchers && state.watchers[id])
|
|
1077
1123
|
const entry = state.watchers[id] || {
|
|
1078
1124
|
id, repo, sessionId, cursor: null, seen: {}, lastReported: {},
|
|
1079
1125
|
cooldownMs: 180000, createdAt: new Date().toISOString(),
|
|
@@ -1105,6 +1151,14 @@ export function apply(ctx) {
|
|
|
1105
1151
|
entry.nextAt = null
|
|
1106
1152
|
// 没传 enabled 就保持原值:只改间隔/标签不该把暂停的 watcher 悄悄恢复
|
|
1107
1153
|
entry.enabled = body.enabled === undefined ? (entry.enabled !== false) : body.enabled !== false
|
|
1154
|
+
// 只有**新建**时才做添加前体检:编辑已有守不该再打一次网络
|
|
1155
|
+
const isNew = !created && !state.watchers[id]
|
|
1156
|
+
let warnings = []
|
|
1157
|
+
if (isNew) {
|
|
1158
|
+
const pre = await precheckRepo(repo)
|
|
1159
|
+
warnings = pre.warnings || []
|
|
1160
|
+
if (pre.access) entry.repoAccess = pre.access
|
|
1161
|
+
}
|
|
1108
1162
|
state.watchers[id] = entry
|
|
1109
1163
|
writeState(state)
|
|
1110
1164
|
// 编辑已有 watcher 时,间隔/配置变化要立刻生效:startWatcher 会因为 timer 已存在而直接返回
|
|
@@ -1114,7 +1168,7 @@ export function apply(ctx) {
|
|
|
1114
1168
|
|
|
1115
1169
|
startWatcher(entry)
|
|
1116
1170
|
}
|
|
1117
|
-
json(res, 200, { ok: true, id, repo, intervalSec, enabled: entry.enabled })
|
|
1171
|
+
json(res, 200, { ok: true, id, repo, intervalSec, enabled: entry.enabled, warnings })
|
|
1118
1172
|
},
|
|
1119
1173
|
})
|
|
1120
1174
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.68",
|
|
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",
|