@t0ken.ai/memoryx-openclaw-plugin 2.0.0 → 2.2.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/README.md +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -12
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -124,12 +124,14 @@ openclaw gateway restart
|
|
|
124
124
|
|
|
125
125
|
## How it Works
|
|
126
126
|
|
|
127
|
+
Powered by **@t0ken.ai/memoryx-sdk** with conversation preset.
|
|
128
|
+
|
|
127
129
|
### Recall (`before_agent_start`)
|
|
128
130
|
|
|
129
131
|
- Builds a `/v1/memories/search` request using the current prompt
|
|
130
132
|
- Injects relevant memories via `prependContext`:
|
|
131
133
|
```
|
|
132
|
-
[
|
|
134
|
+
[Relevant Memories]
|
|
133
135
|
- [preference] User prefers dark mode
|
|
134
136
|
- [fact] User's timezone is UTC+8
|
|
135
137
|
[End of memories]
|
|
@@ -137,10 +139,10 @@ openclaw gateway restart
|
|
|
137
139
|
|
|
138
140
|
### Add (`message_received` + `assistant_response`)
|
|
139
141
|
|
|
140
|
-
- Buffers messages with precise token counting
|
|
142
|
+
- Buffers messages with precise token counting
|
|
141
143
|
- Flushes to `/v1/conversations/flush` when:
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
+
- 30k tokens reached
|
|
145
|
+
- 5 minutes idle timeout
|
|
144
146
|
- Server extracts entities, facts, and preferences automatically
|
|
145
147
|
|
|
146
148
|
### Auto Registration
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAkCH,UAAU,YAAY;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,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114
114
|
try {
|
|
115
115
|
const sdk = await getSDK(this.pluginConfig);
|
|
116
|
-
|
|
117
|
-
await sdk.addUserMessage(content);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
await sdk.addAssistantMessage(content);
|
|
121
|
-
}
|
|
116
|
+
await sdk.addMessage(role, content);
|
|
122
117
|
return true;
|
|
123
118
|
}
|
|
124
119
|
catch (e) {
|
|
@@ -156,8 +151,10 @@ class MemoryXPlugin {
|
|
|
156
151
|
async endConversation() {
|
|
157
152
|
try {
|
|
158
153
|
const sdk = await getSDK(this.pluginConfig);
|
|
154
|
+
// Flush immediately before starting new conversation
|
|
155
|
+
await sdk.flush();
|
|
156
|
+
log("Conversation ended, flushed queue");
|
|
159
157
|
sdk.startNewConversation();
|
|
160
|
-
log("Conversation ended, starting new conversation");
|
|
161
158
|
}
|
|
162
159
|
catch (e) {
|
|
163
160
|
log(`End conversation failed: ${e}`);
|
|
@@ -228,12 +225,11 @@ class MemoryXPlugin {
|
|
|
228
225
|
await this.init();
|
|
229
226
|
try {
|
|
230
227
|
const sdk = await getSDK(this.pluginConfig);
|
|
231
|
-
const info = await sdk.getAccountInfo();
|
|
232
228
|
return {
|
|
233
|
-
apiKey:
|
|
234
|
-
projectId:
|
|
235
|
-
userId:
|
|
236
|
-
apiBaseUrl:
|
|
229
|
+
apiKey: sdk.getApiKey(),
|
|
230
|
+
projectId: sdk.getProjectId(),
|
|
231
|
+
userId: sdk.getUserId(),
|
|
232
|
+
apiBaseUrl: this.pluginConfig?.apiBaseUrl || DEFAULT_API_BASE,
|
|
237
233
|
initialized: true
|
|
238
234
|
};
|
|
239
235
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t0ken.ai/memoryx-openclaw-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "MemoryX real-time memory capture and recall plugin for OpenClaw (powered by @t0ken.ai/memoryx-sdk)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MemoryX Team",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "tsc"
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"postinstall": "npm rebuild better-sqlite3 || echo 'better-sqlite3 rebuild skipped'"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"openclaw",
|
|
@@ -34,10 +35,8 @@
|
|
|
34
35
|
"@types/node": "^20.0.0",
|
|
35
36
|
"typescript": "^5.0.0"
|
|
36
37
|
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"better-sqlite3": "^11.0.0"
|
|
39
|
-
},
|
|
40
38
|
"dependencies": {
|
|
41
|
-
"@t0ken.ai/memoryx-sdk": "^1.
|
|
39
|
+
"@t0ken.ai/memoryx-sdk": "^1.1.0",
|
|
40
|
+
"better-sqlite3": "^11.0.0"
|
|
42
41
|
}
|
|
43
42
|
}
|