dsh-ai-for-memory 0.5.1 → 0.5.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.
@@ -1,82 +1,82 @@
1
- # 开发与测试
2
-
3
- > 返回 [主 README](../README.md)。
4
-
5
- ## 项目定位
6
-
7
- AI for Memory 是面向 DSH 的**项目级记忆插件**。记忆类插件已有不少实现,本项目不声称发明了新品类;发布说明统一使用“本插件的第 N 个正式版”,不要写成“首个项目级正式版”或暗示这是同类插件的第一次出现。
8
-
9
- ## 版本号与发布
10
-
11
- 从 `0.1.0` 起使用三段式版本号:
12
-
13
- | 位置 | 含义 | 示例 |
14
- |---|---|---|
15
- | 第一位 | 重大更新:工具大范围修改、接口或存储格式调整、需要迁移 | `0.1.0` → `1.0.0` |
16
- | 第二位 | 功能更新:新增工具、动作、面板能力,保持向后兼容 | `0.1.0` → `0.2.0` |
17
- | 第三位 | 修复更新:只修 bug,不改变既有接口 | `0.2.0` → `0.2.1` |
18
-
19
- 版本号以 `package.json` 的 `version` 为准,README 徽章、发布标签和面板显示必须与它一致。每次发布都要同时更新这三处。
20
-
21
- Release 标题**只写版本号**(如 `0.1.1`),不写「第 N 个正式版」之类的附加说明;更新频率高,标题保持与 tag 一致即可。正文说明这次是修复、功能还是重大更新,以及主要变化。
22
-
23
- **什么时候改版本号:**
24
-
25
- - 本地开发、修 bug、未发布的改动:不改版本号;
26
- - 只有准备发布到 GitHub 时才改:更新 `package.json` 的 `version`、README 徽章和发布标签/GitHub Release;
27
- - 普通开发提交(包括只推送到分支、还没有正式发布的提交)不算发布;
28
- - 判断标准:仓库里的 `version` 始终指向最近一次已发布版本。
29
-
30
- 发布顺序:
31
-
32
- 1. 跑完测试;
33
- 2. 按重大/功能/修复位更新 `package.json` 和 README 徽章;
34
- 3. 提交发布改动;
35
- 4. 创建对应的 Git tag 和 GitHub Release;
36
- 5. 推送提交与 tag。
37
-
38
- ### npm 发布
39
-
40
- npm 上的包名是 `dsh-ai-for-memory`;`package.json` 已移除 `private`,并限制 `files` 只打包入口、lib、文档、locale、示例模型 README 和许可证,`models/.engine.lock` 不会被发布。
41
-
42
- 首次发布必须由有 npm 账号和 2FA 的维护者手动完成:`npm login` 后先跑 `npm publish --dry-run` 检查包内容,再 `npm publish`。npm 不支持为尚不存在的包预配置 Trusted Publisher,所以第一步不能直接交给 CI。
43
-
44
- 首版成功后,在 npm 包设置里配置 GitHub Actions Trusted Publisher(仓库 `kuugakw/dsh-ai-for-memory`,workflow 文件名 `publish-npm.yml`,允许 `npm publish`),后续版本即可用 OIDC 无 token 发布并自动生成 provenance。要求 npm CLI 11.5.1+、Node 22.14+、公开仓库和匹配的 `repository`;发布 workflow 需要 `id-token: write`,不需要 `NODE_AUTH_TOKEN`。本地或 CI 直接发布时都必须满足 npm 的 2FA 要求。
45
-
46
- ## 开发与测试
47
-
48
- 要求 Node.js 20+。
49
-
50
- ```bash
51
- npm test
52
- # 等价于
53
- node --test test/core.test.mjs
54
- ```
55
-
56
- 当前测试覆盖六层读写、对话隔离、上下文清理/恢复、知识冲突、模型自述确认、事故记录、SQL 路由、RAG 构建、导出、面板数据组装,以及本地引擎的 GGUF 发现和 llama.cpp 启动参数等。
57
-
58
- 全套 193 个用例。Node 20 上 13 项依赖 `node:sqlite` 或 zstd 的用例会 skip(180 pass / 13 skip),另有 2 项使用 shell 包装器的引擎用例只在 POSIX 上运行(Windows 上 178 pass / 15 skip);Node 22 在 Linux / macOS 全过(Windows 190 pass / 3 skip)。CI 同时跑 Node 20 与 22。新用例若依赖运行时能力,用 `t.skip()` 标注原因,保持这条边界可核对。
59
-
60
- 主要代码:
61
-
62
- ```text
63
- index.js # 插件入口和六个工具
64
- lib/session-repair.js # DSH 会话日志体检与修复(zstd 多帧、格式校验、备份/原子写回)
65
- client.js # Web 面板
66
- lib/store.js # 文件存储和六层数据
67
- lib/scopes.js # 对话隔离、共享层、工作区分组
68
- lib/knowledge.js # 知识规范化、冲突、提炼候选
69
- lib/retrieval.js # 本地 BM25 / 向量 / RRF
70
- lib/knowledge-query.js # SQL 路由和临时只读表
71
- lib/knowledge-sqlite.js # SQLite 只读镜像
72
- lib/rag.js # RAG 分片索引
73
- lib/local-engine.js # 本地 llama.cpp 引擎生命周期
74
- lib/api.js # 面板 API
75
- lib/context.js # 上下文保存 / 恢复
76
- lib/decision.js # 决策审查
77
- lib/external.js # OpenAI 兼容外部服务
78
- lib/export.js # 知识库 / SQL / RAG 导出
79
- test/core.test.mjs # 测试
80
- ```
81
-
82
- ---
1
+ # 开发与测试
2
+
3
+ > 返回 [主 README](../README.md)。
4
+
5
+ ## 项目定位
6
+
7
+ AI for Memory 是面向 DSH 的**项目级记忆插件**。记忆类插件已有不少实现,本项目不声称发明了新品类;发布说明统一使用“本插件的第 N 个正式版”,不要写成“首个项目级正式版”或暗示这是同类插件的第一次出现。
8
+
9
+ ## 版本号与发布
10
+
11
+ 从 `0.1.0` 起使用三段式版本号:
12
+
13
+ | 位置 | 含义 | 示例 |
14
+ |---|---|---|
15
+ | 第一位 | 重大更新:工具大范围修改、接口或存储格式调整、需要迁移 | `0.1.0` → `1.0.0` |
16
+ | 第二位 | 功能更新:新增工具、动作、面板能力,保持向后兼容 | `0.1.0` → `0.2.0` |
17
+ | 第三位 | 修复更新:只修 bug,不改变既有接口 | `0.2.0` → `0.2.1` |
18
+
19
+ 版本号以 `package.json` 的 `version` 为准,README 徽章、发布标签和面板显示必须与它一致。每次发布都要同时更新这三处。
20
+
21
+ Release 标题**只写版本号**(如 `0.1.1`),不写「第 N 个正式版」之类的附加说明;更新频率高,标题保持与 tag 一致即可。正文说明这次是修复、功能还是重大更新,以及主要变化。
22
+
23
+ **什么时候改版本号:**
24
+
25
+ - 本地开发、修 bug、未发布的改动:不改版本号;
26
+ - 只有准备发布到 GitHub 时才改:更新 `package.json` 的 `version`、README 徽章和发布标签/GitHub Release;
27
+ - 普通开发提交(包括只推送到分支、还没有正式发布的提交)不算发布;
28
+ - 判断标准:仓库里的 `version` 始终指向最近一次已发布版本。
29
+
30
+ 发布顺序:
31
+
32
+ 1. 跑完测试;
33
+ 2. 按重大/功能/修复位更新 `package.json` 和 README 徽章;
34
+ 3. 提交发布改动;
35
+ 4. 创建对应的 Git tag 和 GitHub Release;
36
+ 5. 推送提交与 tag。
37
+
38
+ ### npm 发布
39
+
40
+ npm 上的包名是 `dsh-ai-for-memory`;`package.json` 已移除 `private`,并限制 `files` 只打包入口、lib、文档、locale、示例模型 README 和许可证,`models/.engine.lock` 不会被发布。
41
+
42
+ 首版 `0.5.1` 已手动发布。包现已配置 GitHub Actions Trusted Publisher:仓库 `kuugakw/dsh-ai-for-memory`,workflow 文件名 `publish.yml`,允许 `npm publish`。后续发布只需要推送 `v*` tag,`.github/workflows/publish.yml` 会跑测试并通过 OIDC 发布,自动生成 npm provenance;需要 npm CLI 11.5.1+、Node 22.14+、公开仓库和匹配的 `repository`。workflow 需要 `id-token: write`,不需要 `NODE_AUTH_TOKEN`。
43
+
44
+ 本地手工发布仍可用 `npm publish --dry-run` 检查包内容,再 `npm publish`;本地发布必须满足 npm 的 2FA 要求,且不会生成 CI provenance。
45
+
46
+ ## 开发与测试
47
+
48
+ 要求 Node.js 20+。
49
+
50
+ ```bash
51
+ npm test
52
+ # 等价于
53
+ node --test test/core.test.mjs
54
+ ```
55
+
56
+ 当前测试覆盖六层读写、对话隔离、上下文清理/恢复、知识冲突、模型自述确认、事故记录、SQL 路由、RAG 构建、导出、面板数据组装,以及本地引擎的 GGUF 发现和 llama.cpp 启动参数等。
57
+
58
+ 全套 193 个用例。Node 20 上 13 项依赖 `node:sqlite` 或 zstd 的用例会 skip(180 pass / 13 skip),另有 2 项使用 shell 包装器的引擎用例只在 POSIX 上运行(Windows 上 178 pass / 15 skip);Node 22 在 Linux / macOS 全过(Windows 190 pass / 3 skip)。CI 同时跑 Node 20 与 22。新用例若依赖运行时能力,用 `t.skip()` 标注原因,保持这条边界可核对。
59
+
60
+ 主要代码:
61
+
62
+ ```text
63
+ index.js # 插件入口和六个工具
64
+ lib/session-repair.js # DSH 会话日志体检与修复(zstd 多帧、格式校验、备份/原子写回)
65
+ client.js # Web 面板
66
+ lib/store.js # 文件存储和六层数据
67
+ lib/scopes.js # 对话隔离、共享层、工作区分组
68
+ lib/knowledge.js # 知识规范化、冲突、提炼候选
69
+ lib/retrieval.js # 本地 BM25 / 向量 / RRF
70
+ lib/knowledge-query.js # SQL 路由和临时只读表
71
+ lib/knowledge-sqlite.js # SQLite 只读镜像
72
+ lib/rag.js # RAG 分片索引
73
+ lib/local-engine.js # 本地 llama.cpp 引擎生命周期
74
+ lib/api.js # 面板 API
75
+ lib/context.js # 上下文保存 / 恢复
76
+ lib/decision.js # 决策审查
77
+ lib/external.js # OpenAI 兼容外部服务
78
+ lib/export.js # 知识库 / SQL / RAG 导出
79
+ test/core.test.mjs # 测试
80
+ ```
81
+
82
+ ---
package/docs/features.md CHANGED
@@ -4,7 +4,7 @@
4
4
  >
