Initial release: generic CLI agent nodes for Nextcloud Node-RED
This commit is contained in:
@@ -0,0 +1,266 @@
|
||||
[
|
||||
{
|
||||
"id": "agent-config",
|
||||
"type": "agent-config",
|
||||
"name": "Agent Config",
|
||||
"cliPath": "agent",
|
||||
"workspaceDir": "/data/agent-workspace",
|
||||
"apiEndpoint": "http://localhost:3000",
|
||||
"defaultArgs": "",
|
||||
"maxConcurrent": 3,
|
||||
"autoStart": true
|
||||
},
|
||||
{
|
||||
"id": "run-task",
|
||||
"type": "inject",
|
||||
"name": "Run Task",
|
||||
"props": [
|
||||
{"p": "payload"},
|
||||
{"p": "prompt", "v": "Process all files in /data/input and generate summary report", "vt": "str"}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"x": 200,
|
||||
"y": 200,
|
||||
"wires": [["agent-exec-run"]]
|
||||
},
|
||||
{
|
||||
"id": "agent-exec-run",
|
||||
"type": "agent-exec",
|
||||
"name": "Agent Exec",
|
||||
"agentConfig": "agent-config",
|
||||
"command": "run",
|
||||
"args": "",
|
||||
"workingDir": "/data/agent-workspace",
|
||||
"timeout": "120000",
|
||||
"outputFormat": "text",
|
||||
"x": 450,
|
||||
"y": 200,
|
||||
"wires": [["write-result", "debug-output"]]
|
||||
},
|
||||
{
|
||||
"id": "write-result",
|
||||
"type": "agent-file",
|
||||
"name": "Write Result",
|
||||
"agentConfig": "agent-config",
|
||||
"operation": "write",
|
||||
"filePath": "results/summary.txt",
|
||||
"encoding": "utf8",
|
||||
"createDirs": true,
|
||||
"x": 700,
|
||||
"y": 200,
|
||||
"wires": [["list-results"]]
|
||||
},
|
||||
{
|
||||
"id": "list-results",
|
||||
"type": "agent-file",
|
||||
"name": "List Results",
|
||||
"agentConfig": "agent-config",
|
||||
"operation": "list",
|
||||
"filePath": "results",
|
||||
"encoding": "utf8",
|
||||
"x": 950,
|
||||
"y": 200,
|
||||
"wires": [["debug-list"]]
|
||||
},
|
||||
{
|
||||
"id": "debug-output",
|
||||
"type": "debug",
|
||||
"name": "Debug Output",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"x": 700,
|
||||
"y": 140,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "debug-list",
|
||||
"type": "debug",
|
||||
"name": "Debug File List",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"x": 1200,
|
||||
"y": 200,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "start-process",
|
||||
"type": "inject",
|
||||
"name": "Start Process",
|
||||
"props": [
|
||||
{"p": "action", "v": "start", "vt": "str"},
|
||||
{"p": "processId", "v": "data-processor", "vt": "str"},
|
||||
{"p": "payload", "v": "Watch /data/input for new files and process them", "vt": "str"}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"x": 200,
|
||||
"y": 400,
|
||||
"wires": [["agent-process"]]
|
||||
},
|
||||
{
|
||||
"id": "send-input",
|
||||
"type": "inject",
|
||||
"name": "Send Input",
|
||||
"props": [
|
||||
{"p": "action", "v": "send", "vt": "str"},
|
||||
{"p": "processId", "v": "data-processor", "vt": "str"},
|
||||
{"p": "payload", "v": "Also generate CSV export", "vt": "str"}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"x": 200,
|
||||
"y": 460,
|
||||
"wires": [["agent-process"]]
|
||||
},
|
||||
{
|
||||
"id": "check-status",
|
||||
"type": "inject",
|
||||
"name": "Check Status",
|
||||
"props": [
|
||||
{"p": "action", "v": "status", "vt": "str"},
|
||||
{"p": "processId", "v": "data-processor", "vt": "str"}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"x": 200,
|
||||
"y": 520,
|
||||
"wires": [["agent-process"]]
|
||||
},
|
||||
{
|
||||
"id": "agent-process",
|
||||
"type": "agent-process",
|
||||
"name": "Data Processor",
|
||||
"agentConfig": "agent-config",
|
||||
"processId": "data-processor",
|
||||
"action": "start",
|
||||
"workingDir": "/data/agent-workspace",
|
||||
"autoRestart": true,
|
||||
"x": 450,
|
||||
"y": 460,
|
||||
"wires": [["debug-process"]]
|
||||
},
|
||||
{
|
||||
"id": "debug-process",
|
||||
"type": "debug",
|
||||
"name": "Debug Process",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"x": 700,
|
||||
"y": 460,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "nextcloud-flow",
|
||||
"type": "inject",
|
||||
"name": "Nextcloud + Agent Flow",
|
||||
"props": [
|
||||
{"p": "topic", "v": "nextcloud-agent", "vt": "str"}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"x": 200,
|
||||
"y": 650,
|
||||
"wires": [["nc-list-files"]]
|
||||
},
|
||||
{
|
||||
"id": "nc-list-files",
|
||||
"type": "file-operations",
|
||||
"name": "List Nextcloud Files",
|
||||
"nextcloud": "nextcloud-config",
|
||||
"operation": "list",
|
||||
"path": "/Documents",
|
||||
"x": 450,
|
||||
"y": 650,
|
||||
"wires": [["filter-files"]]
|
||||
},
|
||||
{
|
||||
"id": "filter-files",
|
||||
"type": "function",
|
||||
"name": "Filter Files",
|
||||
"func": "const files = msg.payload.ocs.data.filter(f => f.name.endsWith('.txt') || f.name.endsWith('.md'));\nmsg.payload = files.map(f => f.name);\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"x": 700,
|
||||
"y": 650,
|
||||
"wires": [["agent-process-files"]]
|
||||
},
|
||||
{
|
||||
"id": "agent-process-files",
|
||||
"type": "agent-exec",
|
||||
"name": "Process with Agent",
|
||||
"agentConfig": "agent-config",
|
||||
"command": "run",
|
||||
"args": "",
|
||||
"workingDir": "/data/agent-workspace",
|
||||
"timeout": "180000",
|
||||
"outputFormat": "text",
|
||||
"x": 950,
|
||||
"y": 650,
|
||||
"wires": [["save-processed"]]
|
||||
},
|
||||
{
|
||||
"id": "save-processed",
|
||||
"type": "agent-file",
|
||||
"name": "Save Processed Output",
|
||||
"agentConfig": "agent-config",
|
||||
"operation": "write",
|
||||
"filePath": "processed/output.txt",
|
||||
"encoding": "utf8",
|
||||
"createDirs": true,
|
||||
"x": 1200,
|
||||
"y": 650,
|
||||
"wires": [["nc-upload-processed"]]
|
||||
},
|
||||
{
|
||||
"id": "nc-upload-processed",
|
||||
"type": "file-operations",
|
||||
"name": "Upload to Nextcloud",
|
||||
"nextcloud": "nextcloud-config",
|
||||
"operation": "upload",
|
||||
"path": "/Documents/processed/output.txt",
|
||||
"x": 1450,
|
||||
"y": 650,
|
||||
"wires": [["debug-upload"]]
|
||||
},
|
||||
{
|
||||
"id": "debug-upload",
|
||||
"type": "debug",
|
||||
"name": "Debug Upload",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"x": 1700,
|
||||
"y": 650,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user