n8n-nodes-tembory 1.1.14 → 1.1.16
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.
|
@@ -1960,7 +1960,7 @@ const contextMemoryText = (memory, max = 700) => {
|
|
|
1960
1960
|
};
|
|
1961
1961
|
const approxTokenCount = (text) => Math.ceil(String(text || '').length / 4);
|
|
1962
1962
|
const noisyToolFields = new Set(['requested_from', 'thread', 'thread_id', 'run_id', 'dedupe_key', 'args_hash', 'result_hash', 'source']);
|
|
1963
|
-
const importantJsonFields = ['id', 'status', 'state', 'next_step', 'action', 'intent', 'tool', 'input', 'output', 'result', 'error', 'message', 'reason', 'customer_id', 'customerId', 'user_id', 'lead_id', 'ticket_id', 'charge_id', 'reservation_id', 'confirmation_id', 'selected_from_message', 'available_slots', 'availability_slots', 'disponibilidade', 'dataDisponivel', 'horarios', 'timezone', 'name', 'phone', 'segmento', 'platform', 'plataforma', 'lifecycle_stage', 'provider', 'provider_id', 'providerId', 'provider_name', 'services', 'service_id', 'serviceId', 'locationId', 'location_id', 'local', 'especialidade', 'duration', 'price', 'price_num', 'sku', 'product', 'stock', 'queue', 'priority'];
|
|
1963
|
+
const importantJsonFields = ['id', 'status', 'state', 'timestamp', 'next_step', 'action', 'intent', 'tool', 'input', 'output', 'result', 'error', 'message', 'reason', 'customer_id', 'customerId', 'user_id', 'lead_id', 'ticket_id', 'charge_id', 'reservation_id', 'confirmation_id', 'selected_from_message', 'available_slots', 'availability_slots', 'disponibilidade', 'dataDisponivel', 'horarios', 'timezone', 'name', 'phone', 'segmento', 'platform', 'plataforma', 'lifecycle_stage', 'provider', 'provider_id', 'providerId', 'provider_name', 'services', 'service_id', 'serviceId', 'locationId', 'location_id', 'local', 'especialidade', 'duration', 'price', 'price_num', 'sku', 'product', 'stock', 'queue', 'priority', 'prioridade', 'fila'];
|
|
1964
1964
|
const stripNoisyToolFields = (value, depth = 0) => {
|
|
1965
1965
|
if (depth > 8)
|
|
1966
1966
|
return undefined;
|
|
@@ -2030,8 +2030,8 @@ const compactToolHistoryForAgent = (toolHistory = [], maxItems = 6, includeResul
|
|
|
2030
2030
|
status: tool.ok === false ? 'failed' : 'ok',
|
|
2031
2031
|
at: tool.at,
|
|
2032
2032
|
reason: truncate(String(tool.reason || tool.decision || tool.why || tool.source || 'recorded tool call'), 140),
|
|
2033
|
-
input: truncate(String(tool.input || ''),
|
|
2034
|
-
result: includeResults ? compactToolResult(tool.result,
|
|
2033
|
+
input: truncate(String(tool.input || ''), 500) || undefined,
|
|
2034
|
+
result: includeResults ? compactToolResult(tool.result, 1200) : undefined,
|
|
2035
2035
|
}));
|
|
2036
2036
|
const cleanContextValue = (value) => {
|
|
2037
2037
|
if (Array.isArray(value)) {
|
|
@@ -2254,6 +2254,14 @@ const invokeConnectedModelSummary = async (connectedLanguageModel, summaryInput,
|
|
|
2254
2254
|
]);
|
|
2255
2255
|
return cleanModelSummaryText(response, Number(adv.connectedModelSummaryMaxChars || 1200));
|
|
2256
2256
|
};
|
|
2257
|
+
const compactToolAuditForSideChannel = (tool = {}) => cleanContextValue({
|
|
2258
|
+
name: tool.name || tool.tool_name || tool.tool,
|
|
2259
|
+
status: tool.status || (tool.ok === false ? 'failed' : 'ok'),
|
|
2260
|
+
at: tool.at || tool.timestamp,
|
|
2261
|
+
timestamp: tool.timestamp || tool.at,
|
|
2262
|
+
input: truncate(String(tool.input || tool.tool_args || tool.normalized_args || ''), 500) || undefined,
|
|
2263
|
+
output: compactToolResult(tool.result !== undefined ? tool.result : tool.output !== undefined ? tool.output : tool.observation, 1200),
|
|
2264
|
+
});
|
|
2257
2265
|
const compactMemoryEventPayload = (payload = {}) => {
|
|
2258
2266
|
const compact = { ...(payload || {}) };
|
|
2259
2267
|
if (Array.isArray(compact.toolCalls)) {
|
|
@@ -2262,6 +2270,10 @@ const compactMemoryEventPayload = (payload = {}) => {
|
|
|
2262
2270
|
.map((tool) => (tool && (tool.name || tool.tool_name || tool.tool)) || '')
|
|
2263
2271
|
.filter(Boolean)
|
|
2264
2272
|
.slice(0, 20);
|
|
2273
|
+
compact.toolEvents = compact.toolCalls
|
|
2274
|
+
.map((tool) => compactToolAuditForSideChannel(tool || {}))
|
|
2275
|
+
.filter((tool) => tool && Object.keys(tool).length)
|
|
2276
|
+
.slice(0, 20);
|
|
2265
2277
|
delete compact.toolCalls;
|
|
2266
2278
|
}
|
|
2267
2279
|
for (const key of ['input', 'output', 'values', 'chatHistory', 'context', 'contextText', 'diagnostics']) {
|
|
@@ -2291,6 +2303,10 @@ const summarizeMemoryMessagesForSideChannel = (messages = []) => {
|
|
|
2291
2303
|
summary.recentMessages = Array.isArray(conversation.conversation_history_chronological) ? conversation.conversation_history_chronological.length : undefined;
|
|
2292
2304
|
summary.toolCount = toolItems.length || tools.count || parsed.operationalState?.tool_counts?.total || undefined;
|
|
2293
2305
|
summary.toolNames = toolItems.map((tool) => tool.name || tool.tool_name).filter(Boolean).slice(0, 20);
|
|
2306
|
+
summary.toolEvents = toolItems
|
|
2307
|
+
.slice(-6)
|
|
2308
|
+
.map((tool) => compactToolAuditForSideChannel(tool || {}))
|
|
2309
|
+
.filter((tool) => tool && Object.keys(tool).length);
|
|
2294
2310
|
summary.lastTool = tools.last_successful_tool
|
|
2295
2311
|
? {
|
|
2296
2312
|
name: tools.last_successful_tool.name,
|
package/package.json
CHANGED