n8n-nodes-tembory 1.0.38 → 1.0.39

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.
@@ -1113,8 +1113,50 @@ const userKeyFrom = (threadId, adv, project = '') => {
1113
1113
  return namespace ? `${namespace}::${base}` : base;
1114
1114
  };
1115
1115
  const applyOperationalPreset = (advanced = {}) => {
1116
- const preset = String(advanced.operationPreset || 'productionBalanced');
1116
+ const preset = String(advanced.operationPreset || 'productionFast');
1117
1117
  const presets = {
1118
+ productionFast: {
1119
+ summarySource: 'activeContext',
1120
+ includeConnectedModelSummary: true,
1121
+ includeActiveSummary: true,
1122
+ persistActiveSummary: true,
1123
+ activeSummaryMaxChars: 1800,
1124
+ activeSummaryRetentionDays: 30,
1125
+ enableTransientSummaryCache: true,
1126
+ transientSummaryCacheTTLSeconds: 300,
1127
+ compactStateSections: true,
1128
+ useVectorMemory: false,
1129
+ persistBackendMemories: false,
1130
+ includeRecentMessageProbe: false,
1131
+ includeToolLedgerProbe: false,
1132
+ includeContextHeader: true,
1133
+ includeSummary: true,
1134
+ includeScores: false,
1135
+ includeDiagnostics: false,
1136
+ includeRelations: false,
1137
+ includeToolHistory: true,
1138
+ includeToolResults: true,
1139
+ persistToolFactsToMem0: false,
1140
+ includeToolHistorySemanticFallback: false,
1141
+ includeProfileFacts: true,
1142
+ includeOperationalState: true,
1143
+ includeActionLedger: true,
1144
+ includeEntityTimeline: false,
1145
+ includeWorkingMemory: true,
1146
+ includeDecisionState: true,
1147
+ includeMemoryCompression: true,
1148
+ includeRecentMessages: true,
1149
+ includeRecentHighlights: false,
1150
+ topK: 0,
1151
+ lastN: 0,
1152
+ maxReturn: 0,
1153
+ toolHistoryLastN: 15,
1154
+ recentMessagesLastN: 50,
1155
+ vectorMemoryMaxChars: 220,
1156
+ contextMaxChars: 9000,
1157
+ connectedModelSummaryMaxChars: 1200,
1158
+ connectedModelSummaryInputMaxChars: 4200,
1159
+ },
1118
1160
  diagnostic: {
1119
1161
  summarySource: 'auto',
1120
1162
  includeConnectedModelSummary: true,
@@ -1689,13 +1731,13 @@ const deriveContextHealth = ({ userId = '', project = '', vectorMemories = [], r
1689
1731
  namespace_stable: Boolean(userId && !/^mcp-session-\d+$/i.test(String(userId))),
1690
1732
  has_recent_messages: Array.isArray(recentMessages) && recentMessages.length > 0,
1691
1733
  has_tool_history: Array.isArray(toolHistory) && toolHistory.length > 0,
1692
- has_vector_memories: Array.isArray(vectorMemories) && vectorMemories.length > 0,
1734
+ has_vector_memories: diagnostics.vectorMemoryEnabled === false ? true : Array.isArray(vectorMemories) && vectorMemories.length > 0,
1693
1735
  has_working_memory: Boolean(workingMemory && Object.keys(workingMemory).length),
1694
1736
  has_decision_state: Boolean(decisionState && Object.keys(decisionState).length),
1695
1737
  has_memory_compression: Boolean(memoryCompression && Object.keys(memoryCompression).length),
1696
1738
  has_operational_state: Boolean(operationalState && Object.keys(operationalState).length),
1697
1739
  connected_language_model: Boolean(diagnostics.connectedAi && diagnostics.connectedAi.languageModel),
1698
- connected_embedding: Boolean(diagnostics.connectedAi && diagnostics.connectedAi.embedding),
1740
+ connected_embedding: diagnostics.vectorMemoryEnabled === false ? true : Boolean(diagnostics.connectedAi && diagnostics.connectedAi.embedding),
1699
1741
  no_connected_ai_errors: !((diagnostics.connectedAi && diagnostics.connectedAi.errors) || []).length,
1700
1742
  };
1701
1743
  const weights = {
@@ -2523,12 +2565,13 @@ class Mem0Memory {
2523
2565
  options: [
2524
2566
  { name: 'Custom', value: 'custom' },
2525
2567
  { name: 'Diagnóstico Completo', value: 'diagnostic' },
2568
+ { name: 'Produção Rápida (Thread + SLM)', value: 'productionFast' },
2526
2569
  { name: 'Produção Balanceada', value: 'productionBalanced' },
2527
2570
  { name: 'Produção Econômica', value: 'productionCheap' },
2528
2571
  { name: 'Produção Nano/SLM', value: 'productionNano' },
2529
2572
  { name: 'Auditoria', value: 'audit' },
2530
2573
  ],
2531
- default: 'productionBalanced',
2574
+ default: 'productionFast',
2532
2575
  description: 'Preenche defaults seguros para contexto, historico de tools e memoria ativa.',
2533
2576
  },
2534
2577
  { displayName: 'Incluir Cabeçalho de Contexto', name: 'includeContextHeader', type: 'boolean', default: true },
@@ -2555,6 +2598,10 @@ class Mem0Memory {
2555
2598
  { displayName: 'Máximo de Relações', name: 'maxRelations', type: 'number', default: 10 },
2556
2599
  { displayName: 'Incluir Action Ledger', name: 'includeActionLedger', type: 'boolean', default: true },
2557
2600
  { displayName: 'Incluir Entity Timeline', name: 'includeEntityTimeline', type: 'boolean', default: true },
2601
+ { displayName: 'Usar Memória Vetorial no Caminho Quente', name: 'useVectorMemory', type: 'boolean', default: false },
2602
+ { displayName: 'Persistir Memórias no Backend', name: 'persistBackendMemories', type: 'boolean', default: false },
2603
+ { displayName: 'Probe Vetorial de Mensagens Recentes', name: 'includeRecentMessageProbe', type: 'boolean', default: false },
2604
+ { displayName: 'Probe Vetorial de Tool Ledger', name: 'includeToolLedgerProbe', type: 'boolean', default: false },
2558
2605
  ],
2559
2606
  },
2560
2607
  {
@@ -2635,18 +2682,21 @@ class Mem0Memory {
2635
2682
  options: [
2636
2683
  { name: 'Custom', value: 'custom' },
2637
2684
  { name: 'Diagnóstico Completo', value: 'diagnostic' },
2685
+ { name: 'Produção Rápida (Thread + SLM)', value: 'productionFast' },
2638
2686
  { name: 'Produção Balanceada', value: 'productionBalanced' },
2639
2687
  { name: 'Produção Econômica', value: 'productionCheap' },
2640
2688
  { name: 'Produção Nano/SLM', value: 'productionNano' },
2641
2689
  { name: 'Auditoria', value: 'audit' },
2642
2690
  ],
2643
- default: 'productionBalanced',
2691
+ default: 'productionFast',
2644
2692
  description: 'Preenche defaults seguros para contexto, diagnostico, historico de tools e mensagens recentes. Valores definidos manualmente continuam tendo prioridade.',
2645
2693
  },
2646
2694
  { displayName: 'Agent ID', name: 'agentId', type: 'string', default: '' },
2647
2695
  { displayName: 'App ID', name: 'appId', type: 'string', default: '' },
2648
2696
  { displayName: 'Run ID', name: 'runId', type: 'string', default: '' },
2649
2697
  { displayName: 'Top K', name: 'topK', type: 'number', typeOptions: { minValue: 1 }, default: 25, description: 'Quantidade de memórias a recuperar (modos semânticos e limites de recentes)' },
2698
+ { displayName: 'Usar Memória Vetorial no Caminho Quente', name: 'useVectorMemory', type: 'boolean', default: false, description: 'Quando desligado, o padrão usa thread estruturada, tools e SLM sem buscar/vetorizar a cada turno.' },
2699
+ { displayName: 'Persistir Memórias no Backend', name: 'persistBackendMemories', type: 'boolean', default: false, description: 'Quando desligado, mantém o estado no workflow/static data para reduzir latência.' },
2650
2700
  { displayName: 'Rerank', name: 'rerank', type: 'boolean', default: true, description: 'Reordenação por relevância (modos semânticos)', displayOptions: { show: { '/retrievalMode': ['semantic', 'semanticV2', 'hybrid'] } } },
2651
2701
  { displayName: 'Fields (lista separada por vírgula)', name: 'fields', type: 'string', default: '', description: 'Campos específicos a retornar da API (modos semânticos)', displayOptions: { show: { '/retrievalMode': ['semantic', 'semanticV2', 'hybrid'] } } },
2652
2702
  { displayName: 'Filters (JSON)', name: 'filters', type: 'json', default: '{}', description: 'Objeto de filtros avançados para busca v2', displayOptions: { show: { '/retrievalMode': ['semanticV2', 'hybrid'] } } },
@@ -2952,7 +3002,9 @@ class Mem0Memory {
2952
3002
  body.app_id = String(adv.appId);
2953
3003
  if (adv.runId)
2954
3004
  body.run_id = String(adv.runId);
2955
- const connectedEmbedding = await getConnectedEmbedding(this, itemIndex);
3005
+ if (adv.persistBackendMemories === false)
3006
+ return;
3007
+ const connectedEmbedding = adv.useVectorMemory === false ? null : await getConnectedEmbedding(this, itemIndex);
2956
3008
  if (connectedEmbedding) {
2957
3009
  const ids = { user_id: body.user_id, agent_id: body.agent_id, run_id: body.run_id };
2958
3010
  const clientMemories = [];
@@ -3220,6 +3272,8 @@ class Mem0Memory {
3220
3272
  const project = this.getNodeParameter('project', itemIndex, '');
3221
3273
  const adv = applyOperationalPreset(readAdvancedOptions(this, itemIndex));
3222
3274
  payloadFormat = adv.payloadFormat || payloadFormat;
3275
+ const vectorMemoryEnabled = adv.useVectorMemory !== false;
3276
+ const backendPersistenceEnabled = adv.persistBackendMemories !== false;
3223
3277
  const store = getMemoryStore(this);
3224
3278
  const key = userKeyFrom(threadId, adv, project);
3225
3279
  const queryParam = this.getNodeParameter('query', itemIndex, '');
@@ -3240,12 +3294,14 @@ class Mem0Memory {
3240
3294
  catch (error) {
3241
3295
  connectedAi.errors.push(`languageModel: ${error.message || String(error)}`);
3242
3296
  }
3243
- try {
3244
- connectedEmbedding = await this.getInputConnectionData(n8n_workflow_1.NodeConnectionTypes.AiEmbedding, itemIndex);
3245
- connectedAi.embedding = true;
3246
- }
3247
- catch (error) {
3248
- connectedAi.errors.push(`embedding: ${error.message || String(error)}`);
3297
+ if (vectorMemoryEnabled) {
3298
+ try {
3299
+ connectedEmbedding = await this.getInputConnectionData(n8n_workflow_1.NodeConnectionTypes.AiEmbedding, itemIndex);
3300
+ connectedAi.embedding = true;
3301
+ }
3302
+ catch (error) {
3303
+ connectedAi.errors.push(`embedding: ${error.message || String(error)}`);
3304
+ }
3249
3305
  }
3250
3306
  if (connectedEmbedding && typeof connectedEmbedding.embedQuery === 'function' && String(query || '').trim()) {
3251
3307
  try {
@@ -3267,7 +3323,7 @@ class Mem0Memory {
3267
3323
  catch { }
3268
3324
  let payload;
3269
3325
  let vectorMemories = [];
3270
- if (retrievalMode === 'semantic' || retrievalMode === 'semanticV2' || retrievalMode === 'hybrid') {
3326
+ if (vectorMemoryEnabled && (retrievalMode === 'semantic' || retrievalMode === 'semanticV2' || retrievalMode === 'hybrid')) {
3271
3327
  const body = { query: String(query || '') };
3272
3328
  // IDs
3273
3329
  body.user_id = key;
@@ -3404,7 +3460,7 @@ class Mem0Memory {
3404
3460
  payload = semMemories.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) }); });
3405
3461
  }
3406
3462
  }
3407
- else {
3463
+ else if (backendPersistenceEnabled) {
3408
3464
  const qs = {};
3409
3465
  qs.user_id = key;
3410
3466
  if (adv.agentId)
@@ -3440,7 +3496,7 @@ class Mem0Memory {
3440
3496
  connectedAi.errors.push(`graph.relations: ${error.message || String(error)}`);
3441
3497
  }
3442
3498
  }
3443
- if (connectedEmbedding && adv.includeRecentMessages !== false) {
3499
+ if (vectorMemoryEnabled && connectedEmbedding && adv.includeRecentMessages !== false && adv.includeRecentMessageProbe !== false) {
3444
3500
  try {
3445
3501
  const transcriptProbe = [
3446
3502
  'recent conversation transcript',
@@ -3475,7 +3531,7 @@ class Mem0Memory {
3475
3531
  connectedAi.errors.push(`recentMessageProbe: ${error.message || String(error)}`);
3476
3532
  }
3477
3533
  }
3478
- if (connectedEmbedding && adv.includeToolHistory !== false) {
3534
+ if (vectorMemoryEnabled && connectedEmbedding && adv.includeToolHistory !== false && adv.includeToolLedgerProbe !== false) {
3479
3535
  try {
3480
3536
  const toolProbe = [
3481
3537
  'Tool history ledger',
@@ -3513,7 +3569,7 @@ class Mem0Memory {
3513
3569
  let persistedRecentMessages = [];
3514
3570
  let persistedToolHistory = [];
3515
3571
  let persistedMemoryItems = [];
3516
- if (adv.includeRecentMessages !== false || adv.includeToolHistory !== false) {
3572
+ if (backendPersistenceEnabled && (adv.includeRecentMessages !== false || adv.includeToolHistory !== false)) {
3517
3573
  try {
3518
3574
  const qs = { user_id: key, limit: Math.max(Number(adv.recentMessagesLastN || 50) * 8, Number(adv.toolHistoryLastN || 10) * 12, 200) };
3519
3575
  if (adv.agentId)
@@ -3660,6 +3716,8 @@ class Mem0Memory {
3660
3716
  graph: graph.length,
3661
3717
  project: project || null,
3662
3718
  memoryNamespace: key,
3719
+ vectorMemoryEnabled,
3720
+ backendPersistenceEnabled,
3663
3721
  captureState: store.captureState[key] || {
3664
3722
  last_save_at: null,
3665
3723
  last_save_had_input: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-tembory",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
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",