n8n-nodes-tembory 1.1.12 → 1.1.14

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.
@@ -2254,6 +2254,57 @@ const invokeConnectedModelSummary = async (connectedLanguageModel, summaryInput,
2254
2254
  ]);
2255
2255
  return cleanModelSummaryText(response, Number(adv.connectedModelSummaryMaxChars || 1200));
2256
2256
  };
2257
+ const compactMemoryEventPayload = (payload = {}) => {
2258
+ const compact = { ...(payload || {}) };
2259
+ if (Array.isArray(compact.toolCalls)) {
2260
+ compact.toolCallsCaptured = compact.toolCalls.length;
2261
+ compact.toolNames = compact.toolCalls
2262
+ .map((tool) => (tool && (tool.name || tool.tool_name || tool.tool)) || '')
2263
+ .filter(Boolean)
2264
+ .slice(0, 20);
2265
+ delete compact.toolCalls;
2266
+ }
2267
+ for (const key of ['input', 'output', 'values', 'chatHistory', 'context', 'contextText', 'diagnostics']) {
2268
+ if (compact[key] !== undefined)
2269
+ compact[`${key}Chars`] = typeof compact[key] === 'string' ? compact[key].length : safeStringify(compact[key]).length;
2270
+ delete compact[key];
2271
+ }
2272
+ return compact;
2273
+ };
2274
+ const summarizeMemoryMessagesForSideChannel = (messages = []) => {
2275
+ const list = Array.isArray(messages) ? messages : [];
2276
+ const summary = { messages: list.length };
2277
+ const firstSystem = list.find((message) => {
2278
+ const type = messageTypeOf(message);
2279
+ return type === 'system' || /system/i.test(String(message?.role || ''));
2280
+ });
2281
+ if (!firstSystem)
2282
+ return summary;
2283
+ try {
2284
+ const parsed = JSON.parse(messageContentOf(firstSystem));
2285
+ const conversation = parsed.conversation || {};
2286
+ const tools = parsed.tools || {};
2287
+ const toolItems = Array.isArray(tools.items) ? tools.items : [];
2288
+ const summaryText = parsed.summary?.slm || parsed.summary || parsed.connectedModelSummary || parsed.activeSummary || '';
2289
+ summary.intent = parsed.observations?.inferred_intent?.label || parsed.workingMemory?.last_user_intent || parsed.decisionState?.current_intent || undefined;
2290
+ summary.currentUserMessage = conversation.current_user_message ? truncate(conversation.current_user_message, 180) : undefined;
2291
+ summary.recentMessages = Array.isArray(conversation.conversation_history_chronological) ? conversation.conversation_history_chronological.length : undefined;
2292
+ summary.toolCount = toolItems.length || tools.count || parsed.operationalState?.tool_counts?.total || undefined;
2293
+ summary.toolNames = toolItems.map((tool) => tool.name || tool.tool_name).filter(Boolean).slice(0, 20);
2294
+ summary.lastTool = tools.last_successful_tool
2295
+ ? {
2296
+ name: tools.last_successful_tool.name,
2297
+ at: tools.last_successful_tool.at,
2298
+ }
2299
+ : (toolItems.length ? { name: toolItems[toolItems.length - 1].name, at: toolItems[toolItems.length - 1].at } : undefined);
2300
+ summary.quality = parsed.contextHealth?.quality_score || parsed.contextQualityScore || undefined;
2301
+ summary.summaryChars = typeof summaryText === 'string' ? summaryText.length : safeStringify(summaryText).length;
2302
+ return Object.fromEntries(Object.entries(summary).filter(([, value]) => value !== undefined));
2303
+ }
2304
+ catch {
2305
+ return summary;
2306
+ }
2307
+ };
2257
2308
  const contextSizeOfMessages = (messages = []) => {
2258
2309
  const perMessage = (messages || []).map((message, index) => {
2259
2310
  const content = String(message.content || '');
@@ -2271,12 +2322,14 @@ const wrapTemboryMemory = (memory, ctx, memoryKey) => new Proxy(memory, {
2271
2322
  ]);
2272
2323
  try {
2273
2324
  const response = await target.loadMemoryVariables(values);
2274
- const messages = Array.isArray(response[memoryKey] || response.chatHistory) ? (response[memoryKey] || response.chatHistory).length : 0;
2325
+ const memoryMessages = response[memoryKey] || response.chatHistory || [];
2326
+ const messages = Array.isArray(memoryMessages) ? memoryMessages.length : 0;
2275
2327
  ctx.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, [
2276
2328
  [{
2277
2329
  json: {
2278
2330
  action: 'loadMemoryVariables',
2279
2331
  messages,
2332
+ memorySummary: summarizeMemoryMessagesForSideChannel(memoryMessages),
2280
2333
  },
2281
2334
  }],
2282
2335
  ]);
@@ -2851,7 +2904,7 @@ class TemboryMemory {
2851
2904
  return;
2852
2905
  }
2853
2906
  this.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, [
2854
- [{ json: { action, ...payload } }],
2907
+ [{ json: { action, ...compactMemoryEventPayload(payload) } }],
2855
2908
  ]);
2856
2909
  };
2857
2910
  const memory = {
@@ -4042,4 +4095,6 @@ exports.__private = {
4042
4095
  buildConnectedModelSummaryInput,
4043
4096
  cleanModelSummaryText,
4044
4097
  invokeConnectedModelSummary,
4098
+ compactMemoryEventPayload,
4099
+ summarizeMemoryMessagesForSideChannel,
4045
4100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-tembory",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "Tembory node for n8n AI Agents with operational memory, tool history and decision state",
5
5
  "license": "MIT",
6
6
  "homepage": "https://tembory.com",