diff --git a/README.md b/README.md index c30e8f5..bd9938e 100644 --- a/README.md +++ b/README.md @@ -177,13 +177,15 @@ On your machine (use your actual plugin path): openclaw plugins install memory-powermem # Install from a local directory (e.g. cloned repo) +cd /path/to/memory-powermem && npm install && npm run build openclaw plugins install /path/to/memory-powermem # For development (symlink, no copy) +cd /path/to/memory-powermem && npm install && npm run build openclaw plugins install -l /path/to/memory-powermem ``` -**Note:** Running `npm i memory-powermem` in a Node project only adds the package to that project’s `node_modules`; it does **not** register the plugin with OpenClaw. To use this as an OpenClaw plugin, you must run `openclaw plugins install memory-powermem` (or install from a path as above), then restart the gateway. +**Note:** Starting with OpenClaw 2026.5.4, local path installs require the TypeScript plugin entry to be compiled to runtime JS first, so run `npm run build` before installing from a local clone. Running `npm i memory-powermem` in a Node project only adds the package to that project’s `node_modules`; it does **not** register the plugin with OpenClaw. To use this as an OpenClaw plugin, you must run `openclaw plugins install memory-powermem` (or install from a path as above), then restart the gateway. After install, run `openclaw plugins list` and confirm `memory-powermem` is listed. With **no** `plugins.entries["memory-powermem"].config`, the plugin uses **defaults**: `mode: "cli"`, `pmemPath: "bundled"` (npm `powermem` from plugin dependencies), `useOpenClawModel: true` (SQLite under OpenClaw state + LLM from `agents.defaults.model`), plus `autoCapture` / `autoRecall` / `inferOnAdd` enabled. No separate `powermem.env` is required unless you opt out of OpenClaw model injection. diff --git a/README_CN.md b/README_CN.md index 6394e66..704573a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -178,13 +178,15 @@ curl -s http://localhost:8000/api/v1/system/health openclaw plugins install memory-powermem # 若插件在本机目录(例如克隆下来的) +cd /path/to/memory-powermem && npm install && npm run build openclaw plugins install /path/to/memory-powermem # 开发时想改代码即生效,可用链接方式(不拷贝) +cd /path/to/memory-powermem && npm install && npm run build openclaw plugins install -l /path/to/memory-powermem ``` -**说明:** 在某个 Node 项目里执行 `npm i memory-powermem` 只会把包装进该项目的 `node_modules`,**不会**在 OpenClaw 里注册插件。若要在 OpenClaw 里使用本插件,必须执行 `openclaw plugins install memory-powermem`(或按上面用本地路径安装),再重启 gateway。 +**说明:** OpenClaw 2026.5.4 起,本地路径安装会要求 TypeScript 插件入口已编译成运行时 JS,因此本地克隆安装前需先执行 `npm run build` 生成 `dist/index.js`。在某个 Node 项目里执行 `npm i memory-powermem` 只会把包装进该项目的 `node_modules`,**不会**在 OpenClaw 里注册插件。若要在 OpenClaw 里使用本插件,必须执行 `openclaw plugins install memory-powermem`(或按上面用本地路径安装),再重启 gateway。 安装成功后,可用 `openclaw plugins list` 确认能看到 `memory-powermem`。若未写 `plugins.entries["memory-powermem"].config`,插件 **默认**:`mode: "cli"`、`pmemPath: "bundled"`(优先插件旁的 npm `powermem`,否则用 PATH 上的 `pmem`)、`useOpenClawModel: true`(SQLite 在 OpenClaw 状态目录 + 从 `agents.defaults.model` 注入 LLM),并开启 `autoCapture`、`autoRecall`、`inferOnAdd`。若不使用 OpenClaw 注入模型,再准备 `powermem` 的 `.env`(`envFile`)。 diff --git a/package.json b/package.json index 8e5cc04..cd2f10a 100644 --- a/package.json +++ b/package.json @@ -3,17 +3,23 @@ "version": "0.4.0", "description": "OpenClaw plugin: long-term memory via PowerMem (default local CLI: npm powermem or pmem on PATH; optional HTTP server; intelligent extraction, Ebbinghaus forgetting curve).", "type": "module", - "main": "src/index.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "exports": { - ".": "./src/index.ts" + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } }, "files": [ + "dist", "src", - "lib", "scripts", "openclaw.plugin.json" ], "scripts": { + "build": "tsc -p tsconfig.build.json", + "prepack": "npm run build", "postinstall": "node scripts/ensure-native-deps.cjs", "native:verify": "node scripts/ensure-native-deps.cjs", "test": "vitest run", @@ -42,7 +48,7 @@ }, "openclaw": { "extensions": [ - "./src/index.ts" + "./dist/index.js" ] }, "repository": "", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..aebde29 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "noEmit": false, + "outDir": "dist", + "rootDir": "src", + "sourceMap": true + }, + "include": ["src/**/*.ts", "src/**/*.d.ts"], + "exclude": ["node_modules", "test/**/*.ts"] +}