@memoryrelay/plugin-memoryrelay-ai 0.4.1 → 0.5.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.
- package/index.ts +18 -21
- package/openclaw.plugin.json +7 -13
- package/package.json +1 -1
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
|
-
|
|
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:
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
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
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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,
|
package/openclaw.plugin.json
CHANGED
|
@@ -3,17 +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.
|
|
7
|
-
"safety": {
|
|
8
|
-
"envAccess": {
|
|
9
|
-
"allowed": ["MEMORYRELAY_API_KEY", "MEMORYRELAY_AGENT_ID", "MEMORYRELAY_BASE_URL"],
|
|
10
|
-
"reason": "Configuration fallback - allows users to provide credentials via environment variables instead of config file"
|
|
11
|
-
},
|
|
12
|
-
"networkAccess": {
|
|
13
|
-
"allowed": ["api.memoryrelay.net"],
|
|
14
|
-
"reason": "Core functionality - plugin connects to MemoryRelay API for memory storage and retrieval"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
6
|
+
"version": "0.5.1",
|
|
17
7
|
"uiHints": {
|
|
18
8
|
"apiKey": {
|
|
19
9
|
"label": "MemoryRelay API Key",
|
|
@@ -46,10 +36,14 @@
|
|
|
46
36
|
"additionalProperties": false,
|
|
47
37
|
"properties": {
|
|
48
38
|
"apiKey": {
|
|
49
|
-
"type": "string"
|
|
39
|
+
"type": "string",
|
|
40
|
+
"minLength": 1,
|
|
41
|
+
"description": "MemoryRelay API key (required, get from https://memoryrelay.ai)"
|
|
50
42
|
},
|
|
51
43
|
"agentId": {
|
|
52
|
-
"type": "string"
|
|
44
|
+
"type": "string",
|
|
45
|
+
"minLength": 1,
|
|
46
|
+
"description": "Unique agent identifier (required)"
|
|
53
47
|
},
|
|
54
48
|
"apiUrl": {
|
|
55
49
|
"type": "string",
|