Files
piik/prototype/channel-browser/README.md
T
AAA 9770d61cc1 feat(channel): host rooms through the shared browser runtime
Load the Rust room owner in WASM, commit policy and history in IndexedDB, and fence competing pages with the existing binding identity. Connect availability and capabilities to the shared UI, align the frontend wire contract, and exercise real owner recovery and cross-room media.
2026-10-27 18:54:10 -04:00

1.8 KiB

Browser room adapter

The shared Rust RoomHost owns room commands, authorized views and history operations. IndexedDB supplies transactional storage; shared Rust prepares confirmations and history pages. The caller supplies authenticated domain member facts, without a credential database, and delivers its returned projection/reply after commit. The channel prototype loads this adapter through its Vite entry; regular 2.x builds do not require generated WASM.

The current room binding also owns writes to the room store. Claiming it reloads policy in the same IndexedDB transaction; old pages cannot overwrite a successor. Concurrent takeover rejects the conflicting instance. Reconnect opens the saved room again rather than letting that instance reclaim it. This uses IndexedDB's transaction scheduling, without holding a page-wide lock or adding a separate lease service.

Requires the repository's Rust/Node environment, wasm32-unknown-unknown, wasm-bindgen CLI 0.2.129, and installed agent-browser Chromium. Set WASM_BINDGEN to the CLI path if it is outside PATH. From the repository root:

node prototype/channel-browser/build.mjs
npx tsc -p prototype/channel-browser/tsconfig.json
node prototype/channel-browser/check.mjs

pkg/ and Cargo target/ are generated and ignored. The finite check owns its loopback server and browser profile, then removes both. Evidence stays under build/channel-browser-check/. It tests real WASM and IndexedDB, including reopen, original nonce confirmation, abort after insert success and pagination. Browser-hosted rooms currently advertise attachments unavailable; no file bytes go to the domain. It does not provide a second room UI or file service.