mr-memory 3.7.10 → 3.9.0
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/README.md +12 -2
- package/index.js +474 -41
- package/index.ts +435 -15
- package/memoryrouter-api.js +69 -2
- package/memoryrouter-api.ts +75 -2
- package/openclaw.plugin.json +11 -0
- package/package.json +1 -1
package/memoryrouter-api.js
CHANGED
|
@@ -27,7 +27,75 @@ export async function searchMemory(endpoint, key, payload) {
|
|
|
27
27
|
"Content-Type": "application/json",
|
|
28
28
|
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
29
29
|
},
|
|
30
|
-
body: JSON.stringify({
|
|
30
|
+
body: JSON.stringify({
|
|
31
|
+
query: payload.query,
|
|
32
|
+
limit: payload.limit,
|
|
33
|
+
...(payload.tiers !== undefined && { tiers: payload.tiers }),
|
|
34
|
+
...(payload.importance !== undefined && { importance: payload.importance }),
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export async function consolidateCheckout(endpoint, key, payload) {
|
|
39
|
+
return fetch(`${endpoint}/v1/memory/consolidate/checkout`, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
...JSON_HEADERS,
|
|
43
|
+
Authorization: `Bearer ${key}`,
|
|
44
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
tier: payload.tier,
|
|
48
|
+
max_tokens: payload.max_tokens ?? 50000,
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export async function commitReflections(endpoint, key, payload) {
|
|
53
|
+
return fetch(`${endpoint}/v1/memory/consolidate/commit`, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers: {
|
|
56
|
+
...JSON_HEADERS,
|
|
57
|
+
Authorization: `Bearer ${key}`,
|
|
58
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
59
|
+
},
|
|
60
|
+
body: JSON.stringify({ batch_id: payload.batch_id, entries: payload.entries }),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export async function inspectMemory(endpoint, key, payload) {
|
|
64
|
+
return fetch(`${endpoint}/v1/memory/inspect`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: {
|
|
67
|
+
...JSON_HEADERS,
|
|
68
|
+
Authorization: `Bearer ${key}`,
|
|
69
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
70
|
+
},
|
|
71
|
+
body: JSON.stringify({ memory_id: payload.memory_id }),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export async function deleteMemoryIds(endpoint, key, payload) {
|
|
75
|
+
return fetch(`${endpoint}/v1/memory/delete-ids`, {
|
|
76
|
+
method: "POST",
|
|
77
|
+
headers: {
|
|
78
|
+
...JSON_HEADERS,
|
|
79
|
+
Authorization: `Bearer ${key}`,
|
|
80
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
81
|
+
},
|
|
82
|
+
body: JSON.stringify({ ids: payload.ids }),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export async function dateSearch(endpoint, key, payload) {
|
|
86
|
+
return fetch(`${endpoint}/v1/memory/date-search`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: {
|
|
89
|
+
...JSON_HEADERS,
|
|
90
|
+
Authorization: `Bearer ${key}`,
|
|
91
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
92
|
+
},
|
|
93
|
+
body: JSON.stringify({
|
|
94
|
+
from: payload.from,
|
|
95
|
+
...(payload.to !== undefined && { to: payload.to }),
|
|
96
|
+
...(payload.query !== undefined && { query: payload.query }),
|
|
97
|
+
...(payload.max_tokens !== undefined && { max_tokens: payload.max_tokens }),
|
|
98
|
+
}),
|
|
31
99
|
});
|
|
32
100
|
}
|
|
33
101
|
export async function getMemoryStats(endpoint, key, embeddings) {
|
|
@@ -47,7 +115,6 @@ export async function deleteMemories(endpoint, key, embeddings) {
|
|
|
47
115
|
headers: { Authorization: `Bearer ${key}` },
|
|
48
116
|
});
|
|
49
117
|
}
|
|
50
|
-
|
|
51
118
|
export async function warmupMemory(endpoint, key, embeddings) {
|
|
52
119
|
return fetch(`${endpoint}/v1/memory/warmup`, {
|
|
53
120
|
method: "POST",
|
package/memoryrouter-api.ts
CHANGED
|
@@ -28,7 +28,7 @@ export function ingestMemory(endpoint: string, key: string, payload: { messages:
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export async function searchMemory(endpoint: string, key: string, payload: { query: string; limit: number; embeddings?: string }): Promise<Response> {
|
|
31
|
+
export async function searchMemory(endpoint: string, key: string, payload: { query: string; limit: number; tiers?: number[]; importance?: number; embeddings?: string }): Promise<Response> {
|
|
32
32
|
return fetch(`${endpoint}/v1/memory/search`, {
|
|
33
33
|
method: "POST",
|
|
34
34
|
headers: {
|
|
@@ -36,7 +36,80 @@ export async function searchMemory(endpoint: string, key: string, payload: { que
|
|
|
36
36
|
"Content-Type": "application/json",
|
|
37
37
|
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
38
38
|
},
|
|
39
|
-
body: JSON.stringify({
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
query: payload.query,
|
|
41
|
+
limit: payload.limit,
|
|
42
|
+
...(payload.tiers !== undefined && { tiers: payload.tiers }),
|
|
43
|
+
...(payload.importance !== undefined && { importance: payload.importance }),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function consolidateCheckout(endpoint: string, key: string, payload: { tier: 1 | 2; max_tokens?: number; embeddings?: string }): Promise<Response> {
|
|
49
|
+
return fetch(`${endpoint}/v1/memory/consolidate/checkout`, {
|
|
50
|
+
method: "POST",
|
|
51
|
+
headers: {
|
|
52
|
+
...JSON_HEADERS,
|
|
53
|
+
Authorization: `Bearer ${key}`,
|
|
54
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
55
|
+
},
|
|
56
|
+
body: JSON.stringify({
|
|
57
|
+
tier: payload.tier,
|
|
58
|
+
max_tokens: payload.max_tokens ?? 50000,
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function commitReflections(endpoint: string, key: string, payload: { batch_id: string; entries: Array<{ text: string; importance: number }>; embeddings?: string }): Promise<Response> {
|
|
64
|
+
return fetch(`${endpoint}/v1/memory/consolidate/commit`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: {
|
|
67
|
+
...JSON_HEADERS,
|
|
68
|
+
Authorization: `Bearer ${key}`,
|
|
69
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
70
|
+
},
|
|
71
|
+
body: JSON.stringify({ batch_id: payload.batch_id, entries: payload.entries }),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export async function inspectMemory(endpoint: string, key: string, payload: { memory_id: string; embeddings?: string }): Promise<Response> {
|
|
76
|
+
return fetch(`${endpoint}/v1/memory/inspect`, {
|
|
77
|
+
method: "POST",
|
|
78
|
+
headers: {
|
|
79
|
+
...JSON_HEADERS,
|
|
80
|
+
Authorization: `Bearer ${key}`,
|
|
81
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
82
|
+
},
|
|
83
|
+
body: JSON.stringify({ memory_id: payload.memory_id }),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export async function deleteMemoryIds(endpoint: string, key: string, payload: { ids: string[]; embeddings?: string }): Promise<Response> {
|
|
88
|
+
return fetch(`${endpoint}/v1/memory/delete-ids`, {
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: {
|
|
91
|
+
...JSON_HEADERS,
|
|
92
|
+
Authorization: `Bearer ${key}`,
|
|
93
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
94
|
+
},
|
|
95
|
+
body: JSON.stringify({ ids: payload.ids }),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function dateSearch(endpoint: string, key: string, payload: { from: string; to?: string; query?: string; max_tokens?: number; embeddings?: string }): Promise<Response> {
|
|
100
|
+
return fetch(`${endpoint}/v1/memory/date-search`, {
|
|
101
|
+
method: "POST",
|
|
102
|
+
headers: {
|
|
103
|
+
...JSON_HEADERS,
|
|
104
|
+
Authorization: `Bearer ${key}`,
|
|
105
|
+
...(payload.embeddings && { "X-Embedding-Model": payload.embeddings }),
|
|
106
|
+
},
|
|
107
|
+
body: JSON.stringify({
|
|
108
|
+
from: payload.from,
|
|
109
|
+
...(payload.to !== undefined && { to: payload.to }),
|
|
110
|
+
...(payload.query !== undefined && { query: payload.query }),
|
|
111
|
+
...(payload.max_tokens !== undefined && { max_tokens: payload.max_tokens }),
|
|
112
|
+
}),
|
|
40
113
|
});
|
|
41
114
|
}
|
|
42
115
|
|
package/openclaw.plugin.json
CHANGED
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
"placeholder": "high",
|
|
22
22
|
"advanced": true,
|
|
23
23
|
"help": "Amount of memory to inject: low (40), high (80), xhigh (160)"
|
|
24
|
+
},
|
|
25
|
+
"keepWarmMs": {
|
|
26
|
+
"label": "Keep Warm Window (ms)",
|
|
27
|
+
"placeholder": "180000",
|
|
28
|
+
"advanced": true,
|
|
29
|
+
"help": "How long to keep your vault warm after each message. Default 180000 (3 min). Set 0 to disable warmup pings."
|
|
24
30
|
}
|
|
25
31
|
},
|
|
26
32
|
"configSchema": {
|
|
@@ -50,6 +56,11 @@
|
|
|
50
56
|
"enum": ["bge", "qwen"],
|
|
51
57
|
"description": "Embedding model: bge (1024d, default) or qwen (4096d)"
|
|
52
58
|
},
|
|
59
|
+
"keepWarmMs": {
|
|
60
|
+
"type": "integer",
|
|
61
|
+
"minimum": 0,
|
|
62
|
+
"description": "Keep the vault warm for this many ms after each message. Default 180000 (3 minutes). 0 disables warmup pings entirely."
|
|
63
|
+
},
|
|
53
64
|
"agentKeys": {
|
|
54
65
|
"type": "object",
|
|
55
66
|
"additionalProperties": {
|
package/package.json
CHANGED