n8n-nodes-tembory 1.0.6 → 1.0.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.
@@ -976,6 +976,16 @@ const dedupeToolHistory = (items) => {
976
976
  const key = toolEventKey(item);
977
977
  if (seen.has(key))
978
978
  continue;
979
+ const atMs = new Date(item.at || 0).getTime();
980
+ const nearDuplicate = out.some((existing) => {
981
+ const existingMs = new Date(existing.at || 0).getTime();
982
+ return Math.abs(atMs - existingMs) < 1000
983
+ && String(item.name || '') === String(existing.name || '')
984
+ && canonicalToolInput(item.input) === canonicalToolInput(existing.input)
985
+ && String(item.result || '') === String(existing.result || '');
986
+ });
987
+ if (nearDuplicate)
988
+ continue;
979
989
  seen.add(key);
980
990
  out.push(item);
981
991
  }
@@ -1211,7 +1221,7 @@ const deriveMemoryCompression = ({ recentMessages = [], toolHistory = [], profil
1211
1221
  const lastMessages = pruneByLimit(recentMessages || [], maxItems).map((msg) => `${msg.role || 'message'}: ${truncate(msg.content || '', 160)}`);
1212
1222
  const lastTools = pruneByLimit(toolHistory || [], maxItems).map((tool) => `${tool.name || 'tool'}:${tool.ok === false ? 'failed' : 'ok'}${tool.at ? `@${tool.at}` : ''}`);
1213
1223
  const profile = renderProfileFacts(profileFacts);
1214
- const activeMemories = (vectorMemories || []).map(enrichContextMemory).filter((item) => item.status === 'active').slice(0, maxItems);
1224
+ const activeMemories = (vectorMemories || []).map((memory) => ({ ...enrichContextMemory(memory), compact_memory: contextMemoryText(memory, 220) })).filter((item) => item.status === 'active').slice(0, maxItems);
1215
1225
  return {
1216
1226
  turn_summary: lastMessages.length ? lastMessages : [],
1217
1227
  session_summary: {
@@ -1223,7 +1233,7 @@ const deriveMemoryCompression = ({ recentMessages = [], toolHistory = [], profil
1223
1233
  workflow_summary: {
1224
1234
  active_memory_count: activeMemories.length,
1225
1235
  top_active_memories: activeMemories.map((item) => ({
1226
- memory: truncate(item.memory, 220),
1236
+ memory: item.compact_memory,
1227
1237
  confidence: item.confidence,
1228
1238
  source: item.source,
1229
1239
  })),
@@ -2357,7 +2367,7 @@ class Mem0Memory {
2357
2367
  const rawScore = scoreOf(m);
2358
2368
  const enriched = enrichContextMemory(m);
2359
2369
  return {
2360
- memory: memoryText(m),
2370
+ memory: contextMemoryText(m, Number(adv.vectorMemoryMaxChars || 700)),
2361
2371
  score: adv.includeScores === false ? undefined : (rawScore !== undefined ? rawScore : scoreMeta.hybridScore ?? scoreMeta.recencyScore ?? 'unavailable'),
2362
2372
  semantic_score: adv.includeScores === false ? undefined : scoreMeta.semanticScore,
2363
2373
  recency_score: adv.includeScores === false ? undefined : scoreMeta.recencyScore,
@@ -2372,7 +2382,7 @@ class Mem0Memory {
2372
2382
  raw: adv.includeDiagnostics ? m : undefined,
2373
2383
  };
2374
2384
  });
2375
- const summary = vectorMemories.slice(0, Number(adv.summaryMaxFacts || 4)).map(memoryText).filter(Boolean);
2385
+ const summary = vectorMemories.slice(0, Number(adv.summaryMaxFacts || 4)).map((memory) => contextMemoryText(memory, 360)).filter(Boolean);
2376
2386
  const contextText = payload.map((message) => String(message.content || '')).join('\n\n');
2377
2387
  const audit = {
2378
2388
  kind: 'elefai.brain.context.v1',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-tembory",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
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",