dsh-cortex-memory 0.4.21 → 0.4.22
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 +7 -0
- package/README.md +16 -5
- package/bin/cortex.mjs +9 -4
- package/package.json +1 -1
- package/test/unit/cli-default-root.test.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.22 — 2026-11-14
|
|
4
|
+
|
|
5
|
+
- Fix CLI default data root: use profileDataRoot (cortex-memory) instead of legacy ~/.dsh/cortex.
|
|
6
|
+
- Add CLI root regression tests for default, --data and CORTEX_HOME.
|
|
7
|
+
- Document that tests/bench require the DSH bundled Node 24; system Node 22 is below engines.
|
|
8
|
+
- No loader-id, data-path or UI changes.
|
|
9
|
+
|
|
3
10
|
## 0.4.21 — 2026-11-14
|
|
4
11
|
|
|
5
12
|
- Documentation-only release: replace the README with a current-version capability guide, install/download flow, add-on matrix and honest performance boundaries.
|
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
## 当前版本
|
|
8
8
|
|
|
9
9
|
```text
|
|
10
|
-
主包:dsh-cortex-memory@0.4.
|
|
10
|
+
主包:dsh-cortex-memory@0.4.22
|
|
11
11
|
提取器:dsh-cortex-extractors@0.3.5
|
|
12
12
|
DSH:>=0.2.1-rc.2 <0.4.0
|
|
13
13
|
Node:>=24
|
|
14
|
-
测试:
|
|
14
|
+
测试:440/440
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## 现在能做什么
|
|
@@ -34,7 +34,7 @@ Node:>=24
|
|
|
34
34
|
先关闭 DSH,再安装并重启:
|
|
35
35
|
|
|
36
36
|
```powershell
|
|
37
|
-
dsh plugin --profile desktop add dsh-cortex-memory@0.4.
|
|
37
|
+
dsh plugin --profile desktop add dsh-cortex-memory@0.4.22
|
|
38
38
|
dsh plugin --profile desktop add dsh-cortex-extractors@0.3.5
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -71,12 +71,23 @@ PaddleOCR 需显式模型目录
|
|
|
71
71
|
不替用户填 LLM API key
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
## 开发与测试
|
|
75
|
+
|
|
76
|
+
必须使用 DSH 自带的 **Node 24** 跑测试/bench。系统 PATH 上如果是 Node 22,会低于 `engines.node >=24`,`node --test` 可能直接失败。
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
DSH 运行时 Node:24.21.0
|
|
80
|
+
系统 Node:仅作兼容性参考,不保证
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
CLI 默认读取 `~/.dsh/cortex-memory`;需要指定其他库时显式传 `--data <dir>`。
|
|
84
|
+
|
|
74
85
|
## 性能与边界
|
|
75
86
|
|
|
76
87
|
已做:
|
|
77
88
|
|
|
78
89
|
```text
|
|
79
|
-
主包测试:
|
|
90
|
+
主包测试:440/440
|
|
80
91
|
受控中文语义探针:recall@3 1.000 / MRR@3 0.917 / nDCG@3 0.938
|
|
81
92
|
受控探针延迟:p50 1.31ms / p95 4.07ms
|
|
82
93
|
真实图片 OCR:已跑通
|
|
@@ -114,7 +125,7 @@ Cortex 的定位是“本地可解释、可回滚、能长期长”的记忆系
|
|
|
114
125
|
|
|
115
126
|
## 下载
|
|
116
127
|
|
|
117
|
-
- npm 主包:`dsh-cortex-memory@0.4.
|
|
128
|
+
- npm 主包:`dsh-cortex-memory@0.4.22`
|
|
118
129
|
- npm 提取器:`dsh-cortex-extractors@0.3.5`
|
|
119
130
|
- GitHub Release:`v0.4.21`
|
|
120
131
|
- Windows 一键包:`cortex-memory-oneclick-0.4.21.zip`
|
package/bin/cortex.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import os from 'node:os';
|
|
3
2
|
import path from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
4
|
import { createCortex } from '../src/service/cortex.js';
|
|
5
|
+
import { profileDataRoot } from '../src/core/profile.js';
|
|
5
6
|
import { createShioriImporter } from '../src/adapters/shiori.js';
|
|
6
7
|
import { exportMarkdown } from '../src/adapters/markdown.js';
|
|
7
8
|
import { importMarkdown } from '../src/adapters/markdown-import.js';
|
|
@@ -26,7 +27,7 @@ function parse(argv) {
|
|
|
26
27
|
function usage() {
|
|
27
28
|
console.log(`dsh-cortex CLI (source only)
|
|
28
29
|
|
|
29
|
-
--data <dir> cortex data directory (default ~/.dsh/cortex)
|
|
30
|
+
--data <dir> cortex data directory (default ~/.dsh/cortex-memory)
|
|
30
31
|
|
|
31
32
|
Commands:
|
|
32
33
|
write --text <text> [--kind <kind>] [--importance 0.5]
|
|
@@ -41,10 +42,14 @@ Commands:
|
|
|
41
42
|
`);
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
export function resolveDataRoot(args = {}, env = process.env) {
|
|
46
|
+
return path.resolve(args.data ?? env.CORTEX_HOME ?? profileDataRoot({ env }));
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
function main() {
|
|
45
50
|
const args = parse(process.argv.slice(2));
|
|
46
51
|
const command = args._[0];
|
|
47
|
-
const dataRoot =
|
|
52
|
+
const dataRoot = resolveDataRoot(args);
|
|
48
53
|
if (!command || command === 'help' || args.help) { usage(); return; }
|
|
49
54
|
|
|
50
55
|
if (command === 'bench') {
|
|
@@ -93,4 +98,4 @@ function main() {
|
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
|
|
96
|
-
main();
|
|
101
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) main();
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { resolveDataRoot } from '../../bin/cortex.mjs';
|
|
5
|
+
|
|
6
|
+
const home = 'C:/tmp/cortex-cli-home';
|
|
7
|
+
|
|
8
|
+
test('CLI defaults to the cortex-memory root, not legacy cortex', () => {
|
|
9
|
+
const root = resolveDataRoot({}, { DSH_HOME: home, DSH_PROFILE: 'desktop' });
|
|
10
|
+
assert.equal(root, path.resolve(path.join(home, 'cortex-memory')));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('CLI --data overrides the profile root', () => {
|
|
14
|
+
const root = resolveDataRoot({ data: 'C:/tmp/explicit-cortex' }, { DSH_HOME: home, DSH_PROFILE: 'desktop' });
|
|
15
|
+
assert.equal(root, path.resolve('C:/tmp/explicit-cortex'));
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('CLI CORTEX_HOME overrides the profile root', () => {
|
|
19
|
+
const root = resolveDataRoot({}, { DSH_HOME: home, CORTEX_HOME: 'C:/tmp/cortex-env' });
|
|
20
|
+
assert.equal(root, path.resolve('C:/tmp/cortex-env'));
|
|
21
|
+
});
|