View opencode sessions on Even Realities G2 smart glasses.
Status: working prototype. Streams session status, assistant messages, tool calls, and permission prompts from opencode to the glasses display in real time. Approval write-back is stubbed (UI works, the call back into opencode isn't wired yet).
A two-process system for following along with an opencode session on the G2:
- Glasses app (
src/) — Even Hub plugin (Vite + TS) that renders the latest session event into a single text container. - Bridge (
bridge/) — Node process that subscribes to opencode's SSE event stream and rebroadcasts a compact subset over WebSocket.
opencode (:4096) ──SSE──► bridge (:7878) ──WS──► glasses webview
The point is short-form, glanceable "vibe coding" — not typing on the glasses, but staying in the loop while away from the keyboard.
@opencode-ai/sdk— bridge subscribes viaclient.event.subscribe()ws— bridge fanout to glasses clients@evenrealities/even_hub_sdk— glasses bridge into the Even Realities App WebView@evenrealities/evenhub-simulator— desktop preview@evenrealities/evenhub-cli— QR sideload +.ehpkpackaging- Vite + TypeScript
# one-time
npm install
npm run bridge:install
# in three terminals
opencode # 1. the agent (or `opencode serve` for headless)
npm run bridge # 2. SSE → WS bridge on :7878
npm run dev # 3. glasses dev server on :5173
npm run sim # 4. (optional) simulator pointing at the dev serverThe simulator window will show the latest event from the bridge. As you interact with opencode, you should see status changes, assistant messages, and tool calls appear on the simulated glasses.
Generate a QR that includes the bridge URL so the phone webview can reach it on your LAN:
npx evenhub qr --url "http://<lan-ip>:5173?bridge=ws://<lan-ip>:7878"Scan with the Even Realities App. The glasses app reads ?bridge= to find the WebSocket; defaults to ws://<page-host>:7878 if not provided.
| Var | Default | Purpose |
|---|---|---|
OPENCODE_URL |
http://127.0.0.1:4096 |
opencode HTTP server |
BRIDGE_PORT |
7878 |
WS port |
BRIDGE_HOST |
0.0.0.0 |
bind address (LAN-reachable so phones can connect) |
DEBUG |
unset | log unmapped opencode event types |
| opencode event | glasses display |
|---|---|
session.idle |
idle |
session.error |
error: … |
session.created |
new session: … |
message.part.updated (text) |
last ~400 chars of assistant text |
tool.execute.before |
▶ <tool> + truncated input |
tool.execute.after |
✓ <tool> |
permission.asked |
? <tool>\n<summary>\nclick=approve dbl=deny |
file.watcher.updated, lsp.*, installation.*, shell.env, server.connected |
dropped (too noisy) |
Set DEBUG=1 on the bridge to log unknown event types so the mapping can be extended.
npm run build
npm run pack
# -> codeview.ehpkUpload the .ehpk to the Even Hub developer portal.
- opencode SSE bridge
- glasses app renders session events
- permission prompt UI
- approval write-back — call opencode back to actually approve/deny
- paginate long assistant messages with swipe up/down
- session history scrollback
- Tailscale-friendly remote mode
- generalize bridge to also support Claude Code (HTTP hooks)
- ocuclaw — OpenClaw plugin for G2
- openclaw-glasses — voice assistant for Even G1
- openclaw-skills-even-g2-bridge — Cloudflare Worker bridge
- cc-g2 / Claude Code + G2 — approval workflow for Claude Code
- openclaw-claude-code — headless Claude Code wrapper
MIT