@memtensor/memos-cloud-openclaw-plugin 0.1.8-beta.5 → 0.1.8-beta.6

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/README.md CHANGED
@@ -111,6 +111,7 @@ In `plugins.entries.memos-cloud-openclaw-plugin.config`:
111
111
  "recallGlobal": true,
112
112
  "addEnabled": true,
113
113
  "captureStrategy": "last_turn",
114
+ "maxItemChars": 8000,
114
115
  "includeAssistant": true,
115
116
  "conversationIdPrefix": "",
116
117
  "conversationIdSuffix": "",
@@ -2,7 +2,7 @@
2
2
  "id": "memos-cloud-openclaw-plugin",
3
3
  "name": "MemOS Cloud OpenClaw Plugin",
4
4
  "description": "MemOS Cloud recall + add memory via lifecycle hooks",
5
- "version": "0.1.8-beta.5",
5
+ "version": "0.1.8-beta.6",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "configSchema": {
@@ -78,6 +78,11 @@
78
78
  "description": "Max chars per message when adding",
79
79
  "default": 20000
80
80
  },
81
+ "maxItemChars": {
82
+ "type": "integer",
83
+ "description": "Max chars per memory item when injecting prompt",
84
+ "default": 8000
85
+ },
81
86
  "includeAssistant": {
82
87
  "type": "boolean",
83
88
  "default": true
package/index.js CHANGED
@@ -245,7 +245,8 @@ export default {
245
245
  const result = await searchMemory(cfg, payload);
246
246
  const promptBlock = formatPromptBlock(result, {
247
247
  wrapTagBlocks: true,
248
- relativity: payload.relativity
248
+ relativity: payload.relativity,
249
+ maxItemChars: cfg.maxItemChars
249
250
  });
250
251
  if (!promptBlock) return;
251
252
 
@@ -2,12 +2,15 @@ import https from "https";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { fileURLToPath } from "url";
5
- import { exec } from "child_process";
5
+ import { spawn } from "child_process";
6
6
  import os from "os";
7
7
 
8
+ let isUpdating = false;
9
+
8
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
11
 
10
- const CHECK_INTERVAL = 12 * 60 * 60 * 1000; // 12 hours
12
+ const CHECK_INTERVAL = 60 * 1000; // 12 hours check interval
13
+ const UPDATE_TIMEOUT = 3 * 60 * 1000; // 3 minutes timeout for the CLI update command to finish
11
14
  const PLUGIN_NAME = "@memtensor/memos-cloud-openclaw-plugin";
12
15
  const CHECK_FILE = path.join(os.tmpdir(), "memos_openclaw_update_check.json");
13
16
 
@@ -110,6 +113,11 @@ export function startUpdateChecker(log) {
110
113
  }
111
114
 
112
115
  const runCheck = async () => {
116
+ if (isUpdating) {
117
+ log.info?.(`${ANSI.YELLOW}[memos-cloud] An update sequence is currently in progress, skipping this check.${ANSI.RESET}`);
118
+ return;
119
+ }
120
+
113
121
  // TRULY PREVENT LOOPS: The instant we start a check, record the time BEFORE any network or processing happens.
114
122
  // This absolutely guarantees that even if the network hangs, NPM crashes, or openclaw update causes an immediate hot reload,
115
123
  // the system has already advanced the 12-hour/1-min clock and will NOT re-enter this function on boot.
@@ -140,7 +148,7 @@ export function startUpdateChecker(log) {
140
148
  dotCount++;
141
149
  const dots = ".".repeat(dotCount % 4);
142
150
  log.info?.(`${ANSI.YELLOW}[memos-cloud] Update in progress for memos-cloud-openclaw-plugin${dots}${ANSI.RESET}`);
143
- }, 5000); // Log every 5 seconds to show it's still alive
151
+ }, 30000); // Log every 30 seconds to show it's still alive without spamming
144
152
 
