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.
- package/index.ts +18 -15
- 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
|
-
//
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
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
|
-
}
|
|
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)}`,
|