@memtensor/memos-cloud-openclaw-plugin 0.1.10-beta.1 → 0.1.10-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.
@@ -350,13 +350,17 @@ function stripLeadingTimestampEnvelope(text) {
350
350
 
351
351
  function stripFeishuInjectedPrompt(text) {
352
352
  if (!text || typeof text !== "string") return text;
353
- // Check for the Feishu System header
354
- if (!/^System: \[.*?\] Feishu\[.*?\]/.test(text)) {
353
+ const hasFeishuSystemHeader = /^System: \[.*?\] Feishu\[.*?\]/.test(text);
354
+ const hasLeadingMessageIdAndSender =
355
+ /^\s*\[message_id: [^\]]+\]\s*(?:\r?\n\s*)?ou_[a-z0-9_-]+:\s*/i.test(text);
356
+ // Keep legacy Feishu header path and support newer payloads that directly start with
357
+ // "[message_id] + ou_xxx:".
358
+ if (!hasFeishuSystemHeader && !hasLeadingMessageIdAndSender) {
355
359
  return text;
356
360
  }
357
361
  // Remove only the first injected Feishu prompt prefix.
358
362
  // Any later "[message_id] ou_xxx:" pattern should be treated as user query content.
359
- const leadingInjectedPattern = /^[\s\S]*?\[message_id: [^\]]+\]\s+ou_[a-z0-9]+:\s*/;
363
+ const leadingInjectedPattern = /^[\s\S]*?\[message_id: [^\]]+\]\s*(?:\r?\n\s*)?ou_[a-z0-9_-]+:\s*/i;
360
364
  if (leadingInjectedPattern.test(text)) {
361
365
  return text.replace(leadingInjectedPattern, "").trim();
362
366
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memtensor/memos-cloud-openclaw-plugin",
3
- "version": "0.1.10-beta.1",
3
+ "version": "0.1.10-beta.3",
4
4
  "description": "OpenClaw lifecycle plugin for MemOS Cloud (add + recall memory)",
5
5
  "scripts": {
6
6
  "sync-version": "node scripts/sync-version.js",
@@ -135,9 +135,18 @@ ou_real: actual message`;
135
135
  );
136
136
  });
137
137
 
138
- test("ignores text that looks like Feishu prompt but missing header", () => {
138
+ test("strips Feishu prompt without system header", () => {
139
139
  const input = `
140
140
  [message_id: om_x100b54bb510590dcc2998da17ca2c2b]
141
141
  ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字 `;
142
- assert.equal(stripOpenClawInjectedPrefix(input), input.trimStart());
142
+ assert.equal(stripOpenClawInjectedPrefix(input), "我叫什么名字");
143
+ });
144
+
145
+ test("keeps content when [message_id] block is not leading and no Feishu header", () => {
146
+ const input = [
147
+ "hello",
148
+ "[message_id: om_x100b54bb510590dcc2998da17ca2c2b]",
149
+ "ou_37e8a1514c24e8afd9cfeca86f679980: 我叫什么名字",
150
+ ].join("\n");
151
+ assert.equal(stripOpenClawInjectedPrefix(input), input);
143
152
  });