dsh-plugin-xujie-memory 0.6.0 → 0.7.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 (61) hide show
  1. package/ACCEPTANCE.md +37 -0
  2. package/BUILD-PROVENANCE.json +53 -0
  3. package/CHANGELOG.md +12 -0
  4. package/README.md +48 -23
  5. package/README_EN.md +32 -9
  6. package/lib/client.js +17219 -0
  7. package/lib/controller.js +307 -0
  8. package/lib/index.js +87 -22
  9. package/lib/typert.host.d.ts +3 -0
  10. package/lib/typert.host.js +15104 -0
  11. package/lib/typert.remote-client.d.ts +40 -0
  12. package/lib/typert.remote-client.d.ts.map +1 -0
  13. package/lib/typert.remote-client.js +15093 -0
  14. package/lib/types.d.ts +13 -0
  15. package/lib/types.js +1 -0
  16. package/package.json +49 -5
  17. package/python/xujie_memory/__init__.py +123 -123
  18. package/python/xujie_memory/engine.py +1333 -1312
  19. package/python/xujie_memory/management.py +203 -0
  20. package/python/xujie_memory/memory.py +27 -21
  21. package/python/xujie_memory/privacy.py +105 -0
  22. package/python/xujie_memory/schema.sql +492 -480
  23. package/python/xujie_memory/server.py +52 -0
  24. package/scripts/build.mjs +19 -0
  25. package/scripts/prepack.mjs +9 -0
  26. package/scripts/test-all.mjs +9 -0
  27. package/scripts/test-node.mjs +10 -0
  28. package/src/client/MemoryPanel.tsx +536 -0
  29. package/src/client/NeuralField.tsx +88 -0
  30. package/src/client/css.d.ts +4 -0
  31. package/src/client/icons.tsx +28 -0
  32. package/src/client/index.tsx +59 -0
  33. package/src/client/memory-adapter.ts +67 -0
  34. package/src/client/model.ts +79 -0
  35. package/src/client/neural/engine.ts +999 -0
  36. package/src/client/neural/morphology.ts +219 -0
  37. package/src/client/panel.css +337 -0
  38. package/src/client/types.ts +6 -0
  39. package/src/controller.ts +88 -0
  40. package/src/generated/typert.host.js +449 -0
  41. package/src/generated/typert.remote-client.js +438 -0
  42. package/src/index.ts +2 -0
  43. package/src/types.ts +13 -0
  44. package/test/cordis-fixture.mjs +5 -0
  45. package/test/management_regression.py +187 -0
  46. package/test/node-regression.entry.mjs +52 -0
  47. package/vendor/DSH-LICENSE.txt +21 -0
  48. package/vendor/THIRD-PARTY.md +6 -0
  49. package/vendor/dsh-protocol/index.ts +484 -0
  50. package/vendor/dsh-protocol/json-value.ts +53 -0
  51. package/vendor/dsh-protocol/owned-value.ts +39 -0
  52. package/vendor/dsh-protocol/principal.ts +17 -0
  53. package/vendor/dsh-protocol/remote-access.ts +38 -0
  54. package/vendor/dsh-protocol/remote-error.ts +49 -0
  55. package/vendor/dsh-protocol/remote-info.ts +161 -0
  56. package/vendor/dsh-protocol/types.ts +939 -0
  57. package/vendor/licenses/jridgewell-gen-mapping-MIT.txt +19 -0
  58. package/vendor/licenses/jridgewell-resolve-uri-MIT.txt +19 -0
  59. package/vendor/licenses/jridgewell-sourcemap-codec-MIT.txt +19 -0
  60. package/vendor/licenses/jridgewell-trace-mapping-MIT.txt +19 -0
  61. package/vendor/licenses/zod-MIT.txt +21 -0