5
5
  > 它不替代主 [README](../README.md),也不替代安装、工具参数、面板操作、本地模型等专门文档。需要精确操作时,请以对应文档和面板为准。
6
6
  >
7
- > 对应版本:**0.5.1**。
7
+ > 对应版本:**0.5.2**。
8
8
 
9
9
  ---
10
10
 
@@ -26,7 +26,17 @@ git check-ignore -v .ai-for-memory/
26
26
 
27
27
  ### 2. 安装 bundle
28
28
 
29
- 在 DSH 中执行:
29
+ 推荐从 npm 安装:
30
+
31
+ ```bash
32
+ dsh plugin --profile <profile> add dsh-ai-for-memory@0.5.2
33
+ ```
34
+
35
+ `<profile>` 换成你的 DSH profile(例如 `desktop`)。安装后重启 DSH;工具、侧栏入口和面板由 bundle 自动加载。
36
+
37
+ 也可以在 DSH 的 **设置 → 插件 → 添加插件** 中直接填 npm 包名 `dsh-ai-for-memory` 安装。
38
+
39
+ 本地开发或离线安装仍然可以用目录:
30
40
 
31
41
  ```text
32
42
  plugin_manager action=install_bundle target=<dsh-ai-for-memory 目录>
@@ -41,6 +51,7 @@ plugin_manager action=install_bundle target=<dsh-ai-for-memory 目录>
41
51
  环境要求:
42
52
 
43
53
  - **Node.js 20+** 可以运行插件和本地记忆;
54
+ - **DSH 0.2.x**(`>=0.2.0-rc.1 <0.3.0`);
44
55
  - **SQL 查询和 SQLite 镜像**需要运行时有 `node:sqlite`(Node 22.5+ 起内置);
45
56
  - RAG 需要配置外部 Embedding 和 Rerank 服务,不需要 `node:sqlite`。
46
57
 
@@ -54,12 +65,23 @@ aim_memory action=status
54
65
 
55
66
  ### 4. 升级与卸载
56
67
 
57
- 升级前先备份整个记忆目录。建议移除旧 bundle、重新安装,然后重新加载插件,不要只替换文件。
68
+ 升级前先备份整个记忆目录。
58
69
 
59
- ```text
60
- plugin_manager action=remove_bundle target=dsh-ai-for-memory
70
+ ```bash
71
+ # 升级到当前 npm 最新版
72
+ dsh plugin --profile <profile> add dsh-ai-for-memory@latest
61
73
  ```
