From 5d7717d1b6bfda92df8d83b4b4ae965dfeb07fd6 Mon Sep 17 00:00:00 2001 From: Teingi Date: Thu, 14 May 2026 19:14:57 +0800 Subject: [PATCH 1/2] openclaw 2026.5.4 --- README.md | 4 +++- README_CN.md | 4 +++- package.json | 14 ++++++++++---- tsconfig.build.json | 13 +++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 tsconfig.build.json 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"] +} From 0afe650262a61453c5002a523ad24f79a93240bf Mon Sep 17 00:00:00 2001 From: Teingi Date: Fri, 15 May 2026 14:23:25 +0800 Subject: [PATCH 2/2] register ltm --- package-lock.json | 1 + src/index.ts | 2 +- src/openclaw-plugin-sdk.d.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 63f0332..cab8a25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "memory-powermem", "version": "0.4.0", + "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@langchain/openai": "^1.4.1", diff --git a/src/index.ts b/src/index.ts index 0f2682a..d67767f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -304,7 +304,7 @@ const memoryPlugin = { kind: "memory" as const, configSchema: powerMemConfigSchema, - async register(api: OpenClawPluginApi) { + register(api: OpenClawPluginApi) { const gw = api as GatewayApi; const raw = api.pluginConfig; const toParse = diff --git a/src/openclaw-plugin-sdk.d.ts b/src/openclaw-plugin-sdk.d.ts index 510791a..b446fcb 100644 --- a/src/openclaw-plugin-sdk.d.ts +++ b/src/openclaw-plugin-sdk.d.ts @@ -53,14 +53,14 @@ declare module "openclaw/plugin-sdk/memory-core" { }) => void; }; - /** Memory plugin entry; `register` may be async when using dynamic imports (e.g. dual-write). */ + /** Memory plugin entry; `register` must be synchronous (OpenClaw loads CLI metadata before awaiting). */ export type OpenClawMemoryPlugin = { id: string; name: string; description: string; kind: "memory"; configSchema: unknown; - register: (api: OpenClawPluginApi) => void | Promise; + register: (api: OpenClawPluginApi) => void; }; }