Initial release: generic CLI agent nodes for Nextcloud Node-RED
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<script type="text/html" data-template-name="agent-process">
|
||||
<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-processId"><i class="fa fa-id-badge"></i> Process ID</label>
|
||||
<input type="text" id="node-input-processId" placeholder="default">
|
||||
<span class="help-text">Unique identifier for this process instance.</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-action"><i class="fa fa-play"></i> Action</label>
|
||||
<select id="node-input-action">
|
||||
<option value="start">Start Process</option>
|
||||
<option value="stop">Stop Process</option>
|
||||
<option value="restart">Restart Process</option>
|
||||
<option value="send">Send Input</option>
|
||||
<option value="status">Get Status</option>
|
||||
</select>
|
||||
<span class="help-text">Action to perform on the process.</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-initialInput"><i class="fa fa-comment"></i> Initial Input</label>
|
||||
<input type="text" id="node-input-initialInput" placeholder="Process the files in /data/input...">
|
||||
<span class="help-text">Initial input for the process (used on start). Can be overridden by msg.payload or msg.initialInput.</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">Workspace directory for this process. Overrides config.</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-autoRestart"><i class="fa fa-redo"></i> Auto Restart</label>
|
||||
<input type="checkbox" id="node-input-autoRestart" checked>
|
||||
<span class="help-text">Automatically restart process if it crashes.</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="agent-process">
|
||||
<p>Manage persistent CLI agent processes.</p>
|
||||
<h3>Actions</h3>
|
||||
<ul>
|
||||
<li><b>Start</b> - Launch a new persistent agent process</li>
|
||||
<li><b>Stop</b> - Gracefully terminate the process</li>
|
||||
<li><b>Restart</b> - Stop and start the process</li>
|
||||
<li><b>Send</b> - Send input to a running process via stdin</li>
|
||||
<li><b>Status</b> - Get current process status (running, pid, uptime)</li>
|
||||
</ul>
|
||||
<h3>Input Message Properties</h3>
|
||||
<ul>
|
||||
<li><code>msg.action</code> - Override action</li>
|
||||
<li><code>msg.processId</code> - Override process ID</li>
|
||||
<li><code>msg.payload</code> - Input for start/send actions</li>
|
||||
<li><code>msg.initialInput</code> - Alternative to msg.payload for start action</li>
|
||||
<li><code>msg.workingDir</code> - Override workspace directory</li>
|
||||
</ul>
|
||||
<h3>Output Message Properties</h3>
|
||||
<ul>
|
||||
<li><code>msg.payload</code> - Status object with process info</li>
|
||||
<li><code>msg.processId</code> - Process ID</li>
|
||||
<li><code>msg.error</code> - Error message if failed</li>
|
||||
</ul>
|
||||
<h3>Process Lifecycle</h3>
|
||||
<p>Processes run as persistent child processes. They maintain state across interactions. Use <b>Send</b> action to continue interactions with a running process.</p>
|
||||
<h3>Example: Continuous processing session</h3>
|
||||
<pre><code>// Start process with initial context
|
||||
msg.action = "start";
|
||||
msg.processId = "data-processor";
|
||||
msg.payload = "Watch /data/input for new files and process them";
|
||||
return msg;
|
||||
|
||||
// Later, send follow-up commands
|
||||
msg.action = "send";
|
||||
msg.processId = "data-processor";
|
||||
msg.payload = "Now also generate summary report";
|
||||
return msg;
|
||||
|
||||
// Check status
|
||||
msg.action = "status";
|
||||
msg.processId = "data-processor";
|
||||
return msg;</code></pre>
|
||||
</script>
|
||||
Reference in New Issue
Block a user