n8n-nodes-tembory 1.1.4 → 1.1.6
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.
|
@@ -687,7 +687,7 @@ const parseToolHistoryMarker = (text) => {
|
|
|
687
687
|
name: String(parsed.name),
|
|
688
688
|
input: parsed.input === undefined ? '' : String(parsed.input),
|
|
689
689
|
ok: parsed.ok !== false,
|
|
690
|
-
result:
|
|
690
|
+
result: parsed.result === undefined ? '' : String(parsed.result),
|
|
691
691
|
at: parsed.at || nowIso(),
|
|
692
692
|
source: parsed.source || 'tembory_marker',
|
|
693
693
|
};
|
|
@@ -714,7 +714,7 @@ const parseToolLedgerMarker = (text) => {
|
|
|
714
714
|
name: String(tool.name),
|
|
715
715
|
input: tool.input === undefined ? '' : String(tool.input),
|
|
716
716
|
ok: tool.ok !== false,
|
|
717
|
-
result:
|
|
717
|
+
result: tool.result === undefined ? '' : String(tool.result),
|
|
718
718
|
at: tool.at || parsed.generated_at || nowIso(),
|
|
719
719
|
source: tool.source || 'tool_ledger_marker',
|
|
720
720
|
}));
|
|
@@ -817,7 +817,7 @@ const toolHistoryFromMemory = (item) => {
|
|
|
817
817
|
name: factMatch[1],
|
|
818
818
|
input: truncate((factMatch[2] || '').trim(), 1000),
|
|
819
819
|
ok: true,
|
|
820
|
-
result:
|
|
820
|
+
result: (factMatch[3] || '').trim(),
|
|
821
821
|
at: meta.at || item.created_at || item.createdAt || nowIso(),
|
|
822
822
|
source: 'semantic_fact',
|
|
823
823
|
};
|
|
@@ -846,7 +846,7 @@ const toolHistoryFromMemory = (item) => {
|
|
|
846
846
|
name: String(name),
|
|
847
847
|
input: meta.input === undefined ? '' : String(meta.input),
|
|
848
848
|
ok: meta.ok !== false,
|
|
849
|
-
result:
|
|
849
|
+
result: meta.result === undefined ? String(content || '') : String(meta.result),
|
|
850
850
|
at: meta.at || item.created_at || item.createdAt || nowIso(),
|
|
851
851
|
source: meta.source || 'metadata',
|
|
852
852
|
};
|
|
@@ -865,7 +865,7 @@ const explicitToolHistoryItemsFromMemory = (item) => {
|
|
|
865
865
|
name: String(tool.name),
|
|
866
866
|
input: tool.input === undefined ? '' : String(tool.input),
|
|
867
867
|
ok: tool.ok !== false,
|
|
868
|
-
result:
|
|
868
|
+
result: tool.output === undefined && tool.result === undefined ? '' : String(tool.output ?? tool.result),
|
|
869
869
|
at: tool.at || archive.generated_at || nowIso(),
|
|
870
870
|
source: tool.source || 'turn_archive',
|
|
871
871
|
}));
|
|
@@ -930,7 +930,9 @@ const canonicalToolInput = (value) => {
|
|
|
930
930
|
const normalizeToolCall = (tool, sequence = 0, defaults = {}) => {
|
|
931
931
|
const at = tool.at || defaults.at || nowIso();
|
|
932
932
|
const input = canonicalToolInput(tool.input);
|
|
933
|
-
const
|
|
933
|
+
const rawResult = tool.result !== undefined ? tool.result : tool.output !== undefined ? tool.output : tool.observation !== undefined ? tool.observation : '';
|
|
934
|
+
const result = typeof rawResult === 'string' ? rawResult : safeStringify(rawResult);
|
|
935
|
+
const resultSummary = summarizeToolResult(rawResult);
|
|
934
936
|
const normalized = {
|
|
935
937
|
id: tool.id || tool.callId || tool.call_id || '',
|
|
936
938
|
call_id: tool.id || tool.callId || tool.call_id || '',
|
|
@@ -944,7 +946,7 @@ const normalizeToolCall = (tool, sequence = 0, defaults = {}) => {
|
|
|
944
946
|
normalized_args: input,
|
|
945
947
|
ok: tool.ok !== false,
|
|
946
948
|
result,
|
|
947
|
-
result_summary:
|
|
949
|
+
result_summary: resultSummary,
|
|
948
950
|
at,
|
|
949
951
|
timestamp: at,
|
|
950
952
|
source: tool.source || defaults.source || 'n8n',
|
|
@@ -1026,8 +1028,9 @@ const extractToolCallsFromMessages = (messages = []) => {
|
|
|
1026
1028
|
const name = message.name || message.toolName || message.tool || additional.name || additional.tool_name || additional.toolName || kwargs.name || 'tool';
|
|
1027
1029
|
const existing = id ? toolCallById.get(String(id)) : null;
|
|
1028
1030
|
if (existing) {
|
|
1029
|
-
|
|
1030
|
-
existing.
|
|
1031
|
+
const rawContent = messageContentOf(message);
|
|
1032
|
+
existing.result = rawContent;
|
|
1033
|
+
existing.result_summary = summarizeToolResult(rawContent);
|
|
1031
1034
|
existing.ok = true;
|
|
1032
1035
|
existing.status = 'ok';
|
|
1033
1036
|
existing.result_hash = stableHash(existing.result || '');
|
|
@@ -1065,7 +1068,7 @@ const extractToolCallsFromText = (text, at = nowIso()) => {
|
|
|
1065
1068
|
name,
|
|
1066
1069
|
input: match[2].trim(),
|
|
1067
1070
|
ok: true,
|
|
1068
|
-
result:
|
|
1071
|
+
result: match[3].trim(),
|
|
1069
1072
|
at,
|
|
1070
1073
|
source: 'used_tools_text',
|
|
1071
1074
|
}, calls.length + 1));
|
|
@@ -1085,7 +1088,7 @@ const extractToolCalls = (outputValues = {}) => {
|
|
|
1085
1088
|
name: String(name),
|
|
1086
1089
|
input: input === undefined ? '' : (typeof input === 'string' ? input : stableStringify(input)),
|
|
1087
1090
|
ok,
|
|
1088
|
-
result
|
|
1091
|
+
result,
|
|
1089
1092
|
at,
|
|
1090
1093
|
source: meta.source || 'intermediate_steps',
|
|
1091
1094
|
}, calls.length + 1, { at }));
|
|
@@ -1956,7 +1959,7 @@ const contextMemoryText = (memory, max = 700) => {
|
|
|
1956
1959
|
};
|
|
1957
1960
|
const approxTokenCount = (text) => Math.ceil(String(text || '').length / 4);
|
|
1958
1961
|
const noisyToolFields = new Set(['requested_from', 'thread', 'thread_id', 'run_id', 'dedupe_key', 'args_hash', 'result_hash', 'source']);
|
|
1959
|
-
const importantJsonFields = ['id', 'status', 'state', 'next_step', 'action', 'intent', 'tool', 'input', 'output', 'result', 'error', 'message', 'reason', 'customer_id', 'user_id', 'lead_id', 'ticket_id', 'charge_id', 'reservation_id', 'confirmation_id', 'selected_from_message', 'available_slots', 'timezone', 'name', 'phone', 'segmento', 'platform', 'plataforma', 'lifecycle_stage', 'provider', 'sku', 'product', 'stock', 'queue', 'priority'];
|
|
1962
|
+
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'];
|
|
1960
1963
|
const stripNoisyToolFields = (value, depth = 0) => {
|
|
1961
1964
|
if (depth > 8)
|
|
1962
1965
|
return undefined;
|
package/package.json
CHANGED