mr-memory 3.0.2 → 3.1.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 +6 -6
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -36,7 +36,7 @@ function stripMediaReferences(text: string): string {
|
|
|
36
36
|
/** Wrap raw memory context in XML tags with a strong instruction */
|
|
37
37
|
/** Wrap API response in extraction markers so we can strip it next turn. */
|
|
38
38
|
function wrapForInjection(context: string): string {
|
|
39
|
-
return `<
|
|
39
|
+
return `<memory_context>\n${stripMediaReferences(context)}\n</memory_context>`;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/** Strip previous memory injections from message text to prevent stacking.
|
|
@@ -483,7 +483,7 @@ const memoryRouterPlugin = {
|
|
|
483
483
|
`memoryrouter: injected ${data.memories_found || 0} memories (${data.memory_tokens || 0} tokens)`,
|
|
484
484
|
);
|
|
485
485
|
const wrapped = wrapForInjection(data.context);
|
|
486
|
-
return {
|
|
486
|
+
return { appendSystemContext: wrapped };
|
|
487
487
|
}
|
|
488
488
|
} catch {
|
|
489
489
|
// Silent fail on tool iterations — don't block the agent
|
|
@@ -596,7 +596,7 @@ const memoryRouterPlugin = {
|
|
|
596
596
|
`memoryrouter: injected ${data.memories_found || 0} memories (${data.memory_tokens || 0} tokens)`,
|
|
597
597
|
);
|
|
598
598
|
const wrapped = wrapForInjection(data.context);
|
|
599
|
-
return {
|
|
599
|
+
return { appendSystemContext: wrapped };
|
|
600
600
|
} else {
|
|
601
601
|
log(`memoryrouter: prepare returned no context (memories_found=${data.memories_found || 0})`);
|
|
602
602
|
}
|
|
@@ -734,7 +734,7 @@ const memoryRouterPlugin = {
|
|
|
734
734
|
execute: async (_toolCallId: string, params: Record<string, unknown>) => {
|
|
735
735
|
const query = typeof params.query === "string" ? params.query.trim() : "";
|
|
736
736
|
if (!query) return jsonToolResult({ results: [], error: "query required" });
|
|
737
|
-
const limit = typeof params.maxResults === "number" ? params.maxResults :
|
|
737
|
+
const limit = typeof params.maxResults === "number" ? params.maxResults : 50;
|
|
738
738
|
try {
|
|
739
739
|
const res = await fetch(`${endpoint}/v1/memory/search`, {
|
|
740
740
|
method: "POST",
|
|
@@ -1101,11 +1101,11 @@ const memoryRouterPlugin = {
|
|
|
1101
1101
|
mr.command("search")
|
|
1102
1102
|
.description("Search memories in vault")
|
|
1103
1103
|
.argument("<query>", "Search query")
|
|
1104
|
-
.option("-n, --limit <number>", "Number of results", "
|
|
1104
|
+
.option("-n, --limit <number>", "Number of results", "50")
|
|
1105
1105
|
.option("--json", "Output raw JSON response")
|
|
1106
1106
|
.action(async (query: string, opts: { limit: string; json?: boolean }) => {
|
|
1107
1107
|
if (!memoryKey) { console.error("Not configured. Run: openclaw mr <key>"); return; }
|
|
1108
|
-
const limit = parseInt(opts.limit, 10) ||
|
|
1108
|
+
const limit = parseInt(opts.limit, 10) || 50;
|
|
1109
1109
|
try {
|
|
1110
1110
|
const res = await fetch(`${endpoint}/v1/memory/search`, {
|
|
1111
1111
|
method: "POST",
|