145
153
  const cliName = (() => {
146
154
  // Check the full path of the entry script (e.g., .../moltbot/bin/index.js) or the executable
@@ -152,23 +160,53 @@ export function startUpdateChecker(log) {
152
160
  return "openclaw";
153
161
  })();
154
162
 
155
- exec(`${cliName} plugins update memos-cloud-openclaw-plugin`, (error, stdout, stderr) => {
156
- clearInterval(progressInterval);
163
+ isUpdating = true;
164
+ const child = spawn(cliName, ["plugins", "update", "memos-cloud-openclaw-plugin"], {
165
+ shell: true
166
+ });
167
+
168
+ // Timeout mechanism: forcefully kill the update process if it hangs for more than the configured timeout
169
+ const updateTimeout = setTimeout(() => {
170
+ log.warn?.(`${ANSI.RED}[memos-cloud] Update process timed out. Please try manually running: ${cliName} plugins update memos-cloud-openclaw-plugin${ANSI.RESET}`);
171
+ try {
172
+ child.kill("SIGKILL");
173
+ } catch (e) {
174
+ // Process might already be dead
175
+ }
176
+ }, UPDATE_TIMEOUT);
177
+
178
+ child.stdout.on("data", (data) => {
179
+ const outText = data.toString();
180
+ log.info?.(`${ANSI.CYAN}[${cliName}-cli]${ANSI.RESET}\n${outText.trim()}`);
181
+
182
+ // Auto-reply to any [y/N] prompts from the CLI
183
+ if (outText.toLowerCase().includes("[y/n]")) {
184
+ child.stdin.write("y\n");
185
+ }
186
+ });
187
+
188
+ child.stderr.on("data", (data) => {
189
+ const errText = data.toString();
190
+ log.warn?.(`${ANSI.RED}[${cliName}-cli]${ANSI.RESET}\n${errText.trim()}`);
157
191
 
158
- const outText = (stdout || "").trim();
159
- const errText = (stderr || "").trim();
192
+ // Some CLIs output interactive prompts to stderr instead of stdout
193
+ if (errText.toLowerCase().includes("[y/n]")) {
194
+ child.stdin.write("y\n");
195
+ }
196
+ });
160
197
 
161
- if (outText) log.info?.(`${ANSI.CYAN}[${cliName}-cli]${ANSI.RESET}\n${outText}`);
162
- if (errText) log.warn?.(`${ANSI.RED}[${cliName}-cli]${ANSI.RESET}\n${errText}`);
198
+ child.on("close", (code) => {
199
+ clearTimeout(updateTimeout);
200
+ clearInterval(progressInterval);
201
+ isUpdating = false;
163
202
 
164
203
  // Wait for a brief moment to let file system sync if needed
165
204
  setTimeout(() => {
166
205
  const postUpdateVersion = getPackageVersion();
167
206
  const actuallyUpdated = (postUpdateVersion === latestVersion) && (postUpdateVersion !== currentVersion);
168
207
 
169
- if (error || !actuallyUpdated) {
170
- const reason = error ? "Command exited with error" : "Version did not change after update command";
171
- log.warn?.(`${ANSI.RED}[memos-cloud] Auto-update failed (${reason}). Please refer to the CLI logs above, or run manually: ${cliName} plugins update memos-cloud-openclaw-plugin${ANSI.RESET}`);
208
+ if (code !== 0 || !actuallyUpdated) {
209
+ log.warn?.(`${ANSI.RED}[memos-cloud] Auto-update failed or version did not change. Please refer to the CLI logs above, or run manually: ${cliName} plugins update memos-cloud-openclaw-plugin${ANSI.RESET}`);
172
210
  } else {
173
211
  log.info?.(`${ANSI.GREEN}[memos-cloud] Successfully updated to version ${latestVersion}. Please restart the gateway to apply changes.${ANSI.RESET}`);
174
212
  }
@@ -164,6 +164,7 @@ export function buildConfig(pluginConfig = {}) {
164
164
  addEnabled: cfg.addEnabled !== false,
165
165
  captureStrategy: cfg.captureStrategy ?? "last_turn",
166
166
  maxMessageChars: cfg.maxMessageChars ?? 20000,
167
+ maxItemChars: cfg.maxItemChars ?? 8000,
167
168
  includeAssistant: cfg.includeAssistant !== false,
168
169
  memoryLimitNumber: cfg.memoryLimitNumber ?? 9,
169
170
  preferenceLimitNumber: cfg.preferenceLimitNumber ?? 6,
@@ -445,5 +446,6 @@ export function formatPromptBlock(result, options = {}) {
445
446
 
446
447
  function truncate(text, maxLen) {
447
448
  if (!text) return "";
448
- return text.length > maxLen ? `${text.slice(0, maxLen)}...` : text;
449
+ const limit = maxLen || 10000;
450
+ return text.length > limit ? `${text.slice(0, limit)}...` : text;
449
451
  }
@@ -2,7 +2,7 @@
2
2
  "id": "memos-cloud-openclaw-plugin",
3
3
  "name": "MemOS Cloud OpenClaw Plugin",
4
4
  "description": "MemOS Cloud recall + add memory via lifecycle hooks",
5
- "version": "0.1.8-beta.5",
5
+ "version": "0.1.8-beta.6",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "configSchema": {
@@ -78,6 +78,11 @@
78
78
  "description": "Max chars per message when adding",
79
79
  "default": 20000
80
80
  },
81
+ "maxItemChars": {
82
+ "type": "integer",
83
+ "description": "Max chars per memory item when injecting prompt",
84
+ "default": 8000
85
+ },
81
86
  "includeAssistant": {
82
87
  "type": "boolean",
83
88
  "default": true
@@ -2,7 +2,7 @@
2
2
  "id": "memos-cloud-openclaw-plugin",
3
3
  "name": "MemOS Cloud OpenClaw Plugin",
4
4
  "description": "MemOS Cloud recall + add memory via lifecycle hooks",
5
- "version": "0.1.8-beta.5",
5
+ "version": "0.1.8-beta.6",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "configSchema": {
@@ -78,6 +78,11 @@
78
78
  "description": "Max chars per message when adding",
79
79
  "default": 20000
80
80
  },
81
+ "maxItemChars": {
82
+ "type": "integer",
83
+ "description": "Max chars per memory item when injecting prompt",
84
+ "default": 8000
85
+ },
81
86
  "includeAssistant": {
82
87
  "type": "boolean",
83
88
  "default": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memtensor/memos-cloud-openclaw-plugin",
3
- "version": "0.1.8-beta.5",
3
+ "version": "0.1.8-beta.6",
4
4
  "description": "OpenClaw lifecycle plugin for MemOS Cloud (add + recall memory)",
5
5
  "scripts": {
6
6
  "sync-version": "node scripts/sync-version.js",