refactor: move e2e's core into @e2e-dev/core, and engines peer on it

Merged
KD
9h ago
+2995-2381

Stack 2/3: session-half split → this PR → @e2e-dev/core API.

2026-11-15: rebased onto main 235986078 and the package renamed from e2e-core to @e2e-dev/core. Command output quoted below predates the rename.

Moves the engine contract, locators, agent, replay cache, secrets, and the session half of a worker from packages/e2e to packages/core, published as the new @e2e-dev/core package. e2e is built on it. Nothing changes in behavior.

flowchart BT
  core["@e2e-dev/core<br/>engine contract, locators, agent, cache,<br/>secrets, engine sessions, standalone worker"]
  e2e["e2e<br/>CLI, collector, scheduler, reporters, expect, MCP"]
  web["@e2e-dev/web, @e2e-dev/mobile"]
  e2e -- "dependency, exact version (fixed group)" --> core
  web -- "peer" --> core
  web -- "peer" --> e2e
  • @e2e-dev/core: 145 modules moved with git mv to the same paths under packages/core/src. Its one public entry is @e2e-dev/core/engine. e2e reaches the rest as @e2e-dev/core/lib/<path> (./lib/* in its exports), which is not public API. The next PR adds the @e2e-dev/core and @e2e-dev/core/agent entries.
  • e2e: depends on @e2e-dev/core at its exact version (workspace:*), and the changesets fixed group keeps the two versions equal. e2e/engine and e2e/agent re-export it unchanged, so engines, integrations, and executors work as before.
  • Engines: @e2e-dev/web and @e2e-dev/mobile import @e2e-dev/core/engine and peer on @e2e-dev/core beside e2e (>=0.23.1 <1).
  • Yarn: Yarn installs no peer the project does not list, and under Plug'n'Play the engine then fails to load. e2e init adds @e2e-dev/core beside an engine, and e2e upgrade adds a required @e2e-dev/* peer the project lacks, at the version e2e depends on. Checked on Yarn 4.18.1 PnP with packed builds: without core listed the config fails to load, with it the scaffolded test passes.
  • CI:
    • The root build and test scripts run @e2e-dev/core first, and so does the Bun job in spec.yml.
    • .github/filters.yml adds packages/core/** to the runner filter.
    • The nightly examples workflow packs @e2e-dev/core and overrides it in each example's npm install.
    • scripts/install-smoke.ts packs it too and fails on a second installed copy.

Most of the diff is mechanical: of 639 files, 145 are pure renames and most of the rest only rewrite import specifiers to @e2e-dev/core/lib/<path>. The parts to read:

WhatWhere
package manifestspackages/core/package.json, packages/e2e/package.json, packages/{web,mobile}/package.json, root package.json, .changeset/config.json
the moved entries and their stubspackages/core/src/engine/index.ts and agent/public.ts (verbatim), packages/e2e/src/engine/index.ts and agent/public.ts (re-exports)
build and test configpackages/core/tsconfig*.json, packages/core/vitest.config.ts, packages/e2e/vitest.config.ts (the integration project externalizes core's dist, so tests and the built runner share one module state)
guardspackages/e2e/tests/unit/package-imports.test.ts (follows imports into @e2e-dev/core; ai stays lazy there), scripts/install-smoke.ts, scripts/check-error-codes.ts
CI.github/workflows/spec.yml, examples.yml, .github/actions/example-packages/action.yml, .github/filters.yml, CODEOWNERS
proseAGENTS.md, CONTRIBUTING.md (stability, engine contract), docs/writing-an-engine.mdx, docs/reference/engine.mdx, READMEs

To confirm the rest is only import lines: git diff -M --unified=0 <base> <head> -- 'packages/*/src' 'packages/*/tests' | grep '^[-+][^-+]' | grep -v "from '\|import('".

Before merging: @e2e-dev/core does not exist on npm yet, and npm Trusted Publishing can only be added to a package that exists. Publish a placeholder @e2e-dev/core@0.0.0 by hand and connect release.yml as its trusted publisher (CONTRIBUTING.md, "npm Trusted Publishing") before this merges. Otherwise the next release publishes e2e with an exact dependency on an @e2e-dev/core version that failed to publish.

Verified

Ran it locally: yes. No behavior changes, so the evidence is the existing suites against the built packages, plus a fresh install:

  • pnpm test: e2e 4626 passed (unit and integration), web 810, mobile 531, every other package green, and @e2e-dev/core's entries check.
  • Testbed through the built CLI: 588 passed, 1 skipped.
  • scripts/install-smoke.ts with pnpm 11 and pnpm 12: installs the packed @e2e-dev/core, e2e, @e2e-dev/web, and @e2e-dev/mobile with no build scripts, finds one @e2e-dev/core copy, typechecks a mobile tool, and runs a TypeScript test.
  • pnpm check passes.
  • Not run locally: the nightly examples workflow's npm override of @e2e-dev/core. It only runs on the nightly or on a manual dispatch, which posts to Slack.

🤖 Generated with Claude Code