feat: add AskUserQuestion tool support #60

Merged
naomi merged 2 commits from feat/ask into main 2026-01-23 14:11:18 -08:00
Owner

Summary

Implements support for Claude's AskUserQuestion tool, allowing Claude to ask the user questions with multiple choice options during a conversation.

Changes

  • Add UserQuestionEvent and QuestionOption types (Rust and TypeScript)
  • Detect AskUserQuestion in permission denials and emit claude:question event
  • Create UserQuestionModal component with option selection and custom answer input
  • Use stop/reconnect approach (same as PermissionModal) since Claude API doesn't accept tool_result for permission-denied tools
  • Add pendingQuestion to conversation store and hasQuestionPending derived store

Technical Notes

We discovered that Claude Code's permission denial system doesn't allow sending tool results back directly - the API rejects them with "unexpected tool_use_id found in tool_result blocks". The solution was to use the same stop/reconnect pattern that permissions use: stop the session, reconnect with context, and include the user's answer in the context restoration message.

Test Plan

  • Build compiles without errors (Rust + TypeScript)
  • Question modal appears when Claude uses AskUserQuestion
  • Can select options and submit answer
  • Answer is properly restored to Claude after reconnect

Closes #51


This PR was created with help from Hikari~ 🌸

## Summary Implements support for Claude's `AskUserQuestion` tool, allowing Claude to ask the user questions with multiple choice options during a conversation. ## Changes - Add `UserQuestionEvent` and `QuestionOption` types (Rust and TypeScript) - Detect `AskUserQuestion` in permission denials and emit `claude:question` event - Create `UserQuestionModal` component with option selection and custom answer input - Use stop/reconnect approach (same as `PermissionModal`) since Claude API doesn't accept tool_result for permission-denied tools - Add `pendingQuestion` to conversation store and `hasQuestionPending` derived store ## Technical Notes We discovered that Claude Code's permission denial system doesn't allow sending tool results back directly - the API rejects them with "unexpected tool_use_id found in tool_result blocks". The solution was to use the same stop/reconnect pattern that permissions use: stop the session, reconnect with context, and include the user's answer in the context restoration message. ## Test Plan - [x] Build compiles without errors (Rust + TypeScript) - [x] Question modal appears when Claude uses `AskUserQuestion` - [x] Can select options and submit answer - [x] Answer is properly restored to Claude after reconnect Closes #51 --- ✨ This PR was created with help from Hikari~ 🌸
naomi added 1 commit 2026-01-23 12:58:26 -08:00
feat: add AskUserQuestion tool support
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 54s
CI / Lint & Test (pull_request) Failing after 5m33s
CI / Build Linux (pull_request) Has been skipped
CI / Build Windows (cross-compile) (pull_request) Has been skipped
fd80864bf1
Implements support for Claude's AskUserQuestion tool, allowing Claude to ask
the user questions with multiple choice options during a conversation.

- Add UserQuestionEvent and QuestionOption types (Rust and TypeScript)
- Detect AskUserQuestion in permission denials and emit claude:question event
- Create UserQuestionModal component with option selection and custom answer
- Use stop/reconnect approach (same as PermissionModal) since Claude API
  doesn't accept tool_result for permission-denied tools
- Add pendingQuestion to conversation store and hasQuestionPending derived store

Closes #51
naomi added 1 commit 2026-01-23 13:13:01 -08:00
fix: lint and format issues in UserQuestionModal
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 56s
CI / Lint & Test (pull_request) Successful in 14m20s
CI / Build Linux (pull_request) Successful in 16m47s
CI / Build Windows (cross-compile) (pull_request) Successful in 27m20s
dafd1b4100
naomi merged commit 06810537a9 into main 2026-01-23 14:11:18 -08:00
naomi deleted branch feat/ask 2026-01-23 14:11:19 -08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#60