dsh-session-superagent 0.8.68 → 0.8.69
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 +21 -0
- package/MAINTENANCE.md +1 -1
- package/README.md +2 -2
- package/client.js +1 -1
- package/lib/index.js +14 -3
- package/lib/watch.js +20 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.69] - 2026-11-02 —— 填错仓库名时给个"是不是想填 X"
|
|
6
|
+
|
|
7
|
+
### 学到的(知识库第 18 条,实测数字)
|
|
8
|
+
`search/repositories` 的响应头本机实测:`x-ratelimit-limit: 30`(30 次/分钟);
|
|
9
|
+
对照 core 的 `5000` —— **两个池差 166 倍**。
|
|
10
|
+
<https://docs.github.com/en/rest/search/search#search-repositories>
|
|
11
|
+
|
|
12
|
+
这给知识库第 16 条(限流分池)补上了具体数字,也决定了本轮实现的边界。
|
|
13
|
+
|
|
14
|
+
### 改了什么
|
|
15
|
+
添加守时若仓库 404,用搜索找最像的仓库,提示「是不是想填 owner/name?」。因为 search 池很紧:
|
|
16
|
+
- 只在 **404 之后**才搜(正常路径零调用);
|
|
17
|
+
- 名字短于 5 字符不搜;
|
|
18
|
+
- `per_page=5` 拿到就停;
|
|
19
|
+
- 搜索失败/被限流**静默放弃**,不影响添加。
|
|
20
|
+
|
|
21
|
+
排序规则:**仓库名完全相同 > 名字包含**;owner 相同但仓库名不相关的**不给建议**(避免误导)。
|
|
22
|
+
|
|
23
|
+
### 测试
|
|
24
|
+
- 新增 1 例(同名优先 / 包含关系 / 不相关不乱猜 / 空输入 / 无候选 / 短名同名)。合计 **122 例**。
|
|
25
|
+
|
|
5
26
|
## [0.8.68] - 2026-11-02 —— 添加时就告诉你仓库有问题,不用等十几秒
|
|
6
27
|
|
|
7
28
|
### 学到的(知识库第 17 条)
|
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` 122/122 通过
|
|
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 # 122 项单测
|
|
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.69'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
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, classifyGhError, repoStructureNote, countReasons, filterReason, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, pushFiltered, normalizeFilters, partitionItems, passesFilters,
|
|
27
|
+
accessNote, classifyGhError, 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.69'
|
|
34
34
|
export const inject = ['tools', 'agents', 'webServer']
|
|
35
35
|
|
|
36
36
|
/** 仅供测试:读写状态文件(生产代码不要用)。 */
|
|
@@ -572,7 +572,18 @@ async function precheckRepo(repo) {
|
|
|
572
572
|
if (res.code !== 0) {
|
|
573
573
|
const detail = redact(res.stderr)
|
|
574
574
|
if (detail.includes('404')) {
|
|
575
|
-
|
|
575
|
+
let hint = ''
|
|
576
|
+
// 只在 404 之后才搜一次:search 池是 30 次/分钟(core 是 5000),不能滥用
|
|
577
|
+
const name = repo.split('/')[1] || repo
|
|
578
|
+
if (name.length >= 5) {
|
|
579
|
+
const search = await run('gh', ['api', 'search/repositories?q=' + encodeURIComponent(name + ' in:name') + '&per_page=5', '--jq', '.items[].full_name'],
|
|
580
|
+
{ timeoutMs: 10000, env: ghEnv() })
|
|
581
|
+
if (search.code === 0) {
|
|
582
|
+
const picked = pickSuggestion(repo, String(search.stdout || '').split(String.fromCharCode(10)).map((v) => v.trim()).filter(Boolean))
|
|
583
|
+
if (picked) hint = ' 是不是想填 ' + picked + '?'
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
warnings.push('仓库 ' + repo + ' 不存在,或当前 token 没有访问权限 —— 先确认名字(owner/name)与权限。' + hint)
|
|
576
587
|
return { warnings, notFound: true }
|
|
577
588
|
}
|
|
578
589
|
warnings.push('添加前没能确认这个仓库(' + detail.slice(0, 100) + '),稍后会在面板里再次探测。')
|
package/lib/watch.js
CHANGED
|
@@ -619,3 +619,23 @@ export function repoBadges(repoAccess) {
|
|
|
619
619
|
if (repoAccess.private === true) badges.push({ text: '私有', tone: 'outline' })
|
|
620
620
|
return badges
|
|
621
621
|
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* 仓库名纠错:404 之后从搜索结果里挑一个最像的,别让客户自己猜。
|
|
625
|
+
*
|
|
626
|
+
* 依据:`GET /search/repositories?q=<name>+in:name` 能按仓库名检索;
|
|
627
|
+
* **但它走独立的 search 池**(本机实测 response header:`x-ratelimit-limit: 30`,
|
|
628
|
+
* 即 30 次/分钟,远小于 core 的 5000)—— 所以只能在 404 之后偶尔调用,绝不能每轮轮询都用。
|
|
629
|
+
* 出处:https://docs.github.com/en/rest/search/search#search-repositories
|
|
630
|
+
*/
|
|
631
|
+
export function pickSuggestion(query, candidates) {
|
|
632
|
+
const wanted = String(query || '').trim().toLowerCase()
|
|
633
|
+
if (!wanted) return null
|
|
634
|
+
const list = Array.isArray(candidates) ? candidates.filter((name) => typeof name === 'string') : []
|
|
635
|
+
const exactName = wanted.includes('/') ? wanted.split('/')[1] : wanted
|
|
636
|
+
// 优先级:仓库名完全相同 > 名字里包含 > 仅 owner 相同(最后这种基本没价值,直接丢)
|
|
637
|
+
const sameName = list.find((name) => name.toLowerCase().endsWith('/' + exactName))
|
|
638
|
+
if (sameName) return sameName
|
|
639
|
+
const contains = list.find((name) => name.toLowerCase().includes(exactName) && exactName.length >= 4)
|
|
640
|
+
return contains || null
|
|
641
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.69",
|
|
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",
|