Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: computer use checks a cancel right before input

ogsamrat3f4c1cd2f5fd
diff --git a/apps/server/src/computer-use/shared/PARITY.sha256 b/apps/server/src/computer-use/shared/PARITY.sha256
index c8797795..fb83b79d 100644
--- a/apps/server/src/computer-use/shared/PARITY.sha256
+++ b/apps/server/src/computer-use/shared/PARITY.sha256
@@ -9,5 +9,5 @@ a96246342720364eb3e5843ba70fbbf640365f94597fc4dbb6a7be7d95254ec4 image.mjs
e47c9ff67b9fce2ec12307737e973ce22551719c482b87f601569bd4f8a77e17 media.mjs
eabdf78c56733577d05aad490d9d7d5ece6c22e9b3ea9e6e9803d1a4a546fdd4 media.d.mts
a0bd964a5d0c7c5e26b4ce4ed8e8300f80a0a3a9da5d7f49c36f6ac2c907e934 native-worker.mjs
-ce36d02e9160aab8f50c50defb2724a15e3244eaccf7e00b7d4e0492d2494cf1 portable-host.mjs
+5d74143ba5a6b6ffa335b29543a6ebde681aea8ce2af3f59a4d6d329b8f2b321 portable-host.mjs
fb2c1dae95e233af20798e0d6700e6f32197f6d4dbf226911beb35fcbff934d9 portable-host.d.mts
diff --git a/apps/server/src/computer-use/shared/portable-host.mjs b/apps/server/src/computer-use/shared/portable-host.mjs
index 32d2d6f0..5b17cdee 100644
--- a/apps/server/src/computer-use/shared/portable-host.mjs
+++ b/apps/server/src/computer-use/shared/portable-host.mjs
@@ -412,9 +412,9 @@ export async function createPortableHost({ native: firstNative, nativeFactory =
if (after.identity !== current.identity || JSON.stringify(after.bounds) !== JSON.stringify(current.bounds)) return finish({ ...common, approval, ok: false, code: "window_changed", message: "The window moved or changed. Observe again.", next: "computer_observe" });
if (!(await hitAll(after))) return finish({ ...common, approval, ok: false, code: "window_occluded", message: "Another window covers this point, or it is outside the approved window. Observe again." });
}
+ const cursorBefore = await native.call("cursor").catch(() => null);
// The engine gave up on this call (before or while it was asked): no input with nobody waiting for it.
if (s.connection.cancelled) return finish({ ...common, approval: { ...approval, ...(approval.asked ? {} : { by: "agent" }), reason: "cancelled" }, ok: false, code: "approval_denied", message: "The request was cancelled.", may_have_acted: false });
- const cursorBefore = await native.call("cursor").catch(() => null);
const point = mapped.length === 1 ? { model: mapped[0].model, screen: mapped[0].screen } : undefined;
const path = action.type === "drag" ? mapped.map((m) => ({ model: m.model, screen: m.screen })) : undefined;
const screenAction = action.type === "drag" ? { ...action, path: mapped.map((m) => m.screen) } : mapped.length ? { ...action, x: mapped[0].screen.x, y: mapped[0].screen.y } : action;