memory-search-plugin 0.6.0 → 0.8.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/gateway-client.ts +2 -0
- package/index.js +1 -1
- package/index.ts +8 -3
- package/package.json +1 -1
package/gateway-client.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface MemorySearchRequest {
|
|
|
18
18
|
query: string;
|
|
19
19
|
scene: Scene;
|
|
20
20
|
group_id?: string | null;
|
|
21
|
+
release_name?: string; // 用户隔离标识(如 user-xxx),owner/peer 搜索必须
|
|
21
22
|
limit?: number; // 1-100, default 20
|
|
22
23
|
threshold?: number; // 0.0-1.0, default 0.3
|
|
23
24
|
}
|
|
@@ -48,6 +49,7 @@ export interface MemoryGetRequest {
|
|
|
48
49
|
path: string;
|
|
49
50
|
scene?: Scene;
|
|
50
51
|
group_id?: string | null;
|
|
52
|
+
release_name?: string; // 用户隔离标识(如 user-xxx),owner/peer 搜索必须
|
|
51
53
|
from?: number;
|
|
52
54
|
lines?: number;
|
|
53
55
|
}
|
package/index.js
CHANGED
|
@@ -108,7 +108,7 @@ var buildPromptSection = ({
|
|
|
108
108
|
if (!hasMemorySearch && !hasMemoryGet) return [];
|
|
109
109
|
let toolGuidance;
|
|
110
110
|
if (hasMemorySearch && hasMemoryGet) {
|
|
111
|
-
toolGuidance = "Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search on MEMORY.md + memory/*.md; then use memory_get
|
|
111
|
+
toolGuidance = "Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search for semantic search on MEMORY.md + memory/*.md; then use memory_get for keyword retrieval on only the needed content. If low confidence after search, say you checked.";
|
|
112
112
|
} else if (hasMemorySearch) {
|
|
113
113
|
toolGuidance = "Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search on MEMORY.md + memory/*.md and answer from the matching results. If low confidence after search, say you checked.";
|
|
114
114
|
} else {
|
package/index.ts
CHANGED
|
@@ -48,7 +48,7 @@ const buildPromptSection = ({
|
|
|
48
48
|
if (hasMemorySearch && hasMemoryGet) {
|
|
49
49
|
toolGuidance =
|
|
50
50
|
"Before answering anything about prior work, decisions, dates, people, preferences, or todos: " +
|
|
51
|
-
"run memory_search on MEMORY.md + memory/*.md; then use memory_get
|
|
51
|
+
"run memory_search for semantic search on MEMORY.md + memory/*.md; then use memory_get for keyword retrieval on only the needed content. " +
|
|
52
52
|
"If low confidence after search, say you checked.";
|
|
53
53
|
} else if (hasMemorySearch) {
|
|
54
54
|
toolGuidance =
|
|
@@ -150,7 +150,9 @@ export default definePluginEntry({
|
|
|
150
150
|
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
151
151
|
const gatewayUrl = (api.pluginConfig?.gatewayUrl as string | undefined) || "http://localhost:18790";
|
|
152
152
|
const gatewayToken = (api.pluginConfig?.gatewayToken as string | undefined) || "";
|
|
153
|
-
|
|
153
|
+
const ocToken = process.env.OPENCLAW_GATEWAY_TOKEN || "";
|
|
154
|
+
const releaseName = ocToken.startsWith("oc-") ? ocToken.slice(3) : "";
|
|
155
|
+
console.log("[memory-search-plugin] gatewayUrl:", gatewayUrl, "releaseName:", releaseName);
|
|
154
156
|
|
|
155
157
|
const gateway = createGatewayClient({ gatewayUrl, gatewayToken });
|
|
156
158
|
|
|
@@ -240,6 +242,7 @@ export default definePluginEntry({
|
|
|
240
242
|
console.log(
|
|
241
243
|
`[memory-search-plugin] search: agent_id=${agentId} scene=${identity.scene} ` +
|
|
242
244
|
`user_id=${identity.user_id} group_id=${identity.group_id} ` +
|
|
245
|
+
`release_name=${releaseName} ` +
|
|
243
246
|
`(source=${params.sender_id ? "llm_params" : "fallback"})`
|
|
244
247
|
);
|
|
245
248
|
|
|
@@ -250,6 +253,7 @@ export default definePluginEntry({
|
|
|
250
253
|
query,
|
|
251
254
|
scene: identity.scene,
|
|
252
255
|
group_id: identity.group_id,
|
|
256
|
+
release_name: releaseName || undefined,
|
|
253
257
|
limit: params.maxResults || 20,
|
|
254
258
|
threshold: params.minScore || 0.3,
|
|
255
259
|
});
|
|
@@ -394,7 +398,7 @@ export default definePluginEntry({
|
|
|
394
398
|
|
|
395
399
|
console.log(
|
|
396
400
|
`[memory-search-plugin] get: path=${path} agent_id=${agentId} scene=${identity.scene} ` +
|
|
397
|
-
`user_id=${identity.user_id} (source=${params.sender_id ? "llm_params" : "fallback"})`
|
|
401
|
+
`user_id=${identity.user_id} release_name=${releaseName} (source=${params.sender_id ? "llm_params" : "fallback"})`
|
|
398
402
|
);
|
|
399
403
|
|
|
400
404
|
try {
|
|
@@ -404,6 +408,7 @@ export default definePluginEntry({
|
|
|
404
408
|
path,
|
|
405
409
|
scene: identity.scene,
|
|
406
410
|
group_id: identity.group_id,
|
|
411
|
+
release_name: releaseName || undefined,
|
|
407
412
|
from: params.from,
|
|
408
413
|
lines: params.lines,
|
|
409
414
|
});
|