lingshu-skill 5.61.0 → 5.63.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.
Files changed (209) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -1
  3. package/SKILL-lite.md +1 -1
  4. package/SKILL-tiny.md +1 -1
  5. package/SKILL.md +1 -1
  6. package/assets/panel.html +2 -2
  7. package/manifest.json +461 -0
  8. package/package.json +8 -2
  9. package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +11 -11
  10. package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +30 -0
  11. package/scripts/astrbot_plugin_lingshu/engine/README.md +1 -1
  12. package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
  13. package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
  14. package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
  15. package/scripts/astrbot_plugin_lingshu/engine/assets/panel.html +2 -2
  16. package/scripts/astrbot_plugin_lingshu/engine/scripts/growth.py +3 -4
  17. package/scripts/astrbot_plugin_lingshu/engine/scripts/make_dsh_tgz.py +20 -3
  18. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_build.py +13 -0
  19. package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +30 -10
  20. package/scripts/astrbot_plugin_lingshu/engine/scripts/panels.py +1 -0
  21. package/scripts/growth.py +3 -4
  22. package/scripts/make_dsh_tgz.py +20 -3
  23. package/scripts/make_manifest.py +15 -10
  24. package/scripts/make_plugin_zip.py +7 -3
  25. package/scripts/panel_build.py +13 -0
  26. package/scripts/panel_server.py +30 -10
  27. package/scripts/panels.py +1 -0
  28. package/scripts/_ci_env_probe.py +0 -81
  29. package/scripts/_panel_smoke_v299.py +0 -27
  30. package/scripts/_scratch/_tmp_backup_race.py +0 -70
  31. package/scripts/_scratch/_tmp_cleanup_move.py +0 -34
  32. package/scripts/_scratch/_tmp_count_kinds.py +0 -25
  33. package/scripts/_scratch/_tmp_diag_paths.py +0 -48
  34. package/scripts/_scratch/_tmp_facts.py +0 -63
  35. package/scripts/_scratch/_tmp_find_copies.py +0 -31
  36. package/scripts/_scratch/_tmp_find_pin.py +0 -29
  37. package/scripts/_scratch/_tmp_fix_pin.py +0 -36
  38. package/scripts/_scratch/_tmp_fold_fixture.py +0 -55
  39. package/scripts/_scratch/_tmp_fold_test.mjs +0 -81
  40. package/scripts/_scratch/_tmp_inject_secs.py +0 -30
  41. package/scripts/_scratch/_tmp_kb_balance.py +0 -159
  42. package/scripts/_scratch/_tmp_lines.py +0 -15
  43. package/scripts/_scratch/_tmp_market_probe.py +0 -13
  44. package/scripts/_scratch/_tmp_move_partial.py +0 -16
  45. package/scripts/_scratch/_tmp_patch_b3.py +0 -41
  46. package/scripts/_scratch/_tmp_patch_b5.py +0 -62
  47. package/scripts/_scratch/_tmp_patch_crash_excl.py +0 -24
  48. package/scripts/_scratch/_tmp_patch_handoff.py +0 -21
  49. package/scripts/_scratch/_tmp_patch_ps1.py +0 -25
  50. package/scripts/_scratch/_tmp_patch_stat.py +0 -27
  51. package/scripts/_scratch/_tmp_patch_todo.py +0 -25
  52. package/scripts/_scratch/_tmp_patch_todo2.py +0 -64
  53. package/scripts/_scratch/_tmp_probe_session.py +0 -51
  54. package/scripts/_scratch/_tmp_style_probe.py +0 -40
  55. package/scripts/_scratch/_tmp_write_note.py +0 -139
  56. package/scripts/_scratch/_/346/235/245/346/272/220/350/256/260/345/275/225.txt +0 -1
  57. package/scripts/_scratch/asar_compaction/dsh-compaction-basic__lib__index.js +0 -1044
  58. package/scripts/_scratch/asar_compaction/dsh-compaction-tool-result-pruner__lib__index.js +0 -194
  59. package/scripts/_scratch/asar_compaction/dsh-compaction__lib__index.js +0 -175
  60. package/scripts/_scratch/asar_compaction/dsh-compaction__lib__types__tool-pairing.js +0 -97
  61. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__image-offload.js +0 -47
  62. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__index.js +0 -40
  63. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction-image-offload__lib__types__project-message.js +0 -37
  64. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__brand.js +0 -9
  65. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__checkpoint.js +0 -36
  66. package/scripts/_scratch/asar_compaction/dsh__node_modules__@deepseek-ai__dsh-compaction__lib__types__types.js +0 -10
  67. package/scripts/_scratch/commit_msg_occ.txt +0 -16
  68. package/scripts/_scratch/commit_msg_struct.txt +0 -16
  69. package/scripts/_scratch/v5.34_changelog.txt +0 -36
  70. package/scripts/_smoke_v299.py +0 -31
  71. package/scripts/_sync_trae_cn.py +0 -102
  72. package/scripts/_tmp_add_s10.py +0 -54
  73. package/scripts/_tmp_add_s11.py +0 -61
  74. package/scripts/_tmp_add_s12.py +0 -66
  75. package/scripts/_tmp_add_s13.py +0 -69
  76. package/scripts/_tmp_add_s14.py +0 -80
  77. package/scripts/_tmp_add_s9.py +0 -68
  78. package/scripts/_tmp_cache_load.py +0 -82
  79. package/scripts/_tmp_clean_market.py +0 -40
  80. package/scripts/_tmp_clean_pruned.py +0 -81
  81. package/scripts/_tmp_cleanup_docs.py +0 -39
  82. package/scripts/_tmp_cmp_ranker.py +0 -17
  83. package/scripts/_tmp_dolater_note.py +0 -35
  84. package/scripts/_tmp_dust_why.py +0 -27
  85. package/scripts/_tmp_explicit_import.py +0 -40
  86. package/scripts/_tmp_extract_compaction.py +0 -35
  87. package/scripts/_tmp_extract_compaction2.py +0 -63
  88. package/scripts/_tmp_extract_compaction3.py +0 -51
  89. package/scripts/_tmp_extract_compaction4.py +0 -54
  90. package/scripts/_tmp_finalize_s14.py +0 -39
  91. package/scripts/_tmp_find_compaction.py +0 -43
  92. package/scripts/_tmp_fix_b4.py +0 -22
  93. package/scripts/_tmp_fix_cli76.py +0 -26
  94. package/scripts/_tmp_fix_docs.py +0 -38
  95. package/scripts/_tmp_fix_docs_b.py +0 -46
  96. package/scripts/_tmp_fix_docs_b2.py +0 -22
  97. package/scripts/_tmp_fix_i3.py +0 -23
  98. package/scripts/_tmp_fix_s10.py +0 -83
  99. package/scripts/_tmp_fix_s11.py +0 -14
  100. package/scripts/_tmp_fix_s9_status.py +0 -19
  101. package/scripts/_tmp_fix_shadow_sim.py +0 -37
  102. package/scripts/_tmp_fix_traits_value.py +0 -41
  103. package/scripts/_tmp_import_idem.py +0 -106
  104. package/scripts/_tmp_log_ack.py +0 -45
  105. package/scripts/_tmp_mark_batch.py +0 -28
  106. package/scripts/_tmp_mark_batch2.py +0 -32
  107. package/scripts/_tmp_mark_dolater.py +0 -26
  108. package/scripts/_tmp_mark_dolater2.py +0 -31
  109. package/scripts/_tmp_move_self.py +0 -16
  110. package/scripts/_tmp_occ_cli.py +0 -22
  111. package/scripts/_tmp_occ_link.py +0 -108
  112. package/scripts/_tmp_optimize_recall.py +0 -54
  113. package/scripts/_tmp_panel_audit.py +0 -26
  114. package/scripts/_tmp_patch_batch3.py +0 -65
  115. package/scripts/_tmp_patch_rrf.py +0 -46
  116. package/scripts/_tmp_patch_s2s3.py +0 -80
  117. package/scripts/_tmp_patch_s4.py +0 -39
  118. package/scripts/_tmp_patch_s7.py +0 -43
  119. package/scripts/_tmp_patch_s8.py +0 -91
  120. package/scripts/_tmp_patch_skill.py +0 -17
  121. package/scripts/_tmp_release_guard.py +0 -57
  122. package/scripts/_tmp_rerank_breaker.py +0 -62
  123. package/scripts/_tmp_s16.py +0 -41
  124. package/scripts/_tmp_scan_asar.py +0 -41
  125. package/scripts/_tmp_scan_asar2.py +0 -37
  126. package/scripts/_tmp_speed_survey.py +0 -49
  127. package/scripts/_tmp_struct_docs.py +0 -49
  128. package/scripts/_tmp_sum_fallback.py +0 -42
  129. package/scripts/_tmp_sweep.py +0 -81
  130. package/scripts/_tmp_sync_check.py +0 -69
  131. package/scripts/_tmp_sync_tail.py +0 -39
  132. package/scripts/_tmp_todo_clean.py +0 -67
  133. package/scripts/_tmp_verify_copy.py +0 -17
  134. package/scripts/_tmp_wire_extras.py +0 -93
  135. package/scripts/_tmp_wire_hsum.py +0 -34
  136. package/scripts/_tmp_wire_occ_b5.py +0 -40
  137. package/scripts/_tmp_wire_ranker.py +0 -13
  138. package/scripts/_tmp_wire_shadow_timeline.py +0 -45
  139. package/scripts/astrbot_plugin_lingshu/engine/scripts/_ci_env_probe.py +0 -81
  140. package/scripts/astrbot_plugin_lingshu/engine/scripts/_panel_smoke_v299.py +0 -27
  141. package/scripts/astrbot_plugin_lingshu/engine/scripts/_smoke_v299.py +0 -31
  142. package/scripts/astrbot_plugin_lingshu/engine/scripts/_sync_trae_cn.py +0 -102
  143. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s10.py +0 -54
  144. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s11.py +0 -61
  145. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s12.py +0 -66
  146. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s13.py +0 -69
  147. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s14.py +0 -80
  148. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_add_s9.py +0 -68
  149. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cache_load.py +0 -82
  150. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_market.py +0 -40
  151. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_clean_pruned.py +0 -81
  152. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cleanup_docs.py +0 -39
  153. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_cmp_ranker.py +0 -17
  154. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dolater_note.py +0 -35
  155. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_dust_why.py +0 -27
  156. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_explicit_import.py +0 -40
  157. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction.py +0 -35
  158. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction2.py +0 -63
  159. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction3.py +0 -51
  160. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_extract_compaction4.py +0 -54
  161. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_finalize_s14.py +0 -39
  162. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_find_compaction.py +0 -43
  163. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_b4.py +0 -22
  164. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_cli76.py +0 -26
  165. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs.py +0 -38
  166. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b.py +0 -46
  167. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_docs_b2.py +0 -22
  168. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_i3.py +0 -23
  169. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s10.py +0 -83
  170. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s11.py +0 -14
  171. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_s9_status.py +0 -19
  172. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_shadow_sim.py +0 -37
  173. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_fix_traits_value.py +0 -41
  174. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_import_idem.py +0 -106
  175. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_log_ack.py +0 -45
  176. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch.py +0 -28
  177. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_batch2.py +0 -32
  178. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater.py +0 -26
  179. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_mark_dolater2.py +0 -31
  180. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_move_self.py +0 -16
  181. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_cli.py +0 -22
  182. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_occ_link.py +0 -108
  183. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_optimize_recall.py +0 -54
  184. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_panel_audit.py +0 -26
  185. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_batch3.py +0 -65
  186. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_rrf.py +0 -46
  187. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s2s3.py +0 -80
  188. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s4.py +0 -39
  189. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s7.py +0 -43
  190. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_s8.py +0 -91
  191. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_patch_skill.py +0 -17
  192. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_release_guard.py +0 -57
  193. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_rerank_breaker.py +0 -62
  194. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_s16.py +0 -41
  195. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar.py +0 -41
  196. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_scan_asar2.py +0 -37
  197. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_speed_survey.py +0 -49
  198. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_struct_docs.py +0 -49
  199. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sum_fallback.py +0 -42
  200. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sweep.py +0 -81
  201. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_check.py +0 -69
  202. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_sync_tail.py +0 -39
  203. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_todo_clean.py +0 -67
  204. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_verify_copy.py +0 -17
  205. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_extras.py +0 -93
  206. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_hsum.py +0 -34
  207. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_occ_b5.py +0 -40
  208. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_ranker.py +0 -13
  209. package/scripts/astrbot_plugin_lingshu/engine/scripts/_tmp_wire_shadow_timeline.py +0 -45
