Skip to content

feat(cli): pass AskUserQuestion answers via permission RPC#803

Open
dragonkid wants to merge 1 commit intoslopus:mainfrom
dragonkid:feat/askuserquestion-answers
Open

feat(cli): pass AskUserQuestion answers via permission RPC#803
dragonkid wants to merge 1 commit intoslopus:mainfrom
dragonkid:feat/askuserquestion-answers

Conversation

@dragonkid
Copy link

@dragonkid dragonkid commented Mar 3, 2026

Summary

  • When a permission response includes an answers field (Record<string, string>), merge it into the tool's updatedInput so Claude Code receives structured user selections in the AskUserQuestion tool result
  • Enables remote clients (mobile app, Discord bot) to send selected answers through the existing permission RPC without a separate sendMessage call
  • No breaking changes — the answers field is optional and backward-compatible

Changes

packages/happy-cli/src/claude/utils/permissionHandler.ts

  • Added answers?: Record<string, string> to PermissionResponse interface
  • Updated handlePermissionResponse to merge response.answers into updatedInput

Context

Currently, remote clients like the Discord bot must use a two-step flow to answer AskUserQuestion:

  1. approvePermission (RPC) — approves the tool call
  2. sendMessage (HTTP) — sends the answer text separately

This causes Claude to treat the answer as a new user message ("Other" free-text input) rather than a structured selection. With this change, answers are passed directly through updatedInput.answers, which the Claude Code SDK natively supports.

Test plan

  • Smoke test: trigger AskUserQuestion from Claude Code, answer via remote client with answers field in permission response
  • Verify Claude sees structured selection (e.g., "The user selected 'PostgreSQL'") instead of "Other" free-text
  • Verify existing permission flow (approve/deny without answers) still works

🤖 Generated with Claude Code

When a permission response includes an `answers` field (Record<string,
string>), merge it into the tool's updatedInput so Claude Code receives
structured user selections in the AskUserQuestion tool result.

This enables remote clients (mobile app, Discord bot) to send selected
answers through the existing permission RPC without a separate
sendMessage call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant