@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.
- package/clawdbot.plugin.json +1 -1
- package/index.js +8 -2
- package/moltbot.plugin.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/test/direct-session-user-id.test.mjs +31 -0
package/clawdbot.plugin.json
CHANGED
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 =
|
|
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:
|
|
194
|
+
source: MEMOS_SOURCE,
|
|
189
195
|
sessionKey: ctx?.sessionKey,
|
|
190
196
|
agentId: ctx?.agentId,
|
|
191
197
|
...(cfg.info || {}),
|
package/moltbot.plugin.json
CHANGED
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -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
|
+
});
|