@@ -1,15 +0,0 @@
1
- import sys, json
2
- targets = [
3
- (r'E:\丁厚同\文档\程序\灵枢-skill\scripts\growth_parts.py', [249,252,254,255,256,258,259,260,261,262,263]),
4
- (r'E:\丁厚同\文档\程序\灵枢-skill\scripts\context_ab.py', [63,64,65,66,67,68,69,70,126,127,128,129,132,133,134,135,136,137,218,219,220,222,224]),
5
- (r'E:\丁厚同\文档\程序\灵枢-skill\scripts\make_manifest.py', [107,108,109,110,111,112,113,126,127,128,129,130,131,147,148,155,156,163]),
6
- ]
7
- out = []
8
- for f, ns in targets:
9
- data = open(f, 'rb').read()
10
- lines = data.split(b'\n')
11
- out.append(f + " | CRLF=%d CR=%d LF=%d nlines=%d" % (data.count(b'\r\n'), data.count(b'\r'), data.count(b'\n'), len(lines)))
12
- for n in ns:
13
- out.append("%s:%d|%s" % (f.split('\\')[-1], n, lines[n-1].decode('utf-8', 'replace')))
14
- open(r'E:\丁厚同\文档\程序\灵枢-skill\_tmp_lines.txt', 'w', encoding='utf-8').write("\n".join(out))
15
- print("ok")
@@ -1,13 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:打印 journal 里 lingshu 行的原文(可删)。"""
3
- import glob
4
- import os
5
-
6
- home = os.path.expanduser("~")
7
- pat = os.path.join(home, ".*", "profiles", "desktop", ".*market", "*compatibility*.journal")
8
- for f in glob.glob(pat):
9
- hits = [l for l in open(f, encoding="utf-8", errors="replace").read().splitlines()
10
- if "lingshu" in l]
11
- print(f"\n=== {os.path.basename(f)} ===")
12
- for l in hits[:3]:
13
- print(repr(l[:500]))
@@ -1,16 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:把 2026-11-29 08:23 失败留下的半截毒包移入 .pruned(不删除,可捞回)。"""
3
- import shutil
4
- import sys
5
- from pathlib import Path
6
-
7
- out = Path(r"D:\brain-memory-backups")
8
- target = out / "brain-memory_20261129_082323.zip"
9
- pruned = out / ".pruned"
10
- if target.is_file():
11
- pruned.mkdir(parents=True, exist_ok=True)
12
- shutil.move(str(target), str(pruned / f"{target.name}.partial"))
13
- print("已移入 .pruned:", pruned / f"{target.name}.partial")
14
- else:
15
- print("已不存在,无需处理")
16
- print("备份目录现有 zip:", [p.name for p in out.glob("*.zip")])
@@ -1,41 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:把 B3 标为已修,并更新交接笔记进度(可删)。"""
3
- from pathlib import Path
4
-
5
- todo = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
6
- lines = todo.read_text(encoding="utf-8").splitlines()
7
- NEW = ("| B3 | **每日回复风格体检**:句长 / 标点 / 语气与人设基线比对 "
8
- "| `persona check` 只验结构(溯源/NaN/越界),`persona drift` 只算特征幅度,"
9
- "**没有文本风格一致性度量** "
10
- "| ✅ **已修**(2026-11-29):新增 `brain.py style`(`--save` 建基线)+ doctor `style` 项——"
11
- "从实时会话取灵枢自己的回复(assistant/source=model、≥20 字),算"
12
- "平均句长、每条字数、逗号/句号/问号/感叹/分号/破折号密度(千字归一)、列表行占比;"
13
- "与 `config.style_baseline` 比对,超容差才 WARN(样本 <20 条不下结论)。"
14
- "实测基线:169 条回复 / 平均句长 50.0 / 逗号 13.6‰ / 感叹 0.1‰ / 列表行 0.285。"
15
- "`tests/test_style_check.py` 8 条回归 |")
16
-
17
- hit = 0
18
- for i, ln in enumerate(lines):
19
- if ln.startswith("| B3 |"):
20
- lines[i] = NEW
21
- hit += 1
22
- if hit != 1:
23
- print("B3 命中行数异常:", hit)
24
- raise SystemExit(1)
25
- todo.write_text("\n".join(lines) + "\n", encoding="utf-8")
26
- print("待办已更新 B3")
27
-
28
- hf = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\交接笔记-20261129.md")
29
- d = hf.read_text(encoding="utf-8")
30
- old = """5. **B3–B5 借鉴项**(回复风格体检 / 周期性风格注入 / 宿主看门狗)仍未动。
31
- 已完成:**B1** `auth-quota`(额度/认证失败体检)、**B2** `plugin-loaded`(副本一致 + 重载证据 + 面板 /api/ping)——
32
- 都加在 doctor 里,各带回归测试。任务行统计见 `docs/审核改进待办.md`。"""
33
- new = """5. **B4–B5 借鉴项**(周期性风格注入 / 宿主看门狗)仍未动。
34
- 已完成 **B1** `auth-quota`、**B2** `plugin-loaded`、**B3** `style`(回复风格体检)——
35
- 都挂在 doctor 里,各带回归测试;B3 另有 `brain.py style [--save]` 命令。
36
- 任务行统计见 `docs/审核改进待办.md`。"""
37
- if old not in d:
38
- print("交接笔记未匹配,跳过")
39
- else:
40
- hf.write_text(d.replace(old, new), encoding="utf-8")
41
- print("交接笔记已更新")
@@ -1,62 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:把 B5 标为已修、追加 11-29 续做记录、更新交接笔记(可删)。"""
3
- from pathlib import Path
4
-
5
- todo = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\审核改进待办.md")
6
- lines = todo.read_text(encoding="utf-8").splitlines()
7
-
8
- B5 = ("| B5 | **宿主进程看门狗**:每 2 分钟存活监控,掉线告警 | `lingshu-cron` 做水位/做梦/体检,"
9
- "**没有宿主进程存活监控** "
10
- "| ✅ **已修**(2026-11-29):插件在 `agent/turn-stopping` 每回合写 `.host-heartbeat.json`"
11
- "(ts/pid);新增 `brain.py watchdog [--check] [--max-age-min N]` 判活——新鲜 0、过期 2、"
12
- "从未收到 3;过期时经 `failures.record('watchdog.stale')` **聚合计数**而不是每次刷日志。"
13
- "doctor 新增 `host-heartbeat`(只在「心跳存在但过期」时 WARN)。**只告警、绝不自启**"
14
- "(自启容易变成两个进程互相打架)。挂任务计划的命令写在模块 docstring 里。"
15
- "`tests/test_watchdog.py` 5 条回归 |")
16
- hit = 0
17
- for i, ln in enumerate(lines):
18
- if ln.startswith("| B5 |"):
19
- lines[i] = B5
20
- hit += 1
21
- if hit != 1:
22
- print("B5 命中行数异常:", hit)
23
- raise SystemExit(1)
24
-
25
- lines += [
26
- "",
27
- "---",
28
- "",
29
- "## 2026-11-29 续做记录(B1–B5 + 日志噪音)",
30
- "",
31
- "- **B1 `auth-quota`**:扫 `lingshu.log`/`failures.jsonl`/`crash-*.log`,7 天窗口、词边界匹配",
32
- " `401/402/403` 与 `quota/insufficient/unauthorized/invalid-api-key/余额/额度/认证失败`。",
33
- "- **B2 `plugin-loaded`**:7 个关键文件源码↔副本逐字指纹 + 副本 mtime↔最近一次「会话开始」+ 面板 `/api/ping`。",
34
- " 进程号与 journal ready 需要宿主接口,**没有假装能验**。",
35
- "- **B3 `style`**:`brain.py style [--save]` + doctor `style`,句长/标点密度/列表占比与基线比对。",
36
- "- **B5 `host-heartbeat`**:插件每回合写心跳,`watchdog` 判活,只告警不自启。",
37
- "- **`log-anomalies` 改成近 7 天窗口**(累计只作附注),并整类排除 `kind=inject`——",
38
- " 那是账单/预算观测(指针替换的小差额、按预算整段丢弃),有 `context-stats` 专门看,",
39
- " 不该靠日志条数间接表达。改后:31 warn/7 error(累计)→ **近 7 天 1 warn / 7 error,PASS**。",
40
- "- **`inject` 的小差额降级为 info**(|Δ|≤40 属指针标记替换的必然结果,只有大差额才 warn)。",
41
- "- **`app-pin` 已修**:profile 的依赖声明 `^5.33.0` → `^5.34.0`(实际已装 5.34.0)。",
42
- " **没有跑 `pnpm install`**——npm 上还没发布 5.34,install 会 404;应在 `release.py publish` 之后再做。",
43
- "",
44
- ]
45
- todo.write_text("\n".join(lines) + "\n", encoding="utf-8")
46
- print("待办已更新")
47
-
48
- hf = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\交接笔记-20261129.md")
49
- d = hf.read_text(encoding="utf-8")
50
- old = """5. **B4–B5 借鉴项**(周期性风格注入 / 宿主看门狗)仍未动。
51
- 已完成 **B1** `auth-quota`、**B2** `plugin-loaded`、**B3** `style`(回复风格体检)——
52
- 都挂在 doctor 里,各带回归测试;B3 另有 `brain.py style [--save]` 命令。
53
- 任务行统计见 `docs/审核改进待办.md`。"""
54
- new = """5. **B4 周期性风格注入** 仍未动(它要往注入包里加东西,**水位高时别碰**)。
55
- 已完成 **B1** `auth-quota`、**B2** `plugin-loaded`、**B3** `style`、**B5** `host-heartbeat`
56
- (插件每回合写心跳 + `brain.py watchdog --check` 判活,只告警不自启)——
57
- 都挂在 doctor 里,各带回归测试。任务行统计见 `docs/审核改进待办.md`。"""
58
- if old in d:
59
- hf.write_text(d.replace(old, new), encoding="utf-8")
60
- print("交接笔记已更新")
61
- else:
62
- print("交接笔记未匹配(跳过)")
@@ -1,24 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:在 cmd_backup 的遍历里加上 crash-*.log 排除(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\cli.py")
6
- lines = p.read_text(encoding="utf-8").splitlines()
7
-
8
- start = next(i for i, l in enumerate(lines) if l.startswith("def cmd_backup("))
9
- idx = next(i for i, l in enumerate(lines[start:], start)
10
- if ".write-probe" in l and l.strip().startswith("if f.name"))
11
- # 下一行应是 continue
12
- assert lines[idx + 1].strip() == "continue", lines[idx + 1]
13
- insert = [
14
- " # 崩溃堆栈/诊断残留不属于记忆正文:留在 HOME 里供排查,但不进备份包",
15
- " #(实测备份包里混过 2 条 crash-*.log)。",
16
- " if f.name.startswith(\"crash-\") and f.suffix == \".log\":",
17
- " continue",
18
- ]
19
- if "startswith(\"crash-\")" in "\n".join(lines[idx:idx + 8]):
20
- print("已存在,跳过")
21
- else:
22
- lines[idx + 2:idx + 2] = insert
23
- p.write_text("\n".join(lines) + "\n", encoding="utf-8")
24
- print(f"已插入(第 {idx + 3} 行起)")
@@ -1,21 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:更新交接笔记里 B1–B5 的进度(可删)。"""
3
- from pathlib import Path
4
-
5
- p = Path(r"E:\丁厚同\文档\程序\灵枢-skill\docs\交接笔记-20261129.md")
6
- d = p.read_text(encoding="utf-8")
7
-
8
- old = """5. **B2–B5 借鉴项**(插件重载四步验证 / 回复风格体检 / 周期性风格注入 / 宿主看门狗)仍未动。
9
- **B1(额度/认证失败体检)已于 2026-11-29 完成**:doctor 新增 `auth-quota` 项。
10
- 任务行统计见 `docs/审核改进待办.md`。"""
11
- new = """5. **B3–B5 借鉴项**(回复风格体检 / 周期性风格注入 / 宿主看门狗)仍未动。
12
- 已完成:**B1** `auth-quota`(额度/认证失败体检)、**B2** `plugin-loaded`(副本一致 + 重载证据 + 面板 /api/ping)——
13
- 都加在 doctor 里,各带回归测试。任务行统计见 `docs/审核改进待办.md`。"""
14
- if old not in d:
15
- print("没匹配到,未改动;当前相关段落:")
16
- for ln in d.splitlines():
17
- if ln.strip().startswith("5.") or "B1" in ln or "B2" in ln:
18
- print(" ", ln[:120])
19
- raise SystemExit(2)
20
- p.write_text(d.replace(old, new), encoding="utf-8")
21
- print("已更新交接笔记")
@@ -1,25 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:把 update_app_copy.ps1 的收尾提示指向新的 plugin-loaded 自检(可删)。"""
3
- import glob
4
- import sys
5
- from pathlib import Path
6
-
7
- hits = glob.glob(r"E:\丁厚同\文档\程序\灵枢-skill\scripts\update*_copy.ps1")
8
- if not hits:
9
- print("没找到脚本")
10
- sys.exit(1)
11
- p = Path(hits[0])
12
- d = p.read_text(encoding="utf-8-sig")
13
- old_tail = 'Write-Host " 自检:python scripts\\brain.py doctor (看 release-drift 那一项)"'
14
- new_tail = (
15
- 'Write-Host " 验证(B2:别只看复制成功):python scripts\\brain.py doctor" -ForegroundColor Green\n'
16
- 'Write-Host " - plugin-loaded PASS = 副本与源码一致,且之后有过「会话开始」记录" -ForegroundColor Green\n'
17
- 'Write-Host " - 若 WARN『副本比最近一次会话开始新』= 还没重载,重启 APP 再验" -ForegroundColor Green\n'
18
- 'Write-Host " - release-drift 只比版本号,不能证明已加载" -ForegroundColor Green'
19
- )
20
- if old_tail not in d:
21
- print("没匹配到旧提示,未改动;末尾如下:")
22
- print(d[-300:])
23
- sys.exit(2)
24
- p.write_text(d.replace(old_tail, new_tail), encoding="utf-8")
25
- print("已更新:", p.name)
@@ -1,27 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:重算状态统计 + 订正版本号(可删)。"""
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
- d = d.replace("当前版本 v5.33", "当前版本 v5.34", 1)
10
-
11
- counts = {"done": 0, "todo": 0, "excl": 0}
12
- for ln in d.splitlines():
13
- if not re.match(r"^\|\s*[A-Z]?\d+\s*\|", ln):
14
- continue
15
- if "✅" in ln:
16
- counts["done"] += 1
17
- elif "⬜" in ln:
18
- counts["todo"] += 1
19
- elif "🔍" in ln:
20
- counts["excl"] += 1
21
-
22
- stat = (f"> **状态统计(编号任务行)**:✅ {counts['done']} 已修 / "
23
- f"⬜ {counts['todo']} 待修 / 🔍 {counts['excl']} 已排除"
24
- f"(含 §7 复审新增)")
25
- d2 = re.sub(r"> \*\*状态统计(编号任务行)\*\*[^\n]*", stat, d, count=1)
26
- p.write_text(d2, encoding="utf-8")
27
- print(stat)
@@ -1,25 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """一次性:把待办里 B2 那一行改成已修(可删)。"""
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 = ("| B2 | **插件重载四步验证**:进程号变更 → 连接日志新行 → 健康检查 200 → journal 输出 ready "
8
- "| `update_app_copy.ps1` 只复制、`release-drift` 只验版本号,**没验副本真被加载** "
9
- "| ✅ **已修(能离线验的三步)**(2026-11-29):doctor 新增 `plugin-loaded` —— "
10
- "①7 个关键文件(cli/core/memory + 4 个 plugin.js)源码与副本**逐字指纹比对**(不一致=改了没同步);"
11
- "②副本 mtime 与 `lingshu.log` 最近一条「会话开始,注入完成」比对(副本更新但之后无启动记录=还没重载);"
12
- "③探测面板 `/api/ping`。**进程号变更与 journal ready 需要宿主接口,本项不假装能验**。"
13
- "`update_app_copy.ps1` 收尾提示改为指向该项;`tests/test_plugin_loaded_check.py` 5 条回归。"
14
- "上线即抓到一次「副本比启动新」的真问题 |")
15
-
16
- hit = 0
17
- for i, ln in enumerate(lines):
18
- if ln.startswith("| B2 |"):
19
- lines[i] = NEW
20
- hit += 1
21
- if hit != 1:
22
- print("命中行数异常:", hit)
23
- raise SystemExit(1)
24
- p.write_text("\n".join(lines) + "\n", encoding="utf-8")
25
- print("已更新 B2 行")
@@ -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:清理探针堆积;只移不删,确认无用后可整目录删除)