RPC: auto-cancel hook UI prompts

This commit is contained in:
Peter Steinberger
2025-12-10 11:46:28 +00:00
parent 8f37f15a33
commit 53c349cb86

View File

@@ -99,6 +99,8 @@ class TauRpcClient {
error?: string; error?: string;
message?: unknown; message?: unknown;
willRetry?: boolean; willRetry?: boolean;
id?: string;
method?: string;
}; };
if (evt.type === "response" && evt.command === "prompt") { if (evt.type === "response" && evt.command === "prompt") {
@@ -140,6 +142,19 @@ class TauRpcClient {
this.scheduleMaybeResolve(); this.scheduleMaybeResolve();
return; return;
} }
// Handle hook UI requests by auto-cancelling (non-interactive surfaces like WhatsApp)
if (evt.type === "hook_ui_request" && evt.id) {
// Fire-and-forget response to unblock hook runner
this.child?.stdin.write(
`${JSON.stringify({
type: "hook_ui_response",
id: evt.id,
cancelled: true,
})}\n`,
);
return;
}
} catch { } catch {
// ignore malformed/non-JSON lines // ignore malformed/non-JSON lines
} }