Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Explain unconfirmed Local VM accessibility text input

skygunnereb65d5d8c8c2
diff --git a/server/container-mcp.test.ts b/server/container-mcp.test.ts
index c181f9b248..221e389f6b 100644
--- a/server/container-mcp.test.ts
+++ b/server/container-mcp.test.ts
@@ -111,6 +111,41 @@ posixOnly("Local VM Cua MCP bridge", () => {
`${CUA_EXECUTABLE} mcp --socket ${CUA_SOCKET}`,
);
});
+ it("explains unconfirmed accessibility input without changing other tool results", async () => {
+ const bin = await mkdtemp(join(tmpdir(), "openmausbot-container-mcp-input-"));
+ temporary.push(bin);
+ const receipts = [
+ ["Typed 14 character(s) (via targeted AT-SPI).", "unverifiable", "accessibility"],
+ ["Set value of element [42] to 'VM funcionando' (path=ax); but the element reads back ''.", "suspected_noop", "accessibility"],
+ ["Clicked element [43] (pid 245).", "unverifiable", "accessibility"],
+ ["Typed 14 character(s) as real key events (delivery_mode=foreground, focus_after=target); not verified — confirm with a screenshot.", "unverifiable", "global_input"],
+ ].map(([text, effect, route], id) => ({ jsonrpc: "2.0", id, result: { content: [{ type: "text", text }], structuredContent: { effect, route } } }));
+ const script = ["#!/bin/sh", ...receipts.map((receipt) => `IFS= read -r line && printf '%s\\n' '${JSON.stringify(receipt).replaceAll("'", "'\\''")}'`), ""].join("\n");
+ await writeFile(join(bin, "docker"), script, { mode: 0o700 });
+ const child = spawn(
+ process.execPath,
+ [fileURLToPath(new URL("./container-mcp.ts", import.meta.url)), "docker", CONTAINER, CUA_SOCKET],
+ { env: { ...process.env, OMB_EXTRA_PATH: bin, NODE_NO_WARNINGS: "1" }, stdio: ["pipe", "pipe", "pipe"] },
+ );
+ const calls = ["type_text", "set_value", "click", "type_text"].map((name, id) => JSON.stringify({ jsonrpc: "2.0", id, method: "tools/call", params: { name, arguments: {} } }));
+ let stdout = "";
+ let stderr = "";
+ child.stdout.setEncoding("utf8").on("data", (chunk) => { stdout += chunk; });
+ child.stderr.setEncoding("utf8").on("data", (chunk) => { stderr += chunk; });
+ const closed = new Promise((resolve, reject) => { child.on("error", reject); child.on("close", resolve); });
+ child.stdin.end(calls.join("\n") + "\n");
+ expect(await closed, stderr).toBe(0);
+ const results = stdout.trim().split("\n").map((line) => JSON.parse(line));
+ expect(results).toHaveLength(4);
+ for (const [index, receipt] of receipts.slice(0, 2).entries()) {
+ expect(results[index]).toEqual({
+ ...receipt,
+ result: { ...receipt.result, content: [{ type: "text", text: expect.stringMatching(/could not confirm.*type_text.*foreground.*clipboard_write/s) }] },
+ });
+ }
+ expect(results.slice(2)).toEqual(receipts.slice(2));
+ });
+
it("never hands an engine an error result that carries a screenshot", async () => {
const bin = await mkdtemp(join(tmpdir(), "openmausbot-container-mcp-error-"));
temporary.push(bin);
diff --git a/server/container-mcp.ts b/server/container-mcp.ts
index 964690d920..3f1106509c 100644
--- a/server/container-mcp.ts
+++ b/server/container-mcp.ts
@@ -1,5 +1,4 @@
-// A stdio bridge into Cua Driver's MCP server in the Local VM. It defines no tools; the shared bridge only answers ping,
-// makes tool schemas provider-safe and keeps error results text-only.
+// A stdio bridge into Cua Driver's MCP server in the Local VM.
import { cuaExecArgs } from "./container-computer.ts";
import { runMcpBridge } from "./mcp-bridge.ts";
@@ -17,10 +16,31 @@ if (!container || !/^[a-zA-Z0-9_.-]+$/.test(container) || !socket?.startsWith("/
const controlUrl = process.env.OMB_CONTROL_URL ?? "";
const controlToken = process.env.OMB_CONTROL_TOKEN ?? "";
+// Cua Driver 0.37.0 can report an AT-SPI write as attempted when Firefox ESR leaves the field empty.
+function textInputResultLine(line: string): string {
+ if (!line.includes("unverifiable") && !line.includes("suspected_noop")) return line;
+ let frame: { result?: { structuredContent?: { effect?: string; route?: string }; content?: Array<{ type?: string; text?: string }> } } | null;
+ try {
+ frame = JSON.parse(line);
+ } catch {
+ return line;
+ }
+ const result = frame?.result;
+ const outcome = result?.structuredContent;
+ if (outcome?.route !== "accessibility" || (outcome.effect !== "unverifiable" && outcome.effect !== "suspected_noop")) return line;
+ const content = result?.content;
+ if (!Array.isArray(content)) return line;
+ const [first, ...rest] = content;
+ if (first?.type !== "text" || typeof first.text !== "string" || !/^(?:Typed \d+ character\(s\) \(via targeted AT-SPI\)\.$|Set value of element \[)/u.test(first.text)) return line;
+ const text = "The accessibility action could not confirm that the field changed. In Firefox ESR on the Local VM this route can leave a field empty. Check the field with get_window_state before trying again. If it is unchanged, use type_text with the field's window-relative x,y and delivery_mode: foreground, or focus the field and use clipboard_write followed by Ctrl+V. Check the resulting value.";
+ return JSON.stringify({ ...frame, result: { ...result, content: [{ ...first, text }, ...rest] } });
+}
+
runMcpBridge({
command: runtime,
args: cuaExecArgs(["mcp", "--socket", socket], { container, interactive: true }),
label: "Cua Driver",
+ rewriteResponse: textInputResultLine,
consoleChild: true,
// No liveness watchdog: the runtime CLI talks to a local daemon and fails fast on its own.
...(controlUrl && controlToken ? { gate: { url: controlUrl, token: controlToken } } : {}),