diff --git a/bun.lock b/bun.lock index efce5c7..60267ee 100644 --- a/bun.lock +++ b/bun.lock @@ -13,7 +13,7 @@ "typescript": "^5.9.3", }, "peerDependencies": { - "openclaw": ">=2026.2.17", + "openclaw": ">=2026.5.7", }, }, }, diff --git a/commands/cli.ts b/commands/cli.ts index c38e552..2b1c4a2 100644 --- a/commands/cli.ts +++ b/commands/cli.ts @@ -4,10 +4,12 @@ import * as path from "node:path" import * as readline from "node:readline" import type { OpenClawPluginApi } from "openclaw/plugin-sdk" import type { SupermemoryClient } from "../client.ts" -import type { SupermemoryConfig } from "../config.ts" import { log } from "../logger.ts" -export function registerCliSetup(api: OpenClawPluginApi): void { +export function registerCli( + api: OpenClawPluginApi, + client?: SupermemoryClient, +): void { api.registerCli( // biome-ignore lint/suspicious/noExplicitAny: openclaw SDK does not ship types ({ program }: { program: any }) => { @@ -60,6 +62,9 @@ export function registerCliSetup(api: OpenClawPluginApi): void { entries["openclaw-supermemory"] = { enabled: true, + hooks: { + allowConversationAccess: true, + }, config: { apiKey: apiKey.trim(), }, @@ -289,6 +294,9 @@ export function registerCliSetup(api: OpenClawPluginApi): void { entries["openclaw-supermemory"] = { enabled: true, + hooks: { + allowConversationAccess: true, + }, config: pluginConfig, } @@ -418,24 +426,8 @@ export function registerCliSetup(api: OpenClawPluginApi): void { console.log(` Container count: ${customContainers.length}`) console.log("") }) - }, - { commands: ["supermemory"] }, - ) -} -export function registerCli( - api: OpenClawPluginApi, - client: SupermemoryClient, - _cfg: SupermemoryConfig, -): void { - api.registerCli( - // biome-ignore lint/suspicious/noExplicitAny: openclaw SDK does not ship types - ({ program }: { program: any }) => { - const cmd = program.commands.find( - // biome-ignore lint/suspicious/noExplicitAny: openclaw SDK does not ship types - (c: any) => c.name() === "supermemory", - ) - if (!cmd) return + if (!client) return cmd .command("search") @@ -512,6 +504,14 @@ export function registerCli( console.log(`Wiped ${result.deletedCount} memories from "${tag}".`) }) }, - { commands: ["supermemory"] }, + { + descriptors: [ + { + name: "supermemory", + description: "Supermemory long-term memory commands", + hasSubcommands: true, + }, + ], + }, ) } diff --git a/index.ts b/index.ts index d7e79e7..8edc61b 100644 --- a/index.ts +++ b/index.ts @@ -3,7 +3,7 @@ import os from "node:os" import path from "node:path" import type { OpenClawPluginApi } from "openclaw/plugin-sdk" import { SupermemoryClient } from "./client.ts" -import { registerCli, registerCliSetup } from "./commands/cli.ts" +import { registerCli } from "./commands/cli.ts" import { registerCommands, registerStubCommands } from "./commands/slash.ts" import { parseConfig, supermemoryConfigSchema } from "./config.ts" import { buildCaptureHandler } from "./hooks/capture.ts" @@ -37,9 +37,8 @@ export default { initLogger(api.logger, cfg.debug) - registerCliSetup(api) - if (!cfg.apiKey) { + registerCli(api) api.logger.info( "supermemory: not configured - run 'openclaw supermemory setup'", ) @@ -48,6 +47,7 @@ export default { } const client = new SupermemoryClient(cfg.apiKey, cfg.containerTag) + registerCli(api, client) const memoryRuntime = buildMemoryRuntime(client) const noopFlushPlan = () => null @@ -87,7 +87,6 @@ export default { } registerCommands(api, client, cfg, getSessionKey) - registerCli(api, client, cfg) api.registerService({ id: "openclaw-supermemory", diff --git a/openclaw.plugin.json b/openclaw.plugin.json index 6f4729a..06b6e0c 100644 --- a/openclaw.plugin.json +++ b/openclaw.plugin.json @@ -1,6 +1,14 @@ { "id": "openclaw-supermemory", "kind": "memory", + "contracts": { + "tools": [ + "supermemory_search", + "supermemory_store", + "supermemory_forget", + "supermemory_profile" + ] + }, "uiHints": { "apiKey": { "label": "Supermemory API Key", diff --git a/package.json b/package.json index 4e1dcbc..60415bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@supermemory/openclaw-supermemory", - "version": "2.1.11", + "version": "2.1.12", "type": "module", "description": "OpenClaw Supermemory memory plugin", "license": "MIT", @@ -8,19 +8,49 @@ "supermemory": "^4.0.0", "@sinclair/typebox": "0.34.47" }, + "files": [ + "README.md", + "openclaw.plugin.json", + "index.ts", + "client.ts", + "commands", + "hooks", + "tools", + "config.ts", + "logger.ts", + "memory.ts", + "runtime.ts", + "types", + "lib/validate.d.ts", + "lib/validate.js", + "dist" + ], "scripts": { + "build": "npm run build:runtime && npm run build:lib", + "build:runtime": "esbuild index.ts --bundle --format=esm --platform=node --target=es2022 --external:openclaw --external:openclaw/* --external:supermemory --outfile=dist/index.js", "check-types": "tsc --noEmit", "lint": "bunx @biomejs/biome ci .", "lint:fix": "bunx @biomejs/biome check --write .", - "build:lib": "esbuild lib/validate.ts --bundle --minify --format=esm --platform=node --target=es2022 --external:node:crypto --outfile=lib/validate.js" + "build:lib": "esbuild lib/validate.ts --bundle --minify --format=esm --platform=node --target=es2022 --external:node:crypto --outfile=lib/validate.js", + "prepack": "npm run build" }, "peerDependencies": { - "openclaw": ">=2026.2.17" + "openclaw": ">=2026.5.7" }, "openclaw": { "extensions": [ "./index.ts" - ] + ], + "runtimeExtensions": [ + "./dist/index.js" + ], + "compat": { + "pluginApi": ">=2026.5.7", + "minGatewayVersion": "2026.5.7" + }, + "build": { + "openclawVersion": "2026.5.7" + } }, "repository": { "type": "git",