n8n-nodes-tembory 1.1.7 → 1.1.9
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.
|
@@ -2266,23 +2266,16 @@ const wrapTemboryMemory = (memory, ctx, memoryKey) => new Proxy(memory, {
|
|
|
2266
2266
|
if (prop === 'loadMemoryVariables') {
|
|
2267
2267
|
return async (values = {}) => {
|
|
2268
2268
|
const { index } = ctx.addInputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, [
|
|
2269
|
-
[{ json: { action: 'loadMemoryVariables', values } }],
|
|
2269
|
+
[{ json: { action: 'loadMemoryVariables', valuesChars: JSON.stringify(values || {}).length } }],
|
|
2270
2270
|
]);
|
|
2271
2271
|
try {
|
|
2272
2272
|
const response = await target.loadMemoryVariables(values);
|
|
2273
|
-
const cacheHit = Boolean(response.temboryDiagnostics && response.temboryDiagnostics.cacheHit);
|
|
2274
|
-
const chatHistory = cacheHit
|
|
2275
|
-
? [{ cached: true, messages: Array.isArray(response[memoryKey] || response.chatHistory) ? (response[memoryKey] || response.chatHistory).length : 0 }]
|
|
2276
|
-
: snapshotJson(response[memoryKey] || response.chatHistory || []);
|
|
2277
2273
|
const messages = Array.isArray(response[memoryKey] || response.chatHistory) ? (response[memoryKey] || response.chatHistory).length : 0;
|
|
2278
2274
|
ctx.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, [
|
|
2279
2275
|
[{
|
|
2280
2276
|
json: {
|
|
2281
2277
|
action: 'loadMemoryVariables',
|
|
2282
|
-
cached: cacheHit || undefined,
|
|
2283
2278
|
messages,
|
|
2284
|
-
contextQualityScore: response.temboryContextQualityScore,
|
|
2285
|
-
contextStatus: response.temboryContextHealth && response.temboryContextHealth.status,
|
|
2286
2279
|
},
|
|
2287
2280
|
}],
|
|
2288
2281
|
]);
|
|
@@ -2297,7 +2290,13 @@ const wrapTemboryMemory = (memory, ctx, memoryKey) => new Proxy(memory, {
|
|
|
2297
2290
|
if (prop === 'saveContext') {
|
|
2298
2291
|
return async (input = {}, output = {}) => {
|
|
2299
2292
|
const { index } = ctx.addInputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, [
|
|
2300
|
-
[{
|
|
2293
|
+
[{
|
|
2294
|
+
json: {
|
|
2295
|
+
action: 'saveContext',
|
|
2296
|
+
inputChars: JSON.stringify(input || {}).length,
|
|
2297
|
+
outputChars: JSON.stringify(output || {}).length,
|
|
2298
|
+
},
|
|
2299
|
+
}],
|
|
2301
2300
|
]);
|
|
2302
2301
|
try {
|
|
2303
2302
|
const response = await target.saveContext(input, output);
|
|
@@ -2844,7 +2843,7 @@ class TemboryMemory {
|
|
|
2844
2843
|
const loadCache = new Map();
|
|
2845
2844
|
const recordMemoryEvent = (action, payload = {}, error) => {
|
|
2846
2845
|
const { index } = this.addInputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, [
|
|
2847
|
-
[{ json: { action
|
|
2846
|
+
[{ json: { action } }],
|
|
2848
2847
|
]);
|
|
2849
2848
|
if (error) {
|
|
2850
2849
|
this.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, error);
|
|
@@ -2893,30 +2892,6 @@ class TemboryMemory {
|
|
|
2893
2892
|
if (loadCache.has(cacheKey)) {
|
|
2894
2893
|
result = snapshotJson(loadCache.get(cacheKey));
|
|
2895
2894
|
result.response = result.response || {};
|
|
2896
|
-
const diagnostics = {
|
|
2897
|
-
...(result.response.temboryDiagnostics || {}),
|
|
2898
|
-
cacheHit: true,
|
|
2899
|
-
cacheScope: 'supplyData.loadMemoryVariables',
|
|
2900
|
-
};
|
|
2901
|
-
Object.defineProperty(result.response, 'temboryDiagnostics', {
|
|
2902
|
-
value: diagnostics,
|
|
2903
|
-
enumerable: false,
|
|
2904
|
-
writable: true,
|
|
2905
|
-
configurable: true,
|
|
2906
|
-
});
|
|
2907
|
-
if (result.response.temboryContext) {
|
|
2908
|
-
result.response.temboryContext = {
|
|
2909
|
-
kind: result.response.temboryContext.kind,
|
|
2910
|
-
userId: result.response.temboryContext.userId,
|
|
2911
|
-
project: result.response.temboryContext.project,
|
|
2912
|
-
query: result.response.temboryContext.query,
|
|
2913
|
-
retrievalMode: result.response.temboryContext.retrievalMode,
|
|
2914
|
-
payloadFormat: result.response.temboryContext.payloadFormat,
|
|
2915
|
-
contextQualityScore: result.response.temboryContext.contextQualityScore,
|
|
2916
|
-
cacheHit: true,
|
|
2917
|
-
};
|
|
2918
|
-
}
|
|
2919
|
-
delete result.response.temboryContextText;
|
|
2920
2895
|
}
|
|
2921
2896
|
else {
|
|
2922
2897
|
result = await TemboryMemory.prototype.loadMemoryVariablesForItem.call(this, itemIndex, inputValues);
|
|
@@ -3910,33 +3885,12 @@ class TemboryMemory {
|
|
|
3910
3885
|
},
|
|
3911
3886
|
diagnostics,
|
|
3912
3887
|
};
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3888
|
+
return {
|
|
3889
|
+
response: {
|
|
3890
|
+
[memoryKey]: payload,
|
|
3891
|
+
chatHistory: payload,
|
|
3892
|
+
},
|
|
3916
3893
|
};
|
|
3917
|
-
Object.defineProperties(response, {
|
|
3918
|
-
temboryContext: { value: audit, enumerable: false, writable: true, configurable: true },
|
|
3919
|
-
temboryContextText: { value: contextText, enumerable: false, writable: true, configurable: true },
|
|
3920
|
-
temborySummary: { value: summary, enumerable: false, writable: true, configurable: true },
|
|
3921
|
-
temboryActiveSummary: { value: loadedActiveSummary, enumerable: false, writable: true, configurable: true },
|
|
3922
|
-
temboryConnectedModelSummary: { value: connectedModelSummary, enumerable: false, writable: true, configurable: true },
|
|
3923
|
-
temboryContextHealth: { value: contextHealth, enumerable: false, writable: true, configurable: true },
|
|
3924
|
-
temboryContextQualityScore: { value: contextHealth.quality_score, enumerable: false, writable: true, configurable: true },
|
|
3925
|
-
temboryWorkingMemory: { value: workingMemory, enumerable: false, writable: true, configurable: true },
|
|
3926
|
-
temboryDecisionState: { value: decisionState, enumerable: false, writable: true, configurable: true },
|
|
3927
|
-
temboryMemoryCompression: { value: memoryCompression, enumerable: false, writable: true, configurable: true },
|
|
3928
|
-
temboryProfileFacts: { value: renderProfileFacts(profileFacts), enumerable: false, writable: true, configurable: true },
|
|
3929
|
-
temboryOperationalState: { value: operationalState, enumerable: false, writable: true, configurable: true },
|
|
3930
|
-
temboryActionLedger: { value: actionLedger, enumerable: false, writable: true, configurable: true },
|
|
3931
|
-
temboryEntityTimeline: { value: entityTimeline, enumerable: false, writable: true, configurable: true },
|
|
3932
|
-
temboryVectorMemories: { value: normalizedVectorMemories, enumerable: false, writable: true, configurable: true },
|
|
3933
|
-
temboryGraph: { value: graph, enumerable: false, writable: true, configurable: true },
|
|
3934
|
-
temboryRecentMessages: { value: recentMessages, enumerable: false, writable: true, configurable: true },
|
|
3935
|
-
temboryRecentHighlights: { value: highlights, enumerable: false, writable: true, configurable: true },
|
|
3936
|
-
temboryToolHistory: { value: audit.toolHistory, enumerable: false, writable: true, configurable: true },
|
|
3937
|
-
temboryDiagnostics: { value: diagnostics, enumerable: false, writable: true, configurable: true },
|
|
3938
|
-
});
|
|
3939
|
-
return { response };
|
|
3940
3894
|
}
|
|
3941
3895
|
async execute() {
|
|
3942
3896
|
const items = this.getInputData();
|
package/package.json
CHANGED