refactor: simplify journal message types and implement GM rolls

Refactor journal message types to use flatter, more intuitive names:
- `narrative` becomes `chat`
- `article.reveal` becomes `reveal`
- `roll.request`/`roll.result` becomes a single `roll` type

Implement client-side dice roll resolution for GMs. When a GM uses
the `/roll` command, the result is now calculated locally using
`resolveRollPayload` before being sent to the stream, rather than
requesting a roll from the server.
This commit is contained in:
2026-07-06 18:06:32 +08:00
parent 59236f6dba
commit 0fc61e2f94
8 changed files with 99 additions and 96 deletions
+2 -2
View File
@@ -3,7 +3,7 @@
*
* Reactive state for a single session's message stream. Manages MQTT
* connection, local message log, per-sender sequence tracking, and the
* revealed-paths set (populated by the article.reveal reducer).
* revealed-paths set (populated by the link reducer).
*
* Session lifecycle (create/list/delete) is handled via MQTT retained
* topics — ttrpg/$SESSIONS for the manifest and ttrpg/{id}/meta per session.
@@ -29,7 +29,7 @@ export interface JournalStreamState {
/** Last sequence number per sender */
senderSeq: Record<string, number>;
/**
* Paths revealed by article.reveal messages.
* Paths revealed by link messages.
* Populated during hydration and live receipt via the type's reducer.
*/
revealedPaths: Set<string>;