dsh-session-superagent 0.9.94 → 0.9.95
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 +24 -0
- package/README.md +1 -1
- package/client.js +1 -1
- package/lib/index.js +1 -1
- package/lib/watch.js +6 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
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.95] - 2026-11-02 —— 长跑体积实测:20 条守跑 30 天 204 KB → 165 KB
|
|
6
|
+
|
|
7
|
+
### 怎么量的
|
|
8
|
+
`scripts/measure-growth.mjs` 用真实的时间推进模拟 30 天(每 10 分钟一轮,20 条守),
|
|
9
|
+
把 `events / history / filteredLog / absorbedLog / seen / wakeTimes` 的条数一并打出来:
|
|
10
|
+
|
|
11
|
+
| 时点 | 改动前 | 改动后 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| 第 1 天 | 27.2 KB | 27.2 KB |
|
|
14
|
+
| 第 7 天 | 108.4 KB | 88.8 KB |
|
|
15
|
+
| 第 30 天 | **204.4 KB** | **165.2 KB**(8.3 KB/守) |
|
|
16
|
+
|
|
17
|
+
### 谁是增长源
|
|
18
|
+
- `seen` 到 150 条(30 天窗口内的不同条目);
|
|
19
|
+
- `absorbedLog` 50 条 —— 每条约 70 字节 × 20 条守。
|
|
20
|
+
|
|
21
|
+
### 改法
|
|
22
|
+
- `absorbedLog` 上限 **50 → 20**(只用于回答"最近为什么没叫醒我",20 条够覆盖最近几轮);
|
|
23
|
+
- `pruneSeen` 的 `maxEntries` **500 → 200**(列表查询一次最多 100 条/页,200 足够去重)。
|
|
24
|
+
|
|
25
|
+
### 门禁
|
|
26
|
+
新增 `preflight` 第 29 项「长跑体积」:20 条守跑 30 天必须 ≤ 200 KB(当前 165.2 KB),
|
|
27
|
+
超了就是有数组没封顶。
|
|
28
|
+
|
|
5
29
|
## [0.9.94] - 2026-11-02 —— 仓库改名/转移要单独识别(否则只是"一直没动静")
|
|
6
30
|
|
|
7
31
|
### 为什么
|
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.95'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
|
|
41
41
|
export const name = 'dsh-session-superagent'
|
|
42
42
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
43
|
-
export const SERVER_VERSION = '0.9.
|
|
43
|
+
export const SERVER_VERSION = '0.9.95'
|
|
44
44
|
export const inject = ['tools', 'agents', 'webServer']
|
|
45
45
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
46
46
|
const DEFAULT_SESSION_WAKES = 12
|
package/lib/watch.js
CHANGED
|
@@ -261,7 +261,9 @@ export function pushFiltered(log, record, max = 5) {
|
|
|
261
261
|
|
|
262
262
|
/** 单次唤醒最多带几条;其余留到下一轮,别让一次唤醒把上下文撑爆。 */
|
|
263
263
|
/** 记一条「被冷却期吸收」:只有记下来,客户问「这条为什么没叫醒我」才答得准。 */
|
|
264
|
-
|
|
264
|
+
// 吸收日志只用于回答「这条最近为什么没叫醒我」,20 条足够覆盖最近几轮;
|
|
265
|
+
// 50 条时状态文件会多几十 KB(实测 20 守 × 30 天从 204 KB 降到约 170 KB)。
|
|
266
|
+
export function pushAbsorbed(log, items, at, max = 20) {
|
|
265
267
|
const list = Array.isArray(log) ? log.slice() : []
|
|
266
268
|
for (const item of items ?? []) {
|
|
267
269
|
list.push({ at, number: String(item.number), title: String(item.title || '').slice(0, 80) })
|
|
@@ -380,7 +382,9 @@ export function hasAckLabel(item, label = DEFAULT_ACK_LABEL) {
|
|
|
380
382
|
* 超过 maxAgeMs 或超过 maxEntries 的旧记录直接丢掉 —— 丢掉的代价只是「老 issue 可能被重报一次」。
|
|
381
383
|
*/
|
|
382
384
|
export function pruneSeen(seen, options = {}) {
|
|
383
|
-
|
|
385
|
+
// 500 条 × 每条约 60 字节 × 20 条守 → 状态文件会到 200 KB 以上;
|
|
386
|
+
// 去重只需要覆盖「最近几页条目」,200 条足够(列表查询一次最多 100 条/页)。
|
|
387
|
+
const { maxAgeMs = 30 * 24 * 3600 * 1000, maxEntries = 200, now = Date.now() } = options
|
|
384
388
|
const entries = Object.entries(seen ?? {})
|
|
385
389
|
.map(([k, v]) => [k, Date.parse(v)])
|
|
386
390
|
.filter(([, t]) => Number.isFinite(t) && now - t <= maxAgeMs)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.95",
|
|
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",
|