mr-memory 2.5.0 → 2.5.2

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 +18 -15
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -378,29 +378,32 @@ const memoryRouterPlugin = {
378
378
 
379
379
  if (toStore.length === 0) return;
380
380
 
381
- // Fire-and-forget: don't block agent completion on memory ingestion.
382
- void fetch(`${endpoint}/v1/memory/ingest`, {
383
- method: "POST",
384
- headers: {
385
- "Content-Type": "application/json",
386
- Authorization: `Bearer ${memoryKey}`,
387
- },
388
- body: JSON.stringify({
389
- messages: toStore,
390
- session_id: ctx.sessionKey,
391
- model: "unknown",
392
- }),
393
- }).then(async (res) => {
381
+ // Await the fetch so OpenClaw's runVoidHook keeps the event loop alive.
382
+ try {
383
+ const res = await fetch(`${endpoint}/v1/memory/ingest`, {
384
+ method: "POST",
385
+ headers: {
386
+ "Content-Type": "application/json",
387
+ Authorization: `Bearer ${memoryKey}`,
388
+ },
389
+ body: JSON.stringify({
390
+ messages: toStore,
391
+ session_id: ctx.sessionKey,
392
+ model: "unknown",
393
+ }),
394
+ });
394
395
  if (!res.ok) {
395
396
  const details = await res.text().catch(() => "");
396
397
  const suffix = details ? ` — ${details.slice(0, 200)}` : "";
397
398
  api.logger.warn?.(`memoryrouter: ingest failed (${res.status})${suffix}`);
399
+ } else {
400
+ api.logger.debug?.(`memoryrouter: ingest accepted (${toStore.length} messages)`);
398
401
  }
399
- }).catch((err) => {
402
+ } catch (err) {
400
403
  api.logger.warn?.(
401
404
  `memoryrouter: ingest error — ${err instanceof Error ? err.message : String(err)}`,
402
405
  );
403
- });
406
+ }
404
407
  } catch (err) {
405
408
  api.logger.warn?.(
406
409
  `memoryrouter: agent_end error — ${err instanceof Error ? err.message : String(err)}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-memory",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "MemoryRouter persistent memory plugin for OpenClaw — your AI remembers every conversation",
5
5
  "type": "module",
6
6
  "files": [