n8n-nodes-elefaibrain-memory-lab 0.1.0-lab.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 ADDED
@@ -0,0 +1,65 @@
1
+ # n8n-nodes-elefaibrain-memory-lab
2
+
3
+ Fork de laboratorio para testar o node de memoria do ElefAI Brain no n8n sem mexer no pacote local antigo em `elefaibrain-project/node/@elefai/n8n-nodes-elefaibrain`.
4
+
5
+ ## Origem
6
+
7
+ Este pacote foi reconstruido a partir do tarball publico `@surreal7/n8n-nodes-mem0@1.3.7`, porque o pacote local atual estava incompleto e continha apenas `index.js`/`index.d.ts` vazios.
8
+
9
+ ## Objetivo do fork
10
+
11
+ - Manter um pacote instalavel no n8n para testes.
12
+ - Renomear o node de memoria para `ElefAI Brain Memory Lab`.
13
+ - Expor a saida `ai_memory` para conectar no AI Agent.
14
+ - Expor entradas experimentais `ai_languageModel` e `ai_embedding` para validar o desenho visual do node no canvas do n8n.
15
+ - Preparar a evolucao em que o LLM e o embedder serao fornecidos pelo proprio n8n do cliente, deixando o custo de tokens na conta conectada pelo cliente.
16
+
17
+ ## Estado atual
18
+
19
+ Este fork agora entrega um conector de Chat Memory pela porta `ai_memory`, com:
20
+
21
+ - `loadMemoryVariables()` para carregar memorias do ElefAI Brain/Mem0.
22
+ - `saveContext()` para persistir pares usuario/assistente no Mem0.
23
+ - entradas `ai_languageModel` e `ai_embedding` no canvas para validar o formato de cluster com modelos conectados no n8n.
24
+
25
+ As entradas de modelo ainda sao tratadas como contrato de interface. A proxima etapa funcional e usar esses modelos conectados para extracao/sumarizacao/embedding antes de enviar ao backend, ou criar endpoints ElefAI no Mem0 para aceitar fatos/vetores pre-processados.
26
+
27
+ ## Teste local
28
+
29
+ ```bash
30
+ cd elefaibrain-project/node-forks/n8n-nodes-elefaibrain-memory-lab
31
+ npm pack
32
+ ```
33
+
34
+ Depois instale o `.tgz` gerado no ambiente de teste do n8n.
35
+
36
+ ## Instalacao via npm publico
37
+
38
+ No n8n Community Nodes, use:
39
+
40
+ ```text
41
+ n8n-nodes-elefaibrain-memory-lab
42
+ ```
43
+
44
+ Ou via terminal:
45
+
46
+ ```bash
47
+ npm install n8n-nodes-elefaibrain-memory-lab@0.1.0-lab.0
48
+ ```
49
+
50
+ ## Instalacao via GitLab Package Registry
51
+
52
+ O pacote esta publicado no GitLab Package Registry do projeto:
53
+
54
+ ```bash
55
+ npm install @elefai/n8n-nodes-elefaibrain-memory-lab@0.1.0-lab.0 \
56
+ --registry https://gitlab.elefai.com.br/api/v4/projects/53/packages/npm/
57
+ ```
58
+
59
+ Em ambiente privado, configure antes um token com permissao de leitura de pacotes:
60
+
61
+ ```bash
62
+ npm config set @elefai:registry https://gitlab.elefai.com.br/api/v4/projects/53/packages/npm/
63
+ npm config set //gitlab.elefai.com.br/api/v4/projects/53/packages/npm/:_authToken SEU_TOKEN
64
+ npm install @elefai/n8n-nodes-elefaibrain-memory-lab@0.1.0-lab.0
65
+ ```
@@ -0,0 +1,10 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class Mem0Api implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=Mem0Api.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mem0Api.credentials.d.ts","sourceRoot":"","sources":["../../credentials/Mem0Api.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,OAAQ,YAAW,eAAe;IAC9C,IAAI,SAAa;IACjB,WAAW,SAAc;IACzB,gBAAgB,SAAwC;IACxD,UAAU,EAAE,eAAe,EAAE,CAwB3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAM1B;CACF"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Mem0Api = void 0;
4
+ class Mem0Api {
5
+ constructor() {
6
+ this.name = 'mem0Api';
7
+ this.displayName = 'Mem0 API';
8
+ this.documentationUrl = 'https://docs.mem0.ai/api-reference';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: { password: true },
15
+ default: '',
16
+ required: true,
17
+ description: 'Your Mem0 API key. Get it from https://app.mem0.ai/dashboard/api-keys.',
18
+ },
19
+ {
20
+ displayName: 'Organization ID',
21
+ name: 'orgId',
22
+ type: 'string',
23
+ default: '',
24
+ description: 'Optional: Your Mem0 Organization ID',
25
+ },
26
+ {
27
+ displayName: 'Project ID',
28
+ name: 'projectId',
29
+ type: 'string',
30
+ default: '',
31
+ description: 'Optional: Your Mem0 Project ID',
32
+ },
33
+ ];
34
+ this.authenticate = {
35
+ type: 'generic',
36
+ properties: {
37
+ headers: {
38
+ 'Authorization': '=Token {{$credentials.apiKey}}',
39
+ },
40
+ },
41
+ };
42
+ this.test = {
43
+ request: {
44
+ baseURL: 'https://api.mem0.ai',
45
+ url: '/v1/entities/',
46
+ method: 'GET',
47
+ },
48
+ };
49
+ }
50
+ }
51
+ exports.Mem0Api = Mem0Api;
52
+ //# sourceMappingURL=Mem0Api.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mem0Api.credentials.js","sourceRoot":"","sources":["../../credentials/Mem0Api.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACC,SAAI,GAAG,SAAS,CAAC;QACjB,gBAAW,GAAG,UAAU,CAAC;QACzB,qBAAgB,GAAG,oCAAoC,CAAC;QACxD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,wEAAwE;aACrF;YACD;gBACC,WAAW,EAAE,iBAAiB;gBAC9B,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,qCAAqC;aAClD;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,gCAAgC;aAC7C;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,eAAe,EAAE,gCAAgC;iBACjD;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,qBAAqB;gBAC9B,GAAG,EAAE,eAAe;gBACpB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AA9CD,0BA8CC"}
@@ -0,0 +1,10 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class Mem0SelfHostedApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=Mem0SelfHostedApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mem0SelfHostedApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/Mem0SelfHostedApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,iBAAkB,YAAW,eAAe;IACxD,IAAI,SAAuB;IAC3B,WAAW,SAA0B;IACrC,gBAAgB,SAAsC;IACtD,UAAU,EAAE,eAAe,EAAE,CAiB3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAM1B;CACF"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Mem0SelfHostedApi = void 0;
4
+ class Mem0SelfHostedApi {
5
+ constructor() {
6
+ this.name = 'mem0SelfHostedApi';
7
+ this.displayName = 'Mem0 Self-Hosted API';
8
+ this.documentationUrl = 'https://docs.mem0.ai/open-source';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Base URL',
12
+ name: 'baseUrl',
13
+ type: 'string',
14
+ default: 'http://localhost:8000',
15
+ required: true,
16
+ description: 'The base URL of your self-hosted Mem0 instance',
17
+ },
18
+ {
19
+ displayName: 'API Key',
20
+ name: 'apiKey',
21
+ type: 'string',
22
+ typeOptions: { password: true },
23
+ default: '',
24
+ description: 'API key if authentication enabled',
25
+ },
26
+ ];
27
+ this.authenticate = {
28
+ type: 'generic',
29
+ properties: {
30
+ headers: {
31
+ 'Authorization': '={{$credentials.apiKey ? "Token " + $credentials.apiKey : ""}}',
32
+ },
33
+ },
34
+ };
35
+ this.test = {
36
+ request: {
37
+ baseURL: '={{$credentials.baseUrl}}',
38
+ url: '/v1/entities/',
39
+ method: 'GET',
40
+ },
41
+ };
42
+ }
43
+ }
44
+ exports.Mem0SelfHostedApi = Mem0SelfHostedApi;
45
+ //# sourceMappingURL=Mem0SelfHostedApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mem0SelfHostedApi.credentials.js","sourceRoot":"","sources":["../../credentials/Mem0SelfHostedApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,iBAAiB;IAA9B;QACC,SAAI,GAAG,mBAAmB,CAAC;QAC3B,gBAAW,GAAG,sBAAsB,CAAC;QACrC,qBAAgB,GAAG,kCAAkC,CAAC;QACtD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,gDAAgD;aAC7D;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,mCAAmC;aAChD;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,eAAe,EAAE,gEAAgE;iBACjF;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,eAAe;gBACpB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AAvCD,8CAuCC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, ILoadOptionsFunctions, IHookFunctions, IWebhookFunctions, IHttpRequestMethods } from 'n8n-workflow';
2
+ export declare function mem0ApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: IHttpRequestMethods, endpoint: string, body?: any, qs?: any): Promise<any>;
3
+ //# sourceMappingURL=GenericFunctions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.d.ts","sourceRoot":"","sources":["../../../nodes/Mem0/GenericFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EAGnB,MAAM,cAAc,CAAC;AAEtB,wBAAsB,cAAc,CACnC,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,GAAG,cAAc,GAAG,iBAAiB,EACpF,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,GAAQ,EACd,EAAE,GAAE,GAAQ,GACV,OAAO,CAAC,GAAG,CAAC,CAyCd"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mem0ApiRequest = mem0ApiRequest;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ async function mem0ApiRequest(method, endpoint, body = {}, qs = {}) {
6
+ // Support both Portuguese parameter name used in CRUD node and English used in Memory node
7
+ let authenticationType;
8
+ try {
9
+ authenticationType = this.getNodeParameter('tipoAutenticacao', 0);
10
+ }
11
+ catch (e) {
12
+ authenticationType = this.getNodeParameter('authType', 0) || 'nuvem';
13
+ // Map to legacy values used below
14
+ if (authenticationType === 'cloud')
15
+ authenticationType = 'nuvem';
16
+ if (authenticationType === 'selfHosted')
17
+ authenticationType = 'selfHosted';
18
+ }
19
+ let credentials;
20
+ let baseUrl;
21
+ if (authenticationType === 'nuvem') {
22
+ credentials = await this.getCredentials('mem0Api');
23
+ baseUrl = 'https://api.mem0.ai';
24
+ }
25
+ else {
26
+ credentials = await this.getCredentials('mem0SelfHostedApi');
27
+ baseUrl = credentials.baseUrl.replace(/\/$/, ''); // Remove trailing slash
28
+ }
29
+ const options = {
30
+ method,
31
+ body,
32
+ qs,
33
+ url: `${baseUrl}${endpoint}`,
34
+ json: true,
35
+ };
36
+ if (credentials.apiKey) {
37
+ options.headers = {
38
+ 'Authorization': `Token ${credentials.apiKey}`,
39
+ };
40
+ }
41
+ try {
42
+ return await this.helpers.request(options);
43
+ }
44
+ catch (error) {
45
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
46
+ }
47
+ }
48
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","s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AAE,SAAS,WAAW,CAAC,MAAM,EAAE;SAC9C,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACJ,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACrB,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;AACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Mem0 implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
6
+ //# sourceMappingURL=Mem0.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mem0.node.d.ts","sourceRoot":"","sources":["../../../nodes/Mem0/Mem0.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,MAAM,cAAc,CAAC;AAiBtB,qBAAa,IAAK,YAAW,SAAS;IACrC,WAAW,EAAE,oBAAoB,CA6yB/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAkVvE"}