diff --git a/apps/docs/content/blog/agent-cursor-drawn-by-chrome.mdx b/apps/docs/content/blog/agent-cursor-drawn-by-chrome.mdx new file mode 100644 index 00000000..06ddd72c --- /dev/null +++ b/apps/docs/content/blog/agent-cursor-drawn-by-chrome.mdx @@ -0,0 +1,89 @@ +--- +title: Moving the agent cursor out of the page +description: In turno-browser 0.7.0 the agent cursor was an element drawn into each page; since 0.11.0 the default asks Chrome to draw a highlight and a click ripple above the page, so the cursor adds nothing to it. The highlight is a rectangle because, as a code comment records, Chrome 158 did not paint a node highlight into the live view's frames, and that rectangle is what the 0.12.1 Retina fix corrected. +date: 2026-12-04 +tags: [research] +product: browser +releases: ["turno-browser@0.7.0", "turno-browser@0.11.0", "turno-browser@0.12.0", "turno-browser@0.12.1"] +--- + +When someone can see the browser, turno-browser shows where the agent acts. The first version, in 0.7.0, drew it inside each page. Since 0.11.0 the default asks Chrome to draw it, and the cursor adds nothing to the page. This post is about that move, and about one choice in it that a later release had to correct. + +## The cursor in the page + +turno-browser 0.7.0 added the [agent cursor](/docs/browser/agent-cursor): an arrow with the agent's name and the identity that glides to each element the agent acts on, a ring on the target, a ripple for each click, a typing bubble by a field, and a thin frame with a badge around the page while calls run. Several sessions on one identity's Chrome each get a cursor and a color of their own. + +
+ +It was built to stay out of the model's way. Everything it draws lives in a closed shadow root on one host element under ``, as the comment at the top of the file says: + +```ts title="packages/browser/src/agent-cursor-overlay.ts" + * What it draws lives in a closed shadow root on one host element under `` (never in + * ``, so `document.body.innerText` never holds it). The host is `aria-hidden` and `inert` + * (out of the accessibility tree, so out of every snapshot), `pointer-events: none` (never a + * target of a click or of `elementFromPoint`, so Playwright's hit test and "covered" check see + * through it) and `position: fixed` with `contain: strict` (no layout, no scroll of its own). +``` + +It is also hidden while `browser_take_screenshot` runs. The person watching sees the cursor; snapshots, screenshots and clicks do not. + +That kept the cursor away from the model. It did not keep it out of the page. The host element is still a node in the site's document, next to `` and ``: one element the site did not build. + +## Asking Chrome to draw it + +[turno-browser 0.11.0](/releases/browser/0-11-0) changed what the default, `cursor: "auto"`, draws. When the browser can be seen (Chrome has a window, or the [live view](/docs/browser/live-view) is on), turno-browser opens a DevTools protocol session on the page and asks Chrome for its own highlight on the element the agent acts on and its own ripple where each click lands: + +```ts title="packages/browser/src/agent-cursor-cdp.ts" + try { + const cdp = await page.context().newCDPSession(page); + await cdp.send("DOM.enable"); + await cdp.send("Overlay.enable"); + // Chrome 158's experimental ripple; an older Chrome still gets the highlight. + const send = cdp.send.bind(cdp) as (method: string, params?: object) => Promise; + await send("Page.setInputVisualization", { clicks: true }).catch(() => {}); + return { cdp, box: null, tone: "agent" as Tone, outline: false }; + } catch { + return false; + } +``` + +Both are painted by the browser above the page, like the boxes of Chrome's DevTools. The cursor inserts nothing, so it leaves the page's DOM and layout as they would be without it. That is true of the cursor only; other features still act in the page, such as the passkey watch, which wraps `navigator.credentials` on a sign-in page while the agent acts on it. The box is taken down while the model's screenshot is taken and drawn again after it. When Chrome refuses the protocol calls, the session is `false` and the cursor in the page is drawn instead. + +In 0.11.0 the box was always turno's blue. [turno-browser 0.12.0](/releases/browser/0-12-0) gave it the color of the action: blue for a click, violet while the agent types, red for a moment when the call fails, and amber while the browser waits for the person. + +| `cursor` | What is drawn | What the cursor adds to the page | +| --- | --- | --- | +| `auto` (default) | Chrome's highlight and click ripple, when the browser can be seen | nothing (the `on` element when Chrome refuses the protocol calls) | +| `on` | the named arrow, the ring, the ripple, the typing bubble, the frame and the badge | one element, `turno-agent-cursor`, with a closed shadow root | +| `off` | nothing | nothing | + +## A rectangle, not a node + +Chrome's overlay can highlight a DOM node (`Overlay.highlightNode`) or a rectangle given by its coordinates (`Overlay.highlightRect`). turno-browser draws a rectangle. The comment at the top of the file, from commit c2a8cbc (2026-11-26 UTC), records why; it does not say how this was measured: + +```ts title="packages/browser/src/agent-cursor-cdp.ts" + * Measured on Chrome 158: `Overlay.highlightNode` is not painted into screencast frames, so the + * live view would not show it; `highlightRect` is, which is why the box is drawn as a rectangle. +``` + +The rectangle has two costs. The first is in the docs: the box is drawn at the element's place, and if the page moves under it during the action, the box stays where the element was. + +The second was fixed in 0.12.1. 0.11.0 and 0.12.0 sent the CSS box as it was, so on a Retina screen it landed at twice its place; [the highlight that landed at twice its place](/blog/highlight-at-twice-its-place) has the measurement and the fix in [0.12.1](/releases/browser/0-12-1). + +## What the default does not show + +The default draws less than the cursor in the page. There is no arrow with the agent's name, no frame around the page while calls run, no badge and no typing bubble, and, as a comment added in 0.12.0 (a41a13e) notes, Chrome draws one highlight at a time, so each replaces the last. With [several agents in one browser](/docs/browser/sharing), a box in the default mode does not say whose it is. Those parts are still there with `cursor: "on"`, at the price of the element in the page. + +The comment from c2a8cbc records, for Chrome 158, that the ripple is painted into screencast frames and screenshots alike; turno-browser does not hide it. + +The ripple needs Chrome 158 or later; an older Chrome gets the highlight without it. Nothing is drawn in [read mode](/docs/browser/engines#read-mode-lightpanda), which lays out no page. + +## Sources + +The change to Chrome's highlight is [commit c2a8cbc](https://github.com/wimo-dev/turno/commit/c2a8cbc). diff --git a/apps/docs/content/blog/defaults-resolved-at-launch.mdx b/apps/docs/content/blog/defaults-resolved-at-launch.mdx new file mode 100644 index 00000000..9299922e --- /dev/null +++ b/apps/docs/content/blog/defaults-resolved-at-launch.mdx @@ -0,0 +1,105 @@ +--- +title: Turning features on by default without rewriting anyone's config +description: turno-browser 0.11.0 turned on features that identities had to opt into, without writing a value into an existing identity.json. Each default is worked out at every launch, a key the person set still wins, and show, status and doctor say where each value came from. +date: 2026-12-04 +tags: [research] +product: browser +releases: ["turno-browser@0.11.0", "turno-browser@0.11.1", "turno-cli@0.6.2", "turno-browser@0.14.0"] +--- + +Before turno-browser 0.11.0, the live view, flow recording, human-like input and tab sharing were each off until someone set a key for them in the identity's `identity.json`. [turno-browser 0.11.0](/releases/browser/0-11-0), released on 2026-11-28 with [turno 0.6.2](/releases/cli/0-6-2), turned them on by default. + +It did that without editing any existing `identity.json`. In the words of the changelog, the defaults are "worked out at every launch and never written into identity.json." An identity that nobody edited gets the new behavior at its next launch, and an identity whose owner had set a key keeps that key. + +## Why the defaults are not written down + +One setting already showed what happens when a default is stored. The vault index next to `identity.json` always carried a `submit` value, and wrote `confirm` when nobody chose. When 0.11.0 made `auto` the default, a stored `confirm` could mean a person's choice or no choice at all. The index now marks a choice apart: + +```ts title="packages/browser/src/vault.ts" +interface VaultIndex { + version: 1; + /** What an older turno-browser reads; this one reads it only with `submitChosen`. */ + submit: SubmitPolicy; + /** The person chose `submit` with `vault submit`; without it the default (`auto`) applies. */ + submitChosen?: boolean; // [!code highlight] + sites: Record>; +} +``` + +Only a `vault submit` the person runs sets that mark, so the changelog asks for `vault submit confirm` to be run again, "even if it was chosen before." + +The other defaults avoid that. The comment at the top of `defaults.ts` gives the reason: a key that is not in the file takes the default again at the next launch, "so a change of default never needs a migration, and the file keeps saying only what the person chose." A test in `defaults.test.ts` checks that resolving the defaults leaves no new file behind and does not change an existing one, down to its modification time. + +## The order of precedence + +Every key is resolved the same way: a `turno-browser-mcp` flag first, then `identity.json`, then the default. A default can depend on the launch itself. The low-resource preset is one: + +```ts title="packages/browser/src/defaults.ts" +function resources( + s: IdentitySettings | undefined, + ctx: DefaultsContext, + f: DefaultsFlags, +): Effective<"normal" | "low"> { + const asked = f.resources ?? s?.resources; + if (asked === "normal" || asked === "low") return f.resources ? flag(asked) : file(asked); + if (ctx.pressure === undefined) return atLaunch("the low-resource preset while memory is short"); // [!code highlight] + return ctx.pressure === "normal" ? auto("normal", "no memory pressure") : auto("low", "memory pressure"); // [!code highlight] +} +``` + +Each value comes back with its origin, such as the file, a flag, a fixed default, or `auto` with the condition that decided it. When the pressure is not known, the value is left undefined and the origin carries the rule instead of a guess. + +## What turned on + +The changelog entry of f717317 lists 11 changes for an identity nobody touched. Three other entries of 0.11.0 also turn something on: the last-click rule and system notifications, the `storage` tools, and natural language actions. The 11 changes of f717317, and how to keep each one from applying: + +| Feature | Default since 0.11.0 | To pin it | +| --- | --- | --- | +| Live view | on; it opens only with `turno-browser live` | `--live false` | +| Flows and screenshots | recorded; screenshots under the 200MB cap, never of a page that shows a vault value | `--record-flows false`, `--record-screenshots false` | +| `vision`, `pdf`, `devtools`, `network` tools | listed when the server has no `--caps`; in attach mode, `devtools` and `network` are off since [0.14.0](/releases/browser/0-14-0#changed-behavior) | `--caps` on the server | +| `browser_login` | submits the form | `vault submit confirm` | +| Low-resource preset | on under memory pressure | `--resources normal` | +| Human-like input | `auto` | `--humanize off` | +| Tab sharing | several sessions, each in its own tabs | `--sharing session` | +| Coherent user agent | in a headless Chrome, once `login` has read its client hints | `--user-agent off` | +| Background throttling | in a headless Chrome with the live view off | `--background-throttling false` | +| Locale | the system's, when `identity.json` names none | `--locale off` | +| Health check | the one `login` finds | `--health off` | + +`vault submit` is a command of its own and `--caps` a flag of the server; the other flags go to `turno-browser set `. The [upgrade notes of 0.11.0](/releases/browser/0-11-0#upgrade) list what changes for an existing identity. Other changes in the same release, and the side panel of 0.12.0, go through the same resolver, and the [Defaults](/docs/browser/identities#defaults) section of the docs keeps the current list. + +## Saying where a value came from + +A setting that is not in the file has to be visible somewhere else. `show` prints the defaults under their own heading; the docs page shows a shortened example: + +```text title="apps/docs/content/docs/browser/identities.mdx" +defaults (not in identity.json; decided at every launch): + live: on (default) + resources: auto (auto: the low-resource preset while memory is short) + humanize: auto (default) + sharing: tabs (default) + ... +``` + +`status ` gives the same values on its `defaults` row. `show`, `status` and `doctor` never pass the memory pressure to the resolver, even while a server runs (`doctor` reads it only for its own memory check). So for an identity with no `resources` key, `show` prints the `resources: auto (...)` line above. `doctor`, when `identity.json` has no problems, adds an info line with only the values the context decides, starting with "decided at launch". At launch the host passes it and the resolver decides; the test expects `resources: low (auto: memory pressure)` under pressure, though nothing prints that line. + +## Off, said out loud + +Leaving a key out now means "the default", so some keys needed a way to say "off". Format 14 of `identity.json`, new in 0.11.0, adds `false` for the keys that had no off value (`act`, `cache`, `captcha`, `proxy`, `health`, `userAgent` and `locale`), and `"auto"` as an explicit name for the default of four keys. A file is written as format 14 only when it uses one of these or sets `notify` or `lastClick` (and, since 0.12.0, `sidePanel`), so every other file keeps its format. turno-browser 0.10 refuses a format 14 file rather than read it wrong. + +## Two values that are stored + +Two defaults do touch disk, each for a reason in the code. For a new identity, `add` writes `"keychain": "system"` into `identity.json` only at a terminal, on macOS, with Google Chrome detected, when no browser, engine, attach or keychain option is given, and not with `--dry-run`. As `defaults.ts` notes, an existing identity keeps what its cookies were encrypted with, so this choice is made once, when the identity is created. The health check that `login` finds is written to the identity's state folder, not to `identity.json`, so a check the person writes still wins and `health: false` still turns it off. + +## What is still not solved + +A key left out follows the default of the turno-browser that runs. A later release can change what an identity does while its file stays the same. That shows in `show`, `status` and `doctor`, and in the changelog, not in the file. + +Defaults in code also live in help text and docs, and those did not follow on their own. [turno-browser 0.11.1](/releases/browser/0-11-1) ([pull request 181](https://github.com/wimo-dev/turno/pull/181)) corrected the help of `vault submit`, `record` and `set`, and docs pages, which still described the old defaults. + +Traces are the one recording that stayed off. `defaults.ts` keeps them off and gives the reason: tracing stops pages from loading images and frames of other sites. + +## Sources + +The change itself is commit `f717317`. diff --git a/apps/docs/content/blog/paired-runs-for-a-browser-benchmark.mdx b/apps/docs/content/blog/paired-runs-for-a-browser-benchmark.mdx new file mode 100644 index 00000000..86316b3c --- /dev/null +++ b/apps/docs/content/blog/paired-runs-for-a-browser-benchmark.mdx @@ -0,0 +1,155 @@ +--- +title: Measuring a 500 ms wait with paired runs +description: Lowering the wait after each browser action from Playwright's 500 ms to 100 ms cut the median paired wall time of nine scripted tasks by 36%, with the same calls. Running the two settings in alternating pairs is what made that readable on a busy laptop, and what showed the two tasks where the change could not be told apart from noise. +date: 2026-12-04 +tags: [benchmarks, research] +product: browser +releases: ["turno-browser@0.3.0", "turno-browser@0.4.0"] +measured: 2026-11-19 +method: /docs/benchmarks#evaluation-suite +environment: Apple M3, 16 GB, macOS, Node 26.13, Chrome 157 headless, turno-browser 0.3.0 +stat: + value: -36% + label: median paired wall time, nine tasks, 100 ms settle +--- + +turno-browser [0.3.0](/releases/browser/0-3-0) added a `settle` key to identity.json: the wait after each action, which is Playwright's 500 ms by default. To see what lowering it does, the repository's evaluation suite ran nine browser tasks five times with the default and five times with `"settle": "100ms"`, on 2026-11-19 (UTC). + +Across the nine tasks, the median paired difference was -9.9 s (-36%), with a 95% interval of -11.8 to -4.4 s. Every run of both configurations succeeded, with the same tool calls. For two tasks, `slow` and `find`, the suite could not tell the change apart from noise. + +The machine was busy with other work during the run, as the [benchmarks page](/docs/benchmarks#evaluation-suite) records. This post is about how the suite still got a usable number out of it. + +## What a run is + +Each task is a fixed script of tool calls on local fixture pages: fill a sign-up form, approve a popup, click a button a cookie banner covers, wait for a slow page, read values from ten tabs, type into a field two shadow roots deep, work in iframes, answer a `confirm()` dialog, find one price in a 400-row catalog. The script is not a model, so both configurations get exactly the same calls, and a difference in time comes from the server. + +Success is read from what the fixture site received, since each page posts what the user did, never from what the script believes. Every run gets its own server, Chrome and fixture site, and the clock starts after Chrome has. + +## Pairs, and an order that alternates + +With `--b`, every task runs in both configurations, back to back: + +```sh +pnpm bench:browser --b settle-100 --rounds 5 +``` + +Today the command runs the build of the checkout and ten tasks; the numbers here come from the suite at commit 6c56e3f with turno-browser 0.3.0. + +The configuration that goes first changes from one round to the next: + +```js title="bench/browser/lib/stats.mjs" +export function schedule(tasks, configs, rounds) { + const out = []; + for (let round = 0; round < rounds; round++) { + const order = round % 2 === 0 ? configs : [...configs].reverse(); // [!code highlight] + for (const task of tasks) for (const config of order) out.push({ round, task, config }); + } + return out; +} +``` + +A warm disk cache, a slow first start or a laptop that heats up then weighs on both sides. Each run is compared with its pair from the same round, not with a pool of runs from the other side. + +## What the pairs showed + +| Task | Default | `settle-100` | Difference | 95% interval | Pairs lower | +| --- | ---: | ---: | ---: | ---: | ---: | +| `form` | 1,354 ms | 542 ms | -59% | -1,012 to -699 ms | 5 of 5 | +| `popup` | 876 ms | 411 ms | -46% | -588 to -247 ms | 5 of 5 | +| `overlay` | 6,837 ms | 5,545 ms | -18% | -1,479 to -1,132 ms | 5 of 5 | +| `slow` | 3,789 ms | 3,106 ms | -13% | -940 to +3,013 ms | 4 of 5 | +| `tabs` | 9,549 ms | 6,518 ms | -31% | -5,847 to -1,938 ms | 5 of 5 | +| `shadow` | 1,205 ms | 329 ms | -73% | -1,046 to -728 ms | 5 of 5 | +| `frames` | 2,357 ms | 680 ms | -67% | -2,357 to -1,329 ms | 5 of 5 | +| `dialog` | 1,223 ms | 450 ms | -67% | -897 to -599 ms | 5 of 5 | +| `find` | 182 ms | 208 ms | +17% | -135 to +135 ms | 1 of 5 | +| all nine | 27,305 ms | 19,057 ms | -36% | -11.8 to -4.4 s | 5 of 5 | + +The times are medians of five runs. The difference is the median of the paired differences, relative to the default's median. For all nine, the medians alone differ by 30%. + +The saving is largest where a task is mostly actions: `shadow`, `frames` and `dialog` lost two thirds of their time or more. + +Peak memory was 935 to 1,123 MiB at the median outside `tabs` in both configurations, and 1,633 and 1,729 MiB in `tabs`, with ten tabs open. In `form`, `dialog` and `find` it was higher with `settle-100` in all five pairs, by a median of 23 to 64 MiB; for the other six tasks the interval crosses zero. + + + +`tabs` shows why the pairs matter. The default's five runs ranged from 7,449 to 13,999 ms and `settle-100`'s from 3,674 to 11,064 ms, so the two sets overlap. Pair by pair, `settle-100` was faster every time, by 1,938 to 5,847 ms. The slowest run of each configuration came from the same round, the fifth (13,999 and 11,064 ms). + +## Where the suite could not tell + +`slow` waits for a slow page and its late data. Four of five pairs were faster with the shorter wait, by 483 to 940 ms. The fifth was slower by 3,013 ms: in that `settle-100` run the first `browser_wait_for` took 4,805 ms, against 1,488 to 1,936 ms in the other nine runs. One slow run is enough to put the interval across zero, which is how the suite says it cannot tell. + + + +`find` has no click and no typing: a navigation and one `browser_find`. It took 182 ms at the median against 208 ms, and the paired differences ran from -135 to +135 ms. In a task that takes a fifth of a second, the suite cannot tell +17% apart from noise. + +## Five pairs and a bootstrap + +The interval is a 95% percentile bootstrap of the median of the paired differences: resample the differences with replacement 2,000 times, take the median of each sample, keep the middle 95%. + +```js title="bench/browser/lib/stats.mjs" +export function bootstrapMedian(diffs, { resamples = 2000, seed = 1 } = {}) { + const d = diffs.filter((x) => Number.isFinite(x)); + if (d.length < 5) return undefined; // [!code highlight] + const rand = seeded(seed); + const medians = []; + for (let i = 0; i < resamples; i++) { + const sample = d.map(() => d[Math.floor(rand() * d.length)]); + medians.push(median(sample)); + } + medians.sort((a, b) => a - b); + return [medians[Math.floor(resamples * 0.025)], medians[Math.ceil(resamples * 0.975) - 1]]; +} +``` + +The generator is seeded, so a report can be recomputed exactly from its raw runs. With fewer than five pairs there is no interval, and the suite ends its table with "Use --rounds 5 or more before trusting a difference." + +The median of five values is always one of them, so with five pairs both ends of the interval are differences that were actually measured. + + + +That is enough for the question the suite asks: does a change break a task, add calls, or cost time, tokens or memory. + +## A finding on the side + +In `overlay`, the first click hits a button a cookie banner covers. In all ten runs that click took between 5,031 and 5,087 ms, with either setting: it waited out Playwright's action timeout before turno said which element covered the button. The next release, [0.4.0](/releases/browser/0-4-0), names the covering element when it still covers the target 300 ms after the call, instead of after the 5 second timeout. + +## What this does not measure + +The tasks are scripted, so the suite measures the server's part of a task, not how a model decides. It ran once, on one machine. The tokens matched in every run but one: a `tabs` run of `settle-100` returned 6,820 tokens against 6,727 in the other nine, and the report does not say why. + +Since [0.11.0](/releases/browser/0-11-0) the wait after a click, key press or typed text ends as soon as the page is done with it. Its limit is [the longest Playwright's wait can be](/docs/browser/actions#actions): `settle` when the action started no request; with requests, `settle`, up to 5 s for them and `settle` again; after a navigation, `settle`, up to 10 s and `settle` again, one `settle` longer than Playwright. Read mode and one other [engine](/docs/browser/engines) keep the fixed wait. The numbers above describe 0.3.0, where the wait was fixed. + +## Sources + +Measured on an Apple M3 with 16 GB, macOS, Node 26.13 and headless Chrome 157, with turno-browser 0.3.0, from 04:25 to 04:34 UTC on 2026-11-19. The [raw runs](https://github.com/wimo-dev/turno/blob/acc16d6/bench/results/2026-11-18-m3-16gb-browser-eval-settle.json), in a file named 2026-11-18, keep every call of every run and the paired summary, and the suite came with [pull request 93](https://github.com/wimo-dev/turno/pull/93). diff --git a/apps/docs/content/docs/(docs)/concepts/gateway.mdx b/apps/docs/content/docs/(docs)/concepts/gateway.mdx index 84cc64c9..4f65506d 100644 --- a/apps/docs/content/docs/(docs)/concepts/gateway.mdx +++ b/apps/docs/content/docs/(docs)/concepts/gateway.mdx @@ -102,7 +102,7 @@ url = "https://mcp.linear.app/mcp" auth = "oauth" # mcpd logs in once per account: turno mcp login linear [server.docs] -url = "https://docs.example.com/mcp" # remote, no secrets: written straight into each profile +url = "https://docs.example.com/mcp" # remote, no OAuth and no secret reference: written straight into the Claude Code config ``` A remote server with `auth = "oauth"` or secret headers goes through mcpd, so no agent logs in to it on its own. You log in once per account: @@ -116,7 +116,7 @@ turno mcp login linear --profile personal On a machine without a browser, `turno mcp login linear --no-browser` prints the link. Open it on any machine; when that browser ends on a page that cannot load, paste the page's address into the waiting turno. Or fix the callback port with `--port ` and forward it beforehand (`ssh -L :127.0.0.1:`). -The tokens go to the secret store, never to a file or a log. A remote server without secrets is written straight into each profile and never touches mcpd. +The tokens go to the secret store, never to a file or a log. A remote server that needs no OAuth and no secret reference is written straight into the Claude Code config of each profile it is enabled for; other agents skip it, and it never goes through mcpd. ## The daemon as a service diff --git a/apps/docs/public/blog/agent-cursor-drawn-by-chrome/agent-cursor.png b/apps/docs/public/blog/agent-cursor-drawn-by-chrome/agent-cursor.png new file mode 100644 index 00000000..b3396078 Binary files /dev/null and b/apps/docs/public/blog/agent-cursor-drawn-by-chrome/agent-cursor.png differ