@connectorx/n8n-nodes-cortex 0.1.35 → 0.1.37

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.
@@ -41,6 +41,10 @@ class Cortex {
41
41
  name: 'Contact',
42
42
  value: 'contact',
43
43
  },
44
+ {
45
+ name: 'Agent',
46
+ value: 'agent',
47
+ },
44
48
  ],
45
49
  default: 'message',
46
50
  },
@@ -482,6 +486,37 @@ class Cortex {
482
486
  default: '',
483
487
  description: 'Custom properties in JSON format',
484
488
  },
489
+ {
490
+ displayName: 'Operation',
491
+ name: 'operation',
492
+ type: 'options',
493
+ noDataExpression: true,
494
+ displayOptions: { show: { resource: ['agent'] } },
495
+ options: [
496
+ { name: 'List Agents', value: 'listAgents', description: 'List all AI agents' },
497
+ { name: 'Get Prompt', value: 'getPrompt', description: 'Get compiled prompt for an agent' },
498
+ { name: 'Get Active Agent', value: 'getActiveAgent', description: 'Get the active agent for a column' },
499
+ ],
500
+ default: 'listAgents',
501
+ },
502
+ {
503
+ displayName: 'Agent ID',
504
+ name: 'agentId',
505
+ type: 'string',
506
+ required: true,
507
+ displayOptions: { show: { resource: ['agent'], operation: ['getPrompt'] } },
508
+ default: '',
509
+ description: 'The UUID of the agent',
510
+ },
511
+ {
512
+ displayName: 'Column ID',
513
+ name: 'agentColumnId',
514
+ type: 'string',
515
+ required: false,
516
+ displayOptions: { show: { resource: ['agent'], operation: ['getActiveAgent'] } },
517
+ default: '',
518
+ description: 'Optional kanban column ID to resolve column-specific agent',
519
+ },
485
520
  ],
486
521
  };
487
522
  this.methods = {
@@ -781,6 +816,22 @@ class Cortex {
781
816
  options.qs.before = before;
782
817
  }
783
818
  }
819
+ else if (resource === 'agent') {
820
+ if (operation === 'listAgents') {
821
+ options.method = 'GET';
822
+ options.uri = `${baseUrl}/integrations/agents`;
823
+ }
824
+ else if (operation === 'getPrompt') {
825
+ const agentId = this.getNodeParameter('agentId', i);
826
+ options.method = 'GET';
827
+ options.uri = `${baseUrl}/integrations/agents/${agentId}/prompt`;
828
+ }
829
+ else if (operation === 'getActiveAgent') {
830
+ const columnId = this.getNodeParameter('agentColumnId', i);
831
+ options.method = 'GET';
832
+ options.uri = `${baseUrl}/integrations/agents/active${columnId ? '?column_id=' + columnId : ''}`;
833
+ }
834
+ }
784
835
  else if (resource === 'contact') {
785
836
  const contactId = this.getNodeParameter('contactId', i);
786
837
  if (operation === 'get') {
@@ -25,6 +25,18 @@ class CortexTrigger {
25
25
  description: 'The secret token to validate incoming requests. Used for both verification (hub.verify_token) and data reception (Bearer token).',
26
26
  required: true,
27
27
  },
28
+ {
29
+ displayName: 'Events',
30
+ name: 'events',
31
+ type: 'multiOptions',
32
+ options: [
33
+ { name: 'All Events', value: '*' },
34
+ { name: 'New Message', value: 'new_message' },
35
+ { name: 'Agent Prompt Updated', value: 'agent_prompt_updated' },
36
+ ],
37
+ default: ['*'],
38
+ description: 'Which events to listen for. Select specific events or "All Events" to receive everything.',
39
+ },
28
40
  ],
29
41
  webhooks: [
30
42
  {
@@ -43,6 +55,7 @@ class CortexTrigger {
43
55
  };
44
56
  }
45
57
  async webhook() {
58
+ var _a, _b;
46
59
  const httpMethod = this.getRequestObject().method;
47
60
  const query = this.getQueryData();
48
61
  const headers = this.getHeaderData();
@@ -88,6 +101,16 @@ class CortexTrigger {
88
101
  },
89
102
  };
90
103
  }
104
+ const events = this.getNodeParameter('events', []);
105
+ const eventType = ((_a = body) === null || _a === void 0 ? void 0 : _a.event) || ((_b = body) === null || _b === void 0 ? void 0 : _b.type) || '*';
106
+ if (events.length > 0 && !events.includes('*') && !events.includes(eventType)) {
107
+ return {
108
+ webhookResponse: {
109
+ status: 200,
110
+ body: { status: 'ignored', reason: 'event_filtered' },
111
+ },
112
+ };
113
+ }
91
114
  return {
92
115
  workflowData: [
93
116
  this.helpers.returnJsonArray(body),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectorx/n8n-nodes-cortex",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "n8n nodes for Cortex API",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"