Repository navigation
feat(rooms): a room page can reply, react and be told the room changed (rooms.react, rooms.unreact, rooms.watch) - #454
Merged
Conversation
…d (rooms.react, rooms.unreact, rooms.watch)
The member portal can send a message but not answer one, react, or learn a
room moved without a refresh button. Three additions to the page's
`window.vtaWallet.rooms`, behind the same gates as every room call (the
community's portal by its DID document, a room the member shared with it):
- `putMessage({ replyTo })` writes `inReplyTo`; `react` writes a record of
kind `reaction` naming the record (the shape `assembleRoomRecords` counts);
`unreact` writes an empty version over each of the member's own live
reactions with that value (`ownReactions`, `withdrawReactionAsMember`).
Where the room's profile does not list what the write needs, the wallet
refuses with the new code `recordMembersNotListed` before the member is
asked — never writing a reply without `inReplyTo`. Each is confirmed in the
wallet's window, which shows the record answered or reacted to as the
wallet read it, never the page's word.
- `watch` opens a port per room: the background arms a watch through the
member's VTA (`rooms/keys/watch/0.1`) in one shared `RoomWatcher`, passes
the room's `rooms/keys/changed` on to the ports that armed it — that it
moved and to which version, nothing more — re-arms after each read the page
reports, and cancels when the port closes. The page pings the port while it
watches. Older wallets have none of these; a page feature-detects them.
Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
stormer78
added a commit
to OpenVTC/verifiable-trust-infrastructure
that referenced
this pull request
Nov 26, 2026
…chat (#2828) The portal's chat could only send a plain message, and a member had to press refresh to see anyone else's. The wallet now replies, reacts and watches a room (OpenVTC/vta-browser-plugin#454); the portal uses all three, feature-detected, so an older wallet keeps today's chat. - Reply: a message's actions (hover or focus; a tap on a phone) offer Reply; the composer names what is answered and sends it as `putMessage`'s `replyTo`. - React: a small picker of reactions; a reaction chip the member added is theirs to take back (`unreact`). Counts, authors and "yours" are the wallet's reading; the page counts nothing. The wallet confirms each one. - A room whose profile does not list what a reply or reaction needs answers `recordMembersNotListed` and writes nothing: the page says so, stops offering both, and offers the words as a plain message. - Live: `room-live.ts` watches the room through the wallet, reads it again when told it moved and tells the watch what it read; while the wallet cannot watch it reads on a 20-second timer while the tab is visible, and watches again with backoff after a close. "Live" is derived from the latest event and drops the moment any other arrives (R6.2); a wallet without `watch` keeps the refresh button. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The VTC member portal shows a room as a conversation and can send a message, but it can't reply, react, or learn the room moved without a refresh button. This adds what the portal needs from the wallet, behind the same gates as every room call: the community's portal by its DID document, and a room the member shared with it.
Replies and reactions
rooms.putMessage({ hostDid, roomId, body, replyTo?: { key, version? } })writesinReplyTo.rooms.react({ hostDid, roomId, key, version?, value })writes a record of kindreaction: the value asbody, naming the record. That is exactly the shapeassembleRoomRecordscounts.rooms.unreact({ hostDid, roomId, key, value })writes an empty version over each of the member's own live reactions with that value on that record (ownReactions→withdrawReactionAsMember, over the version read), which only their author may. Answers{ withdrawn }.inReplyTo;kind+inReplyTo), the call is refused with a new wallet code,recordMembersNotListed(added topage-error.tsanddocs/page-bridge-errors.md). A reply is never sent without itsinReplyTo. Core refuses the same way as a backstop (RecordWriteRefused.code).rooms/keys/read,glimpseOf), never the page's description.Change signal
rooms.watch({ hostDid, roomId, sinceVersion? }, onEvent) → { read(version?), stop() }.ROOM_WATCH_PAGE_PORTper watch, relayed by the content script likeroomFileframes. The background checks the port's attested origin and the share, then holds the watch in one sharedRoomWatcher, so two tabs share a room's watch.rooms/keys/watch/0.1, offscreenwatchop), and armed again only after a read the page reports.rooms/keys/changed, taken only from the offscreen document, is passed to the ports that armed it as{ kind: "changed", latestVersion }and nothing else, after re-checking the share. Closing the port cancels the watch at the VTA (the last holder).RUNTIME_BROADCAST_EVENT, which reaches every tab of every origin.Older wallets have none of these methods; a page feature-detects them.
Tests
tests/rooms.reply-react.mjs(12)tests/room-page-reply-react-watch.test.mts(22): shapes, the profile check before any prompt, confirm contents, share/origin refusals, watch arm/fire/re-arm/cancel, a shared watch, a share withdrawn mid-watch, no VTA support →unavailable, offscreen react/unreact/watch, content-script port-name paritynpm run lint,npm test(123 / 1348 / 1600 / 6 / 9, all pass),npm run build