@chenhw7/dsh-memory 0.1.0 → 0.1.1
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 +69 -35
- package/README.zh-CN.md +71 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ This is a **self-contained single package** (not a multi-package workspace). It
|
|
|
10
10
|
|
|
11
11
|
- [Features](#features)
|
|
12
12
|
- [Install](#install)
|
|
13
|
+
- [Uninstall](#uninstall)
|
|
13
14
|
- [Verify](#verify)
|
|
14
15
|
- [Troubleshooting](#troubleshooting)
|
|
15
16
|
- [Configuration](#configuration)
|
|
@@ -34,7 +35,7 @@ Your dsh agent normally forgets everything when you close a session. This bundle
|
|
|
34
35
|
|
|
35
36
|
### Prerequisites
|
|
36
37
|
|
|
37
|
-
- [Node.js](https://nodejs.org)
|
|
38
|
+
- [Node.js](https://nodejs.org) installed.
|
|
38
39
|
- The `dsh` CLI available (globally or from a source checkout):
|
|
39
40
|
|
|
40
41
|
```sh
|
|
@@ -62,59 +63,70 @@ Your dsh agent normally forgets everything when you close a session. This bundle
|
|
|
62
63
|
|
|
63
64
|
- A profile you want to add memory to (this guide uses `web`).
|
|
64
65
|
|
|
65
|
-
### From
|
|
66
|
+
### From npm (recommended)
|
|
66
67
|
|
|
67
|
-
pnpm
|
|
68
|
-
|
|
69
|
-
**Step 1: allow the build script.** Edit your profile's `pnpm-workspace.yaml`:
|
|
68
|
+
One command. The published tarball ships prebuilt, so pnpm does not run any build script on your machine and no extra pnpm configuration is needed:
|
|
70
69
|
|
|
71
70
|
```sh
|
|
72
|
-
|
|
73
|
-
# macOS/Linux: ~/.dsh/profiles/web/pnpm-workspace.yaml
|
|
74
|
-
# Or $DSH_HOME/profiles/web/pnpm-workspace.yaml if you set DSH_HOME
|
|
71
|
+
dsh plugin add --profile web @chenhw7/dsh-memory
|
|
75
72
|
```
|
|
76
73
|
|
|
77
|
-
|
|
74
|
+
With a source checkout, run it from the `deepseek-harness` directory instead:
|
|
78
75
|
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
"@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/045a6f4402fac282fb649787bf3de38cad28c6bb": true
|
|
76
|
+
```sh
|
|
77
|
+
pnpm dsh plugin add --profile web @chenhw7/dsh-memory
|
|
82
78
|
```
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Some pnpm versions use the older list form instead:
|
|
80
|
+
To pin a version instead of `latest`:
|
|
88
81
|
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
- "@chenhw7/dsh-memory"
|
|
82
|
+
```sh
|
|
83
|
+
dsh plugin add --profile web @chenhw7/dsh-memory@0.1.1
|
|
92
84
|
```
|
|
93
85
|
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
### From GitHub (bleeding edge)
|
|
96
87
|
|
|
97
|
-
|
|
88
|
+
Use this only to test a commit that is newer than the latest npm release. pnpm blocks a git dependency's `prepare` (build) script until you explicitly allow it, so a profile without an `allowBuilds` entry needs **two runs**:
|
|
98
89
|
|
|
99
|
-
**Step
|
|
90
|
+
**Step 1: run the install once.** It will stop with:
|
|
100
91
|
|
|
101
92
|
```sh
|
|
102
93
|
dsh plugin add --profile web https://github.com/chenhw7/dsh-memory
|
|
103
94
|
```
|
|
104
95
|
|
|
105
|
-
|
|
96
|
+
```text
|
|
97
|
+
[ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] ... The git-hosted package "@chenhw7/dsh-memory@0.1.1"
|
|
98
|
+
needs to execute build scripts but is not in the "allowBuilds" allowlist.
|
|
99
|
+
...
|
|
100
|
+
allowBuilds:
|
|
101
|
+
@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<commit>: true
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Step 2: allow the exact key pnpm printed.** Edit the profile's `pnpm-workspace.yaml`:
|
|
106
105
|
|
|
107
106
|
```sh
|
|
108
|
-
|
|
107
|
+
# Windows: %USERPROFILE%\.dsh\profiles\web\pnpm-workspace.yaml
|
|
108
|
+
# macOS/Linux: ~/.dsh/profiles/web/pnpm-workspace.yaml
|
|
109
|
+
# Or $DSH_HOME/profiles/web/pnpm-workspace.yaml if you set DSH_HOME
|
|
109
110
|
```
|
|
110
111
|
|
|
112
|
+
and add the key from the error message (merge with existing content):
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
```yaml
|
|
115
|
+
allowBuilds:
|
|
116
|
+
"@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<the commit pnpm printed>": true
|
|
117
|
+
```
|
|
113
118
|
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
Some pnpm versions use the older list form instead:
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
onlyBuiltDependencies:
|
|
123
|
+
- "@chenhw7/dsh-memory"
|
|
116
124
|
```
|
|
117
125
|
|
|
126
|
+
If your pnpm names that field, use that form. Then re-run the `dsh plugin add` command.
|
|
127
|
+
|
|
128
|
+
> **Copy the key from pnpm's error, not from an old copy of this README.** The key includes the resolved commit, so it changes every time you install from a newer commit. This entry grants permission for the package's `prepare` script (`npm run build`) to run on your machine at install time — only allow packages whose source you trust. For a reproducible install, pin a commit (`dsh plugin add --profile web https://github.com/chenhw7/dsh-memory/archive/<commit>.tar.gz`) and allow the key pnpm prints for that pin.
|
|
129
|
+
|
|
118
130
|
### From a local checkout
|
|
119
131
|
|
|
120
132
|
If you want to hack on the plugin, clone and build it first, then install from the local path:
|
|
@@ -126,19 +138,41 @@ npm install && npm run build
|
|
|
126
138
|
dsh plugin add --profile web file:.
|
|
127
139
|
```
|
|
128
140
|
|
|
129
|
-
|
|
141
|
+
pnpm does not run build scripts for `file:` dependencies, so no `allowBuilds` entry is needed — the install copies the files as they are, which is why the `npm run build` step above matters: a missing or stale `lib/` is what you get installed.
|
|
130
142
|
|
|
131
143
|
### From a tarball (no build permission needed)
|
|
132
144
|
|
|
133
|
-
If you'd rather not
|
|
145
|
+
If you'd rather not install from the npm registry, pack a tarball from a checkout with `lib/` already built and install it — a tarball ships prebuilt, so no `allowBuilds` entry is needed:
|
|
134
146
|
|
|
135
147
|
```sh
|
|
136
148
|
cd dsh-memory
|
|
137
149
|
npm install && npm run build
|
|
138
|
-
npm pack # produces chenhw7-dsh-memory-0.1.
|
|
139
|
-
dsh plugin add --profile web ./chenhw7-dsh-memory-0.1.
|
|
150
|
+
npm pack # produces chenhw7-dsh-memory-0.1.1.tgz
|
|
151
|
+
dsh plugin add --profile web ./chenhw7-dsh-memory-0.1.1.tgz
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Uninstall
|
|
155
|
+
|
|
156
|
+
Remove the plugin from a profile:
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
dsh plugin remove --profile web @chenhw7/dsh-memory
|
|
140
160
|
```
|
|
141
161
|
|
|
162
|
+
(with a source checkout: `pnpm dsh plugin remove --profile web @chenhw7/dsh-memory` from the `deepseek-harness` directory). This runs `pnpm remove` in the profile directory and reconciles the layer list, so the four `memory-*` rows disappear from the composed config — you can confirm with the `--dump-config` check below.
|
|
163
|
+
|
|
164
|
+
Uninstall does **not** delete your saved memories. They live in one file under dsh's storage area:
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
# macOS/Linux
|
|
168
|
+
~/.dsh/storages/memory.json
|
|
169
|
+
# Windows
|
|
170
|
+
%USERPROFILE%\.dsh\storages\memory.json
|
|
171
|
+
# or $DSH_HOME/storages/memory.json if you set DSH_HOME
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Stop dsh, then delete that file to wipe all saved memories. Other files in the same directory belong to other features — do not remove the whole directory.
|
|
175
|
+
|
|
142
176
|
## Verify
|
|
143
177
|
|
|
144
178
|
After install, confirm the four memory rows are in the composed profile tree:
|
|
@@ -173,11 +207,11 @@ dsh web
|
|
|
173
207
|
|
|
174
208
|
### `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED`
|
|
175
209
|
|
|
176
|
-
If `dsh plugin add
|
|
210
|
+
If a **git-hosted** install (`dsh plugin add ... https://github.com/...`) fails with an error like: (npm installs of `@chenhw7/dsh-memory` never trigger this.)
|
|
177
211
|
|
|
178
212
|
```text
|
|
179
213
|
[ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] Failed to prepare git-hosted package ...
|
|
180
|
-
The git-hosted package "@chenhw7/dsh-memory@0.1.
|
|
214
|
+
The git-hosted package "@chenhw7/dsh-memory@0.1.1" needs to execute build scripts but is not in the "allowBuilds" allowlist.
|
|
181
215
|
```
|
|
182
216
|
|
|
183
217
|
It means pnpm has not been told to allow this package's `prepare` build script.
|
|
@@ -280,7 +314,7 @@ The bundle inserts four rows over `dsh-base`, each pointing at this package's ow
|
|
|
280
314
|
|
|
281
315
|
- **No semantic/vector retrieval** — `memory_search` is substring matching over structured KV entries, not embeddings.
|
|
282
316
|
- **Extraction quality tracks the session model** — review/flush reuse the session's routed provider/model.
|
|
283
|
-
- **git install needs a build allowance** — pnpm blocks the `prepare` script until you
|
|
317
|
+
- **git install needs a build allowance** — pnpm blocks the git dependency's `prepare` script until you allow it in the profile's `pnpm-workspace.yaml` (two-step procedure above). The npm install path avoids this entirely.
|
|
284
318
|
- **dsh is in developer preview** — breaking changes are expected; this bundle's peer dependency ranges track the dsh release line.
|
|
285
319
|
|
|
286
320
|
## License
|
package/README.zh-CN.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
- [功能特性](#功能特性)
|
|
12
12
|
- [安装](#安装)
|
|
13
|
+
- [卸载](#卸载)
|
|
13
14
|
- [验证](#验证)
|
|
14
15
|
- [配置](#配置)
|
|
15
16
|
- [架构](#架构)
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
|
|
32
33
|
### 前置要求
|
|
33
34
|
|
|
34
|
-
- 已安装 [Node.js](https://nodejs.org)
|
|
35
|
+
- 已安装 [Node.js](https://nodejs.org)。
|
|
35
36
|
- 可以使用 dsh CLI(全局安装或源码构建):
|
|
36
37
|
|
|
37
38
|
```sh
|
|
@@ -60,27 +61,57 @@
|
|
|
60
61
|
|
|
61
62
|
- 准备一个要添加记忆能力的 profile(本文以 `web` 为例)。
|
|
62
63
|
|
|
63
|
-
### 从
|
|
64
|
+
### 从 npm 安装(推荐)
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
一条命令。npm 上的 tarball 是预构建的,安装时 pnpm 不会在你的机器上运行任何构建脚本,也不需要额外的 pnpm 配置:
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
```sh
|
|
69
|
+
dsh plugin add --profile web @chenhw7/dsh-memory
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
如果使用源码构建的 dsh,在 `deepseek-harness` 目录下执行:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
pnpm dsh plugin add --profile web @chenhw7/dsh-memory
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
需要锁定版本而不跟 `latest` 时:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
dsh plugin add --profile web @chenhw7/dsh-memory@0.1.1
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 从 GitHub 安装(尝鲜最新 commit)
|
|
85
|
+
|
|
86
|
+
只有当你要测试比最新 npm 版本更新的 commit 时才用这种方式。pnpm 会阻止 git 依赖的 `prepare` 构建脚本,直到你显式允许,所以没有 `allowBuilds` 条目的 profile 需要**跑两次**:
|
|
68
87
|
|
|
69
|
-
|
|
88
|
+
**第一步:先跑一次安装。** 它会停下并报错:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
dsh plugin add --profile web https://github.com/chenhw7/dsh-memory
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
[ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] ... The git-hosted package "@chenhw7/dsh-memory@0.1.1"
|
|
96
|
+
needs to execute build scripts but is not in the "allowBuilds" allowlist.
|
|
97
|
+
...
|
|
98
|
+
allowBuilds:
|
|
99
|
+
@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<commit>: true
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**第二步:把 pnpm 打印的精确 key 加入允许列表。** 编辑 profile 的 `pnpm-workspace.yaml`:
|
|
70
103
|
|
|
71
104
|
- Windows:`%USERPROFILE%\.dsh\profiles\web\pnpm-workspace.yaml`
|
|
72
105
|
- macOS/Linux:`~/.dsh/profiles/web/pnpm-workspace.yaml`
|
|
73
106
|
- 如果设置了 `DSH_HOME`:`$DSH_HOME/profiles/web/pnpm-workspace.yaml`
|
|
74
107
|
|
|
75
|
-
|
|
108
|
+
添加报错信息里的那条 key(与已有内容合并):
|
|
76
109
|
|
|
77
110
|
```yaml
|
|
78
111
|
allowBuilds:
|
|
79
|
-
"@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz
|
|
112
|
+
"@chenhw7/dsh-memory@https://codeload.github.com/chenhw7/dsh-memory/tar.gz/<pnpm 打印的 commit>": true
|
|
80
113
|
```
|
|
81
114
|
|
|
82
|
-
> **为什么是这个 URL?** 这是 pnpm 在 `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED` 中打印的依赖 URL,包含解析后的 commit(`045a6f...`)。如果更新 `dsh-memory` 到新 commit,pnpm 可能提示不同的 URL;请同步更新 `allowBuilds`,或继续使用这里固定的 commit。
|
|
83
|
-
|
|
84
115
|
部分 pnpm 版本使用旧格式:
|
|
85
116
|
|
|
86
117
|
```yaml
|
|
@@ -88,25 +119,9 @@ onlyBuiltDependencies:
|
|
|
88
119
|
- "@chenhw7/dsh-memory"
|
|
89
120
|
```
|
|
90
121
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
dsh plugin add --profile web https://github.com/chenhw7/dsh-memory
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
如果使用源码构建的 dsh,则在 `deepseek-harness` 目录下执行:
|
|
98
|
-
|
|
99
|
-
```sh
|
|
100
|
-
pnpm dsh plugin add --profile web https://github.com/chenhw7/dsh-memory
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
profile 路径和 `allowBuilds` 步骤与全局安装相同。
|
|
104
|
-
|
|
105
|
-
固定 commit 安装:
|
|
122
|
+
如果你的 pnpm 提示的是这个字段,就用这个格式。然后重新执行 `dsh plugin add` 命令。
|
|
106
123
|
|
|
107
|
-
|
|
108
|
-
dsh plugin add --profile web https://github.com/chenhw7/dsh-memory/archive/045a6f4402fac282fb649787bf3de38cad28c6bb.tar.gz
|
|
109
|
-
```
|
|
124
|
+
> **key 要从 pnpm 的报错里复制,不要从旧版本文档里复制。** key 包含解析后的 commit,每换一个新 commit 安装都会变。这条允许项的含义是:允许该包的 `prepare` 脚本(`npm run build`)在安装时于你的机器上运行——只允许你信任源码的包。需要可复现的安装时,请固定 commit(`dsh plugin add --profile web https://github.com/chenhw7/dsh-memory/archive/<commit>.tar.gz`),并允许 pnpm 为该固定地址打印的 key。
|
|
110
125
|
|
|
111
126
|
### 从本地 checkout 安装
|
|
112
127
|
|
|
@@ -119,19 +134,41 @@ npm install && npm run build
|
|
|
119
134
|
dsh plugin add --profile web file:.
|
|
120
135
|
```
|
|
121
136
|
|
|
122
|
-
`file:`
|
|
137
|
+
pnpm 不会为 `file:` 依赖运行构建脚本,所以不需要 `allowBuilds` 条目——安装是按原样拷贝文件的,这也正是上面 `npm run build` 步骤的意义:`lib/` 缺失或过期,装到的就是缺失或过期的产物。
|
|
123
138
|
|
|
124
139
|
### 从 tarball 安装(无需构建权限)
|
|
125
140
|
|
|
126
|
-
|
|
141
|
+
如果不想从 npm registry 安装,可以从已构建好 `lib/` 的 checkout 打包 tarball 再安装——tarball 是预构建的,同样不需要 `allowBuilds` 条目:
|
|
127
142
|
|
|
128
143
|
```sh
|
|
129
144
|
cd dsh-memory
|
|
130
145
|
npm install && npm run build
|
|
131
|
-
npm pack # 生成 chenhw7-dsh-memory-0.1.
|
|
132
|
-
dsh plugin add --profile web ./chenhw7-dsh-memory-0.1.
|
|
146
|
+
npm pack # 生成 chenhw7-dsh-memory-0.1.1.tgz
|
|
147
|
+
dsh plugin add --profile web ./chenhw7-dsh-memory-0.1.1.tgz
|
|
133
148
|
```
|
|
134
149
|
|
|
150
|
+
## 卸载
|
|
151
|
+
|
|
152
|
+
从 profile 中移除插件:
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
dsh plugin remove --profile web @chenhw7/dsh-memory
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
(源码构建的 dsh:在 `deepseek-harness` 目录下执行 `pnpm dsh plugin remove --profile web @chenhw7/dsh-memory`。)这会在 profile 目录里执行 `pnpm remove` 并同步层列表,四个 `memory-*` 行会从组合后的配置中消失——可以用下面的 `--dump-config` 检查确认。
|
|
159
|
+
|
|
160
|
+
卸载**不会**删除你已保存的记忆。它们存放在 dsh 存储目录下的一个文件里:
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
# macOS/Linux
|
|
164
|
+
~/.dsh/storages/memory.json
|
|
165
|
+
# Windows
|
|
166
|
+
%USERPROFILE%\.dsh\storages\memory.json
|
|
167
|
+
# 如果设置了 DSH_HOME,则为 $DSH_HOME/storages/memory.json
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
先停掉 dsh,再删除该文件即可清空所有已保存的记忆。同一目录下的其他文件属于其他功能,不要删除整个目录。
|
|
171
|
+
|
|
135
172
|
## 验证
|
|
136
173
|
|
|
137
174
|
安装后,确认组合后的 profile 树中包含四个 memory 行:
|
|
@@ -245,11 +282,11 @@ memory:
|
|
|
245
282
|
|
|
246
283
|
### `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED`
|
|
247
284
|
|
|
248
|
-
|
|
285
|
+
如果**git 安装**(`dsh plugin add ... https://github.com/...`)报错,例如:(npm 安装 `@chenhw7/dsh-memory` 不会触发此错误。)
|
|
249
286
|
|
|
250
287
|
```text
|
|
251
288
|
[ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED] Failed to prepare git-hosted package ...
|
|
252
|
-
The git-hosted package "@chenhw7/dsh-memory@0.1.
|
|
289
|
+
The git-hosted package "@chenhw7/dsh-memory@0.1.1" needs to execute build scripts but is not in the "allowBuilds" allowlist.
|
|
253
290
|
```
|
|
254
291
|
|
|
255
292
|
说明 pnpm 还没有被允许执行该包的 `prepare` 构建脚本。
|
|
@@ -272,7 +309,7 @@ The git-hosted package "@chenhw7/dsh-memory@0.1.0" needs to execute build script
|
|
|
272
309
|
|
|
273
310
|
- **无语义/向量检索** — `memory_search` 是对结构化 KV 条目的子串匹配,不是 embeddings。
|
|
274
311
|
- **提取质量跟随会话模型** — review/flush 复用会话当前路由的 provider/model。
|
|
275
|
-
- **git 安装需要构建允许** — pnpm 会阻止 `prepare`
|
|
312
|
+
- **git 安装需要构建允许** — pnpm 会阻止 git 依赖的 `prepare` 脚本,直到你在 profile 的 `pnpm-workspace.yaml` 中允许它(见上文两步流程)。npm 安装路径则完全不需要。
|
|
276
313
|
- **dsh 仍处于开发者预览阶段** — 可能会有破坏性变更;本 bundle 的 peer dependency 范围跟随 dsh 发布线。
|
|
277
314
|
|
|
278
315
|
## 许可证
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenhw7/dsh-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Long-term memory for the DeepSeek Harness: persistent cross-session memory (store, tools, auto-extraction, context injection) as one installable profile bundle",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|