dsh-session-superagent 0.9.34 → 0.9.35
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 +23 -0
- package/README.md +1 -1
- package/client.js +7 -2
- package/lib/index.js +3 -1
- package/lib/watch.js +22 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
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.35] - 2026-11-02 —— 「今天明显比平时忙」:阈值故意定高
|
|
6
|
+
|
|
7
|
+
### 学到的(知识库第 83 条)
|
|
8
|
+
用历史影响判断时,阈值要故意定高 —— 告警疲劳的代价远大于少提示一次。
|
|
9
|
+
|
|
10
|
+
### 规则(`busierThanUsual`)
|
|
11
|
+
| 条件 | 结论 |
|
|
12
|
+
|---|---|
|
|
13
|
+
| 历史不足 3 天 / 日均 0 | 不提示(没有基线) |
|
|
14
|
+
| 今天 < 日均 × 2 | 不提示 |
|
|
15
|
+
| 今天 ≥ 日均 × 2 | 「今天明显比平时忙 —— 上限可能不够用」 |
|
|
16
|
+
|
|
17
|
+
阈值下限写死 1.5 倍(调用方传更小也不会更低)。
|
|
18
|
+
|
|
19
|
+
### 判断放在服务端
|
|
20
|
+
`/state` 回传 `busy: true/false`,面板只显示 —— 与 0.9.21 一致:**面板不再实现第二份判断逻辑**。
|
|
21
|
+
|
|
22
|
+
### 为什么宁可不提示
|
|
23
|
+
真积压已有更硬的信号(`sessionUsage.capped > 0`);历史基线是用来**发现异常**,不是制造焦虑。
|
|
24
|
+
|
|
25
|
+
### 测试
|
|
26
|
+
- 新增 2 例(阈值 6 种情况;面板 busy=false 不提示 / true 提示且给原因)。合计 **175 例**。
|
|
27
|
+
|
|
5
28
|
## [0.9.34] - 2026-11-02 —— 留一份「每天一个数」的极小历史
|
|
6
29
|
|
|
7
30
|
### 学到的(知识库第 82 条)
|
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.35'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -1344,7 +1344,12 @@ window.__ModuleLoader__.load({
|
|
|
1344
1344
|
const total = watchers.reduce((n, w) => n + (Number(w.daily && w.daily.total) || 0), 0)
|
|
1345
1345
|
if (total === 0) return null
|
|
1346
1346
|
const span = Math.max(...watchers.map((w) => Number(w.daily && w.daily.days) || 0))
|
|
1347
|
-
return
|
|
1347
|
+
return [
|
|
1348
|
+
h('span', { key: 'hist', className: 'dt-row-meta' }, '过去 ' + span + ' 天:共 ' + total + ' 次(日均 ' + (Math.round((total / Math.max(1, span)) * 10) / 10) + ')'),
|
|
1349
|
+
watchers.some((w) => w.busy)
|
|
1350
|
+
? h('span', { key: 'busy', className: 'dt-error-text' }, '今天明显比平时忙 —— 上限可能不够用')
|
|
1351
|
+
: null,
|
|
1352
|
+
]
|
|
1348
1353
|
})())
|
|
1349
1354
|
: null,
|
|
1350
1355
|
visible.length === 0 ? h(Hint, null, '没有符合条件的主理鱼。点上面「全部」看所有守。') : null,
|
package/lib/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
TRIAGE_SIGNALS, accessNote, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, pushFiltered, normalizeFilters, partitionItems, passesFilters,
|
|
29
29
|
shouldRunCleanup,
|
|
30
30
|
bumpDailyWakes,
|
|
31
|
+
busierThanUsual,
|
|
31
32
|
countCapped,
|
|
32
33
|
dailySummary,
|
|
33
34
|
suggestSessionCap,
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
|
|
39
40
|
export const name = 'dsh-session-superagent'
|
|
40
41
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
41
|
-
export const SERVER_VERSION = '0.9.
|
|
42
|
+
export const SERVER_VERSION = '0.9.35'
|
|
42
43
|
export const inject = ['tools', 'agents', 'webServer']
|
|
43
44
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
44
45
|
const DEFAULT_SESSION_WAKES = 12
|
|
@@ -1259,6 +1260,7 @@ export function apply(ctx) {
|
|
|
1259
1260
|
events: (w.events ?? []).slice(-20),
|
|
1260
1261
|
deferReason: w.deferReason ?? null,
|
|
1261
1262
|
daily: dailySummary(w.dailyWakes),
|
|
1263
|
+
busy: busierThanUsual(dailySummary(w.dailyWakes)),
|
|
1262
1264
|
silentWakes: w.silentWakes ?? 0,
|
|
1263
1265
|
note: w.goal ?? '',
|
|
1264
1266
|
title: sessionTitle(w.sessionId),
|
package/lib/watch.js
CHANGED
|
@@ -820,10 +820,30 @@ export function bumpDailyWakes(daily, atIso = new Date().toISOString(), keepDays
|
|
|
820
820
|
}
|
|
821
821
|
|
|
822
822
|
/** 最近几天的总量与日均(给面板显示用;没有数据就返回 null)。 */
|
|
823
|
-
export function dailySummary(daily) {
|
|
823
|
+
export function dailySummary(daily, todayIso = new Date().toISOString()) {
|
|
824
824
|
const map = (daily && typeof daily === 'object' && !Array.isArray(daily)) ? daily : {}
|
|
825
825
|
const values = Object.values(map).map(Number).filter((n) => Number.isFinite(n) && n >= 0)
|
|
826
826
|
if (values.length === 0) return null
|
|
827
827
|
const total = values.reduce((a, b) => a + b, 0)
|
|
828
|
-
|
|
828
|
+
const day = String(todayIso).slice(0, 10)
|
|
829
|
+
return {
|
|
830
|
+
days: values.length,
|
|
831
|
+
total,
|
|
832
|
+
avg: Math.round((total / values.length) * 10) / 10,
|
|
833
|
+
today: Number(map[day]) || 0,
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* 「今天明显比平时忙」:只在有足够历史、且高出很多倍时才提示。
|
|
839
|
+
*
|
|
840
|
+
* 阈值故意保守(默认 2 倍 + 至少 3 天数据)——
|
|
841
|
+
* 拿历史去影响判断,最怕的是频繁误报;宁可少提示,也不要制造噪音。
|
|
842
|
+
*/
|
|
843
|
+
export function busierThanUsual(summary, { factor = 2, minDays = 3 } = {}) {
|
|
844
|
+
if (!summary || !Number.isFinite(Number(summary.days)) || summary.days < minDays) return false
|
|
845
|
+
const avg = Number(summary.avg) || 0
|
|
846
|
+
const today = Number(summary.today) || 0
|
|
847
|
+
if (avg <= 0) return false // 历史为 0 时没有可比基线
|
|
848
|
+
return today >= avg * Math.max(1.5, Number(factor) || 2)
|
|
829
849
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.35",
|
|
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",
|