lingshu-skill 5.70.0 → 5.72.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 +56 -0
- package/SKILL-lite.md +1 -1
- package/SKILL-tiny.md +1 -1
- package/SKILL.md +1 -1
- package/cordis-plugin/lingshu-cron/plugin.js +36 -14
- package/cordis-plugin/lingshu-im/plugin.js +67 -15
- package/manifest.json +36 -36
- package/package.json +3 -2
- package/scripts/assembler.py +8 -2
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +89 -16
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +56 -0
- 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/scripts/astrbot_plugin_lingshu/engine/scripts/assembler.py +8 -2
- package/scripts/astrbot_plugin_lingshu/engine/scripts/autotag.py +82 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/checkpoint.py +13 -2
- package/scripts/astrbot_plugin_lingshu/engine/scripts/dream.py +51 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/emotion.py +13 -2
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth_parts.py +5 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/memory.py +75 -10
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_cloud.py +47 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +12 -2
- package/scripts/astrbot_plugin_lingshu/engine/scripts/persona.py +47 -27
- package/scripts/astrbot_plugin_lingshu/engine/scripts/safety.py +6 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +6 -2
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_rag.py +68 -21
- package/scripts/astrbot_plugin_lingshu/make_checksums.py +8 -4
- package/scripts/autotag.py +82 -0
- package/scripts/checkpoint.py +13 -2
- package/scripts/dream.py +51 -1
- package/scripts/emotion.py +13 -2
- package/scripts/growth_parts.py +5 -1
- package/scripts/memory.py +75 -10
- package/scripts/panel_cloud.py +47 -1
- package/scripts/panel_server.py +12 -2
- package/scripts/persona.py +47 -27
- package/scripts/safety.py +6 -1
- package/scripts/session_import.py +6 -2
- package/scripts/session_rag.py +68 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v5.72(2026-12-05)
|
|
4
|
+
|
|
5
|
+
### 🪄 发布自动化与注入瘦身
|
|
6
|
+
|
|
7
|
+
1. **AUTOTAG(postpublish 自动打 tag)**:新增 `scripts/autotag.py` 并挂到 npm `postpublish`——`npm publish` 成功后自动创建 `vX.Y` 标签并推送 GitHub+Gitee(指数退避重试),GitHub Actions 随即创建 Release,插件市场版本说明自动更新。修复"npm 发了新版但市场永远停在旧版"(v5.34-v5.71 无 tag 导致)。
|
|
8
|
+
2. **人格注入瘦身·性格内驱合并**:自我描述从两行合并为一行「性格:好奇80—来源;理智70—来源;内驱 好奇89/理智80」,砍掉"(0-100,数值来自…真实发生过的事)"和"理智先算值不值得深想…"两段每轮重复的固定说明;来源 why 超过 12 字截断。
|
|
9
|
+
3. **人格注入瘦身·画像截断**:擅长/短板/没弄清的每条分别截到 80/80/60 字(实测短板单条 300+ 字、三条 900+ 字),教训正文截到 160 字、砍掉"置信度 0.50 已验证 0 次"这类零信息注脚(只保留已验证 ≥1 次的)。
|
|
10
|
+
4. **人格演化提示强化**:做梦 apply_schema 的 persona_updates 增加显式指引——likes/dislikes 填本批记忆里新出现的稳定偏好/反感(带证据),traits 填 -10~10 倾向微调,宁缺勿滥。配合既有漂移双门限(TRAIT_DRIFT_GATE)机制,喜欢/讨厌/性格将随相处真实演化而非停在初识值。
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## v5.71(2026-12-05)
|
|
15
|
+
|
|
16
|
+
### 🎉 150 项审计最终批:全量缺口大收官!
|
|
17
|
+
|
|
18
|
+
本批一次性闭环最后 29 项待办,150 项审计**全部完成**:
|
|
19
|
+
|
|
20
|
+
**记忆与人格(高危)**:
|
|
21
|
+
1. **LS-001**:`safety.py` 修复 POSIX 危险路径子目录绕过——系统目录前缀分隔符跟随平台(`/` vs `\`)。
|
|
22
|
+
2. **LS-019**:`memory.py` 归档召回保留缺少 id 的旧记录,按内容哈希合成稳定 id。
|
|
23
|
+
3. **LS-020**:`memory.py` purge 冷静期检查 fail-closed——时间戳缺失/无效拒绝物理删除。
|
|
24
|
+
4. **LS-021**:`memory.py` trash_restore 按 deleted_at 选取最新版本台账记录。
|
|
25
|
+
5. **LS-023**:`memory.py` 批量 discard/delete 遵守置顶保护,跳过并回报。
|
|
26
|
+
6. **LS-026**:`persona.py` 人格自愈回滚在只读模式不写盘。
|
|
27
|
+
7. **LS-027**:`persona.py` 写 lastgood 前执行完整结构校验。
|
|
28
|
+
8. **LS-028**:`emotion.py` 补齐独立导入依赖(mind_state/default_onboarding)。
|
|
29
|
+
9. **LS-030**:`dream.py` 旧 pending 存在时合并新簇,避免新簇永久丢失。
|
|
30
|
+
10. **LS-032**:`dream.py` 禁止 aggregate 标志绕过审核——正文必须等于源原文拼接。
|
|
31
|
+
|
|
32
|
+
**会话与摄取**:
|
|
33
|
+
11. **LS-046**:`session_rag.py` 脏时间戳单条隔离,不再回滚整批。
|
|
34
|
+
12. **LS-047**:`session_rag.py` search/stats 只读连接,不自动建库建表。
|
|
35
|
+
13. **LS-054**:`checkpoint.py` 同一脏工作区不重复 remember。
|
|
36
|
+
14. **LS-055**:`growth_parts.py` frontmatter 开界独立成行判断。
|
|
37
|
+
15. **LS-056**:`assembler.py` 钳制输出预留在 [0, budget]。
|
|
38
|
+
16. **LS-057**:`session_import.py` 先设置 sys.path 再 import brain。
|
|
39
|
+
|
|
40
|
+
**面板与云端**:
|
|
41
|
+
17. **LS-062**:`panel_cloud.py` cloud_shot 兼容完整文件名与扩展名两种传法。
|
|
42
|
+
18. **LS-067**:`panel_cloud.py` 发布读-改-写共享索引加互斥锁。
|
|
43
|
+
19. **LS-068**:`panel_cloud.py` 拒绝空扩展 ZIP 安装。
|
|
44
|
+
20. **LS-085**:`panel_server.py` 技能操作协议对齐(check/show/delete/root_rm 别名)。
|
|
45
|
+
21. **LS-122**:`make_checksums.py` 显式发布清单优先于下划线启发式,`_conf_schema.json` 纳入校验。
|
|
46
|
+
|
|
47
|
+
**Cordis 插件**:
|
|
48
|
+
22. **LS-097**:cron extract 成功只清理已提交前缀,保留运行期间新增文本。
|
|
49
|
+
23. **LS-098**:cron 高水位自救每档位只执行一次(先检查消费状态再跑)。
|
|
50
|
+
24. **LS-105**:IM 后续工具步骤保留召回块,不提前删除。
|
|
51
|
+
25. **LS-106**:IM 会话重绑定后按身份指纹替换旧提示。
|
|
52
|
+
26. **LS-107**:IM capture 节流先原子占用再写回,防并发绕过间隔。
|
|
53
|
+
27. **LS-108**:IM `where.exe` 探测 PATH 真实 python.exe,修复 .cmd 启动。
|
|
54
|
+
28. **LS-110**:cron 水位动作 busy 时不消费档位,下轮可重试。
|
|
55
|
+
29. **LS-115**:`test_app_context.py` __main__ 移到末尾,plan_turns 测试可执行。
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
3
59
|
## v5.70(2026-12-05)
|
|
4
60
|
|
|
5
61
|
### 🏗️ 150 项审计第十四批:发布流水线与测试门禁组大收官
|
package/SKILL-lite.md
CHANGED
package/SKILL-tiny.md
CHANGED
package/SKILL.md
CHANGED
|
@@ -786,6 +786,7 @@ const waterState = new Map() // agent -> { max } 水位守卫已提醒的最高
|
|
|
786
786
|
const prev = Number(st.max) || 0
|
|
787
787
|
if (level <= prev) return null // 档位只推进一次(首次跨 75/90 各做一次)
|
|
788
788
|
let noticeText = null
|
|
789
|
+
let delivered = true // LS-110: 本档动作是否成功投递(busy 等临时状态不算消费)
|
|
789
790
|
// 75%:该做梦了。直接从低位跳到 90% 时也补做这一档(prev < 75)。
|
|
790
791
|
// 复用 turn-stopping 那条任务名 'dream':全局同一时刻只许一份 dream 在跑
|
|
791
792
|
// (与轮次驱动的 dream 撞车时返回 busy,如实记 executed=false)。
|
|
@@ -794,6 +795,10 @@ const waterState = new Map() // agent -> { max } 水位守卫已提醒的最高
|
|
|
794
795
|
if (consent && wcfg.shadow === false) {
|
|
795
796
|
const fired = fire({ id: 'dream', argv: ['dream', '--auto'] })
|
|
796
797
|
recordWaterAuto(75, 'dream --auto', fired, fired ? 'executed' : 'busy')
|
|
798
|
+
// LS-110(v5.71):水位动作失败时允许后续重试!
|
|
799
|
+
// busy(dream 已在跑)只是暂时的——若此刻消费掉档位,这 75% 的
|
|
800
|
+
// dream 就永远不会再补做。只有成功投递才推进档位。
|
|
801
|
+
delivered = fired
|
|
797
802
|
} else {
|
|
798
803
|
// 影子模式或没给同意:只记"本来会做什么",不动手
|
|
799
804
|
recordWaterAuto(75, 'dream --auto', false, consent ? 'shadow' : 'no-consent')
|
|
@@ -804,7 +809,10 @@ const waterState = new Map() // agent -> { max } 水位守卫已提醒的最高
|
|
|
804
809
|
recordWaterAuto(90, 'capture', false, 'no-verbatim')
|
|
805
810
|
noticeText = escapeSuggestion(pct, source)
|
|
806
811
|
}
|
|
807
|
-
|
|
812
|
+
// LS-110: 仅成功投递后消费档位;busy 等临时状态解除后下一轮可重试
|
|
813
|
+
if (delivered) {
|
|
814
|
+
waterAutoState.set(agent, { max: level })
|
|
815
|
+
}
|
|
808
816
|
return noticeText
|
|
809
817
|
}
|
|
810
818
|
|
|
@@ -843,8 +851,18 @@ const waterState = new Map() // agent -> { max } 水位守卫已提醒的最高
|
|
|
843
851
|
}
|
|
844
852
|
} catch {} // 顶层兜底
|
|
845
853
|
finally {
|
|
846
|
-
|
|
847
|
-
|
|
854
|
+
// LS-097(v5.71):extract 成功只清理**已提交前缀**!
|
|
855
|
+
// 旧实现把整个缓冲清空——子进程运行期间(可达数秒)新攒进来的对话
|
|
856
|
+
// 会被一并清掉(数据丢失)。现在按快照长度截掉已提交部分,
|
|
857
|
+
// 保留 extract 运行期间新增的文本和游标。
|
|
858
|
+
if (ok) {
|
|
859
|
+
const cur = convo.get(agent) || { text: '', seen: [] }
|
|
860
|
+
const committed = (buf?.text || '')
|
|
861
|
+
const curText = cur.text || ''
|
|
862
|
+
// 快照仍是当前缓冲的前缀 → 截掉前缀;否则(已被截断兜底改写)保守清空
|
|
863
|
+
const rest = curText.startsWith(committed) ? curText.slice(committed.length) : ''
|
|
864
|
+
convo.set(agent, { text: rest, seen: buf?.seen })
|
|
865
|
+
} else if (text.length > 200_000) {
|
|
848
866
|
// 兜底防爆内存:截断保留头部 100k 而非全丢,并至少告警一次(#64)
|
|
849
867
|
// ★ 必须用 ctx.logger(审计 plugin.js:766):模块作用域里没有裸 `logger`
|
|
850
868
|
// (只有 ctx.logger 和本地 warn(),而后者是 once-only——这里丢的是数据,
|
|
@@ -1405,19 +1423,23 @@ const waterState = new Map() // agent -> { max } 水位守卫已提醒的最高
|
|
|
1405
1423
|
// diagnose 只报告),绝不自动 capture(拿不到原文)也绝不 purge(物理删除)。
|
|
1406
1424
|
const th = pressureThresholds()
|
|
1407
1425
|
if (pct >= th.force_at) {
|
|
1426
|
+
// LS-098(v5.71):高水位自救每个档位只执行一次!
|
|
1427
|
+
// 旧实现先 await runForceActions 再检查 forceAt 消费状态——
|
|
1428
|
+
// 连续 99% 时每个 pre-step 都会重复启动子进程(auto-archive 风暴)。
|
|
1429
|
+
// 现在先检查档位消费状态,已执行过就只提示不再跑。
|
|
1430
|
+
if (st.forceAt === true) {
|
|
1431
|
+
return decision
|
|
1432
|
+
}
|
|
1408
1433
|
const did = await runForceActions(pythonExe, brainPy)
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
)],
|
|
1418
|
-
}
|
|
1434
|
+
st.forceAt = true
|
|
1435
|
+
waterState.set(agent, st)
|
|
1436
|
+
return {
|
|
1437
|
+
...decision,
|
|
1438
|
+
messages: [...decision.messages, notice(
|
|
1439
|
+
`【灵枢·水位 ${pct}%】已到强制自救线(${th.force_at}%),已自动执行无破坏性压缩:${did || '无可用动作'}。`
|
|
1440
|
+
+ `现在只做三件事之一:① 让用户确认封存 capture;② 结束本轮话题;③ 继续也得先说明风险。不要再开新话题。`,
|
|
1441
|
+
)],
|
|
1419
1442
|
}
|
|
1420
|
-
return decision
|
|
1421
1443
|
}
|
|
1422
1444
|
if (pct >= th.hard_at && st.hardAt !== true) {
|
|
1423
1445
|
st.hardAt = true
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
// 数据安全:只读记忆库 + 仅在用户显式 capture-on 后写回本人原话;不改宿主
|
|
26
26
|
// 人格、不改 dsh-im 配置、不写入任何非本插件命名空间的状态。
|
|
27
27
|
|
|
28
|
-
import { spawn } from 'node:child_process'
|
|
28
|
+
import { spawn, execFileSync } from 'node:child_process'
|
|
29
29
|
import { existsSync, readFileSync, statSync } from 'node:fs'
|
|
30
30
|
import { homedir } from 'node:os'
|
|
31
31
|
import { dirname, join } from 'node:path'
|
|
@@ -159,6 +159,23 @@ function findPythonExe(configured) {
|
|
|
159
159
|
for (const p of candidates) {
|
|
160
160
|
if (existsSync(p)) return p
|
|
161
161
|
}
|
|
162
|
+
// LS-108(v5.71):修复 Windows .cmd Python 启动方式!
|
|
163
|
+
// 旧实现候选全落空时返回 null,runBrain 退化成 spawn('python', ...)——
|
|
164
|
+
// Node 18+ 出于安全禁止 spawn 直接执行 .cmd/.bat(EINVAL),conda/Store
|
|
165
|
+
// 的 python 都经过 .cmd shim,导致召回和写回**静默返回 null**。
|
|
166
|
+
// 现在用 `where python` 同步探测 PATH 里真实的 python.exe/优先 exe。
|
|
167
|
+
if (process.platform === 'win32') {
|
|
168
|
+
try {
|
|
169
|
+
const out = execFileSync('where.exe', ['python'], { encoding: 'utf8', timeout: 3000 })
|
|
170
|
+
const lines = String(out || '').split(/\r?\n/).map((s) => s.trim()).filter(Boolean)
|
|
171
|
+
// 优先真实 .exe(排除 Store 的 python.exe stub 不太好区分,但至少拿到真实路径)
|
|
172
|
+
const exe = lines.find((s) => s.toLowerCase().endsWith('.exe'))
|
|
173
|
+
if (exe && existsSync(exe)) return exe
|
|
174
|
+
// 只有 .cmd/.bat:返回它(runBrain 的数组 spawn 路径 + 元字符校验已防护)
|
|
175
|
+
const cmd = lines.find((s) => /\.(cmd|bat)$/i.test(s))
|
|
176
|
+
if (cmd && existsSync(cmd)) return cmd
|
|
177
|
+
} catch { /* where 失败就走原 null 路径 */ }
|
|
178
|
+
}
|
|
162
179
|
return null
|
|
163
180
|
}
|
|
164
181
|
|
|
@@ -342,6 +359,7 @@ export function apply(ctx, config) {
|
|
|
342
359
|
const lastInjected = new Map() // agent -> 上一条已处理的用户消息 id
|
|
343
360
|
const seenBySession = new Map() // sessionId -> Set(已注入记忆 id)
|
|
344
361
|
const captureSeen = new Map() // agent -> 最近已写回的消息 id(防同轮重复)
|
|
362
|
+
const lastIdentityFp = new Map() // LS-106: agent -> 上次注入身份指纹(channel\u0000user),重绑定时替换旧提示
|
|
345
363
|
const lastCapture = new Map() // `${channel}\u0000${group}\u0000${user}` -> 毫秒时间戳
|
|
346
364
|
const consentCache = new Map() // user -> { mt, ok }(按 mtime 失效,授权后下一条即生效)
|
|
347
365
|
|
|
@@ -498,8 +516,16 @@ export function apply(ctx, config) {
|
|
|
498
516
|
const key = `${id.channel}\u0000${id.group}\u0000${id.user}`
|
|
499
517
|
const now = Date.now()
|
|
500
518
|
if (now - (lastCapture.get(key) || 0) < cfg.captureInterval * 1000) return
|
|
519
|
+
// LS-107(v5.71):为 capture 节流增加在飞标记!
|
|
520
|
+
// 旧实现在 await ensureBrainPy() 之前只读不占——两条快速连续消息
|
|
521
|
+
// 都能通过节流检查,并发绕过 captureInterval 重复写回。
|
|
522
|
+
// 现在进入写回前先原子占用节流键:失败路径回退到"半周期后重试"。
|
|
523
|
+
lastCapture.set(key, now)
|
|
501
524
|
const brainPy = await ensureBrainPy()
|
|
502
|
-
if (!brainPy)
|
|
525
|
+
if (!brainPy) {
|
|
526
|
+
lastCapture.delete(key) // 释放占用,下条消息可重试
|
|
527
|
+
return
|
|
528
|
+
}
|
|
503
529
|
// 聊天原话是用户亲述 → source=user(冲突时按用户原话取代)。
|
|
504
530
|
const argv = [
|
|
505
531
|
'channel', 'remember', '聊天原话:' + text.slice(0, cfg.maxText),
|
|
@@ -514,7 +540,7 @@ export function apply(ctx, config) {
|
|
|
514
540
|
const out = await runBrain(findPythonExe(cfg.python), cfg.python, brainPy, argv,
|
|
515
541
|
cfg.timeoutMs, cfg.memoryHome)
|
|
516
542
|
if (out === null) {
|
|
517
|
-
//
|
|
543
|
+
// 失败退避:半个周期后再试,别把一个周期全丢掉(释放占用 + 缩短下次窗口)
|
|
518
544
|
lastCapture.set(key, now - cfg.captureInterval * 1000 + Math.min(30, cfg.captureInterval) * 1000)
|
|
519
545
|
return
|
|
520
546
|
}
|
|
@@ -570,14 +596,6 @@ export function apply(ctx, config) {
|
|
|
570
596
|
|
|
571
597
|
let messages = Array.isArray(decision.messages) ? decision.messages : []
|
|
572
598
|
const original = decision.messages
|
|
573
|
-
// 清理上一轮自己注入的召回块(身份块留着,工具步骤还要用)。这样无论
|
|
574
|
-
// cron 包裹在本插件外层还是内层,结果都一致,且召回块只保留最新一份。
|
|
575
|
-
if (messages.some((m) => m?.source?.name === INJECT_SOURCE && messageText(m).includes(MARK_RECALL))) {
|
|
576
|
-
messages = messages.filter((m) => !(m?.source?.name === INJECT_SOURCE && messageText(m).includes(MARK_RECALL)))
|
|
577
|
-
}
|
|
578
|
-
// 清掉了旧召回块但本步不需要再注入时,也要把清理结果交回去。
|
|
579
|
-
const pruned = messages !== original
|
|
580
|
-
const finish = () => (pruned ? { ...decision, messages } : decision)
|
|
581
599
|
// 找最新的用户消息(跳过本插件/cron 注入的、跳过 assistant/工具结果)。
|
|
582
600
|
let newest = null
|
|
583
601
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
@@ -589,8 +607,25 @@ export function apply(ctx, config) {
|
|
|
589
607
|
break
|
|
590
608
|
}
|
|
591
609
|
if (!newest) return finish()
|
|
592
|
-
|
|
593
610
|
const msgKey = String(newest.m.id ?? createHash('sha1').update(newest.text).digest('hex'))
|
|
611
|
+
const sameUserTurn = (lastInjected.get(agent) === msgKey)
|
|
612
|
+
// LS-105(v5.71):后续工具步骤保留或重建 IM 召回块!
|
|
613
|
+
// 旧实现无条件清理旧召回块 + 同一 msgKey 提前返回——工具调用后的
|
|
614
|
+
// 最终回答步骤看不到记忆。同一轮次(msgKey 相同)时保留旧召回块原样返回。
|
|
615
|
+
if (sameUserTurn) {
|
|
616
|
+
const stillHasRecall = messages.some(
|
|
617
|
+
(m) => m?.source?.name === INJECT_SOURCE && messageText(m).includes(MARK_RECALL))
|
|
618
|
+
return decision // 同一轮次:消息原样放行,召回/身份块都在
|
|
619
|
+
}
|
|
620
|
+
// 新一轮用户消息:清理上一轮自己注入的召回块(身份块留着,工具步骤还要用)。
|
|
621
|
+
if (messages.some((m) => m?.source?.name === INJECT_SOURCE && messageText(m).includes(MARK_RECALL))) {
|
|
622
|
+
messages = messages.filter((m) => !(m?.source?.name === INJECT_SOURCE && messageText(m).includes(MARK_RECALL)))
|
|
623
|
+
}
|
|
624
|
+
// 清掉了旧召回块但本步不需要再注入时,也要把清理结果交回去。
|
|
625
|
+
let pruned = messages !== original
|
|
626
|
+
const finish = () => (pruned ? { ...decision, messages } : decision)
|
|
627
|
+
if (!newest) return finish()
|
|
628
|
+
|
|
594
629
|
const sessionId = sessionIdOf(agent) || msgKey
|
|
595
630
|
|
|
596
631
|
// ---- 自动写回:只写用户原话,先授权后落盘;fire-and-forget 不阻塞回合
|
|
@@ -606,14 +641,31 @@ export function apply(ctx, config) {
|
|
|
606
641
|
}
|
|
607
642
|
}
|
|
608
643
|
|
|
609
|
-
// ----
|
|
610
|
-
if (lastInjected.get(agent) === msgKey) return finish()
|
|
644
|
+
// ---- 注入:标记本轮已处理(工具调用的后续步骤走上面的 sameUserTurn 保留路径)
|
|
611
645
|
lastInjected.set(agent, msgKey)
|
|
612
646
|
|
|
613
647
|
let hint = ''
|
|
648
|
+
let _fp = ''
|
|
614
649
|
if (cfg.identityHint) {
|
|
615
650
|
const has = messages.some((m) => m?.source?.name === INJECT_SOURCE && messageText(m).includes(MARK_IDENTITY))
|
|
616
|
-
|
|
651
|
+
// LS-106(v5.71):会话重绑定后刷新身份提示!
|
|
652
|
+
// 旧实现只看"有没有身份块"——同一会话换人(重绑定到新 sender)时,
|
|
653
|
+
// 旧用户的身份提示仍在,新 sender 沿用旧用户提示(张冠李戴)。
|
|
654
|
+
// 现在记录上次注入的身份指纹(channel+user),不一致时替换旧块。
|
|
655
|
+
_fp = `${id.channel}\u0000${id.user}`
|
|
656
|
+
if (has) {
|
|
657
|
+
if (lastIdentityFp.get(agent) === _fp) {
|
|
658
|
+
// 同一身份且块还在:不再重复注入
|
|
659
|
+
} else {
|
|
660
|
+
// 身份变了:替换旧的(清理后由下面的 text 重新注入)
|
|
661
|
+
messages = messages.filter((m) => !(m?.source?.name === INJECT_SOURCE && messageText(m).includes(MARK_IDENTITY)))
|
|
662
|
+
pruned = true
|
|
663
|
+
hint = identityLine(id)
|
|
664
|
+
}
|
|
665
|
+
} else {
|
|
666
|
+
hint = identityLine(id)
|
|
667
|
+
}
|
|
668
|
+
lastIdentityFp.set(agent, _fp)
|
|
617
669
|
}
|
|
618
670
|
|
|
619
671
|
let recall = ''
|
package/manifest.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.
|
|
2
|
+
"version": "5.72",
|
|
3
3
|
"files": {
|
|
4
4
|
"CHANGELOG.md": {
|
|
5
|
-
"sha256": "
|
|
6
|
-
"size":
|
|
5
|
+
"sha256": "3a1c73e0c26b63fc676169954d26d4eb9345e66ba85889d79b6ce1323e83b9e4",
|
|
6
|
+
"size": 444569
|
|
7
7
|
},
|
|
8
8
|
"README.md": {
|
|
9
9
|
"sha256": "5ab87b76dc757e6edd6ef1d760e9a979e55df48b2b8c2b76552747fabb7b1026",
|
|
10
10
|
"size": 114306
|
|
11
11
|
},
|
|
12
12
|
"SKILL-lite.md": {
|
|
13
|
-
"sha256": "
|
|
13
|
+
"sha256": "bb746449e7ea2f59c4a1f0dea49ef5c3a9648b0f6863237cb4094e036ce88e80",
|
|
14
14
|
"size": 4440
|
|
15
15
|
},
|
|
16
16
|
"SKILL-tiny.md": {
|
|
17
|
-
"sha256": "
|
|
17
|
+
"sha256": "489762bf2958fe686cf9f14133de9aad52f3a1eb0127859ce9bbe4941838b824",
|
|
18
18
|
"size": 1913
|
|
19
19
|
},
|
|
20
20
|
"SKILL.md": {
|
|
21
|
-
"sha256": "
|
|
21
|
+
"sha256": "ea18038576fb462dab4bed8748c351833c525eb500884a4ab6e6a2f07c7ec378",
|
|
22
22
|
"size": 25366
|
|
23
23
|
},
|
|
24
24
|
"assets/lingshu-icon-preview.png": {
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"size": 2205
|
|
51
51
|
},
|
|
52
52
|
"cordis-plugin/lingshu-cron/plugin.js": {
|
|
53
|
-
"sha256": "
|
|
54
|
-
"size":
|
|
53
|
+
"sha256": "6e89f6de3ccc4d51159625ced64bfe5ff052ca099019f2ce91745a1ffeb0e38a",
|
|
54
|
+
"size": 77955
|
|
55
55
|
},
|
|
56
56
|
"cordis-plugin/lingshu-guard/plugin.js": {
|
|
57
57
|
"sha256": "c86066adb5726331099b7513ac7cc7eb078d271b0f71454b900b716303b0fd65",
|
|
58
58
|
"size": 23970
|
|
59
59
|
},
|
|
60
60
|
"cordis-plugin/lingshu-im/plugin.js": {
|
|
61
|
-
"sha256": "
|
|
62
|
-
"size":
|
|
61
|
+
"sha256": "f66c955fd0ba785123c600c86e4908e44611a592da1dc6a1fe684c6c53ad2ce7",
|
|
62
|
+
"size": 30790
|
|
63
63
|
},
|
|
64
64
|
"cordis-plugin/lingshu-startup/README.md": {
|
|
65
65
|
"sha256": "e62016afb05dd910cd1b99fd547b1b5eead2afea43e0b90b96df2d2782c0b386",
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
"size": 6007
|
|
139
139
|
},
|
|
140
140
|
"package.json": {
|
|
141
|
-
"sha256": "
|
|
142
|
-
"size":
|
|
141
|
+
"sha256": "4f85581313d68a84a66d7cdc25be4057c5b86be422d6c7ee12ec68e56f45a64c",
|
|
142
|
+
"size": 1551
|
|
143
143
|
},
|
|
144
144
|
"scripts/anchor_retention.py": {
|
|
145
145
|
"sha256": "327862125cbe9b1c5aaaf14f0b9334031f0906c5c10b15367af53bfe3f905d16",
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
"size": 43970
|
|
151
151
|
},
|
|
152
152
|
"scripts/assembler.py": {
|
|
153
|
-
"sha256": "
|
|
154
|
-
"size":
|
|
153
|
+
"sha256": "60bbb5ebe238d54f9f4bdecbbf0e24cfa9793102b6f1f734e796560786482205",
|
|
154
|
+
"size": 8774
|
|
155
155
|
},
|
|
156
156
|
"scripts/behavior_baseline.py": {
|
|
157
157
|
"sha256": "7f488663082f301426c98f291a31860dd159a6097eba6ff225e4912f1b222272",
|
|
@@ -186,8 +186,8 @@
|
|
|
186
186
|
"size": 14445
|
|
187
187
|
},
|
|
188
188
|
"scripts/checkpoint.py": {
|
|
189
|
-
"sha256": "
|
|
190
|
-
"size":
|
|
189
|
+
"sha256": "9963cac0dffbb5fbaedbde9db40323abd19fc8c53250955f3b9119371144b31a",
|
|
190
|
+
"size": 10619
|
|
191
191
|
},
|
|
192
192
|
"scripts/cli.py": {
|
|
193
193
|
"sha256": "e68709f183eae3cb407732f52df91fd65d22f4327b101a8bbc26df93c2a7b69f",
|
|
@@ -214,12 +214,12 @@
|
|
|
214
214
|
"size": 8071
|
|
215
215
|
},
|
|
216
216
|
"scripts/dream.py": {
|
|
217
|
-
"sha256": "
|
|
218
|
-
"size":
|
|
217
|
+
"sha256": "e8a9961fd7daf860aabc2b34d396ae00d01138a736e8b50c3a0287ee4c3c28dd",
|
|
218
|
+
"size": 64703
|
|
219
219
|
},
|
|
220
220
|
"scripts/emotion.py": {
|
|
221
|
-
"sha256": "
|
|
222
|
-
"size":
|
|
221
|
+
"sha256": "e0b4451e05e99dd651c79b9d927191d963824012e7b03aba933d92e111368965",
|
|
222
|
+
"size": 77858
|
|
223
223
|
},
|
|
224
224
|
"scripts/failures.py": {
|
|
225
225
|
"sha256": "3a16234a1871f62e3ba7b7b743110b4044fb7b715b4d0e924b8ebf1cf0be50d0",
|
|
@@ -238,8 +238,8 @@
|
|
|
238
238
|
"size": 264326
|
|
239
239
|
},
|
|
240
240
|
"scripts/growth_parts.py": {
|
|
241
|
-
"sha256": "
|
|
242
|
-
"size":
|
|
241
|
+
"sha256": "84321f429394aaf1295e445e46ef2f09ab6881e66c47d16cb789eff86279b572",
|
|
242
|
+
"size": 11435
|
|
243
243
|
},
|
|
244
244
|
"scripts/hooks/pre-commit": {
|
|
245
245
|
"sha256": "14dafabbfd698f7e510411b144ec624affe41023113b1ffd0f1aa8f3e623a275",
|
|
@@ -298,8 +298,8 @@
|
|
|
298
298
|
"size": 7912
|
|
299
299
|
},
|
|
300
300
|
"scripts/memory.py": {
|
|
301
|
-
"sha256": "
|
|
302
|
-
"size":
|
|
301
|
+
"sha256": "4d8a4da1428d6239e3eaa0a28902888bd7ce4d49a25c389cadeaecf37d907463",
|
|
302
|
+
"size": 339027
|
|
303
303
|
},
|
|
304
304
|
"scripts/memory_extras.py": {
|
|
305
305
|
"sha256": "4adb61400c5224c90aa54f059267f795c6348a251d93cd173d79fff157d57d90",
|
|
@@ -318,8 +318,8 @@
|
|
|
318
318
|
"size": 6684
|
|
319
319
|
},
|
|
320
320
|
"scripts/panel_cloud.py": {
|
|
321
|
-
"sha256": "
|
|
322
|
-
"size":
|
|
321
|
+
"sha256": "bb0762f93efd0cdbb0db7f4541935a39c77579f6c1c7c974afa5094c8f0399f6",
|
|
322
|
+
"size": 32697
|
|
323
323
|
},
|
|
324
324
|
"scripts/panel_data.py": {
|
|
325
325
|
"sha256": "189eadcba9139fc934fc22fcd62911828b28fe3a4a189c8c0598043d227ea37b",
|
|
@@ -334,8 +334,8 @@
|
|
|
334
334
|
"size": 12360
|
|
335
335
|
},
|
|
336
336
|
"scripts/panel_server.py": {
|
|
337
|
-
"sha256": "
|
|
338
|
-
"size":
|
|
337
|
+
"sha256": "3e34c3461994f57d61d0bdcd6d81a575e03d18591f618f8d2e445a2618465ba3",
|
|
338
|
+
"size": 161326
|
|
339
339
|
},
|
|
340
340
|
"scripts/panel_settings.py": {
|
|
341
341
|
"sha256": "1d33fc5bf46ee64e3d1b052ecfa1b998a5da55a58e55807182a7214f8594b15b",
|
|
@@ -358,8 +358,8 @@
|
|
|
358
358
|
"size": 27795
|
|
359
359
|
},
|
|
360
360
|
"scripts/persona.py": {
|
|
361
|
-
"sha256": "
|
|
362
|
-
"size":
|
|
361
|
+
"sha256": "62b69b58c99a7d9488cf9f17c244b1fccd328846d78ea199d58c3321ea0f0ec1",
|
|
362
|
+
"size": 135416
|
|
363
363
|
},
|
|
364
364
|
"scripts/prepublish_tests.py": {
|
|
365
365
|
"sha256": "8d116de1edd3ab57584a6a2749598cf127e918383da67e50118601e5a3970c2a",
|
|
@@ -382,20 +382,20 @@
|
|
|
382
382
|
"size": 11690
|
|
383
383
|
},
|
|
384
384
|
"scripts/safety.py": {
|
|
385
|
-
"sha256": "
|
|
386
|
-
"size":
|
|
385
|
+
"sha256": "1ae280f1f03feecf8b735b6305b136b5809d138c168e22e1d9fa5495b77fb145",
|
|
386
|
+
"size": 16331
|
|
387
387
|
},
|
|
388
388
|
"scripts/safety_net.py": {
|
|
389
389
|
"sha256": "678d9286c83530e5196f4e46ef195d7e4686fe7f9bcbff0af57ff1b97827376e",
|
|
390
390
|
"size": 16206
|
|
391
391
|
},
|
|
392
392
|
"scripts/session_import.py": {
|
|
393
|
-
"sha256": "
|
|
394
|
-
"size":
|
|
393
|
+
"sha256": "61ddf40707e0b11d9c958040f2024d1fc7c4dc45eb798ed0a4befcce38713bbe",
|
|
394
|
+
"size": 33621
|
|
395
395
|
},
|
|
396
396
|
"scripts/session_rag.py": {
|
|
397
|
-
"sha256": "
|
|
398
|
-
"size":
|
|
397
|
+
"sha256": "60fe617e3ca9863d9f77957421ce81de91a533452618d3dbb84a81cf1826df5e",
|
|
398
|
+
"size": 12250
|
|
399
399
|
},
|
|
400
400
|
"scripts/session_summary.py": {
|
|
401
401
|
"sha256": "290d6cff75c68461f03bcad8d691793fb9c79612d4c44b3da22679fab021a149",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lingshu-skill",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.72.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",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"!scripts/astrbot_plugin_lingshu/engine/scripts/_*"
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
|
-
"prepack": "python scripts/npm_prepack.py"
|
|
34
|
+
"prepack": "python scripts/npm_prepack.py",
|
|
35
|
+
"postpublish": "python scripts/autotag.py"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"@deepseek-ai/cordis": "^0.2.0-rc.1 || ^0.2.1-alpha.3 || ^0.2.1-rc.1 || ^0.2.1-rc.2 || ^0.2.1-rc.3"
|
package/scripts/assembler.py
CHANGED
|
@@ -61,10 +61,16 @@ def plan(parts: dict, budget: int = 40000, *, ratios: dict | None = None,
|
|
|
61
61
|
budget = max(1, int(budget))
|
|
62
62
|
ratios = {**DEFAULT_RATIOS, **(ratios or {})}
|
|
63
63
|
# 输出预留:min(max_tokens, 25% 窗口),与附录 C 的 outputHeadroomMaxPct 一致
|
|
64
|
+
# LS-056(v5.71):钳制输出预留和可用上下文范围!
|
|
65
|
+
# 旧写法不设防——output_reserve 传负数时 reserve<0 → usable > 总预算;
|
|
66
|
+
# 传 >1 时 reserve 吃掉全部窗口。现在 reserve 强制钳在 [0, budget]。
|
|
67
|
+
_or = float(output_reserve) if output_reserve is not None else 0.25
|
|
68
|
+
_or = max(0.0, min(1.0, _or))
|
|
64
69
|
if max_output_tokens:
|
|
65
|
-
reserve = min(int(max_output_tokens), int(budget *
|
|
70
|
+
reserve = min(int(max_output_tokens), int(budget * _or))
|
|
66
71
|
else:
|
|
67
|
-
reserve = int(budget *
|
|
72
|
+
reserve = int(budget * _or)
|
|
73
|
+
reserve = max(0, min(budget, reserve))
|
|
68
74
|
usable = max(1, budget - reserve)
|
|
69
75
|
|
|
70
76
|
texts = {name: str(parts.get(name) or "") for name in SECTIONS}
|