@furongjun1999/dsh-memory 0.9.7 → 0.9.9

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 (68) hide show
  1. package/README.md +150 -662
  2. package/codebuddy/CODEBUDDY.md +337 -204
  3. package/docs/README.md +21 -0
  4. package/docs/discipline/harnesses.yaml +11 -3
  5. package/docs/discipline/templates/compact.txt.tmpl +20 -18
  6. package/docs/discipline/templates/full.md.tmpl +63 -61
  7. package/docs/discipline/templates/rules.mdc.tmpl +5 -3
  8. package/docs/discipline/templates/skill.md.tmpl +25 -23
  9. package/docs/discipline/templates/spec.txt.tmpl +1 -1
  10. package/docs/discipline/templates/zcode-user.md.tmpl +1 -1
  11. package/docs//350/247/204/350/214/203/AI/347/274/226/347/250/213/351/200/232/347/224/250/350/247/204/350/214/203.md +4 -0
  12. package/dsh/cordis.yml.example +2 -2
  13. package/lib/hooks.d.ts +11 -1
  14. package/lib/hooks.js +59 -4
  15. package/lib/index.d.ts +1 -1
  16. package/lib/index.js +11 -5
  17. package/lib/init.js +28 -4
  18. package/lib/lib/hook_audit.d.ts +3 -0
  19. package/lib/lib/hook_audit.js +63 -0
  20. package/md_cg/autonomy.py +1 -1
  21. package/md_cg/config_registry.py +329 -329
  22. package/md_cg/config_registry_bulk.py +483 -482
  23. package/md_cg/config_render.py +27 -0
  24. package/md_cg/config_validate.py +456 -455
  25. package/md_cg/conflict_surface.py +127 -0
  26. package/md_cg/mcp_server.py +5324 -5227
  27. package/md_cg/mdcg.py +12 -1
  28. package/md_cg/mdcos.py +7159 -7108
  29. package/md_cg/pooling.py +487 -485
  30. package/md_cg/qmd_llm.py +334 -334
  31. package/md_cg/reach.py +10 -4
  32. package/md_cg/sleep.py +2 -2
  33. package/md_cg/sustain.py +13 -4
  34. package/md_cg/test_auto_defaults.py +463 -463
  35. package/md_cg/test_autonomy_emotion.py +328 -328
  36. package/md_cg/test_bm25_default.py +56 -0
  37. package/md_cg/test_c3_transient_read_negative.py +7 -3
  38. package/md_cg/test_conflict_surface.py +75 -0
  39. package/md_cg/test_conflict_value_untrusted.py +63 -0
  40. package/md_cg/test_exact_text_cache.py +194 -191
  41. package/md_cg/test_heartbeat_ledger.py +563 -557
  42. package/md_cg/test_hotcache_tool.py +121 -0
  43. package/md_cg/test_issue274_read_node_id_none.py +364 -341
  44. package/md_cg/test_issue561_pending_review.py +89 -5
  45. package/md_cg/test_issue578_service_info_gate.py +264 -0
  46. package/md_cg/test_n184_keys_concurrent_provision.py +1 -1
  47. package/md_cg/test_p3_legacy_closure.py +441 -438
  48. package/md_cg/test_p43_pooling.py +419 -412
  49. package/md_cg/test_reach.py +5 -1
  50. package/md_cg/test_reach_exits.py +54 -0
  51. package/md_cg/test_reach_single_char.py +74 -0
  52. package/md_cg/test_read_scope_b27.py +2 -2
  53. package/md_cg/test_search_bm25_default.py +60 -0
  54. package/md_cg/test_security_audit_v21.py +249 -249
  55. package/md_cg/test_sleep_p1.py +1032 -1032
  56. package/md_cg/test_sustain_bad_stamp.py +178 -0
  57. package/md_cg/test_untrusted_audit.py +55 -0
  58. package/md_cg/test_untrusted_classifier.py +42 -0
  59. package/md_cg/test_untrusted_enforcement.py +66 -0
  60. package/md_cg/untrusted.py +45 -0
  61. package/md_cg/untrusted_audit.py +87 -0
  62. package/md_cg/value_conflict.py +71 -0
  63. package/package.json +7 -7
  64. package/src/hooks.ts +986 -932
  65. package/src/index.ts +20 -14
  66. package/src/init.ts +21 -4
  67. package/src/lib/hook_audit.ts +334 -282
  68. package/zcode/AGENTS.md +337 -204
package/md_cg/mdcg.py CHANGED
@@ -3039,6 +3039,17 @@ class MdCG:
3039
3039
  "evidence_count": 0, "positive_evidence": 0, "negative_evidence": 0,
3040
3040
  }
3041
3041
  fm.update(extra)
3042
+ # 写入面信任标记(使用者裁定 2026-10-21:「未验证、未信任的信息本来就不应该执行」):
3043
+ # 文本里出现伪装系统消息/指令式短语 ⇒ 落 untrusted 标记 + 命中词,供检索面与
3044
+ # 上层(注入前)据此把它当**数据**而不是指令;不改正文(数据无损)。
3045
+ try:
3046
+ from . import untrusted as _un
3047
+ _u = _un.classify(content)
3048
+ if _u.get("untrusted"):
3049
+ fm["untrusted"] = True
3050
+ fm["untrusted_markers"] = list(_u.get("markers") or [])
3051
+ except Exception:
3052
+ pass
3042
3053
  # 相对时间锚定(MDCG_TIME_ANCHOR=1,缺省关 ⇒ 零调用、fm 逐位不变):无显式 temporal
3043
3054
  # 时把正文里的时间表达以 created_at 为参照归一成派生字段 temporal_anchor;解析不了不写。
3044
3055
  if _timeanchor.enabled():
@@ -5436,7 +5447,7 @@ class MdCG:
5436
5447
  # 阶段 1 大域收敛结果 + 完整打分明细(白箱可审计)
5437
5448
  "big_domain": big_domain,
5438
5449
  "big_domain_scores": big_scores,
5439
- # reach 收敛层审计(2026-09-18):reach=converged/off/short_term/...
5450
+ # reach 收敛层审计(2026-09-18):reach=converged/off/index_unavailable/hash_incomplete/no_tokens/empty_converge/fresh_overflow(#611 起不再产生 short_term)
5440
5451
  # 与 reach_seed(倒排命中数)/reach_diffused(图扩散增量)——
5441
5452
  # A3「触碰量随查询变化」的观测面(scanned 只报读盘数)
5442
5453
  "reach": stat.get("reach"),