@memtensor/memos-cloud-openclaw-plugin 0.1.8-beta.4 → 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 +1 -0
- package/clawdbot.plugin.json +6 -1
- package/index.js +2 -1
- package/lib/check-update.js +51 -17
- package/lib/memos-cloud-api.js +3 -1
- package/moltbot.plugin.json +6 -1
- package/openclaw.plugin.json +6 -1
- package/package.json +1 -1
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": "",
|
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.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
|
|
package/lib/check-update.js
CHANGED
|
@@ -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 {
|
|
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
|
+
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,15 +113,18 @@ export function startUpdateChecker(log) {
|
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
const runCheck = async () => {
|
|
113
|
-
|
|
114
|
-
|
|
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
|
+
|
|
115
121
|
// TRULY PREVENT LOOPS: The instant we start a check, record the time BEFORE any network or processing happens.
|
|
116
122
|
// This absolutely guarantees that even if the network hangs, NPM crashes, or openclaw update causes an immediate hot reload,
|
|
117
123
|
// the system has already advanced the 12-hour/1-min clock and will NOT re-enter this function on boot.
|
|
118
124
|
try {
|
|
119
125
|
fs.writeFileSync(CHECK_FILE, JSON.stringify({ time: Date.now() }));
|
|
120
126
|
} catch (e) {
|
|
121
|
-
log.warn?.(`${ANSI.RED}[memos-cloud] Failed to write
|
|
127
|
+
log.warn?.(`${ANSI.RED}[memos-cloud] Failed to write timestamp file: ${e.message}${ANSI.RESET}`);
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
const currentVersion = getPackageVersion();
|
|
@@ -128,12 +134,10 @@ export function startUpdateChecker(log) {
|
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
try {
|
|
131
|
-
log.info?.(`${ANSI.CYAN}[memos-cloud] Fetching latest version for ${PLUGIN_NAME} from registry...${ANSI.RESET}`);
|
|
132
137
|
const latestVersion = await getLatestVersion(log);
|
|
133
138
|
|
|
134
139
|
// Normal version check
|
|
135
140
|
if (compareVersions(latestVersion, currentVersion) <= 0) {
|
|
136
|
-
log.info?.(`${ANSI.GREEN}[memos-cloud] No update needed. Current: ${currentVersion}, Latest: ${latestVersion}${ANSI.RESET}`);
|
|
137
141
|
return;
|
|
138
142
|
}
|
|
139
143
|
|
|
@@ -144,7 +148,7 @@ export function startUpdateChecker(log) {
|
|
|
144
148
|
dotCount++;
|
|
145
149
|
const dots = ".".repeat(dotCount % 4);
|
|
146
150
|
log.info?.(`${ANSI.YELLOW}[memos-cloud] Update in progress for memos-cloud-openclaw-plugin${dots}${ANSI.RESET}`);
|
|
147
|
-
},
|
|
151
|
+
}, 30000); // Log every 30 seconds to show it's still alive without spamming
|
|
148
152
|
|
|
149
153
|
const cliName = (() => {
|
|
150
154
|
// Check the full path of the entry script (e.g., .../moltbot/bin/index.js) or the executable
|
|
@@ -156,23 +160,53 @@ export function startUpdateChecker(log) {
|
|
|
156
160
|
return "openclaw";
|
|
157
161
|
})();
|
|
158
162
|
|
|
159
|
-
|
|
160
|
-
|
|
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()}`);
|
|
161
191
|
|
|
162
|
-
|
|
163
|
-
|
|
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
|
+
});
|
|
164
197
|
|
|
165
|
-
|
|
166
|
-
|
|
198
|
+
child.on("close", (code) => {
|
|
199
|
+
clearTimeout(updateTimeout);
|
|
200
|
+
clearInterval(progressInterval);
|
|
201
|
+
isUpdating = false;
|
|
167
202
|
|
|
168
203
|
// Wait for a brief moment to let file system sync if needed
|
|
169
204
|
setTimeout(() => {
|
|
170
205
|
const postUpdateVersion = getPackageVersion();
|
|
171
206
|
const actuallyUpdated = (postUpdateVersion === latestVersion) && (postUpdateVersion !== currentVersion);
|
|
172
207
|
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
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}`);
|
|
176
210
|
} else {
|
|
177
211
|
log.info?.(`${ANSI.GREEN}[memos-cloud] Successfully updated to version ${latestVersion}. Please restart the gateway to apply changes.${ANSI.RESET}`);
|
|
178
212
|
}
|
package/lib/memos-cloud-api.js
CHANGED
|
@@ -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
|
-
|
|
449
|
+
const limit = maxLen || 10000;
|
|
450
|
+
return text.length > limit ? `${text.slice(0, limit)}...` : text;
|
|
449
451
|
}
|
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.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/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.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