@memoryrelay/plugin-memoryrelay-ai 0.4.0 → 0.5.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.ts CHANGED
@@ -170,32 +170,29 @@ function shouldCapture(text: string): boolean {
170
170
  // ============================================================================
171
171
 
172
172
  export default async function plugin(api: OpenClawPluginApi): Promise<void> {
173
- // Debug: log what config we're receiving
174
- api.logger.info(`memory-memoryrelay: plugin loaded, checking config...`);
175
- api.logger.info(`memory-memoryrelay: pluginConfig type: ${typeof api.pluginConfig}`);
176
- api.logger.info(`memory-memoryrelay: pluginConfig keys: ${api.pluginConfig ? Object.keys(api.pluginConfig).join(', ') : 'null'}`);
177
-
178
173
  const cfg = api.pluginConfig as MemoryRelayConfig | undefined;
179
174
 
180
- // Try to get config from multiple sources
181
- const apiKey = cfg?.apiKey || process.env.MEMORYRELAY_API_KEY;
182
- const agentId = cfg?.agentId || process.env.MEMORYRELAY_AGENT_ID || "default";
183
-
184
- if (!apiKey) {
175
+ if (!cfg?.apiKey) {
185
176
  api.logger.error(
186
- "memory-memoryrelay: missing API key. Configure in one of these ways:\n" +
187
- " 1. Add to config: plugins.entries.\"plugin-memoryrelay-ai\".config.apiKey\n" +
188
- " 2. Set environment variable: MEMORYRELAY_API_KEY\n" +
189
- " 3. Run: cat ~/.openclaw/openclaw.json | jq '.plugins.entries.\"plugin-memoryrelay-ai\".config = {\"apiKey\": \"YOUR_KEY\", \"agentId\": \"YOUR_AGENT\"}' > /tmp/config.json && mv /tmp/config.json ~/.openclaw/openclaw.json\n" +
177
+ "memory-memoryrelay: Missing API key in config.\n\n" +
178
+ "REQUIRED: Add config after installation:\n\n" +
179
+ "cat ~/.openclaw/openclaw.json | jq '.plugins.entries.\"plugin-memoryrelay-ai\".config = {\n" +
180
+ " \"apiKey\": \"YOUR_API_KEY\",\n" +
181
+ " \"agentId\": \"YOUR_AGENT_ID\"\n" +
182
+ "}' > /tmp/config.json && mv /tmp/config.json ~/.openclaw/openclaw.json\n\n" +
183
+ "Then restart: openclaw gateway restart\n\n" +
190
184
  "Get your API key from: https://memoryrelay.ai"
191
185
  );
192
186
  return;
193
187
  }
194
188
 
195
- api.logger.info(`memory-memoryrelay: using agentId: ${agentId}`);
196
-
197
- const apiUrl = cfg?.apiUrl || DEFAULT_API_URL;
198
- const client = new MemoryRelayClient(apiKey, agentId, apiUrl);
189
+ if (!cfg.agentId) {
190
+ api.logger.error("memory-memoryrelay: Missing agentId in config");
191
+ return;
192
+ }
193
+
194
+ const apiUrl = cfg.apiUrl || DEFAULT_API_URL;
195
+ const client = new MemoryRelayClient(cfg.apiKey, cfg.agentId, apiUrl);
199
196
 
200
197
  // Verify connection on startup
201
198
  try {
@@ -216,7 +213,7 @@ export default async function plugin(api: OpenClawPluginApi): Promise<void> {
216
213
  try {
217
214
  const health = await client.health();
218
215
  let memoryCount = 0;
219
-
216
+
220
217
  // Try to get stats if the endpoint exists
221
218
  try {
222
219
  const stats = await client.stats();
@@ -225,11 +222,11 @@ export default async function plugin(api: OpenClawPluginApi): Promise<void> {
225
222
  // Stats endpoint may not exist yet - that's okay, just report 0
226
223
  api.logger.debug?.(`memory-memoryrelay: stats endpoint unavailable: ${String(statsErr)}`);
227
224
  }
228
-
225
+
229
226
  // Consider API connected if health check succeeds with any recognized status
230
227
  const healthStatus = String(health.status).toLowerCase();
231
228
  const isConnected = VALID_HEALTH_STATUSES.includes(healthStatus);
232
-
229
+
233
230
  respond(true, {
234
231
  available: true,
235
232
  connected: isConnected,
@@ -3,7 +3,7 @@
3
3
  "kind": "memory",
4
4
  "name": "MemoryRelay AI",
5
5
  "description": "AI memory service using MemoryRelay API (api.memoryrelay.net)",
6
- "version": "0.4.0",
6
+ "version": "0.5.0",
7
7
  "uiHints": {
8
8
  "apiKey": {
9
9
  "label": "MemoryRelay API Key",
@@ -36,10 +36,12 @@
36
36
  "additionalProperties": false,
37
37
  "properties": {
38
38
  "apiKey": {
39
- "type": "string"
39
+ "type": "string",
40
+ "minLength": 1
40
41
  },
41
42
  "agentId": {
42
- "type": "string"
43
+ "type": "string",
44
+ "minLength": 1
43
45
  },
44
46
  "apiUrl": {
45
47
  "type": "string",
@@ -62,6 +64,6 @@
62
64
  "default": 0.3
63
65
  }
64
66
  },
65
- "required": []
67
+ "required": ["apiKey", "agentId"]
66
68
  }
67
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memoryrelay/plugin-memoryrelay-ai",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "OpenClaw memory plugin for MemoryRelay API - long-term memory with semantic search",
5
5
  "type": "module",
6
6
  "main": "index.ts",