dsh-session-superagent 0.9.178 → 0.9.179
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 +36 -0
- package/README.md +2 -2
- package/client.js +1 -1
- package/lib/gitee.js +6 -2
- package/lib/index.js +17 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
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.179] - 2026-11-04 —— 兼容 DSH 0.2.2-rc.1(静态核对)+ Gitee 增量轮询
|
|
6
|
+
|
|
7
|
+
### 一、DSH 0.2.2-rc.1 兼容核对(不装新版也能查)
|
|
8
|
+
`npm dist-tags` 显示 `next = 0.2.2-rc.1`。逐个比对 `.d.ts`(而不是读 release notes):
|
|
9
|
+
|
|
10
|
+
| 检查 | 结果 |
|
|
11
|
+
|---|---|
|
|
12
|
+
| CLI 包 `lib/types/*.d.ts` | 与 0.2.1-rc.5 **逐字相同** |
|
|
13
|
+
| `dsh-web-app`(webServer 服务) | 逐字相同 |
|
|
14
|
+
| `dsh-goal`(goals 服务) | 逐字相同 |
|
|
15
|
+
| cordis 4.0.5 → 4.1.0 | `ctx.effect` / `ctx.on` / `ctx.get` 契约不变;**日志级别数值重排**(INFO/WARN 互换);provision 形状 `{fiber}` → `{ctx,uid}` |
|
|
16
|
+
| Node 引擎 | 新宿主要求 **≥24.9.0**(我们声明 ≥22.19,是下界,没问题) |
|
|
17
|
+
|
|
18
|
+
**改了一处**:`apply()` 先检查 `ctx.tools`,缺了只打一条日志就返回 ——
|
|
19
|
+
即使某个服务改名,也只是"这个插件不工作",不会拖垮整棵插件树。
|
|
20
|
+
|
|
21
|
+
### 二、Gitee 增量轮询(看 Gitee 帮助中心时顺手挖到的)
|
|
22
|
+
Gitee 没有 ETag,之前每轮全量读。实测它**支持 `since`**:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
全量 34 条 → since(24h) 5 条
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
现在按「上次水位 - 30 分钟安全边际」传 `since`;首次轮询仍全量。
|
|
29
|
+
|
|
30
|
+
### 三、关于 `help.gitee.com/ide-plugin`
|
|
31
|
+
那一页是 **IDE 插件**(IDEA / VS / Eclipse / Atom)的集成说明,与守护进程无关 ——
|
|
32
|
+
没有可用的 CLI 或服务端接口可抄。真正的可用面是 Open API v5,`since` 就是从那儿试出来的。
|
|
33
|
+
|
|
34
|
+
### 证据
|
|
35
|
+
```
|
|
36
|
+
node --test → 287/287(新增 since 拼 URL、缺 tools 不抛)
|
|
37
|
+
preflight 全量 → 37/37
|
|
38
|
+
真机:listGiteeItems 全量 34 条 / since 5 条
|
|
39
|
+
```
|
|
40
|
+
|
|
5
41
|
## [0.9.178] - 2026-11-04 —— 用真实 Gitee 响应校对:编号是字符串,不是数字
|
|
6
42
|
|
|
7
43
|
### 怎么发现的
|
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
|
|
|
@@ -144,7 +144,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
|
|
|
144
144
|
## 开发
|
|
145
145
|
|
|
146
146
|
```sh
|
|
147
|
-
node --test #
|
|
147
|
+
node --test # 287 项单测
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
### 工具输出:文本给人和 agent,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.179'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/gitee.js
CHANGED
|
@@ -95,8 +95,12 @@ async function request(path, { token, method = 'GET', body = null, fetchImpl = g
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/** 拉一页 issue + PR(Gitee 两者分属不同端点,缺 token 时公开仓库也能读)。 */
|
|
98
|
-
export async function listGiteeItems({ repo, token = '', perPage = 20, fetchImpl } = {}) {
|
|
99
|
-
|
|
98
|
+
export async function listGiteeItems({ repo, token = '', perPage = 20, since = '', fetchImpl } = {}) {
|
|
99
|
+
// `since` 是 Gitee 少有的、能省流量的手段(没有 ETag 条件请求)。
|
|
100
|
+
// 真机验证:since 传给未来时间 → 返回 [];传今天 → 只返回今天之后更新的。
|
|
101
|
+
// 两个端点都支持,缺了它就只能每轮全量读。
|
|
102
|
+
const sinceQ = since ? '&since=' + encodeURIComponent(String(since)) : ''
|
|
103
|
+
const q = 'state=all&sort=updated&direction=desc&per_page=' + Math.max(1, Math.min(100, Number(perPage) || 20)) + sinceQ
|
|
100
104
|
const [issues, pulls] = await Promise.all([
|
|
101
105
|
request(`/repos/${repo}/issues?${q}`, { token, fetchImpl }),
|
|
102
106
|
request(`/repos/${repo}/pulls?${q}`, { token, fetchImpl }),
|
package/lib/index.js
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
|
|
43
43
|
export const name = 'dsh-session-superagent'
|
|
44
44
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
45
|
-
export const SERVER_VERSION = '0.9.
|
|
45
|
+
export const SERVER_VERSION = '0.9.179'
|
|
46
46
|
export const inject = ['tools', 'agents', 'webServer']
|
|
47
47
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
48
48
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -950,7 +950,16 @@ async function pollOnce(ctx, entry, baseMs) {
|
|
|
950
950
|
// Gitee 没有 gh CLI、没有 GraphQL、没有 ETag 条件请求;用 REST v5 拉一页,
|
|
951
951
|
// 在 lib/gitee.js 里归一成和 GitHub 一样的条目形状,下面所有筛选/唤醒逻辑共用。
|
|
952
952
|
if (entry.provider === 'gitee') {
|
|
953
|
-
|
|
953
|
+
// 没有 ETag,就用 `since` 只取「上次水位之后更新过」的条目 —— 省的是每轮的解析与带宽。
|
|
954
|
+
// 安全边际 30 分钟:宁可多读一轮,也不能因为时钟偏差漏掉一条。首次轮询没有水位,仍然全量。
|
|
955
|
+
const sinceIso = (() => {
|
|
956
|
+
const base = entry.cursor || entry.lastPoll
|
|
957
|
+
if (!base) return ''
|
|
958
|
+
const t = Date.parse(base)
|
|
959
|
+
if (!Number.isFinite(t)) return ''
|
|
960
|
+
return new Date(Math.max(0, t - 30 * 60 * 1000)).toISOString()
|
|
961
|
+
})()
|
|
962
|
+
const listed = await listGiteeItems({ repo: entry.repo, token: String(readSecrets().giteeToken || ''), perPage: 20, since: sinceIso })
|
|
954
963
|
entry.lastPoll = new Date().toISOString()
|
|
955
964
|
if (!listed.ok) {
|
|
956
965
|
const status = Number(listed.status) || 0
|
|
@@ -1338,6 +1347,12 @@ async function pollWithItems(ctx, entry, baseMs, parsed) {
|
|
|
1338
1347
|
}
|
|
1339
1348
|
|
|
1340
1349
|
export function apply(ctx) {
|
|
1350
|
+
// 宿主升级(如 0.2.2-rc.1)时最可能变的不是我们的逻辑,而是服务名/形状。
|
|
1351
|
+
// 一条守挂了不该拖垮整个插件树:缺服务就只打一条日志,其余能力继续挂。
|
|
1352
|
+
if (!ctx || !ctx.tools || typeof ctx.tools.register !== 'function') {
|
|
1353
|
+
try { console.error('[session-superagent] 宿主没有提供 tools 服务:插件能力不可用,但不影响宿主') } catch {}
|
|
1354
|
+
return
|
|
1355
|
+
}
|
|
1341
1356
|
const timers = sharedTimers
|
|
1342
1357
|
// 并发闸的唯一事实源:tick 和 HTTP「立刻」拿到的是两个不同的 entry 对象,
|
|
1343
1358
|
// 靠 entry.polling 标记永远对不上(审核专员 probe-c 实证:同一条被唤醒 3 次)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.179",
|
|
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",
|