n8n-nodes-tembory 1.0.18 → 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 CHANGED
@@ -2,7 +2,18 @@
2
2
 
3
3
  Node de memoria operacional da Tembory para agentes de IA no n8n.
4
4
 
5
- Versao atual: `1.0.18`.
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.
12
+
13
+ ## 1.0.19
14
+
15
+ - Amplia a deteccao de metaconversa para abreviacoes como `msg` e `msgs`.
16
+ - Adiciona regressao para "qual foia minha ultima msg?" com disponibilidade carregada, garantindo resposta pela mensagem anterior e nao pela agenda.
6
17
 
7
18
  ## 1.0.18
8
19
 
@@ -1147,9 +1147,9 @@ const normalizeIntentText = (value = '') => String(value || '')
1147
1147
  const hasConfirmIntent = (value = '') => /\b(confirm\w*|confim\w*|cnfirm\w*|cofnirm\w*|ocnfi\w*|ocnfia\w*|fechar)\b/.test(normalizeIntentText(value));
1148
1148
  const isConversationRecallQuery = (value = '') => {
1149
1149
  const text = normalizeIntentText(value);
1150
- return /\b(minha|qual|quais|o que|oq|voce|vc|lembra|lembrar|sabe|diga|fala)\b.{0,80}\b(ultima|ultimas|mensagem|mensagens|pergunta|perguntei|falei|disse)\b/.test(text)
1150
+ return /\b(minha|qual|quais|o que|oq|voce|vc|lembra|lembrar|sabe|diga|fala)\b.{0,80}\b(ultima|ultimas|msg|msgs|mensagem|mensagens|pergunta|perguntei|falei|disse)\b/.test(text)
1151
1151
  || /\b(o que|oq)\b.{0,30}\b(eu)\b.{0,30}\b(falei|disse|perguntei|mandei)\b/.test(text)
1152
- || /\b(nao|nao)\b.{0,20}\b(lembra|sabe)\b.{0,60}\b(mensagem|pergunta|falei|disse|perguntei)\b/.test(text);
1152
+ || /\b(nao|nao)\b.{0,20}\b(lembra|sabe)\b.{0,60}\b(msg|msgs|mensagem|pergunta|falei|disse|perguntei)\b/.test(text);
1153
1153
  };
1154
1154
  const isAgendaStatusQuery = (value = '') => {
1155
1155
  const text = normalizeIntentText(value);
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-tembory",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Tembory node for n8n AI Agents with profile, tools, timeline, graph and semantic memory",
5
5
  "license": "MIT",
6
6
  "homepage": "https://tembory.com",