@connectorx/n8n-nodes-cortex 0.1.41 → 0.1.43
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.
|
@@ -11,7 +11,7 @@ class CortexApi {
|
|
|
11
11
|
name: 'apiBaseUrl',
|
|
12
12
|
type: 'string',
|
|
13
13
|
default: 'https://api.your-cortex-instance.com',
|
|
14
|
-
description: 'The base URL of the Cortex
|
|
14
|
+
description: 'The base URL of the Cortex API (e.g. https://api.agentecortex.com.br)',
|
|
15
15
|
required: true,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -29,7 +29,7 @@ class CortexApi {
|
|
|
29
29
|
this.test = {
|
|
30
30
|
request: {
|
|
31
31
|
baseURL: '={{$credentials.apiBaseUrl.replace(/\\/$/, "")}}',
|
|
32
|
-
url: '/validate',
|
|
32
|
+
url: '/integrations/validate-token',
|
|
33
33
|
method: 'GET',
|
|
34
34
|
headers: {
|
|
35
35
|
Authorization: '={{ "Bearer " + $credentials.accessToken }}',
|
|
@@ -644,7 +644,7 @@ class Cortex {
|
|
|
644
644
|
const response = await this.helpers.request(options);
|
|
645
645
|
const data = Array.isArray(response) ? response : (response.data || response.users || []);
|
|
646
646
|
return data.map((u) => ({
|
|
647
|
-
name: u.name || u.email || u.id || u.user_id || 'Unknown User',
|
|
647
|
+
name: u.is_ai_agent ? `\u{1F916} ${u.name || 'AI Agent'}` : (u.name || u.email || u.id || u.user_id || 'Unknown User'),
|
|
648
648
|
value: u.id || u.user_id
|
|
649
649
|
})).filter(u => u.value);
|
|
650
650
|
}
|
|
@@ -8,14 +8,18 @@ class CortexTrigger {
|
|
|
8
8
|
name: 'cortexTrigger',
|
|
9
9
|
icon: 'file:cortex.png',
|
|
10
10
|
group: ['trigger'],
|
|
11
|
-
version:
|
|
12
|
-
description: '
|
|
11
|
+
version: 2,
|
|
12
|
+
description: 'Recebe eventos do Cortex via webhook: mensagens, atualizações de prompt e atribuições de conversa.',
|
|
13
13
|
defaults: {
|
|
14
14
|
name: 'Cortex Trigger',
|
|
15
15
|
},
|
|
16
16
|
inputs: [],
|
|
17
|
-
outputs: ['main', 'main'],
|
|
18
|
-
outputNames: [
|
|
17
|
+
outputs: ['main', 'main', 'main'],
|
|
18
|
+
outputNames: [
|
|
19
|
+
'Mensagens Recebidas',
|
|
20
|
+
'Prompt Atualizado',
|
|
21
|
+
'Conversa Atribuída',
|
|
22
|
+
],
|
|
19
23
|
properties: [
|
|
20
24
|
{
|
|
21
25
|
displayName: 'Webhook Secret',
|
|
@@ -23,7 +27,7 @@ class CortexTrigger {
|
|
|
23
27
|
type: 'string',
|
|
24
28
|
default: '',
|
|
25
29
|
placeholder: 'your-secret-token',
|
|
26
|
-
description: '
|
|
30
|
+
description: 'Token secreto para validar requisições. Usado tanto na verificação (hub.verify_token) quanto na recepção de dados (Bearer token).',
|
|
27
31
|
required: true,
|
|
28
32
|
},
|
|
29
33
|
{
|
|
@@ -34,9 +38,24 @@ class CortexTrigger {
|
|
|
34
38
|
{ name: 'All Events', value: '*' },
|
|
35
39
|
{ name: 'New Message', value: 'new_message' },
|
|
36
40
|
{ name: 'Agent Prompt Updated', value: 'agent_prompt_updated' },
|
|
41
|
+
{ name: 'Conversation Assigned', value: 'ai_assignment' },
|
|
37
42
|
],
|
|
38
43
|
default: ['*'],
|
|
39
|
-
description: '
|
|
44
|
+
description: 'Quais eventos escutar. Selecione eventos específicos ou "All Events" para receber tudo.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
displayName: 'Saída separada para Prompt Atualizado',
|
|
48
|
+
name: 'enablePromptOutput',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
default: true,
|
|
51
|
+
description: 'Quando LIGADO, eventos de atualização de prompt do agente saem pela 2ª saída (Prompt Atualizado). Quando DESLIGADO, vão para a 1ª saída (Mensagens Recebidas).',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Saída separada para Conversa Atribuída',
|
|
55
|
+
name: 'enableAssignmentOutput',
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
default: true,
|
|
58
|
+
description: 'Quando LIGADO, eventos de atribuição de conversa a um agente IA saem pela 3ª saída (Conversa Atribuída). Quando DESLIGADO, vão para a 1ª saída (Mensagens Recebidas).',
|
|
40
59
|
},
|
|
41
60
|
],
|
|
42
61
|
webhooks: [
|
|
@@ -103,8 +122,8 @@ class CortexTrigger {
|
|
|
103
122
|
};
|
|
104
123
|
}
|
|
105
124
|
const events = this.getNodeParameter('events', []);
|
|
106
|
-
const eventType = ((_a = body) === null || _a === void 0 ? void 0 : _a.event) || ((_b = body) === null || _b === void 0 ? void 0 : _b.type) || '
|
|
107
|
-
if (events.length > 0 && !events.includes('*') && !events.includes(eventType)) {
|
|
125
|
+
const eventType = String(((_a = body) === null || _a === void 0 ? void 0 : _a.event) || ((_b = body) === null || _b === void 0 ? void 0 : _b.type) || '').trim();
|
|
126
|
+
if (events.length > 0 && !events.includes('*') && eventType && !events.includes(eventType)) {
|
|
108
127
|
return {
|
|
109
128
|
webhookResponse: {
|
|
110
129
|
status: 200,
|
|
@@ -112,12 +131,17 @@ class CortexTrigger {
|
|
|
112
131
|
},
|
|
113
132
|
};
|
|
114
133
|
}
|
|
134
|
+
const enablePromptOutput = this.getNodeParameter('enablePromptOutput', true);
|
|
135
|
+
const enableAssignmentOutput = this.getNodeParameter('enableAssignmentOutput', true);
|
|
115
136
|
const outputData = this.helpers.returnJsonArray(body);
|
|
116
|
-
if (eventType === 'agent_prompt_updated') {
|
|
117
|
-
return { workflowData: [[], outputData] };
|
|
137
|
+
if (eventType === 'agent_prompt_updated' && enablePromptOutput) {
|
|
138
|
+
return { workflowData: [[], outputData, []] };
|
|
139
|
+
}
|
|
140
|
+
else if (eventType === 'ai_assignment' && enableAssignmentOutput) {
|
|
141
|
+
return { workflowData: [[], [], outputData] };
|
|
118
142
|
}
|
|
119
143
|
else {
|
|
120
|
-
return { workflowData: [outputData, []] };
|
|
144
|
+
return { workflowData: [outputData, [], []] };
|
|
121
145
|
}
|
|
122
146
|
}
|
|
123
147
|
return {
|