n8n-nodes-tembory 1.0.19 → 1.0.20
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/Mem0/Mem0Memory.node.js +22 -2
- 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.0.
|
|
5
|
+
Versao atual: `1.0.20`.
|
|
6
|
+
|
|
7
|
+
## 1.0.20
|
|
8
|
+
|
|
9
|
+
- Torna `Conversation frame` obrigatorio em todo contexto estruturado, antes de estado operacional e historico de tools.
|
|
10
|
+
- Expõe `current_user_message`, `previous_user_message` e ultimas mensagens do cliente como fonte autoritativa de curto prazo.
|
|
11
|
+
- Remove a dependencia de detectar termos como `msg`/`mensagem` para o agente conseguir responder sobre a ultima mensagem do cliente.
|
|
6
12
|
|
|
7
13
|
## 1.0.19
|
|
8
14
|
|
|
@@ -1167,6 +1167,21 @@ const previousUserMessageForQuery = (query = '', recentMessages = []) => {
|
|
|
1167
1167
|
return users[1] || null;
|
|
1168
1168
|
return users[0] || null;
|
|
1169
1169
|
};
|
|
1170
|
+
const buildConversationFrame = ({ query = '', recentMessages = [], workingMemory = {} }) => {
|
|
1171
|
+
const normalizedQuery = normalizeIntentText(query).trim();
|
|
1172
|
+
const users = recentUserMessages(recentMessages);
|
|
1173
|
+
const currentUser = users.find((msg) => normalizeIntentText(msg.content).trim() === normalizedQuery) || (query ? { role: 'user', content: query, at: nowIso() } : null);
|
|
1174
|
+
const previousUser = previousUserMessageForQuery(query, recentMessages);
|
|
1175
|
+
return cleanContextValue({
|
|
1176
|
+
current_user_message: currentUser ? truncate(currentUser.content, 500) : truncate(query, 500),
|
|
1177
|
+
previous_user_message: previousUser ? truncate(previousUser.content, 500) : (workingMemory === null || workingMemory === void 0 ? void 0 : workingMemory.last_user_message) || null,
|
|
1178
|
+
recent_user_messages: users
|
|
1179
|
+
.filter((msg) => normalizeIntentText(msg.content).trim() !== normalizedQuery)
|
|
1180
|
+
.slice(0, 5)
|
|
1181
|
+
.map((msg) => ({ role: msg.role, content: truncate(msg.content, 500), at: msg.at })),
|
|
1182
|
+
instruction: 'This is the authoritative short-term conversation frame. If the user asks about the last/current/previous client message, answer from previous_user_message/recent_user_messages before using vector memories, summaries, operational state, or tool history.',
|
|
1183
|
+
});
|
|
1184
|
+
};
|
|
1170
1185
|
const buildCurrentTurnFocus = ({ query = '', recentMessages = [], operationalState = {}, workingMemory = {} }) => {
|
|
1171
1186
|
const recall = isConversationRecallQuery(query);
|
|
1172
1187
|
const agendaStatus = isAgendaStatusQuery(query);
|
|
@@ -1850,10 +1865,15 @@ const buildContextMessages = ({ payloadFormat, query, userId, profileFacts, work
|
|
|
1850
1865
|
section: 'context_header',
|
|
1851
1866
|
title: 'Tembory context',
|
|
1852
1867
|
value: compactForAgent || compactStateSections
|
|
1853
|
-
? 'Read-only memory. Follow next_expected_action when present. Before calling downstream tools, verify required prior tool context in tool_history or operational_state. Do not repeat tools listed in do_not_repeat_tools.'
|
|
1854
|
-
: 'Use this context as read-only memory. Prefer it over guessing. Do not mention internal section names to the user. Treat next_expected_action as an instruction, not as a suggestion. If it says to call a tool now, call that tool instead of asking the user the same question again. If the user asks to continue, chooses a slot, says ok/sim, reserve, confirm, update, cancel, or performs any downstream action that depends on a prior tool result, first verify the required prior result in tool_history, recent_messages, or vector memories. If the required prior result is absent, do not call the downstream tool; ask for the missing context or call the appropriate prerequisite tool.',
|
|
1868
|
+
? 'Read-only memory. Conversation frame is authoritative for current/previous client messages. Follow next_expected_action when present. Before calling downstream tools, verify required prior tool context in tool_history or operational_state. Do not repeat tools listed in do_not_repeat_tools.'
|
|
1869
|
+
: 'Use this context as read-only memory. Prefer it over guessing. Do not mention internal section names to the user. The Conversation frame is authoritative for current, previous, and recent client messages. Treat next_expected_action as an instruction, not as a suggestion. If it says to call a tool now, call that tool instead of asking the user the same question again. If the user asks to continue, chooses a slot, says ok/sim, reserve, confirm, update, cancel, or performs any downstream action that depends on a prior tool result, first verify the required prior result in tool_history, recent_messages, or vector memories. If the required prior result is absent, do not call the downstream tool; ask for the missing context or call the appropriate prerequisite tool.',
|
|
1855
1870
|
});
|
|
1856
1871
|
}
|
|
1872
|
+
sections.push({
|
|
1873
|
+
section: 'conversation_frame',
|
|
1874
|
+
title: 'Conversation frame',
|
|
1875
|
+
value: buildConversationFrame({ query, recentMessages, workingMemory }),
|
|
1876
|
+
});
|
|
1857
1877
|
const currentTurnFocus = buildCurrentTurnFocus({ query, recentMessages, operationalState, workingMemory });
|
|
1858
1878
|
if (currentTurnFocus) {
|
|
1859
1879
|
sections.push({
|
package/package.json
CHANGED