n8n-nodes-tembory 1.1.1 → 1.1.3

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.
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Node de memoria operacional da Tembory para agentes de IA no n8n.
4
4
 
5
- Versao atual: `1.1.1`.
5
+ Versao atual: `1.1.2`.
6
6
 
7
- ## 1.1.1
7
+ ## 1.1.2
8
8
 
9
9
  - Torna a entrada `LLM` obrigatoria no node.
10
10
  - Remove opcoes visiveis de vetor, grafo e configuracao legada da interface do node.
@@ -2,8 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.temboryApiRequest = temboryApiRequest;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
+ async function getTemboryCredentials(ctx) {
6
+ try {
7
+ return await ctx.getCredentials('temboryApi');
8
+ }
9
+ catch { }
10
+ try {
11
+ return await ctx.getCredentials('mem0Api');
12
+ }
13
+ catch { }
14
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Credentials for Tembory are not set. Select a Tembory API credential and save the workflow.');
15
+ }
5
16
  async function temboryApiRequest(method, endpoint, body = {}, qs = {}) {
6
- const credentials = await this.getCredentials('temboryApi');
17
+ const credentials = await getTemboryCredentials(this);
7
18
  const baseUrl = 'https://api.tembory.com';
8
19
  const operation = resolveGatewayOperation(method, endpoint);
9
20
  const payload = {
@@ -2267,30 +2267,15 @@ const wrapTemboryMemory = (memory, ctx, memoryKey) => new Proxy(memory, {
2267
2267
  const chatHistory = cacheHit
2268
2268
  ? [{ cached: true, messages: Array.isArray(response[memoryKey] || response.chatHistory) ? (response[memoryKey] || response.chatHistory).length : 0 }]
2269
2269
  : snapshotJson(response[memoryKey] || response.chatHistory || []);
2270
+ const messages = Array.isArray(response[memoryKey] || response.chatHistory) ? (response[memoryKey] || response.chatHistory).length : 0;
2270
2271
  ctx.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, [
2271
2272
  [{
2272
2273
  json: {
2273
2274
  action: 'loadMemoryVariables',
2274
2275
  cached: cacheHit || undefined,
2275
- chatHistory,
2276
- context: response.temboryContext,
2277
- contextText: response.temboryContextText,
2278
- summary: response.temborySummary,
2279
- activeSummary: response.temboryActiveSummary,
2280
- connectedModelSummary: response.temboryConnectedModelSummary,
2281
- workingMemory: response.temboryWorkingMemory,
2282
- decisionState: response.temboryDecisionState,
2283
- memoryCompression: response.temboryMemoryCompression,
2284
- profileFacts: response.temboryProfileFacts,
2285
- operationalState: response.temboryOperationalState,
2286
- actionLedger: response.temboryActionLedger,
2287
- entityTimeline: response.temboryEntityTimeline,
2288
- vectorMemories: response.temboryVectorMemories,
2289
- graph: response.temboryGraph,
2290
- recentMessages: response.temboryRecentMessages,
2291
- recentHighlights: response.temboryRecentHighlights,
2292
- toolHistory: response.temboryToolHistory,
2293
- diagnostics: response.temboryDiagnostics,
2276
+ messages,
2277
+ contextQualityScore: response.temboryContextQualityScore,
2278
+ contextStatus: response.temboryContextHealth && response.temboryContextHealth.status,
2294
2279
  },
2295
2280
  }],
2296
2281
  ]);
@@ -2311,7 +2296,15 @@ const wrapTemboryMemory = (memory, ctx, memoryKey) => new Proxy(memory, {
2311
2296
  const response = await target.saveContext(input, output);
2312
2297
  const chatHistory = snapshotJson(await target.chatHistory.getMessages());
2313
2298
  ctx.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, [
2314
- [{ json: { action: 'saveContext', input, output, chatHistory, saved: true } }],
2299
+ [{
2300
+ json: {
2301
+ action: 'saveContext',
2302
+ saved: true,
2303
+ inputChars: JSON.stringify(input || {}).length,
2304
+ outputChars: JSON.stringify(output || {}).length,
2305
+ messages: Array.isArray(chatHistory) ? chatHistory.length : 0,
2306
+ },
2307
+ }],
2315
2308
  ]);
2316
2309
  return response;
2317
2310
  }
@@ -2667,7 +2660,7 @@ class TemboryMemory {
2667
2660
  credentials: [
2668
2661
  {
2669
2662
  name: 'temboryApi',
2670
- required: true,
2663
+ required: false,
2671
2664
  },
2672
2665
  ],
2673
2666
  codex: {
@@ -2921,11 +2914,8 @@ class TemboryMemory {
2921
2914
  }
2922
2915
  }
2923
2916
  const chatHistory = (result.response[memoryKey] || []).map(toBaseMessage);
2924
- const extra = { ...(result.response || {}) };
2925
- delete extra[memoryKey];
2926
2917
  currentMessages = chatHistory;
2927
2918
  return {
2928
- ...extra,
2929
2919
  [memoryKey]: chatHistory,
2930
2920
  chatHistory,
2931
2921
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-tembory",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
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",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "main": "index.js",
19
19
  "scripts": {
20
- "build": "tsc && gulp build:icons",
20
+ "build": "node --check index.js && node --check dist/credentials/TemboryApi.credentials.js && node --check dist/nodes/Tembory/GenericFunctions.js && node --check dist/nodes/Tembory/TemboryMemory.node.js",
21
21
  "dev": "tsc --watch",
22
22
  "format": "prettier nodes credentials --write",
23
23
  "lint": "tslint -p tsconfig.json -c tslint.json",