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,64 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性:更新待办(统计行 + §7 复审新增缺点)(可删)。"""
|
|
3
|
-
import re
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
|
|
7
|
-
d = p.read_text(encoding="utf-8")
|
|
8
|
-
|
|
9
|
-
# 1) 头部日期
|
|
10
|
-
d = re.sub(r"> 最后更新:\d{4}-\d{2}-\d{2}", "> 最后更新:2026-11-29", d, count=1)
|
|
11
|
-
|
|
12
|
-
# 2) 统计行(插在头部引用块之后)
|
|
13
|
-
counts = {"done": 0, "todo": 0, "excl": 0}
|
|
14
|
-
for ln in d.splitlines():
|
|
15
|
-
if not re.match(r"^\|\s*[A-Z]?\d+\s*\|", ln):
|
|
16
|
-
continue
|
|
17
|
-
if "✅" in ln:
|
|
18
|
-
counts["done"] += 1
|
|
19
|
-
elif "⬜" in ln:
|
|
20
|
-
counts["todo"] += 1
|
|
21
|
-
elif "🔍" in ln:
|
|
22
|
-
counts["excl"] += 1
|
|
23
|
-
|
|
24
|
-
NEW_SEC = """
|
|
25
|
-
## §7 复审新增缺点(2026-11-29 二次体检)
|
|
26
|
-
|
|
27
|
-
> 上一轮把 P0/P1/P2/P3 清完、B1–B3/B5 也补上了。这轮换了个角度:**看"修完之后
|
|
28
|
-
> 有没有新窟窿"和"日常运行会不会越攒越脏"**。每条都带实测数字,不是推测。
|
|
29
|
-
|
|
30
|
-
| # | 位置 | 问题(实测) | 状态 |
|
|
31
|
-
|---|---|---|---|
|
|
32
|
-
| 35 | `~/.brain-memory/.safety/` | 回滚快照**只增不减**:`.safety` 共 27.7MB / 300 文件,其中 `.pruned` 19.7MB / 220 文件。用户规矩是「只移不删」,所以**不能自动清**,但至少该有容量告警 | ⬜ 待修(建议:doctor 加 `disk-usage`,`.safety`>50MB 或 `.pruned`>30MB 时 WARN,并在信息里给出手动清理命令) |
|
|
33
|
-
| 36 | `cli.py:cmd_backup` | 备份包**混入诊断残留**:实测包里带 2 条 `crash-*.log`。崩溃堆栈不属于记忆正文 | ✅ **已修**(备份遍历排除 `crash-*.log`;复测 386 条目 / crash 0 条) |
|
|
34
|
-
| 37 | `cli.py` doctor `log-anomalies` | 我把 `kind=inject` 整类排除后,**注入包超预算就再没有任何体检项覆盖了**(`context-stats` 只是命令,doctor 不跑它)——这是上一轮修噪音时留下的新窟窿 | ⬜ 待修(新增 `inject-budget`:跑一次装配账单,`tokens > budget` 即 WARN,并附"超了多少/丢了哪几段") |
|
|
35
|
-
| 38 | 仓库 `scripts/` | 积了 **18 个 `_tmp_*` 一次性脚本**(探针/补丁)。虽已 gitignore、不入交付,但会污染 grep 与 IDE 搜索 | ⬜ 待修(一次性任务收尾时顺手清;或给它们统一挪进 `scripts/_scratch/`) |
|
|
36
|
-
| 39 | `tests/` | `git status` 显示 **58 条改动/未跟踪**。"只提交已跟踪测试"全靠手工 `git reset`,容易漏(漏了就把本地测试推上去) | ⬜ 待修(写 `scripts/prepublish_tests.py`:按 `git ls-tree -r HEAD --name-only tests/` 求差集自动 reset) |
|
|
37
|
-
| 40 | `cli.py:_file_sig` | 指纹按**字节**算,源码在 Windows 是 CRLF、npm 包可能是 LF → 内容相同也判"副本不一致",`plugin-loaded` 会天天误报 | ✅ **已修**(先 `\r\n`→`\n` 归一再算长度与 sha1) |
|
|
38
|
-
| 41 | `scripts/app_context.py` | `context` 每次**全量解压**会话文件(旧会话可达 11MB),`sessions`/`analyze` 在大会话上偏慢 | ⬜ 待修(按 mtime+size 缓存解压结果;或只读尾部 N KB) |
|
|
39
|
-
| 42 | `cli.py:_PLUGIN_VERIFY_FILES` | B2 的核对清单是**硬编码 7 个文件**;以后新增脚本不会被覆盖到,等于留了个盲区 | ⬜ 待修(改为从 manifest 里自动取 `scripts/` 与 `cordis-plugin/` 的全部条目) |
|
|
40
|
-
|
|
41
|
-
**这一轮的判断依据**:不是"我觉得可能有问题",而是
|
|
42
|
-
`.safety` 实际占 27.7MB、备份包里实际有 2 条 crash 日志、仓库里实际有 18 个 `_tmp_*`、
|
|
43
|
-
`git status` 实际 58 条、`context` 对 11MB 会话实测偏慢、`_files_sig` 的 CRLF 风险来自
|
|
44
|
-
源码 CRLF 与 npm LF 的现实差异。
|
|
45
|
-
"""
|
|
46
|
-
|
|
47
|
-
if "## §7 复审新增缺点" in d:
|
|
48
|
-
print("§7 已存在,跳过")
|
|
49
|
-
else:
|
|
50
|
-
d = d.rstrip() + "\n" + NEW_SEC
|
|
51
|
-
print("已追加 §7")
|
|
52
|
-
|
|
53
|
-
stat = (f"> **状态统计(编号任务行)**:✅ {counts['done']} 已修 / "
|
|
54
|
-
f"⬜ {counts['todo']} 待修 / 🔍 {counts['excl']} 已排除"
|
|
55
|
-
f"(统计于 §7 追加前)")
|
|
56
|
-
if "**状态统计(编号任务行)**" in d:
|
|
57
|
-
d = re.sub(r"> \*\*状态统计(编号任务行)\*\*[^\n]*", stat, d, count=1)
|
|
58
|
-
else:
|
|
59
|
-
# 插到第一个 "## 怎么用" 之前
|
|
60
|
-
i = d.find("## 怎么用")
|
|
61
|
-
d = d[:i] + stat + "\n\n" + d[i:]
|
|
62
|
-
|
|
63
|
-
p.write_text(d, encoding="utf-8")
|
|
64
|
-
print(stat)
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性探针:消息序列的真实结构(可删)。
|
|
3
|
-
|
|
4
|
-
关心三件事:
|
|
5
|
-
1. assistant 消息在调用工具时,content 里到底有没有 tool-call 段(决定折叠边界);
|
|
6
|
-
2. 消息顺序:assistant -> tool -> assistant 是否严格配对;
|
|
7
|
-
3. turn 边界能否用 message 上的 turn 字段判定。
|
|
8
|
-
"""
|
|
9
|
-
import json
|
|
10
|
-
import sys
|
|
11
|
-
|
|
12
|
-
sys.path.insert(0, r"E:\丁厚同\文档\程序\灵枢-skill\scripts")
|
|
13
|
-
import app_context
|
|
14
|
-
|
|
15
|
-
path = app_context.find_session()
|
|
16
|
-
print("session file:", path)
|
|
17
|
-
events = app_context.read_events(path)
|
|
18
|
-
print("events:", len(events))
|
|
19
|
-
|
|
20
|
-
# 原始事件里 message 的 content 段类型分布
|
|
21
|
-
from collections import Counter
|
|
22
|
-
part_types = Counter()
|
|
23
|
-
for ev in events:
|
|
24
|
-
m = (ev.get("data") or {}).get("message")
|
|
25
|
-
if not isinstance(m, dict):
|
|
26
|
-
continue
|
|
27
|
-
for p in (m.get("content") or []):
|
|
28
|
-
if isinstance(p, dict):
|
|
29
|
-
part_types[f"{m.get('role')}/{p.get('type')}"] += 1
|
|
30
|
-
print("content 段类型:", dict(part_types))
|
|
31
|
-
|
|
32
|
-
# 打印前 14 条 message 事件的骨架
|
|
33
|
-
n = 0
|
|
34
|
-
for ev in events:
|
|
35
|
-
m = (ev.get("data") or {}).get("message")
|
|
36
|
-
if not isinstance(m, dict):
|
|
37
|
-
continue
|
|
38
|
-
n += 1
|
|
39
|
-
if n > 14:
|
|
40
|
-
break
|
|
41
|
-
d = ev.get("data") or {}
|
|
42
|
-
parts = [p.get("type") for p in (m.get("content") or []) if isinstance(p, dict)]
|
|
43
|
-
print(f"seq{ev.get('seq'):<4} {ev.get('type'):<18} role={m.get('role'):<9} "
|
|
44
|
-
f"turn={d.get('turn')} step={d.get('step')} "
|
|
45
|
-
f"toolCallId={str(m.get('toolCallId'))[:18]:<20} parts={parts}")
|
|
46
|
-
|
|
47
|
-
print("\n=== turn/end 事件带的 turn 字段 ===")
|
|
48
|
-
for ev in events:
|
|
49
|
-
if ev.get("type") in ("turn/start", "turn/end"):
|
|
50
|
-
print(ev.get("seq"), ev.get("type"), (ev.get("data") or {}).get("turn"),
|
|
51
|
-
(ev.get("data") or {}).get("reason"))
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""一次性探针:从实时会话里取 assistant 回复,看风格指标的真实量级(可删)。"""
|
|
3
|
-
import re
|
|
4
|
-
import statistics
|
|
5
|
-
import sys
|
|
6
|
-
|
|
7
|
-
sys.path.insert(0, r"E:\丁厚同\文档\程序\灵枢-skill\scripts")
|
|
8
|
-
import app_context
|
|
9
|
-
|
|
10
|
-
p = app_context.find_session()
|
|
11
|
-
ev = app_context.read_events(p)
|
|
12
|
-
texts = []
|
|
13
|
-
for e in ev:
|
|
14
|
-
m = app_context._msg_of(e)
|
|
15
|
-
if not isinstance(m, dict) or m.get("role") != "assistant":
|
|
16
|
-
continue
|
|
17
|
-
t = app_context._full_text(m).strip()
|
|
18
|
-
if len(t) >= 20:
|
|
19
|
-
texts.append(t)
|
|
20
|
-
|
|
21
|
-
print("assistant 回复条数(>=20字) =", len(texts))
|
|
22
|
-
if not texts:
|
|
23
|
-
raise SystemExit(0)
|
|
24
|
-
CH = sum(len(t) for t in texts)
|
|
25
|
-
sents = []
|
|
26
|
-
for t in texts:
|
|
27
|
-
for s in re.split(r"[。!?!?\n]+", t):
|
|
28
|
-
s = s.strip()
|
|
29
|
-
if s:
|
|
30
|
-
sents.append(s)
|
|
31
|
-
print("总字符 =", CH, "| 平均每条 =", round(CH / len(texts), 1))
|
|
32
|
-
print("句子数 =", len(sents), "| 平均句长 =", round(statistics.mean(len(s) for s in sents), 1))
|
|
33
|
-
for name, pat in (("逗号", ",,"), ("句号", "。"), ("问号", "??"),
|
|
34
|
-
("感叹", "!!"), ("分号", ";;"), ("破折", "—")):
|
|
35
|
-
c = sum(t.count(x) for t in texts for x in pat)
|
|
36
|
-
print(f" {name} 密度 = {c / CH * 1000:.1f} 个/千字")
|
|
37
|
-
print("列表行占比 = %.2f" % (sum(1 for t in texts for ln in t.splitlines()
|
|
38
|
-
if ln.strip().startswith(("-", "*", "·")))
|
|
39
|
-
/ max(1, sum(len(t.splitlines()) for t in texts))))
|
|
40
|
-
print("\n样例(前 120 字):\n", texts[-1][:120])
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# dsh-thinking-proxy 修复记录写入脚本
|
|
2
|
-
# 用 Python 直接调 growth/memory API:argparse 传多行中文太容易踩编码坑。
|
|
3
|
-
import sys
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
|
|
6
|
-
ROOT = Path(r"E:\丁厚同\文档\程序\灵枢-skill")
|
|
7
|
-
sys.path.insert(0, str(ROOT / "scripts"))
|
|
8
|
-
|
|
9
|
-
import brain # noqa: E402,F401 入口合并
|
|
10
|
-
import growth # noqa: E402
|
|
11
|
-
import memory as _mem # noqa: E402
|
|
12
|
-
|
|
13
|
-
TITLE = "dsh-thinking-proxy:把中转站塞进 content 的思考标签抽回 reasoning_content"
|
|
14
|
-
|
|
15
|
-
BODY = """\
|
|
16
|
-
## 它解决的是什么
|
|
17
|
-
|
|
18
|
-
DSH 的响应解析只认 `reasoning_content` / `reasoning` / `reasoning_text` 三个字段,
|
|
19
|
-
**从不解析 `content` 里的思考标签**。而 laneai 这类中转站会把模型的思考包在
|
|
20
|
-
`<thinking>…</thinking>`、`<analysis>…</analysis>`、`<summary>…</summary>` 里
|
|
21
|
-
直接塞进 `content`,结果整段思考全文摊在对话栏里,不会被折叠成思考块。
|
|
22
|
-
|
|
23
|
-
插件在 **HTTP 层**做改写:起一个本地代理(默认 `127.0.0.1:18791`),转发到上游
|
|
24
|
-
`https://www.laneai.dev`,把 `content` 里的标签拆到 `reasoning_content`。
|
|
25
|
-
选这一层而不是改 `llm/stream` 事件,是因为不碰 DSH 内部的 StreamChunk / partial
|
|
26
|
-
共享累加器,稳得多、也不依赖 DSH 版本。
|
|
27
|
-
|
|
28
|
-
## 位置与链路
|
|
29
|
-
|
|
30
|
-
- 源码:`E:\\丁厚同\\文档\\deepseek-harness\\default-workspace\\dsh-thinking-proxy\\`
|
|
31
|
-
(`index.js` 插件入口 / `lib.js` 改写与代理 / `cordis.patch.yml` / `package.json`)
|
|
32
|
-
- 安装:`C:\\Users\\Administrator\\.dsh\\profiles\\desktop\\node_modules\\dsh-thinking-proxy`
|
|
33
|
-
—— **符号链接**,指向上面的工作区目录。改源码立即生效,不用重装、不用复制。
|
|
34
|
-
- 接线:`profiles/desktop/cordis.patch.yml` 里 `laneai` 与 `laneai1` 两个 provider 的
|
|
35
|
-
`baseURL` 都是 `http://127.0.0.1:18791/v1`。**这是关键**——插件本身只是个代理,
|
|
36
|
-
provider 不改 baseURL 就完全不起作用。
|
|
37
|
-
|
|
38
|
-
## 改写规则(lib.js)
|
|
39
|
-
|
|
40
|
-
| 输入 | 处理 |
|
|
41
|
-
|---|---|
|
|
42
|
-
| `<thinking>` | 正文进 `reasoning_content` |
|
|
43
|
-
| `<analysis>` | 同上(压缩器常用,也是此前标签外露的来源之一) |
|
|
44
|
-
| `<summary>` | **正文留在 content**,只剥掉标签本身 |
|
|
45
|
-
| 上游已给 `reasoning_content` | 不覆盖,只把 content 里的标签剥掉 |
|
|
46
|
-
| 无受支持标签 | 原样返回,一个字节都不动 |
|
|
47
|
-
|
|
48
|
-
流式(SSE)与非流式(整包 JSON)两条路都覆盖。流式用跨 chunk 状态机,专门处理
|
|
49
|
-
标签被拆开的情况(`<thi` + `nking>`)——这是最容易被漏掉的一类。
|
|
50
|
-
|
|
51
|
-
## 之前的问题与这次的修复
|
|
52
|
-
|
|
53
|
-
19:10 只把用户那句原话封存成了 episode("DSH问题,我弄了 dsh-thinking-proxy"),
|
|
54
|
-
没有可复用的结论。`lib.js` 时间戳是 **19:32**,晚于那条记忆——修复就在之后。
|
|
55
|
-
本轮补做验证,10 条断言全过:
|
|
56
|
-
|
|
57
|
-
1. `<thinking>` 完整文本 → reasoning / 正文分离 ✓
|
|
58
|
-
2. `<analysis>` → reasoning ✓
|
|
59
|
-
3. `<summary>` 正文保留、只剥标签 ✓
|
|
60
|
-
4. 无标签文本原样不动 ✓
|
|
61
|
-
5. 流式跨 chunk 拆标签(`<thi`+`nking>`)✓
|
|
62
|
-
6. 流式里字面 `<`(如 `a < b`)不被吞 ✓
|
|
63
|
-
7. SSE 行改写:content → reasoning_content ✓
|
|
64
|
-
8. 上游已有 reasoning_content 时不覆盖 ✓
|
|
65
|
-
9. 非流式整包改写 message ✓
|
|
66
|
-
10. 非流式无标签时字节完全不变 ✓
|
|
67
|
-
|
|
68
|
-
另确认:代理在 `127.0.0.1:18791` 监听中;两个 provider 的 `baseURL` 都指向它。
|
|
69
|
-
|
|
70
|
-
## 排查顺序(以后再遇到"思考全文露出来")
|
|
71
|
-
|
|
72
|
-
1. 先看**标签是什么**:`<thinking>`/`<analysis>` 走 reasoning,`<summary>` 只剥标签。
|
|
73
|
-
若露的是 `<summary>…</summary>` 的正文,那是设计如此,不是 bug。
|
|
74
|
-
2. 确认 provider 的 `baseURL` 是 `http://127.0.0.1:18791/v1`——改回上游域名就等于关了插件。
|
|
75
|
-
3. 看代理进程:`Get-NetTCPConnection -LocalPort 18791 -State Listen`。
|
|
76
|
-
4. 看插件是否启用:`cordis.patch.yml` 里 `thinking-proxy` 的 `enabled`。
|
|
77
|
-
5. 密钥不在 `.env` 里:两个 provider 用 `apiKeyEnv`(`LANEAI_API_KEY` / `LANEAI1_API_KEY`),
|
|
78
|
-
由 DSH 进程环境提供;从外部 curl 测转发拿不到 key 是正常的。
|
|
79
|
-
|
|
80
|
-
## 注意
|
|
81
|
-
|
|
82
|
-
- 这是**绕开 DSH 解析限制**的补丁,不是 DSH 本身修好了。上游若哪天开始正确返回
|
|
83
|
-
`reasoning_content`,插件也不会重复改写(有 `upstreamHasRc` 判断),可以安全留着。
|
|
84
|
-
- 代理只监听 `127.0.0.1`,不对外暴露。
|
|
85
|
-
- `lib.js` 是纯模块、不依赖 `@deepseek-ai/*`,可以直接 `node` 单测——这次验证就是这么做的。
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
POINTS = [
|
|
89
|
-
"插件在 HTTP 层把 content 里的 thinking/analysis 标签拆到 reasoning_content",
|
|
90
|
-
"provider 的 baseURL 必须指向 http://127.0.0.1:18791/v1,否则插件等于没开",
|
|
91
|
-
"node_modules 那份是符号链接,改工作区源码立即生效",
|
|
92
|
-
"summary 只剥标签、正文留在 content,是设计不是 bug",
|
|
93
|
-
"流式状态机处理标签被拆到不同 chunk(<thi + nking>)",
|
|
94
|
-
"上游已给 reasoning_content 时不覆盖",
|
|
95
|
-
]
|
|
96
|
-
|
|
97
|
-
TAGS = ["DSH", "插件", "thinking-proxy", "reasoning_content", "laneai", "已修复"]
|
|
98
|
-
|
|
99
|
-
MEM_TEXT = (
|
|
100
|
-
"dsh-thinking-proxy 已修好并验证(2026-11-27):本地 HTTP 代理插件,把 laneai 中转站"
|
|
101
|
-
"塞进 content 的 thinking/analysis/summary 思考标签抽到标准 reasoning_content,"
|
|
102
|
-
"因为 DSH 响应解析只认 reasoning_content、从不解析 content 里的标签。源码在 "
|
|
103
|
-
"E:\\丁厚同\\文档\\deepseek-harness\\default-workspace\\dsh-thinking-proxy\\,"
|
|
104
|
-
"node_modules 那份是符号链接所以改源码立即生效;关键是 laneai/laneai1 两个 provider 的 "
|
|
105
|
-
"baseURL 必须是 http://127.0.0.1:18791/v1,改回上游域名插件就等于关了。"
|
|
106
|
-
"summary 只剥标签、正文留在 content 是设计不是 bug。10 条改写断言全过,含流式跨 chunk "
|
|
107
|
-
"拆标签。以后再看到思考全文露出来,查知识库「dsh-thinking-proxy」里的排查顺序。"
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def main() -> int:
|
|
112
|
-
# 先查重:标题相同就别写第二份
|
|
113
|
-
try:
|
|
114
|
-
dup = [k for k in growth.list_knowledge() if k.get("title") == TITLE]
|
|
115
|
-
except Exception:
|
|
116
|
-
dup = []
|
|
117
|
-
if dup:
|
|
118
|
-
print(f"[skip] 已有同标题知识 id={dup[0].get('id')},不重复写入")
|
|
119
|
-
return 0
|
|
120
|
-
|
|
121
|
-
rec, how = growth.add_knowledge(
|
|
122
|
-
TITLE, BODY, "DSH插件",
|
|
123
|
-
points=POINTS, tags=TAGS,
|
|
124
|
-
entities=["dsh-thinking-proxy", "laneai"],
|
|
125
|
-
source="user", # 人工写入 → 直接 confirmed,不进待审
|
|
126
|
-
)
|
|
127
|
-
print(f"[knowledge] {how} id={rec.get('id')} status={rec.get('status')}")
|
|
128
|
-
|
|
129
|
-
mrec, mhow = _mem.remember(
|
|
130
|
-
MEM_TEXT, "insight", 8,
|
|
131
|
-
["DSH", "插件", "thinking-proxy", "已修复"],
|
|
132
|
-
["dsh-thinking-proxy", "laneai"], "user",
|
|
133
|
-
)
|
|
134
|
-
print(f"[memory] {mhow} id={mrec.get('id')} imp={mrec.get('importance')}")
|
|
135
|
-
return 0
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if __name__ == "__main__":
|
|
139
|
-
sys.exit(main())
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[2026-11-29 18:21:29] 从仓库根/scripts 迁入 25 个 _tmp_* 一次性脚本(§7 #38:清理探针堆积;只移不删,确认无用后可整目录删除)
|