@bamdra/bamdra-memory-vector 0.1.12 → 0.1.13
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 +7 -0
- package/README.zh-CN.md +7 -0
- package/dist/index.js +64 -6
- package/dist/openclaw.plugin.json +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ The local knowledge and semantic recall layer for the Bamdra suite.
|
|
|
6
6
|
|
|
7
7
|
It can run independently, and it becomes most powerful when paired with `bamdra-openclaw-memory`.
|
|
8
8
|
|
|
9
|
+
Tested with OpenClaw `v2026.3.23`.
|
|
10
|
+
|
|
9
11
|
Install directly:
|
|
10
12
|
|
|
11
13
|
```bash
|
|
@@ -34,6 +36,11 @@ It indexes:
|
|
|
34
36
|
|
|
35
37
|
and helps OpenClaw search that local knowledge before falling back to the web.
|
|
36
38
|
|
|
39
|
+
Recent compatibility improvements:
|
|
40
|
+
|
|
41
|
+
- npm installs on OpenClaw `v2026.3.23` now backfill `plugins.installs` metadata for the standalone vector plugin
|
|
42
|
+
- vector storage paths that use `~/.openclaw/...` are now resolved against the active user home instead of being treated as literal directories
|
|
43
|
+
|
|
37
44
|
## Why it matters
|
|
38
45
|
|
|
39
46
|
The weakest part of many memory systems is the knowledge layer:
|
package/README.zh-CN.md
CHANGED
|
@@ -6,6 +6,8 @@ Bamdra 套件中的本地知识库与语义召回层。
|
|
|
6
6
|
|
|
7
7
|
它可以独立运行,和 `bamdra-openclaw-memory` 配合时效果最好。
|
|
8
8
|
|
|
9
|
+
已验证适配 OpenClaw `v2026.3.23`。
|
|
10
|
+
|
|
9
11
|
单独安装:
|
|
10
12
|
|
|
11
13
|
```bash
|
|
@@ -34,6 +36,11 @@ openclaw plugins install @bamdra/bamdra-memory-vector
|
|
|
34
36
|
|
|
35
37
|
并尽量让 OpenClaw 在上网之前先查本地知识。
|
|
36
38
|
|
|
39
|
+
这轮兼容性修复还包括:
|
|
40
|
+
|
|
41
|
+
- 在 OpenClaw `v2026.3.23` 下通过 npm 单独安装时,会自动补齐 `plugins.installs` 元数据
|
|
42
|
+
- 使用 `~/.openclaw/...` 的向量存储路径现在会正确解析到当前用户目录,而不是被当成字面目录名
|
|
43
|
+
|
|
37
44
|
## 为什么重要
|
|
38
45
|
|
|
39
46
|
很多记忆系统最弱的一层,其实就是知识库层:
|
package/dist/index.js
CHANGED
|
@@ -230,16 +230,28 @@ function exposeVectorApi(runtime) {
|
|
|
230
230
|
}
|
|
231
231
|
function normalizeConfig(input) {
|
|
232
232
|
const root = (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "memory", "vector");
|
|
233
|
-
const markdownRoot = input?.markdownRoot ?? (0, import_node_path.join)(root, "markdown");
|
|
233
|
+
const markdownRoot = expandHomePath(input?.markdownRoot) ?? (0, import_node_path.join)(root, "markdown");
|
|
234
234
|
return {
|
|
235
235
|
enabled: input?.enabled ?? true,
|
|
236
236
|
markdownRoot,
|
|
237
|
-
privateMarkdownRoot: input?.privateMarkdownRoot ?? (0, import_node_path.join)(markdownRoot, "private"),
|
|
238
|
-
sharedMarkdownRoot: input?.sharedMarkdownRoot ?? (0, import_node_path.join)(markdownRoot, "shared"),
|
|
239
|
-
indexPath: input?.indexPath ?? (0, import_node_path.join)(root, "index.json"),
|
|
237
|
+
privateMarkdownRoot: expandHomePath(input?.privateMarkdownRoot) ?? (0, import_node_path.join)(markdownRoot, "private"),
|
|
238
|
+
sharedMarkdownRoot: expandHomePath(input?.sharedMarkdownRoot) ?? (0, import_node_path.join)(markdownRoot, "shared"),
|
|
239
|
+
indexPath: expandHomePath(input?.indexPath) ?? (0, import_node_path.join)(root, "index.json"),
|
|
240
240
|
dimensions: input?.dimensions ?? 64
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
|
+
function expandHomePath(value) {
|
|
244
|
+
if (!value) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
if (value === "~") {
|
|
248
|
+
return (0, import_node_os.homedir)();
|
|
249
|
+
}
|
|
250
|
+
if (value.startsWith("~/")) {
|
|
251
|
+
return (0, import_node_path.join)((0, import_node_os.homedir)(), value.slice(2));
|
|
252
|
+
}
|
|
253
|
+
return value;
|
|
254
|
+
}
|
|
243
255
|
function bootstrapOpenClawHost() {
|
|
244
256
|
const currentFile = (0, import_node_url.fileURLToPath)(importMetaUrl);
|
|
245
257
|
const runtimeDir = (0, import_node_path.dirname)(currentFile);
|
|
@@ -259,17 +271,58 @@ function bootstrapOpenClawHost() {
|
|
|
259
271
|
}
|
|
260
272
|
const original = (0, import_node_fs.readFileSync)(configPath, "utf8");
|
|
261
273
|
const config = JSON.parse(original);
|
|
262
|
-
const changed = ensureHostConfig(config);
|
|
274
|
+
const changed = ensureHostConfig(config, packageRoot);
|
|
263
275
|
if (!changed) {
|
|
264
276
|
return;
|
|
265
277
|
}
|
|
266
278
|
(0, import_node_fs.writeFileSync)(configPath, `${JSON.stringify(config, null, 2)}
|
|
267
279
|
`, "utf8");
|
|
268
280
|
}
|
|
269
|
-
function
|
|
281
|
+
function readPluginInstallMetadata(pluginId, packageRoot, installPath) {
|
|
282
|
+
try {
|
|
283
|
+
const pkg = JSON.parse((0, import_node_fs.readFileSync)((0, import_node_path.join)(packageRoot, "package.json"), "utf8"));
|
|
284
|
+
const packageName = typeof pkg.name === "string" ? pkg.name : pluginId;
|
|
285
|
+
const version = typeof pkg.version === "string" ? pkg.version : "0.0.0";
|
|
286
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
287
|
+
return {
|
|
288
|
+
source: "npm",
|
|
289
|
+
spec: packageName,
|
|
290
|
+
installPath,
|
|
291
|
+
version,
|
|
292
|
+
resolvedName: packageName,
|
|
293
|
+
resolvedVersion: version,
|
|
294
|
+
resolvedSpec: `${packageName}@${version}`,
|
|
295
|
+
resolvedAt: now,
|
|
296
|
+
installedAt: now
|
|
297
|
+
};
|
|
298
|
+
} catch {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function ensureInstallMetadata(installs, pluginId, metadata) {
|
|
303
|
+
if (!metadata) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
const current = installs[pluginId];
|
|
307
|
+
if (current && typeof current === "object" && !Array.isArray(current)) {
|
|
308
|
+
const install = current;
|
|
309
|
+
let changed = false;
|
|
310
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
311
|
+
if (typeof install[key] !== "string" || install[key] === "") {
|
|
312
|
+
install[key] = value;
|
|
313
|
+
changed = true;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return changed;
|
|
317
|
+
}
|
|
318
|
+
installs[pluginId] = metadata;
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
function ensureHostConfig(config, packageRoot) {
|
|
270
322
|
let changed = false;
|
|
271
323
|
const plugins = ensureObject(config, "plugins");
|
|
272
324
|
const entries = ensureObject(plugins, "entries");
|
|
325
|
+
const installs = ensureObject(plugins, "installs");
|
|
273
326
|
const load = ensureObject(plugins, "load");
|
|
274
327
|
const tools = ensureObject(config, "tools");
|
|
275
328
|
const skills = ensureObject(config, "skills");
|
|
@@ -280,6 +333,11 @@ function ensureHostConfig(config) {
|
|
|
280
333
|
changed = ensureArrayIncludes(plugins, "allow", PLUGIN_ID) || changed;
|
|
281
334
|
changed = ensureArrayIncludes(load, "paths", (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "extensions")) || changed;
|
|
282
335
|
changed = ensureArrayIncludes(skillsLoad, "extraDirs", (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "skills")) || changed;
|
|
336
|
+
changed = ensureInstallMetadata(
|
|
337
|
+
installs,
|
|
338
|
+
PLUGIN_ID,
|
|
339
|
+
readPluginInstallMetadata(PLUGIN_ID, packageRoot, (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "extensions", PLUGIN_ID))
|
|
340
|
+
) || changed;
|
|
283
341
|
changed = ensureArrayIncludes(tools, "allow", SEARCH_TOOL_NAME) || changed;
|
|
284
342
|
changed = ensureArrayIncludes(tools, "allow", REINDEX_TOOL_NAME) || changed;
|
|
285
343
|
if (typeof entry.enabled !== "boolean") {
|
package/dist/package.json
CHANGED
package/package.json
CHANGED