Skip to content

Agent Zero AI framework

Align remote execution and Computer Use tool contracts

Alessandroa2dc9dc8d74e
diff --git a/helpers/parallel_tools.py b/helpers/parallel_tools.py
index 6790a92c1..1ce8af8f8 100644
--- a/helpers/parallel_tools.py
+++ b/helpers/parallel_tools.py
@@ -32,7 +32,7 @@ CHILD_PARALLEL_TOOL_NAME_KEY = "parallel_tool_name"
DEFAULT_MAX_CALLS = 8
DEFAULT_TIMEOUT_SECONDS = 300
POLL_INTERVAL_SECONDS = 0.5
-DISALLOWED_PARALLEL_TOOLS = {"document_query", "response", "goal", "input"}
+DISALLOWED_PARALLEL_TOOLS = {"document_query", "response", "goal", "input", "input_remote"}
TERMINAL_STATES = {"success", "error", "cancelled", "timeout"}
JobState = Literal["pending", "running", "success", "error", "cancelled", "timeout"]
@@ -118,7 +118,7 @@ def _ensure_parallel_tool_allowed(tool_name: str, tool_args: dict[str, Any]) ->
if tool_name == "parallel":
raise ValueError("`parallel` cannot be nested inside another `parallel` call.")
if (
- tool_name == "code_execution_tool"
+ tool_name in {"code_execution_tool", "code_execution_remote"}
and str(tool_args.get("runtime", "")).strip().lower() in {"output", "reset"}
):
raise ValueError(
diff --git a/helpers/parallel_tools.py.dox.md b/helpers/parallel_tools.py.dox.md
index a5c670312..aa7a4b099 100644
--- a/helpers/parallel_tools.py.dox.md
+++ b/helpers/parallel_tools.py.dox.md
@@ -25,7 +25,7 @@
- Wrapped tool-call items must use the same shape as normal tool calls: a tool name plus arguments.
- Normalization accepts full agent-reply-shaped objects when `tool_name` and `tool_args` are present; non-contract planning fields such as `thoughts` or `headline` are ignored.
- `tool_calls` should be an array, but normalization also accepts a valid JSON string encoding of that array to recover provider/model stringification.
-- Shared validation rejects `document_query`, `response`, `input`, and `goal` inside direct `parallel` workers: document parsing stays sequential, `response` ends the parent loop, and goals belong to the calling context. Validate the whole batch before registering jobs and recheck at direct dispatch. Retained subordinates keep their own state.
+- Shared validation rejects `document_query`, `response`, `input`, `input_remote`, and `goal` inside direct `parallel` workers: document parsing stays sequential, `response` ends the parent loop, and goals belong to the calling context. Local and remote execution output/reset follow-ups also stay sequential. Validate the whole batch before registering jobs and recheck at direct dispatch. Retained subordinates keep their own state.
- `call_subordinate` jobs first enforce the actual calling agent's delegation policy, then call the same creation and execution functions as direct delegation in `tools/call_subordinate.py`; this helper does not construct or prompt a second kind of subordinate.
- Fresh parallel sibling calls create distinct `parent.number + 1` child agents. Their job snapshots expose stable `context_id` values that direct or parallel `reset=false` calls can continue after success or failure.
- Jobs retain their actual parent agent so parallel calls made by A1 create A2 rather than falling back to a context's A0.
diff --git a/helpers/responses_tools.py b/helpers/responses_tools.py
index 72cc3b05d..75faa96e9 100644
--- a/helpers/responses_tools.py
+++ b/helpers/responses_tools.py
@@ -82,6 +82,17 @@ BUNDLED_TOOL_PARAMETERS: dict[str, dict[str, Any]] = {
"keyboard": {"type": "string"},
"session": {"type": "integer"},
},
+ "plugins/_a0_connector/tools/code_execution_remote.py": {
+ "runtime": {"type": "string", "enum": ["terminal", "python", "nodejs", "output", "reset"]},
+ "code": {"type": "string"},
+ "session": {"type": "integer"},
+ "reset": {"type": "boolean"},
+ "reason": {"type": "string"},
+ },
+ "plugins/_a0_connector/tools/input_remote.py": {
+ "keyboard": {"type": "string"},
+ "session": {"type": "integer"},
+ },
"plugins/_memory/tools/memory_load.py": {
"query": {"type": "string"},
"threshold": {"type": "number"},
diff --git a/helpers/responses_tools.py.dox.md b/helpers/responses_tools.py.dox.md
index 70ddae909..6c64753bd 100644
--- a/helpers/responses_tools.py.dox.md
+++ b/helpers/responses_tools.py.dox.md
@@ -20,6 +20,9 @@
- Emit generated definitions with `strict: false` so Responses does not normalize optional or extensible arguments into required strict fields. Provider-specific strictness (such as Codex's final response) belongs at the provider request boundary.
- Explicitly embedded JSON schemas take precedence. Otherwise use canonical argument properties only for a matching resolved bundled implementation in `BUNDLED_TOOL_PARAMETERS`; custom/profile overrides must not inherit a same-named bundled contract. Properties remain optional and extensible for action-dependent inputs and runtime aliases; runtime validation remains authoritative.
- For unlisted implementations, infer only an unambiguous single backticked argument on an otherwise empty `args:` line; otherwise retain a permissive object instead of prose-guessed types.
+- Local and remote code execution expose matching runtime enums; `input` and
+ `input_remote` expose keyboard/session arguments separately. Remote schemas
+ do not advertise the framework-owned `allow_running` transport flag.
- Native local descriptions preserve full policy-filtered operational guidance. Convert unfenced and JSON-fenced A0 envelope examples to argument-only examples using the shared tool-request parser; preserve unrelated JSON and non-JSON code fences. Catalog summaries remain separate.
- Preserve original Agent Zero tool names through the native Responses name map.
- Keep MCP tool schemas merged after local prompt-derived tools.
diff --git a/plugins/_a0_connector/AGENTS.md b/plugins/_a0_connector/AGENTS.md
index a32d35f90..3a35b2a67 100644
--- a/plugins/_a0_connector/AGENTS.md
+++ b/plugins/_a0_connector/AGENTS.md
@@ -20,8 +20,14 @@
- Keep remote tool prompts synchronized with remote tool behavior and disclose
them only from connected CLI metadata: no connected CLI hides all remote tool
prompts, remote file metadata enables `text_editor_remote`, F4-enabled remote
- execution metadata enables `code_execution_remote`, and supported enabled
+ execution metadata enables `code_execution_remote` and `input_remote`, and supported enabled
Computer Use that does not need re-arming enables `computer_use_remote`.
+- Remote execution uses the same runtime set as local code execution. `input_remote`
+ mirrors local `input`, forwarding trimmed `keyboard` through gated terminal
+ execution with framework-owned `allow_running`. It shares connection, write
+ access, timeout, transfer, and disconnect handling; ordinary model args cannot
+ enable `allow_running`. There is no `runtime=input` or `code` input alias.
+- Computer Use prompts keep `element_index` top-level and semantic `target` syntax in backend skills. macOS `app-scoped-semantic-targeting` enables explicit app/window scope; older clients use the indexed window workflow. Native `get_window_state.mode` only labels output and stays out of model-facing guidance.
- Agent-scoped skill discovery includes this plugin's `skills/` root only when a routed connected socket has connector capability metadata. WebUI-only sockets do not qualify; disabled capabilities still count as a connected CLI. Filter roots on each discovery without mutating cached paths or persisting visibility settings. `setup-a0-cli` lives in root `skills/` and stays discoverable while disconnected.
- Never re-add a connector prompt that the effective project/profile tool policy
blocks.
@@ -82,7 +88,7 @@
Prompts must direct complete or binary transfer to authenticated HTTP.
- Host browser status metadata may advertise `available_browsers` entries with browser ids, labels, CDP endpoints, status, and enabled state; keep older CLI payloads without those fields compatible.
- `computer_use_remote` action results may report `requested_dispatch`, `actual_dispatch`, and `foreground_fallback_used` (`fallback_used` legacy); these are output-only fields, not tool args. `scroll` reads `dx`/`dy` with legacy aliases `delta_x`/`delta_y`; document only canonical args in model-facing prompts.
-- `computer_use_remote` reads legacy `name` as an `operation` fallback for element/ax/uia actions, and `code_execution_remote` `runtime=input` falls back to `code` when `keyboard` is missing; both stay out of model-facing prompts.
+- `computer_use_remote` reads legacy `name` as an `operation` fallback for element/ax/uia actions; it stays out of model-facing prompts.
- Model preset definitions exposed through v1 are global; project arguments select scope but never create project-owned definitions. Model switcher state reports the effective main, utility, and embedding models and preserves embedding-change notifications.
- The protected v1 `agent_editor` route delegates to the bundled Agent Editor
API and must not define another profile schema or write profile files itself.
diff --git a/plugins/_a0_connector/api/v1/capabilities.py b/plugins/_a0_connector/api/v1/capabilities.py
index 3aadd2dbc..f9cb68ddb 100644
--- a/plugins/_a0_connector/api/v1/capabilities.py
+++ b/plugins/_a0_connector/api/v1/capabilities.py
@@ -25,6 +25,7 @@ _BASE_FEATURES = [
"projects",
"text_editor_remote",
"code_execution_remote",
+ "input_remote",
"computer_use_remote",
"browser_host_remote",
"connector_browser_op",
diff --git a/plugins/_a0_connector/api/ws_connector.py b/plugins/_a0_connector/api/ws_connector.py
index fd8ab1c20..7ab4b0182 100644
--- a/plugins/_a0_connector/api/ws_connector.py
+++ b/plugins/_a0_connector/api/ws_connector.py
@@ -74,6 +74,7 @@ WS_FEATURES = [
"text_editor_remote",
"remote_file_tree",
"code_execution_remote",
+ "input_remote",
"computer_use_remote",
"browser_host_remote",
"connector_browser_op",
diff --git a/plugins/_a0_connector/helpers/remote_tool_prompts.py b/plugins/_a0_connector/helpers/remote_tool_prompts.py
index 65472fabe..055b7699e 100644
--- a/plugins/_a0_connector/helpers/remote_tool_prompts.py
+++ b/plugins/_a0_connector/helpers/remote_tool_prompts.py
@@ -7,6 +7,7 @@ from plugins._a0_connector.helpers import ws_runtime
REMOTE_TOOL_PROMPTS: dict[str, str] = {
"code_execution_remote": "agent.system.tool.code_execution_remote.md",
+ "input_remote": "agent.system.tool.input_remote.md",
"computer_use_remote": "agent.system.tool.computer_use_remote.md",
"text_editor_remote": "agent.system.tool.text_editor_remote.md",
}
@@ -19,6 +20,9 @@ def remote_tool_prompt_availability(context_id: str) -> dict[str, bool]:
"code_execution_remote": any(
_remote_exec_prompt_available(sid) for sid in candidates
),
+ "input_remote": any(
+ _remote_exec_prompt_available(sid) for sid in candidates
+ ),
"computer_use_remote": any(
_computer_use_prompt_available(sid) for sid in candidates
),
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.md
index f69ce4ac8..4f8887196 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,18 +21,18 @@ enable "Allow remote debugging for this browser instance", run `/browser host on
and retry.
## Arguments
-- `runtime`: one of `terminal`, `python`, `nodejs`, `output`, `input`, `reset`
+- `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 code
Runtime-specific fields:
- `terminal`, `python`, `nodejs`: require `code`
-- `input`: require `keyboard`
- `reset`: optional `reason`
## Notes
- Reuse `session` when continuing a workflow.
+- Use `input_remote` to answer interactive terminal prompts in that 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.
diff --git a/plugins/_a0_connector/prompts/agent.system.tool.computer_use_remote.md b/plugins/_a0_connector/prompts/agent.system.tool.computer_use_remote.md
index 46fb747a4..e988ce822 100644
--- a/plugins/_a0_connector/prompts/agent.system.tool.computer_use_remote.md
+++ b/plugins/_a0_connector/prompts/agent.system.tool.computer_use_remote.md
@@ -34,15 +34,14 @@ Required argument:
Optional arguments by action:
- `session_id`: session returned by `start_session`
- `pid`, `window_id`: target a native window for `get_window_state`, `element_action`, scoped backend snapshots, and guarded keyboard input when supported
-- `element_index`: target an element from the latest `get_window_state`
-- structural `element_action` target object: `element_index` or any of `title`, `name`, `description`, `automation_id`, `class_name`, `selector`; macOS app targeting uses `app_name` or `bundle_id`
-- `max_depth`, `max_nodes`: bound window/element snapshot size for `get_window_state` and backend snapshots
+- `element_index`: top-level index from the latest `get_window_state`
+- `target`: backend-specific semantic fields for `element_action`
+- `max_depth`, `max_nodes`: bound snapshot size for `get_window_state` and supported backend snapshots
- `include_hidden`, `include_offscreen`, `max_windows`: optional filters for `list_windows`
-- `mode`: optional scope selector for `get_window_state`
-- `selector`: structural target for `element_action` when the backend supports selector targeting
+- `selector`: Windows UIA selector from the latest snapshot
+- `path`: element path from the latest backend snapshot
- `operation`: action such as `invoke`, `press`, `set_value`, `focus`, or backend-specific operations
-- `target`, `value`: element target object and value for `element_action` operations such as `set_value`
-- `path`: element path for `element_action`, macOS `ax_action`, and Windows `uia_action`
+- `value`: replacement for `set_value`
- `dispatch`: `background`, `auto`, or `foreground`; prefer `background` for `element_action`
- `x`, `y`: normalized `[0,1]` global-screen coordinates for `move` and `click`
- `button`: `left`, `right`, or `middle` for `click`
diff --git a/plugins/_a0_connector/prompts/agent.system.tool.input_remote.md b/plugins/_a0_connector/prompts/agent.system.tool.input_remote.md
new file mode 100644
index 000000000..3850c3509
--- /dev/null
+++ b/plugins/_a0_connector/prompts/agent.system.tool.input_remote.md
@@ -0,0 +1,15 @@
+### input_remote
+send keyboard input to an interactive program on the connected CLI host
+args: `keyboard`, optional `session` (default `0`)
+uses the same connection and Read&Write gates as `code_execution_remote`
+for Agent Zero's own terminal, use `input`; for host browser actions, use `browser`
+usage:
+~~~json
+{
+ "tool_name": "input_remote",
+ "tool_args": {
+ "keyboard": "Y",
+ "session": 0
+ }
+}
+~~~
diff --git a/plugins/_a0_connector/skills/host-code-execution/SKILL.md b/plugins/_a0_connector/skills/host-code-execution/SKILL.md
index 448f63ba8..33d3a2f6b 100644
--- a/plugins/_a0_connector/skills/host-code-execution/SKILL.md
+++ b/plugins/_a0_connector/skills/host-code-execution/SKILL.md
@@ -24,6 +24,7 @@ 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 `input_remote` with `keyboard` and the same `session` to answer an interactive program.
- 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.
diff --git a/plugins/_a0_connector/skills/host-computer-use-macos/SKILL.md b/plugins/_a0_connector/skills/host-computer-use-macos/SKILL.md
index 9197948f7..81f628e32 100644
--- a/plugins/_a0_connector/skills/host-computer-use-macos/SKILL.md
+++ b/plugins/_a0_connector/skills/host-computer-use-macos/SKILL.md
@@ -21,6 +21,26 @@ When these features are present, prefer structural targeting over pixel clicks f
If the backend also advertises `native-window-list`, `window-state`, `element-index-targeting`, or `background-dispatch`, prefer the generic background loop from `host-computer-use`: `list_windows` -> `get_window_state` -> `element_action`. If those features are absent, use the AX snapshot/action flow below.
+With `app-scoped-semantic-targeting`, `element_action` also accepts top-level `pid` or `window_id` to scope semantic matching, or `target.app_name` / `target.bundle_id` to select one app. Use identifiers from `list_windows`; app names and bundle IDs match exactly, ignoring case. Without this feature, use `get_window_state` and its top-level `element_index` for another app/window.
+
+For example, replace the app identifier and control title with observed values:
+
+```json
+{
+ "tool_name": "computer_use_remote",
+ "tool_args": {
+ "action": "element_action",
+ "target": {
+ "bundle_id": "com.example.editor",
+ "role": "AXButton",
+ "title": "Save"
+ },
+ "operation": "press",
+ "dispatch": "background"
+ }
+}
+```
+
Use `ax_snapshot` to inspect the frontmost app's bounded Accessibility tree:
```json
diff --git a/plugins/_a0_connector/tools/code_execution_remote.py b/plugins/_a0_connector/tools/code_execution_remote.py
index aaeb80101..73bfa585f 100644
--- a/plugins/_a0_connector/tools/code_execution_remote.py
+++ b/plugins/_a0_connector/tools/code_execution_remote.py
@@ -38,9 +38,11 @@ _TIMEOUT_KEYS = (
class CodeExecutionRemote(Tool):
"""Send shell-backed frontend execution operations to the connected CLI machine."""
+ _allow_running = False
+
@staticmethod
def _runtime_requires_write_access(runtime: str) -> bool:
- return runtime in {"terminal", "python", "nodejs", "input"}
+ return runtime in {"terminal", "python", "nodejs"}
@staticmethod
def _coerce_bool(value: Any) -> bool:
@@ -59,7 +61,7 @@ class CodeExecutionRemote(Tool):
) -> dict[str, int] | None:
if runtime == "output":
source = exec_config.get("output_timeouts")
- elif runtime in {"terminal", "python", "nodejs", "input"}:
+ elif runtime in {"terminal", "python", "nodejs"}:
source = exec_config.get("code_exec_timeouts")
else:
return None
@@ -109,12 +111,9 @@ class CodeExecutionRemote(Tool):
async def execute(self, **kwargs: Any) -> Response:
runtime = str(self.args.get("runtime", "")).strip().lower()
- if runtime not in {"terminal", "python", "nodejs", "output", "input", "reset"}:
+ if runtime not in {"terminal", "python", "nodejs", "output", "reset"}:
return Response(
- message=(
- "runtime is required (terminal, python, nodejs, output, reset, "
- "or input [deprecated compatibility alias])"
- ),
+ message="runtime is required (terminal, python, nodejs, output, reset)",
break_loop=False,
)
@@ -175,23 +174,14 @@ class CodeExecutionRemote(Tool):
if runtime in {"terminal", "python", "nodejs"}:
code = self.args.get("code")
- if code is None or not str(code).strip():
+ if code is None or (not self._allow_running and not str(code).strip()):
return Response(
message=f"code is required for runtime={runtime}",
break_loop=False,
)
payload["code"] = str(code)
-
- elif runtime == "input":
- keyboard = self.args.get("keyboard")
- if keyboard is None:
- keyboard = self.args.get("code")
- if keyboard is None:
- return Response(
- message="keyboard is required for runtime=input",
- break_loop=False,
- )
- payload["keyboard"] = str(keyboard)
+ if self._allow_running:
+ payload["allow_running"] = True
elif runtime == "reset":
reason = self.args.get("reason")
diff --git a/plugins/_a0_connector/tools/input_remote.py b/plugins/_a0_connector/tools/input_remote.py
new file mode 100644
index 000000000..1dd7e45c1
--- /dev/null
+++ b/plugins/_a0_connector/tools/input_remote.py
@@ -0,0 +1,16 @@
+from plugins._a0_connector.tools.code_execution_remote import CodeExecutionRemote
+
+
+class InputRemote(CodeExecutionRemote):
+ _allow_running = True
+
+ async def execute(self, keyboard="", **kwargs):
+ self.args = {
+ "runtime": "terminal",
+ "code": keyboard.rstrip(),
+ "session": self.args.get("session", 0),
+ }
+ return await super().execute(**kwargs)
+
+ def get_heading(self, text=""):
+ return f"icon://keyboard input_remote [{self.args.get('session', 0)}]"
diff --git a/tests/test_a0_connector_prompt_gating.py b/tests/test_a0_connector_prompt_gating.py
index b92617cc6..b6fb968ed 100644
--- a/tests/test_a0_connector_prompt_gating.py
+++ b/tests/test_a0_connector_prompt_gating.py
@@ -35,6 +35,7 @@ from plugins._a0_connector.helpers import ws_runtime
PROMPT_ROOT = PROJECT_ROOT / "plugins" / "_a0_connector" / "prompts"
REMOTE_PROMPT_FILES = {
"code_execution_remote": "agent.system.tool.code_execution_remote.md",
+ "input_remote": "agent.system.tool.input_remote.md",
"computer_use_remote": "agent.system.tool.computer_use_remote.md",
"text_editor_remote": "agent.system.tool.text_editor_remote.md",
}
@@ -175,6 +176,21 @@ def test_remote_tool_gate_requires_f4_enabled_remote_exec_metadata():
ws_runtime.unregister_sid(sid)
assert '"tool_name": "code_execution_remote"' in prompt
+ assert '"tool_name": "input_remote"' in prompt
+
+
+def test_remote_input_prompt_obeys_its_tool_policy(monkeypatch):
+ context_id, sid = _context_id(), _sid()
+ ws_runtime.register_sid(sid)
+ ws_runtime.store_sid_remote_exec_metadata(sid, {"enabled": True})
+ monkeypatch.setitem(IncludeRemoteToolStubs.execute.__globals__, "resolve_tool",
+ lambda _agent, name: SimpleNamespace(allowed=name != "input_remote"))
+ try:
+ prompt = _apply_gate(context_id)
+ _assert_remote_tool_absent(prompt, "input_remote")
+ assert '"tool_name": "code_execution_remote"' in prompt
+ finally:
+ ws_runtime.unregister_sid(sid)
def test_remote_tool_gate_requires_enabled_computer_use_metadata():
@@ -620,6 +636,10 @@ def test_remote_tool_stubs_are_self_contained_and_reference_per_tool_skills():
assert "load and follow skill `host-computer-use`" in computer_stub
assert "host-computer-use-macos" in computer_stub
assert "host-computer-use-windows" in computer_stub
+ assert "top-level index" in computer_stub
+ assert "- `mode`:" not in computer_stub
+ assert "Use `input_remote` to answer interactive terminal prompts" in exec_stub
+ assert "With `app-scoped-semantic-targeting`" in macos_computer_skill
assert "ax_snapshot" not in computer_stub
assert "ax_action" not in computer_stub
assert "uia_snapshot" not in computer_stub
@@ -717,9 +737,8 @@ def test_host_computer_use_does_not_fall_back_to_linux_desktop_skill():
assert "Do not substitute the `linux-desktop` skill" in computer_stub
assert "Never switch to `linux-desktop`" in host_skill
assert "Those paths only see the internal Agent Zero runtime" in host_skill
- assert "built-in Docker/Xpra Linux Desktop" in linux_frontmatter["description"]
- assert "Not for A0 CLI /computer-use" in linux_frontmatter["description"]
- assert "A0 CLI /computer-use" in linux_frontmatter["description"]
+ assert "Docker/Xpra" in linux_frontmatter["description"]
+ assert "not the user's host computer" in linux_frontmatter["description"]
assert "host-computer-use" in linux_skill
assert "computer_use_remote" in linux_skill
assert "`desktopctl.sh` only targets the internal Agent Zero Xpra display" in linux_skill
diff --git a/tests/test_parallel_code_lifetime.py b/tests/test_parallel_code_lifetime.py
index e535db54f..ff8e5654c 100644
--- a/tests/test_parallel_code_lifetime.py
+++ b/tests/test_parallel_code_lifetime.py
@@ -50,6 +50,9 @@ async def test_code_job_keeps_polling_after_output_timeout_without_reexecuting(m
@pytest.mark.parametrize("tool_name,args", [
("input", {"session": 0, "keyboard": "yes"}),
+ ("input_remote", {"session": 0, "keyboard": "yes"}),
+ ("code_execution_remote", {"runtime": "output", "session": 0}),
+ ("code_execution_remote", {"runtime": "reset", "session": 0}),
("code_execution_tool", {"runtime": "output", "session": 0}),
("code_execution_tool", {"runtime": " RESET ", "session": 0}),
])
diff --git a/tests/test_responses_tools.py b/tests/test_responses_tools.py
index c74273546..a56d8b87b 100644
--- a/tests/test_responses_tools.py
+++ b/tests/test_responses_tools.py
@@ -214,6 +214,16 @@ def test_complex_prompt_args_are_not_guessed_as_string_schemas():
}
+def test_remote_execution_schemas_match_local_runtime_and_input_contracts():
+ params = responses_tools.BUNDLED_TOOL_PARAMETERS
+ local = params["plugins/_code_execution/tools/code_execution_tool.py"]
+ remote = params["plugins/_a0_connector/tools/code_execution_remote.py"]
+ assert remote["runtime"] == local["runtime"]
+ assert "input" not in remote["runtime"]["enum"]
+ assert "allow_running" not in remote
+ assert params["plugins/_a0_connector/tools/input_remote.py"] == params["plugins/_code_execution/tools/input.py"]
+
+
def test_bundled_schema_follows_implementation_and_explicit_overrides(monkeypatch, tmp_path):
tool_path = PROJECT_ROOT / "plugins/_code_execution/tools/code_execution_tool.py"
custom_path = tmp_path / "code_execution_tool.py"
diff --git a/tests/test_tool_action_contracts.py b/tests/test_tool_action_contracts.py
index c79db4543..4bd64c534 100644
--- a/tests/test_tool_action_contracts.py
+++ b/tests/test_tool_action_contracts.py
@@ -1184,6 +1184,25 @@ def test_computer_use_remote_start_session_reports_backend_features_and_windows_
assert "host-computer-use-windows" in message
+def test_computer_use_remote_forwards_documented_macos_app_scope(monkeypatch):
+ import json
+ import re
+
+ module = _load_computer_use_remote_tool(monkeypatch)
+ tool = object.__new__(module.ComputerUseRemote)
+ skill = (Path(__file__).resolve().parents[1] / "plugins/_a0_connector/skills/host-computer-use-macos/SKILL.md").read_text()
+ example = json.loads(re.search(r"```json\n(.*?)\n```", skill, re.S).group(1))
+ tool.args = example["tool_args"]
+ payload = tool._build_payload(op_id="scoped", context_id="ctx", action="element_action")
+ assert payload["target"] == {"bundle_id": "com.example.editor", "role": "AXButton", "title": "Save"}
+ assert payload["dispatch"] == "background"
+ assert payload["operation"] == "press"
+ tool.args = {**tool.args, "pid": 123, "window_id": "ax-pid:123:path:0", "element_index": 2}
+ payload = tool._build_payload(op_id="indexed", context_id="ctx", action="element_action")
+ assert (payload["pid"], payload["window_id"], payload["element_index"]) == (123, "ax-pid:123:path:0", 2)
+ assert "element_index" not in payload["target"]
+
+
def test_computer_use_remote_forwards_linux_window_scope_and_type_guard(monkeypatch):
module = _load_computer_use_remote_tool(monkeypatch)
tool = object.__new__(module.ComputerUseRemote)