dsh-prime-memory 0.11.0

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.
Files changed (151) hide show
  1. package/CHANGELOG.en.md +28 -0
  2. package/CHANGELOG.ja.md +30 -0
  3. package/CHANGELOG.ko.md +30 -0
  4. package/CHANGELOG.md +1220 -0
  5. package/ENGINEERING-NOTES.md +452 -0
  6. package/INSTALL.en.md +92 -0
  7. package/INSTALL.ja.md +92 -0
  8. package/INSTALL.ko.md +92 -0
  9. package/INSTALL.md +92 -0
  10. package/LICENSE +21 -0
  11. package/README.en.md +458 -0
  12. package/README.ja.md +306 -0
  13. package/README.ko.md +306 -0
  14. package/README.md +425 -0
  15. package/assets/changelog/0.8.10/01-write-only-pill.png +0 -0
  16. package/assets/changelog/0.8.9/01-panel.png +0 -0
  17. package/assets/changelog/0.8.9/02-halo.png +0 -0
  18. package/assets/changelog/0.8.9/03-layer-segmented-panel.png +0 -0
  19. package/assets/changelog/0.8.9/04-layer-l1-panel.png +0 -0
  20. package/assets/img/EmbeddingSource.png +0 -0
  21. package/assets/img/Hero.png +0 -0
  22. package/assets/img/Layers.png +0 -0
  23. package/assets/img/MemoryTools.png +0 -0
  24. package/assets/img/Modes.png +0 -0
  25. package/assets/img/ToolTrajectory.png +0 -0
  26. package/assets/img/ui-dark.jpg +0 -0
  27. package/assets/img/ui-light.jpg +0 -0
  28. package/assets/readme/bench-dialog.svg +70 -0
  29. package/assets/readme/bench-workflow.svg +79 -0
  30. package/assets/readme/flow.svg +189 -0
  31. package/assets/readme/storage.svg +115 -0
  32. package/cordis.patch.yml +16 -0
  33. package/dist/bench-control.d.ts +34 -0
  34. package/dist/bench-control.js +16 -0
  35. package/dist/client.js +4293 -0
  36. package/dist/config.d.ts +683 -0
  37. package/dist/config.js +129 -0
  38. package/dist/contract.d.ts +820 -0
  39. package/dist/contract.js +1 -0
  40. package/dist/embedding-worker.cjs +176 -0
  41. package/dist/graph/apply.d.ts +37 -0
  42. package/dist/graph/apply.js +270 -0
  43. package/dist/graph/constraints.d.ts +47 -0
  44. package/dist/graph/constraints.js +38 -0
  45. package/dist/graph/search.d.ts +16 -0
  46. package/dist/graph/search.js +115 -0
  47. package/dist/graph/types.d.ts +142 -0
  48. package/dist/graph/types.js +14 -0
  49. package/dist/hooks/capture.d.ts +32 -0
  50. package/dist/hooks/capture.js +194 -0
  51. package/dist/hooks/recall.d.ts +63 -0
  52. package/dist/hooks/recall.js +429 -0
  53. package/dist/index.d.ts +534 -0
  54. package/dist/index.js +344 -0
  55. package/dist/llm-usage.d.ts +26 -0
  56. package/dist/llm-usage.js +37 -0
  57. package/dist/llm.d.ts +153 -0
  58. package/dist/llm.js +530 -0
  59. package/dist/pipeline/graph.d.ts +35 -0
  60. package/dist/pipeline/graph.js +104 -0
  61. package/dist/pipeline/l1.d.ts +19 -0
  62. package/dist/pipeline/l1.js +271 -0
  63. package/dist/pipeline/l2.d.ts +13 -0
  64. package/dist/pipeline/l2.js +83 -0
  65. package/dist/pipeline/l3.d.ts +15 -0
  66. package/dist/pipeline/l3.js +78 -0
  67. package/dist/pipeline/rebuild.d.ts +61 -0
  68. package/dist/pipeline/rebuild.js +307 -0
  69. package/dist/pipeline/ruminate.d.ts +89 -0
  70. package/dist/pipeline/ruminate.js +298 -0
  71. package/dist/pipeline/runner.d.ts +167 -0
  72. package/dist/pipeline/runner.js +638 -0
  73. package/dist/pipeline/trigger.d.ts +40 -0
  74. package/dist/pipeline/trigger.js +75 -0
  75. package/dist/prompts/graph-projection.d.ts +70 -0
  76. package/dist/prompts/graph-projection.js +167 -0
  77. package/dist/prompts/l1-dedup.d.ts +22 -0
  78. package/dist/prompts/l1-dedup.js +251 -0
  79. package/dist/prompts/l1-extraction.d.ts +22 -0
  80. package/dist/prompts/l1-extraction.js +457 -0
  81. package/dist/prompts/persona.d.ts +23 -0
  82. package/dist/prompts/persona.js +240 -0
  83. package/dist/prompts/scene.d.ts +32 -0
  84. package/dist/prompts/scene.js +414 -0
  85. package/dist/runtime-package-lock.json +982 -0
  86. package/dist/settings.d.ts +50 -0
  87. package/dist/settings.js +355 -0
  88. package/dist/stats.d.ts +109 -0
  89. package/dist/stats.js +929 -0
  90. package/dist/store/bm25.d.ts +19 -0
  91. package/dist/store/bm25.js +63 -0
  92. package/dist/store/cost-ledger.d.ts +75 -0
  93. package/dist/store/cost-ledger.js +171 -0
  94. package/dist/store/download-queue.d.ts +79 -0
  95. package/dist/store/download-queue.js +424 -0
  96. package/dist/store/embedding-source.d.ts +118 -0
  97. package/dist/store/embedding-source.js +443 -0
  98. package/dist/store/embedding.d.ts +90 -0
  99. package/dist/store/embedding.js +206 -0
  100. package/dist/store/graph-store.d.ts +94 -0
  101. package/dist/store/graph-store.js +641 -0
  102. package/dist/store/l0.d.ts +40 -0
  103. package/dist/store/l0.js +197 -0
  104. package/dist/store/l1.d.ts +93 -0
  105. package/dist/store/l1.js +297 -0
  106. package/dist/store/local-embedding.d.ts +89 -0
  107. package/dist/store/local-embedding.js +227 -0
  108. package/dist/store/model-catalog.d.ts +48 -0
  109. package/dist/store/model-catalog.js +81 -0
  110. package/dist/store/occupancy.d.ts +30 -0
  111. package/dist/store/occupancy.js +134 -0
  112. package/dist/store/pending.d.ts +36 -0
  113. package/dist/store/pending.js +103 -0
  114. package/dist/store/persona.d.ts +15 -0
  115. package/dist/store/persona.js +60 -0
  116. package/dist/store/recall-dedupe.d.ts +26 -0
  117. package/dist/store/recall-dedupe.js +138 -0
  118. package/dist/store/runtime-installer.d.ts +59 -0
  119. package/dist/store/runtime-installer.js +243 -0
  120. package/dist/store/scenes.d.ts +24 -0
  121. package/dist/store/scenes.js +160 -0
  122. package/dist/store/search-utils.d.ts +38 -0
  123. package/dist/store/search-utils.js +100 -0
  124. package/dist/store/session-modes.d.ts +35 -0
  125. package/dist/store/session-modes.js +144 -0
  126. package/dist/store/sqlite.d.ts +246 -0
  127. package/dist/store/sqlite.js +1491 -0
  128. package/dist/store/state.d.ts +41 -0
  129. package/dist/store/state.js +72 -0
  130. package/dist/token-cost.d.ts +23 -0
  131. package/dist/token-cost.js +185 -0
  132. package/dist/tools/index.d.ts +34 -0
  133. package/dist/tools/index.js +758 -0
  134. package/dist/types.d.ts +139 -0
  135. package/dist/types.js +38 -0
  136. package/dist/util/context-occupancy.d.ts +68 -0
  137. package/dist/util/context-occupancy.js +92 -0
  138. package/dist/util/filelog.d.ts +6 -0
  139. package/dist/util/filelog.js +108 -0
  140. package/dist/util/io.d.ts +18 -0
  141. package/dist/util/io.js +97 -0
  142. package/dist/util/recall-budget.d.ts +31 -0
  143. package/dist/util/recall-budget.js +84 -0
  144. package/dist/util/sanitize.d.ts +11 -0
  145. package/dist/util/sanitize.js +67 -0
  146. package/dist/util/text.d.ts +16 -0
  147. package/dist/util/text.js +61 -0
  148. package/dist/util/tokenizer.d.ts +9 -0
  149. package/dist/util/tokenizer.js +50 -0
  150. package/dsh.plugin.json +22 -0
  151. package/package.json +118 -0
