mr-memory 2.19.0 → 2.20.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.
Files changed (2) hide show
  1. package/index.ts +25 -5
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -876,7 +876,8 @@ const memoryRouterPlugin = {
876
876
  .description("Search memories in vault")
877
877
  .argument("<query>", "Search query")
878
878
  .option("-n, --limit <number>", "Number of results", "5")
879
- .action(async (query: string, opts: { limit: string }) => {
879
+ .option("--json", "Output raw JSON response")
880
+ .action(async (query: string, opts: { limit: string; json?: boolean }) => {
880
881
  if (!memoryKey) { console.error("Not configured. Run: openclaw mr <key>"); return; }
881
882
  const limit = parseInt(opts.limit, 10) || 5;
882
883
  try {
@@ -885,6 +886,7 @@ const memoryRouterPlugin = {
885
886
  headers: {
886
887
  Authorization: `Bearer ${memoryKey}`,
887
888
  "Content-Type": "application/json",
889
+ ...(embeddings && { "X-Embedding-Model": embeddings }),
888
890
  },
889
891
  body: JSON.stringify({ query, limit }),
890
892
  });
@@ -894,16 +896,31 @@ const memoryRouterPlugin = {
894
896
  return;
895
897
  }
896
898
  const data = await res.json() as {
899
+ query: string;
900
+ sessionId: string | null;
901
+ memoryKey: string;
897
902
  totalMemories: number;
898
903
  tokenCount: number;
904
+ windowBreakdown: Record<string, number>;
905
+ metrics: Record<string, number>;
899
906
  memories: Array<{
907
+ id: number;
900
908
  content: string;
901
909
  score: number;
902
910
  window: string;
903
911
  timestampHuman: string;
912
+ timestamp: number;
904
913
  role: string;
914
+ source: string;
905
915
  }>;
906
916
  };
917
+
918
+ // Raw JSON output
919
+ if (opts.json) {
920
+ console.log(JSON.stringify(data, null, 2));
921
+ return;
922
+ }
923
+
907
924
  if (data.totalMemories === 0) {
908
925
  console.log("No results found.");
909
926
  return;
@@ -917,11 +934,14 @@ const memoryRouterPlugin = {
917
934
  month: "short", day: "numeric", year: "numeric",
918
935
  });
919
936
  const windowIcon = m.window === "immediate" ? "⚡" : m.window === "short" ? "🔥" : m.window === "long" ? "🧠" : "📚";
920
- const preview = m.content.replace(/\n/g, " ").slice(0, 200);
921
- console.log(` ${i + 1}. ${windowIcon} ${score}% | ${m.role} | ${date}`);
922
- console.log(` ${preview}${m.content.length > 200 ? "..." : ""}\n`);
937
+ console.log(` ${i + 1}. ${windowIcon} ${score}% | ${m.role} | ${date} | id:${m.id}`);
938
+ console.log(` ${m.content}\n`);
939
+ }
940
+ console.log(` Tokens: ${data.tokenCount} | Windows: ${JSON.stringify(data.windowBreakdown)}`);
941
+ if (data.metrics) {
942
+ const ms = data.metrics;
943
+ console.log(` Latency: ${ms.raceMs ?? ms.totalMs ?? '-'}ms`);
923
944
  }
924
- console.log(` Tokens: ${data.tokenCount}`);
925
945
  } catch (err) {
926
946
  console.error(`Failed: ${err instanceof Error ? err.message : String(err)}`);
927
947
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-memory",
3
- "version": "2.19.0",
3
+ "version": "2.20.1",
4
4
  "description": "MemoryRouter persistent memory plugin for OpenClaw — your AI remembers every conversation",
5
5
  "type": "module",
6
6
  "files": [