feat(browser): replace the preview proxy with a real browser panel and an agent web tool (#2883)

The preview panel worked by proxying a dev server through OpenChamber's own
origin and rewriting the HTML that came back. Anything the rewriter did not
anticipate broke, and pages that refuse to be embedded never loaded at all.
This deletes the proxy (-1604 lines and its tests) and merges the preview and
browser panels into one surface backed by a real Chromium view.

What the panel is now

- A `<webview>` in its own session partition: logins and cookies persist, hot
  reload works because nothing is rewritten, DevTools are one click away.
- Annotation: pick one element, drag a region, or draw freehand, write a note,
  and it reaches chat with a screenshot of the visible page with the marks on it.
- Toolbar: hard reload, page zoom, device sizes, a light/dark switch that
  applies to the page rather than the app, and cookie/cache clearing scoped to
  the panel alone.
- Several pages at once, each tab showing the page's own favicon, and an address
  bar that suggests pages already visited in this project.
- Dev servers are listed from what is actually listening on the machine, checked
  against what a project announced, so a server is offered no matter how it was
  started. One that is still starting is waited for instead of failing.

Remote dev servers

The desktop app binds a local port and pipes raw bytes to the OpenChamber host
over the existing authenticated connection, so the page keeps its own origin at
the root of its own host. The reachable set is exactly what discovery reports
and is re-checked per connection, so an authenticated client cannot dial
arbitrary local services on the host. Links and redirects to another loopback
port stay on the machine that served the page. A tunnel that cannot be opened is
reported; it is never replaced by the plain loopback URL, which would answer
from the user's own machine under a remote address.

Agent control

Browser actions are a separate `openchamber_web` tool: open, snapshot, click,
type, scroll, inspect computed styles, resize between mobile/tablet/desktop, and
capture a screenshot into `.openchamber/screenshots/` in the project. The
existing `openchamber` tool keeps sessions, worktrees and scheduled tasks. Each
has its own setting in the new Settings -> General -> OpenChamber Tools section,
and the plugin is not injected at all when both are off.

Capability belongs to the connected client, not to configuration: a client
declares on its event stream that it can drive a page, which only a Chromium
host does. Exactly one client performs each request — it claims the request
before acting, and the first claim wins — because deciding by whose result
arrives first would be too late for a click that already happened. No client
listening is answered immediately with an explanation rather than a timeout.

Runtime boundaries

Web tabs get a plain iframe that can display a page but not inspect one. The
VS Code extension no longer offers the surface at all, since nothing that makes
the panel worth having works there. Mobile is unaffected.

Native boundary

Camera, microphone, location and device-picker requests from panel pages are
denied — Electron grants them by default when no handler is set, and the panel
loads whatever address the user types. Page capture, appearance emulation and
storage clearing verify that their target belongs to the panel's own session
instead of trusting a web-contents id from the renderer.

Persisted state

Stored `preview` tabs migrate to `browser` (v13 -> v14). Context panel tab
limits are now per surface, so filling one surface no longer evicts another's
tabs. Address history is stored per project and per runtime.

Documentation

`preview.mdx` and `desktop-browser.mdx` rewritten across all locales, the agent
tool settings path corrected, new `DOCUMENTATION.md` for the browser-control
broker and the dev tunnel, and the `ui-api-decoupling` skill updated where it
still described the deleted proxy.
This commit is contained in:
Bohdan Triapitsyn
2026-08-13 22:44:13 +03:00
committed by GitHub
parent 50613bb170
commit a5aa32446d
151 changed files with 10431 additions and 5587 deletions
+53
View File
@@ -1196,9 +1196,62 @@ export const dict: Record<I18nKey, string> = {
'contextRail.editorTree.toggle': '파일 트리 표시 전환',
'contextPanel.browser.open': '브라우저 패널 열기',
'contextPanel.browser.addressAria': '브라우저 주소',
'contextPanel.browser.history.label': '최근 주소',
'contextPanel.browser.history.forget': '기록에서 제거',
'contextPanel.browser.newTab': '새 브라우저 탭',
'contextPanel.browser.empty': '웹 브라우저',
'contextPanel.browser.emptyHint': '위에 주소를 입력하여 탐색을 시작하세요',
'contextPanel.browser.inspectUnavailable': '브라우저 패널에서 이 페이지를 검사할 수 없습니다.',
'contextPanel.browser.back': '뒤로',
'contextPanel.browser.forward': '앞으로',
'contextPanel.browser.reload': '새로고침',
'contextPanel.browser.hardReload': '캐시를 무시하고 새로고침',
'contextPanel.browser.zoomIn': '확대',
'contextPanel.browser.zoomOut': '축소',
'contextPanel.browser.zoomReset': '확대/축소 초기화',
'contextPanel.browser.clearCookies': '쿠키 삭제',
'contextPanel.browser.clearCache': '캐시 삭제',
'contextPanel.browser.clearedCookies': '쿠키를 삭제했습니다',
'contextPanel.browser.clearedCache': '캐시를 삭제했습니다',
'contextPanel.browser.clearFailed': '브라우징 데이터를 삭제하지 못했습니다',
'contextPanel.browser.stop': '중지',
'contextPanel.browser.openExternal': '시스템 브라우저에서 열기',
'contextPanel.browser.devTools': 'DevTools 열기',
'contextPanel.browser.deviceToolbar': '디바이스 도구 모음',
'contextPanel.browser.device.preset': '디바이스 프리셋',
'contextPanel.browser.device.responsive': '반응형',
'contextPanel.browser.device.width': '뷰포트 너비',
'contextPanel.browser.device.height': '뷰포트 높이',
'contextPanel.browser.device.rotate': '회전',
'contextPanel.browser.device.schemeSystem': '자동',
'contextPanel.browser.device.schemeLight': '라이트',
'contextPanel.browser.device.schemeDark': '다크',
'contextPanel.browser.device.schemeFailed': '페이지 외관을 바꾸지 못했습니다',
'contextPanel.browser.frameTitle': '브라우저',
'contextPanel.browser.loadFailed': '이 페이지를 불러오지 못했습니다',
'contextPanel.browser.waitingForServer': '개발 서버를 기다리는 중',
'contextPanel.browser.waitingForServerHint': '아직 연결을 받지 않습니다. 준비되는 대로 이 페이지를 불러옵니다.',
'contextPanel.browser.tunnelFailed': '이 개발 서버에 연결하지 못했습니다',
'contextPanel.browser.tunnelFailedHint': '{url} 은(는) OpenChamber가 실행 중인 컴퓨터에 있으며, 그곳으로의 연결을 열지 못했습니다. 이 화면에는 사용자 컴퓨터의 내용이 표시되지 않습니다.',
'contextPanel.browser.loadFailedUnknown': '페이지에 접근할 수 없습니다.',
'contextPanel.browser.crashed': '이 페이지가 응답하지 않습니다',
'contextPanel.browser.crashedHint': '페이지가 반복해서 중단되었습니다. 다시 시도하려면 새로 고치세요.',
'contextPanel.browser.devServers.title': '실행 중인 개발 서버',
'projectActions.toast.multipleServers': '여러 서버가 시작되었습니다. 브라우저 패널에서 선택하세요',
'contextPanel.browser.devServers.justStarted': '방금 시작됨',
'contextPanel.browser.devServers.unavailable': '실행 중인 개발 서버를 확인하지 못했습니다.',
'contextPanel.browser.devServers.remoteOnly': '이 서버들은 OpenChamber가 실행 중인 컴퓨터에 있습니다. 열려면 데스크톱 앱이 필요합니다.',
'contextPanel.browser.annotate.toggle': '페이지에 주석 달기',
'contextPanel.browser.annotate.intro': '앱 내 브라우저에서 주석을 단 선택 영역입니다.',
'contextPanel.browser.annotate.attached': '주석을 채팅에 첨부했습니다',
'contextPanel.browser.annotate.noSession': '주석을 첨부하기 전에 채팅 세션을 여세요',
'contextPanel.browser.annotate.noPage': '주석을 달기 전에 페이지를 불러오세요',
'contextPanel.browser.annotate.failed': '이 페이지에 주석을 달 수 없습니다',
'contextPanel.browser.annotate.tool.element': '요소',
'contextPanel.browser.annotate.tool.region': '영역',
'contextPanel.browser.annotate.tool.draw': '그리기',
'contextPanel.browser.annotate.commentPlaceholder': '변경 사항을 설명하세요...',
'contextPanel.browser.annotate.submit': '첨부',
'contextPanel.browser.trustNotice': '여기서 여는 페이지는 OpenChamber에 대한 전체 액세스 권한으로 실행됩니다 — 검사와 스크린샷에 필요합니다. 신뢰하는 사이트만 여세요: 악성 페이지가 데이터를 읽거나 사용자를 대신해 동작할 수 있습니다.',
'contextPanel.preview.actions.reload': '미리보기 새로고침',
'contextPanel.preview.actions.openExternal': '브라우저에서 열기',