memory-search-plugin 1.1.0 → 1.3.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/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2
+
1
3
  // identity.ts
2
4
  function resolveIdentity(params) {
3
5
  const testScene = process.env.MEMORY_GATEWAY_TEST_SCENE;
@@ -15,7 +17,7 @@ function resolveIdentity(params) {
15
17
  const groupId = params.group_id?.trim() || null;
16
18
  if (!ownerId) {
17
19
  console.warn(
18
- "[identity] owner_id is empty \u2014 LLM failed to extract from UntrustedContext. owner queries will be skipped to prevent cross-user leak."
20
+ "[identity] owner_id is empty LLM failed to extract from UntrustedContext. owner queries will be skipped to prevent cross-user leak."
19
21
  );
20
22
  }
21
23
  if (convType === "group") {
@@ -54,7 +56,8 @@ function createGatewayClient(config) {
54
56
 
55
57
  // index.ts
56
58
  var buildPromptSection = ({
57
- availableTools
59
+ availableTools,
60
+ citationsMode
58
61
  }) => {
59
62
  const hasSearch = availableTools.has("memory_search");
60
63
  const hasGet = availableTools.has("memory_get");
@@ -63,28 +66,31 @@ var buildPromptSection = ({
63
66
  "## Memory Recall",
64
67
  "Before answering anything about prior work, decisions, dates, people, preferences, or todos: run memory_search for semantic search. If low confidence after search, say you checked.",
65
68
  "",
66
- "**Context extraction:** When calling memory_search or memory_get, you MUST extract the following from the UntrustedContext section and pass as parameters: `owner_id`, `sender_id`, `agent_id`, `conversation_type`, `group_id`. Look for lines like `owner_id: xxx`, `sender_id: xxx`, etc. If a field is not present, omit it. Do NOT invent or guess values \u2014 only use what is explicitly stated in UntrustedContext.",
69
+ "**Context extraction:** When calling memory_search or memory_get, you MUST extract the following from the UntrustedContext section and pass as parameters: `owner_id`, `sender_id`, `agent_id`, `conversation_type`, `group_id`. Look for lines like `owner_id: xxx`, `sender_id: xxx`, etc. If a field is not present, omit it. Do NOT invent or guess values only use what is explicitly stated in UntrustedContext.",
67
70
  ""
68
71
  ];
69
72
  return lines;
70
73
  };
71
- var index_default = {
74
+
75
+ var index_default = definePluginEntry({
72
76
  id: "memory-search-plugin",
77
+ name: "Memory Search Plugin",
78
+ description: "Memory search and retrieval with owner_id-based isolation",
79
+ kind: "memory",
80
+
73
81
  register(api) {
74
- const config = {
75
- gatewayUrl: api.getConfig?.("MEMORY_GATEWAY_URL") || process.env.MEMORY_GATEWAY_URL || "",
76
- gatewayToken: api.getConfig?.("MEMORY_GATEWAY_TOKEN") || process.env.MEMORY_GATEWAY_TOKEN || ""
77
- };
82
+ const gatewayUrl = api.pluginConfig?.gatewayUrl || process.env.MEMORY_GATEWAY_URL || "";
83
+ const gatewayToken = api.pluginConfig?.gatewayToken || process.env.MEMORY_GATEWAY_TOKEN || "";
84
+ const config = { gatewayUrl, gatewayToken };
78
85
  if (!config.gatewayUrl) {
79
86
  console.warn("[memory-search-plugin] MEMORY_GATEWAY_URL not set, plugin disabled");
80
87
  return;
81
88
  }
89
+ console.log("[memory-search-plugin] gatewayUrl:", gatewayUrl);
82
90
  const gateway = createGatewayClient(config);
83
- api.registerPromptSection?.({
84
- id: "memory-recall",
85
- position: "top",
86
- build: buildPromptSection
87
- });
91
+
92
+ api.registerMemoryPromptSection(buildPromptSection);
93
+
88
94
  api.registerTool(
89
95
  (ctx) => {
90
96
  return {
@@ -175,6 +181,7 @@ ${r.content}`;
175
181
  },
176
182
  { names: ["memory_search"] }
177
183
  );
184
+
178
185
  api.registerTool(
179
186
  (ctx) => {
180
187
  return {
@@ -270,7 +277,8 @@ ${r.content}`;
270
277
  { names: ["memory_get"] }
271
278
  );
272
279
  }
273
- };
280
+ });
281
+
274
282
  export {
275
283
  index_default as default
276
284
  };
package/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
1
2
  import { resolveIdentity } from "./identity";
2
3
  import {
3
4
  createGatewayClient,
@@ -9,8 +10,10 @@ import {
9
10
 
10
11
  const buildPromptSection = ({
11
12
  availableTools,
13
+ citationsMode,
12
14
  }: {
13
15
  availableTools: Set<string>;
16
+ citationsMode: string;
14
17
  }) => {
15
18
  const hasSearch = availableTools.has("memory_search");
16
19
  const hasGet = availableTools.has("memory_get");
@@ -36,34 +39,31 @@ const buildPromptSection = ({
36
39
 
37
40
  // ── Plugin Entry ──
38
41
 
39
- export default {
42
+ export default definePluginEntry({
40
43
  id: "memory-search-plugin",
44
+ name: "Memory Search Plugin",
45
+ description: "Memory search and retrieval with owner_id-based isolation",
46
+ kind: "memory" as const,
41
47
 
42
48
  register(api: any) {
43
- const config: GatewayClientConfig = {
44
- gatewayUrl:
45
- api.getConfig?.("MEMORY_GATEWAY_URL") ||
46
- process.env.MEMORY_GATEWAY_URL ||
47
- "",
48
- gatewayToken:
49
- api.getConfig?.("MEMORY_GATEWAY_TOKEN") ||
50
- process.env.MEMORY_GATEWAY_TOKEN ||
51
- "",
52
- };
49
+ const gatewayUrl = (api.pluginConfig?.gatewayUrl as string | undefined) ||
50
+ process.env.MEMORY_GATEWAY_URL || "";
51
+ const gatewayToken = (api.pluginConfig?.gatewayToken as string | undefined) ||
52
+ process.env.MEMORY_GATEWAY_TOKEN || "";
53
+
54
+ const config: GatewayClientConfig = { gatewayUrl, gatewayToken };
53
55
 
54
56
  if (!config.gatewayUrl) {
55
57
  console.warn("[memory-search-plugin] MEMORY_GATEWAY_URL not set, plugin disabled");
56
58
  return;
57
59
  }
58
60
 
61
+ console.log("[memory-search-plugin] gatewayUrl:", gatewayUrl);
62
+
59
63
  const gateway: GatewayClient = createGatewayClient(config);
60
64
 
61
65
  // ── Prompt Section ──
62
- api.registerPromptSection?.({
63
- id: "memory-recall",
64
- position: "top",
65
- build: buildPromptSection,
66
- });
66
+ api.registerMemoryPromptSection(buildPromptSection);
67
67
 
68
68
  // ── memory_search (vector search on memory_pipeline_facts) ──
69
69
  api.registerTool(
@@ -313,4 +313,4 @@ export default {
313
313
  { names: ["memory_get"] }
314
314
  );
315
315
  },
316
- };
316
+ });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "memory-search-plugin",
3
3
  "name": "Memory Search Plugin",
4
- "version": "1.1.0",
4
+ "version": "1.3.0",
5
5
  "description": "Memory search and retrieval with owner_id-based isolation (no release_name)",
6
6
  "main": "index.ts",
7
7
  "config": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-search-plugin",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "files": [