feat: reactions, link previews, mobile layout, TUI multi-network + /react usage hints
- TUI /react shows usage hint on bad/missing args instead of silently no-oping - README: document /join /net /react slash commands and Ctrl+N keybinding - README: add send_reaction IPC command and reaction IPC event to protocol reference - FUTURE.md: mark reactions, link previews, responsive mobile layout, TUI multi-network and TUI reactions as shipped; add prose sections for each - EXTENSIONS.md: add EXT-008 documenting reaction wire protocol, SQLite schema, IPC commands/events, history replay, and browser-mode implementation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -304,3 +304,74 @@ without a `mid` are assigned one at receive time and are not gossipped.
|
||||
|
||||
Emitted once per room after a `history_chunk` is fully processed. The UI
|
||||
should render these messages with a visual separator from live messages.
|
||||
|
||||
---
|
||||
|
||||
## EXT-008 — Message Reactions
|
||||
|
||||
### Wire message (`PeerMessage`)
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "reaction",
|
||||
"reaction_mid": "<32-hex mid of the target message>",
|
||||
"reaction_emoji": "👍"
|
||||
}
|
||||
```
|
||||
|
||||
Sent on the normal mesh DataChannel (same as `chat`). No signing beyond
|
||||
the existing channel-level encryption.
|
||||
|
||||
### Semantics
|
||||
|
||||
- A reaction is idempotent: the same `(mid, emoji, from_peer)` triple is
|
||||
stored with `INSERT OR IGNORE` — receiving a duplicate is a no-op.
|
||||
- There is no "un-react" wire message. Toggling off a reaction in the UI
|
||||
is a local-only operation in the current implementation.
|
||||
- `reaction_mid` must reference a message that exists in the local store;
|
||||
unknown mids are silently ignored.
|
||||
|
||||
### Storage
|
||||
|
||||
SQLite table added as a migration:
|
||||
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS reactions (
|
||||
mid TEXT NOT NULL,
|
||||
emoji TEXT NOT NULL,
|
||||
from_peer TEXT NOT NULL,
|
||||
reacted_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (mid, emoji, from_peer)
|
||||
)
|
||||
```
|
||||
|
||||
### IPC
|
||||
|
||||
**Command** — send a reaction (daemon and browser mode):
|
||||
```json
|
||||
{ "type": "send_reaction", "network_id": "...", "reaction_mid": "<hex>", "reaction_emoji": "👍" }
|
||||
```
|
||||
|
||||
**Event** — reaction received or replayed from history:
|
||||
```json
|
||||
{ "type": "reaction", "network_id": "...", "peer_id": "<64-hex>", "reaction_mid": "<hex>", "reaction_emoji": "👍" }
|
||||
```
|
||||
|
||||
Stored reactions are replayed as `reaction` IPC events when history is
|
||||
loaded (`sendStoredHistory`), so the UI always sees reactions alongside
|
||||
their messages.
|
||||
|
||||
### History replay
|
||||
|
||||
When `sendStoredHistory` sends a `history_chunk`, it also queries
|
||||
`ReactionsForRoom` and emits one `reaction` event per stored reaction so
|
||||
clients receive the full reaction state on reconnect.
|
||||
|
||||
### Browser mode
|
||||
|
||||
`browser.ts` mirrors the daemon behaviour independently:
|
||||
|
||||
- `PeerConn.sendReaction(mid, emoji)` broadcasts `{ type: "reaction", reaction_mid, reaction_emoji }` over the DataChannel.
|
||||
- Incoming `reaction` wire frames are dispatched as `reaction` IPC events.
|
||||
- `BrowserAdapter.send()` handles `send_reaction` commands and both broadcasts to all peers and emits a local `reaction` event.
|
||||
- `sendChat` includes the `mid` in the wire frame so reactions can reference it correctly across peers.
|
||||
|
||||
Reference in New Issue
Block a user