Initial release: generic CLI agent nodes for Nextcloud Node-RED
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<script type="text/html" data-template-name="agent-file">
|
||||
<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 (provides workspace directory).</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-operation"><i class="fa fa-tasks"></i> Operation</label>
|
||||
<select id="node-input-operation">
|
||||
<option value="read">Read File</option>
|
||||
<option value="write">Write File</option>
|
||||
<option value="append">Append to File</option>
|
||||
<option value="delete">Delete File</option>
|
||||
<option value="exists">Check Exists</option>
|
||||
<option value="list">List Directory</option>
|
||||
<option value="stat">File Stats</option>
|
||||
<option value="mkdir">Create Directory</option>
|
||||
</select>
|
||||
<span class="help-text">File operation to perform.</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-filePath"><i class="fa fa-file"></i> File Path</label>
|
||||
<input type="text" id="node-input-filePath" placeholder="output/result.txt or /data/agent-workspace/output/result.txt">
|
||||
<span class="help-text">Path relative to workspace directory, or absolute path. Can be overridden by msg.filePath.</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-encoding"><i class="fa fa-font"></i> Encoding</label>
|
||||
<select id="node-input-encoding">
|
||||
<option value="utf8">UTF-8</option>
|
||||
<option value="ascii">ASCII</option>
|
||||
<option value="latin1">Latin1</option>
|
||||
<option value="base64">Base64</option>
|
||||
<option value="hex">Hex</option>
|
||||
</select>
|
||||
<span class="help-text">Text encoding for read/write operations.</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-createDirs"><i class="fa fa-folder-plus"></i> Create Parent Directories</label>
|
||||
<input type="checkbox" id="node-input-createDirs" checked>
|
||||
<span class="help-text">Automatically create parent directories for write/append operations.</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="agent-file">
|
||||
<p>Read, write, and manage files in the agent workspace directory.</p>
|
||||
<h3>Operations</h3>
|
||||
<ul>
|
||||
<li><b>Read</b> - Returns file content as string (or Buffer for binary encodings)</li>
|
||||
<li><b>Write</b> - Creates/overwrites file with msg.payload content</li>
|
||||
<li><b>Append</b> - Appends msg.payload to existing file</li>
|
||||
<li><b>Delete</b> - Removes file</li>
|
||||
<li><b>Exists</b> - Returns {exists: true/false}</li>
|
||||
<li><b>List</b> - Returns array of directory entries with name, path, isDirectory, isFile</li>
|
||||
<li><b>Stat</b> - Returns file stats (size, timestamps, type)</li>
|
||||
<li><b>Mkdir</b> - Creates directory recursively</li>
|
||||
</ul>
|
||||
<h3>Input Message Properties</h3>
|
||||
<ul>
|
||||
<li><code>msg.operation</code> - Override operation</li>
|
||||
<li><code>msg.filePath</code> - Override file path</li>
|
||||
<li><code>msg.payload</code> - Content for write/append operations</li>
|
||||
<li><code>msg.encoding</code> - Override encoding</li>
|
||||
</ul>
|
||||
<h3>Output Message Properties</h3>
|
||||
<ul>
|
||||
<li><code>msg.payload</code> - Operation result (content, stats, or status object)</li>
|
||||
<li><code>msg.filePath</code> - File path used</li>
|
||||
<li><code>msg.operation</code> - Operation performed</li>
|
||||
<li><code>msg.error</code> - Error message if failed</li>
|
||||
</ul>
|
||||
<h3>Security</h3>
|
||||
<p>Paths are restricted to the configured workspace directory. Path traversal attempts are blocked.</p>
|
||||
<h3>Example: Write agent output to file</h3>
|
||||
<pre><code>// After agent-exec generates output:
|
||||
msg.filePath = "results/output.txt";
|
||||
msg.payload = msg.payload; // output from agent-exec
|
||||
msg.operation = "write";
|
||||
return msg;</code></pre>
|
||||
</script>
|
||||
Reference in New Issue
Block a user