* build(desktop): write the native driver's types from the crate build-native.ts now emits packages/desktop/src/native.ts from the crate's #[napi] items, the way napi build --dts does, and the loader is typed by it. CI's native job fails when a build changes the committed file. * build(desktop): write the driver types only with --types A release builds the addon with no workspace install, so the script loads @napi-rs/cli only when asked for types. CI's native job installs first and checks the committed file. * build(desktop): tighten the driver types after review scale_factor is always sent, the input id docs name every call that takes one, and a failed --types build removes its temp folder. * build(desktop): refuse a --types build that wrote no types With no type definitions the generator answers an empty string, which the header comparison let through. * build(desktop): check spread options and fail early without installs Options that reach a native call through a spread now carry the generated type, the type definitions go into cargo's target directory so a stopped build leaves nothing in TMPDIR, and --types without the workspace installed fails before cargo runs.
72 KiB
AGENTS.md
e2e — an agentic end-to-end testing framework. pnpm monorepo, ESM only,
TypeScript 7.
Contracts
There is no separate spec. The code is the contract, pinned in three places:
- The emitted
packages/e2e/dist/index.d.ts(anddist/engine/index.d.ts,dist/runner.d.ts,dist/reporters.d.ts,dist/oauth/*.d.ts), and@e2e-dev/core'spackages/core/dist/core/*.d.tsanddist/engine/index.d.ts, are the public API.packages/e2e/tests/types/sdk-types.tsholds compile-time assertions (@ts-expect-errorlines) for the parts that are easy to loosen by accident; it runs under the packagetypecheck, never under vitest. - Wire formats live in
packages/e2e/schema/*.schema.json(report-1, session-1, agent-judgment-2, the engine protocol's engine-manifest-1,e2e doctor's doctor-1, the scheduler's advisory timings-1, and the deprecated agent-judgment-1) with a valid and an invalid fixture each. Integration tests validate every generated report and session envelope against them;tests/unit/schema-fixtures.test.tschecks the fixtures. A wire change edits the schema, both fixtures, and the producer in one review. - Security invariants are the list under Gotchas below, enforced by tests in
tests/integration/agent-policy.test.tsand the secret-ledger unit tests. - Behavior changes update the matching
docs/**/*.mdxpage in the same change, including "not implemented yet" callouts, andskills/e2e/when the changed surface is described there.scripts/check-error-codes.ts(inpnpm check) fails when an error code in source is missing fromreference/errors.mdxorreference/engine.mdx, or documented but raised nowhere.
There are no RFCs or design documents in the repo. The why lives in PR
descriptions and commit bodies; git log and gh pr view are the archive.
Layout
packages/ holds what publishes to npm; crates/ holds every Rust crate,
one Cargo workspace with one Cargo.lock and one rust-toolchain.toml at
the root (sources only: scripts/native/, which takes an addon from
scripts/native/addons.ts, builds each addon into its npm package);
apps/ holds the private apps and suites that consume the built packages
the way a user would.
packages/core— the published@e2e-dev/corepackage, whiche2eis built on and depends on at its exact version (a changesetsfixedgroup keeps the two versions equal): the engine contract (@e2e-dev/core/engine, andsrc/engine/protocol/), locators (src/locator/), the agent (src/agent/, theactexecutor socket plus the judgment methods), the replay cache (src/cache/), secrets, and the session half of a worker:run/engine-sessions.ts(engine init and dispose, each attempt's session from launch to close, which the runner'sTargetExecutorextends),run/standalone.ts(the worker an@e2e-dev/corehost, a runner host, or MCP keeps alive, with aWorkerPolicyper kind), andrun/standalone-attempt.ts(one attempt: reservation, launch, fixtures, deadline, close).src/core/is its own surface:launchopens acoreattempt (no attempt published toglobalThis, no trace, no session deadline),SessionStatethesession-state-1export, andcreateAgent(@e2e-dev/core/agent) the agent with a per-cacheKeyreplay cache settled at session close. A host shares its static secrets with every session in the process while it is open (run/secrecy.ts), and inside a test the running attempt takes charge of the host and its sessions, records their steps, and keeps their video (run/guest-steps.ts), both throughglobalThis, so they hold between two installed copies of the package. It imports nothing ofe2e:tests/unit/package-imports.test.tsinpackages/e2efails on a dependency@e2e-dev/core's manifest does not declare.e2ereaches its modules as@e2e-dev/core/lib/<path>(./lib/*in its exports), which is not public API;@e2e-dev/core's behavior is tested bypackages/e2e's suites, through those paths and through the runner.packages/e2e— the publishede2epackage: SDK surface, runner, CLI, ande2e/engineande2e/agent, which re-export@e2e-dev/core's. A config's reporters and test filters resolve inconfig/resolve-run.tsover@e2e-dev/core'sresolveProjectConfig, and their types live insrc/run-types.ts. Core knows the contract and never an engine's internals: no engine package is imported fromsrc/(grep forfrom '@e2e-dev/andimport('@e2e-dev/; the presets below are the only hits). Engine words still appear as platform labels, capability names, and in error text that names a factory, such asconfig/targets.tstelling you to callweb(); no path through them reaches engine code. The one exception is thee2e initscaffold presets insrc/cli/init/engines.ts, which write the user's config and so name engine packages as text; the package build records the sibling packages' versions indist/cli/init/sibling-versions.jsonfor the ranges they write. Each preset owns its prompt label, dependencies, config, example, and run command; interactive choices derive from this list. These presets never import engine implementations.src/run/runner core (scheduler, units, workers, retries, sessions;standalone-kinds.tsthe hosted and one-shot kinds of@e2e-dev/core's standalone worker,host-trace.tsa hosted attempt'strace.md, andselect-target.tsthe target a session names, shared with MCP;open-session.tsexposesopenHostone2e/runnerfor another test runner: worker-lifetime provisioning, app processes, and engine init, thenhost.openSession({ name })for each test's fixtures, deadline, steps, artifacts, and trace at close. Only one hosted attempt may be opening, live, or closing per process; close it before opening another),src/collect/registration+selection,src/session-tools/the shared session tool catalog and handlers,src/mcp/thee2e mcpserver (a live session that rides theactsocket with a queue executor so every MCP call is a harness action; in a directory with no config,open_session {engine}names the engine as a package, whose default export is called, or as a factory call, a package with an export and options that may hold further such calls, whichmcp/default-engine.tsresolves in the project, beside e2e, or in~/.e2e/engines, never by a specifier written in core),src/oauth/subscription sign-in (thee2e login,logout, andmodelscommands and thee2e/oauth/*model constructors; each constructor subpath is the place its@ai-sdk/*optional peers are imported, and the Copilot constructor loads@ai-sdk/openailazily, only for the Responses models, so the CLI boots without any of them). The constructors and the CLI are the whole public surface: the flows, stores, and fetch behind them are module-private, not a library for other products.tests/live/holds hand-run checks that need a stored login and are never part ofpnpm test.
packages/web— the published@e2e-dev/webpackage: the browser engine, built with the publicdefineEngine, contributing thebrowserfixture andexpect(browser).@e2e-dev/web/engine(and@e2e-dev/mobile/engine) export the factory and types withouttest, so@e2e-dev/coreprograms never importe2e's main entry. It depends on@e2e-dev/core(peer), never the reverse, and one2eas an optional peer that only the main entry loads; a target names it explicitly asengine: web(). There is no default engine and no well-known id registry in core. It imports from@e2e-dev/core/engineonly: the semantics every engine must reproduce (error taxonomy, text and URL matching, assertion polling, JSON-value rules) are exported there, and an engine never imports@e2e-dev/core/lib/*.packages/mobile— the published@e2e-dev/mobilepackage: the iOS/Android engine on agent-device, built with the same publicdefineEngine, contributing thedevicefixture. Like the web engine it depends on@e2e-dev/core(peer) and optionallye2e, never the reverse; the engine implementation imports from@e2e-dev/core/engineonly, and a target names it asengine: mobile(). The@e2e-dev/mobile/toolssubpath holds the agent-sideopen_app,swipe, andalerttools; focused-field typing uses the engine's keyboard grammar. The main entry never loads the AI SDK.unstable_deviceSession()on./toolsgives custom tools the running attempt's raw driver session, likedevice.unstable_raw. The client is typed asDeviceSessionClient, exported from the main entry. The@e2e-dev/mobile/leasesubpath holds the agent-device lease plumbing device-cloud providers (testmu,browserstack,revyl) share: one daemon per slot, heartbeat, a release that fails unless the session end is confirmed, andagentDevicePlugin(), which checks a provider plugin's version and registers it in the daemon's home. ItsinstallLeasedApp()installs a target'sapp.appPaththrough any lease's daemon;easuses it too.packages/desktop- the published@e2e-dev/desktoppackage: the desktop engine (native apps through the OS accessibility tree), built with the same publicdefineEngine, contributing thedesktopfixture. It imports from@e2e-dev/core/engineonly, and a target names it asengine: desktop(). The engine drives macOS through its own Rust driver,crates/e2e-desktop-napi(a NAPI-RS crate), loaded into the worker's process and called directly (src/driver.ts): no CLI process and no JSON-RPC. Every native call that talks to another process runs on a blocking thread and resolves with an envelope that says whether input reached the app;callbounds it by the operation's budget and translates it. Unit tests driveDesktopSurfacewith a scripted driver (tests/helpers/fake-driver.ts) and run on any OS. The app it launches gets only a few variables of the run's environment (INHERITED_ENVinsrc/launch-ownership.ts): the driver launches throughopen -nwith exactly that environment, since LaunchServices hands the app the environment of the process that asks.pnpm --filter @e2e-dev/desktop build:native(needsrustupandpnpm install) buildspackages/desktop/desktop.<platform>-<arch>.node, which the loader takes in a checkout, and writespackages/desktop/src/native.ts: the driver's functions and argument objects as NAPI-RS reads them from the crate's#[napi]items. That file types the loader, is never edited by hand, and is committed with any change to those items (CI'snativejob fails on a difference). What a call resolves with is still written by hand indriver.tsandnodes.ts, named byts_return_typein the crate. A release ships the addon in@e2e-dev/desktop-darwin-arm64and@e2e-dev/desktop-darwin-x64(packages/desktop/npm/<platform>, where every native addon's platform packages live), optional dependencies withos/cpuset, in a changesetsfixedgroup with the engine, each with aTHIRD_PARTY_LICENSES.mdof the crates the addon links. After a change undercrates/, runcargo clippy --workspaceandcargo fmt --all --checkat the root, rebuild, and run the desktop testbed; after a dependency change, alsopnpm --filter @e2e-dev/desktop licenses:native, which CI checks. A prototype that runs on macOS only:prepareandinitrefuse any other OS.packages/electron- the published@e2e-dev/electronpackage: the Electron engine, contributing theelectronfixture, and the reference for an engine built outside this repository (ENG-892): it imports@e2e-dev/core/engineand nothing else at run time: it starts the binary and speaks the DevTools protocol itself (src/cdp/, typed bydevtools-protocol), never another engine or an automation library. What it needs from core becomes public contract (expressionSelectorscame from it);docs/engines.mdxlists the assumptions it broke.app.open()launches the project'selectronpackage onapp.appPath(orexecutablePath) with a private--user-data-dirper attempt;preparedownloads the Electron binary, since Electron 45 has no install script. Reads joinAccessibility.getFullAXTreeand oneDOMSnapshoton backend node ids (src/tree.ts, pure, tested on a captured read); actions run in an isolated world and send trusted input; the page-side code is typed functions insrc/in-page/, sent as source text (toString()) and tested in Chromium (tests/integration/). Windows are the tabs. Screenshots mask password fields and nested documents, and are withheld when the DOM snapshot finds one inside a closed shadow root, which no mask reaches (unmaskableCount, independent of the accessibility tree). The app gets only a few variables of the run's environment (INHERITED_ENVinsrc/app-process.ts) andelectron({ env }). A window that shows a local file outside the app's directory is not observed, traced, or captured (src/file-bound.ts): an Electron target has noapp.urlfor core's file-app bound to key on.packages/core/src/engine/protocol/- the engine protocol: the engine contract as LSP-style JSON-RPC (connectEngineclient,serveEngineserver, spawn/socket/loopback transports), so an engine can run in another process, machine, or language. The harness holds only protocol clients (ResolvedTarget.engineis anEngineClientHandle); adefineEnginehandle is served overloopbackTransport, so a contract change that cannot cross the wire fails in every suite.packages/kernel- the published@e2e-dev/kernelpackage: Kernel hosted browsers for the web engine. An official integration with a hosted service is one package per service, named after it (@e2e-dev/<service>), with the vendor SDK and the engine it plugs into as peers. It implements that engine's provider seam (BrowserProviderfor web,DeviceProviderfor mobile) and imports the engine's types only; the engines never know it exists. A service with providers for both engines ships them in that one package, each engine an optional peer and each provider on its own entry that never imports the other engine (@e2e-dev/testmuand@e2e-dev/testmu/web). Its docs page underdocs/integrations/ships with the vendor's logo on its overview card (authoring-docs, "Vendor logos");scripts/check-docs-logos.tsfailspnpm docs:checkwithout it.packages/notte- the published@e2e-dev/nottepackage: Notte cloud browsers for the web engine,attemptscope only, with a marker-file ledger forsweepsince sessions carry no tags. Maintained by Notte.packages/browser-run- the published@e2e-dev/browser-runpackage: Cloudflare Browser Run hosted Chromium for the web engine (BrowserProvider). It readsCLOUDFLARE_ACCOUNT_IDandCLOUDFLARE_API_TOKENfrom the run's environment when it acquires a browser, so importing a config needs no login. One session per worker slot by default, or a fresh browser per attempt withscope: 'attempt'; the CDP endpoint is built from the account and session id rather than taken from the response, so a response cannot send the token to another origin. Each session is journaled by id under the OS temp directory, andsweepdeletes what a killed worker left open.packages/lightpanda- the published@e2e-dev/lightpandapackage: aBrowserProviderthat starts a locallightpanda serveper worker slot and stops it with the run; no vendor SDK, the binary is the dependency.packages/moli- the published@e2e-dev/molipackage: aBrowserProviderthat runs a local Moli browser for the web engine, onemoli serveprocess on an available loopback port per worker slot, stopped when the lease is released. The binary isbinarywhen given, elseMOLI_PATH, thenPATH, then~/.local/bin/moli, resolved when a browser is acquired, so importing a config starts nothing; no vendor SDK, the binary is the dependency. On-demand layout and screenshots (--layout) and optional resource fetching (--resource) are on by default, andargspasses furthermoli serveflags. Worker scope only.packages/eas- the published@e2e-dev/easpackage: Expo Simulators hosted iOS simulators and Android emulators for the mobile engine (DeviceProvider). Expo publishes no SDK for the sessions API, so it calls Expo's GraphQL API withfetch, and@e2e-dev/mobileis its only peer.packages/smol- the published@e2e-dev/smolpackage: Chromium in smol machines microVMs on the runner's own computer for the web engine (BrowserProvider), through thesmolmachinesSDK's embedded engine (peer). Each worker slot boots one warm browser machine from the pinned Playwright Ubuntu image; a Node TCP relay exposes DevTools, and SDK agent readiness allows machine startup without waiting for published ports. Inattemptscope every attempt runs in a copy-on-write branch. Withapp, the app under test runs in the same machine, so a branch also copies its running app and data on the machine. When maintaining this integration, update the provider's SDK dev dependency to a published version and raise its peer minimum only if the provider needs new SDK behavior. Keep the Playwright image and Chromium version in sync with@e2e-dev/web. Runpnpm --filter @e2e-dev/smol test:unitandpnpm check, then verify live machines in both attempt and worker scopes with an app running in the VM.packages/limrun— the Limrun hosted mobile device provider. Each worker leases one remote device, installs its app, and releases the device at exit.packages/decision— the published@e2e-dev/decisionpackage: aStepExecutor(decisionExecutor()) that drivesagent.actandagent.assertthrough an AI SDK decision model answeringchoicequestions with probability distributions, plus an optional small language model that writes field values when the decision model pickstype.minProbabilityandminConfidencegate a chosen operation, target, secret, or assertion verdict. It also exportsdecisionFilter(), aTestFilterthat asks a decision model whether the pull request's diff can affect each test, packing test files into calls under the model's size limit, 8 calls at a time, and leaves out the unlikely ones. It runs every test on ane2e.configor lockfile change, and asks nothing about a test whose test file, setup file, or stored screenshots changed. It scores each test it keeps throughrelevance(1 for a touched test, the model's probability for a judged one, 0.5 for one it did not judge), and the runner starts each target's likeliest files first. A failed call leaves its tests in and the rest are still judged; after 3 failed calls it stops asking. When every call fails, or git or a file read fails, it throws, and the run warns and runs every test, the touched ones first, since the error carries their scores inrelevance.packages/acp— the published@e2e-dev/acppackage: aStepExecutor(acp(), withclaudeCode()andcodex()presets) that runsagent.actandagent.asserton a coding agent over the Agent Client Protocol, answersagent.waitForandagent.extractin a second, tool-less session (answer), and takese2e explore's rules andreport_findingthroughextend. The step tools (createGrammarTools,createVerdictToolfrome2e/agent) reach the agent as an MCP server on 127.0.0.1; permission requests for anything else are rejected, and a tool of the agent's own that runs without asking fails the step withPOLICY_DENIED.packages/github— the published@e2e-dev/githubpackage: the reporter that posts the run as one pull request comment from GitHub Actions and keeps it current on reruns, writing the same text to the job summary. It reads the token, event, and repository when the run finishes, never at config load, and renders the page withrenderMarkdownReportfrome2e.packages/html-reporter— the published@e2e-dev/html-reporterpackage:htmlReporter()writes the run as one self-contained page,<output>/report.html. The page is a React app (app/) that Vite builds into one HTML file with everything inlined; the reporter embeds the report-1 document in it and links artifacts fromresults/by relative path, so it opens fromfile://. Its styles are a copy of the e2e-site design system's tokens, with OFL fonts in place of Cassette, which the site's license does not let us ship.packages/testmu— the published@e2e-dev/testmupackage: TestMu AI (formerly LambdaTest) hosted Android emulators, iOS simulators, and real devices for the mobile engine (DeviceProvider), through agent-device's@agent-device/testmuplugin, and hosted Chrome and Edge for the web engine (BrowserProvider) from@e2e-dev/testmu/web.packages/revyl- the published@e2e-dev/revylpackage: Revyl hosted iOS simulators and Android emulators for the mobile engine (DeviceProvider), through agent-device's@agent-device/revylplugin. Revyl installs the build from anhttpsappURL when it starts each device.revylBrowsers()from@e2e-dev/revyl/web(BrowserProvider, attempt scope only) starts a Revyl web session per attempt and leases the single-use CDP URL Revyl mints for it. Verify a change against live Revyl sessions withREVYL_API_KEYset.packages/browserstack— the published@e2e-dev/browserstackpackage: BrowserStack App Automate real Android and iOS devices for the mobile engine (DeviceProvider), through agent-device's built-inbrowserstackprovider. Anhttpsappis uploaded once per run through the App Automate API, since the session'sappcapability takes onlybs://ids.packages/e2b— the published@e2e-dev/e2bpackage: E2B sandboxes for both engines, through thee2bSDK (peer). Every sandbox refuses public traffic; a loopback tunnel on the runner (src/tunnel.ts) adds E2B's traffic access token, and a lease names only that tunnel, so no lease carries that token.e2b()(DeviceProvider) boots oneandroid-16sandbox per worker slot, installs the engine's agent-device there behindagent-device proxy, and installs the target's.apkthrough that proxy with the agent-device client (pinned like@e2e-dev/mobile's); the lease'sdaemonis the tunnel, so the runner needs noadb.e2bBrowsers()from@e2e-dev/e2b/web(BrowserProvider) starts Chromium on a sandbox's loopback and creates the sandbox withmaskRequestHost, so E2B's edge rewritesHosttolocalhostand DevTools accepts the request. Keep the Playwright image indocs/examples/web/e2b-template.tsin sync with@e2e-dev/web. Runpnpm --filter @e2e-dev/e2b test, then verify live sandboxes on both engines, web in both scopes, withE2B_API_KEYset.apps/testbed(@e2e-dev/testbed, private) — dogfood project that consumes the built packages like a real user would: the playground app where every runner feature (sessions, routes, downloads, frames, uploads, serial groups, the executor seams, verdict edge cases, the reporter under stress,explore) has a deterministic test. Hard UI surfaces belong to the benchmarks, not here.apps/web-benchmark(@e2e-dev/web-benchmark, private) — a Next.js app of self-contained hard-surface scenarios (shadow DOM, canvas, iframes, native dialogs, planted bugs) at/e/<slug>, copied from the e2e-inc web benchmark, plus the e2e suites written against them (tests/andtests-agent/both gate PRs; the agentic one runs from its committed recordings, see "Committed recordings" under Gotchas). Scenario files are copies: keep diffs against the source minimal so scenarios port both ways, and never fix a planted bug. The one exception is Control Inventory, ours like the mobile benchmark's: plain controls, one exercise per agent verb the hard scenarios never reach, with one agentic test per verb intests-agent/control-inventory.e2e.ts.apps/mobile-benchmark(@e2e-dev/mobile-benchmark, private) — an Expo app of hard mobile surfaces (merged or hidden accessibility trees, native alerts over modals, keyboard-covered submits, virtualized lists, a WebView, OS permission and payment sheets), copied from the e2e-inc mobile benchmark, plus the e2e suites on the@e2e-dev/mobileengine (tests/locators only,tests-agent/oneagent.actper scenario). Both suites run in CI on an iOS simulator and an Android emulator (.github/workflows/mobile.yml; the Expo build is cached per native fingerprint and its JS repacked on a hit); the agentic one replays committed recordings and calls the model for a step with none, see "Committed recordings" under Gotchas. Scenario files are copies: keep diffs against the source minimal, and name no company a scenario was distilled from.apps/desktop-testbed(@e2e-dev/desktop-testbed, private) - a native AppKit app (app/macos/main.swift, built bypnpm build:appintobuild/SignInForm.app): a sign-in form, and a Controls window with one control per engine capability the form does not reach. Its e2e suites on@e2e-dev/desktop:tests/locators only,tests-physical/the physical pointer and keyboard (pnpm test:physical, which moves your pointer), andtests-agent/oneagent.act. Hand-run on a Mac with Accessibility permission and the native driver built; no CI job runs it yet.apps/electron-testbed(@e2e-dev/electron-testbed, private) - a small Electron app (app/: context isolation, a preload bridge, IPC, a second window, a closed-shadow password field) and the e2e suites on@e2e-dev/electron(tests/deterministic,tests-agent/with a model). Its windows stay hidden unlessE2E_ELECTRON_HEADED=1. Theelectronjob inspec.ymlruns it under xvfb, after the package's integration tests (pnpm test:electron-testbedby hand).examples/— standalone user-facing projects, one per technology (with-vite,with-next,with-astro,with-angular,with-expo,with-swiftui,with-compose,with-kotlin-multiplatform,with-flutter,with-maui), each the same one-screen greeter demo with deterministic and agent tests. They install the published packages from npm, sit outside the pnpm workspace, commit no lockfile, and gate no pull request; oxlint and fallow ignore them..github/workflows/examples.ymlruns every one nightly (23:00 Europe/Warsaw) on each platform it supports, with the packages packed from main swapped in for the npm ones, agent tests included, and posts one Slack message for the run (scripts/examples-nightly/, theSLACK_EXAMPLES_NIGHTLY_WEBHOOK_URLsecret). A new example or platform gets a matrix entry there. It also needs an official entry inexamples/examples.json(the list e2e.com/examples renders, partner and community repositories included) and a preset inpackages/e2e/src/cli/init/examples.ts;pnpm check:examplesfails without either. A change still runs the example's suite by hand and updates the "Last checked" line in its README. A native, Flutter, or .NET MAUI example (SwiftUI, Compose, Kotlin Multiplatform, Flutter, .NET MAUI) keeps its tests in ane2e/folder beside the native project, as a user would.docs/(the docs pages: the.mdxfiles underdocs/, navigation, redirects, and the page menu indocs/docs.json, the images underdocs/images/;docs/examples/is typechecked and shown verbatim on docs pages and inskills/e2e/(docs/examples/skill/), kept in sync byscripts/check-docs-examples.ts; a shell block that runsnpxornpm install/cisits in a<CodeGroup>ofnpm,pnpm, andbunblocks, which the site syncs site-wide, enforced byscripts/check-docs-package-managers.ts).docs/ja/,docs/zh/,docs/cs/,docs/es/,docs/pt/,docs/hi/,docs/fr/,docs/pl/, anddocs/id/hold the Japanese, Simplified Chinese, Czech, Spanish, Brazilian Portuguese, Hindi, French, Polish, and Indonesian translations, one page per English page at the same path, with the tab and group labels indocs/<language>/navigation.json. Translations are best effort: keep the English pages current in every change, and leave the translations to lag behind, since no contributor is expected to update a language they don't speak.scripts/check-docs-translations.tswarns on a stale outline, code block, or label. It fails on a translation whose English page is gone or that has no title, a language with nonavigation.json, and a line that repeats the end of the line above it (repeatedLinesinscripts/docs-prose.ts;authoring-docs"Translations"). Thee2ebuild copies the pages topackages/e2e/docs/(gitignored,packages/e2e/scripts/prepare-build.ts) so the published package ships them for agents to read offline.skills/e2e/— the agent skill for consumers:SKILL.mdplusreferences/<topic>.md, one pere2e guidetopic. It lives at the repo root becausenpx skills add e2e-inc/e2eonly looks in well-known directories. Thee2ebuild copies it topackages/e2e/skills/(gitignored) so the published package ships it;src/cli/skill.tsreads that copy first and the repo source as the fallback, ande2e initwrites it into a project's.agents/skills/and.claude/skills/.SKILL.mdopens with a table that routes each job to one reference, and every reference over 100 lines opens with a## Contentslist of its sections (tests/unit/skill.test.ts). Every consumer skill underskills/is named in the rootskills.sh.jsongroup, which puts it at the top of the skills.sh page.skills/create-verification-skill/: a generator skill for consumers; it writes a project-localverify-<app>skill and feature map on top of e2e, with the bug bash wired to the map. Installed withnpx skills add e2e-inc/e2e --skill create-verification-skill; not shipped in the package and not read bye2e guide.references/example/is the skill it generated and ran forapps/testbed: regenerate it when a playground route, label, or test it names changes.skills/migrate-to-e2e/: a consumer skill that ports a Playwright, Cypress, Selenium, Appium, Detox, Maestro, or TesterArmy suite one slice per session, the old suite running beside the new one, with aMIGRATION.mdprogress file the next session resumes from. It routes todocs/migrate/<runner>.mdxfor the API mapping, so a mapping change edits the guide, not the skill. Installed withnpx skills add e2e-inc/e2e --skill migrate-to-e2e; not shipped in the package and not read bye2e guide..dev/skills/— the skills we use to work on this repo (authoring-docs,babysit,merge-risk,ship-pr,verify,writing-pr).npx skills add e2e-inc/e2eoffers onlyskills/*: its default scan never looks in.dev/, and it skips.claude/skills/<name>, the relative symlink to each that agents load them through, because it does not follow symlinked directories. Its--full-depthscan does reach.dev/skills/; there the frontmatter'smetadata.internal: truehides them. A new repo-only skill goes in.dev/skills/with both. On Windows the symlinks need Developer Mode andcore.symlinks=true(CONTRIBUTING.md). The vendored third-party skills in.claude/skills/(unbox-ai,unslop, tracked byskills-lock.json) stay where they are: the CLI skips them as installed project skills. Each also carriesmetadata.internal: true, which keeps skills.sh from listing it on the e2e-inc/e2e page;npx skills updatedrops that line, so add it back.plugins/e2e/— one package of skills for Codex, Claude Code, Cursor, and Devin, and the e2e MCP server (mcp.json,npx -y e2e@<version> mcp) for all of them but Claude Code; Grok Build reads the Claude files. There is no.mcp.json: Claude Code loads one from a plugin's root without being told, andpnpm plugins:checkfails when it appears. The root.agents/plugins/marketplace.json,.claude-plugin/marketplace.json, and.cursor-plugin/marketplace.jsonall point here. Edit skill Markdown inskills/, then runpnpm plugins:sync;pnpm plugins:checkchecks the generated copies, license, the Claude, Cursor, and Devin manifests (generated from Codex's), every manifest'sversion, and the versionmcp.jsonpins, which is the runner's (version-packagessyncs it, so plugin installs update once per release; it does the same forpackages/e2e/server.json, the MCP Registry entry). The Codex manifest's other fields (itsmcpServerspath,./mcp.json, reaches the Cursor manifest too, and the sync drops it from Claude's), assets, README, and per-skillagents/openai.yamlare maintained in the plugin. Keep the package self-contained and leave the repository's development MCP configuration outside it. Example skills useSKILL.example.mdso clients do not discover them as additional skills. GitHub Copilot reads the generatedplugin.jsonandmcp.jsonat the plugin root (the Agent Plugins v1.0.0 format awesome-copilot's intake requires), ahead of.claude-plugin/;plugin.jsoncannot name MCP servers, so droppingmcp.jsondrops Copilot's server. The plugin's skill copies leave outmetadata.openclaw, since that spec takes string metadata values only (ClawHub publishes fromskills/), and a skill links no file outside its own directory. Devin reads the generated.devin-plugin/plugin.json(card fields and the server inline); its loader also reads the rootplugin.jsonand MCP files, which declare the samee2eserver. Its marketplace (CognitionAI/devin-marketplace) listsplugins/e2epinned to one commit of this repository, so a plugin change reaches Devin users only after a pull request there bumps thatsha.
Commands
Build first — nearly everything downstream consumes dist.
pnpm check # lint -> check:dead-code -> typecheck -> docs:check-errors -> check:peer-ranges -> check:changeset-bumps -> check:examples -> check:benchmark-coverage -> check:install-scripts -> plugins:check -> mcp-server:check -> docs:check (full gate)
pnpm test # builds, then vitest unit + integration
pnpm test:testbed # builds, then runs the real CLI against the playground app
pnpm test:web-benchmark # builds, then runs the real CLI against the benchmark scenarios
Focused work:
pnpm --filter @e2e-dev/core run build && pnpm --filter e2e run build
pnpm --filter e2e run test:unit # unit only; needs @e2e-dev/core built
pnpm --filter e2e exec vitest run tests/unit/scheduler.test.ts
pnpm --filter e2e exec vitest run -t 'name fragment'
pnpm --filter @e2e-dev/web run test
pnpm --filter @e2e-dev/testbed run test:headed
- Package
testscripts do not build. Rootbuildandtestorder the packages explicitly rather than relying on topological sort, becausee2edevDepends on the web engine for its browser-backed integration tests while the engine optionally peer-depends one2e— pnpm reports that cycle on every install.@e2e-dev/corebuilds first:e2eand every engine compile against itsdist. pnpm typecheckrunsbuildfirst, then per-packagetypecheck. The packagetypecheckcoverstests/**, which is what makestests/types/sdk-types.tsa test.- Integration tests need Chromium:
pnpm --filter @e2e-dev/web exec playwright-core install chromium. The web engine'spreparehook also installs a missing browser once per run, in the runner, beforecollectedis emitted and the run's clock starts.
Definition of done
Work is done when a human can review it without redoing any of it: verified
against the built packages, reviewed in a fresh context, green, every bot
thread handled, and labeled Ready for Human Review. "It compiles" and
"tests pass" are not done.
- Prove behavior with the
verifyskill (.dev/skills/verify) while iterating and before the PR: the built CLI on the testbed or a benchmark, thee2eMCP server (.mcp.json), a scratch project forinit, the docs site. If you cannot verify something, say so; never imply you did. - The PR body is the source of truth for the change (
writing-prskill):## What,## Why,## How it worksas numbered steps through the diff, then## Verified. It describes the head commit. After every push to a branch with an open PR, whatever the task was, run thewriting-prskill's "After every push to an open PR" steps. A push that changes how the PR works, its scope, or a measured number edits the body in the same step and captures stale evidence again. Run theunsloppass on the text you edit. A body and a diff that disagree are a review finding. ## Verifiedstates whether the change was run locally and carries the evidence: CLI output, a main-vs-branch table for fixes, thepnpm bench:abtable for a perf claim or a runner, agent, or engine change, apnpm record:terminalrecording when terminal output or UI changes, and the run's video for on-screen behavior.- Open every PR through the
ship-prskill (.dev/skills/ship-pr): checks, verification, fresh-context self-review, the PR, then thebabysitskill (.dev/skills/babysit) until the label is on. Asking for a PR means asking for all of that. A push, a merge conflict, a change request, or a move back to draft removes the label (.github/workflows/review-label.yml), so a labeled PR is always labeled for its current head. - On a PR from a fork you cannot add the label. Comment exactly
/readyas the PR's author once the gates in CONTRIBUTING.md hold: green, conflict-free, every review thread replied to and resolved. The workflow refuses it otherwise and lists what is open. Never resolve a thread just to pass: handle the feedback first. - Never merge or approve.
- When a reviewer (human or bot) corrects the same thing twice, encode it: make it impossible in types or structure, else a lint rule or a test, else a skill line, in that order of preference.
Non-obvious conventions
- Relative imports carry the
.tsextension (rewriteRelativeImportExtensions).import { x } from '../internal/ids.ts'— not.js, not extensionless. exactOptionalPropertyTypes+noUncheckedIndexedAccessare on. Optional properties use the conditional-spread idiom;oxc/no-map-spreadis disabled for exactly that reason.- Lint is
oxlintwithcorrectness/suspicious/perfas errors andstyle/pedanticoff.no-await-in-loopis intentionally off (sequential execution is the runner's contract). pnpm check:dead-coderuns fallow (.fallowrc.json): unused files, exports, dependencies, and duplicate export names fail CI. An export whose only consumer is a test is dead production API - make it module-private or move it. The class-member rule is advisory (warn) because it misses getters and callback-invoked methods.- JSDoc on new functions; avoid inline comments unless they explain why.
Testing quirks
- Vitest 5,
pool: 'forks', two projects.integrationis capped atmaxWorkers: 3and runs in a later group — do not raise it; CPU starvation produces timeouts indistinguishable from real failures. - Integration tests write throwaway projects into
packages/e2e/tests/tmp-projects/(gitignored) and import the runner fromdist/via a non-literal specifier so the fixture'se2eself-reference shares one registry. Staledistmeans confusing failures — rebuild. - Testbed suites beyond the default one never gate a PR:
test:agent/test:dogfood(real model calls, needAI_GATEWAY_API_KEY, optionalE2E_MODEL=provider/model-id, the testbed's own override) run only on the weekly.github/workflows/agent.ymlschedule or by manual dispatch. Both run against local deterministic apps, so a failure there is ours. - The default testbed suite runs
decisionFilterwith Jev on a pull request (apps/testbed/e2e.config.ts, with--changed-sincefromspec.yml), so a PR's testbed check runs only the tests Jev rates the change can affect; without the key, every test runs, and when a call fails, the tests no call judged run. The merge queue andmainpass no--changed-sinceand run every test, so the merge gate stays deterministic. Locally, every test runs unless you pass--changed-since origin/main. - Agentic assertions must be model-portable: assert on meaning (
toContain) and pair each agentic step with a deterministic locator check.
Inspecting agent runs with unbox-ai
e2e run --ai-trace records every model call of a run to .e2e/ai-trace.json
in the AI SDK devtools database shape ({ runs[], steps[] }). One run per
agent step, named <test title> · <api> "<label>"; one entry per model round
trip (an act turn, a waitFor poll, a judgment repair round) with the exact
prompt, the tool definitions and their JSON schemas, the response, usage, model
latency, and provider metadata. Recorder: src/internal/ai-trace.ts (an AI SDK
registerTelemetry integration, attributed through an async-local scope set
in run/execute.ts and run/steps.ts; workers drain on unit-done).
Use unbox-ai to read it — never
cat or Read the file, it is megabytes of resent context. The skill in
.claude/skills/unbox-ai/SKILL.md has the full workflow and recipes (other
agents: npx skills add e2e-inc/unbox-ai). Start wide, then drill:
AI_GATEWAY_API_KEY=... pnpm --filter @e2e-dev/testbed test:agent -- --ai-trace --no-cache
npx unbox-ai runs apps/testbed/.e2e/ai-trace.json # one line per agent step
npx unbox-ai summary apps/testbed/.e2e/ai-trace.json --run 3 # one step: turns, tokens, caching
npx unbox-ai tools apps/testbed/.e2e/ai-trace.json --run 3 # what the agent called, and how often
npx unbox-ai event apps/testbed/.e2e/ai-trace.json 2 --run 3 # one turn's new messages
npx unbox-ai compare apps/testbed/.e2e/ai-trace.json --run 3 --run 4 --trajectory
This is how to debug an agentic step: a wrong node id, a loop guard firing, a
prompt or tool description change, or where the tokens went. Reach for it
before changing prompts in src/agent/, and again after, with compare. In
integration tests, pass runOptions: { aiTrace: true } and read the file from
the fixture project (tests/integration/agent-ai-trace.test.ts shows how).
- Steps replayed from the replay cache make no model call and leave no run; use
--no-cachewhen you want the whole flow traced. - Cost shows as
-in unbox-ai (the devtools shape carries none); the AI Gateway'smarketCostis in each step'soutput.providerMetadata, and the--debugstep table prints dollars. - Live view while a suite runs:
npx unbox-ai devtoolsin the project directory, thenE2E_DEVTOOLS=1 ... test:agent -- --workers 1(the testbed agent config registers@ai-sdk/devtools; that recorder is one database per process, hence one worker). Prefer--ai-tracefor anything to keep. - "Trace" means three things here: the recorded actions the replay cache
keeps (
trace-1entries under.e2e/cache/), this AI trace, and the runner's trace page per test (.e2e/results/<test>/trace.md). Say which.
Cross-checking the web engine's tree
packages/web/tests/integration/crosscheck.test.ts reads every node of the
web engine's semantic tree against two oracles on the same page: Chrome's
accessibility tree over CDP (role, name, checked, disabled, expanded,
selected, pressed, heading level, and interactive nodes the tree left out)
and Playwright's getByRole(role, { name }) round trip, exact but tolerant of
icon-font glyphs the way the engine's role locator is. It runs on the
fixture pages in tests/crosscheck/fixtures.ts under pnpm test, and on
every web-benchmark scenario in benchmark.yml or locally:
pnpm --filter @e2e-dev/web-benchmark run build && pnpm --filter @e2e-dev/web-benchmark run start &
CROSSCHECK_BENCHMARK_URL=http://127.0.0.1:4280 pnpm --filter @e2e-dev/web exec vitest run tests/integration/crosscheck.test.ts
- Every disagreement must be listed in
tests/crosscheck/expected.txtwith a reason; a new one fails, and so does a listed one that stopped happening.E2E_CROSSCHECK_UPDATE=1rewrites the file keeping the reasons and marks new linesTODO, which fails until someone writes one. Review its diff: a removed line is a fix, an added one a change in what the model reads. - Deliberate vocabulary choices (a
listitemnamed from content,box, an editor host astextbox, Chrome's own role names) are policies at the top oftests/crosscheck/crosscheck.ts, each with its reason, not lines. - A reader change (
src/in-page/read-semantics.ts) runs it before the PR. A bug in that family starts as a fixture page line here. - Pages load with Playwright's clock paused (
openCheckPage), so a timer cannot replace a node between the engine's read and the oracles'. Content a timer reveals is never read: build fixture pages synchronously. tests/integration/conformance.test.tsholds the reader to a third oracle: the role and accessible-name expectations of the axe-core test suite (tests/conformance/axe-core/, vendored byte for byte through Playwright's copy, MPL-2.0). Its disagreements live intests/conformance/expected.txtthe same way, grouped by reason; a line that starts withBug:is a fix waiting to be made, and the fix deletes it.
Recording the terminal
pnpm record:terminal records a command in a real TTY as a video for the PR
body, at one size and font so recordings compare. It drives
VHS, which must be on PATH
(brew install vhs, or nix shell nixpkgs#vhs -c pnpm record:terminal ...).
Use it whenever a change alters what the terminal shows: CLI output, a
reporter, a prompt, watch or pause UI.
pnpm record:terminal --cwd apps/testbed --out /tmp/branch.gif -- node node_modules/e2e/dist/cli/bin.js run tests/todos.e2e.ts
pnpm record:terminal --cwd /tmp/e2e-main/apps/testbed --out /tmp/main.gif -- node node_modules/e2e/dist/cli/bin.js run tests/todos.e2e.ts
pnpm record:terminal --cwd apps/testbed --out /tmp/watch.gif --tape /tmp/watch.tape
The recording ends when the prompt returns, whatever the exit code. Several
arguments after -- are a program and its arguments; one is a shell line
("a && b"). A UI
that takes keys needs --tape <file> with the VHS commands to play (Type,
Enter, Ctrl+C, Wait+Screen /regex/, Sleep); the script owns the
output, shell, and size. .gif renders inside a markdown table, .mp4 and
.webm as players at the end of the body. The options are in the header of
scripts/record-terminal.ts; the tape builder is tested in
scripts/record-terminal/ (pnpm test:scripts).
Measuring a change against main
pnpm bench:ab runs a benchmark suite through two builds, the merge base
with origin/main (a worktree under the system temp directory, installed and
built once per commit) and the working tree, in pairs in a seeded random
order, and prints a markdown table for the PR body. Use it for any perf claim
and before and after a change to the runner, the agent loop, or an engine:
pnpm bench:ab -- tests-agent/control-inventory.e2e.ts --config e2e.agent.config.ts
pnpm bench:ab --suite testbed --threshold 3 -- tests/forms.e2e.ts
Arguments after -- go to e2e run; the options are in the header of
scripts/bench-ab.ts. What it reports, in order:
- Behavior. A test whose status, attempts, or step sequence (kind, api, label, status, error code, cache mode) differs between the builds, or between two runs of one build, is listed and left out of the timings. This is the regression check: a perf change that alters behavior is not a perf change.
- Timings: the whole suite, the observe, action, and model event phases, and
every step api, each as the median paired change with a bootstrap 95%
interval,
faster,slower, orsameagainst±--threshold, elseunresolved. Sampling stops once the suite's interval resolves. - Counters that should not move within one build: steps, events by kind, observed nodes and bytes, cache modes, model calls and tokens, run exit code. A change here is exact and needs no statistics.
Runs go with CI=1: committed recordings replay read-only, a step with none
calls the model. A load average above half the cores is warned about; shared
CI runners are too noisy for wall-time verdicts, so trust the behavior and
counter sections there. The harness's statistics have unit tests under
scripts/bench-ab/ (pnpm test:scripts).
Microbenchmarks
pnpm microbench measures small pure-JS functions (secret redaction,
locator resolution, mobile tree projection; the cases are in
scripts/microbench/cases.mjs) as instruction counts under Valgrind's
Cachegrind, so the result does not move with the machine's load. Valgrind
runs on Linux only; on macOS, --tool time runs the same cases on wall time
as a smoke check.
pnpm microbench --trials 10 --base-root . # repeatability: one build against itself
pnpm microbench --base-root /path/to/base/checkout # base against this checkout
pnpm microbench --tool time --case redact # local smoke run, noisy
- Each trial runs a case in two fresh processes, N and 3N iterations, and
keeps the difference: startup, loading, warmup, and compilation cancel.
Cases and inputs come from this checkout, the code under test from each
--root/--base-root, which must be built. Give both roots paths of the same length: a different length moved one case by a fixed 0.075% between builds of the same code, and the harness warns about it. - The default mode,
jitless, counts the interpreter only, regexps included; in CI, the trials of one commit spread at most 0.17% per case.--mode jitkeeps V8's compilers under--predictable,--single-threaded,--predictable-gc-schedule, and fixed seeds, but V8 still optimizes differently in some processes and its trials cluster up to 2% apart: use it to look at JIT behavior, not to compare. Every process runs with--v8-pool-size=0, and with ASLR off (setarch -R) on Linux. Counts are not wall time. - A direction is reported only when the base and head trial ranges do not
overlap and the change reaches the noise floor (
--threshold, 0.5% for instruction counts).--expect-same(implied by one directory twice) makes the run a repeatability check, which exits 1 when any case's ranges separate, under the floor too. .github/workflows/microbench.ymlruns both checks on a Blacksmith runner with one pinned Node version; dispatch it with abaseref to compare. On a pull request from this repository it posts the comparison and the repeatability result as one comment and edits it on every run; a fork's or Dependabot's pull request has the tables in the job summaries only. A measured regression never fails the job: read the comment.- A case's
child.mjsandcases.mjsare plain JavaScript:--jitlessturns off WebAssembly, which Node's TypeScript stripping needs.
Golden device trees
packages/mobile/tests/fixtures/snapshots/{ios,android}/ holds raw
agent-device snapshots of the mobile benchmark's home list and every
scenario's first screen, captured from a real simulator and emulator, beside
the tree each one projects to (<scenario>.tree.txt: role, name, text,
value, states, test id, attributes, one node per line, no geometry).
tests/unit/captured-snapshots.test.ts projects them the way observe does
under pnpm test, so a change to src/nodes.ts shows up as a diff of the
trees, on both platforms, without a device.
- After a reader change,
E2E_GOLDEN_UPDATE=1 pnpm --filter @e2e-dev/mobile exec vitest run tests/unit/captured-snapshots.test.tsrewrites the trees; the diff is what the model and the locators now read. Review it like code. - Re-capture after an agent-device bump or an app change, with the current
build installed (
pnpm ios/pnpm androidin the app), one platform at a time:pnpm --filter @e2e-dev/mobile-benchmark run capture:snapshots --target ios-simulator(orandroid-emulator), then update the trees. A bump that changes the snapshot shape is exactly what this catches.
Gotchas
-
Status prose drifts.
README.md(the build copies it intopackages/e2e/for npm) and the docs pages can claim things that have since landed or been removed (the located verbs and the locate cache are both gone, for example). Verify againstsrc/before repeating or relying on any "not implemented yet" list — and fix the prose when you find it stale. -
Committed recordings. The two benchmarks commit their agentic suites' replay cache (
apps/web-benchmark/.e2e/cache/,apps/mobile-benchmark/.e2e/cache/; their.gitignores leave it tracked, the testbed's ignores its own, since fixture-app recordings are worth nothing to anyone). CI replays the entries read-only and calls the model for a step with no recording, so those suites gate a pull request at deterministic speed and cost. On a pull request they run for this repository's branches only, since a fork's has no key; the merge queue runs them, with the key, for every queued pull request the change reaches. Re-record with the package'stest:agentand commit the changed entries in the same pull request as the scenario change. The web benchmark's agent job runs with--strict-cache, so a recording a change broke fails withREPLAY_STALEinstead of quietly calling the model. That includes a change to the cache key (REPLAY_POLICY_VERSION, a new key field): strict lists the file store and fails a step whose key misses while an entry recorded for the same step sits under another key (cache/rekeyed.ts). Only entries whoserecordedFornames the whole step (params digest, occurrence, agent) count; a lenientread-writereplay completes an older one. Such a change re-records every entry and deletes the old ones in the same pull request. A step that was never recorded still runs live. A strict run replays on retries too and never writes or deletes an entry, whatever the mode. The web benchmark's entries are in. The mobile benchmark's iOS and Android entries are recorded on a Mac; Android replays with--strict-cache, iOS leniently. -
No implicit default model. For the built-in agent, the entry's
modelservesact; the judgment calls (assert,waitFor,extract) use itsjudgewhen one is configured, elsemodel. A judgment never sees the prior-step ledger or the acting agent's summaries; it sees the instruction, its params, the agent's context, and the current screen with its location. Without a model, the firstagentacquisition in a run reports one run-levelMODEL_UNAVAILABLEand stops the run (exit 2). A custom executor handlesactandassertthroughrunStepand needs no model; itswaitForandextractuse the built-in judgments on the agent'sjudgeormodel, else on the executor's ownanswer. No implicit target either:targetsis required and each names its engine. -
Security invariants (fail closed when one cannot be enforced):
- Secret values never reach model input, digests, logs, reports, or
artifacts as text. Model input is the redacted location, the redacted semantic tree (as text
or, on request, the redacted node tree), masked pixels only when masking
is proven, and the sanitized prior-step records. Pixels mask secure
fields only, before and after a secret fill: a value the app shows
elsewhere is in the image, a documented limit (
docs/security.mdx), not a gap to close with taint or text-matching heuristics. Text downloads are rewritten whenever the session's ledger holds a value (redactsDownloadsinrun/secrecy.ts), since a plain string reaches the app unseen. What an executor keeps inattempt.memoryis its own; the harness never reports it. - Provider keys are a class of their own in the ledger
(
registerProviderKeyinrun/secrecy.ts): the closed list of model provider variables there, subscription tokens, a coding agent's saved login, and what an executor registers throughe2e/agent. Every ledger redacts them from what the run writes and from model input, whole values only, text downloads included (an app can be given one). They never enter a ledger's own entries (so no saved session carries one), and never redact what a test id is made of, since the runner and a worker need not know the same keys. A new provider adds its variable to the list; a name pattern is not a substitute. Redact before any cut: half a value is no longer a match. - An agent's secret fill is authorized by the runner, not the model.
typeSecret(action-dispatcher.ts) takes only a handle the step's params declare, the target resolves on the newest observation (feed.resolveandrequireLatestinobservation-feed.ts), andauthorizeSecretFill(secrets.ts) requires the secret configured for the run, an enabled editable node, and a password field for a password. There is no origin check: the value goes to whatever site the page is on (docs/reference/security.mdx). The model never sees or picks the value. A test's ownfill(secret)is trusted code and runs none of these checks. - Every model tool call is parsed into a closed schema and authorized
immediately before dispatch. Nothing runs on a refusal: an unknown tool
name, or an undeclared field on a built-in tool that declares fields,
goes back to the model as the call's error result (the AI SDK's
tool-error, naming the tool or the field), the next turn is the repair, and refusals count toward the failure-streak guard. A built-in tool with no fields drops extra keys and runs; the schema a provider receives still setsadditionalProperties: false. A project tool keeps the schema given todefineTool. A node id not on the current screen isLOCATOR_NOT_FOUND, an action failure the model reads and re-aims from.POLICY_DENIEDis for denied destinations, forbidden fills, and withheld pixels. Model text is never evaluated as code, selectors, shell, or config. The one exception ise2e mcp'srun_code, which runs a coding agent's JavaScript in the server's process with a test file's authority (session-tools/run-code.ts): that agent can already write a test and run it. The code can read every configured secret and credential (the config file, the environment, the app) and fill one into whatever field it likes. Its result passes the secret ledger, which replaces a secret's exact value only: that prevents accidents and is not a boundary. An accepted exception to the first invariant and to the fill rule above. On by default by design (maintainer decision): no flag or config gates it. App content, ledger text, and pixels are quoted as untrusted evidence with no policy authority. - Every navigation a test or the agent asks for (
app.open,browser.goto, thenavigateverb) goes through one rule,resolveNavigationUrl: onlyhttp:,https:, and the exactabout:blankpass; every other scheme (view-source:file:included) and a malformed URL isPOLICY_DENIED(a relative URL on a target with noapp.urlisAPP_URL_REQUIRED). One exception: on a target whoseapp.urlis itself afile:URL (one file, no host, never a directory), afile:URL passes for a file in that file's directory or below it, compared as decoded paths with symbolic links resolved, so neither an encoded separator nor a link climbs out, and never for a directory, whose listing links to its parent; a path that cannot be resolved is outside. The agent names navigation URLs and a page can tell it to, so anything wider would let a local page read any file the user can and carry it to an http(s) address. A link or a script in the local page can still take the browser anywhere a file page may go, which an http(s) page cannot, soleftFileAppholds the same bound over every sink that keeps or sends a screen on its own: an observation taken for a model (checkObservedLocationinagent/observation-feed.tsandagent/invocation.ts), the trace's step screens (traceScreen), and failure evidence (run/failure-evidence.ts). Out of the directory, the screen is withheld and only the location kept. A model is sent no pixels of a file app at all (isFileAppwherepixelsAllowedis set and whereInvocation.observeasks for pixels), since pixels can show a frame of another local file that no tree lists. For the same reason no automatic screenshot of a file app is kept: the twocaptureEvidenceofagent.assertand the failure screenshot are second captures nothing places. A video the user turns on is not gated. A test's own reads are trusted and not gated. An engine opens a file app only when it declaresfileApps, and the harness tells itsvalidateAppwithfileApp: true; the scheme is read once, in core (namesFile). The web engine refuses a provider andconnectthere, since the bound is checked against the runner's disk.device.openLinktakes custom app schemes, so it refuses a list instead (packages/mobile/src/links.ts):file:,data:,javascript:,view-source:,blob:,filesystem:. There is no origin or host allowlist; PR #290 removed them on purpose, since a click reaches any origin a typed URL could. - Sessions are per-run, target-bound, AES-256-GCM encrypted with a memory-only key, and deleted at cleanup; payloads never enter diagnostics.
- Reports escape contextually, strip terminal controls, generate artifact names, and never let a label become a path component.
- Test, config, and engine code run with the runner's full OS authority; nothing here sandboxes them. Untrusted PR code belongs in an external sandbox with no secrets or write tokens. The merge queue runs a queued pull request's code with the repository's secrets, fork or not, so enqueueing (auto-merge included) is the trust decision: review a fork's test, config, and engine changes before you enqueue it.
- Secret values never reach model input, digests, logs, reports, or
artifacts as text. Model input is the redacted location, the redacted semantic tree (as text
or, on request, the redacted node tree), masked pixels only when masking
is proven, and the sanitized prior-step records. Pixels mask secure
fields only, before and after a secret fill: a value the app shows
elsewhere is in the image, a documented limit (
-
CI:
.github/workflows/spec.ymlruns lint, typecheck, and the testbed on Node 26,pnpm teston the newest Node 22, 24, and 26 and on theengines.nodefloors (22.22.3, 24.8.0), as two jobs per version (test:runnerfor core and e2e,test:packagesfor the rest), the CLI on Bun 1.4.3 and the latest Bun,scripts/install-smoke.ts, a fresh install of the packed packages with pnpm 11 and 12, andnativeonblacksmith-6vcpu-macos-26(the desktop driver'scargo fmt --check, clippy, andcargo test, a build for both Mac architectures with each one's architecture checked bylipo, a load of the arm64 build, also through the engine's loader test, and a load of the x64 build in the official darwin-x64 Node under Rosetta; rustup, when the image has none, comes from the rustup-init release and SHA-256 that.github/actions/rust-toolchainpins), whichspec gateneeds;benchmark.ymlruns the web benchmark's two suites;mobile.ymlruns the mobile benchmark's on an iOS simulator and an Android emulator (KVM on x64 Linux);docs.ymlchecks the docs. All four run on pull requests and in the merge queue (merge_group), which is the merge gate: auto-merge enqueues, and the queue merges only when every check is green on the queued tree. Each of the four ends in a<workflow> gatejob, the only checks theMainruleset requires (spec gate,benchmark gate,mobile gate,docs gate); it fails when any job it needs failed or was cancelled and passes over a skipped one, so a new job gates merges once it is in its gate'sneeds. The benchmark and docs workflows gate on paths: achangesjob (dorny/paths-filter over.github/filters.yml) skips the suites when the change cannot reach them, and a manual dispatch always runs them. Never use a workflow-levelpaths:filter: the gate would never report and the merge would wait forever. A suite that cannot run (the agentic ones on a fork's or Dependabot's pull request, which get no model key) is skipped at the job level, never at the step level, so it boots no device for nothing. A push to main runsspecand the web benchmark;mobileonly rebuilds the Expo app on a cache miss, since main's caches are the ones every pull request restores. A new build input or benchmark dependency goes intofilters.ymlin the same change. Every workflow pins actions by SHA; keep new actions SHA-pinned. Every job runs on Blacksmith, like the e2e-inc repos. Linux jobs useblacksmith-4vcpu-ubuntu-2404and macOS jobsblacksmith-6vcpu-macos-26; keep new jobs on those labels. The one exception is thereleasejob: npm Trusted Publishing rejects OIDC tokens from self-hosted runners, and Blacksmith counts as one, so it stays onubuntu-latest. -
Commits follow Conventional Commits; PRs are squash-merged with the number in the subject.
-
PR titles and bodies follow the
writing-prskill (.dev/skills/writing-pr/SKILL.md).unslop(.claude/skills/unslop/SKILL.md, fromokwasniewski/dotfiles) applies to any prose an agent writes here; other agents install it withnpx skills add okwasniewski/dotfiles --skill unslop. -
Releases go through changesets: a user-visible change adds a
.changeset/entry. On0.xthe bump ispatchfor a feature or fix; never pickminoron your own. A breaking change is aminorwith the summary opening**Breaking:**; aminorormajorfor a release the maintainer calls opens**Release:**(scripts/check-changeset-bumps.ts,pnpm check). Peer ranges point one way only (engine ->@e2e-dev/coreand optionallye2e, integration -> engine) and read>=<major.minor.patch> <major+1>, the floor the oldest sibling the package works with. Raise it when a package starts relying on a newer sibling's export or contract field;scripts/check-peer-ranges.ts(pnpm check) fails on any other shape for every peer one package underpackages/has on another (vendor SDK peers such as@onkernel/sdkare not checked). Narrow or exact, every runner minor (exact: every patch too) falls out of range, and changesets 3 then patch-bumps each engine and rewrites its pin, never a major (determineDependentsin@changesets/assemble-release-planpatches an out-of-range peer dependent). That republishes every engine on every runner release, and a consumer who updatese2ealone is left with an exact peer npm 7+ refuses (ERESOLVE). A runner major is the one legitimate rewrite (>=1.0.0 <2.0.0, engines patched):version-packagesrunsscripts/restore-peer-ranges.tsafterchangeset version, which puts that in shape and leaves a wide range alone. -
The root
releasescript publishes with no--tag, so versioned releases land onlatest.changeset publishpasses--tagthrough to the publish tool when given one, sopublishConfig.tag: "latest"on every package is only a backstop for a hand-runnpm publish(pnpm publishignores it). Canaries pass--tag canaryexplicitly and never movelatest. Do not switch to changesets pre mode to get a real prerelease version: a0.16.0-beta.0runner is outside the engine'se2epeer range, so changesets patch-bumps@e2e-dev/weband rewrites the peer to>=0.16.0-beta.0 <0.16.0, which no stable runner satisfies. Widening the range does not rescue it — node-semver only lets a prerelease satisfy a comparator set when a comparator with the samemajor.minor.patchcarries a prerelease, so0.3.0-beta.0satisfies neither>=0.1.0-0 <1nor*. Never hand-edit a packageversionorCHANGELOG.md;changesets/actionowns both. -
When you release (merge the
chore: version packagespull request) and it publishese2eor an@e2e-dev/*package an example depends on, update the examples once npm has the new versions, in a separate pull request from the release (#1838 is the pattern). Raise eache2eand@e2e-dev/*range inexamples/*/package.jsonandexamples/*/e2e/package.jsonto the newest version on npm (npm view <pkg> version); leave a package with no newer version alone. Run each changed example's suite by hand and update the "Last checked" line in its README for every example you ran. Where you have no simulator, emulator, or toolchain for one, install it, typecheck it, runnpx e2e list, leave its "Last checked" line alone, and say so under## Verified. The examples commit no lockfile and gate no pull request, so nothing else catches one left on an old version. -
Canaries are hand-run, never from CI:
pnpm run canarywithGITHUB_TOKENset versions and builds every public package as a changesets snapshot, andpnpm run canary:publishpublishes them to thecanarydist-tag, then runsscripts/restore-peer-ranges.ts. Publishing is its own step because npm's two-factor prompt is interactive. Never publish without building first: each build stampsdist/.build.json, and every package'sprepublishOnly(scripts/check-dist.ts) refuses adistwhose stamp does not matchpackage.json.scripts/canary-changeset.tsfirst writes a changeset bumping all of them, so they move together: a snapshot of one engine alone would keep a peer range the runner's canary does not satisfy. Snapshot versions read0.10.0-canary-<datetime>(snapshot.useCalculatedVersion); the build runs afterchangeset versionsoinitrecords those versions, andinitpins a prerelease engine exactly, since a caret on a prerelease resolves to the newest canary of that tuple, whose peer range names a different runner build. The snapshot also pins everye2epeer to that runner build (and an integration's engine peer to that engine build), since a prerelease satisfies no>=x <1range: the tarballs need the pin, main must not keep it, so the restore step widens it to>=<sibling major.minor.patch> <1before the output (versions, changelogs, consumed changesets, peers) is committed to main aschore: release. Achangeset publishtyped by hand needsnode scripts/restore-peer-ranges.tsafter it, orpnpm checkfails on the pin. The canary build also builds the desktop driver into both platform packages (build:desktop-native), so it runs on a Mac with rustup. Inrelease.yml, a macOSnativejob builds the driver and loads both builds the same way before it uploads them, and the release and nightly jobs place it into the platform packages (scripts/native/place-native.ts) before they publish. -
The runner publishes as the unscoped
e2e(entry pointse2e,e2e/agent,e2e/engine,e2e/runner,e2e/reporters,e2e/oauth/chatgpt,e2e/oauth/copilot,e2e/oauth/grok,e2e/oauth/opencode-console; the bin ise2etoo); engines, reporters, and integrations publish public under the@e2e-devscope. The@e2edevscope (moved to@e2e-devon 2026-09-28),@e2edev/e2e,@e2edev/oauth(folded intoe2e/oauthon 2026-09-21), and@e2e-dev/integrations(moved to@e2e-dev/kernelon 2026-09-29, deprecated by hand after the first@e2e-dev/kernelpublish) are the retired names: deprecated on npm, never referenced here. The release job authenticates with npm Trusted Publishing (OIDC), no token; each package carries its own trusted publisher connection on npmjs (see "npm Trusted Publishing" in CONTRIBUTING.md). Provenance attaches automatically once the repository is public. Document the CLI asnpx e2e; npx runs the locally installed bin first, and the flag--no-installadds nothing once the package is a dependency. -
Private packages are skipped entirely by changesets (
privatePackages: false), so@e2e-dev/testbedgets no version bump, noCHANGELOG.md, and no git tag.