@t0ken.ai/memoryx-openclaw-plugin 1.1.5 → 1.1.7
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.d.ts +2 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -16
- package/package.json +2 -6
package/dist/index.d.ts
CHANGED
|
@@ -31,34 +31,28 @@ interface RecallResult {
|
|
|
31
31
|
}
|
|
32
32
|
declare class ConversationBuffer {
|
|
33
33
|
private messages;
|
|
34
|
-
private tokenCount;
|
|
35
34
|
private roundCount;
|
|
36
35
|
private lastRole;
|
|
37
36
|
private conversationId;
|
|
38
37
|
private startedAt;
|
|
39
38
|
private lastActivityAt;
|
|
40
|
-
private encoder;
|
|
41
39
|
private readonly ROUND_THRESHOLD;
|
|
42
40
|
private readonly TIMEOUT_MS;
|
|
43
|
-
private readonly
|
|
41
|
+
private readonly MAX_CHARS_PER_MESSAGE;
|
|
44
42
|
constructor();
|
|
45
43
|
private generateId;
|
|
46
|
-
private countTokens;
|
|
47
44
|
addMessage(role: string, content: string): boolean;
|
|
48
45
|
shouldFlush(): boolean;
|
|
49
46
|
flush(): {
|
|
50
47
|
conversation_id: string;
|
|
51
48
|
messages: Message[];
|
|
52
|
-
total_tokens: number;
|
|
53
49
|
};
|
|
54
50
|
forceFlush(): {
|
|
55
51
|
conversation_id: string;
|
|
56
52
|
messages: Message[];
|
|
57
|
-
total_tokens: number;
|
|
58
53
|
} | null;
|
|
59
54
|
getStatus(): {
|
|
60
55
|
messageCount: number;
|
|
61
|
-
tokenCount: number;
|
|
62
56
|
conversationId: string;
|
|
63
57
|
};
|
|
64
58
|
}
|
|
@@ -84,7 +78,7 @@ declare class MemoryXPlugin {
|
|
|
84
78
|
hasApiKey: boolean;
|
|
85
79
|
bufferStatus: {
|
|
86
80
|
messageCount: number;
|
|
87
|
-
|
|
81
|
+
conversationId: string;
|
|
88
82
|
};
|
|
89
83
|
};
|
|
90
84
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqCH,UAAU,YAAY;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAUD,UAAU,OAAO;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC;QACZ,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AA6ED,cAAM,kBAAkB;IACpB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,cAAc,CAAsB;IAE5C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAK;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;IAC7C,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;;IAM/C,OAAO,CAAC,UAAU;IAIlB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IA2BlD,WAAW,IAAI,OAAO;IAiBtB,KAAK,IAAI;QAAE,eAAe,EA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base URL
|
|
10
10
|
* - Precise token counting with tiktoken
|
|
11
11
|
*/
|
|
12
|
-
import { getEncoding } from "js-tiktoken";
|
|
13
12
|
import * as fs from "fs";
|
|
14
13
|
import * as path from "path";
|
|
15
14
|
import * as os from "os";
|
|
@@ -110,42 +109,34 @@ class SQLiteStorage {
|
|
|
110
109
|
}
|
|
111
110
|
class ConversationBuffer {
|
|
112
111
|
messages = [];
|
|
113
|
-
tokenCount = 0;
|
|
114
112
|
roundCount = 0;
|
|
115
113
|
lastRole = "";
|
|
116
114
|
conversationId = "";
|
|
117
115
|
startedAt = Date.now();
|
|
118
116
|
lastActivityAt = Date.now();
|
|
119
|
-
encoder;
|
|
120
117
|
ROUND_THRESHOLD = 2;
|
|
121
118
|
TIMEOUT_MS = 30 * 60 * 1000;
|
|
122
|
-
|
|
119
|
+
MAX_CHARS_PER_MESSAGE = 32000;
|
|
123
120
|
constructor() {
|
|
124
121
|
this.conversationId = this.generateId();
|
|
125
|
-
this.encoder = getEncoding("cl100k_base");
|
|
126
122
|
}
|
|
127
123
|
generateId() {
|
|
128
124
|
return `conv_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
129
125
|
}
|
|
130
|
-
countTokens(text) {
|
|
131
|
-
return this.encoder.encode(text).length;
|
|
132
|
-
}
|
|
133
126
|
addMessage(role, content) {
|
|
134
127
|
if (!content || content.length < 2) {
|
|
135
128
|
return false;
|
|
136
129
|
}
|
|
137
|
-
|
|
138
|
-
if (tokens > this.MAX_TOKENS_PER_MESSAGE) {
|
|
130
|
+
if (content.length > this.MAX_CHARS_PER_MESSAGE) {
|
|
139
131
|
return false;
|
|
140
132
|
}
|
|
141
133
|
const message = {
|
|
142
134
|
role,
|
|
143
135
|
content,
|
|
144
|
-
tokens,
|
|
136
|
+
tokens: 0,
|
|
145
137
|
timestamp: Date.now()
|
|
146
138
|
};
|
|
147
139
|
this.messages.push(message);
|
|
148
|
-
this.tokenCount += tokens;
|
|
149
140
|
this.lastActivityAt = Date.now();
|
|
150
141
|
if (role === "assistant" && this.lastRole === "user") {
|
|
151
142
|
this.roundCount++;
|
|
@@ -169,11 +160,9 @@ class ConversationBuffer {
|
|
|
169
160
|
flush() {
|
|
170
161
|
const data = {
|
|
171
162
|
conversation_id: this.conversationId,
|
|
172
|
-
messages: [...this.messages]
|
|
173
|
-
total_tokens: this.tokenCount
|
|
163
|
+
messages: [...this.messages]
|
|
174
164
|
};
|
|
175
165
|
this.messages = [];
|
|
176
|
-
this.tokenCount = 0;
|
|
177
166
|
this.roundCount = 0;
|
|
178
167
|
this.lastRole = "";
|
|
179
168
|
this.conversationId = this.generateId();
|
|
@@ -190,7 +179,6 @@ class ConversationBuffer {
|
|
|
190
179
|
getStatus() {
|
|
191
180
|
return {
|
|
192
181
|
messageCount: this.messages.length,
|
|
193
|
-
tokenCount: this.tokenCount,
|
|
194
182
|
conversationId: this.conversationId
|
|
195
183
|
};
|
|
196
184
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t0ken.ai/memoryx-openclaw-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "MemoryX real-time memory capture and recall plugin for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MemoryX Team",
|
|
@@ -36,10 +36,6 @@
|
|
|
36
36
|
"typescript": "^5.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"
|
|
40
|
-
"better-sqlite3": "^11.0.0",
|
|
41
|
-
"js-tiktoken": "^1.0.21",
|
|
42
|
-
"onnxruntime-node": "^1.24.1",
|
|
43
|
-
"onnxruntime-web": "^1.24.1"
|
|
39
|
+
"better-sqlite3": "^11.0.0"
|
|
44
40
|
}
|
|
45
41
|
}
|