feat(chat): show agent message reactions (#1422)

This commit is contained in:
m57 authored and GitHub committed 2026-09-30 23:15:11 +03:00
1 parent 6e14c49df1
commit 0c336ecc4d
14 files changed
+289

No files matched your search

@@ -1,6 +1,7 @@
package com.m57.hermescontrol.data.ws
import android.util.Log
import com.m57.hermescontrol.data.model.parseMessageReactions
import com.m57.hermescontrol.ui.chat.extractTodosFromMap
import kotlinx.serialization.json.JsonObject
@@ -333,6 +334,20 @@ object EventParser {
WsEvent.ReactionEvent(kind)
}
"message.reaction" -> {
val rowId = (payload?.get("row_id") as? Number)?.toLong()
if (rowId == null) {
WsEvent.Unknown(rawJson)
} else {
WsEvent.MessageReactionUpdated(
rowId = rowId,
reactions = parseMessageReactions(payload["reactions"]),
role = payload["role"] as? String ?: "",
sessionId = sessionId,
)
}
}
"approval.request" -> {
val command = payload?.get("command") as? String
val description = payload?.get("description") as? String
@@ -445,6 +445,18 @@ sealed class WsEvent {
val kind: String = "",
) : WsEvent()
/**
* `message.reaction`: the agent (or another client) set/cleared a tapback on a stored
* message. [reactions] is the row's full list after the write; [rowId] is the gateway
* SQLite row id, matched against `ChatMessage.serverRowId`.
*/
data class MessageReactionUpdated(
val rowId: Long,
val reactions: List<com.m57.hermescontrol.data.model.MessageReaction>,
val role: String,
val sessionId: String?,
) : WsEvent()
// ── Replay resync (internal) ──────────────────────────────────────────
/** Internal: replay could not cover the reconnect gap (truncated or epoch change) — UI must refetch history. */