mr-memory 2.9.10 → 2.9.12

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.
Files changed (2) hide show
  1. package/index.ts +22 -5
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -229,7 +229,15 @@ const memoryRouterPlugin = {
229
229
  }),
230
230
  });
231
231
 
232
- if (!res.ok) return;
232
+ if (!res.ok) {
233
+ const errBody = await res.json().catch(() => null) as any;
234
+ if (errBody?.error?.code === "payment_required") {
235
+ api.logger.warn?.(`⚠️ MemoryRouter: Out of credits. Memory is NOT being injected. Add credits at https://app.memoryrouter.ai/settings/billing`);
236
+ } else {
237
+ log(`memoryrouter: prepare failed (${res.status})`);
238
+ }
239
+ return;
240
+ }
233
241
 
234
242
  const data = (await res.json()) as {
235
243
  context?: string;
@@ -330,7 +338,12 @@ const memoryRouterPlugin = {
330
338
  });
331
339
 
332
340
  if (!res.ok) {
333
- log(`memoryrouter: prepare failed (${res.status})`);
341
+ const errBody = await res.json().catch(() => null) as any;
342
+ if (errBody?.error?.code === "payment_required") {
343
+ api.logger.warn?.(`⚠️ MemoryRouter: Out of credits. Memory is NOT being injected. Add credits at https://app.memoryrouter.ai/settings/billing`);
344
+ } else {
345
+ log(`memoryrouter: prepare failed (${res.status})`);
346
+ }
334
347
  return;
335
348
  }
336
349
 
@@ -390,7 +403,7 @@ const memoryRouterPlugin = {
390
403
 
391
404
  const toStore: Array<{ role: string; content: string }> = [];
392
405
 
393
- // Add the user message (strip media refs so image paths don't get stored)
406
+ // Add the user message
394
407
  if (lastUserIdx >= 0) {
395
408
  const userMsg = msgs[lastUserIdx] as { content?: unknown };
396
409
  const userText = extractText(userMsg.content);
@@ -429,8 +442,12 @@ const memoryRouterPlugin = {
429
442
  });
430
443
  if (!res.ok) {
431
444
  const details = await res.text().catch(() => "");
432
- const suffix = details ? ` — ${details.slice(0, 200)}` : "";
433
- log(`memoryrouter: ingest failed (${res.status})${suffix}`);
445
+ if (details.includes("payment_required")) {
446
+ api.logger.warn?.(`⚠️ MemoryRouter: Out of credits. Conversations are NOT being stored. Add credits at https://app.memoryrouter.ai/settings/billing`);
447
+ } else {
448
+ const suffix = details ? ` — ${details.slice(0, 200)}` : "";
449
+ log(`memoryrouter: ingest failed (${res.status})${suffix}`);
450
+ }
434
451
  } else {
435
452
  api.logger.debug?.(`memoryrouter: ingest accepted (${toStore.length} messages)`);
436
453
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-memory",
3
- "version": "2.9.10",
3
+ "version": "2.9.12",
4
4
  "description": "MemoryRouter persistent memory plugin for OpenClaw — your AI remembers every conversation",
5
5
  "type": "module",
6
6
  "files": [