lingshu-skill 5.61.0 → 5.62.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 +14 -0
- package/README.md +1 -1
- package/SKILL-lite.md +1 -1
- package/SKILL-tiny.md +1 -1
- package/SKILL.md +1 -1
- package/manifest.json +461 -0
- package/package.json +8 -2
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +8 -8
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +14 -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/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +3 -4
- package/scripts/astrbot_plugin_lingshu/engine/scripts/make_dsh_tgz.py +20 -3
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +13 -0
- package/scripts/growth.py +3 -4
- package/scripts/make_dsh_tgz.py +20 -3
- package/scripts/make_manifest.py +15 -10
- package/scripts/make_plugin_zip.py +7 -3
- package/scripts/panel_build.py +13 -0
- package/scripts/_ci_env_probe.py +0 -81
- package/scripts/_panel_smoke_v299.py +0 -27
- package/scripts/_scratch/_tmp_backup_race.py +0 -70
- package/scripts/_scratch/_tmp_cleanup_move.py +0 -34
- package/scripts/_scratch/_tmp_count_kinds.py +0 -25
- package/scripts/_scratch/_tmp_diag_paths.py +0 -48
- package/scripts/_scratch/_tmp_facts.py +0 -63
- package/scripts/_scratch/_tmp_find_copies.py +0 -31
- package/scripts/_scratch/_tmp_find_pin.py +0 -29
- package/scripts/_scratch/_tmp_fix_pin.py +0 -36
- package/scripts/_scratch/_tmp_fold_fixture.py +0 -55
- package/scripts/_scratch/_tmp_fold_test.mjs +0 -81
- package/scripts/_scratch/_tmp_inject_secs.py +0 -30
- package/scripts/_scratch/_tmp_kb_balance.py +0 -159
- package/scripts/_scratch/_tmp_lines.py +0 -15
- package/scripts/_scratch/_tmp_market_probe.py +0 -13
- package/scripts/_scratch/_tmp_move_partial.py +0 -16
- package/scripts/_scratch/_tmp_patch_b3.py +0 -41
- package/scripts/_scratch/_tmp_patch_b5.py +0 -62
- package/scripts/_scratch/_tmp_patch_crash_excl.py +0 -24
- package/scripts/_scratch/_tmp_patch_handoff.py +0 -21
- package/scripts/_scratch/_tmp_patch_ps1.py +0 -25
- package/scripts/_scratch/_tmp_patch_stat.py +0 -27
- package/scripts/_scratch/_tmp_patch_todo.py +0 -25
- package/scripts/_scratch/_tmp_patch_todo2.py +0 -64
- package/scripts/_scratch/_tmp_probe_session.py +0 -51
- package/scripts/_scratch/_tmp_style_probe.py +0 -40
- package/scripts/_scratch/_tmp_write_note.py +0 -139
- package/scripts/_scratch/_/346/235/245/346/272/220/350/256/260/345/275/225.txt +0 -1
- package/scripts/_scratch/asar_compaction/dsh-compaction-basic__lib__index.js +0 -1044
- package/scripts/_scratch/asar_compaction/dsh-compaction-tool-result-pruner__lib__index.js +0 -194
- package/scripts/_scratch/asar_compaction/dsh-compaction__lib__index.js +0 -175
- package/scripts/_scratch/asar_compaction/dsh-compaction__lib__types__tool-pairing.js +0 -97
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__image-offload.js +0 -47
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__index.js +0 -40
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__project-message.js +0 -37
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__brand.js +0 -9
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__checkpoint.js +0 -36
- package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__types.js +0 -10
- package/scripts/_scratch/commit_msg_occ.txt +0 -16
- package/scripts/_scratch/commit_msg_struct.txt +0 -16
- package/scripts/_scratch/v5.34_changelog.txt +0 -36
- package/scripts/_smoke_v299.py +0 -31
- package/scripts/_sync_trae_cn.py +0 -102
- package/scripts/_tmp_add_s10.py +0 -54
- package/scripts/_tmp_add_s11.py +0 -61
- package/scripts/_tmp_add_s12.py +0 -66
- package/scripts/_tmp_add_s13.py +0 -69
- package/scripts/_tmp_add_s14.py +0 -80
- package/scripts/_tmp_add_s9.py +0 -68
- package/scripts/_tmp_cache_load.py +0 -82
- package/scripts/_tmp_clean_market.py +0 -40
- package/scripts/_tmp_clean_pruned.py +0 -81
- package/scripts/_tmp_cleanup_docs.py +0 -39
- package/scripts/_tmp_cmp_ranker.py +0 -17
- package/scripts/_tmp_dolater_note.py +0 -35
- package/scripts/_tmp_dust_why.py +0 -27
- package/scripts/_tmp_explicit_import.py +0 -40
- package/scripts/_tmp_extract_compaction.py +0 -35
- package/scripts/_tmp_extract_compaction2.py +0 -63
- package/scripts/_tmp_extract_compaction3.py +0 -51
- package/scripts/_tmp_extract_compaction4.py +0 -54
- package/scripts/_tmp_finalize_s14.py +0 -39
- package/scripts/_tmp_find_compaction.py +0 -43
- package/scripts/_tmp_fix_b4.py +0 -22
- package/scripts/_tmp_fix_cli76.py +0 -26
- package/scripts/_tmp_fix_docs.py +0 -38
- package/scripts/_tmp_fix_docs_b.py +0 -46
- package/scripts/_tmp_fix_docs_b2.py +0 -22
- package/scripts/_tmp_fix_i3.py +0 -23
- package/scripts/_tmp_fix_s10.py +0 -83
- package/scripts/_tmp_fix_s11.py +0 -14
- package/scripts/_tmp_fix_s9_status.py +0 -19
- package/scripts/_tmp_fix_shadow_sim.py +0 -37
- package/scripts/_tmp_fix_traits_value.py +0 -41
- package/scripts/_tmp_import_idem.py +0 -106
- package/scripts/_tmp_log_ack.py +0 -45
- package/scripts/_tmp_mark_batch.py +0 -28
- package/scripts/_tmp_mark_batch2.py +0 -32
- package/scripts/_tmp_mark_dolater.py +0 -26
- package/scripts/_tmp_mark_dolater2.py +0 -31
- package/scripts/_tmp_move_self.py +0 -16
- package/scripts/_tmp_occ_cli.py +0 -22
- package/scripts/_tmp_occ_link.py +0 -108
- package/scripts/_tmp_optimize_recall.py +0 -54
- package/scripts/_tmp_panel_audit.py +0 -26
- package/scripts/_tmp_patch_batch3.py +0 -65
- package/scripts/_tmp_patch_rrf.py +0 -46
- package/scripts/_tmp_patch_s2s3.py +0 -80
- package/scripts/_tmp_patch_s4.py +0 -39
- package/scripts/_tmp_patch_s7.py +0 -43
- package/scripts/_tmp_patch_s8.py +0 -91
- package/scripts/_tmp_patch_skill.py +0 -17
- package/scripts/_tmp_release_guard.py +0 -57
- package/scripts/_tmp_rerank_breaker.py +0 -62
- package/scripts/_tmp_s16.py +0 -41
- package/scripts/_tmp_scan_asar.py +0 -41
- package/scripts/_tmp_scan_asar2.py +0 -37
- package/scripts/_tmp_speed_survey.py +0 -49
- package/scripts/_tmp_struct_docs.py +0 -49
- package/scripts/_tmp_sum_fallback.py +0 -42
- package/scripts/_tmp_sweep.py +0 -81
- package/scripts/_tmp_sync_check.py +0 -69
- package/scripts/_tmp_sync_tail.py +0 -39
- package/scripts/_tmp_todo_clean.py +0 -67
- package/scripts/_tmp_verify_copy.py +0 -17
- package/scripts/_tmp_wire_extras.py +0 -93
- package/scripts/_tmp_wire_hsum.py +0 -34
- package/scripts/_tmp_wire_occ_b5.py +0 -40
- package/scripts/_tmp_wire_ranker.py +0 -13
- package/scripts/_tmp_wire_shadow_timeline.py +0 -45
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_ci_env_probe.py +0 -81
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_panel_smoke_v299.py +0 -27
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_smoke_v299.py +0 -31
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +0 -102
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s10.py +0 -54
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s11.py +0 -61
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s12.py +0 -66
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s13.py +0 -69
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s14.py +0 -80
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s9.py +0 -68
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cache_load.py +0 -82
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_market.py +0 -40
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_pruned.py +0 -81
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cleanup_docs.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cmp_ranker.py +0 -17
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dolater_note.py +0 -35
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dust_why.py +0 -27
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_explicit_import.py +0 -40
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction.py +0 -35
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction2.py +0 -63
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction3.py +0 -51
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction4.py +0 -54
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_finalize_s14.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_find_compaction.py +0 -43
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_b4.py +0 -22
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_cli76.py +0 -26
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs.py +0 -38
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b.py +0 -46
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b2.py +0 -22
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_i3.py +0 -23
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s10.py +0 -83
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s11.py +0 -14
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s9_status.py +0 -19
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_shadow_sim.py +0 -37
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_traits_value.py +0 -41
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_import_idem.py +0 -106
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_log_ack.py +0 -45
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch.py +0 -28
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch2.py +0 -32
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater.py +0 -26
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater2.py +0 -31
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_move_self.py +0 -16
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_cli.py +0 -22
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_link.py +0 -108
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_optimize_recall.py +0 -54
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_panel_audit.py +0 -26
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_batch3.py +0 -65
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_rrf.py +0 -46
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s2s3.py +0 -80
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s4.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s7.py +0 -43
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s8.py +0 -91
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_skill.py +0 -17
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_release_guard.py +0 -57
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_rerank_breaker.py +0 -62
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_s16.py +0 -41
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar.py +0 -41
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar2.py +0 -37
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_speed_survey.py +0 -49
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_struct_docs.py +0 -49
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sum_fallback.py +0 -42
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sweep.py +0 -81
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_check.py +0 -69
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_tail.py +0 -39
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_todo_clean.py +0 -67
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_verify_copy.py +0 -17
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_extras.py +0 -93
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_hsum.py +0 -34
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_occ_b5.py +0 -40
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_ranker.py +0 -13
- package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_shadow_timeline.py +0 -45
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:从 asar 按索引抽 compaction 相关源码(可删)。"""
|
|
3
|
-
import glob
|
|
4
|
-
import json
|
|
5
|
-
import re
|
|
6
|
-
|
|
7
|
-
PATH = glob.glob("D:/*/resources/app.asar")[0]
|
|
8
|
-
|
|
9
|
-
with open(PATH, "rb") as f:
|
|
10
|
-
f.seek(0)
|
|
11
|
-
head = f.read(3 << 20) # 索引在头部区域
|
|
12
|
-
|
|
13
|
-
text = head.decode("utf-8", "replace")
|
|
14
|
-
# 该 asar 的索引是 JSON(可能在 header 里),先定位以 { 开头的 JSON 段
|
|
15
|
-
start = text.find('{"files"')
|
|
16
|
-
if start < 0:
|
|
17
|
-
# 有的打包器把 header 放在别处,暴力找 "compaction.ts" 附近的 JSON
|
|
18
|
-
i = text.find('"compaction.ts"')
|
|
19
|
-
start = text.rfind("{", 0, i - 2000) if i > 0 else -1
|
|
20
|
-
|
|
21
|
-
targets = {}
|
|
22
|
-
for name in ("compaction.ts", "trajectory-compaction-definition.ts"):
|
|
23
|
-
m = re.search(r'"' + re.escape(name) + r'":\{"size":(\d+),"offset":"(\d+)"', text)
|
|
24
|
-
if m:
|
|
25
|
-
targets[name] = (int(m.group(1)), int(m.group(2)))
|
|
26
|
-
|
|
27
|
-
print("定位:", targets)
|
|
28
|
-
|
|
29
|
-
with open(PATH, "rb") as f:
|
|
30
|
-
for name, (size, off) in targets.items():
|
|
31
|
-
f.seek(off)
|
|
32
|
-
body = f.read(size)
|
|
33
|
-
print("=" * 20, name, f"({size} 字节)")
|
|
34
|
-
print(body.decode("utf-8", "replace")[:3000])
|
|
35
|
-
print()
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:正规解析 asar 头,抽出 dsh-compaction* 包源码(可删)。
|
|
3
|
-
|
|
4
|
-
asar 布局:uint32(4) + uint32(headerSize) + JSON header + 数据区。
|
|
5
|
-
header.files 是树,节点有 {files:{...}} 或 {size, offset}。
|
|
6
|
-
"""
|
|
7
|
-
import glob
|
|
8
|
-
import json
|
|
9
|
-
import struct
|
|
10
|
-
import sys
|
|
11
|
-
|
|
12
|
-
PATH = glob.glob("D:/*/resources/app.asar")[0]
|
|
13
|
-
OUT = r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_scratch\asar_compaction"
|
|
14
|
-
import os
|
|
15
|
-
os.makedirs(OUT, exist_ok=True)
|
|
16
|
-
|
|
17
|
-
with open(PATH, "rb") as f:
|
|
18
|
-
head = f.read(16)
|
|
19
|
-
_a, hsize = struct.unpack("<II", head[:8])
|
|
20
|
-
header = f.read(hsize)
|
|
21
|
-
base = 8 + hsize
|
|
22
|
-
meta, _end = json.JSONDecoder().raw_decode(header.decode("utf-8", "replace"))
|
|
23
|
-
|
|
24
|
-
files = meta.get("files", {})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def walk(node, prefix=""):
|
|
28
|
-
for name, sub in (node or {}).items():
|
|
29
|
-
path = f"{prefix}/{name}" if prefix else name
|
|
30
|
-
if "files" in sub:
|
|
31
|
-
yield from walk(sub["files"], path)
|
|
32
|
-
else:
|
|
33
|
-
yield path, sub
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
targets = []
|
|
37
|
-
for path, sub in walk(files):
|
|
38
|
-
low = path.lower()
|
|
39
|
-
if "compaction" not in low:
|
|
40
|
-
continue
|
|
41
|
-
if not (low.endswith(".js") or low.endswith(".mjs") or low.endswith(".cjs")):
|
|
42
|
-
continue
|
|
43
|
-
targets.append((path, sub.get("size", 0), sub.get("offset")))
|
|
44
|
-
|
|
45
|
-
print(f"命中 {len(targets)} 个压缩相关 JS 文件:")
|
|
46
|
-
for p, s, o in targets[:40]:
|
|
47
|
-
print(f" {s:>7} {p}")
|
|
48
|
-
|
|
49
|
-
# 抽前若干个(按大小升序,先看小文件了解接口)
|
|
50
|
-
targets.sort(key=lambda x: x[1])
|
|
51
|
-
with open(PATH, "rb") as f:
|
|
52
|
-
for p, s, o in targets[:6]:
|
|
53
|
-
if o is None or s > 400_000:
|
|
54
|
-
continue
|
|
55
|
-
f.seek(base + int(o))
|
|
56
|
-
body = f.read(int(s))
|
|
57
|
-
safe = p.replace("/", "__")
|
|
58
|
-
dst = os.path.join(OUT, safe)
|
|
59
|
-
with open(dst, "wb") as w:
|
|
60
|
-
w.write(body)
|
|
61
|
-
print(f"\n===== {p} ({s} 字节) → {dst} =====")
|
|
62
|
-
txt = body.decode("utf-8", "replace")
|
|
63
|
-
print(txt[:1600])
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:按名字精确抽 compaction 主实现(可删)。"""
|
|
3
|
-
import glob
|
|
4
|
-
import json
|
|
5
|
-
import os
|
|
6
|
-
import struct
|
|
7
|
-
|
|
8
|
-
PATH = glob.glob("D:/*/resources/app.asar")[0]
|
|
9
|
-
OUT = r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_scratch\asar_compaction"
|
|
10
|
-
os.makedirs(OUT, exist_ok=True)
|
|
11
|
-
|
|
12
|
-
WANT = (
|
|
13
|
-
"dsh-compaction/lib/index.js",
|
|
14
|
-
"dsh-compaction-tool-result-pruner/lib/index.js",
|
|
15
|
-
"dsh-compaction/lib/types/tool-pairing.js",
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
with open(PATH, "rb") as f:
|
|
19
|
-
_a, hsize = struct.unpack("<II", f.read(8))
|
|
20
|
-
meta, _ = json.JSONDecoder().raw_decode(f.read(hsize).decode("utf-8", "replace"))
|
|
21
|
-
base = 8 + hsize
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def walk(node, prefix=""):
|
|
25
|
-
for name, sub in (node or {}).items():
|
|
26
|
-
path = f"{prefix}/{name}" if prefix else name
|
|
27
|
-
if "files" in sub:
|
|
28
|
-
yield from walk(sub["files"], path)
|
|
29
|
-
else:
|
|
30
|
-
yield path, sub
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
found = {}
|
|
34
|
-
for path, sub in walk(meta.get("files", {})):
|
|
35
|
-
for w in WANT:
|
|
36
|
-
if path.endswith(w):
|
|
37
|
-
found[w] = (sub.get("size", 0), sub.get("offset"))
|
|
38
|
-
|
|
39
|
-
with open(PATH, "rb") as f:
|
|
40
|
-
for w in WANT:
|
|
41
|
-
if w not in found:
|
|
42
|
-
print(f"缺失: {w}")
|
|
43
|
-
continue
|
|
44
|
-
size, off = found[w]
|
|
45
|
-
f.seek(base + int(off))
|
|
46
|
-
body = f.read(int(size))
|
|
47
|
-
dst = os.path.join(OUT, w.replace("/", "__"))
|
|
48
|
-
with open(dst, "wb") as o:
|
|
49
|
-
o.write(body)
|
|
50
|
-
print(f"\n===== {w} ({size}B) =====")
|
|
51
|
-
print(body.decode("utf-8", "replace")[:5200])
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:复用已验证的 asar 解析,抽 compaction 主实现(可删)。"""
|
|
3
|
-
import glob
|
|
4
|
-
import json
|
|
5
|
-
import os
|
|
6
|
-
import struct
|
|
7
|
-
|
|
8
|
-
PATH = glob.glob("D:/*/resources/app.asar")[0]
|
|
9
|
-
OUT = r"E:\丁厚同\文档\程序\灵枢-skill\scripts\_scratch\asar_compaction"
|
|
10
|
-
os.makedirs(OUT, exist_ok=True)
|
|
11
|
-
|
|
12
|
-
WANT = (
|
|
13
|
-
"dsh-compaction/lib/index.js",
|
|
14
|
-
"dsh-compaction-tool-result-pruner/lib/index.js",
|
|
15
|
-
"dsh-compaction/lib/types/tool-pairing.js",
|
|
16
|
-
"dsh-compaction-basic/lib/index.js",
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
with open(PATH, "rb") as f:
|
|
20
|
-
head = f.read(16)
|
|
21
|
-
_a, hsize = struct.unpack("<II", head[:8])
|
|
22
|
-
header = f.read(hsize)
|
|
23
|
-
base = 8 + hsize
|
|
24
|
-
meta, _end = json.JSONDecoder().raw_decode(header.decode("utf-8", "replace"))
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def walk(node, prefix=""):
|
|
28
|
-
for name, sub in (node or {}).items():
|
|
29
|
-
path = f"{prefix}/{name}" if prefix else name
|
|
30
|
-
if "files" in sub:
|
|
31
|
-
yield from walk(sub["files"], path)
|
|
32
|
-
else:
|
|
33
|
-
yield path, sub
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
found = {}
|
|
37
|
-
for path, sub in walk(meta.get("files", {})):
|
|
38
|
-
for w in WANT:
|
|
39
|
-
if path.endswith(w):
|
|
40
|
-
found.setdefault(w, (sub.get("size", 0), sub.get("offset")))
|
|
41
|
-
|
|
42
|
-
with open(PATH, "rb") as f:
|
|
43
|
-
for w in WANT:
|
|
44
|
-
if w not in found:
|
|
45
|
-
print(f"缺失: {w}")
|
|
46
|
-
continue
|
|
47
|
-
size, off = found[w]
|
|
48
|
-
f.seek(base + int(off))
|
|
49
|
-
body = f.read(int(size))
|
|
50
|
-
dst = os.path.join(OUT, w.replace("/", "__"))
|
|
51
|
-
with open(dst, "wb") as o:
|
|
52
|
-
o.write(body)
|
|
53
|
-
print(f"\n===== {w} ({size}B) =====")
|
|
54
|
-
print(body.decode("utf-8", "replace")[:4600])
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:§14 标为已落地 + README CLI 数(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
|
|
6
|
-
|
|
7
|
-
rp = ROOT / "README.md"
|
|
8
|
-
d = rp.read_text(encoding="utf-8")
|
|
9
|
-
n = d.count("82 个 CLI 命令")
|
|
10
|
-
rp.write_text(d.replace("82 个 CLI 命令", "84 个 CLI 命令"), encoding="utf-8")
|
|
11
|
-
print("README CLI 82→84 x", n)
|
|
12
|
-
|
|
13
|
-
p = ROOT / "docs" / "审核改进待办.md"
|
|
14
|
-
d = p.read_text(encoding="utf-8")
|
|
15
|
-
|
|
16
|
-
d = d.replace("| **Big Five 数值化** | ⬜ **未做**(M):需要先定 traits→5 维的映射表,属产品决策 |",
|
|
17
|
-
"| **Big Five 数值化** | ✅ 已做:`brain.py bigfive [--save]`——固定 5 维按关键词归并,"
|
|
18
|
-
"未映射计分不计(`{value,why,evidence}` 嵌套结构已正确处理) |", 1)
|
|
19
|
-
d = d.replace("| **OCC 结构情绪** | ⬜ **未做**(M):需要先定 OCC 22 类里用哪几类、怎么触发,属产品决策 |",
|
|
20
|
-
"| **OCC 结构情绪** | ✅ 已做(**6 类 + 预期违背拆正负两向**):`brain.py occ label|violation`,"
|
|
21
|
-
"失望=负向 / 释然=正向 |", 1)
|
|
22
|
-
|
|
23
|
-
SEC = """
|
|
24
|
-
### 14.3 决定与落地(2026-11-30)
|
|
25
|
-
|
|
26
|
-
用户拍板:**OCC 先上 6 类,「预期违背」拆正负两向**;Big Five 按 14.1 候选表落地。
|
|
27
|
-
|
|
28
|
-
- `scripts/occ.py`:6 类规则(失望/释然/满意/感激/愤怒/焦虑),每类要求"事件线索 + 方向线索"
|
|
29
|
-
同时命中才算,避免单词误报;`expected_violation()` 单独给出 violated + direction。
|
|
30
|
-
实测六句各命中一类,且"答应却没做到"=负向、"担心却没事"=正向。
|
|
31
|
-
- `scripts/bigfive.py`:5 维归并(未映射 traits **不计分**,不瞎归),`--save` 写入
|
|
32
|
-
`persona.json.big_five`;顺带修了 traits 嵌套结构 `{value,why,evidence}` 被当裸数字读成 0 的 bug
|
|
33
|
-
(`persona_drift` 的 magnitude 同样受益,原来对嵌套结构只能记 0.5 当量)。
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
if "### 14.3 决定与落地" not in d:
|
|
37
|
-
d = d.rstrip() + "\n\n" + SEC
|
|
38
|
-
p.write_text(d, encoding="utf-8")
|
|
39
|
-
print("§14.3 已补")
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:在 app.asar 里找 compaction 的真实实现/接口(跳过索引条目)(可删)。"""
|
|
3
|
-
import glob
|
|
4
|
-
|
|
5
|
-
PATH = glob.glob("D:/*/resources/app.asar")[0]
|
|
6
|
-
NEEDLES = [b"compaction", b"compactS", b"autoCompact", b"requestContext()"]
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def scan(needle, limit=6, ctx=520):
|
|
10
|
-
hits = 0
|
|
11
|
-
overlap = b""
|
|
12
|
-
with open(PATH, "rb") as f:
|
|
13
|
-
while True:
|
|
14
|
-
chunk = f.read(8 << 20)
|
|
15
|
-
if not chunk:
|
|
16
|
-
break
|
|
17
|
-
buf = overlap + chunk
|
|
18
|
-
start = 0
|
|
19
|
-
while hits < limit:
|
|
20
|
-
i = buf.find(needle, start)
|
|
21
|
-
if i < 0:
|
|
22
|
-
break
|
|
23
|
-
seg = buf[max(0, i - 200): i + ctx]
|
|
24
|
-
text = seg.decode("utf-8", "replace")
|
|
25
|
-
start = i + 1
|
|
26
|
-
# 跳过 asar 的文件索引(这类片段里有 integrity/offset 元数据)
|
|
27
|
-
if '"integrity"' in text or '"blockSize"' in text:
|
|
28
|
-
continue
|
|
29
|
-
if "sourceMappingURL" in text and len(text) < 300:
|
|
30
|
-
continue
|
|
31
|
-
print(f"--- {needle.decode()} ---")
|
|
32
|
-
print(text.replace("\x00", " ").strip()[:900])
|
|
33
|
-
print()
|
|
34
|
-
hits += 1
|
|
35
|
-
if hits >= limit:
|
|
36
|
-
return hits
|
|
37
|
-
overlap = buf[-len(needle) - 16:]
|
|
38
|
-
return hits
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for n in NEEDLES:
|
|
42
|
-
got = scan(n)
|
|
43
|
-
print(f"[{n.decode()}] 有效命中 {got}\n")
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:把 B4 行标为已修(默认关闭)(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
|
|
6
|
-
lines = p.read_text(encoding="utf-8").splitlines()
|
|
7
|
-
NEW = ("| B4 | **周期性风格摘要注入**:每 6 小时从近期对话算语气特征,自动生成紧凑注入提示 "
|
|
8
|
-
"| `persona suggest` 从**记忆**归纳候选特征,没有从**近期对话**实时提炼 "
|
|
9
|
-
"| ✅ **已修(默认关闭)**(2026-11-29):`style_check.hint()` 从近期回复提炼一句"
|
|
10
|
-
"`【语气】…`(平均句长/列表占比 + 具体建议),**6 小时缓存**(`config.style_hint_cache`);"
|
|
11
|
-
"注入侧只有 `config style_hint: true` 才追加(记 `rules` 段)。"
|
|
12
|
-
"**默认关闭**——属注入主链路改动,水位 >50% 时不该默认生效;实测默认关时注入包无该块 |")
|
|
13
|
-
hit = 0
|
|
14
|
-
for i, ln in enumerate(lines):
|
|
15
|
-
if ln.startswith("| B4 |"):
|
|
16
|
-
lines[i] = NEW
|
|
17
|
-
hit += 1
|
|
18
|
-
if hit != 1:
|
|
19
|
-
print("命中异常:", hit)
|
|
20
|
-
raise SystemExit(1)
|
|
21
|
-
p.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
|
22
|
-
print("B4 已标已修")
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:README CLI 数 75→76 + SKILL 补 web 命令(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
|
|
6
|
-
|
|
7
|
-
rp = ROOT / "README.md"
|
|
8
|
-
d = rp.read_text(encoding="utf-8")
|
|
9
|
-
n = d.count("75 个 CLI 命令")
|
|
10
|
-
rp.write_text(d.replace("75 个 CLI 命令", "76 个 CLI 命令"), encoding="utf-8")
|
|
11
|
-
print("README CLI 75→76 x", n)
|
|
12
|
-
|
|
13
|
-
sp = ROOT / "SKILL.md"
|
|
14
|
-
sd = sp.read_text(encoding="utf-8")
|
|
15
|
-
anchor = "python scripts/brain.py rss ingest --file feed.xml"
|
|
16
|
-
line = ('python scripts/brain.py web search "<关键词>" / web fetch <url> '
|
|
17
|
-
"# 联网调研(web_search 欠费时的备胎,Bing HTML)")
|
|
18
|
-
if "web search" not in sd and anchor in sd:
|
|
19
|
-
# 插到 rss 行之后
|
|
20
|
-
idx = sd.index(anchor)
|
|
21
|
-
end = sd.index("\n", idx)
|
|
22
|
-
sd = sd[:end + 1] + line + "\n" + sd[end + 1:]
|
|
23
|
-
sp.write_text(sd, encoding="utf-8")
|
|
24
|
-
print("SKILL.md 已补 web 行")
|
|
25
|
-
else:
|
|
26
|
-
print("SKILL.md 跳过(已有或找不到锚点)")
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:按 check_docs 的结果修正文档数字与命令名(§3 A)(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
|
|
6
|
-
|
|
7
|
-
FIXES = {
|
|
8
|
-
"SKILL.md": [
|
|
9
|
-
("# 17 项体检", "# 22 项体检"),
|
|
10
|
-
],
|
|
11
|
-
"README.md": [
|
|
12
|
-
("(13 项体检", "(22 项体检"),
|
|
13
|
-
("**15 个页签**", "**16 个页签**"),
|
|
14
|
-
("**设置页 29 项**", "**设置页 39 项**"),
|
|
15
|
-
("**75 个 CLI 命令**", "**72 个 CLI 命令**"),
|
|
16
|
-
("brain.py panel", "brain.py serve"),
|
|
17
|
-
("设置页 29 项 / 分 6 组", "设置页 39 项 / 分 7 组"),
|
|
18
|
-
("分 6 组", "分 7 组"),
|
|
19
|
-
],
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
for rel, pairs in FIXES.items():
|
|
23
|
-
p = ROOT / rel
|
|
24
|
-
d = p.read_text(encoding="utf-8")
|
|
25
|
-
for old, new in pairs:
|
|
26
|
-
n = d.count(old)
|
|
27
|
-
if n:
|
|
28
|
-
d = d.replace(old, new)
|
|
29
|
-
print(f"{rel}: {old!r} → {new!r} ×{n}")
|
|
30
|
-
p.write_text(d, encoding="utf-8")
|
|
31
|
-
|
|
32
|
-
# 文档审查 B 里可当场核实的两条
|
|
33
|
-
p = ROOT / "SKILL.md"
|
|
34
|
-
d = p.read_text(encoding="utf-8")
|
|
35
|
-
old = "status --json # 水位唯一数据源(0/1=60%/2=75%/3=90%)"
|
|
36
|
-
if "--exit-code" not in old and "status --json" in d:
|
|
37
|
-
print("SKILL.md status 行保持原样(退出码需 --exit-code,已在文档里标明)")
|
|
38
|
-
print("完成")
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:按实测结果修正 §3 B 的文档线索(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
|
|
6
|
-
|
|
7
|
-
FIXES = {
|
|
8
|
-
"docs/commands.md": [
|
|
9
|
-
# lessons 没有子命令,只有开关
|
|
10
|
-
("`lessons [list|add|check]`",
|
|
11
|
-
"`lessons [--bad] [--confidence N] [--evidence N]`"),
|
|
12
|
-
# topic 的真实子命令是 list/touch/feedback/drop/status
|
|
13
|
-
("`topic [list|add \"话题\"]`",
|
|
14
|
-
"`topic [list|touch|feedback|drop|status] [名字]`(另有 `--weight/--type/--good/--bad`)"),
|
|
15
|
-
# session-summary 也是开关式
|
|
16
|
-
("`session-summary [status\\|make\\|show\\|rollback]`",
|
|
17
|
-
"`session-summary [--input F] [--pct N] [--turns-since-last N]`"),
|
|
18
|
-
# startup 不是"只认 --query",而是不接位置参数
|
|
19
|
-
("未初始化 / 命令错误(startup 只认 `--query`)",
|
|
20
|
-
"未初始化 / 命令错误(startup 用 `--query`,不接位置参数;另有 `--budget/--minimal`)"),
|
|
21
|
-
("命令写错了:`startup` 只接受 `--query \"...\"`,不接位置参数。见返回码表。",
|
|
22
|
-
"命令写错了:`startup` 用 `--query \"...\"`(也支持 `--budget/--minimal`),"
|
|
23
|
-
"**不接位置参数**。见返回码表。"),
|
|
24
|
-
],
|
|
25
|
-
"docs/mechanics.md": [
|
|
26
|
-
# 备份修剪早已改成"移入 .pruned",不是删
|
|
27
|
-
("# 只留最近 10 份,旧的自动删",
|
|
28
|
-
"# 只留最近 10 份,更旧的移入 .pruned/(不删,可捞回)"),
|
|
29
|
-
# 非交互安装必须带 --yes,否则会卡在确认
|
|
30
|
-
("--from \"E:\\丁厚同\\文档\\程序\\灵枢-skill\" --force`",
|
|
31
|
-
"--from \"E:\\丁厚同\\文档\\程序\\灵枢-skill\" --force --yes`"),
|
|
32
|
-
],
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
for rel, pairs in FIXES.items():
|
|
36
|
-
p = ROOT / rel
|
|
37
|
-
d = p.read_text(encoding="utf-8")
|
|
38
|
-
for old, new in pairs:
|
|
39
|
-
n = d.count(old)
|
|
40
|
-
if n:
|
|
41
|
-
d = d.replace(old, new)
|
|
42
|
-
print(f"{rel}: 替换 {n} 处 → {new[:40]}…")
|
|
43
|
-
else:
|
|
44
|
-
print(f"{rel}: 未找到 {old[:46]!r}(跳过)")
|
|
45
|
-
p.write_text(d, encoding="utf-8")
|
|
46
|
-
print("完成")
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:修正 commands.md 里 lessons/topic 两条(表格转义版)(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\commands.md")
|
|
6
|
-
d = p.read_text(encoding="utf-8")
|
|
7
|
-
|
|
8
|
-
pairs = [
|
|
9
|
-
("`lessons [list\\|add\\|check]`",
|
|
10
|
-
"`lessons [--bad] [--confidence N] [--evidence N]`"),
|
|
11
|
-
("`topic [list\\|add \"话题\"]`",
|
|
12
|
-
"`topic [list\\|touch\\|feedback\\|drop\\|status] [名字]`"),
|
|
13
|
-
]
|
|
14
|
-
for old, new in pairs:
|
|
15
|
-
n = d.count(old)
|
|
16
|
-
if n:
|
|
17
|
-
d = d.replace(old, new)
|
|
18
|
-
print(f"替换 {n} 处: {old} → {new}")
|
|
19
|
-
else:
|
|
20
|
-
print(f"仍未找到: {old!r}")
|
|
21
|
-
p.write_text(d, encoding="utf-8")
|
|
22
|
-
print("完成")
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:I3 口径结案(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
|
|
6
|
-
lines = p.read_text(encoding="utf-8").splitlines()
|
|
7
|
-
NEW = ("| I3 | 账单口径 | 账单用 `chars_per_token=2`,装配用 `char_budget=budget*1.8` "
|
|
8
|
-
"| 同一个包被算成两种大小,\"超预算\"的量化不统一 "
|
|
9
|
-
"| ✅ **已结案(2026-11-29,结论:不是 bug,是两个故意不同的口径)**:"
|
|
10
|
-
"装配 `char_budget = budget×1.8` 是给中文分词留的余量、装配按它做硬上限;"
|
|
11
|
-
"账单 `chars_per_token=2` 是显示/对比的统一折算。**两者不该互相换算**"
|
|
12
|
-
"(历史上试过把 2 改成 1.8 去\"对齐\",4 个测试挂且证据不足,已回退)。"
|
|
13
|
-
"已在 `context-stats` 表头直接打出 char_budget 与这句话,并在 report 里暴露 char_budget 字段 |")
|
|
14
|
-
hit = 0
|
|
15
|
-
for i, ln in enumerate(lines):
|
|
16
|
-
if ln.startswith("| I3 |"):
|
|
17
|
-
lines[i] = NEW
|
|
18
|
-
hit += 1
|
|
19
|
-
if hit != 1:
|
|
20
|
-
print("命中异常:", hit)
|
|
21
|
-
raise SystemExit(1)
|
|
22
|
-
p.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
|
23
|
-
print("I3 已结案")
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:用宿主 schema 的权威定义改写 §10 的结论(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
|
|
6
|
-
d = p.read_text(encoding="utf-8")
|
|
7
|
-
|
|
8
|
-
old_head = "## §10 为什么\"灵枢压了、APP 水位还是那么多\"(2026-11-30 查清)"
|
|
9
|
-
if old_head not in d:
|
|
10
|
-
raise SystemExit("找不到 §10")
|
|
11
|
-
|
|
12
|
-
NEW = """## §10 为什么"灵枢压了、APP 水位还是那么多"(2026-11-30 查清 + 2026-11-30 更正)
|
|
13
|
-
|
|
14
|
-
> **更正**:本文件上一版说"宿主口径数的是它自己的历史、不会因为改了请求而下降"——**这是错的**。
|
|
15
|
-
> 2026-11-30 直接读 DSH 安装包(`app.asar`)里的 schema 定义,得到权威口径:
|
|
16
|
-
>
|
|
17
|
-
> - `contextPressure.pressureTokens`:**"Provider-reported prompt size of the most recent request:
|
|
18
|
-
> uncached input plus cache reads and writes. Response output is excluded…"**
|
|
19
|
-
> → 它就是**最近一次真正发出去的那份 prompt 的大小**,由 provider 上报。
|
|
20
|
-
> - `contextPressure.projectedTokens`:`pressureTokens` + "heuristic repricing of everything the
|
|
21
|
-
> surface gained or lost since that sample",并且明确写着 **"reacting the moment a compaction
|
|
22
|
-
> shadows a span — which `pressureTokens` alone cannot do, since compaction reports no usage of its own"**。
|
|
23
|
-
> → 说明宿主**自带 compaction**(会话级"遮住一段"),且**只有 projected 会立刻反映压缩**。
|
|
24
|
-
> - `contextPressure.contextWindow`:最新记录的 route 容量。
|
|
25
|
-
>
|
|
26
|
-
> 结论修正:**灵枢折叠会真的降低 pressureTokens**(因为请求变小了,provider 下次上报就更小),
|
|
27
|
-
> 但**滞后一次请求**(它是"最近一次请求"的采样);而 `projectedTokens` 才是那个"压缩后立刻变"的数。
|
|
28
|
-
> 之前看到的"79.9% 纹丝不动",主因就是**插件开关没开**(`contextFold` 为假 → 请求根本没被改)。
|
|
29
|
-
|
|
30
|
-
### 两个水位是两个口径(更正后)
|
|
31
|
-
|
|
32
|
-
| 口径 | 谁算的 | 算什么 | 会被折叠影响吗 |
|
|
33
|
-
|---|---|---|---|
|
|
34
|
-
| `pressureTokens`(APP 显示的那个,通常) | provider 上报 | **最近一次请求**的 prompt 大小 | ✅ 会,**滞后一次请求** |
|
|
35
|
-
| `projectedTokens` | 宿主本地估算 | 下一次请求的预期 + 局部重算 | ✅ 会,**压缩后立刻** |
|
|
36
|
-
| 灵枢 `context status` 的"折叠后" | 灵枢自己模拟 | 折叠后 messages 的字符/2 | 参考值,非权威 |
|
|
37
|
-
|
|
38
|
-
### 三条会让人误判"没生效"的原因
|
|
39
|
-
|
|
40
|
-
1. **插件开关默认关**:`contextFold` 为假时账本里的折叠**一条都不应用**,请求原样发出——
|
|
41
|
-
这是之前水位纹丝不动的**主因**(账本里 7 条生效中的折叠没用上)。已 `config set contextFold true`,
|
|
42
|
-
**需重载插件/重启 APP 才生效**。
|
|
43
|
-
2. **`pressureTokens` 滞后一次请求**:它标的是"最近一次请求"的采样,改完之后要等下一次 provider 上报。
|
|
44
|
-
3. **插件重载前改配置等于没改**——`plugin-loaded` 会诚实报警。
|
|
45
|
-
|
|
46
|
-
### 怎么验证真的生效
|
|
47
|
-
|
|
48
|
-
重载插件后:
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
brain.py context status # 第一行宿主口径,第二行折叠后口径
|
|
52
|
-
brain.py context preview # 折叠收益明细(省多少字符 / 多少轮)
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
判断标准(更正后):**宿主那个百分比应该在下一次请求之后下降**;若连续几轮都不降,
|
|
56
|
-
再怀疑宿主 meter 与请求解耦(此时才轮到"新开会话 / 用宿主自己的 compaction"这条路)。
|
|
57
|
-
|
|
58
|
-
### 顺带发现:宿主有官方 compaction
|
|
59
|
-
|
|
60
|
-
`projectedTokens` 的注释提到 "a compaction shadows a span",说明宿主支持会话级压缩(把一段遮住)。
|
|
61
|
-
如果灵枢的"整轮折叠"和宿主 compaction 能协同,最优解可能是**让宿主压缩、灵枢只负责摘要生成**——
|
|
62
|
-
这比我们自己在 `agent/pre-step` 里改 messages 更稳(不会和宿主的状态机抢)。记为 **#54**(待评估)。
|
|
63
|
-
"""
|
|
64
|
-
|
|
65
|
-
start = d.find(old_head)
|
|
66
|
-
end = d.find("## §11")
|
|
67
|
-
if end < 0:
|
|
68
|
-
end = len(d)
|
|
69
|
-
d = d[:start] + NEW + "\n" + d[end:]
|
|
70
|
-
|
|
71
|
-
# 新增 #54
|
|
72
|
-
if "| 54 |" not in d:
|
|
73
|
-
d = d.rstrip() + """
|
|
74
|
-
|
|
75
|
-
### §10 附:新增待办
|
|
76
|
-
|
|
77
|
-
| # | 项 | 说明 | 状态 |
|
|
78
|
-
|---|---|---|---|
|
|
79
|
-
| 54 | **与宿主 compaction 协同** | 宿主 `projectedTokens` 注释证实有会话级 compaction("compaction shadows a span")。
|
|
80
|
-
需要先搞清它的触发方式与对外接口;若能协同,灵枢只产摘要、压缩交给宿主,避免在 `agent/pre-step` 抢状态机 | ⬜ 待修 |
|
|
81
|
-
"""
|
|
82
|
-
p.write_text(d, encoding="utf-8")
|
|
83
|
-
print("§10 已按权威定义更正,并新增 #54")
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:校正 §11 开头结论句(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
|
|
6
|
-
d = p.read_text(encoding="utf-8")
|
|
7
|
-
old = "> 先说结论:**8 条里 4 条现在可落、2 条要前置信号、2 条建议不做**。"
|
|
8
|
-
new = ("> 先说结论:**8 条里 3 条可直接落(二/三/六)、4 条只能做近似或弱化版(一/四/七/八)、"
|
|
9
|
-
"1 条缺信号建议不做(五:宿主不暴露缓存命中率)**。")
|
|
10
|
-
if old in d:
|
|
11
|
-
p.write_text(d.replace(old, new), encoding="utf-8")
|
|
12
|
-
print("已校正")
|
|
13
|
-
else:
|
|
14
|
-
print("未找到,跳过")
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:给 §9 的 43–46 行补状态列(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
|
|
6
|
-
lines = p.read_text(encoding="utf-8").splitlines()
|
|
7
|
-
|
|
8
|
-
out = []
|
|
9
|
-
for ln in lines:
|
|
10
|
-
if ln.startswith("| # | 项 | 为什么值得做 | 代价/风险 |"):
|
|
11
|
-
out.append("| # | 项 | 为什么值得做 | 代价/风险 | 状态 |")
|
|
12
|
-
elif ln.startswith("|---|---|---|---|") and out and out[-1].endswith("状态 |"):
|
|
13
|
-
out.append("|---|---|---|---|---|")
|
|
14
|
-
elif ln.startswith(("| 43 |", "| 44 |", "| 45 |", "| 46 |")):
|
|
15
|
-
out.append(ln.rstrip() + " ⬜ 待修 |")
|
|
16
|
-
else:
|
|
17
|
-
out.append(ln)
|
|
18
|
-
p.write_text("\n".join(out) + "\n", encoding="utf-8")
|
|
19
|
-
print("已补状态列")
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:影子相似度改为 余弦 × 相对一致度(可删)。"""
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\shadow_memory.py")
|
|
6
|
-
d = p.read_text(encoding="utf-8")
|
|
7
|
-
|
|
8
|
-
old = '''def snapshot_persona() -> dict:'''
|
|
9
|
-
new = '''def _similarity(a: dict, b: dict) -> float:
|
|
10
|
-
"""人格底色相似度 = 余弦 × 相对一致度。
|
|
11
|
-
|
|
12
|
-
为什么不用纯余弦:traits 都是正数小向量,余弦对它不敏感——
|
|
13
|
-
实测「好奇 80/温和 60」vs「好奇 5/温和 95」余弦还有 0.64,根本算不上"断裂"。
|
|
14
|
-
再乘一个**逐维相对一致度**(1 - |Δ|/max)就分得开了:同一对只有 0.22。
|
|
15
|
-
"""
|
|
16
|
-
keys = set(a) & set(b)
|
|
17
|
-
if not keys:
|
|
18
|
-
return 1.0
|
|
19
|
-
cos = _cos(a, b)
|
|
20
|
-
agree = 0.0
|
|
21
|
-
for k in keys:
|
|
22
|
-
m = max(abs(a[k]), abs(b[k]), 1.0)
|
|
23
|
-
agree += 1.0 - abs(a[k] - b[k]) / m
|
|
24
|
-
agree /= len(keys)
|
|
25
|
-
return cos * agree
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def snapshot_persona() -> dict:'''
|
|
29
|
-
assert old in d
|
|
30
|
-
d = d.replace(old, new, 1)
|
|
31
|
-
|
|
32
|
-
old2 = """ sim = _cos(cur, prev)"""
|
|
33
|
-
new2 = """ sim = _similarity(cur, prev)"""
|
|
34
|
-
assert old2 in d
|
|
35
|
-
d = d.replace(old2, new2, 1)
|
|
36
|
-
p.write_text(d, encoding="utf-8")
|
|
37
|
-
print("相似度算法已替换")
|