62
74
 
75
+ 安装后重启 DSH。旧 bundle 也可以先在「设置 → 插件」里移除,再重新安装;不建议只替换文件。
76
+
77
+ 卸载:
78
+
79
+ ```bash
80
+ dsh plugin --profile <profile> remove dsh-ai-for-memory
81
+ ```
82
+
83
+ 用 `plugin_manager` 安装的本地目录,仍用 `plugin_manager action=remove_bundle target=dsh-ai-for-memory` 卸载。
84
+
63
85
  旧的根目录数据会留在共享层;旧对话目录会在下次使用或下一轮结束时补上元数据。旧版 RAG 单文件索引不再读取,需要重新建立。
64
86
 
65
87
  ---
package/package.json CHANGED
@@ -1,72 +1,80 @@
1
- {
2
- "name": "dsh-ai-for-memory",
3
- "version": "0.5.1",
4
- "type": "module",
5
- "description": "面向 DSH 的项目级记忆插件:按对话隔离的六层项目记忆、共享层、可检索知识库、可恢复上下文、风险决策审查,以及可选的 SQL/RAG/本地 llama.cpp 检索增强。",
6
- "exports": {
7
- ".": "./index.js",
8
- "./client": "./client.js",
9
- "./locale/*.json": "./locale/*.json",
10
- "./icon": "./icon.svg"
11
- },
12
- "files": [
13
- "index.js",
14
- "client.js",
15
- "lib",
16
- "models/README.md",
17
- "models/Embedding/README.md",
18
- "models/Rerank/README.md",
19
- "models/Routing/README.md",
20
- "cordis.patch.yml",
21
- "locale/*.json",
22
- "icon.svg",
23
- "README.md",
24
- "CHANGELOG.md",
25
- "docs",
26
- "LICENSE"
27
- ],
28
- "engines": {
29
- "node": ">=20"
30
- },
31
- "dsh": {
32
- "bundle": {
33
- "patch": "./cordis.patch.yml"
34
- },
35
- "client": {
36
- "platform": "web",
37
- "immediately": true,
38
- "inject": []
39
- }
40
- },
41
- "scripts": {
42
- "test": "node --test test/core.test.mjs",
43
- "prepublishOnly": "npm test"
44
- },
45
- "publishConfig": {
46
- "access": "public"
47
- },
48
- "author": "kuugakw",
49
- "repository": {
50
- "type": "git",
51
- "url": "git+https://github.com/kuugakw/dsh-ai-for-memory.git"
52
- },
53
- "homepage": "https://github.com/kuugakw/dsh-ai-for-memory#readme",
54
- "bugs": {
55
- "url": "https://github.com/kuugakw/dsh-ai-for-memory/issues"
56
- },
57
- "keywords": [
58
- "dsh",
59
- "dsh-plugin",
60
- "deepseek-harness",
61
- "memory",
62
- "snapshot",
63
- "bm25",
64
- "decision-review",
65
- "rag",
66
- "embeddings",
67
- "rerank",
68
- "sqlite",
69
- "text-to-sql"
70
- ],
71
- "license": "MIT"
72
- }
1
+ {
2
+ "name": "dsh-ai-for-memory",
3
+ "version": "0.5.2",
4
+ "type": "module",
5
+ "description": "面向 DSH 的项目级记忆插件:按对话隔离的六层项目记忆、共享层、可检索知识库、可恢复上下文、风险决策审查,以及可选的 SQL/RAG/本地 llama.cpp 检索增强。",
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./client": "./client.js",
9
+ "./locale/*.json": "./locale/*.json",
10
+ "./icon": "./icon.svg"
11
+ },
12
+ "files": [
13
+ "index.js",
14
+ "client.js",
15
+ "lib",
16
+ "models/README.md",
17
+ "models/Embedding/README.md",
18
+ "models/Rerank/README.md",
19
+ "models/Routing/README.md",
20
+ "cordis.patch.yml",
21
+ "locale/*.json",
22
+ "icon.svg",
23
+ "README.md",
24
+ "CHANGELOG.md",
25
+ "docs",
26
+ "LICENSE"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20",
30
+ "dsh": ">=0.2.0-rc.1 <0.3.0"
31
+ },
32
+ "dsh": {
33
+ "bundle": {
34
+ "patch": "./cordis.patch.yml"
35
+ },
36
+ "client": {
37
+ "platform": "web",
38
+ "immediately": true,
39
+ "inject": []
40
+ },
41
+ "compatibility": {
42
+ "dsh": ">=0.2.0-rc.1 <0.3.0"
43
+ }
44
+ },
45
+ "scripts": {
46
+ "test": "node --test test/core.test.mjs",
47
+ "prepublishOnly": "npm test"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "provenance": true
52
+ },
53
+ "author": "kuugakw",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/kuugakw/dsh-ai-for-memory.git"
57
+ },
58
+ "homepage": "https://github.com/kuugakw/dsh-ai-for-memory#readme",
59
+ "bugs": {
60
+ "url": "https://github.com/kuugakw/dsh-ai-for-memory/issues"
61
+ },
62
+ "keywords": [
63
+ "dsh",
64
+ "dsh-plugin",
65
+ "deepseek-harness",
66
+ "memory",
67
+ "snapshot",
68
+ "bm25",
69
+ "decision-review",
70
+ "rag",
71
+ "embeddings",
72
+ "rerank",
73
+ "sqlite",
74
+ "text-to-sql",
75
+ "context",
76
+ "compaction",
77
+ "repair"
78
+ ],
79
+ "license": "MIT"
80
+ }