@memtensor/memos-cloud-openclaw-plugin 0.1.16 → 0.1.17

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.16",
5
+ "version": "0.1.17",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "activation": {
package/index.js CHANGED
@@ -25,7 +25,13 @@ let lastCaptureTime = 0;
25
25
  const conversationCounters = new Map();
26
26
  const API_KEY_HELP_URL = "https://memos-dashboard.openmem.net/cn/apikeys/";
27
27
  const ENV_FILE_SEARCH_HINTS = ["~/.openclaw/.env", "~/.moltbot/.env", "~/.clawdbot/.env"];
28
- const MEMOS_SOURCE = "openclaw";
28
+ const MEMOS_SOURCE = (() => {
29
+ const platform = process.platform;
30
+ if (platform === "win32") return "openclaw_win";
31
+ if (platform === "darwin") return "openclaw_mac";
32
+ if (platform === "linux") return "openclaw_linux";
33
+ return "openclaw";
34
+ })();
29
35
 
30
36
  // Heartbeat prompts are always injected at the very beginning of the user
31
37
  // content by the host (OpenClaw). Anchoring at start prevents false positives
@@ -185,7 +191,7 @@ export function buildAddMessagePayload(cfg, messages, ctx) {
185
191
  if (cfg.tags?.length) payload.tags = cfg.tags;
186
192
 
187
193
  const info = {
188
- source: "openclaw",
194
+ source: MEMOS_SOURCE,
189
195
  sessionKey: ctx?.sessionKey,
190
196
  agentId: ctx?.agentId,
191
197
  ...(cfg.info || {}),
@@ -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.16",
5
+ "version": "0.1.17",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "activation": {
@@ -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.16",
5
+ "version": "0.1.17",
6
6
  "kind": "lifecycle",
7
7
  "main": "./index.js",
8
8
  "activation": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memtensor/memos-cloud-openclaw-plugin",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "OpenClaw lifecycle plugin for MemOS Cloud (add + recall memory)",
5
5
  "scripts": {
6
6
  "sync-version": "node scripts/sync-version.js",
@@ -92,3 +92,34 @@ test("buildAddMessagePayload keeps configured userId for non-direct chats", () =
92
92
  const payload = buildAddMessagePayload(cfg, [{ role: "user", content: "hi" }], ctx);
93
93
  assert.equal(payload.user_id, "openclaw-user");
94
94
  });
95
+
96
+ test("MEMOS_SOURCE is correctly appended with platform suffix", () => {
97
+ const expectedSource = (() => {
98
+ const platform = process.platform;
99
+ if (platform === "win32") return "openclaw_win";
100
+ if (platform === "darwin") return "openclaw_mac";
101
+ if (platform === "linux") return "openclaw_linux";
102
+ return "openclaw";
103
+ })();
104
+ const cfg = {
105
+ userId: "openclaw-user",
106
+ useDirectSessionUserId: false,
107
+ queryPrefix: "",
108
+ maxQueryChars: 0,
109
+ recallGlobal: true,
110
+ knowledgebaseIds: [],
111
+ memoryLimitNumber: 6,
112
+ includePreference: true,
113
+ preferenceLimitNumber: 6,
114
+ includeToolMemory: false,
115
+ toolMemoryLimitNumber: 0,
116
+ relativity: 0.45,
117
+ multiAgentMode: false,
118
+ };
119
+ const ctx = {};
120
+ const searchPayload = buildSearchPayload(cfg, "query", ctx);
121
+ assert.equal(searchPayload.source, expectedSource);
122
+
123
+ const addPayload = buildAddMessagePayload(cfg, [], ctx);
124
+ assert.equal(addPayload.source, expectedSource);
125
+ });