A desktop coding agent with free access to frontier models.
TypeScript
fix: answering a question does not pause control
ogsamratb9600b3d74d9
diff --git a/apps/server/src/computer-use/portable-host.test.ts b/apps/server/src/computer-use/portable-host.test.tsindex ec25e7d0..be45daf8 100644--- a/apps/server/src/computer-use/portable-host.test.ts+++ b/apps/server/src/computer-use/portable-host.test.ts@@ -226,6 +226,20 @@ describe("portable host: observe and act", () => {await host.close();});+ test("the person's answer (a click or key during the question) does not pause; input after it does", async () => {+ const r = rig("careful");+ const { host, c, session, obs } = await opened(r);+ const native = r.native as ReturnType<typeof fakeNative>;+ const original = r.acts.push.bind(r.acts);+ r.acts.push = (...items: ActRequest[]) => { native.personInput(); return original(...items); };+ const act = await call(c, "computer_act", { session_id: session, observation_id: obs.state.observation?.id, request_id: "a", intent: "Type a word", action: { type: "type", text: "ok" } });+ expect(act.state).toMatchObject({ ok: true, approval: { asked: true } });+ expect(host.state()[0]?.phase).toBe("working");+ native.personInput();+ expect(host.state()[0]?.phase).toBe("paused");+ await host.close();+ });+test("person input pauses; only Continue resumes; first act after takeover asks in Normal", async () => {const r = rig("normal");const { host, c, session, obs } = await opened(r);diff --git a/apps/server/src/computer-use/shared/PARITY.sha256 b/apps/server/src/computer-use/shared/PARITY.sha256index 59d50ffa..eabb3622 100644--- a/apps/server/src/computer-use/shared/PARITY.sha256+++ b/apps/server/src/computer-use/shared/PARITY.sha256@@ -9,5 +9,5 @@ f11dd35d6db769398222387695262aeeac5dbaf9df16191d62a8811e8613e25d image.d.mts80e88fcc18b489720ef31dd273c15387606df3e9a2ffe4508762c5f51125b33c media.mjsc12540410a558f4b48960c75b7a09e0660d6de679a6e49e2542427530fd9a3d4 media.d.mts02be6c62de13f3c8a55a0167c751742086c16bfadb201e9ce8e7f1b955d2376d native-worker.mjs-42455d2fb02246b44a27b644f7f1f9bfdea9a11588442cf43f5ea57746a2403c portable-host.mjs+8d53edb30e8d8f582bb02cad06731266f7362dab3d98b08ed8e5d3b308ae7208 portable-host.mjs3adf92d8ab9fe7a1a8b595c090f6ba4f99ed10d5146c318cfbdf7b674aec9657 portable-host.d.mtsdiff --git a/apps/server/src/computer-use/shared/portable-host.mjs b/apps/server/src/computer-use/shared/portable-host.mjsindex 2bf1ee2d..6b386430 100644--- a/apps/server/src/computer-use/shared/portable-host.mjs+++ b/apps/server/src/computer-use/shared/portable-host.mjs@@ -178,7 +178,8 @@ export async function createPortableHost({ native, spool = null, settings, conteupdate();}native.onEvent((value) => {- if (value.event === "person-input") for (const s of sessions.values()) if (s.phase === "working" && s.mode === "control") pause(s, "person", "Your input paused computer use. Choose Continue when you are ready.");+ // The person's own answer to a question (a click or key in the app) is not a takeover.+ if (value.event === "person-input") for (const s of sessions.values()) if (s.phase === "working" && s.mode === "control" && !s.waiting) pause(s, "person", "Your input paused computer use. Choose Continue when you are ready.");if (value.event === "unavailable") for (const s of [...sessions.values()]) void stop(s, "stopped", "limit", { reason: "native_unavailable" });});const ticker = setInterval(() => {@@ -324,6 +325,9 @@ export async function createPortableHost({ native, spool = null, settings, conteapproval = { asked: true, reasons: decision.reasons.map((r) => r.code), by: "person" };if (!answer.allow) return finish({ ...common, approval, ok: false, code: "approval_denied", message: "The person did not allow this action. Ask them or choose another way." });if (sessions.get(s.id) !== s || s.phase !== "working") return finish({ ...common, approval, ok: false, code: "paused_by_person", message: "The session was paused or ended." });+ // Input from answering moved the worker's input generation on: act from the current one.+ const now = await native.call("state").catch(() => null);+ if (now && Number.isInteger(now.generation)) s.generation = now.generation;s.allowed.set(key, Date.now() + 30_000);if (s.allowed.size > 64) s.allowed.delete(s.allowed.keys().next().value);}