dsh-plugin-xujie-memory 0.5.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.
- package/ACCEPTANCE.md +37 -0
- package/BUILD-PROVENANCE.json +53 -0
- package/CHANGELOG.md +40 -1
- package/LICENSE +21 -21
- package/README.md +67 -17
- package/README_EN.md +54 -8
- package/cordis.patch.yml +49 -49
- package/lib/client.js +17219 -0
- package/lib/controller.js +307 -0
- package/lib/index.js +200 -14
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +15104 -0
- package/lib/typert.remote-client.d.ts +40 -0
- package/lib/typert.remote-client.d.ts.map +1 -0
- package/lib/typert.remote-client.js +15093 -0
- package/lib/types.d.ts +13 -0
- package/lib/types.js +1 -0
- package/package.json +49 -5
- package/python/specs/characters/aloof.json +14 -14
- package/python/specs/characters/gentle.json +14 -14
- package/python/specs/characters/tsundere.json +14 -14
- package/python/specs/debt.v1.json +31 -31
- package/python/specs/nickname.v1.json +16 -16
- package/python/specs/preference.v1.json +16 -16
- package/python/xujie_memory/__init__.py +123 -123
- package/python/xujie_memory/admission.py +211 -211
- package/python/xujie_memory/audit.py +377 -377
- package/python/xujie_memory/benchmark.py +281 -281
- package/python/xujie_memory/character.py +199 -199
- package/python/xujie_memory/console.py +41 -41
- package/python/xujie_memory/consolidate.py +356 -356
- package/python/xujie_memory/due.py +121 -121
- package/python/xujie_memory/emotion.py +573 -573
- package/python/xujie_memory/engine.py +1333 -1312
- package/python/xujie_memory/errors.py +98 -98
- package/python/xujie_memory/importance.py +104 -104
- package/python/xujie_memory/judge.py +350 -350
- package/python/xujie_memory/management.py +203 -0
- package/python/xujie_memory/memory.py +71 -10
- package/python/xujie_memory/orchestrator.py +690 -666
- package/python/xujie_memory/phrasing.py +292 -292
- package/python/xujie_memory/privacy.py +105 -0
- package/python/xujie_memory/schema.sql +492 -480
- package/python/xujie_memory/server.py +76 -0
- package/python/xujie_memory/specs.py +170 -170
- package/python/xujie_memory/summary.py +238 -238
- package/scripts/build.mjs +19 -0
- package/scripts/prepack.mjs +9 -0
- package/scripts/test-all.mjs +9 -0
- package/scripts/test-node.mjs +10 -0
- package/src/client/MemoryPanel.tsx +536 -0
- package/src/client/NeuralField.tsx +88 -0
- package/src/client/css.d.ts +4 -0
- package/src/client/icons.tsx +28 -0
- package/src/client/index.tsx +59 -0
- package/src/client/memory-adapter.ts +67 -0
- package/src/client/model.ts +79 -0
- package/src/client/neural/engine.ts +999 -0
- package/src/client/neural/morphology.ts +219 -0
- package/src/client/panel.css +337 -0
- package/src/client/types.ts +6 -0
- package/src/controller.ts +88 -0
- package/src/generated/typert.host.js +449 -0
- package/src/generated/typert.remote-client.js +438 -0
- package/src/index.ts +2 -0
- package/src/types.ts +13 -0
- package/test/cordis-fixture.mjs +5 -0
- package/test/management_regression.py +187 -0
- package/test/node-regression.entry.mjs +52 -0
- package/vendor/DSH-LICENSE.txt +21 -0
- package/vendor/THIRD-PARTY.md +6 -0
- package/vendor/dsh-protocol/index.ts +484 -0
- package/vendor/dsh-protocol/json-value.ts +53 -0
- package/vendor/dsh-protocol/owned-value.ts +39 -0
- package/vendor/dsh-protocol/principal.ts +17 -0
- package/vendor/dsh-protocol/remote-access.ts +38 -0
- package/vendor/dsh-protocol/remote-error.ts +49 -0
- package/vendor/dsh-protocol/remote-info.ts +161 -0
- package/vendor/dsh-protocol/types.ts +939 -0
- package/vendor/licenses/jridgewell-gen-mapping-MIT.txt +19 -0
- package/vendor/licenses/jridgewell-resolve-uri-MIT.txt +19 -0
- package/vendor/licenses/jridgewell-sourcemap-codec-MIT.txt +19 -0
- package/vendor/licenses/jridgewell-trace-mapping-MIT.txt +19 -0
- 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.
|
|
4
|
-
"description": "
|
|
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
|
-
"
|
|
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,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "aloof",
|
|
3
|
-
"persona": "高冷",
|
|
4
|
-
"anger_sensitivity": 0.8,
|
|
5
|
-
"anger_half_life_days": 0.5,
|
|
6
|
-
"sadness_half_life_days": 5.0,
|
|
7
|
-
"trust_damage": 1.2,
|
|
8
|
-
"trust_repair": 1.0,
|
|
9
|
-
"speak_first": false,
|
|
10
|
-
"hold_words": false,
|
|
11
|
-
"demand_explanation": true,
|
|
12
|
-
"intensity": "normal",
|
|
13
|
-
"note": "不容易被激怒(0.8),但一旦掉信任就掉得更多(1.2)。不主动开口,也不需要嘴硬——隔阂本身就是态度。"
|
|
14
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "aloof",
|
|
3
|
+
"persona": "高冷",
|
|
4
|
+
"anger_sensitivity": 0.8,
|
|
5
|
+
"anger_half_life_days": 0.5,
|
|
6
|
+
"sadness_half_life_days": 5.0,
|
|
7
|
+
"trust_damage": 1.2,
|
|
8
|
+
"trust_repair": 1.0,
|
|
9
|
+
"speak_first": false,
|
|
10
|
+
"hold_words": false,
|
|
11
|
+
"demand_explanation": true,
|
|
12
|
+
"intensity": "normal",
|
|
13
|
+
"note": "不容易被激怒(0.8),但一旦掉信任就掉得更多(1.2)。不主动开口,也不需要嘴硬——隔阂本身就是态度。"
|
|
14
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "gentle",
|
|
3
|
-
"persona": "温柔",
|
|
4
|
-
"anger_sensitivity": 0.5,
|
|
5
|
-
"anger_half_life_days": 1.0,
|
|
6
|
-
"sadness_half_life_days": 2.0,
|
|
7
|
-
"trust_damage": 0.8,
|
|
8
|
-
"trust_repair": 1.3,
|
|
9
|
-
"speak_first": true,
|
|
10
|
-
"hold_words": false,
|
|
11
|
-
"demand_explanation": false,
|
|
12
|
-
"intensity": "soft",
|
|
13
|
-
"note": "同样被冒犯,气只有别人一半(0.5);修复时回得更多(1.3)。会主动开口把话说开。"
|
|
14
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "gentle",
|
|
3
|
+
"persona": "温柔",
|
|
4
|
+
"anger_sensitivity": 0.5,
|
|
5
|
+
"anger_half_life_days": 1.0,
|
|
6
|
+
"sadness_half_life_days": 2.0,
|
|
7
|
+
"trust_damage": 0.8,
|
|
8
|
+
"trust_repair": 1.3,
|
|
9
|
+
"speak_first": true,
|
|
10
|
+
"hold_words": false,
|
|
11
|
+
"demand_explanation": false,
|
|
12
|
+
"intensity": "soft",
|
|
13
|
+
"note": "同样被冒犯,气只有别人一半(0.5);修复时回得更多(1.3)。会主动开口把话说开。"
|
|
14
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tsundere",
|
|
3
|
-
"persona": "傲娇",
|
|
4
|
-
"anger_sensitivity": 1.3,
|
|
5
|
-
"anger_half_life_days": 0.5,
|
|
6
|
-
"sadness_half_life_days": 3.0,
|
|
7
|
-
"trust_damage": 1.0,
|
|
8
|
-
"trust_repair": 0.8,
|
|
9
|
-
"speak_first": false,
|
|
10
|
-
"hold_words": true,
|
|
11
|
-
"demand_explanation": true,
|
|
12
|
-
"intensity": "sharp",
|
|
13
|
-
"note": "气来得快去得也快(半衰期半天),但嘴上不肯先软。信任修得慢——0.8 的修复乘数意味着同样的和解,她只回八成。"
|
|
14
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "tsundere",
|
|
3
|
+
"persona": "傲娇",
|
|
4
|
+
"anger_sensitivity": 1.3,
|
|
5
|
+
"anger_half_life_days": 0.5,
|
|
6
|
+
"sadness_half_life_days": 3.0,
|
|
7
|
+
"trust_damage": 1.0,
|
|
8
|
+
"trust_repair": 0.8,
|
|
9
|
+
"speak_first": false,
|
|
10
|
+
"hold_words": true,
|
|
11
|
+
"demand_explanation": true,
|
|
12
|
+
"intensity": "sharp",
|
|
13
|
+
"note": "气来得快去得也快(半衰期半天),但嘴上不肯先软。信任修得慢——0.8 的修复乘数意味着同样的和解,她只回八成。"
|
|
14
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"relation": "debt",
|
|
3
|
-
"version": "1",
|
|
4
|
-
"risk_tier": "R2",
|
|
5
|
-
"required_slots": [
|
|
6
|
-
"debtor",
|
|
7
|
-
"creditor",
|
|
8
|
-
"item",
|
|
9
|
-
"quantity"
|
|
10
|
-
],
|
|
11
|
-
"allowed_modalities": [
|
|
12
|
-
"asserted",
|
|
13
|
-
"request"
|
|
14
|
-
],
|
|
15
|
-
"writers": [
|
|
16
|
-
"debtor",
|
|
17
|
-
"creditor"
|
|
18
|
-
],
|
|
19
|
-
"effect_kind": "delta",
|
|
20
|
-
"admission_mode": "assisted",
|
|
21
|
-
"value_type": "number",
|
|
22
|
-
"unit": null,
|
|
23
|
-
"allow_negative": false,
|
|
24
|
-
"confirmation": "explicit",
|
|
25
|
-
"validity": "permanent",
|
|
26
|
-
"conflict_policy": "dispute",
|
|
27
|
-
"feeds": [],
|
|
28
|
-
"derived_from": [],
|
|
29
|
-
"note": "游戏内债务。建立用 set,偿还与免除用 delta(-)。余额不得为负;累计偿付量参与修正校验。unit 不是必填,也不固定在规格里:债务可以是米、书、金币,单位由对话决定(eval 时通过上下文 unit_hint 提供)。口语里「三十」不说单位,把它当必填只会把正常句子挂起。给了但与规格不符时,由内核判 disputed。 允许 request:免除在语用上多是请求(「给我免三碗」),不是陈述事实。请求仍走 explicit 确认。 【准入决策】永久 assisted,不是\"等指标变好再升\":(1)实测准确率约 48%(EXPERIMENT §36–39),(2)R2 的错误代价不对称——多问一句是打扰,少问一句是记错钱,(3)错误集中在\"承诺 vs 已发生\"和\"疑问句确认\"两类高频语用(XM-21/22),那是能力边界,不是调参能解决的。",
|
|
30
|
-
"conservation": "repayment"
|
|
31
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"relation": "debt",
|
|
3
|
+
"version": "1",
|
|
4
|
+
"risk_tier": "R2",
|
|
5
|
+
"required_slots": [
|
|
6
|
+
"debtor",
|
|
7
|
+
"creditor",
|
|
8
|
+
"item",
|
|
9
|
+
"quantity"
|
|
10
|
+
],
|
|
11
|
+
"allowed_modalities": [
|
|
12
|
+
"asserted",
|
|
13
|
+
"request"
|
|
14
|
+
],
|
|
15
|
+
"writers": [
|
|
16
|
+
"debtor",
|
|
17
|
+
"creditor"
|
|
18
|
+
],
|
|
19
|
+
"effect_kind": "delta",
|
|
20
|
+
"admission_mode": "assisted",
|
|
21
|
+
"value_type": "number",
|
|
22
|
+
"unit": null,
|
|
23
|
+
"allow_negative": false,
|
|
24
|
+
"confirmation": "explicit",
|
|
25
|
+
"validity": "permanent",
|
|
26
|
+
"conflict_policy": "dispute",
|
|
27
|
+
"feeds": [],
|
|
28
|
+
"derived_from": [],
|
|
29
|
+
"note": "游戏内债务。建立用 set,偿还与免除用 delta(-)。余额不得为负;累计偿付量参与修正校验。unit 不是必填,也不固定在规格里:债务可以是米、书、金币,单位由对话决定(eval 时通过上下文 unit_hint 提供)。口语里「三十」不说单位,把它当必填只会把正常句子挂起。给了但与规格不符时,由内核判 disputed。 允许 request:免除在语用上多是请求(「给我免三碗」),不是陈述事实。请求仍走 explicit 确认。 【准入决策】永久 assisted,不是\"等指标变好再升\":(1)实测准确率约 48%(EXPERIMENT §36–39),(2)R2 的错误代价不对称——多问一句是打扰,少问一句是记错钱,(3)错误集中在\"承诺 vs 已发生\"和\"疑问句确认\"两类高频语用(XM-21/22),那是能力边界,不是调参能解决的。",
|
|
30
|
+
"conservation": "repayment"
|
|
31
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"relation": "nickname",
|
|
3
|
-
"version": "1",
|
|
4
|
-
"risk_tier": "R1",
|
|
5
|
-
"required_slots": ["subject", "value"],
|
|
6
|
-
"allowed_modalities": ["asserted"],
|
|
7
|
-
"writers": ["subject"],
|
|
8
|
-
"effect_kind": "set",
|
|
9
|
-
"admission_mode": "auto",
|
|
10
|
-
"value_type": "string",
|
|
11
|
-
"allow_negative": false,
|
|
12
|
-
"confirmation": "implicit",
|
|
13
|
-
"validity": "permanent",
|
|
14
|
-
"conflict_policy": "last_write_wins",
|
|
15
|
-
"note": "称呼属于身份设定。v0.52 起用户明说「叫我X」直接生效(宿主没有确认交互,挂起等于永远记不住);改口按 last_write_wins 覆盖。"
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"relation": "nickname",
|
|
3
|
+
"version": "1",
|
|
4
|
+
"risk_tier": "R1",
|
|
5
|
+
"required_slots": ["subject", "value"],
|
|
6
|
+
"allowed_modalities": ["asserted"],
|
|
7
|
+
"writers": ["subject"],
|
|
8
|
+
"effect_kind": "set",
|
|
9
|
+
"admission_mode": "auto",
|
|
10
|
+
"value_type": "string",
|
|
11
|
+
"allow_negative": false,
|
|
12
|
+
"confirmation": "implicit",
|
|
13
|
+
"validity": "permanent",
|
|
14
|
+
"conflict_policy": "last_write_wins",
|
|
15
|
+
"note": "称呼属于身份设定。v0.52 起用户明说「叫我X」直接生效(宿主没有确认交互,挂起等于永远记不住);改口按 last_write_wins 覆盖。"
|
|
16
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"relation": "preference",
|
|
3
|
-
"version": "1",
|
|
4
|
-
"risk_tier": "R0",
|
|
5
|
-
"required_slots": ["subject", "object"],
|
|
6
|
-
"allowed_modalities": ["asserted"],
|
|
7
|
-
"writers": ["subject"],
|
|
8
|
-
"effect_kind": "set",
|
|
9
|
-
"admission_mode": "auto",
|
|
10
|
-
"value_type": "string",
|
|
11
|
-
"allow_negative": false,
|
|
12
|
-
"confirmation": "implicit",
|
|
13
|
-
"validity": "permanent",
|
|
14
|
-
"conflict_policy": "last_write_wins",
|
|
15
|
-
"note": "低影响偏好,错误代价低、可随时纠正。"
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"relation": "preference",
|
|
3
|
+
"version": "1",
|
|
4
|
+
"risk_tier": "R0",
|
|
5
|
+
"required_slots": ["subject", "object"],
|
|
6
|
+
"allowed_modalities": ["asserted"],
|
|
7
|
+
"writers": ["subject"],
|
|
8
|
+
"effect_kind": "set",
|
|
9
|
+
"admission_mode": "auto",
|
|
10
|
+
"value_type": "string",
|
|
11
|
+
"allow_negative": false,
|
|
12
|
+
"confirmation": "implicit",
|
|
13
|
+
"validity": "permanent",
|
|
14
|
+
"conflict_policy": "last_write_wins",
|
|
15
|
+
"note": "低影响偏好,错误代价低、可随时纠正。"
|
|
16
|
+
}
|
|
@@ -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.
|
|
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"
|