mr-memory 1.0.2 → 1.0.4
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/index.ts +21 -12
- package/package.json +1 -1
- package/upload.ts +1 -1
package/index.ts
CHANGED
|
@@ -73,7 +73,7 @@ const memoryRouterPlugin = {
|
|
|
73
73
|
if (memoryKey) {
|
|
74
74
|
api.logger.info?.(`memoryrouter: registered (endpoint: ${endpoint})`);
|
|
75
75
|
} else {
|
|
76
|
-
api.logger.info?.("memoryrouter: no key configured — run: openclaw mr
|
|
76
|
+
api.logger.info?.("memoryrouter: no key configured — run: openclaw mr <key>");
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
if (memoryKey) {
|
|
@@ -118,12 +118,15 @@ const memoryRouterPlugin = {
|
|
|
118
118
|
|
|
119
119
|
api.registerCli(
|
|
120
120
|
({ program }) => {
|
|
121
|
-
const mr = program.command("mr")
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
const mr = program.command("mr")
|
|
122
|
+
.description("MemoryRouter memory commands")
|
|
123
|
+
.argument("[key]", "Your MemoryRouter memory key (mk_xxx)")
|
|
124
|
+
.action(async (key: string | undefined) => {
|
|
125
|
+
if (!key) {
|
|
126
|
+
// No key provided — show help
|
|
127
|
+
mr.help();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
127
130
|
if (!key.startsWith("mk")) {
|
|
128
131
|
console.error("Invalid key format. Keys start with 'mk' (e.g. mk_xxx)");
|
|
129
132
|
return;
|
|
@@ -139,7 +142,7 @@ const memoryRouterPlugin = {
|
|
|
139
142
|
.action(async () => {
|
|
140
143
|
await api.updatePluginConfig({});
|
|
141
144
|
console.log("✓ MemoryRouter disabled. LLM calls go direct to provider.");
|
|
142
|
-
console.log(" Key removed. Re-enable with: openclaw mr
|
|
145
|
+
console.log(" Key removed. Re-enable with: openclaw mr <key>");
|
|
143
146
|
});
|
|
144
147
|
|
|
145
148
|
mr.command("status")
|
|
@@ -147,7 +150,7 @@ const memoryRouterPlugin = {
|
|
|
147
150
|
.option("--json", "JSON output")
|
|
148
151
|
.action(async (opts) => {
|
|
149
152
|
if (!memoryKey) {
|
|
150
|
-
console.error("MemoryRouter not configured. Run: openclaw mr
|
|
153
|
+
console.error("MemoryRouter not configured. Run: openclaw mr <key>");
|
|
151
154
|
return;
|
|
152
155
|
}
|
|
153
156
|
try {
|
|
@@ -182,13 +185,19 @@ const memoryRouterPlugin = {
|
|
|
182
185
|
.option("--brain <dir>", "State directory with sessions (default: ~/.openclaw)")
|
|
183
186
|
.action(async (targetPath: string | undefined, opts: { workspace?: string; brain?: string }) => {
|
|
184
187
|
if (!memoryKey) {
|
|
185
|
-
console.error("MemoryRouter not configured. Run: openclaw mr
|
|
188
|
+
console.error("MemoryRouter not configured. Run: openclaw mr <key>");
|
|
186
189
|
return;
|
|
187
190
|
}
|
|
188
191
|
const os = await import("node:os");
|
|
189
192
|
const path = await import("node:path");
|
|
190
193
|
const stateDir = opts.brain ? path.resolve(opts.brain) : path.join(os.homedir(), ".openclaw");
|
|
191
|
-
|
|
194
|
+
// Use OpenClaw's configured workspace, not cwd
|
|
195
|
+
const configWorkspace = api.config.workspace || api.config.agents?.defaults?.workspace;
|
|
196
|
+
const workspacePath = opts.workspace
|
|
197
|
+
? path.resolve(opts.workspace)
|
|
198
|
+
: configWorkspace
|
|
199
|
+
? path.resolve(configWorkspace.replace(/^~/, os.homedir()))
|
|
200
|
+
: path.join(os.homedir(), ".openclaw", "workspace");
|
|
192
201
|
const { runUpload } = await import("./upload.js");
|
|
193
202
|
await runUpload({
|
|
194
203
|
memoryKey,
|
|
@@ -205,7 +214,7 @@ const memoryRouterPlugin = {
|
|
|
205
214
|
.description("Clear all memories from vault")
|
|
206
215
|
.action(async () => {
|
|
207
216
|
if (!memoryKey) {
|
|
208
|
-
console.error("MemoryRouter not configured. Run: openclaw mr
|
|
217
|
+
console.error("MemoryRouter not configured. Run: openclaw mr <key>");
|
|
209
218
|
return;
|
|
210
219
|
}
|
|
211
220
|
try {
|
package/package.json
CHANGED
package/upload.ts
CHANGED
|
@@ -319,7 +319,7 @@ export async function runUpload(params: {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
console.log(`\n✅ ${totalProcessed}
|
|
322
|
+
console.log(`\n✅ ${totalProcessed} memories stored in vault`);
|
|
323
323
|
if (totalFailed > 0) {
|
|
324
324
|
console.log(`⚠️ ${totalFailed} failed (${((totalFailed / (totalProcessed + totalFailed)) * 100).toFixed(0)}%)`);
|
|
325
325
|
}
|