n8n-nodes-2kw 6.2.0-dev.3 → 6.2.0-dev.42
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 +35 -1
- package/dist/nodes/TwoKw/TwoKw.node.js +4 -0
- package/dist/nodes/TwoKw/TwoKw.node.js.map +1 -1
- package/dist/nodes/TwoKw/descriptions/agent.d.ts +3 -0
- package/dist/nodes/TwoKw/descriptions/agent.js +182 -0
- package/dist/nodes/TwoKw/descriptions/agent.js.map +1 -0
- package/dist/nodes/TwoKw/descriptions/index.js +4 -0
- package/dist/nodes/TwoKw/descriptions/index.js.map +1 -1
- package/dist/nodes/TwoKw/methods.d.ts +2 -0
- package/dist/nodes/TwoKw/methods.js +15 -0
- package/dist/nodes/TwoKw/methods.js.map +1 -1
- package/dist/nodes/TwoKw/operations/agent.d.ts +54 -0
- package/dist/nodes/TwoKw/operations/agent.js +319 -0
- package/dist/nodes/TwoKw/operations/agent.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,10 +29,12 @@ n8n's credential test calls `GET /v1/models` against your base URL — if it suc
|
|
|
29
29
|
|
|
30
30
|
Drop the **2kw** node into a workflow. Pick a Resource and Operation.
|
|
31
31
|
|
|
32
|
-
Schema, Prompt, Schema Version, and Prompt Label fields are **searchable dropdowns** populated from the 2kw API on demand. Switch
|
|
32
|
+
Agent, Label, Schema, Prompt, Schema Version, and Prompt Label fields are **searchable dropdowns** populated from the 2kw API on demand. Switch a field to its manual mode (**By ID**, **By ID or Name**, or **By Name**) to paste a value or use an n8n expression instead.
|
|
33
33
|
|
|
34
34
|
| Resource | Operation | Notes |
|
|
35
35
|
| --- | --- | --- |
|
|
36
|
+
| Agent | Decide Approval | Approves or rejects every pending approval of a paused run and continues it. Required: `Agent`, `Response ID`, `Decision` (`Approve All` / `Reject All`, default reject). Optional: `Label` (the one the run used), `Reason`, `Remember for Conversation` (approvals only). Options: `Return Paused Runs`, `Simplify Output`. See [Human approval from a workflow](#human-approval-from-a-workflow). |
|
|
37
|
+
| Agent | Send Message | Runs one turn of a stored agent. `Agent` and `Label` are pickers (empty label = latest). Options: `Binary Properties` (comma-separated, uploaded as attachments), `Conversation ID`, `Previous Response ID`, `Return Paused Runs`, `Simplify Output`. Fails if the agent pauses unless `Return Paused Runs` is on — see [Agents in n8n](#agents-in-n8n). |
|
|
36
38
|
| Schema | Get | Searchable picker. Returns schema metadata + active version. |
|
|
37
39
|
| Prompt | Get | Searchable picker. Returns prompt metadata. |
|
|
38
40
|
| Prompt | Compile | Compiles a prompt with a `Variables` JSON map. Optional `Version ID` (string) or `Label` (picker, depends on prompt). |
|
|
@@ -44,6 +46,34 @@ Schema, Prompt, Schema Version, and Prompt Label fields are **searchable dropdow
|
|
|
44
46
|
| Document | Convert From Source | URL or base64 (no binary upload). Same `Output Formats` + per-document item split as Convert. Pipeline option: fast / ocr / vlm. |
|
|
45
47
|
| Transcription | Transcribe | Multipart audio upload. Required: `Model`. Optional: `Language`, `Prompt`, `Response Format`, `Temperature`. |
|
|
46
48
|
|
|
49
|
+
## Agents in n8n
|
|
50
|
+
|
|
51
|
+
**Agent › Send Message** runs one turn of an agent you built in 2kw and returns its answer as `text`, together with `status`, `responseId`, `conversationId`, `model` and `usage`. Pass `conversationId` (or `responseId` as *Previous Response ID*) to a later Send Message to continue the thread. Files from binary properties are uploaded and attached to the message; images reach the model as pixels.
|
|
52
|
+
|
|
53
|
+
**n8n runs agents unattended by default.** When an agent's policy wants a human to approve a tool call, the run pauses and this operation fails with the tools that are waiting, for example `Agent paused for approval: create_invoice (apreq_…)`. To ask a person instead, see [Human approval from a workflow](#human-approval-from-a-workflow). For agents you call from n8n, use tools their policy lets run without a human decision — once auto-approval is available, set `classes.write` to `auto` in the agent's policy. A run that asks for a client-side tool fails the same way (`Agent requested client-side tool …`), because n8n cannot execute it. A run that stops early (`status: incomplete`, e.g. too many tool iterations) is returned, not failed; check `incompleteReason`. Leave *Retry On Fail* off for agents with write tools: a timed-out turn may still be running, and a retry repeats its tool calls.
|
|
54
|
+
|
|
55
|
+
### Human approval from a workflow
|
|
56
|
+
|
|
57
|
+
To put a person in the loop instead of failing, turn on **Return Paused Runs** in Send Message. A run that pauses for approval then comes out as an item with `status: requires_action`, its `responseId`, and `pendingApprovals` — one entry per waiting call, with `approvalId`, `tool`, `arguments`, `policyClass` and `reason` (why the auto-approver escalated it, or `null`). Route on `status` with an IF node, ask a person with any Send-and-Wait node (Slack, email, Telegram), and pass the answer to **Agent › Decide Approval**:
|
|
58
|
+
|
|
59
|
+
- **Agent** and **Label**: the same agent and label the run used. The platform resolves the approved calls' tools from the continued version.
|
|
60
|
+
- **Response ID**: `{{ $json.responseId }}` from the paused item.
|
|
61
|
+
- **Decision**: `Approve All` or `Reject All`, or an expression returning `approve` or `reject`. It applies to every pending approval of the response; the platform accepts a continuation only when all of them are decided.
|
|
62
|
+
- **Reason**: optional. It is recorded on each decision, and on a rejection the agent reads it.
|
|
63
|
+
- **Remember for Conversation**: approvals only. Later calls of the same tools in this conversation run without asking. Destructive tools are approved once and never remembered.
|
|
64
|
+
|
|
65
|
+
Decide Approval reads the pending approvals from `GET /v1/agents/{agentId}/approvals?status=pending`, sends one `backbone:approval_response` per approval on `POST /v1/responses` with `previous_response_id`, and returns the continued run in Send Message's output shape. A continued run can pause again; with Return Paused Runs on it comes out the same way, so a loop back to the person works.
|
|
66
|
+
|
|
67
|
+
It fails the item when:
|
|
68
|
+
|
|
69
|
+
- nothing is pending on the response: already decided by a person, a conversation grant or the auto-approver, or the ID is not a paused run of this agent;
|
|
70
|
+
- the platform refuses the decision, for example because an approval was decided automatically (`2kw refused the decision on response …`) or is no longer pending;
|
|
71
|
+
- the continued run asks for a client-side tool, which n8n still cannot execute. A turn can wait for approvals and a client-side tool at once; deciding the approvals does not run the client-side tool.
|
|
72
|
+
|
|
73
|
+
Approvals remain a human decision. Do not give Decide Approval to an AI Agent as a tool, and do not wire it to approve without asking someone. For tools that should run without a person, set `classes.write` to `auto` in the agent's policy once auto-approval is available.
|
|
74
|
+
|
|
75
|
+
**Using n8n's OpenAI node instead.** With the OpenAI credential set up as below, *OpenAI › Message a Model* (n8n 1.117 or later) can call an agent too: pick the model **By ID** and enter `agent/<name>` or `agent/<name>@<label>`. That is fine for text-only turns with agents that never pause. It cannot attach files, and its default *Simplify* setting hides a paused run — the workflow receives empty output and carries on. The OpenAI *Chat Model* inside n8n's AI Agent is not supported for agents: with a streaming trigger it requests streaming, which the 2kw Responses API does not offer yet.
|
|
76
|
+
|
|
47
77
|
## Chat completions (via n8n's OpenAI node)
|
|
48
78
|
|
|
49
79
|
The 2kw API exposes an OpenAI-compatible `/v1/chat/completions` endpoint. To use chat models, embeddings, vision, tool calling, or n8n's AI Agent against 2kw, **use n8n's built-in OpenAI node** rather than this package — that gives you the full OpenAI surface for free.
|
|
@@ -89,6 +119,10 @@ Prereleases publish under the `dev` dist-tag (`npm install n8n-nodes-2kw@dev`),
|
|
|
89
119
|
|
|
90
120
|
## Changelog
|
|
91
121
|
|
|
122
|
+
### Unreleased
|
|
123
|
+
- Added Agent › Send Message: agent and label pickers, file attachments, loud failure when the agent pauses for approval.
|
|
124
|
+
- Added Agent › Decide Approval: approve or reject every pending approval of a paused run and continue it. Send Message and Decide Approval gained `Return Paused Runs`, which returns an approval pause as an item with `pendingApprovals` instead of failing.
|
|
125
|
+
|
|
92
126
|
Entries below `1.0.0` predate npm publication and use the node's own numbering.
|
|
93
127
|
|
|
94
128
|
### 0.3.0
|
|
@@ -11,6 +11,7 @@ const prompt_1 = require("./operations/prompt");
|
|
|
11
11
|
const extraction_1 = require("./operations/extraction");
|
|
12
12
|
const document_1 = require("./operations/document");
|
|
13
13
|
const transcription_1 = require("./operations/transcription");
|
|
14
|
+
const agent_1 = require("./operations/agent");
|
|
14
15
|
const resourceHandlers = {};
|
|
15
16
|
function registerResource(name, handler) {
|
|
16
17
|
resourceHandlers[name] = handler;
|
|
@@ -78,4 +79,7 @@ registerResource('document', async function (itemIndex, operation) {
|
|
|
78
79
|
registerResource('transcription', async function (itemIndex, operation) {
|
|
79
80
|
return transcription_1.executeTranscription.call(this, itemIndex, operation);
|
|
80
81
|
});
|
|
82
|
+
registerResource('agent', async function (itemIndex, operation) {
|
|
83
|
+
return agent_1.executeAgent.call(this, itemIndex, operation);
|
|
84
|
+
});
|
|
81
85
|
//# sourceMappingURL=TwoKw.node.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TwoKw.node.js","sourceRoot":"","sources":["../../../nodes/TwoKw/TwoKw.node.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TwoKw.node.js","sourceRoot":"","sources":["../../../nodes/TwoKw/TwoKw.node.ts"],"names":[],"mappings":";;;AA0BA,4CAEC;AA5BD,+CAOsB;AACtB,iDAAmE;AACnE,qCAAuC;AACvC,uCAAoC;AACpC,gDAAoD;AACpD,gDAAoD;AACpD,wDAA4D;AAC5D,oDAAwD;AACxD,8DAAkE;AAClE,8CAAkD;AAQlD,MAAM,gBAAgB,GAAoC,EAAE,CAAC;AAE7D,SAAgB,gBAAgB,CAAC,IAAY,EAAE,OAAwB;IACrE,gBAAgB,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AACnC,CAAC;AAED,MAAa,KAAK;IAChB,WAAW,GAAyB;QAClC,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,oBAAoB,EAAE;QAClE,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,OAAO,EAAE,CAAC;QACV,2EAA2E;QAC3E,uEAAuE;QACvE,uCAAuC;QACvC,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,8DAA8D;QACxE,WAAW,EAAE,4DAA4D;QACzE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;QACzB,MAAM,EAAE,CAAC,MAA4B,CAAC;QACtC,OAAO,EAAE,CA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,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.agentFields = exports.agentOperations = void 0;
|
|
4
|
+
const showSendMessage = { resource: ['agent'], operation: ['sendMessage'] };
|
|
5
|
+
const showDecideApproval = { resource: ['agent'], operation: ['decideApproval'] };
|
|
6
|
+
const showAgentRun = { resource: ['agent'], operation: ['sendMessage', 'decideApproval'] };
|
|
7
|
+
const returnPausedRuns = {
|
|
8
|
+
displayName: 'Return Paused Runs',
|
|
9
|
+
name: 'returnPausedRuns',
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
default: false,
|
|
12
|
+
description: 'Whether to return a run that pauses for approval as an item (status requires_action, with pendingApprovals) instead of failing, so Agent › Decide Approval can continue it',
|
|
13
|
+
};
|
|
14
|
+
const simplifyOutput = {
|
|
15
|
+
displayName: 'Simplify Output',
|
|
16
|
+
name: 'simplify',
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
default: true,
|
|
19
|
+
description: 'Whether to return text, status, IDs and usage instead of the raw response',
|
|
20
|
+
};
|
|
21
|
+
exports.agentOperations = {
|
|
22
|
+
displayName: 'Operation',
|
|
23
|
+
name: 'operation',
|
|
24
|
+
type: 'options',
|
|
25
|
+
noDataExpression: true,
|
|
26
|
+
displayOptions: { show: { resource: ['agent'] } },
|
|
27
|
+
default: 'sendMessage',
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
name: 'Decide Approval',
|
|
31
|
+
value: 'decideApproval',
|
|
32
|
+
description: 'Approve or reject every pending approval of a paused run and continue it',
|
|
33
|
+
action: 'Decide the approvals of a paused agent run',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'Send Message',
|
|
37
|
+
value: 'sendMessage',
|
|
38
|
+
description: 'Run one turn of a stored agent',
|
|
39
|
+
action: 'Send a message to an agent',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
exports.agentFields = [
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Agent',
|
|
46
|
+
name: 'agent',
|
|
47
|
+
type: 'resourceLocator',
|
|
48
|
+
default: { mode: 'list', value: '' },
|
|
49
|
+
required: true,
|
|
50
|
+
displayOptions: { show: showAgentRun },
|
|
51
|
+
description: 'Pick from a list, or enter an agent ID or name',
|
|
52
|
+
modes: [
|
|
53
|
+
{
|
|
54
|
+
displayName: 'From List',
|
|
55
|
+
name: 'list',
|
|
56
|
+
type: 'list',
|
|
57
|
+
typeOptions: { searchListMethod: 'searchAgents', searchable: true },
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'By ID or Name',
|
|
61
|
+
name: 'id',
|
|
62
|
+
type: 'string',
|
|
63
|
+
placeholder: 'support-agent',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Label',
|
|
69
|
+
name: 'label',
|
|
70
|
+
type: 'resourceLocator',
|
|
71
|
+
default: { mode: 'list', value: '' },
|
|
72
|
+
displayOptions: { show: showAgentRun },
|
|
73
|
+
description: 'Optional. Run the agent version this label points at (e.g. "prod"). Empty runs the latest version. To decide approvals, use the label the paused run used. The list needs the agent picked from the list or by ID.',
|
|
74
|
+
modes: [
|
|
75
|
+
{
|
|
76
|
+
displayName: 'From List',
|
|
77
|
+
name: 'list',
|
|
78
|
+
type: 'list',
|
|
79
|
+
typeOptions: { searchListMethod: 'searchAgentLabels', searchable: false },
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'By Name',
|
|
83
|
+
name: 'id',
|
|
84
|
+
type: 'string',
|
|
85
|
+
placeholder: 'prod',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Message',
|
|
91
|
+
name: 'message',
|
|
92
|
+
type: 'string',
|
|
93
|
+
required: true,
|
|
94
|
+
default: '',
|
|
95
|
+
typeOptions: { rows: 4 },
|
|
96
|
+
displayOptions: { show: showSendMessage },
|
|
97
|
+
description: 'The user message the agent answers',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Options',
|
|
101
|
+
name: 'options',
|
|
102
|
+
type: 'collection',
|
|
103
|
+
placeholder: 'Add Option',
|
|
104
|
+
default: {},
|
|
105
|
+
displayOptions: { show: showSendMessage },
|
|
106
|
+
options: [
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Binary Properties',
|
|
109
|
+
name: 'binaryProperties',
|
|
110
|
+
type: 'string',
|
|
111
|
+
default: '',
|
|
112
|
+
placeholder: 'data, invoice',
|
|
113
|
+
description: 'Comma-separated binary properties of the input item to attach as files',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
displayName: 'Conversation ID',
|
|
117
|
+
name: 'conversationId',
|
|
118
|
+
type: 'string',
|
|
119
|
+
default: '',
|
|
120
|
+
description: 'Continue an existing conversation',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
displayName: 'Previous Response ID',
|
|
124
|
+
name: 'previousResponseId',
|
|
125
|
+
type: 'string',
|
|
126
|
+
default: '',
|
|
127
|
+
description: 'Continue from a previous response of this agent',
|
|
128
|
+
},
|
|
129
|
+
returnPausedRuns,
|
|
130
|
+
simplifyOutput,
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Response ID',
|
|
135
|
+
name: 'responseId',
|
|
136
|
+
type: 'string',
|
|
137
|
+
required: true,
|
|
138
|
+
default: '',
|
|
139
|
+
placeholder: 'resp_...',
|
|
140
|
+
displayOptions: { show: showDecideApproval },
|
|
141
|
+
description: 'The paused run to continue: the responseId of a Send Message (or Decide Approval) item returned with Return Paused Runs on',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
displayName: 'Decision',
|
|
145
|
+
name: 'decision',
|
|
146
|
+
type: 'options',
|
|
147
|
+
required: true,
|
|
148
|
+
default: 'reject',
|
|
149
|
+
displayOptions: { show: showDecideApproval },
|
|
150
|
+
description: 'Applied to every pending approval of the response; the platform accepts a continuation only when all of them are decided',
|
|
151
|
+
options: [
|
|
152
|
+
{ name: 'Approve All', value: 'approve', description: 'Let every waiting tool call run' },
|
|
153
|
+
{ name: 'Reject All', value: 'reject', description: 'Refuse every waiting tool call; the agent is told' },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
displayName: 'Reason',
|
|
158
|
+
name: 'reason',
|
|
159
|
+
type: 'string',
|
|
160
|
+
default: '',
|
|
161
|
+
displayOptions: { show: showDecideApproval },
|
|
162
|
+
description: 'Optional. Recorded on every decision; on a rejection the agent reads it.',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
displayName: 'Remember for Conversation',
|
|
166
|
+
name: 'rememberForConversation',
|
|
167
|
+
type: 'boolean',
|
|
168
|
+
default: false,
|
|
169
|
+
displayOptions: { show: { ...showDecideApproval, decision: ['approve'] } },
|
|
170
|
+
description: 'Whether to also approve later calls of the same tools in this conversation without asking. Destructive tools are approved once and never remembered.',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
displayName: 'Options',
|
|
174
|
+
name: 'decideOptions',
|
|
175
|
+
type: 'collection',
|
|
176
|
+
placeholder: 'Add Option',
|
|
177
|
+
default: {},
|
|
178
|
+
displayOptions: { show: showDecideApproval },
|
|
179
|
+
options: [returnPausedRuns, simplifyOutput],
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../nodes/TwoKw/descriptions/agent.ts"],"names":[],"mappings":";;;AAEA,MAAM,eAAe,GAAG,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;AAC5E,MAAM,kBAAkB,GAAG,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,S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I,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC5C,WAAW,EAAE,0EAA0E;KACxF;IACD;QACE,WAAW,EAAE,2BAA2B;QACxC,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,kBAAkB,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;QAC1E,WAAW,EACT,sJAAsJ;KACzJ;IACD;QACE,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC5C,OAAO,EAAE,CAAC,gBAAgB,EAAE,cAAc,CAAC;KAC5C;CACF,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resourceProperties = exports.resourceField = void 0;
|
|
4
|
+
const agent_1 = require("./agent");
|
|
4
5
|
const schema_1 = require("./schema");
|
|
5
6
|
const prompt_1 = require("./prompt");
|
|
6
7
|
const extraction_1 = require("./extraction");
|
|
@@ -15,6 +16,7 @@ exports.resourceField = {
|
|
|
15
16
|
// Alphabetical, not workflow order: n8n's community-node scan enforces
|
|
16
17
|
// `node-param-options-type-unsorted-items` (#363).
|
|
17
18
|
options: [
|
|
19
|
+
{ name: 'Agent', value: 'agent' },
|
|
18
20
|
{ name: 'Document', value: 'document' },
|
|
19
21
|
{ name: 'Extraction', value: 'extraction' },
|
|
20
22
|
{ name: 'Prompt', value: 'prompt' },
|
|
@@ -33,5 +35,7 @@ exports.resourceProperties = [
|
|
|
33
35
|
...document_1.documentFields,
|
|
34
36
|
transcription_1.transcriptionOperations,
|
|
35
37
|
...transcription_1.transcriptionFields,
|
|
38
|
+
agent_1.agentOperations,
|
|
39
|
+
...agent_1.agentFields,
|
|
36
40
|
];
|
|
37
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/TwoKw/descriptions/index.ts"],"names":[],"mappings":";;;AACA,qCAA0D;AAC1D,qCAA0D;AAC1D,6CAAsE;AACtE,yCAAgE;AAChE,mDAA+E;AAElE,QAAA,aAAa,GAAoB;IAC5C,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE,QAAQ;IACjB,uEAAuE;IACvE,mDAAmD;IACnD,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;QACvC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;QAC3C,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACnC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;KAClD;CACF,CAAC;AAEW,QAAA,kBAAkB,GAAsB;IACnD,yBAAgB;IAChB,GAAG,qBAAY;IACf,yBAAgB;IAChB,GAAG,qBAAY;IACf,iCAAoB;IACpB,GAAG,6BAAgB;IACnB,6BAAkB;IAClB,GAAG,yBAAc;IACjB,uCAAuB;IACvB,GAAG,mCAAmB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/TwoKw/descriptions/index.ts"],"names":[],"mappings":";;;AACA,mCAAuD;AACvD,qCAA0D;AAC1D,qCAA0D;AAC1D,6CAAsE;AACtE,yCAAgE;AAChE,mDAA+E;AAElE,QAAA,aAAa,GAAoB;IAC5C,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE,QAAQ;IACjB,uEAAuE;IACvE,mDAAmD;IACnD,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QACjC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;QACvC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;QAC3C,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACnC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;KAClD;CACF,CAAC;AAEW,QAAA,kBAAkB,GAAsB;IACnD,yBAAgB;IAChB,GAAG,qBAAY;IACf,yBAAgB;IAChB,GAAG,qBAAY;IACf,iCAAoB;IACpB,GAAG,6BAAgB;IACnB,6BAAkB;IAClB,GAAG,yBAAc;IACjB,uCAAuB;IACvB,GAAG,mCAAmB;IACtB,uBAAe;IACf,GAAG,mBAAW;CACf,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';
|
|
2
2
|
export declare const methods: {
|
|
3
3
|
listSearch: {
|
|
4
|
+
searchAgents(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
5
|
+
searchAgentLabels(this: ILoadOptionsFunctions): Promise<INodeListSearchResult>;
|
|
4
6
|
searchSchemas(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
5
7
|
searchPrompts(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
6
8
|
searchSchemaVersions(this: ILoadOptionsFunctions): Promise<INodeListSearchResult>;
|
|
@@ -29,6 +29,21 @@ function formatVersion(v) {
|
|
|
29
29
|
}
|
|
30
30
|
exports.methods = {
|
|
31
31
|
listSearch: {
|
|
32
|
+
async searchAgents(filter) {
|
|
33
|
+
const data = (await backboneGet(this, '/v1/agents', pageQuery(filter)));
|
|
34
|
+
return {
|
|
35
|
+
results: (data.content ?? []).map((a) => ({ name: a.name, value: a.id })),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
async searchAgentLabels() {
|
|
39
|
+
const agentId = readParentId(this, 'agent');
|
|
40
|
+
if (!agentId)
|
|
41
|
+
return { results: [] };
|
|
42
|
+
const data = (await backboneGet(this, `/v1/agents/${encodeURIComponent(agentId)}/labels`));
|
|
43
|
+
return {
|
|
44
|
+
results: (data ?? []).map((l) => ({ name: l.name, value: l.name })),
|
|
45
|
+
};
|
|
46
|
+
},
|
|
32
47
|
async searchSchemas(filter) {
|
|
33
48
|
const data = (await backboneGet(this, '/v1/schemas', pageQuery(filter)));
|
|
34
49
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../../nodes/TwoKw/methods.ts"],"names":[],"mappings":";;;AACA,2CAAgD;AAOhD,KAAK,UAAU,WAAW,CACxB,GAA0B,EAC1B,IAAY,EACZ,KAAmB;IAEnB,MAAM,WAAW,GAAG,CAAC,MAAM,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAgC,CAAC;IACxF,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAChE,OAAO,GAAG,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE;QACnE,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,GAAG,OAAO,GAAG,IAAI,EAAE;QACxB,EAAE,EAAE,KAAK;QACT,IAA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teFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
interface OutputItem {
|
|
3
|
+
type?: string;
|
|
4
|
+
role?: string;
|
|
5
|
+
content?: {
|
|
6
|
+
type?: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
}[];
|
|
9
|
+
id?: string;
|
|
10
|
+
tool?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
status?: string;
|
|
13
|
+
arguments?: string;
|
|
14
|
+
policy_class?: string;
|
|
15
|
+
reason?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentResponse {
|
|
18
|
+
id: string;
|
|
19
|
+
status: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
output?: OutputItem[];
|
|
22
|
+
usage?: IDataObject | null;
|
|
23
|
+
incomplete_details?: {
|
|
24
|
+
reason?: string;
|
|
25
|
+
} | null;
|
|
26
|
+
conversation?: {
|
|
27
|
+
id?: string;
|
|
28
|
+
} | null;
|
|
29
|
+
}
|
|
30
|
+
/** A `GET /v1/agents/{agentId}/approvals` row; only the fields a decision needs. */
|
|
31
|
+
interface ApprovalRow {
|
|
32
|
+
id?: string;
|
|
33
|
+
responseId?: string;
|
|
34
|
+
hmac?: string;
|
|
35
|
+
policyClass?: string;
|
|
36
|
+
tool?: string;
|
|
37
|
+
}
|
|
38
|
+
/** `agent/<ref>` at the latest label (`agent/<ref>@` if the ref contains `@`), or `agent/<ref>@<label>`. */
|
|
39
|
+
export declare function buildAgentModel(ref: string, label: string): string;
|
|
40
|
+
/** Every assistant `output_text` part, in output order — the resource has no `output_text` field. */
|
|
41
|
+
export declare function responseText(response: AgentResponse): string;
|
|
42
|
+
/**
|
|
43
|
+
* One `backbone:approval_response` per pending approval, with the backend's field
|
|
44
|
+
* names (ApprovalResponseItem). `remember` is sent only on an approval, and never for
|
|
45
|
+
* a destructive call: the backend refuses both (ApprovalDecisionValidator).
|
|
46
|
+
*/
|
|
47
|
+
export declare function approvalResponseItems(rows: ApprovalRow[], decision: 'approve' | 'reject', reason: string, remember: boolean): IDataObject[];
|
|
48
|
+
/** The OpenAI-style `error.code` / `error.message` of a gateway error, wherever n8n put the body. */
|
|
49
|
+
export declare function gatewayError(error: unknown): {
|
|
50
|
+
code?: string;
|
|
51
|
+
message?: string;
|
|
52
|
+
};
|
|
53
|
+
export declare function executeAgent(this: IExecuteFunctions, itemIndex: number, operation: string): Promise<INodeExecutionData[]>;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAgentModel = buildAgentModel;
|
|
4
|
+
exports.responseText = responseText;
|
|
5
|
+
exports.approvalResponseItems = approvalResponseItems;
|
|
6
|
+
exports.gatewayError = gatewayError;
|
|
7
|
+
exports.executeAgent = executeAgent;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
const transport_1 = require("../transport");
|
|
10
|
+
/** `agent/<ref>` at the latest label (`agent/<ref>@` if the ref contains `@`), or `agent/<ref>@<label>`. */
|
|
11
|
+
function buildAgentModel(ref, label) {
|
|
12
|
+
if (label)
|
|
13
|
+
return `agent/${ref}@${label}`;
|
|
14
|
+
return ref.includes('@') ? `agent/${ref}@` : `agent/${ref}`;
|
|
15
|
+
}
|
|
16
|
+
/** Every assistant `output_text` part, in output order — the resource has no `output_text` field. */
|
|
17
|
+
function responseText(response) {
|
|
18
|
+
const parts = [];
|
|
19
|
+
for (const item of response.output ?? []) {
|
|
20
|
+
if (item.type !== 'message' || item.role !== 'assistant')
|
|
21
|
+
continue;
|
|
22
|
+
for (const part of item.content ?? []) {
|
|
23
|
+
if (part.type === 'output_text' && typeof part.text === 'string')
|
|
24
|
+
parts.push(part.text);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return parts.join('\n\n');
|
|
28
|
+
}
|
|
29
|
+
async function uploadAttachments(ctx, itemIndex, binaryProperties) {
|
|
30
|
+
const names = binaryProperties
|
|
31
|
+
.split(',')
|
|
32
|
+
.map((n) => n.trim())
|
|
33
|
+
.filter((n) => n.length > 0);
|
|
34
|
+
const item = ctx.getInputData()[itemIndex];
|
|
35
|
+
// Validate every property before the first upload, so a typo never leaves
|
|
36
|
+
// half the files uploaded for a turn that is not sent.
|
|
37
|
+
const entries = names.map((name) => {
|
|
38
|
+
const entry = item.binary?.[name];
|
|
39
|
+
if (!entry) {
|
|
40
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Binary property "${name}" not found on input item`, { itemIndex });
|
|
41
|
+
}
|
|
42
|
+
return { name, entry };
|
|
43
|
+
});
|
|
44
|
+
const parts = [];
|
|
45
|
+
for (const { name, entry } of entries) {
|
|
46
|
+
const buffer = await ctx.helpers.getBinaryDataBuffer(itemIndex, name);
|
|
47
|
+
const filename = entry.fileName ?? name;
|
|
48
|
+
const file = await (0, transport_1.apiRequest)(ctx, 'POST', '/v1/files', {
|
|
49
|
+
formData: { purpose: 'agent_input' },
|
|
50
|
+
binary: {
|
|
51
|
+
fieldName: 'file',
|
|
52
|
+
buffer,
|
|
53
|
+
filename,
|
|
54
|
+
mimeType: entry.mimeType ?? 'application/octet-stream',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
parts.push({ type: 'input_file', file_id: file.id, filename: file.filename ?? filename });
|
|
58
|
+
}
|
|
59
|
+
return parts;
|
|
60
|
+
}
|
|
61
|
+
const APPROVAL_REQUEST = 'backbone:approval_request';
|
|
62
|
+
const APPROVAL_RESPONSE = 'backbone:approval_response';
|
|
63
|
+
/**
|
|
64
|
+
* Approval requests still waiting for a decision. Requests the auto-approver or a
|
|
65
|
+
* conversation grant already decided carry another status and are not pending (#634).
|
|
66
|
+
*/
|
|
67
|
+
function pendingApprovalItems(response) {
|
|
68
|
+
return (response.output ?? []).filter((item) => item.type === APPROVAL_REQUEST && item.status === 'in_progress');
|
|
69
|
+
}
|
|
70
|
+
function simplify(response) {
|
|
71
|
+
const json = {
|
|
72
|
+
text: responseText(response),
|
|
73
|
+
status: response.status,
|
|
74
|
+
responseId: response.id,
|
|
75
|
+
conversationId: response.conversation?.id ?? null,
|
|
76
|
+
model: response.model,
|
|
77
|
+
usage: response.usage ?? null,
|
|
78
|
+
};
|
|
79
|
+
if (response.status === 'incomplete') {
|
|
80
|
+
json.incompleteReason = response.incomplete_details?.reason ?? null;
|
|
81
|
+
}
|
|
82
|
+
if (response.status === 'requires_action') {
|
|
83
|
+
json.pendingApprovals = pendingApprovalItems(response).map((item) => ({
|
|
84
|
+
approvalId: item.id ?? null,
|
|
85
|
+
tool: item.tool ?? null,
|
|
86
|
+
arguments: item.arguments ?? null,
|
|
87
|
+
policyClass: item.policy_class ?? null,
|
|
88
|
+
reason: item.reason ?? null,
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
return json;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* n8n runs agents unattended (spec D2): a turn that waits for a human or for a
|
|
95
|
+
* client-side tool fails the item loudly instead of reaching the workflow as
|
|
96
|
+
* empty output. With Return Paused Runs on, an approval pause is returned as an
|
|
97
|
+
* item instead, for a later Decide Approval (#660); a relay pause still fails.
|
|
98
|
+
*/
|
|
99
|
+
function assertNotPaused(ctx, response, itemIndex, returnPausedRuns) {
|
|
100
|
+
if (response.status === 'completed' || response.status === 'incomplete')
|
|
101
|
+
return;
|
|
102
|
+
const output = response.output ?? [];
|
|
103
|
+
if (response.status === 'requires_action') {
|
|
104
|
+
const pending = pendingApprovalItems(response);
|
|
105
|
+
if (pending.length > 0) {
|
|
106
|
+
if (returnPausedRuns)
|
|
107
|
+
return;
|
|
108
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Agent paused for approval: ${pending.map((a) => `${a.tool} (${a.id})`).join(', ')}`, {
|
|
109
|
+
itemIndex,
|
|
110
|
+
description: `Response ${response.id} is waiting for a human decision, and n8n runs agents unattended. ` +
|
|
111
|
+
"Change this agent's hitlPolicy so these tools no longer require approval " +
|
|
112
|
+
'(set `classes.write` to `auto` once auto-approval is available), ' +
|
|
113
|
+
'or remove them from agents you call from n8n.',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// Server tools that already ran precede the relay calls as completed
|
|
117
|
+
// function_call items; only the in_progress ones wait for the caller.
|
|
118
|
+
const relays = output.filter((item) => item.type === 'function_call' && item.status === 'in_progress');
|
|
119
|
+
if (relays.length > 0) {
|
|
120
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Agent requested client-side tool ${relays.map((r) => r.name).join(', ')}, which n8n cannot execute`, {
|
|
121
|
+
itemIndex,
|
|
122
|
+
description: `Response ${response.id} is waiting for the caller to run these tools.`,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Agent run ended with unexpected status "${response.status}"`, { itemIndex, description: `Response ${response.id}.` });
|
|
127
|
+
}
|
|
128
|
+
function runResult(ctx, response, itemIndex, options) {
|
|
129
|
+
assertNotPaused(ctx, response, itemIndex, options.returnPausedRuns === true);
|
|
130
|
+
const json = options.simplify === false ? response : simplify(response);
|
|
131
|
+
return [{ json, pairedItem: itemIndex }];
|
|
132
|
+
}
|
|
133
|
+
async function sendMessage(ctx, itemIndex) {
|
|
134
|
+
const ref = (0, transport_1.extractResourceId)(ctx.getNodeParameter('agent', itemIndex)).trim();
|
|
135
|
+
const label = (0, transport_1.extractResourceId)(ctx.getNodeParameter('label', itemIndex, '')).trim();
|
|
136
|
+
const message = ctx.getNodeParameter('message', itemIndex);
|
|
137
|
+
const options = ctx.getNodeParameter('options', itemIndex, {});
|
|
138
|
+
const content = [{ type: 'input_text', text: message }];
|
|
139
|
+
if (options.binaryProperties) {
|
|
140
|
+
content.push(...(await uploadAttachments(ctx, itemIndex, options.binaryProperties)));
|
|
141
|
+
}
|
|
142
|
+
const body = {
|
|
143
|
+
model: buildAgentModel(ref, label),
|
|
144
|
+
input: [{ type: 'message', role: 'user', content }],
|
|
145
|
+
};
|
|
146
|
+
const conversationId = options.conversationId?.trim();
|
|
147
|
+
const previousResponseId = options.previousResponseId?.trim();
|
|
148
|
+
if (conversationId)
|
|
149
|
+
body.conversation = conversationId;
|
|
150
|
+
if (previousResponseId)
|
|
151
|
+
body.previous_response_id = previousResponseId;
|
|
152
|
+
const response = await (0, transport_1.apiRequest)(ctx, 'POST', '/v1/responses', { body });
|
|
153
|
+
return runResult(ctx, response, itemIndex, options);
|
|
154
|
+
}
|
|
155
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
156
|
+
const PAGE_SIZE = 100;
|
|
157
|
+
const MAX_PAGES = 50;
|
|
158
|
+
/**
|
|
159
|
+
* The approvals listing is addressed by agent id only, while the Agent field also
|
|
160
|
+
* takes a name. A name is matched exactly; the API offers only a substring search.
|
|
161
|
+
*/
|
|
162
|
+
async function resolveAgentId(ctx, ref, itemIndex) {
|
|
163
|
+
if (UUID.test(ref))
|
|
164
|
+
return ref;
|
|
165
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
166
|
+
const data = await (0, transport_1.apiRequest)(ctx, 'GET', '/v1/agents', {
|
|
167
|
+
query: { search: ref, page, size: PAGE_SIZE, sort: 'id,asc' },
|
|
168
|
+
});
|
|
169
|
+
const content = data?.content ?? [];
|
|
170
|
+
const hit = content.find((a) => a.name === ref);
|
|
171
|
+
if (hit)
|
|
172
|
+
return hit.id;
|
|
173
|
+
if (data?.last !== false || content.length === 0)
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Agent "${ref}" not found`, { itemIndex });
|
|
177
|
+
}
|
|
178
|
+
async function pendingApprovalRows(ctx, agentId, responseId) {
|
|
179
|
+
const rows = [];
|
|
180
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
181
|
+
const data = await (0, transport_1.apiRequest)(ctx, 'GET', '/v1/agents/{agentId}/approvals', {
|
|
182
|
+
pathParams: { agentId },
|
|
183
|
+
query: { status: 'pending', page, size: PAGE_SIZE },
|
|
184
|
+
});
|
|
185
|
+
const content = data?.content ?? [];
|
|
186
|
+
rows.push(...content.filter((row) => row.responseId === responseId));
|
|
187
|
+
if (data?.last !== false || content.length === 0)
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
return rows;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* One `backbone:approval_response` per pending approval, with the backend's field
|
|
194
|
+
* names (ApprovalResponseItem). `remember` is sent only on an approval, and never for
|
|
195
|
+
* a destructive call: the backend refuses both (ApprovalDecisionValidator).
|
|
196
|
+
*/
|
|
197
|
+
function approvalResponseItems(rows, decision, reason, remember) {
|
|
198
|
+
return rows.map((row) => {
|
|
199
|
+
const item = {
|
|
200
|
+
type: APPROVAL_RESPONSE,
|
|
201
|
+
approval_id: row.id,
|
|
202
|
+
decision,
|
|
203
|
+
hmac: row.hmac,
|
|
204
|
+
};
|
|
205
|
+
if (reason)
|
|
206
|
+
item.reason = reason;
|
|
207
|
+
if (remember && decision === 'approve' && (row.policyClass ?? '').toUpperCase() !== 'DESTRUCTIVE') {
|
|
208
|
+
item.remember = 'conversation';
|
|
209
|
+
}
|
|
210
|
+
return item;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/** The OpenAI-style `error.code` / `error.message` of a gateway error, wherever n8n put the body. */
|
|
214
|
+
function gatewayError(error) {
|
|
215
|
+
const e = error;
|
|
216
|
+
const candidates = [
|
|
217
|
+
e?.context?.data,
|
|
218
|
+
e?.errorResponse?.response?.data,
|
|
219
|
+
e?.errorResponse?.response?.body,
|
|
220
|
+
e?.cause?.response?.data,
|
|
221
|
+
e?.cause?.response?.body,
|
|
222
|
+
e?.response?.data,
|
|
223
|
+
e?.response?.body,
|
|
224
|
+
];
|
|
225
|
+
for (const body of candidates) {
|
|
226
|
+
const inner = body?.error;
|
|
227
|
+
if (inner && typeof inner.code === 'string') {
|
|
228
|
+
return { code: inner.code, message: typeof inner.message === 'string' ? inner.message : undefined };
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return {};
|
|
232
|
+
}
|
|
233
|
+
/** Gateway refusals of a decision continuation (approval-gate spec §7), rewritten for a workflow author. */
|
|
234
|
+
function decisionError(ctx, error, itemIndex, responseId) {
|
|
235
|
+
const { code, message } = gatewayError(error);
|
|
236
|
+
const detail = message ? ` ${message}` : '';
|
|
237
|
+
switch (code) {
|
|
238
|
+
case 'invalid_approval_decision':
|
|
239
|
+
return new n8n_workflow_1.NodeOperationError(ctx.getNode(), `2kw refused the decision on response ${responseId}`, {
|
|
240
|
+
itemIndex,
|
|
241
|
+
description: `An approval that was already decided — by the auto-approver or a conversation grant — accepts no decision.${detail}`,
|
|
242
|
+
});
|
|
243
|
+
case 'unknown_approval_id':
|
|
244
|
+
return new n8n_workflow_1.NodeOperationError(ctx.getNode(), `An approval is no longer pending on response ${responseId}`, {
|
|
245
|
+
itemIndex,
|
|
246
|
+
description: `It was cancelled or expired, or this is not the response that raised it.${detail}`,
|
|
247
|
+
});
|
|
248
|
+
case 'incomplete_tool_outputs':
|
|
249
|
+
return new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Response ${responseId} has pending approvals this decision did not cover`, {
|
|
250
|
+
itemIndex,
|
|
251
|
+
description: `Run Decide Approval again to decide them all.${detail}`,
|
|
252
|
+
});
|
|
253
|
+
case 'approval_hmac_mismatch':
|
|
254
|
+
return new n8n_workflow_1.NodeOperationError(ctx.getNode(), `An approval of response ${responseId} does not match its tool call`, {
|
|
255
|
+
itemIndex,
|
|
256
|
+
description: `The approval binds other arguments than the call being released.${detail}`,
|
|
257
|
+
});
|
|
258
|
+
default:
|
|
259
|
+
return error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async function decideApproval(ctx, itemIndex) {
|
|
263
|
+
const ref = (0, transport_1.extractResourceId)(ctx.getNodeParameter('agent', itemIndex)).trim();
|
|
264
|
+
const label = (0, transport_1.extractResourceId)(ctx.getNodeParameter('label', itemIndex, '')).trim();
|
|
265
|
+
const responseId = ctx.getNodeParameter('responseId', itemIndex).trim();
|
|
266
|
+
const decision = ctx.getNodeParameter('decision', itemIndex);
|
|
267
|
+
const reason = ctx.getNodeParameter('reason', itemIndex, '').trim();
|
|
268
|
+
const remember = decision === 'approve' && ctx.getNodeParameter('rememberForConversation', itemIndex, false);
|
|
269
|
+
const options = ctx.getNodeParameter('decideOptions', itemIndex, {});
|
|
270
|
+
if (!responseId) {
|
|
271
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Response ID is required', { itemIndex });
|
|
272
|
+
}
|
|
273
|
+
if (decision !== 'approve' && decision !== 'reject') {
|
|
274
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Decision must be "approve" or "reject", got "${decision}"`, {
|
|
275
|
+
itemIndex,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
const agentId = await resolveAgentId(ctx, ref, itemIndex);
|
|
279
|
+
const rows = await pendingApprovalRows(ctx, agentId, responseId);
|
|
280
|
+
// Never send a continuation without decisions: it would be a new turn, not a decision.
|
|
281
|
+
if (rows.length === 0) {
|
|
282
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `No pending approvals on response ${responseId}`, {
|
|
283
|
+
itemIndex,
|
|
284
|
+
description: 'They were already decided (by a person, a conversation grant or the auto-approver), ' +
|
|
285
|
+
'or the response ID is not a paused run of this agent.',
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
const unbound = rows.find((row) => !row.id || !row.hmac);
|
|
289
|
+
if (unbound) {
|
|
290
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Approval ${unbound.id ?? '?'} carries no binding and cannot be decided`, {
|
|
291
|
+
itemIndex,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
// Continue on the agent id and the run's label: the platform resolves the approved
|
|
295
|
+
// calls' tools from the continuation's version.
|
|
296
|
+
const body = {
|
|
297
|
+
model: buildAgentModel(agentId, label),
|
|
298
|
+
previous_response_id: responseId,
|
|
299
|
+
input: approvalResponseItems(rows, decision, reason, remember),
|
|
300
|
+
};
|
|
301
|
+
let response;
|
|
302
|
+
try {
|
|
303
|
+
response = await (0, transport_1.apiRequest)(ctx, 'POST', '/v1/responses', { body });
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
throw decisionError(ctx, error, itemIndex, responseId);
|
|
307
|
+
}
|
|
308
|
+
return runResult(ctx, response, itemIndex, options);
|
|
309
|
+
}
|
|
310
|
+
async function executeAgent(itemIndex, operation) {
|
|
311
|
+
if (operation === 'sendMessage')
|
|
312
|
+
return sendMessage(this, itemIndex);
|
|
313
|
+
if (operation === 'decideApproval')
|
|
314
|
+
return decideApproval(this, itemIndex);
|
|
315
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown agent operation: ${operation}`, {
|
|
316
|
+
itemIndex,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../nodes/TwoKw/operations/agent.ts"],"names":[],"mappings":";;AA8DA,0CAGC;AAGD,oCASC;AA0ND,sDAmBC;AAGD,oCAuBC;AA4FD,oCAUC;AA1bD,+CAKsB;AACtB,4CAA6D;AAuD7D,4GAA4G;AAC5G,SAAgB,eAAe,CAAC,GAAW,EAAE,KAAa;IACxD,IAAI,KAAK;QAAE,OAAO,SAAS,GAAG,IAAI,KAAK,EAAE,CAAC;IAC1C,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC;AAC9D,CAAC;AAED,qGAAqG;AACrG,SAAgB,YAAY,CAAC,QAAuB;IAClD,MAAM,KAAK,GAAa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,IAAI,SAAS,KAAK,aAAa;QAAE,OAAO,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACrE,IAAI,SAAS,KAAK,gBAAgB;QAAE,OAAO,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC3E,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,4BAA4B,SAAS,EAAE,EAAE;QACpF,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-2kw",
|
|
3
|
-
"version": "6.2.0-dev.
|
|
3
|
+
"version": "6.2.0-dev.42",
|
|
4
4
|
"description": "n8n community node for the 2kw.ai platform (engineering name: Backbone)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@n8n/scan-community-package": "0.32.0",
|
|
60
|
-
"@types/node": "^22.
|
|
60
|
+
"@types/node": "^22.20.1",
|
|
61
61
|
"gulp": "^5.0.1",
|
|
62
62
|
"n8n-workflow": "^1.120.13",
|
|
63
63
|
"tsx": "^4.21.1",
|