lingshu-skill 5.47.0 → 5.48.0
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 +18 -0
- package/README.md +1 -1
- package/SKILL-lite.md +1 -1
- package/SKILL-tiny.md +1 -1
- package/SKILL.md +1 -1
- package/cordis-plugin/lingshu-startup/plugin.js +22 -3
- package/cordis-plugin/lingshu-startup/resilience.js +64 -0
- package/package.json +1 -1
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +5 -5
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +18 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v5.48(2026-12-03)
|
|
4
|
+
|
|
5
|
+
### 🛡️ RESILIENCE:lingshu-startup 插件健壮性双引擎
|
|
6
|
+
|
|
7
|
+
#### prior 连续失败退避(借鉴 SPEED-3 自适应降级 + mem0 服务健康探针)
|
|
8
|
+
- prior 每轮首个 pre-step 都 spawn brain.py 子进程查开工前查——宿主高负载/Python 异常时连续超时,每次白付 6s 等待还拖慢请求。
|
|
9
|
+
- 连续 3 次失败 → 自动退避 10 分钟静默跳过;成功即清零计数。请求关键路径不再被坏环境拖死。
|
|
10
|
+
|
|
11
|
+
#### context-pressure 采样节流(借鉴 zep 增量更新)
|
|
12
|
+
- sampleContextPressure 原先每步都读 tokenMeter+写盘;对话密集时 1s 数次写盘纯属浪费。
|
|
13
|
+
- 节流到 30s 一次(按 agent 独立),压力读数对水位判断足够新鲜;Map 防无限增长。
|
|
14
|
+
|
|
15
|
+
#### 调研结论
|
|
16
|
+
- Cordis 插件生态(Koishi 4000+ 插件背书)的核心模式:钩子内绝不冒泡、子进程调用必须有退避、高频 IO 必须节流——本版三项全部对齐。
|
|
17
|
+
- 腾讯 Hy-Memory 2.0(聊天/工作/代码三类记忆)与灵枢分层设计同构,验证了方向;其 benchmark 框架可后续借鉴做召回质量回归。
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
3
21
|
## v5.47(2026-12-03)
|
|
4
22
|
|
|
5
23
|
### ⏱️ TIME-CTX:历史时间戳归并(对话上下文瘦身)
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 名字取自《黄帝内经》:**算力给思考,人格给灵魂,记忆给生命。**
|
|
4
4
|
|
|
5
|
-
> 当前版本 **v5.
|
|
5
|
+
> 当前版本 **v5.48**(变更见 [CHANGELOG.md](CHANGELOG.md))
|
|
6
6
|
|
|
7
7
|
> 🔁 **双仓库镜像**:GitHub(主)与 Gitee(镜像)保持同步——[gitee.com/htmcwy_0/lingshu-skill](https://gitee.com/htmcwy_0/lingshu-skill)。灵枢的更新检查会探测两边最新提交,**谁更新就自动从谁拉取**;任一边不可达(Gitee 匿名风控 / GitHub 限额)时走另一边兜底。
|
|
8
8
|
|
package/SKILL-lite.md
CHANGED
package/SKILL-tiny.md
CHANGED
package/SKILL.md
CHANGED
|
@@ -28,6 +28,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
28
28
|
import { sampleContextPressure } from './context-pressure.js'
|
|
29
29
|
import { applyFolds } from './context-fold.js'
|
|
30
30
|
import { foldTimeContext } from './time-context-fold.js'
|
|
31
|
+
import { createPriorBackoff, createPressureThrottle } from './resilience.js'
|
|
31
32
|
|
|
32
33
|
// 刻意零外部依赖:不 import @deepseek-ai/schemastery。原因——link: 安装时模块
|
|
33
34
|
// 真实路径留在技能目录,Node 从那里向上找 node_modules 一路到盘符根都找不到
|
|
@@ -332,6 +333,9 @@ export function apply(ctx, config) {
|
|
|
332
333
|
const priorDigests = new Map()
|
|
333
334
|
// #45:digest -> 上次查询时间(毫秒)
|
|
334
335
|
let priorCooldown = new Map()
|
|
336
|
+
// RESILIENCE(v5.48):prior 连续失败退避 + 压力采样节流器
|
|
337
|
+
const priorBackoff = createPriorBackoff()
|
|
338
|
+
const pressureThrottle = createPressureThrottle()
|
|
335
339
|
// 配置类失败只告警一次:静默吞掉配置错误会让插件"看似在工作、实际没注入"
|
|
336
340
|
let warnedOnce = false
|
|
337
341
|
|
|
@@ -416,9 +420,14 @@ export function apply(ctx, config) {
|
|
|
416
420
|
// v3.86:每轮请求前采一次 DSH 的准确 token 压力(ctx.tokenMeter),
|
|
417
421
|
// 写 HOME/.context-pressure.json 给 brain.py 读。必须在决策之后也不影响
|
|
418
422
|
// 注入语义;采集器自身吞掉所有异常,绝不让 pre-step 冒泡。
|
|
423
|
+
// RESILIENCE(v5.48):节流到 30s 一次——密集对话下每步都读 tokenMeter+写盘
|
|
424
|
+
// 纯属浪费,30s 的压力读数对水位判断足够新鲜(借鉴 zep 增量更新)。
|
|
419
425
|
try {
|
|
420
426
|
const { agent: pa } = payload || {}
|
|
421
|
-
if (pa)
|
|
427
|
+
if (pa) {
|
|
428
|
+
const key = pa.id || pa.name || 'default'
|
|
429
|
+
if (pressureThrottle.shouldSample(key)) sampleContextPressure(ctx, pa)
|
|
430
|
+
}
|
|
422
431
|
} catch { /* 采集失败不影响请求/注入 */ }
|
|
423
432
|
if (!decision || decision.kind !== 'enter') return decision
|
|
424
433
|
const { agent } = payload || {}
|
|
@@ -456,8 +465,13 @@ export function apply(ctx, config) {
|
|
|
456
465
|
}
|
|
457
466
|
// ② 开工前查(P9 #61):每轮首个 pre-step 抽用户消息 → prior → 命中才注入。
|
|
458
467
|
// 同一条消息只查一次(digest 去重);查不到就不注入,避免白占上下文。
|
|
468
|
+
// RESILIENCE(v5.48):prior 连续失败退避——宿主高负载/Python 异常时子进程
|
|
469
|
+
// 连续超时,每次白付 6s 还拖慢请求;连续 3 次失败退避 10 分钟静默跳过。
|
|
459
470
|
if (cfg.priorAuto && agent) {
|
|
460
471
|
try {
|
|
472
|
+
if (priorBackoff.blocked()) {
|
|
473
|
+
try { ctx.logger?.debug?.('[lingshu-startup] prior 退避窗口内,跳过') } catch {}
|
|
474
|
+
} else {
|
|
461
475
|
const userText = lastUserText(decision.messages)
|
|
462
476
|
if (looksLikeTask(userText, cfg.priorMinChars)) {
|
|
463
477
|
const dig = createHash('sha256').update(userText).digest('hex').slice(0, 16)
|
|
@@ -491,10 +505,15 @@ export function apply(ctx, config) {
|
|
|
491
505
|
? await runPrior(pythonExe, cfg.python, brainPy, userText,
|
|
492
506
|
cfg.priorBudget, cfg.priorTimeoutMs)
|
|
493
507
|
: null
|
|
494
|
-
if (block) extra.push(block)
|
|
508
|
+
if (block) { extra.push(block); priorBackoff.success() }
|
|
509
|
+
else if (brainPy) priorBackoff.fail() // 跑了但没产出 = 视为一次失败信号
|
|
495
510
|
}
|
|
496
511
|
}
|
|
497
|
-
|
|
512
|
+
} // end else (prior backoff 未阻塞)
|
|
513
|
+
} catch (e) {
|
|
514
|
+
priorBackoff.fail() // 异常也算失败信号(含子进程超时)
|
|
515
|
+
try { ctx.logger?.debug?.('[lingshu-startup] prior 失败计入退避', e) } catch {}
|
|
516
|
+
}
|
|
498
517
|
}
|
|
499
518
|
if (!extra.length) return decision
|
|
500
519
|
return {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRIOR-BACKOFF + PRESSURE-THROTTLE(v5.48):lingshu-startup 插件的两项健壮性改进。
|
|
3
|
+
*
|
|
4
|
+
* 1. prior 连续失败退避(借鉴 SPEED-3 dense 自适应降级 + mem0 服务健康探针模式):
|
|
5
|
+
* prior 每轮首个 pre-step 都会 spawn brain.py 子进程查"开工前查"。宿主高负载/
|
|
6
|
+
* Python 环境异常时子进程会连续超时——每次都白付 6s 等待还拖慢请求。
|
|
7
|
+
* 连续 N 次失败后自动退避 M 分钟,期间 priorAuto 静默跳过。
|
|
8
|
+
*
|
|
9
|
+
* 2. context-pressure 采样节流(借鉴 zep 会话事实增量更新):
|
|
10
|
+
* sampleContextPressure 每步都跑 tokenMeter 读取+写盘(.context-pressure.json)。
|
|
11
|
+
* 对话密集时 1s 数次写盘纯属浪费——节流到 30s 一次,压力读数足够新鲜。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const PRIOR_FAIL_STREAK_MAX = 3 // 连续失败 3 次
|
|
15
|
+
const PRIOR_BACKOFF_MS = 10 * 60 * 1000 // 退避 10 分钟
|
|
16
|
+
const PRESSURE_MIN_INTERVAL_MS = 30 * 1000 // 压力采样最小间隔 30s
|
|
17
|
+
|
|
18
|
+
/** prior 子进程失败退避器(进程内状态,重启重置) */
|
|
19
|
+
export function createPriorBackoff() {
|
|
20
|
+
let streak = 0
|
|
21
|
+
let until = 0
|
|
22
|
+
return {
|
|
23
|
+
/** 是否处于退避窗口(true = 跳过本轮 prior) */
|
|
24
|
+
blocked() {
|
|
25
|
+
return Date.now() < until
|
|
26
|
+
},
|
|
27
|
+
/** 记录一次成功:清零计数 */
|
|
28
|
+
success() {
|
|
29
|
+
streak = 0
|
|
30
|
+
},
|
|
31
|
+
/** 记录一次失败:达到阈值即进入退避窗口 */
|
|
32
|
+
fail() {
|
|
33
|
+
streak += 1
|
|
34
|
+
if (streak >= PRIOR_FAIL_STREAK_MAX) {
|
|
35
|
+
until = Date.now() + PRIOR_BACKOFF_MS
|
|
36
|
+
streak = 0
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/** 调试用:当前状态快照 */
|
|
40
|
+
snapshot() {
|
|
41
|
+
return { streak, backoffRemainingMs: Math.max(0, until - Date.now()) }
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** context-pressure 采样节流器(每 agent 独立,30s 内只采一次) */
|
|
47
|
+
export function createPressureThrottle(intervalMs = PRESSURE_MIN_INTERVAL_MS) {
|
|
48
|
+
const last = new Map() // agentKey -> ts
|
|
49
|
+
return {
|
|
50
|
+
shouldSample(agentKey) {
|
|
51
|
+
const now = Date.now()
|
|
52
|
+
const prev = last.get(agentKey) || 0
|
|
53
|
+
if (now - prev < intervalMs) return false
|
|
54
|
+
last.set(agentKey, now)
|
|
55
|
+
// 防长会话 Map 无限增长
|
|
56
|
+
if (last.size > 50) {
|
|
57
|
+
for (const [k, ts] of last) {
|
|
58
|
+
if (now - ts > intervalMs * 10) last.delete(k)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return true
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lingshu-skill",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.48.0",
|
|
4
4
|
"description": "Brain-inspired persistent memory, persona and growth system for AI coding agents. Local-only, zero-dependency Python. Requires Python 3.10+.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"PATCH_NOTES.md": "9296e524f743f358fd11115598398a754cfd69534526dde9c8ad85f14a418f89",
|
|
3
3
|
"README.md": "3d634d743b085eebd2cbb5dd3a00edfa728ed23947e20cc29e7c3b29087ec043",
|
|
4
|
-
"engine/CHANGELOG.md": "
|
|
5
|
-
"engine/README.md": "
|
|
6
|
-
"engine/SKILL-lite.md": "
|
|
7
|
-
"engine/SKILL-tiny.md": "
|
|
8
|
-
"engine/SKILL.md": "
|
|
4
|
+
"engine/CHANGELOG.md": "ab76966415260d000afec8e305cc6eb130d642226d78622ad9b117ffaabe7e1a",
|
|
5
|
+
"engine/README.md": "16b184ffed24c5e2578194a591b0a425bf5f532410ccf32fa8c0596e7c90dbc8",
|
|
6
|
+
"engine/SKILL-lite.md": "621b19bd3895d7c7044446b90af9f6518f5b3cf3d12fd113479d0440a2a9a6c0",
|
|
7
|
+
"engine/SKILL-tiny.md": "1c08662cb5eeef89cd40b68ab10e137e3b97bd22668a061455c56c9dbed7ebd3",
|
|
8
|
+
"engine/SKILL.md": "877f35e8ec6aea428e771513f6efdbbd6588a5dc9af887b2ac2e41b7d3e9b8e6",
|
|
9
9
|
"engine/assets/panel.html": "af43d2d001233a9ed4314348335669d57b045f7f3efb2b2de69b4b15da659312",
|
|
10
10
|
"engine/docs/commands.md": "0ce8c88e5d2d04a8055b45c060ebd53b50c52b79b650312e2ee440845804ca4b",
|
|
11
11
|
"engine/docs/mechanics.md": "aa9683c827ed3419106e84d847ab16dc310c27fc62f588184192aaa1617523cc",
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v5.48(2026-12-03)
|
|
4
|
+
|
|
5
|
+
### 🛡️ RESILIENCE:lingshu-startup 插件健壮性双引擎
|
|
6
|
+
|
|
7
|
+
#### prior 连续失败退避(借鉴 SPEED-3 自适应降级 + mem0 服务健康探针)
|
|
8
|
+
- prior 每轮首个 pre-step 都 spawn brain.py 子进程查开工前查——宿主高负载/Python 异常时连续超时,每次白付 6s 等待还拖慢请求。
|
|
9
|
+
- 连续 3 次失败 → 自动退避 10 分钟静默跳过;成功即清零计数。请求关键路径不再被坏环境拖死。
|
|
10
|
+
|
|
11
|
+
#### context-pressure 采样节流(借鉴 zep 增量更新)
|
|
12
|
+
- sampleContextPressure 原先每步都读 tokenMeter+写盘;对话密集时 1s 数次写盘纯属浪费。
|
|
13
|
+
- 节流到 30s 一次(按 agent 独立),压力读数对水位判断足够新鲜;Map 防无限增长。
|
|
14
|
+
|
|
15
|
+
#### 调研结论
|
|
16
|
+
- Cordis 插件生态(Koishi 4000+ 插件背书)的核心模式:钩子内绝不冒泡、子进程调用必须有退避、高频 IO 必须节流——本版三项全部对齐。
|
|
17
|
+
- 腾讯 Hy-Memory 2.0(聊天/工作/代码三类记忆)与灵枢分层设计同构,验证了方向;其 benchmark 框架可后续借鉴做召回质量回归。
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
3
21
|
## v5.47(2026-12-03)
|
|
4
22
|
|
|
5
23
|
### ⏱️ TIME-CTX:历史时间戳归并(对话上下文瘦身)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 名字取自《黄帝内经》:**算力给思考,人格给灵魂,记忆给生命。**
|
|
4
4
|
|
|
5
|
-
> 当前版本 **v5.
|
|
5
|
+
> 当前版本 **v5.48**(变更见 [CHANGELOG.md](CHANGELOG.md))
|
|
6
6
|
|
|
7
7
|
> 🔁 **双仓库镜像**:GitHub(主)与 Gitee(镜像)保持同步——[gitee.com/htmcwy_0/lingshu-skill](https://gitee.com/htmcwy_0/lingshu-skill)。灵枢的更新检查会探测两边最新提交,**谁更新就自动从谁拉取**;任一边不可达(Gitee 匿名风控 / GitHub 限额)时走另一边兜底。
|
|
8
8
|
|