package/INSTALL.ko.md ADDED
@@ -0,0 +1,92 @@
1
+ # 설치 안내(dsh-prime-memory)
2
+
3
+ 본 플러그인은 **DSH 공식 bundle 합성 패키지**로 배포됩니다. 설치 후 `cordis.patch.yml`의 `dsh.bundle` 계층이 플러그인 행을 자동 마운트하므로 profile 설정을 손으로 고칠 필요가 없습니다.
4
+
5
+ ## 환경 요구
6
+
7
+ - Node.js ≥ 22.16(DSH 0.1.1-rc.2 이상)
8
+ - DeepSeek Harness(이하 DSH)설치 완료, `--profile web` 사용 가능
9
+
10
+ ## 설치
11
+
12
+ 두 가지 호출 방식 중 선택(`npx` 접두사는 아래 어떤 `dsh` 명령도 대체 가능):
13
+
14
+ ```bash
15
+ # 방식 1: npx로 공식 CLI 직접 실행(dsh 사전 설치 불필요. 버전 고정 가능, 예: dsh-prime-memory@0.8.4)
16
+ npx -y @deepseek-ai/dsh plugin --profile web add dsh-prime-memory
17
+
18
+ # 방식 2: dsh CLI 설치된 경우(dsh는 pnpm 포워더. 없으면 먼저 npm i -g pnpm)
19
+ dsh plugin --profile web add dsh-prime-memory
20
+
21
+ # 기타 소스: GitHub 저장소 / 로컬 경로(개발·디버깅용. link: 는 저장소를 가리키며, npm run build + dsh 재시작으로 반영)
22
+ dsh plugin --profile web add https://github.com/drscrewdriver/dsh-prime-memory
23
+ dsh plugin --profile web add /path/to/dsh-prime-memory
24
+ ```
25
+
26
+ ### Agent에게 설치시키기(권장)
27
+
28
+ 현재 Agent가 터미널 명령을 실행할 수 있다면 아래 문장을 그대로 보내세요:
29
+
30
+ ```text
31
+ DeepSeek Harness의 web 프로파일에 dsh-prime-memory 플러그인을 설치해 주세요.
32
+
33
+ 다른 프로파일은 수정하지 말고 아래 두 명령만 실행해 주세요:
34
+ dsh plugin --profile web add dsh-prime-memory
35
+ dsh --profile web --dump-config
36
+
37
+ 출력에 dsh-prime-memory가 나타나면 설치 결과를 알려 주세요.
38
+ 실행 중인 DSH를 임의로 닫거나 재시작하지 마세요. 설치 후 DSH Web Host 수동 재시작을 알려 주세요.
39
+ ```
40
+
41
+ ## 업그레이드
42
+
43
+ ```bash
44
+ # 최신版으로
45
+ dsh plugin --profile web update dsh-prime-memory
46
+
47
+ # 특정 버전으로
48
+ dsh plugin --profile web update dsh-prime-memory@0.8.11
49
+ ```
50
+
51
+ 업그레이드는 플러그인 코드와 `dist/` 산출물만 교체하며, 데이터 디렉터리 `~/.dsh/memory/`에는 영향이 없습니다.
52
+
53
+ ## 검증
54
+
55
+ DSH Web Host 재시작 후 확인:
56
+
57
+ 1. **데이터 디렉터리가 나타남**=플러그인 적용 성공:`~/.dsh/memory/` 아래에 `conversations/` `records/` `scenes/`와 `memory.db`가 나타남;
58
+ 2. **설정에 "기억" 페이지**, 입력 바에 모드 pill이 나타남=클라이언트 준비 완료;
59
+ 3. 개인정보를 담은 메시지를 보내고 증류 완료 후, 다른 턴에서 관련을 물으면 컨텍스트에 "컨텍스트 주입 · memory" 행이 보여야 함.
60
+
61
+ 선택 스모크 테스트(개발·장애 대응용):
62
+
63
+ ```bash
64
+ npm run build
65
+ npx tsc src/smoke.ts --outDir dist-smoke --module nodenext --moduleResolution nodenext --target es2022 --strict --skipLibCheck --esModuleInterop
66
+ node dist-smoke/smoke.js
67
+ ```
68
+
69
+ ## 마이그레이션 / 다운그레이드
70
+
71
+ - **구버전(0.5.0 이전은 `dsh-memory-plugin`)에서 이전**:구 데이터 디렉터리는 신패키지와 호환되지 않습니다. 백업 후 `~/.dsh/memory/`를 삭제하고 신플러그인 초회 실행에서 재구축하세요. 내역은 그대로 승격 불가하며 재증류가 필요합니다.
72
+ - **구버전으로 롤백**:`dsh plugin --profile web remove dsh-prime-memory` 후 구버전 문서로 재설치. 데이터 디렉터리는 남지만 구버전은 신레이아웃을 읽지 못하므로 함께 삭제 권장.
73
+
74
+ ## 제거
75
+
76
+ ```bash
77
+ dsh plugin --profile web remove dsh-prime-memory
78
+ ```
79
+
80
+ 데이터는 `~/.dsh/memory/`에 남습니다. 필요 없으면 디렉터리 전체를 수동 삭제하세요.
81
+
82
+ ## 문제 해결
83
+
84
+ | 현상 | 가능한 원인 | 조치 |
85
+ | --- | --- | --- |
86
+ | 설치 후 "기억" 페이지 없음 | DSH 미재시작 / bundle 미마운트 | DSH Web Host 재시작. `dsh --profile web --dump-config`로 `dsh-prime-memory` 확인 |
87
+ | 기동 시 `duplicate loader entry id` | patch가 `insert:`와 bundle 동일 id 중복 추가 | 수동 `insert:` 삭제(본 패키지는 bundle 계층 동봉) |
88
+ | "컨텍스트 주입 · memory" 행 없음 | 증류 미실행 / 회상 꺼짐 | 모드가 off 아니며 `recall.enabled=true` 확인. `memory.log`의 `L1 단계 완료` 확인 |
89
+ | 로컬 임베딩 다운로드 멈춤 | 미러 직결 불가 | `embedding.proxy`로 프록시 설정, 또는 `embedding.mirror`을 공식 `huggingface.co`로 |
90
+ | 원격 임베딩 401 오류 | apiKey 오류 / 무키 서비스에 key 불필요 | `embedding.apiKey` 확인. self-host 무키 서비스는 apiKey 비움 |
91
+
92
+ 자세한 것은 [README.ko.md](./README.ko.md)와 [CHANGELOG.ko.md](./CHANGELOG.ko.md) 참조.
package/INSTALL.md ADDED
@@ -0,0 +1,92 @@
1
+ # 安装指南(dsh-prime-memory)
2
+
3
+ 本插件以 **DSH 官方 bundle 组合包**形式分发:安装后由 `cordis.patch.yml` 的 `dsh.bundle` 层自动挂载插件行,无需手改任何 profile 配置。
4
+
5
+ ## 环境要求
6
+
7
+ - Node.js ≥ 22.16(DSH 0.1.1-rc.2 及以上)
8
+ - 已安装 DeepSeek Harness(以下简称 DSH),且 `--profile web` 可用
9
+
10
+ ## 安装
11
+
12
+ 任选一种调用方式(`npx` 前缀可替换下面任何 `dsh` 命令):
13
+
14
+ ```bash
15
+ # 方式一:npx 直接跑官方 CLI(无需预装 dsh;可 pin 版本,如 dsh-prime-memory@0.8.4)
16
+ npx -y @deepseek-ai/dsh plugin --profile web add dsh-prime-memory
17
+
18
+ # 方式二:已装 dsh CLI(dsh 是 pnpm 转发器,未装 pnpm 时先 npm i -g pnpm)
19
+ dsh plugin --profile web add dsh-prime-memory
20
+
21
+ # 包源备选:GitHub 仓库 / 本地路径(开发调试,link: 指向仓库,npm run build + 重启 dsh 即生效)
22
+ dsh plugin --profile web add https://github.com/drscrewdriver/dsh-prime-memory
23
+ dsh plugin --profile web add /path/to/dsh-prime-memory
24
+ ```
25
+
26
+ ### 让 Agent 安装(推荐)
27
+
28
+ 把下面这段话完整发送给当前 Agent(只要它能执行终端命令):
29
+
30
+ ```text
31
+ 请为 DeepSeek Harness 的 web Profile 安装 dsh-prime-memory 插件。
32
+
33
+ 只执行下面两条命令,不要修改其他 Profile:
34
+ dsh plugin --profile web add dsh-prime-memory
35
+ dsh --profile web --dump-config
36
+
37
+ 确认输出中出现 dsh-prime-memory 后告诉我安装结果。
38
+ 不要替我关闭或重启正在运行的 DSH;安装完成后提醒我手动重启 DSH Web Host。
39
+ ```
40
+
41
+ ## 升级
42
+
43
+ ```bash
44
+ # 升级到最新版
45
+ dsh plugin --profile web update dsh-prime-memory
46
+
47
+ # 升级到指定版本
48
+ dsh plugin --profile web update dsh-prime-memory@0.8.11
49
+ ```
50
+
51
+ 升级只替换插件代码与 `dist/` 产物,数据目录 `~/.dsh/memory/` 不受影响。
52
+
53
+ ## 验证
54
+
55
+ 安装并重启 DSH Web Host 后检查:
56
+
57
+ 1. **数据目录出现**即插件 apply 成功:`~/.dsh/memory/` 下出现 `conversations/` `records/` `scenes/` 目录与 `memory.db`;
58
+ 2. **设置页出现「记忆」页面**、输入栏出现档位 pill 即 client 半边就绪;
59
+ 3. 发一条带个人信息的消息,稍等蒸馏完成后,在另一轮对话里问到相关信息,应能在上下文看到「上下文注入 · memory」行。
60
+
61
+ 可选冒烟测试(开发/排障用):
62
+
63
+ ```bash
64
+ npm run build
65
+ npx tsc src/smoke.ts --outDir dist-smoke --module nodenext --moduleResolution nodenext --target es2022 --strict --skipLibCheck --esModuleInterop
66
+ node dist-smoke/smoke.js
67
+ ```
68
+
69
+ ## 迁移 / 降级
70
+
71
+ - **从旧版(0.5.0 前名为 `dsh-memory-plugin`)迁移**:旧数据目录与新包不兼容,请备份后删除 `~/.dsh/memory/`,由新插件首次运行重建;历史记忆不可直接升级,需重新蒸馏。
72
+ - **回退到旧版**:`dsh plugin --profile web remove dsh-prime-memory` 后按旧版文档重装;数据目录保留,但旧版不识别新结构,建议一并清理。
73
+
74
+ ## 卸载
75
+
76
+ ```bash
77
+ dsh plugin --profile web remove dsh-prime-memory
78
+ ```
79
+
80
+ 数据保留在 `~/.dsh/memory/`,不需要时手动删除整个目录即可。
81
+
82
+ ## 故障排查
83
+
84
+ | 现象 | 可能原因 | 处理 |
85
+ | --- | --- | --- |
86
+ | 安装后设置页无「记忆」页 | 未重启 DSH / bundle 未挂载 | 重启 DSH Web Host;`dsh --profile web --dump-config` 确认含 `dsh-prime-memory` |
87
+ | 重启报 `duplicate loader entry id` | patch 里同时用了 `insert:` 与 bundle 同 id 追加 | 删除手动加的 `insert:` 条目,本包已自带 bundle 层 |
88
+ | 无「上下文注入 · memory」行 | 蒸馏未跑 / 召回关闭 | 检查档位非 off、recall.enabled=true;看 `memory.log` 的 `L1 阶段完成` |
89
+ | 本地嵌入档下载卡住 | 镜像直连不可达 | 设 `embedding.proxy` 走代理;或换 `embedding.mirror` 为官方 `huggingface.co` |
90
+ | 远程嵌入报错 401 | apiKey 错 / 免 key 服务不应传 key | 检查 `embedding.apiKey`;自托管免 key 服务保持 apiKey 为空 |
91
+
92
+ 更多见 [README.md](./README.md) 与 [CHANGELOG.md](./CHANGELOG.md)。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 drscrewdriver
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.