package/lib/types.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /** Public JSON DTOs for the owner-only memory management page. */
2
+ export interface ScopeRow { scope_id: string; agent_id: string; traces: number }
3
+ export interface Trace { id: string; trace_id: string; scope_id: string; content: string; content_hash: string; recorded_at: string; source_kind: string; importance: number; anchor: boolean; priority: number }
4
+ export interface Node { id: string; layer: string; kind: string; content: string; editable: boolean; trace_id?: string; content_hash?: string; recorded_at?: string; importance?: number; priority?: number; anchor?: boolean; status?: string; evidence?: string[] }
5
+ export interface Edge { source: string; target: string; kind: string }
6
+ export interface PersonTag { tag_id: string; kind: string; value: string; source: string; confidence: number }
7
+ export interface PersonCard { account_id: string; display_name: string; status: string; tags: PersonTag[] }
8
+ export interface Stats { traces: number; traces_erased: number; events: number; states: number; anchors: number; clarifications_open: number; summaries: number }
9
+ export interface Catalog { scope_mode: string; scopes: ScopeRow[] }
10
+ export interface Snapshot { scope_id: string; scope_mode: string; nodes: Node[]; edges: Edge[]; cards: PersonCard[]; stats: Stats; truncated: boolean; limit: number }
11
+ export interface SearchHit { trace_id: string; content: string; content_hash: string; score: number; priority: number; anchor: boolean; importance: number; recorded_at: string; layer: string }
12
+ export interface EditResult { changed: boolean; trace: Trace; replaced_trace_id?: string; pending?: number }
13
+ export interface ForgetResult { trace_id: string; erased: boolean; already_erased: boolean; state_keys: string[] }
package/lib/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,24 +1,34 @@
1
1
  {
2
2
  "name": "dsh-plugin-xujie-memory",
3
- "version": "0.6.0",
4
- "description": "Long-term memory for DeepSeek Harness: facts, anchors, decay and a person card, injected every turn without the model having to ask. Bundles the Python kernel and runtime — install and it works.",
3
+ "version": "0.7.0",
4
+ "description": "DeepSeek Harness in-app memory workspace: three-layer neural graph, fuzzy recall, atomic memory editing and a person card.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "license": "MIT",
8
8
  "scripts": {
9
- "test": "node --test --test-concurrency=1 test/*.test.mjs"
9
+ "build": "node scripts/build.mjs",
10
+ "test": "node scripts/test-all.mjs",
11
+ "test:node": "node scripts/test-node.mjs",
12
+ "prepack": "node scripts/prepack.mjs"
10
13
  },
11
14
  "files": [
12
15
  "lib",
13
16
  "python",
14
17
  "runtime",
18
+ "src",
19
+ "scripts",
20
+ "test",
21
+ "vendor",
15
22
  "cordis.patch.yml",
16
23
  "README.md",
17
24
  "README_EN.md",
18
- "CHANGELOG.md"
25
+ "CHANGELOG.md",
26
+ "BUILD-PROVENANCE.json",
27
+ "ACCEPTANCE.md"
19
28
  ],
20
29
  "engines": {
21
- "node": "^22.19 || >=24"
30
+ "node": "^22.19 || >=24",
31
+ "dsh": "0.2.1-rc.5"
22
32
  },
23
33
  "keywords": [
24
34
  "dsh-plugin",
@@ -28,6 +38,40 @@
28
38
  "dsh": {
29
39
  "bundle": {
30
40
  "patch": "./cordis.patch.yml"
41
+ },
42
+ "client": {
43
+ "platform": "web",
44
+ "inject": [
45
+ "@deepseek-ai/dsh-api-remotes",
46
+ "@deepseek-ai/dsh-client-ui-layout",
47
+ "@deepseek-ai/dsh-client-ui-sidebar"
48
+ ]
31
49
  }
50
+ },
51
+ "exports": {
52
+ ".": "./lib/index.js",
53
+ "./client": "./lib/client.js",
54
+ "./types": {
55
+ "types": "./lib/types.d.ts",
56
+ "default": "./lib/types.js"
57
+ },
58
+ "./typert": {
59
+ "types": "./lib/typert.host.d.ts",
60
+ "default": "./lib/typert.host.js"
61
+ },
62
+ "./remote": {
63
+ "types": "./lib/typert.remote-client.d.ts",
64
+ "default": "./lib/typert.remote-client.js"
65
+ },
66
+ "./package.json": "./package.json"
67
+ },
68
+ "peerDependencies": {
69
+ "@deepseek-ai/cordis": "^4.0.5"
70
+ },
71
+ "devDependencies": {
72
+ "esbuild": "^0.25.0",
73
+ "zod": "4.4.3",
74
+ "typescript": "6.0.3",
75
+ "@jridgewell/gen-mapping": "^0.3.13"
32
76
  }
33
77
  }
@@ -1,123 +1,123 @@
1
- """Xujie-Memory 内核(阶段 1–3)。
2
-
3
- 公开入口:
4
- Engine 提交与投影内核
5
- Assertion 一条待提交的领域变更
6
- SpecRegistry 关系规格注册表
7
- RelationSpec 单条关系规格
8
- make_state_key 状态键构造
9
-
10
- RuleEncoder 词表 + 正则的弱编码器(跑通流程用)
11
- ReplayEncoder 从标注样本回放(测试用)
12
- LLMEncoder 调 OpenAI 兼容接口(可选)
13
-
14
- Ingest 写路径编排:接收 → 编码 → 闸门 → 提交/挂起/只记录
15
- decide 单条解释的闸门判定
16
-
17
- 设计文档对应:v0.3 第 2、3、5、6、7、8 节。
18
- """
19
-
20
- from .encoder import (
21
- Interpretation,
22
- LLMEncoder,
23
- ReplayEncoder,
24
- RuleEncoder,
25
- parse_number,
26
- )
27
- from .engine import (
28
- fixed_clock,
29
- Assertion,
30
- CommitResult,
31
- Engine,
32
- StateChange,
33
- StateView,
34
- apply_event,
35
- canonical_json,
36
- make_state_key,
37
- relation_of,
38
- )
39
- from .decay import Lifecycle, priority
40
- from .errors import (
41
- DependencyCycle,
42
- EvidenceMissing,
43
- EventAlreadyVoid,
44
- IdempotencyConflict,
45
- LockTimeout,
46
- MemoryError,
47
- ScopeNotFound,
48
- SpecNotFound,
49
- SpecVersionMismatch,
50
- TraceErased,
51
- TraceNotFound,
52
- VersionConflict,
53
- )
54
- from .gate import (
55
- COMMIT,
56
- PENDING,
57
- RECORD_ONLY,
58
- REJECT,
59
- Decision,
60
- GateContext,
61
- decide,
62
- )
63
- from .ingest import (
64
- Ingest,
65
- IngestOutcome,
66
- IngestResult,
67
- ReplyResult,
68
- classify_reply,
69
- resolve,
70
- )
71
- from .audit import AuditReport, Finding, audit
72
- from .consolidate import ConsolidationReport, consolidate
73
- from .phrasing import Persona, acknowledge, answer, ask, declined, describe
74
- from .recall import (
75
- FOUND,
76
- NOT_FOUND,
77
- PARTIAL,
78
- UNAVAILABLE,
79
- Budget,
80
- Recall,
81
- RecallQuery,
82
- RecallResult,
83
- )
84
- from .specs import RelationSpec, SpecRegistry
85
- from .console import make_console_safe
86
- from .memory import FuzzySearch, Memory, similarity
87
-
88
- __all__ = [
89
- # 内核
90
- "Engine", "Assertion", "CommitResult", "StateView", "StateChange",
91
- "apply_event", "canonical_json", "make_state_key", "relation_of",
92
- "SpecRegistry", "RelationSpec",
93
- # 编码
94
- "Interpretation", "RuleEncoder", "ReplayEncoder", "LLMEncoder", "parse_number",
95
- # 闸门
96
- "GateContext", "Decision", "decide", "COMMIT", "PENDING", "RECORD_ONLY", "REJECT",
97
- # 编排
98
- "Ingest", "IngestResult", "IngestOutcome", "resolve",
99
- "ReplyResult", "classify_reply",
100
- # 话术(措辞与内核分离)
101
- "Persona", "ask", "describe", "acknowledge", "declined", "answer",
102
- # 生命周期
103
- "Lifecycle", "priority",
104
- "consolidate", "ConsolidationReport",
105
- # 不变量验收(方案第七节)
106
- "audit", "AuditReport", "Finding",
107
- # 时钟(模拟"过了很久")
108
- "fixed_clock",
109
- # 读取
110
- "Recall", "RecallQuery", "RecallResult", "Budget",
111
- "FOUND", "PARTIAL", "NOT_FOUND", "UNAVAILABLE",
112
- # 三层记忆 / 重点 / 模糊搜索
113
- "Memory", "FuzzySearch", "similarity",
114
- # 控制台兜底(Windows 的 GBK 终端打不出 −/⚠/█)
115
- "make_console_safe",
116
- # 错误
117
- "MemoryError", "ScopeNotFound", "TraceNotFound", "TraceErased",
118
- "SpecNotFound", "SpecVersionMismatch", "IdempotencyConflict",
119
- "VersionConflict", "LockTimeout", "EventAlreadyVoid",
120
- "EvidenceMissing", "DependencyCycle",
121
- ]
122
-
123
- __version__ = "0.52.0"
1
+ """Xujie-Memory 内核(阶段 1–3)。
2
+
3
+ 公开入口:
4
+ Engine 提交与投影内核
5
+ Assertion 一条待提交的领域变更
6
+ SpecRegistry 关系规格注册表
7
+ RelationSpec 单条关系规格
8
+ make_state_key 状态键构造
9
+
10
+ RuleEncoder 词表 + 正则的弱编码器(跑通流程用)
11
+ ReplayEncoder 从标注样本回放(测试用)
12
+ LLMEncoder 调 OpenAI 兼容接口(可选)
13
+
14
+ Ingest 写路径编排:接收 → 编码 → 闸门 → 提交/挂起/只记录
15
+ decide 单条解释的闸门判定
16
+
17
+ 设计文档对应:v0.3 第 2、3、5、6、7、8 节。
18
+ """
19
+
20
+ from .encoder import (
21
+ Interpretation,
22
+ LLMEncoder,
23
+ ReplayEncoder,
24
+ RuleEncoder,
25
+ parse_number,
26
+ )
27
+ from .engine import (
28
+ fixed_clock,
29
+ Assertion,
30
+ CommitResult,
31
+ Engine,
32
+ StateChange,
33
+ StateView,
34
+ apply_event,
35
+ canonical_json,
36
+ make_state_key,
37
+ relation_of,
38
+ )
39
+ from .decay import Lifecycle, priority
40
+ from .errors import (
41
+ DependencyCycle,
42
+ EvidenceMissing,
43
+ EventAlreadyVoid,
44
+ IdempotencyConflict,
45
+ LockTimeout,
46
+ MemoryError,
47
+ ScopeNotFound,
48
+ SpecNotFound,
49
+ SpecVersionMismatch,
50
+ TraceErased,
51
+ TraceNotFound,
52
+ VersionConflict,
53
+ )
54
+ from .gate import (
55
+ COMMIT,
56
+ PENDING,
57
+ RECORD_ONLY,
58
+ REJECT,
59
+ Decision,
60
+ GateContext,
61
+ decide,
62
+ )
63
+ from .ingest import (
64
+ Ingest,
65
+ IngestOutcome,
66
+ IngestResult,
67
+ ReplyResult,
68
+ classify_reply,
69
+ resolve,
70
+ )
71
+ from .audit import AuditReport, Finding, audit
72
+ from .consolidate import ConsolidationReport, consolidate
73
+ from .phrasing import Persona, acknowledge, answer, ask, declined, describe
74
+ from .recall import (
75
+ FOUND,
76
+ NOT_FOUND,
77
+ PARTIAL,
78
+ UNAVAILABLE,
79
+ Budget,
80
+ Recall,
81
+ RecallQuery,
82
+ RecallResult,
83
+ )
84
+ from .specs import RelationSpec, SpecRegistry
85
+ from .console import make_console_safe
86
+ from .memory import FuzzySearch, Memory, similarity
87
+
88
+ __all__ = [
89
+ # 内核
90
+ "Engine", "Assertion", "CommitResult", "StateView", "StateChange",
91
+ "apply_event", "canonical_json", "make_state_key", "relation_of",
92
+ "SpecRegistry", "RelationSpec",
93
+ # 编码
94
+ "Interpretation", "RuleEncoder", "ReplayEncoder", "LLMEncoder", "parse_number",
95
+ # 闸门
96
+ "GateContext", "Decision", "decide", "COMMIT", "PENDING", "RECORD_ONLY", "REJECT",
97
+ # 编排
98
+ "Ingest", "IngestResult", "IngestOutcome", "resolve",
99
+ "ReplyResult", "classify_reply",
100
+ # 话术(措辞与内核分离)
101
+ "Persona", "ask", "describe", "acknowledge", "declined", "answer",
102
+ # 生命周期
103
+ "Lifecycle", "priority",
104
+ "consolidate", "ConsolidationReport",
105
+ # 不变量验收(方案第七节)
106
+ "audit", "AuditReport", "Finding",
107
+ # 时钟(模拟"过了很久")
108
+ "fixed_clock",
109
+ # 读取
110
+ "Recall", "RecallQuery", "RecallResult", "Budget",
111
+ "FOUND", "PARTIAL", "NOT_FOUND", "UNAVAILABLE",
112
+ # 三层记忆 / 重点 / 模糊搜索
113
+ "Memory", "FuzzySearch", "similarity",
114
+ # 控制台兜底(Windows 的 GBK 终端打不出 −/⚠/█)
115
+ "make_console_safe",
116
+ # 错误
117
+ "MemoryError", "ScopeNotFound", "TraceNotFound", "TraceErased",
118
+ "SpecNotFound", "SpecVersionMismatch", "IdempotencyConflict",
119
+ "VersionConflict", "LockTimeout", "EventAlreadyVoid",
120
+ "EvidenceMissing", "DependencyCycle",
121
+ ]
122
+
123
+ __version__ = "0.7.0"