n8n-nodes-tembory 1.1.36 → 1.1.37
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 +7 -1
- package/dist/nodes/Tembory/TemboryMemory.node.js +33 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Node de memoria operacional da Tembory para agentes de IA no n8n.
|
|
4
4
|
|
|
5
|
-
Versao atual: `1.1.
|
|
5
|
+
Versao atual: `1.1.37`.
|
|
6
|
+
|
|
7
|
+
## 1.1.37
|
|
8
|
+
|
|
9
|
+
- Normaliza `chatHistory` legado para `chat_history` no modo simples, evitando que historico bruto vaze no output final do Agent.
|
|
10
|
+
- Mantem `chatHistory` apenas como alias nao enumeravel no contrato interno de memoria.
|
|
11
|
+
- O caminho de execucao normal do node passa a retornar resumo visual compacto, nao o array bruto de mensagens.
|
|
6
12
|
|
|
7
13
|
## 1.1.36
|
|
8
14
|
|
|
@@ -10,6 +10,21 @@ try {
|
|
|
10
10
|
catch { }
|
|
11
11
|
const MAX_TEXT = 12000;
|
|
12
12
|
const DEFAULT_MEMORY_KEY = 'chat_history';
|
|
13
|
+
const resolveRuntimeMemoryKey = (ctx, itemIndex = 0) => {
|
|
14
|
+
let configurationMode = 'simple';
|
|
15
|
+
try {
|
|
16
|
+
configurationMode = String(ctx.getNodeParameter('configurationMode', itemIndex, 'simple') || 'simple');
|
|
17
|
+
}
|
|
18
|
+
catch { }
|
|
19
|
+
if (configurationMode !== 'advanced')
|
|
20
|
+
return DEFAULT_MEMORY_KEY;
|
|
21
|
+
let key = DEFAULT_MEMORY_KEY;
|
|
22
|
+
try {
|
|
23
|
+
key = String(ctx.getNodeParameter('memoryKey', itemIndex, DEFAULT_MEMORY_KEY) || DEFAULT_MEMORY_KEY);
|
|
24
|
+
}
|
|
25
|
+
catch { }
|
|
26
|
+
return key === 'chatHistory' ? DEFAULT_MEMORY_KEY : key;
|
|
27
|
+
};
|
|
13
28
|
const nowIso = () => new Date().toISOString();
|
|
14
29
|
const safeStringify = (value) => {
|
|
15
30
|
try {
|
|
@@ -3812,7 +3827,7 @@ class TemboryMemory {
|
|
|
3812
3827
|
// For AI connections, n8n reads from supplyData. The AI Agent expects a
|
|
3813
3828
|
// memory-like object, not raw JSON, so expose the LangChain memory contract.
|
|
3814
3829
|
async supplyData(itemIndex) {
|
|
3815
|
-
const memoryKey = this
|
|
3830
|
+
const memoryKey = resolveRuntimeMemoryKey(this, itemIndex);
|
|
3816
3831
|
let currentMessages = [];
|
|
3817
3832
|
const loadCache = new Map();
|
|
3818
3833
|
const recordMemoryEvent = (action, payload = {}, error) => {
|
|
@@ -4436,7 +4451,7 @@ class TemboryMemory {
|
|
|
4436
4451
|
}
|
|
4437
4452
|
async loadMemoryVariablesForItem(itemIndex, inputValues = {}) {
|
|
4438
4453
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4439
|
-
const memoryKey = this
|
|
4454
|
+
const memoryKey = resolveRuntimeMemoryKey(this, itemIndex);
|
|
4440
4455
|
const requestedRetrievalMode = this.getNodeParameter('retrievalMode', itemIndex, 'basic');
|
|
4441
4456
|
let payloadFormat = this.getNodeParameter('payloadFormat', itemIndex, 'structured');
|
|
4442
4457
|
const threadId = this.getNodeParameter('threadId', itemIndex);
|
|
@@ -5066,20 +5081,20 @@ class TemboryMemory {
|
|
|
5066
5081
|
diagnostics,
|
|
5067
5082
|
dedupeSummary: diagnostics.dedupeSummary,
|
|
5068
5083
|
};
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
};
|
|
5084
|
+
const response = { [memoryKey]: payload, chat_history: payload };
|
|
5085
|
+
Object.defineProperty(response, 'chatHistory', {
|
|
5086
|
+
value: payload,
|
|
5087
|
+
enumerable: false,
|
|
5088
|
+
configurable: true,
|
|
5089
|
+
});
|
|
5090
|
+
return { response };
|
|
5076
5091
|
}
|
|
5077
5092
|
async execute() {
|
|
5078
5093
|
const items = this.getInputData();
|
|
5079
5094
|
const returnData = [];
|
|
5080
5095
|
const count = Math.max(items.length, 1);
|
|
5081
5096
|
for (let i = 0; i < count; i++) {
|
|
5082
|
-
const memoryKey = this
|
|
5097
|
+
const memoryKey = resolveRuntimeMemoryKey(this, i);
|
|
5083
5098
|
const requestedRetrievalMode = this.getNodeParameter('retrievalMode', i, 'basic');
|
|
5084
5099
|
const threadId = this.getNodeParameter('threadId', i);
|
|
5085
5100
|
const project = this.getNodeParameter('project', i, '');
|
|
@@ -5142,10 +5157,14 @@ class TemboryMemory {
|
|
|
5142
5157
|
payload = memories.map((m) => { var _a, _b; return ({ role: 'system', content: (_b = (_a = m.memory) !== null && _a !== void 0 ? _a : m.text) !== null && _b !== void 0 ? _b : JSON.stringify(m) }); });
|
|
5143
5158
|
}
|
|
5144
5159
|
}
|
|
5145
|
-
const json = {
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5160
|
+
const json = {
|
|
5161
|
+
action: 'loadMemoryVariables',
|
|
5162
|
+
messages: Array.isArray(payload) ? payload.length : 0,
|
|
5163
|
+
memorySummary: summarizeMemoryMessagesForSideChannel(payload),
|
|
5164
|
+
};
|
|
5165
|
+
if (adv.includeDiagnostics === true) {
|
|
5166
|
+
json.contextMessages = payload;
|
|
5167
|
+
}
|
|
5149
5168
|
returnData.push({ json });
|
|
5150
5169
|
}
|
|
5151
5170
|
return [returnData];
|
package/package.json
CHANGED