mr-memory 3.0.0 → 3.0.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 +21 -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",
|
|
@@ -830,6 +827,8 @@ const memoryRouterPlugin = {
|
|
|
830
827
|
try {
|
|
831
828
|
// Disable built-in memory entirely — MR replaces it with custom tools
|
|
832
829
|
await runOpenClawConfigSet("agents.defaults.memorySearch.enabled", "false", true);
|
|
830
|
+
// Disable compaction memory flush — MR handles memory storage
|
|
831
|
+
await runOpenClawConfigSet("agents.defaults.compaction.memoryFlush.enabled", "false", true);
|
|
833
832
|
} catch {
|
|
834
833
|
// Non-fatal — config optimization is best-effort
|
|
835
834
|
}
|
|
@@ -846,6 +845,8 @@ const memoryRouterPlugin = {
|
|
|
846
845
|
await runOpenClawConfigSet("agents.defaults.memorySearch.experimental.sessionMemory", "true", true);
|
|
847
846
|
// Restore sync on search
|
|
848
847
|
await runOpenClawConfigSet("agents.defaults.memorySearch.sync.onSearch", "true", true);
|
|
848
|
+
// Restore compaction memory flush
|
|
849
|
+
await runOpenClawConfigSet("agents.defaults.compaction.memoryFlush.enabled", "true", true);
|
|
849
850
|
} catch {
|
|
850
851
|
// Non-fatal
|
|
851
852
|
}
|