@connectorx/n8n-nodes-cortex 0.1.42 → 0.1.44
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 }}',
|
|
@@ -6,16 +6,20 @@ class CortexTrigger {
|
|
|
6
6
|
this.description = {
|
|
7
7
|
displayName: 'Cortex Trigger',
|
|
8
8
|
name: 'cortexTrigger',
|
|
9
|
-
icon: 'file:cortex.
|
|
9
|
+
icon: 'file:cortex.svg',
|
|
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:
|
|
18
|
-
|
|
17
|
+
outputs: `={{(() => {
|
|
18
|
+
const o = [{ type: "main", displayName: "Mensagens Recebidas" }];
|
|
19
|
+
if ($parameter.enablePromptOutput) o.push({ type: "main", displayName: "Prompt Atualizado" });
|
|
20
|
+
if ($parameter.enableAssignmentOutput) o.push({ type: "main", displayName: "Conversa Atribuída" });
|
|
21
|
+
return o;
|
|
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
|
{
|
|
@@ -37,7 +41,21 @@ class CortexTrigger {
|
|
|
37
41
|
{ name: 'Conversation Assigned', value: 'ai_assignment' },
|
|
38
42
|
],
|
|
39
43
|
default: ['*'],
|
|
40
|
-
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: false,
|
|
51
|
+
description: 'Quando LIGADO, eventos de atualização de prompt do agente saem por uma saída dedicada. Quando DESLIGADO, vão para a saída principal (Mensagens Recebidas).',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Saída separada para Conversa Atribuída',
|
|
55
|
+
name: 'enableAssignmentOutput',
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
default: false,
|
|
58
|
+
description: 'Quando LIGADO, eventos de atribuição de conversa a um agente IA saem por uma saída dedicada. Quando DESLIGADO, vão para a saída principal (Mensagens Recebidas).',
|
|
41
59
|
},
|
|
42
60
|
],
|
|
43
61
|
webhooks: [
|
|
@@ -104,8 +122,8 @@ class CortexTrigger {
|
|
|
104
122
|
};
|
|
105
123
|
}
|
|
106
124
|
const events = this.getNodeParameter('events', []);
|
|
107
|
-
const eventType = ((_a = body) === null || _a === void 0 ? void 0 : _a.event) || ((_b = body) === null || _b === void 0 ? void 0 : _b.type) || '
|
|
108
|
-
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)) {
|
|
109
127
|
return {
|
|
110
128
|
webhookResponse: {
|
|
111
129
|
status: 200,
|
|
@@ -113,16 +131,28 @@ class CortexTrigger {
|
|
|
113
131
|
},
|
|
114
132
|
};
|
|
115
133
|
}
|
|
134
|
+
const enablePromptOutput = this.getNodeParameter('enablePromptOutput', false);
|
|
135
|
+
const enableAssignmentOutput = this.getNodeParameter('enableAssignmentOutput', false);
|
|
116
136
|
const outputData = this.helpers.returnJsonArray(body);
|
|
117
|
-
|
|
118
|
-
|
|
137
|
+
const outputCount = 1 + (enablePromptOutput ? 1 : 0) + (enableAssignmentOutput ? 1 : 0);
|
|
138
|
+
const result = new Array(outputCount).fill(null).map(() => []);
|
|
139
|
+
let promptIndex = -1;
|
|
140
|
+
let assignIndex = -1;
|
|
141
|
+
let idx = 1;
|
|
142
|
+
if (enablePromptOutput)
|
|
143
|
+
promptIndex = idx++;
|
|
144
|
+
if (enableAssignmentOutput)
|
|
145
|
+
assignIndex = idx++;
|
|
146
|
+
if (eventType === 'agent_prompt_updated' && promptIndex >= 0) {
|
|
147
|
+
result[promptIndex] = outputData;
|
|
119
148
|
}
|
|
120
|
-
else if (eventType === 'ai_assignment') {
|
|
121
|
-
|
|
149
|
+
else if (eventType === 'ai_assignment' && assignIndex >= 0) {
|
|
150
|
+
result[assignIndex] = outputData;
|
|
122
151
|
}
|
|
123
152
|
else {
|
|
124
|
-
|
|
153
|
+
result[0] = outputData;
|
|
125
154
|
}
|
|
155
|
+
return { workflowData: result };
|
|
126
156
|
}
|
|
127
157
|
return {
|
|
128
158
|
webhookResponse: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#7c3aed"/>
|
|
5
|
+
<stop offset="100%" stop-color="#10b981"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="128" height="128" rx="28" fill="url(#bg)"/>
|
|
9
|
+
<g transform="translate(64,66) scale(0.7)">
|
|
10
|
+
<path d="M-2,-44 C-10,-44 -18,-40 -24,-34 C-30,-28 -34,-20 -34,-12 C-40,-10 -44,-4 -44,4 C-44,10 -42,16 -38,20 C-40,26 -38,34 -32,40 C-26,44 -18,46 -10,46 L0,46z" fill="white" opacity="0.92"/>
|
|
11
|
+
<path d="M2,-44 C10,-44 18,-40 24,-34 C30,-28 34,-20 34,-12 C40,-10 44,-4 44,4 C44,10 42,16 38,20 C40,26 38,34 32,40 C26,44 18,46 10,46 L0,46z" fill="white" opacity="0.78"/>
|
|
12
|
+
<path d="M-22,-18 Q-28,-6 -22,6 Q-16,18 -22,30" stroke="rgba(124,58,237,0.35)" stroke-width="3" fill="none" stroke-linecap="round"/>
|
|
13
|
+
<path d="M-11,-34 Q-18,-18 -13,-4 Q-8,10 -15,24" stroke="rgba(124,58,237,0.25)" stroke-width="2.5" fill="none" stroke-linecap="round"/>
|
|
14
|
+
<path d="M22,-18 Q28,-6 22,6 Q16,18 22,30" stroke="rgba(16,185,129,0.35)" stroke-width="3" fill="none" stroke-linecap="round"/>
|
|
15
|
+
<path d="M11,-34 Q18,-18 13,-4 Q8,10 15,24" stroke="rgba(16,185,129,0.25)" stroke-width="2.5" fill="none" stroke-linecap="round"/>
|
|
16
|
+
<line x1="0" y1="-42" x2="0" y2="44" stroke="rgba(255,255,255,0.15)" stroke-width="1.5"/>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|