Skip to content

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.

fix: enable island approval and question cards for Claude Desktop sessions

unknown38658ba45157
diff --git a/windows/hook/src/reply.rs b/windows/hook/src/reply.rs
index 2e6bd232..34c5bd37 100644
--- a/windows/hook/src/reply.rs
+++ b/windows/hook/src/reply.rs
@@ -9,10 +9,10 @@
use serde_json::{json, Map, Value};
/// The agents whose permission requests the island can answer: Claude Code
-/// (no `--agent`), Codex, Copilot CLI and Muse Code. Any decision for another
-/// agent is ignored here too, whatever the app sent.
+/// (no `--agent`), Codex, Copilot CLI, Muse Code and Claude Desktop. Any decision
+/// for another agent is ignored here too, whatever the app sent.
pub fn takes_decisions(agent: &str) -> bool {
- matches!(agent, "" | "codex" | "copilot" | "muse")
+ matches!(agent, "" | "codex" | "copilot" | "muse" | "claude-desktop")
}
/// Agents that read a JSON object on stdout after every hook and get `{}` —
@@ -49,9 +49,9 @@ pub fn stdout(agent: &str, event: &str, decision: Option<&str>, question: Option
None => None,
}
}
- // Claude Code and Codex share the documented hookSpecificOutput. Only
- // Claude Code asks questions.
- "" => decision.and_then(|d| decision_json(d, question)),
+ // Claude Code, Claude Desktop and Codex share the documented hookSpecificOutput.
+ // Claude Code and Claude Desktop can ask questions.
+ "" | "claude-desktop" => decision.and_then(|d| decision_json(d, question)),
_ => decision.and_then(|d| decision_json(d, None)),
}
}
@@ -186,7 +186,7 @@ mod tests {
fn each_agent_gets_its_own_reply_shape() {
let allow = r#"{"hookSpecificOutput":{"hookEventName":"PermissionRequest","decision":{"behavior":"allow"}}}"#;
let deny = r#"{"hookSpecificOutput":{"hookEventName":"PermissionRequest","decision":{"behavior":"deny","message":"Denied from Coucou"}}}"#;
- for agent in ["", "codex"] {
+ for agent in ["", "codex", "claude-desktop"] {
assert_eq!(stdout(agent, "PermissionRequest", Some("allow"), None).unwrap(), allow);
assert_eq!(stdout(agent, "PermissionRequest", Some("always"), None).unwrap(), allow);
assert_eq!(stdout(agent, "PermissionRequest", Some("deny"), None).unwrap(), deny);
@@ -246,8 +246,10 @@ mod tests {
let decision = &v["hookSpecificOutput"]["decision"];
assert_eq!(decision["behavior"], "allow");
assert_eq!(decision["updatedInput"]["questions"], question["questions"]);
- assert_eq!(decision["updatedInput"]["answers"]["Which one?"], "B");
- // Only Claude Code asks questions: an answer for anyone else is nothing.
+ // Claude Desktop can also ask questions.
+ let out_desktop = stdout("claude-desktop", "PermissionRequest", Some(r#"{"answers":{"Which one?":"B"}}"#), Some(&question)).unwrap();
+ assert_eq!(out_desktop, out);
+ // Only Claude Code and Claude Desktop ask questions: an answer for anyone else is nothing.
assert!(stdout("codex", "PermissionRequest", Some(r#"{"answers":{"Which one?":"B"}}"#), Some(&question)).is_none());
}
diff --git a/windows/src/island/agents.ts b/windows/src/island/agents.ts
index 68ccc6ce..7cc022f2 100644
--- a/windows/src/island/agents.ts
+++ b/windows/src/island/agents.ts
@@ -25,7 +25,7 @@ export const KNOWN_AGENTS: Record<string, KnownAgent> = {
* Must match `takes_decisions` in the relay (hook/src/reply.rs): any other
* agent's request is handed straight back to its terminal.
*/
-export const APPROVAL_AGENTS = new Set(["codex", "copilot", "muse"]);
+export const APPROVAL_AGENTS = new Set(["codex", "copilot", "muse", "claude-desktop"]);
/** Same rule as HookServer.validateAgent on macOS. "claude" is reserved. */
export function validateAgent(raw: string | undefined): string | null {
diff --git a/windows/src/island/hooks.ts b/windows/src/island/hooks.ts
index 63e5cb08..570d2bb5 100644
--- a/windows/src/island/hooks.ts
+++ b/windows/src/island/hooks.ts
@@ -475,10 +475,10 @@ function handleHook(island: Island, payload: HookPayload) {
if (pendingTimeout != null) window.clearTimeout(pendingTimeout);
const tool = payload.tool_name ?? "Tool";
const input = payload.tool_input ?? {};
- // Claude Code asking a question is not a permission to grant: the island
- // shows the options and sends back the one that was picked. Only Claude
- // Code asks questions this way.
- const questions = isExternalAgent ? null : askedQuestions(tool, input);
+ // Claude Code (including Claude Desktop) asking a question is not a permission to grant: the island
+ // shows the options and sends back the one that was picked.
+ const isClaude = !isExternalAgent || validAgent === "claude-desktop";
+ const questions = isClaude ? askedQuestions(tool, input) : null;
const view = questions ? "question" : "approval";
// The card always comes up, even over another pill or an island that is
// already open: its pill comes to the front, and the one you were on
diff --git a/windows/tests/agents.test.mjs b/windows/tests/agents.test.mjs
index 3b210cab..630edcd7 100644
--- a/windows/tests/agents.test.mjs
+++ b/windows/tests/agents.test.mjs
@@ -34,5 +34,5 @@ test("the agent tag is checked the Mac's way, and claude is reserved", () => {
test("approval cards are for the agents the relay answers, no one else", () => {
// Must match takes_decisions() in hook/src/reply.rs.
- assert.deepEqual([...APPROVAL_AGENTS].sort(), ["codex", "copilot", "muse"]);
+ assert.deepEqual([...APPROVAL_AGENTS].sort(), ["claude-desktop", "codex", "copilot", "muse"]);
});
diff --git a/windows/tests/hooks.test.mjs b/windows/tests/hooks.test.mjs
index ce9f49d1..aa6e498b 100644
--- a/windows/tests/hooks.test.mjs
+++ b/windows/tests/hooks.test.mjs
@@ -353,9 +353,33 @@ test("a Claude Desktop session gets the Claude Desktop pill, in its colour (Mac
assert.equal(desktop.color, "#D97757");
assert.equal(desktop.sessionId, "d1");
assert.equal(task().state, "idle");
- // Its permission requests are answered in the app, as on macOS.
- hook({ hook_event_name: "PermissionRequest", request_id: "r1", coucou_agent: "claude-desktop", tool_name: "Bash" });
- assert.deepEqual(sent("approval_decline"), [{ requestId: "r1" }]);
+ // Its permission requests get an approval card on the island (#328).
+ hook({ hook_event_name: "PermissionRequest", request_id: "r1", coucou_agent: "claude-desktop", tool_name: "Bash", tool_input: { command: "npm test" } });
+ assert.equal(State.pendingApproval?.requestId, "r1");
+ assert.equal(State.pendingApproval?.pillId, "agent_claude-desktop");
+ assert.equal(sent("approval_ack").length, 1);
+});
+
+test("Claude Desktop AskUserQuestion gets a question card on the island (#328)", () => {
+ hook({ hook_event_name: "SessionStart", cwd: "C:\\p\\proj", session_id: "d2", coucou_agent: "claude-desktop" });
+ hook({
+ hook_event_name: "PermissionRequest",
+ request_id: "q1",
+ coucou_agent: "claude-desktop",
+ tool_name: "AskUserQuestion",
+ tool_input: {
+ questions: [
+ {
+ question: "Proceed?",
+ options: [{ label: "Yes" }, { label: "No" }],
+ },
+ ],
+ },
+ });
+ assert.equal(State.pendingApproval?.requestId, "q1");
+ assert.equal(State.pendingApproval?.pillId, "agent_claude-desktop");
+ assert.ok(State.pendingApproval?.questions);
+ assert.equal(sent("approval_ack").length, 1);
});
// ── Main tool and Cursor ──────────────────────────────────────────────────────