dsh-layered-memory 0.8.0 → 0.8.2
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.en.md +54 -11
- package/README.md +51 -9
- package/assets/readme/bench-dialog.svg +87 -0
- package/assets/readme/bench-workflow.svg +79 -0
- package/assets/readme/flow.svg +74 -74
- package/assets/readme/storage.svg +56 -56
- package/dist/client.js +369 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -3
- package/dist/llm.d.ts +15 -0
- package/dist/llm.js +16 -0
- package/dist/pipeline/l1.js +3 -3
- package/dist/pipeline/l2.js +2 -2
- package/dist/pipeline/l3.js +2 -2
- package/dist/pipeline/rebuild.js +2 -2
- package/dist/pipeline/runner.d.ts +9 -3
- package/dist/pipeline/runner.js +37 -4
- package/dist/settings.d.ts +14 -0
- package/dist/settings.js +41 -2
- package/dist/stats.js +113 -1
- package/dist/store/download-queue.d.ts +35 -2
- package/dist/store/download-queue.js +102 -5
- package/dist/store/model-catalog.js +1 -1
- package/package.json +14 -12
package/assets/readme/flow.svg
CHANGED
|
@@ -7,183 +7,183 @@
|
|
|
7
7
|
|
|
8
8
|
<defs>
|
|
9
9
|
<marker id="arr-teal" markerWidth="9" markerHeight="9" refX="7" refY="4" orient="auto">
|
|
10
|
-
<path d="M0 0 L8 4 L0 8 Z" fill="#
|
|
10
|
+
<path d="M0 0 L8 4 L0 8 Z" fill="#FFD15D"/>
|
|
11
11
|
</marker>
|
|
12
12
|
<marker id="arr-orange" markerWidth="9" markerHeight="9" refX="7" refY="4" orient="auto">
|
|
13
|
-
<path d="M0 0 L8 4 L0 8 Z" fill="#
|
|
13
|
+
<path d="M0 0 L8 4 L0 8 Z" fill="#7FA6E3"/>
|
|
14
14
|
</marker>
|
|
15
15
|
</defs>
|
|
16
16
|
|
|
17
|
-
<rect width="1200" height="600" rx="26" fill="#
|
|
17
|
+
<rect width="1200" height="600" rx="26" fill="#0D1526"/>
|
|
18
18
|
|
|
19
19
|
<g font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">
|
|
20
20
|
|
|
21
21
|
<!-- ── 图例 ── -->
|
|
22
|
-
<circle cx="72" cy="58" r="5" fill="#
|
|
23
|
-
<text x="86" y="64" font-size="18" fill="#
|
|
24
|
-
<circle cx="250" cy="58" r="5" fill="#
|
|
25
|
-
<text x="264" y="64" font-size="18" fill="#
|
|
22
|
+
<circle cx="72" cy="58" r="5" fill="#FFD15D"/>
|
|
23
|
+
<text x="86" y="64" font-size="18" fill="#C2CDDE">捕获 / 写入</text>
|
|
24
|
+
<circle cx="250" cy="58" r="5" fill="#7FA6E3"/>
|
|
25
|
+
<text x="264" y="64" font-size="18" fill="#C2CDDE">召回 / 注入</text>
|
|
26
26
|
|
|
27
27
|
<!-- ── 左列:User ── -->
|
|
28
28
|
<g id="node-user">
|
|
29
|
-
<rect x="64" y="120" width="190" height="92" rx="16" fill="#
|
|
30
|
-
<circle cx="102" cy="152" r="9" fill="none" stroke="#
|
|
31
|
-
<path d="M86 182 a16 16 0 0 1 32 0" fill="none" stroke="#
|
|
32
|
-
<text x="126" y="162" font-size="20" font-weight="700" fill="#
|
|
33
|
-
<text x="126" y="188" font-size="18" fill="#
|
|
29
|
+
<rect x="64" y="120" width="190" height="92" rx="16" fill="#15223A" stroke="#263A5C" stroke-width="1.5"/>
|
|
30
|
+
<circle cx="102" cy="152" r="9" fill="none" stroke="#8296B3" stroke-width="2"/>
|
|
31
|
+
<path d="M86 182 a16 16 0 0 1 32 0" fill="none" stroke="#8296B3" stroke-width="2"/>
|
|
32
|
+
<text x="126" y="162" font-size="20" font-weight="700" fill="#EFF3FA">User</text>
|
|
33
|
+
<text x="126" y="188" font-size="18" fill="#8296B3">用户消息</text>
|
|
34
34
|
</g>
|
|
35
35
|
|
|
36
36
|
<!-- ── 左列:Assistant ── -->
|
|
37
37
|
<g id="node-assistant">
|
|
38
|
-
<rect x="64" y="348" width="190" height="92" rx="16" fill="#
|
|
39
|
-
<path d="M102 376 L106 390 L120 394 L106 398 L102 412 L98 398 L84 394 L98 390 Z" fill="#
|
|
40
|
-
<text x="126" y="392" font-size="20" font-weight="700" fill="#
|
|
41
|
-
<text x="126" y="418" font-size="18" fill="#
|
|
38
|
+
<rect x="64" y="348" width="190" height="92" rx="16" fill="#15223A" stroke="#263A5C" stroke-width="1.5"/>
|
|
39
|
+
<path d="M102 376 L106 390 L120 394 L106 398 L102 412 L98 398 L84 394 L98 390 Z" fill="#8296B3"/>
|
|
40
|
+
<text x="126" y="392" font-size="20" font-weight="700" fill="#EFF3FA">Assistant</text>
|
|
41
|
+
<text x="126" y="418" font-size="18" fill="#8296B3">助手回复</text>
|
|
42
42
|
</g>
|
|
43
43
|
|
|
44
44
|
<!-- ── 中列:插件 ── -->
|
|
45
45
|
<g id="node-plugin">
|
|
46
|
-
<rect x="430" y="96" width="290" height="356" rx="18" fill="#
|
|
46
|
+
<rect x="430" y="96" width="290" height="356" rx="18" fill="#15223A" stroke="#FFD15D" stroke-opacity="0.55" stroke-width="1.5"/>
|
|
47
47
|
<text x="575" y="138" text-anchor="middle" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
48
|
-
font-size="22" font-weight="700" fill="#
|
|
49
|
-
<text x="575" y="166" text-anchor="middle" font-size="18" fill="#
|
|
48
|
+
font-size="22" font-weight="700" fill="#EFF3FA">dsh-layered-memory</text>
|
|
49
|
+
<text x="575" y="166" text-anchor="middle" font-size="18" fill="#8296B3">分层蒸馏记忆插件</text>
|
|
50
50
|
|
|
51
51
|
<g id="plugin-modules">
|
|
52
|
-
<rect x="452" y="188" width="246" height="46" rx="10" fill="#
|
|
53
|
-
<circle cx="470" cy="211" r="4" fill="#
|
|
54
|
-
<text x="486" y="218" font-size="19" fill="#
|
|
52
|
+
<rect x="452" y="188" width="246" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
53
|
+
<circle cx="470" cy="211" r="4" fill="#FFD15D"/>
|
|
54
|
+
<text x="486" y="218" font-size="19" fill="#EFF3FA">L0 捕获 capture</text>
|
|
55
55
|
|
|
56
|
-
<rect x="452" y="244" width="246" height="46" rx="10" fill="#
|
|
57
|
-
<circle cx="470" cy="267" r="4" fill="#
|
|
58
|
-
<text x="486" y="274" font-size="19" fill="#
|
|
56
|
+
<rect x="452" y="244" width="246" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
57
|
+
<circle cx="470" cy="267" r="4" fill="#FFD15D"/>
|
|
58
|
+
<text x="486" y="274" font-size="19" fill="#EFF3FA">L1–L3 蒸馏 distill</text>
|
|
59
59
|
|
|
60
|
-
<rect x="452" y="300" width="246" height="46" rx="10" fill="#
|
|
61
|
-
<circle cx="470" cy="323" r="4" fill="#
|
|
62
|
-
<text x="486" y="330" font-size="19" fill="#
|
|
60
|
+
<rect x="452" y="300" width="246" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
61
|
+
<circle cx="470" cy="323" r="4" fill="#FFD15D"/>
|
|
62
|
+
<text x="486" y="330" font-size="19" fill="#EFF3FA">检索召回 · 三策略</text>
|
|
63
63
|
|
|
64
|
-
<rect x="452" y="356" width="246" height="46" rx="10" fill="#
|
|
65
|
-
<circle cx="470" cy="379" r="4" fill="#
|
|
66
|
-
<text x="486" y="386" font-size="19" fill="#
|
|
64
|
+
<rect x="452" y="356" width="246" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
65
|
+
<circle cx="470" cy="379" r="4" fill="#FFD15D"/>
|
|
66
|
+
<text x="486" y="386" font-size="19" fill="#EFF3FA">记忆工具 ×3</text>
|
|
67
67
|
</g>
|
|
68
68
|
</g>
|
|
69
69
|
|
|
70
70
|
<!-- ── 存储条 ── -->
|
|
71
71
|
<g id="node-storage">
|
|
72
|
-
<path id="sto-write" d="M545 456 V482" stroke="#
|
|
73
|
-
<path id="sto-read" d="M605 482 V456" stroke="#
|
|
74
|
-
<text x="531" y="472" text-anchor="end" font-size="16" fill="#
|
|
75
|
-
<text x="619" y="472" font-size="16" fill="#
|
|
76
|
-
<circle r="3.5" fill="#
|
|
72
|
+
<path id="sto-write" d="M545 456 V482" stroke="#FFD15D" stroke-width="2.5" fill="none" marker-end="url(#arr-teal)"/>
|
|
73
|
+
<path id="sto-read" d="M605 482 V456" stroke="#7FA6E3" stroke-width="2.5" fill="none" marker-end="url(#arr-orange)"/>
|
|
74
|
+
<text x="531" y="472" text-anchor="end" font-size="16" fill="#FFD15D">写</text>
|
|
75
|
+
<text x="619" y="472" font-size="16" fill="#7FA6E3">读</text>
|
|
76
|
+
<circle r="3.5" fill="#FFD15D" cx="545" cy="470">
|
|
77
77
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
78
78
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
79
79
|
<animateMotion dur="1.6s" begin="0s" repeatCount="indefinite"><mpath href="#sto-write" xlink:href="#sto-write"/></animateMotion>
|
|
80
80
|
</circle>
|
|
81
|
-
<circle r="3.5" fill="#
|
|
81
|
+
<circle r="3.5" fill="#7FA6E3" cx="605" cy="468">
|
|
82
82
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
83
83
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
84
84
|
<animateMotion dur="1.6s" begin="-0.8s" repeatCount="indefinite"><mpath href="#sto-read" xlink:href="#sto-read"/></animateMotion>
|
|
85
85
|
</circle>
|
|
86
86
|
|
|
87
|
-
<rect x="430" y="486" width="290" height="54" rx="12" fill="#
|
|
87
|
+
<rect x="430" y="486" width="290" height="54" rx="12" fill="#101B30" stroke="#263A5C" stroke-dasharray="6 4"/>
|
|
88
88
|
<text x="575" y="509" text-anchor="middle" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
89
|
-
font-size="18" fill="#
|
|
89
|
+
font-size="18" fill="#FFD15D">~/.dsh/memory/</text>
|
|
90
90
|
<text x="575" y="531" text-anchor="middle" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
91
|
-
font-size="16" fill="#
|
|
91
|
+
font-size="16" fill="#6E82A3">memory.db · JSONL · Markdown</text>
|
|
92
92
|
</g>
|
|
93
93
|
|
|
94
94
|
<!-- ── 右列:DSH 核心 ── -->
|
|
95
95
|
<g id="node-core">
|
|
96
|
-
<rect x="920" y="96" width="216" height="356" rx="18" fill="#
|
|
97
|
-
<text x="1028" y="138" text-anchor="middle" font-size="22" font-weight="700" fill="#
|
|
96
|
+
<rect x="920" y="96" width="216" height="356" rx="18" fill="#15223A" stroke="#263A5C" stroke-width="1.5"/>
|
|
97
|
+
<text x="1028" y="138" text-anchor="middle" font-size="22" font-weight="700" fill="#EFF3FA">DSH 核心</text>
|
|
98
98
|
<text x="1028" y="166" text-anchor="middle" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
99
|
-
font-size="18" fill="#
|
|
99
|
+
font-size="18" fill="#8296B3">DeepSeek Harness</text>
|
|
100
100
|
|
|
101
101
|
<g id="core-modules">
|
|
102
|
-
<rect x="936" y="188" width="184" height="46" rx="10" fill="#
|
|
103
|
-
<circle cx="954" cy="211" r="4" fill="#
|
|
104
|
-
<text x="970" y="218" font-size="19" fill="#
|
|
102
|
+
<rect x="936" y="188" width="184" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
103
|
+
<circle cx="954" cy="211" r="4" fill="#7FA6E3"/>
|
|
104
|
+
<text x="970" y="218" font-size="19" fill="#EFF3FA">agent 循环</text>
|
|
105
105
|
|
|
106
|
-
<rect x="936" y="244" width="184" height="46" rx="10" fill="#
|
|
107
|
-
<circle cx="954" cy="267" r="4" fill="#
|
|
108
|
-
<text x="970" y="274" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="19" fill="#
|
|
106
|
+
<rect x="936" y="244" width="184" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
107
|
+
<circle cx="954" cy="267" r="4" fill="#7FA6E3"/>
|
|
108
|
+
<text x="970" y="274" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="19" fill="#EFF3FA">ctx.llm</text>
|
|
109
109
|
|
|
110
|
-
<rect x="936" y="300" width="184" height="46" rx="10" fill="#
|
|
111
|
-
<circle cx="954" cy="323" r="4" fill="#
|
|
112
|
-
<text x="970" y="330" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="19" fill="#
|
|
110
|
+
<rect x="936" y="300" width="184" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
111
|
+
<circle cx="954" cy="323" r="4" fill="#7FA6E3"/>
|
|
112
|
+
<text x="970" y="330" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="19" fill="#EFF3FA">systemPrompt</text>
|
|
113
113
|
|
|
114
|
-
<rect x="936" y="356" width="184" height="46" rx="10" fill="#
|
|
115
|
-
<circle cx="954" cy="379" r="4" fill="#
|
|
116
|
-
<text x="970" y="386" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="19" fill="#
|
|
114
|
+
<rect x="936" y="356" width="184" height="46" rx="10" fill="#101B30" stroke="#263A5C"/>
|
|
115
|
+
<circle cx="954" cy="379" r="4" fill="#7FA6E3"/>
|
|
116
|
+
<text x="970" y="386" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="19" fill="#EFF3FA">tools·settings</text>
|
|
117
117
|
</g>
|
|
118
118
|
</g>
|
|
119
119
|
|
|
120
120
|
<!-- ── 连接 1:User → 插件(捕获) ── -->
|
|
121
|
-
<path id="cap-user" d="M254 166 H430" stroke="#
|
|
122
|
-
<text x="342" y="142" text-anchor="middle" font-size="18" fill="#
|
|
123
|
-
<circle r="4" fill="#
|
|
121
|
+
<path id="cap-user" d="M254 166 H430" stroke="#FFD15D" stroke-width="2.5" fill="none" marker-end="url(#arr-teal)"/>
|
|
122
|
+
<text x="342" y="142" text-anchor="middle" font-size="18" fill="#C2CDDE">对话输入</text>
|
|
123
|
+
<circle r="4" fill="#FFD15D" cx="320" cy="166">
|
|
124
124
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
125
125
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
126
126
|
<animateMotion dur="2.4s" begin="0s" repeatCount="indefinite"><mpath href="#cap-user" xlink:href="#cap-user"/></animateMotion>
|
|
127
127
|
</circle>
|
|
128
|
-
<circle r="4" fill="#
|
|
128
|
+
<circle r="4" fill="#FFD15D" opacity="0.7" cx="368" cy="166">
|
|
129
129
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
130
130
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
131
131
|
<animateMotion dur="2.4s" begin="-1.2s" repeatCount="indefinite"><mpath href="#cap-user" xlink:href="#cap-user"/></animateMotion>
|
|
132
132
|
</circle>
|
|
133
133
|
|
|
134
134
|
<!-- ── 连接 2:Assistant → 插件(捕获) ── -->
|
|
135
|
-
<path id="cap-asst" d="M254 394 H430" stroke="#
|
|
136
|
-
<text x="342" y="370" text-anchor="middle" font-size="18" fill="#
|
|
137
|
-
<circle r="4" fill="#
|
|
135
|
+
<path id="cap-asst" d="M254 394 H430" stroke="#FFD15D" stroke-width="2.5" fill="none" marker-end="url(#arr-teal)"/>
|
|
136
|
+
<text x="342" y="370" text-anchor="middle" font-size="18" fill="#C2CDDE">回复捕获</text>
|
|
137
|
+
<circle r="4" fill="#FFD15D" cx="320" cy="394">
|
|
138
138
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
139
139
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
140
140
|
<animateMotion dur="2.4s" begin="-0.6s" repeatCount="indefinite"><mpath href="#cap-asst" xlink:href="#cap-asst"/></animateMotion>
|
|
141
141
|
</circle>
|
|
142
|
-
<circle r="4" fill="#
|
|
142
|
+
<circle r="4" fill="#FFD15D" opacity="0.7" cx="368" cy="394">
|
|
143
143
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
144
144
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
145
145
|
<animateMotion dur="2.4s" begin="-1.8s" repeatCount="indefinite"><mpath href="#cap-asst" xlink:href="#cap-asst"/></animateMotion>
|
|
146
146
|
</circle>
|
|
147
147
|
|
|
148
148
|
<!-- ── 连接 3:插件 → 核心(召回注入) ── -->
|
|
149
|
-
<path id="flow-recall" d="M720 192 L920 214" stroke="#
|
|
150
|
-
<text x="820" y="166" text-anchor="middle" font-size="18" fill="#
|
|
151
|
-
<circle r="3.5" fill="#
|
|
149
|
+
<path id="flow-recall" d="M720 192 L920 214" stroke="#7FA6E3" stroke-width="2.5" fill="none" marker-end="url(#arr-orange)"/>
|
|
150
|
+
<text x="820" y="166" text-anchor="middle" font-size="18" fill="#7FA6E3">召回注入 pre-step</text>
|
|
151
|
+
<circle r="3.5" fill="#7FA6E3" cx="770" cy="198">
|
|
152
152
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
153
153
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
154
154
|
<animateMotion dur="2.4s" begin="0s" repeatCount="indefinite"><mpath href="#flow-recall" xlink:href="#flow-recall"/></animateMotion>
|
|
155
155
|
</circle>
|
|
156
|
-
<circle r="3.5" fill="#
|
|
156
|
+
<circle r="3.5" fill="#7FA6E3" cx="815" cy="202.5">
|
|
157
157
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
158
158
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
159
159
|
<animateMotion dur="2.4s" begin="-0.8s" repeatCount="indefinite"><mpath href="#flow-recall" xlink:href="#flow-recall"/></animateMotion>
|
|
160
160
|
</circle>
|
|
161
|
-
<circle r="3.5" fill="#
|
|
161
|
+
<circle r="3.5" fill="#7FA6E3" cx="860" cy="207">
|
|
162
162
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
163
163
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
164
164
|
<animateMotion dur="2.4s" begin="-1.6s" repeatCount="indefinite"><mpath href="#flow-recall" xlink:href="#flow-recall"/></animateMotion>
|
|
165
165
|
</circle>
|
|
166
166
|
|
|
167
167
|
<!-- ── 连接 4:核心 → 插件(蒸馏复用 LLM) ── -->
|
|
168
|
-
<path id="flow-distill" d="M920 320 L720 342" stroke="#
|
|
169
|
-
<text x="820" y="374" text-anchor="middle" font-size="18" fill="#
|
|
170
|
-
<circle r="3.5" fill="#
|
|
168
|
+
<path id="flow-distill" d="M920 320 L720 342" stroke="#FFD15D" stroke-width="2.5" fill="none" marker-end="url(#arr-teal)"/>
|
|
169
|
+
<text x="820" y="374" text-anchor="middle" font-size="18" fill="#FFD15D">蒸馏复用 ctx.llm</text>
|
|
170
|
+
<circle r="3.5" fill="#FFD15D" cx="865" cy="327">
|
|
171
171
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
172
172
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
173
173
|
<animateMotion dur="2.4s" begin="-0.4s" repeatCount="indefinite"><mpath href="#flow-distill" xlink:href="#flow-distill"/></animateMotion>
|
|
174
174
|
</circle>
|
|
175
|
-
<circle r="3.5" fill="#
|
|
175
|
+
<circle r="3.5" fill="#FFD15D" cx="820" cy="331">
|
|
176
176
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
177
177
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
178
178
|
<animateMotion dur="2.4s" begin="-1.2s" repeatCount="indefinite"><mpath href="#flow-distill" xlink:href="#flow-distill"/></animateMotion>
|
|
179
179
|
</circle>
|
|
180
|
-
<circle r="3.5" fill="#
|
|
180
|
+
<circle r="3.5" fill="#FFD15D" cx="775" cy="335">
|
|
181
181
|
<animate attributeName="cx" to="0" dur="1ms" fill="freeze"/>
|
|
182
182
|
<animate attributeName="cy" to="0" dur="1ms" fill="freeze"/>
|
|
183
183
|
<animateMotion dur="2.4s" begin="-2s" repeatCount="indefinite"><mpath href="#flow-distill" xlink:href="#flow-distill"/></animateMotion>
|
|
184
184
|
</circle>
|
|
185
185
|
|
|
186
186
|
<!-- ── 底注 ── -->
|
|
187
|
-
<text x="600" y="576" text-anchor="middle" font-size="18" fill="#
|
|
187
|
+
<text x="600" y="576" text-anchor="middle" font-size="18" fill="#8296B3">事件缝 session/event · 注入缝 agent/pre-step + systemPrompt.context · 全程无感,用户与模型零操作</text>
|
|
188
188
|
</g>
|
|
189
189
|
</svg>
|
|
@@ -4,112 +4,112 @@
|
|
|
4
4
|
<title id="storageTitle">存储布局与检索</title>
|
|
5
5
|
<desc id="storageDesc">双写架构:JSONL 按天追加只增不改(事实源),memory.db 为主检索引擎。文件形态含 conversations、records、scenes、persona、state、pending、session-modes、embedding-source、models、runtime、日志与重建归档;检索三策略 keyword/embedding/hybrid(RRF k=60 融合);嵌入源三态 off/remote/local(生效 = 部署上限 AND 运行时选择);降级链保证永不阻塞宿主,唯一检索缝为 L1Store.search()。</desc>
|
|
6
6
|
|
|
7
|
-
<rect width="1200" height="800" rx="26" fill="#
|
|
7
|
+
<rect width="1200" height="800" rx="26" fill="#0D1526"/>
|
|
8
8
|
|
|
9
9
|
<g font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">
|
|
10
10
|
|
|
11
11
|
<!-- ── 双写架构 ── -->
|
|
12
|
-
<rect x="64" y="56" width="1072" height="56" rx="14" fill="#
|
|
13
|
-
<text x="600" y="91" text-anchor="middle" font-size="20" fill="#
|
|
12
|
+
<rect x="64" y="56" width="1072" height="56" rx="14" fill="#15223A" stroke="#263A5C" stroke-width="1.5"/>
|
|
13
|
+
<text x="600" y="91" text-anchor="middle" font-size="20" fill="#EFF3FA">双写架构:JSONL 按天追加、只增不改(备份 / 恢复事实源)· memory.db 主检索引擎(去重合并只动检索库)</text>
|
|
14
14
|
|
|
15
15
|
<!-- ── 左:文件形态 ── -->
|
|
16
16
|
<g id="files">
|
|
17
|
-
<rect x="64" y="140" width="560" height="610" rx="16" fill="#
|
|
17
|
+
<rect x="64" y="140" width="560" height="610" rx="16" fill="#101B30" stroke="#263A5C" stroke-width="1.5"/>
|
|
18
18
|
<text x="92" y="176" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
19
|
-
font-size="18" fill="#
|
|
19
|
+
font-size="18" fill="#FFD15D">文件形态 · ~/.dsh/memory/</text>
|
|
20
20
|
|
|
21
21
|
<g font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18">
|
|
22
|
-
<text x="92" y="210" fill="#
|
|
23
|
-
<text x="352" y="210" fill="#
|
|
22
|
+
<text x="92" y="210" fill="#EFF3FA">memory.db</text>
|
|
23
|
+
<text x="352" y="210" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">SQLite 检索库 · FTS5+向量</text>
|
|
24
24
|
|
|
25
|
-
<text x="92" y="252" fill="#
|
|
26
|
-
<text x="352" y="252" fill="#
|
|
25
|
+
<text x="92" y="252" fill="#EFF3FA">conversations/*.jsonl</text>
|
|
26
|
+
<text x="352" y="252" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">L0 事实源 · 只增不改</text>
|
|
27
27
|
|
|
28
|
-
<text x="92" y="294" fill="#
|
|
29
|
-
<text x="352" y="294" fill="#
|
|
28
|
+
<text x="92" y="294" fill="#EFF3FA">records/*.jsonl</text>
|
|
29
|
+
<text x="352" y="294" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">L1 事实源 · 含 family</text>
|
|
30
30
|
|
|
31
|
-
<text x="92" y="336" fill="#
|
|
32
|
-
<text x="352" y="336" fill="#
|
|
31
|
+
<text x="92" y="336" fill="#EFF3FA">scenes/<family>/*.md</text>
|
|
32
|
+
<text x="352" y="336" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">L2 场景块 · 按族</text>
|
|
33
33
|
|
|
34
|
-
<text x="92" y="378" fill="#
|
|
35
|
-
<text x="352" y="378" fill="#
|
|
34
|
+
<text x="92" y="378" fill="#EFF3FA">persona-<family>.md</text>
|
|
35
|
+
<text x="352" y="378" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">L3 画像 · 每族一份</text>
|
|
36
36
|
|
|
37
|
-
<text x="92" y="420" fill="#
|
|
38
|
-
<text x="352" y="420" fill="#
|
|
37
|
+
<text x="92" y="420" fill="#EFF3FA">state.json</text>
|
|
38
|
+
<text x="352" y="420" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">checkpoint · v2 分族</text>
|
|
39
39
|
|
|
40
|
-
<text x="92" y="462" fill="#
|
|
41
|
-
<text x="352" y="462" fill="#
|
|
40
|
+
<text x="92" y="462" fill="#EFF3FA">pending.json</text>
|
|
41
|
+
<text x="352" y="462" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">未蒸馏缓冲 · 重启恢复</text>
|
|
42
42
|
|
|
43
|
-
<text x="92" y="504" fill="#
|
|
44
|
-
<text x="352" y="504" fill="#
|
|
43
|
+
<text x="92" y="504" fill="#EFF3FA">session-modes.json</text>
|
|
44
|
+
<text x="352" y="504" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">会话档位 · 90 天清理</text>
|
|
45
45
|
|
|
46
|
-
<text x="92" y="546" fill="#
|
|
47
|
-
<text x="352" y="546" fill="#
|
|
46
|
+
<text x="92" y="546" fill="#EFF3FA">embedding-source.json</text>
|
|
47
|
+
<text x="352" y="546" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">嵌入源三态 · 运行时切换</text>
|
|
48
48
|
|
|
49
|
-
<text x="92" y="588" fill="#
|
|
50
|
-
<text x="352" y="588" fill="#
|
|
49
|
+
<text x="92" y="588" fill="#EFF3FA">models/<id>/</text>
|
|
50
|
+
<text x="352" y="588" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">本地嵌入模型 · sha256 校验</text>
|
|
51
51
|
|
|
52
|
-
<text x="92" y="630" fill="#
|
|
53
|
-
<text x="352" y="630" fill="#
|
|
52
|
+
<text x="92" y="630" fill="#EFF3FA">runtime/</text>
|
|
53
|
+
<text x="352" y="630" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">推理运行时 · 按需安装</text>
|
|
54
54
|
|
|
55
|
-
<text x="92" y="672" fill="#
|
|
56
|
-
<text x="352" y="672" fill="#
|
|
55
|
+
<text x="92" y="672" fill="#EFF3FA">*.bak.<ts>/</text>
|
|
56
|
+
<text x="352" y="672" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">重建归档(改名保留)</text>
|
|
57
57
|
|
|
58
|
-
<text x="92" y="714" fill="#
|
|
59
|
-
<text x="352" y="714" fill="#
|
|
58
|
+
<text x="92" y="714" fill="#EFF3FA">memory.log</text>
|
|
59
|
+
<text x="352" y="714" fill="#8296B3" font-family="-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif">诊断日志 · 2MB 轮转</text>
|
|
60
60
|
</g>
|
|
61
61
|
</g>
|
|
62
62
|
|
|
63
63
|
<!-- ── 右上:检索三策略 ── -->
|
|
64
64
|
<g id="retrieval">
|
|
65
|
-
<rect x="656" y="140" width="480" height="210" rx="16" fill="#
|
|
65
|
+
<rect x="656" y="140" width="480" height="210" rx="16" fill="#101B30" stroke="#263A5C" stroke-width="1.5"/>
|
|
66
66
|
<text x="684" y="174" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
67
|
-
font-size="18" fill="#
|
|
67
|
+
font-size="18" fill="#7FA6E3">检索三策略 · recall.strategy</text>
|
|
68
68
|
|
|
69
|
-
<text x="684" y="210" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#
|
|
70
|
-
<text x="800" y="210" font-size="18" fill="#
|
|
69
|
+
<text x="684" y="210" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#EFF3FA">keyword</text>
|
|
70
|
+
<text x="800" y="210" font-size="18" fill="#8296B3">FTS5 BM25</text>
|
|
71
71
|
|
|
72
|
-
<text x="684" y="244" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#
|
|
73
|
-
<text x="800" y="244" font-size="18" fill="#
|
|
72
|
+
<text x="684" y="244" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#EFF3FA">embedding</text>
|
|
73
|
+
<text x="800" y="244" font-size="18" fill="#8296B3">vec0 余弦 KNN</text>
|
|
74
74
|
|
|
75
|
-
<text x="684" y="278" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#
|
|
76
|
-
<rect x="798" y="262" width="48" height="24" rx="12" fill="#
|
|
77
|
-
<text x="822" y="279" text-anchor="middle" font-size="15" font-weight="700" fill="#
|
|
78
|
-
<text x="860" y="278" font-size="18" fill="#
|
|
75
|
+
<text x="684" y="278" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#EFF3FA">hybrid</text>
|
|
76
|
+
<rect x="798" y="262" width="48" height="24" rx="12" fill="#FFD15D"/>
|
|
77
|
+
<text x="822" y="279" text-anchor="middle" font-size="15" font-weight="700" fill="#0D1526">默认</text>
|
|
78
|
+
<text x="860" y="278" font-size="18" fill="#8296B3">双路并行 + RRF k=60</text>
|
|
79
79
|
|
|
80
|
-
<text x="684" y="322" font-size="18" fill="#
|
|
80
|
+
<text x="684" y="322" font-size="18" fill="#6E82A3">conversation_search(L0)同款融合</text>
|
|
81
81
|
</g>
|
|
82
82
|
|
|
83
83
|
<!-- ── 右中:嵌入源三态 ── -->
|
|
84
84
|
<g id="embedding-source">
|
|
85
|
-
<rect x="656" y="370" width="480" height="184" rx="16" fill="#
|
|
85
|
+
<rect x="656" y="370" width="480" height="184" rx="16" fill="#101B30" stroke="#263A5C" stroke-width="1.5"/>
|
|
86
86
|
<text x="684" y="404" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
87
87
|
font-size="18" fill="#93A8FF">嵌入源三态 · 运行时切换</text>
|
|
88
88
|
|
|
89
|
-
<text x="684" y="438" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#
|
|
90
|
-
<text x="800" y="438" font-size="18" fill="#
|
|
89
|
+
<text x="684" y="438" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#EFF3FA">off</text>
|
|
90
|
+
<text x="800" y="438" font-size="18" fill="#8296B3">纯 FTS(默认)</text>
|
|
91
91
|
|
|
92
|
-
<text x="684" y="471" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#
|
|
93
|
-
<text x="800" y="471" font-size="18" fill="#
|
|
92
|
+
<text x="684" y="471" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#EFF3FA">remote</text>
|
|
93
|
+
<text x="800" y="471" font-size="18" fill="#8296B3">OpenAI 兼容 /embeddings</text>
|
|
94
94
|
|
|
95
|
-
<text x="684" y="504" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#
|
|
96
|
-
<text x="800" y="504" font-size="18" fill="#
|
|
95
|
+
<text x="684" y="504" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace" font-size="18" fill="#EFF3FA">local</text>
|
|
96
|
+
<text x="800" y="504" font-size="18" fill="#8296B3">内置目录 · CPU 推理</text>
|
|
97
97
|
|
|
98
|
-
<text x="684" y="536" font-size="16" fill="#
|
|
98
|
+
<text x="684" y="536" font-size="16" fill="#6E82A3">生效 = 部署上限 AND 运行时选择 · 本地模型免 API Key</text>
|
|
99
99
|
</g>
|
|
100
100
|
|
|
101
101
|
<!-- ── 右下:降级链 ── -->
|
|
102
102
|
<g id="degradation">
|
|
103
|
-
<rect x="656" y="574" width="480" height="176" rx="16" fill="#
|
|
103
|
+
<rect x="656" y="574" width="480" height="176" rx="16" fill="#101B30" stroke="#263A5C" stroke-width="1.5"/>
|
|
104
104
|
<text x="684" y="608" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
105
|
-
font-size="18" fill="#
|
|
105
|
+
font-size="18" fill="#8296B3">降级链 · 永不阻塞宿主</text>
|
|
106
106
|
|
|
107
|
-
<text x="684" y="642" font-size="18" fill="#
|
|
108
|
-
<text x="684" y="675" font-size="18" fill="#
|
|
109
|
-
<text x="684" y="708" font-size="18" fill="#
|
|
107
|
+
<text x="684" y="642" font-size="18" fill="#C2CDDE">sqlite-vec 加载失败 → 纯 FTS</text>
|
|
108
|
+
<text x="684" y="675" font-size="18" fill="#C2CDDE">embedding 调用失败 → 该次降级 FTS</text>
|
|
109
|
+
<text x="684" y="708" font-size="18" fill="#C2CDDE">初始化失败 → 记忆停用 · dsh 照常启动</text>
|
|
110
110
|
|
|
111
111
|
<text x="684" y="740" font-family="ui-monospace,SFMono-Regular,Menlo,Consolas,monospace"
|
|
112
|
-
font-size="18" fill="#
|
|
112
|
+
font-size="18" fill="#FFD15D">唯一检索缝:L1Store.search()</text>
|
|
113
113
|
</g>
|
|
114
114
|
</g>
|
|
115
115
|
</svg>
|