n8n-nodes-smart-memory 1.0.99 → 1.1.1
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/SmartMemory.d.ts +26 -0
- package/dist/SmartMemory.d.ts.map +1 -1
- package/dist/SmartMemory.js +73 -36
- package/dist/SmartMemory.js.map +1 -1
- package/dist/SmartMemory.node.d.ts +7 -3
- package/dist/SmartMemory.node.d.ts.map +1 -1
- package/dist/SmartMemory.node.js +86 -178
- package/dist/SmartMemory.node.js.map +1 -1
- package/dist/interfaces/MemoryInterfaces.d.ts +38 -1
- package/dist/interfaces/MemoryInterfaces.d.ts.map +1 -1
- package/dist/storage/InMemoryStorage.d.ts +1 -1
- package/dist/storage/InMemoryStorage.d.ts.map +1 -1
- package/dist/storage/InMemoryStorage.js +14 -8
- package/dist/storage/InMemoryStorage.js.map +1 -1
- package/dist/storage/PostgresStorage.d.ts +28 -0
- package/dist/storage/PostgresStorage.d.ts.map +1 -1
- package/dist/storage/PostgresStorage.js +127 -102
- package/dist/storage/PostgresStorage.js.map +1 -1
- package/dist/storage/RedisStorage.d.ts +59 -0
- package/dist/storage/RedisStorage.d.ts.map +1 -1
- package/dist/storage/RedisStorage.js +124 -32
- package/dist/storage/RedisStorage.js.map +1 -1
- package/dist/storage/SqliteStorage.d.ts +43 -2
- package/dist/storage/SqliteStorage.d.ts.map +1 -1
- package/dist/storage/SqliteStorage.js +115 -108
- package/dist/storage/SqliteStorage.js.map +1 -1
- package/dist/utils/StorageFactory.d.ts +16 -0
- package/dist/utils/StorageFactory.d.ts.map +1 -0
- package/dist/utils/StorageFactory.js +105 -0
- package/dist/utils/StorageFactory.js.map +1 -0
- package/dist/utils/ValidationUtils.d.ts +15 -0
- package/dist/utils/ValidationUtils.d.ts.map +1 -1
- package/dist/utils/ValidationUtils.js +65 -0
- package/dist/utils/ValidationUtils.js.map +1 -1
- package/package.json +5 -2
package/dist/SmartMemory.d.ts
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import { CleanMemoryStructure, MemoryManagerConfig } from './interfaces/MemoryInterfaces';
|
|
2
2
|
import { MemoryStorage } from './storage/MemoryStorage';
|
|
3
|
+
/**
|
|
4
|
+
* Core class for managing chat memory. It handles message processing,
|
|
5
|
+
* memory creation, and interaction with the storage backend.
|
|
6
|
+
* This class is framework-agnostic.
|
|
7
|
+
*/
|
|
3
8
|
export declare class PureMemoryManager {
|
|
4
9
|
private config;
|
|
5
10
|
private storage;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of PureMemoryManager.
|
|
13
|
+
* @param config The memory manager configuration.
|
|
14
|
+
* @param storage (Optional) A storage backend instance. Defaults to `InMemoryStorage`.
|
|
15
|
+
*/
|
|
6
16
|
constructor(config: MemoryManagerConfig, storage?: MemoryStorage);
|
|
7
17
|
private validateConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Inserts a new message into the memory for a given chat.
|
|
20
|
+
* @param inputData The raw input data containing the message.
|
|
21
|
+
* @param insertMode The mode of insertion ('append' or 'replace').
|
|
22
|
+
* @returns The updated memory structure for the chat.
|
|
23
|
+
*/
|
|
8
24
|
insertMessage(inputData: Record<string, unknown>, insertMode: string): Promise<CleanMemoryStructure>;
|
|
9
25
|
private validateAndParseInput;
|
|
10
26
|
private isValidInputData;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves the memory for a specific chat.
|
|
29
|
+
* @param chatId The ID of the chat to retrieve memory for.
|
|
30
|
+
* @returns The memory structure for the chat, or `null` if not found.
|
|
31
|
+
*/
|
|
11
32
|
getMemory(chatId: string): Promise<CleanMemoryStructure | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Clears the memory for a specific chat or all chats.
|
|
35
|
+
* @param chatId (Optional) The ID of the chat to clear. If not provided, all memory will be cleared.
|
|
36
|
+
*/
|
|
12
37
|
clearMemory(chatId?: string): Promise<void>;
|
|
38
|
+
private getUserIdentity;
|
|
13
39
|
private createNewMemory;
|
|
14
40
|
private normalizeChatType;
|
|
15
41
|
private addMessageToMemory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartMemory.d.ts","sourceRoot":"","sources":["../src/SmartMemory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SmartMemory.d.ts","sourceRoot":"","sources":["../src/SmartMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAEpB,mBAAmB,EAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAKxD;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;OAIG;gBACS,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,aAAa;IAMhE,OAAO,CAAC,cAAc;IAStB;;;;;OAKG;IACG,aAAa,CACjB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,CAAC;IAgBhC,OAAO,CAAC,qBAAqB;IA+B7B,OAAO,CAAC,gBAAgB;IAUxB;;;;OAIG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAOrE;;;OAGG;IACG,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjD,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,eAAe;IAgCvB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,kBAAkB;IA0B1B,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,YAAY;IAwCpB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,gBAAgB;CAkDzB"}
|
package/dist/SmartMemory.js
CHANGED
|
@@ -2,23 +2,36 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PureMemoryManager = void 0;
|
|
4
4
|
const InMemoryStorage_1 = require("./storage/InMemoryStorage");
|
|
5
|
-
const ExpressionEvaluator_1 = require("./utils/ExpressionEvaluator");
|
|
6
5
|
const constants_1 = require("./constants");
|
|
7
6
|
const ValidationUtils_1 = require("./utils/ValidationUtils");
|
|
7
|
+
/**
|
|
8
|
+
* Core class for managing chat memory. It handles message processing,
|
|
9
|
+
* memory creation, and interaction with the storage backend.
|
|
10
|
+
* This class is framework-agnostic.
|
|
11
|
+
*/
|
|
8
12
|
class PureMemoryManager {
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of PureMemoryManager.
|
|
15
|
+
* @param config The memory manager configuration.
|
|
16
|
+
* @param storage (Optional) A storage backend instance. Defaults to `InMemoryStorage`.
|
|
17
|
+
*/
|
|
9
18
|
constructor(config, storage) {
|
|
10
19
|
this.validateConfig(config);
|
|
11
20
|
this.config = config;
|
|
12
21
|
this.storage = storage ?? new InMemoryStorage_1.InMemoryStorage();
|
|
13
22
|
}
|
|
14
23
|
validateConfig(config) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (!config.assistantRole || config.assistantRole.trim() === '') {
|
|
19
|
-
throw new Error('Assistant role is required');
|
|
24
|
+
const validationResult = ValidationUtils_1.ValidationUtils.validateConfig(config);
|
|
25
|
+
if (!validationResult.valid) {
|
|
26
|
+
throw new Error(`Invalid configuration: ${validationResult.error}`);
|
|
20
27
|
}
|
|
21
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Inserts a new message into the memory for a given chat.
|
|
31
|
+
* @param inputData The raw input data containing the message.
|
|
32
|
+
* @param insertMode The mode of insertion ('append' or 'replace').
|
|
33
|
+
* @returns The updated memory structure for the chat.
|
|
34
|
+
*/
|
|
22
35
|
async insertMessage(inputData, insertMode) {
|
|
23
36
|
const validatedInput = this.validateAndParseInput(inputData);
|
|
24
37
|
const chatId = validatedInput.message.chat.id;
|
|
@@ -40,14 +53,14 @@ class PureMemoryManager {
|
|
|
40
53
|
const chat = message.chat;
|
|
41
54
|
const chatId = chat?.id;
|
|
42
55
|
if (!ValidationUtils_1.ValidationUtils.isValidChatId(chatId)) {
|
|
43
|
-
throw new Error(
|
|
56
|
+
throw new Error(`Invalid or missing chat ID: ${chatId}`);
|
|
44
57
|
}
|
|
45
58
|
const messageContent = message.text ??
|
|
46
59
|
message.caption ??
|
|
47
60
|
inputData.bot_response ??
|
|
48
61
|
'';
|
|
49
62
|
if (!ValidationUtils_1.ValidationUtils.isValidMessage(messageContent)) {
|
|
50
|
-
throw new Error(
|
|
63
|
+
throw new Error(`Invalid or empty message content: "${messageContent}"`);
|
|
51
64
|
}
|
|
52
65
|
// Type guard: if we've validated the structure, we can safely cast
|
|
53
66
|
if (!this.isValidInputData(inputData)) {
|
|
@@ -62,43 +75,64 @@ class PureMemoryManager {
|
|
|
62
75
|
const chat = message.chat;
|
|
63
76
|
return chat !== undefined && chat.id !== undefined;
|
|
64
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Retrieves the memory for a specific chat.
|
|
80
|
+
* @param chatId The ID of the chat to retrieve memory for.
|
|
81
|
+
* @returns The memory structure for the chat, or `null` if not found.
|
|
82
|
+
*/
|
|
65
83
|
async getMemory(chatId) {
|
|
66
84
|
if (!ValidationUtils_1.ValidationUtils.isValidChatId(chatId)) {
|
|
67
85
|
throw new Error('Invalid chat ID');
|
|
68
86
|
}
|
|
69
87
|
return this.storage.getMemory(chatId);
|
|
70
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Clears the memory for a specific chat or all chats.
|
|
91
|
+
* @param chatId (Optional) The ID of the chat to clear. If not provided, all memory will be cleared.
|
|
92
|
+
*/
|
|
71
93
|
async clearMemory(chatId) {
|
|
72
94
|
if (chatId && !ValidationUtils_1.ValidationUtils.isValidChatId(chatId)) {
|
|
73
95
|
throw new Error('Invalid chat ID');
|
|
74
96
|
}
|
|
75
97
|
await this.storage.clearMemory(chatId);
|
|
76
98
|
}
|
|
99
|
+
getUserIdentity(message) {
|
|
100
|
+
const from = message.from;
|
|
101
|
+
if (!from)
|
|
102
|
+
return {};
|
|
103
|
+
const displayNameField = this.config.identityFieldMapping.displayName;
|
|
104
|
+
const usernameField = this.config.identityFieldMapping.username;
|
|
105
|
+
const displayName = from[displayNameField];
|
|
106
|
+
const username = usernameField
|
|
107
|
+
? from[usernameField]
|
|
108
|
+
: undefined;
|
|
109
|
+
const identity = {};
|
|
110
|
+
if (displayName)
|
|
111
|
+
identity.displayName = displayName.trim();
|
|
112
|
+
if (username)
|
|
113
|
+
identity.username = username.trim();
|
|
114
|
+
return identity;
|
|
115
|
+
}
|
|
77
116
|
createNewMemory(inputData) {
|
|
78
117
|
const { message } = inputData;
|
|
79
118
|
const { chat, from } = message;
|
|
80
119
|
const isBotResponse = !!inputData.bot_response;
|
|
81
120
|
const chatInfo = {
|
|
82
|
-
id: chat.id,
|
|
121
|
+
id: String(chat.id),
|
|
83
122
|
type: this.normalizeChatType(chat.type),
|
|
84
123
|
};
|
|
85
|
-
// For group chats, set chat name
|
|
86
124
|
if (chat.type !== 'private') {
|
|
87
125
|
if (chat.title) {
|
|
88
126
|
chatInfo.name = chat.title;
|
|
89
127
|
}
|
|
90
128
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
? ExpressionEvaluator_1.ExpressionEvaluator.evaluateExpression({ message: inputData.message }, this.config.identityFieldMapping.username)
|
|
96
|
-
: undefined;
|
|
97
|
-
if (displayName) {
|
|
98
|
-
chatInfo.displayName = displayName;
|
|
129
|
+
else if (from && !isBotResponse) {
|
|
130
|
+
const identity = this.getUserIdentity(message);
|
|
131
|
+
if (identity.displayName) {
|
|
132
|
+
chatInfo.displayName = identity.displayName;
|
|
99
133
|
}
|
|
100
|
-
if (username) {
|
|
101
|
-
chatInfo.username = username;
|
|
134
|
+
if (identity.username) {
|
|
135
|
+
chatInfo.username = identity.username;
|
|
102
136
|
}
|
|
103
137
|
}
|
|
104
138
|
const memory = {
|
|
@@ -132,7 +166,7 @@ class PureMemoryManager {
|
|
|
132
166
|
if (existingMessages.length < limit) {
|
|
133
167
|
return [...existingMessages, newMessage];
|
|
134
168
|
}
|
|
135
|
-
// When at capacity, create
|
|
169
|
+
// When at capacity, create new window by dropping oldest message
|
|
136
170
|
// More efficient than slice + push for large arrays
|
|
137
171
|
const startIndex = existingMessages.length - limit + 1;
|
|
138
172
|
return [...existingMessages.slice(startIndex), newMessage];
|
|
@@ -168,16 +202,13 @@ class PureMemoryManager {
|
|
|
168
202
|
extractUserInfo(message) {
|
|
169
203
|
if (!message.from)
|
|
170
204
|
return undefined;
|
|
171
|
-
const
|
|
172
|
-
if (!displayName)
|
|
205
|
+
const identity = this.getUserIdentity(message);
|
|
206
|
+
if (!identity.displayName)
|
|
173
207
|
return undefined;
|
|
174
|
-
const username = this.config.identityFieldMapping.username
|
|
175
|
-
? ExpressionEvaluator_1.ExpressionEvaluator.evaluateExpression({ message }, this.config.identityFieldMapping.username)
|
|
176
|
-
: undefined;
|
|
177
208
|
return {
|
|
178
209
|
id: message.from.id,
|
|
179
|
-
displayName,
|
|
180
|
-
...(username && { username }),
|
|
210
|
+
displayName: identity.displayName,
|
|
211
|
+
...(identity.username && { username: identity.username }),
|
|
181
212
|
};
|
|
182
213
|
}
|
|
183
214
|
extractReplyInfo(replyToMessage) {
|
|
@@ -189,21 +220,27 @@ class PureMemoryManager {
|
|
|
189
220
|
const replyInfo = {};
|
|
190
221
|
if (replyUser) {
|
|
191
222
|
if (this.config.includeReplyDisplayName) {
|
|
192
|
-
const
|
|
223
|
+
const from = replyUser;
|
|
224
|
+
const displayNameField = this.config.identityFieldMapping.displayName;
|
|
225
|
+
const usernameField = this.config.identityFieldMapping.username;
|
|
226
|
+
const displayName = from?.[displayNameField];
|
|
227
|
+
const username = usernameField
|
|
228
|
+
? from?.[usernameField]
|
|
229
|
+
: undefined;
|
|
193
230
|
if (displayName) {
|
|
194
|
-
replyInfo.displayName = displayName;
|
|
231
|
+
replyInfo.displayName = displayName.trim();
|
|
195
232
|
}
|
|
196
|
-
}
|
|
197
|
-
if (this.config.includeReplyUsername && this.config.identityFieldMapping.username) {
|
|
198
|
-
const username = ExpressionEvaluator_1.ExpressionEvaluator.evaluateExpression({ message: { from: replyUser } }, this.config.identityFieldMapping.username);
|
|
199
233
|
if (username) {
|
|
200
|
-
replyInfo.username = username;
|
|
234
|
+
replyInfo.username = username.trim();
|
|
201
235
|
}
|
|
202
236
|
}
|
|
203
237
|
}
|
|
204
238
|
if (this.config.includeReplyMessage) {
|
|
205
|
-
const
|
|
206
|
-
|
|
239
|
+
const quote = reply.quote;
|
|
240
|
+
const quoteText = quote?.text;
|
|
241
|
+
const message = (this.config.prioritizeQuoteText && quoteText) ||
|
|
242
|
+
reply.text ||
|
|
243
|
+
reply.caption ||
|
|
207
244
|
constants_1.MEDIA_PLACEHOLDER;
|
|
208
245
|
if (message && message.trim() !== '') {
|
|
209
246
|
replyInfo.message = message;
|
package/dist/SmartMemory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartMemory.js","sourceRoot":"","sources":["../src/SmartMemory.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SmartMemory.js","sourceRoot":"","sources":["../src/SmartMemory.ts"],"names":[],"mappings":";;;AAOA,+DAA4D;AAC5D,2CAAgD;AAChD,6DAA0D;AAE1D;;;;GAIG;AACH,MAAa,iBAAiB;IAI5B;;;;OAIG;IACH,YAAY,MAA2B,EAAE,OAAuB;QAC9D,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,IAAI,iCAAe,EAAE,CAAC;IAClD,CAAC;IAEO,cAAc,CAAC,MAA2B;QAGhD,MAAM,gBAAgB,GAAG,iCAAe,CAAC,cAAc,CAAC,MAA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OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;CACF;AA9TD,8CA8TC"}
|
|
@@ -3,13 +3,17 @@ import { CleanMemoryStructure } from './interfaces/MemoryInterfaces';
|
|
|
3
3
|
export declare class SmartMemory implements INodeType {
|
|
4
4
|
description: INodeTypeDescription;
|
|
5
5
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
6
|
-
private static
|
|
6
|
+
private static _executeInsert;
|
|
7
|
+
private static _executeGet;
|
|
8
|
+
private static _executeClear;
|
|
9
|
+
private static _getOperationAndSession;
|
|
10
|
+
private static _getStorageConfig;
|
|
11
|
+
private static _getMemoryConfig;
|
|
12
|
+
private static _getInsertConfig;
|
|
7
13
|
private static _initializeStorage;
|
|
8
14
|
private static _handleInsertOperation;
|
|
9
15
|
private static _handleGetOperation;
|
|
10
|
-
private static _handleClearOperation;
|
|
11
16
|
private static _cleanupConnections;
|
|
12
|
-
private static createStorage;
|
|
13
17
|
private static buildConfig;
|
|
14
18
|
private static buildInputData;
|
|
15
19
|
private static buildMemoryOutput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartMemory.node.d.ts","sourceRoot":"","sources":["../src/SmartMemory.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"SmartMemory.node.d.ts","sourceRoot":"","sources":["../src/SmartMemory.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EAAE,oBAAoB,EAAuB,MAAM,+BAA+B,CAAC;AAK1F,qBAAa,WAAY,YAAW,SAAS;IAC3C,WAAW,EAAE,oBAAoB,CAqZ/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;mBAwClD,cAAc;mBAad,WAAW;mBAYX,aAAa;IAelC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAWtC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAMhC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAgB/B,OAAO,CAAC,MAAM,CAAC,gBAAgB;mBA+CV,kBAAkB;mBAgBlB,sBAAsB;mBA0BtB,mBAAmB;mBAclB,mBAAmB;IAkBzC,OAAO,CAAC,MAAM,CAAC,WAAW;IAiC1B,OAAO,CAAC,MAAM,CAAC,cAAc;IAsF7B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAuBhC,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM;CAIhE"}
|