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.

feat(agents): notify and play sound when Antigravity asks a question (#690)

unknownacb4135cf01a
diff --git a/NotchBuddy/Sources/App/HookServer.swift b/NotchBuddy/Sources/App/HookServer.swift
index 3d6c37b0..42e17f29 100644
--- a/NotchBuddy/Sources/App/HookServer.swift
+++ b/NotchBuddy/Sources/App/HookServer.swift
@@ -548,10 +548,15 @@ final class HookServer: @unchecked Sendable {
guard tool != "AskUserQuestion" else { break }
upsertTask(pill: agentId, display: display, working: true,
externalAgent: isExternalAgent ? validAgent : nil)
- state.updateTask(id: agentId, state: .working)
+ let isQuestion = tool == "ask_question" || tool.hasSuffix(":ask_question")
+ state.updateTask(id: agentId, state: isQuestion ? .question : .working)
let input = payload["tool_input"] as? [String: Any] ?? [:]
let step = localizedStep(tool: tool, input: input)
appendStep(id: agentId, step: step)
+ if isQuestion {
+ SoundEngine.shared.play("question")
+ if state.isPresent { expandIfNeeded(to: .overview) }
+ }
nbLog("PreToolUse \(tool)")
case "PostToolUse":
@@ -1146,11 +1151,12 @@ final class HookServer: @unchecked Sendable {
"Task": String(localized: "step.agent", defaultValue: "Agent"),
"LS": String(localized: "step.lists", defaultValue: "Lists"),
"MultiEdit": String(localized: "step.edits", defaultValue: "Edits"),
- "NotebookEdit": String(localized: "step.notebook", defaultValue: "Notebook"),
- // Codex tools
+ // Codex tools
"apply_patch": String(localized: "step.edits", defaultValue: "Edits"),
"update_plan": String(localized: "step.tasks", defaultValue: "Tasks"),
"spawn_agent": String(localized: "step.agent", defaultValue: "Agent"),
+ // Antigravity tools
+ "ask_question": String(localized: "step.needs-input", defaultValue: "Needs input"),
]
var label = labels[tool] ?? tool
@@ -1176,7 +1182,14 @@ final class HookServer: @unchecked Sendable {
}
}
}
- return label
+ }
+
+ // ask_question: extract the question string
+ if (tool == "ask_question" || tool.hasSuffix(":ask_question")),
+ let questions = input["questions"] as? [[String: Any]],
+ let firstQ = questions.first?["question"] as? String,
+ !firstQ.trimmingCharacters(in: .whitespaces).isEmpty {
+ return "\(label) · \(oneLine(firstQ))"
}
if let cmd = input["command"] as? String {
diff --git a/windows/src/island/hooks.ts b/windows/src/island/hooks.ts
index ad01493d..5be064fa 100644
--- a/windows/src/island/hooks.ts
+++ b/windows/src/island/hooks.ts
@@ -113,6 +113,7 @@ const TOOL_LABELS: Record<string, string> = {
replace_file_content: N_("Edits"),
read_url_content: N_("Fetches"),
search_web: N_("Searches the web"),
+ ask_question: N_("Needs input"),
};
function stepLabel(tool: string, input: Record<string, unknown>): string {
@@ -126,6 +127,17 @@ function stepLabel(tool: string, input: Record<string, unknown>): string {
if (file) return `${label} · ${lastPathComponent(file)}`;
const query = str("query");
if (query) return `${label} · ${query.slice(0, 40)}`;
+ if (
+ (tool === "ask_question" || tool.endsWith(":ask_question")) &&
+ Array.isArray(input.questions) &&
+ input.questions.length > 0
+ ) {
+ const firstQ = input.questions[0];
+ if (typeof firstQ === "object" && firstQ !== null && typeof (firstQ as Record<string, unknown>).question === "string") {
+ const q = ((firstQ as Record<string, unknown>).question as string).trim();
+ if (q) return `${label} · ${q.slice(0, 40)}`;
+ }
+ }
return label;
}
@@ -341,10 +353,18 @@ function handleHook(island: Island, payload: HookPayload) {
ensurePill();
supersedeStop();
clearFinalLine(agentId);
- State.updateTask(agentId, "working");
const tool = payload.tool_name ?? "Tool";
- State.appendStep(agentId, stepLabel(tool, payload.tool_input ?? {}));
- surface("overview", false);
+ const isQuestion = tool === "ask_question" || tool.endsWith(":ask_question");
+ if (isQuestion) {
+ State.updateTask(agentId, "question");
+ State.appendStep(agentId, stepLabel(tool, payload.tool_input ?? {}));
+ Sound.play("question");
+ surface("overview", true);
+ } else {
+ State.updateTask(agentId, "working");
+ State.appendStep(agentId, stepLabel(tool, payload.tool_input ?? {}));
+ surface("overview", false);
+ }
break;
}
diff --git a/windows/tests/hooks.test.mjs b/windows/tests/hooks.test.mjs
index 6e965ef0..ead0f482 100644
--- a/windows/tests/hooks.test.mjs
+++ b/windows/tests/hooks.test.mjs
@@ -695,3 +695,27 @@ test("a declined permission request leaves the stop timer running", () => {
assert.deepEqual(sent("approval_decline"), [{ requestId: "r1" }, { requestId: "r2" }]);
assert.equal(task().state, "idle");
});
+
+test("Antigravity ask_question PreToolUse triggers question state and island alert", () => {
+ hook({
+ hook_event_name: "PreToolUse",
+ coucou_agent: "antigravity",
+ tool_name: "ask_question",
+ tool_input: {
+ questions: [{ question: "Which deployment strategy should we use?" }],
+ },
+ });
+ const t = task("agent_antigravity");
+ assert.ok(t);
+ assert.equal(t.state, "question");
+ assert.ok(t.steps.at(-1).includes("Which deployment strategy"));
+ assert.ok(asked.includes("alert:overview"));
+
+ // PostToolUse puts the pill back to working
+ hook({
+ hook_event_name: "PostToolUse",
+ coucou_agent: "antigravity",
+ tool_name: "ask_question",
+ });
+ assert.equal(t.state, "working");
+});