Agent fetches serialized task data from prologue web server and successfully parses it.

This commit is contained in:
Jakob Friedl
2025-07-18 18:47:57 +02:00
parent 5825ec91a1
commit d22ad0bd0c
13 changed files with 275 additions and 86 deletions

View File

@@ -0,0 +1,37 @@
import strutils, tables, json
import ../types
import ../commands/commands
import sugar
proc handleTask*(config: AgentConfig, task: Task): TaskResult =
dump task
# var taskResult = TaskResult
# let handlers = {
# CMD_SLEEP: taskSleep,
# CMD_SHELL: taskShell,
# CMD_PWD: taskPwd,
# CMD_CD: taskCd,
# CMD_LS: taskDir,
# CMD_RM: taskRm,
# CMD_RMDIR: taskRmdir,
# CMD_MOVE: taskMove,
# CMD_COPY: taskCopy
# }.toTable
# Handle task command
# taskResult = handlers[task.command](task)
# echo taskResult.data
# Handle actions on specific commands
# case task.command:
# of CMD_SLEEP:
# if taskResult.status == STATUS_COMPLETED:
# # config.sleep = parseJson(task.args)["delay"].getInt()
# discard
# else:
# discard
# # Return the result
# return taskResult