mr-memory 3.0.0 → 3.0.1
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 +17 -20
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -679,20 +679,19 @@ const memoryRouterPlugin = {
|
|
|
679
679
|
return;
|
|
680
680
|
}
|
|
681
681
|
|
|
682
|
-
//
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
});
|
|
682
|
+
// Fire and forget — don't block message delivery waiting for ingest
|
|
683
|
+
fetch(`${endpoint}/v1/memory/ingest`, {
|
|
684
|
+
method: "POST",
|
|
685
|
+
headers: {
|
|
686
|
+
"Content-Type": "application/json",
|
|
687
|
+
Authorization: `Bearer ${memoryKey}`,
|
|
688
|
+
},
|
|
689
|
+
body: JSON.stringify({
|
|
690
|
+
messages: toStore,
|
|
691
|
+
model: "unknown",
|
|
692
|
+
...(embeddings && { embeddings }),
|
|
693
|
+
}),
|
|
694
|
+
}).then(async (res) => {
|
|
696
695
|
if (!res.ok) {
|
|
697
696
|
const details = await res.text().catch(() => "");
|
|
698
697
|
if (details.includes("payment_required")) {
|
|
@@ -704,11 +703,9 @@ const memoryRouterPlugin = {
|
|
|
704
703
|
} else {
|
|
705
704
|
api.logger.debug?.(`memoryrouter: ingest accepted (${toStore.length} messages)`);
|
|
706
705
|
}
|
|
707
|
-
}
|
|
708
|
-
log(
|
|
709
|
-
|
|
710
|
-
);
|
|
711
|
-
}
|
|
706
|
+
}).catch((err) => {
|
|
707
|
+
log(`memoryrouter: ingest error — ${err instanceof Error ? err.message : String(err)}`);
|
|
708
|
+
});
|
|
712
709
|
} catch (err) {
|
|
713
710
|
log(
|
|
714
711
|
`memoryrouter: agent_end error — ${err instanceof Error ? err.message : String(err)}`,
|
|
@@ -758,7 +755,7 @@ const memoryRouterPlugin = {
|
|
|
758
755
|
tokenCount?: number;
|
|
759
756
|
};
|
|
760
757
|
// Format results similar to OpenClaw's memory_search output
|
|
761
|
-
const results = (data.memories || []).map((m
|
|
758
|
+
const results = (data.memories || []).map((m) => ({
|
|
762
759
|
snippet: m.content,
|
|
763
760
|
score: m.score,
|
|
764
761
|
source: "memoryrouter",
|