MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / _daemon_shell

Method _daemon_shell

core/task_executor.py:137–155  ·  view source on GitHub ↗

Execute a shell command in daemon context. Only prefixes listed in _DAEMON_ALLOWED_PREFIXES are permitted. Anything else is blocked with a clear message so the model knows to restructure its approach rather than silently failing.

(self, command: str)

Source from the content-addressed store, hash-verified

135 # ------------------------------------------------------------------
136
137 def _daemon_shell(self, command: str) -> str:
138 """
139 Execute a shell command in daemon context.
140
141 Only prefixes listed in _DAEMON_ALLOWED_PREFIXES are permitted.
142 Anything else is blocked with a clear message so the model knows
143 to restructure its approach rather than silently failing.
144 """
145 from tools.shell_tools import shell
146
147 cmd = command.strip()
148 if not any(cmd.startswith(p) for p in _DAEMON_ALLOWED_PREFIXES):
149 warning(f"Daemon: blocked shell command: {cmd[:80]}")
150 return (
151 f"[BLOCKED] Daemon mode will not run '{cmd[:60]}' without "
152 "explicit authorization. Add the command prefix to "
153 "_DAEMON_ALLOWED_PREFIXES in core/task_executor.py to enable it."
154 )
155 return shell(command, yolo=True)
156
157 # ------------------------------------------------------------------
158 # Introspection helpers

Callers

nothing calls this directly

Calls 2

warningFunction · 0.90
shellFunction · 0.90

Tested by

no test coverage detected