Skip to content

feat: ts/packages/web-console, the browser client - #15

Merged
Mearman merged 2 commits into
mainfrom
feat/web-console
Sep 10, 2026
Merged

feat: ts/packages/web-console, the browser client#15
Mearman merged 2 commits into
mainfrom
feat/web-console

Conversation

@Mearman

@Mearman Mearman commented Sep 10, 2026

Copy link
Copy Markdown
Member

Plan task #7: the browser client — a client of any node, not just the hub, built to static assets (vite) and servable from any origin with no Cloudflare tie.

Architecture, same as its siblings: a browser-side Transport adapter (src/adapters/websocket-transport.ts) implementing core's port over the browser's native WebSocket — the same one-CBOR-frame-per-binary-message convention the hub's Worker adapter speaks, with the same hostile-input split (undecodable bytes reject that connection; a decodable-but-unknown frame drops without disconnecting). A DOM-free session module (src/mesh-session.ts) owns everything with behaviour: the client side of the handshake exchange via core's negotiate() — including an explicit unanswered state after a timeout, because a relay-only node like the hub legitimately never answers a handshake and that should be displayed, not treated as an error — the peer directory assembled from gossip frames (latest advert per device winning), and the ordered frame log. src/main.ts is deliberately thin DOM wiring.

UI: connect form (node URL defaulting to the hub's wrangler dev port, domain checkboxes), negotiated-handshake status line, peer-directory table, live frame log with a send-ping button.

Verified against a real running node: wrangler dev on the hub, then the actual adapter and session modules (the same code the browser bundle imports — Node 26 provides the identical native WebSocket) connected to ws://localhost:8787: connecting → connected/pending → unanswered after the timeout, outgoing ping recorded. Static bundle verified serving via vite preview (HTML + JS module 200). 18 unit tests cover the adapter's port semantics and the session's negotiation/directory/frame-log/rejection behaviour against fakes.

Deferred, documented in the README: room browser / join-from-browser (no node serves room semantics yet — dead UI would be dishonest; the directory + frame inspector is the honest first pass), client identity (Web Crypto Identity adapter when a node requires one), and the live-hub e2e as a CI job (would couple console CI to a running workerd).

@Mearman
Mearman marked this pull request as ready for review September 10, 2026 16:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-10T16:50:18.986864Z 2199f0b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

A client of any node, not just the hub: a browser-side Transport adapter implementing core's port over native WebSocket (one CBOR frame per binary message, the hub's convention; undecodable bytes reject the connection, unknown-but-decodable frames drop without disconnecting), and a DOM-free session module owning the client side of the handshake -- with an explicit unanswered state, since a relay-only node legitimately never answers one -- the gossip-derived peer directory, and the ordered frame log. The UI is deliberately thin DOM wiring over those. Builds to static assets with vite, servable from any origin.

Verified against a locally-running hub (wrangler dev) using the same adapter and session modules the browser bundle imports: Node 26 provides the same native WebSocket, so the identical code path connected, observed the handshake go unanswered after the timeout, and recorded an outgoing ping. The room browser and join-from-browser UI are deferred and documented -- no node serves room semantics yet, and shipping dead UI for it would be dishonest.
@Mearman
Mearman merged commit 54fe563 into main Sep 10, 2026
5 checks passed
@Mearman
Mearman deleted the feat/web-console branch September 10, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant