@memtensor/memos-cloud-openclaw-plugin 0.1.8-beta.2 → 0.1.8-beta.3
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/clawdbot.plugin.json +1 -1
- package/lib/check-update.js +28 -9
- package/moltbot.plugin.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/clawdbot.plugin.json
CHANGED
|
@@ -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
|
+
"version": "0.1.8-beta.3",
|
|
6
6
|
"kind": "lifecycle",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"configSchema": {
|
package/lib/check-update.js
CHANGED
|
@@ -3,12 +3,13 @@ import fs from "fs";
|
|
|
3
3
|
import { exec } from "child_process";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
|
+
import os from "os";
|
|
6
7
|
|
|
7
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
9
|
|
|
9
|
-
let lastCheckTime = 0;
|
|
10
10
|
const CHECK_INTERVAL = 24 * 60 * 60 * 1000; // 24 hours
|
|
11
11
|
const PLUGIN_NAME = "@memtensor/memos-cloud-openclaw-plugin";
|
|
12
|
+
const CHECK_FILE = path.join(os.tmpdir(), "memos_openclaw_update_check.json");
|
|
12
13
|
|
|
13
14
|
const ANSI = {
|
|
14
15
|
RESET: "\x1b[0m",
|
|
@@ -102,20 +103,28 @@ function compareVersions(v1, v2) {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
export async function checkUpdate(log) {
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
// Only check for updates when the gateway is starting.
|
|
107
|
+
// When starting the gateway, 'gateway' is in process.argv.
|
|
108
|
+
log.warn(JSON.stringify(process.argv))
|
|
109
|
+
const isGateway = process.argv.includes("gateway");
|
|
110
|
+
|
|
111
|
+
if (!isGateway) {
|
|
109
112
|
return;
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
const now = Date.now();
|
|
116
|
+
let lastCheckTime = 0;
|
|
117
|
+
try {
|
|
118
|
+
if (fs.existsSync(CHECK_FILE)) {
|
|
119
|
+
const data = JSON.parse(fs.readFileSync(CHECK_FILE, "utf-8"));
|
|
120
|
+
lastCheckTime = data.time || 0;
|
|
121
|
+
}
|
|
122
|
+
} catch (e) {}
|
|
123
|
+
|
|
113
124
|
if (now - lastCheckTime < CHECK_INTERVAL) {
|
|
114
125
|
return;
|
|
115
126
|
}
|
|
116
127
|
|
|
117
|
-
lastCheckTime = now;
|
|
118
|
-
|
|
119
128
|
const currentVersion = getPackageVersion();
|
|
120
129
|
if (!currentVersion) {
|
|
121
130
|
return;
|
|
@@ -152,8 +161,18 @@ export async function checkUpdate(log) {
|
|
|
152
161
|
exec(`${cliName} plugins update memos-cloud-openclaw-plugin`, (error, stdout, stderr) => {
|
|
153
162
|
clearInterval(progressInterval);
|
|
154
163
|
|
|
155
|
-
const
|
|
156
|
-
const
|
|
164
|
+
const combinedOutput = `${outText} ${errText}`.toLowerCase();
|
|
165
|
+
const requiresRestart = combinedOutput.includes("restart") ||
|
|
166
|
+
combinedOutput.includes("already at");
|
|
167
|
+
|
|
168
|
+
// ONLY write the 24-hour throttle if the CLI actually tells us to restart the gateway
|
|
169
|
+
// This is the condition that indicates a loop might happen (because the CLI modified openclaw.json)
|
|
170
|
+
// Or if the CLI outputs 'already at', meaning the update was suppressed due to fixed spec.
|
|
171
|
+
if (requiresRestart) {
|
|
172
|
+
try {
|
|
173
|
+
fs.writeFileSync(CHECK_FILE, JSON.stringify({ time: now }));
|
|
174
|
+
} catch (e) {}
|
|
175
|
+
}
|
|
157
176
|
|
|
158
177
|
if (outText) log.info?.(`${ANSI.CYAN}[${cliName}-cli]${ANSI.RESET}\n${outText}`);
|
|
159
178
|
if (errText) log.warn?.(`${ANSI.RED}[${cliName}-cli]${ANSI.RESET}\n${errText}`);
|
package/moltbot.plugin.json
CHANGED
|
@@ -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
|
+
"version": "0.1.8-beta.3",
|
|
6
6
|
"kind": "lifecycle",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"configSchema": {
|
package/openclaw.plugin.json
CHANGED
|
@@ -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
|
+
"version": "0.1.8-beta.3",
|
|
6
6
|
"kind": "lifecycle",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"configSchema": {
|
package/package.json
CHANGED