Files
magpie/internal
yetone 8e27369bd6 browser: record_start and record_stop make a GIF of what an agent did
Asked for in chat ("Magpie Browser MCP 也要支持录屏哦"), like
claude-in-chrome's gif_creator. The browser tool gets two actions:

- record_start: from now on, after each action that can change the page
  (not tabs, snapshot, text, console, screenshot, tab_close), the gateway
  takes a picture of the session's window, 800 wide, with the action and
  what it was done to written in a strip under it (the url, ref, key or
  drag; never what was typed).
- record_stop: the frames as an animated GIF, a second a frame and the
  last three, each frame after the first only the rectangle that changed.
  It is kept an hour behind the image server's tokened files link and
  named in FilesMeta, so `magpie tool` saves it; the text says to curl it.

The gateway does it all through browser_screenshot, so every extension
version records and nobody has to reload theirs. At most 300 frames;
a recording nobody stops goes after 30 minutes. A picture an action's
screenshot: true asks for is the same one the frame is made from.

Run on mote (macOS, Chrome for Testing 1234 headless):
- GOOS=darwin/linux/windows go vet ./internal/gateway, gofmt -l: clean.
- MAGPIE_BROWSER_CHROME=... go test ./internal/gateway -count=1
  -timeout 45m: ok (794s).
- New: TestBrowserRecordsAGIF (real Chromium: navigate, type, snapshot,
  navigate → 3 frames, GIF fetched from the link, 800 wide),
  TestBrowserGIFFramesHoldWhatChanged, TestBrowserRecSayKeepsTypedTextOut,
  TestBrowserRecordStopWithNothing.
Broken by hand: with browserRecWorth always false, TestBrowserRecordsAGIF
is red ("no frames").
Not tried: a real headful Chrome, Edge or Arc; Windows and Linux browsers.
2026-11-04 00:10:50 +08:00
..
…
…
…
…
…
…
…
…