mr-memory 2.9.8 → 2.9.10
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 +5 -4
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -243,7 +243,7 @@ const memoryRouterPlugin = {
|
|
|
243
243
|
`memoryrouter: injected ${data.memories_found || 0} memories (${data.memory_tokens || 0} tokens)`,
|
|
244
244
|
);
|
|
245
245
|
const wrapped = wrapForInjection(data.context);
|
|
246
|
-
return {
|
|
246
|
+
return { appendSystemPrompt: wrapped };
|
|
247
247
|
}
|
|
248
248
|
} catch {
|
|
249
249
|
// Silent fail on tool iterations — don't block the agent
|
|
@@ -390,11 +390,11 @@ const memoryRouterPlugin = {
|
|
|
390
390
|
|
|
391
391
|
const toStore: Array<{ role: string; content: string }> = [];
|
|
392
392
|
|
|
393
|
-
// Add the user message
|
|
393
|
+
// Add the user message (strip media refs so image paths don't get stored)
|
|
394
394
|
if (lastUserIdx >= 0) {
|
|
395
395
|
const userMsg = msgs[lastUserIdx] as { content?: unknown };
|
|
396
396
|
const userText = extractText(userMsg.content);
|
|
397
|
-
if (userText) toStore.push({ role: "user", content: userText });
|
|
397
|
+
if (userText) toStore.push({ role: "user", content: stripMediaReferences(userText) });
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// Collect ALL assistant messages after the last user message
|
|
@@ -407,7 +407,8 @@ const memoryRouterPlugin = {
|
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
if (assistantParts.length > 0) {
|
|
410
|
-
|
|
410
|
+
// Strip media refs so image paths don't get stored and re-injected
|
|
411
|
+
toStore.push({ role: "assistant", content: stripMediaReferences(assistantParts.join("\n\n")) });
|
|
411
412
|
}
|
|
412
413
|
|
|
413
414
|
if (toStore.length === 0) return;
|