Initial release: generic CLI agent nodes for Nextcloud Node-RED

This commit is contained in:
n3wk
2026-08-24 19:06:08 +02:00
commit b9249dd9ca
16 changed files with 1437 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
<script type="text/html" data-template-name="agent-exec">
<div class="form-row">
<label for="node-input-agentConfig"><i class="fa fa-cog"></i> Agent Config</label>
<input type="text" id="node-input-agentConfig" class="node-config-input" placeholder="Select agent config node">
<span class="help-text">Select the agent configuration node.</span>
</div>
<div class="form-row">
<label for="node-input-command"><i class="fa fa-terminal"></i> Command</label>
<select id="node-input-command">
<option value="run">run - Execute a task</option>
<option value="version">version - Show version</option>
<option value="config">config - Show configuration</option>
<option value="help">help - Show help</option>
</select>
<span class="help-text">Agent subcommand to execute.</span>
</div>
<div class="form-row">
<label for="node-input-args"><i class="fa fa-list"></i> Arguments</label>
<input type="text" id="node-input-args" placeholder="--verbose --output json">
<span class="help-text">Additional arguments (space-separated). Can be overridden by msg.args.</span>
</div>
<div class="form-row">
<label for="node-input-workingDir"><i class="fa fa-folder"></i> Working Directory</label>
<input type="text" id="node-input-workingDir" placeholder="/data/agent-workspace">
<span class="help-text">Working directory for agent. Overrides config. Can be overridden by msg.workingDir.</span>
</div>
<div class="form-row">
<label for="node-input-timeout"><i class="fa fa-clock"></i> Timeout (ms)</label>
<input type="number" id="node-input-timeout" min="5000" max="600000" value="120000" style="width: 100px;">
<span class="help-text">Maximum execution time in milliseconds.</span>
</div>
<div class="form-row">
<label for="node-input-outputFormat"><i class="fa fa-code"></i> Output Format</label>
<select id="node-input-outputFormat">
<option value="text">Text (raw stdout)</option>
<option value="json">JSON (parse stdout as JSON)</option>
</select>
<span class="help-text">How to parse the output.</span>
</div>
</script>
<script type="text/html" data-help-name="agent-exec">
<p>Execute CLI agent commands from Node-RED flows.</p>
<h3>Usage</h3>
<p>This node runs agent commands and returns the output. The most common use is <code>agent run</code> with a prompt/input.</p>
<h3>Input Message Properties</h3>
<ul>
<li><code>msg.command</code> - Override the command (e.g., "run", "version")</li>
<li><code>msg.args</code> - Override arguments (array or space-separated string)</li>
<li><code>msg.prompt</code> - Input text for <code>run</code> command</li>
<li><code>msg.workingDir</code> - Override working directory</li>
<li><code>msg.timeout</code> - Override timeout in ms</li>
</ul>
<h3>Output Message Properties</h3>
<ul>
<li><code>msg.payload</code> - Command output (text or parsed JSON)</li>
<li><code>msg.stderr</code> - Standard error output</li>
<li><code>msg.exitCode</code> - Process exit code</li>
<li><code>msg.duration</code> - Execution time in milliseconds</li>
<li><code>msg.command</code> - Full command that was executed</li>
<li><code>msg.workingDir</code> - Working directory used</li>
<li><code>msg.error</code> - Error message if failed</li>
</ul>
<h3>Example Flow</h3>
<pre><code>// Inject node with:
msg.payload = "Process the files in /data/input and generate a report";
msg.prompt = msg.payload;
return msg;</code></pre>
<p>Connect to agent-exec with command "run" to execute the task.</p>
</script>