A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
Windows: the chat field keeps the focus after an answer
ceo330476bce9c4
diff --git a/windows/src/views/chat.ts b/windows/src/views/chat.tsindex f11fea16..c97262d8 100644--- a/windows/src/views/chat.ts+++ b/windows/src/views/chat.ts@@ -299,7 +299,13 @@ export function buildPrompt(onHeightChange: () => void): ViewHost {drawModelButton();State.notify();onHeightChange();- input.focus();+ // Back to typing without a click. The field was disabled while the+ // answer came, which took the focus away, and the sync that enables it+ // again is a frame away: a disabled field can't take the focus.+ if (State.view === "prompt") {+ input.disabled = false;+ input.focus();+ }}}diff --git a/windows/tests/chat.test.mjs b/windows/tests/chat.test.mjsindex ff03d4a7..489fc72a 100644--- a/windows/tests/chat.test.mjs+++ b/windows/tests/chat.test.mjs@@ -122,3 +122,34 @@ test("a local answer streams into one reply, then the finished text replaces it"assert.deepEqual(State.chatHistory.map((m) => m.role), ["user", "assistant"]);assert.ok(!$(".model-btn").disabled);});++test("once the answer is in, the field takes the focus back, enabled", async () => {+ let finish;+ answers.chat_send = () => new Promise((resolve) => (finish = resolve));+ const input = $(".chat-input");+ const focused = [];+ input.focus = () => focused.push(input.disabled ? "disabled" : "enabled");+ input.value = "hello";+ $(".send-btn").fire("click");+ await flush();+ view.sync(); // mid-answer: the field is disabled+ assert.ok(input.disabled);++ finish({ text: "Hi!" });+ await flush(); // no sync yet: in the island it runs on the next frame+ assert.equal(input.disabled, false);+ assert.deepEqual(focused, ["enabled"]);+});++test("a failed answer leaves the chat for the note without taking the focus", async () => {+ answers.chat_send = () => Promise.reject(new Error("no key"));+ const input = $(".chat-input");+ const focused = [];+ input.focus = () => focused.push(true);+ input.value = "hello";+ $(".send-btn").fire("click");+ await flush();+ await flush();+ assert.equal(State.view, "note");+ assert.deepEqual(focused, []);+});