node-red-contrib-ai-agent 0.5.16 → 0.5.17
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.
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
debug: { value: false }
|
|
14
14
|
},
|
|
15
15
|
inputs: 1,
|
|
16
|
-
outputs:
|
|
17
|
-
outputLabels: ["
|
|
16
|
+
outputs: 2,
|
|
17
|
+
outputLabels: ["Success", "Failure"],
|
|
18
18
|
icon: "font-awesome/fa-sitemap",
|
|
19
19
|
label: function () {
|
|
20
20
|
return this.name || "AI Orchestrator";
|
|
@@ -76,16 +76,20 @@
|
|
|
76
76
|
|
|
77
77
|
<h3>Outputs</h3>
|
|
78
78
|
<ol class="node-ports">
|
|
79
|
-
<li>
|
|
79
|
+
<li>Success
|
|
80
80
|
<dl class="message-properties">
|
|
81
|
-
<dt>msg.payload <span class="property-type">string</span></dt>
|
|
82
|
-
<dd>The
|
|
81
|
+
<dt>msg.payload <span class="property-type">string | object</span></dt>
|
|
82
|
+
<dd>The final successful result once the plan completes.</dd>
|
|
83
|
+
<dt>msg.orchestration <span class="property-type">object</span></dt>
|
|
84
|
+
<dd>Complete orchestration metadata and history.</dd>
|
|
83
85
|
</dl>
|
|
84
86
|
</li>
|
|
85
|
-
<li>
|
|
87
|
+
<li>Failure
|
|
86
88
|
<dl class="message-properties">
|
|
89
|
+
<dt>msg.error <span class="property-type">string</span></dt>
|
|
90
|
+
<dd>Error message explaining why orchestration failed.</dd>
|
|
87
91
|
<dt>msg.orchestration <span class="property-type">object</span></dt>
|
|
88
|
-
<dd>
|
|
92
|
+
<dd>Orchestration state including failure details.</dd>
|
|
89
93
|
</dl>
|
|
90
94
|
</li>
|
|
91
95
|
</ol>
|
|
@@ -98,5 +102,5 @@
|
|
|
98
102
|
<li><strong>Priorities:</strong> Tasks with higher <code>priority</code> numbers are executed first.</li>
|
|
99
103
|
<li><strong>Error Recovery:</strong> If a task fails, the orchestrator reflects on the error and can revise the plan to retry or try an alternative approach.</li>
|
|
100
104
|
</ul>
|
|
101
|
-
<p>
|
|
105
|
+
<p>The first output fires when the orchestration succeeds. All failure paths (validation errors, missing agents, iteration limits, plan errors, etc.) send a message out of the second output with <code>msg.error</code> describing the issue.</p>
|
|
102
106
|
</script>
|
|
@@ -64,9 +64,11 @@ module.exports = function (RED) {
|
|
|
64
64
|
msg.orchestration._running = true;
|
|
65
65
|
setImmediate(() => processNextStep(RED, node, msg, send, done));
|
|
66
66
|
} catch (error) {
|
|
67
|
-
node.status({ fill: 'red', shape: 'ring', text: 'error' });
|
|
68
67
|
node.error(error.message, msg);
|
|
69
|
-
|
|
68
|
+
msg.orchestration = msg.orchestration || {};
|
|
69
|
+
msg.orchestration.status = 'failed';
|
|
70
|
+
msg.orchestration.error = error && error.message ? error.message : String(error);
|
|
71
|
+
finalizeOrchestration(node, msg, send, done, error);
|
|
70
72
|
}
|
|
71
73
|
});
|
|
72
74
|
}
|
|
@@ -155,9 +157,25 @@ module.exports = function (RED) {
|
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
function finalizeOrchestration(node, msg, send, done, error) {
|
|
160
|
+
send = send || function () { node.send.apply(node, arguments) };
|
|
161
|
+
msg.orchestration = msg.orchestration || {};
|
|
158
162
|
msg.orchestration._running = false;
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
|
|
164
|
+
const isSuccess = msg.orchestration.status === 'completed';
|
|
165
|
+
if (!isSuccess) {
|
|
166
|
+
const errorMessage = msg.orchestration.error || (error && error.message) || msg.error || 'Unknown error';
|
|
167
|
+
msg.error = errorMessage;
|
|
168
|
+
msg.orchestration.error = errorMessage;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
node.status({
|
|
172
|
+
fill: isSuccess ? 'green' : 'red',
|
|
173
|
+
shape: 'dot',
|
|
174
|
+
text: msg.orchestration.status || (isSuccess ? 'completed' : 'failed')
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const outputs = isSuccess ? [msg, null] : [null, msg];
|
|
178
|
+
send(outputs);
|
|
161
179
|
if (done) done(error);
|
|
162
180
|
}
|
|
163
181
|
|