stratagate-dsh 0.3.32 → 0.3.33
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/CHANGELOG.md +709 -694
- package/CONTRIBUTING.md +88 -0
- package/CONTRIBUTING.zh-CN.md +88 -0
- package/README.md +487 -491
- package/README.zh-CN.md +491 -495
- package/benchmarks/locomo-conv26-r8-final.json +146 -0
- package/cordis.patch.yml +16 -16
- package/dist/client.d.ts +1 -1
- package/dist/client.js +107 -21
- package/dist/index.d.ts +9 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +9 -0
- package/dist/plugin.js +415 -90
- package/dist/plugin.js.map +1 -1
- package/dist/repair-profile.js.map +1 -1
- package/docs/ARCHITECTURE.md +282 -282
- package/docs/DSH.md +331 -331
- package/docs/DSH.zh-CN.md +309 -291
- package/docs/EVALUATION.md +189 -189
- package/docs/EXTERNAL_MEMORY_IMPORT.zh-CN.md +99 -99
- package/docs/MEMORY_TOPICS.zh-CN.md +51 -51
- package/docs/dreaming-agent.md +69 -69
- package/docs/event-extractor.md +48 -48
- package/docs/npm-release.md +1 -0
- package/docs/validation/workspace-cleanup-20261020.md +36 -36
- package/package.json +255 -249
- package/packages/core/examples/basic.ts +87 -0
- package/packages/core/src/blocks.ts +442 -0
- package/packages/core/src/weights.ts +21 -0
- package/docs/assets/41fc676096d0a13337a1c03aaf8f499b.png +0 -0
- package/docs/assets/cecc9d191a4b9bf22a479623e2ebdc1d.png +0 -0
package/package.json
CHANGED
|
@@ -1,249 +1,255 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "stratagate-dsh",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Recent conversations stay vivid. Older ones fade into summaries, not oblivion. StrataGate gives DeepSeek Harness six-layer, time-decaying memory, while lasting events and relationships settle into a knowledge graph. Bring your memories from other AIs with you—no need to start over.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"stratagate-dsh-repair": "dist/repair-profile.js"
|
|
10
|
-
},
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./client": {
|
|
17
|
-
"types": "./dist/client.d.ts",
|
|
18
|
-
"default": "./dist/client.js"
|
|
19
|
-
},
|
|
20
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
21
|
-
"./package.json": "./package.json"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist",
|
|
25
|
-
"cordis.patch.yml",
|
|
26
|
-
"README.md",
|
|
27
|
-
"README.zh-CN.md",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"packages
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"test:
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
},
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"0.2
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"@deepseek-ai/
|
|
165
|
-
"@deepseek-ai/dsh-
|
|
166
|
-
"@deepseek-ai/dsh-
|
|
167
|
-
"@deepseek-ai/dsh-
|
|
168
|
-
"@deepseek-ai/dsh-
|
|
169
|
-
"@deepseek-ai/dsh-
|
|
170
|
-
"@deepseek-ai/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
"@deepseek-ai/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"@deepseek-ai/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"@deepseek-ai/
|
|
180
|
-
"optional": true
|
|
181
|
-
},
|
|
182
|
-
"@deepseek-ai/dsh-
|
|
183
|
-
"optional": true
|
|
184
|
-
},
|
|
185
|
-
"@deepseek-ai/dsh-
|
|
186
|
-
"optional": true
|
|
187
|
-
},
|
|
188
|
-
"@deepseek-ai/dsh-
|
|
189
|
-
"optional": true
|
|
190
|
-
},
|
|
191
|
-
"@deepseek-ai/dsh-
|
|
192
|
-
"optional": true
|
|
193
|
-
},
|
|
194
|
-
"@deepseek-ai/dsh-session
|
|
195
|
-
"optional": true
|
|
196
|
-
},
|
|
197
|
-
"@deepseek-ai/dsh-session-format
|
|
198
|
-
"optional": true
|
|
199
|
-
},
|
|
200
|
-
"@deepseek-ai/dsh-
|
|
201
|
-
"optional": true
|
|
202
|
-
},
|
|
203
|
-
"@deepseek-ai/dsh-
|
|
204
|
-
"optional": true
|
|
205
|
-
},
|
|
206
|
-
"@deepseek-ai/dsh-
|
|
207
|
-
"optional": true
|
|
208
|
-
},
|
|
209
|
-
"@deepseek-ai/
|
|
210
|
-
"optional": true
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
"@deepseek-ai/
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
"@deepseek-ai/
|
|
221
|
-
"@deepseek-ai/dsh
|
|
222
|
-
"@deepseek-ai/dsh-
|
|
223
|
-
"@deepseek-ai/dsh-
|
|
224
|
-
"@deepseek-ai/dsh-
|
|
225
|
-
"@deepseek-ai/dsh-
|
|
226
|
-
"@deepseek-ai/dsh-
|
|
227
|
-
"@deepseek-ai/dsh-
|
|
228
|
-
"@deepseek-ai/
|
|
229
|
-
"@
|
|
230
|
-
"@
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
"
|
|
234
|
-
"
|
|
235
|
-
"
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
"
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
"
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "stratagate-dsh",
|
|
3
|
+
"version": "0.3.33",
|
|
4
|
+
"description": "Recent conversations stay vivid. Older ones fade into summaries, not oblivion. StrataGate gives DeepSeek Harness six-layer, time-decaying memory, while lasting events and relationships settle into a knowledge graph. Bring your memories from other AIs with you—no need to start over.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"stratagate-dsh-repair": "dist/repair-profile.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./client": {
|
|
17
|
+
"types": "./dist/client.d.ts",
|
|
18
|
+
"default": "./dist/client.js"
|
|
19
|
+
},
|
|
20
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"cordis.patch.yml",
|
|
26
|
+
"README.md",
|
|
27
|
+
"README.zh-CN.md",
|
|
28
|
+
"CONTRIBUTING.md",
|
|
29
|
+
"CONTRIBUTING.zh-CN.md",
|
|
30
|
+
"docs",
|
|
31
|
+
"benchmarks/locomo-conv26-r8-final.json",
|
|
32
|
+
"packages/core/examples/basic.ts",
|
|
33
|
+
"packages/core/src/blocks.ts",
|
|
34
|
+
"packages/core/src/weights.ts",
|
|
35
|
+
"screenshots.json",
|
|
36
|
+
"CHANGELOG.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"workspaces": [
|
|
40
|
+
"packages/*",
|
|
41
|
+
"integrations/workbuddy"
|
|
42
|
+
],
|
|
43
|
+
"dsh": {
|
|
44
|
+
"bundle": {
|
|
45
|
+
"patch": "./cordis.patch.yml"
|
|
46
|
+
},
|
|
47
|
+
"client": {
|
|
48
|
+
"inject": [
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-conversation"
|
|
50
|
+
],
|
|
51
|
+
"platform": "web"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "npm run build:core && npm run build:dsh && npm run build:workbuddy",
|
|
56
|
+
"build:dsh": "tsup && node scripts/build-client.mjs",
|
|
57
|
+
"build:core": "npm run build --workspace @diqier/stratagate",
|
|
58
|
+
"build:workbuddy": "npm run build --workspace stratagate-workbuddy",
|
|
59
|
+
"check": "npm run check:core && npm run check:dsh && npm run check:workbuddy",
|
|
60
|
+
"check:dsh": "tsc -p tsconfig.json --noEmit",
|
|
61
|
+
"check:core": "npm run check --workspace @diqier/stratagate",
|
|
62
|
+
"check:workbuddy": "npm run check --workspace stratagate-workbuddy",
|
|
63
|
+
"test": "npm run test:core && npm run test:dsh && npm run test:workbuddy",
|
|
64
|
+
"test:dsh": "vitest run --config vitest.config.ts",
|
|
65
|
+
"test:profile-browser": "node scripts/test-profile-browser.mjs",
|
|
66
|
+
"test:core": "npm run test --workspace @diqier/stratagate",
|
|
67
|
+
"test:workbuddy": "npm run test --workspace stratagate-workbuddy",
|
|
68
|
+
"verify:dsh": "npm run build:dsh && node scripts/verify-package.mjs && npm pack --ignore-scripts --pack-destination . && node scripts/verify-dsh-install.mjs",
|
|
69
|
+
"verify:workbuddy": "npm run verify:package --workspace stratagate-workbuddy",
|
|
70
|
+
"test:watch": "vitest --config vitest.config.ts",
|
|
71
|
+
"prepare": "npm run build:dsh"
|
|
72
|
+
},
|
|
73
|
+
"keywords": [
|
|
74
|
+
"memory",
|
|
75
|
+
"dsh",
|
|
76
|
+
"deepseek",
|
|
77
|
+
"plugin",
|
|
78
|
+
"agent",
|
|
79
|
+
"cross-session",
|
|
80
|
+
"evidence",
|
|
81
|
+
"deepseek-harness",
|
|
82
|
+
"dsh-plugin",
|
|
83
|
+
"agent-memory",
|
|
84
|
+
"cross-session-memory",
|
|
85
|
+
"persistent-memory",
|
|
86
|
+
"project-memory",
|
|
87
|
+
"conversation-memory",
|
|
88
|
+
"long-term-memory",
|
|
89
|
+
"local-first",
|
|
90
|
+
"time-decay",
|
|
91
|
+
"usage-reinforcement",
|
|
92
|
+
"source-traceability",
|
|
93
|
+
"source-tracing",
|
|
94
|
+
"evidence-gate"
|
|
95
|
+
],
|
|
96
|
+
"repository": {
|
|
97
|
+
"type": "git",
|
|
98
|
+
"url": "git+https://github.com/diqierjia/StrataGate-AgentMemory.git"
|
|
99
|
+
},
|
|
100
|
+
"bugs": {
|
|
101
|
+
"url": "https://github.com/diqierjia/StrataGate-AgentMemory/issues"
|
|
102
|
+
},
|
|
103
|
+
"homepage": "https://github.com/diqierjia/StrataGate-AgentMemory#readme",
|
|
104
|
+
"license": "MIT",
|
|
105
|
+
"dshWorkshop": {
|
|
106
|
+
"schema": "omdsh-workshop-package/v1",
|
|
107
|
+
"type": "plugin",
|
|
108
|
+
"integration": {
|
|
109
|
+
"protocol": "harness-profile",
|
|
110
|
+
"artifact": "cordis.patch.yml"
|
|
111
|
+
},
|
|
112
|
+
"install": {
|
|
113
|
+
"mode": "transactional",
|
|
114
|
+
"adapter": "profile-bundle",
|
|
115
|
+
"failurePolicy": "generation-rollback",
|
|
116
|
+
"touchesCurrentBeforeActivation": false
|
|
117
|
+
},
|
|
118
|
+
"lifecycle": {
|
|
119
|
+
"activation": "restart-profile",
|
|
120
|
+
"dispose": "supported"
|
|
121
|
+
},
|
|
122
|
+
"compatibility": {
|
|
123
|
+
"dshVersions": [
|
|
124
|
+
"0.1.2-rc.1",
|
|
125
|
+
"0.1.5-rc.1",
|
|
126
|
+
"0.1.6-alpha.1",
|
|
127
|
+
"0.1.7-rc.1",
|
|
128
|
+
"0.1.7-rc.2",
|
|
129
|
+
"0.2.0-rc.1",
|
|
130
|
+
"0.2.0-rc.2"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"permissions": [
|
|
134
|
+
"harness:tool",
|
|
135
|
+
"filesystem:read",
|
|
136
|
+
"filesystem:write",
|
|
137
|
+
"network:none",
|
|
138
|
+
"subprocess:none",
|
|
139
|
+
"shell:none",
|
|
140
|
+
"python:none",
|
|
141
|
+
"credentials:none"
|
|
142
|
+
],
|
|
143
|
+
"capability": {
|
|
144
|
+
"id": "memory_search_events",
|
|
145
|
+
"kind": "tool",
|
|
146
|
+
"invocation": "Invoke memory_search_events with a project-memory query after profile activation.",
|
|
147
|
+
"expected": "The DSH tool registry exposes memory_search_events and returns an evidence-gated retrieval batch."
|
|
148
|
+
},
|
|
149
|
+
"evidence": {
|
|
150
|
+
"install": "tests/plugin.test.ts",
|
|
151
|
+
"failureIsolation": null,
|
|
152
|
+
"hotReload": null,
|
|
153
|
+
"remove": null
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"publishConfig": {
|
|
157
|
+
"access": "public"
|
|
158
|
+
},
|
|
159
|
+
"engines": {
|
|
160
|
+
"dsh": "0.1.2-rc.1 || >=0.1.5-rc.1 <0.3.0-0",
|
|
161
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
162
|
+
},
|
|
163
|
+
"peerDependencies": {
|
|
164
|
+
"@deepseek-ai/cordis": "4.0.2 || ~4.0.4",
|
|
165
|
+
"@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
166
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
167
|
+
"@deepseek-ai/dsh-llm": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
168
|
+
"@deepseek-ai/dsh-native-command": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
169
|
+
"@deepseek-ai/dsh-session": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
170
|
+
"@deepseek-ai/dsh-session-format": ">=0.1.5-rc.2 <0.3.0-0",
|
|
171
|
+
"@deepseek-ai/dsh-session-format-catalog": ">=0.1.5-rc.2 <0.3.0-0",
|
|
172
|
+
"@deepseek-ai/dsh-session-format-v0-to-v1": ">=0.1.5-rc.2 <0.3.0-0",
|
|
173
|
+
"@deepseek-ai/dsh-settings": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
174
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
175
|
+
"@deepseek-ai/dsh-tools": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
|
|
176
|
+
"@deepseek-ai/schemastery": "3.18.2 || ~3.18.4"
|
|
177
|
+
},
|
|
178
|
+
"peerDependenciesMeta": {
|
|
179
|
+
"@deepseek-ai/cordis": {
|
|
180
|
+
"optional": true
|
|
181
|
+
},
|
|
182
|
+
"@deepseek-ai/dsh-agent-default-model": {
|
|
183
|
+
"optional": true
|
|
184
|
+
},
|
|
185
|
+
"@deepseek-ai/dsh-client-ui-conversation": {
|
|
186
|
+
"optional": true
|
|
187
|
+
},
|
|
188
|
+
"@deepseek-ai/dsh-llm": {
|
|
189
|
+
"optional": true
|
|
190
|
+
},
|
|
191
|
+
"@deepseek-ai/dsh-native-command": {
|
|
192
|
+
"optional": true
|
|
193
|
+
},
|
|
194
|
+
"@deepseek-ai/dsh-session": {
|
|
195
|
+
"optional": true
|
|
196
|
+
},
|
|
197
|
+
"@deepseek-ai/dsh-session-format": {
|
|
198
|
+
"optional": true
|
|
199
|
+
},
|
|
200
|
+
"@deepseek-ai/dsh-session-format-catalog": {
|
|
201
|
+
"optional": true
|
|
202
|
+
},
|
|
203
|
+
"@deepseek-ai/dsh-session-format-v0-to-v1": {
|
|
204
|
+
"optional": true
|
|
205
|
+
},
|
|
206
|
+
"@deepseek-ai/dsh-settings": {
|
|
207
|
+
"optional": true
|
|
208
|
+
},
|
|
209
|
+
"@deepseek-ai/dsh-system-prompt": {
|
|
210
|
+
"optional": true
|
|
211
|
+
},
|
|
212
|
+
"@deepseek-ai/dsh-tools": {
|
|
213
|
+
"optional": true
|
|
214
|
+
},
|
|
215
|
+
"@deepseek-ai/schemastery": {
|
|
216
|
+
"optional": true
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"devDependencies": {
|
|
220
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
221
|
+
"@deepseek-ai/dsh": "0.2.0-rc.2",
|
|
222
|
+
"@deepseek-ai/dsh-agent-default-model": "0.2.0-rc.2",
|
|
223
|
+
"@deepseek-ai/dsh-app-boot": "0.2.0-rc.2",
|
|
224
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.2",
|
|
225
|
+
"@deepseek-ai/dsh-llm": "0.2.0-rc.2",
|
|
226
|
+
"@deepseek-ai/dsh-native-command": "0.2.0-rc.2",
|
|
227
|
+
"@deepseek-ai/dsh-session": "0.2.0-rc.2",
|
|
228
|
+
"@deepseek-ai/dsh-session-format": "0.2.0-rc.2",
|
|
229
|
+
"@deepseek-ai/dsh-session-format-catalog": "0.2.0-rc.2",
|
|
230
|
+
"@deepseek-ai/dsh-session-format-v0-to-v1": "0.2.0-rc.2",
|
|
231
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.2",
|
|
232
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
|
|
233
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.2",
|
|
234
|
+
"@deepseek-ai/schemastery": "3.18.4",
|
|
235
|
+
"@types/node": "^22.0.0",
|
|
236
|
+
"@types/semver": "^7.8.0",
|
|
237
|
+
"cytoscape": "^3.34.1",
|
|
238
|
+
"cytoscape-fcose": "^2.2.0",
|
|
239
|
+
"esbuild": "^0.28.2",
|
|
240
|
+
"playwright-core": "^1.63.0",
|
|
241
|
+
"tsup": "^8.5.0",
|
|
242
|
+
"typescript": "^5.7.0",
|
|
243
|
+
"vitest": "^3.0.0"
|
|
244
|
+
},
|
|
245
|
+
"dependencies": {
|
|
246
|
+
"ngraph.graph": "^20.1.2",
|
|
247
|
+
"ngraph.leiden": "^0.3.0",
|
|
248
|
+
"semver": "^7.8.5"
|
|
249
|
+
},
|
|
250
|
+
"directories": {
|
|
251
|
+
"doc": "docs",
|
|
252
|
+
"test": "tests"
|
|
253
|
+
},
|
|
254
|
+
"author": ""
|
|
255
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StrataGate,
|
|
3
|
+
type BlockSummarizer,
|
|
4
|
+
type ElementProjector,
|
|
5
|
+
type EventExtractor,
|
|
6
|
+
} from '../src/index.js';
|
|
7
|
+
|
|
8
|
+
const summarize: BlockSummarizer = async (messages) => ({
|
|
9
|
+
l0Title: 'API design discussion',
|
|
10
|
+
l0Tags: ['api', 'decision'],
|
|
11
|
+
l1Summary: 'The team chose cursor pagination for the public API.',
|
|
12
|
+
l2Keypoints: messages.map((message) => message.content),
|
|
13
|
+
shouldExtract: true,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const extract: EventExtractor = async ({ target }) => ({
|
|
17
|
+
shouldExtract: true,
|
|
18
|
+
reason: 'A durable technical decision was made.',
|
|
19
|
+
events: [{
|
|
20
|
+
title: 'Use cursor pagination',
|
|
21
|
+
summary: 'The public API should use cursor pagination instead of page numbers.',
|
|
22
|
+
sourceMessageIds: target.l5Raw.filter((message) => message.role === 'user').map((message) => message.id),
|
|
23
|
+
sourceBlockId: target.id,
|
|
24
|
+
tags: ['api', 'pagination'],
|
|
25
|
+
temporal: { status: 'occurred', eventType: 'decision' },
|
|
26
|
+
}],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Element cards are a separately retryable materialized view. The callback may
|
|
30
|
+
// call any model provider; StrataGate validates every proposed source event ID.
|
|
31
|
+
const projectElements: ElementProjector = async ({ events }) => ({
|
|
32
|
+
reason: 'Update the current project view from the new immutable event.',
|
|
33
|
+
changes: events.map((event) => ({
|
|
34
|
+
element: { name: 'Public API', type: 'project' },
|
|
35
|
+
operation: 'set_state',
|
|
36
|
+
key: 'pagination',
|
|
37
|
+
mode: 'state',
|
|
38
|
+
value: 'cursor pagination',
|
|
39
|
+
sourceEventIds: [event.id],
|
|
40
|
+
confidence: 1,
|
|
41
|
+
})),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const memory = await StrataGate.open({
|
|
45
|
+
database: './stratagate-example.db',
|
|
46
|
+
namespace: 'example:basic',
|
|
47
|
+
blockTurnSize: 1,
|
|
48
|
+
summarizer: summarize,
|
|
49
|
+
extractor: extract,
|
|
50
|
+
elementProjector: projectElements,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
await memory.appendTurn({
|
|
54
|
+
user: 'Let us use cursor pagination for the public API.',
|
|
55
|
+
assistant: 'Agreed. I will treat that as the current API decision.',
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Extraction waits until the following block exists, so it can use both
|
|
59
|
+
// earlier and later context without taking quotes from neighboring blocks.
|
|
60
|
+
await memory.appendTurn({
|
|
61
|
+
user: 'Now define the response envelope.',
|
|
62
|
+
assistant: 'I will keep the pagination decision in mind.',
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const results = await memory.searchEvents('How should the API paginate?');
|
|
66
|
+
const elementFacts = await memory.searchElements('current API pagination', { type: 'project' });
|
|
67
|
+
const evidence = new Set([
|
|
68
|
+
...results.map(({ event }) => event.id),
|
|
69
|
+
...elementFacts.map(({ id }) => id),
|
|
70
|
+
]);
|
|
71
|
+
const assessment = memory.assessRetrieval({
|
|
72
|
+
verdict: 'sufficient',
|
|
73
|
+
evidence_refs: [...evidence],
|
|
74
|
+
fit: 'The event card records the chosen pagination strategy.',
|
|
75
|
+
missing: '',
|
|
76
|
+
next_strategy: 'answer',
|
|
77
|
+
}, evidence);
|
|
78
|
+
|
|
79
|
+
if (assessment.verdict === 'sufficient') {
|
|
80
|
+
await memory.recordMemoryUse({
|
|
81
|
+
eventIds: results.map(({ event }) => event.id),
|
|
82
|
+
elementIds: [...new Set(elementFacts.map(({ elementId }) => elementId))],
|
|
83
|
+
}, { receiptId: 'example:answer:1' });
|
|
84
|
+
console.log(elementFacts[0]?.fact.value ?? results[0]?.event.summary);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
await memory.close();
|