@pentatonic-ai/openclaw-memory-plugin 0.5.2 → 0.5.5

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
@@ -55,12 +55,13 @@ async function localSearch(baseUrl, query, limit = 5, minScore = 0.3) {
55
55
  body: JSON.stringify({ query, limit, min_score: minScore }),
56
56
  signal: AbortSignal.timeout(5000),
57
57
  });
58
- if (!res.ok) { stats.backendReachable = false; return []; }
58
+ if (!res.ok) { stats.backendReachable = false; console.error(`[pentatonic-memory] search HTTP ${res.status}`); return []; }
59
59
  stats.backendReachable = true;
60
60
  const data = await res.json();
61
61
  return data.results || [];
62
- } catch {
62
+ } catch (err) {
63
63
  stats.backendReachable = false;
64
+ console.error(`[pentatonic-memory] search fetch error: ${err.message}`);
64
65
  return [];
65
66
  }
66
67
  }
@@ -73,11 +74,12 @@ async function localStore(baseUrl, content, metadata = {}) {
73
74
  body: JSON.stringify({ content, metadata }),
74
75
  signal: AbortSignal.timeout(10000),
75
76
  });
76
- if (!res.ok) { stats.backendReachable = false; return null; }
77
+ if (!res.ok) { stats.backendReachable = false; console.error(`[pentatonic-memory] store HTTP ${res.status}`); return null; }
77
78
  stats.backendReachable = true;
78
79
  return res.json();
79
- } catch {
80
+ } catch (err) {
80
81
  stats.backendReachable = false;
82
+ console.error(`[pentatonic-memory] store fetch error: ${err.message}`);
81
83
  return null;
82
84
  }
83
85
  }
@@ -264,7 +266,7 @@ export default {
264
266
  kind: "context-engine",
265
267
 
266
268
  register(api) {
267
- const config = api.config || {};
269
+ const config = api.pluginConfig || api.config?.plugins?.entries?.["pentatonic-memory"]?.config || api.config || {};
268
270
  const hosted = !!(config.tes_endpoint && config.tes_api_key);
269
271
  const baseUrl = config.memory_url || "http://localhost:3333";
270
272
  const searchLimit = config.search_limit || 5;
@@ -308,27 +310,50 @@ export default {
308
310
  const lastUserMsg = [...messages].reverse().find((m) => m.role === "user" || m.type === "user");
309
311
  if (!lastUserMsg?.content) return { messages, estimatedTokens: 0 };
310
312
 
311
- // First interaction: check if backend is reachable, prompt setup if not
312
- if (!stats.setupPrompted && stats.backendReachable === null) {
313
- if (!hosted) await localHealth(baseUrl);
314
- }
315
-
316
- if (!stats.setupPrompted && stats.backendReachable === false) {
313
+ // First interaction: welcome the user and offer TES upgrade
314
+ if (!stats.setupPrompted) {
317
315
  stats.setupPrompted = true;
318
- const setupPrompt = [
319
- "[Pentatonic Memory] The memory system is installed but not connected to a backend yet.",
320
- "",
321
- "Before responding to the user, ask them how they'd like to set up their memory:",
322
- "",
323
- "1. **Local** (self-hosted) — Fully private, runs on this machine via Docker. Requires Docker installed.",
324
- " Use the pentatonic_memory_setup tool with action 'check_local' to verify.",
325
- "",
326
- "2. **Hosted** (Pentatonic TES cloud) — Team-wide shared memory, analytics dashboard, higher-dimensional embeddings.",
327
- " Use the pentatonic_memory_setup tool with action 'setup_hosted' to create an account.",
328
- "",
329
- "Ask the user which option they prefer, then use the pentatonic_memory_setup tool to proceed.",
330
- ].join("\n");
331
- return { messages, estimatedTokens: Math.ceil(setupPrompt.length / 4), systemPromptAddition: setupPrompt };
316
+
317
+ if (!hosted) {
318
+ await localHealth(baseUrl);
319
+ }
320
+
321
+ let setupPrompt;
322
+ if (hosted) {
323
+ // Already on TES — no prompt needed
324
+ setupPrompt = null;
325
+ } else if (stats.backendReachable) {
326
+ // Local is working — upsell TES
327
+ setupPrompt = [
328
+ "[Pentatonic Memory] Memory is active and working locally.",
329
+ "",
330
+ "After responding to the user's message, briefly mention that Pentatonic Memory is running locally and offer an upgrade:",
331
+ "",
332
+ "Local memory is great for personal use. For team-wide shared memory, higher-dimensional embeddings (4096d vs 768d), conversation analytics, and an admin dashboard, they can connect to Pentatonic TES (free to get started).",
333
+ "",
334
+ "Ask if they'd like to upgrade to hosted TES. If yes, use the pentatonic_memory_setup tool with action 'setup_hosted'.",
335
+ "Keep it brief and natural — don't be pushy. One mention is enough.",
336
+ ].join("\n");
337
+ } else {
338
+ // Nothing running — full setup prompt
339
+ setupPrompt = [
340
+ "[Pentatonic Memory] The memory plugin is installed but no backend is connected yet.",
341
+ "",
342
+ "Before responding to the user, ask them how they'd like to set up their memory:",
343
+ "",
344
+ "1. **Local** (self-hosted) — Fully private, runs on this machine via Docker. Free forever.",
345
+ " Use the pentatonic_memory_setup tool with action 'check_local' to verify.",
346
+ "",
347
+ "2. **Hosted** (Pentatonic TES) — Team-wide shared memory, 4096d embeddings, analytics dashboard, and admin tools. Free to get started.",
348
+ " Use the pentatonic_memory_setup tool with action 'setup_hosted' to create an account.",
349
+ "",
350
+ "Ask the user which option they prefer, then use the pentatonic_memory_setup tool to proceed.",
351
+ ].join("\n");
352
+ }
353
+
354
+ if (setupPrompt) {
355
+ return { messages, estimatedTokens: Math.ceil(setupPrompt.length / 4), systemPromptAddition: setupPrompt };
356
+ }
332
357
  }
333
358
 
334
359
  try {
@@ -14,6 +14,11 @@
14
14
  "default": "local",
15
15
  "description": "Local (Docker + Ollama) or hosted (Pentatonic TES)"
16
16
  },
17
+ "memory_url": {
18
+ "type": "string",
19
+ "default": "http://localhost:3333",
20
+ "description": "Memory server HTTP URL (local mode, default: http://localhost:3333)"
21
+ },
17
22
  "database_url": {
18
23
  "type": "string",
19
24
  "description": "PostgreSQL connection string (local mode)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pentatonic-ai/openclaw-memory-plugin",
3
- "version": "0.5.2",
3
+ "version": "0.5.5",
4
4
  "description": "Pentatonic Memory plugin for OpenClaw — persistent, searchable memory with multi-signal retrieval and HyDE query expansion",
5
5
  "type": "module",
6
6
  "main": "index.js",