openclaw-cortex-memory 0.1.0-Alpha.2 → 0.1.0-Alpha.21
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 +163 -203
- package/SKILL.md +71 -268
- package/dist/index.d.ts +88 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +859 -1189
- package/dist/index.js.map +1 -1
- package/dist/openclaw.plugin.json +362 -14
- package/dist/src/dedup/three_stage_deduplicator.d.ts +25 -0
- package/dist/src/dedup/three_stage_deduplicator.d.ts.map +1 -0
- package/dist/src/dedup/three_stage_deduplicator.js +224 -0
- package/dist/src/dedup/three_stage_deduplicator.js.map +1 -0
- package/dist/src/engine/memory_engine.d.ts +2 -1
- package/dist/src/engine/memory_engine.d.ts.map +1 -1
- package/dist/src/engine/ts_engine.d.ts +126 -0
- package/dist/src/engine/ts_engine.d.ts.map +1 -1
- package/dist/src/engine/ts_engine.js +1172 -44
- package/dist/src/engine/ts_engine.js.map +1 -1
- package/dist/src/engine/types.d.ts +12 -0
- package/dist/src/engine/types.d.ts.map +1 -1
- package/dist/src/graph/ontology.d.ts +103 -0
- package/dist/src/graph/ontology.d.ts.map +1 -0
- package/dist/src/graph/ontology.js +564 -0
- package/dist/src/graph/ontology.js.map +1 -0
- package/dist/src/quality/llm_output_validator.d.ts +48 -0
- package/dist/src/quality/llm_output_validator.d.ts.map +1 -0
- package/dist/src/quality/llm_output_validator.js +404 -0
- package/dist/src/quality/llm_output_validator.js.map +1 -0
- package/dist/src/reflect/reflector.d.ts +7 -0
- package/dist/src/reflect/reflector.d.ts.map +1 -1
- package/dist/src/reflect/reflector.js +358 -8
- package/dist/src/reflect/reflector.js.map +1 -1
- package/dist/src/rules/rule_store.d.ts.map +1 -1
- package/dist/src/rules/rule_store.js +75 -16
- package/dist/src/rules/rule_store.js.map +1 -1
- package/dist/src/session/session_end.d.ts +33 -0
- package/dist/src/session/session_end.d.ts.map +1 -1
- package/dist/src/session/session_end.js +67 -64
- package/dist/src/session/session_end.js.map +1 -1
- package/dist/src/store/archive_store.d.ts +128 -0
- package/dist/src/store/archive_store.d.ts.map +1 -0
- package/dist/src/store/archive_store.js +481 -0
- package/dist/src/store/archive_store.js.map +1 -0
- package/dist/src/store/embedding_utils.d.ts +32 -0
- package/dist/src/store/embedding_utils.d.ts.map +1 -0
- package/dist/src/store/embedding_utils.js +173 -0
- package/dist/src/store/embedding_utils.js.map +1 -0
- package/dist/src/store/graph_memory_store.d.ts +44 -0
- package/dist/src/store/graph_memory_store.d.ts.map +1 -0
- package/dist/src/store/graph_memory_store.js +168 -0
- package/dist/src/store/graph_memory_store.js.map +1 -0
- package/dist/src/store/read_store.d.ts +86 -0
- package/dist/src/store/read_store.d.ts.map +1 -1
- package/dist/src/store/read_store.js +1681 -25
- package/dist/src/store/read_store.js.map +1 -1
- package/dist/src/store/vector_store.d.ts +44 -0
- package/dist/src/store/vector_store.d.ts.map +1 -0
- package/dist/src/store/vector_store.js +201 -0
- package/dist/src/store/vector_store.js.map +1 -0
- package/dist/src/store/write_store.d.ts +52 -0
- package/dist/src/store/write_store.d.ts.map +1 -1
- package/dist/src/store/write_store.js +245 -3
- package/dist/src/store/write_store.js.map +1 -1
- package/dist/src/sync/session_sync.d.ts +100 -2
- package/dist/src/sync/session_sync.d.ts.map +1 -1
- package/dist/src/sync/session_sync.js +673 -22
- package/dist/src/sync/session_sync.js.map +1 -1
- package/dist/src/utils/runtime_env.d.ts +4 -0
- package/dist/src/utils/runtime_env.d.ts.map +1 -0
- package/dist/src/utils/runtime_env.js +51 -0
- package/dist/src/utils/runtime_env.js.map +1 -0
- package/openclaw.plugin.json +362 -14
- package/package.json +23 -6
- package/scripts/cli.js +19 -14
- package/scripts/uninstall.js +22 -5
- package/index.ts +0 -2092
- package/scripts/install.js +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-cortex-memory",
|
|
3
|
-
"version": "0.1.0-Alpha.
|
|
3
|
+
"version": "0.1.0-Alpha.21",
|
|
4
4
|
"description": "Long-term memory system for OpenClaw AI Agent",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,9 +9,19 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc && node -e \"require('fs').copyFileSync('openclaw.plugin.json','dist/openclaw.plugin.json')\"",
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"check:version": "node scripts/check-version.js",
|
|
14
|
+
"test:compat": "node scripts/compat-regression.js",
|
|
15
|
+
"test:model": "node scripts/model-regression.js",
|
|
16
|
+
"test:graph": "node scripts/graph-eval.js",
|
|
17
|
+
"test:graph-quality": "node scripts/graph-quality-eval.js",
|
|
18
|
+
"test:graph-quality-zh": "node scripts/graph-quality-eval.js --gold eval/graph_quality_gold.zh.jsonl --pred eval/graph_quality_predictions.zh.sample.jsonl --thresholds eval/graph_quality_thresholds.json",
|
|
19
|
+
"test:lengthnorm": "node scripts/lengthnorm-regression.js",
|
|
20
|
+
"test:all": "npm run test:compat && npm run test:model && npm run test:graph && npm run test:graph-quality && npm run test:graph-quality-zh && npm run test:lengthnorm",
|
|
21
|
+
"release:check": "node scripts/release-pipeline.js",
|
|
12
22
|
"dev": "tsc --watch",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
23
|
+
"prepack": "npm run build",
|
|
24
|
+
"prepublishOnly": "npm run check:version && npm run build && npm run test:all"
|
|
15
25
|
},
|
|
16
26
|
"keywords": [
|
|
17
27
|
"openclaw",
|
|
@@ -20,11 +30,14 @@
|
|
|
20
30
|
"agent",
|
|
21
31
|
"rag"
|
|
22
32
|
],
|
|
23
|
-
"author": "",
|
|
33
|
+
"author": "deki18",
|
|
24
34
|
"license": "MIT",
|
|
25
35
|
"dependencies": {
|
|
26
36
|
"undici": "^6.21.0"
|
|
27
37
|
},
|
|
38
|
+
"optionalDependencies": {
|
|
39
|
+
"@lancedb/lancedb": "^0.22.0"
|
|
40
|
+
},
|
|
28
41
|
"devDependencies": {
|
|
29
42
|
"@types/node": "^22.19.15",
|
|
30
43
|
"typescript": "^5.7.2"
|
|
@@ -37,9 +50,7 @@
|
|
|
37
50
|
},
|
|
38
51
|
"files": [
|
|
39
52
|
"dist/",
|
|
40
|
-
"index.ts",
|
|
41
53
|
"scripts/cli.js",
|
|
42
|
-
"scripts/install.js",
|
|
43
54
|
"scripts/uninstall.js",
|
|
44
55
|
"openclaw.plugin.json",
|
|
45
56
|
"SKILL.md"
|
|
@@ -48,6 +59,12 @@
|
|
|
48
59
|
"plugin": true,
|
|
49
60
|
"requiresPython": false,
|
|
50
61
|
"cli": "cortex-memory",
|
|
62
|
+
"build": {
|
|
63
|
+
"openclawVersion": "2026.3.22"
|
|
64
|
+
},
|
|
65
|
+
"compat": {
|
|
66
|
+
"pluginApi": ">=2026.3.22"
|
|
67
|
+
},
|
|
51
68
|
"extensions": [
|
|
52
69
|
"./dist/index.js"
|
|
53
70
|
]
|
package/scripts/cli.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const { spawn } = require('child_process');
|
|
6
5
|
|
|
7
6
|
const PLUGIN_NAME = 'openclaw-cortex-memory';
|
|
8
7
|
|
|
9
8
|
function findOpenClawConfig() {
|
|
10
9
|
const explicitConfigPath = process.env.OPENCLAW_CONFIG_PATH || '';
|
|
10
|
+
const stateDir = process.env.OPENCLAW_STATE_DIR || '';
|
|
11
11
|
const basePath = process.env.OPENCLAW_BASE_PATH || '';
|
|
12
12
|
const homePath = process.env.USERPROFILE || process.env.HOME || '';
|
|
13
13
|
const possiblePaths = [
|
|
14
14
|
explicitConfigPath,
|
|
15
|
+
stateDir ? path.join(stateDir, 'openclaw.json') : '',
|
|
15
16
|
basePath ? path.join(basePath, 'openclaw.json') : '',
|
|
16
17
|
path.join(process.cwd(), 'openclaw.json'),
|
|
17
18
|
homePath ? path.join(homePath, '.openclaw', 'openclaw.json') : '',
|
|
@@ -53,7 +54,10 @@ function enablePlugin() {
|
|
|
53
54
|
const configPath = findOpenClawConfig();
|
|
54
55
|
|
|
55
56
|
if (!configPath) {
|
|
56
|
-
const defaultPath =
|
|
57
|
+
const defaultPath = process.env.OPENCLAW_CONFIG_PATH
|
|
58
|
+
|| (process.env.OPENCLAW_STATE_DIR ? path.join(process.env.OPENCLAW_STATE_DIR, 'openclaw.json') : '')
|
|
59
|
+
|| (process.env.OPENCLAW_BASE_PATH ? path.join(process.env.OPENCLAW_BASE_PATH, 'openclaw.json') : '')
|
|
60
|
+
|| path.join(process.env.USERPROFILE || process.env.HOME || '', '.openclaw', 'openclaw.json');
|
|
57
61
|
console.log(`No config file found. Creating: ${defaultPath}`);
|
|
58
62
|
|
|
59
63
|
const config = {
|
|
@@ -170,21 +174,22 @@ function getStatus() {
|
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
function runUninstall(args) {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
if (!fs.existsSync(uninstallScript)) {
|
|
177
|
+
const uninstallScriptPath = path.join(__dirname, 'uninstall.js');
|
|
178
|
+
if (!fs.existsSync(uninstallScriptPath)) {
|
|
176
179
|
console.error('Uninstall script not found.');
|
|
177
180
|
process.exit(1);
|
|
178
181
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
try {
|
|
183
|
+
const uninstallModule = require(uninstallScriptPath);
|
|
184
|
+
if (!uninstallModule || typeof uninstallModule.uninstall !== 'function') {
|
|
185
|
+
console.error('Invalid uninstall script export.');
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
uninstallModule.uninstall(args);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error(`Failed to run uninstall: ${error instanceof Error ? error.message : String(error)}`);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
188
193
|
}
|
|
189
194
|
|
|
190
195
|
function showHelp() {
|
package/scripts/uninstall.js
CHANGED
|
@@ -17,14 +17,20 @@ function findProjectRoot() {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function findOpenClawConfig() {
|
|
20
|
+
const explicitConfigPath = process.env.OPENCLAW_CONFIG_PATH || '';
|
|
21
|
+
const stateDir = process.env.OPENCLAW_STATE_DIR || '';
|
|
22
|
+
const basePath = process.env.OPENCLAW_BASE_PATH || '';
|
|
23
|
+
const homePath = process.env.USERPROFILE || process.env.HOME || '';
|
|
20
24
|
const possiblePaths = [
|
|
25
|
+
explicitConfigPath,
|
|
26
|
+
stateDir ? path.join(stateDir, 'openclaw.json') : '',
|
|
27
|
+
basePath ? path.join(basePath, 'openclaw.json') : '',
|
|
21
28
|
path.join(process.cwd(), 'openclaw.json'),
|
|
22
|
-
path.join(
|
|
23
|
-
path.join(process.env.OPENCLAW_BASE_PATH || '', 'openclaw.json'),
|
|
29
|
+
homePath ? path.join(homePath, '.openclaw', 'openclaw.json') : '',
|
|
24
30
|
];
|
|
25
31
|
|
|
26
32
|
for (const p of possiblePaths) {
|
|
27
|
-
if (fs.existsSync(p)) {
|
|
33
|
+
if (p && fs.existsSync(p)) {
|
|
28
34
|
return p;
|
|
29
35
|
}
|
|
30
36
|
}
|
|
@@ -114,15 +120,20 @@ function removeFromConfig() {
|
|
|
114
120
|
const content = fs.readFileSync(configPath, 'utf-8');
|
|
115
121
|
const config = JSON.parse(content);
|
|
116
122
|
|
|
123
|
+
if (Array.isArray(config.plugins?.allow)) {
|
|
124
|
+
config.plugins.allow = config.plugins.allow.filter((item) => item !== PLUGIN_NAME);
|
|
125
|
+
}
|
|
117
126
|
if (config.plugins?.entries?.[PLUGIN_NAME]) {
|
|
118
127
|
delete config.plugins.entries[PLUGIN_NAME];
|
|
119
|
-
|
|
120
128
|
if (config.plugins.slots?.memory === PLUGIN_NAME) {
|
|
121
129
|
delete config.plugins.slots.memory;
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
125
133
|
console.log(`Removed plugin from config: ${configPath}`);
|
|
134
|
+
} else if (Array.isArray(config.plugins?.allow)) {
|
|
135
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
136
|
+
console.log(`Removed plugin allowlist entry from config: ${configPath}`);
|
|
126
137
|
} else {
|
|
127
138
|
console.log('Plugin not found in config.');
|
|
128
139
|
}
|
|
@@ -209,4 +220,10 @@ function main() {
|
|
|
209
220
|
}
|
|
210
221
|
}
|
|
211
222
|
|
|
212
|
-
|
|
223
|
+
module.exports = {
|
|
224
|
+
uninstall,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
if (require.main === module) {
|
|
228
|
+
main();
|
|
229
|
+
}
|