n8n-nodes-tembory 1.0.0
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 +75 -0
- package/dist/credentials/Mem0Api.credentials.d.ts +10 -0
- package/dist/credentials/Mem0Api.credentials.js +52 -0
- package/dist/credentials/Mem0SelfHostedApi.credentials.d.ts +10 -0
- package/dist/credentials/Mem0SelfHostedApi.credentials.js +45 -0
- package/dist/nodes/Mem0/GenericFunctions.d.ts +3 -0
- package/dist/nodes/Mem0/GenericFunctions.js +48 -0
- package/dist/nodes/Mem0/Mem0Memory.node.d.ts +15 -0
- package/dist/nodes/Mem0/Mem0Memory.node.js +2564 -0
- package/dist/nodes/Mem0/tembory-brain.svg +23 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +70 -0
- package/scripts/smoke-n8n-multiturn-tools.js +138 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
3
|
+
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
4
|
+
viewBox="0 0 460 460" xml:space="preserve">
|
|
5
|
+
<g>
|
|
6
|
+
<path style="fill:#FF926E;" d="M230,203.06h-29.375v50h-31.25v-50H85.04v-30H120V133.1h30v39.96h109.375v50h31.25v-50h84.335v-30
|
|
7
|
+
H340V103.1h-30v39.96h-80v-36h-49.96v-30H230V0c-23.02,0-42.99,12.97-53.06,31.99c-18.22-11.44-42.01-12.68-61.94-1.18
|
|
8
|
+
C95.07,42.32,84.25,63.54,85.04,85.04C63.54,84.25,42.32,95.07,30.81,115c-11.5,19.93-10.26,43.72,1.18,61.94
|
|
9
|
+
C12.97,187.01,0,206.98,0,230s12.97,42.99,31.99,53.06H230V203.06z"/>
|
|
10
|
+
<path style="fill:#F46A1A;" d="M428.01,176.94c11.44-18.22,12.68-42.01,1.18-61.94c-11.51-19.93-32.73-30.75-54.23-29.96
|
|
11
|
+
c0.79-21.5-10.03-42.72-29.96-54.23c-19.93-11.5-43.72-10.26-61.94,1.18C272.99,12.97,253.02,0,230,0v77.06h50.04v30H230v36h80
|
|
12
|
+
V103.1h30v39.96h34.96v30h-84.335v50h-31.25v-50H230v110h198.01C447.03,272.99,460,253.02,460,230S447.03,187.01,428.01,176.94z
|
|
13
|
+
M393.51,253.06h-30v-30h30V253.06z"/>
|
|
14
|
+
<path style="fill:#FFB76E;" d="M329.01,283.06h-99c0,47.828,33.909,87.729,79,96.979V460h40v-79.961
|
|
15
|
+
c-6.459,1.325-13.148,2.021-20,2.021V283.06z"/>
|
|
16
|
+
<rect x="180.04" y="77.06" style="fill:#FFB76E;" width="50" height="30"/>
|
|
17
|
+
<polygon style="fill:#FFB76E;" points="150,133.1 120,133.1 120,173.06 85.04,173.06 85.04,203.06 169.375,203.06 169.375,253.06
|
|
18
|
+
200.625,253.06 200.625,203.06 230,203.06 230,173.06 150,173.06 "/>
|
|
19
|
+
<rect x="230.04" y="77.06" style="fill:#FF926E;" width="50" height="30"/>
|
|
20
|
+
<rect x="363.51" y="223.06" style="fill:#FF926E;" width="30" height="30"/>
|
|
21
|
+
<path style="fill:#FF926E;" d="M329.01,382.06c6.852,0,13.54-0.697,20-2.021c45.091-9.249,79-49.15,79-96.979h-99V382.06z"/>
|
|
22
|
+
</g>
|
|
23
|
+
</svg>
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-tembory",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Tembory node for n8n AI Agents with profile, tools, timeline, graph and semantic memory",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://tembory.com",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Tembory",
|
|
9
|
+
"email": "dev@tembory.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/temboryhq/n8n-nodes-tembory.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/temboryhq/n8n-nodes-tembory/issues"
|
|
17
|
+
},
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc && gulp build:icons",
|
|
21
|
+
"dev": "tsc --watch",
|
|
22
|
+
"format": "prettier nodes credentials --write",
|
|
23
|
+
"lint": "tslint -p tsconfig.json -c tslint.json",
|
|
24
|
+
"lintfix": "tslint --fix -p tsconfig.json -c tslint.json",
|
|
25
|
+
"test": "node --test test/*.test.js",
|
|
26
|
+
"smoke:n8n:multiturn": "node scripts/smoke-n8n-multiturn-tools.js",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"scripts",
|
|
32
|
+
"index.js",
|
|
33
|
+
"index.d.ts",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"n8n": {
|
|
37
|
+
"n8nNodesApiVersion": 1,
|
|
38
|
+
"credentials": [
|
|
39
|
+
"dist/credentials/Mem0Api.credentials.js",
|
|
40
|
+
"dist/credentials/Mem0SelfHostedApi.credentials.js"
|
|
41
|
+
],
|
|
42
|
+
"nodes": [
|
|
43
|
+
"dist/nodes/Mem0/Mem0Memory.node.js"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"n8n-community-node-package",
|
|
48
|
+
"n8n",
|
|
49
|
+
"tembory",
|
|
50
|
+
"tembory-memory",
|
|
51
|
+
"elephant-brain",
|
|
52
|
+
"memory",
|
|
53
|
+
"ai",
|
|
54
|
+
"llm",
|
|
55
|
+
"long-term-memory",
|
|
56
|
+
"semantic-search",
|
|
57
|
+
"vector-database"
|
|
58
|
+
],
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^18.16.0",
|
|
61
|
+
"gulp": "^4.0.2",
|
|
62
|
+
"n8n-workflow": "^1.0.0",
|
|
63
|
+
"prettier": "^2.8.8",
|
|
64
|
+
"tslint": "^6.1.3",
|
|
65
|
+
"typescript": "^5.1.6"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"n8n-workflow": ">=1.0.0"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const assert = require('node:assert/strict');
|
|
5
|
+
const Module = require('node:module');
|
|
6
|
+
|
|
7
|
+
const originalLoad = Module._load;
|
|
8
|
+
Module._load = function patchedLoad(request, parent, isMain) {
|
|
9
|
+
if (request === 'n8n-workflow') {
|
|
10
|
+
return {
|
|
11
|
+
NodeConnectionTypes: {
|
|
12
|
+
AiMemory: 'ai_memory',
|
|
13
|
+
AiLanguageModel: 'ai_languageModel',
|
|
14
|
+
AiEmbedding: 'ai_embedding',
|
|
15
|
+
},
|
|
16
|
+
NodeApiError: class NodeApiError extends Error {},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (request === '@langchain/core/messages') {
|
|
20
|
+
return {
|
|
21
|
+
HumanMessage: class HumanMessage { constructor(content) { this.content = content; } },
|
|
22
|
+
AIMessage: class AIMessage { constructor(content) { this.content = content; } },
|
|
23
|
+
SystemMessage: class SystemMessage { constructor(content) { this.content = content; } },
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return originalLoad.call(this, request, parent, isMain);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const core = require('../dist/nodes/Mem0/Mem0Memory.node.js').__private;
|
|
30
|
+
|
|
31
|
+
const turns = [
|
|
32
|
+
{
|
|
33
|
+
user: 'Quais horarios existem para uma reuniao esta semana?',
|
|
34
|
+
tools: [{ name: 'agenda_consultar_disponibilidade', input: { range: 'week' }, result: { slots: ['2026-05-15T14:00:00-03:00'] } }],
|
|
35
|
+
},
|
|
36
|
+
{ user: 'Pode usar o horario das 14h', tools: [] },
|
|
37
|
+
{
|
|
38
|
+
user: 'Faz a pre-reserva desse horario',
|
|
39
|
+
tools: [{ name: 'agenda_pre_reservar_horario', input: { slot: '2026-05-15T14:00:00-03:00' }, result: { reservation_id: 'RES-TEMBORY-001' } }],
|
|
40
|
+
},
|
|
41
|
+
{ user: 'Qual pre-reserva ficou pendente?', tools: [] },
|
|
42
|
+
{
|
|
43
|
+
user: 'Pode confirmar',
|
|
44
|
+
tools: [{ name: 'agenda_confirmar_agendamento', input: { reservation_id: 'RES-TEMBORY-001' }, result: { confirmation_id: 'CONF-TEMBORY-001' } }],
|
|
45
|
+
},
|
|
46
|
+
{ user: 'Qual foi o codigo de confirmacao?', tools: [] },
|
|
47
|
+
{
|
|
48
|
+
user: 'Atualiza disponibilidade para outro horario',
|
|
49
|
+
tools: [{ name: 'agenda_consultar_disponibilidade', input: { refresh: true }, result: { slots: ['2026-05-16T10:00:00-03:00'] } }],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
user: 'Pre-reserva o novo horario',
|
|
53
|
+
tools: [{ name: 'agenda_pre_reservar_horario', input: { slot: '2026-05-16T10:00:00-03:00' }, result: { reservation_id: 'RES-TEMBORY-002' } }],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
user: 'Confirma o novo horario',
|
|
57
|
+
tools: [{ name: 'agenda_confirmar_agendamento', input: { reservation_id: 'RES-TEMBORY-002' }, result: { confirmation_id: 'CONF-TEMBORY-002' } }],
|
|
58
|
+
},
|
|
59
|
+
{ user: 'Resume as tools usadas e o estado atual', tools: [] },
|
|
60
|
+
{ user: 'O que voce sabe sem chamar ferramenta?', tools: [] },
|
|
61
|
+
{ user: 'Nao repita os passos anteriores, so responda pelo contexto', tools: [] },
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const namespace = process.env.TEMBORY_SMOKE_NAMESPACE || 'tembory-smoke-local';
|
|
65
|
+
const recentMessages = [];
|
|
66
|
+
let toolHistory = [];
|
|
67
|
+
let workingMemory = {};
|
|
68
|
+
let decisionState = {};
|
|
69
|
+
let memoryCompression = {};
|
|
70
|
+
let operationalState = {};
|
|
71
|
+
|
|
72
|
+
for (const [index, turn] of turns.entries()) {
|
|
73
|
+
recentMessages.push({ role: 'user', content: turn.user, at: new Date(Date.UTC(2026, 4, 14, 12, index)).toISOString() });
|
|
74
|
+
const output = {
|
|
75
|
+
intermediateSteps: turn.tools.map((tool, step) => ({
|
|
76
|
+
action: {
|
|
77
|
+
id: `turn-${index + 1}-tool-${step + 1}`,
|
|
78
|
+
tool: tool.name,
|
|
79
|
+
toolInput: tool.input,
|
|
80
|
+
},
|
|
81
|
+
observation: tool.result,
|
|
82
|
+
})),
|
|
83
|
+
};
|
|
84
|
+
const calls = core.extractToolCalls(output);
|
|
85
|
+
toolHistory = core.applyToolHistoryWindow(toolHistory.concat(calls), 3600, 20);
|
|
86
|
+
operationalState = core.deriveOperationalState(toolHistory, {}, recentMessages, true);
|
|
87
|
+
workingMemory = core.deriveWorkingMemory({
|
|
88
|
+
query: turn.user,
|
|
89
|
+
profileFacts: {},
|
|
90
|
+
recentMessages,
|
|
91
|
+
toolHistory,
|
|
92
|
+
operationalState,
|
|
93
|
+
previous: workingMemory,
|
|
94
|
+
});
|
|
95
|
+
decisionState = core.deriveDecisionState({
|
|
96
|
+
query: turn.user,
|
|
97
|
+
toolHistory,
|
|
98
|
+
operationalState,
|
|
99
|
+
workingMemory,
|
|
100
|
+
});
|
|
101
|
+
memoryCompression = core.deriveMemoryCompression({
|
|
102
|
+
recentMessages,
|
|
103
|
+
toolHistory,
|
|
104
|
+
profileFacts: {},
|
|
105
|
+
operationalState,
|
|
106
|
+
vectorMemories: [{ memory: 'CONF-TEMBORY-002 confirmado' }],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const health = core.deriveContextHealth({
|
|
111
|
+
userId: namespace,
|
|
112
|
+
project: 'smoke',
|
|
113
|
+
vectorMemories: [{ memory: 'CONF-TEMBORY-002 confirmado' }],
|
|
114
|
+
recentMessages,
|
|
115
|
+
toolHistory,
|
|
116
|
+
workingMemory,
|
|
117
|
+
decisionState,
|
|
118
|
+
memoryCompression,
|
|
119
|
+
operationalState,
|
|
120
|
+
diagnostics: { connectedAi: { languageModel: true, embedding: true, errors: [] } },
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
assert.equal(recentMessages.length, 12);
|
|
124
|
+
assert.equal(toolHistory.length, 6);
|
|
125
|
+
assert.equal(operationalState.agenda_state.has_confirmation, true);
|
|
126
|
+
assert.equal(decisionState.agenda_decision_state.confirmed_reservation, true);
|
|
127
|
+
assert.ok(decisionState.do_not_repeat_tools.includes('agenda_confirmar_agendamento'));
|
|
128
|
+
assert.ok(health.quality_score >= 970);
|
|
129
|
+
|
|
130
|
+
console.log(JSON.stringify({
|
|
131
|
+
ok: true,
|
|
132
|
+
namespace,
|
|
133
|
+
turns: turns.length,
|
|
134
|
+
toolEvents: toolHistory.length,
|
|
135
|
+
qualityScore: health.quality_score,
|
|
136
|
+
status: health.status,
|
|
137
|
+
latestConfirmation: operationalState.agenda_state.latest_confirmation_result,
|
|
138
|
+
}, null, 2));
|