Skip to content

feat(browser): the live page fills the panel - #53

Merged
httpsphl merged 3 commits into
mainfrom
feat/browser-fit
Sep 30, 2026
Merged

httpsphl merged 3 commits into
mainfrom
feat/browser-fit

Conversation

@httpsphl

Copy link
Copy Markdown
Owner

What

The browser panel showed the bot's page at a fixed 1280 x 800, so a tall panel had the page small at the top and a large empty area below it. Now the page takes the shape of the room the panel has.

  • Daemon. New browser.resize {botId, width, height}: the room the watching connection's panel has for the page. The page keeps its 1280 of width, so sites keep their desktop layout (a narrow panel shrinks the picture, not the page), and takes the height that gives it the room's shape, between 600 and 2000. It applies to every tab, also to a browser that opens later, and the page goes back to 1280 x 800 when the last connection watching stops. Frames, the bounds of the owner's points and the bot's browser_scroll follow the size the page has now.
  • App. The panel measures itself under the address row, sets aside the place of the line about what the bot did and of the button to take over, and asks for that shape 300 ms after it stops changing. The picture is shown as large as fits, in the page's shape (CSS container units, no second measurement). Notices that come and go (the request for a hand, the bar that says you are in control) do not count, so they never resize the page under the bot or under the owner's mouse: the picture only gets a little smaller.
  • Spec 21.3, 21.7, 21.8, 21.10 and 21.11 (N3.1), and section 19 records what Edge 154 does when the size changes with a page open.

Decisions

  • The height follows the panel, the width does not. Following the width would hand the bot a phone layout every time the panel is narrow.
  • Only while someone watches. A bot working alone always gets the same 1280 x 800.
  • One size per browser, the last request wins.

Tests

  • crates/botloftd/tests/browser_panel.rs, with the real Edge: a size asked before the browser opens, a change with a page open (the page's innerHeight and the frames follow), the owner's points on the taller page, and back to 800 after browser.unwatch.
  • Unit tests for the shape rule and for the points.
  • browser.test.tsx with FakeBotloft: the panel asks for the right room, the bot's cursor lands right on a taller page, and closing the panel gives the page its own size back.
  • cargo fmt, clippy -D warnings, cargo test --workspace and pnpm check pass.
  • Seen in the dev preview (pnpm dev): the page fills a tall panel, follows the window's size, and keeps its size when taking control.

Still to see with real Claude Code

  • With a bot browsing a real site and the panel tall: the page fills the panel, and browser_screenshot gives the bot the taller picture without trouble (ask it to describe the bottom of the page).

The page was always 1280 x 800, so a tall panel showed it small with an
empty area below. While an app connection watches, `browser.resize` tells
the daemon the room its panel has for the page: the page keeps its 1280 of
width, so sites keep their desktop layout, and takes the height that gives
it the room's shape, between 600 and 2000. Frames, the owner's points and
the bot's scroll follow the size the page has. When the last one watching
stops, the page is 1280 x 800 again.

Spec 21.3, 21.7, 21.8 and 21.10 say so, and section 19 records what the
real Edge does when the size changes with a page open.
The panel measures the room it has under the address row and asks for a
page of that shape, 300 ms after the room stops changing. The picture is
shown as large as fits, in the page's shape. Notices that come and go
(the request for a hand, the bar that says the owner is in control, the
line about what the bot did) do not count: they never resize the page.

The preview's pages are drawn at the size the panel asks for.
Edge drops the frame of the new size while older frames wait to be
confirmed, and a page that stands still sends no other: the panel kept the
picture of the old size. After sizing the tabs the daemon waits for those
frames to be confirmed and starts the screencast over, which sends one.
The test with the real Edge now waits for a frame after each change; it
failed about half the runs before.
@httpsphl
httpsphl merged commit 8c06e06 into main Sep 30, 2026
3 checks passed
@httpsphl httpsphl mentioned this pull request Sep 30, 2026
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