Open a page in the container's browser, at a viewport you choose
Build App / compute-version (pull_request) Successful in 4s
Build App / build-macos (pull_request) Successful in 2m31s
Build App / build-linux (pull_request) Successful in 5m14s
Build App / build-windows (pull_request) Successful in 5m56s
Build App / create-tag (pull_request) Skipped
Build App / sync-to-github (pull_request) Skipped

The pane could only ever watch a browser something else had published.
This opens one: a URL and a viewport, launched inside the container and
bound so the pane picks it up. Two uses, one action — a sign-in page,
where the callback listener is *in* the container and the loop closes
with no host round trip and no auth bridge, and a dev server on container
loopback, which is how you watch a UI Claude is building.

Reachable from both places the question comes up: "Open a page…" in the
Browser tab, and an "In container" button on the terminal's URL prompt.

Verified first, because it decided the design: a second client cannot
join a bound browser. `chromium.connect()` against the published endpoint
times out in every URL form (`ws+unix://…`, with and without the trailing
path) — that socket speaks the dashboard's own transport, not the public
connect protocol. Whoever launches is therefore the only process that can
drive, so the helper is resident and holds the handle, and live resize
applies to pages we opened and never to `@playwright/mcp`'s. Those take
`--viewport-size` / `PLAYWRIGHT_MCP_VIEWPORT_SIZE` at launch, which the
docs now say.

The viewport is the interesting half. Resizing the *window* does nothing
to the page — the viewer is a CDP screencast, so a bigger window is the
same pixels drawn larger, which is why pages have been looking like they
were rendered small. `page.setViewportSize()` genuinely reflows: measured
against a `@media (max-width: 900px)` rule, it fires at 800×600 and
clears at 1440×900. Match-window mode pushes the pop-out's settled size
into it, debounced by generation counter because a drag emits `Resized`
continuously and each one costs a container exec.

Control is a polled JSON file in /tmp: no port, no second listener,
nothing added to the proxy's surface, and URLs travel as argv to `node`
so no shell ever parses one. A re-open with a helper already up
navigates instead of relaunching — otherwise the second page would throw
away the session the first one just signed into.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-11 09:15:12 -07:00
co-authored by Claude Opus 5
parent bd72781482
commit f68d9c5788
14 changed files with 1073 additions and 7 deletions
+46 -1
View File
@@ -7,7 +7,11 @@ import { openUrl } from "@tauri-apps/plugin-opener";
import "@xterm/xterm/css/xterm.css";
import { useTerminal } from "../../hooks/useTerminal";
import { useAppState } from "../../store/appState";
import { awsSsoRefresh, uploadHostFileToTerminal } from "../../lib/tauri-commands";
import {
awsSsoRefresh,
openPageInContainerBrowser,
uploadHostFileToTerminal,
} from "../../lib/tauri-commands";
import { getCurrentWebview } from "@tauri-apps/api/webview";
import { UrlDetector } from "../../lib/urlDetector";
import {
@@ -529,6 +533,46 @@ export default function TerminalView({ sessionId, active }: Props) {
openUrl(safe).catch((e) => console.error("Failed to open URL:", e));
}, [urlPrompt]);
/**
* Open the prompted URL in the container's own browser instead of the host's.
*
* For a sign-in this is the shorter path: the callback listener the tool is
* waiting on is inside the container, so a container-side browser closes the
* loop with nothing crossing to the host. The page is published to the
* project's Browser tab, which is where the user completes it by hand.
*/
const handleOpenUrlInContainer = useCallback(() => {
if (!urlPrompt) return;
const safe = sanitizeRelayUrl(urlPrompt.url);
setUrlPrompt(null);
if (!safe) {
console.warn("Refusing to open a URL that failed validation");
return;
}
if (!projectId) return;
// A sign-in page is the one case where the *window* size matters least and
// the layout matters most, so it gets the ordinary desktop viewport.
openPageInContainerBrowser(projectId, safe, 1280, 720)
.then((result) => {
const push = useAppState.getState().pushToast;
if (result.error) {
push({ kind: "error", message: "The page didnt open", detail: result.error });
} else {
push({
kind: "success",
message: "Opened in the containers browser — see the projects Browser tab",
});
}
})
.catch((e) =>
useAppState.getState().pushToast({
kind: "error",
message: "Could not open it in the containers browser",
detail: String(e),
}),
);
}, [urlPrompt, projectId]);
const handleScrollToBottom = useCallback(() => {
const term = termRef.current;
if (term) {
@@ -606,6 +650,7 @@ export default function TerminalView({ sessionId, active }: Props) {
url={urlPrompt.url}
label={urlPrompt.label}
onOpen={handleOpenUrl}
onOpenInContainer={handleOpenUrlInContainer}
onDismiss={() => setUrlPrompt(null)}
/>
)}