feat(#396): native approval UI for dangerous command, memory, and skill write requests (#397)

* feat(ws): add ApprovalRequest event type and parser

* feat(model): add ApprovalInfo field to ChatMessage

* feat(viewmodel): handle approval.request events and respondToApproval

* feat(ui): render Approve/Deny buttons for approval request messages

* test: add approval request event and respond RPC tests

* fix: add ApprovalRequest branch to ChatWsEventReducer exhaustive when

---------

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-06-26 15:53:11 +03:00
1 parent fafba3231b
commit cac15147f4
8 files changed
+285 -3

No files matched your search

@@ -105,6 +105,15 @@ object EventParser {
WsEvent.SessionUpdated(payload)
}
"approval.request" -> {
val command = payload?.get("command") as? String
val description = payload?.get("description") as? String
@Suppress("UNCHECKED_CAST")
val patternKeys = (payload?.get("pattern_keys") as? List<*>)?.filterIsInstance<String>()
WsEvent.ApprovalRequest(command, description, patternKeys, sessionId)
}
else -> {
Log.w(TAG, "Unknown event type: $eventType")
WsEvent.Unknown(rawJson)
@@ -85,6 +85,15 @@ sealed class WsEvent {
val error: JsonRpcError,
) : WsEvent()
// ── Approval request ────────────────────────────────────────────────
data class ApprovalRequest(
val command: String?,
val description: String?,
val patternKeys: List<String>?,
val sessionId: String?,
) : WsEvent()
// ── Fallback ─────────────────────────────────────────────────────────
data class Unknown(