Agent Zero AI framework
Forward remote exec reset flag
Alessandrob48e31bead54
diff --git a/plugins/_a0_connector/prompts/agent.system.tool.code_execution_remote.md b/plugins/_a0_connector/prompts/agent.system.tool.code_execution_remote.mdindex b8e7010c6..094d105ed 100644--- a/plugins/_a0_connector/prompts/agent.system.tool.code_execution_remote.md+++ b/plugins/_a0_connector/prompts/agent.system.tool.code_execution_remote.md@@ -21,6 +21,8 @@ and retry.## Arguments- `runtime`: one of `terminal`, `python`, `nodejs`, `output`, `reset`- `session`: integer session id (default `0`)+- `reset`: optional boolean for `terminal`, `python`, or `nodejs`; when true,+ the CLI resets the session before running the supplied codeRuntime-specific fields:- `terminal`, `python`, `nodejs`: require `code`@@ -28,7 +30,9 @@ Runtime-specific fields:## Notes- Reuse `session` when continuing a workflow.-- Use `output` to poll a running session and `reset` for a stuck session.+- Use `output` to poll a running session and `runtime=reset` for a stuck session.+ Use `reset: true` on a new command when you need a clean session and want to+ run the replacement command immediately.- Paths and shell syntax are evaluated on the CLI host, not inside Agent Zero.- When the user gives a relative path like `tmp/file.txt`, keep it relative tothe CLI host terminal. Do not prepend or `cd` to `/a0/usr/workdir`; that is thediff --git a/plugins/_a0_connector/skills/host-code-execution/SKILL.md b/plugins/_a0_connector/skills/host-code-execution/SKILL.mdindex 76938e8a3..448f63ba8 100644--- a/plugins/_a0_connector/skills/host-code-execution/SKILL.md+++ b/plugins/_a0_connector/skills/host-code-execution/SKILL.md@@ -24,7 +24,8 @@ Browser boundary: do not use shell launchers such as `xdg-open`, `sensible-brows- Use `runtime=terminal` for shell commands, `runtime=python` for Python snippets, and `runtime=nodejs` for Node.js snippets.- Reuse the same integer `session` while continuing a workflow; session state is local to the CLI frontend.- Use `runtime=output` when a previous command is still running or returned before the shell reached a prompt.-- Use `runtime=reset` when a session is stuck or a clean shell is safer.+- Use `runtime=reset` when a session is stuck and no replacement command needs to run yet.+- Use `reset: true` with `runtime=terminal`, `python`, or `nodejs` when a session is stuck and the next command should run immediately in a clean shell.- Match the remote host shell syntax. A Windows CLI may need PowerShell syntax even when Agent Zero runs on Linux.## Failure Handlingdiff --git a/plugins/_a0_connector/tools/code_execution_remote.py b/plugins/_a0_connector/tools/code_execution_remote.pyindex 248b62e5c..45d68a3e4 100644--- a/plugins/_a0_connector/tools/code_execution_remote.py+++ b/plugins/_a0_connector/tools/code_execution_remote.py@@ -30,6 +30,16 @@ class CodeExecutionRemote(Tool):def _runtime_requires_write_access(runtime: str) -> bool:return runtime in {"terminal", "python", "nodejs", "input"}+ @staticmethod+ def _coerce_bool(value: Any) -> bool:+ if isinstance(value, bool):+ return value+ if isinstance(value, (int, float)):+ return bool(value)+ if isinstance(value, str):+ return value.strip().lower() in {"1", "true", "yes", "on"}+ return False+def get_log_object(self):import uuid@@ -118,6 +128,8 @@ class CodeExecutionRemote(Tool):"session": session,"context_id": context_id,}+ if runtime != "reset" and self._coerce_bool(self.args.get("reset")):+ payload["reset"] = Trueif runtime in {"terminal", "python", "nodejs"}:code = self.args.get("code")