@furongjun1999/dsh-memory 0.9.9 → 0.9.12
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/README.md +181 -150
- package/lib/hooks.d.ts +16 -1
- package/lib/hooks.js +53 -2
- package/lib/index.d.ts +3 -0
- package/lib/index.js +9 -1
- package/lib/tools.d.ts +8 -0
- package/lib/tools.js +32 -5
- package/md_cg/config_registry_bulk.py +488 -483
- package/md_cg/config_validate.py +5 -0
- package/md_cg/mcp_server.py +5446 -5324
- package/md_cg/mdcg.py +62 -4
- package/md_cg/mdcos.py +7259 -7159
- package/md_cg/refindex.py +11 -4
- package/md_cg/test_c3_transient_read_negative.py +797 -797
- package/md_cg/test_c8_search_rrf_gates.py +511 -502
- package/md_cg/test_domain_granularity.py +68 -0
- package/md_cg/test_exact_text_cache.py +194 -194
- package/md_cg/test_hotcache_tool.py +121 -121
- package/md_cg/test_index_snapshot_fastpath.py +72 -0
- package/md_cg/test_issue274_read_node_id_none.py +364 -364
- package/md_cg/test_issue623_fullwidth_symmetry.py +66 -0
- package/md_cg/test_p28_refcheck.py +7 -7
- package/md_cg/test_p3_legacy_closure.py +441 -441
- package/md_cg/test_retr_gates_prodpath.py +11 -1
- package/md_cg/test_search_async.py +84 -0
- package/md_cg/test_search_bm25_default.py +60 -60
- package/md_cg/test_search_prefilter.py +85 -0
- package/md_cg/test_untrusted_audit.py +55 -55
- package/md_cg/test_untrusted_classifier.py +42 -42
- package/md_cg/test_untrusted_enforcement.py +66 -66
- package/md_cg/tokens.py +5 -1
- package/md_cg/untrusted.py +45 -45
- package/md_cg/untrusted_audit.py +87 -87
- package/package.json +113 -113
- package/scripts/workspace_index.py +2 -0
- package/src/hooks.ts +1043 -986
- package/src/index.ts +12 -1
- package/src/tools.ts +37 -6
package/md_cg/untrusted.py
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""untrusted · 写入面「把外部文本当数据」标记(v4:精度优先 + 指令框架)
|
|
3
|
-
|
|
4
|
-
使用者裁定(2026-10-21):未验证、未信任的信息本来就不应该执行。
|
|
5
|
-
标记的后果是「不进 recall(上下文)」⇒ 判据精度优先,宁漏不误伤。
|
|
6
|
-
|
|
7
|
-
判据(A 且 B):
|
|
8
|
-
A) 出现指令式/伪装身份短语(MARKERS)
|
|
9
|
-
B) 三选一:
|
|
10
|
-
· 短语位于行首或紧随冒号(真指令的排版形态);
|
|
11
|
-
· 正文含**指令框架**(系统通知:/ 管理员指令:/ 开发者要求: 等);
|
|
12
|
-
· 命中 >= 2 个不同 marker(单点更可能是引用/讨论)。
|
|
13
|
-
"""
|
|
14
|
-
from __future__ import annotations
|
|
15
|
-
|
|
16
|
-
import re
|
|
17
|
-
|
|
18
|
-
MARKERS = (
|
|
19
|
-
"忽略以上",
|
|
20
|
-
"忽略之前",
|
|
21
|
-
"无视规则",
|
|
22
|
-
"跳过检查",
|
|
23
|
-
"必须在结尾",
|
|
24
|
-
"以系统身份",
|
|
25
|
-
"你现在是助手",
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
_LEAD = re.compile(r"(?:^|[\n。;;::])[\s>*\-]*(?:%s)" % "|".join(re.escape(m) for m in MARKERS))
|
|
29
|
-
#: 指令框架:伪装成「上级/系统」下发的句式(单凭它不算,需与 marker 同时出现)
|
|
30
|
-
_FRAME = re.compile(r"(?:系统|管理员|上级|开发者|平台)(?:通知|指令|要求|规定)\s*[::]")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def classify(content):
|
|
34
|
-
"""返回 {"untrusted": bool, "markers": [...], "reason": str|None}。"""
|
|
35
|
-
text = str(content or "")
|
|
36
|
-
hits = [m for m in MARKERS if m in text]
|
|
37
|
-
if not hits:
|
|
38
|
-
return {"untrusted": False, "markers": [], "reason": None}
|
|
39
|
-
if _LEAD.search(text):
|
|
40
|
-
return {"untrusted": True, "markers": hits, "reason": "line_start_or_after_colon"}
|
|
41
|
-
if _FRAME.search(text):
|
|
42
|
-
return {"untrusted": True, "markers": hits, "reason": "instruction_frame"}
|
|
43
|
-
if len(hits) >= 2:
|
|
44
|
-
return {"untrusted": True, "markers": hits, "reason": "multi_marker"}
|
|
45
|
-
return {"untrusted": False, "markers": hits, "reason": None}
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""untrusted · 写入面「把外部文本当数据」标记(v4:精度优先 + 指令框架)
|
|
3
|
+
|
|
4
|
+
使用者裁定(2026-10-21):未验证、未信任的信息本来就不应该执行。
|
|
5
|
+
标记的后果是「不进 recall(上下文)」⇒ 判据精度优先,宁漏不误伤。
|
|
6
|
+
|
|
7
|
+
判据(A 且 B):
|
|
8
|
+
A) 出现指令式/伪装身份短语(MARKERS)
|
|
9
|
+
B) 三选一:
|
|
10
|
+
· 短语位于行首或紧随冒号(真指令的排版形态);
|
|
11
|
+
· 正文含**指令框架**(系统通知:/ 管理员指令:/ 开发者要求: 等);
|
|
12
|
+
· 命中 >= 2 个不同 marker(单点更可能是引用/讨论)。
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import re
|
|
17
|
+
|
|
18
|
+
MARKERS = (
|
|
19
|
+
"忽略以上",
|
|
20
|
+
"忽略之前",
|
|
21
|
+
"无视规则",
|
|
22
|
+
"跳过检查",
|
|
23
|
+
"必须在结尾",
|
|
24
|
+
"以系统身份",
|
|
25
|
+
"你现在是助手",
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
_LEAD = re.compile(r"(?:^|[\n。;;::])[\s>*\-]*(?:%s)" % "|".join(re.escape(m) for m in MARKERS))
|
|
29
|
+
#: 指令框架:伪装成「上级/系统」下发的句式(单凭它不算,需与 marker 同时出现)
|
|
30
|
+
_FRAME = re.compile(r"(?:系统|管理员|上级|开发者|平台)(?:通知|指令|要求|规定)\s*[::]")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def classify(content):
|
|
34
|
+
"""返回 {"untrusted": bool, "markers": [...], "reason": str|None}。"""
|
|
35
|
+
text = str(content or "")
|
|
36
|
+
hits = [m for m in MARKERS if m in text]
|
|
37
|
+
if not hits:
|
|
38
|
+
return {"untrusted": False, "markers": [], "reason": None}
|
|
39
|
+
if _LEAD.search(text):
|
|
40
|
+
return {"untrusted": True, "markers": hits, "reason": "line_start_or_after_colon"}
|
|
41
|
+
if _FRAME.search(text):
|
|
42
|
+
return {"untrusted": True, "markers": hits, "reason": "instruction_frame"}
|
|
43
|
+
if len(hits) >= 2:
|
|
44
|
+
return {"untrusted": True, "markers": hits, "reason": "multi_marker"}
|
|
45
|
+
return {"untrusted": False, "markers": hits, "reason": None}
|
package/md_cg/untrusted_audit.py
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""untrusted_audit · 误判率巡检读数(使用者裁定 2026-10-21 第 1 条)
|
|
3
|
-
|
|
4
|
-
背景:untrusted 标记会让条目**不进 recall(上下文)**,误判 = 合法记忆消失。
|
|
5
|
-
故需要可复算的读数:命中了多少条、按理由/按 marker 分布、以及供人工抽检的样本。
|
|
6
|
-
|
|
7
|
-
口径(只读,不改任何节点):
|
|
8
|
-
· 遍历 knowledge 层节点正文(去掉 frontmatter),跑 untrusted.classify;
|
|
9
|
-
· 计数按 reason(line_start_or_after_colon / instruction_frame / multi_marker)分组;
|
|
10
|
-
· 抽样默认 5 条,给 id + markers + 前 80 字,供人工判真伪。
|
|
11
|
-
|
|
12
|
-
用法:
|
|
13
|
-
python -m md_cg.untrusted_audit --root <库根> [--limit 2000] [--sample 5]
|
|
14
|
-
"""
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import argparse
|
|
18
|
-
import glob
|
|
19
|
-
import io
|
|
20
|
-
import json
|
|
21
|
-
import os
|
|
22
|
-
|
|
23
|
-
from . import untrusted as U
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def _body(text: str) -> str:
|
|
27
|
-
if text.startswith("---"):
|
|
28
|
-
parts = text.split("---", 2)
|
|
29
|
-
if len(parts) >= 3:
|
|
30
|
-
return parts[2]
|
|
31
|
-
return text
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def scan(root: str, limit: int = 2000, sample: int = 5) -> dict:
|
|
35
|
-
"""扫描 knowledge 层节点,返回误判巡检读数(不写任何东西)。"""
|
|
36
|
-
pattern = os.path.join(root, "knowledge", "**", "*.md")
|
|
37
|
-
files = sorted(glob.glob(pattern, recursive=True))[:max(1, int(limit))]
|
|
38
|
-
flagged = 0
|
|
39
|
-
by_reason = {}
|
|
40
|
-
by_marker = {}
|
|
41
|
-
samples = []
|
|
42
|
-
for path in files:
|
|
43
|
-
try:
|
|
44
|
-
text = io.open(path, encoding="utf-8", errors="replace").read()
|
|
45
|
-
except OSError:
|
|
46
|
-
continue
|
|
47
|
-
body = _body(text)
|
|
48
|
-
r = U.classify(body)
|
|
49
|
-
if not r.get("untrusted"):
|
|
50
|
-
continue
|
|
51
|
-
flagged += 1
|
|
52
|
-
reason = r.get("reason") or "unknown"
|
|
53
|
-
by_reason[reason] = by_reason.get(reason, 0) + 1
|
|
54
|
-
for m in r.get("markers") or []:
|
|
55
|
-
by_marker[m] = by_marker.get(m, 0) + 1
|
|
56
|
-
if len(samples) < max(0, int(sample)):
|
|
57
|
-
samples.append({
|
|
58
|
-
"path": os.path.relpath(path, root).replace("\\", "/"),
|
|
59
|
-
"markers": r.get("markers"),
|
|
60
|
-
"reason": reason,
|
|
61
|
-
"excerpt": body.strip().replace("\n", " ")[:80],
|
|
62
|
-
})
|
|
63
|
-
total = len(files)
|
|
64
|
-
return {
|
|
65
|
-
"root": root,
|
|
66
|
-
"scanned": total,
|
|
67
|
-
"flagged": flagged,
|
|
68
|
-
"flag_ratio": round(flagged / total, 6) if total else 0.0,
|
|
69
|
-
"by_reason": by_reason,
|
|
70
|
-
"by_marker": by_marker,
|
|
71
|
-
"samples": samples,
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def main(argv=None):
|
|
76
|
-
ap = argparse.ArgumentParser(description="untrusted 误判率巡检读数")
|
|
77
|
-
ap.add_argument("--root", required=True)
|
|
78
|
-
ap.add_argument("--limit", type=int, default=2000)
|
|
79
|
-
ap.add_argument("--sample", type=int, default=5)
|
|
80
|
-
a = ap.parse_args(argv)
|
|
81
|
-
print(json.dumps(scan(a.root, limit=a.limit, sample=a.sample),
|
|
82
|
-
ensure_ascii=False, indent=2))
|
|
83
|
-
return 0
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if __name__ == "__main__":
|
|
87
|
-
raise SystemExit(main())
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""untrusted_audit · 误判率巡检读数(使用者裁定 2026-10-21 第 1 条)
|
|
3
|
+
|
|
4
|
+
背景:untrusted 标记会让条目**不进 recall(上下文)**,误判 = 合法记忆消失。
|
|
5
|
+
故需要可复算的读数:命中了多少条、按理由/按 marker 分布、以及供人工抽检的样本。
|
|
6
|
+
|
|
7
|
+
口径(只读,不改任何节点):
|
|
8
|
+
· 遍历 knowledge 层节点正文(去掉 frontmatter),跑 untrusted.classify;
|
|
9
|
+
· 计数按 reason(line_start_or_after_colon / instruction_frame / multi_marker)分组;
|
|
10
|
+
· 抽样默认 5 条,给 id + markers + 前 80 字,供人工判真伪。
|
|
11
|
+
|
|
12
|
+
用法:
|
|
13
|
+
python -m md_cg.untrusted_audit --root <库根> [--limit 2000] [--sample 5]
|
|
14
|
+
"""
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import argparse
|
|
18
|
+
import glob
|
|
19
|
+
import io
|
|
20
|
+
import json
|
|
21
|
+
import os
|
|
22
|
+
|
|
23
|
+
from . import untrusted as U
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _body(text: str) -> str:
|
|
27
|
+
if text.startswith("---"):
|
|
28
|
+
parts = text.split("---", 2)
|
|
29
|
+
if len(parts) >= 3:
|
|
30
|
+
return parts[2]
|
|
31
|
+
return text
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def scan(root: str, limit: int = 2000, sample: int = 5) -> dict:
|
|
35
|
+
"""扫描 knowledge 层节点,返回误判巡检读数(不写任何东西)。"""
|
|
36
|
+
pattern = os.path.join(root, "knowledge", "**", "*.md")
|
|
37
|
+
files = sorted(glob.glob(pattern, recursive=True))[:max(1, int(limit))]
|
|
38
|
+
flagged = 0
|
|
39
|
+
by_reason = {}
|
|
40
|
+
by_marker = {}
|
|
41
|
+
samples = []
|
|
42
|
+
for path in files:
|
|
43
|
+
try:
|
|
44
|
+
text = io.open(path, encoding="utf-8", errors="replace").read()
|
|
45
|
+
except OSError:
|
|
46
|
+
continue
|
|
47
|
+
body = _body(text)
|
|
48
|
+
r = U.classify(body)
|
|
49
|
+
if not r.get("untrusted"):
|
|
50
|
+
continue
|
|
51
|
+
flagged += 1
|
|
52
|
+
reason = r.get("reason") or "unknown"
|
|
53
|
+
by_reason[reason] = by_reason.get(reason, 0) + 1
|
|
54
|
+
for m in r.get("markers") or []:
|
|
55
|
+
by_marker[m] = by_marker.get(m, 0) + 1
|
|
56
|
+
if len(samples) < max(0, int(sample)):
|
|
57
|
+
samples.append({
|
|
58
|
+
"path": os.path.relpath(path, root).replace("\\", "/"),
|
|
59
|
+
"markers": r.get("markers"),
|
|
60
|
+
"reason": reason,
|
|
61
|
+
"excerpt": body.strip().replace("\n", " ")[:80],
|
|
62
|
+
})
|
|
63
|
+
total = len(files)
|
|
64
|
+
return {
|
|
65
|
+
"root": root,
|
|
66
|
+
"scanned": total,
|
|
67
|
+
"flagged": flagged,
|
|
68
|
+
"flag_ratio": round(flagged / total, 6) if total else 0.0,
|
|
69
|
+
"by_reason": by_reason,
|
|
70
|
+
"by_marker": by_marker,
|
|
71
|
+
"samples": samples,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def main(argv=None):
|
|
76
|
+
ap = argparse.ArgumentParser(description="untrusted 误判率巡检读数")
|
|
77
|
+
ap.add_argument("--root", required=True)
|
|
78
|
+
ap.add_argument("--limit", type=int, default=2000)
|
|
79
|
+
ap.add_argument("--sample", type=int, default=5)
|
|
80
|
+
a = ap.parse_args(argv)
|
|
81
|
+
print(json.dumps(scan(a.root, limit=a.limit, sample=a.sample),
|
|
82
|
+
ensure_ascii=False, indent=2))
|
|
83
|
+
return 0
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if __name__ == "__main__":
|
|
87
|
+
raise SystemExit(main())
|
package/package.json
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@furongjun1999/dsh-memory",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"description": "灵枢(Lingshu·líng shū)DeepSeek Harness 插件:完整大脑——长期记忆/知识飞轮/自我认知/递归反思接入 DSH,对话自动沉淀进 md_cg 认知图(md 文档)",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"lingshu": "./lib/cli.js",
|
|
10
|
-
"lingshu-init": "./lib/init.js",
|
|
11
|
-
"dsh-memory": "./lib/cli.js"
|
|
12
|
-
},
|
|
13
|
-
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"types": "./lib/index.d.ts",
|
|
16
|
-
"import": "./lib/index.js"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"lib",
|
|
21
|
-
"src",
|
|
22
|
-
"md_cg",
|
|
23
|
-
"utf8_boot.py",
|
|
24
|
-
"data/policy.json",
|
|
25
|
-
"hive/id_charset_blocks.txt",
|
|
26
|
-
"skills",
|
|
27
|
-
"README.md",
|
|
28
|
-
"dsh",
|
|
29
|
-
"codebuddy",
|
|
30
|
-
"zcode",
|
|
31
|
-
"docs/规范/AI编程通用规范.md",
|
|
32
|
-
"docs/规范/AI编程通用规范_灵枢适配.md",
|
|
33
|
-
"docs/规范/AI编程通用规范_自检清单.md",
|
|
34
|
-
"docs/discipline",
|
|
35
|
-
"docs/工作纪律_认知图条目_v1.1.json",
|
|
36
|
-
"scripts/workspace_index.py"
|
|
37
|
-
],
|
|
38
|
-
"keywords": [
|
|
39
|
-
"deepseek",
|
|
40
|
-
"dsh",
|
|
41
|
-
"dsh-plugin",
|
|
42
|
-
"cordis",
|
|
43
|
-
"memory",
|
|
44
|
-
"agent",
|
|
45
|
-
"aeis",
|
|
46
|
-
"lingshu",
|
|
47
|
-
"multi-agent",
|
|
48
|
-
"spatiotemporal",
|
|
49
|
-
"knowledge-graph"
|
|
50
|
-
],
|
|
51
|
-
"license": "MIT",
|
|
52
|
-
"peerDependenciesMeta": {
|
|
53
|
-
"@deepseek-ai/cordis": {
|
|
54
|
-
"optional": true
|
|
55
|
-
},
|
|
56
|
-
"@deepseek-ai/dsh-llm": {
|
|
57
|
-
"optional": true
|
|
58
|
-
},
|
|
59
|
-
"@deepseek-ai/dsh-session": {
|
|
60
|
-
"optional": true
|
|
61
|
-
},
|
|
62
|
-
"@deepseek-ai/dsh-system-prompt": {
|
|
63
|
-
"optional": true
|
|
64
|
-
},
|
|
65
|
-
"@deepseek-ai/dsh-tools": {
|
|
66
|
-
"optional": true
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"peerDependencies": {
|
|
70
|
-
"@deepseek-ai/cordis": ">=4.0.1",
|
|
71
|
-
"@deepseek-ai/dsh-llm": ">=0.1.0-rc.6",
|
|
72
|
-
"@deepseek-ai/dsh-session": ">=0.1.0-rc.6",
|
|
73
|
-
"@deepseek-ai/dsh-system-prompt": ">=0.1.0-rc.6",
|
|
74
|
-
"@deepseek-ai/dsh-tools": ">=0.1.0-rc.6"
|
|
75
|
-
},
|
|
76
|
-
"dependencies": {
|
|
77
|
-
"@deepseek-ai/schemastery": "^3.18.1"
|
|
78
|
-
},
|
|
79
|
-
"devDependencies": {
|
|
80
|
-
"@deepseek-ai/cordis": "^4.0.1",
|
|
81
|
-
"@deepseek-ai/dsh-llm": "^0.2.0-rc.2",
|
|
82
|
-
"@deepseek-ai/dsh-session": "^0.2.0-rc.2",
|
|
83
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.2",
|
|
84
|
-
"@deepseek-ai/dsh-tools": "^0.2.0-rc.2",
|
|
85
|
-
"@deepseek-ai/schemastery": "^3.0.0",
|
|
86
|
-
"@types/node": "^26.6.5",
|
|
87
|
-
"tsx": "^4.19.0",
|
|
88
|
-
"typescript": "^7.0.2"
|
|
89
|
-
},
|
|
90
|
-
"scripts": {
|
|
91
|
-
"build": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
92
|
-
"test": "npm run build && node --import tsx --test \"test/*.test.ts\"",
|
|
93
|
-
"prepare": "node -e \"const fs=require('fs');const tsc='node_modules/typescript/bin/tsc';if(fs.existsSync(tsc)){fs.rmSync('lib',{recursive:true,force:true});require('child_process').execFileSync(process.execPath,[tsc,'-p','tsconfig.json'],{stdio:'inherit'})}else if(fs.existsSync('lib/index.js')){console.log('[prepare] 跳过构建:typescript 未安装(NODE_ENV=production 或 --omit=dev 会省略 devDependencies)——需要构建请用 npm install --include=dev')}else{console.error('[prepare] 本安装会得到一个不可用的包(issue #161):包入口 main 指向 lib/index.js,但 lib/ 被 .gitignore 忽略、git 归档里没有它,此处 typescript 又未安装(NODE_ENV=production 或 --omit=dev 会省略 devDependencies)⇒ prepare 无法构建,lib/index.js 不存在。修法:用 npm install --include=dev 安装(带上 devDependencies,让 prepare 能构建),或改用已带构建产物的发布包。');process.exitCode=1}\"",
|
|
94
|
-
"gate": "python scripts/check_unreachable.py && python scripts/check_publish_artifact.py && python scripts/check_publish_smoke.py && python scripts/cogmap_sync.py check && python scripts/link_check.py && python scripts/check_line_anchors.py && python scripts/workspace_index.py --check && python scripts/discipline_nodes.py --init --write --cg-root .tmp/discipline-cg && python scripts/verify_discipline.py --allow-missing --cg-root .tmp/discipline-cg && python scripts/gate_rust_crate_test.py && python scripts/gate_rust_parity.py && python scripts/check_local_paths.py && python scripts/body_e2e_smoke.py",
|
|
95
|
-
"prepublishOnly": "npm run build && npm test && npm run gate"
|
|
96
|
-
},
|
|
97
|
-
"repository": {
|
|
98
|
-
"type": "git",
|
|
99
|
-
"url": "git+https://github.com/FuRongJun-1999/dsh-memory.git"
|
|
100
|
-
},
|
|
101
|
-
"engines": {
|
|
102
|
-
"node": ">=22.19"
|
|
103
|
-
},
|
|
104
|
-
"dsh": {
|
|
105
|
-
"bundle": {
|
|
106
|
-
"patch": "./dsh/cordis.patch.yml"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"publishConfig": {
|
|
110
|
-
"access": "public",
|
|
111
|
-
"registry": "https://registry.npmjs.org/"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@furongjun1999/dsh-memory",
|
|
3
|
+
"version": "0.9.12",
|
|
4
|
+
"description": "灵枢(Lingshu·líng shū)DeepSeek Harness 插件:完整大脑——长期记忆/知识飞轮/自我认知/递归反思接入 DSH,对话自动沉淀进 md_cg 认知图(md 文档)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"lingshu": "./lib/cli.js",
|
|
10
|
+
"lingshu-init": "./lib/init.js",
|
|
11
|
+
"dsh-memory": "./lib/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./lib/index.d.ts",
|
|
16
|
+
"import": "./lib/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"lib",
|
|
21
|
+
"src",
|
|
22
|
+
"md_cg",
|
|
23
|
+
"utf8_boot.py",
|
|
24
|
+
"data/policy.json",
|
|
25
|
+
"hive/id_charset_blocks.txt",
|
|
26
|
+
"skills",
|
|
27
|
+
"README.md",
|
|
28
|
+
"dsh",
|
|
29
|
+
"codebuddy",
|
|
30
|
+
"zcode",
|
|
31
|
+
"docs/规范/AI编程通用规范.md",
|
|
32
|
+
"docs/规范/AI编程通用规范_灵枢适配.md",
|
|
33
|
+
"docs/规范/AI编程通用规范_自检清单.md",
|
|
34
|
+
"docs/discipline",
|
|
35
|
+
"docs/工作纪律_认知图条目_v1.1.json",
|
|
36
|
+
"scripts/workspace_index.py"
|
|
37
|
+
],
|
|
38
|
+
"keywords": [
|
|
39
|
+
"deepseek",
|
|
40
|
+
"dsh",
|
|
41
|
+
"dsh-plugin",
|
|
42
|
+
"cordis",
|
|
43
|
+
"memory",
|
|
44
|
+
"agent",
|
|
45
|
+
"aeis",
|
|
46
|
+
"lingshu",
|
|
47
|
+
"multi-agent",
|
|
48
|
+
"spatiotemporal",
|
|
49
|
+
"knowledge-graph"
|
|
50
|
+
],
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"@deepseek-ai/cordis": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"@deepseek-ai/dsh-llm": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"@deepseek-ai/dsh-session": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@deepseek-ai/dsh-system-prompt": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"@deepseek-ai/dsh-tools": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"@deepseek-ai/cordis": ">=4.0.1",
|
|
71
|
+
"@deepseek-ai/dsh-llm": ">=0.1.0-rc.6",
|
|
72
|
+
"@deepseek-ai/dsh-session": ">=0.1.0-rc.6",
|
|
73
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.1.0-rc.6",
|
|
74
|
+
"@deepseek-ai/dsh-tools": ">=0.1.0-rc.6"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
81
|
+
"@deepseek-ai/dsh-llm": "^0.2.0-rc.2",
|
|
82
|
+
"@deepseek-ai/dsh-session": "^0.2.0-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.0-rc.2",
|
|
84
|
+
"@deepseek-ai/dsh-tools": "^0.2.0-rc.2",
|
|
85
|
+
"@deepseek-ai/schemastery": "^3.0.0",
|
|
86
|
+
"@types/node": "^26.6.5",
|
|
87
|
+
"tsx": "^4.19.0",
|
|
88
|
+
"typescript": "^7.0.2"
|
|
89
|
+
},
|
|
90
|
+
"scripts": {
|
|
91
|
+
"build": "node -e \"require('node:fs').rmSync('lib',{recursive:true,force:true})\" && tsc -p tsconfig.json",
|
|
92
|
+
"test": "npm run build && node --import tsx --test \"test/*.test.ts\"",
|
|
93
|
+
"prepare": "node -e \"const fs=require('fs');const tsc='node_modules/typescript/bin/tsc';if(fs.existsSync(tsc)){fs.rmSync('lib',{recursive:true,force:true});require('child_process').execFileSync(process.execPath,[tsc,'-p','tsconfig.json'],{stdio:'inherit'})}else if(fs.existsSync('lib/index.js')){console.log('[prepare] 跳过构建:typescript 未安装(NODE_ENV=production 或 --omit=dev 会省略 devDependencies)——需要构建请用 npm install --include=dev')}else{console.error('[prepare] 本安装会得到一个不可用的包(issue #161):包入口 main 指向 lib/index.js,但 lib/ 被 .gitignore 忽略、git 归档里没有它,此处 typescript 又未安装(NODE_ENV=production 或 --omit=dev 会省略 devDependencies)⇒ prepare 无法构建,lib/index.js 不存在。修法:用 npm install --include=dev 安装(带上 devDependencies,让 prepare 能构建),或改用已带构建产物的发布包。');process.exitCode=1}\"",
|
|
94
|
+
"gate": "python scripts/check_unreachable.py && python scripts/check_publish_artifact.py && python scripts/check_publish_smoke.py && python scripts/cogmap_sync.py check && python scripts/link_check.py && python scripts/check_line_anchors.py && python scripts/workspace_index.py --check && python scripts/discipline_nodes.py --init --write --cg-root .tmp/discipline-cg && python scripts/verify_discipline.py --allow-missing --cg-root .tmp/discipline-cg && python scripts/gate_rust_crate_test.py && python scripts/gate_rust_parity.py && python scripts/check_local_paths.py && python scripts/body_e2e_smoke.py",
|
|
95
|
+
"prepublishOnly": "npm run build && npm test && npm run gate"
|
|
96
|
+
},
|
|
97
|
+
"repository": {
|
|
98
|
+
"type": "git",
|
|
99
|
+
"url": "git+https://github.com/FuRongJun-1999/dsh-memory.git"
|
|
100
|
+
},
|
|
101
|
+
"engines": {
|
|
102
|
+
"node": ">=22.19"
|
|
103
|
+
},
|
|
104
|
+
"dsh": {
|
|
105
|
+
"bundle": {
|
|
106
|
+
"patch": "./dsh/cordis.patch.yml"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"publishConfig": {
|
|
110
|
+
"access": "public",
|
|
111
|
+
"registry": "https://registry.npmjs.org/"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -44,6 +44,8 @@ CI_WORKFLOW = ".github/workflows/workspace-index-check.yml"
|
|
|
44
44
|
# —— 职责真源(本脚本即真源;新增顶层目录 / 根级文件必须在此登记,否则 --check 亮红)——
|
|
45
45
|
# 值 = (职责一句话, [关键入口,相对本目录;目录名亦可])
|
|
46
46
|
DIR_ROLES = {
|
|
47
|
+
"ui": ("灵枢极简前端增量包(可选:给已装插件补可视化侧栏;不随 npm 包分发)",
|
|
48
|
+
["minimal/install.ps1", "minimal/payload/web/app.js"]),
|
|
47
49
|
#: 收据目录(receipt 机制):`完成` 必须带可复现命令输出(见 docs/state/会话状态.md 顶部用法)。
|
|
48
50
|
#: 登记于此是按纪律 #18「新增顶层目录须在 DIR_ROLES 登记后重生成」——本条属**机械连带产物**。
|
|
49
51
|
"receipts": ("收据(可复现命令输出的证据面)—— scripts/receipt.py 的 --write/--check/--list 落盘目录",
|