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

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.
@@ -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.6",
5
+ "version": "0.1.8-beta.8",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "configSchema": {
@@ -2,14 +2,31 @@ import https from "https";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { fileURLToPath } from "url";
5
- import { spawn } from "child_process";
5
+ import { spawn, exec } from "child_process";
6
6
  import os from "os";
7
7
 
8
+ /**
9
+ * Kill a spawned child process and its entire process tree.
10
+ */
11
+ function killProcessTree(child) {
12
+ try {
13
+ if (process.platform === "win32") {
14
+ exec(`taskkill /pid ${child.pid} /T /F`, () => {});
15
+ } else {
16
+ // On Unix, kill the process group
17
+ process.kill(-child.pid, "SIGKILL");
18
+ }
19
+ } catch (e) {
20
+ // Fallback: try the basic kill
21
+ try { child.kill("SIGKILL"); } catch (_) {}
22
+ }
23
+ }
24
+
8
25
  let isUpdating = false;
9
26
 
10
27
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
28
 
12
- const CHECK_INTERVAL = 60 * 1000; // 12 hours check interval
29
+ const CHECK_INTERVAL = 5 * 60 * 1000; // 12 hours check interval
13
30
  const UPDATE_TIMEOUT = 3 * 60 * 1000; // 3 minutes timeout for the CLI update command to finish
14
31
  const PLUGIN_NAME = "@memtensor/memos-cloud-openclaw-plugin";
15
32
  const CHECK_FILE = path.join(os.tmpdir(), "memos_openclaw_update_check.json");
@@ -161,18 +178,25 @@ export function startUpdateChecker(log) {
161
178
  })();
162
179
 
163
180
  isUpdating = true;
164
- const child = spawn(cliName, ["plugins", "update", "memos-cloud-openclaw-plugin"], {
165
- shell: true
166
- });
181
+ const spawnOpts = { shell: true };
182
+ // On Unix, detach the process so we can kill the entire process group on timeout
183
+ if (process.platform !== "win32") {
184
+ spawnOpts.detached = true;
185
+ }
186
+ const child = spawn(cliName, ["plugins", "update", "memos-cloud-openclaw-plugin"], spawnOpts);
167
187
 
168
188
  // Timeout mechanism: forcefully kill the update process if it hangs for more than the configured timeout
169
189
  const updateTimeout = setTimeout(() => {
170
190
  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
- }
191
+ killProcessTree(child);
192
+
193
+ // Fallback: if kill failed and the close event never fires, forcefully release the lock after 5 seconds
194
+ setTimeout(() => {
195
+ if (isUpdating) {
196
+ clearInterval(progressInterval);
197
+ isUpdating = false;
198
+ }
199
+ }, 5000);
176
200
  }, UPDATE_TIMEOUT);
177
201
 
178
202
  child.stdout.on("data", (data) => {
@@ -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.6",
5
+ "version": "0.1.8-beta.8",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "configSchema": {
@@ -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.6",
5
+ "version": "0.1.8-beta.8",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memtensor/memos-cloud-openclaw-plugin",
3
- "version": "0.1.8-beta.6",
3
+ "version": "0.1.8-beta.8",
4
4
  "description": "OpenClaw lifecycle plugin for MemOS Cloud (add + recall memory)",
5
5
  "scripts": {
6
6
  "sync-version": "node scripts/sync-version.js",