fix(#206): read clarify.request question/choices from gateway (#355)

* fix(#206): read clarify.request question/choices from gateway

The Hermes TUI gateway sends clarify.request payloads with "question" and "choices" fields, but the Android parser was looking for "text" and "options" — so the text was always null and the dialog showed only the input box.

Fix reads "question"/"choices" first, falls back to "text"/"options" for backward compat.

Test added for the new field names; existing test for legacy names still passes.

* fix(#206): clear default text in clarify input field

The input box was pre-filled with the clarify question text because the initial state was set to clarify.text instead of empty string.

* fix: use JsonRpcResponse instead of undefined WsResponse in EventParserTest

---------

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-06-24 23:54:47 +03:00
1 parent e7b2973c1c
commit 1bd56270b3
3 files changed
+35 -3

No files matched your search

@@ -81,8 +81,14 @@ object EventParser {
}
"clarify.request" -> {
val text = payload?.get("text") as? String
val rawOptions = payload?.get("options")
// Gateway sends "question"/"choices" — fall back to "text"/"options" for any
// older client or test that still uses the legacy field names. (Issue #206)
val text =
payload?.get("question") as? String
?: payload?.get("text") as? String
val rawOptions =
payload?.get("choices")
?: payload?.get("options")
val clarifyId = payload?.get("clarify_id") as? String ?: payload?.get("request_id") as? String
@Suppress("UNCHECKED_CAST")