@remnic/plugin-openclaw 9.62.1 → 9.63.0
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/dist/index.js +1 -20
- package/openclaw.plugin.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3190,6 +3190,7 @@ import {
|
|
|
3190
3190
|
} from "@remnic/core/migrate/from-engram";
|
|
3191
3191
|
|
|
3192
3192
|
// ../../src/user-message-cleaning.ts
|
|
3193
|
+
import { cleanUserMessageWithPattern } from "@remnic/core/user-message-cleaning";
|
|
3193
3194
|
var DEFAULT_CHANNEL_ENVELOPE_PREFIXES = ["OpenClaw"];
|
|
3194
3195
|
function createOpenClawUserMessageCleaner(prefixes, options = {}) {
|
|
3195
3196
|
const normalized = normalizeOpenClawChannelEnvelopePrefixes(prefixes);
|
|
@@ -3200,26 +3201,6 @@ function createOpenClawUserMessageCleaner(prefixes, options = {}) {
|
|
|
3200
3201
|
);
|
|
3201
3202
|
return (content) => cleanUserMessageWithPattern(content, platformHeaderPattern);
|
|
3202
3203
|
}
|
|
3203
|
-
function cleanUserMessageWithPattern(content, platformHeaderPattern) {
|
|
3204
|
-
let cleaned = content;
|
|
3205
|
-
cleaned = cleaned.replace(
|
|
3206
|
-
/<supermemory-context[^>]*>[\s\S]*?<\/supermemory-context>\s*/gi,
|
|
3207
|
-
""
|
|
3208
|
-
);
|
|
3209
|
-
const platformHeader = cleaned.match(platformHeaderPattern);
|
|
3210
|
-
const hasPlatformHeader = platformHeader !== null;
|
|
3211
|
-
if (platformHeader) {
|
|
3212
|
-
cleaned = cleaned.slice(platformHeader[0].length);
|
|
3213
|
-
}
|
|
3214
|
-
cleaned = cleaned.replace(
|
|
3215
|
-
/^\s*## Memory Context \((?:Engram|Remnic)\)[\s\S]*?(?=\n## |\n$)/i,
|
|
3216
|
-
""
|
|
3217
|
-
);
|
|
3218
|
-
if (hasPlatformHeader) {
|
|
3219
|
-
cleaned = cleaned.replace(/\s*\[message_id:\s*[^\]]+\]\s*$/i, "");
|
|
3220
|
-
}
|
|
3221
|
-
return cleaned.trim();
|
|
3222
|
-
}
|
|
3223
3204
|
function normalizeOpenClawChannelEnvelopePrefixes(prefixes) {
|
|
3224
3205
|
const cleaned = prefixes.map((prefix) => typeof prefix === "string" ? prefix.trim() : "").filter((prefix) => prefix.length > 0);
|
|
3225
3206
|
return cleaned.length > 0 ? cleaned : [...DEFAULT_CHANNEL_ENVELOPE_PREFIXES];
|