lingshu-skill 5.25.0 → 5.28.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 +137 -0
- package/README.md +1577 -1577
- package/SKILL-lite.md +59 -59
- package/SKILL-tiny.md +38 -38
- package/SKILL.md +405 -405
- package/cordis-plugin/lingshu-cron/plugin.js +15 -5
- package/package.json +52 -52
- package/scripts/_ci_env_probe.py +81 -0
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +16 -16
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +137 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +1577 -1577
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +59 -59
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +38 -38
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +405 -405
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_ci_env_probe.py +81 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/behavior_baseline.py +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/bench.py +218 -190
- package/scripts/astrbot_plugin_lingshu/engine/scripts/check_pressure_sync.py +31 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/check_tag.py +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/coverage_report.py +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/make_icon.py +24 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +31 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/release.py +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/scripts/session_import.py +28 -0
- package/scripts/astrbot_plugin_lingshu/make_checksums.py +28 -0
- package/scripts/behavior_baseline.py +28 -0
- package/scripts/bench.py +218 -190
- package/scripts/check_pressure_sync.py +31 -0
- package/scripts/check_tag.py +28 -0
- package/scripts/check_version.py +31 -0
- package/scripts/coverage_report.py +28 -0
- package/scripts/growth.py +28 -0
- package/scripts/make_icon.py +24 -0
- package/scripts/make_manifest.py +285 -254
- package/scripts/make_plugin_zip.py +28 -0
- package/scripts/panel_build.py +31 -0
- package/scripts/panel_server.py +28 -0
- package/scripts/release.py +28 -0
- package/scripts/run_tests.py +31 -0
- package/scripts/session_import.py +28 -0
- package/scripts/sync_engine.py +170 -139
- package/docs/npm-/345/217/221/345/270/203/350/257/264/346/230/216.md +0 -49
- package/docs/tgz-/345/256/211/350/243/205/350/257/264/346/230/216.md +0 -53
- package/docs//345/217/221/345/270/203/350/207/252/345/212/250/345/214/226.md +0 -54
- package/docs//345/256/241/346/240/270/346/224/271/350/277/233/345/276/205/345/212/236.md +0 -201
|
@@ -963,13 +963,22 @@ export function apply(ctx, config) {
|
|
|
963
963
|
// 先把"真实对话字符数"算出来:既给下面的 chars 分支用,也给盈不足标定
|
|
964
964
|
// 提供自变量(宿主给真值 token 时才成对记录)。
|
|
965
965
|
let chars = 0
|
|
966
|
+
let lingshuChars = 0 // 灵枢注入虽不算"对话",但真的占上下文(v3.59 只排除没加回)
|
|
966
967
|
for (const m of msgs) {
|
|
967
|
-
|
|
968
|
-
if (LINGSHU_SOURCES.has(m?.source?.name)) continue
|
|
968
|
+
const isLingshu = LINGSHU_SOURCES.has(m?.source?.name)
|
|
969
969
|
for (const c of (Array.isArray(m?.content) ? m.content : [])) {
|
|
970
|
-
if (
|
|
970
|
+
if (typeof c?.text !== 'string') continue
|
|
971
|
+
// text 与 tool_result 都算(v3.59 只看 text,工具结果整块漏计——那才是大头)
|
|
972
|
+
const n = c.text.length
|
|
973
|
+
if (n <= 0) continue
|
|
974
|
+
if (isLingshu) lingshuChars += n
|
|
975
|
+
else chars += n
|
|
971
976
|
}
|
|
972
977
|
}
|
|
978
|
+
// 灵枢注入要加回:它占上下文空间,只是不属于"对话"
|
|
979
|
+
// (v3.59 只排除没加回 = 灵枢注入整块漏计,实测水位被低估 4 倍多)
|
|
980
|
+
const dialogChars = chars // 纯对话字符:标定样本要用它
|
|
981
|
+
chars += lingshuChars // 含注入的总字符:水位分母要用它
|
|
973
982
|
for (let i = msgs.length - 1; i >= 0; i--) {
|
|
974
983
|
const u = msgs[i]?.metadata?.usage || msgs[i]?.usage || msgs[i]?.modelUsage
|
|
975
984
|
|| msgs[i]?.metadata?.modelUsage
|
|
@@ -979,8 +988,9 @@ export function apply(ctx, config) {
|
|
|
979
988
|
const total = num(u.totalTokens)
|
|
980
989
|
const used = total > 0 ? total : prompt
|
|
981
990
|
if (used > 0) {
|
|
982
|
-
// 盈不足:拿到真值时顺手记一组 (字符数, 真实 token),交给 _recordCalib
|
|
983
|
-
|
|
991
|
+
// 盈不足:拿到真值时顺手记一组 (字符数, 真实 token),交给 _recordCalib 拟合。
|
|
992
|
+
// 用 dialogChars 而不是 chars:灵枢注入的体积每次都变,掺进拟合会把斜率带偏。
|
|
993
|
+
_recordCalib(dialogChars, used)
|
|
984
994
|
return { pct: Math.min(100, Math.round(used / cfg.contextLimit * 100)), source: 'usage' }
|
|
985
995
|
}
|
|
986
996
|
}
|
package/package.json
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "lingshu-skill",
|
|
3
|
-
"version": "5.
|
|
4
|
-
"description": "Brain-inspired persistent memory, persona and growth system for AI coding agents. Local-only, zero-dependency Python. Requires Python 3.10+.",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/Q2667671398/lingshu-skill.git"
|
|
8
|
-
},
|
|
9
|
-
"homepage": "https://github.com/Q2667671398/lingshu-skill#readme",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"type": "module",
|
|
12
|
-
"main": "index.js",
|
|
13
|
-
"files": [
|
|
14
|
-
"SKILL.md",
|
|
15
|
-
"SKILL-lite.md",
|
|
16
|
-
"SKILL-tiny.md",
|
|
17
|
-
"README.md",
|
|
18
|
-
"CHANGELOG.md",
|
|
19
|
-
"index.js",
|
|
20
|
-
"cordis.patch.yml",
|
|
21
|
-
"start-panel.bat",
|
|
22
|
-
"assets/",
|
|
23
|
-
"docs/",
|
|
24
|
-
"cordis-plugin/",
|
|
25
|
-
"scripts/"
|
|
26
|
-
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"prepack": "python scripts/npm_prepack.py"
|
|
29
|
-
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"@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"
|
|
32
|
-
},
|
|
33
|
-
"peerDependenciesMeta": {
|
|
34
|
-
"@deepseek-ai/cordis": {
|
|
35
|
-
"optional": true
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"keywords": [
|
|
39
|
-
"dsh",
|
|
40
|
-
"deepseek",
|
|
41
|
-
"coding-agent",
|
|
42
|
-
"plugin",
|
|
43
|
-
"memory",
|
|
44
|
-
"persona"
|
|
45
|
-
],
|
|
46
|
-
"dsh": {
|
|
47
|
-
"bundle": {
|
|
48
|
-
"patch": "./cordis.patch.yml"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"packageManager": "pnpm@12.21.0+sha512.66fd8278ee28935ce951792d34367ff3af5c432a2756445823029533835b8da529bbe0be5130afd56ed0713fb8789e47bad82d93bd5ae2fe54b15562d6276ef0"
|
|
52
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "lingshu-skill",
|
|
3
|
+
"version": "5.28.0",
|
|
4
|
+
"description": "Brain-inspired persistent memory, persona and growth system for AI coding agents. Local-only, zero-dependency Python. Requires Python 3.10+.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/Q2667671398/lingshu-skill.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Q2667671398/lingshu-skill#readme",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "index.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"SKILL.md",
|
|
15
|
+
"SKILL-lite.md",
|
|
16
|
+
"SKILL-tiny.md",
|
|
17
|
+
"README.md",
|
|
18
|
+
"CHANGELOG.md",
|
|
19
|
+
"index.js",
|
|
20
|
+
"cordis.patch.yml",
|
|
21
|
+
"start-panel.bat",
|
|
22
|
+
"assets/",
|
|
23
|
+
"docs/",
|
|
24
|
+
"cordis-plugin/",
|
|
25
|
+
"scripts/"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"prepack": "python scripts/npm_prepack.py"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@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"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"@deepseek-ai/cordis": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"dsh",
|
|
40
|
+
"deepseek",
|
|
41
|
+
"coding-agent",
|
|
42
|
+
"plugin",
|
|
43
|
+
"memory",
|
|
44
|
+
"persona"
|
|
45
|
+
],
|
|
46
|
+
"dsh": {
|
|
47
|
+
"bundle": {
|
|
48
|
+
"patch": "./cordis.patch.yml"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"packageManager": "pnpm@12.21.0+sha512.66fd8278ee28935ce951792d34367ff3af5c432a2756445823029533835b8da529bbe0be5130afd56ed0713fb8789e47bad82d93bd5ae2fe54b15562d6276ef0"
|
|
52
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""CI 诊断探针:只在 sync_engine 失败时被调用,把环境事实打出来。
|
|
3
|
+
|
|
4
|
+
为什么单独成文件:内联在 workflow 的 heredoc 会破坏 YAML 缩进(实测解析失败),
|
|
5
|
+
而这一段逻辑值得留档——它回答的是"为什么在 Windows runner 上失败、Linux 上不".
|
|
6
|
+
"""
|
|
7
|
+
import locale
|
|
8
|
+
import pathlib
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main() -> int:
|
|
13
|
+
root = pathlib.Path(".").resolve()
|
|
14
|
+
print(f" cwd={root}")
|
|
15
|
+
print(f" python={sys.version.split()[0]}")
|
|
16
|
+
print(f" fsencoding={sys.getfilesystemencoding()}")
|
|
17
|
+
print(f" preferred={locale.getpreferredencoding(False)}")
|
|
18
|
+
|
|
19
|
+
print(" --- 关键路径 ---")
|
|
20
|
+
for rel in ("scripts",
|
|
21
|
+
"scripts/astrbot_plugin_lingshu",
|
|
22
|
+
"scripts/astrbot_plugin_lingshu/engine",
|
|
23
|
+
"docs/panel-api.md", "docs/commands.md",
|
|
24
|
+
"docs/mechanics.md", "docs/models.md", "docs/recovery.md",
|
|
25
|
+
"assets/panel.html"):
|
|
26
|
+
p = root / rel
|
|
27
|
+
kind = "-" if not p.exists() else ("dir" if p.is_dir() else f"{p.stat().st_size}B")
|
|
28
|
+
print(f" {rel}: {kind}")
|
|
29
|
+
|
|
30
|
+
# 换行抽样:CI 若在 Windows 上 checkout 成 CRLF,这里能直接看出来
|
|
31
|
+
print(" --- 换行抽样(前 5 个 .md/.py)---")
|
|
32
|
+
shown = 0
|
|
33
|
+
for p in sorted(root.rglob("*")):
|
|
34
|
+
if shown >= 5:
|
|
35
|
+
break
|
|
36
|
+
if p.is_file() and p.suffix.lower() in (".md", ".py") and "node_modules" not in str(p):
|
|
37
|
+
b = p.read_bytes()[:400]
|
|
38
|
+
crlf = b.count(b"\r\n")
|
|
39
|
+
lf = b.count(b"\n") - crlf
|
|
40
|
+
print(f" {p.relative_to(root)}: CRLF={crlf} LF={lf}")
|
|
41
|
+
shown += 1
|
|
42
|
+
|
|
43
|
+
# engine 里是否残留已从根目录删掉的文档
|
|
44
|
+
eng = root / "scripts" / "astrbot_plugin_lingshu" / "engine"
|
|
45
|
+
if eng.is_dir():
|
|
46
|
+
stale = [p.name for p in eng.rglob("*.md")
|
|
47
|
+
if not (root / p.relative_to(eng)).exists()]
|
|
48
|
+
print(f" --- engine 里根目录已无对应项的 .md: {stale[:8] or '无'}")
|
|
49
|
+
return 0
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _ensure_utf8_stdout() -> None:
|
|
53
|
+
"""把 stdout/stderr 切到 UTF-8,避免 Windows 控制台(cp1252/cp936)编不了中文就崩。
|
|
54
|
+
|
|
55
|
+
CI 的 windows-latest stdout 是 cp1252:脚本一 print 中文就 UnicodeEncodeError
|
|
56
|
+
直接退出(实测 sync_engine.py / make_checksums.py 都因此挂过,Ubuntu 同期正常)。
|
|
57
|
+
这不是业务 bug,是"中文输出 + 非 UTF-8 控制台"的必然结果。
|
|
58
|
+
"""
|
|
59
|
+
for name in ("stdout", "stderr"):
|
|
60
|
+
stream = getattr(sys, name, None)
|
|
61
|
+
fn = getattr(stream, "reconfigure", None)
|
|
62
|
+
if callable(fn):
|
|
63
|
+
try:
|
|
64
|
+
fn(encoding="utf-8", errors="replace")
|
|
65
|
+
continue
|
|
66
|
+
except (OSError, ValueError, AttributeError):
|
|
67
|
+
pass
|
|
68
|
+
try:
|
|
69
|
+
import io
|
|
70
|
+
buf = getattr(stream, "buffer", None)
|
|
71
|
+
if buf is not None:
|
|
72
|
+
setattr(sys, name,
|
|
73
|
+
io.TextIOWrapper(buf, encoding="utf-8", errors="replace",
|
|
74
|
+
line_buffering=True))
|
|
75
|
+
except Exception: # noqa: BLE001
|
|
76
|
+
pass
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
_ensure_utf8_stdout()
|
|
81
|
+
sys.exit(main())
|
|
@@ -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": "47c8d59df673699e3bd6b49fcc2aa9e308b86f2b698a3258fc9b5da18402a171",
|
|
5
|
+
"engine/README.md": "403af64c93f30b271bec6df7f17a814c2272ddd4527354b873584b0414f1e9ca",
|
|
6
|
+
"engine/SKILL-lite.md": "cd1001c814666f6e1e2e85a688a89d721b7a9e653627f9b222e0326ff8131658",
|
|
7
|
+
"engine/SKILL-tiny.md": "cca7b2c60a03ed9afed2f91797c523b6dc0180b35853746290825193cc5d81b7",
|
|
8
|
+
"engine/SKILL.md": "b02c82c2eade58a795faaa62e22cd9e09b0a9bb2d89e05a936259605abb7e7e8",
|
|
9
9
|
"engine/assets/panel.html": "74b763c4fae3d3be607c85e9ae6b2ef8ce5c13c4294937adcc58d251f78a218d",
|
|
10
10
|
"engine/docs/commands.md": "e3f515a760f06fc8f528e93b59716d46499ffb1976e945814ac6dc1d18964e0f",
|
|
11
11
|
"engine/docs/mechanics.md": "e8a6602a434ed5b78cac64a98884f65a6888eb48daa7a1c0be1f6c3984041b34",
|
|
@@ -13,26 +13,26 @@
|
|
|
13
13
|
"engine/docs/panel-api.md": "d57f793c7504c50272a16d99f7d6bcd3fd6a246bad8f049199920ff0f0f00f00",
|
|
14
14
|
"engine/docs/recovery.md": "2e9443d8416048c72ebe5cbec03a437fb833e41f4cd6cc4b3c8ee14ea73a0e8e",
|
|
15
15
|
"engine/scripts/assembler.py": "084e1b0157feda76539f0acd57f813edc4fa4df65c7d418912ef874174622db6",
|
|
16
|
-
"engine/scripts/behavior_baseline.py": "
|
|
17
|
-
"engine/scripts/bench.py": "
|
|
16
|
+
"engine/scripts/behavior_baseline.py": "7f488663082f301426c98f291a31860dd159a6097eba6ff225e4912f1b222272",
|
|
17
|
+
"engine/scripts/bench.py": "7e410bb94a93c8e0b4fd8187ede7a3f7f6cf171e43a2884a836b6734e23e9dc0",
|
|
18
18
|
"engine/scripts/brain.py": "671ba08c6af91841eddab4bd2eedb79d3924b6a66fa6a87c8cb5acedb000ba1d",
|
|
19
|
-
"engine/scripts/check_pressure_sync.py": "
|
|
20
|
-
"engine/scripts/check_tag.py": "
|
|
19
|
+
"engine/scripts/check_pressure_sync.py": "d7ea8acfa8a2d07baca12c9a6664c76a259766d6e1cecf06963ed30241f9bb8b",
|
|
20
|
+
"engine/scripts/check_tag.py": "fd333d0983ff075ea7340532dfeed62ab05ab521d169b44ff8a928d418c7dd22",
|
|
21
21
|
"engine/scripts/checkpoint.py": "3a9292121042692dc872a865b6ee1c1e5f14c054791887e0791f19ccdb9638fb",
|
|
22
22
|
"engine/scripts/cli.py": "51ffd19d441bd0c9efebb13ff8cf13fd72ab102ab50047c600752d6fd389a664",
|
|
23
23
|
"engine/scripts/context_ab.py": "3d383f1fc16d328612825bbf731866fa427da0746490d027a0ddb719d210f1cb",
|
|
24
24
|
"engine/scripts/core.py": "ab964997802e792add6fef95cd470e1f2d62aeb1048f46431626584242940072",
|
|
25
|
-
"engine/scripts/coverage_report.py": "
|
|
25
|
+
"engine/scripts/coverage_report.py": "085fd3e9b4247718a2e90d489b15c582a3fdcb6a02aae79ddc82b962da1e94a5",
|
|
26
26
|
"engine/scripts/desktop_shortcut.py": "77ea248bfaaf28e1e4299979d0c0d8c80a055642dde9a40f5e297b2008474091",
|
|
27
27
|
"engine/scripts/dream.py": "c1ba3de2958fb045db7b6962a6dd0fcf70f225bfb4d372dd9c3e8584e4f759ce",
|
|
28
28
|
"engine/scripts/emotion.py": "b56f2516a47ed5adecfe913e7e24957e5f4975fc8379f4097d5fa73dbd5c97d0",
|
|
29
29
|
"engine/scripts/failures.py": "3a16234a1871f62e3ba7b7b743110b4044fb7b715b4d0e924b8ebf1cf0be50d0",
|
|
30
30
|
"engine/scripts/fallback_embed.py": "11339a9f5040aea8952fdd45f4183cdfb0f00266ff61e200f3b4e8a62778f6e0",
|
|
31
|
-
"engine/scripts/growth.py": "
|
|
31
|
+
"engine/scripts/growth.py": "d302ed78142533cba877d64fca92326f536acde3c787b3db458e6e959c537122",
|
|
32
32
|
"engine/scripts/growth_parts.py": "d8f8d1808d4097630e7a0425d1ad9bc8f3826c11a64625304e25336f2a8aa592",
|
|
33
33
|
"engine/scripts/insights.py": "3ed8d8aedb79b7c578985285e5838cc93a58163383ac83caf0e45eb343e9c27e",
|
|
34
34
|
"engine/scripts/make_dsh_tgz.py": "d7371a4e521925d9b0cafee374c940baf5b2d5d96f4971f941b57fe46be355b2",
|
|
35
|
-
"engine/scripts/make_icon.py": "
|
|
35
|
+
"engine/scripts/make_icon.py": "1ff9d6ba6c63dae2f2c691c30c81b3b6c69411bde8893bfdfd65c0e14722cfc1",
|
|
36
36
|
"engine/scripts/mem_dialogue.py": "3ea39782e930626e979b3a14718e643b107f959570efd2053216da220e3ec376",
|
|
37
37
|
"engine/scripts/mem_embed.py": "b98478243237221a5bce491a5cbf4ca2753de29285086abfb0a855e3473c27a8",
|
|
38
38
|
"engine/scripts/mem_lesson.py": "e1520786315f3e41c829909c739e5af3eee89397da7db5026d106710b2b3c118",
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"engine/scripts/mem_topic.py": "c22f75c128cdd3b26ff845f1a71608401bc0dc8955f9f0e1988d7f0cd663d0d5",
|
|
41
41
|
"engine/scripts/memory.py": "a2298c0146f011709230a314f2127c6ae33b1063c70f4fe353a1254e798036f6",
|
|
42
42
|
"engine/scripts/npm_prepack.py": "d62c491a6f9edfcab2dd465a995e72df879a61b4da26ae0fe76121c8adc77e02",
|
|
43
|
-
"engine/scripts/panel_build.py": "
|
|
43
|
+
"engine/scripts/panel_build.py": "e36dbc2e2c3ea1e36da6a4aa279f666937199d685ea3af7f676b1f350f59d608",
|
|
44
44
|
"engine/scripts/panel_cloud.py": "956b1ae529b1c29fc1271b635b5a6a73be6b82c9acb94aa59fab8cfda63c9440",
|
|
45
45
|
"engine/scripts/panel_data.py": "5788aaee9b4e56e73587c4d0474687cecaa40dd7e507f02c27dd07aa208ba237",
|
|
46
46
|
"engine/scripts/panel_launcher.py": "d54dc3ab7b4a7301651cb797e4003f6b228c45f6842bc70deac91569289f6e83",
|
|
47
|
-
"engine/scripts/panel_server.py": "
|
|
47
|
+
"engine/scripts/panel_server.py": "2ec2f09ba960a739aa11c80f3a12dbd94f44ada8175e66435d08a2a72a6f38fd",
|
|
48
48
|
"engine/scripts/panel_settings.py": "49714ad058b1fe0cdd495a2e7eeadc3b4554346c92150b1381cdc39f44012b6e",
|
|
49
49
|
"engine/scripts/panel_update.py": "6ff1a0687c05e3ef4ae846058abea4dacf985a3fe6adcdbb4eef1b38e27139b5",
|
|
50
50
|
"engine/scripts/panels.py": "9db94038c2c11fc5da0f2f7c3292d01053acfaf1b74f1517a1f1c4402895fef4",
|
|
51
51
|
"engine/scripts/persona.py": "f3e12472ed33aaea01c1694247ba9838126e2c432ce5edac194c621ddadc9a1b",
|
|
52
|
-
"engine/scripts/release.py": "
|
|
52
|
+
"engine/scripts/release.py": "42496434d9edc232931df3aad44e75d5d9aaddb6b5663019374473aeb6246b68",
|
|
53
53
|
"engine/scripts/retriever.py": "85a35f8f660767cff1c068e722b51e3b5623c4dffe4822527eee96f9220240d3",
|
|
54
54
|
"engine/scripts/safety.py": "01ff42b7dac0eeac45c4a1e8cee97a21d8f0de55067213a61efbb95073186638",
|
|
55
55
|
"engine/scripts/safety_net.py": "4066da364082ebe5ec0bbccb9b516f3b1583516b4a2c5e1d410f8ba7c5819c0b",
|
|
56
|
-
"engine/scripts/session_import.py": "
|
|
56
|
+
"engine/scripts/session_import.py": "914181d3cb8eebe6a41a253f40b76bc57a5ebf0bbe274ed0d1102dd43cddc5a5",
|
|
57
57
|
"engine/scripts/session_rag.py": "a62e7cdf0e32c87c0031d0bc289b7864d6981c255af8055dcf02c70a153e7d61",
|
|
58
58
|
"engine/scripts/session_summary.py": "7f86a47cfb75b5340f748176f3cd2ca2242bd568351f241df6b9bbd6da3e66c0",
|
|
59
59
|
"engine/scripts/shape_audit.py": "3c361b8138d95c1e11476092e4d4da2eba71d9ed5300857bb3ce9113a8bf3be7",
|
|
@@ -1,5 +1,142 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## v5.28(2026-11-27)
|
|
4
|
+
|
|
5
|
+
> 主题:**UTF-8 防护补到测试文件**。这是同一个根因的第三次出现——
|
|
6
|
+
> 说明我前两轮的修法(按报错逐个补)方式就错了。
|
|
7
|
+
|
|
8
|
+
### 为什么还会有第三次
|
|
9
|
+
|
|
10
|
+
v5.27 把 `scripts/**` 全扫了一遍,Windows CI 顺利越过了 `生成 engine 副本`、
|
|
11
|
+
`checksums --check`,然后停在 `tests`:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
File "...\tests\test_check_tag.py", line 40, in check
|
|
15
|
+
print(("PASS " if ok else "FAIL ") + name + ...)
|
|
16
|
+
File "...\Lib\encodings\cp1252.py", line 19, in encode
|
|
17
|
+
UnicodeEncodeError: 'charmap' codec can't encode characters in position 5-6
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
测试里的 `name` 是中文(`"没有 tag → 拒绝"`),print 出来同样崩。
|
|
21
|
+
**同一个根因,只是换了个目录。**
|
|
22
|
+
|
|
23
|
+
### 改了什么
|
|
24
|
+
|
|
25
|
+
把扫描范围从 `scripts/**` 扩到 `tests/**`,凡是"有 `__main__` + print 中文/中文字符串"的
|
|
26
|
+
都补 `_ensure_utf8_stdout()`。共有 **89 个测试文件**符合条件,全部补上。
|
|
27
|
+
|
|
28
|
+
顺带修了两个漏网的:`scripts/make_icon.py` 与它 `engine/` 副本——它们没有
|
|
29
|
+
`import sys`,所以上一轮被跳过;这次先补 import 再加防护。
|
|
30
|
+
|
|
31
|
+
### 一个必须说清的发现
|
|
32
|
+
|
|
33
|
+
**`tests/` 下有 44 个文件是 git 跟踪的**(`git ls-files tests/` 数出来的),
|
|
34
|
+
不是我之前以为的"测试全不入库"。`test_check_tag.py` 就在其中——所以 CI 会跑它,
|
|
35
|
+
所以它必须修。本地那 50 多个 `test_p*.py` 才是纯本地、不入库的。
|
|
36
|
+
|
|
37
|
+
这个区分以前没写清楚,导致我改测试时默认"不用管"。
|
|
38
|
+
|
|
39
|
+
### 教训(第三次记同一条,说明前面没记住)
|
|
40
|
+
|
|
41
|
+
**不要在报错的地方打补丁,要按"缺陷的性质"扫全。**
|
|
42
|
+
cp1252 是平台属性,凡是 `print` 中文的地方都会崩——正确做法是一次扫完
|
|
43
|
+
`scripts/` + `tests/` + `cordis-plugin/`,而不是等 CI 一轮轮告诉我。
|
|
44
|
+
|
|
45
|
+
验证:`test_check_tag.py` 在模拟 cp1252 环境下退出码 0(修复前正是它崩);
|
|
46
|
+
全套 93/93 通过。
|
|
47
|
+
|
|
48
|
+
## v5.27(2026-11-27)
|
|
49
|
+
|
|
50
|
+
> 主题:**把 UTF-8 输出防护铺全**。v5.26 只补了 6 个脚本,CI 立刻在下一个
|
|
51
|
+
> `checksums --check` 上以**同一个** cp1252 错误挂掉——这次一次扫全。
|
|
52
|
+
|
|
53
|
+
### 为什么还要再修一次
|
|
54
|
+
|
|
55
|
+
v5.26 修好 `sync_engine.py` 后,Windows CI 越过了 `生成 engine 副本`,
|
|
56
|
+
但停在了下一步 `checksums --check`:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
File "...\scripts\astrbot_plugin_lingshu\make_checksums.py", line 78, in main
|
|
60
|
+
print(f"[checksums] OK\uff1a{len(current)} \u4e2a\u6587\u4ef6\u54c8\u5e0c\u4e00\u81f4...")
|
|
61
|
+
File "...\Lib\encodings\cp1252.py", line 19, in encode
|
|
62
|
+
UnicodeEncodeError: 'charmap' codec can't encode character '\uff1a' in position 14
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
同一个根因(Windows stdout 是 cp1252,编不了中文),只是换了个脚本。
|
|
66
|
+
挤牙膏式修复(发现一个补一个)在这种"普遍性缺陷"上注定要来回好几轮。
|
|
67
|
+
|
|
68
|
+
### 改了什么
|
|
69
|
+
|
|
70
|
+
全量扫描 `scripts/**/*.py`,凡是满足三条的都补上 `_ensure_utf8_stdout()`:
|
|
71
|
+
有 `if __name__ == "__main__"`、有非 ASCII 的 `print(...)`、还没加防护。
|
|
72
|
+
共补 **20 个**:
|
|
73
|
+
|
|
74
|
+
`_ci_env_probe.py`、`behavior_baseline.py`、`bench.py`、`check_tag.py`、
|
|
75
|
+
`coverage_report.py`、`growth.py`、`make_plugin_zip.py`、`panel_server.py`、
|
|
76
|
+
`release.py`、`session_import.py`、`astrbot_plugin_lingshu/make_checksums.py`
|
|
77
|
+
(含它们 `engine/` 下的副本)。
|
|
78
|
+
|
|
79
|
+
跳过 2 个(`make_icon.py` 主副本):它们没有 `import sys`,加防护要先补 import;
|
|
80
|
+
且只画图标、输出全是 ASCII,不在崩溃路径上。
|
|
81
|
+
|
|
82
|
+
### 教训
|
|
83
|
+
|
|
84
|
+
**"普遍性缺陷"要一次全扫,别按报错逐个补。** 第一次报 `sync_engine.py`、
|
|
85
|
+
第二次报 `make_checksums.py`——这个模式说明问题在"所有中文 print + cp1252",
|
|
86
|
+
而不是某两个脚本。全扫一遍的成本远低于反复等 CI。
|
|
87
|
+
|
|
88
|
+
验证:10 个改动脚本 `py_compile` 全过;`make_checksums.py --check` 在模拟
|
|
89
|
+
cp1252 环境下退出码 0(修复前正是这里崩);`sync --check` 53 脚本 + 11 文档一致。
|
|
90
|
+
|
|
91
|
+
## v5.26(2026-11-27)
|
|
92
|
+
|
|
93
|
+
> 主题:**修 Windows CI 的编码崩溃** + **水位估算漏算**(两处都是实测出来的真 bug)。
|
|
94
|
+
|
|
95
|
+
### 修:Windows CI 长期失败——cp1252 编不了中文
|
|
96
|
+
|
|
97
|
+
CI 的 `windows-latest` 一直在 `生成 engine 副本` 这一步失败,只看到一个裸
|
|
98
|
+
`exit code 1`(Ubuntu 同期全绿,所以一直被当成 Windows 特有问题去猜)。
|
|
99
|
+
拿到私密日志后原因很清楚:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
File "sync_engine.py", line 90, in sync
|
|
103
|
+
print(f"[sync] engine 副本已同步:...")
|
|
104
|
+
File "encodings\cp1252.py", line 19, in encode
|
|
105
|
+
UnicodeEncodeError: 'charmap' codec can't encode characters in position 14-21
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Windows runner 的 stdout 编码是 **cp1252**,脚本一 print 中文就崩。
|
|
109
|
+
与换行、文件内容、业务逻辑全无关,纯粹是"中文输出 + 非 UTF-8 控制台"。
|
|
110
|
+
|
|
111
|
+
修法:新增 `_ensure_utf8_stdout()`(`reconfigure(encoding='utf-8', errors='replace')`,
|
|
112
|
+
不可用时退回包一层 TextIOWrapper),接进 6 个会打印中文的入口脚本:
|
|
113
|
+
`sync_engine.py` / `make_manifest.py` / `check_version.py` / `check_pressure_sync.py` /
|
|
114
|
+
`panel_build.py` / `run_tests.py`。
|
|
115
|
+
|
|
116
|
+
教训:**CI 只报一个退出码时,先想办法拿到日志,别靠猜**。这一条猜了两轮。
|
|
117
|
+
|
|
118
|
+
### 修:水位估算漏算(14% vs 真实 62%)
|
|
119
|
+
|
|
120
|
+
`lingshu-cron` 的 `estimateWater()` 只累加"真实对话"的 `type==='text'` 字符,
|
|
121
|
+
把三样真实占用漏掉了,实测低估约 **4.4 倍**:
|
|
122
|
+
|
|
123
|
+
| 漏算项 | 说明 |
|
|
124
|
+
|---|---|
|
|
125
|
+
| 灵枢自己的注入包 | 被 `LINGSHU_SOURCES` 排除后**没有加回**,可它真占上下文 |
|
|
126
|
+
| 工具调用结果 | 只看 `type==='text'`,工具结果块整块不计 |
|
|
127
|
+
| 标定样本被污染 | `_recordCalib` 用含注入的总字符,注入体积每次都变,拟合斜率会漂 |
|
|
128
|
+
|
|
129
|
+
修法:
|
|
130
|
+
- 灵枢注入单独计数后**加回总字符**(水位分母用总字符 `chars`)
|
|
131
|
+
- 所有内容块(含 tool_result)都累加
|
|
132
|
+
- 标定改用**纯对话字符** `dialogChars`(保持样本可比)
|
|
133
|
+
- 有宿主 usage 时仍优先用真值,估算只是兜底
|
|
134
|
+
|
|
135
|
+
不改配置里的 `charsPerToken`/`systemOverheadTokens`:它们是拟合兜底值,
|
|
136
|
+
真正的偏差来自"漏算",不是"系数不对"。
|
|
137
|
+
|
|
138
|
+
验证:93/93 测试通过;`sync_engine.py` 在模拟 cp1252 环境下退出码 0(修复前崩溃)。
|
|
139
|
+
|
|
3
140
|
## v5.25(2026-11-27)
|
|
4
141
|
|
|
5
142
|
> 主题:**三个真问题** + 中转站 compat 修复。
|