Skip to content

feat(desktop): embed read-only browser workspace#6

Merged
gu87 merged 4 commits into
upstream-main-cleanfrom
codex/desktop-browser-workspace-phase2a
Jun 7, 2026
Merged

feat(desktop): embed read-only browser workspace#6
gu87 merged 4 commits into
upstream-main-cleanfrom
codex/desktop-browser-workspace-phase2a

Conversation

@gu87

@gu87 gu87 commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an embedded Browser Workspace to the Electron desktop client.

This upgrades the existing /browser launcher placeholder into a real WebContentsView-backed browser surface with user-driven navigation, page state tracking, and read-only context extraction.

What Changed

  • Add WebContentsView lifecycle management for /browser.
  • Add URL bar navigation and browser controls.
  • Track browser state: URL, title, loading, back/forward availability.
  • Add read-only extraction:
    • DOM summary
    • screenshot capture
    • selected text
  • Add a renderer-only "Copy Context" action that copies formatted browser context to the clipboard.
  • Use a persistent browser session partition for login state.

Safety Boundary

  • Navigation/reload/back/forward/stop require source: "user".
  • No Agent click/type/submit APIs.
  • No main-process copy-to-chat IPC.
  • Copy Context does not send messages or insert into the composer.
  • executeJavaScript is static and read-only only.
  • Dangerous schemes are blocked.
  • Downloads, popups, and sensitive permissions are denied.
  • No old web dashboard plugin.
  • No independent browser-host subprocess.

Validation

  • npm run type-check --workspace apps/desktop — PASS
  • npm run build --workspace apps/desktop — PASS
  • npm run test:desktop:platforms --workspace apps/desktop — 79 PASS
  • Dev startup — PASS
  • Manual browser checks — PASS

Scope

  • Desktop Electron app only.
  • No Browser Workspace backend changes.
  • No executors/Kanban changes.
  • No web dashboard changes.
  • No automatic browser actions.

🤖 Generated with Claude Code

Gu and others added 4 commits June 7, 2026 09:45
- Add BrowserSessionManager (electron/browser-session.cjs) with:
  WebContentsView lifecycle, isolated persist:hermes-browser session,
  dangerous scheme blocking (file:, javascript:, data:, etc.),
  popup deny (external http/https → shell.openExternal),
  download prevention, sensitive permission deny
- Add browser IPC handlers in main.cjs:
  - mount / unmount / set-bounds (WebContentsView lifecycle)
  - get-state (URL, title, canGoBack, canGoForward, isLoading)
  - navigate / reload / stop / go-back / go-forward with source:'user' guard
  - is-available (HERMES_DESKTOP_DISABLE_BROWSER env guard)
  - page event forwarding (title, favicon, navigate, loading)
  - before-quit cleanup
- Add browser API bridge in preload.cjs
- Rewrite BrowserWorkspace UI with URL bar, nav buttons,
  ResizeObserver-based WebContentsView mount container, status bar
- Add TypeScript types for browser lifecycle, state, and navigation
- No extraction (screenshot/DOM/selected text) handlers
- No Copy to Chat UI

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add get-dom-summary handler (executeJavaScript for title, meta description,
  h1-h3 headings, body.innerText preview)
- Add get-screenshot handler (webContents.capturePage() → dataURL)
- Add get-selected-text handler (executeJavaScript for window.getSelection())
- All executeJavaScript calls are static, read-only DOM access only
- No preload bridge or DOM manipulation injected into embedded pages

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a renderer-only action that captures the current browser URL, title, DOM summary, and screenshot, then copies the formatted context to the clipboard.

This does not insert into the chat composer or send a message; composer insertion remains a future step.
@gu87 gu87 force-pushed the codex/desktop-browser-workspace-phase2a branch from 6bfb211 to 7700475 Compare June 7, 2026 01:48
@gu87 gu87 merged commit 38ae8cd into upstream-main-clean Jun 7, 2026
7 checks passed
@gu87 gu87 deleted the codex/desktop-browser-workspace-phase2a branch June 7, 2026 01:48
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