From 490eb9225cfad9506887eb75136bfe1c3784643a Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Fri, 13 Nov 2026 13:50:39 +0900 Subject: [PATCH 1/4] refactor: move e2e's core into @e2e-dev/core, and engines peer on it The engine contract, locators, agent, replay cache, secrets, and the session half of a worker move from packages/e2e to packages/core, the new @e2e-dev/core package, at the same paths. e2e depends on it at its exact version (a changesets fixed group) and reaches its modules through @e2e-dev/core/lib/*, which is not public API; e2e/engine and e2e/agent re-export it. @e2e-dev/web and @e2e-dev/mobile peer on @e2e-dev/core and import the contract from @e2e-dev/core/engine. Install smoke checks that one copy of @e2e-dev/core is installed. Most of this diff is git mv and import specifiers rewritten to @e2e-dev/core/lib/; no behavior changes. Co-Authored-By: Claude Opus 5.5 --- .changeset/config.json | 14 +- .changeset/e2e-core-package.md | 8 + .fallowrc.json | 2 +- .github/CODEOWNERS | 9 +- AGENTS.md | 64 +- CONTRIBUTING.md | 23 +- docs/reference/engine.mdx | 3 +- docs/writing-an-engine.mdx | 12 +- package.json | 4 +- packages/core/LICENSE | 202 ++++ packages/core/NOTICE | 5 + packages/core/README.md | 13 + packages/core/package.json | 77 ++ .../{e2e => core}/src/agent/act-validation.ts | 0 packages/{e2e => core}/src/agent/act.ts | 0 .../src/agent/action-dispatcher.ts | 0 .../{e2e => core}/src/agent/action-names.ts | 0 packages/{e2e => core}/src/agent/actions.ts | 0 .../{e2e => core}/src/agent/agent-brand.ts | 0 packages/{e2e => core}/src/agent/ai-sdk.ts | 0 .../{e2e => core}/src/agent/call-options.ts | 0 .../{e2e => core}/src/agent/default-agent.ts | 0 packages/{e2e => core}/src/agent/derived.ts | 0 packages/{e2e => core}/src/agent/error.ts | 0 packages/{e2e => core}/src/agent/executor.ts | 0 packages/{e2e => core}/src/agent/index.ts | 0 .../{e2e => core}/src/agent/invocation.ts | 0 packages/{e2e => core}/src/agent/ledger.ts | 0 .../{e2e => core}/src/agent/loop-guards.ts | 0 .../{e2e => core}/src/agent/message-shape.ts | 0 .../{e2e => core}/src/agent/model/adapter.ts | 0 .../{e2e => core}/src/agent/model/overflow.ts | 0 .../src/agent/model/provider-hints.ts | 0 .../{e2e => core}/src/agent/model/schema.ts | 0 packages/{e2e => core}/src/agent/model/sdk.ts | 0 .../{e2e => core}/src/agent/model/stall.ts | 0 .../src/agent/model/tool-choice.ts | 0 .../src/agent/observation-budget.ts | 0 .../src/agent/observation-feed.ts | 0 .../{e2e => core}/src/agent/observation.ts | 0 .../src/agent/operation-queue.ts | 0 packages/{e2e => core}/src/agent/phases.ts | 0 packages/{e2e => core}/src/agent/pixels.ts | 0 packages/{e2e => core}/src/agent/point-tap.ts | 0 .../{e2e => core}/src/agent/primitives.ts | 0 packages/{e2e => core}/src/agent/prompts.ts | 0 packages/{e2e => core}/src/agent/protocol.ts | 0 packages/core/src/agent/public.ts | 33 + packages/{e2e => core}/src/agent/reading.ts | 0 packages/{e2e => core}/src/agent/redaction.ts | 0 packages/{e2e => core}/src/agent/replay.ts | 0 .../{e2e => core}/src/agent/sample-files.ts | 0 .../{e2e => core}/src/agent/screen-update.ts | 0 .../{e2e => core}/src/agent/scroll-target.ts | 0 packages/{e2e => core}/src/agent/secrets.ts | 0 .../{e2e => core}/src/agent/settle-policy.ts | 0 .../src/agent/step-accounting.ts | 0 .../{e2e => core}/src/agent/step-cache.ts | 0 packages/{e2e => core}/src/agent/tool-loop.ts | 0 .../{e2e => core}/src/agent/tool-output.ts | 0 packages/{e2e => core}/src/agent/tool.ts | 0 .../src/agent/transcript-compaction.ts | 0 .../{e2e => core}/src/agent/upload-paths.ts | 0 packages/{e2e => core}/src/agent/usage.ts | 0 packages/{e2e => core}/src/cache/anchors.ts | 0 packages/{e2e => core}/src/cache/context.ts | 0 packages/{e2e => core}/src/cache/decide.ts | 0 packages/{e2e => core}/src/cache/identity.ts | 0 packages/{e2e => core}/src/cache/recorder.ts | 0 packages/{e2e => core}/src/cache/rekeyed.ts | 0 packages/{e2e => core}/src/cache/relocate.ts | 0 packages/{e2e => core}/src/cache/route.ts | 0 packages/{e2e => core}/src/cache/store.ts | 0 packages/{e2e => core}/src/cache/template.ts | 0 .../{e2e => core}/src/cache/trace-fields.ts | 0 .../{e2e => core}/src/cache/trace-read.ts | 0 packages/{e2e => core}/src/cache/trace.ts | 0 packages/{e2e => core}/src/config/agent.ts | 0 packages/{e2e => core}/src/config/app.ts | 0 packages/{e2e => core}/src/config/command.ts | 0 packages/{e2e => core}/src/config/resolve.ts | 0 packages/{e2e => core}/src/config/secrets.ts | 0 packages/{e2e => core}/src/config/targets.ts | 0 packages/{e2e => core}/src/config/validate.ts | 0 .../src/engine/computed-style.ts | 0 packages/{e2e => core}/src/engine/contract.ts | 0 packages/core/src/engine/index.ts | 969 ++++++++++++++++++ packages/{e2e => core}/src/engine/manifest.ts | 0 .../src/engine/protocol/client.ts | 0 .../src/engine/protocol/connection.ts | 0 .../src/engine/protocol/manifest.ts | 0 .../src/engine/protocol/protocol.ts | 0 .../src/engine/protocol/server.ts | 0 .../src/engine/protocol/transport.ts | 0 .../{e2e => core}/src/engine/recording.ts | 0 packages/{e2e => core}/src/engine/resolve.ts | 0 packages/{e2e => core}/src/engine/session.ts | 0 packages/{e2e => core}/src/engine/surface.ts | 0 packages/{e2e => core}/src/engine/timing.ts | 0 packages/{e2e => core}/src/expect/attempt.ts | 0 .../{e2e => core}/src/expect/poll-scope.ts | 0 packages/{e2e => core}/src/expect/samples.ts | 0 packages/{e2e => core}/src/expect/soft.ts | 0 .../{e2e => core}/src/internal/abandoned.ts | 0 .../{e2e => core}/src/internal/ai-trace.ts | 0 .../src/internal/atomic-write.ts | 0 packages/{e2e => core}/src/internal/brands.ts | 0 .../src/internal/client-identity.ts | 0 packages/{e2e => core}/src/internal/dates.ts | 0 packages/{e2e => core}/src/internal/debug.ts | 0 packages/{e2e => core}/src/internal/env.ts | 0 packages/{e2e => core}/src/internal/errors.ts | 0 .../src/internal/expected-failure.ts | 0 .../{e2e => core}/src/internal/geometry.ts | 0 packages/{e2e => core}/src/internal/globs.ts | 0 packages/{e2e => core}/src/internal/ids.ts | 0 packages/{e2e => core}/src/internal/image.ts | 0 .../{e2e => core}/src/internal/json-value.ts | 0 packages/{e2e => core}/src/internal/keys.ts | 0 .../{e2e => core}/src/internal/objects.ts | 0 .../{e2e => core}/src/internal/options.ts | 0 .../src/internal/package-version.ts | 0 packages/{e2e => core}/src/internal/paths.ts | 0 .../{e2e => core}/src/internal/realm-slot.ts | 0 .../src/internal/recording-modes.ts | 0 packages/{e2e => core}/src/internal/redact.ts | 0 packages/{e2e => core}/src/internal/regexp.ts | 0 packages/{e2e => core}/src/internal/roles.ts | 0 packages/{e2e => core}/src/internal/source.ts | 0 .../src/internal/standard-schema.ts | 0 .../{e2e => core}/src/internal/suggest.ts | 0 packages/{e2e => core}/src/internal/text.ts | 0 packages/{e2e => core}/src/internal/time.ts | 0 .../src/internal/unserved-model.ts | 0 packages/{e2e => core}/src/internal/urls.ts | 0 packages/{e2e => core}/src/locator/engine.ts | 0 .../{e2e => core}/src/locator/expression.ts | 0 packages/{e2e => core}/src/locator/screen.ts | 0 packages/{e2e => core}/src/params.ts | 0 packages/{e2e => core}/src/run/artifacts.ts | 0 packages/{e2e => core}/src/run/budget.ts | 0 .../src/run/declared-processes.ts | 0 .../{e2e => core}/src/run/engine-sessions.ts | 0 .../src/run/fixture-recording.ts | 0 packages/{e2e => core}/src/run/fixtures.ts | 0 .../{e2e => core}/src/run/managed-process.ts | 0 packages/{e2e => core}/src/run/output.ts | 0 .../{e2e => core}/src/run/process-pool.ts | 0 packages/{e2e => core}/src/run/provision.ts | 0 packages/{e2e => core}/src/run/recordings.ts | 0 packages/{e2e => core}/src/run/records.ts | 0 packages/{e2e => core}/src/run/screenshots.ts | 0 packages/{e2e => core}/src/run/secrecy.ts | 0 packages/{e2e => core}/src/run/sessions.ts | 0 .../src/run/standalone-attempt.ts | 0 packages/{e2e => core}/src/run/standalone.ts | 0 .../{e2e => core}/src/run/step-screens.ts | 0 packages/{e2e => core}/src/run/steps.ts | 0 .../{e2e => core}/src/run/worker-models.ts | 0 packages/{e2e => core}/src/secrets.ts | 0 packages/{e2e => core}/src/types.ts | 0 packages/core/tests/unit/entries.test.ts | 9 + packages/core/tsconfig.build.json | 22 + packages/core/tsconfig.json | 20 + packages/core/vitest.config.ts | 10 + packages/e2e/package.json | 4 +- packages/e2e/src/agent/interactive-step.ts | 14 +- packages/e2e/src/agent/public.ts | 32 +- packages/e2e/src/cli/bin.ts | 2 +- packages/e2e/src/cli/cache.ts | 4 +- packages/e2e/src/cli/doctor.ts | 24 +- packages/e2e/src/cli/feedback.ts | 6 +- packages/e2e/src/cli/index.ts | 12 +- packages/e2e/src/cli/init/agent-skill.ts | 2 +- packages/e2e/src/cli/init/examples.ts | 4 +- packages/e2e/src/cli/init/gateways.ts | 2 +- packages/e2e/src/cli/init/mcp-config.ts | 2 +- packages/e2e/src/cli/init/package.ts | 4 +- packages/e2e/src/cli/init/scaffold.ts | 2 +- packages/e2e/src/cli/init/versions.ts | 2 +- packages/e2e/src/cli/mcp.ts | 6 +- packages/e2e/src/cli/run-output.ts | 6 +- packages/e2e/src/cli/signals.ts | 2 +- packages/e2e/src/cli/step-control.ts | 2 +- packages/e2e/src/cli/update-check.ts | 8 +- packages/e2e/src/cli/upgrade.ts | 2 +- packages/e2e/src/cli/watch.ts | 2 +- packages/e2e/src/cli/wordmark.ts | 2 +- packages/e2e/src/collect/collect.ts | 14 +- packages/e2e/src/collect/registry.ts | 22 +- packages/e2e/src/collect/select.ts | 18 +- packages/e2e/src/config/diagnose.ts | 6 +- packages/e2e/src/config/esm-hooks.ts | 4 +- packages/e2e/src/config/load.ts | 4 +- packages/e2e/src/config/resolve-run.ts | 8 +- packages/e2e/src/config/typescript.ts | 6 +- packages/e2e/src/engine/index.ts | 969 +----------------- packages/e2e/src/expect/async.ts | 22 +- packages/e2e/src/expect/index.ts | 10 +- packages/e2e/src/expect/poll.ts | 10 +- packages/e2e/src/expect/screenshot-call.ts | 16 +- packages/e2e/src/expect/screenshot-capture.ts | 16 +- packages/e2e/src/expect/screenshot.ts | 18 +- packages/e2e/src/expect/values.ts | 10 +- packages/e2e/src/explore/body.ts | 8 +- packages/e2e/src/explore/change.ts | 4 +- packages/e2e/src/explore/executor.ts | 6 +- packages/e2e/src/explore/index.ts | 14 +- packages/e2e/src/explore/plan.ts | 2 +- packages/e2e/src/explore/state.ts | 2 +- packages/e2e/src/index.ts | 14 +- packages/e2e/src/internal/package-manager.ts | 4 +- packages/e2e/src/internal/skip.ts | 4 +- packages/e2e/src/mcp/app-lines.ts | 8 +- packages/e2e/src/mcp/catalog.ts | 24 +- packages/e2e/src/mcp/code-parse.ts | 4 +- packages/e2e/src/mcp/code-surface.ts | 2 +- packages/e2e/src/mcp/config.ts | 6 +- packages/e2e/src/mcp/default-engine.ts | 6 +- packages/e2e/src/mcp/output.ts | 2 +- packages/e2e/src/mcp/recording.ts | 2 +- packages/e2e/src/mcp/run-code.ts | 28 +- packages/e2e/src/mcp/run-tests.ts | 4 +- packages/e2e/src/mcp/server.ts | 4 +- packages/e2e/src/mcp/session.ts | 24 +- packages/e2e/src/mcp/sessions.ts | 6 +- packages/e2e/src/mcp/test-lines.ts | 20 +- packages/e2e/src/mcp/test-outcome.ts | 2 +- packages/e2e/src/mcp/tools.ts | 12 +- packages/e2e/src/oauth/chatgpt.ts | 2 +- packages/e2e/src/oauth/cli.ts | 2 +- packages/e2e/src/oauth/copilot.ts | 4 +- packages/e2e/src/oauth/fetch.ts | 2 +- packages/e2e/src/oauth/grok.ts | 2 +- packages/e2e/src/oauth/login-model.ts | 2 +- packages/e2e/src/oauth/models.ts | 2 +- packages/e2e/src/oauth/opencode-console.ts | 4 +- packages/e2e/src/report/build.ts | 30 +- packages/e2e/src/report/code-frame.ts | 2 +- packages/e2e/src/report/debug-steps.ts | 6 +- packages/e2e/src/report/failure-text.ts | 8 +- packages/e2e/src/report/format.ts | 8 +- packages/e2e/src/report/junit.ts | 6 +- packages/e2e/src/report/left-out.ts | 2 +- packages/e2e/src/report/list-explore.ts | 8 +- packages/e2e/src/report/list-model.ts | 8 +- packages/e2e/src/report/list-steps.ts | 8 +- packages/e2e/src/report/list.ts | 12 +- packages/e2e/src/report/markdown-text.ts | 2 +- packages/e2e/src/report/markdown.ts | 2 +- packages/e2e/src/report/outcome.ts | 6 +- packages/e2e/src/report/traces.ts | 4 +- packages/e2e/src/report/write.ts | 2 +- packages/e2e/src/run-types.ts | 2 +- packages/e2e/src/run/app-ports.ts | 4 +- packages/e2e/src/run/changes.ts | 10 +- packages/e2e/src/run/events.ts | 8 +- packages/e2e/src/run/execute.ts | 56 +- packages/e2e/src/run/expected-failure.ts | 10 +- packages/e2e/src/run/extended-fixtures.ts | 4 +- packages/e2e/src/run/failure-evidence.ts | 18 +- packages/e2e/src/run/host-trace.ts | 4 +- packages/e2e/src/run/in-process.ts | 10 +- packages/e2e/src/run/last-run.ts | 4 +- packages/e2e/src/run/open-session.ts | 10 +- packages/e2e/src/run/process-output.ts | 4 +- packages/e2e/src/run/public-ownership.ts | 6 +- packages/e2e/src/run/public-run.ts | 4 +- packages/e2e/src/run/realm.ts | 14 +- packages/e2e/src/run/retry.ts | 4 +- packages/e2e/src/run/runner.ts | 44 +- packages/e2e/src/run/scheduler.ts | 18 +- packages/e2e/src/run/select-target.ts | 4 +- packages/e2e/src/run/serial.ts | 24 +- packages/e2e/src/run/standalone-kinds.ts | 32 +- packages/e2e/src/run/standalone-test.ts | 36 +- packages/e2e/src/run/step-hold.ts | 8 +- packages/e2e/src/run/test-filters.ts | 16 +- packages/e2e/src/run/units.ts | 6 +- packages/e2e/src/run/worker/entry.ts | 20 +- packages/e2e/src/run/worker/handle.ts | 2 +- packages/e2e/src/run/worker/protocol.ts | 14 +- packages/e2e/src/run/worker/session.ts | 12 +- packages/e2e/src/runner.ts | 4 +- packages/e2e/src/telemetry/environment.ts | 4 +- packages/e2e/src/telemetry/events.ts | 10 +- packages/e2e/src/telemetry/posthog.ts | 2 +- packages/e2e/src/telemetry/project.ts | 2 +- packages/e2e/src/telemetry/store.ts | 6 +- packages/e2e/src/telemetry/telemetry.ts | 4 +- packages/e2e/tests/helpers/agent-fake-time.ts | 4 +- packages/e2e/tests/helpers/engine-runtime.ts | 6 +- packages/e2e/tests/helpers/executor-tree.ts | 2 +- packages/e2e/tests/helpers/fake-engine.ts | 2 +- .../tests/helpers/fake-executor-context.ts | 2 +- packages/e2e/tests/helpers/fake-loop-model.ts | 2 +- packages/e2e/tests/helpers/fake-model.ts | 2 +- packages/e2e/tests/helpers/fixture-config.ts | 2 +- packages/e2e/tests/helpers/open-host.ts | 2 +- packages/e2e/tests/helpers/redacted.ts | 4 +- packages/e2e/tests/helpers/report.ts | 4 +- packages/e2e/tests/helpers/sample-report.ts | 2 +- packages/e2e/tests/helpers/screen-fixture.ts | 4 +- packages/e2e/tests/helpers/screen-over.ts | 18 +- packages/e2e/tests/helpers/scripted-engine.ts | 2 +- packages/e2e/tests/helpers/scripted-model.ts | 2 +- packages/e2e/tests/helpers/scripted-scene.ts | 2 +- packages/e2e/tests/helpers/scripted-suite.ts | 2 +- packages/e2e/tests/helpers/snapshot.ts | 2 +- packages/e2e/tests/helpers/trace-cache.ts | 4 +- .../tests/helpers/unserved-copilot-model.ts | 4 +- .../agent-act-before-action.test.ts | 2 +- .../integration/agent-act-on-action.test.ts | 2 +- .../integration/agent-act-pixel-tools.test.ts | 4 +- .../integration/agent-act-stress.test.ts | 2 +- .../e2e/tests/integration/agent-act.test.ts | 2 +- .../tests/integration/agent-ai-trace.test.ts | 2 +- .../integration/agent-assert-explore.test.ts | 4 +- .../agent-executor-context.test.ts | 2 +- .../agent-fallback-handoff.test.ts | 6 +- .../integration/agent-input-stale.test.ts | 2 +- .../agent-observation-deadline.test.ts | 2 +- .../agent-observation-report.test.ts | 2 +- .../tests/integration/agent-policy.test.ts | 8 +- .../integration/agent-scroll-pages.test.ts | 2 +- .../integration/agent-scroll-settle.test.ts | 2 +- .../integration/agent-scroll-smooth.test.ts | 2 +- .../tests/integration/agent-tool-read.test.ts | 2 +- .../integration/agent-trace-cache.test.ts | 4 +- .../integration/artifact-store-serial.test.ts | 2 +- .../cache-model-provenance.test.ts | 4 +- .../e2e/tests/integration/config-load.test.ts | 2 +- .../tests/integration/config-names.test.ts | 2 +- .../integration/dist-public-exports.test.ts | 4 +- .../tests/integration/engine-contract.test.ts | 2 +- .../tests/integration/engine-secrets.test.ts | 2 +- .../tests/integration/engine-target.test.ts | 6 +- .../e2e/tests/integration/explore.test.ts | 6 +- .../integration/failure-evidence.test.ts | 2 +- .../tests/integration/filled-secrets.test.ts | 4 +- .../tests/integration/judgment-params.test.ts | 2 +- .../tests/integration/list-reporter.test.ts | 2 +- .../tests/integration/managed-process.test.ts | 4 +- .../integration/mcp-session-host.test.ts | 10 +- .../e2e/tests/integration/model-usage.test.ts | 2 +- .../tests/integration/named-agents.test.ts | 2 +- .../integration/open-host-deadline.test.ts | 2 +- .../open-host-engine-ownership.test.ts | 2 +- .../integration/open-host-redaction.test.ts | 2 +- .../e2e/tests/integration/reporters.test.ts | 4 +- .../integration/route-announcer-cache.test.ts | 2 +- .../e2e/tests/integration/run-events.test.ts | 2 +- .../integration/runner-lifecycle.test.ts | 2 +- .../integration/screenshot-assertions.test.ts | 2 +- .../tests/integration/serial-secrets.test.ts | 2 +- .../tests/integration/session-secrets.test.ts | 4 +- .../integration/shared-app-processes.test.ts | 18 +- .../integration/target-processes.test.ts | 2 +- .../trace-cache-minted-test-id.test.ts | 4 +- .../integration/trace-cache-replay.test.ts | 2 +- packages/e2e/tests/integration/traces.test.ts | 2 +- .../tests/integration/unserved-model.test.ts | 2 +- packages/e2e/tests/types/sdk-types.ts | 2 +- .../e2e/tests/unit/act-validation.test.ts | 8 +- .../tests/unit/agent-assert-explore.test.ts | 14 +- packages/e2e/tests/unit/agent-config.test.ts | 16 +- packages/e2e/tests/unit/agent-derived.test.ts | 2 +- .../e2e/tests/unit/agent-entry-prompt.test.ts | 14 +- .../tests/unit/agent-grammar-tools.test.ts | 10 +- .../tests/unit/agent-judgment-schema.test.ts | 2 +- packages/e2e/tests/unit/agent-ledger.test.ts | 4 +- .../tests/unit/agent-model-refusal.test.ts | 16 +- .../unit/agent-observation-budget.test.ts | 4 +- .../e2e/tests/unit/agent-observation.test.ts | 20 +- packages/e2e/tests/unit/agent-phases.test.ts | 8 +- packages/e2e/tests/unit/agent-pixels.test.ts | 4 +- .../e2e/tests/unit/agent-point-tap.test.ts | 6 +- packages/e2e/tests/unit/agent-prompts.test.ts | 6 +- .../e2e/tests/unit/agent-protocol.test.ts | 4 +- packages/e2e/tests/unit/agent-reading.test.ts | 6 +- .../tests/unit/agent-screen-update.test.ts | 4 +- .../tests/unit/agent-scroll-target.test.ts | 6 +- packages/e2e/tests/unit/agent-secrets.test.ts | 14 +- .../tests/unit/agent-tap-modifiers.test.ts | 16 +- packages/e2e/tests/unit/ai-sdk.test.ts | 4 +- .../e2e/tests/unit/ai-trace-media.test.ts | 2 +- packages/e2e/tests/unit/ai-trace.test.ts | 2 +- packages/e2e/tests/unit/app-log.test.ts | 8 +- packages/e2e/tests/unit/app-ports.test.ts | 8 +- packages/e2e/tests/unit/app-recording.test.ts | 6 +- .../e2e/tests/unit/artifact-segment.test.ts | 2 +- .../e2e/tests/unit/artifact-store.test.ts | 6 +- packages/e2e/tests/unit/cli-cache.test.ts | 4 +- packages/e2e/tests/unit/cli-doctor.test.ts | 4 +- .../e2e/tests/unit/cli-run-output.test.ts | 6 +- packages/e2e/tests/unit/cli-watch.test.ts | 2 +- packages/e2e/tests/unit/cli.test.ts | 2 +- .../e2e/tests/unit/computed-style.test.ts | 2 +- packages/e2e/tests/unit/config.test.ts | 10 +- packages/e2e/tests/unit/debug-steps.test.ts | 6 +- packages/e2e/tests/unit/debug.test.ts | 2 +- .../e2e/tests/unit/declared-processes.test.ts | 8 +- packages/e2e/tests/unit/engine-error.test.ts | 4 +- packages/e2e/tests/unit/engine-guards.test.ts | 2 +- .../e2e/tests/unit/engine-protocol.test.ts | 12 +- packages/e2e/tests/unit/engine.test.ts | 8 +- packages/e2e/tests/unit/errors.test.ts | 4 +- .../unit/expect-async-attributes.test.ts | 2 +- .../tests/unit/expect-async-options.test.ts | 4 +- .../e2e/tests/unit/expect-async-value.test.ts | 2 +- .../tests/unit/expect-missing-frame.test.ts | 2 +- packages/e2e/tests/unit/expect-poll.test.ts | 14 +- packages/e2e/tests/unit/expect-soft.test.ts | 10 +- packages/e2e/tests/unit/expect-values.test.ts | 2 +- .../e2e/tests/unit/expected-failure.test.ts | 12 +- packages/e2e/tests/unit/explore-body.test.ts | 8 +- .../e2e/tests/unit/explore-change.test.ts | 4 +- packages/e2e/tests/unit/explore-plan.test.ts | 2 +- packages/e2e/tests/unit/expression.test.ts | 4 +- packages/e2e/tests/unit/failure-hint.test.ts | 4 +- packages/e2e/tests/unit/filter-has.test.ts | 6 +- .../e2e/tests/unit/filter-options.test.ts | 4 +- .../e2e/tests/unit/fixture-runtime.test.ts | 22 +- packages/e2e/tests/unit/geometry.test.ts | 2 +- packages/e2e/tests/unit/globs-walk.test.ts | 2 +- packages/e2e/tests/unit/globs.test.ts | 2 +- packages/e2e/tests/unit/ids.test.ts | 2 +- packages/e2e/tests/unit/image-codec.test.ts | 6 +- packages/e2e/tests/unit/image.test.ts | 2 +- packages/e2e/tests/unit/json-value.test.ts | 2 +- packages/e2e/tests/unit/last-run.test.ts | 2 +- .../tests/unit/locator-action-options.test.ts | 4 +- .../e2e/tests/unit/locator-basics.test.ts | 2 +- .../e2e/tests/unit/locator-engine.test.ts | 16 +- packages/e2e/tests/unit/locator-union.test.ts | 4 +- .../e2e/tests/unit/locator-wait-for.test.ts | 6 +- packages/e2e/tests/unit/loop-guards.test.ts | 2 +- .../tests/unit/managed-process-exit.test.ts | 4 +- .../e2e/tests/unit/managed-process.test.ts | 6 +- packages/e2e/tests/unit/mcp-output.test.ts | 2 +- packages/e2e/tests/unit/mcp-recording.test.ts | 2 +- packages/e2e/tests/unit/mcp-session.test.ts | 4 +- .../e2e/tests/unit/mcp-test-lines.test.ts | 12 +- .../tests/unit/mcp-tools-without-ai.test.ts | 2 +- packages/e2e/tests/unit/mcp-tools.test.ts | 8 +- packages/e2e/tests/unit/message-shape.test.ts | 2 +- .../e2e/tests/unit/model-overflow.test.ts | 2 +- .../tests/unit/model-request-headers.test.ts | 20 +- packages/e2e/tests/unit/model-usage.test.ts | 2 +- .../e2e/tests/unit/no-output-error.test.ts | 8 +- packages/e2e/tests/unit/oauth/copilot.test.ts | 2 +- .../tests/unit/oauth/opencode-console.test.ts | 2 +- .../e2e/tests/unit/openai-second-turn.test.ts | 2 +- packages/e2e/tests/unit/options.test.ts | 4 +- .../e2e/tests/unit/package-imports.test.ts | 66 +- .../e2e/tests/unit/package-version.test.ts | 2 +- .../e2e/tests/unit/press-sequentially.test.ts | 4 +- .../e2e/tests/unit/process-output.test.ts | 2 +- .../unit/provider-failure-message.test.ts | 18 +- .../e2e/tests/unit/provider-hints.test.ts | 2 +- .../e2e/tests/unit/provider-recording.test.ts | 2 +- packages/e2e/tests/unit/read-cost.test.ts | 2 +- packages/e2e/tests/unit/realm-slot.test.ts | 2 +- packages/e2e/tests/unit/realm.test.ts | 2 +- .../e2e/tests/unit/recording-modes.test.ts | 2 +- packages/e2e/tests/unit/regexp.test.ts | 2 +- packages/e2e/tests/unit/registry.test.ts | 2 +- .../e2e/tests/unit/relocate-anonymous.test.ts | 10 +- .../unit/relocate-minted-test-id.test.ts | 6 +- .../tests/unit/relocate-placeholder.test.ts | 6 +- .../e2e/tests/unit/relocate-position.test.ts | 12 +- .../e2e/tests/unit/relocate-within.test.ts | 8 +- packages/e2e/tests/unit/report-list.test.ts | 6 +- packages/e2e/tests/unit/report-status.test.ts | 10 +- .../e2e/tests/unit/rerun-artifacts.test.ts | 2 +- .../e2e/tests/unit/resolve-expression.test.ts | 2 +- packages/e2e/tests/unit/retry.test.ts | 2 +- .../e2e/tests/unit/sample-history.test.ts | 2 +- packages/e2e/tests/unit/scheduler.test.ts | 12 +- packages/e2e/tests/unit/screen-tree.test.ts | 2 +- .../tests/unit/scroll-until-visible.test.ts | 6 +- packages/e2e/tests/unit/secret-ledger.test.ts | 2 +- packages/e2e/tests/unit/secrets.test.ts | 6 +- .../tests/unit/select-option-shape.test.ts | 4 +- packages/e2e/tests/unit/select.test.ts | 6 +- packages/e2e/tests/unit/serial-record.test.ts | 8 +- .../e2e/tests/unit/session-envelope.test.ts | 6 +- .../e2e/tests/unit/session-secrecy.test.ts | 8 +- .../e2e/tests/unit/source-location.test.ts | 2 +- packages/e2e/tests/unit/step-abandon.test.ts | 4 +- .../e2e/tests/unit/step-accounting.test.ts | 12 +- packages/e2e/tests/unit/step-cache.test.ts | 26 +- packages/e2e/tests/unit/step-hold.test.ts | 4 +- packages/e2e/tests/unit/step-progress.test.ts | 4 +- packages/e2e/tests/unit/step-screens.test.ts | 12 +- .../e2e/tests/unit/step-verification.test.ts | 2 +- packages/e2e/tests/unit/suggest.test.ts | 2 +- .../e2e/tests/unit/target-identity.test.ts | 8 +- .../e2e/tests/unit/telemetry-events.test.ts | 4 +- .../e2e/tests/unit/telemetry-project.test.ts | 2 +- packages/e2e/tests/unit/test-filters.test.ts | 10 +- packages/e2e/tests/unit/text.test.ts | 2 +- packages/e2e/tests/unit/time.test.ts | 6 +- .../e2e/tests/unit/tool-loop-overflow.test.ts | 20 +- .../e2e/tests/unit/tool-loop-prefix.test.ts | 18 +- .../e2e/tests/unit/tool-loop-stall.test.ts | 22 +- .../tests/unit/tool-loop-tool-choice.test.ts | 18 +- packages/e2e/tests/unit/tool-output.test.ts | 2 +- packages/e2e/tests/unit/tool.test.ts | 2 +- packages/e2e/tests/unit/trace-anchors.test.ts | 10 +- .../e2e/tests/unit/trace-cache-config.test.ts | 10 +- packages/e2e/tests/unit/trace-cache.test.ts | 6 +- .../e2e/tests/unit/trace-identity.test.ts | 2 +- .../e2e/tests/unit/trace-recorder.test.ts | 10 +- packages/e2e/tests/unit/trace-replay.test.ts | 16 +- packages/e2e/tests/unit/trace-route.test.ts | 2 +- packages/e2e/tests/unit/trace-store.test.ts | 4 +- .../e2e/tests/unit/trace-template.test.ts | 10 +- .../tests/unit/transcript-compaction.test.ts | 2 +- packages/e2e/tests/unit/units.test.ts | 4 +- .../e2e/tests/unit/unserved-model.test.ts | 6 +- packages/e2e/tests/unit/upload-paths.test.ts | 2 +- packages/e2e/tests/unit/urls.test.ts | 2 +- packages/e2e/tests/unit/worker-handle.test.ts | 4 +- packages/e2e/tests/unit/worker-models.test.ts | 6 +- packages/e2e/vitest.config.ts | 3 + packages/mobile/README.md | 4 +- packages/mobile/package.json | 4 +- packages/mobile/src/actions.ts | 2 +- packages/mobile/src/bindings.ts | 2 +- packages/mobile/src/device.ts | 2 +- packages/mobile/src/doctor.ts | 2 +- packages/mobile/src/engine.ts | 2 +- packages/mobile/src/errors.ts | 2 +- packages/mobile/src/keyboard.ts | 2 +- packages/mobile/src/links.ts | 2 +- packages/mobile/src/locate.ts | 2 +- packages/mobile/src/nodes.ts | 2 +- packages/mobile/src/pool.ts | 2 +- packages/mobile/src/provider.ts | 2 +- packages/mobile/src/selector.ts | 2 +- packages/mobile/src/support.ts | 2 +- packages/mobile/src/surface.ts | 2 +- packages/mobile/src/tools.ts | 2 +- packages/mobile/tests/helpers/harness.ts | 2 +- .../tests/unit/captured-snapshots.test.ts | 2 +- packages/mobile/tests/unit/doctor.test.ts | 2 +- packages/mobile/tests/unit/engine.test.ts | 2 +- packages/mobile/tests/unit/errors.test.ts | 2 +- .../tests/unit/input-cancellation.test.ts | 2 +- packages/mobile/tests/unit/locate.test.ts | 2 +- packages/mobile/tests/unit/provider.test.ts | 2 +- packages/mobile/tests/unit/tools.test.ts | 2 +- packages/web/README.md | 4 +- packages/web/package.json | 2 + packages/web/src/actions.ts | 2 +- packages/web/src/app-log.ts | 2 +- packages/web/src/attempt-session.ts | 2 +- packages/web/src/browser.ts | 2 +- packages/web/src/capture-scope.ts | 2 +- packages/web/src/cdp-recovery.ts | 2 +- packages/web/src/cdp-selectors.ts | 2 +- packages/web/src/dialogs.ts | 2 +- packages/web/src/downloads.ts | 2 +- packages/web/src/element-list.ts | 2 +- packages/web/src/engine.ts | 2 +- packages/web/src/evaluation.ts | 2 +- packages/web/src/init-scripts.ts | 2 +- packages/web/src/install.ts | 2 +- packages/web/src/locators.ts | 2 +- packages/web/src/observation-capture.ts | 2 +- packages/web/src/observation.ts | 2 +- packages/web/src/observe.ts | 2 +- packages/web/src/operation-budget.ts | 2 +- packages/web/src/permissions.ts | 2 +- packages/web/src/protected-app.ts | 2 +- packages/web/src/provider-video.ts | 2 +- packages/web/src/provider.ts | 2 +- packages/web/src/refs.ts | 2 +- packages/web/src/route-options.ts | 2 +- packages/web/src/route-pattern.ts | 2 +- packages/web/src/screenshot-caret.ts | 2 +- packages/web/src/support.ts | 4 +- packages/web/src/surface.ts | 4 +- packages/web/src/trace-feed.ts | 2 +- packages/web/src/video.ts | 2 +- packages/web/tests/crosscheck/crosscheck.ts | 2 +- .../web/tests/integration/app-log.test.ts | 2 +- .../web/tests/integration/cdp-attach.test.ts | 2 +- .../tests/integration/cdp-recovery.test.ts | 2 +- .../tests/integration/check-actions.test.ts | 2 +- .../tests/integration/clear-cookies.test.ts | 2 +- .../closed-shadow-locators.test.ts | 2 +- .../tests/integration/computed-style.test.ts | 2 +- .../integration/concurrent-observe.test.ts | 2 +- .../web/tests/integration/evaluate.test.ts | 2 +- .../tests/integration/hidden-frames.test.ts | 2 +- .../web/tests/integration/hung-page.test.ts | 2 +- .../integration/icon-glyph-names.test.ts | 2 +- .../tests/integration/init-scripts.test.ts | 2 +- .../web/tests/integration/keyboard.test.ts | 2 +- .../integration/label-composition.test.ts | 2 +- .../web/tests/integration/lifecycle.test.ts | 2 +- .../web/tests/integration/line-text.test.ts | 2 +- packages/web/tests/integration/media.test.ts | 2 +- .../tests/integration/nested-frames.test.ts | 2 +- .../web/tests/integration/permissions.test.ts | 2 +- .../tests/integration/protected-app.test.ts | 2 +- .../integration/provider-downloads.test.ts | 2 +- .../integration/read-node-checked.test.ts | 2 +- .../tests/integration/read-node-names.test.ts | 2 +- .../tests/integration/read-node-roles.test.ts | 2 +- .../integration/read-node-selection.test.ts | 2 +- .../integration/read-node-states.test.ts | 2 +- packages/web/tests/integration/routes.test.ts | 2 +- .../integration/screenshot-caret.test.ts | 2 +- .../integration/screenshot-navigation.test.ts | 2 +- .../integration/semantic-fallback.test.ts | 2 +- .../tests/integration/stalled-frame.test.ts | 2 +- packages/web/tests/integration/tabs.test.ts | 2 +- .../web/tests/integration/visibility.test.ts | 2 +- .../integration/wait-for-response.test.ts | 2 +- packages/web/tests/unit/actions.test.ts | 2 +- .../web/tests/unit/browser-provider.test.ts | 2 +- packages/web/tests/unit/cdp-connect.test.ts | 2 +- packages/web/tests/unit/dialogs.test.ts | 2 +- packages/web/tests/unit/doctor.test.ts | 2 +- packages/web/tests/unit/errors.test.ts | 4 +- packages/web/tests/unit/frame-screen.test.ts | 2 +- packages/web/tests/unit/locators.test.ts | 2 +- .../tests/unit/observation-capture.test.ts | 2 +- .../web/tests/unit/provider-video.test.ts | 2 +- packages/web/tests/unit/route-pattern.test.ts | 2 +- .../web/tests/unit/semantic-fallback.test.ts | 2 +- packages/web/tests/unit/surface-guard.test.ts | 4 +- .../web/tests/unit/surface-lifecycle.test.ts | 2 +- packages/web/tests/unit/surface-of.test.ts | 2 +- packages/web/tests/unit/video.test.ts | 2 +- pnpm-lock.yaml | 43 +- scripts/check-error-codes.ts | 4 +- scripts/install-smoke.ts | 21 +- 641 files changed, 2834 insertions(+), 2349 deletions(-) create mode 100644 .changeset/e2e-core-package.md create mode 100644 packages/core/LICENSE create mode 100644 packages/core/NOTICE create mode 100644 packages/core/README.md create mode 100644 packages/core/package.json rename packages/{e2e => core}/src/agent/act-validation.ts (100%) rename packages/{e2e => core}/src/agent/act.ts (100%) rename packages/{e2e => core}/src/agent/action-dispatcher.ts (100%) rename packages/{e2e => core}/src/agent/action-names.ts (100%) rename packages/{e2e => core}/src/agent/actions.ts (100%) rename packages/{e2e => core}/src/agent/agent-brand.ts (100%) rename packages/{e2e => core}/src/agent/ai-sdk.ts (100%) rename packages/{e2e => core}/src/agent/call-options.ts (100%) rename packages/{e2e => core}/src/agent/default-agent.ts (100%) rename packages/{e2e => core}/src/agent/derived.ts (100%) rename packages/{e2e => core}/src/agent/error.ts (100%) rename packages/{e2e => core}/src/agent/executor.ts (100%) rename packages/{e2e => core}/src/agent/index.ts (100%) rename packages/{e2e => core}/src/agent/invocation.ts (100%) rename packages/{e2e => core}/src/agent/ledger.ts (100%) rename packages/{e2e => core}/src/agent/loop-guards.ts (100%) rename packages/{e2e => core}/src/agent/message-shape.ts (100%) rename packages/{e2e => core}/src/agent/model/adapter.ts (100%) rename packages/{e2e => core}/src/agent/model/overflow.ts (100%) rename packages/{e2e => core}/src/agent/model/provider-hints.ts (100%) rename packages/{e2e => core}/src/agent/model/schema.ts (100%) rename packages/{e2e => core}/src/agent/model/sdk.ts (100%) rename packages/{e2e => core}/src/agent/model/stall.ts (100%) rename packages/{e2e => core}/src/agent/model/tool-choice.ts (100%) rename packages/{e2e => core}/src/agent/observation-budget.ts (100%) rename packages/{e2e => core}/src/agent/observation-feed.ts (100%) rename packages/{e2e => core}/src/agent/observation.ts (100%) rename packages/{e2e => core}/src/agent/operation-queue.ts (100%) rename packages/{e2e => core}/src/agent/phases.ts (100%) rename packages/{e2e => core}/src/agent/pixels.ts (100%) rename packages/{e2e => core}/src/agent/point-tap.ts (100%) rename packages/{e2e => core}/src/agent/primitives.ts (100%) rename packages/{e2e => core}/src/agent/prompts.ts (100%) rename packages/{e2e => core}/src/agent/protocol.ts (100%) create mode 100644 packages/core/src/agent/public.ts rename packages/{e2e => core}/src/agent/reading.ts (100%) rename packages/{e2e => core}/src/agent/redaction.ts (100%) rename packages/{e2e => core}/src/agent/replay.ts (100%) rename packages/{e2e => core}/src/agent/sample-files.ts (100%) rename packages/{e2e => core}/src/agent/screen-update.ts (100%) rename packages/{e2e => core}/src/agent/scroll-target.ts (100%) rename packages/{e2e => core}/src/agent/secrets.ts (100%) rename packages/{e2e => core}/src/agent/settle-policy.ts (100%) rename packages/{e2e => core}/src/agent/step-accounting.ts (100%) rename packages/{e2e => core}/src/agent/step-cache.ts (100%) rename packages/{e2e => core}/src/agent/tool-loop.ts (100%) rename packages/{e2e => core}/src/agent/tool-output.ts (100%) rename packages/{e2e => core}/src/agent/tool.ts (100%) rename packages/{e2e => core}/src/agent/transcript-compaction.ts (100%) rename packages/{e2e => core}/src/agent/upload-paths.ts (100%) rename packages/{e2e => core}/src/agent/usage.ts (100%) rename packages/{e2e => core}/src/cache/anchors.ts (100%) rename packages/{e2e => core}/src/cache/context.ts (100%) rename packages/{e2e => core}/src/cache/decide.ts (100%) rename packages/{e2e => core}/src/cache/identity.ts (100%) rename packages/{e2e => core}/src/cache/recorder.ts (100%) rename packages/{e2e => core}/src/cache/rekeyed.ts (100%) rename packages/{e2e => core}/src/cache/relocate.ts (100%) rename packages/{e2e => core}/src/cache/route.ts (100%) rename packages/{e2e => core}/src/cache/store.ts (100%) rename packages/{e2e => core}/src/cache/template.ts (100%) rename packages/{e2e => core}/src/cache/trace-fields.ts (100%) rename packages/{e2e => core}/src/cache/trace-read.ts (100%) rename packages/{e2e => core}/src/cache/trace.ts (100%) rename packages/{e2e => core}/src/config/agent.ts (100%) rename packages/{e2e => core}/src/config/app.ts (100%) rename packages/{e2e => core}/src/config/command.ts (100%) rename packages/{e2e => core}/src/config/resolve.ts (100%) rename packages/{e2e => core}/src/config/secrets.ts (100%) rename packages/{e2e => core}/src/config/targets.ts (100%) rename packages/{e2e => core}/src/config/validate.ts (100%) rename packages/{e2e => core}/src/engine/computed-style.ts (100%) rename packages/{e2e => core}/src/engine/contract.ts (100%) create mode 100644 packages/core/src/engine/index.ts rename packages/{e2e => core}/src/engine/manifest.ts (100%) rename packages/{e2e => core}/src/engine/protocol/client.ts (100%) rename packages/{e2e => core}/src/engine/protocol/connection.ts (100%) rename packages/{e2e => core}/src/engine/protocol/manifest.ts (100%) rename packages/{e2e => core}/src/engine/protocol/protocol.ts (100%) rename packages/{e2e => core}/src/engine/protocol/server.ts (100%) rename packages/{e2e => core}/src/engine/protocol/transport.ts (100%) rename packages/{e2e => core}/src/engine/recording.ts (100%) rename packages/{e2e => core}/src/engine/resolve.ts (100%) rename packages/{e2e => core}/src/engine/session.ts (100%) rename packages/{e2e => core}/src/engine/surface.ts (100%) rename packages/{e2e => core}/src/engine/timing.ts (100%) rename packages/{e2e => core}/src/expect/attempt.ts (100%) rename packages/{e2e => core}/src/expect/poll-scope.ts (100%) rename packages/{e2e => core}/src/expect/samples.ts (100%) rename packages/{e2e => core}/src/expect/soft.ts (100%) rename packages/{e2e => core}/src/internal/abandoned.ts (100%) rename packages/{e2e => core}/src/internal/ai-trace.ts (100%) rename packages/{e2e => core}/src/internal/atomic-write.ts (100%) rename packages/{e2e => core}/src/internal/brands.ts (100%) rename packages/{e2e => core}/src/internal/client-identity.ts (100%) rename packages/{e2e => core}/src/internal/dates.ts (100%) rename packages/{e2e => core}/src/internal/debug.ts (100%) rename packages/{e2e => core}/src/internal/env.ts (100%) rename packages/{e2e => core}/src/internal/errors.ts (100%) rename packages/{e2e => core}/src/internal/expected-failure.ts (100%) rename packages/{e2e => core}/src/internal/geometry.ts (100%) rename packages/{e2e => core}/src/internal/globs.ts (100%) rename packages/{e2e => core}/src/internal/ids.ts (100%) rename packages/{e2e => core}/src/internal/image.ts (100%) rename packages/{e2e => core}/src/internal/json-value.ts (100%) rename packages/{e2e => core}/src/internal/keys.ts (100%) rename packages/{e2e => core}/src/internal/objects.ts (100%) rename packages/{e2e => core}/src/internal/options.ts (100%) rename packages/{e2e => core}/src/internal/package-version.ts (100%) rename packages/{e2e => core}/src/internal/paths.ts (100%) rename packages/{e2e => core}/src/internal/realm-slot.ts (100%) rename packages/{e2e => core}/src/internal/recording-modes.ts (100%) rename packages/{e2e => core}/src/internal/redact.ts (100%) rename packages/{e2e => core}/src/internal/regexp.ts (100%) rename packages/{e2e => core}/src/internal/roles.ts (100%) rename packages/{e2e => core}/src/internal/source.ts (100%) rename packages/{e2e => core}/src/internal/standard-schema.ts (100%) rename packages/{e2e => core}/src/internal/suggest.ts (100%) rename packages/{e2e => core}/src/internal/text.ts (100%) rename packages/{e2e => core}/src/internal/time.ts (100%) rename packages/{e2e => core}/src/internal/unserved-model.ts (100%) rename packages/{e2e => core}/src/internal/urls.ts (100%) rename packages/{e2e => core}/src/locator/engine.ts (100%) rename packages/{e2e => core}/src/locator/expression.ts (100%) rename packages/{e2e => core}/src/locator/screen.ts (100%) rename packages/{e2e => core}/src/params.ts (100%) rename packages/{e2e => core}/src/run/artifacts.ts (100%) rename packages/{e2e => core}/src/run/budget.ts (100%) rename packages/{e2e => core}/src/run/declared-processes.ts (100%) rename packages/{e2e => core}/src/run/engine-sessions.ts (100%) rename packages/{e2e => core}/src/run/fixture-recording.ts (100%) rename packages/{e2e => core}/src/run/fixtures.ts (100%) rename packages/{e2e => core}/src/run/managed-process.ts (100%) rename packages/{e2e => core}/src/run/output.ts (100%) rename packages/{e2e => core}/src/run/process-pool.ts (100%) rename packages/{e2e => core}/src/run/provision.ts (100%) rename packages/{e2e => core}/src/run/recordings.ts (100%) rename packages/{e2e => core}/src/run/records.ts (100%) rename packages/{e2e => core}/src/run/screenshots.ts (100%) rename packages/{e2e => core}/src/run/secrecy.ts (100%) rename packages/{e2e => core}/src/run/sessions.ts (100%) rename packages/{e2e => core}/src/run/standalone-attempt.ts (100%) rename packages/{e2e => core}/src/run/standalone.ts (100%) rename packages/{e2e => core}/src/run/step-screens.ts (100%) rename packages/{e2e => core}/src/run/steps.ts (100%) rename packages/{e2e => core}/src/run/worker-models.ts (100%) rename packages/{e2e => core}/src/secrets.ts (100%) rename packages/{e2e => core}/src/types.ts (100%) create mode 100644 packages/core/tests/unit/entries.test.ts create mode 100644 packages/core/tsconfig.build.json create mode 100644 packages/core/tsconfig.json create mode 100644 packages/core/vitest.config.ts diff --git a/.changeset/config.json b/.changeset/config.json index 3d77191108..465e680a15 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,11 +1,21 @@ { "$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json", - "changelog": ["@changesets/changelog-github", { "repo": "e2e-inc/e2e" }], + "changelog": [ + "@changesets/changelog-github", + { + "repo": "e2e-inc/e2e" + } + ], "commit": false, "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", - "fixed": [], + "fixed": [ + [ + "e2e", + "@e2e-dev/core" + ] + ], "linked": [], "ignore": [], "privatePackages": false, diff --git a/.changeset/e2e-core-package.md b/.changeset/e2e-core-package.md new file mode 100644 index 0000000000..fcb3bd1238 --- /dev/null +++ b/.changeset/e2e-core-package.md @@ -0,0 +1,8 @@ +--- +'e2e': patch +'@e2e-dev/core': patch +'@e2e-dev/web': patch +'@e2e-dev/mobile': patch +--- + +New package `@e2e-dev/core`: the engine contract, locators, agent, replay cache, and engine sessions that `e2e` is built on. `e2e` depends on it at the same version, and `e2e/engine` and `e2e/agent` re-export it unchanged. `@e2e-dev/web` and `@e2e-dev/mobile` peer on `@e2e-dev/core` beside `e2e`, and import the contract from `@e2e-dev/core/engine`, which a third-party engine can now import too. diff --git a/.fallowrc.json b/.fallowrc.json index 07b575a5c8..97adb352bd 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -51,7 +51,7 @@ "ignoreBinaries": ["eas"], "ignoreExports": [ { - "file": "packages/e2e/src/types.ts", + "file": "packages/core/src/types.ts", "exports": ["StandardSchemaV1"] } ], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2f29cb1733..44b726905e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,14 +3,15 @@ * @okwasniewski # Public contract: emitted types, type assertions, wire schemas. -/packages/e2e/src/types.ts @okwasniewski -/packages/e2e/src/engine/ @okwasniewski +/packages/core/src/types.ts @okwasniewski +/packages/core/src/engine/ @okwasniewski +/packages/e2e/src/run-types.ts @okwasniewski /packages/e2e/tests/types/ @okwasniewski /packages/e2e/schema/ @okwasniewski # Agent, secrets, navigation policy. -/packages/e2e/src/agent/ @okwasniewski -/packages/e2e/src/internal/urls.ts @okwasniewski +/packages/core/src/agent/ @okwasniewski +/packages/core/src/internal/urls.ts @okwasniewski /SECURITY.md @okwasniewski # Engines. diff --git a/AGENTS.md b/AGENTS.md index beb3b392c9..7c0ada0b45 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,8 +8,8 @@ TypeScript 7. There is no separate spec. The code is the contract, pinned in three places: - The emitted `packages/e2e/dist/index.d.ts` (and `dist/engine/index.d.ts`, - `dist/runner.d.ts`, `dist/oauth/*.d.ts`) - is the public API. `packages/e2e/tests/types/sdk-types.ts` holds compile-time + `dist/runner.d.ts`, `dist/oauth/*.d.ts`), and `@e2e-dev/core`'s + `packages/core/dist/engine/index.d.ts`, are the public API. `packages/e2e/tests/types/sdk-types.ts` holds compile-time assertions (`@ts-expect-error` lines) for the parts that are easy to loosen by accident; it runs under the package `typecheck`, never under vitest. - Wire formats live in `packages/e2e/schema/*.schema.json` (report-1, @@ -34,8 +34,28 @@ descriptions and commit bodies; `git log` and `gh pr view` are the archive. `packages/` holds what publishes to npm; `apps/` holds the private apps and suites that consume the built packages the way a user would. +- `packages/core` — the published `@e2e-dev/core` package, which `e2e` is built + on and depends on at its exact version (a changesets `fixed` group keeps + the two versions equal): the engine contract (`@e2e-dev/core/engine`, and + `src/engine/protocol/`), locators (`src/locator/`), the agent + (`src/agent/`, the `act` executor 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's `TargetExecutor` + extends), `run/standalone.ts` (the worker a runner host or MCP keeps + alive, with a `WorkerPolicy` per kind), and `run/standalone-attempt.ts` + (one attempt: reservation, launch, fixtures, deadline, close). Its one + public entry is `@e2e-dev/core/engine`. It imports nothing of `e2e`: + `tests/unit/package-imports.test.ts` in `packages/e2e` fails on a + dependency `@e2e-dev/core`'s manifest does not declare. `e2e` reaches its + modules as `@e2e-dev/core/lib/` (`./lib/*` in its exports), which is + not public API; `@e2e-dev/core`'s behavior is tested by `packages/e2e`'s + suites, through those paths and through the runner. - `packages/e2e` — the published `e2e` package: SDK surface, runner, CLI, - `e2e/engine` contract. Core knows the contract and never an engine's + and `e2e/engine` and `e2e/agent`, which re-export `@e2e-dev/core`'s. A + config's reporters and test filters resolve in `config/resolve-run.ts` + over `@e2e-dev/core`'s `resolveProjectConfig`, and their types live in + `src/run-types.ts`. Core knows the contract and never an engine's internals: no engine package is imported from `src/` (grep for `from '@e2e-dev/` and `import('@e2e-dev/`; the presets below are the only hits). Engine words still appear as platform labels, capability names, and in @@ -48,18 +68,15 @@ suites that consume the built packages the way a user would. 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.ts` is the worker a host or MCP's one-shot attempt keeps - alive, `standalone-attempt.ts` one attempt on it: reservation, launch, - fixtures, deadline, close, `host-trace.ts` its `trace.md`, and + `standalone-kinds.ts` the hosted and one-shot kinds of `@e2e-dev/core`'s + standalone worker, `host-trace.ts` a hosted attempt's `trace.md`, and `select-target.ts` the target a session names, shared with MCP; `open-session.ts` exposes `openHost` on `e2e/runner` for another test runner: worker-lifetime provisioning, app processes, and engine init, then `host.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/locator/` locator AST/engine, - `src/agent/` the agent (the `act` executor socket plus the judgment - methods), `src/mcp/` the `e2e mcp` server (a live session that rides + `src/collect/` registration+selection, `src/mcp/` the `e2e mcp` server (a live session that rides the `act` socket 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 @@ -76,17 +93,19 @@ suites that consume the built packages the way a user would. checks that need a stored login and are never part of `pnpm test`. - `packages/web` — the published `@e2e-dev/web` package: the browser engine, built with the public `defineEngine`, contributing the - `browser` fixture and `expect(browser)`. It depends on `e2e` (peer), never the - reverse; a target names it explicitly as `engine: web()`. There is - no default engine and no well-known id registry in core. It imports from - `e2e/engine` only: the semantics every engine must reproduce - (error taxonomy, text and URL matching, assertion polling, JSON-value rules) - are exported there, and there is no `e2e/internal` subpath. + `browser` fixture and `expect(browser)`. It depends on `@e2e-dev/core` and + `e2e` (peers), never the reverse; a target names it explicitly as + `engine: web()`. There is no default engine and no well-known id registry + in core. It imports from `@e2e-dev/core/engine` only: 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/mobile` package: the iOS/Android engine on agent-device, built with the same public `defineEngine`, contributing the `device` fixture. Like the web engine it - depends on `e2e` (peer), never the reverse; the engine implementation - imports from `e2e/engine` only, and a target names it as `engine: mobile()`. + depends on `@e2e-dev/core` and `e2e` (peers), never the reverse; the + engine implementation imports from `@e2e-dev/core/engine` only, and a target + names it as `engine: mobile()`. The `@e2e-dev/mobile/tools` subpath holds the agent-side `open_app`, `swipe`, and `alert` tools; focused-field typing uses the engine's keyboard grammar. The main entry never loads the AI SDK. @@ -337,8 +356,8 @@ pnpm test:web-benchmark # builds, then runs the real CLI against the benchmark Focused work: ```bash -pnpm --filter e2e run build -pnpm --filter e2e run test:unit # unit only, no build +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 @@ -348,8 +367,9 @@ pnpm --filter @e2e-dev/testbed run test:headed - Package `test` scripts do **not** build. Root `build` and `test` order the packages explicitly rather than relying on topological sort, because `e2e` devDepends on the web engine for its browser-backed integration tests - while the engine peer-depends on `e2e` — pnpm reports that cycle on every - install. + while the engine peer-depends on `e2e` — pnpm reports that cycle + on every install. `@e2e-dev/core` builds first: `e2e` and every engine compile + against its `dist`. - `pnpm typecheck` runs `build` first, then per-package `typecheck`. The package `typecheck` covers `tests/**`, which is what makes `tests/types/sdk-types.ts` a test. @@ -693,7 +713,7 @@ trees, on both platforms, without a device. entry. On `0.x` the bump is `patch` for a feature or fix; never pick `minor` on your own. A breaking change is a `minor` with the summary opening `**Breaking:**`; a `minor` or `major` for a release the maintainer - calls opens `**Release:**` (`scripts/check-changeset-bumps.ts`, `pnpm check`). Peer ranges point one way only (engine -> `e2e`, integration -> + calls opens `**Release:**` (`scripts/check-changeset-bumps.ts`, `pnpm check`). Peer ranges point one way only (engine -> `@e2e-dev/core` and `e2e`, integration -> engine) and read `>= `, 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; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f275a7188f..045e703bd8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -289,8 +289,9 @@ committed. The following are the public contract. A change that breaks any of them is a breaking change and follows the rules below: -- Public types exported from `e2e` and `e2e/engine`, as - emitted in `dist/index.d.ts` and `dist/engine/index.d.ts`. Removing an +- Public types exported from `e2e`, `e2e/engine`, and `@e2e-dev/core/engine`, + as emitted in `dist/index.d.ts` and `dist/engine/index.d.ts` of `e2e`, + and `dist/engine/index.d.ts` of `@e2e-dev/core`. Removing an export, narrowing an accepted input, widening a returned type, or changing a fixture's runtime behavior all count. - Config keys in `e2e.config.ts`, their types, and their defaults. @@ -300,7 +301,8 @@ breaking change and follows the rules below: Adding an optional field is compatible; renaming, removing, or changing the meaning of one is not. -Not covered: anything under `internal`, the testbed, the exact text of error +Not covered: anything under `internal`, `@e2e-dev/core/lib/*` (the modules `e2e` +reaches at the exact `@e2e-dev/core` version it depends on), the testbed, the exact text of error messages and reporter output (error *codes* are covered), and the agent's prompts and tool descriptions. @@ -326,12 +328,15 @@ prompts and tool descriptions. ### Engine contract -`e2e/engine` is what `@e2e-dev/web` and `@e2e-dev/mobile` -build against, and what a third-party engine builds against too. A change to -that contract bumps all three packages together in one release, with a -changeset for each, so an engine and a runner from the same release always -match. Engines declare a peer range on `e2e` that points one way only -(engine to runner, `>=x <1`), and each integration (`@e2e-dev/kernel`, `@e2e-dev/lightpanda`, `@e2e-dev/eas`, `@e2e-dev/smol`, `@e2e-dev/testmu`, `@e2e-dev/browserstack`, `@e2e-dev/e2b`) does +`@e2e-dev/core/engine` (re-exported as `e2e/engine`) is what `@e2e-dev/web` and +`@e2e-dev/mobile` build against, and what a third-party engine builds against +too. A change to that contract bumps `@e2e-dev/core`, `e2e`, and both engines +together in one release, with a changeset for each, so an engine and a runner +from the same release always match. `e2e` and `@e2e-dev/core` are a changesets +`fixed` group: they always share a version, and `e2e` depends on that exact +`@e2e-dev/core`. Engines declare a peer range on `@e2e-dev/core` that points one way +only (engine to core, `>=x <1`), plus one on `e2e` for the main entry that +adds the engine's fixture to `test`, and each integration (`@e2e-dev/kernel`, `@e2e-dev/lightpanda`, `@e2e-dev/eas`, `@e2e-dev/smol`, `@e2e-dev/testmu`, `@e2e-dev/browserstack`, `@e2e-dev/e2b`) does the same on the engines it plugs into; do not make it mutual or narrow it. ### Driver nightly compatibility diff --git a/docs/reference/engine.mdx b/docs/reference/engine.mdx index d429ad53c3..22c01dd470 100644 --- a/docs/reference/engine.mdx +++ b/docs/reference/engine.mdx @@ -12,7 +12,8 @@ implementation, derives its capabilities, and returns a handle for `targets` in the config. The runner drives it over the [engine protocol](/reference/engine-protocol), in its own process; see [Engines](/engines). Use `test.extend` fixtures for resources outside the UI, -such as APIs or databases. +such as APIs or databases. `@e2e-dev/core/engine` is the same module, and a +published engine imports it from there and peers on `@e2e-dev/core`. This sketch assumes a `connect` adapter for the platform: diff --git a/docs/writing-an-engine.mdx b/docs/writing-an-engine.mdx index 5c0dc9738a..b43655f5ba 100644 --- a/docs/writing-an-engine.mdx +++ b/docs/writing-an-engine.mdx @@ -34,16 +34,18 @@ Return a handle from `defineEngine`. It validates the manifest and computes the engine's capabilities when the config loads. -Import types and helpers from `e2e/engine` only; there is no internal -subpath. Declare `e2e` as a peer dependency, so the engine and the runner -share one set of error classes. +Import types and helpers from `@e2e-dev/core/engine` only; there is no internal +subpath. Declare `@e2e-dev/core` as a peer dependency, so the engine and the runner +share one set of error classes. `e2e/engine` +re-exports the same module, so an engine that imports it and peers on `e2e` +still runs under the runner. This skeleton assumes a `createClient` adapter for your platform. Its nodes must follow the [semantic tree rules](#nodes-and-refs). ```ts title="src/index.ts" expandable -import { ConfigurationError, defineEngine, resolveExpression, type EngineHandle } from 'e2e/engine'; +import { ConfigurationError, defineEngine, resolveExpression, type EngineHandle } from '@e2e-dev/core/engine'; export function hyperdrive(options: { device: string }): EngineHandle { const client = createClient(options); @@ -215,7 +217,7 @@ An engine option can take a secret too, such as a password the engine sends to the app: 1. Accept `string | Secret`. Tell them apart with `isSecret` from - `e2e/engine`. + `@e2e-dev/core/engine`. 2. List each handle in the engine's `secrets`. The config load rejects a name that no secret has. 3. Read the value in `startAttempt` with `context.resolveSecret(secret)`. diff --git a/package.json b/package.json index 06545246cc..dd8e1e076d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ ], "type": "module", "scripts": { - "build": "pnpm --filter e2e run build && pnpm --filter @e2e-dev/web run build && pnpm --filter @e2e-dev/mobile run build && pnpm --filter @e2e-dev/github run build && pnpm --filter @e2e-dev/html-reporter run build && pnpm --filter @e2e-dev/kernel run build && pnpm --filter @e2e-dev/browser-run run build && pnpm --filter @e2e-dev/lightpanda run build && pnpm --filter @e2e-dev/eas run build && pnpm --filter @e2e-dev/smol run build && pnpm --filter @e2e-dev/limrun run build && pnpm --filter @e2e-dev/decision run build && pnpm --filter @e2e-dev/testmu run build && pnpm --filter @e2e-dev/acp run build && pnpm --filter @e2e-dev/browserstack run build && pnpm --filter @e2e-dev/e2b run build", + "build": "pnpm --filter @e2e-dev/core run build && pnpm --filter e2e run build && pnpm --filter @e2e-dev/web run build && pnpm --filter @e2e-dev/mobile run build && pnpm --filter @e2e-dev/github run build && pnpm --filter @e2e-dev/html-reporter run build && pnpm --filter @e2e-dev/kernel run build && pnpm --filter @e2e-dev/browser-run run build && pnpm --filter @e2e-dev/lightpanda run build && pnpm --filter @e2e-dev/eas run build && pnpm --filter @e2e-dev/smol run build && pnpm --filter @e2e-dev/limrun run build && pnpm --filter @e2e-dev/decision run build && pnpm --filter @e2e-dev/testmu run build && pnpm --filter @e2e-dev/acp run build && pnpm --filter @e2e-dev/browserstack run build && pnpm --filter @e2e-dev/e2b run build", "check": "pnpm run lint && pnpm run check:dead-code && pnpm run typecheck && pnpm run docs:check-errors && pnpm run check:peer-ranges && pnpm run check:changeset-bumps && pnpm run check:examples && pnpm run check:install-scripts && pnpm run plugins:check && pnpm run mcp-server:check && pnpm run docs:check", "check:dead-code": "fallow dead-code", "check:peer-ranges": "node scripts/check-peer-ranges.ts", @@ -30,7 +30,7 @@ "canary": "node scripts/canary-changeset.ts && changeset version --snapshot canary && pnpm run build", "canary:publish": "changeset publish --tag canary --no-git-tag && node scripts/restore-peer-ranges.ts", "typecheck": "pnpm run build && pnpm -r run typecheck && tsc -p scripts", - "test": "pnpm run build && pnpm --filter e2e run test && pnpm --filter @e2e-dev/web run test && pnpm --filter @e2e-dev/mobile run test && pnpm --filter @e2e-dev/github run test && pnpm --filter @e2e-dev/html-reporter run test && pnpm --filter @e2e-dev/kernel run test && pnpm --filter @e2e-dev/browser-run run test && pnpm --filter @e2e-dev/lightpanda run test && pnpm --filter @e2e-dev/eas run test && pnpm --filter @e2e-dev/smol run test && pnpm --filter @e2e-dev/limrun run test && pnpm --filter @e2e-dev/decision run test && pnpm --filter @e2e-dev/acp run test && pnpm run test:scripts && pnpm --filter @e2e-dev/testmu run test && pnpm --filter @e2e-dev/browserstack run test && pnpm --filter @e2e-dev/e2b run test", + "test": "pnpm run build && pnpm --filter @e2e-dev/core run test && pnpm --filter e2e run test && pnpm --filter @e2e-dev/web run test && pnpm --filter @e2e-dev/mobile run test && pnpm --filter @e2e-dev/github run test && pnpm --filter @e2e-dev/html-reporter run test && pnpm --filter @e2e-dev/kernel run test && pnpm --filter @e2e-dev/browser-run run test && pnpm --filter @e2e-dev/lightpanda run test && pnpm --filter @e2e-dev/eas run test && pnpm --filter @e2e-dev/smol run test && pnpm --filter @e2e-dev/limrun run test && pnpm --filter @e2e-dev/decision run test && pnpm --filter @e2e-dev/acp run test && pnpm run test:scripts && pnpm --filter @e2e-dev/testmu run test && pnpm --filter @e2e-dev/browserstack run test && pnpm --filter @e2e-dev/e2b run test", "test:testbed": "pnpm run build && pnpm --filter @e2e-dev/testbed test", "test:web-benchmark": "pnpm run build && pnpm --filter @e2e-dev/web-benchmark test", "test:mobile-benchmark": "pnpm run build && pnpm --filter @e2e-dev/mobile-benchmark test", diff --git a/packages/core/LICENSE b/packages/core/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/packages/core/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/core/NOTICE b/packages/core/NOTICE new file mode 100644 index 0000000000..de8d11ff5a --- /dev/null +++ b/packages/core/NOTICE @@ -0,0 +1,5 @@ +@e2e-dev/core +Copyright 2026 TesterArmy, Inc. + +This product includes software developed at TesterArmy, Inc. +(https://tester.army). diff --git a/packages/core/README.md b/packages/core/README.md new file mode 100644 index 0000000000..f38bd45e82 --- /dev/null +++ b/packages/core/README.md @@ -0,0 +1,13 @@ +# @e2e-dev/core + +The engine contract, locators, agent, and replay cache that the +[e2e](https://github.com/e2e-inc/e2e) test runner is built on. `e2e` depends +on it at its own version, and the engines (`@e2e-dev/web`, +`@e2e-dev/mobile`) peer on it. + +Engine authors import the contract from `@e2e-dev/core/engine`; `e2e/engine` +re-exports it unchanged. See +[Writing an engine](https://e2e.com/docs/writing-an-engine). + +Everything under `@e2e-dev/core/lib/*` is internal to `e2e` and may change in any +release. diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 0000000000..55db8e463f --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,77 @@ +{ + "name": "@e2e-dev/core", + "version": "0.0.0", + "description": "The engine contract, locators, agent, and replay cache the e2e test runner is built on", + "keywords": [ + "e2e", + "automation", + "browser-automation", + "mobile-automation", + "ios", + "android", + "agent" + ], + "license": "Apache-2.0", + "contributors": [ + "Oskar Kwaśniewski ", + "Szymon Rybczak " + ], + "repository": { + "type": "git", + "url": "git+https://github.com/e2e-inc/e2e.git", + "directory": "packages/core" + }, + "bugs": { + "url": "https://github.com/e2e-inc/e2e/issues" + }, + "homepage": "https://github.com/e2e-inc/e2e/tree/main/packages/core#readme", + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public", + "tag": "latest" + }, + "type": "module", + "exports": { + "./engine": { + "types": "./dist/engine/index.d.ts", + "default": "./dist/engine/index.js" + }, + "./lib/*": { + "types": "./dist/*.d.ts", + "default": "./dist/*.js" + } + }, + "files": [ + "dist", + "NOTICE" + ], + "scripts": { + "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc --project tsconfig.build.json && node ../../scripts/stamp-dist.ts", + "prepublishOnly": "node ../../scripts/check-dist.ts", + "typecheck": "tsc --noEmit", + "test": "vitest run", + "test:unit": "vitest run tests/unit" + }, + "dependencies": { + "@napi-rs/image": "1.16.0", + "pixelmatch": "8.0.0", + "zod": "4.6.7" + }, + "peerDependencies": { + "ai": "^7.0.0" + }, + "peerDependenciesMeta": { + "ai": { + "optional": true + } + }, + "devDependencies": { + "@types/node": "26.6.6", + "ai": "7.0.173", + "typescript": "7.0.2", + "vitest": "5.1.0" + }, + "engines": { + "node": "^22.22.3 || >=24.8.0" + } +} diff --git a/packages/e2e/src/agent/act-validation.ts b/packages/core/src/agent/act-validation.ts similarity index 100% rename from packages/e2e/src/agent/act-validation.ts rename to packages/core/src/agent/act-validation.ts diff --git a/packages/e2e/src/agent/act.ts b/packages/core/src/agent/act.ts similarity index 100% rename from packages/e2e/src/agent/act.ts rename to packages/core/src/agent/act.ts diff --git a/packages/e2e/src/agent/action-dispatcher.ts b/packages/core/src/agent/action-dispatcher.ts similarity index 100% rename from packages/e2e/src/agent/action-dispatcher.ts rename to packages/core/src/agent/action-dispatcher.ts diff --git a/packages/e2e/src/agent/action-names.ts b/packages/core/src/agent/action-names.ts similarity index 100% rename from packages/e2e/src/agent/action-names.ts rename to packages/core/src/agent/action-names.ts diff --git a/packages/e2e/src/agent/actions.ts b/packages/core/src/agent/actions.ts similarity index 100% rename from packages/e2e/src/agent/actions.ts rename to packages/core/src/agent/actions.ts diff --git a/packages/e2e/src/agent/agent-brand.ts b/packages/core/src/agent/agent-brand.ts similarity index 100% rename from packages/e2e/src/agent/agent-brand.ts rename to packages/core/src/agent/agent-brand.ts diff --git a/packages/e2e/src/agent/ai-sdk.ts b/packages/core/src/agent/ai-sdk.ts similarity index 100% rename from packages/e2e/src/agent/ai-sdk.ts rename to packages/core/src/agent/ai-sdk.ts diff --git a/packages/e2e/src/agent/call-options.ts b/packages/core/src/agent/call-options.ts similarity index 100% rename from packages/e2e/src/agent/call-options.ts rename to packages/core/src/agent/call-options.ts diff --git a/packages/e2e/src/agent/default-agent.ts b/packages/core/src/agent/default-agent.ts similarity index 100% rename from packages/e2e/src/agent/default-agent.ts rename to packages/core/src/agent/default-agent.ts diff --git a/packages/e2e/src/agent/derived.ts b/packages/core/src/agent/derived.ts similarity index 100% rename from packages/e2e/src/agent/derived.ts rename to packages/core/src/agent/derived.ts diff --git a/packages/e2e/src/agent/error.ts b/packages/core/src/agent/error.ts similarity index 100% rename from packages/e2e/src/agent/error.ts rename to packages/core/src/agent/error.ts diff --git a/packages/e2e/src/agent/executor.ts b/packages/core/src/agent/executor.ts similarity index 100% rename from packages/e2e/src/agent/executor.ts rename to packages/core/src/agent/executor.ts diff --git a/packages/e2e/src/agent/index.ts b/packages/core/src/agent/index.ts similarity index 100% rename from packages/e2e/src/agent/index.ts rename to packages/core/src/agent/index.ts diff --git a/packages/e2e/src/agent/invocation.ts b/packages/core/src/agent/invocation.ts similarity index 100% rename from packages/e2e/src/agent/invocation.ts rename to packages/core/src/agent/invocation.ts diff --git a/packages/e2e/src/agent/ledger.ts b/packages/core/src/agent/ledger.ts similarity index 100% rename from packages/e2e/src/agent/ledger.ts rename to packages/core/src/agent/ledger.ts diff --git a/packages/e2e/src/agent/loop-guards.ts b/packages/core/src/agent/loop-guards.ts similarity index 100% rename from packages/e2e/src/agent/loop-guards.ts rename to packages/core/src/agent/loop-guards.ts diff --git a/packages/e2e/src/agent/message-shape.ts b/packages/core/src/agent/message-shape.ts similarity index 100% rename from packages/e2e/src/agent/message-shape.ts rename to packages/core/src/agent/message-shape.ts diff --git a/packages/e2e/src/agent/model/adapter.ts b/packages/core/src/agent/model/adapter.ts similarity index 100% rename from packages/e2e/src/agent/model/adapter.ts rename to packages/core/src/agent/model/adapter.ts diff --git a/packages/e2e/src/agent/model/overflow.ts b/packages/core/src/agent/model/overflow.ts similarity index 100% rename from packages/e2e/src/agent/model/overflow.ts rename to packages/core/src/agent/model/overflow.ts diff --git a/packages/e2e/src/agent/model/provider-hints.ts b/packages/core/src/agent/model/provider-hints.ts similarity index 100% rename from packages/e2e/src/agent/model/provider-hints.ts rename to packages/core/src/agent/model/provider-hints.ts diff --git a/packages/e2e/src/agent/model/schema.ts b/packages/core/src/agent/model/schema.ts similarity index 100% rename from packages/e2e/src/agent/model/schema.ts rename to packages/core/src/agent/model/schema.ts diff --git a/packages/e2e/src/agent/model/sdk.ts b/packages/core/src/agent/model/sdk.ts similarity index 100% rename from packages/e2e/src/agent/model/sdk.ts rename to packages/core/src/agent/model/sdk.ts diff --git a/packages/e2e/src/agent/model/stall.ts b/packages/core/src/agent/model/stall.ts similarity index 100% rename from packages/e2e/src/agent/model/stall.ts rename to packages/core/src/agent/model/stall.ts diff --git a/packages/e2e/src/agent/model/tool-choice.ts b/packages/core/src/agent/model/tool-choice.ts similarity index 100% rename from packages/e2e/src/agent/model/tool-choice.ts rename to packages/core/src/agent/model/tool-choice.ts diff --git a/packages/e2e/src/agent/observation-budget.ts b/packages/core/src/agent/observation-budget.ts similarity index 100% rename from packages/e2e/src/agent/observation-budget.ts rename to packages/core/src/agent/observation-budget.ts diff --git a/packages/e2e/src/agent/observation-feed.ts b/packages/core/src/agent/observation-feed.ts similarity index 100% rename from packages/e2e/src/agent/observation-feed.ts rename to packages/core/src/agent/observation-feed.ts diff --git a/packages/e2e/src/agent/observation.ts b/packages/core/src/agent/observation.ts similarity index 100% rename from packages/e2e/src/agent/observation.ts rename to packages/core/src/agent/observation.ts diff --git a/packages/e2e/src/agent/operation-queue.ts b/packages/core/src/agent/operation-queue.ts similarity index 100% rename from packages/e2e/src/agent/operation-queue.ts rename to packages/core/src/agent/operation-queue.ts diff --git a/packages/e2e/src/agent/phases.ts b/packages/core/src/agent/phases.ts similarity index 100% rename from packages/e2e/src/agent/phases.ts rename to packages/core/src/agent/phases.ts diff --git a/packages/e2e/src/agent/pixels.ts b/packages/core/src/agent/pixels.ts similarity index 100% rename from packages/e2e/src/agent/pixels.ts rename to packages/core/src/agent/pixels.ts diff --git a/packages/e2e/src/agent/point-tap.ts b/packages/core/src/agent/point-tap.ts similarity index 100% rename from packages/e2e/src/agent/point-tap.ts rename to packages/core/src/agent/point-tap.ts diff --git a/packages/e2e/src/agent/primitives.ts b/packages/core/src/agent/primitives.ts similarity index 100% rename from packages/e2e/src/agent/primitives.ts rename to packages/core/src/agent/primitives.ts diff --git a/packages/e2e/src/agent/prompts.ts b/packages/core/src/agent/prompts.ts similarity index 100% rename from packages/e2e/src/agent/prompts.ts rename to packages/core/src/agent/prompts.ts diff --git a/packages/e2e/src/agent/protocol.ts b/packages/core/src/agent/protocol.ts similarity index 100% rename from packages/e2e/src/agent/protocol.ts rename to packages/core/src/agent/protocol.ts diff --git a/packages/core/src/agent/public.ts b/packages/core/src/agent/public.ts new file mode 100644 index 0000000000..8cfb9143be --- /dev/null +++ b/packages/core/src/agent/public.ts @@ -0,0 +1,33 @@ +/** + * The `e2e/agent` entrypoint: what a project builds agents from on the AI + * SDK. The built-in agent needs no builder: an agents entry is one plain + * object (`agents: { default: { model, system, tools } }`), and `defineTool` + * makes its project tools. `createToolLoopExecutor` is the built-in agent's + * loop with a caller's own prompt and tool vocabulary, for a custom brain + * under `{ executor }`. `createGrammarTools` and `BASE_RULES` are the + * built-in agent's action tools and their rules, and `createVerdictTool` and + * `VERDICT_RULES` its `complete_step`, for a loop or an executor that keeps + * the built-in actions and verdicts. The socket vocabulary itself, `StepExecutor` and its + * verdicts, lives on the main `e2e` entrypoint, so a hand-rolled executor + * needs no import from here (and no AI SDK) at all. + */ + +export { + createToolLoopExecutor, + type ToolLoopExecutorOptions, + type PreparedTurn, + type PreparedMessages, + type ToolLoopHelpers, +} from './tool-loop.ts'; +export { defineTool, getToolContext, type DefinedTool, type ToolAnnotations } from './tool.ts'; +export { AgentError, isAgentError } from './error.ts'; +export { + createGrammarTools, + createVerdictTool, + VERDICT_RULES, + type GrammarToolOptions, + type VerdictTool, +} from './primitives.ts'; +export { BASE_RULES } from './default-agent.ts'; +export { isRuntimeHardStop } from './executor.ts'; +export type { ScreenOutput } from './screen-update.ts'; diff --git a/packages/e2e/src/agent/reading.ts b/packages/core/src/agent/reading.ts similarity index 100% rename from packages/e2e/src/agent/reading.ts rename to packages/core/src/agent/reading.ts diff --git a/packages/e2e/src/agent/redaction.ts b/packages/core/src/agent/redaction.ts similarity index 100% rename from packages/e2e/src/agent/redaction.ts rename to packages/core/src/agent/redaction.ts diff --git a/packages/e2e/src/agent/replay.ts b/packages/core/src/agent/replay.ts similarity index 100% rename from packages/e2e/src/agent/replay.ts rename to packages/core/src/agent/replay.ts diff --git a/packages/e2e/src/agent/sample-files.ts b/packages/core/src/agent/sample-files.ts similarity index 100% rename from packages/e2e/src/agent/sample-files.ts rename to packages/core/src/agent/sample-files.ts diff --git a/packages/e2e/src/agent/screen-update.ts b/packages/core/src/agent/screen-update.ts similarity index 100% rename from packages/e2e/src/agent/screen-update.ts rename to packages/core/src/agent/screen-update.ts diff --git a/packages/e2e/src/agent/scroll-target.ts b/packages/core/src/agent/scroll-target.ts similarity index 100% rename from packages/e2e/src/agent/scroll-target.ts rename to packages/core/src/agent/scroll-target.ts diff --git a/packages/e2e/src/agent/secrets.ts b/packages/core/src/agent/secrets.ts similarity index 100% rename from packages/e2e/src/agent/secrets.ts rename to packages/core/src/agent/secrets.ts diff --git a/packages/e2e/src/agent/settle-policy.ts b/packages/core/src/agent/settle-policy.ts similarity index 100% rename from packages/e2e/src/agent/settle-policy.ts rename to packages/core/src/agent/settle-policy.ts diff --git a/packages/e2e/src/agent/step-accounting.ts b/packages/core/src/agent/step-accounting.ts similarity index 100% rename from packages/e2e/src/agent/step-accounting.ts rename to packages/core/src/agent/step-accounting.ts diff --git a/packages/e2e/src/agent/step-cache.ts b/packages/core/src/agent/step-cache.ts similarity index 100% rename from packages/e2e/src/agent/step-cache.ts rename to packages/core/src/agent/step-cache.ts diff --git a/packages/e2e/src/agent/tool-loop.ts b/packages/core/src/agent/tool-loop.ts similarity index 100% rename from packages/e2e/src/agent/tool-loop.ts rename to packages/core/src/agent/tool-loop.ts diff --git a/packages/e2e/src/agent/tool-output.ts b/packages/core/src/agent/tool-output.ts similarity index 100% rename from packages/e2e/src/agent/tool-output.ts rename to packages/core/src/agent/tool-output.ts diff --git a/packages/e2e/src/agent/tool.ts b/packages/core/src/agent/tool.ts similarity index 100% rename from packages/e2e/src/agent/tool.ts rename to packages/core/src/agent/tool.ts diff --git a/packages/e2e/src/agent/transcript-compaction.ts b/packages/core/src/agent/transcript-compaction.ts similarity index 100% rename from packages/e2e/src/agent/transcript-compaction.ts rename to packages/core/src/agent/transcript-compaction.ts diff --git a/packages/e2e/src/agent/upload-paths.ts b/packages/core/src/agent/upload-paths.ts similarity index 100% rename from packages/e2e/src/agent/upload-paths.ts rename to packages/core/src/agent/upload-paths.ts diff --git a/packages/e2e/src/agent/usage.ts b/packages/core/src/agent/usage.ts similarity index 100% rename from packages/e2e/src/agent/usage.ts rename to packages/core/src/agent/usage.ts diff --git a/packages/e2e/src/cache/anchors.ts b/packages/core/src/cache/anchors.ts similarity index 100% rename from packages/e2e/src/cache/anchors.ts rename to packages/core/src/cache/anchors.ts diff --git a/packages/e2e/src/cache/context.ts b/packages/core/src/cache/context.ts similarity index 100% rename from packages/e2e/src/cache/context.ts rename to packages/core/src/cache/context.ts diff --git a/packages/e2e/src/cache/decide.ts b/packages/core/src/cache/decide.ts similarity index 100% rename from packages/e2e/src/cache/decide.ts rename to packages/core/src/cache/decide.ts diff --git a/packages/e2e/src/cache/identity.ts b/packages/core/src/cache/identity.ts similarity index 100% rename from packages/e2e/src/cache/identity.ts rename to packages/core/src/cache/identity.ts diff --git a/packages/e2e/src/cache/recorder.ts b/packages/core/src/cache/recorder.ts similarity index 100% rename from packages/e2e/src/cache/recorder.ts rename to packages/core/src/cache/recorder.ts diff --git a/packages/e2e/src/cache/rekeyed.ts b/packages/core/src/cache/rekeyed.ts similarity index 100% rename from packages/e2e/src/cache/rekeyed.ts rename to packages/core/src/cache/rekeyed.ts diff --git a/packages/e2e/src/cache/relocate.ts b/packages/core/src/cache/relocate.ts similarity index 100% rename from packages/e2e/src/cache/relocate.ts rename to packages/core/src/cache/relocate.ts diff --git a/packages/e2e/src/cache/route.ts b/packages/core/src/cache/route.ts similarity index 100% rename from packages/e2e/src/cache/route.ts rename to packages/core/src/cache/route.ts diff --git a/packages/e2e/src/cache/store.ts b/packages/core/src/cache/store.ts similarity index 100% rename from packages/e2e/src/cache/store.ts rename to packages/core/src/cache/store.ts diff --git a/packages/e2e/src/cache/template.ts b/packages/core/src/cache/template.ts similarity index 100% rename from packages/e2e/src/cache/template.ts rename to packages/core/src/cache/template.ts diff --git a/packages/e2e/src/cache/trace-fields.ts b/packages/core/src/cache/trace-fields.ts similarity index 100% rename from packages/e2e/src/cache/trace-fields.ts rename to packages/core/src/cache/trace-fields.ts diff --git a/packages/e2e/src/cache/trace-read.ts b/packages/core/src/cache/trace-read.ts similarity index 100% rename from packages/e2e/src/cache/trace-read.ts rename to packages/core/src/cache/trace-read.ts diff --git a/packages/e2e/src/cache/trace.ts b/packages/core/src/cache/trace.ts similarity index 100% rename from packages/e2e/src/cache/trace.ts rename to packages/core/src/cache/trace.ts diff --git a/packages/e2e/src/config/agent.ts b/packages/core/src/config/agent.ts similarity index 100% rename from packages/e2e/src/config/agent.ts rename to packages/core/src/config/agent.ts diff --git a/packages/e2e/src/config/app.ts b/packages/core/src/config/app.ts similarity index 100% rename from packages/e2e/src/config/app.ts rename to packages/core/src/config/app.ts diff --git a/packages/e2e/src/config/command.ts b/packages/core/src/config/command.ts similarity index 100% rename from packages/e2e/src/config/command.ts rename to packages/core/src/config/command.ts diff --git a/packages/e2e/src/config/resolve.ts b/packages/core/src/config/resolve.ts similarity index 100% rename from packages/e2e/src/config/resolve.ts rename to packages/core/src/config/resolve.ts diff --git a/packages/e2e/src/config/secrets.ts b/packages/core/src/config/secrets.ts similarity index 100% rename from packages/e2e/src/config/secrets.ts rename to packages/core/src/config/secrets.ts diff --git a/packages/e2e/src/config/targets.ts b/packages/core/src/config/targets.ts similarity index 100% rename from packages/e2e/src/config/targets.ts rename to packages/core/src/config/targets.ts diff --git a/packages/e2e/src/config/validate.ts b/packages/core/src/config/validate.ts similarity index 100% rename from packages/e2e/src/config/validate.ts rename to packages/core/src/config/validate.ts diff --git a/packages/e2e/src/engine/computed-style.ts b/packages/core/src/engine/computed-style.ts similarity index 100% rename from packages/e2e/src/engine/computed-style.ts rename to packages/core/src/engine/computed-style.ts diff --git a/packages/e2e/src/engine/contract.ts b/packages/core/src/engine/contract.ts similarity index 100% rename from packages/e2e/src/engine/contract.ts rename to packages/core/src/engine/contract.ts diff --git a/packages/core/src/engine/index.ts b/packages/core/src/engine/index.ts new file mode 100644 index 0000000000..383e326933 --- /dev/null +++ b/packages/core/src/engine/index.ts @@ -0,0 +1,969 @@ +/** + * The engine contract: the typed, model-free body of one target. + * + * An engine never talks to a model. It declares capabilities - observation, + * actions, location, state, artifacts, contributed fixtures - and the harness + * grades what a target can do from what its engine declares: observation + * unlocks the judgment tier and prompt snapshots, `perform` unlocks the + * harness-routed node actions (the agent's grammar verbs and the `screen` + * tier's actions alike), location unlocks `screen`/`expect`. Every piece of + * model-facing vocabulary is an agent-side `defineTool`; a target with no + * engine at all is valid and simply runs everything opaque. + * + * Core knows this contract and never an engine's internals. The one platform + * noun here is `platform`, the label an engine declares it drives and its + * target inherits; no member's shape depends on it. A document engine, a + * simulator engine, and a desktop engine fill in the same members with + * different bodies. + * + * `defineEngine` is the loud manifest: capability detection happens here, + * synchronously, at config load - a malformed engine fails the run instead + * of silently demoting itself to a lower tier. + */ + +import { engineBrand } from '../internal/brands.ts'; +import type { ComputedStyleProperty, ComputedStyleValues } from './computed-style.ts'; + +export { COMPUTED_STYLE_PROPERTIES, validateComputedStyleProperties } from './computed-style.ts'; +export type { ComputedStyleProperty, ComputedStyleValues } from './computed-style.ts'; + +// Semantics the spec requires every engine and contributed fixture to +// reproduce exactly, exported so an engine never carries its own copy: the +// runner error taxonomy, text-pattern matching, locator resolution over a +// semantic tree, URL matching, assertion polling, option-bag validation, the +// JSON-value rules for data a fixture returns, and the unknown-key check +// config options get. +export { ConfigurationError, InfrastructureError, TestError } from '../internal/errors.ts'; +export { rejectUnknownKeys, rejectUnknownOptions } from '../internal/options.ts'; +export { validateJsonValue, type JsonValueRules } from '../internal/json-value.ts'; +export { describePattern, matchesText, toTextPattern } from '../internal/text.ts'; +export { resolveExpression, type ResolveExpressionOptions } from './resolve.ts'; +export type { TextMatch } from '../types.ts'; +export { raceAbort } from './timing.ts'; +export { isProviderRecording, stopProviderRecording } from './recording.ts'; +export type { + ProviderRecordContext, + ProviderRecording, + ProviderRecordingResult, + ProviderRecordingStopContext, + ProviderRecordingTarget, +} from './recording.ts'; +export { Deadline, pollCondition, stepTimeout, withTimeout, withinCleanupBudget, type PollConditionOptions } from '../internal/time.ts'; +export { sameSite, siteOf, urlMatches } from '../internal/urls.ts'; +export { obj, type WithoutUndefined } from '../internal/objects.ts'; +import type { AppPermissionState, Expectable, Locator, Screen, Secret } from '../types.ts'; +import type { + EngineSpiVersion, + LocatorAction, + LocatorActionKind, + LocatorExpression, + NodeRef, + ObservationPixels, + OperationContext, + PointerAction, + PointerActionKind, + SemanticNode, + ViewportPoint, + ViewportSize, +} from './contract.ts'; + +export type * from './contract.ts'; +export { + ENGINE_ERROR_CODES, + ENGINE_SPI_VERSION, + EngineError, + KEY_MODIFIERS, + KEY_NAMES, + LOCATOR_ACTION_KINDS, + OBSERVED_NAME_LIMIT, + OBSERVED_TEXT_LIMIT, + POINTER_ACTION_KINDS, + RETRYABLE_ENGINE_ERROR_CODES, + parseKey, +} from './contract.ts'; +export type { AppPermissionState, Expectable, JsonValue, Locator, Screen, Secret } from '../types.ts'; +export { isSecret } from '../secrets.ts'; + +/** + * Capability names: the closed harness capabilities plus one name per + * contributed fixture. `actions` is `perform`; `location` is `locate`; both + * require observation, because their refs live in the observation's id space. + * `pointer` is `performAt`, an action addressed by a viewport point rather + * than a node, and requires observation because the point is read off its + * pixels. + */ +export type EngineCapability = + | 'observation' + | 'computed-style' + | 'actions' + | 'location' + | 'pointer' + | 'keyboard' + | 'state' + | 'artifacts' + | (string & {}); + +/** + * capability: keyboard - requires observation. Input to whatever holds focus, + * with no node behind it: the agent's `type` and `press` without a target, and + * the fallback of its point-addressed `type_at` and `press_at` when the point + * lands on nothing the tree lists (a field drawn on a canvas, an input a + * platform flattens out of its accessibility tree). Focus is the app's: the + * harness tapped first, or the model said the field already has it. + */ +export interface EngineKeyboard { + /** + * Types `text` into the focused field as a person typing would, through + * the platform's keyboard path: a browser dispatches the key events of each + * character, a device sends the text through its keyboard. Where the + * platform has key events the app must receive them; setting the value + * without keystrokes is not a compliant implementation, since + * `locator.pressSequentially` and the agent's `type` rely on the app + * reacting as it does to a user. With `replace`, clears the field first + * (select-all and delete on a keyboard surface; the platform's clear on a + * device). Throw `NOT_ACTIONABLE` when nothing that accepts text has focus, + * so the keystrokes are never silently discarded into the document body. + */ + type(text: string, options: { readonly replace: boolean }, context: OperationContext): Promise; + /** + * Sends one key of the contract grammar (`Enter`, `Escape`, `Tab`, + * `Shift+Tab`, a character) to whatever holds focus. The harness has + * already validated the key's shape; refuse with `UNSUPPORTED_CAPABILITY` + * a key the surface cannot deliver. + */ + press(key: string, context: OperationContext): Promise; + /** Hides an on-screen keyboard. Platforms without one leave it undefined. */ + dismiss?(context: OperationContext): Promise; +} + +/** Handed to `Engine.validateApp` beside the declaration. */ +export interface EngineAppCheckInfo { + /** The target declaring the app, for the message of a refusal. */ + readonly targetName: string; +} + +/** + * The app the harness resolved from the target's declaration, handed to + * `prepare` and `init`: the origin and site policy for the decisions only a + * surface can make (which requests carry injected credentials, which nested + * documents enter an observation), and what a device launches. Navigation + * stays with the harness: a surface opens what `session.open` is given. + */ +export interface EngineAppInfo { + /** + * The origin of the app's `url` on the run's port (`scheme://host:port`, as + * `URL.origin` serializes it): where credentials an engine injects into + * requests (headers, basic auth) go by default. Absent for an app without + * a URL, and for a free port the run has not assigned (`e2e doctor`). + */ + readonly origin?: string; + /** + * The site of the app's `url`, its registrable domain as `siteOf` reads it: + * whose child frames an observation reads; `sameSite` applies it. Absent + * for an app without a URL, which is no policy at all. + */ + readonly site?: string; + /** The installed app to launch, as the target declared it. */ + readonly bundleId?: string; + /** The build to install, as the target declared it; relative to `projectRoot`. */ + readonly appPath?: string; + /** Arguments every fresh launch passes the app. */ + readonly launchArguments?: readonly string[]; + /** Permissions the app holds, by name; what each state means is the engine's (a device sets them before every fresh launch). */ + readonly permissions?: Readonly>; +} + +/** + * The app a target declares, as its engine reads it at config load: what it + * is and where it is served. The app is the target's alone + * (`targets: [{ engine, app }]`); an engine only drives it. The harness has + * checked the shape of every field before `Engine.validateApp` sees it, so + * an engine can require what its platform needs (a URL, a bundle id) and + * refuse what it cannot drive, naming the target. + */ +export type EngineAppDeclaration = EngineAppInfo & { + /** Base URL the target opens, as declared; see `TargetApp.url`. */ + readonly url?: string; +}; + +/** Explicit recording policy for one async fixture method. Arguments enter reports only through label. */ +export interface FixtureOperation { + readonly kind: 'resource' | 'assertion'; + readonly label?: (...args: Args) => string; + /** Action timeout by default, none of its own for 0; false when the method owns its assertion/navigation deadline. */ + readonly timeout?: number | false | ((...args: Args) => number | undefined); + /** Assertions verify by default; waits may opt in as well. */ + readonly verifies?: boolean; +} + +/** Only declared async methods are recorded. Sync accessors pass through unchanged. */ +export type FixtureOperations = { + readonly [Key in keyof T]?: T[Key] extends (...args: infer Args) => Promise + ? FixtureOperation + : T[Key] extends object ? FixtureOperations : never; +}; + +/** Context handed to a contributed fixture factory, once per attempt. */ +export interface EngineFixtureContext { + /** The target the fixture serves. */ + readonly targetName: string; + /** Records the declared operations before invoking them; undeclared accessors retain their identity. */ + fixture(name: string, surface: T, operations: FixtureOperations): T; + readonly app: EngineAppInfo & { + /** + * Resolves a navigation target against the base URL. Throws + * `APP_URL_REQUIRED` when the target declares no URL and `POLICY_DENIED` + * for any scheme but `http:` and `https:` (`about:blank` aside), so a + * fixture never re-implements the rule the harness owns. + */ + resolveUrl(url: string): string; + }; + /** Harness budgets, for fixtures that poll or navigate. */ + readonly timeouts: { + readonly test: number; + readonly action: number; + readonly assertion: number; + }; + /** + * The running phase's signal: the attempt's through `beforeEach` and the + * body, then a fresh one per `afterEach` hook so teardown can still drive + * the app after a body timeout. Read it per call; a fixture factory that + * captures it once keeps a signal that is dead by teardown. + */ + readonly signal: AbortSignal; + /** Per-call operation budget: the action timeout (or an explicit one) plus the attempt signal. */ + operation(timeoutMs?: number): OperationContext; + /** Registers a file the current step produced under the attempt artifact directory. */ + attachArtifact( + kind: 'screenshot' | 'video' | 'download' | 'log', + relativePath: string, + ): void; + /** Records the viewport the current step established. */ + attachViewport(viewport: { width: number; height: number; scale: number }): void; + /** Mints a public locator from a raw expression (a platform selector, say). */ + locator(expression: LocatorExpression): Locator; + /** Mints a screen scope whose every query is wrapped by `scope` (a nested document, say). */ + screen(scope: (expression: LocatorExpression) => LocatorExpression): Screen; + /** + * Attaches an expectation surface to a fixture object so `expect(fixture)` + * returns it. The harness records every matcher call as an assertion step + * named `expect.`; the factory only decides what the matchers mean. + */ + expectable(target: T, factory: () => E): T & Expectable; +} + +/** + * A contributed fixture: any record of async methods, sync accessors, and + * nested namespaces, declared through context.fixture so its metadata controls + * labels, deadlines and verification. The factory must return the declared + * surface; a plain one is rejected with INVALID_CONFIG. + */ +export type EngineFixtureFactory = (context: EngineFixtureContext) => object; + +/** + * An opaque, restorable snapshot of an engine's state. `data` is JSON the + * harness never inspects - a document platform's storage state, a device's app state, a + * desktop's window state all satisfy it identically. `format`/`version` let a + * engine reject a snapshot it can no longer read. + */ +export interface EngineState { + /** Engine-defined format name. */ + readonly format: string; + /** Format version, for rejecting a snapshot the engine can no longer read. */ + readonly version: number; + /** Opaque JSON the runner never inspects. */ + readonly data: unknown; + /** Earliest moment the state is known to be invalid, if the engine knows one. */ + readonly expiresAt?: string; +} + +/** + * Platform-neutral state capture and restore. A setup test captures a + * snapshot; an ordinary test restores it at launch. + * + * Snapshots are credentials: cookies, tokens, and storage that authenticate + * the app under test. The duties split at the seam. The harness owns the + * snapshot from the moment `capture` returns: it encrypts it at rest with a + * per-run AES-256-GCM key that never touches disk, stores it under the run's + * private session directory, binds it to the run, target, engine, and app + * identity, and deletes it when the run ends; it never logs it, reports it, + * digests it, or sends it to a model. An engine MUST NOT persist, cache, or + * log a snapshot on its own, MUST NOT echo snapshot contents in an error + * message, and MUST treat `restore` as a replacement of the surface's whole + * persisted state, never a merge, so a restored session cannot leak into the + * next attempt. + */ +export interface EngineStateCapability { + /** Captures the surface's persisted state. */ + capture(context: OperationContext): Promise; + /** Replaces the surface's persisted state with `state`. */ + restore(state: EngineState, context: OperationContext): Promise; +} + +/** + * Evidence capture. Paths are relative to the attempt artifact directory the + * engine received in `startAttempt`. + */ +export interface EngineArtifacts { + /** Captures a redacted screenshot; secure fields are masked at the source. */ + screenshot(label: string | undefined, context: OperationContext): Promise; + /** + * Starts recording the surface. Declared together with `stopVideo`. An + * attempt may start and stop more than once, never overlapping. A surface that has nothing to show yet (no page open) may + * defer the actual capture to the moment it does; the segments returned by + * `stopVideo` say when each one began. + */ + startVideo?(context: OperationContext): Promise; + /** + * Stops recording and returns every segment written, in order. One segment + * is the common case; a surface whose recording is bound to a page returns + * one per page the attempt showed (a restart or a state reset opens a new + * one). An attempt that never showed anything returns none. + */ + stopVideo?(context: OperationContext): Promise; +} + +/** + * One recorded video of an attempt: a file the engine wrote into the attempt + * artifact directory, or a recording a hosted service keeps and links to. + */ +export type VideoSegment = VideoFile | VideoLink; + +/** A video file in the attempt artifact directory. */ +export interface VideoFile { + /** Path relative to the attempt artifact directory. */ + readonly path: string; + /** When the segment started recording, as an ISO timestamp; its first frame is at or just after it. */ + readonly startedAt: string; +} + +/** A recording a hosted service keeps, by URL: the report links to it and the runner never downloads it. */ +export interface VideoLink { + /** `http(s)` URL of the recording. */ + readonly url: string; + /** Media type of what the URL serves: `video/mp4`, or `text/html` for a player page. */ + readonly mediaType: string; + /** When the recording started, as an ISO timestamp; its first frame is at or just after it. */ + readonly startedAt: string; +} + +/** + * Steering hooks behind the universal `app` fixture and the agent's + * `navigate` verb. The app itself is the target's `app`, handed over as data; + * node actions never live here, they are `perform`. + * + * `restart` and `reset` open nothing on an addressable surface: they end at + * a fresh surface with no location shown, and the harness reopens the app + * through `open` when the target has an address. A surface therefore never + * needs to know the app's URL, and an unreachable app after a restart is + * reported the same way as on first open. A surface without `open` (a + * device with a pinned app) relaunches the app inside `restart` and `reset` + * itself, since nothing else will. + */ +export interface EngineSession { + /** + * Opens one URL the harness already resolved against the base URL and the + * origin policy. Absent on a surface without addressable locations. + */ + open?(url: string, context: OperationContext): Promise; + /** Navigates back once in the surface's history. */ + back?(context: OperationContext): Promise; + /** Sets the viewport to `size` in CSS pixels, for this page and every page the attempt opens after it. */ + resize?(size: ViewportSize, context: OperationContext): Promise; + /** + * Shows the open tab at `index`, zero-based in the order the tabs opened, + * as `EngineSnapshot.tabs` counts them: every observation and action after + * it reads and acts on that tab. An index with no open tab is an + * `ACTION_FAILED` the model reads. Declare it with `tabs` in snapshots. + */ + switchTab?(index: number, context: OperationContext): Promise; + /** + * Closes the open tab at `index`, counted as `switchTab` counts them. When + * it was the tab shown, the engine shows another, such as the tab that + * opened it. An index with no open tab, or the last open tab, is an + * `ACTION_FAILED` the model reads. + */ + closeTab?(index: number, context: OperationContext): Promise; + /** Recreates the execution context, keeping persisted state. */ + restart?(context: OperationContext): Promise; + /** Clears persisted client state and recreates the execution context. */ + reset?(context: OperationContext): Promise; +} + +/** + * What `prepare` learned that the run must honour. `workers` replaces the + * engine's declared cap for this target and run: the surfaces the engine + * actually provisioned, `1` to `info.slots`. Declared `workers` stays the + * static answer for engines that know it up front. + */ +export interface EnginePrepareResult { + /** Lowers the target's worker cap for this run, `1` to `info.slots`. */ + readonly workers?: number; + /** + * Variables every worker of this target is spawned with, on top of the + * run's environment: how a runner-side `prepare` hands what it provisioned + * (a device pool it discovered) to each worker's `init`. The run's own + * variables win on a clash. + */ + readonly env?: Readonly>; +} + +/** + * Facts handed to `prepare`, once per run and target in the runner process, + * before any worker exists. + */ +export interface EnginePrepareInfo { + /** The run id. */ + readonly runId: string; + /** The target being prepared. */ + readonly targetName: string; + /** Directory relative paths in the config resolve against; see `EngineInitInfo.projectRoot`. */ + readonly projectRoot: string; + /** The app the target declares, as `init` receives it: what a device installs or warms up here. */ + readonly app: EngineAppInfo; + /** + * The worker slots the run will start for this target, `0` to `slots - 1`: + * the run's worker cap, the engine's declared `workers`, and the work units + * selected for the target, whichever is smallest; `0` when nothing runs on + * it while another target has work. A run with nothing to run prepares no + * target. Provision for exactly these slots (boot that many devices of a + * pool); `init` then finds them ready. + */ + readonly slots: number; + /** + * The run's environment: what every worker is started with. A host may hand + * the run an environment other than the runner process's own, so anything + * provisioned here that a worker later looks up by environment (a browser + * cache location) must be resolved and spawned against this, not + * `process.env`. + */ + readonly env: Readonly>; + /** + * Aborts on interrupt only. Provisioning has no budget: a first-run + * download is as long as the network makes it, and cutting it short would + * fail every test behind it. + */ + readonly signal: AbortSignal; + /** Whether the run asked for a visible surface (`--headed`), as `EngineInitInfo` declares it. */ + readonly headed: boolean; + /** + * Reports one line of progress. The runner streams it as a `notice` run + * event, so it reaches the reporter and every host sink instead of being + * written to a worker's stderr underneath the live status block. + */ + readonly log: (line: string) => void; +} + +/** Handed to `finish`, once per run and target after the last worker is gone, with the cleanup budget of one hook. */ +export interface EngineFinishInfo extends EngineCleanupContext { + /** The run id. */ + readonly runId: string; + /** The target being finished. */ + readonly targetName: string; + /** The run's environment, the same `prepare` saw. */ + readonly env: Readonly>; + /** Reports one line of progress, streamed as a `notice` run event like `prepare`'s. */ + readonly log: (line: string) => void; +} + +/** Facts handed to `doctor`, once per target in the process `e2e doctor` runs in. */ +export interface EngineDoctorInfo { + /** The target being checked. */ + readonly targetName: string; + /** Directory relative paths in the config resolve against; see `EngineInitInfo.projectRoot`. */ + readonly projectRoot: string; + /** The app the target declares, as `prepare` receives it. */ + readonly app: EngineAppInfo; + /** The environment a run would start with. */ + readonly env: Readonly>; + /** Whether the run would show the surface (`--headed`), as `prepare` receives it. */ + readonly headed: boolean; + /** Aborts 30 seconds in, when the checks fail as timed out, or when `e2e doctor` is interrupted; return within 5 seconds of it, when the connection closes. */ + readonly signal: AbortSignal; + /** Reports one line of progress; `e2e doctor` prints it to stderr. */ + readonly log: (line: string) => void; +} + +/** One finding of `doctor`. */ +export interface EngineDoctorCheck { + /** What was checked, in kebab case: `browser`, `toolchain`. */ + readonly id: string; + /** + * `pass`; `warn` for something a run handles on its own, slower (a + * first-run download); `fail` for something that stops a run; `skip` for + * a check that does not apply to this target. + */ + readonly status: 'pass' | 'warn' | 'fail' | 'skip'; + /** One line: what was found and, unless it passed, what to do. */ + readonly message?: string; +} + +/** Run identity and harness-resolved facts handed to `init`, once per worker before the first step. */ +export interface EngineInitInfo { + /** The run id. */ + readonly runId: string; + /** The target this worker serves. */ + readonly targetName: string; + /** + * Directory relative paths in the config resolve against: the config file's + * directory, or the run's `cwd` for a programmatic config. An engine option + * naming a file (a build to install) resolves here, never against + * `process.cwd()`, which an in-process run does not change. + */ + readonly projectRoot: string; + /** The app the target declares: the origin and site policy of its URL, and what a device launches. */ + readonly app: EngineAppInfo; + /** + * This worker's environment: the run's, plus what this target's `prepare` + * returned in its result's `env`. Read what `prepare` provisioned from + * here, never from `process.env`: an in-process worker shares its process + * with the runner and every other target. + */ + readonly env: Readonly>; + /** Whether the run asked for a visible surface (`--headed`). */ + readonly headed: boolean; + /** + * This worker's 0-based slot among the target's workers: the lowest slot + * free when the worker was spawned, so a replacement worker takes over the + * slot of the one that exited. An engine with several devices hands each + * slot its own; `config.workers` bounds the slots a target can reach. + */ + readonly workerSlot: number; + /** Aborts on interrupt and when init exceeds the launch timeout; init must stop promptly. */ + readonly signal: AbortSignal; + /** + * Reports one line of progress. The runner streams it as a `notice` run + * event, prefixed with the target and worker slot, so it reaches the + * reporter and every host sink instead of being written to a worker's + * stderr underneath the live status block. This is where a fact that only + * exists once the worker is up belongs: the URL a hosted browser or device + * can be watched at, which simulator a slot got, a version it detected. + * Meant for `init` itself; a line logged later is still delivered while + * the worker lives and dropped once it has exited. The line is shown as is + * in reporters and host sinks, so keep tokens and other secrets out of it + * (a viewer URL without its credential). + */ + readonly log: (line: string) => void; +} + +/** + * Per-attempt isolation context. An engine that must give each test a fresh + * surface (a fresh isolated context per test, a reset device) sets it up in + * `startAttempt` and tears it down in `endAttempt`. + */ +export interface EngineAttemptContext { + /** The attempt id. */ + readonly attemptId: string; + /** Absolute directory every artifact of this attempt is written under. */ + readonly artifactsDir: string; + /** + * The plaintext of a secret the engine declared in `secrets`, for an + * option the engine hands the app itself (basic-auth credentials). A + * provider runs again on every call. The value, and every value + * `options.derived` computes from it, join the attempt's redaction before + * this resolves, so reports, logs, and every observation redact them, and + * the attempt's text downloads are rewritten. The protection is + * text only: a page that shows the value outside a secure field is not + * masked in screenshots. + * A secret the engine did not declare is `SECRET_UNAVAILABLE`. + */ + readonly resolveSecret: (secret: Secret, options?: ResolveSecretOptions) => Promise; + /** + * Aborts with the attempt, and the moment `startAttempt` fails or exceeds + * the launch timeout: a hook still running then must stop, because the + * harness ends the attempt's isolation right behind it and may retry. + */ + readonly signal: AbortSignal; + /** + * Reports something the app did on its own while the attempt ran: a + * console line, an uncaught exception, a request that failed. The harness + * redacts the text, keeps it with the step that was running (from an event + * callback outside any step, the step that started last; before the first + * step, with none), and shows it on the trace page. Call it from the moment `startAttempt` begins until + * `endAttempt`; entries past a per-attempt cap are dropped. + */ + readonly appLog: (entry: AppLogEntry) => void; + /** + * Reports where the app went on its own, as one line (`navigated to + * /login`, `the app opened a new tab at /help`, `frame "pay" loaded + * /embed`): a navigation the engine did not start, a tab, a frame. The + * harness redacts it and shows it under the step that was running. + */ + readonly navigation: (line: string) => void; + /** + * Hands the harness a screen for the trace: the capture a `locate` + * matched against, or one read right after an action. The harness redacts + * it and keeps, for each step, how the screen changed since the step + * before, which the trace page shows. It never becomes an observation: + * refs it holds are not valid for `perform`. An engine that reads one after + * an action does so on the action's path, so it bounds the read (the web + * engine allows one second and gives up silently) and skips it where a + * read is expensive; an action never fails because of it. Absent when the + * attempt keeps no trace; the engine then reads nothing for it. + */ + readonly screen?: (snapshot: EngineSnapshot) => void; + /** + * What the attempt runs on, such as `{ browser: 'chromium 141.0.7390.37' }` + * or `{ device: 'iPhone 16', os: 'iOS 26.0' }`, for the trace page. A + * later call adds to and overwrites earlier facts; the harness redacts and + * clips them and keeps a handful. + */ + readonly environment: (facts: Readonly>) => void; +} + +/** Where an app log entry came from. */ +export type AppLogSource = 'console' | 'error' | 'network' | 'system'; + +/** One line of what the app did during an attempt, as `EngineAttemptContext.appLog` takes it. */ +export interface AppLogEntry { + /** + * Where it came from: the app's `console`, an `error` nothing caught, the + * `network`, or the `system` the app runs on (a crash, an OS log). + */ + readonly source: AppLogSource; + readonly level: 'error' | 'warning' | 'info'; + /** One line, such as `GET /api/todos 500` or `TypeError: x is undefined`; the harness clips it. */ + readonly text: string; +} + +/** How `EngineAttemptContext.resolveSecret` treats what the engine makes of the value. */ +export interface ResolveSecretOptions { + /** + * The forms of the value the app sees instead of the value itself, for the + * same redaction under the secret's name: the base64 `user:password` an + * `Authorization: Basic` header carries, which a page echoing its request + * headers would otherwise show. + */ + readonly derived?: (plaintext: string) => readonly string[] | Promise; +} + +/** + * Budget of one cleanup hook (`settleAttempt`, `endAttempt`, `dispose`). `signal` aborts when + * the budget is exhausted, so a hook that cannot finish in time stops instead + * of running on into the next attempt's setup. + */ +export interface EngineCleanupContext { + /** Aborts when the cleanup budget is spent. */ + readonly signal: AbortSignal; + /** Remaining cleanup budget when the call starts. */ + readonly timeoutMs: number; +} + +/** Cleanup of one worker, with optional permission to leave run-owned resources for a replacement. */ +export interface EngineDisposeContext extends EngineCleanupContext { + /** + * A live signal permits reusable resources owned by `prepare` and `finish` + * to survive this worker. Missing or aborted permission requires final + * cleanup. Observe revocation until disposal settles. This signal does + * not cancel cleanup, which remains bounded by `signal` and `timeoutMs`. + */ + readonly reuseSignal?: AbortSignal; +} + +export interface EngineObserveOptions { + /** Requests masked viewport pixels for the same revision as the tree. */ + readonly pixels?: boolean; + /** Allows independently masked pixels to replace a failed semantic capture. */ + readonly pixelFallback?: boolean; + /** + * The pixels are compared against a stored screenshot (`toHaveScreenshot`). + * Where the platform can, render what changes on its own outside the app + * in a fixed state: a status bar's clock, battery, and signal. + */ + readonly comparable?: boolean; +} + +/** The tabs a surface has open, as `EngineSnapshot.tabs` reports them. */ +export interface EngineTabs { + /** How many tabs are open: 2 or more. */ + readonly count: number; + /** The zero-based position, in the order the tabs opened, of the tab `root` reads. */ + readonly active: number; +} + +/** + * One fresh semantic snapshot of the surface under test. The harness owns + * everything downstream: revision minting, secret redaction, and the + * observation byte budget apply to every engine equally. + */ +export interface EngineSnapshot { + /** + * Where the surface is, as an opaque address the platform understands: a + * URL on a document platform, the foreground screen or activity on a + * device, the front window on a desktop. The harness shows it to the model + * and to the report, anchors trace replay on it, and applies the origin + * policy to it only when it parses as a URL. Omit when the platform has no + * notion of a current location. + */ + readonly location?: string; + /** + * The observation tree under one root the engine minted. The root's id MUST + * be stable for the surface across observations: `perform(root, swipe)` is + * the viewport swipe, and the harness addresses it from an earlier + * observation, possibly one taken before a `restart` or `reset`, so the + * root swipe MUST NOT depend on a live handle from that observation. A + * platform with several top-level elements (a device's windows) wraps them + * in a root of its own. + */ + readonly root: SemanticNode; + /** The viewport `SemanticNode.rect` and `ViewportPoint` are measured in. */ + readonly viewport: ViewportSize; + /** + * True when `root` leaves out nodes that are on the surface: the engine + * stopped reading at a node cap or a depth limit, or could not enter a + * child document. The harness tells the model the listing is incomplete + * and never calls such a screen unchanged. Omit or set false for a tree + * read whole. + */ + readonly truncated?: boolean; + /** + * Whether an on-screen keyboard is showing, as the engine measured it apart + * from `root`: a platform can raise a keyboard the tree lists only in part, + * or not at all. Set `false` when it measured none, and omit it only when + * the engine did not measure it; consumers then fall back to the tree. + */ + readonly keyboardVisible?: boolean; + /** + * The tabs the surface has open, when it has more than one, such as a + * browser with a tab the app opened. The harness tells the model which + * tab it reads and how many there are, and the agent switches between them + * through `session.switchTab` and closes them through `session.closeTab`. + * Omit with one tab. + */ + readonly tabs?: EngineTabs; + /** + * Semantic capture timed out. Return only the stable root reference, with no other fields, + * and fresh pixels whose masking was proven independently of the failed + * capture. Requires `pixelFallback`; callers must use the pixels as evidence + * and must not replay or record a trace from this observation. + */ + readonly treeUnavailable?: true; + /** Masked pixels, when requested and producible; omitted otherwise. */ + readonly pixels?: ObservationPixels; + /** Regions masked in `pixels`; the harness checks it covers every secure node. */ + readonly maskedRegionCount?: number; +} + +/** The body of one target: typed, model-free, capability-graded. */ +export interface Engine { + /** Engine name, for diagnostics. */ + readonly name: string; + /** + * Implementation version, recorded as provenance and part of the trace + * cache identity: an engine that resolves nodes differently must not replay + * another version's traces, so an unversioned engine is not accepted. + */ + readonly version: string; + /** + * Contract version literal. Additive optional members never bump it; + * changed required semantics do. + */ + readonly spiVersion: EngineSpiVersion; + /** + * Platform label this engine drives (`web`, `ios`, `android`, or a label of + * the engine's own). Tests filter on it through `platforms` and tool packs + * are scoped by it; the harness attaches no meaning to any value. A target + * inherits it; a target that names a platform of its own must agree with it. + */ + readonly platform?: string; + /** + * The most workers this engine can serve at once for one target: one per + * surface it drives concurrently (a device pool's size; 1 for a single + * simulator). The scheduler never runs more workers for the target, whatever + * `config.workers` allows, so a device target shares a run with browser + * targets without being over-subscribed. Omit when there is no such bound. + */ + readonly workers?: number; + /** + * The `secrets.get()` handles the engine's options hold, such as a + * basic-auth password. The config load checks each names a configured + * secret (`INVALID_CONFIG` otherwise), and only these resolve through + * `EngineAttemptContext.resolveSecret`. The handles carry names only, so + * no value reaches the config digest. + */ + readonly secrets?: readonly Secret[]; + /** capability: observation. */ + observe?(context: OperationContext, options?: EngineObserveOptions): Promise; + /** + * capability: computed-style - requires observation. Reads only requested, allow-listed + * rendered properties of a node this engine minted, without changing app + * state. Throw NODE_STALE if the node no longer binds. Values cross the + * protocol as JSON and are redacted by the harness before a tool sees them. + */ + readStyle?(ref: NodeRef, properties: readonly ComputedStyleProperty[], context: OperationContext): Promise; + /** + * capability: actions - requires observation. Performs exactly one action + * on a ref this engine minted, from the newest observation or from + * `locate` (both live in one id space), with the platform's actionability + * checks. The agent's grammar verbs (tap, type, press, select, scroll) and + * the `screen` tier's actions both bottom out here, so a surface + * implements each action once. A `swipe` on the observation root is the + * viewport swipe. + * + * Error contract (load-bearing for trace replay): throw a retryable + * `NODE_STALE`-coded error when a ref no longer binds, and an + * `ACTION_MAY_HAVE_COMMITTED`-coded error when input may have reached the + * app - the harness never blindly repeats an uncertain mutation. + */ + perform?(ref: NodeRef, action: LocatorAction, context: OperationContext): Promise; + /** + * The action kinds `perform` honors, required with it. The harness offers + * the agent and the `screen` tier exactly these: a kind left out is never + * presented as a tool that can only decline, and `screen`/`Locator` methods + * for it fail with `UNSUPPORTED_CAPABILITY` before reaching the engine. + * `perform` still throws `UNSUPPORTED_CAPABILITY` for a declared kind one + * particular node cannot take (a `check` on a toggle whose state is unknown). + */ + readonly actions?: readonly LocatorActionKind[]; + /** + * capability: location - requires observation. Deterministic locator + * resolution for the `screen`/`expect` tier: resolve one expression to the + * nodes it currently matches. The harness owns polling, strictness, and + * staleness; an engine resolves once, immediately. + */ + locate?( + expression: LocatorExpression, + context: OperationContext, + ): Promise; + /** + * capability: pointer - requires observation. Performs one pointer action + * at a viewport point, in the CSS pixels of `SemanticNode.rect`, with no + * node behind it: the agent's `tap_at`, `hover_at`, and `drag_at` verbs land + * here with the point the model named in a screenshot (a shape on a canvas, a pin on + * a map, a control in a system sheet or one the tree lists), and so do a test's + * `screen.tapAt`, `screen.swipe({ from, to })`, and `tap({ position })`. + * Dispatch the pointer at the point as given; the harness has clamped an + * agent's point to the viewport and validated a test's. Throw + * `UNSUPPORTED_CAPABILITY` for a declared kind the surface cannot deliver + * at this particular point. + */ + performAt?(point: ViewportPoint, action: PointerAction, context: OperationContext): Promise; + /** + * The pointer action kinds `performAt` honors, required with it. The + * harness routes a point-addressed action to the engine only for a kind + * listed here; an undeclared kind fails with `UNSUPPORTED_CAPABILITY` + * before reaching the engine. + */ + readonly pointerActions?: readonly PointerActionKind[]; + /** + * The surface honors `modifiers` on the `tap`, `doubleTap`, and + * `secondaryTap` actions `perform` receives, holding each key for the + * click. Without it the harness fails an action that carries modifiers + * with `UNSUPPORTED_CAPABILITY` before it reaches the engine, so an engine + * that predates the field never drops one silently. + */ + readonly tapModifiers?: boolean; + /** capability: keyboard - requires observation. Input to whatever holds focus; see `EngineKeyboard`. */ + readonly keyboard?: EngineKeyboard; + /** + * Named deterministic surfaces this engine contributes to TestFixtures + * (a device fixture, a document fixture - anything). Keys become fixture and + * capability names; `requires: ['']` gates at selection. + */ + readonly fixtures?: Readonly>; + /** capability: state - opaque snapshot capture/restore for session reuse. */ + readonly state?: EngineStateCapability; + /** capability: artifacts - screenshots under the attempt directory, and videos there or at a provider. */ + readonly artifacts?: EngineArtifacts; + /** + * Checks the app a target declares against what this engine can drive, at + * config load, synchronously: throw `INVALID_CONFIG` naming + * `info.targetName` for a field the platform needs and the target left out + * (a URL, a bundle id) or one it cannot drive. The harness has already + * checked every field's shape. + */ + validateApp?(app: EngineAppDeclaration, info: EngineAppCheckInfo): void; + /** Steering hooks: open, back, restart, reset. */ + readonly session?: EngineSession; + /** + * Once per run and target, in the runner process, before any worker starts + * and outside every launch budget. Provision what the engine needs on this + * machine here (a first-run browser download, a toolchain fetch), so it + * happens once instead of per worker and its progress reaches the reporter + * through `info.log`. It runs after collection and before the run's clock + * starts: `plan` is emitted, the report's `startedAt` taken, and the app + * started only once every target is prepared, so a download is never part + * of a run's duration. A run with nothing to run (the test filters left + * nothing, or `--pass-with-no-tests` on an empty selection) prepares no + * target, and so calls no `finish`. Failure is infrastructure and ends the + * run before any test executes. The result may lower the target's worker + * cap for this run, for an engine that only learns its capacity here (a + * device pool discovered from the booted devices). + */ + prepare?(info: EnginePrepareInfo): Promise; + /** + * Once per run and target, in the runner process, after every worker of + * the target has been disposed and on every exit path: a passing run, a + * failure, an interrupt, or a `prepare` that threw part-way. Release what + * `prepare` acquired for the run here (a leased cloud device, a remote + * session billed by the minute); per-worker resources belong in + * `dispose`. Runs only when `prepare` was called, within the cleanup + * budget and never cancelled by an interrupt: an interrupted run is exactly + * when a leased device must still be released. A failure is a + * cleanup-phase run error, never a crash. + */ + finish?(info: EngineFinishInfo): Promise; + /** + * Checks this machine for what a run on the target needs, for + * `e2e doctor`. Read-only and quick: never install, launch, lease, or + * start anything a check could instead look up, and never call `prepare`. + * A check that cannot tell reports nothing rather than guess. A throw is + * reported as one failed check of the target. + */ + doctor?(info: EngineDoctorInfo): Promise; + /** + * Once per worker, before the first step; boot devices here, not in a step + * budget. The same handle can be booted again after `dispose`: a config-held + * handle outlives an in-process worker, so init MUST work on a disposed + * engine as it does on a fresh one. + */ + init?(info: EngineInitInfo): Promise; + /** Before each attempt: set up per-test isolation. */ + startAttempt?(context: EngineAttemptContext): Promise; + /** + * After the body has settled, and again after teardown, before the verdict, + * within the cleanup budget: report a failure that landed on a path no step + * awaited (a callback the surface ran for the test: a request interceptor, + * a native dialog handler). Wait for one still running, then throw its + * error; the attempt fails with it the way a step would, an error already + * classified keeping its code. MUST report each failure once. + */ + settleAttempt?(context: EngineCleanupContext): Promise; + /** + * After each attempt, within the cleanup budget: tear that isolation down. + * MUST be idempotent, and safe to call after a failed `startAttempt`. + */ + endAttempt?(context: EngineCleanupContext): Promise; + /** + * Worker shutdown, within the cleanup budget; failure is a run error. Runs + * once `init` was called, even when it failed, so it MUST tolerate a + * partly initialized engine. A live + * `reuseSignal` permits preserving run-owned resources for a replacement, + * until that permission is revoked or this hook settles. + */ + dispose?(context: EngineDisposeContext): Promise; +} + +/** A validated engine: branded, frozen, capabilities computed. */ +export interface EngineHandle extends Engine { + readonly [engineBrand]: true; + readonly capabilities: ReadonlySet; +} + +export { defineEngine, isEngineHandle } from './manifest.ts'; + +export { connectEngine, type ConnectEngineOptions } from './protocol/client.ts'; +export { describeEngine } from './protocol/manifest.ts'; +export { serveEngine } from './protocol/server.ts'; +export { + loopbackTransport, + socketTransport, + spawnTransport, + type EngineTransport, + type SocketTransportOptions, + type SpawnTransportOptions, + type TransportConnection, + type TransportContext, +} from './protocol/transport.ts'; +export { ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, type EngineManifest, type EngineMethod } from './protocol/protocol.ts'; +export type { MessageStreams } from './protocol/connection.ts'; diff --git a/packages/e2e/src/engine/manifest.ts b/packages/core/src/engine/manifest.ts similarity index 100% rename from packages/e2e/src/engine/manifest.ts rename to packages/core/src/engine/manifest.ts diff --git a/packages/e2e/src/engine/protocol/client.ts b/packages/core/src/engine/protocol/client.ts similarity index 100% rename from packages/e2e/src/engine/protocol/client.ts rename to packages/core/src/engine/protocol/client.ts diff --git a/packages/e2e/src/engine/protocol/connection.ts b/packages/core/src/engine/protocol/connection.ts similarity index 100% rename from packages/e2e/src/engine/protocol/connection.ts rename to packages/core/src/engine/protocol/connection.ts diff --git a/packages/e2e/src/engine/protocol/manifest.ts b/packages/core/src/engine/protocol/manifest.ts similarity index 100% rename from packages/e2e/src/engine/protocol/manifest.ts rename to packages/core/src/engine/protocol/manifest.ts diff --git a/packages/e2e/src/engine/protocol/protocol.ts b/packages/core/src/engine/protocol/protocol.ts similarity index 100% rename from packages/e2e/src/engine/protocol/protocol.ts rename to packages/core/src/engine/protocol/protocol.ts diff --git a/packages/e2e/src/engine/protocol/server.ts b/packages/core/src/engine/protocol/server.ts similarity index 100% rename from packages/e2e/src/engine/protocol/server.ts rename to packages/core/src/engine/protocol/server.ts diff --git a/packages/e2e/src/engine/protocol/transport.ts b/packages/core/src/engine/protocol/transport.ts similarity index 100% rename from packages/e2e/src/engine/protocol/transport.ts rename to packages/core/src/engine/protocol/transport.ts diff --git a/packages/e2e/src/engine/recording.ts b/packages/core/src/engine/recording.ts similarity index 100% rename from packages/e2e/src/engine/recording.ts rename to packages/core/src/engine/recording.ts diff --git a/packages/e2e/src/engine/resolve.ts b/packages/core/src/engine/resolve.ts similarity index 100% rename from packages/e2e/src/engine/resolve.ts rename to packages/core/src/engine/resolve.ts diff --git a/packages/e2e/src/engine/session.ts b/packages/core/src/engine/session.ts similarity index 100% rename from packages/e2e/src/engine/session.ts rename to packages/core/src/engine/session.ts diff --git a/packages/e2e/src/engine/surface.ts b/packages/core/src/engine/surface.ts similarity index 100% rename from packages/e2e/src/engine/surface.ts rename to packages/core/src/engine/surface.ts diff --git a/packages/e2e/src/engine/timing.ts b/packages/core/src/engine/timing.ts similarity index 100% rename from packages/e2e/src/engine/timing.ts rename to packages/core/src/engine/timing.ts diff --git a/packages/e2e/src/expect/attempt.ts b/packages/core/src/expect/attempt.ts similarity index 100% rename from packages/e2e/src/expect/attempt.ts rename to packages/core/src/expect/attempt.ts diff --git a/packages/e2e/src/expect/poll-scope.ts b/packages/core/src/expect/poll-scope.ts similarity index 100% rename from packages/e2e/src/expect/poll-scope.ts rename to packages/core/src/expect/poll-scope.ts diff --git a/packages/e2e/src/expect/samples.ts b/packages/core/src/expect/samples.ts similarity index 100% rename from packages/e2e/src/expect/samples.ts rename to packages/core/src/expect/samples.ts diff --git a/packages/e2e/src/expect/soft.ts b/packages/core/src/expect/soft.ts similarity index 100% rename from packages/e2e/src/expect/soft.ts rename to packages/core/src/expect/soft.ts diff --git a/packages/e2e/src/internal/abandoned.ts b/packages/core/src/internal/abandoned.ts similarity index 100% rename from packages/e2e/src/internal/abandoned.ts rename to packages/core/src/internal/abandoned.ts diff --git a/packages/e2e/src/internal/ai-trace.ts b/packages/core/src/internal/ai-trace.ts similarity index 100% rename from packages/e2e/src/internal/ai-trace.ts rename to packages/core/src/internal/ai-trace.ts diff --git a/packages/e2e/src/internal/atomic-write.ts b/packages/core/src/internal/atomic-write.ts similarity index 100% rename from packages/e2e/src/internal/atomic-write.ts rename to packages/core/src/internal/atomic-write.ts diff --git a/packages/e2e/src/internal/brands.ts b/packages/core/src/internal/brands.ts similarity index 100% rename from packages/e2e/src/internal/brands.ts rename to packages/core/src/internal/brands.ts diff --git a/packages/e2e/src/internal/client-identity.ts b/packages/core/src/internal/client-identity.ts similarity index 100% rename from packages/e2e/src/internal/client-identity.ts rename to packages/core/src/internal/client-identity.ts diff --git a/packages/e2e/src/internal/dates.ts b/packages/core/src/internal/dates.ts similarity index 100% rename from packages/e2e/src/internal/dates.ts rename to packages/core/src/internal/dates.ts diff --git a/packages/e2e/src/internal/debug.ts b/packages/core/src/internal/debug.ts similarity index 100% rename from packages/e2e/src/internal/debug.ts rename to packages/core/src/internal/debug.ts diff --git a/packages/e2e/src/internal/env.ts b/packages/core/src/internal/env.ts similarity index 100% rename from packages/e2e/src/internal/env.ts rename to packages/core/src/internal/env.ts diff --git a/packages/e2e/src/internal/errors.ts b/packages/core/src/internal/errors.ts similarity index 100% rename from packages/e2e/src/internal/errors.ts rename to packages/core/src/internal/errors.ts diff --git a/packages/e2e/src/internal/expected-failure.ts b/packages/core/src/internal/expected-failure.ts similarity index 100% rename from packages/e2e/src/internal/expected-failure.ts rename to packages/core/src/internal/expected-failure.ts diff --git a/packages/e2e/src/internal/geometry.ts b/packages/core/src/internal/geometry.ts similarity index 100% rename from packages/e2e/src/internal/geometry.ts rename to packages/core/src/internal/geometry.ts diff --git a/packages/e2e/src/internal/globs.ts b/packages/core/src/internal/globs.ts similarity index 100% rename from packages/e2e/src/internal/globs.ts rename to packages/core/src/internal/globs.ts diff --git a/packages/e2e/src/internal/ids.ts b/packages/core/src/internal/ids.ts similarity index 100% rename from packages/e2e/src/internal/ids.ts rename to packages/core/src/internal/ids.ts diff --git a/packages/e2e/src/internal/image.ts b/packages/core/src/internal/image.ts similarity index 100% rename from packages/e2e/src/internal/image.ts rename to packages/core/src/internal/image.ts diff --git a/packages/e2e/src/internal/json-value.ts b/packages/core/src/internal/json-value.ts similarity index 100% rename from packages/e2e/src/internal/json-value.ts rename to packages/core/src/internal/json-value.ts diff --git a/packages/e2e/src/internal/keys.ts b/packages/core/src/internal/keys.ts similarity index 100% rename from packages/e2e/src/internal/keys.ts rename to packages/core/src/internal/keys.ts diff --git a/packages/e2e/src/internal/objects.ts b/packages/core/src/internal/objects.ts similarity index 100% rename from packages/e2e/src/internal/objects.ts rename to packages/core/src/internal/objects.ts diff --git a/packages/e2e/src/internal/options.ts b/packages/core/src/internal/options.ts similarity index 100% rename from packages/e2e/src/internal/options.ts rename to packages/core/src/internal/options.ts diff --git a/packages/e2e/src/internal/package-version.ts b/packages/core/src/internal/package-version.ts similarity index 100% rename from packages/e2e/src/internal/package-version.ts rename to packages/core/src/internal/package-version.ts diff --git a/packages/e2e/src/internal/paths.ts b/packages/core/src/internal/paths.ts similarity index 100% rename from packages/e2e/src/internal/paths.ts rename to packages/core/src/internal/paths.ts diff --git a/packages/e2e/src/internal/realm-slot.ts b/packages/core/src/internal/realm-slot.ts similarity index 100% rename from packages/e2e/src/internal/realm-slot.ts rename to packages/core/src/internal/realm-slot.ts diff --git a/packages/e2e/src/internal/recording-modes.ts b/packages/core/src/internal/recording-modes.ts similarity index 100% rename from packages/e2e/src/internal/recording-modes.ts rename to packages/core/src/internal/recording-modes.ts diff --git a/packages/e2e/src/internal/redact.ts b/packages/core/src/internal/redact.ts similarity index 100% rename from packages/e2e/src/internal/redact.ts rename to packages/core/src/internal/redact.ts diff --git a/packages/e2e/src/internal/regexp.ts b/packages/core/src/internal/regexp.ts similarity index 100% rename from packages/e2e/src/internal/regexp.ts rename to packages/core/src/internal/regexp.ts diff --git a/packages/e2e/src/internal/roles.ts b/packages/core/src/internal/roles.ts similarity index 100% rename from packages/e2e/src/internal/roles.ts rename to packages/core/src/internal/roles.ts diff --git a/packages/e2e/src/internal/source.ts b/packages/core/src/internal/source.ts similarity index 100% rename from packages/e2e/src/internal/source.ts rename to packages/core/src/internal/source.ts diff --git a/packages/e2e/src/internal/standard-schema.ts b/packages/core/src/internal/standard-schema.ts similarity index 100% rename from packages/e2e/src/internal/standard-schema.ts rename to packages/core/src/internal/standard-schema.ts diff --git a/packages/e2e/src/internal/suggest.ts b/packages/core/src/internal/suggest.ts similarity index 100% rename from packages/e2e/src/internal/suggest.ts rename to packages/core/src/internal/suggest.ts diff --git a/packages/e2e/src/internal/text.ts b/packages/core/src/internal/text.ts similarity index 100% rename from packages/e2e/src/internal/text.ts rename to packages/core/src/internal/text.ts diff --git a/packages/e2e/src/internal/time.ts b/packages/core/src/internal/time.ts similarity index 100% rename from packages/e2e/src/internal/time.ts rename to packages/core/src/internal/time.ts diff --git a/packages/e2e/src/internal/unserved-model.ts b/packages/core/src/internal/unserved-model.ts similarity index 100% rename from packages/e2e/src/internal/unserved-model.ts rename to packages/core/src/internal/unserved-model.ts diff --git a/packages/e2e/src/internal/urls.ts b/packages/core/src/internal/urls.ts similarity index 100% rename from packages/e2e/src/internal/urls.ts rename to packages/core/src/internal/urls.ts diff --git a/packages/e2e/src/locator/engine.ts b/packages/core/src/locator/engine.ts similarity index 100% rename from packages/e2e/src/locator/engine.ts rename to packages/core/src/locator/engine.ts diff --git a/packages/e2e/src/locator/expression.ts b/packages/core/src/locator/expression.ts similarity index 100% rename from packages/e2e/src/locator/expression.ts rename to packages/core/src/locator/expression.ts diff --git a/packages/e2e/src/locator/screen.ts b/packages/core/src/locator/screen.ts similarity index 100% rename from packages/e2e/src/locator/screen.ts rename to packages/core/src/locator/screen.ts diff --git a/packages/e2e/src/params.ts b/packages/core/src/params.ts similarity index 100% rename from packages/e2e/src/params.ts rename to packages/core/src/params.ts diff --git a/packages/e2e/src/run/artifacts.ts b/packages/core/src/run/artifacts.ts similarity index 100% rename from packages/e2e/src/run/artifacts.ts rename to packages/core/src/run/artifacts.ts diff --git a/packages/e2e/src/run/budget.ts b/packages/core/src/run/budget.ts similarity index 100% rename from packages/e2e/src/run/budget.ts rename to packages/core/src/run/budget.ts diff --git a/packages/e2e/src/run/declared-processes.ts b/packages/core/src/run/declared-processes.ts similarity index 100% rename from packages/e2e/src/run/declared-processes.ts rename to packages/core/src/run/declared-processes.ts diff --git a/packages/e2e/src/run/engine-sessions.ts b/packages/core/src/run/engine-sessions.ts similarity index 100% rename from packages/e2e/src/run/engine-sessions.ts rename to packages/core/src/run/engine-sessions.ts diff --git a/packages/e2e/src/run/fixture-recording.ts b/packages/core/src/run/fixture-recording.ts similarity index 100% rename from packages/e2e/src/run/fixture-recording.ts rename to packages/core/src/run/fixture-recording.ts diff --git a/packages/e2e/src/run/fixtures.ts b/packages/core/src/run/fixtures.ts similarity index 100% rename from packages/e2e/src/run/fixtures.ts rename to packages/core/src/run/fixtures.ts diff --git a/packages/e2e/src/run/managed-process.ts b/packages/core/src/run/managed-process.ts similarity index 100% rename from packages/e2e/src/run/managed-process.ts rename to packages/core/src/run/managed-process.ts diff --git a/packages/e2e/src/run/output.ts b/packages/core/src/run/output.ts similarity index 100% rename from packages/e2e/src/run/output.ts rename to packages/core/src/run/output.ts diff --git a/packages/e2e/src/run/process-pool.ts b/packages/core/src/run/process-pool.ts similarity index 100% rename from packages/e2e/src/run/process-pool.ts rename to packages/core/src/run/process-pool.ts diff --git a/packages/e2e/src/run/provision.ts b/packages/core/src/run/provision.ts similarity index 100% rename from packages/e2e/src/run/provision.ts rename to packages/core/src/run/provision.ts diff --git a/packages/e2e/src/run/recordings.ts b/packages/core/src/run/recordings.ts similarity index 100% rename from packages/e2e/src/run/recordings.ts rename to packages/core/src/run/recordings.ts diff --git a/packages/e2e/src/run/records.ts b/packages/core/src/run/records.ts similarity index 100% rename from packages/e2e/src/run/records.ts rename to packages/core/src/run/records.ts diff --git a/packages/e2e/src/run/screenshots.ts b/packages/core/src/run/screenshots.ts similarity index 100% rename from packages/e2e/src/run/screenshots.ts rename to packages/core/src/run/screenshots.ts diff --git a/packages/e2e/src/run/secrecy.ts b/packages/core/src/run/secrecy.ts similarity index 100% rename from packages/e2e/src/run/secrecy.ts rename to packages/core/src/run/secrecy.ts diff --git a/packages/e2e/src/run/sessions.ts b/packages/core/src/run/sessions.ts similarity index 100% rename from packages/e2e/src/run/sessions.ts rename to packages/core/src/run/sessions.ts diff --git a/packages/e2e/src/run/standalone-attempt.ts b/packages/core/src/run/standalone-attempt.ts similarity index 100% rename from packages/e2e/src/run/standalone-attempt.ts rename to packages/core/src/run/standalone-attempt.ts diff --git a/packages/e2e/src/run/standalone.ts b/packages/core/src/run/standalone.ts similarity index 100% rename from packages/e2e/src/run/standalone.ts rename to packages/core/src/run/standalone.ts diff --git a/packages/e2e/src/run/step-screens.ts b/packages/core/src/run/step-screens.ts similarity index 100% rename from packages/e2e/src/run/step-screens.ts rename to packages/core/src/run/step-screens.ts diff --git a/packages/e2e/src/run/steps.ts b/packages/core/src/run/steps.ts similarity index 100% rename from packages/e2e/src/run/steps.ts rename to packages/core/src/run/steps.ts diff --git a/packages/e2e/src/run/worker-models.ts b/packages/core/src/run/worker-models.ts similarity index 100% rename from packages/e2e/src/run/worker-models.ts rename to packages/core/src/run/worker-models.ts diff --git a/packages/e2e/src/secrets.ts b/packages/core/src/secrets.ts similarity index 100% rename from packages/e2e/src/secrets.ts rename to packages/core/src/secrets.ts diff --git a/packages/e2e/src/types.ts b/packages/core/src/types.ts similarity index 100% rename from packages/e2e/src/types.ts rename to packages/core/src/types.ts diff --git a/packages/core/tests/unit/entries.test.ts b/packages/core/tests/unit/entries.test.ts new file mode 100644 index 0000000000..481c97038b --- /dev/null +++ b/packages/core/tests/unit/entries.test.ts @@ -0,0 +1,9 @@ +import { describe, expect, it } from 'vitest'; +import * as engine from '../../src/engine/index.ts'; + +describe('@e2e-dev/core entries', () => { + it('export the engine contract, and nothing of the test runner', () => { + expect(Object.keys(engine)).toContain('defineEngine'); + expect(Object.keys(engine)).not.toContain('test'); + }); +}); diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.json new file mode 100644 index 0000000000..a23d257f84 --- /dev/null +++ b/packages/core/tsconfig.build.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "lib": [ + "ES2023", + "DOM", + "DOM.Iterable" + ], + "rootDir": "src", + "outDir": "dist", + "noEmit": false, + "declaration": true + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "dist", + "node_modules", + "src/**/*.test.ts" + ] +} diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json new file mode 100644 index 0000000000..caf184d56d --- /dev/null +++ b/packages/core/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "lib": [ + "ES2023", + "DOM", + "DOM.Iterable" + ], + "rootDir": ".", + "noEmit": true + }, + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ], + "exclude": [ + "dist", + "node_modules" + ] +} diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts new file mode 100644 index 0000000000..f760701bba --- /dev/null +++ b/packages/core/vitest.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'vitest/config'; + +/** @e2e-dev/core's own checks; the behavior runs under e2e's suites, which drive it through the runner too. */ +export default defineConfig({ + test: { + include: ['tests/unit/**/*.test.ts'], + testTimeout: 30_000, + pool: 'forks', + }, +}); diff --git a/packages/e2e/package.json b/packages/e2e/package.json index d7911b3aee..27a75a29f6 100644 --- a/packages/e2e/package.json +++ b/packages/e2e/package.json @@ -94,9 +94,9 @@ "dependencies": { "@ai-sdk/provider": "4.0.38", "@clack/prompts": "1.9.0", + "@e2e-dev/core": "workspace:*", "@jridgewell/remapping": "2.3.5", "@modelcontextprotocol/server": "2.4.0", - "@napi-rs/image": "1.16.0", "@oxc-project/runtime": "0.158.0", "@vitest/expect": "5.1.0", "commander": "15.1.0", @@ -104,7 +104,6 @@ "oxc-parser": "0.158.0", "oxc-transform": "0.158.0", "picocolors": "1.1.1", - "pixelmatch": "8.0.0", "toml-eslint-parser": "1.0.3", "zod": "4.6.7" }, @@ -144,6 +143,7 @@ "@ai-sdk/xai": "5.0.46", "@e2e-dev/web": "workspace:*", "@modelcontextprotocol/client": "2.4.0", + "@napi-rs/image": "1.16.0", "@openrouter/ai-sdk-provider": "3.1.0", "@types/node": "26.6.6", "ai": "7.0.173", diff --git a/packages/e2e/src/agent/interactive-step.ts b/packages/e2e/src/agent/interactive-step.ts index e29b4aeffe..2d04792b20 100644 --- a/packages/e2e/src/agent/interactive-step.ts +++ b/packages/e2e/src/agent/interactive-step.ts @@ -8,13 +8,13 @@ * hard-stops the same way; only the brain is the host instead of a model. */ -import type { ResolvedAgentConfig } from '../config/agent.ts'; -import { ConfigurationError } from '../internal/errors.ts'; -import type { AgentParams } from '../types.ts'; -import { dispatchAgentStep, type DispatchAgent } from './act.ts'; -import { validateParams } from './act-validation.ts'; -import type { StepExecutor, StepExecutorContext, StepVerdict } from './executor.ts'; -import type { AgentContext } from './invocation.ts'; +import type { ResolvedAgentConfig } from '@e2e-dev/core/lib/config/agent'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; +import type { AgentParams } from '@e2e-dev/core/lib/types'; +import { dispatchAgentStep, type DispatchAgent } from '@e2e-dev/core/lib/agent/act'; +import { validateParams } from '@e2e-dev/core/lib/agent/act-validation'; +import type { StepExecutor, StepExecutorContext, StepVerdict } from '@e2e-dev/core/lib/agent/executor'; +import type { AgentContext } from '@e2e-dev/core/lib/agent/invocation'; /** Action and model-call budgets a host-driven step never reaches; the timeout is the real bound. */ const UNBOUNDED = 1_000_000; diff --git a/packages/e2e/src/agent/public.ts b/packages/e2e/src/agent/public.ts index 8cfb9143be..8834a8deb1 100644 --- a/packages/e2e/src/agent/public.ts +++ b/packages/e2e/src/agent/public.ts @@ -1,33 +1,5 @@ /** - * The `e2e/agent` entrypoint: what a project builds agents from on the AI - * SDK. The built-in agent needs no builder: an agents entry is one plain - * object (`agents: { default: { model, system, tools } }`), and `defineTool` - * makes its project tools. `createToolLoopExecutor` is the built-in agent's - * loop with a caller's own prompt and tool vocabulary, for a custom brain - * under `{ executor }`. `createGrammarTools` and `BASE_RULES` are the - * built-in agent's action tools and their rules, and `createVerdictTool` and - * `VERDICT_RULES` its `complete_step`, for a loop or an executor that keeps - * the built-in actions and verdicts. The socket vocabulary itself, `StepExecutor` and its - * verdicts, lives on the main `e2e` entrypoint, so a hand-rolled executor - * needs no import from here (and no AI SDK) at all. + * `e2e/agent`: the agent's tools and executor seam, which `@e2e-dev/core` owns. */ -export { - createToolLoopExecutor, - type ToolLoopExecutorOptions, - type PreparedTurn, - type PreparedMessages, - type ToolLoopHelpers, -} from './tool-loop.ts'; -export { defineTool, getToolContext, type DefinedTool, type ToolAnnotations } from './tool.ts'; -export { AgentError, isAgentError } from './error.ts'; -export { - createGrammarTools, - createVerdictTool, - VERDICT_RULES, - type GrammarToolOptions, - type VerdictTool, -} from './primitives.ts'; -export { BASE_RULES } from './default-agent.ts'; -export { isRuntimeHardStop } from './executor.ts'; -export type { ScreenOutput } from './screen-update.ts'; +export * from '@e2e-dev/core/lib/agent/public'; diff --git a/packages/e2e/src/cli/bin.ts b/packages/e2e/src/cli/bin.ts index 1990812360..5bd8483235 100644 --- a/packages/e2e/src/cli/bin.ts +++ b/packages/e2e/src/cli/bin.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node import { unsupportedRuntimeMessage } from '../internal/runtime.ts'; -import { packageVersion } from '../internal/package-version.ts'; +import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; import { ignoreBrokenPipes } from './broken-pipe.ts'; import type { DoctorReport } from './doctor.ts'; diff --git a/packages/e2e/src/cli/cache.ts b/packages/e2e/src/cli/cache.ts index 86869ea26e..692d7d73dd 100644 --- a/packages/e2e/src/cli/cache.ts +++ b/packages/e2e/src/cli/cache.ts @@ -15,10 +15,10 @@ import { readdir, rm, rmdir } from 'node:fs/promises'; import path from 'node:path'; import type { Command } from 'commander'; import picocolors from 'picocolors'; -import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '../cache/store.ts'; +import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '@e2e-dev/core/lib/cache/store'; import { discoverConfig, loadConfigModule, missingConfigError } from '../config/load.ts'; import { resolveConfig } from '../config/resolve-run.ts'; -import { errorMessage } from '../internal/errors.ts'; +import { errorMessage } from '@e2e-dev/core/lib/internal/errors'; import { visibleWidth } from '../report/format.ts'; import { docsLine, examples } from './help.ts'; diff --git a/packages/e2e/src/cli/doctor.ts b/packages/e2e/src/cli/doctor.ts index 5359dee2c1..318b4efcc6 100644 --- a/packages/e2e/src/cli/doctor.ts +++ b/packages/e2e/src/cli/doctor.ts @@ -7,26 +7,26 @@ */ import picocolors from 'picocolors'; -import { createModelAdapter } from '../agent/model/sdk.ts'; -import { ModelOutputInvalidError } from '../agent/model/adapter.ts'; -import { loadAiSdk } from '../agent/ai-sdk.ts'; -import { AgentError, isAgentError } from '../agent/error.ts'; -import { engineAppInfo } from '../config/app.ts'; -import { modelLabel, type ResolvedAgentConfig, type ResolvedModel } from '../config/agent.ts'; +import { createModelAdapter } from '@e2e-dev/core/lib/agent/model/sdk'; +import { ModelOutputInvalidError } from '@e2e-dev/core/lib/agent/model/adapter'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { AgentError, isAgentError } from '@e2e-dev/core/lib/agent/error'; +import { engineAppInfo } from '@e2e-dev/core/lib/config/app'; +import { modelLabel, type ResolvedAgentConfig, type ResolvedModel } from '@e2e-dev/core/lib/config/agent'; import { discoverConfig, loadConfigModule, missingConfigError } from '../config/load.ts'; -import { type ResolvedConfig } from '../config/resolve.ts'; +import { type ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../config/resolve-run.ts'; -import type { ResolvedTarget } from '../config/targets.ts'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/targets'; import { selectTargets } from '../collect/select.ts'; -import type { EngineDoctorCheck } from '../engine/index.ts'; -import { classifyError, InfrastructureError } from '../internal/errors.ts'; +import type { EngineDoctorCheck } from '@e2e-dev/core/lib/engine/index'; +import { classifyError, InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; import { onBun, SUPPORTED_BUN_RANGE, SUPPORTED_NODE_RANGE } from '../internal/runtime.ts'; -import { budgetText, cancelledError, NEVER_ABORTS, withAbort, withinCleanupBudget } from '../internal/time.ts'; +import { budgetText, cancelledError, NEVER_ABORTS, withAbort, withinCleanupBudget } from '@e2e-dev/core/lib/internal/time'; import { loginOf } from '../oauth/login-model.ts'; import { apiKeyFor, getProvider, loginHint, type ProviderId } from '../oauth/providers.ts'; import { defaultCredentialStore } from '../oauth/store.ts'; import { bounded } from '../report/format.ts'; -import { processSecrets, registerStaticSecrets } from '../run/secrecy.ts'; +import { processSecrets, registerStaticSecrets } from '@e2e-dev/core/lib/run/secrecy'; import type { RunnerOutput } from '../run/process-output.ts'; /** The `schemaVersion` of `e2e doctor --json`, described by `schema/doctor-v1.schema.json`. */ diff --git a/packages/e2e/src/cli/feedback.ts b/packages/e2e/src/cli/feedback.ts index d84ea7f8a9..963e8349c5 100644 --- a/packages/e2e/src/cli/feedback.ts +++ b/packages/e2e/src/cli/feedback.ts @@ -18,10 +18,10 @@ * command prints a prefilled issue link and sends nothing. */ -import { uuidv7, timestamp } from '../internal/ids.ts'; -import { createRedactor } from '../internal/redact.ts'; +import { uuidv7, timestamp } from '@e2e-dev/core/lib/internal/ids'; +import { createRedactor } from '@e2e-dev/core/lib/internal/redact'; import { latestRelease, olderThan } from '../internal/release.ts'; -import { MIN_SECRET_LENGTH, secretLength } from '../config/secrets.ts'; +import { MIN_SECRET_LENGTH, secretLength } from '@e2e-dev/core/lib/config/secrets'; import { collectEnvironment, type TelemetryEnvironment } from '../telemetry/environment.ts'; import { postBatch, type PostHogEvent } from '../telemetry/posthog.ts'; import type { Telemetry, TelemetryDisabledBy } from '../telemetry/telemetry.ts'; diff --git a/packages/e2e/src/cli/index.ts b/packages/e2e/src/cli/index.ts index a69c9c6df6..956737e8c1 100644 --- a/packages/e2e/src/cli/index.ts +++ b/packages/e2e/src/cli/index.ts @@ -10,9 +10,9 @@ import { dirname, isAbsolute, normalize, resolve as resolvePath, sep } from 'nod import { Argument, Command, CommanderError, Help, InvalidArgumentError, Option } from 'commander'; import picocolors from 'picocolors'; import { detectPackageManager, execCommand, runScriptCommand } from '../internal/package-manager.ts'; -import { packageVersion } from '../internal/package-version.ts'; -import { MAX_TIMER_MS } from '../internal/time.ts'; -import { classifyError, codedMessage, exitCodeForCategory } from '../internal/errors.ts'; +import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; +import { MAX_TIMER_MS } from '@e2e-dev/core/lib/internal/time'; +import { classifyError, codedMessage, exitCodeForCategory } from '@e2e-dev/core/lib/internal/errors'; import type { Shard, TagMode } from '../collect/select.ts'; import { listSelection, run, type ListedPair, type RunOptions, type RunOutcome } from '../run/runner.ts'; import { claimRunnerOutput } from './run-output.ts'; @@ -20,11 +20,11 @@ import { writeTerminal } from '../run/process-output.ts'; import { STEP_BOUNDS, TIMEOUT_BOUNDS } from '../explore/bounds.ts'; import { BUILTIN_REPORTERS, isBuiltinReporter } from '../report/builtin.ts'; import { bounded, failureLine } from '../report/format.ts'; -import type { RecordingMode } from '../types.ts'; +import type { RecordingMode } from '@e2e-dev/core/lib/types'; import type { BuiltinReporter } from '../run-types.ts'; -import { isRecordingMode, legacyTraceSpelling, RECORDING_MODES } from '../internal/recording-modes.ts'; +import { isRecordingMode, legacyTraceSpelling, RECORDING_MODES } from '@e2e-dev/core/lib/internal/recording-modes'; import { discoverConfig } from '../config/load.ts'; -import { isCiMode } from '../config/resolve.ts'; +import { isCiMode } from '@e2e-dev/core/lib/config/resolve'; import { runsFromCheckout } from '../telemetry/checkout.ts'; import { initCompletedEvent, runCompletedEvent, upgradeCompletedEvent, USAGE_ERROR_CODE } from '../telemetry/events.ts'; import { Telemetry } from '../telemetry/telemetry.ts'; diff --git a/packages/e2e/src/cli/init/agent-skill.ts b/packages/e2e/src/cli/init/agent-skill.ts index 53ba5e837c..8a832200c1 100644 --- a/packages/e2e/src/cli/init/agent-skill.ts +++ b/packages/e2e/src/cli/init/agent-skill.ts @@ -2,7 +2,7 @@ import { existsSync, lstatSync, readdirSync, readFileSync, readlinkSync, realpathSync, type Stats } from 'node:fs'; import path from 'node:path'; -import { insideProjectRoot, realpathOfExisting } from '../../internal/paths.ts'; +import { insideProjectRoot, realpathOfExisting } from '@e2e-dev/core/lib/internal/paths'; import { MISSING_SKILL_MESSAGE, SKILL_NAME, type SkillFile } from '../skill.ts'; interface SkillLocation { diff --git a/packages/e2e/src/cli/init/examples.ts b/packages/e2e/src/cli/init/examples.ts index 19df0bdcf9..2799686d07 100644 --- a/packages/e2e/src/cli/init/examples.ts +++ b/packages/e2e/src/cli/init/examples.ts @@ -9,8 +9,8 @@ import { Readable } from 'node:stream'; import { createGunzip } from 'node:zlib'; import { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from 'node:fs'; import path from 'node:path'; -import { USER_AGENT } from '../../internal/client-identity.ts'; -import { packageVersion } from '../../internal/package-version.ts'; +import { USER_AGENT } from '@e2e-dev/core/lib/internal/client-identity'; +import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; import { dependencyRange, recordedSiblingRange } from './versions.ts'; export interface ExamplePreset { diff --git a/packages/e2e/src/cli/init/gateways.ts b/packages/e2e/src/cli/init/gateways.ts index 05b47b07be..369271438c 100644 --- a/packages/e2e/src/cli/init/gateways.ts +++ b/packages/e2e/src/cli/init/gateways.ts @@ -5,7 +5,7 @@ * entry here. */ -import { isLoopbackHost } from '../../internal/urls.ts'; +import { isLoopbackHost } from '@e2e-dev/core/lib/internal/urls'; /** The local server an OpenAI-compatible gateway points at unless an endpoint is given. */ export const DEFAULT_ENDPOINT = 'http://127.0.0.1:11434/v1'; diff --git a/packages/e2e/src/cli/init/mcp-config.ts b/packages/e2e/src/cli/init/mcp-config.ts index 8d390f3f60..597cabb1f5 100644 --- a/packages/e2e/src/cli/init/mcp-config.ts +++ b/packages/e2e/src/cli/init/mcp-config.ts @@ -10,7 +10,7 @@ import { existsSync, lstatSync, readFileSync } from 'node:fs'; import path from 'node:path'; import type { PackageManager } from '../../internal/package-manager.ts'; -import { realpathOfExisting } from '../../internal/paths.ts'; +import { realpathOfExisting } from '@e2e-dev/core/lib/internal/paths'; import { readCodexConfig, updateCodexConfig } from './codex-config.ts'; interface McpLocation { diff --git a/packages/e2e/src/cli/init/package.ts b/packages/e2e/src/cli/init/package.ts index b7361a569f..61e14087b6 100644 --- a/packages/e2e/src/cli/init/package.ts +++ b/packages/e2e/src/cli/init/package.ts @@ -3,8 +3,8 @@ import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { z } from 'zod'; -import { compareCodePoints } from '../../internal/globs.ts'; -import { isPlainObject } from '../../internal/options.ts'; +import { compareCodePoints } from '@e2e-dev/core/lib/internal/globs'; +import { isPlainObject } from '@e2e-dev/core/lib/internal/options'; const dependencyBlock = z.record(z.string(), z.string()).optional(); const packageSchema = z.looseObject({ diff --git a/packages/e2e/src/cli/init/scaffold.ts b/packages/e2e/src/cli/init/scaffold.ts index 80b9c335db..38cf6423ed 100644 --- a/packages/e2e/src/cli/init/scaffold.ts +++ b/packages/e2e/src/cli/init/scaffold.ts @@ -1,4 +1,4 @@ -import { packageVersion } from '../../internal/package-version.ts'; +import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; import { getEnginePreset, type EngineId, type EnginePreset } from './engines.ts'; import { dependencyRange } from './versions.ts'; import { getGatewayPreset, type GatewayId } from './gateways.ts'; diff --git a/packages/e2e/src/cli/init/versions.ts b/packages/e2e/src/cli/init/versions.ts index 9b42a3ecfe..c34180ba1c 100644 --- a/packages/e2e/src/cli/init/versions.ts +++ b/packages/e2e/src/cli/init/versions.ts @@ -4,7 +4,7 @@ * Absent when running from source. Both preset tables read from here. */ -import { readJson } from '../../internal/package-version.ts'; +import { readJson } from '@e2e-dev/core/lib/internal/package-version'; const SIBLING_VERSIONS = readJson(import.meta.url, './sibling-versions.json') as Readonly> | undefined; diff --git a/packages/e2e/src/cli/mcp.ts b/packages/e2e/src/cli/mcp.ts index 4de062af71..0320144dcd 100644 --- a/packages/e2e/src/cli/mcp.ts +++ b/packages/e2e/src/cli/mcp.ts @@ -8,12 +8,12 @@ */ import { Writable } from 'node:stream'; -import { isAbandonedRejection } from '../internal/abandoned.ts'; -import { errorMessage, exitCodeForCategory, classifyError } from '../internal/errors.ts'; +import { isAbandonedRejection } from '@e2e-dev/core/lib/internal/abandoned'; +import { errorMessage, exitCodeForCategory, classifyError } from '@e2e-dev/core/lib/internal/errors'; import { onBun } from '../internal/runtime.ts'; import { McpOutput } from '../mcp/output.ts'; import { serveMcp, type ServeOptions } from '../mcp/server.ts'; -import { processSecrets } from '../run/secrecy.ts'; +import { processSecrets } from '@e2e-dev/core/lib/run/secrecy'; import { claimStrayRejection } from '../run/standalone-test.ts'; import { mcpSessionEvent } from '../telemetry/events.ts'; import type { Telemetry } from '../telemetry/telemetry.ts'; diff --git a/packages/e2e/src/cli/run-output.ts b/packages/e2e/src/cli/run-output.ts index 6c9473703f..1c2bf781ad 100644 --- a/packages/e2e/src/cli/run-output.ts +++ b/packages/e2e/src/cli/run-output.ts @@ -6,10 +6,10 @@ * only the list reporter writes to the terminal past it. */ -import { leftWorkBehind } from '../internal/abandoned.ts'; -import { killManagedProcessGroups, stopsSettled } from '../run/managed-process.ts'; +import { leftWorkBehind } from '@e2e-dev/core/lib/internal/abandoned'; +import { killManagedProcessGroups, stopsSettled } from '@e2e-dev/core/lib/run/managed-process'; import { claimProcessOutput, type RunnerOutput } from '../run/process-output.ts'; -import { processSecrets } from '../run/secrecy.ts'; +import { processSecrets } from '@e2e-dev/core/lib/run/secrecy'; /** The process's claimed output, once claimed: the wrappers stay for the rest of the process. */ let claimed: RunnerOutput | undefined; diff --git a/packages/e2e/src/cli/signals.ts b/packages/e2e/src/cli/signals.ts index fb80c3897a..671a2588c0 100644 --- a/packages/e2e/src/cli/signals.ts +++ b/packages/e2e/src/cli/signals.ts @@ -5,7 +5,7 @@ * caller that is the process. */ -import { killManagedProcessGroups } from '../run/managed-process.ts'; +import { killManagedProcessGroups } from '@e2e-dev/core/lib/run/managed-process'; /** How long a CLI whose parent died waits on each rung of the ladder before the next. */ const PARENT_GONE_ESCALATE_MS = 15_000; diff --git a/packages/e2e/src/cli/step-control.ts b/packages/e2e/src/cli/step-control.ts index 1ffa584c69..b5cdad735a 100644 --- a/packages/e2e/src/cli/step-control.ts +++ b/packages/e2e/src/cli/step-control.ts @@ -20,7 +20,7 @@ import path from 'node:path'; import { setTimeout as sleep } from 'node:timers/promises'; import picocolors from 'picocolors'; import { z } from 'zod'; -import { classifyError, codedMessage, ConfigurationError, exitCodeForCategory } from '../internal/errors.ts'; +import { classifyError, codedMessage, ConfigurationError, exitCodeForCategory } from '@e2e-dev/core/lib/internal/errors'; import { stepLine, stepPromptText } from '../report/list-steps.ts'; import type { RunEventSink } from '../run/events.ts'; import { run, type RunOptions, type RunOutcome } from '../run/runner.ts'; diff --git a/packages/e2e/src/cli/update-check.ts b/packages/e2e/src/cli/update-check.ts index c02463ea11..c2ec719c31 100644 --- a/packages/e2e/src/cli/update-check.ts +++ b/packages/e2e/src/cli/update-check.ts @@ -11,11 +11,11 @@ import { mkdirSync, readFileSync } from 'node:fs'; import path from 'node:path'; import picocolors from 'picocolors'; -import { isCiMode } from '../config/resolve.ts'; -import { writeFileAtomicSync } from '../internal/atomic-write.ts'; -import { envFlag } from '../internal/env.ts'; +import { isCiMode } from '@e2e-dev/core/lib/config/resolve'; +import { writeFileAtomicSync } from '@e2e-dev/core/lib/internal/atomic-write'; +import { envFlag } from '@e2e-dev/core/lib/internal/env'; import { detectWorkspacePackageManager, execCommand, readPackageManifest } from '../internal/package-manager.ts'; -import { isPlainObject } from '../internal/options.ts'; +import { isPlainObject } from '@e2e-dev/core/lib/internal/options'; import { isRelease, latestRelease, olderThan } from '../internal/release.ts'; import { telemetryConfigDir } from '../telemetry/store.ts'; diff --git a/packages/e2e/src/cli/upgrade.ts b/packages/e2e/src/cli/upgrade.ts index ed2aa0418f..c6b4722af6 100644 --- a/packages/e2e/src/cli/upgrade.ts +++ b/packages/e2e/src/cli/upgrade.ts @@ -13,7 +13,7 @@ import path from 'node:path'; import picocolors from 'picocolors'; import { z } from 'zod'; import { detectWorkspacePackageManager, execCommand, LOCKFILE_NAMES, type PackageManager } from '../internal/package-manager.ts'; -import { insideProjectRoot, realpathOfExisting } from '../internal/paths.ts'; +import { insideProjectRoot, realpathOfExisting } from '@e2e-dev/core/lib/internal/paths'; import { compareVersions, parseVersion, satisfies } from '../internal/semver.ts'; import type { UpgradeOutcome, UpgradeResult } from '../telemetry/events.ts'; import { describeLinks, describeObstacles, findInstalledSkillDirs, planSkillInstall } from './init/agent-skill.ts'; diff --git a/packages/e2e/src/cli/watch.ts b/packages/e2e/src/cli/watch.ts index 94396f74f6..8e23136e26 100644 --- a/packages/e2e/src/cli/watch.ts +++ b/packages/e2e/src/cli/watch.ts @@ -12,7 +12,7 @@ import { Writable } from 'node:stream'; import * as clack from '@clack/prompts'; import picocolors from 'picocolors'; import { discoverConfig } from '../config/load.ts'; -import { compileGlob, compileGlobList, GLOB_SYNTAX, literalPrefix, matchesGlob, type CompiledGlobList } from '../internal/globs.ts'; +import { compileGlob, compileGlobList, GLOB_SYNTAX, literalPrefix, matchesGlob, type CompiledGlobList } from '@e2e-dev/core/lib/internal/globs'; import type { RunOptions, RunOutcome } from '../run/runner.ts'; import { Keyboard, type Keypress } from './keyboard.ts'; import type { SignalLadder } from './signals.ts'; diff --git a/packages/e2e/src/cli/wordmark.ts b/packages/e2e/src/cli/wordmark.ts index 1ed1dc8cad..0612b80863 100644 --- a/packages/e2e/src/cli/wordmark.ts +++ b/packages/e2e/src/cli/wordmark.ts @@ -9,7 +9,7 @@ */ import { setTimeout as sleep } from 'node:timers/promises'; -import { envFlag } from '../internal/env.ts'; +import { envFlag } from '@e2e-dev/core/lib/internal/env'; const ESC = '\u001b'; const SYNC_START = `${ESC}[?2026h`; diff --git a/packages/e2e/src/collect/collect.ts b/packages/e2e/src/collect/collect.ts index 0d6a8bb1fd..8f65f520f9 100644 --- a/packages/e2e/src/collect/collect.ts +++ b/packages/e2e/src/collect/collect.ts @@ -2,13 +2,13 @@ import { realpathSync, statSync } from 'node:fs'; import path from 'node:path'; -import { compileGlob, compileGlobList, discoverFiles, GLOB_SYNTAX, literalPrefix, matchesGlob } from '../internal/globs.ts'; -import { CollectionError, isE2EError } from '../internal/errors.ts'; -import { setupTestId, testId } from '../internal/ids.ts'; +import { compileGlob, compileGlobList, discoverFiles, GLOB_SYNTAX, literalPrefix, matchesGlob } from '@e2e-dev/core/lib/internal/globs'; +import { CollectionError, isE2EError } from '@e2e-dev/core/lib/internal/errors'; +import { setupTestId, testId } from '@e2e-dev/core/lib/internal/ids'; import { explainModuleError } from '../config/diagnose.ts'; import { importModule } from '../config/load.ts'; -import type { ResolvedConfig } from '../config/resolve.ts'; -import { staticSecretLedger } from '../run/secrecy.ts'; +import type { ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; +import { staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; import { collectModule, groupTitles, @@ -17,8 +17,8 @@ import { type ModuleRegistration, type RegisteredTest, } from './registry.ts'; -import type { SourceLocation } from '../internal/source.ts'; -import type { TestIdentity } from '../run/records.ts'; +import type { SourceLocation } from '@e2e-dev/core/lib/internal/source'; +import type { TestIdentity } from '@e2e-dev/core/lib/run/records'; export interface CollectedTest extends RegisteredTest, TestIdentity { /** Outermost serial group, when the test is a serial-group member. */ diff --git a/packages/e2e/src/collect/registry.ts b/packages/e2e/src/collect/registry.ts index c6e8f44bc3..1507219114 100644 --- a/packages/e2e/src/collect/registry.ts +++ b/packages/e2e/src/collect/registry.ts @@ -3,17 +3,17 @@ import { realpathSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { testCaseBrand } from '../internal/brands.ts'; -import { describeValue } from '../config/validate.ts'; -import { isRecordingMode, legacyTraceSpelling, RECORDING_MODES } from '../internal/recording-modes.ts'; -import { CollectionError } from '../internal/errors.ts'; -import { MAX_TIMER_MS } from '../internal/time.ts'; -import { validateTitle } from '../internal/ids.ts'; -import { realmSlot } from '../internal/realm-slot.ts'; -import { markRunningTestExpectedToFail } from '../internal/expected-failure.ts'; +import { testCaseBrand } from '@e2e-dev/core/lib/internal/brands'; +import { describeValue } from '@e2e-dev/core/lib/config/validate'; +import { isRecordingMode, legacyTraceSpelling, RECORDING_MODES } from '@e2e-dev/core/lib/internal/recording-modes'; +import { CollectionError } from '@e2e-dev/core/lib/internal/errors'; +import { MAX_TIMER_MS } from '@e2e-dev/core/lib/internal/time'; +import { validateTitle } from '@e2e-dev/core/lib/internal/ids'; +import { realmSlot } from '@e2e-dev/core/lib/internal/realm-slot'; +import { markRunningTestExpectedToFail } from '@e2e-dev/core/lib/internal/expected-failure'; import { parseModifierCall, skipRunningTest } from '../internal/skip.ts'; -import { unknownKeyMessage } from '../internal/options.ts'; -import type { SourceLocation } from '../internal/source.ts'; +import { unknownKeyMessage } from '@e2e-dev/core/lib/internal/options'; +import type { SourceLocation } from '@e2e-dev/core/lib/internal/source'; import type { DescribeOptions, FixtureFn, @@ -25,7 +25,7 @@ import type { TestFn, TestHookFn, TestOptions, -} from '../types.ts'; +} from '@e2e-dev/core/lib/types'; export interface GroupNode { readonly title: string; diff --git a/packages/e2e/src/collect/select.ts b/packages/e2e/src/collect/select.ts index d6ae54092c..32430cdf0d 100644 --- a/packages/e2e/src/collect/select.ts +++ b/packages/e2e/src/collect/select.ts @@ -1,16 +1,16 @@ /** Option resolution and test-target selection. */ -import { staticSecretLedger } from '../run/secrecy.ts'; -import { ConfigurationError, CollectionError, sanitizeText, truncateUtf8 } from '../internal/errors.ts'; -import { resultId } from '../internal/ids.ts'; -import { expectedFailureOption } from '../internal/expected-failure.ts'; -import { didYouMean, suggestionNote } from '../internal/suggest.ts'; -import type { ResolvedConfig, ResolvedTarget } from '../config/resolve.ts'; -import { attemptKeep, attemptVideo, pairRecording, type AttemptRecordings } from '../internal/recording-modes.ts'; -import type { Capability, RecordingMode, TestOptions } from '../types.ts'; +import { staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; +import { ConfigurationError, CollectionError, sanitizeText, truncateUtf8 } from '@e2e-dev/core/lib/internal/errors'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; +import { expectedFailureOption } from '@e2e-dev/core/lib/internal/expected-failure'; +import { didYouMean, suggestionNote } from '@e2e-dev/core/lib/internal/suggest'; +import type { ResolvedConfig, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { attemptKeep, attemptVideo, pairRecording, type AttemptRecordings } from '@e2e-dev/core/lib/internal/recording-modes'; +import type { Capability, RecordingMode, TestOptions } from '@e2e-dev/core/lib/types'; import { excludingEntry, type Collection, type CollectedTest, type UncollectedFile } from './collect.ts'; import { groupChain } from './registry.ts'; -import type { SkipInfo } from '../run/records.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; export interface ResolvedTestOptions { readonly timeout: number; diff --git a/packages/e2e/src/config/diagnose.ts b/packages/e2e/src/config/diagnose.ts index 7db05a1691..2b6804c801 100644 --- a/packages/e2e/src/config/diagnose.ts +++ b/packages/e2e/src/config/diagnose.ts @@ -8,10 +8,10 @@ import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { withHint } from '../internal/errors.ts'; -import { isPlainObject } from '../internal/options.ts'; +import { withHint } from '@e2e-dev/core/lib/internal/errors'; +import { isPlainObject } from '@e2e-dev/core/lib/internal/options'; import { addDevDependencyCommand, detectPackageManager } from '../internal/package-manager.ts'; -import { didYouMean, suggest } from '../internal/suggest.ts'; +import { didYouMean, suggest } from '@e2e-dev/core/lib/internal/suggest'; /** The runtime exports of `e2e`; a unit test keeps this list equal to the real module. */ export const RUNTIME_EXPORTS: readonly string[] = [ diff --git a/packages/e2e/src/config/esm-hooks.ts b/packages/e2e/src/config/esm-hooks.ts index c460d267ca..6074682fe2 100644 --- a/packages/e2e/src/config/esm-hooks.ts +++ b/packages/e2e/src/config/esm-hooks.ts @@ -45,9 +45,9 @@ import { readFileSync } from 'node:fs'; import nodeModule, { type LoadHookSync, type ResolveHookContext, type ResolveHookSync } from 'node:module'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -import { InfrastructureError } from '../internal/errors.ts'; +import { InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; import { onBun, unsupportedRuntimeMessage } from '../internal/runtime.ts'; -import { realmSlot } from '../internal/realm-slot.ts'; +import { realmSlot } from '@e2e-dev/core/lib/internal/realm-slot'; import { compiledSource, HOOKED_REQUIRE_KEY, IMPLIED_EXTENSIONS, isProjectFile, writtenCandidates, type CompiledSource } from './compiled-files.ts'; import { isPathSpecifier, pathTarget, type Target } from './specifiers.ts'; import { projectView, type ProjectView } from './tsconfig.ts'; diff --git a/packages/e2e/src/config/load.ts b/packages/e2e/src/config/load.ts index 881ff5bbe5..9aa35a623e 100644 --- a/packages/e2e/src/config/load.ts +++ b/packages/e2e/src/config/load.ts @@ -2,9 +2,9 @@ import { existsSync } from 'node:fs'; import path from 'node:path'; -import { ConfigurationError, InfrastructureError, isE2EError } from '../internal/errors.ts'; +import { ConfigurationError, InfrastructureError, isE2EError } from '@e2e-dev/core/lib/internal/errors'; import { onBun } from '../internal/runtime.ts'; -import { withConfigSecretReferences } from '../secrets.ts'; +import { withConfigSecretReferences } from '@e2e-dev/core/lib/secrets'; import type { E2EConfig } from '../run-types.ts'; import { explainModuleError } from './diagnose.ts'; import { freshModuleURL, registerLoader } from './esm-hooks.ts'; diff --git a/packages/e2e/src/config/resolve-run.ts b/packages/e2e/src/config/resolve-run.ts index 468ec0b2ec..4da5d9df84 100644 --- a/packages/e2e/src/config/resolve-run.ts +++ b/packages/e2e/src/config/resolve-run.ts @@ -3,13 +3,13 @@ * the reporters and test filters only a run reads. */ -import { ConfigurationError } from '../internal/errors.ts'; -import { didYouMean } from '../internal/suggest.ts'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; +import { didYouMean } from '@e2e-dev/core/lib/internal/suggest'; import { BUILTIN_REPORTER_LIST, BUILTIN_REPORTERS, isBuiltinReporter } from '../report/builtin.ts'; import { ellipsize } from '../report/format.ts'; import type { BuiltinReporter, E2EConfig, Reporter, TestFilter } from '../run-types.ts'; -import { resolveProjectConfig, type CliOverrides, type ResolvedConfig } from './resolve.ts'; -import { TARGET_NAME_PATTERN } from './targets.ts'; +import { resolveProjectConfig, type CliOverrides, type ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; +import { TARGET_NAME_PATTERN } from '@e2e-dev/core/lib/config/targets'; /** A resolved config with what only a run reads. */ export interface ResolvedRunConfig extends ResolvedConfig { diff --git a/packages/e2e/src/config/typescript.ts b/packages/e2e/src/config/typescript.ts index 87e92a12e6..98716f053c 100644 --- a/packages/e2e/src/config/typescript.ts +++ b/packages/e2e/src/config/typescript.ts @@ -14,9 +14,9 @@ import { pathToFileURL } from 'node:url'; import type * as OxcParser from 'oxc-parser'; import type { JsxOptions, OxcError, TransformOptions } from 'oxc-transform'; import type * as OxcTransform from 'oxc-transform'; -import { InfrastructureError } from '../internal/errors.ts'; -import { obj } from '../internal/objects.ts'; -import { isPlainObject } from '../internal/options.ts'; +import { InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { obj } from '@e2e-dev/core/lib/internal/objects'; +import { isPlainObject } from '@e2e-dev/core/lib/internal/options'; import { HOOKED_REQUIRE_KEY, type CompiledExtension } from './compiled-files.ts'; import type { CompilerOptions } from './tsconfig.ts'; diff --git a/packages/e2e/src/engine/index.ts b/packages/e2e/src/engine/index.ts index 383e326933..74ae51c9e9 100644 --- a/packages/e2e/src/engine/index.ts +++ b/packages/e2e/src/engine/index.ts @@ -1,969 +1,6 @@ /** - * The engine contract: the typed, model-free body of one target. - * - * An engine never talks to a model. It declares capabilities - observation, - * actions, location, state, artifacts, contributed fixtures - and the harness - * grades what a target can do from what its engine declares: observation - * unlocks the judgment tier and prompt snapshots, `perform` unlocks the - * harness-routed node actions (the agent's grammar verbs and the `screen` - * tier's actions alike), location unlocks `screen`/`expect`. Every piece of - * model-facing vocabulary is an agent-side `defineTool`; a target with no - * engine at all is valid and simply runs everything opaque. - * - * Core knows this contract and never an engine's internals. The one platform - * noun here is `platform`, the label an engine declares it drives and its - * target inherits; no member's shape depends on it. A document engine, a - * simulator engine, and a desktop engine fill in the same members with - * different bodies. - * - * `defineEngine` is the loud manifest: capability detection happens here, - * synchronously, at config load - a malformed engine fails the run instead - * of silently demoting itself to a lower tier. + * `e2e/engine`: the engine contract, which `@e2e-dev/core` owns and publishes as + * `@e2e-dev/core/engine`. Kept for engines and integrations that import it here. */ -import { engineBrand } from '../internal/brands.ts'; -import type { ComputedStyleProperty, ComputedStyleValues } from './computed-style.ts'; - -export { COMPUTED_STYLE_PROPERTIES, validateComputedStyleProperties } from './computed-style.ts'; -export type { ComputedStyleProperty, ComputedStyleValues } from './computed-style.ts'; - -// Semantics the spec requires every engine and contributed fixture to -// reproduce exactly, exported so an engine never carries its own copy: the -// runner error taxonomy, text-pattern matching, locator resolution over a -// semantic tree, URL matching, assertion polling, option-bag validation, the -// JSON-value rules for data a fixture returns, and the unknown-key check -// config options get. -export { ConfigurationError, InfrastructureError, TestError } from '../internal/errors.ts'; -export { rejectUnknownKeys, rejectUnknownOptions } from '../internal/options.ts'; -export { validateJsonValue, type JsonValueRules } from '../internal/json-value.ts'; -export { describePattern, matchesText, toTextPattern } from '../internal/text.ts'; -export { resolveExpression, type ResolveExpressionOptions } from './resolve.ts'; -export type { TextMatch } from '../types.ts'; -export { raceAbort } from './timing.ts'; -export { isProviderRecording, stopProviderRecording } from './recording.ts'; -export type { - ProviderRecordContext, - ProviderRecording, - ProviderRecordingResult, - ProviderRecordingStopContext, - ProviderRecordingTarget, -} from './recording.ts'; -export { Deadline, pollCondition, stepTimeout, withTimeout, withinCleanupBudget, type PollConditionOptions } from '../internal/time.ts'; -export { sameSite, siteOf, urlMatches } from '../internal/urls.ts'; -export { obj, type WithoutUndefined } from '../internal/objects.ts'; -import type { AppPermissionState, Expectable, Locator, Screen, Secret } from '../types.ts'; -import type { - EngineSpiVersion, - LocatorAction, - LocatorActionKind, - LocatorExpression, - NodeRef, - ObservationPixels, - OperationContext, - PointerAction, - PointerActionKind, - SemanticNode, - ViewportPoint, - ViewportSize, -} from './contract.ts'; - -export type * from './contract.ts'; -export { - ENGINE_ERROR_CODES, - ENGINE_SPI_VERSION, - EngineError, - KEY_MODIFIERS, - KEY_NAMES, - LOCATOR_ACTION_KINDS, - OBSERVED_NAME_LIMIT, - OBSERVED_TEXT_LIMIT, - POINTER_ACTION_KINDS, - RETRYABLE_ENGINE_ERROR_CODES, - parseKey, -} from './contract.ts'; -export type { AppPermissionState, Expectable, JsonValue, Locator, Screen, Secret } from '../types.ts'; -export { isSecret } from '../secrets.ts'; - -/** - * Capability names: the closed harness capabilities plus one name per - * contributed fixture. `actions` is `perform`; `location` is `locate`; both - * require observation, because their refs live in the observation's id space. - * `pointer` is `performAt`, an action addressed by a viewport point rather - * than a node, and requires observation because the point is read off its - * pixels. - */ -export type EngineCapability = - | 'observation' - | 'computed-style' - | 'actions' - | 'location' - | 'pointer' - | 'keyboard' - | 'state' - | 'artifacts' - | (string & {}); - -/** - * capability: keyboard - requires observation. Input to whatever holds focus, - * with no node behind it: the agent's `type` and `press` without a target, and - * the fallback of its point-addressed `type_at` and `press_at` when the point - * lands on nothing the tree lists (a field drawn on a canvas, an input a - * platform flattens out of its accessibility tree). Focus is the app's: the - * harness tapped first, or the model said the field already has it. - */ -export interface EngineKeyboard { - /** - * Types `text` into the focused field as a person typing would, through - * the platform's keyboard path: a browser dispatches the key events of each - * character, a device sends the text through its keyboard. Where the - * platform has key events the app must receive them; setting the value - * without keystrokes is not a compliant implementation, since - * `locator.pressSequentially` and the agent's `type` rely on the app - * reacting as it does to a user. With `replace`, clears the field first - * (select-all and delete on a keyboard surface; the platform's clear on a - * device). Throw `NOT_ACTIONABLE` when nothing that accepts text has focus, - * so the keystrokes are never silently discarded into the document body. - */ - type(text: string, options: { readonly replace: boolean }, context: OperationContext): Promise; - /** - * Sends one key of the contract grammar (`Enter`, `Escape`, `Tab`, - * `Shift+Tab`, a character) to whatever holds focus. The harness has - * already validated the key's shape; refuse with `UNSUPPORTED_CAPABILITY` - * a key the surface cannot deliver. - */ - press(key: string, context: OperationContext): Promise; - /** Hides an on-screen keyboard. Platforms without one leave it undefined. */ - dismiss?(context: OperationContext): Promise; -} - -/** Handed to `Engine.validateApp` beside the declaration. */ -export interface EngineAppCheckInfo { - /** The target declaring the app, for the message of a refusal. */ - readonly targetName: string; -} - -/** - * The app the harness resolved from the target's declaration, handed to - * `prepare` and `init`: the origin and site policy for the decisions only a - * surface can make (which requests carry injected credentials, which nested - * documents enter an observation), and what a device launches. Navigation - * stays with the harness: a surface opens what `session.open` is given. - */ -export interface EngineAppInfo { - /** - * The origin of the app's `url` on the run's port (`scheme://host:port`, as - * `URL.origin` serializes it): where credentials an engine injects into - * requests (headers, basic auth) go by default. Absent for an app without - * a URL, and for a free port the run has not assigned (`e2e doctor`). - */ - readonly origin?: string; - /** - * The site of the app's `url`, its registrable domain as `siteOf` reads it: - * whose child frames an observation reads; `sameSite` applies it. Absent - * for an app without a URL, which is no policy at all. - */ - readonly site?: string; - /** The installed app to launch, as the target declared it. */ - readonly bundleId?: string; - /** The build to install, as the target declared it; relative to `projectRoot`. */ - readonly appPath?: string; - /** Arguments every fresh launch passes the app. */ - readonly launchArguments?: readonly string[]; - /** Permissions the app holds, by name; what each state means is the engine's (a device sets them before every fresh launch). */ - readonly permissions?: Readonly>; -} - -/** - * The app a target declares, as its engine reads it at config load: what it - * is and where it is served. The app is the target's alone - * (`targets: [{ engine, app }]`); an engine only drives it. The harness has - * checked the shape of every field before `Engine.validateApp` sees it, so - * an engine can require what its platform needs (a URL, a bundle id) and - * refuse what it cannot drive, naming the target. - */ -export type EngineAppDeclaration = EngineAppInfo & { - /** Base URL the target opens, as declared; see `TargetApp.url`. */ - readonly url?: string; -}; - -/** Explicit recording policy for one async fixture method. Arguments enter reports only through label. */ -export interface FixtureOperation { - readonly kind: 'resource' | 'assertion'; - readonly label?: (...args: Args) => string; - /** Action timeout by default, none of its own for 0; false when the method owns its assertion/navigation deadline. */ - readonly timeout?: number | false | ((...args: Args) => number | undefined); - /** Assertions verify by default; waits may opt in as well. */ - readonly verifies?: boolean; -} - -/** Only declared async methods are recorded. Sync accessors pass through unchanged. */ -export type FixtureOperations = { - readonly [Key in keyof T]?: T[Key] extends (...args: infer Args) => Promise - ? FixtureOperation - : T[Key] extends object ? FixtureOperations : never; -}; - -/** Context handed to a contributed fixture factory, once per attempt. */ -export interface EngineFixtureContext { - /** The target the fixture serves. */ - readonly targetName: string; - /** Records the declared operations before invoking them; undeclared accessors retain their identity. */ - fixture(name: string, surface: T, operations: FixtureOperations): T; - readonly app: EngineAppInfo & { - /** - * Resolves a navigation target against the base URL. Throws - * `APP_URL_REQUIRED` when the target declares no URL and `POLICY_DENIED` - * for any scheme but `http:` and `https:` (`about:blank` aside), so a - * fixture never re-implements the rule the harness owns. - */ - resolveUrl(url: string): string; - }; - /** Harness budgets, for fixtures that poll or navigate. */ - readonly timeouts: { - readonly test: number; - readonly action: number; - readonly assertion: number; - }; - /** - * The running phase's signal: the attempt's through `beforeEach` and the - * body, then a fresh one per `afterEach` hook so teardown can still drive - * the app after a body timeout. Read it per call; a fixture factory that - * captures it once keeps a signal that is dead by teardown. - */ - readonly signal: AbortSignal; - /** Per-call operation budget: the action timeout (or an explicit one) plus the attempt signal. */ - operation(timeoutMs?: number): OperationContext; - /** Registers a file the current step produced under the attempt artifact directory. */ - attachArtifact( - kind: 'screenshot' | 'video' | 'download' | 'log', - relativePath: string, - ): void; - /** Records the viewport the current step established. */ - attachViewport(viewport: { width: number; height: number; scale: number }): void; - /** Mints a public locator from a raw expression (a platform selector, say). */ - locator(expression: LocatorExpression): Locator; - /** Mints a screen scope whose every query is wrapped by `scope` (a nested document, say). */ - screen(scope: (expression: LocatorExpression) => LocatorExpression): Screen; - /** - * Attaches an expectation surface to a fixture object so `expect(fixture)` - * returns it. The harness records every matcher call as an assertion step - * named `expect.`; the factory only decides what the matchers mean. - */ - expectable(target: T, factory: () => E): T & Expectable; -} - -/** - * A contributed fixture: any record of async methods, sync accessors, and - * nested namespaces, declared through context.fixture so its metadata controls - * labels, deadlines and verification. The factory must return the declared - * surface; a plain one is rejected with INVALID_CONFIG. - */ -export type EngineFixtureFactory = (context: EngineFixtureContext) => object; - -/** - * An opaque, restorable snapshot of an engine's state. `data` is JSON the - * harness never inspects - a document platform's storage state, a device's app state, a - * desktop's window state all satisfy it identically. `format`/`version` let a - * engine reject a snapshot it can no longer read. - */ -export interface EngineState { - /** Engine-defined format name. */ - readonly format: string; - /** Format version, for rejecting a snapshot the engine can no longer read. */ - readonly version: number; - /** Opaque JSON the runner never inspects. */ - readonly data: unknown; - /** Earliest moment the state is known to be invalid, if the engine knows one. */ - readonly expiresAt?: string; -} - -/** - * Platform-neutral state capture and restore. A setup test captures a - * snapshot; an ordinary test restores it at launch. - * - * Snapshots are credentials: cookies, tokens, and storage that authenticate - * the app under test. The duties split at the seam. The harness owns the - * snapshot from the moment `capture` returns: it encrypts it at rest with a - * per-run AES-256-GCM key that never touches disk, stores it under the run's - * private session directory, binds it to the run, target, engine, and app - * identity, and deletes it when the run ends; it never logs it, reports it, - * digests it, or sends it to a model. An engine MUST NOT persist, cache, or - * log a snapshot on its own, MUST NOT echo snapshot contents in an error - * message, and MUST treat `restore` as a replacement of the surface's whole - * persisted state, never a merge, so a restored session cannot leak into the - * next attempt. - */ -export interface EngineStateCapability { - /** Captures the surface's persisted state. */ - capture(context: OperationContext): Promise; - /** Replaces the surface's persisted state with `state`. */ - restore(state: EngineState, context: OperationContext): Promise; -} - -/** - * Evidence capture. Paths are relative to the attempt artifact directory the - * engine received in `startAttempt`. - */ -export interface EngineArtifacts { - /** Captures a redacted screenshot; secure fields are masked at the source. */ - screenshot(label: string | undefined, context: OperationContext): Promise; - /** - * Starts recording the surface. Declared together with `stopVideo`. An - * attempt may start and stop more than once, never overlapping. A surface that has nothing to show yet (no page open) may - * defer the actual capture to the moment it does; the segments returned by - * `stopVideo` say when each one began. - */ - startVideo?(context: OperationContext): Promise; - /** - * Stops recording and returns every segment written, in order. One segment - * is the common case; a surface whose recording is bound to a page returns - * one per page the attempt showed (a restart or a state reset opens a new - * one). An attempt that never showed anything returns none. - */ - stopVideo?(context: OperationContext): Promise; -} - -/** - * One recorded video of an attempt: a file the engine wrote into the attempt - * artifact directory, or a recording a hosted service keeps and links to. - */ -export type VideoSegment = VideoFile | VideoLink; - -/** A video file in the attempt artifact directory. */ -export interface VideoFile { - /** Path relative to the attempt artifact directory. */ - readonly path: string; - /** When the segment started recording, as an ISO timestamp; its first frame is at or just after it. */ - readonly startedAt: string; -} - -/** A recording a hosted service keeps, by URL: the report links to it and the runner never downloads it. */ -export interface VideoLink { - /** `http(s)` URL of the recording. */ - readonly url: string; - /** Media type of what the URL serves: `video/mp4`, or `text/html` for a player page. */ - readonly mediaType: string; - /** When the recording started, as an ISO timestamp; its first frame is at or just after it. */ - readonly startedAt: string; -} - -/** - * Steering hooks behind the universal `app` fixture and the agent's - * `navigate` verb. The app itself is the target's `app`, handed over as data; - * node actions never live here, they are `perform`. - * - * `restart` and `reset` open nothing on an addressable surface: they end at - * a fresh surface with no location shown, and the harness reopens the app - * through `open` when the target has an address. A surface therefore never - * needs to know the app's URL, and an unreachable app after a restart is - * reported the same way as on first open. A surface without `open` (a - * device with a pinned app) relaunches the app inside `restart` and `reset` - * itself, since nothing else will. - */ -export interface EngineSession { - /** - * Opens one URL the harness already resolved against the base URL and the - * origin policy. Absent on a surface without addressable locations. - */ - open?(url: string, context: OperationContext): Promise; - /** Navigates back once in the surface's history. */ - back?(context: OperationContext): Promise; - /** Sets the viewport to `size` in CSS pixels, for this page and every page the attempt opens after it. */ - resize?(size: ViewportSize, context: OperationContext): Promise; - /** - * Shows the open tab at `index`, zero-based in the order the tabs opened, - * as `EngineSnapshot.tabs` counts them: every observation and action after - * it reads and acts on that tab. An index with no open tab is an - * `ACTION_FAILED` the model reads. Declare it with `tabs` in snapshots. - */ - switchTab?(index: number, context: OperationContext): Promise; - /** - * Closes the open tab at `index`, counted as `switchTab` counts them. When - * it was the tab shown, the engine shows another, such as the tab that - * opened it. An index with no open tab, or the last open tab, is an - * `ACTION_FAILED` the model reads. - */ - closeTab?(index: number, context: OperationContext): Promise; - /** Recreates the execution context, keeping persisted state. */ - restart?(context: OperationContext): Promise; - /** Clears persisted client state and recreates the execution context. */ - reset?(context: OperationContext): Promise; -} - -/** - * What `prepare` learned that the run must honour. `workers` replaces the - * engine's declared cap for this target and run: the surfaces the engine - * actually provisioned, `1` to `info.slots`. Declared `workers` stays the - * static answer for engines that know it up front. - */ -export interface EnginePrepareResult { - /** Lowers the target's worker cap for this run, `1` to `info.slots`. */ - readonly workers?: number; - /** - * Variables every worker of this target is spawned with, on top of the - * run's environment: how a runner-side `prepare` hands what it provisioned - * (a device pool it discovered) to each worker's `init`. The run's own - * variables win on a clash. - */ - readonly env?: Readonly>; -} - -/** - * Facts handed to `prepare`, once per run and target in the runner process, - * before any worker exists. - */ -export interface EnginePrepareInfo { - /** The run id. */ - readonly runId: string; - /** The target being prepared. */ - readonly targetName: string; - /** Directory relative paths in the config resolve against; see `EngineInitInfo.projectRoot`. */ - readonly projectRoot: string; - /** The app the target declares, as `init` receives it: what a device installs or warms up here. */ - readonly app: EngineAppInfo; - /** - * The worker slots the run will start for this target, `0` to `slots - 1`: - * the run's worker cap, the engine's declared `workers`, and the work units - * selected for the target, whichever is smallest; `0` when nothing runs on - * it while another target has work. A run with nothing to run prepares no - * target. Provision for exactly these slots (boot that many devices of a - * pool); `init` then finds them ready. - */ - readonly slots: number; - /** - * The run's environment: what every worker is started with. A host may hand - * the run an environment other than the runner process's own, so anything - * provisioned here that a worker later looks up by environment (a browser - * cache location) must be resolved and spawned against this, not - * `process.env`. - */ - readonly env: Readonly>; - /** - * Aborts on interrupt only. Provisioning has no budget: a first-run - * download is as long as the network makes it, and cutting it short would - * fail every test behind it. - */ - readonly signal: AbortSignal; - /** Whether the run asked for a visible surface (`--headed`), as `EngineInitInfo` declares it. */ - readonly headed: boolean; - /** - * Reports one line of progress. The runner streams it as a `notice` run - * event, so it reaches the reporter and every host sink instead of being - * written to a worker's stderr underneath the live status block. - */ - readonly log: (line: string) => void; -} - -/** Handed to `finish`, once per run and target after the last worker is gone, with the cleanup budget of one hook. */ -export interface EngineFinishInfo extends EngineCleanupContext { - /** The run id. */ - readonly runId: string; - /** The target being finished. */ - readonly targetName: string; - /** The run's environment, the same `prepare` saw. */ - readonly env: Readonly>; - /** Reports one line of progress, streamed as a `notice` run event like `prepare`'s. */ - readonly log: (line: string) => void; -} - -/** Facts handed to `doctor`, once per target in the process `e2e doctor` runs in. */ -export interface EngineDoctorInfo { - /** The target being checked. */ - readonly targetName: string; - /** Directory relative paths in the config resolve against; see `EngineInitInfo.projectRoot`. */ - readonly projectRoot: string; - /** The app the target declares, as `prepare` receives it. */ - readonly app: EngineAppInfo; - /** The environment a run would start with. */ - readonly env: Readonly>; - /** Whether the run would show the surface (`--headed`), as `prepare` receives it. */ - readonly headed: boolean; - /** Aborts 30 seconds in, when the checks fail as timed out, or when `e2e doctor` is interrupted; return within 5 seconds of it, when the connection closes. */ - readonly signal: AbortSignal; - /** Reports one line of progress; `e2e doctor` prints it to stderr. */ - readonly log: (line: string) => void; -} - -/** One finding of `doctor`. */ -export interface EngineDoctorCheck { - /** What was checked, in kebab case: `browser`, `toolchain`. */ - readonly id: string; - /** - * `pass`; `warn` for something a run handles on its own, slower (a - * first-run download); `fail` for something that stops a run; `skip` for - * a check that does not apply to this target. - */ - readonly status: 'pass' | 'warn' | 'fail' | 'skip'; - /** One line: what was found and, unless it passed, what to do. */ - readonly message?: string; -} - -/** Run identity and harness-resolved facts handed to `init`, once per worker before the first step. */ -export interface EngineInitInfo { - /** The run id. */ - readonly runId: string; - /** The target this worker serves. */ - readonly targetName: string; - /** - * Directory relative paths in the config resolve against: the config file's - * directory, or the run's `cwd` for a programmatic config. An engine option - * naming a file (a build to install) resolves here, never against - * `process.cwd()`, which an in-process run does not change. - */ - readonly projectRoot: string; - /** The app the target declares: the origin and site policy of its URL, and what a device launches. */ - readonly app: EngineAppInfo; - /** - * This worker's environment: the run's, plus what this target's `prepare` - * returned in its result's `env`. Read what `prepare` provisioned from - * here, never from `process.env`: an in-process worker shares its process - * with the runner and every other target. - */ - readonly env: Readonly>; - /** Whether the run asked for a visible surface (`--headed`). */ - readonly headed: boolean; - /** - * This worker's 0-based slot among the target's workers: the lowest slot - * free when the worker was spawned, so a replacement worker takes over the - * slot of the one that exited. An engine with several devices hands each - * slot its own; `config.workers` bounds the slots a target can reach. - */ - readonly workerSlot: number; - /** Aborts on interrupt and when init exceeds the launch timeout; init must stop promptly. */ - readonly signal: AbortSignal; - /** - * Reports one line of progress. The runner streams it as a `notice` run - * event, prefixed with the target and worker slot, so it reaches the - * reporter and every host sink instead of being written to a worker's - * stderr underneath the live status block. This is where a fact that only - * exists once the worker is up belongs: the URL a hosted browser or device - * can be watched at, which simulator a slot got, a version it detected. - * Meant for `init` itself; a line logged later is still delivered while - * the worker lives and dropped once it has exited. The line is shown as is - * in reporters and host sinks, so keep tokens and other secrets out of it - * (a viewer URL without its credential). - */ - readonly log: (line: string) => void; -} - -/** - * Per-attempt isolation context. An engine that must give each test a fresh - * surface (a fresh isolated context per test, a reset device) sets it up in - * `startAttempt` and tears it down in `endAttempt`. - */ -export interface EngineAttemptContext { - /** The attempt id. */ - readonly attemptId: string; - /** Absolute directory every artifact of this attempt is written under. */ - readonly artifactsDir: string; - /** - * The plaintext of a secret the engine declared in `secrets`, for an - * option the engine hands the app itself (basic-auth credentials). A - * provider runs again on every call. The value, and every value - * `options.derived` computes from it, join the attempt's redaction before - * this resolves, so reports, logs, and every observation redact them, and - * the attempt's text downloads are rewritten. The protection is - * text only: a page that shows the value outside a secure field is not - * masked in screenshots. - * A secret the engine did not declare is `SECRET_UNAVAILABLE`. - */ - readonly resolveSecret: (secret: Secret, options?: ResolveSecretOptions) => Promise; - /** - * Aborts with the attempt, and the moment `startAttempt` fails or exceeds - * the launch timeout: a hook still running then must stop, because the - * harness ends the attempt's isolation right behind it and may retry. - */ - readonly signal: AbortSignal; - /** - * Reports something the app did on its own while the attempt ran: a - * console line, an uncaught exception, a request that failed. The harness - * redacts the text, keeps it with the step that was running (from an event - * callback outside any step, the step that started last; before the first - * step, with none), and shows it on the trace page. Call it from the moment `startAttempt` begins until - * `endAttempt`; entries past a per-attempt cap are dropped. - */ - readonly appLog: (entry: AppLogEntry) => void; - /** - * Reports where the app went on its own, as one line (`navigated to - * /login`, `the app opened a new tab at /help`, `frame "pay" loaded - * /embed`): a navigation the engine did not start, a tab, a frame. The - * harness redacts it and shows it under the step that was running. - */ - readonly navigation: (line: string) => void; - /** - * Hands the harness a screen for the trace: the capture a `locate` - * matched against, or one read right after an action. The harness redacts - * it and keeps, for each step, how the screen changed since the step - * before, which the trace page shows. It never becomes an observation: - * refs it holds are not valid for `perform`. An engine that reads one after - * an action does so on the action's path, so it bounds the read (the web - * engine allows one second and gives up silently) and skips it where a - * read is expensive; an action never fails because of it. Absent when the - * attempt keeps no trace; the engine then reads nothing for it. - */ - readonly screen?: (snapshot: EngineSnapshot) => void; - /** - * What the attempt runs on, such as `{ browser: 'chromium 141.0.7390.37' }` - * or `{ device: 'iPhone 16', os: 'iOS 26.0' }`, for the trace page. A - * later call adds to and overwrites earlier facts; the harness redacts and - * clips them and keeps a handful. - */ - readonly environment: (facts: Readonly>) => void; -} - -/** Where an app log entry came from. */ -export type AppLogSource = 'console' | 'error' | 'network' | 'system'; - -/** One line of what the app did during an attempt, as `EngineAttemptContext.appLog` takes it. */ -export interface AppLogEntry { - /** - * Where it came from: the app's `console`, an `error` nothing caught, the - * `network`, or the `system` the app runs on (a crash, an OS log). - */ - readonly source: AppLogSource; - readonly level: 'error' | 'warning' | 'info'; - /** One line, such as `GET /api/todos 500` or `TypeError: x is undefined`; the harness clips it. */ - readonly text: string; -} - -/** How `EngineAttemptContext.resolveSecret` treats what the engine makes of the value. */ -export interface ResolveSecretOptions { - /** - * The forms of the value the app sees instead of the value itself, for the - * same redaction under the secret's name: the base64 `user:password` an - * `Authorization: Basic` header carries, which a page echoing its request - * headers would otherwise show. - */ - readonly derived?: (plaintext: string) => readonly string[] | Promise; -} - -/** - * Budget of one cleanup hook (`settleAttempt`, `endAttempt`, `dispose`). `signal` aborts when - * the budget is exhausted, so a hook that cannot finish in time stops instead - * of running on into the next attempt's setup. - */ -export interface EngineCleanupContext { - /** Aborts when the cleanup budget is spent. */ - readonly signal: AbortSignal; - /** Remaining cleanup budget when the call starts. */ - readonly timeoutMs: number; -} - -/** Cleanup of one worker, with optional permission to leave run-owned resources for a replacement. */ -export interface EngineDisposeContext extends EngineCleanupContext { - /** - * A live signal permits reusable resources owned by `prepare` and `finish` - * to survive this worker. Missing or aborted permission requires final - * cleanup. Observe revocation until disposal settles. This signal does - * not cancel cleanup, which remains bounded by `signal` and `timeoutMs`. - */ - readonly reuseSignal?: AbortSignal; -} - -export interface EngineObserveOptions { - /** Requests masked viewport pixels for the same revision as the tree. */ - readonly pixels?: boolean; - /** Allows independently masked pixels to replace a failed semantic capture. */ - readonly pixelFallback?: boolean; - /** - * The pixels are compared against a stored screenshot (`toHaveScreenshot`). - * Where the platform can, render what changes on its own outside the app - * in a fixed state: a status bar's clock, battery, and signal. - */ - readonly comparable?: boolean; -} - -/** The tabs a surface has open, as `EngineSnapshot.tabs` reports them. */ -export interface EngineTabs { - /** How many tabs are open: 2 or more. */ - readonly count: number; - /** The zero-based position, in the order the tabs opened, of the tab `root` reads. */ - readonly active: number; -} - -/** - * One fresh semantic snapshot of the surface under test. The harness owns - * everything downstream: revision minting, secret redaction, and the - * observation byte budget apply to every engine equally. - */ -export interface EngineSnapshot { - /** - * Where the surface is, as an opaque address the platform understands: a - * URL on a document platform, the foreground screen or activity on a - * device, the front window on a desktop. The harness shows it to the model - * and to the report, anchors trace replay on it, and applies the origin - * policy to it only when it parses as a URL. Omit when the platform has no - * notion of a current location. - */ - readonly location?: string; - /** - * The observation tree under one root the engine minted. The root's id MUST - * be stable for the surface across observations: `perform(root, swipe)` is - * the viewport swipe, and the harness addresses it from an earlier - * observation, possibly one taken before a `restart` or `reset`, so the - * root swipe MUST NOT depend on a live handle from that observation. A - * platform with several top-level elements (a device's windows) wraps them - * in a root of its own. - */ - readonly root: SemanticNode; - /** The viewport `SemanticNode.rect` and `ViewportPoint` are measured in. */ - readonly viewport: ViewportSize; - /** - * True when `root` leaves out nodes that are on the surface: the engine - * stopped reading at a node cap or a depth limit, or could not enter a - * child document. The harness tells the model the listing is incomplete - * and never calls such a screen unchanged. Omit or set false for a tree - * read whole. - */ - readonly truncated?: boolean; - /** - * Whether an on-screen keyboard is showing, as the engine measured it apart - * from `root`: a platform can raise a keyboard the tree lists only in part, - * or not at all. Set `false` when it measured none, and omit it only when - * the engine did not measure it; consumers then fall back to the tree. - */ - readonly keyboardVisible?: boolean; - /** - * The tabs the surface has open, when it has more than one, such as a - * browser with a tab the app opened. The harness tells the model which - * tab it reads and how many there are, and the agent switches between them - * through `session.switchTab` and closes them through `session.closeTab`. - * Omit with one tab. - */ - readonly tabs?: EngineTabs; - /** - * Semantic capture timed out. Return only the stable root reference, with no other fields, - * and fresh pixels whose masking was proven independently of the failed - * capture. Requires `pixelFallback`; callers must use the pixels as evidence - * and must not replay or record a trace from this observation. - */ - readonly treeUnavailable?: true; - /** Masked pixels, when requested and producible; omitted otherwise. */ - readonly pixels?: ObservationPixels; - /** Regions masked in `pixels`; the harness checks it covers every secure node. */ - readonly maskedRegionCount?: number; -} - -/** The body of one target: typed, model-free, capability-graded. */ -export interface Engine { - /** Engine name, for diagnostics. */ - readonly name: string; - /** - * Implementation version, recorded as provenance and part of the trace - * cache identity: an engine that resolves nodes differently must not replay - * another version's traces, so an unversioned engine is not accepted. - */ - readonly version: string; - /** - * Contract version literal. Additive optional members never bump it; - * changed required semantics do. - */ - readonly spiVersion: EngineSpiVersion; - /** - * Platform label this engine drives (`web`, `ios`, `android`, or a label of - * the engine's own). Tests filter on it through `platforms` and tool packs - * are scoped by it; the harness attaches no meaning to any value. A target - * inherits it; a target that names a platform of its own must agree with it. - */ - readonly platform?: string; - /** - * The most workers this engine can serve at once for one target: one per - * surface it drives concurrently (a device pool's size; 1 for a single - * simulator). The scheduler never runs more workers for the target, whatever - * `config.workers` allows, so a device target shares a run with browser - * targets without being over-subscribed. Omit when there is no such bound. - */ - readonly workers?: number; - /** - * The `secrets.get()` handles the engine's options hold, such as a - * basic-auth password. The config load checks each names a configured - * secret (`INVALID_CONFIG` otherwise), and only these resolve through - * `EngineAttemptContext.resolveSecret`. The handles carry names only, so - * no value reaches the config digest. - */ - readonly secrets?: readonly Secret[]; - /** capability: observation. */ - observe?(context: OperationContext, options?: EngineObserveOptions): Promise; - /** - * capability: computed-style - requires observation. Reads only requested, allow-listed - * rendered properties of a node this engine minted, without changing app - * state. Throw NODE_STALE if the node no longer binds. Values cross the - * protocol as JSON and are redacted by the harness before a tool sees them. - */ - readStyle?(ref: NodeRef, properties: readonly ComputedStyleProperty[], context: OperationContext): Promise; - /** - * capability: actions - requires observation. Performs exactly one action - * on a ref this engine minted, from the newest observation or from - * `locate` (both live in one id space), with the platform's actionability - * checks. The agent's grammar verbs (tap, type, press, select, scroll) and - * the `screen` tier's actions both bottom out here, so a surface - * implements each action once. A `swipe` on the observation root is the - * viewport swipe. - * - * Error contract (load-bearing for trace replay): throw a retryable - * `NODE_STALE`-coded error when a ref no longer binds, and an - * `ACTION_MAY_HAVE_COMMITTED`-coded error when input may have reached the - * app - the harness never blindly repeats an uncertain mutation. - */ - perform?(ref: NodeRef, action: LocatorAction, context: OperationContext): Promise; - /** - * The action kinds `perform` honors, required with it. The harness offers - * the agent and the `screen` tier exactly these: a kind left out is never - * presented as a tool that can only decline, and `screen`/`Locator` methods - * for it fail with `UNSUPPORTED_CAPABILITY` before reaching the engine. - * `perform` still throws `UNSUPPORTED_CAPABILITY` for a declared kind one - * particular node cannot take (a `check` on a toggle whose state is unknown). - */ - readonly actions?: readonly LocatorActionKind[]; - /** - * capability: location - requires observation. Deterministic locator - * resolution for the `screen`/`expect` tier: resolve one expression to the - * nodes it currently matches. The harness owns polling, strictness, and - * staleness; an engine resolves once, immediately. - */ - locate?( - expression: LocatorExpression, - context: OperationContext, - ): Promise; - /** - * capability: pointer - requires observation. Performs one pointer action - * at a viewport point, in the CSS pixels of `SemanticNode.rect`, with no - * node behind it: the agent's `tap_at`, `hover_at`, and `drag_at` verbs land - * here with the point the model named in a screenshot (a shape on a canvas, a pin on - * a map, a control in a system sheet or one the tree lists), and so do a test's - * `screen.tapAt`, `screen.swipe({ from, to })`, and `tap({ position })`. - * Dispatch the pointer at the point as given; the harness has clamped an - * agent's point to the viewport and validated a test's. Throw - * `UNSUPPORTED_CAPABILITY` for a declared kind the surface cannot deliver - * at this particular point. - */ - performAt?(point: ViewportPoint, action: PointerAction, context: OperationContext): Promise; - /** - * The pointer action kinds `performAt` honors, required with it. The - * harness routes a point-addressed action to the engine only for a kind - * listed here; an undeclared kind fails with `UNSUPPORTED_CAPABILITY` - * before reaching the engine. - */ - readonly pointerActions?: readonly PointerActionKind[]; - /** - * The surface honors `modifiers` on the `tap`, `doubleTap`, and - * `secondaryTap` actions `perform` receives, holding each key for the - * click. Without it the harness fails an action that carries modifiers - * with `UNSUPPORTED_CAPABILITY` before it reaches the engine, so an engine - * that predates the field never drops one silently. - */ - readonly tapModifiers?: boolean; - /** capability: keyboard - requires observation. Input to whatever holds focus; see `EngineKeyboard`. */ - readonly keyboard?: EngineKeyboard; - /** - * Named deterministic surfaces this engine contributes to TestFixtures - * (a device fixture, a document fixture - anything). Keys become fixture and - * capability names; `requires: ['']` gates at selection. - */ - readonly fixtures?: Readonly>; - /** capability: state - opaque snapshot capture/restore for session reuse. */ - readonly state?: EngineStateCapability; - /** capability: artifacts - screenshots under the attempt directory, and videos there or at a provider. */ - readonly artifacts?: EngineArtifacts; - /** - * Checks the app a target declares against what this engine can drive, at - * config load, synchronously: throw `INVALID_CONFIG` naming - * `info.targetName` for a field the platform needs and the target left out - * (a URL, a bundle id) or one it cannot drive. The harness has already - * checked every field's shape. - */ - validateApp?(app: EngineAppDeclaration, info: EngineAppCheckInfo): void; - /** Steering hooks: open, back, restart, reset. */ - readonly session?: EngineSession; - /** - * Once per run and target, in the runner process, before any worker starts - * and outside every launch budget. Provision what the engine needs on this - * machine here (a first-run browser download, a toolchain fetch), so it - * happens once instead of per worker and its progress reaches the reporter - * through `info.log`. It runs after collection and before the run's clock - * starts: `plan` is emitted, the report's `startedAt` taken, and the app - * started only once every target is prepared, so a download is never part - * of a run's duration. A run with nothing to run (the test filters left - * nothing, or `--pass-with-no-tests` on an empty selection) prepares no - * target, and so calls no `finish`. Failure is infrastructure and ends the - * run before any test executes. The result may lower the target's worker - * cap for this run, for an engine that only learns its capacity here (a - * device pool discovered from the booted devices). - */ - prepare?(info: EnginePrepareInfo): Promise; - /** - * Once per run and target, in the runner process, after every worker of - * the target has been disposed and on every exit path: a passing run, a - * failure, an interrupt, or a `prepare` that threw part-way. Release what - * `prepare` acquired for the run here (a leased cloud device, a remote - * session billed by the minute); per-worker resources belong in - * `dispose`. Runs only when `prepare` was called, within the cleanup - * budget and never cancelled by an interrupt: an interrupted run is exactly - * when a leased device must still be released. A failure is a - * cleanup-phase run error, never a crash. - */ - finish?(info: EngineFinishInfo): Promise; - /** - * Checks this machine for what a run on the target needs, for - * `e2e doctor`. Read-only and quick: never install, launch, lease, or - * start anything a check could instead look up, and never call `prepare`. - * A check that cannot tell reports nothing rather than guess. A throw is - * reported as one failed check of the target. - */ - doctor?(info: EngineDoctorInfo): Promise; - /** - * Once per worker, before the first step; boot devices here, not in a step - * budget. The same handle can be booted again after `dispose`: a config-held - * handle outlives an in-process worker, so init MUST work on a disposed - * engine as it does on a fresh one. - */ - init?(info: EngineInitInfo): Promise; - /** Before each attempt: set up per-test isolation. */ - startAttempt?(context: EngineAttemptContext): Promise; - /** - * After the body has settled, and again after teardown, before the verdict, - * within the cleanup budget: report a failure that landed on a path no step - * awaited (a callback the surface ran for the test: a request interceptor, - * a native dialog handler). Wait for one still running, then throw its - * error; the attempt fails with it the way a step would, an error already - * classified keeping its code. MUST report each failure once. - */ - settleAttempt?(context: EngineCleanupContext): Promise; - /** - * After each attempt, within the cleanup budget: tear that isolation down. - * MUST be idempotent, and safe to call after a failed `startAttempt`. - */ - endAttempt?(context: EngineCleanupContext): Promise; - /** - * Worker shutdown, within the cleanup budget; failure is a run error. Runs - * once `init` was called, even when it failed, so it MUST tolerate a - * partly initialized engine. A live - * `reuseSignal` permits preserving run-owned resources for a replacement, - * until that permission is revoked or this hook settles. - */ - dispose?(context: EngineDisposeContext): Promise; -} - -/** A validated engine: branded, frozen, capabilities computed. */ -export interface EngineHandle extends Engine { - readonly [engineBrand]: true; - readonly capabilities: ReadonlySet; -} - -export { defineEngine, isEngineHandle } from './manifest.ts'; - -export { connectEngine, type ConnectEngineOptions } from './protocol/client.ts'; -export { describeEngine } from './protocol/manifest.ts'; -export { serveEngine } from './protocol/server.ts'; -export { - loopbackTransport, - socketTransport, - spawnTransport, - type EngineTransport, - type SocketTransportOptions, - type SpawnTransportOptions, - type TransportConnection, - type TransportContext, -} from './protocol/transport.ts'; -export { ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, type EngineManifest, type EngineMethod } from './protocol/protocol.ts'; -export type { MessageStreams } from './protocol/connection.ts'; +export * from '@e2e-dev/core/engine'; diff --git a/packages/e2e/src/expect/async.ts b/packages/e2e/src/expect/async.ts index 4f022e3599..0c711d1112 100644 --- a/packages/e2e/src/expect/async.ts +++ b/packages/e2e/src/expect/async.ts @@ -1,8 +1,8 @@ /** Runner-owned polling locator assertions. */ -import type { SemanticNode } from '../engine/surface.ts'; -import { TestError } from '../internal/errors.ts'; -import { rejectUnknownOptions } from '../internal/options.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; +import { rejectUnknownOptions } from '@e2e-dev/core/lib/internal/options'; import { isTextMatch, normalizeText, @@ -12,14 +12,14 @@ import { withIgnoreCase, type TextComparison, type TextPattern, -} from '../internal/text.ts'; -import { isValueControl } from '../internal/roles.ts'; -import { pollReads, type ReadWindow } from '../internal/time.ts'; -import { SampleHistory } from './samples.ts'; -import { attributeOf, denySecureRead, isNodeVisible } from '../locator/engine.ts'; -import { describeExpression } from '../locator/expression.ts'; -import type { LocatorInternals } from '../locator/screen.ts'; -import type { AsyncExpectation, ScreenshotOptions, TextMatch, TextMatcherOptions } from '../types.ts'; +} from '@e2e-dev/core/lib/internal/text'; +import { isValueControl } from '@e2e-dev/core/lib/internal/roles'; +import { pollReads, type ReadWindow } from '@e2e-dev/core/lib/internal/time'; +import { SampleHistory } from '@e2e-dev/core/lib/expect/samples'; +import { attributeOf, denySecureRead, isNodeVisible } from '@e2e-dev/core/lib/locator/engine'; +import { describeExpression } from '@e2e-dev/core/lib/locator/expression'; +import type { LocatorInternals } from '@e2e-dev/core/lib/locator/screen'; +import type { AsyncExpectation, ScreenshotOptions, TextMatch, TextMatcherOptions } from '@e2e-dev/core/lib/types'; import { expectScreenshot } from './screenshot.ts'; interface Sample { diff --git a/packages/e2e/src/expect/index.ts b/packages/e2e/src/expect/index.ts index 9c09739959..02445cacfb 100644 --- a/packages/e2e/src/expect/index.ts +++ b/packages/e2e/src/expect/index.ts @@ -1,14 +1,14 @@ /** Public expect() dispatcher (spec api/e2e.d.ts). */ import { Any, Anything, ArrayContaining, ObjectContaining, StringContaining, StringMatching } from '@vitest/expect'; -import type { AsymmetricMatcher, AsyncExpectation, Class, Expect, Expectable, Locator, Screen, ScreenExpectation, SoftValueExpectation, ValueExpectation } from '../types.ts'; -import { expectationBrand } from '../internal/brands.ts'; -import { realmSlot } from '../internal/realm-slot.ts'; -import { locatorInternals, screenInternals } from '../locator/screen.ts'; +import type { AsymmetricMatcher, AsyncExpectation, Class, Expect, Expectable, Locator, Screen, ScreenExpectation, SoftValueExpectation, ValueExpectation } from '@e2e-dev/core/lib/types'; +import { expectationBrand } from '@e2e-dev/core/lib/internal/brands'; +import { realmSlot } from '@e2e-dev/core/lib/internal/realm-slot'; +import { locatorInternals, screenInternals } from '@e2e-dev/core/lib/locator/screen'; import { createAsyncExpectation } from './async.ts'; import { createPollExpectation } from './poll.ts'; import { createScreenExpectation } from './screenshot.ts'; -import { soften } from './soft.ts'; +import { soften } from '@e2e-dev/core/lib/expect/soft'; import { createValueExpectation } from './values.ts'; /** diff --git a/packages/e2e/src/expect/poll.ts b/packages/e2e/src/expect/poll.ts index dd0bb081e3..7bb73dc321 100644 --- a/packages/e2e/src/expect/poll.ts +++ b/packages/e2e/src/expect/poll.ts @@ -1,10 +1,10 @@ /** expect.poll: re-reads a value until a synchronous matcher passes. */ -import { ConfigurationError, isE2EError, TestError } from '../internal/errors.ts'; -import { abortError, cancelledError, Deadline, POLL_INTERVAL_MS, sleep, withAbort, withTimeout } from '../internal/time.ts'; -import type { PollExpectation, PollOptions, ValueExpectation, ValueMatcherName } from '../types.ts'; -import { currentAttempt } from './attempt.ts'; -import { currentPollScope, pollRead } from './poll-scope.ts'; +import { ConfigurationError, isE2EError, TestError } from '@e2e-dev/core/lib/internal/errors'; +import { abortError, cancelledError, Deadline, POLL_INTERVAL_MS, sleep, withAbort, withTimeout } from '@e2e-dev/core/lib/internal/time'; +import type { PollExpectation, PollOptions, ValueExpectation, ValueMatcherName } from '@e2e-dev/core/lib/types'; +import { currentAttempt } from '@e2e-dev/core/lib/expect/attempt'; +import { currentPollScope, pollRead } from '@e2e-dev/core/lib/expect/poll-scope'; import { createValueExpectation } from './values.ts'; /** Outside an attempt (a standalone script) there is no config to read `assertionTimeout` from. */ diff --git a/packages/e2e/src/expect/screenshot-call.ts b/packages/e2e/src/expect/screenshot-call.ts index 19e8458d9c..0b00b571c3 100644 --- a/packages/e2e/src/expect/screenshot-call.ts +++ b/packages/e2e/src/expect/screenshot-call.ts @@ -1,14 +1,14 @@ /** The arguments of one `toHaveScreenshot` call, checked and named before anything is read. */ import { createHash } from 'node:crypto'; -import type { LocatorExpression } from '../engine/surface.ts'; -import { TestError } from '../internal/errors.ts'; -import type { ImageTolerance } from '../internal/image.ts'; -import { checkStepTimeout } from '../internal/time.ts'; -import { isPlainObject, rejectUnknownOptions } from '../internal/options.ts'; -import { locatorInternals } from '../locator/screen.ts'; -import type { ScreenshotContext } from '../run/screenshots.ts'; -import type { ScreenshotOptions } from '../types.ts'; +import type { LocatorExpression } from '@e2e-dev/core/lib/engine/surface'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; +import type { ImageTolerance } from '@e2e-dev/core/lib/internal/image'; +import { checkStepTimeout } from '@e2e-dev/core/lib/internal/time'; +import { isPlainObject, rejectUnknownOptions } from '@e2e-dev/core/lib/internal/options'; +import { locatorInternals } from '@e2e-dev/core/lib/locator/screen'; +import type { ScreenshotContext } from '@e2e-dev/core/lib/run/screenshots'; +import type { ScreenshotOptions } from '@e2e-dev/core/lib/types'; /** One checked call. */ export interface ScreenshotCall { diff --git a/packages/e2e/src/expect/screenshot-capture.ts b/packages/e2e/src/expect/screenshot-capture.ts index f8dce8087e..733fe0bea7 100644 --- a/packages/e2e/src/expect/screenshot-capture.ts +++ b/packages/e2e/src/expect/screenshot-capture.ts @@ -5,14 +5,14 @@ * painted over. */ -import type { LocatorExpression } from '../engine/surface.ts'; -import { ConfigurationError, isE2EError } from '../internal/errors.ts'; -import { clipBox, cropImage, decodePng, fillBoxes, resampleImage, type ImageBox, type RgbaImage } from '../internal/image.ts'; -import type { ReadWindow } from '../internal/time.ts'; -import { isNodeVisible } from '../locator/engine.ts'; -import { describeExpression } from '../locator/expression.ts'; -import type { ScreenContext } from '../locator/screen.ts'; -import { pixelsProvenMasked } from '../run/secrecy.ts'; +import type { LocatorExpression } from '@e2e-dev/core/lib/engine/surface'; +import { ConfigurationError, isE2EError } from '@e2e-dev/core/lib/internal/errors'; +import { clipBox, cropImage, decodePng, fillBoxes, resampleImage, type ImageBox, type RgbaImage } from '@e2e-dev/core/lib/internal/image'; +import type { ReadWindow } from '@e2e-dev/core/lib/internal/time'; +import { isNodeVisible } from '@e2e-dev/core/lib/locator/engine'; +import { describeExpression } from '@e2e-dev/core/lib/locator/expression'; +import type { ScreenContext } from '@e2e-dev/core/lib/locator/screen'; +import { pixelsProvenMasked } from '@e2e-dev/core/lib/run/secrecy'; /** What one call captures. */ export interface CaptureRequest { diff --git a/packages/e2e/src/expect/screenshot.ts b/packages/e2e/src/expect/screenshot.ts index 7823f16a9c..624a0f8e22 100644 --- a/packages/e2e/src/expect/screenshot.ts +++ b/packages/e2e/src/expect/screenshot.ts @@ -7,15 +7,15 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; -import type { LocatorExpression } from '../engine/surface.ts'; -import { writeFileAtomic } from '../internal/atomic-write.ts'; -import { InfrastructureError, TestError } from '../internal/errors.ts'; -import { compareImages, decodePng, encodePng, type ImageComparison, type RgbaImage } from '../internal/image.ts'; -import { pollReads, type Deadline, type ReadWindow } from '../internal/time.ts'; -import { describeExpression } from '../locator/expression.ts'; -import type { ScreenContext } from '../locator/screen.ts'; -import type { ScreenshotContext } from '../run/screenshots.ts'; -import type { ScreenExpectation, ScreenshotOptions } from '../types.ts'; +import type { LocatorExpression } from '@e2e-dev/core/lib/engine/surface'; +import { writeFileAtomic } from '@e2e-dev/core/lib/internal/atomic-write'; +import { InfrastructureError, TestError } from '@e2e-dev/core/lib/internal/errors'; +import { compareImages, decodePng, encodePng, type ImageComparison, type RgbaImage } from '@e2e-dev/core/lib/internal/image'; +import { pollReads, type Deadline, type ReadWindow } from '@e2e-dev/core/lib/internal/time'; +import { describeExpression } from '@e2e-dev/core/lib/locator/expression'; +import type { ScreenContext } from '@e2e-dev/core/lib/locator/screen'; +import type { ScreenshotContext } from '@e2e-dev/core/lib/run/screenshots'; +import type { ScreenExpectation, ScreenshotOptions } from '@e2e-dev/core/lib/types'; import { parseScreenshotCall, type ScreenshotCall } from './screenshot-call.ts'; import { screenshotCapturer, type Capture } from './screenshot-capture.ts'; diff --git a/packages/e2e/src/expect/values.ts b/packages/e2e/src/expect/values.ts index 62cb6dc8a2..c7e42bbea5 100644 --- a/packages/e2e/src/expect/values.ts +++ b/packages/e2e/src/expect/values.ts @@ -2,11 +2,11 @@ import { types } from 'node:util'; import { equals, isAsymmetric, iterableEquality, subsetEquality } from '@vitest/expect'; -import { TestError } from '../internal/errors.ts'; -import { testPattern } from '../internal/regexp.ts'; -import { describeIssue, requireStandardSchema } from '../internal/standard-schema.ts'; -import { toTextPattern } from '../internal/text.ts'; -import type { AsymmetricMatcher, NegatedValueExpectation, PropertyPath, StandardSchemaV1, ValueExpectation } from '../types.ts'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; +import { testPattern } from '@e2e-dev/core/lib/internal/regexp'; +import { describeIssue, requireStandardSchema } from '@e2e-dev/core/lib/internal/standard-schema'; +import { toTextPattern } from '@e2e-dev/core/lib/internal/text'; +import type { AsymmetricMatcher, NegatedValueExpectation, PropertyPath, StandardSchemaV1, ValueExpectation } from '@e2e-dev/core/lib/types'; function fail(message: string): never { throw new TestError('ASSERTION_FAILED', message); diff --git a/packages/e2e/src/explore/body.ts b/packages/e2e/src/explore/body.ts index f35fcff956..a4f200de50 100644 --- a/packages/e2e/src/explore/body.ts +++ b/packages/e2e/src/explore/body.ts @@ -11,11 +11,11 @@ * ends `skipped` and passes. */ -import { AgentError, isAgentError } from '../agent/error.ts'; -import { BLOCKABLE_CODES } from '../agent/executor.ts'; -import { credentials } from '../secrets.ts'; +import { AgentError, isAgentError } from '@e2e-dev/core/lib/agent/error'; +import { BLOCKABLE_CODES } from '@e2e-dev/core/lib/agent/executor'; +import { credentials } from '@e2e-dev/core/lib/secrets'; import type { ReportExplore, ReportExploreStep } from '../report/build.ts'; -import type { Agent, AgentErrorCode, AgentParams, TestFn } from '../types.ts'; +import type { Agent, AgentErrorCode, AgentParams, TestFn } from '@e2e-dev/core/lib/types'; import { planNext, type PlanAccount, type PlanDecision } from './plan.ts'; import type { ExploreState } from './state.ts'; diff --git a/packages/e2e/src/explore/change.ts b/packages/e2e/src/explore/change.ts index f3e15b7441..e0ce2b45b3 100644 --- a/packages/e2e/src/explore/change.ts +++ b/packages/e2e/src/explore/change.ts @@ -14,9 +14,9 @@ * Nothing here guesses at a file's role from its path or language. */ -import { E2EError } from '../internal/errors.ts'; +import { E2EError } from '@e2e-dev/core/lib/internal/errors'; import { GitFailure, runGit } from '../internal/git.ts'; -import { bound } from '../internal/text.ts'; +import { bound } from '@e2e-dev/core/lib/internal/text'; import type { ReportExploreChange } from '../report/build.ts'; import { findChanges } from '../run/changes.ts'; diff --git a/packages/e2e/src/explore/executor.ts b/packages/e2e/src/explore/executor.ts index fd7fc225c0..e44353e901 100644 --- a/packages/e2e/src/explore/executor.ts +++ b/packages/e2e/src/explore/executor.ts @@ -8,9 +8,9 @@ import type { ToolExecutionOptions } from 'ai'; import { z } from 'zod'; -import type { ResolvedAgentConfig } from '../config/agent.ts'; -import { defineTool, getToolContext, type DefinedTool } from '../agent/tool.ts'; -import type { AgentConfig } from '../types.ts'; +import type { ResolvedAgentConfig } from '@e2e-dev/core/lib/config/agent'; +import { defineTool, getToolContext, type DefinedTool } from '@e2e-dev/core/lib/agent/tool'; +import type { AgentConfig } from '@e2e-dev/core/lib/types'; import type { ExploreState } from './state.ts'; export const FINDING_TOOL_NAME = 'report_finding'; diff --git a/packages/e2e/src/explore/index.ts b/packages/e2e/src/explore/index.ts index b2c1517ac7..33779e0f01 100644 --- a/packages/e2e/src/explore/index.ts +++ b/packages/e2e/src/explore/index.ts @@ -8,22 +8,22 @@ * rides along as `run.explore`. */ -import { MAX_PARAMS_BYTES } from '../agent/act-validation.ts'; +import { MAX_PARAMS_BYTES } from '@e2e-dev/core/lib/agent/act-validation'; import type { ModuleRegistration, RegisteredTest } from '../collect/registry.ts'; import { selectTargets } from '../collect/select.ts'; import { discoverConfig, loadConfigModule, missingConfigError } from '../config/load.ts'; -import { missingModelError, resolveAgentConfig } from '../config/agent.ts'; -import { type ResolvedConfig, type ResolvedCredential, type ResolvedTarget } from '../config/resolve.ts'; +import { missingModelError, resolveAgentConfig } from '@e2e-dev/core/lib/config/agent'; +import { type ResolvedConfig, type ResolvedCredential, type ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../config/resolve-run.ts'; -import { launchesPinnedApp } from '../config/targets.ts'; -import { ConfigurationError } from '../internal/errors.ts'; +import { launchesPinnedApp } from '@e2e-dev/core/lib/config/targets'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; import type { ReportExplore } from '../report/build.ts'; import { validateChangedSince } from '../run/changes.ts'; import type { RunEventSink } from '../run/events.ts'; import type { RunnerOutput } from '../run/process-output.ts'; import { run, type RunOutcome } from '../run/runner.ts'; -import { registerStaticSecrets, staticSecretLedger } from '../run/secrecy.ts'; -import type { AgentConfig, RecordingMode } from '../types.ts'; +import { registerStaticSecrets, staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; +import type { AgentConfig, RecordingMode } from '@e2e-dev/core/lib/types'; import type { BuiltinReporter, E2EConfig } from '../run-types.ts'; import { createExploreBody } from './body.ts'; import { STEP_BOUNDS, TIMEOUT_BOUNDS } from './bounds.ts'; diff --git a/packages/e2e/src/explore/plan.ts b/packages/e2e/src/explore/plan.ts index 3ee0caa2ce..c8870ccc88 100644 --- a/packages/e2e/src/explore/plan.ts +++ b/packages/e2e/src/explore/plan.ts @@ -7,7 +7,7 @@ import { z } from 'zod'; import type { ReportExploreStep } from '../report/build.ts'; -import type { Agent } from '../types.ts'; +import type { Agent } from '@e2e-dev/core/lib/types'; import { MAX_TITLE_CHARS, type ExploreState } from './state.ts'; const MIN_SUMMARY_CHARS = 10; diff --git a/packages/e2e/src/explore/state.ts b/packages/e2e/src/explore/state.ts index 9ec85c1185..3ba4b2a57f 100644 --- a/packages/e2e/src/explore/state.ts +++ b/packages/e2e/src/explore/state.ts @@ -9,7 +9,7 @@ * listeners `subscribe` registered, as `ExploreProgress`. */ -import { timestamp, uuidv7 } from '../internal/ids.ts'; +import { timestamp, uuidv7 } from '@e2e-dev/core/lib/internal/ids'; import type { ReportExplore, ReportExploreChange, ReportExploreFinding, ReportExploreStep } from '../report/build.ts'; import type { ExploreBudgets, ExploreListener, ExploreProgress, OpenedStep } from './progress.ts'; diff --git a/packages/e2e/src/index.ts b/packages/e2e/src/index.ts index cde33aec38..7f59b0f0e3 100644 --- a/packages/e2e/src/index.ts +++ b/packages/e2e/src/index.ts @@ -2,15 +2,15 @@ export { afterAll, afterEach, beforeAll, beforeEach, describe, test } from './collect/registry.ts'; export { expect } from './expect/index.ts'; -export { credentials, secrets } from './secrets.ts'; -export { unique } from './params.ts'; -export { AgentError, isAgentError } from './agent/error.ts'; +export { credentials, secrets } from '@e2e-dev/core/lib/secrets'; +export { unique } from '@e2e-dev/core/lib/params'; +export { AgentError, isAgentError } from '@e2e-dev/core/lib/agent/error'; // The markdown page the `markdown` reporter writes, for a reporter that posts // it elsewhere: @e2e-dev/github renders the pull request comment from it. export { renderMarkdownReport } from './report/markdown.ts'; export type { MarkdownReportOptions } from './report/markdown.ts'; -export type * from './types.ts'; +export type * from '@e2e-dev/core/lib/types'; export type * from './run-types.ts'; export type { ExecutorActions, @@ -35,7 +35,7 @@ export type { StepExecutorContext, StepVerdict, StepVerdictStatus, -} from './agent/executor.ts'; -export type { StepTurn, VisionDegradation } from './run/steps.ts'; +} from '@e2e-dev/core/lib/agent/executor'; +export type { StepTurn, VisionDegradation } from '@e2e-dev/core/lib/run/steps'; export type { RunEvent, RunEventOf, RunExitCode, RunStatus } from './run/events.ts'; -export type { EngineAppDeclaration } from './engine/index.ts'; +export type { EngineAppDeclaration } from '@e2e-dev/core/lib/engine/index'; diff --git a/packages/e2e/src/internal/package-manager.ts b/packages/e2e/src/internal/package-manager.ts index 2b22f2cee3..0e084e3bf1 100644 --- a/packages/e2e/src/internal/package-manager.ts +++ b/packages/e2e/src/internal/package-manager.ts @@ -2,8 +2,8 @@ import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; -import { compileGlob, matchesGlob } from './globs.ts'; -import { isPlainObject } from './options.ts'; +import { compileGlob, matchesGlob } from '@e2e-dev/core/lib/internal/globs'; +import { isPlainObject } from '@e2e-dev/core/lib/internal/options'; export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun'; diff --git a/packages/e2e/src/internal/skip.ts b/packages/e2e/src/internal/skip.ts index 37933a5dec..5784dc0742 100644 --- a/packages/e2e/src/internal/skip.ts +++ b/packages/e2e/src/internal/skip.ts @@ -8,8 +8,8 @@ * `dist` next to a runner on `src`, or a nested install). */ -import { currentAttempt } from '../expect/attempt.ts'; -import { CollectionError, TestError } from './errors.ts'; +import { currentAttempt } from '@e2e-dev/core/lib/expect/attempt'; +import { CollectionError, TestError } from '@e2e-dev/core/lib/internal/errors'; const runtimeSkipBrand: unique symbol = Symbol.for('e2e.runtimeSkip.v1'); diff --git a/packages/e2e/src/mcp/app-lines.ts b/packages/e2e/src/mcp/app-lines.ts index 1c296d9976..d661ec240f 100644 --- a/packages/e2e/src/mcp/app-lines.ts +++ b/packages/e2e/src/mcp/app-lines.ts @@ -6,10 +6,10 @@ * without values, and the readiness URL loses userinfo and query. */ -import type { ResolvedTarget } from '../config/resolve.ts'; -import { launchesPinnedApp } from '../config/targets.ts'; -import { printableUrl } from '../internal/urls.ts'; -import type { CommandConfig } from '../types.ts'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { launchesPinnedApp } from '@e2e-dev/core/lib/config/targets'; +import { printableUrl } from '@e2e-dev/core/lib/internal/urls'; +import type { CommandConfig } from '@e2e-dev/core/lib/types'; /** * The `App:` and `Process:` lines for a session on `target`. `ranTest` is diff --git a/packages/e2e/src/mcp/catalog.ts b/packages/e2e/src/mcp/catalog.ts index 049750b612..15e9d617d9 100644 --- a/packages/e2e/src/mcp/catalog.ts +++ b/packages/e2e/src/mcp/catalog.ts @@ -18,18 +18,18 @@ import { copyFileSync, mkdirSync, rmSync } from 'node:fs'; import path from 'node:path'; import type { ToolSet } from 'ai'; import { z } from 'zod'; -import { projectTools } from '../agent/default-agent.ts'; -import type { ExecutorNode, StepExecutorContext } from '../agent/executor.ts'; -import { projectTree, redactNode, type NodeRedaction } from '../agent/observation.ts'; -import { GRAMMAR_TOOL_NAMES } from '../agent/action-names.ts'; -import { grammarTools } from '../agent/primitives.ts'; -import type { ScreenPresenter } from '../agent/screen-update.ts'; -import type { LocatorExpression, SemanticNode, TargetSession } from '../engine/surface.ts'; -import { ConfigurationError } from '../internal/errors.ts'; -import { relativeToProjectRoot } from '../internal/paths.ts'; -import { describeExpression, roleQuery, testIdQuery, textQuery } from '../locator/expression.ts'; -import type { LocatorEngine } from '../locator/engine.ts'; -import type { AgentTool, Role } from '../types.ts'; +import { projectTools } from '@e2e-dev/core/lib/agent/default-agent'; +import type { ExecutorNode, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; +import { projectTree, redactNode, type NodeRedaction } from '@e2e-dev/core/lib/agent/observation'; +import { GRAMMAR_TOOL_NAMES } from '@e2e-dev/core/lib/agent/action-names'; +import { grammarTools } from '@e2e-dev/core/lib/agent/primitives'; +import type { ScreenPresenter } from '@e2e-dev/core/lib/agent/screen-update'; +import type { LocatorExpression, SemanticNode, TargetSession } from '@e2e-dev/core/lib/engine/surface'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; +import { relativeToProjectRoot } from '@e2e-dev/core/lib/internal/paths'; +import { describeExpression, roleQuery, testIdQuery, textQuery } from '@e2e-dev/core/lib/locator/expression'; +import type { LocatorEngine } from '@e2e-dev/core/lib/locator/engine'; +import type { AgentTool, Role } from '@e2e-dev/core/lib/types'; import { recordingTools, type SessionRecorder } from './recording.ts'; import { SessionTestLines, type TestLineFills } from './test-lines.ts'; import { runCodeTool, type RunCodeSession } from './run-code.ts'; diff --git a/packages/e2e/src/mcp/code-parse.ts b/packages/e2e/src/mcp/code-parse.ts index 9a4eef3ec7..8f3013ea17 100644 --- a/packages/e2e/src/mcp/code-parse.ts +++ b/packages/e2e/src/mcp/code-parse.ts @@ -14,8 +14,8 @@ import type { Argument, CallExpression, Directive, Expression, MemberExpression, Node, ObjectExpression, PropertyKey, Span, Statement as SourceStatement } from 'oxc-parser'; import { oxcParser } from '../config/typescript.ts'; -import { ConfigurationError } from '../internal/errors.ts'; -import { suggest } from '../internal/suggest.ts'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; +import { suggest } from '@e2e-dev/core/lib/internal/suggest'; import { LEFT_OUT, RECEIVER_LABELS, SURFACE, type Arity, type Member, type Receiver } from './code-surface.ts'; /** diff --git a/packages/e2e/src/mcp/code-surface.ts b/packages/e2e/src/mcp/code-surface.ts index a3b228310a..4e945c134c 100644 --- a/packages/e2e/src/mcp/code-surface.ts +++ b/packages/e2e/src/mcp/code-surface.ts @@ -10,7 +10,7 @@ * members. */ -import type { App, AsyncExpectation, Locator, Screen } from '../types.ts'; +import type { App, AsyncExpectation, Locator, Screen } from '@e2e-dev/core/lib/types'; /** Something a statement can call members on. */ export type Receiver = 'screen' | 'locator' | 'app' | 'locator-expectation'; diff --git a/packages/e2e/src/mcp/config.ts b/packages/e2e/src/mcp/config.ts index 1592f1d3fb..8b2ba1701e 100644 --- a/packages/e2e/src/mcp/config.ts +++ b/packages/e2e/src/mcp/config.ts @@ -2,10 +2,10 @@ import path from 'node:path'; import { discoverConfig, loadConfigModule, missingConfigError } from '../config/load.ts'; -import { type ResolvedConfig } from '../config/resolve.ts'; +import { type ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../config/resolve-run.ts'; -import { ConfigurationError } from '../internal/errors.ts'; -import type { TargetApp } from '../types.ts'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; +import type { TargetApp } from '@e2e-dev/core/lib/types'; import { loadEngine, type EngineLookup, type FactoryRef } from './default-engine.ts'; export interface ProjectOptions { diff --git a/packages/e2e/src/mcp/default-engine.ts b/packages/e2e/src/mcp/default-engine.ts index 4931780300..b8ab7d6043 100644 --- a/packages/e2e/src/mcp/default-engine.ts +++ b/packages/e2e/src/mcp/default-engine.ts @@ -12,9 +12,9 @@ import { createRequire, isBuiltin } from 'node:module'; import os from 'node:os'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; -import { ENGINE_SPI_VERSION } from '../engine/contract.ts'; -import { isEngineHandle, type EngineHandle } from '../engine/index.ts'; -import { ConfigurationError, errorMessage, isE2EError } from '../internal/errors.ts'; +import { ENGINE_SPI_VERSION } from '@e2e-dev/core/lib/engine/contract'; +import { isEngineHandle, type EngineHandle } from '@e2e-dev/core/lib/engine/index'; +import { ConfigurationError, errorMessage, isE2EError } from '@e2e-dev/core/lib/internal/errors'; /** npm's package name grammar with an optional subpath, so a path, a URL, or a `..` segment is never resolved. */ const PACKAGE = /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*(?:\/[A-Za-z0-9][A-Za-z0-9._~-]*)*$/; diff --git a/packages/e2e/src/mcp/output.ts b/packages/e2e/src/mcp/output.ts index c32cc63996..0b03613865 100644 --- a/packages/e2e/src/mcp/output.ts +++ b/packages/e2e/src/mcp/output.ts @@ -8,7 +8,7 @@ */ import { StringDecoder } from 'node:string_decoder'; -import { StreamRedactor, type SecretLedger } from '../internal/redact.ts'; +import { StreamRedactor, type SecretLedger } from '@e2e-dev/core/lib/internal/redact'; export type OutputStream = 'stdout' | 'stderr'; diff --git a/packages/e2e/src/mcp/recording.ts b/packages/e2e/src/mcp/recording.ts index 37bd84b3c0..f1968c0628 100644 --- a/packages/e2e/src/mcp/recording.ts +++ b/packages/e2e/src/mcp/recording.ts @@ -13,7 +13,7 @@ import { existsSync, mkdirSync, renameSync } from 'node:fs'; import path from 'node:path'; import type { ToolSet } from 'ai'; import { z } from 'zod'; -import type { OperationContext, VideoSegment } from '../engine/surface.ts'; +import type { OperationContext, VideoSegment } from '@e2e-dev/core/lib/engine/surface'; export interface SessionRecorderOptions { /** The engine's video hooks. */ diff --git a/packages/e2e/src/mcp/run-code.ts b/packages/e2e/src/mcp/run-code.ts index e64a0254e7..f2b9a69a93 100644 --- a/packages/e2e/src/mcp/run-code.ts +++ b/packages/e2e/src/mcp/run-code.ts @@ -21,21 +21,21 @@ import type { ToolExecutionOptions, ToolSet } from 'ai'; import { z } from 'zod'; -import type { StepExecutorContext } from '../agent/executor.ts'; -import { redactNode, type NodeRedaction } from '../agent/observation.ts'; -import { recordPolicyEvent } from '../agent/phases.ts'; -import type { ScreenPresenter } from '../agent/screen-update.ts'; -import { authorizeSecretFill } from '../agent/secrets.ts'; -import type { TargetSession } from '../engine/surface.ts'; +import type { StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; +import { redactNode, type NodeRedaction } from '@e2e-dev/core/lib/agent/observation'; +import { recordPolicyEvent } from '@e2e-dev/core/lib/agent/phases'; +import type { ScreenPresenter } from '@e2e-dev/core/lib/agent/screen-update'; +import { authorizeSecretFill } from '@e2e-dev/core/lib/agent/secrets'; +import type { TargetSession } from '@e2e-dev/core/lib/engine/surface'; import { createAsyncExpectation } from '../expect/async.ts'; -import { classifyError, codedMessage, ConfigurationError, TestError, type E2EError } from '../internal/errors.ts'; -import { isPlainObject, rejectUnknownOptions } from '../internal/options.ts'; -import { describeExpression } from '../locator/expression.ts'; -import { createScreen, locatorInternals, type LocatorInternals } from '../locator/screen.ts'; -import { createScreenContext } from '../run/fixtures.ts'; -import type { StandaloneAttempt } from '../run/standalone-attempt.ts'; -import { secretHandle } from '../secrets.ts'; -import type { App, Screen, Secret } from '../types.ts'; +import { classifyError, codedMessage, ConfigurationError, TestError, type E2EError } from '@e2e-dev/core/lib/internal/errors'; +import { isPlainObject, rejectUnknownOptions } from '@e2e-dev/core/lib/internal/options'; +import { describeExpression } from '@e2e-dev/core/lib/locator/expression'; +import { createScreen, locatorInternals, type LocatorInternals } from '@e2e-dev/core/lib/locator/screen'; +import { createScreenContext } from '@e2e-dev/core/lib/run/fixtures'; +import type { StandaloneAttempt } from '@e2e-dev/core/lib/run/standalone-attempt'; +import { secretHandle } from '@e2e-dev/core/lib/secrets'; +import type { App, Screen, Secret } from '@e2e-dev/core/lib/types'; import { parseCode, type Call, type Chain, type Statement, type Value } from './code-parse.ts'; import { SURFACE } from './code-surface.ts'; diff --git a/packages/e2e/src/mcp/run-tests.ts b/packages/e2e/src/mcp/run-tests.ts index 396ef35535..acd68a8aa7 100644 --- a/packages/e2e/src/mcp/run-tests.ts +++ b/packages/e2e/src/mcp/run-tests.ts @@ -14,8 +14,8 @@ import { existsSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { z } from 'zod'; import { EXIT_CODES } from '../cli/exit-codes.ts'; -import { ConfigurationError, InfrastructureError } from '../internal/errors.ts'; -import { MAX_TIMER_MS } from '../internal/time.ts'; +import { ConfigurationError, InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { MAX_TIMER_MS } from '@e2e-dev/core/lib/internal/time'; import { defineMcpTool, redacting, type McpToolResult, type McpToolSpec } from './tools.ts'; /** How long each rung of the CLI's Ctrl-C ladder (interrupt, force, exit) waits before the next, and the kill after the last. */ diff --git a/packages/e2e/src/mcp/server.ts b/packages/e2e/src/mcp/server.ts index 71e9db6117..94dbed29ec 100644 --- a/packages/e2e/src/mcp/server.ts +++ b/packages/e2e/src/mcp/server.ts @@ -12,8 +12,8 @@ import type { Readable, Writable } from 'node:stream'; import { McpServer, ResourceTemplate } from '@modelcontextprotocol/server'; import { StdioServerTransport } from '@modelcontextprotocol/server/stdio'; import { readGuide, skillTopics } from '../cli/skill.ts'; -import { ConfigurationError, errorMessage } from '../internal/errors.ts'; -import { processSecrets } from '../run/secrecy.ts'; +import { ConfigurationError, errorMessage } from '@e2e-dev/core/lib/internal/errors'; +import { processSecrets } from '@e2e-dev/core/lib/run/secrecy'; import { loadEngineConfig, loadProjectConfig, locateProjectConfig } from './config.ts'; import { userEnginesDir } from './default-engine.ts'; import type { McpOutput } from './output.ts'; diff --git a/packages/e2e/src/mcp/session.ts b/packages/e2e/src/mcp/session.ts index 9c984c9fa9..951cfaf551 100644 --- a/packages/e2e/src/mcp/session.ts +++ b/packages/e2e/src/mcp/session.ts @@ -14,23 +14,23 @@ */ import { z } from 'zod'; -import { loadAiSdkIfInstalled } from '../agent/ai-sdk.ts'; +import { loadAiSdkIfInstalled } from '@e2e-dev/core/lib/agent/ai-sdk'; import { openInteractiveStep, type InteractiveStep } from '../agent/interactive-step.ts'; -import { ScreenPresenter } from '../agent/screen-update.ts'; -import type { ResolvedConfig, ResolvedTarget } from '../config/resolve.ts'; -import { launchesPinnedApp } from '../config/targets.ts'; -import { secretHandle } from '../secrets.ts'; -import { classifyError, ConfigurationError, errorMessage, InfrastructureError, type SerializedError } from '../internal/errors.ts'; -import { LocatorEngine } from '../locator/engine.ts'; +import { ScreenPresenter } from '@e2e-dev/core/lib/agent/screen-update'; +import type { ResolvedConfig, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { launchesPinnedApp } from '@e2e-dev/core/lib/config/targets'; +import { secretHandle } from '@e2e-dev/core/lib/secrets'; +import { classifyError, ConfigurationError, errorMessage, InfrastructureError, type SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { LocatorEngine } from '@e2e-dev/core/lib/locator/engine'; import { allocateTargetPorts } from '../run/app-ports.ts'; import { selectTarget } from '../run/select-target.ts'; -import { SharedAppProcesses } from '../run/process-pool.ts'; -import { outputLayout } from '../run/output.ts'; -import { processSecrets, registerStaticSecrets } from '../run/secrecy.ts'; +import { SharedAppProcesses } from '@e2e-dev/core/lib/run/process-pool'; +import { outputLayout } from '@e2e-dev/core/lib/run/output'; +import { processSecrets, registerStaticSecrets } from '@e2e-dev/core/lib/run/secrecy'; import { openStandaloneAttempt, type OneShotAttempt } from '../run/standalone-kinds.ts'; -import type { StandaloneAttempt } from '../run/standalone-attempt.ts'; +import type { StandaloneAttempt } from '@e2e-dev/core/lib/run/standalone-attempt'; import { selectStandaloneTest, testLocation } from '../run/standalone-test.ts'; -import type { AgentParams } from '../types.ts'; +import type { AgentParams } from '@e2e-dev/core/lib/types'; import { createSessionCatalog, isGrammarVerb, type SessionCatalog } from './catalog.ts'; import { appLines } from './app-lines.ts'; import { SESSION_BOUNDS } from './bounds.ts'; diff --git a/packages/e2e/src/mcp/sessions.ts b/packages/e2e/src/mcp/sessions.ts index 396ea0f795..1ee65396c0 100644 --- a/packages/e2e/src/mcp/sessions.ts +++ b/packages/e2e/src/mcp/sessions.ts @@ -8,9 +8,9 @@ * and closing it, belongs to the host; this module only orders it. */ -import type { EngineHandle } from '../engine/index.ts'; -import { ConfigurationError } from '../internal/errors.ts'; -import { uuidv7 } from '../internal/ids.ts'; +import type { EngineHandle } from '@e2e-dev/core/lib/engine/index'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; +import { uuidv7 } from '@e2e-dev/core/lib/internal/ids'; /** How many ended sessions keep the reason they ended, for the error a call naming one gets. */ const ENDED_KEPT = 32; diff --git a/packages/e2e/src/mcp/test-lines.ts b/packages/e2e/src/mcp/test-lines.ts index 5c59c43000..28f4b17c98 100644 --- a/packages/e2e/src/mcp/test-lines.ts +++ b/packages/e2e/src/mcp/test-lines.ts @@ -19,16 +19,16 @@ import type { ToolSet } from 'ai'; import { z } from 'zod'; -import type { ExecutorNode, ExecutorObservation, ExecutorObserveOptions, StepExecutorContext } from '../agent/executor.ts'; -import { isFailedResult } from '../agent/loop-guards.ts'; -import { typedThroughKeyboard } from '../agent/primitives.ts'; -import { SAMPLE_PREFIX } from '../agent/sample-files.ts'; -import type { ScreenOutput } from '../agent/screen-update.ts'; -import type { LocatorExpression, NodeRef, SemanticNode } from '../engine/surface.ts'; -import { codedMessage, InfrastructureError } from '../internal/errors.ts'; -import { collapseText } from '../internal/text.ts'; -import { filterExpression, indexExpression } from '../locator/expression.ts'; -import type { Role } from '../types.ts'; +import type { ExecutorNode, ExecutorObservation, ExecutorObserveOptions, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; +import { isFailedResult } from '@e2e-dev/core/lib/agent/loop-guards'; +import { typedThroughKeyboard } from '@e2e-dev/core/lib/agent/primitives'; +import { SAMPLE_PREFIX } from '@e2e-dev/core/lib/agent/sample-files'; +import type { ScreenOutput } from '@e2e-dev/core/lib/agent/screen-update'; +import type { LocatorExpression, NodeRef, SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { codedMessage, InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { collapseText } from '@e2e-dev/core/lib/internal/text'; +import { filterExpression, indexExpression } from '@e2e-dev/core/lib/locator/expression'; +import type { Role } from '@e2e-dev/core/lib/types'; /** Matches read per locator while looking for the target among them. */ const MAX_READ_MATCHES = 50; diff --git a/packages/e2e/src/mcp/test-outcome.ts b/packages/e2e/src/mcp/test-outcome.ts index aa187914a3..22edf446d8 100644 --- a/packages/e2e/src/mcp/test-outcome.ts +++ b/packages/e2e/src/mcp/test-outcome.ts @@ -11,7 +11,7 @@ import { codeFrame } from '../report/code-frame.ts'; import { formatTime } from '../report/format.ts'; import { plural } from '../report/markdown-text.ts'; import { testLocation, type StandaloneTest, type StandaloneTestOutcome } from '../run/standalone-test.ts'; -import type { StepRecord } from '../run/steps.ts'; +import type { StepRecord } from '@e2e-dev/core/lib/run/steps'; const plain = picocolors.createColors(false); /** Steps the text lists; a longer run shows its last ones, where it stopped. */ diff --git a/packages/e2e/src/mcp/tools.ts b/packages/e2e/src/mcp/tools.ts index a9ce3ba098..b1442e17f1 100644 --- a/packages/e2e/src/mcp/tools.ts +++ b/packages/e2e/src/mcp/tools.ts @@ -17,12 +17,12 @@ import type { JSONSchema7, Tool, ToolExecutionOptions, ToolSet } from 'ai'; import type { z } from 'zod'; -import { loadAiSdk, loadAiSdkIfInstalled, loadedAiSdk } from '../agent/ai-sdk.ts'; -import { isFailedResult } from '../agent/loop-guards.ts'; -import { codedMessage, ConfigurationError, errorMessage, InfrastructureError } from '../internal/errors.ts'; -import { describeIssue } from '../internal/standard-schema.ts'; -import { processSecrets } from '../run/secrecy.ts'; -import type { StandardSchemaV1 } from '../types.ts'; +import { loadAiSdk, loadAiSdkIfInstalled, loadedAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { isFailedResult } from '@e2e-dev/core/lib/agent/loop-guards'; +import { codedMessage, ConfigurationError, errorMessage, InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { describeIssue } from '@e2e-dev/core/lib/internal/standard-schema'; +import { processSecrets } from '@e2e-dev/core/lib/run/secrecy'; +import type { StandardSchemaV1 } from '@e2e-dev/core/lib/types'; /** One MCP content part this server emits. */ export type McpContent = diff --git a/packages/e2e/src/oauth/chatgpt.ts b/packages/e2e/src/oauth/chatgpt.ts index 51ad639bfd..ccc982cf0b 100644 --- a/packages/e2e/src/oauth/chatgpt.ts +++ b/packages/e2e/src/oauth/chatgpt.ts @@ -9,7 +9,7 @@ import { createOpenAI } from '@ai-sdk/openai'; import type { LanguageModelV4 } from '@ai-sdk/provider'; import { createOAuthFetch } from './fetch.ts'; import { withLogin } from './login-model.ts'; -import { USER_AGENT } from '../internal/client-identity.ts'; +import { USER_AGENT } from '@e2e-dev/core/lib/internal/client-identity'; import { loginHint } from './providers.ts'; import { createCodexProvider } from './providers/openai.ts'; import { withoutServerStorage } from './responses.ts'; diff --git a/packages/e2e/src/oauth/cli.ts b/packages/e2e/src/oauth/cli.ts index 77035eabf0..6b74d46803 100644 --- a/packages/e2e/src/oauth/cli.ts +++ b/packages/e2e/src/oauth/cli.ts @@ -7,7 +7,7 @@ import { spawn } from 'node:child_process'; import * as clack from '@clack/prompts'; import pc from 'picocolors'; -import { sanitizeText } from '../internal/errors.ts'; +import { sanitizeText } from '@e2e-dev/core/lib/internal/errors'; import { browserCommand } from './browser.ts'; import { OAuthError } from './errors.ts'; import { login, logout } from './login.ts'; diff --git a/packages/e2e/src/oauth/copilot.ts b/packages/e2e/src/oauth/copilot.ts index c468678cbe..5c0edfb1c6 100644 --- a/packages/e2e/src/oauth/copilot.ts +++ b/packages/e2e/src/oauth/copilot.ts @@ -12,8 +12,8 @@ import type { LanguageModelV4 } from '@ai-sdk/provider'; import { OAuthError } from './errors.ts'; import { createOAuthFetch } from './fetch.ts'; import { withLogin } from './login-model.ts'; -import { USER_AGENT } from '../internal/client-identity.ts'; -import { markUnservedModel } from '../internal/unserved-model.ts'; +import { USER_AGENT } from '@e2e-dev/core/lib/internal/client-identity'; +import { markUnservedModel } from '@e2e-dev/core/lib/internal/unserved-model'; import { loginHint } from './providers.ts'; import { COPILOT_API_URL, copilotProtocolFor, copilotRefusal, createCopilotProvider, isCopilotRefusal, type CopilotProtocol } from './providers/github-copilot.ts'; import { withoutServerStorage } from './responses.ts'; diff --git a/packages/e2e/src/oauth/fetch.ts b/packages/e2e/src/oauth/fetch.ts index eb794d2f3e..81cb9ea8e3 100644 --- a/packages/e2e/src/oauth/fetch.ts +++ b/packages/e2e/src/oauth/fetch.ts @@ -8,7 +8,7 @@ * rotate refresh tokens reject the second concurrent refresh. */ -import { withAbort } from '../internal/time.ts'; +import { withAbort } from '@e2e-dev/core/lib/internal/time'; import { OAuthError, describeResponse } from './errors.ts'; import type { CredentialStore, FetchFunction, OAuthCredentials, OAuthProvider } from './types.ts'; diff --git a/packages/e2e/src/oauth/grok.ts b/packages/e2e/src/oauth/grok.ts index ca6ef5acd6..f5cf28fd56 100644 --- a/packages/e2e/src/oauth/grok.ts +++ b/packages/e2e/src/oauth/grok.ts @@ -8,7 +8,7 @@ import type { LanguageModelV4 } from '@ai-sdk/provider'; import { createXai } from '@ai-sdk/xai'; import { createOAuthFetch } from './fetch.ts'; import { withLogin } from './login-model.ts'; -import { USER_AGENT } from '../internal/client-identity.ts'; +import { USER_AGENT } from '@e2e-dev/core/lib/internal/client-identity'; import { loginHint } from './providers.ts'; import { createXaiProvider } from './providers/xai.ts'; import { defaultCredentialStore } from './store.ts'; diff --git a/packages/e2e/src/oauth/login-model.ts b/packages/e2e/src/oauth/login-model.ts index 58262ac941..74c1d57092 100644 --- a/packages/e2e/src/oauth/login-model.ts +++ b/packages/e2e/src/oauth/login-model.ts @@ -4,7 +4,7 @@ * A registry symbol, not module state: the config may load its own copy of e2e. */ -import { realmSlot } from '../internal/realm-slot.ts'; +import { realmSlot } from '@e2e-dev/core/lib/internal/realm-slot'; import type { ProviderId } from './providers.ts'; const loginSlot = realmSlot('e2e.oauth.login.v1'); diff --git a/packages/e2e/src/oauth/models.ts b/packages/e2e/src/oauth/models.ts index 75eccbf854..574210fa1a 100644 --- a/packages/e2e/src/oauth/models.ts +++ b/packages/e2e/src/oauth/models.ts @@ -2,7 +2,7 @@ import { OAuthError } from './errors.ts'; import { createOAuthFetch } from './fetch.ts'; -import { USER_AGENT } from '../internal/client-identity.ts'; +import { USER_AGENT } from '@e2e-dev/core/lib/internal/client-identity'; import { credentialSource, getProvider, type ProviderId } from './providers.ts'; import type { CredentialStore, SubscriptionModel } from './types.ts'; diff --git a/packages/e2e/src/oauth/opencode-console.ts b/packages/e2e/src/oauth/opencode-console.ts index 7557585024..885af466b2 100644 --- a/packages/e2e/src/oauth/opencode-console.ts +++ b/packages/e2e/src/oauth/opencode-console.ts @@ -10,11 +10,11 @@ import { randomUUID } from 'node:crypto'; import { createOpenAICompatible } from '@ai-sdk/openai-compatible'; import type { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4Message } from '@ai-sdk/provider'; -import { promptCacheKey } from '../agent/model/provider-hints.ts'; +import { promptCacheKey } from '@e2e-dev/core/lib/agent/model/provider-hints'; import { OAuthError } from './errors.ts'; import { createOAuthFetch } from './fetch.ts'; import { withLogin } from './login-model.ts'; -import { USER_AGENT } from '../internal/client-identity.ts'; +import { USER_AGENT } from '@e2e-dev/core/lib/internal/client-identity'; import { credentialSource } from './providers.ts'; import { createOpencodeConsoleProvider, opencodeConsoleChatRoute, opencodeConsoleRouteFor, type OpencodeConsoleRoute } from './providers/opencode-console.ts'; import type { FetchFunction } from './types.ts'; diff --git a/packages/e2e/src/report/build.ts b/packages/e2e/src/report/build.ts index 8d660bcb30..4425fa314b 100644 --- a/packages/e2e/src/report/build.ts +++ b/packages/e2e/src/report/build.ts @@ -2,21 +2,21 @@ import os from 'node:os'; import path from 'node:path'; -import { BLOCKABLE_CODES } from '../agent/executor.ts'; -import { DEFAULT_LIMITS } from '../config/agent.ts'; -import type { ResolvedConfig, ResolvedLimits, ResolvedTarget } from '../config/resolve.ts'; -import type { AgentErrorCode } from '../types.ts'; -import type { ErrorCategory, ErrorDetails, ErrorPhase, HookScope, SerializedError } from '../internal/errors.ts'; -import { resultId, timestamp } from '../internal/ids.ts'; -import { obj } from '../internal/objects.ts'; -import { packageVersion } from '../internal/package-version.ts'; +import { BLOCKABLE_CODES } from '@e2e-dev/core/lib/agent/executor'; +import { DEFAULT_LIMITS } from '@e2e-dev/core/lib/config/agent'; +import type { ResolvedConfig, ResolvedLimits, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import type { AgentErrorCode } from '@e2e-dev/core/lib/types'; +import type { ErrorCategory, ErrorDetails, ErrorPhase, HookScope, SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { resultId, timestamp } from '@e2e-dev/core/lib/internal/ids'; +import { obj } from '@e2e-dev/core/lib/internal/objects'; +import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; import { onBun } from '../internal/runtime.ts'; -import { projectRelativePath } from '../internal/source.ts'; +import { projectRelativePath } from '@e2e-dev/core/lib/internal/source'; import type { VcsInfo } from '../internal/vcs.ts'; -import type { SkipInfo } from '../run/records.ts'; -import { expectedFailureOf, memberRan, someSkippedAfterFailure } from '../run/records.ts'; -import { describeTarget, type TargetProvenance } from '../run/provision.ts'; -import type { EngineSpiVersion } from '../engine/contract.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; +import { expectedFailureOf, memberRan, someSkippedAfterFailure } from '@e2e-dev/core/lib/run/records'; +import { describeTarget, type TargetProvenance } from '@e2e-dev/core/lib/run/provision'; +import type { EngineSpiVersion } from '@e2e-dev/core/lib/engine/contract'; import type { ArtifactRecord, AttemptRecord, @@ -26,7 +26,7 @@ import type { SerialAttemptRecord, SerialGroupRecord, SerialMemberRecord, -} from '../run/records.ts'; +} from '@e2e-dev/core/lib/run/records'; import type { AppLogRecord, StepCacheRecord, @@ -36,7 +36,7 @@ import type { StepRecord, StepTurn, VisionDegradation, -} from '../run/steps.ts'; +} from '@e2e-dev/core/lib/run/steps'; export interface ReportSource { file: string; diff --git a/packages/e2e/src/report/code-frame.ts b/packages/e2e/src/report/code-frame.ts index 49f0a4a7f9..c74c9a8762 100644 --- a/packages/e2e/src/report/code-frame.ts +++ b/packages/e2e/src/report/code-frame.ts @@ -5,7 +5,7 @@ */ import { readFileSync } from 'node:fs'; -import { userFrame, type StackFrame } from '../internal/source.ts'; +import { userFrame, type StackFrame } from '@e2e-dev/core/lib/internal/source'; import { bounded, fitColumns, terminalColumns, visibleWidth, type Colors } from './format.ts'; export { userFrame, type StackFrame }; diff --git a/packages/e2e/src/report/debug-steps.ts b/packages/e2e/src/report/debug-steps.ts index 79bd785049..9cf1e95e0d 100644 --- a/packages/e2e/src/report/debug-steps.ts +++ b/packages/e2e/src/report/debug-steps.ts @@ -5,9 +5,9 @@ * of what happened. */ -import { formatMs, table } from '../internal/debug.ts'; -import type { ResultRecord, SerialGroupRecord } from '../run/records.ts'; -import type { StepRecord } from '../run/steps.ts'; +import { formatMs, table } from '@e2e-dev/core/lib/internal/debug'; +import type { ResultRecord, SerialGroupRecord } from '@e2e-dev/core/lib/run/records'; +import type { StepRecord } from '@e2e-dev/core/lib/run/steps'; import { stepModelLabel } from './format.ts'; /** diff --git a/packages/e2e/src/report/failure-text.ts b/packages/e2e/src/report/failure-text.ts index a6d70da9e7..bfb3d1a737 100644 --- a/packages/e2e/src/report/failure-text.ts +++ b/packages/e2e/src/report/failure-text.ts @@ -9,10 +9,10 @@ */ import path from 'node:path'; -import { modelLabel } from '../config/agent.ts'; -import { isLoopbackHost } from '../internal/urls.ts'; -import type { AppLogSource } from '../engine/index.ts'; -import type { AppLogRecord, StepCacheInfo, StepCacheRecord, StepEvent, StepTurn } from '../run/steps.ts'; +import { modelLabel } from '@e2e-dev/core/lib/config/agent'; +import { isLoopbackHost } from '@e2e-dev/core/lib/internal/urls'; +import type { AppLogSource } from '@e2e-dev/core/lib/engine/index'; +import type { AppLogRecord, StepCacheInfo, StepCacheRecord, StepEvent, StepTurn } from '@e2e-dev/core/lib/run/steps'; import type { Report1Document, ReportError, ReportResult, ReportSource, ReportStep } from './build.ts'; import { cell, code, formatDuration, link, MAX_CELL_CHARS, MAX_ID_CHARS, MAX_LABEL_CHARS, MAX_PATH_CHARS, MAX_TITLE_CHARS, plural } from './markdown-text.ts'; import { repeatSuffix, STATUS_WORD } from './format.ts'; diff --git a/packages/e2e/src/report/format.ts b/packages/e2e/src/report/format.ts index 53b09815b4..f465ebf010 100644 --- a/packages/e2e/src/report/format.ts +++ b/packages/e2e/src/report/format.ts @@ -6,10 +6,10 @@ import { stripVTControlCharacters } from 'node:util'; import picocolors from 'picocolors'; -import type { CacheWrite } from '../cache/context.ts'; -import { sanitizeText, truncateUtf8 } from '../internal/errors.ts'; -import type { ResultStatus } from '../run/records.ts'; -import type { StepModelInfo, StepRecord } from '../run/steps.ts'; +import type { CacheWrite } from '@e2e-dev/core/lib/cache/context'; +import { sanitizeText, truncateUtf8 } from '@e2e-dev/core/lib/internal/errors'; +import type { ResultStatus } from '@e2e-dev/core/lib/run/records'; +import type { StepModelInfo, StepRecord } from '@e2e-dev/core/lib/run/steps'; /** A picocolors instance; the reporter decides whether it emits color. */ export type Colors = ReturnType; diff --git a/packages/e2e/src/report/junit.ts b/packages/e2e/src/report/junit.ts index 7df5df8164..20469d8a16 100644 --- a/packages/e2e/src/report/junit.ts +++ b/packages/e2e/src/report/junit.ts @@ -1,9 +1,9 @@ /** JUnit XML reporter: the report-1 document as `.e2e/junit.xml`. */ import path from 'node:path'; -import { envValue } from '../internal/env.ts'; -import { sanitizeText } from '../internal/errors.ts'; -import { realpathOfExisting, relativeToProjectRoot } from '../internal/paths.ts'; +import { envValue } from '@e2e-dev/core/lib/internal/env'; +import { sanitizeText } from '@e2e-dev/core/lib/internal/errors'; +import { realpathOfExisting, relativeToProjectRoot } from '@e2e-dev/core/lib/internal/paths'; import type { FinishedRun } from '../run-types.ts'; import type { Report1Document, ReportError, ReportResult, ReportSerialGroup } from './build.ts'; import { repeatSuffix } from './format.ts'; diff --git a/packages/e2e/src/report/left-out.ts b/packages/e2e/src/report/left-out.ts index e455a90c20..c46cbdd056 100644 --- a/packages/e2e/src/report/left-out.ts +++ b/packages/e2e/src/report/left-out.ts @@ -5,7 +5,7 @@ * or repeats counts once. */ -import type { SkipInfo } from '../run/records.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; /** How many tests each test filter left out of `results`, by its name in the order first seen. */ export function leftOutTests(results: Iterable<{ readonly testId: string; readonly skip?: SkipInfo | undefined }>): Map { diff --git a/packages/e2e/src/report/list-explore.ts b/packages/e2e/src/report/list-explore.ts index dfafb6043d..4fda0987a8 100644 --- a/packages/e2e/src/report/list-explore.ts +++ b/packages/e2e/src/report/list-explore.ts @@ -9,12 +9,12 @@ import path from 'node:path'; import type { ExploreBudgets, ExploreProgress, OpenedStep } from '../explore/progress.ts'; -import type { SerializedError } from '../internal/errors.ts'; -import { collapseText } from '../internal/text.ts'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { collapseText } from '@e2e-dev/core/lib/internal/text'; import type { ReportExplore, ReportExploreFinding, ReportExploreStep } from '../report/build.ts'; -import type { ArtifactRecord } from '../run/records.ts'; +import type { ArtifactRecord } from '@e2e-dev/core/lib/run/records'; import { ENDED_TEXT, orderFindings, SEVERITY_WORDS, stepCountParts } from './explore-text.ts'; -import type { StepEvent } from '../run/steps.ts'; +import type { StepEvent } from '@e2e-dev/core/lib/run/steps'; import { bounded, F_CHECK, diff --git a/packages/e2e/src/report/list-model.ts b/packages/e2e/src/report/list-model.ts index 09c26f8b48..faba86c903 100644 --- a/packages/e2e/src/report/list-model.ts +++ b/packages/e2e/src/report/list-model.ts @@ -4,11 +4,11 @@ * each consumer renders at its own indent and width when it prints. */ -import type { ResultStatus } from '../run/records.ts'; -import type { RecordedModel } from '../cache/trace.ts'; -import type { SerializedError } from '../internal/errors.ts'; +import type { ResultStatus } from '@e2e-dev/core/lib/run/records'; +import type { RecordedModel } from '@e2e-dev/core/lib/cache/trace'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; import type { StepPrompt } from '../run/step-hold.ts'; -import type { StepActivity, StepEvent, StepKind, StepProgress } from '../run/steps.ts'; +import type { StepActivity, StepEvent, StepKind, StepProgress } from '@e2e-dev/core/lib/run/steps'; import type { AiUsage } from './format.ts'; /** Step events worth a glance in the live window; polls and policy decisions stay quiet. */ diff --git a/packages/e2e/src/report/list-steps.ts b/packages/e2e/src/report/list-steps.ts index 6fc79f13ea..cd0523aed5 100644 --- a/packages/e2e/src/report/list-steps.ts +++ b/packages/e2e/src/report/list-steps.ts @@ -5,10 +5,10 @@ */ import type { HeldStep, StepPrompt } from '../run/step-hold.ts'; -import type { StepRecord } from '../run/steps.ts'; -import { modelLabel } from '../config/agent.ts'; -import { sanitizeText, truncateUtf8 } from '../internal/errors.ts'; -import { collapseText } from '../internal/text.ts'; +import type { StepRecord } from '@e2e-dev/core/lib/run/steps'; +import { modelLabel } from '@e2e-dev/core/lib/config/agent'; +import { sanitizeText, truncateUtf8 } from '@e2e-dev/core/lib/internal/errors'; +import { collapseText } from '@e2e-dev/core/lib/internal/text'; import { bounded, F_CHECK, diff --git a/packages/e2e/src/report/list.ts b/packages/e2e/src/report/list.ts index 81d6808a6d..fc2fbfa983 100644 --- a/packages/e2e/src/report/list.ts +++ b/packages/e2e/src/report/list.ts @@ -9,14 +9,14 @@ import path from 'node:path'; import picocolors from 'picocolors'; -import type { SkipInfo } from '../run/records.ts'; -import type { SerializedError } from '../internal/errors.ts'; -import { resultId } from '../internal/ids.ts'; -import { packageVersion } from '../internal/package-version.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; +import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; import type { RunEvent, RunEventFact, RunEventOf, RunEventResult, SetupStep } from '../run/events.ts'; import type { StepPrompt } from '../run/step-hold.ts'; -import type { AppLogRecord, StepRecord } from '../run/steps.ts'; -import { cleanupErrorsOf, expectedFailureOf, failureBeforeSkip, type ArtifactRecord, type AttemptRecord, type AttemptStatus, type FailureEvidence, type ResultStatus, type SerialGroupRecord } from '../run/records.ts'; +import type { AppLogRecord, StepRecord } from '@e2e-dev/core/lib/run/steps'; +import { cleanupErrorsOf, expectedFailureOf, failureBeforeSkip, type ArtifactRecord, type AttemptRecord, type AttemptStatus, type FailureEvidence, type ResultStatus, type SerialGroupRecord } from '@e2e-dev/core/lib/run/records'; import type { Reporter, ReporterSummary } from '../run-types.ts'; import { projectSource } from './build.ts'; import { codeFrame, userFrame } from './code-frame.ts'; diff --git a/packages/e2e/src/report/markdown-text.ts b/packages/e2e/src/report/markdown-text.ts index f53489ce51..9925617f6a 100644 --- a/packages/e2e/src/report/markdown-text.ts +++ b/packages/e2e/src/report/markdown-text.ts @@ -4,7 +4,7 @@ * so both treat what a test wrote the same way. */ -import { collapseText } from '../internal/text.ts'; +import { collapseText } from '@e2e-dev/core/lib/internal/text'; import { ellipsize, formatMinutes } from './format.ts'; /** Text widths, in code points. */ diff --git a/packages/e2e/src/report/markdown.ts b/packages/e2e/src/report/markdown.ts index 574eb661be..938693f468 100644 --- a/packages/e2e/src/report/markdown.ts +++ b/packages/e2e/src/report/markdown.ts @@ -20,7 +20,7 @@ */ import path from 'node:path'; -import { collapseText } from '../internal/text.ts'; +import { collapseText } from '@e2e-dev/core/lib/internal/text'; import type { Report1Document, ReportChanges, ReportError, ReportExplore, ReportExploreFinding, ReportFilter, ReportResult, ReportStep, ReportTarget } from './build.ts'; import { ENDED_TEXT, orderFindings, SEVERITY_WORDS, stepCountParts } from './explore-text.ts'; import { filterDecision, formatCost, formatTokens, repeatSuffix, shortCommit, statusBucket, tally, type Counters } from './format.ts'; diff --git a/packages/e2e/src/report/outcome.ts b/packages/e2e/src/report/outcome.ts index 5dd497276a..117f36f24e 100644 --- a/packages/e2e/src/report/outcome.ts +++ b/packages/e2e/src/report/outcome.ts @@ -6,9 +6,9 @@ * (JUnit, markdown) share this one reading. */ -import type { SkipInfo } from '../run/records.ts'; -import type { FailureEvidence } from '../run/records.ts'; -import type { AppLogRecord } from '../run/steps.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; +import type { FailureEvidence } from '@e2e-dev/core/lib/run/records'; +import type { AppLogRecord } from '@e2e-dev/core/lib/run/steps'; import { isCutSerialRetry } from '../run/retry.ts'; import type { ReportError, ReportResult, ReportSerialGroup, ReportStep } from './build.ts'; diff --git a/packages/e2e/src/report/traces.ts b/packages/e2e/src/report/traces.ts index 37bcc699bc..e7e0b63505 100644 --- a/packages/e2e/src/report/traces.ts +++ b/packages/e2e/src/report/traces.ts @@ -11,8 +11,8 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; -import { displayPath } from '../internal/paths.ts'; -import { resultSegment } from '../run/artifacts.ts'; +import { displayPath } from '@e2e-dev/core/lib/internal/paths'; +import { resultSegment } from '@e2e-dev/core/lib/run/artifacts'; import type { Report1Document, ReportExplore, ReportResult } from './build.ts'; import { renderTracePage } from './failure-text.ts'; import { outcome, type Outcome } from './outcome.ts'; diff --git a/packages/e2e/src/report/write.ts b/packages/e2e/src/report/write.ts index de8e2cfb3b..b38d7f8896 100644 --- a/packages/e2e/src/report/write.ts +++ b/packages/e2e/src/report/write.ts @@ -2,7 +2,7 @@ import { mkdirSync } from 'node:fs'; import path from 'node:path'; -import { writeFileAtomic } from '../internal/atomic-write.ts'; +import { writeFileAtomic } from '@e2e-dev/core/lib/internal/atomic-write'; import type { FinishedRun, Reporter } from '../run-types.ts'; /** Atomically writes one text document, creating the parent directory when it is missing. */ diff --git a/packages/e2e/src/run-types.ts b/packages/e2e/src/run-types.ts index 6fd23d8f48..4f4ca2c1d5 100644 --- a/packages/e2e/src/run-types.ts +++ b/packages/e2e/src/run-types.ts @@ -5,7 +5,7 @@ import type { RunEvent, RunExitCode, RunStatus } from './run/events.ts'; import type { Report1Document } from './report/build.ts'; -import type { ProjectConfig } from './types.ts'; +import type { ProjectConfig } from '@e2e-dev/core/lib/types'; /** The reporters the runner ships, named by id; each is a `Reporter` on the same contract. */ export type BuiltinReporter = 'list' | 'json' | 'junit' | 'markdown'; diff --git a/packages/e2e/src/run/app-ports.ts b/packages/e2e/src/run/app-ports.ts index 12ad4a27dc..3a774418c4 100644 --- a/packages/e2e/src/run/app-ports.ts +++ b/packages/e2e/src/run/app-ports.ts @@ -6,8 +6,8 @@ */ import net from 'node:net'; -import { assignPorts, type ResolvedConfig, type ResolvedTarget } from '../config/resolve.ts'; -import { ConfigurationError, errorMessage } from '../internal/errors.ts'; +import { assignPorts, type ResolvedConfig, type ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { ConfigurationError, errorMessage } from '@e2e-dev/core/lib/internal/errors'; /** * The config with a free port assigned to every target whose URL asked for diff --git a/packages/e2e/src/run/changes.ts b/packages/e2e/src/run/changes.ts index ed0b38e5b5..8438119c00 100644 --- a/packages/e2e/src/run/changes.ts +++ b/packages/e2e/src/run/changes.ts @@ -5,12 +5,12 @@ * `INVALID_CHANGED_SINCE`. */ -import { describeValue } from '../config/validate.ts'; -import { ConfigurationError, E2EError } from '../internal/errors.ts'; +import { describeValue } from '@e2e-dev/core/lib/config/validate'; +import { ConfigurationError, E2EError } from '@e2e-dev/core/lib/internal/errors'; import { COMMIT_HASH, GitFailure, runGit, type GitResult } from '../internal/git.ts'; -import { compareCodePoints } from '../internal/globs.ts'; -import { onDiskPath } from '../internal/paths.ts'; -import { budgetText } from '../internal/time.ts'; +import { compareCodePoints } from '@e2e-dev/core/lib/internal/globs'; +import { onDiskPath } from '@e2e-dev/core/lib/internal/paths'; +import { budgetText } from '@e2e-dev/core/lib/internal/time'; import { ellipsize } from '../report/format.ts'; import type { TestFilterChanges } from '../run-types.ts'; diff --git a/packages/e2e/src/run/events.ts b/packages/e2e/src/run/events.ts index 36d6d1c3ce..d9eae36255 100644 --- a/packages/e2e/src/run/events.ts +++ b/packages/e2e/src/run/events.ts @@ -19,11 +19,11 @@ */ import type { ExploreProgress } from '../explore/progress.ts'; -import { errorMessage, type SerializedError } from '../internal/errors.ts'; -import { timestamp } from '../internal/ids.ts'; +import { errorMessage, type SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { timestamp } from '@e2e-dev/core/lib/internal/ids'; import type { FilterOutcome } from '../report/build.ts'; -import { encodeResult, type ResultRecord, type SerialGroupRecord, type WireResultRecord } from './records.ts'; -import type { StepProgress } from './steps.ts'; +import { encodeResult, type ResultRecord, type SerialGroupRecord, type WireResultRecord } from '@e2e-dev/core/lib/run/records'; +import type { StepProgress } from '@e2e-dev/core/lib/run/steps'; /** The closed set of process exit codes a run can end with. */ export type RunExitCode = 0 | 1 | 2 | 3 | 4 | 130; diff --git a/packages/e2e/src/run/execute.ts b/packages/e2e/src/run/execute.ts index 06f525b15c..0679b4d344 100644 --- a/packages/e2e/src/run/execute.ts +++ b/packages/e2e/src/run/execute.ts @@ -1,31 +1,31 @@ /** Test-target execution engine. */ import path from 'node:path'; -import type { TargetSession } from '../engine/surface.ts'; -import type { ResolvedConfig } from '../config/resolve.ts'; -import { classifyError, ConfigurationError, E2EError, serializeError, sanitizeText, truncateUtf8, TestError, TestTimeoutError, type SerializedError } from '../internal/errors.ts'; +import type { TargetSession } from '@e2e-dev/core/lib/engine/surface'; +import type { ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; +import { classifyError, ConfigurationError, E2EError, serializeError, sanitizeText, truncateUtf8, TestError, TestTimeoutError, type SerializedError } from '@e2e-dev/core/lib/internal/errors'; import { isRuntimeSkip, type RuntimeSkip } from '../internal/skip.ts'; -import { lateExpectedFailureError } from '../internal/expected-failure.ts'; +import { lateExpectedFailureError } from '@e2e-dev/core/lib/internal/expected-failure'; import { settleExpectedFailure } from './expected-failure.ts'; -import type { ExecutorAttempt } from '../agent/executor.ts'; -import { isModelUnreachable } from '../agent/error.ts'; -import { withAiTraceScope } from '../internal/ai-trace.ts'; -import { resultId, timestamp, uuidv7 } from '../internal/ids.ts'; -import { Deadline, withAbort, withTimeout } from '../internal/time.ts'; -import { createAgentCacheContext, settleStagedTraces } from '../cache/context.ts'; -import { storedRecordingsFor, type StoredRecordings } from '../cache/rekeyed.ts'; +import type { ExecutorAttempt } from '@e2e-dev/core/lib/agent/executor'; +import { isModelUnreachable } from '@e2e-dev/core/lib/agent/error'; +import { withAiTraceScope } from '@e2e-dev/core/lib/internal/ai-trace'; +import { resultId, timestamp, uuidv7 } from '@e2e-dev/core/lib/internal/ids'; +import { Deadline, withAbort, withTimeout } from '@e2e-dev/core/lib/internal/time'; +import { createAgentCacheContext, settleStagedTraces } from '@e2e-dev/core/lib/cache/context'; +import { storedRecordingsFor, type StoredRecordings } from '@e2e-dev/core/lib/cache/rekeyed'; import type { ModuleRegistration, RegisteredTest } from '../collect/registry.ts'; import { pairRecordings, type TestTargetPair } from '../collect/select.ts'; -import type { ArtifactStore } from '../types.ts'; -import { attemptSegments, createAttemptArtifacts, resultSegment } from './artifacts.ts'; -import { AttemptBudget } from './budget.ts'; +import type { ArtifactStore } from '@e2e-dev/core/lib/types'; +import { attemptSegments, createAttemptArtifacts, resultSegment } from '@e2e-dev/core/lib/run/artifacts'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; import { createExtendedFixtures } from './extended-fixtures.ts'; import { captureFailureEvidence } from './failure-evidence.ts'; -import { createFixtures } from './fixtures.ts'; -import { WrittenScreenshots } from './screenshots.ts'; -import { publishAttempt } from '../expect/attempt.ts'; -import { PollScope, runInPollScope } from '../expect/poll-scope.ts'; -import { SoftFailures } from '../expect/soft.ts'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { WrittenScreenshots } from '@e2e-dev/core/lib/run/screenshots'; +import { publishAttempt } from '@e2e-dev/core/lib/expect/attempt'; +import { PollScope, runInPollScope } from '@e2e-dev/core/lib/expect/poll-scope'; +import { SoftFailures } from '@e2e-dev/core/lib/expect/soft'; import { findRegistered, RealmManager, runHook, type FileRef, type Realm } from './realm.ts'; import type { AttemptRecord, @@ -34,19 +34,19 @@ import type { RunError, SerialGroupRecord, SerialMemberRecord, -} from './records.ts'; -import { isFailedStatus, type SerialAttemptRecord } from './records.ts'; -import { traceScreen } from './step-screens.ts'; +} from '@e2e-dev/core/lib/run/records'; +import { isFailedStatus, type SerialAttemptRecord } from '@e2e-dev/core/lib/run/records'; +import { traceScreen } from '@e2e-dev/core/lib/run/step-screens'; import { runWithRetries } from './retry.ts'; import { runSerialUnit, type SerialAttemptStart, type SerialHost, type SharedSerialSession } from './serial.ts'; import { interruptedInPhase, interruptedSkip, pairKey, pairResult, unstartedResult } from './units.ts'; -import { carriedSecrets, processSecrets, redactForSession, sessionLedger, staticSecretLedger } from './secrecy.ts'; -import { SessionStaging } from './sessions.ts'; -import { StepRecorder, type StepHoldRequest, type StepProgress } from './steps.ts'; +import { carriedSecrets, processSecrets, redactForSession, sessionLedger, staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; +import { SessionStaging } from '@e2e-dev/core/lib/run/sessions'; +import { StepRecorder, type StepHoldRequest, type StepProgress } from '@e2e-dev/core/lib/run/steps'; import { AttemptHolds, type HeldStep } from './step-hold.ts'; -import { WorkerModels } from './worker-models.ts'; -import { classifyAttemptStatus, EngineSessions, type EngineSessionsOptions } from './engine-sessions.ts'; -import type { SetupFn } from '../types.ts'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; +import { classifyAttemptStatus, EngineSessions, type EngineSessionsOptions } from '@e2e-dev/core/lib/run/engine-sessions'; +import type { SetupFn } from '@e2e-dev/core/lib/types'; export interface ExecutionEvents { onResult?(result: ResultRecord): void; diff --git a/packages/e2e/src/run/expected-failure.ts b/packages/e2e/src/run/expected-failure.ts index 5381ade0d7..fadf3c84ed 100644 --- a/packages/e2e/src/run/expected-failure.ts +++ b/packages/e2e/src/run/expected-failure.ts @@ -8,11 +8,11 @@ * run, or a broken test. */ -import { BLOCKABLE_CODES } from '../agent/executor.ts'; -import { sanitizeText, TestError, truncateUtf8, type ErrorPhase, type SerializedError } from '../internal/errors.ts'; -import type { ExpectedFailureInfo } from '../internal/expected-failure.ts'; -import type { AgentErrorCode } from '../types.ts'; -import type { AttemptStatus } from './records.ts'; +import { BLOCKABLE_CODES } from '@e2e-dev/core/lib/agent/executor'; +import { sanitizeText, TestError, truncateUtf8, type ErrorPhase, type SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import type { ExpectedFailureInfo } from '@e2e-dev/core/lib/internal/expected-failure'; +import type { AgentErrorCode } from '@e2e-dev/core/lib/types'; +import type { AttemptStatus } from '@e2e-dev/core/lib/run/records'; /** The report schema's bound on a reason. */ const MAX_REASON_BYTES = 8192; diff --git a/packages/e2e/src/run/extended-fixtures.ts b/packages/e2e/src/run/extended-fixtures.ts index 6326fdd57f..44b6e5f726 100644 --- a/packages/e2e/src/run/extended-fixtures.ts +++ b/packages/e2e/src/run/extended-fixtures.ts @@ -1,8 +1,8 @@ /** The fixtures a test's `test.extend()` chain adds to one attempt. */ import type { FixtureDefinition } from '../collect/registry.ts'; -import { pollLineage, type PollLineage } from '../expect/poll-scope.ts'; -import { ConfigurationError } from '../internal/errors.ts'; +import { pollLineage, type PollLineage } from '@e2e-dev/core/lib/expect/poll-scope'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; /** One set-up fixture's teardown: the rest of its function after `use`. */ export interface FixtureTeardown { diff --git a/packages/e2e/src/run/failure-evidence.ts b/packages/e2e/src/run/failure-evidence.ts index 7bff7b7c3a..8c2a62a967 100644 --- a/packages/e2e/src/run/failure-evidence.ts +++ b/packages/e2e/src/run/failure-evidence.ts @@ -12,15 +12,15 @@ import { mkdirSync, writeFileSync } from 'node:fs'; import path from 'node:path'; -import { formatNode, prepareObservation, type AgentObservation, type RedactedNode } from '../agent/observation.ts'; -import type { ResolvedConfig } from '../config/resolve.ts'; -import type { OperationContext, TargetSession } from '../engine/surface.ts'; -import { truncateUtf8, type E2EError } from '../internal/errors.ts'; -import type { SecretLedger } from '../internal/redact.ts'; -import { isTypoOf } from '../internal/suggest.ts'; -import { withAbort } from '../internal/time.ts'; -import type { ArtifactSink } from './fixtures.ts'; -import type { FailureEvidence } from './records.ts'; +import { formatNode, prepareObservation, type AgentObservation, type RedactedNode } from '@e2e-dev/core/lib/agent/observation'; +import type { ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; +import type { OperationContext, TargetSession } from '@e2e-dev/core/lib/engine/surface'; +import { truncateUtf8, type E2EError } from '@e2e-dev/core/lib/internal/errors'; +import type { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; +import { isTypoOf } from '@e2e-dev/core/lib/internal/suggest'; +import { withAbort } from '@e2e-dev/core/lib/internal/time'; +import type { ArtifactSink } from '@e2e-dev/core/lib/run/fixtures'; +import type { FailureEvidence } from '@e2e-dev/core/lib/run/records'; /** The whole capture, observation and screenshot together, gets this long. */ const EVIDENCE_TIMEOUT_MS = 5_000; diff --git a/packages/e2e/src/run/host-trace.ts b/packages/e2e/src/run/host-trace.ts index 17438f04e0..a84de4a3d8 100644 --- a/packages/e2e/src/run/host-trace.ts +++ b/packages/e2e/src/run/host-trace.ts @@ -2,13 +2,13 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; -import type { ResolvedConfig, ResolvedTarget } from '../config/resolve.ts'; +import type { ResolvedConfig, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; import type { Report } from '../run-types.ts'; import { buildReport } from '../report/build.ts'; import { renderTracePage } from '../report/failure-text.ts'; import { outcome } from '../report/outcome.ts'; import { toPosixPath, writeTextReport } from '../report/write.ts'; -import type { AttemptRecord, ResultRecord } from './records.ts'; +import type { AttemptRecord, ResultRecord } from '@e2e-dev/core/lib/run/records'; export interface HostTraceOptions { readonly config: ResolvedConfig; diff --git a/packages/e2e/src/run/in-process.ts b/packages/e2e/src/run/in-process.ts index ce7addf4f5..8beb103b30 100644 --- a/packages/e2e/src/run/in-process.ts +++ b/packages/e2e/src/run/in-process.ts @@ -8,12 +8,12 @@ import type { ModuleRegistration } from '../collect/registry.ts'; import type { Selection, TestTargetPair } from '../collect/select.ts'; -import type { ResolvedConfig, ResolvedTarget } from '../config/resolve.ts'; -import { isAbandonedRejection } from '../internal/abandoned.ts'; -import { classifyError, ConfigurationError, serializeError } from '../internal/errors.ts'; -import type { DebugTrace } from '../internal/debug.ts'; +import type { ResolvedConfig, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { isAbandonedRejection } from '@e2e-dev/core/lib/internal/abandoned'; +import { classifyError, ConfigurationError, serializeError } from '@e2e-dev/core/lib/internal/errors'; +import type { DebugTrace } from '@e2e-dev/core/lib/internal/debug'; import type { InMemoryAttempts } from './execute.ts'; -import type { SessionStore } from './sessions.ts'; +import type { SessionStore } from '@e2e-dev/core/lib/run/sessions'; import type { StepHolding } from './step-hold.ts'; import type { SpawnUnitRunner, UnitRunner, UnitRunnerEvents } from './unit-runner.ts'; import { pairKey } from './units.ts'; diff --git a/packages/e2e/src/run/last-run.ts b/packages/e2e/src/run/last-run.ts index b3f9548a91..f721ef2159 100644 --- a/packages/e2e/src/run/last-run.ts +++ b/packages/e2e/src/run/last-run.ts @@ -1,8 +1,8 @@ /** What `--last-failed` reads back from the previous run's report. */ import { readFile } from 'node:fs/promises'; -import { ConfigurationError, errorMessage } from '../internal/errors.ts'; -import { resultId } from '../internal/ids.ts'; +import { ConfigurationError, errorMessage } from '@e2e-dev/core/lib/internal/errors'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; import type { Report1Document } from '../report/build.ts'; type ReportResult = Report1Document['run']['results'][number]; diff --git a/packages/e2e/src/run/open-session.ts b/packages/e2e/src/run/open-session.ts index 44dbca8fd9..19c75bc814 100644 --- a/packages/e2e/src/run/open-session.ts +++ b/packages/e2e/src/run/open-session.ts @@ -1,16 +1,16 @@ /** Hosted test runners keep a worker alive while opening isolated per-test attempts. */ import { discoverConfig, loadConfigModule, missingConfigError } from '../config/load.ts'; -import { type ResolvedConfig } from '../config/resolve.ts'; +import { type ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../config/resolve-run.ts'; -import { classifyError, ConfigurationError, E2EError, serializeError, type SerializedError } from '../internal/errors.ts'; -import type { TestFixtures } from '../types.ts'; +import { classifyError, ConfigurationError, E2EError, serializeError, type SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import type { TestFixtures } from '@e2e-dev/core/lib/types'; import type { E2EConfig, Report } from '../run-types.ts'; import { allocateTargetPorts } from './app-ports.ts'; -import { processSecrets, registerStaticSecrets } from './secrecy.ts'; +import { processSecrets, registerStaticSecrets } from '@e2e-dev/core/lib/run/secrecy'; import { selectTarget } from './select-target.ts'; import { openStandaloneHost } from './standalone-kinds.ts'; -import type { StepProgress, StepRecord } from './steps.ts'; +import type { StepProgress, StepRecord } from '@e2e-dev/core/lib/run/steps'; import { reserveHostedRun } from './public-ownership.ts'; export interface OpenHostOptions { diff --git a/packages/e2e/src/run/process-output.ts b/packages/e2e/src/run/process-output.ts index 8f055c3680..cb632d1832 100644 --- a/packages/e2e/src/run/process-output.ts +++ b/packages/e2e/src/run/process-output.ts @@ -8,9 +8,9 @@ * fails. */ -import { StreamRedactor, type SecretLedger } from '../internal/redact.ts'; +import { StreamRedactor, type SecretLedger } from '@e2e-dev/core/lib/internal/redact'; import { AsyncLocalStorage, AsyncResource } from 'node:async_hooks'; -import { realmSlot } from '../internal/realm-slot.ts'; +import { realmSlot } from '@e2e-dev/core/lib/internal/realm-slot'; import type { ListReporterOutput } from '../report/list.ts'; export type OutputStream = 'stdout' | 'stderr'; diff --git a/packages/e2e/src/run/public-ownership.ts b/packages/e2e/src/run/public-ownership.ts index 4d5a6cc825..f59ff95a03 100644 --- a/packages/e2e/src/run/public-ownership.ts +++ b/packages/e2e/src/run/public-ownership.ts @@ -1,6 +1,6 @@ -import { currentAttempt } from '../expect/attempt.ts'; -import { ConfigurationError, InfrastructureError } from '../internal/errors.ts'; -import { realmSlot } from '../internal/realm-slot.ts'; +import { currentAttempt } from '@e2e-dev/core/lib/expect/attempt'; +import { ConfigurationError, InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { realmSlot } from '@e2e-dev/core/lib/internal/realm-slot'; import { onBun } from '../internal/runtime.ts'; interface RunnerOwners { diff --git a/packages/e2e/src/run/public-run.ts b/packages/e2e/src/run/public-run.ts index b18ceb4f24..b08c06a51a 100644 --- a/packages/e2e/src/run/public-run.ts +++ b/packages/e2e/src/run/public-run.ts @@ -1,6 +1,6 @@ import { AsyncResource } from 'node:async_hooks'; import path from 'node:path'; -import { packageVersion } from '../internal/package-version.ts'; +import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; import { runsFromCheckout } from '../telemetry/checkout.ts'; import { runCompletedEvent } from '../telemetry/events.ts'; import { Telemetry } from '../telemetry/telemetry.ts'; @@ -8,7 +8,7 @@ import type { Report } from '../run-types.ts'; import type { RunEventSink, RunExitCode, RunStatus } from './events.ts'; import { withProcessOutput, type RunnerOutput } from './process-output.ts'; import { reserveSuiteRun } from './public-ownership.ts'; -import { processSecrets } from './secrecy.ts'; +import { processSecrets } from '@e2e-dev/core/lib/run/secrecy'; import { run as execute, toSelectionRunOptions, diff --git a/packages/e2e/src/run/realm.ts b/packages/e2e/src/run/realm.ts index 1e1e91bbeb..e1cd4af5f1 100644 --- a/packages/e2e/src/run/realm.ts +++ b/packages/e2e/src/run/realm.ts @@ -1,17 +1,17 @@ /** Suite realm lifecycle: module re-import, beforeAll/afterAll scope tracking. */ import { importModule } from '../config/load.ts'; -import { PollScope, runInPollScope } from '../expect/poll-scope.ts'; +import { PollScope, runInPollScope } from '@e2e-dev/core/lib/expect/poll-scope'; import { classifyError, E2EError, serializeError, TestTimeoutError, type SerializedError, -} from '../internal/errors.ts'; -import { DebugTrace } from '../internal/debug.ts'; -import { titlePathKey } from '../internal/ids.ts'; -import { withTimeout } from '../internal/time.ts'; +} from '@e2e-dev/core/lib/internal/errors'; +import { DebugTrace } from '@e2e-dev/core/lib/internal/debug'; +import { titlePathKey } from '@e2e-dev/core/lib/internal/ids'; +import { withTimeout } from '@e2e-dev/core/lib/internal/time'; import type { CollectedFile, CollectedTest } from '../collect/collect.ts'; import { collectModule, @@ -25,8 +25,8 @@ import { type TestHook, } from '../collect/registry.ts'; import type { TestTargetPair } from '../collect/select.ts'; -import type { SuiteFixtures } from '../types.ts'; -import type { RunError } from './records.ts'; +import type { SuiteFixtures } from '@e2e-dev/core/lib/types'; +import type { RunError } from '@e2e-dev/core/lib/run/records'; /** * A suite scope of one realm: a describe group, or `undefined` for the file diff --git a/packages/e2e/src/run/retry.ts b/packages/e2e/src/run/retry.ts index b535b644a9..5a8900ad01 100644 --- a/packages/e2e/src/run/retry.ts +++ b/packages/e2e/src/run/retry.ts @@ -1,7 +1,7 @@ /** Shared retry policy for ordinary tests, setup tests, and serial groups. */ -import type { SerializedError } from '../internal/errors.ts'; -import type { AttemptStatus, ResultStatus, SerialAttemptRecord } from './records.ts'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import type { AttemptStatus, ResultStatus, SerialAttemptRecord } from '@e2e-dev/core/lib/run/records'; /** * Whether a retry's member records are not the verdict. True when the retry diff --git a/packages/e2e/src/run/runner.ts b/packages/e2e/src/run/runner.ts index eb159da5cf..7d0006cd2f 100644 --- a/packages/e2e/src/run/runner.ts +++ b/packages/e2e/src/run/runner.ts @@ -3,7 +3,7 @@ import { rm } from 'node:fs/promises'; import path from 'node:path'; import { discoverConfig, loadConfigModule, missingConfigError } from '../config/load.ts'; -import { isCiMode, type ResolvedTarget } from '../config/resolve.ts'; +import { isCiMode, type ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig, type ResolvedRunConfig, type RunCliOverrides } from '../config/resolve-run.ts'; import { collect, collectInMemory, collectSetups, type Collection } from '../collect/collect.ts'; import type { ModuleRegistration } from '../collect/registry.ts'; @@ -27,16 +27,16 @@ import { exitCodeForCategory, serializeError, type ErrorPhase, -} from '../internal/errors.ts'; -import { loadAiSdk } from '../agent/ai-sdk.ts'; -import { leaveWorkBehind } from '../internal/abandoned.ts'; -import { AiTraceCollector, AiTraceRecorder, registerAiTraceRecorder } from '../internal/ai-trace.ts'; -import { DebugTrace } from '../internal/debug.ts'; -import { printableUrl } from '../internal/urls.ts'; -import { resultId, timestamp, uuidv7 } from '../internal/ids.ts'; +} from '@e2e-dev/core/lib/internal/errors'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { leaveWorkBehind } from '@e2e-dev/core/lib/internal/abandoned'; +import { AiTraceCollector, AiTraceRecorder, registerAiTraceRecorder } from '@e2e-dev/core/lib/internal/ai-trace'; +import { DebugTrace } from '@e2e-dev/core/lib/internal/debug'; +import { printableUrl } from '@e2e-dev/core/lib/internal/urls'; +import { resultId, timestamp, uuidv7 } from '@e2e-dev/core/lib/internal/ids'; import type { ExploreProgress } from '../explore/progress.ts'; import { buildReport, projectSource, type Report1Document, type ReportChanges, type ReportExplore, type ReportFilter } from '../report/build.ts'; -import type { TargetProvenance } from './provision.ts'; +import type { TargetProvenance } from '@e2e-dev/core/lib/run/provision'; import { agentStepTable } from '../report/debug-steps.ts'; import { writeTracePages, type TracePages } from '../report/traces.ts'; import { STATELESS_REPORTERS } from '../report/builtin.ts'; @@ -46,31 +46,31 @@ import { writeJsonReport } from '../report/write.ts'; import { createRunEventEmitter, toEventResult, type RunEventSink, type RunExitCode, type RunStatus, type RunEventFact, type SetupOutcome, type SetupStep } from './events.ts'; import { allocateAppPorts } from './app-ports.ts'; import { inProcessSpawner } from './in-process.ts'; -import { cleanupErrorsOf, someSkippedAfterFailure, tracedResultIds, type ResultRecord, type RunError, type SerialGroupRecord } from './records.ts'; +import { cleanupErrorsOf, someSkippedAfterFailure, tracedResultIds, type ResultRecord, type RunError, type SerialGroupRecord } from '@e2e-dev/core/lib/run/records'; import { runUnits, type TargetFailure } from './scheduler.ts'; import type { BeforeStep, HeldStep, StepHolding, StepPrompt } from './step-hold.ts'; import { stepPromptLine } from '../report/list-steps.ts'; import { buildWorkPlans, nonRunResult, orderWorkPlans, plannedSlots, type TargetWorkPlan, type TimeLimit } from './units.ts'; -import { SessionStore } from './sessions.ts'; -import { outputLayout } from './output.ts'; +import { SessionStore } from '@e2e-dev/core/lib/run/sessions'; +import { outputLayout } from '@e2e-dev/core/lib/run/output'; import type { RunnerOutput } from './process-output.ts'; import { refuseBun } from './public-ownership.ts'; -import { processSecrets, registerStaticSecrets, staticSecretLedger } from './secrecy.ts'; -import { nextRerunDir, pruneArtifacts } from './artifacts.ts'; +import { processSecrets, registerStaticSecrets, staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; +import { nextRerunDir, pruneArtifacts } from '@e2e-dev/core/lib/run/artifacts'; import { carryForward, fileDurationKey, lastFailedIds, readLastRun, reportArtifactPaths, type RerunCollection } from './last-run.ts'; import { loadTimings, writeTimings } from './timings.ts'; import { childProcessSpawner } from './worker/handle.ts'; -import { setSecretRegistry } from '../secrets.ts'; -import { budgetText, withAbort } from '../internal/time.ts'; -import type { RecordingMode } from '../types.ts'; +import { setSecretRegistry } from '@e2e-dev/core/lib/secrets'; +import { budgetText, withAbort } from '@e2e-dev/core/lib/internal/time'; +import type { RecordingMode } from '@e2e-dev/core/lib/types'; import type { BuiltinReporter, E2EConfig, FinishedRun, Reporter, ReporterSummary } from '../run-types.ts'; -import { modelLabel } from '../config/agent.ts'; -import { boundedInt, describeValue, positiveInt, timerMs } from '../config/validate.ts'; +import { modelLabel } from '@e2e-dev/core/lib/config/agent'; +import { boundedInt, describeValue, positiveInt, timerMs } from '@e2e-dev/core/lib/config/validate'; import { validateChangedSince } from './changes.ts'; import { detectVcs, type VcsInfo } from '../internal/vcs.ts'; -import type { EnginePrepareResult } from '../engine/index.ts'; -import type { AppProcesses } from './managed-process.ts'; -import { PreparedEngines, recordingNotices, startDeclaredProcesses, validateEngine, type EngineGrade, type PrepareScope } from './provision.ts'; +import type { EnginePrepareResult } from '@e2e-dev/core/lib/engine/index'; +import type { AppProcesses } from '@e2e-dev/core/lib/run/managed-process'; +import { PreparedEngines, recordingNotices, startDeclaredProcesses, validateEngine, type EngineGrade, type PrepareScope } from '@e2e-dev/core/lib/run/provision'; import { filterSelection, rankingNotice } from './test-filters.ts'; export interface RunOptions { diff --git a/packages/e2e/src/run/scheduler.ts b/packages/e2e/src/run/scheduler.ts index 89ea630631..e6d223d5e5 100644 --- a/packages/e2e/src/run/scheduler.ts +++ b/packages/e2e/src/run/scheduler.ts @@ -9,18 +9,18 @@ */ import type { TestTargetPair } from '../collect/select.ts'; -import type { SkipInfo } from './records.ts'; -import type { ResolvedTarget } from '../config/resolve.ts'; -import type { AiTraceSnapshot } from '../internal/ai-trace.ts'; -import type { DebugSnapshot } from '../internal/debug.ts'; -import { classifyError, InfrastructureError, type SerializedError, TestError, TestTimeoutError, serializeError } from '../internal/errors.ts'; -import { timestamp, uuidv7 } from '../internal/ids.ts'; -import { MAX_TIMER_MS } from '../internal/time.ts'; -import type { AttemptRecord, ResultRecord, RunError, SerialGroupRecord } from './records.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import type { AiTraceSnapshot } from '@e2e-dev/core/lib/internal/ai-trace'; +import type { DebugSnapshot } from '@e2e-dev/core/lib/internal/debug'; +import { classifyError, InfrastructureError, type SerializedError, TestError, TestTimeoutError, serializeError } from '@e2e-dev/core/lib/internal/errors'; +import { timestamp, uuidv7 } from '@e2e-dev/core/lib/internal/ids'; +import { MAX_TIMER_MS } from '@e2e-dev/core/lib/internal/time'; +import type { AttemptRecord, ResultRecord, RunError, SerialGroupRecord } from '@e2e-dev/core/lib/run/records'; import { retryVerdict } from './retry.ts'; import { SerialGroupProgress, serialGroupId } from './serial.ts'; import type { HeldStep } from './step-hold.ts'; -import type { StepProgress } from './steps.ts'; +import type { StepProgress } from '@e2e-dev/core/lib/run/steps'; import type { SpawnUnitRunner, UnitRunner } from './unit-runner.ts'; import { INTERRUPTED_BEFORE_START, diff --git a/packages/e2e/src/run/select-target.ts b/packages/e2e/src/run/select-target.ts index eec38d8be7..4f2c9169a6 100644 --- a/packages/e2e/src/run/select-target.ts +++ b/packages/e2e/src/run/select-target.ts @@ -1,7 +1,7 @@ /** The target a session opens: named, or the only one the config declares. */ -import type { ResolvedConfig, ResolvedTarget } from '../config/resolve.ts'; -import { ConfigurationError } from '../internal/errors.ts'; +import type { ResolvedConfig, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; /** * `name` must be a declared target; without one, the config must declare diff --git a/packages/e2e/src/run/serial.ts b/packages/e2e/src/run/serial.ts index fffe8050fe..068658adbb 100644 --- a/packages/e2e/src/run/serial.ts +++ b/packages/e2e/src/run/serial.ts @@ -1,27 +1,27 @@ /** Serial-group execution: one shared session per group attempt. */ -import type { TargetSession } from '../engine/surface.ts'; +import type { TargetSession } from '@e2e-dev/core/lib/engine/surface'; import { classifyError, ConfigurationError, serializeError, type SerializedError, -} from '../internal/errors.ts'; -import { canonicalDigest, timestamp, uuidv7 } from '../internal/ids.ts'; +} from '@e2e-dev/core/lib/internal/errors'; +import { canonicalDigest, timestamp, uuidv7 } from '@e2e-dev/core/lib/internal/ids'; import type { CollectedTest } from '../collect/collect.ts'; import { groupTitles, type RegisteredTest } from '../collect/registry.ts'; import { pairRecordings, type TestTargetPair } from '../collect/select.ts'; -import type { SkipInfo } from './records.ts'; -import type { ResolvedTarget } from '../config/resolve.ts'; -import type { ArtifactStore } from '../types.ts'; -import { attemptSegments, createAttemptArtifacts, resultSegment } from './artifacts.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import type { ArtifactStore } from '@e2e-dev/core/lib/types'; +import { attemptSegments, createAttemptArtifacts, resultSegment } from '@e2e-dev/core/lib/run/artifacts'; import type { AttemptContext } from './execute.ts'; -import type { ClosingRecord, SessionClose, SessionPlan } from './engine-sessions.ts'; -import type { ArtifactSink } from './fixtures.ts'; -import type { StepRecord } from './steps.ts'; +import type { ClosingRecord, SessionClose, SessionPlan } from '@e2e-dev/core/lib/run/engine-sessions'; +import type { ArtifactSink } from '@e2e-dev/core/lib/run/fixtures'; +import type { StepRecord } from '@e2e-dev/core/lib/run/steps'; import { findRegistered, type FileRef, type Realm, RealmManager } from './realm.ts'; -import type { AttemptRecord, ResultRecord, ResultStatus, SerialAttemptRecord, SerialGroupRecord, SerialMemberRecord, FailedStatus } from './records.ts'; -import { isFailedStatus } from './records.ts'; +import type { AttemptRecord, ResultRecord, ResultStatus, SerialAttemptRecord, SerialGroupRecord, SerialMemberRecord, FailedStatus } from '@e2e-dev/core/lib/run/records'; +import { isFailedStatus } from '@e2e-dev/core/lib/run/records'; import { isCutSerialRetry, isRetryEligible, retryVerdict, runWithRetries } from './retry.ts'; import { interruptedSkip, pairResult } from './units.ts'; diff --git a/packages/e2e/src/run/standalone-kinds.ts b/packages/e2e/src/run/standalone-kinds.ts index fe0d9b9cc6..5457db1e4e 100644 --- a/packages/e2e/src/run/standalone-kinds.ts +++ b/packages/e2e/src/run/standalone-kinds.ts @@ -7,25 +7,25 @@ * test (`open_session {test}`). */ -import { createAgentCacheContext } from '../cache/context.ts'; -import { storedRecordingsFor } from '../cache/rekeyed.ts'; -import { publishAttempt } from '../expect/attempt.ts'; -import { SoftFailures } from '../expect/soft.ts'; -import type { SerializedError } from '../internal/errors.ts'; -import { resultId } from '../internal/ids.ts'; -import { Deadline } from '../internal/time.ts'; -import { holdSecretRegistry } from '../secrets.ts'; +import { createAgentCacheContext } from '@e2e-dev/core/lib/cache/context'; +import { storedRecordingsFor } from '@e2e-dev/core/lib/cache/rekeyed'; +import { publishAttempt } from '@e2e-dev/core/lib/expect/attempt'; +import { SoftFailures } from '@e2e-dev/core/lib/expect/soft'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { holdSecretRegistry } from '@e2e-dev/core/lib/secrets'; import type { Report } from '../run-types.ts'; -import { resultSegment } from './artifacts.ts'; -import { AttemptBudget } from './budget.ts'; +import { resultSegment } from '@e2e-dev/core/lib/run/artifacts'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; import { TargetExecutor } from './execute.ts'; -import { createFixtures } from './fixtures.ts'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; import { writeHostTrace } from './host-trace.ts'; -import { WrittenScreenshots } from './screenshots.ts'; -import { processSecrets } from './secrecy.ts'; -import { targetIdentity } from './sessions.ts'; -import { openWorker, type StandaloneHost, type StandaloneHostOptions, type WorkerPolicy } from './standalone.ts'; -import type { StandaloneAttempt, StandaloneSessionOptions } from './standalone-attempt.ts'; +import { WrittenScreenshots } from '@e2e-dev/core/lib/run/screenshots'; +import { processSecrets } from '@e2e-dev/core/lib/run/secrecy'; +import { targetIdentity } from '@e2e-dev/core/lib/run/sessions'; +import { openWorker, type StandaloneHost, type StandaloneHostOptions, type WorkerPolicy } from '@e2e-dev/core/lib/run/standalone'; +import type { StandaloneAttempt, StandaloneSessionOptions } from '@e2e-dev/core/lib/run/standalone-attempt'; import { createStandaloneTestRun, type StandaloneTest, type StandaloneTestRun } from './standalone-test.ts'; /** What a hosted attempt keeps beside the shared ones: the report its trace was written from. */ diff --git a/packages/e2e/src/run/standalone-test.ts b/packages/e2e/src/run/standalone-test.ts index 7ed72ee8f1..8b68813677 100644 --- a/packages/e2e/src/run/standalone-test.ts +++ b/packages/e2e/src/run/standalone-test.ts @@ -9,34 +9,34 @@ * the run as it serves a run's first attempt, settled when the body ends. */ -import { isModelUnreachable } from '../agent/error.ts'; -import { settleStagedTraces, type AgentCacheContext } from '../cache/context.ts'; +import { isModelUnreachable } from '@e2e-dev/core/lib/agent/error'; +import { settleStagedTraces, type AgentCacheContext } from '@e2e-dev/core/lib/cache/context'; import { collect, type CollectedFile } from '../collect/collect.ts'; -import type { TestIdentity } from './records.ts'; +import type { TestIdentity } from '@e2e-dev/core/lib/run/records'; import { select, type TestTargetPair } from '../collect/select.ts'; -import type { ResolvedConfig, ResolvedTarget } from '../config/resolve.ts'; -import type { OperationContext, TargetSession } from '../engine/surface.ts'; -import { publishAttempt } from '../expect/attempt.ts'; -import { PollScope, runInPollScope } from '../expect/poll-scope.ts'; -import { SoftFailures } from '../expect/soft.ts'; +import type { ResolvedConfig, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import type { OperationContext, TargetSession } from '@e2e-dev/core/lib/engine/surface'; +import { publishAttempt } from '@e2e-dev/core/lib/expect/attempt'; +import { PollScope, runInPollScope } from '@e2e-dev/core/lib/expect/poll-scope'; +import { SoftFailures } from '@e2e-dev/core/lib/expect/soft'; import { classifyError, ConfigurationError, E2EError, InfrastructureError, serializeError, TestError, TestTimeoutError, type ErrorPhase, type SerializedError, -} from '../internal/errors.ts'; -import type { ExpectedFailureInfo } from '../internal/expected-failure.ts'; +} from '@e2e-dev/core/lib/internal/errors'; +import type { ExpectedFailureInfo } from '@e2e-dev/core/lib/internal/expected-failure'; import { isRuntimeSkip, type RuntimeSkip } from '../internal/skip.ts'; import { settleExpectedFailure } from './expected-failure.ts'; -import { withAbort, withTimeout } from '../internal/time.ts'; -import type { SetupFn } from '../types.ts'; -import type { AttemptBudget } from './budget.ts'; +import { withAbort, withTimeout } from '@e2e-dev/core/lib/internal/time'; +import type { SetupFn } from '@e2e-dev/core/lib/types'; +import type { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; import type { TargetExecutor } from './execute.ts'; -import { classifyAttemptStatus } from './engine-sessions.ts'; +import { classifyAttemptStatus } from '@e2e-dev/core/lib/run/engine-sessions'; import { createExtendedFixtures, type ExtendedFixtures } from './extended-fixtures.ts'; import { captureFailureEvidence } from './failure-evidence.ts'; -import type { ArtifactSink, AttemptFixtures } from './fixtures.ts'; +import type { ArtifactSink, AttemptFixtures } from '@e2e-dev/core/lib/run/fixtures'; import { findRegistered, runHook, type Realm } from './realm.ts'; -import type { FailureEvidence } from './records.ts'; -import { sessionLedger } from './secrecy.ts'; -import type { StepRecord, StepRecorder } from './steps.ts'; +import type { FailureEvidence } from '@e2e-dev/core/lib/run/records'; +import { sessionLedger } from '@e2e-dev/core/lib/run/secrecy'; +import type { StepRecord, StepRecorder } from '@e2e-dev/core/lib/run/steps'; /** A queue: each piece of work starts once every piece queued before it has settled. */ function oneAtATime(): (work: () => Promise) => Promise { diff --git a/packages/e2e/src/run/step-hold.ts b/packages/e2e/src/run/step-hold.ts index 85ffd529ec..256685ffa0 100644 --- a/packages/e2e/src/run/step-hold.ts +++ b/packages/e2e/src/run/step-hold.ts @@ -6,10 +6,10 @@ * app is never charged to the test. */ -import { abortError, cancelledError } from '../internal/time.ts'; -import type { SourceLocation } from '../internal/source.ts'; -import type { AttemptBudget } from './budget.ts'; -import type { StepHoldRequest } from './steps.ts'; +import { abortError, cancelledError } from '@e2e-dev/core/lib/internal/time'; +import type { SourceLocation } from '@e2e-dev/core/lib/internal/source'; +import type { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import type { StepHoldRequest } from '@e2e-dev/core/lib/run/steps'; /** A step held before it runs, as the runner's `beforeStep` hook sees it. */ export interface HeldStep { diff --git a/packages/e2e/src/run/test-filters.ts b/packages/e2e/src/run/test-filters.ts index a48b124d96..819f4f657b 100644 --- a/packages/e2e/src/run/test-filters.ts +++ b/packages/e2e/src/run/test-filters.ts @@ -4,20 +4,20 @@ import path from 'node:path'; import type { Collection } from '../collect/collect.ts'; import { select, type Selection, type SelectionFilters, type TestExclusion, type TestTargetPair } from '../collect/select.ts'; import type { ResolvedRunConfig } from '../config/resolve-run.ts'; -import { describeValue } from '../config/validate.ts'; -import { leaveWorkBehind } from '../internal/abandoned.ts'; -import { E2EError, errorMessage } from '../internal/errors.ts'; -import { isPlainObject } from '../internal/options.ts'; -import { onDiskPath } from '../internal/paths.ts'; -import { collapseText } from '../internal/text.ts'; -import { budgetText, withAbort } from '../internal/time.ts'; +import { describeValue } from '@e2e-dev/core/lib/config/validate'; +import { leaveWorkBehind } from '@e2e-dev/core/lib/internal/abandoned'; +import { E2EError, errorMessage } from '@e2e-dev/core/lib/internal/errors'; +import { isPlainObject } from '@e2e-dev/core/lib/internal/options'; +import { onDiskPath } from '@e2e-dev/core/lib/internal/paths'; +import { collapseText } from '@e2e-dev/core/lib/internal/text'; +import { budgetText, withAbort } from '@e2e-dev/core/lib/internal/time'; import { compareTests, type FilterOutcome, type ReportChanges, type ReportFilter } from '../report/build.ts'; import { ellipsize, filterDecision, shortCommit } from '../report/format.ts'; import { plural } from '../report/markdown-text.ts'; import { leftOutTests } from '../report/left-out.ts'; import type { TestFilter, TestFilterCandidate, TestFilterChanges, TestFilterContext } from '../run-types.ts'; import { findChanges } from './changes.ts'; -import { staticSecretLedger } from './secrecy.ts'; +import { staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; import { relevanceBand } from './units.ts'; /** What `filterSelection` judges a selection with, and where each line about what the gate and the filters decided goes. */ diff --git a/packages/e2e/src/run/units.ts b/packages/e2e/src/run/units.ts index 7d1423dc55..d69bd72ba3 100644 --- a/packages/e2e/src/run/units.ts +++ b/packages/e2e/src/run/units.ts @@ -9,9 +9,9 @@ import path from 'node:path'; import type { Collection } from '../collect/collect.ts'; import { testIdentity } from '../collect/collect.ts'; import type { Selection, TestTargetPair } from '../collect/select.ts'; -import type { SkipInfo } from './records.ts'; -import type { ResolvedTarget } from '../config/resolve.ts'; -import type { ResultRecord } from './records.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import type { ResultRecord } from '@e2e-dev/core/lib/run/records'; import type { WirePair } from './worker/protocol.ts'; /** diff --git a/packages/e2e/src/run/worker/entry.ts b/packages/e2e/src/run/worker/entry.ts index ce97a999e4..5dc96e0f17 100644 --- a/packages/e2e/src/run/worker/entry.ts +++ b/packages/e2e/src/run/worker/entry.ts @@ -9,17 +9,17 @@ import { collectFromRegistration } from '../../collect/collect.ts'; import { collectModule } from '../../collect/registry.ts'; import type { TestTargetPair } from '../../collect/select.ts'; import { importModule, loadConfigModule } from '../../config/load.ts'; -import { assignPorts } from '../../config/resolve.ts'; +import { assignPorts } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../../config/resolve-run.ts'; -import { setSecretRegistry } from '../../secrets.ts'; -import { loadAiSdk } from '../../agent/ai-sdk.ts'; -import { AiTraceRecorder, registerAiTraceRecorder } from '../../internal/ai-trace.ts'; -import { DebugTrace } from '../../internal/debug.ts'; -import { classifyError, ConfigurationError, serializeError } from '../../internal/errors.ts'; -import { StreamRedactor } from '../../internal/redact.ts'; +import { setSecretRegistry } from '@e2e-dev/core/lib/secrets'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { AiTraceRecorder, registerAiTraceRecorder } from '@e2e-dev/core/lib/internal/ai-trace'; +import { DebugTrace } from '@e2e-dev/core/lib/internal/debug'; +import { classifyError, ConfigurationError, serializeError } from '@e2e-dev/core/lib/internal/errors'; +import { StreamRedactor } from '@e2e-dev/core/lib/internal/redact'; import { ConfigLoadHold, writtenChunk } from '../process-output.ts'; -import { processSecrets, registerStaticSecrets, staticSecretLedger } from '../secrecy.ts'; -import { SessionStore } from '../sessions.ts'; +import { processSecrets, registerStaticSecrets, staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; +import { SessionStore } from '@e2e-dev/core/lib/run/sessions'; import type { ChildProcessInbound, OutputMessage, @@ -29,7 +29,7 @@ import type { WorkerToMain, } from './protocol.ts'; import { TargetWorker, type ResolvedUnitPairs, type TargetWorkerDeps } from './session.ts'; -import { isAbandonedRejection } from '../../internal/abandoned.ts'; +import { isAbandonedRejection } from '@e2e-dev/core/lib/internal/abandoned'; /** * Outbound messages in flight. `process.send` is asynchronous and a diff --git a/packages/e2e/src/run/worker/handle.ts b/packages/e2e/src/run/worker/handle.ts index f6f3e82992..3569ef9c51 100644 --- a/packages/e2e/src/run/worker/handle.ts +++ b/packages/e2e/src/run/worker/handle.ts @@ -4,7 +4,7 @@ import { fork, type ChildProcess } from 'node:child_process'; import { existsSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import { WARNED_TSCONFIGS_ENV, warnedTsconfigs } from '../../config/tsconfig.ts'; -import { InfrastructureError } from '../../internal/errors.ts'; +import { InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; import type { SpawnUnitRunner, UnitRunner, UnitRunnerEvents } from '../unit-runner.ts'; import type { ChildProcessInbound, diff --git a/packages/e2e/src/run/worker/protocol.ts b/packages/e2e/src/run/worker/protocol.ts index dfa5478d4b..53d4663985 100644 --- a/packages/e2e/src/run/worker/protocol.ts +++ b/packages/e2e/src/run/worker/protocol.ts @@ -8,15 +8,15 @@ */ import type { ResolvedTestOptions } from '../../collect/select.ts'; -import type { SkipInfo, TestIdentity } from '../records.ts'; -import type { CliOverrides, PortAssignments, ResolvedTarget } from '../../config/resolve.ts'; -import type { AiTraceSnapshot } from '../../internal/ai-trace.ts'; -import type { DebugSnapshot } from '../../internal/debug.ts'; -import type { SerializedError } from '../../internal/errors.ts'; -import type { AttemptRecord, ResultRecord, RunError, SerialAttemptRecord, SerialGroupRecord, SerialMemberRecord, WireResultRecord } from '../records.ts'; +import type { SkipInfo, TestIdentity } from '@e2e-dev/core/lib/run/records'; +import type { CliOverrides, PortAssignments, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import type { AiTraceSnapshot } from '@e2e-dev/core/lib/internal/ai-trace'; +import type { DebugSnapshot } from '@e2e-dev/core/lib/internal/debug'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import type { AttemptRecord, ResultRecord, RunError, SerialAttemptRecord, SerialGroupRecord, SerialMemberRecord, WireResultRecord } from '@e2e-dev/core/lib/run/records'; import type { SerialAttemptStart } from '../serial.ts'; import type { HeldStep, StepHolding } from '../step-hold.ts'; -import type { StepProgress } from '../steps.ts'; +import type { StepProgress } from '@e2e-dev/core/lib/run/steps'; /** One runnable pair on the wire; the worker resolves the test function. */ export interface WirePair { diff --git a/packages/e2e/src/run/worker/session.ts b/packages/e2e/src/run/worker/session.ts index 9910851aaa..e3787b96c5 100644 --- a/packages/e2e/src/run/worker/session.ts +++ b/packages/e2e/src/run/worker/session.ts @@ -8,13 +8,13 @@ import inspector from 'node:inspector'; import type { ModuleRegistration } from '../../collect/registry.ts'; import type { TestTargetPair } from '../../collect/select.ts'; -import type { ResolvedConfig, ResolvedTarget } from '../../config/resolve.ts'; -import { DebugTrace } from '../../internal/debug.ts'; -import { uuidv7 } from '../../internal/ids.ts'; -import { abortError, cancelledError } from '../../internal/time.ts'; +import type { ResolvedConfig, ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { DebugTrace } from '@e2e-dev/core/lib/internal/debug'; +import { uuidv7 } from '@e2e-dev/core/lib/internal/ids'; +import { abortError, cancelledError } from '@e2e-dev/core/lib/internal/time'; import { TargetExecutor, type InMemoryAttempts } from '../execute.ts'; -import { encodeResult, type RunError } from '../records.ts'; -import type { SessionStore } from '../sessions.ts'; +import { encodeResult, type RunError } from '@e2e-dev/core/lib/run/records'; +import type { SessionStore } from '@e2e-dev/core/lib/run/sessions'; import type { HeldStep, StepHolding } from '../step-hold.ts'; import { countsTowardFailureLimit, disappearedResult, failureLimitSkip } from '../units.ts'; import type { FailureLimit, MainToWorker, RunUnitMessage, WirePair, WorkerToMain } from './protocol.ts'; diff --git a/packages/e2e/src/runner.ts b/packages/e2e/src/runner.ts index c5e1d20316..727fd45fe7 100644 --- a/packages/e2e/src/runner.ts +++ b/packages/e2e/src/runner.ts @@ -1,5 +1,5 @@ /** Runner APIs live on e2e/runner so importing e2e does not load them; ConfigurationError is shared with e2e/engine. */ -export { ConfigurationError, isE2EError, type SerializedError } from './internal/errors.ts'; +export { ConfigurationError, isE2EError, type SerializedError } from '@e2e-dev/core/lib/internal/errors'; export { list, type ListOptions, type ListResult, type ListedPair } from './run/runner.ts'; export { runSuite as run, type SuiteRunOptions as RunOptions, type RunResult } from './run/public-run.ts'; export { @@ -9,4 +9,4 @@ export { } from './explore/public-explore.ts'; export type { RunEventSink } from './run/events.ts'; export { openHost, type E2EHost, type E2ESession, type OpenHostOptions, type OpenSessionOptions } from './run/open-session.ts'; -export type { StepProgress, StepRecord } from './run/steps.ts'; +export type { StepProgress, StepRecord } from '@e2e-dev/core/lib/run/steps'; diff --git a/packages/e2e/src/telemetry/environment.ts b/packages/e2e/src/telemetry/environment.ts index d2a8e7d94f..b4f34e4669 100644 --- a/packages/e2e/src/telemetry/environment.ts +++ b/packages/e2e/src/telemetry/environment.ts @@ -9,8 +9,8 @@ import { existsSync, readFileSync } from 'node:fs'; import os from 'node:os'; -import { isCiMode } from '../config/resolve.ts'; -import { envValue } from '../internal/env.ts'; +import { isCiMode } from '@e2e-dev/core/lib/config/resolve'; +import { envValue } from '@e2e-dev/core/lib/internal/env'; import { detectPackageManager } from '../internal/package-manager.ts'; import { plainToken } from './token.ts'; diff --git a/packages/e2e/src/telemetry/events.ts b/packages/e2e/src/telemetry/events.ts index 5211dcff41..53310241f4 100644 --- a/packages/e2e/src/telemetry/events.ts +++ b/packages/e2e/src/telemetry/events.ts @@ -12,15 +12,15 @@ * hold the payload to that promise. */ -import { GRAMMAR_ACTION_NAMES, GRAMMAR_TOOL_NAMES, HARNESS_TOOL_NAMES, MCP_SESSION_SURFACE, PROJECT_TOOL_EVENT_PREFIX } from '../agent/action-names.ts'; -import { modelLabel } from '../config/agent.ts'; +import { GRAMMAR_ACTION_NAMES, GRAMMAR_TOOL_NAMES, HARNESS_TOOL_NAMES, MCP_SESSION_SURFACE, PROJECT_TOOL_EVENT_PREFIX } from '@e2e-dev/core/lib/agent/action-names'; +import { modelLabel } from '@e2e-dev/core/lib/config/agent'; import type { ResolvedRunConfig } from '../config/resolve-run.ts'; import type { McpClient } from '../mcp/server.ts'; import type { McpSessionSummary } from '../mcp/usage.ts'; import type { Report1Document, ReportError, ReportExplore, ReportStep, ReportUsage } from '../report/build.ts'; -import { memberRan } from '../run/records.ts'; -import { STEP_KINDS } from '../run/steps.ts'; -import type { JsonValue } from '../types.ts'; +import { memberRan } from '@e2e-dev/core/lib/run/records'; +import { STEP_KINDS } from '@e2e-dev/core/lib/run/steps'; +import type { JsonValue } from '@e2e-dev/core/lib/types'; import { failureKind } from './failure-kind.ts'; import { errorCodeToken, plainToken } from './token.ts'; diff --git a/packages/e2e/src/telemetry/posthog.ts b/packages/e2e/src/telemetry/posthog.ts index 0e53721018..c11c6c758a 100644 --- a/packages/e2e/src/telemetry/posthog.ts +++ b/packages/e2e/src/telemetry/posthog.ts @@ -8,7 +8,7 @@ * telemetry, telemetry that delays or fails a command is a bug. */ -import type { JsonValue } from '../types.ts'; +import type { JsonValue } from '@e2e-dev/core/lib/types'; /** The PostHog Cloud EU ingestion host. */ export const POSTHOG_HOST = 'https://eu.i.posthog.com'; diff --git a/packages/e2e/src/telemetry/project.ts b/packages/e2e/src/telemetry/project.ts index 98419b5598..b08ffbdac6 100644 --- a/packages/e2e/src/telemetry/project.ts +++ b/packages/e2e/src/telemetry/project.ts @@ -14,7 +14,7 @@ */ import { COMMIT_HASH, git } from '../internal/git.ts'; -import { sha256Hex } from '../internal/ids.ts'; +import { sha256Hex } from '@e2e-dev/core/lib/internal/ids'; /** The lexically first root commit reachable from HEAD; undefined outside git and in a shallow clone. */ async function rootCommit(cwd: string): Promise { diff --git a/packages/e2e/src/telemetry/store.ts b/packages/e2e/src/telemetry/store.ts index 421323e065..669afe54e9 100644 --- a/packages/e2e/src/telemetry/store.ts +++ b/packages/e2e/src/telemetry/store.ts @@ -20,9 +20,9 @@ import { randomBytes } from 'node:crypto'; import { mkdirSync, readFileSync } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { writeFileAtomicSync } from '../internal/atomic-write.ts'; -import { envValue } from '../internal/env.ts'; -import { timestamp } from '../internal/ids.ts'; +import { writeFileAtomicSync } from '@e2e-dev/core/lib/internal/atomic-write'; +import { envValue } from '@e2e-dev/core/lib/internal/env'; +import { timestamp } from '@e2e-dev/core/lib/internal/ids'; interface Preferences { enabled?: boolean; diff --git a/packages/e2e/src/telemetry/telemetry.ts b/packages/e2e/src/telemetry/telemetry.ts index d2eb92138b..9fb76b4349 100644 --- a/packages/e2e/src/telemetry/telemetry.ts +++ b/packages/e2e/src/telemetry/telemetry.ts @@ -29,8 +29,8 @@ import { randomBytes } from 'node:crypto'; import picocolors from 'picocolors'; import { DOCS_URL } from '../cli/docs-url.ts'; -import { envFlag } from '../internal/env.ts'; -import { timestamp } from '../internal/ids.ts'; +import { envFlag } from '@e2e-dev/core/lib/internal/env'; +import { timestamp } from '@e2e-dev/core/lib/internal/ids'; import { collectEnvironment, statedIdentity } from './environment.ts'; import { cliSessionEvent, type TelemetryEvent } from './events.ts'; import { postBatch, type PostHogEvent } from './posthog.ts'; diff --git a/packages/e2e/tests/helpers/agent-fake-time.ts b/packages/e2e/tests/helpers/agent-fake-time.ts index 6d7eea42a6..3246d00372 100644 --- a/packages/e2e/tests/helpers/agent-fake-time.ts +++ b/packages/e2e/tests/helpers/agent-fake-time.ts @@ -1,5 +1,5 @@ import { afterEach, beforeAll, beforeEach, vi } from 'vitest'; -import { loadAiSdk } from '../../src/agent/ai-sdk.ts'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; /** * Runs every test in the calling file on fake time that jumps to each next @@ -10,7 +10,7 @@ import { loadAiSdk } from '../../src/agent/ai-sdk.ts'; */ export function runAgentStepsOnFakeTime(): void { beforeAll(async () => { - await import('../../src/agent/default-agent.ts'); + await import('@e2e-dev/core/lib/agent/default-agent'); await loadAiSdk(); }); beforeEach(() => { diff --git a/packages/e2e/tests/helpers/engine-runtime.ts b/packages/e2e/tests/helpers/engine-runtime.ts index 3494a2bfb8..5c0dda6656 100644 --- a/packages/e2e/tests/helpers/engine-runtime.ts +++ b/packages/e2e/tests/helpers/engine-runtime.ts @@ -7,11 +7,11 @@ * require a prior build. */ -import type { EngineErrorCode } from '../../src/engine/index.ts'; +import type { EngineErrorCode } from '@e2e-dev/core/lib/engine/index'; -const builtEngineModule = '../../dist/engine/index.js'; +const builtEngineModule = '@e2e-dev/core/lib/engine/index'; -const built = (await import(builtEngineModule)) as typeof import('../../src/engine/index.ts'); +const built = (await import(builtEngineModule)) as typeof import('@e2e-dev/core/lib/engine/index'); export const { defineEngine, ENGINE_SPI_VERSION, LOCATOR_ACTION_KINDS, POINTER_ACTION_KINDS, obj, parseKey, resolveExpression } = built; diff --git a/packages/e2e/tests/helpers/executor-tree.ts b/packages/e2e/tests/helpers/executor-tree.ts index 11cefc7c7c..3113be5175 100644 --- a/packages/e2e/tests/helpers/executor-tree.ts +++ b/packages/e2e/tests/helpers/executor-tree.ts @@ -1,6 +1,6 @@ /** Reading the node tree an executor gets from `observe({ tree: true })`. */ -import type { ExecutorNode } from '../../src/agent/executor.ts'; +import type { ExecutorNode } from '@e2e-dev/core/lib/agent/executor'; /** The first node `match` accepts, depth first. */ export function findNode(node: ExecutorNode | undefined, match: (node: ExecutorNode) => boolean): ExecutorNode | undefined { diff --git a/packages/e2e/tests/helpers/fake-engine.ts b/packages/e2e/tests/helpers/fake-engine.ts index 4b3783802a..5823e79834 100644 --- a/packages/e2e/tests/helpers/fake-engine.ts +++ b/packages/e2e/tests/helpers/fake-engine.ts @@ -27,7 +27,7 @@ import type { Secret, SemanticNode, ViewportPoint, -} from '../../src/engine/index.ts'; +} from '@e2e-dev/core/lib/engine/index'; import { defineEngine, ENGINE_SPI_VERSION, LOCATOR_ACTION_KINDS } from './engine-runtime.ts'; import { createScene, type Scene, type ScriptedNode, type Stage } from './scripted-scene.ts'; diff --git a/packages/e2e/tests/helpers/fake-executor-context.ts b/packages/e2e/tests/helpers/fake-executor-context.ts index 09bb502594..e91332a44f 100644 --- a/packages/e2e/tests/helpers/fake-executor-context.ts +++ b/packages/e2e/tests/helpers/fake-executor-context.ts @@ -5,7 +5,7 @@ * subject; a tool body that reaches an action is the failure. */ -import type { ExecutorActions, ExecutorStep, ExecutorVerb, StepExecutorContext } from '../../src/agent/executor.ts'; +import type { ExecutorActions, ExecutorStep, ExecutorVerb, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; export interface FakeExecutorContext { readonly context: StepExecutorContext; diff --git a/packages/e2e/tests/helpers/fake-loop-model.ts b/packages/e2e/tests/helpers/fake-loop-model.ts index 2a670a6972..a41ab680fe 100644 --- a/packages/e2e/tests/helpers/fake-loop-model.ts +++ b/packages/e2e/tests/helpers/fake-loop-model.ts @@ -6,7 +6,7 @@ * conditions, and the `complete_step` verdict — without a provider. */ -import type { ModelInstance } from '../../src/types.ts'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; import { createScriptedInstance, scriptedResult, type ScriptedWarning } from './scripted-model.ts'; export interface LoopCall { diff --git a/packages/e2e/tests/helpers/fake-model.ts b/packages/e2e/tests/helpers/fake-model.ts index 26ac76af65..82b306474c 100644 --- a/packages/e2e/tests/helpers/fake-model.ts +++ b/packages/e2e/tests/helpers/fake-model.ts @@ -7,7 +7,7 @@ * works across the src/dist realm boundary. */ -import type { ModelInstance } from '../../src/types.ts'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; import { createScriptedInstance, scriptedResult } from './scripted-model.ts'; /** diff --git a/packages/e2e/tests/helpers/fixture-config.ts b/packages/e2e/tests/helpers/fixture-config.ts index 4a1f2fbf0e..ba6817fdce 100644 --- a/packages/e2e/tests/helpers/fixture-config.ts +++ b/packages/e2e/tests/helpers/fixture-config.ts @@ -1,6 +1,6 @@ /** Fixture configs over one in-memory engine, in the shape `runProject` merges over its defaults. */ -import type { EngineHandle } from '../../src/engine/index.ts'; +import type { EngineHandle } from '@e2e-dev/core/lib/engine/index'; import type { E2EConfig } from '../../src/index.ts'; import { FAKE_APP } from './fake-engine.ts'; diff --git a/packages/e2e/tests/helpers/open-host.ts b/packages/e2e/tests/helpers/open-host.ts index 8d32b33b7e..8f57ec477d 100644 --- a/packages/e2e/tests/helpers/open-host.ts +++ b/packages/e2e/tests/helpers/open-host.ts @@ -4,7 +4,7 @@ import { mkdirSync, mkdtempSync, rmSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { afterEach, beforeEach } from 'vitest'; -import type { EngineHandle, EnginePrepareInfo, EngineFinishInfo } from '../../src/engine/index.ts'; +import type { EngineHandle, EnginePrepareInfo, EngineFinishInfo } from '@e2e-dev/core/lib/engine/index'; import type { E2EConfig } from '../../src/index.ts'; import type { OpenHostOptions } from '../../src/runner.ts'; import { FAKE_APP, type FakeEngineHandle } from './fake-engine.ts'; diff --git a/packages/e2e/tests/helpers/redacted.ts b/packages/e2e/tests/helpers/redacted.ts index 0fa8796d59..3e99680771 100644 --- a/packages/e2e/tests/helpers/redacted.ts +++ b/packages/e2e/tests/helpers/redacted.ts @@ -1,7 +1,7 @@ /** Fixture nodes in the redacted shape descriptors, anchors, and relocation read. */ -import { redactNode, type NodeRedaction, type RedactedNode } from '../../src/agent/observation.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import { redactNode, type NodeRedaction, type RedactedNode } from '@e2e-dev/core/lib/agent/observation'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; /** Redaction that changes nothing: the fixture holds no registered secret. */ const NO_SECRETS: NodeRedaction = { redact: (text) => text, redactCut: (text) => text }; diff --git a/packages/e2e/tests/helpers/report.ts b/packages/e2e/tests/helpers/report.ts index 7cadb1afea..d698e04e0a 100644 --- a/packages/e2e/tests/helpers/report.ts +++ b/packages/e2e/tests/helpers/report.ts @@ -4,8 +4,8 @@ * states only what it is about. */ -import type { ResolvedLimits } from '../../src/config/agent.ts'; -import { ENGINE_SPI_VERSION } from '../../src/engine/contract.ts'; +import type { ResolvedLimits } from '@e2e-dev/core/lib/config/agent'; +import { ENGINE_SPI_VERSION } from '@e2e-dev/core/lib/engine/contract'; import type { Report1Document, ReportAttempt, diff --git a/packages/e2e/tests/helpers/sample-report.ts b/packages/e2e/tests/helpers/sample-report.ts index 9c87c211f0..a15cee75fe 100644 --- a/packages/e2e/tests/helpers/sample-report.ts +++ b/packages/e2e/tests/helpers/sample-report.ts @@ -9,7 +9,7 @@ * engine name and the platform are declared names and reach it as they are. */ -import { ENGINE_SPI_VERSION } from '../../src/engine/contract.ts'; +import { ENGINE_SPI_VERSION } from '@e2e-dev/core/lib/engine/contract'; import type { Report1Document, ReportStep } from '../../src/report/build.ts'; import { reportAttempt, reportDocument, reportError, reportResult, reportStep, reportTarget } from './report.ts'; diff --git a/packages/e2e/tests/helpers/screen-fixture.ts b/packages/e2e/tests/helpers/screen-fixture.ts index 18f8af410e..cdff65b755 100644 --- a/packages/e2e/tests/helpers/screen-fixture.ts +++ b/packages/e2e/tests/helpers/screen-fixture.ts @@ -4,8 +4,8 @@ * matchers can be exercised without a browser. */ -import { resolveExpression, type SemanticNode } from '../../src/engine/index.ts'; -import type { Screen } from '../../src/types.ts'; +import { resolveExpression, type SemanticNode } from '@e2e-dev/core/lib/engine/index'; +import type { Screen } from '@e2e-dev/core/lib/types'; import { screenOver } from './screen-over.ts'; import { snapshot } from './snapshot.ts'; diff --git a/packages/e2e/tests/helpers/screen-over.ts b/packages/e2e/tests/helpers/screen-over.ts index 96ed2f1c96..646f1928ea 100644 --- a/packages/e2e/tests/helpers/screen-over.ts +++ b/packages/e2e/tests/helpers/screen-over.ts @@ -17,15 +17,15 @@ import { type NodeRef, type OperationContext, type SemanticNode, -} from '../../src/engine/index.ts'; -import { prepareObservation } from '../../src/agent/observation.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { LocatorEngine } from '../../src/locator/engine.ts'; -import { createScreen } from '../../src/locator/screen.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import type { Screen } from '../../src/types.ts'; +} from '@e2e-dev/core/lib/engine/index'; +import { prepareObservation } from '@e2e-dev/core/lib/agent/observation'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { LocatorEngine } from '@e2e-dev/core/lib/locator/engine'; +import { createScreen } from '@e2e-dev/core/lib/locator/screen'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import type { Screen } from '@e2e-dev/core/lib/types'; export interface ScreenOverOptions { /** Answers every `locate`, with the operation it runs under. */ diff --git a/packages/e2e/tests/helpers/scripted-engine.ts b/packages/e2e/tests/helpers/scripted-engine.ts index 0e7c480699..28b91cebc3 100644 --- a/packages/e2e/tests/helpers/scripted-engine.ts +++ b/packages/e2e/tests/helpers/scripted-engine.ts @@ -6,7 +6,7 @@ * the deterministic-tier suites share. */ -import type { LocatorActionKind, PointerActionKind } from '../../src/engine/index.ts'; +import type { LocatorActionKind, PointerActionKind } from '@e2e-dev/core/lib/engine/index'; import { LOCATOR_ACTION_KINDS, POINTER_ACTION_KINDS } from './engine-runtime.ts'; import { createFakeEngine, type FakeEngineHandle } from './fake-engine.ts'; import type { ScriptedNode, Stage } from './scripted-scene.ts'; diff --git a/packages/e2e/tests/helpers/scripted-model.ts b/packages/e2e/tests/helpers/scripted-model.ts index 289edfd37f..f7a887b914 100644 --- a/packages/e2e/tests/helpers/scripted-model.ts +++ b/packages/e2e/tests/helpers/scripted-model.ts @@ -6,7 +6,7 @@ */ import type { FinishReason } from 'ai'; -import type { ModelInstance } from '../../src/types.ts'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; /** Builds a V4-shaped scripted model instance around one doGenerate body. */ export function createScriptedInstance( diff --git a/packages/e2e/tests/helpers/scripted-scene.ts b/packages/e2e/tests/helpers/scripted-scene.ts index ba295d66ee..247416e8a4 100644 --- a/packages/e2e/tests/helpers/scripted-scene.ts +++ b/packages/e2e/tests/helpers/scripted-scene.ts @@ -8,7 +8,7 @@ * owns one `Scene` per attempt and forwards its calls. */ -import type { LocatorAction, LocatorExpression, SemanticNode } from '../../src/engine/index.ts'; +import type { LocatorAction, LocatorExpression, SemanticNode } from '@e2e-dev/core/lib/engine/index'; import { engineFailure, obj, parseKey, resolveExpression } from './engine-runtime.ts'; /** The stable id of the observation root; `perform(root, swipe)` is the viewport swipe. */ diff --git a/packages/e2e/tests/helpers/scripted-suite.ts b/packages/e2e/tests/helpers/scripted-suite.ts index 547e242e6b..a38ab3a68b 100644 --- a/packages/e2e/tests/helpers/scripted-suite.ts +++ b/packages/e2e/tests/helpers/scripted-suite.ts @@ -7,7 +7,7 @@ */ import { afterAll, beforeAll, expect } from 'vitest'; -import type { AttemptRecord } from '../../src/run/records.ts'; +import type { AttemptRecord } from '@e2e-dev/core/lib/run/records'; import { FAKE_APP_URL, type FakeEngineHandle } from './fake-engine.ts'; import { engineConfig } from './fixture-config.ts'; import { resultByTitle, runProject, type FixtureProject, type RunOutcome } from './run-project.ts'; diff --git a/packages/e2e/tests/helpers/snapshot.ts b/packages/e2e/tests/helpers/snapshot.ts index 33acd89775..3ce2e20cda 100644 --- a/packages/e2e/tests/helpers/snapshot.ts +++ b/packages/e2e/tests/helpers/snapshot.ts @@ -4,7 +4,7 @@ * `root` node, and the viewport is the fake engine's. */ -import type { EngineSnapshot, SemanticNode } from '../../src/engine/index.ts'; +import type { EngineSnapshot, SemanticNode } from '@e2e-dev/core/lib/engine/index'; const SNAPSHOT_VIEWPORT = { width: 1280, height: 720 } as const; diff --git a/packages/e2e/tests/helpers/trace-cache.ts b/packages/e2e/tests/helpers/trace-cache.ts index 869afd2cb8..c226fc5d31 100644 --- a/packages/e2e/tests/helpers/trace-cache.ts +++ b/packages/e2e/tests/helpers/trace-cache.ts @@ -8,9 +8,9 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { expect } from 'vitest'; -import type { TraceEntry } from '../../src/cache/trace.ts'; +import type { TraceEntry } from '@e2e-dev/core/lib/cache/trace'; import type { E2EConfig, ModelInstance } from '../../src/index.ts'; -import type { StepCacheInfo, StepRecord } from '../../src/run/steps.ts'; +import type { StepCacheInfo, StepRecord } from '@e2e-dev/core/lib/run/steps'; import { installFakeLoopModel, nodeIdFor, type LoopCall, type LoopToolCall } from './fake-loop-model.ts'; import { resultByTitle, type FixtureProject, type RunOutcome } from './run-project.ts'; diff --git a/packages/e2e/tests/helpers/unserved-copilot-model.ts b/packages/e2e/tests/helpers/unserved-copilot-model.ts index 5f565fe170..6e747bb5e7 100644 --- a/packages/e2e/tests/helpers/unserved-copilot-model.ts +++ b/packages/e2e/tests/helpers/unserved-copilot-model.ts @@ -1,9 +1,9 @@ /** A Copilot-shaped failure and model the account cannot use, marked as `copilot()` marks a refusal; a worker-path config file imports it. */ import { APICallError } from '@ai-sdk/provider'; -import { markUnservedModel } from '../../src/internal/unserved-model.ts'; +import { markUnservedModel } from '@e2e-dev/core/lib/internal/unserved-model'; import { copilotRefusal } from '../../src/oauth/providers/github-copilot.ts'; -import type { ModelInstance } from '../../src/types.ts'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; import { createScriptedInstance } from './scripted-model.ts'; const REFUSED_MODEL_ID = 'claude-haiku-4.5'; diff --git a/packages/e2e/tests/integration/agent-act-before-action.test.ts b/packages/e2e/tests/integration/agent-act-before-action.test.ts index 446ec27611..24b2106522 100644 --- a/packages/e2e/tests/integration/agent-act-before-action.test.ts +++ b/packages/e2e/tests/integration/agent-act-before-action.test.ts @@ -6,7 +6,7 @@ import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { installFakeLoopModel, loopCalls, nodeIdFor } from '../helpers/fake-loop-model.ts'; import { createProject, resultByTitle, runExisting, runProject, type RunOutcome } from '../helpers/run-project.ts'; import { readEntries } from '../helpers/trace-cache.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; const TITLE = 'captures before incrementing'; const SUITE = `import { test, expect } from 'e2e'; diff --git a/packages/e2e/tests/integration/agent-act-on-action.test.ts b/packages/e2e/tests/integration/agent-act-on-action.test.ts index 0c6e604ec0..bed23671dc 100644 --- a/packages/e2e/tests/integration/agent-act-on-action.test.ts +++ b/packages/e2e/tests/integration/agent-act-on-action.test.ts @@ -11,7 +11,7 @@ import { nodeIdFor } from '../helpers/fake-loop-model.ts'; import { createProject, resultByTitle, runExisting, runProject, type FixtureProject, type RunOutcome } from '../helpers/run-project.ts'; import { writeFileSync } from 'node:fs'; import { readEntries } from '../helpers/trace-cache.ts'; -import type { StepExecutor, StepExecutorContext } from '../../src/agent/executor.ts'; +import type { StepExecutor, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; const TITLE = 'screenshots every action'; diff --git a/packages/e2e/tests/integration/agent-act-pixel-tools.test.ts b/packages/e2e/tests/integration/agent-act-pixel-tools.test.ts index 5b5262da83..c0f0f8ed90 100644 --- a/packages/e2e/tests/integration/agent-act-pixel-tools.test.ts +++ b/packages/e2e/tests/integration/agent-act-pixel-tools.test.ts @@ -11,8 +11,8 @@ */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; -import { defineEngine, type LocatorAction, type NodeRef } from '../../src/engine/index.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; +import { defineEngine, type LocatorAction, type NodeRef } from '@e2e-dev/core/lib/engine/index'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { installFakeLoopModel, loopCalls, type LoopCall } from '../helpers/fake-loop-model.ts'; import { resultByTitle, runProject, type FixtureProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-act-stress.test.ts b/packages/e2e/tests/integration/agent-act-stress.test.ts index bf65aa4238..3a6f75d9c2 100644 --- a/packages/e2e/tests/integration/agent-act-stress.test.ts +++ b/packages/e2e/tests/integration/agent-act-stress.test.ts @@ -10,7 +10,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { installFakeLoopModel, loopCalls, nodeIdFor } from '../helpers/fake-loop-model.ts'; import { resultByTitle, runProject, runProjectWithConfigFile } from '../helpers/run-project.ts'; -import type { StepExecutor, StepExecutorContext } from '../../src/agent/executor.ts'; +import type { StepExecutor, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; const CREDS = { admin: { username: 'admin', password: 'admin-pass' } }; diff --git a/packages/e2e/tests/integration/agent-act.test.ts b/packages/e2e/tests/integration/agent-act.test.ts index f3a1633066..99952c8c8e 100644 --- a/packages/e2e/tests/integration/agent-act.test.ts +++ b/packages/e2e/tests/integration/agent-act.test.ts @@ -12,7 +12,7 @@ import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { installFakeLoopModel, loopCalls, nodeIdFor } from '../helpers/fake-loop-model.ts'; import { resultByTitle, runProject, type FixtureProject } from '../helpers/run-project.ts'; import type { RunOutcome } from '../helpers/run-project.ts'; -import type { StepExecutor, StepExecutorContext } from '../../src/agent/executor.ts'; +import type { StepExecutor, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; const SUITE = `import { test, expect } from 'e2e'; diff --git a/packages/e2e/tests/integration/agent-ai-trace.test.ts b/packages/e2e/tests/integration/agent-ai-trace.test.ts index 1dbce415dc..341f6d06fc 100644 --- a/packages/e2e/tests/integration/agent-ai-trace.test.ts +++ b/packages/e2e/tests/integration/agent-ai-trace.test.ts @@ -18,7 +18,7 @@ import { type FixtureProject, type RunOutcome, } from '../helpers/run-project.ts'; -import type { AiTraceDocument } from '../../src/internal/ai-trace.ts'; +import type { AiTraceDocument } from '@e2e-dev/core/lib/internal/ai-trace'; const SUITE = `import { test, expect } from 'e2e'; diff --git a/packages/e2e/tests/integration/agent-assert-explore.test.ts b/packages/e2e/tests/integration/agent-assert-explore.test.ts index fcd9a72a93..e223b31060 100644 --- a/packages/e2e/tests/integration/agent-assert-explore.test.ts +++ b/packages/e2e/tests/integration/agent-assert-explore.test.ts @@ -1,6 +1,6 @@ import { afterAll, beforeAll, expect, it } from 'vitest'; -import { AgentError } from '../../src/agent/error.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import { AgentError } from '@e2e-dev/core/lib/agent/error'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { installFakeLoopModel, loopCalls, nodeIdFor } from '../helpers/fake-loop-model.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { resultByTitle, runProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-executor-context.test.ts b/packages/e2e/tests/integration/agent-executor-context.test.ts index 5a9377b623..f1153a986a 100644 --- a/packages/e2e/tests/integration/agent-executor-context.test.ts +++ b/packages/e2e/tests/integration/agent-executor-context.test.ts @@ -6,7 +6,7 @@ */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { StepExecutor, StepExecutorContext } from '../../src/agent/executor.ts'; +import type { StepExecutor, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; import { nodeIdFor } from '../helpers/fake-loop-model.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { resultByTitle, runProject, type FixtureProject, type RunOutcome } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-fallback-handoff.test.ts b/packages/e2e/tests/integration/agent-fallback-handoff.test.ts index 065112a027..147b933a59 100644 --- a/packages/e2e/tests/integration/agent-fallback-handoff.test.ts +++ b/packages/e2e/tests/integration/agent-fallback-handoff.test.ts @@ -1,9 +1,9 @@ /** Pixel-only evidence survives the cache handoff and every default-agent screen update, a secret filled or not. */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { defineEngine, EngineError, type EngineObserveOptions, type EngineSnapshot } from '../../src/engine/index.ts'; -import { buildTraceEntry, type RecordedAction } from '../../src/cache/trace.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import { defineEngine, EngineError, type EngineObserveOptions, type EngineSnapshot } from '@e2e-dev/core/lib/engine/index'; +import { buildTraceEntry, type RecordedAction } from '@e2e-dev/core/lib/cache/trace'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { installFakeLoopModel, loopCalls } from '../helpers/fake-loop-model.ts'; import { fakeCalls, installFakeModel, judgment } from '../helpers/fake-model.ts'; import { resultByTitle, runProject, type FixtureProject, type RunOutcome } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-input-stale.test.ts b/packages/e2e/tests/integration/agent-input-stale.test.ts index 8a75e34ed4..256693f656 100644 --- a/packages/e2e/tests/integration/agent-input-stale.test.ts +++ b/packages/e2e/tests/integration/agent-input-stale.test.ts @@ -1,7 +1,7 @@ /** A stale fill must re-enter secret authorization, on live actions and cached replay alike. */ import { describe, expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { EngineError, type SemanticNode } from 'e2e/engine'; import { createFakeEngine } from '../helpers/fake-engine.ts'; import { nodeIdFor } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/integration/agent-observation-deadline.test.ts b/packages/e2e/tests/integration/agent-observation-deadline.test.ts index c3b83b8e80..f86eafee0c 100644 --- a/packages/e2e/tests/integration/agent-observation-deadline.test.ts +++ b/packages/e2e/tests/integration/agent-observation-deadline.test.ts @@ -2,7 +2,7 @@ import { setTimeout } from 'node:timers/promises'; import { describe, expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL } from '../helpers/fake-engine.ts'; import { runProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-observation-report.test.ts b/packages/e2e/tests/integration/agent-observation-report.test.ts index 530a9e5dd3..43425d6a0b 100644 --- a/packages/e2e/tests/integration/agent-observation-report.test.ts +++ b/packages/e2e/tests/integration/agent-observation-report.test.ts @@ -1,7 +1,7 @@ /** Agent steps report when any semantic observation was truncated. */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { defineEngine, type EngineSnapshot } from '../../src/engine/index.ts'; +import { defineEngine, type EngineSnapshot } from '@e2e-dev/core/lib/engine/index'; import { installFakeLoopModel } from '../helpers/fake-loop-model.ts'; import { installFakeModel, judgment } from '../helpers/fake-model.ts'; import { assertValidReport } from '../helpers/report-schema.ts'; diff --git a/packages/e2e/tests/integration/agent-policy.test.ts b/packages/e2e/tests/integration/agent-policy.test.ts index fc99cc8684..8170719cc2 100644 --- a/packages/e2e/tests/integration/agent-policy.test.ts +++ b/packages/e2e/tests/integration/agent-policy.test.ts @@ -5,19 +5,19 @@ */ import { z } from 'zod'; -import { defineTool } from '../../src/agent/tool.ts'; +import { defineTool } from '@e2e-dev/core/lib/agent/tool'; import { readdirSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { OBSERVED_NAME_LIMIT, OBSERVED_TEXT_LIMIT, type SemanticNode } from '../../src/engine/contract.ts'; +import { OBSERVED_NAME_LIMIT, OBSERVED_TEXT_LIMIT, type SemanticNode } from '@e2e-dev/core/lib/engine/contract'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { installFakeLoopModel, loopCalls, nodeIdFor } from '../helpers/fake-loop-model.ts'; import { extracted, fakeCalls, installFakeModel, judgment } from '../helpers/fake-model.ts'; import type { FakeCall } from '../helpers/fake-model.ts'; import { createProject, resultByTitle, runExisting, runProject, type FixtureProject } from '../helpers/run-project.ts'; import type { RunOutcome } from '../helpers/run-project.ts'; -import type { SdkLanguageModel } from '../../src/agent/ai-sdk.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { SdkLanguageModel } from '@e2e-dev/core/lib/agent/ai-sdk'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL } from '../helpers/fake-engine.ts'; const SUITE = `import { test, credentials } from 'e2e'; diff --git a/packages/e2e/tests/integration/agent-scroll-pages.test.ts b/packages/e2e/tests/integration/agent-scroll-pages.test.ts index defd8d9d39..a4ddf8e400 100644 --- a/packages/e2e/tests/integration/agent-scroll-pages.test.ts +++ b/packages/e2e/tests/integration/agent-scroll-pages.test.ts @@ -1,7 +1,7 @@ /** Scrolling to text reads each page once when it landed, and keeps reading when it may not have. */ import { describe, expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL } from '../helpers/fake-engine.ts'; import { createProject, runExisting } from '../helpers/run-project.ts'; import type { ScriptedNode } from '../helpers/scripted-scene.ts'; diff --git a/packages/e2e/tests/integration/agent-scroll-settle.test.ts b/packages/e2e/tests/integration/agent-scroll-settle.test.ts index 39abc3ef2a..078a5b21a4 100644 --- a/packages/e2e/tests/integration/agent-scroll-settle.test.ts +++ b/packages/e2e/tests/integration/agent-scroll-settle.test.ts @@ -1,7 +1,7 @@ /** Scrolling to text settles each page once, including on a zero-turn replay. */ import { describe, expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL } from '../helpers/fake-engine.ts'; import { nodeIdFor } from '../helpers/fake-loop-model.ts'; import { createProject, resultByTitle, runExisting } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-scroll-smooth.test.ts b/packages/e2e/tests/integration/agent-scroll-smooth.test.ts index 6eebde6388..c6fa51a8f1 100644 --- a/packages/e2e/tests/integration/agent-scroll-smooth.test.ts +++ b/packages/e2e/tests/integration/agent-scroll-smooth.test.ts @@ -7,7 +7,7 @@ */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { createProject, resultByTitle, runExisting, type FixtureProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-tool-read.test.ts b/packages/e2e/tests/integration/agent-tool-read.test.ts index 43115f95f3..c441058fb2 100644 --- a/packages/e2e/tests/integration/agent-tool-read.test.ts +++ b/packages/e2e/tests/integration/agent-tool-read.test.ts @@ -1,7 +1,7 @@ /** Project-tool reads cross the built runner's engine protocol and secret boundary. */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { z } from 'zod'; -import { defineTool, getToolContext } from '../../src/agent/tool.ts'; +import { defineTool, getToolContext } from '@e2e-dev/core/lib/agent/tool'; import { installFakeLoopModel, loopCalls } from '../helpers/fake-loop-model.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { resultByTitle, runProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/agent-trace-cache.test.ts b/packages/e2e/tests/integration/agent-trace-cache.test.ts index 0f088b702c..8bc78c8035 100644 --- a/packages/e2e/tests/integration/agent-trace-cache.test.ts +++ b/packages/e2e/tests/integration/agent-trace-cache.test.ts @@ -30,8 +30,8 @@ import type { ReplayedPrefix, StepExecutor, StepExecutorContext, -} from '../../src/agent/executor.ts'; -import type { ActionTrace, TraceEntry } from '../../src/cache/trace.ts'; +} from '@e2e-dev/core/lib/agent/executor'; +import type { ActionTrace, TraceEntry } from '@e2e-dev/core/lib/cache/trace'; const SUITE = `import { test, expect } from 'e2e'; diff --git a/packages/e2e/tests/integration/artifact-store-serial.test.ts b/packages/e2e/tests/integration/artifact-store-serial.test.ts index f5baf1b488..b5ff21101b 100644 --- a/packages/e2e/tests/integration/artifact-store-serial.test.ts +++ b/packages/e2e/tests/integration/artifact-store-serial.test.ts @@ -10,7 +10,7 @@ import { existsSync } from 'node:fs'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { ArtifactStore, StoredArtifact } from '../../src/types.ts'; +import type { ArtifactStore, StoredArtifact } from '@e2e-dev/core/lib/types'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { assertValidReport } from '../helpers/report-schema.ts'; import { createProject, runExisting, type FixtureProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/cache-model-provenance.test.ts b/packages/e2e/tests/integration/cache-model-provenance.test.ts index 1ad3939875..4f8f2f0f59 100644 --- a/packages/e2e/tests/integration/cache-model-provenance.test.ts +++ b/packages/e2e/tests/integration/cache-model-provenance.test.ts @@ -1,8 +1,8 @@ import { readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { expect, it } from 'vitest'; -import type { ModelInstance } from '../../src/types.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { installFakeLoopModel, loopCalls, nodeIdFor } from '../helpers/fake-loop-model.ts'; import { startFixtureApp } from '../helpers/fixture-app.ts'; import { assertValidReport } from '../helpers/report-schema.ts'; diff --git a/packages/e2e/tests/integration/config-load.test.ts b/packages/e2e/tests/integration/config-load.test.ts index 3f7d1c9e91..d72e8c9ea1 100644 --- a/packages/e2e/tests/integration/config-load.test.ts +++ b/packages/e2e/tests/integration/config-load.test.ts @@ -9,7 +9,7 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; const loaderModule = '../../dist/config/load.js'; const { loadConfigModule } = (await import(loaderModule)) as typeof import('../../src/config/load.ts'); const SDK = new URL('../../dist/index.js', import.meta.url).href; -const ENGINE = new URL('../../dist/engine/index.js', import.meta.url).href; +const ENGINE = import.meta.resolve('@e2e-dev/core/lib/engine/index'); let dir: string; diff --git a/packages/e2e/tests/integration/config-names.test.ts b/packages/e2e/tests/integration/config-names.test.ts index c376d23636..2967cc0a54 100644 --- a/packages/e2e/tests/integration/config-names.test.ts +++ b/packages/e2e/tests/integration/config-names.test.ts @@ -3,7 +3,7 @@ import { existsSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import { defineEngine } from '../../src/engine/index.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; import { runProject } from '../helpers/run-project.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/integration/dist-public-exports.test.ts b/packages/e2e/tests/integration/dist-public-exports.test.ts index 12d986188d..eec58714a8 100644 --- a/packages/e2e/tests/integration/dist-public-exports.test.ts +++ b/packages/e2e/tests/integration/dist-public-exports.test.ts @@ -28,7 +28,9 @@ describe('the built declarations', () => { }); it('export nothing outside the runner consumed from e2e/agent', () => { - const agent = declaration('agent/public.d.ts'); + // `e2e/agent` re-exports the module `@e2e-dev/core` builds it in, so that module is what ships. + expect(declaration('agent/public.d.ts')).toMatch(/export \* from '@e2e-dev\/core\/lib\/agent\/public';/u); + const agent = readFileSync(new URL(import.meta.resolve('@e2e-dev/core/lib/agent/public').replace(/\.js$/u, '.d.ts')), 'utf8'); expect(mentions(agent, 'defineTool')).toBe(true); for (const name of ['isDefinedTool', 'toolAppliesTo', 'createAgent', 'CreateAgentOptions', 'DefaultAgent']) { expect(mentions(agent, name), name).toBe(false); diff --git a/packages/e2e/tests/integration/engine-contract.test.ts b/packages/e2e/tests/integration/engine-contract.test.ts index 00fd1f0afe..0d6048f191 100644 --- a/packages/e2e/tests/integration/engine-contract.test.ts +++ b/packages/e2e/tests/integration/engine-contract.test.ts @@ -17,7 +17,7 @@ import { assertValidReport } from '../helpers/report-schema.ts'; import { freePort } from '../helpers/free-port.ts'; import { resultByTitle, runProject } from '../helpers/run-project.ts'; import type { E2EConfig } from '../../src/index.ts'; -import { TestError } from '../../src/engine/index.ts'; +import { TestError } from '@e2e-dev/core/lib/engine/index'; const APP_URL = FAKE_APP_URL; diff --git a/packages/e2e/tests/integration/engine-secrets.test.ts b/packages/e2e/tests/integration/engine-secrets.test.ts index 940d82da04..84cd834017 100644 --- a/packages/e2e/tests/integration/engine-secrets.test.ts +++ b/packages/e2e/tests/integration/engine-secrets.test.ts @@ -17,7 +17,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { web } from '@e2e-dev/web'; import type { E2EConfig } from '../../src/index.ts'; import type { RunOutcome } from '../../src/run/runner.ts'; -import { secrets } from '../../src/secrets.ts'; +import { secrets } from '@e2e-dev/core/lib/secrets'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL } from '../helpers/fake-engine.ts'; import { fakeCalls, installFakeModel, judgment } from '../helpers/fake-model.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; diff --git a/packages/e2e/tests/integration/engine-target.test.ts b/packages/e2e/tests/integration/engine-target.test.ts index 5ea94571b1..94656f8e2f 100644 --- a/packages/e2e/tests/integration/engine-target.test.ts +++ b/packages/e2e/tests/integration/engine-target.test.ts @@ -6,9 +6,9 @@ */ import { describe, expect, it } from 'vitest'; -import { defineEngine } from '../../src/engine/index.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { assertValidReport } from '../helpers/report-schema.ts'; import { createProject, runProjectWithConfigFile } from '../helpers/run-project.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/integration/explore.test.ts b/packages/e2e/tests/integration/explore.test.ts index 0537be6ad4..d7d3d57edf 100644 --- a/packages/e2e/tests/integration/explore.test.ts +++ b/packages/e2e/tests/integration/explore.test.ts @@ -10,12 +10,12 @@ import { spawnSync } from 'node:child_process'; import { existsSync, readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { defineTool } from '../../src/agent/public.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import { defineTool } from '@e2e-dev/core/lib/agent/public'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { explore, type ExploreOptions, type ExploreOutcome } from '../../src/explore/index.ts'; import { FINDING_TOOL_NAME } from '../../src/explore/executor.ts'; import type { RunEvent } from '../../src/index.ts'; -import type { ModelInstance } from '../../src/types.ts'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; import { installFakeLoopModel, loopCalls, nodeIdFor, type LoopCall, type LoopToolCall } from '../helpers/fake-loop-model.ts'; import { extracted, fakeCalls, installFakeModel, type FakeCall } from '../helpers/fake-model.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; diff --git a/packages/e2e/tests/integration/failure-evidence.test.ts b/packages/e2e/tests/integration/failure-evidence.test.ts index 9d30151a56..075a4bb55a 100644 --- a/packages/e2e/tests/integration/failure-evidence.test.ts +++ b/packages/e2e/tests/integration/failure-evidence.test.ts @@ -12,7 +12,7 @@ import { createHash } from 'node:crypto'; import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import type { OperationContext, SemanticNode } from '../../src/engine/contract.ts'; +import type { OperationContext, SemanticNode } from '@e2e-dev/core/lib/engine/contract'; import type { E2EConfig } from '../../src/index.ts'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL, type FakeEngineHandle } from '../helpers/fake-engine.ts'; import { assertValidReport } from '../helpers/report-schema.ts'; diff --git a/packages/e2e/tests/integration/filled-secrets.test.ts b/packages/e2e/tests/integration/filled-secrets.test.ts index a7a8e3306c..c1aa9af08a 100644 --- a/packages/e2e/tests/integration/filled-secrets.test.ts +++ b/packages/e2e/tests/integration/filled-secrets.test.ts @@ -12,8 +12,8 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { ExecutorNode } from '../../src/agent/executor.ts'; -import type { ArtifactStore, StoredArtifact } from '../../src/types.ts'; +import type { ExecutorNode } from '@e2e-dev/core/lib/agent/executor'; +import type { ArtifactStore, StoredArtifact } from '@e2e-dev/core/lib/types'; import type { RunOutcome } from '../../src/run/runner.ts'; import { findNode } from '../helpers/executor-tree.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; diff --git a/packages/e2e/tests/integration/judgment-params.test.ts b/packages/e2e/tests/integration/judgment-params.test.ts index b411c78c4a..e47539c4a8 100644 --- a/packages/e2e/tests/integration/judgment-params.test.ts +++ b/packages/e2e/tests/integration/judgment-params.test.ts @@ -5,7 +5,7 @@ */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { StepExecutor, StepExecutorContext } from '../../src/agent/executor.ts'; +import type { StepExecutor, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; import { fakeCalls, installFakeModel, judgment } from '../helpers/fake-model.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { resultByTitle, runProject, type FixtureProject, type RunOutcome } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/list-reporter.test.ts b/packages/e2e/tests/integration/list-reporter.test.ts index 382fdc942f..4abd3f3d0d 100644 --- a/packages/e2e/tests/integration/list-reporter.test.ts +++ b/packages/e2e/tests/integration/list-reporter.test.ts @@ -4,7 +4,7 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; import { stripVTControlCharacters } from 'node:util'; import { describe, expect, it, vi } from 'vitest'; -import { defineEngine } from '../../src/engine/index.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; import { createFakeEngine } from '../helpers/fake-engine.ts'; import { engineConfig } from '../helpers/fixture-config.ts'; import { runProject, type FixtureProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/managed-process.test.ts b/packages/e2e/tests/integration/managed-process.test.ts index a8ae912569..226bfada6d 100644 --- a/packages/e2e/tests/integration/managed-process.test.ts +++ b/packages/e2e/tests/integration/managed-process.test.ts @@ -3,8 +3,8 @@ import fs from 'node:fs'; import path from 'node:path'; import process from 'node:process'; import { describe, expect, it } from 'vitest'; -import { InfrastructureError } from '../../src/internal/errors.ts'; -import { ManagedProcess } from '../../src/run/managed-process.ts'; +import { InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { ManagedProcess } from '@e2e-dev/core/lib/run/managed-process'; import { freePort } from '../helpers/free-port.ts'; const SERVER_SCRIPT = ` diff --git a/packages/e2e/tests/integration/mcp-session-host.test.ts b/packages/e2e/tests/integration/mcp-session-host.test.ts index 8295678d4c..4953122b39 100644 --- a/packages/e2e/tests/integration/mcp-session-host.test.ts +++ b/packages/e2e/tests/integration/mcp-session-host.test.ts @@ -22,16 +22,16 @@ import { gate } from '../helpers/gate.ts'; import { startupLog, writeStartupScripts } from '../helpers/startup-scripts.ts'; import type { EngineSession } from '../../src/mcp/config.ts'; import type { McpSessionSummary } from '../../src/mcp/usage.ts'; -import type { RecordingMode, TargetApp } from '../../src/types.ts'; +import type { RecordingMode, TargetApp } from '@e2e-dev/core/lib/types'; const sessionModule = new URL('../../dist/mcp/session.js', import.meta.url).href; const { SessionHost } = (await import(sessionModule)) as typeof import('../../src/mcp/session.ts'); const resolveModule = new URL('../../dist/config/resolve-run.js', import.meta.url).href; const { resolveConfig } = (await import(resolveModule)) as typeof import('../../src/config/resolve-run.ts'); -const secretsModule = new URL('../../dist/secrets.js', import.meta.url).href; -const { credentials, secrets } = (await import(secretsModule)) as typeof import('../../src/secrets.ts'); -const agentModule = new URL('../../dist/agent/public.js', import.meta.url).href; -const { defineTool } = (await import(agentModule)) as typeof import('../../src/agent/public.ts'); +const secretsModule = '@e2e-dev/core/lib/secrets'; +const { credentials, secrets } = (await import(secretsModule)) as typeof import('@e2e-dev/core/lib/secrets'); +const agentModule = '@e2e-dev/core/lib/agent/public'; +const { defineTool } = (await import(agentModule)) as typeof import('@e2e-dev/core/lib/agent/public'); const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/packages/e2e/tests/integration/model-usage.test.ts b/packages/e2e/tests/integration/model-usage.test.ts index 48457f30bd..f963308db4 100644 --- a/packages/e2e/tests/integration/model-usage.test.ts +++ b/packages/e2e/tests/integration/model-usage.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import { defineEngine } from '../../src/engine/index.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; import { judgment } from '../helpers/fake-model.ts'; import { assertValidReport } from '../helpers/report-schema.ts'; import { createProject, runExisting } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/named-agents.test.ts b/packages/e2e/tests/integration/named-agents.test.ts index 0ec576c698..f168b26d03 100644 --- a/packages/e2e/tests/integration/named-agents.test.ts +++ b/packages/e2e/tests/integration/named-agents.test.ts @@ -2,7 +2,7 @@ import { stripVTControlCharacters } from 'node:util'; import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import type { RunEvent } from '../../src/run/events.ts'; import { judgment } from '../helpers/fake-model.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; diff --git a/packages/e2e/tests/integration/open-host-deadline.test.ts b/packages/e2e/tests/integration/open-host-deadline.test.ts index 8230a45081..e29ff10c1b 100644 --- a/packages/e2e/tests/integration/open-host-deadline.test.ts +++ b/packages/e2e/tests/integration/open-host-deadline.test.ts @@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import type { EngineHandle } from '../../src/engine/index.ts'; +import type { EngineHandle } from '@e2e-dev/core/lib/engine/index'; import { createFakeEngine } from '../helpers/fake-engine.ts'; import { gate, hostHarness, sdkExpect } from '../helpers/open-host.ts'; diff --git a/packages/e2e/tests/integration/open-host-engine-ownership.test.ts b/packages/e2e/tests/integration/open-host-engine-ownership.test.ts index ce7a770b40..20b939a840 100644 --- a/packages/e2e/tests/integration/open-host-engine-ownership.test.ts +++ b/packages/e2e/tests/integration/open-host-engine-ownership.test.ts @@ -1,6 +1,6 @@ /** A hosted worker owns its engine instance from before prepare until clean teardown. */ import { describe, expect, it } from 'vitest'; -import type { EngineFinishInfo, EngineHandle } from '../../src/engine/index.ts'; +import type { EngineFinishInfo, EngineHandle } from '@e2e-dev/core/lib/engine/index'; import { createFakeEngine } from '../helpers/fake-engine.ts'; import { gate, hostHarness, provisioned, sdkExpect } from '../helpers/open-host.ts'; diff --git a/packages/e2e/tests/integration/open-host-redaction.test.ts b/packages/e2e/tests/integration/open-host-redaction.test.ts index a097c3d93d..c55ab0dca1 100644 --- a/packages/e2e/tests/integration/open-host-redaction.test.ts +++ b/packages/e2e/tests/integration/open-host-redaction.test.ts @@ -3,7 +3,7 @@ import { readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { inspect } from 'node:util'; import { describe, expect, it } from 'vitest'; -import type { EngineHandle } from '../../src/engine/index.ts'; +import type { EngineHandle } from '@e2e-dev/core/lib/engine/index'; import type { E2EHost } from '../../src/runner.ts'; import { createFakeEngine, FAKE_APP } from '../helpers/fake-engine.ts'; import { contentsUnder } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/reporters.test.ts b/packages/e2e/tests/integration/reporters.test.ts index 822a0a53e7..1f5cd3ffac 100644 --- a/packages/e2e/tests/integration/reporters.test.ts +++ b/packages/e2e/tests/integration/reporters.test.ts @@ -14,8 +14,8 @@ import { createProject, runExisting, type FixtureProject } from '../helpers/run- import type { FinishedRun, Reporter, RunEvent } from '../../src/index.ts'; // The built runner's flag. It stays set for the rest of the process, so only the first reporter given up on can show it. -const abandonedModule = new URL('../../dist/internal/abandoned.js', import.meta.url).href; -const { leftWorkBehind } = (await import(abandonedModule)) as typeof import('../../src/internal/abandoned.ts'); +const abandonedModule = '@e2e-dev/core/lib/internal/abandoned'; +const { leftWorkBehind } = (await import(abandonedModule)) as typeof import('@e2e-dev/core/lib/internal/abandoned'); const SUITE = `import { test, expect } from 'e2e'; diff --git a/packages/e2e/tests/integration/route-announcer-cache.test.ts b/packages/e2e/tests/integration/route-announcer-cache.test.ts index a324110ea9..e79771f15e 100644 --- a/packages/e2e/tests/integration/route-announcer-cache.test.ts +++ b/packages/e2e/tests/integration/route-announcer-cache.test.ts @@ -1,7 +1,7 @@ /** Record and replay around Next.js App Router's route announcer in real Chromium; no model. */ import { expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { startFixtureApp } from '../helpers/fixture-app.ts'; import { nodeIdFor } from '../helpers/fake-loop-model.ts'; import { createProject, runExisting } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/run-events.test.ts b/packages/e2e/tests/integration/run-events.test.ts index 3524bc4d19..2201507666 100644 --- a/packages/e2e/tests/integration/run-events.test.ts +++ b/packages/e2e/tests/integration/run-events.test.ts @@ -17,7 +17,7 @@ import { type FixtureProject, type RunOutcome, } from '../helpers/run-project.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import type { RunEvent } from '../../src/run/events.ts'; const SUITE = `import { test, expect } from 'e2e'; diff --git a/packages/e2e/tests/integration/runner-lifecycle.test.ts b/packages/e2e/tests/integration/runner-lifecycle.test.ts index 8081d3374b..053be4be22 100644 --- a/packages/e2e/tests/integration/runner-lifecycle.test.ts +++ b/packages/e2e/tests/integration/runner-lifecycle.test.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { assertValidReport } from '../helpers/report-schema.ts'; -import { resultId } from '../../src/internal/ids.ts'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; import { createProject, listExisting, diff --git a/packages/e2e/tests/integration/screenshot-assertions.test.ts b/packages/e2e/tests/integration/screenshot-assertions.test.ts index 73eab9dbaf..0335501711 100644 --- a/packages/e2e/tests/integration/screenshot-assertions.test.ts +++ b/packages/e2e/tests/integration/screenshot-assertions.test.ts @@ -9,7 +9,7 @@ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { JsColorType, Transformer } from '@napi-rs/image'; import { describe, expect, it } from 'vitest'; -import type { EngineObserveOptions, ObservationPixels, SemanticNode } from '../../src/engine/index.ts'; +import type { EngineObserveOptions, ObservationPixels, SemanticNode } from '@e2e-dev/core/lib/engine/index'; import type { E2EConfig } from '../../src/index.ts'; import { engineFailure } from '../helpers/engine-runtime.ts'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL, type FakeEngineHandle } from '../helpers/fake-engine.ts'; diff --git a/packages/e2e/tests/integration/serial-secrets.test.ts b/packages/e2e/tests/integration/serial-secrets.test.ts index 47cb8be821..eff1cb4e3b 100644 --- a/packages/e2e/tests/integration/serial-secrets.test.ts +++ b/packages/e2e/tests/integration/serial-secrets.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { defineEngine, LOCATOR_ACTION_KINDS } from '../../src/engine/index.ts'; +import { defineEngine, LOCATOR_ACTION_KINDS } from '@e2e-dev/core/lib/engine/index'; import { createProject, runExisting } from '../helpers/run-project.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/integration/session-secrets.test.ts b/packages/e2e/tests/integration/session-secrets.test.ts index 14324bd2d0..42264b58a4 100644 --- a/packages/e2e/tests/integration/session-secrets.test.ts +++ b/packages/e2e/tests/integration/session-secrets.test.ts @@ -9,8 +9,8 @@ import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import { defineEngine, LOCATOR_ACTION_KINDS } from '../../src/engine/index.ts'; -import type { EngineState } from '../../src/engine/index.ts'; +import { defineEngine, LOCATOR_ACTION_KINDS } from '@e2e-dev/core/lib/engine/index'; +import type { EngineState } from '@e2e-dev/core/lib/engine/index'; import { assertValidReport } from '../helpers/report-schema.ts'; import { createProject, runExisting } from '../helpers/run-project.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/integration/shared-app-processes.test.ts b/packages/e2e/tests/integration/shared-app-processes.test.ts index 5696677251..a4dff1e395 100644 --- a/packages/e2e/tests/integration/shared-app-processes.test.ts +++ b/packages/e2e/tests/integration/shared-app-processes.test.ts @@ -10,21 +10,21 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'no import os from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import type { AppProcesses } from '../../src/run/managed-process.ts'; -import type { ProcessPool } from '../../src/run/process-pool.ts'; -import type { Target } from '../../src/types.ts'; +import type { AppProcesses } from '@e2e-dev/core/lib/run/managed-process'; +import type { ProcessPool } from '@e2e-dev/core/lib/run/process-pool'; +import type { Target } from '@e2e-dev/core/lib/types'; import { createFakeEngine } from '../helpers/fake-engine.ts'; import { freePort } from '../helpers/free-port.ts'; import { startupLog, writeStartupScripts } from '../helpers/startup-scripts.ts'; -const provisionModule = new URL('../../dist/run/provision.js', import.meta.url).href; -const { startDeclaredProcesses } = (await import(provisionModule)) as typeof import('../../src/run/provision.ts'); -const poolModule = new URL('../../dist/run/process-pool.js', import.meta.url).href; -const { SharedAppProcesses } = (await import(poolModule)) as typeof import('../../src/run/process-pool.ts'); +const provisionModule = '@e2e-dev/core/lib/run/provision'; +const { startDeclaredProcesses } = (await import(provisionModule)) as typeof import('@e2e-dev/core/lib/run/provision'); +const poolModule = '@e2e-dev/core/lib/run/process-pool'; +const { SharedAppProcesses } = (await import(poolModule)) as typeof import('@e2e-dev/core/lib/run/process-pool'); const resolveModule = new URL('../../dist/config/resolve-run.js', import.meta.url).href; const { resolveConfig } = (await import(resolveModule)) as typeof import('../../src/config/resolve-run.ts'); -const debugModule = new URL('../../dist/internal/debug.js', import.meta.url).href; -const { DebugTrace } = (await import(debugModule)) as typeof import('../../src/internal/debug.ts'); +const debugModule = '@e2e-dev/core/lib/internal/debug'; +const { DebugTrace } = (await import(debugModule)) as typeof import('@e2e-dev/core/lib/internal/debug'); /** How long a test waits for the app process to start: vitest's 1 s default is too short on a loaded machine. */ const PROCESS_POLL = { timeout: 5_000 }; diff --git a/packages/e2e/tests/integration/target-processes.test.ts b/packages/e2e/tests/integration/target-processes.test.ts index 0bcc8a829e..3b53c7eda1 100644 --- a/packages/e2e/tests/integration/target-processes.test.ts +++ b/packages/e2e/tests/integration/target-processes.test.ts @@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; import type { RunEvent } from '../../src/run/events.ts'; -import type { Target, TargetApp } from '../../src/types.ts'; +import type { Target, TargetApp } from '@e2e-dev/core/lib/types'; import { createFakeEngine } from '../helpers/fake-engine.ts'; import { freePort } from '../helpers/free-port.ts'; import { createProject, runExisting } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/integration/trace-cache-minted-test-id.test.ts b/packages/e2e/tests/integration/trace-cache-minted-test-id.test.ts index ab94a9f52e..01a330887d 100644 --- a/packages/e2e/tests/integration/trace-cache-minted-test-id.test.ts +++ b/packages/e2e/tests/integration/trace-cache-minted-test-id.test.ts @@ -9,8 +9,8 @@ import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { nodeIdFor } from '../helpers/fake-loop-model.ts'; import { createProject, resultByTitle, runExisting, type FixtureProject } from '../helpers/run-project.ts'; import { readEntries } from '../helpers/trace-cache.ts'; -import type { StepExecutor, StepExecutorContext } from '../../src/agent/executor.ts'; -import type { ActionTrace, TraceTargetDescriptor } from '../../src/cache/trace.ts'; +import type { StepExecutor, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; +import type { ActionTrace, TraceTargetDescriptor } from '@e2e-dev/core/lib/cache/trace'; const GRAPH_SUITE = `import { test, expect } from 'e2e'; diff --git a/packages/e2e/tests/integration/trace-cache-replay.test.ts b/packages/e2e/tests/integration/trace-cache-replay.test.ts index b6bef004cf..f66e02f96d 100644 --- a/packages/e2e/tests/integration/trace-cache-replay.test.ts +++ b/packages/e2e/tests/integration/trace-cache-replay.test.ts @@ -11,7 +11,7 @@ import { readFileSync, statSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { stripVTControlCharacters } from 'node:util'; import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; -import type { TraceEntry } from '../../src/cache/trace.ts'; +import type { TraceEntry } from '@e2e-dev/core/lib/cache/trace'; import { main } from '../../src/cli/index.ts'; import type { E2EConfig } from '../../src/index.ts'; import { loopCalls } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/integration/traces.test.ts b/packages/e2e/tests/integration/traces.test.ts index f81723b718..a8d74182f5 100644 --- a/packages/e2e/tests/integration/traces.test.ts +++ b/packages/e2e/tests/integration/traces.test.ts @@ -9,7 +9,7 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import type { AppLogEntry, EngineAttemptContext } from '../../src/engine/index.ts'; +import type { AppLogEntry, EngineAttemptContext } from '@e2e-dev/core/lib/engine/index'; import type { E2EConfig } from '../../src/index.ts'; import type { RunEvent } from '../../src/run/events.ts'; import { createFakeEngine, FAKE_APP, FAKE_APP_URL } from '../helpers/fake-engine.ts'; diff --git a/packages/e2e/tests/integration/unserved-model.test.ts b/packages/e2e/tests/integration/unserved-model.test.ts index 81ccd32eb0..015632a2f0 100644 --- a/packages/e2e/tests/integration/unserved-model.test.ts +++ b/packages/e2e/tests/integration/unserved-model.test.ts @@ -1,7 +1,7 @@ /** A model the provider refuses stops the run once, naming the model, from whichever tier met it first, and once only across two workers. */ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { StepExecutor } from '../../src/agent/executor.ts'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; import { explore } from '../../src/explore/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { createProject, runExisting, runProjectWithConfigFile, type FixtureProject } from '../helpers/run-project.ts'; diff --git a/packages/e2e/tests/types/sdk-types.ts b/packages/e2e/tests/types/sdk-types.ts index 33cf8c8390..71c50d481d 100644 --- a/packages/e2e/tests/types/sdk-types.ts +++ b/packages/e2e/tests/types/sdk-types.ts @@ -565,7 +565,7 @@ void screen.getByLabel('Plan').selectOption({ value: 'pro', index: 1 }); screen.getByRole('button', { hidden: true }); // Coordinate input: a viewport point on screen, a node-relative one on a locator. -declare const point: import('../../src/types.ts').Point; +declare const point: import('../../src/index.ts').Point; void (executorContext.actions.tapAt(point) satisfies Promise); void (executorContext.actions.hitTest(point) satisfies Promise); void (executorContext.actions.dragAt(point, point) satisfies Promise); diff --git a/packages/e2e/tests/unit/act-validation.test.ts b/packages/e2e/tests/unit/act-validation.test.ts index d8d5798b0e..27ce2bd98c 100644 --- a/packages/e2e/tests/unit/act-validation.test.ts +++ b/packages/e2e/tests/unit/act-validation.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; -import { redactParams, validateActOptions, validateParams } from '../../src/agent/act-validation.ts'; -import { templateParams } from '../../src/cache/template.ts'; -import { unique } from '../../src/params.ts'; -import { ConfigurationError } from '../../src/internal/errors.ts'; +import { redactParams, validateActOptions, validateParams } from '@e2e-dev/core/lib/agent/act-validation'; +import { templateParams } from '@e2e-dev/core/lib/cache/template'; +import { unique } from '@e2e-dev/core/lib/params'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; describe('validateActOptions', () => { it('accepts the options bag and an absent one', () => { diff --git a/packages/e2e/tests/unit/agent-assert-explore.test.ts b/packages/e2e/tests/unit/agent-assert-explore.test.ts index 88ed210548..865ca66700 100644 --- a/packages/e2e/tests/unit/agent-assert-explore.test.ts +++ b/packages/e2e/tests/unit/agent-assert-explore.test.ts @@ -2,13 +2,13 @@ import { expect, it } from 'vitest'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine, type EngineHandle } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { defineEngine, type EngineHandle } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import type { E2EConfig } from '../../src/run-types.ts'; import { runAgentStepsOnFakeTime } from '../helpers/agent-fake-time.ts'; import { installFakeLoopModel, loopCalls } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/unit/agent-config.test.ts b/packages/e2e/tests/unit/agent-config.test.ts index b2d533f039..4f8bb92688 100644 --- a/packages/e2e/tests/unit/agent-config.test.ts +++ b/packages/e2e/tests/unit/agent-config.test.ts @@ -1,14 +1,14 @@ import { APICallError, createGateway } from 'ai'; import { describe, expect, it, vi } from 'vitest'; -import { type CliOverrides } from '../../src/config/resolve.ts'; +import { type CliOverrides } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../../src/config/resolve-run.ts'; import { z } from 'zod'; -import { defineTool } from '../../src/agent/tool.ts'; -import { createToolLoopExecutor } from '../../src/agent/tool-loop.ts'; -import { TRANSPORT_RETRIES } from '../../src/agent/model/sdk.ts'; -import type { SdkLanguageModel } from '../../src/agent/ai-sdk.ts'; +import { defineTool } from '@e2e-dev/core/lib/agent/tool'; +import { createToolLoopExecutor } from '@e2e-dev/core/lib/agent/tool-loop'; +import { TRANSPORT_RETRIES } from '@e2e-dev/core/lib/agent/model/sdk'; +import type { SdkLanguageModel } from '@e2e-dev/core/lib/agent/ai-sdk'; import type { E2EConfig } from '../../src/run-types.ts'; -import { HARNESS_TOOL_NAMES } from '../../src/agent/action-names.ts'; +import { HARNESS_TOOL_NAMES } from '@e2e-dev/core/lib/agent/action-names'; import { FINDING_TOOL_NAME } from '../../src/explore/executor.ts'; import { recordingTools } from '../../src/mcp/recording.ts'; @@ -361,7 +361,7 @@ describe('model error classification', () => { it('separates an aborted attempt from an elapsed step budget', async () => { // A slow provider is a test timeout (exit 1); only an aborted attempt is a // runner cancellation (exit 3). Verified through the public adapter. - const { createModelAdapter } = await import('../../src/agent/model/sdk.ts'); + const { createModelAdapter } = await import('@e2e-dev/core/lib/agent/model/sdk'); const model = createGateway({ apiKey: 'x', baseURL: 'https://127.0.0.1:1/v1' }).languageModel('openai/unreachable'); const adapter = createModelAdapter({ provider: model.provider, id: model.modelId, model }); @@ -424,7 +424,7 @@ const TRANSPORT_BACKOFF_BUDGET_MS = 120_000; /** Builds the adapter for a caller-supplied AI SDK model instance. */ async function instanceAdapter(model: unknown) { - const { createModelAdapter } = await import('../../src/agent/model/sdk.ts'); + const { createModelAdapter } = await import('@e2e-dev/core/lib/agent/model/sdk'); return createModelAdapter({ provider: 'scripted', id: 'always-fails', diff --git a/packages/e2e/tests/unit/agent-derived.test.ts b/packages/e2e/tests/unit/agent-derived.test.ts index f8cd0cb1b0..735b8d3002 100644 --- a/packages/e2e/tests/unit/agent-derived.test.ts +++ b/packages/e2e/tests/unit/agent-derived.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { derivedReason } from '../../src/agent/derived.ts'; +import { derivedReason } from '@e2e-dev/core/lib/agent/derived'; describe('derivedReason', () => { it('treats values spelled out by the instruction or the params as literal', () => { diff --git a/packages/e2e/tests/unit/agent-entry-prompt.test.ts b/packages/e2e/tests/unit/agent-entry-prompt.test.ts index 5cc9d99f20..20df827e16 100644 --- a/packages/e2e/tests/unit/agent-entry-prompt.test.ts +++ b/packages/e2e/tests/unit/agent-entry-prompt.test.ts @@ -1,12 +1,12 @@ import { describe, expect, it } from 'vitest'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import type { E2EConfig } from '../../src/run-types.ts'; import { runAgentStepsOnFakeTime } from '../helpers/agent-fake-time.ts'; import { installFakeLoopModel, loopCalls } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/unit/agent-grammar-tools.test.ts b/packages/e2e/tests/unit/agent-grammar-tools.test.ts index 76503b51bc..6275ed2984 100644 --- a/packages/e2e/tests/unit/agent-grammar-tools.test.ts +++ b/packages/e2e/tests/unit/agent-grammar-tools.test.ts @@ -7,11 +7,11 @@ import type { ToolSet } from 'ai'; import { z } from 'zod'; import { beforeAll, describe, expect, it, vi } from 'vitest'; -import { aiSdk, loadAiSdk } from '../../src/agent/ai-sdk.ts'; -import { GRAMMAR_TOOL_NAMES } from '../../src/agent/action-names.ts'; -import { createGrammarTools, createVerdictTool } from '../../src/agent/primitives.ts'; -import { createBuiltInAgent, projectTools } from '../../src/agent/default-agent.ts'; -import { defineTool } from '../../src/agent/tool.ts'; +import { aiSdk, loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { GRAMMAR_TOOL_NAMES } from '@e2e-dev/core/lib/agent/action-names'; +import { createGrammarTools, createVerdictTool } from '@e2e-dev/core/lib/agent/primitives'; +import { createBuiltInAgent, projectTools } from '@e2e-dev/core/lib/agent/default-agent'; +import { defineTool } from '@e2e-dev/core/lib/agent/tool'; import { fakeExecutorContext } from '../helpers/fake-executor-context.ts'; import { installFakeLoopModel } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/unit/agent-judgment-schema.test.ts b/packages/e2e/tests/unit/agent-judgment-schema.test.ts index 4e6128dcb4..3cc5298a3c 100644 --- a/packages/e2e/tests/unit/agent-judgment-schema.test.ts +++ b/packages/e2e/tests/unit/agent-judgment-schema.test.ts @@ -11,7 +11,7 @@ import { fileURLToPath } from 'node:url'; import { Ajv2020, type SchemaObject } from 'ajv/dist/2020.js'; import addFormats from 'ajv-formats'; import { describe, expect, it } from 'vitest'; -import { JUDGMENT_SCHEMA, validateJudgmentResponse } from '../../src/agent/protocol.ts'; +import { JUDGMENT_SCHEMA, validateJudgmentResponse } from '@e2e-dev/core/lib/agent/protocol'; const SCHEMA_ROOT = path.resolve(fileURLToPath(import.meta.url), '..', '..', '..', 'schema'); diff --git a/packages/e2e/tests/unit/agent-ledger.test.ts b/packages/e2e/tests/unit/agent-ledger.test.ts index d2a827f0a8..7363c2b7e2 100644 --- a/packages/e2e/tests/unit/agent-ledger.test.ts +++ b/packages/e2e/tests/unit/agent-ledger.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { MAX_HANDOFF_BYTES, projectPriorSteps, serializeLedger } from '../../src/agent/ledger.ts'; -import type { StepRecord } from '../../src/run/steps.ts'; +import { MAX_HANDOFF_BYTES, projectPriorSteps, serializeLedger } from '@e2e-dev/core/lib/agent/ledger'; +import type { StepRecord } from '@e2e-dev/core/lib/run/steps'; function step(overrides: Partial & Pick): StepRecord { return { diff --git a/packages/e2e/tests/unit/agent-model-refusal.test.ts b/packages/e2e/tests/unit/agent-model-refusal.test.ts index 166d5d6979..0c4557b575 100644 --- a/packages/e2e/tests/unit/agent-model-refusal.test.ts +++ b/packages/e2e/tests/unit/agent-model-refusal.test.ts @@ -1,13 +1,13 @@ import { describe, expect, it } from 'vitest'; -import { createModelAdapter } from '../../src/agent/model/sdk.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; +import { createModelAdapter } from '@e2e-dev/core/lib/agent/model/sdk'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import { snapshot } from '../helpers/snapshot.ts'; function contentFilterModel(text = '') { diff --git a/packages/e2e/tests/unit/agent-observation-budget.test.ts b/packages/e2e/tests/unit/agent-observation-budget.test.ts index 005d409384..97886be476 100644 --- a/packages/e2e/tests/unit/agent-observation-budget.test.ts +++ b/packages/e2e/tests/unit/agent-observation-budget.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { imageTokenUpperBound } from '../../src/agent/model/adapter.ts'; -import { observationByteBudget } from '../../src/agent/observation-budget.ts'; +import { imageTokenUpperBound } from '@e2e-dev/core/lib/agent/model/adapter'; +import { observationByteBudget } from '@e2e-dev/core/lib/agent/observation-budget'; const LIMITS = { maxObservationBytes: 262_144, maxInputTokens: 200_000 }; const INSTRUCTION_RESERVE = 4_096; diff --git a/packages/e2e/tests/unit/agent-observation.test.ts b/packages/e2e/tests/unit/agent-observation.test.ts index b7ee59ae25..df7aa451fc 100644 --- a/packages/e2e/tests/unit/agent-observation.test.ts +++ b/packages/e2e/tests/unit/agent-observation.test.ts @@ -1,14 +1,14 @@ import { assert, describe, expect, it, vi } from 'vitest'; -import type { Observation, SemanticNode } from '../../src/engine/surface.ts'; -import { changeShape, interactiveNodeCount, isTransitionalObservation, observationShape, prepareObservation, projectTree, redactNode, redactNodesAgain, settleObservation } from '../../src/agent/observation.ts'; -import { OBSERVED_NAME_LIMIT, OBSERVED_TEXT_LIMIT } from '../../src/engine/contract.ts'; -import { SecretLedger } from '../../src/internal/redact.ts'; -import { describeDelta } from '../../src/cache/anchors.ts'; -import { ObservationFeed } from '../../src/agent/observation-feed.ts'; -import { OperationQueue } from '../../src/agent/operation-queue.ts'; -import type { AgentContext } from '../../src/agent/invocation.ts'; -import type { StepAccounting } from '../../src/agent/step-accounting.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; +import type { Observation, SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { changeShape, interactiveNodeCount, isTransitionalObservation, observationShape, prepareObservation, projectTree, redactNode, redactNodesAgain, settleObservation } from '@e2e-dev/core/lib/agent/observation'; +import { OBSERVED_NAME_LIMIT, OBSERVED_TEXT_LIMIT } from '@e2e-dev/core/lib/engine/contract'; +import { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; +import { describeDelta } from '@e2e-dev/core/lib/cache/anchors'; +import { ObservationFeed } from '@e2e-dev/core/lib/agent/observation-feed'; +import { OperationQueue } from '@e2e-dev/core/lib/agent/operation-queue'; +import type { AgentContext } from '@e2e-dev/core/lib/agent/invocation'; +import type { StepAccounting } from '@e2e-dev/core/lib/agent/step-accounting'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; function node(id: string, extra: Partial = {}): SemanticNode { return { ref: { id, revision: 'r1' }, ...extra }; diff --git a/packages/e2e/tests/unit/agent-phases.test.ts b/packages/e2e/tests/unit/agent-phases.test.ts index f17da33d61..869c5f200d 100644 --- a/packages/e2e/tests/unit/agent-phases.test.ts +++ b/packages/e2e/tests/unit/agent-phases.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; -import { checkStepClock, instrumentPhase, retryingObserve } from '../../src/agent/phases.ts'; -import type { Observation } from '../../src/engine/surface.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; +import { checkStepClock, instrumentPhase, retryingObserve } from '@e2e-dev/core/lib/agent/phases'; +import type { Observation } from '@e2e-dev/core/lib/engine/surface'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; /** * An `EngineError` the way an engine loaded from a config file throws it: diff --git a/packages/e2e/tests/unit/agent-pixels.test.ts b/packages/e2e/tests/unit/agent-pixels.test.ts index c1c52e2ed5..9b798f868a 100644 --- a/packages/e2e/tests/unit/agent-pixels.test.ts +++ b/packages/e2e/tests/unit/agent-pixels.test.ts @@ -2,8 +2,8 @@ import { JsColorType, Transformer } from '@napi-rs/image'; import { describe, expect, it } from 'vitest'; -import type { ObservationPixels } from '../../src/engine/surface.ts'; -import { downscalePixels } from '../../src/agent/pixels.ts'; +import type { ObservationPixels } from '@e2e-dev/core/lib/engine/surface'; +import { downscalePixels } from '@e2e-dev/core/lib/agent/pixels'; /** A width by height PNG: white, with a black box at the given rect. */ function picture(width: number, height: number, box: { x: number; y: number; w: number; h: number }): ObservationPixels { diff --git a/packages/e2e/tests/unit/agent-point-tap.test.ts b/packages/e2e/tests/unit/agent-point-tap.test.ts index 1f8896f0c6..0158aabad8 100644 --- a/packages/e2e/tests/unit/agent-point-tap.test.ts +++ b/packages/e2e/tests/unit/agent-point-tap.test.ts @@ -4,9 +4,9 @@ */ import { assert, describe, expect, it } from 'vitest'; -import type { Observation, SemanticNode } from '../../src/engine/surface.ts'; -import { prepareObservation } from '../../src/agent/observation.ts'; -import { describePointAction, hitTest, imagePointToViewport, nodeLine } from '../../src/agent/point-tap.ts'; +import type { Observation, SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { prepareObservation } from '@e2e-dev/core/lib/agent/observation'; +import { describePointAction, hitTest, imagePointToViewport, nodeLine } from '@e2e-dev/core/lib/agent/point-tap'; function node(id: string, extra: Partial = {}): SemanticNode { return { ref: { id, revision: 'r1' }, ...extra }; diff --git a/packages/e2e/tests/unit/agent-prompts.test.ts b/packages/e2e/tests/unit/agent-prompts.test.ts index 684c639f85..755fc6df4d 100644 --- a/packages/e2e/tests/unit/agent-prompts.test.ts +++ b/packages/e2e/tests/unit/agent-prompts.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import type { Observation } from '../../src/engine/surface.ts'; -import { judgmentShape, prepareObservation } from '../../src/agent/observation.ts'; -import { buildPrompt, EXTRACT_REQUEST, JUDGMENT_REQUEST } from '../../src/agent/prompts.ts'; +import type { Observation } from '@e2e-dev/core/lib/engine/surface'; +import { judgmentShape, prepareObservation } from '@e2e-dev/core/lib/agent/observation'; +import { buildPrompt, EXTRACT_REQUEST, JUDGMENT_REQUEST } from '@e2e-dev/core/lib/agent/prompts'; const REDACT = (text: string): string => text.replaceAll('hunter2', ''); diff --git a/packages/e2e/tests/unit/agent-protocol.test.ts b/packages/e2e/tests/unit/agent-protocol.test.ts index ba84965e08..d3b72cd291 100644 --- a/packages/e2e/tests/unit/agent-protocol.test.ts +++ b/packages/e2e/tests/unit/agent-protocol.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; import { z } from 'zod'; -import { deriveJsonSchema } from '../../src/agent/model/schema.ts'; -import { extractSchema, validateExtractResponse } from '../../src/agent/protocol.ts'; +import { deriveJsonSchema } from '@e2e-dev/core/lib/agent/model/schema'; +import { extractSchema, validateExtractResponse } from '@e2e-dev/core/lib/agent/protocol'; describe('agent-extract-2', () => { it('passes any found value through: the caller schema is the only authority over it', () => { diff --git a/packages/e2e/tests/unit/agent-reading.test.ts b/packages/e2e/tests/unit/agent-reading.test.ts index 0f6c7000d1..c0d98928b9 100644 --- a/packages/e2e/tests/unit/agent-reading.test.ts +++ b/packages/e2e/tests/unit/agent-reading.test.ts @@ -1,9 +1,9 @@ /** The rules `scroll_to` pages by: which node reads a text, within which list, and what counts as the screen moving. */ import { describe, expect, it } from 'vitest'; -import type { SemanticNode } from '../../src/engine/surface.ts'; -import type { RedactedNode } from '../../src/agent/observation.ts'; -import { nodeReading, normalizeReading, pageLanded, pageMoved, readPage } from '../../src/agent/reading.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; +import { nodeReading, normalizeReading, pageLanded, pageMoved, readPage } from '@e2e-dev/core/lib/agent/reading'; import { redacted } from '../helpers/redacted.ts'; function node(id: string, extra: Partial = {}): SemanticNode { diff --git a/packages/e2e/tests/unit/agent-screen-update.test.ts b/packages/e2e/tests/unit/agent-screen-update.test.ts index ae280bab48..8038b7b815 100644 --- a/packages/e2e/tests/unit/agent-screen-update.test.ts +++ b/packages/e2e/tests/unit/agent-screen-update.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import type { ExecutorObservation } from '../../src/agent/executor.ts'; -import { ScreenPresenter } from '../../src/agent/screen-update.ts'; +import type { ExecutorObservation } from '@e2e-dev/core/lib/agent/executor'; +import { ScreenPresenter } from '@e2e-dev/core/lib/agent/screen-update'; function screen(revision: string, lines: readonly string[], extra: Partial = {}): ExecutorObservation { return { diff --git a/packages/e2e/tests/unit/agent-scroll-target.test.ts b/packages/e2e/tests/unit/agent-scroll-target.test.ts index c5361df5ba..6712fb709a 100644 --- a/packages/e2e/tests/unit/agent-scroll-target.test.ts +++ b/packages/e2e/tests/unit/agent-scroll-target.test.ts @@ -4,9 +4,9 @@ */ import { assert, describe, expect, it } from 'vitest'; -import type { Observation, SemanticNode } from '../../src/engine/surface.ts'; -import { prepareObservation } from '../../src/agent/observation.ts'; -import { samePlace } from '../../src/agent/scroll-target.ts'; +import type { Observation, SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { prepareObservation } from '@e2e-dev/core/lib/agent/observation'; +import { samePlace } from '@e2e-dev/core/lib/agent/scroll-target'; function node(id: string, extra: Partial = {}): SemanticNode { return { ref: { id, revision: 'r1' }, ...extra }; diff --git a/packages/e2e/tests/unit/agent-secrets.test.ts b/packages/e2e/tests/unit/agent-secrets.test.ts index 378687f6db..278aa2a0d0 100644 --- a/packages/e2e/tests/unit/agent-secrets.test.ts +++ b/packages/e2e/tests/unit/agent-secrets.test.ts @@ -7,13 +7,13 @@ */ import { afterEach, describe, expect, it } from 'vitest'; -import type { AgentContext } from '../../src/agent/invocation.ts'; -import { authorizeSecretFill } from '../../src/agent/secrets.ts'; -import type { ResolvedCredential, ResolvedSecret } from '../../src/config/resolve.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; -import { secretBrand } from '../../src/internal/brands.ts'; -import type { Secret } from '../../src/types.ts'; -import { credentials, setSecretRegistry } from '../../src/secrets.ts'; +import type { AgentContext } from '@e2e-dev/core/lib/agent/invocation'; +import { authorizeSecretFill } from '@e2e-dev/core/lib/agent/secrets'; +import type { ResolvedCredential, ResolvedSecret } from '@e2e-dev/core/lib/config/resolve'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { secretBrand } from '@e2e-dev/core/lib/internal/brands'; +import type { Secret } from '@e2e-dev/core/lib/types'; +import { credentials, setSecretRegistry } from '@e2e-dev/core/lib/secrets'; const adminPassword: ResolvedSecret = { name: 'admin.password', purpose: 'password', value: 'hunter2' }; const admin: ResolvedCredential = { name: 'admin', username: 'admin@example.com', password: adminPassword }; diff --git a/packages/e2e/tests/unit/agent-tap-modifiers.test.ts b/packages/e2e/tests/unit/agent-tap-modifiers.test.ts index f8542ce72b..2b4221dce9 100644 --- a/packages/e2e/tests/unit/agent-tap-modifiers.test.ts +++ b/packages/e2e/tests/unit/agent-tap-modifiers.test.ts @@ -9,14 +9,14 @@ import type { ToolSet } from 'ai'; import { z } from 'zod'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { describeAction } from '../../src/agent/actions.ts'; -import type { StepExecutorContext } from '../../src/agent/executor.ts'; -import { createGrammarTools } from '../../src/agent/primitives.ts'; -import { replayTrace, type ReplayHost, type SemanticScreen } from '../../src/agent/replay.ts'; -import { TraceRecorder } from '../../src/cache/recorder.ts'; -import { buildTraceEntry, type ActionTrace, type RecordedAction } from '../../src/cache/trace.ts'; -import { readTraceEntry } from '../../src/cache/trace-read.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import { describeAction } from '@e2e-dev/core/lib/agent/actions'; +import type { StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; +import { createGrammarTools } from '@e2e-dev/core/lib/agent/primitives'; +import { replayTrace, type ReplayHost, type SemanticScreen } from '@e2e-dev/core/lib/agent/replay'; +import { TraceRecorder } from '@e2e-dev/core/lib/cache/recorder'; +import { buildTraceEntry, type ActionTrace, type RecordedAction } from '@e2e-dev/core/lib/cache/trace'; +import { readTraceEntry } from '@e2e-dev/core/lib/cache/trace-read'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { fakeExecutorContext } from '../helpers/fake-executor-context.ts'; import { redacted, redactedNodes } from '../helpers/redacted.ts'; diff --git a/packages/e2e/tests/unit/ai-sdk.test.ts b/packages/e2e/tests/unit/ai-sdk.test.ts index aad2d411ec..7fb8fe9e70 100644 --- a/packages/e2e/tests/unit/ai-sdk.test.ts +++ b/packages/e2e/tests/unit/ai-sdk.test.ts @@ -11,11 +11,11 @@ import { describe, expect, it, vi } from 'vitest'; describe('ai-sdk loader cache', () => { it('shares the loaded SDK across module realms via the globalThis slot', async () => { - const first = await import('../../src/agent/ai-sdk.ts'); + const first = await import('@e2e-dev/core/lib/agent/ai-sdk'); await first.loadAiSdk(); // A fresh module registry simulates a project's separate copy of e2e. vi.resetModules(); - const second = await import('../../src/agent/ai-sdk.ts'); + const second = await import('@e2e-dev/core/lib/agent/ai-sdk'); expect(second).not.toBe(first); expect(() => second.aiSdk()).not.toThrow(); expect(second.aiSdk()).toBe(await first.loadAiSdk()); diff --git a/packages/e2e/tests/unit/ai-trace-media.test.ts b/packages/e2e/tests/unit/ai-trace-media.test.ts index 01779cc40c..c3c0ac0f8a 100644 --- a/packages/e2e/tests/unit/ai-trace-media.test.ts +++ b/packages/e2e/tests/unit/ai-trace-media.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { AiTraceRecorder } from '../../src/internal/ai-trace.ts'; +import { AiTraceRecorder } from '@e2e-dev/core/lib/internal/ai-trace'; /** Records SDK message parts at both telemetry boundaries without making a model call. */ async function recordMessages(messages: unknown[], rawOutput: unknown = undefined) { diff --git a/packages/e2e/tests/unit/ai-trace.test.ts b/packages/e2e/tests/unit/ai-trace.test.ts index 1ff3fc1e63..dbd2c01403 100644 --- a/packages/e2e/tests/unit/ai-trace.test.ts +++ b/packages/e2e/tests/unit/ai-trace.test.ts @@ -7,7 +7,7 @@ import { stringify, withAiTraceScope, withAiTraceStep, -} from '../../src/internal/ai-trace.ts'; +} from '@e2e-dev/core/lib/internal/ai-trace'; import { gate } from '../helpers/gate.ts'; const SCOPE = { test: 'todos › adds one', testId: 't1', target: 'web', agent: 'default', attempt: 0 }; diff --git a/packages/e2e/tests/unit/app-log.test.ts b/packages/e2e/tests/unit/app-log.test.ts index 43e90141ae..86cf583333 100644 --- a/packages/e2e/tests/unit/app-log.test.ts +++ b/packages/e2e/tests/unit/app-log.test.ts @@ -6,10 +6,10 @@ */ import { describe, expect, it } from 'vitest'; -import { createEngineSession } from '../../src/engine/session.ts'; -import type { AppLogEntry } from '../../src/engine/index.ts'; -import type { AppEvent } from '../../src/engine/surface.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import type { AppLogEntry } from '@e2e-dev/core/lib/engine/index'; +import type { AppEvent } from '@e2e-dev/core/lib/engine/surface'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; const ERROR: AppLogEntry = { source: 'console', level: 'error', text: 'boom' }; const log = (entry: AppLogEntry): AppEvent => ({ kind: 'log', entry }); diff --git a/packages/e2e/tests/unit/app-ports.test.ts b/packages/e2e/tests/unit/app-ports.test.ts index ff2779a6d2..55b786999b 100644 --- a/packages/e2e/tests/unit/app-ports.test.ts +++ b/packages/e2e/tests/unit/app-ports.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; -import { engineAppInfo } from '../../src/config/app.ts'; -import { assignPorts, type PortAssignments } from '../../src/config/resolve.ts'; +import { engineAppInfo } from '@e2e-dev/core/lib/config/app'; +import { assignPorts, type PortAssignments } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import type { TargetApp } from '../../src/types.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import type { TargetApp } from '@e2e-dev/core/lib/types'; import { allocateAppPorts, allocateTargetPorts } from '../../src/run/app-ports.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/app-recording.test.ts b/packages/e2e/tests/unit/app-recording.test.ts index d4d1cc815f..dd15fdc399 100644 --- a/packages/e2e/tests/unit/app-recording.test.ts +++ b/packages/e2e/tests/unit/app-recording.test.ts @@ -8,9 +8,9 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync import os from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import type { OperationContext, TargetSession, VideoSegment } from '../../src/engine/surface.ts'; -import { sessionRecordings } from '../../src/run/recordings.ts'; -import type { ArtifactSink } from '../../src/run/fixtures.ts'; +import type { OperationContext, TargetSession, VideoSegment } from '@e2e-dev/core/lib/engine/surface'; +import { sessionRecordings } from '@e2e-dev/core/lib/run/recordings'; +import type { ArtifactSink } from '@e2e-dev/core/lib/run/fixtures'; const operation: OperationContext = { signal: new AbortController().signal, timeoutMs: 1_000, runId: 'run', attemptId: 'attempt', origin: 'test' }; diff --git a/packages/e2e/tests/unit/artifact-segment.test.ts b/packages/e2e/tests/unit/artifact-segment.test.ts index ac9a09d17b..1aa4bbf8e5 100644 --- a/packages/e2e/tests/unit/artifact-segment.test.ts +++ b/packages/e2e/tests/unit/artifact-segment.test.ts @@ -5,7 +5,7 @@ */ import { describe, expect, it } from 'vitest'; -import { resultSegment } from '../../src/run/artifacts.ts'; +import { resultSegment } from '@e2e-dev/core/lib/run/artifacts'; const SAFE_SEGMENT = /^[a-z0-9-]+$/; const ID = '1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d'; diff --git a/packages/e2e/tests/unit/artifact-store.test.ts b/packages/e2e/tests/unit/artifact-store.test.ts index e67669e9ed..f125158350 100644 --- a/packages/e2e/tests/unit/artifact-store.test.ts +++ b/packages/e2e/tests/unit/artifact-store.test.ts @@ -10,9 +10,9 @@ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'nod import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import type { ArtifactStore, StoredArtifact } from '../../src/types.ts'; -import { SecretLedger } from '../../src/internal/redact.ts'; -import { createAttemptArtifacts } from '../../src/run/artifacts.ts'; +import type { ArtifactStore, StoredArtifact } from '@e2e-dev/core/lib/types'; +import { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; +import { createAttemptArtifacts } from '@e2e-dev/core/lib/run/artifacts'; const roots: string[] = []; function root(): string { diff --git a/packages/e2e/tests/unit/cli-cache.test.ts b/packages/e2e/tests/unit/cli-cache.test.ts index 9588ebcfa2..8a1bea4468 100644 --- a/packages/e2e/tests/unit/cli-cache.test.ts +++ b/packages/e2e/tests/unit/cli-cache.test.ts @@ -5,9 +5,9 @@ import os from 'node:os'; import path from 'node:path'; import { stripVTControlCharacters } from 'node:util'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '../../src/cache/store.ts'; +import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '@e2e-dev/core/lib/cache/store'; import { main } from '../../src/cli/index.ts'; -import type { ActionTrace, TraceProvenance } from '../../src/cache/trace.ts'; +import type { ActionTrace, TraceProvenance } from '@e2e-dev/core/lib/cache/trace'; let root: string; let stdoutSpy: ReturnType; diff --git a/packages/e2e/tests/unit/cli-doctor.test.ts b/packages/e2e/tests/unit/cli-doctor.test.ts index f6d5a75d04..284afe6058 100644 --- a/packages/e2e/tests/unit/cli-doctor.test.ts +++ b/packages/e2e/tests/unit/cli-doctor.test.ts @@ -7,9 +7,9 @@ import { existsSync } from 'node:fs'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; import { doctor, type DoctorOptions, type DoctorReport } from '../../src/cli/doctor.ts'; -import { cancelledError } from '../../src/internal/time.ts'; +import { cancelledError } from '@e2e-dev/core/lib/internal/time'; import { withProcessOutput } from '../../src/run/process-output.ts'; -import { processSecrets } from '../../src/run/secrecy.ts'; +import { processSecrets } from '@e2e-dev/core/lib/run/secrecy'; import { createProject, type FixtureProject } from '../helpers/run-project.ts'; const projects: FixtureProject[] = []; diff --git a/packages/e2e/tests/unit/cli-run-output.test.ts b/packages/e2e/tests/unit/cli-run-output.test.ts index 3846d5e35a..b792556ff4 100644 --- a/packages/e2e/tests/unit/cli-run-output.test.ts +++ b/packages/e2e/tests/unit/cli-run-output.test.ts @@ -4,8 +4,8 @@ const { killManagedProcessGroups, stopsSettled } = vi.hoisted(() => ({ killManagedProcessGroups: vi.fn(), stopsSettled: vi.fn<() => Promise>(), })); -vi.mock('../../src/run/managed-process.ts', async (importOriginal) => ({ - ...(await importOriginal()), +vi.mock('@e2e-dev/core/lib/run/managed-process', async (importOriginal) => ({ + ...(await importOriginal()), killManagedProcessGroups, stopsSettled, })); @@ -13,7 +13,7 @@ vi.mock('../../src/run/managed-process.ts', async (importOriginal) => ({ /** `exitIfStopped`, `exitAfterGrace`, and `leaveWorkBehind` from fresh modules, so work one test leaves behind is not the next one's. */ async function fresh() { vi.resetModules(); - const [{ exitAfterGrace, exitIfStopped }, { leaveWorkBehind }] = await Promise.all([import('../../src/cli/run-output.ts'), import('../../src/internal/abandoned.ts')]); + const [{ exitAfterGrace, exitIfStopped }, { leaveWorkBehind }] = await Promise.all([import('../../src/cli/run-output.ts'), import('@e2e-dev/core/lib/internal/abandoned')]); return { exitAfterGrace, exitIfStopped, leaveWorkBehind }; } diff --git a/packages/e2e/tests/unit/cli-watch.test.ts b/packages/e2e/tests/unit/cli-watch.test.ts index e2eb610051..f173a70677 100644 --- a/packages/e2e/tests/unit/cli-watch.test.ts +++ b/packages/e2e/tests/unit/cli-watch.test.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import { PassThrough } from 'node:stream'; import picocolors from 'picocolors'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { compileGlobList } from '../../src/internal/globs.ts'; +import { compileGlobList } from '@e2e-dev/core/lib/internal/globs'; import type { RunOptions, RunOutcome } from '../../src/run/runner.ts'; import { SignalLadder } from '../../src/cli/signals.ts'; import { diff --git a/packages/e2e/tests/unit/cli.test.ts b/packages/e2e/tests/unit/cli.test.ts index e3a7403d78..f6cae916c1 100644 --- a/packages/e2e/tests/unit/cli.test.ts +++ b/packages/e2e/tests/unit/cli.test.ts @@ -5,7 +5,7 @@ import { stripVTControlCharacters } from 'node:util'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import type { ListOptions, ListedPair } from '../../src/runner.ts'; import type { RunOptions } from '../../src/run/runner.ts'; -import { ConfigurationError } from '../../src/internal/errors.ts'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; import { SAMPLE_REPORT_SECRETS, sampleReport } from '../helpers/sample-report.ts'; const runMock = vi.hoisted(() => vi.fn()); diff --git a/packages/e2e/tests/unit/computed-style.test.ts b/packages/e2e/tests/unit/computed-style.test.ts index 557f7e777a..d74b68b375 100644 --- a/packages/e2e/tests/unit/computed-style.test.ts +++ b/packages/e2e/tests/unit/computed-style.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { validateComputedStyleProperties, type ComputedStyleProperty } from '../../src/engine/computed-style.ts'; +import { validateComputedStyleProperties, type ComputedStyleProperty } from '@e2e-dev/core/lib/engine/computed-style'; describe('computed style properties', () => { it.each([undefined, null, {}, 'color', [], ['content'], ['background-image'], ['--token'], ['COLOR'], ['color', 'content'], Array(1)])( diff --git a/packages/e2e/tests/unit/config.test.ts b/packages/e2e/tests/unit/config.test.ts index 104555dd3c..c66f6585e3 100644 --- a/packages/e2e/tests/unit/config.test.ts +++ b/packages/e2e/tests/unit/config.test.ts @@ -3,12 +3,12 @@ import os from 'node:os'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; import { discoverConfig } from '../../src/config/load.ts'; -import { isCiMode, type CliOverrides } from '../../src/config/resolve.ts'; +import { isCiMode, type CliOverrides } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { ConfigurationError, defineEngine } from '../../src/engine/index.ts'; -import { protocolEngine } from '../../src/engine/protocol/client.ts'; -import { secrets } from '../../src/secrets.ts'; -import type { CommandConfig, Target, TargetApp } from '../../src/types.ts'; +import { ConfigurationError, defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { protocolEngine } from '@e2e-dev/core/lib/engine/protocol/client'; +import { secrets } from '@e2e-dev/core/lib/secrets'; +import type { CommandConfig, Target, TargetApp } from '@e2e-dev/core/lib/types'; import type { E2EConfig, TestFilter } from '../../src/run-types.ts'; import { snapshot } from '../helpers/snapshot.ts'; import { invalid } from '../helpers/invalid.ts'; diff --git a/packages/e2e/tests/unit/debug-steps.test.ts b/packages/e2e/tests/unit/debug-steps.test.ts index b932f3f8ed..a9d11934b9 100644 --- a/packages/e2e/tests/unit/debug-steps.test.ts +++ b/packages/e2e/tests/unit/debug-steps.test.ts @@ -1,11 +1,11 @@ /** The `--debug` agent step table: one row per agent step, a `via` column only when the steps named several models. */ import { describe, expect, it } from 'vitest'; -import type { ResolvedTarget } from '../../src/config/resolve.ts'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; import { agentStepTable } from '../../src/report/debug-steps.ts'; import { stepModelLabel } from '../../src/report/format.ts'; -import type { AttemptRecord, ResultRecord, SerialGroupRecord, SerialMemberRecord } from '../../src/run/records.ts'; -import type { StepModelInfo, StepRecord } from '../../src/run/steps.ts'; +import type { AttemptRecord, ResultRecord, SerialGroupRecord, SerialMemberRecord } from '@e2e-dev/core/lib/run/records'; +import type { StepModelInfo, StepRecord } from '@e2e-dev/core/lib/run/steps'; const AT = '2026-01-01T00:00:00.000Z'; diff --git a/packages/e2e/tests/unit/debug.test.ts b/packages/e2e/tests/unit/debug.test.ts index c3ff091df4..630570b417 100644 --- a/packages/e2e/tests/unit/debug.test.ts +++ b/packages/e2e/tests/unit/debug.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { DebugTrace } from '../../src/internal/debug.ts'; +import { DebugTrace } from '@e2e-dev/core/lib/internal/debug'; describe('DebugTrace', () => { it('times async work and rethrows failures', async () => { diff --git a/packages/e2e/tests/unit/declared-processes.test.ts b/packages/e2e/tests/unit/declared-processes.test.ts index 6729dfc8b0..3f4d5ba331 100644 --- a/packages/e2e/tests/unit/declared-processes.test.ts +++ b/packages/e2e/tests/unit/declared-processes.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; -import { defineEngine } from '../../src/engine/index.ts'; -import { assignPorts } from '../../src/config/resolve.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { assignPorts } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { declaredCommands } from '../../src/run/declared-processes.ts'; -import type { TargetApp } from '../../src/types.ts'; +import { declaredCommands } from '@e2e-dev/core/lib/run/declared-processes'; +import type { TargetApp } from '@e2e-dev/core/lib/types'; import { snapshot } from '../helpers/snapshot.ts'; const ROOT = '/tmp/e2e-declared-processes'; diff --git a/packages/e2e/tests/unit/engine-error.test.ts b/packages/e2e/tests/unit/engine-error.test.ts index 96c6b53993..107cac9226 100644 --- a/packages/e2e/tests/unit/engine-error.test.ts +++ b/packages/e2e/tests/unit/engine-error.test.ts @@ -1,8 +1,8 @@ /** The engine error contract: closed codes and closed retryability, local and foreign. */ import { describe, expect, it } from 'vitest'; -import { ENGINE_ERROR_CODES, EngineError, RETRYABLE_ENGINE_ERROR_CODES } from '../../src/engine/contract.ts'; -import { asEngineError } from '../../src/internal/errors.ts'; +import { ENGINE_ERROR_CODES, EngineError, RETRYABLE_ENGINE_ERROR_CODES } from '@e2e-dev/core/lib/engine/contract'; +import { asEngineError } from '@e2e-dev/core/lib/internal/errors'; /** An EngineError thrown by another copy of the module: same shape, different class. */ function foreign(code: string, retryable: boolean): Error { diff --git a/packages/e2e/tests/unit/engine-guards.test.ts b/packages/e2e/tests/unit/engine-guards.test.ts index 6400440781..e8aeb96ebc 100644 --- a/packages/e2e/tests/unit/engine-guards.test.ts +++ b/packages/e2e/tests/unit/engine-guards.test.ts @@ -5,7 +5,7 @@ */ import { afterEach, describe, expect, it, vi } from 'vitest'; -import { raceAbort, withinCleanupBudget } from '../../src/engine/index.ts'; +import { raceAbort, withinCleanupBudget } from '@e2e-dev/core/lib/engine/index'; afterEach(() => { vi.useRealTimers(); diff --git a/packages/e2e/tests/unit/engine-protocol.test.ts b/packages/e2e/tests/unit/engine-protocol.test.ts index e0668d60db..7521fc5bbf 100644 --- a/packages/e2e/tests/unit/engine-protocol.test.ts +++ b/packages/e2e/tests/unit/engine-protocol.test.ts @@ -23,13 +23,13 @@ import { type EngineInitInfo, type OperationContext, type SemanticNode, -} from '../../src/engine/index.ts'; +} from '@e2e-dev/core/lib/engine/index'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { ConfigurationError, TestTimeoutError } from '../../src/internal/errors.ts'; -import { protocolEngine } from '../../src/engine/protocol/client.ts'; -import { Connection } from '../../src/engine/protocol/connection.ts'; -import type { EngineTransport } from '../../src/engine/protocol/transport.ts'; -import { secretHandle } from '../../src/secrets.ts'; +import { ConfigurationError, TestTimeoutError } from '@e2e-dev/core/lib/internal/errors'; +import { protocolEngine } from '@e2e-dev/core/lib/engine/protocol/client'; +import { Connection } from '@e2e-dev/core/lib/engine/protocol/connection'; +import type { EngineTransport } from '@e2e-dev/core/lib/engine/protocol/transport'; +import { secretHandle } from '@e2e-dev/core/lib/secrets'; const node = (id: string, name: string, role = 'button'): SemanticNode => ({ ref: { id, revision: '' }, role, name }); diff --git a/packages/e2e/tests/unit/engine.test.ts b/packages/e2e/tests/unit/engine.test.ts index 86c4d2a609..84e0a5f9be 100644 --- a/packages/e2e/tests/unit/engine.test.ts +++ b/packages/e2e/tests/unit/engine.test.ts @@ -7,12 +7,12 @@ import { type Engine, type EngineCleanupContext, type EngineSnapshot, -} from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; +} from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { secrets } from '../../src/secrets.ts'; +import { secrets } from '@e2e-dev/core/lib/secrets'; import { snapshot } from '../helpers/snapshot.ts'; -import type { OperationContext, SemanticNode } from '../../src/engine/surface.ts'; +import type { OperationContext, SemanticNode } from '@e2e-dev/core/lib/engine/surface'; const OP: OperationContext = { signal: new AbortController().signal, diff --git a/packages/e2e/tests/unit/errors.test.ts b/packages/e2e/tests/unit/errors.test.ts index 41777571e5..bc69e3d5f0 100644 --- a/packages/e2e/tests/unit/errors.test.ts +++ b/packages/e2e/tests/unit/errors.test.ts @@ -15,8 +15,8 @@ import { translateEngineError, translateProvisioningError, truncateUtf8, -} from '../../src/internal/errors.ts'; -import { EngineError } from '../../src/engine/surface.ts'; +} from '@e2e-dev/core/lib/internal/errors'; +import { EngineError } from '@e2e-dev/core/lib/engine/surface'; describe('translateProvisioningError', () => { it('never yields a test error: an engine error of any code is infrastructure', () => { diff --git a/packages/e2e/tests/unit/expect-async-attributes.test.ts b/packages/e2e/tests/unit/expect-async-attributes.test.ts index 458d6b942c..0dad624b80 100644 --- a/packages/e2e/tests/unit/expect-async-attributes.test.ts +++ b/packages/e2e/tests/unit/expect-async-attributes.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { expect as expectFixture } from '../../src/expect/index.ts'; import { createScreenFixture } from '../helpers/screen-fixture.ts'; import { useFakeTime } from '../helpers/fake-time.ts'; diff --git a/packages/e2e/tests/unit/expect-async-options.test.ts b/packages/e2e/tests/unit/expect-async-options.test.ts index 103562dcb2..3750b6f866 100644 --- a/packages/e2e/tests/unit/expect-async-options.test.ts +++ b/packages/e2e/tests/unit/expect-async-options.test.ts @@ -1,7 +1,7 @@ import { describe, expect as vexpect, it } from 'vitest'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { expect as expectFixture } from '../../src/expect/index.ts'; -import type { AsyncExpectation } from '../../src/types.ts'; +import type { AsyncExpectation } from '@e2e-dev/core/lib/types'; import { createScreenFixture } from '../helpers/screen-fixture.ts'; import { useFakeTime } from '../helpers/fake-time.ts'; diff --git a/packages/e2e/tests/unit/expect-async-value.test.ts b/packages/e2e/tests/unit/expect-async-value.test.ts index cad3db85dc..36fa3d3e61 100644 --- a/packages/e2e/tests/unit/expect-async-value.test.ts +++ b/packages/e2e/tests/unit/expect-async-value.test.ts @@ -1,5 +1,5 @@ import { describe, expect as vexpect, it } from 'vitest'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { expect as expectFixture } from '../../src/expect/index.ts'; import { createScreenFixture } from '../helpers/screen-fixture.ts'; import { useFakeTime } from '../helpers/fake-time.ts'; diff --git a/packages/e2e/tests/unit/expect-missing-frame.test.ts b/packages/e2e/tests/unit/expect-missing-frame.test.ts index 4c94390e72..bad843770f 100644 --- a/packages/e2e/tests/unit/expect-missing-frame.test.ts +++ b/packages/e2e/tests/unit/expect-missing-frame.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect as vexpect, it } from 'vitest'; -import { EngineError, type SemanticNode } from '../../src/engine/index.ts'; +import { EngineError, type SemanticNode } from '@e2e-dev/core/lib/engine/index'; import { expect } from '../../src/expect/index.ts'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/expect-poll.test.ts b/packages/e2e/tests/unit/expect-poll.test.ts index eda78cca5b..ba801b7472 100644 --- a/packages/e2e/tests/unit/expect-poll.test.ts +++ b/packages/e2e/tests/unit/expect-poll.test.ts @@ -1,13 +1,13 @@ import { describe, expect as vexpect, it } from 'vitest'; import { z } from 'zod'; -import { currentAttempt, publishAttempt } from '../../src/expect/attempt.ts'; +import { currentAttempt, publishAttempt } from '@e2e-dev/core/lib/expect/attempt'; import { expect as e2eExpect } from '../../src/expect/index.ts'; -import { currentPollScope, pollLineage, PollScope, runInPollScope } from '../../src/expect/poll-scope.ts'; -import { isAbandonedRejection } from '../../src/internal/abandoned.ts'; -import { SoftFailures } from '../../src/expect/soft.ts'; -import { ConfigurationError, TestError } from '../../src/internal/errors.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; +import { currentPollScope, pollLineage, PollScope, runInPollScope } from '@e2e-dev/core/lib/expect/poll-scope'; +import { isAbandonedRejection } from '@e2e-dev/core/lib/internal/abandoned'; +import { SoftFailures } from '@e2e-dev/core/lib/expect/soft'; +import { ConfigurationError, TestError } from '@e2e-dev/core/lib/internal/errors'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; import { useFakeTime } from '../helpers/fake-time.ts'; useFakeTime(); diff --git a/packages/e2e/tests/unit/expect-soft.test.ts b/packages/e2e/tests/unit/expect-soft.test.ts index 5e4f9eaa93..7159bc200d 100644 --- a/packages/e2e/tests/unit/expect-soft.test.ts +++ b/packages/e2e/tests/unit/expect-soft.test.ts @@ -1,11 +1,11 @@ import { describe, expect as vexpect, it } from 'vitest'; import { z } from 'zod'; -import { publishAttempt } from '../../src/expect/attempt.ts'; +import { publishAttempt } from '@e2e-dev/core/lib/expect/attempt'; import { expect as e2eExpect } from '../../src/expect/index.ts'; -import { SoftFailures, soften } from '../../src/expect/soft.ts'; -import { TestError } from '../../src/internal/errors.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; +import { SoftFailures, soften } from '@e2e-dev/core/lib/expect/soft'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; /** Publishes a fake attempt with its own soft-failure collector; `end()` clears it. */ function attempt(): { soft: SoftFailures; end: () => void } { diff --git a/packages/e2e/tests/unit/expect-values.test.ts b/packages/e2e/tests/unit/expect-values.test.ts index 136be3b740..e4f8e16932 100644 --- a/packages/e2e/tests/unit/expect-values.test.ts +++ b/packages/e2e/tests/unit/expect-values.test.ts @@ -1,7 +1,7 @@ import { describe, expect as vexpect, it } from 'vitest'; import { z } from 'zod'; import { expect as e2eExpect } from '../../src/expect/index.ts'; -import { TestError } from '../../src/internal/errors.ts'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; function failsWith(fn: () => void, pattern: RegExp): void { try { diff --git a/packages/e2e/tests/unit/expected-failure.test.ts b/packages/e2e/tests/unit/expected-failure.test.ts index b390da41e4..a0485b1d66 100644 --- a/packages/e2e/tests/unit/expected-failure.test.ts +++ b/packages/e2e/tests/unit/expected-failure.test.ts @@ -1,11 +1,11 @@ import { describe, expect, it } from 'vitest'; -import { publishAttempt } from '../../src/expect/attempt.ts'; -import { SoftFailures } from '../../src/expect/soft.ts'; -import { serializeError, TestError, type SerializedError } from '../../src/internal/errors.ts'; -import { expectedFailureOption, markRunningTestExpectedToFail, type ExpectedFailureInfo } from '../../src/internal/expected-failure.ts'; +import { publishAttempt } from '@e2e-dev/core/lib/expect/attempt'; +import { SoftFailures } from '@e2e-dev/core/lib/expect/soft'; +import { serializeError, TestError, type SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { expectedFailureOption, markRunningTestExpectedToFail, type ExpectedFailureInfo } from '@e2e-dev/core/lib/internal/expected-failure'; import { settleExpectedFailure } from '../../src/run/expected-failure.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { Deadline } from '../../src/internal/time.ts'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; type Attempt = { status: 'passed' | 'failed' | 'timed-out' | 'interrupted' | 'skipped'; diff --git a/packages/e2e/tests/unit/explore-body.test.ts b/packages/e2e/tests/unit/explore-body.test.ts index 38bde34d49..32f113e3c2 100644 --- a/packages/e2e/tests/unit/explore-body.test.ts +++ b/packages/e2e/tests/unit/explore-body.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; -import { AgentError, isAgentError } from '../../src/agent/error.ts'; -import { setSecretRegistry } from '../../src/secrets.ts'; -import { isSecret } from '../../src/secrets.ts'; +import { AgentError, isAgentError } from '@e2e-dev/core/lib/agent/error'; +import { setSecretRegistry } from '@e2e-dev/core/lib/secrets'; +import { isSecret } from '@e2e-dev/core/lib/secrets'; import { CONSECUTIVE_FAILURE_LIMIT, createExploreBody } from '../../src/explore/body.ts'; import { ExploreState } from '../../src/explore/state.ts'; -import type { Agent, App, TestFixtures } from '../../src/types.ts'; +import type { Agent, App, TestFixtures } from '@e2e-dev/core/lib/types'; import type { ZodType } from 'zod'; type PlanAnswer = { decision: 'step'; title: string; instruction: string } | { decision: 'finish' | 'skip'; summary: string }; diff --git a/packages/e2e/tests/unit/explore-change.test.ts b/packages/e2e/tests/unit/explore-change.test.ts index 17d0490b5c..96e218ff5e 100644 --- a/packages/e2e/tests/unit/explore-change.test.ts +++ b/packages/e2e/tests/unit/explore-change.test.ts @@ -7,9 +7,9 @@ import { chmodSync, symlinkSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import { DEFAULT_LIMITS } from '../../src/config/agent.ts'; +import { DEFAULT_LIMITS } from '@e2e-dev/core/lib/config/agent'; import { changeContext, readExploreChange } from '../../src/explore/change.ts'; -import { staticSecretLedger } from '../../src/run/secrecy.ts'; +import { staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; import { commitFiles, initRepo, runGit, useTempDirs } from '../helpers/git-repo.ts'; const tempDir = useTempDirs(); diff --git a/packages/e2e/tests/unit/explore-plan.test.ts b/packages/e2e/tests/unit/explore-plan.test.ts index f5e5c9c3ea..30d1b0d374 100644 --- a/packages/e2e/tests/unit/explore-plan.test.ts +++ b/packages/e2e/tests/unit/explore-plan.test.ts @@ -22,7 +22,7 @@ describe('planSchema', () => { it('requires every field to be present, as strict providers demand', async () => { expect(PLAN_SCHEMA.safeParse({ decision: 'step', title: 'Cart', instruction: 'open' }).success).toBe(false); - const { deriveJsonSchema } = await import('../../src/agent/model/schema.ts'); + const { deriveJsonSchema } = await import('@e2e-dev/core/lib/agent/model/schema'); const json = (await deriveJsonSchema(PLAN_SCHEMA)) as { required?: string[]; properties?: Record }; expect([...(json.required ?? [])].toSorted()).toEqual(Object.keys(json.properties ?? {}).toSorted()); }); diff --git a/packages/e2e/tests/unit/expression.test.ts b/packages/e2e/tests/unit/expression.test.ts index 7e54fc8473..b612fde846 100644 --- a/packages/e2e/tests/unit/expression.test.ts +++ b/packages/e2e/tests/unit/expression.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import type { LocatorExpression } from '../../src/engine/surface.ts'; +import type { LocatorExpression } from '@e2e-dev/core/lib/engine/surface'; import { describeExpression, expressionHints, @@ -9,7 +9,7 @@ import { roleQuery, testIdQuery, textQuery, -} from '../../src/locator/expression.ts'; +} from '@e2e-dev/core/lib/locator/expression'; describe('locator expressions', () => { it('builds role queries with name and states', () => { diff --git a/packages/e2e/tests/unit/failure-hint.test.ts b/packages/e2e/tests/unit/failure-hint.test.ts index ca334ee7a7..fcd7f122c2 100644 --- a/packages/e2e/tests/unit/failure-hint.test.ts +++ b/packages/e2e/tests/unit/failure-hint.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { loadAiSdk } from '../../src/agent/ai-sdk.ts'; -import { failureHint } from '../../src/agent/model/sdk.ts'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { failureHint } from '@e2e-dev/core/lib/agent/model/sdk'; const { APICallError, RetryError } = await loadAiSdk(); diff --git a/packages/e2e/tests/unit/filter-has.test.ts b/packages/e2e/tests/unit/filter-has.test.ts index 6ae6d36862..06a6a3ee9b 100644 --- a/packages/e2e/tests/unit/filter-has.test.ts +++ b/packages/e2e/tests/unit/filter-has.test.ts @@ -8,9 +8,9 @@ */ import { describe, expect, it } from 'vitest'; -import { resolveExpression, type LocatorExpression, type SemanticNode } from '../../src/engine/index.ts'; -import { roleQuery } from '../../src/locator/expression.ts'; -import type { Locator } from '../../src/types.ts'; +import { resolveExpression, type LocatorExpression, type SemanticNode } from '@e2e-dev/core/lib/engine/index'; +import { roleQuery } from '@e2e-dev/core/lib/locator/expression'; +import type { Locator } from '@e2e-dev/core/lib/types'; import { invalid } from '../helpers/invalid.ts'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/filter-options.test.ts b/packages/e2e/tests/unit/filter-options.test.ts index 4c08a127af..31f61633e3 100644 --- a/packages/e2e/tests/unit/filter-options.test.ts +++ b/packages/e2e/tests/unit/filter-options.test.ts @@ -6,8 +6,8 @@ */ import { describe, expect, it } from 'vitest'; -import { resolveExpression, type LocatorExpression, type SemanticNode } from '../../src/engine/index.ts'; -import type { Locator } from '../../src/types.ts'; +import { resolveExpression, type LocatorExpression, type SemanticNode } from '@e2e-dev/core/lib/engine/index'; +import type { Locator } from '@e2e-dev/core/lib/types'; import { invalid } from '../helpers/invalid.ts'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/fixture-runtime.test.ts b/packages/e2e/tests/unit/fixture-runtime.test.ts index 7b10161020..a75be2803c 100644 --- a/packages/e2e/tests/unit/fixture-runtime.test.ts +++ b/packages/e2e/tests/unit/fixture-runtime.test.ts @@ -1,18 +1,18 @@ import { describe, expect, it, vi } from 'vitest'; import { z } from 'zod'; -import { defineEngine, EngineError, type EngineHandle, LOCATOR_ACTION_KINDS, TestError } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; +import { defineEngine, EngineError, type EngineHandle, LOCATOR_ACTION_KINDS, TestError } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { credentials, secrets, setSecretRegistry } from '../../src/secrets.ts'; +import { credentials, secrets, setSecretRegistry } from '@e2e-dev/core/lib/secrets'; import { expect as expectFixture } from '../../src/expect/index.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; -import type { StepExecutor } from '../../src/agent/executor.ts'; -import { defineTool, getToolContext } from '../../src/agent/tool.ts'; -import type { TargetApp } from '../../src/types.ts'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; +import type { StepExecutor } from '@e2e-dev/core/lib/agent/executor'; +import { defineTool, getToolContext } from '@e2e-dev/core/lib/agent/tool'; +import type { TargetApp } from '@e2e-dev/core/lib/types'; import type { E2EConfig } from '../../src/run-types.ts'; import { installFakeLoopModel } from '../helpers/fake-loop-model.ts'; import { extracted, fakeCalls, installFakeModel, judgment, notFound } from '../helpers/fake-model.ts'; diff --git a/packages/e2e/tests/unit/geometry.test.ts b/packages/e2e/tests/unit/geometry.test.ts index b9756a0cb6..85df8dc68e 100644 --- a/packages/e2e/tests/unit/geometry.test.ts +++ b/packages/e2e/tests/unit/geometry.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { overlapShare, viewportShare } from '../../src/internal/geometry.ts'; +import { overlapShare, viewportShare } from '@e2e-dev/core/lib/internal/geometry'; const viewport = { width: 400, height: 800 }; diff --git a/packages/e2e/tests/unit/globs-walk.test.ts b/packages/e2e/tests/unit/globs-walk.test.ts index 05962573cf..a81efe3a8f 100644 --- a/packages/e2e/tests/unit/globs-walk.test.ts +++ b/packages/e2e/tests/unit/globs-walk.test.ts @@ -4,7 +4,7 @@ import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; -import { discoverFiles } from '../../src/internal/globs.ts'; +import { discoverFiles } from '@e2e-dev/core/lib/internal/globs'; const { readDirectories } = vi.hoisted(() => ({ readDirectories: [] as string[] })); diff --git a/packages/e2e/tests/unit/globs.test.ts b/packages/e2e/tests/unit/globs.test.ts index a5557956c7..eea9e70ff5 100644 --- a/packages/e2e/tests/unit/globs.test.ts +++ b/packages/e2e/tests/unit/globs.test.ts @@ -10,7 +10,7 @@ import { GLOB_SYNTAX, literalPrefix, matchesGlob, -} from '../../src/internal/globs.ts'; +} from '@e2e-dev/core/lib/internal/globs'; function matches(pattern: string, candidate: string): boolean { return matchesGlob(compileGlob(pattern), candidate); diff --git a/packages/e2e/tests/unit/ids.test.ts b/packages/e2e/tests/unit/ids.test.ts index 614b8082d9..86f97bce72 100644 --- a/packages/e2e/tests/unit/ids.test.ts +++ b/packages/e2e/tests/unit/ids.test.ts @@ -8,7 +8,7 @@ import { testId, uuidv7, validateTitle, -} from '../../src/internal/ids.ts'; +} from '@e2e-dev/core/lib/internal/ids'; describe('encodeTitle', () => { it('percent-encodes every other byte as uppercase %HH', () => { diff --git a/packages/e2e/tests/unit/image-codec.test.ts b/packages/e2e/tests/unit/image-codec.test.ts index 48eb315e13..c0162ee98f 100644 --- a/packages/e2e/tests/unit/image-codec.test.ts +++ b/packages/e2e/tests/unit/image-codec.test.ts @@ -2,9 +2,9 @@ import { registerHooks } from 'node:module'; import { afterAll, describe, expect, it } from 'vitest'; -import { downscalePixels } from '../../src/agent/pixels.ts'; -import { InfrastructureError } from '../../src/internal/errors.ts'; -import { clipBox, compareImages, cropImage, decodePng, encodePng, resampleImage, type RgbaImage } from '../../src/internal/image.ts'; +import { downscalePixels } from '@e2e-dev/core/lib/agent/pixels'; +import { InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { clipBox, compareImages, cropImage, decodePng, encodePng, resampleImage, type RgbaImage } from '@e2e-dev/core/lib/internal/image'; // What the loader reports when npm left the binding out. This file imports nothing that loads the addon, so no earlier test in the process has. let loaderFailure = new Error('Cannot find native binding. npm has a bug related to optional dependencies'); diff --git a/packages/e2e/tests/unit/image.test.ts b/packages/e2e/tests/unit/image.test.ts index 0165010512..4d7fc951a9 100644 --- a/packages/e2e/tests/unit/image.test.ts +++ b/packages/e2e/tests/unit/image.test.ts @@ -3,7 +3,7 @@ import { crc32, deflateSync } from 'node:zlib'; import { Transformer } from '@napi-rs/image'; import { describe, expect, it } from 'vitest'; -import { clipBox, compareImages, cropImage, decodePng, encodePng, fillBoxes, resampleImage, type RgbaImage } from '../../src/internal/image.ts'; +import { clipBox, compareImages, cropImage, decodePng, encodePng, fillBoxes, resampleImage, type RgbaImage } from '@e2e-dev/core/lib/internal/image'; /** A width by height image of one gray level. */ function gray(width: number, height: number, level: number): RgbaImage { diff --git a/packages/e2e/tests/unit/json-value.test.ts b/packages/e2e/tests/unit/json-value.test.ts index 6a2c736e4e..5832e478d0 100644 --- a/packages/e2e/tests/unit/json-value.test.ts +++ b/packages/e2e/tests/unit/json-value.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { validateJsonValue } from '../../src/internal/json-value.ts'; +import { validateJsonValue } from '@e2e-dev/core/lib/internal/json-value'; describe('validateJsonValue', () => { it('accepts the same object reached twice by different paths', () => { diff --git a/packages/e2e/tests/unit/last-run.test.ts b/packages/e2e/tests/unit/last-run.test.ts index 190832d16d..5cd95e71c8 100644 --- a/packages/e2e/tests/unit/last-run.test.ts +++ b/packages/e2e/tests/unit/last-run.test.ts @@ -2,7 +2,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import { resultId } from '../../src/internal/ids.ts'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; import type { Report1Document } from '../../src/report/build.ts'; import { carryForward, fileDurationKey, lastFailedIds, previousFileDurations, readLastRun, reportArtifactPaths } from '../../src/run/last-run.ts'; diff --git a/packages/e2e/tests/unit/locator-action-options.test.ts b/packages/e2e/tests/unit/locator-action-options.test.ts index ec1ee74b83..06d3c2710b 100644 --- a/packages/e2e/tests/unit/locator-action-options.test.ts +++ b/packages/e2e/tests/unit/locator-action-options.test.ts @@ -7,8 +7,8 @@ */ import { describe, expect, it, vi } from 'vitest'; -import { resolveExpression, type KeyModifier, type LocatorAction, type LocatorExpression } from '../../src/engine/index.ts'; -import type { ActionOptions, Locator, Screen } from '../../src/types.ts'; +import { resolveExpression, type KeyModifier, type LocatorAction, type LocatorExpression } from '@e2e-dev/core/lib/engine/index'; +import type { ActionOptions, Locator, Screen } from '@e2e-dev/core/lib/types'; import { invalid } from '../helpers/invalid.ts'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/locator-basics.test.ts b/packages/e2e/tests/unit/locator-basics.test.ts index 3dbfead7c9..83d4168bb5 100644 --- a/packages/e2e/tests/unit/locator-basics.test.ts +++ b/packages/e2e/tests/unit/locator-basics.test.ts @@ -6,7 +6,7 @@ */ import { describe, expect, it } from 'vitest'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { expect as expectFixture } from '../../src/expect/index.ts'; import { createScreenFixture, SCREEN_FIXTURE_TIMEOUT_MS } from '../helpers/screen-fixture.ts'; import { useFakeTime } from '../helpers/fake-time.ts'; diff --git a/packages/e2e/tests/unit/locator-engine.test.ts b/packages/e2e/tests/unit/locator-engine.test.ts index b5d25349ba..5dfcd3c33b 100644 --- a/packages/e2e/tests/unit/locator-engine.test.ts +++ b/packages/e2e/tests/unit/locator-engine.test.ts @@ -12,14 +12,14 @@ import { type NodeRef, type SemanticNode, type OperationContext, -} from '../../src/engine/surface.ts'; -import { LocatorEngine, isNodeVisible, translateLocatorError } from '../../src/locator/engine.ts'; -import { E2EError } from '../../src/internal/errors.ts'; -import { Deadline, sleep, withTimeout } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { defineEngine, LOCATOR_ACTION_KINDS } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { describeExpression, filterExpression, indexExpression, roleQuery, testIdQuery, textQuery } from '../../src/locator/expression.ts'; +} from '@e2e-dev/core/lib/engine/surface'; +import { LocatorEngine, isNodeVisible, translateLocatorError } from '@e2e-dev/core/lib/locator/engine'; +import { E2EError } from '@e2e-dev/core/lib/internal/errors'; +import { Deadline, sleep, withTimeout } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { defineEngine, LOCATOR_ACTION_KINDS } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { describeExpression, filterExpression, indexExpression, roleQuery, testIdQuery, textQuery } from '@e2e-dev/core/lib/locator/expression'; import { snapshot } from '../helpers/snapshot.ts'; import { useFakeTime } from '../helpers/fake-time.ts'; diff --git a/packages/e2e/tests/unit/locator-union.test.ts b/packages/e2e/tests/unit/locator-union.test.ts index 71f8e56e0f..063ecfb6cc 100644 --- a/packages/e2e/tests/unit/locator-union.test.ts +++ b/packages/e2e/tests/unit/locator-union.test.ts @@ -5,8 +5,8 @@ */ import { describe, expect, it } from 'vitest'; -import { resolveExpression, type LocatorExpression, type SemanticNode } from '../../src/engine/index.ts'; -import type { Locator } from '../../src/types.ts'; +import { resolveExpression, type LocatorExpression, type SemanticNode } from '@e2e-dev/core/lib/engine/index'; +import type { Locator } from '@e2e-dev/core/lib/types'; import { invalid } from '../helpers/invalid.ts'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/locator-wait-for.test.ts b/packages/e2e/tests/unit/locator-wait-for.test.ts index b75f33fd51..4819f5a8f2 100644 --- a/packages/e2e/tests/unit/locator-wait-for.test.ts +++ b/packages/e2e/tests/unit/locator-wait-for.test.ts @@ -6,10 +6,10 @@ */ import { afterEach, describe, expect, it } from 'vitest'; -import { EngineError, resolveExpression, type SemanticNode } from '../../src/engine/index.ts'; +import { EngineError, resolveExpression, type SemanticNode } from '@e2e-dev/core/lib/engine/index'; import { expect as expectFixture } from '../../src/expect/index.ts'; -import { sleep, withTimeout } from '../../src/internal/time.ts'; -import type { Locator } from '../../src/types.ts'; +import { sleep, withTimeout } from '@e2e-dev/core/lib/internal/time'; +import type { Locator } from '@e2e-dev/core/lib/types'; import { invalid } from '../helpers/invalid.ts'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/loop-guards.test.ts b/packages/e2e/tests/unit/loop-guards.test.ts index ecb19bd8a5..5414e7481d 100644 --- a/packages/e2e/tests/unit/loop-guards.test.ts +++ b/packages/e2e/tests/unit/loop-guards.test.ts @@ -8,7 +8,7 @@ import { type GuardToolCall, type GuardToolResult, isFailedResult, -} from '../../src/agent/loop-guards.ts'; +} from '@e2e-dev/core/lib/agent/loop-guards'; const call = (toolName: string, input = '{}'): GuardToolCall => ({ toolName, input }); diff --git a/packages/e2e/tests/unit/managed-process-exit.test.ts b/packages/e2e/tests/unit/managed-process-exit.test.ts index 52c85f5fb9..c255bc45a8 100644 --- a/packages/e2e/tests/unit/managed-process-exit.test.ts +++ b/packages/e2e/tests/unit/managed-process-exit.test.ts @@ -2,8 +2,8 @@ import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it, vi } from 'vitest'; -import { InfrastructureError } from '../../src/internal/errors.ts'; -import { ManagedProcess } from '../../src/run/managed-process.ts'; +import { InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { ManagedProcess } from '@e2e-dev/core/lib/run/managed-process'; import { freePort } from '../helpers/free-port.ts'; /** Whether the operating system still sees the managed child. */ diff --git a/packages/e2e/tests/unit/managed-process.test.ts b/packages/e2e/tests/unit/managed-process.test.ts index 0aba698dcd..7614daceb1 100644 --- a/packages/e2e/tests/unit/managed-process.test.ts +++ b/packages/e2e/tests/unit/managed-process.test.ts @@ -5,9 +5,9 @@ import http from 'node:http'; import os from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { InfrastructureError } from '../../src/internal/errors.ts'; -import { ManagedProcess, stopsSettled } from '../../src/run/managed-process.ts'; -import type { CommandConfig } from '../../src/types.ts'; +import { InfrastructureError } from '@e2e-dev/core/lib/internal/errors'; +import { ManagedProcess, stopsSettled } from '@e2e-dev/core/lib/run/managed-process'; +import type { CommandConfig } from '@e2e-dev/core/lib/types'; import { freePort } from '../helpers/free-port.ts'; describe('ManagedProcess', () => { diff --git a/packages/e2e/tests/unit/mcp-output.test.ts b/packages/e2e/tests/unit/mcp-output.test.ts index fb451c6c9f..e628783c1a 100644 --- a/packages/e2e/tests/unit/mcp-output.test.ts +++ b/packages/e2e/tests/unit/mcp-output.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { SecretLedger } from '../../src/internal/redact.ts'; +import { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; import { McpOutput } from '../../src/mcp/output.ts'; const TOKEN = 'mcp-output-token-1'; diff --git a/packages/e2e/tests/unit/mcp-recording.test.ts b/packages/e2e/tests/unit/mcp-recording.test.ts index 7d43516cd6..f331d9f820 100644 --- a/packages/e2e/tests/unit/mcp-recording.test.ts +++ b/packages/e2e/tests/unit/mcp-recording.test.ts @@ -2,7 +2,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync import os from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import type { OperationContext, VideoSegment } from '../../src/engine/surface.ts'; +import type { OperationContext, VideoSegment } from '@e2e-dev/core/lib/engine/surface'; import { describeRecording, SessionRecorder } from '../../src/mcp/recording.ts'; describe('SessionRecorder', () => { diff --git a/packages/e2e/tests/unit/mcp-session.test.ts b/packages/e2e/tests/unit/mcp-session.test.ts index 256953ff46..de697ae795 100644 --- a/packages/e2e/tests/unit/mcp-session.test.ts +++ b/packages/e2e/tests/unit/mcp-session.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import type { SemanticNode } from '../../src/engine/surface.ts'; -import { SecretLedger } from '../../src/internal/redact.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; import { describeLocate, locateQuery } from '../../src/mcp/catalog.ts'; function node(role: string, name: string, extra: Partial = {}): SemanticNode { diff --git a/packages/e2e/tests/unit/mcp-test-lines.test.ts b/packages/e2e/tests/unit/mcp-test-lines.test.ts index 89ffad2599..32648582d3 100644 --- a/packages/e2e/tests/unit/mcp-test-lines.test.ts +++ b/packages/e2e/tests/unit/mcp-test-lines.test.ts @@ -7,12 +7,12 @@ import type { ToolSet } from 'ai'; import { describe, expect, it } from 'vitest'; -import type { ExecutorActions, ExecutorNode, ExecutorObservation, ExecutorObserveOptions, StepExecutorContext } from '../../src/agent/executor.ts'; -import { GRAMMAR_TOOL_NAMES } from '../../src/agent/action-names.ts'; -import { createGrammarTools } from '../../src/agent/primitives.ts'; -import type { LocatorExpression, NodeRef, SemanticNode } from '../../src/engine/surface.ts'; -import { TestError } from '../../src/internal/errors.ts'; -import { describeExpression } from '../../src/locator/expression.ts'; +import type { ExecutorActions, ExecutorNode, ExecutorObservation, ExecutorObserveOptions, StepExecutorContext } from '@e2e-dev/core/lib/agent/executor'; +import { GRAMMAR_TOOL_NAMES } from '@e2e-dev/core/lib/agent/action-names'; +import { createGrammarTools } from '@e2e-dev/core/lib/agent/primitives'; +import type { LocatorExpression, NodeRef, SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; +import { describeExpression } from '@e2e-dev/core/lib/locator/expression'; import { locateQuery } from '../../src/mcp/catalog.ts'; import { navigationLine, nodeQueries, SessionTestLines } from '../../src/mcp/test-lines.ts'; import { invokeTool } from '../../src/mcp/tools.ts'; diff --git a/packages/e2e/tests/unit/mcp-tools-without-ai.test.ts b/packages/e2e/tests/unit/mcp-tools-without-ai.test.ts index 30bac92946..04b546df44 100644 --- a/packages/e2e/tests/unit/mcp-tools-without-ai.test.ts +++ b/packages/e2e/tests/unit/mcp-tools-without-ai.test.ts @@ -1,7 +1,7 @@ import type { ToolSet } from 'ai'; import { z } from 'zod'; import { describe, expect, it, vi } from 'vitest'; -import { loadAiSdk } from '../../src/agent/ai-sdk.ts'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; import { catalogLine, invokeTool, toolJsonSchema } from '../../src/mcp/tools.ts'; // A project that never installed the optional `ai` peer. diff --git a/packages/e2e/tests/unit/mcp-tools.test.ts b/packages/e2e/tests/unit/mcp-tools.test.ts index 771d5fb55a..65c4d61d6d 100644 --- a/packages/e2e/tests/unit/mcp-tools.test.ts +++ b/packages/e2e/tests/unit/mcp-tools.test.ts @@ -1,10 +1,10 @@ import type { Tool, ToolSet } from 'ai'; import { z } from 'zod'; import { beforeAll, describe, expect, it, vi } from 'vitest'; -import { loadAiSdk } from '../../src/agent/ai-sdk.ts'; -import { createGrammarTools } from '../../src/agent/primitives.ts'; -import { ScreenPresenter } from '../../src/agent/screen-update.ts'; -import { TestError } from '../../src/internal/errors.ts'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { createGrammarTools } from '@e2e-dev/core/lib/agent/primitives'; +import { ScreenPresenter } from '@e2e-dev/core/lib/agent/screen-update'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; import { createSessionCatalog } from '../../src/mcp/catalog.ts'; import { catalogLine, describeToolDetail, errorResult, invokeTool, resultFromOutput, toolJsonSchema } from '../../src/mcp/tools.ts'; import { fakeExecutorContext } from '../helpers/fake-executor-context.ts'; diff --git a/packages/e2e/tests/unit/message-shape.test.ts b/packages/e2e/tests/unit/message-shape.test.ts index 1c9288e39b..a46842fd77 100644 --- a/packages/e2e/tests/unit/message-shape.test.ts +++ b/packages/e2e/tests/unit/message-shape.test.ts @@ -1,6 +1,6 @@ import type { ModelMessage } from 'ai'; import { describe, expect, it } from 'vitest'; -import { shapeOf } from '../../src/agent/message-shape.ts'; +import { shapeOf } from '@e2e-dev/core/lib/agent/message-shape'; const bytes = () => new Uint8Array([137, 80, 78, 71]); diff --git a/packages/e2e/tests/unit/model-overflow.test.ts b/packages/e2e/tests/unit/model-overflow.test.ts index 799e46f520..e3518a1399 100644 --- a/packages/e2e/tests/unit/model-overflow.test.ts +++ b/packages/e2e/tests/unit/model-overflow.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { isContextOverflow } from '../../src/agent/model/overflow.ts'; +import { isContextOverflow } from '@e2e-dev/core/lib/agent/model/overflow'; describe('isContextOverflow', () => { it.each([ diff --git a/packages/e2e/tests/unit/model-request-headers.test.ts b/packages/e2e/tests/unit/model-request-headers.test.ts index f5f58aea73..d51cc91227 100644 --- a/packages/e2e/tests/unit/model-request-headers.test.ts +++ b/packages/e2e/tests/unit/model-request-headers.test.ts @@ -1,17 +1,17 @@ import { createOpenAICompatible } from '@ai-sdk/openai-compatible'; import { z } from 'zod'; import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import { createModelAdapter } from '../../src/agent/model/sdk.ts'; -import { defineTool } from '../../src/agent/tool.ts'; +import { createModelAdapter } from '@e2e-dev/core/lib/agent/model/sdk'; +import { defineTool } from '@e2e-dev/core/lib/agent/tool'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { USER_AGENT } from '../../src/internal/client-identity.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { USER_AGENT } from '@e2e-dev/core/lib/internal/client-identity'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import { json, startServer } from '../helpers/recording-server.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/model-usage.test.ts b/packages/e2e/tests/unit/model-usage.test.ts index 41f132e817..8b0f2a8447 100644 --- a/packages/e2e/tests/unit/model-usage.test.ts +++ b/packages/e2e/tests/unit/model-usage.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { ModelUsage } from '../../src/agent/usage.ts'; +import { ModelUsage } from '@e2e-dev/core/lib/agent/usage'; const provenance = { provider: 'test', model: 'test', endpoint: 'default', adapterVersion: '1', policyVersion: '1' }; diff --git a/packages/e2e/tests/unit/no-output-error.test.ts b/packages/e2e/tests/unit/no-output-error.test.ts index 0b8664cb67..1afc9afe8b 100644 --- a/packages/e2e/tests/unit/no-output-error.test.ts +++ b/packages/e2e/tests/unit/no-output-error.test.ts @@ -8,10 +8,10 @@ */ import { describe, expect, it } from 'vitest'; -import { isAgentError } from '../../src/agent/error.ts'; -import { createModelAdapter } from '../../src/agent/model/sdk.ts'; -import type { ModelCall } from '../../src/agent/model/adapter.ts'; -import type { ModelInstance } from '../../src/types.ts'; +import { isAgentError } from '@e2e-dev/core/lib/agent/error'; +import { createModelAdapter } from '@e2e-dev/core/lib/agent/model/sdk'; +import type { ModelCall } from '@e2e-dev/core/lib/agent/model/adapter'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; import { createScriptedInstance, scriptedResult } from '../helpers/scripted-model.ts'; function adapter(model: ModelInstance) { diff --git a/packages/e2e/tests/unit/oauth/copilot.test.ts b/packages/e2e/tests/unit/oauth/copilot.test.ts index 601aab3197..55b6dba188 100644 --- a/packages/e2e/tests/unit/oauth/copilot.test.ts +++ b/packages/e2e/tests/unit/oauth/copilot.test.ts @@ -3,7 +3,7 @@ import { z } from 'zod'; import { afterEach, describe, expect, it } from 'vitest'; import { copilot } from '../../../src/oauth/copilot.ts'; import { copilotBaseUrl, copilotProtocolFor, copilotRefusal, createCopilotProvider, enterpriseHost, sendCopilotRequest } from '../../../src/oauth/providers/github-copilot.ts'; -import { unservedModelExplanation } from '../../../src/internal/unserved-model.ts'; +import { unservedModelExplanation } from '@e2e-dev/core/lib/internal/unserved-model'; import { json, useServers, type Received } from '../../helpers/recording-server.ts'; import { echoUpstream, useVendor, type Echo } from './helpers/vendor.ts'; import { onFakeTimeouts } from './helpers/time.ts'; diff --git a/packages/e2e/tests/unit/oauth/opencode-console.test.ts b/packages/e2e/tests/unit/oauth/opencode-console.test.ts index ad24e05a5e..c9f326a951 100644 --- a/packages/e2e/tests/unit/oauth/opencode-console.test.ts +++ b/packages/e2e/tests/unit/oauth/opencode-console.test.ts @@ -1,7 +1,7 @@ import { generateText, tool } from 'ai'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { z } from 'zod'; -import { promptCacheKey } from '../../../src/agent/model/provider-hints.ts'; +import { promptCacheKey } from '@e2e-dev/core/lib/agent/model/provider-hints'; import { createOAuthFetch } from '../../../src/oauth/fetch.ts'; import { opencodeConsole } from '../../../src/oauth/opencode-console.ts'; import { listModels } from '../../../src/oauth/models.ts'; diff --git a/packages/e2e/tests/unit/openai-second-turn.test.ts b/packages/e2e/tests/unit/openai-second-turn.test.ts index 9f24c24a9d..8a7d193344 100644 --- a/packages/e2e/tests/unit/openai-second-turn.test.ts +++ b/packages/e2e/tests/unit/openai-second-turn.test.ts @@ -10,7 +10,7 @@ import { createOpenAI } from '@ai-sdk/openai'; import { jsonSchema, stepCountIs, tool, ToolLoopAgent } from 'ai'; import { describe, expect, it } from 'vitest'; -import { promptCacheKey, providerHints, type ProviderModelRef } from '../../src/agent/model/provider-hints.ts'; +import { promptCacheKey, providerHints, type ProviderModelRef } from '@e2e-dev/core/lib/agent/model/provider-hints'; const USAGE = { input_tokens: 3, diff --git a/packages/e2e/tests/unit/options.test.ts b/packages/e2e/tests/unit/options.test.ts index fcfaad5bf9..dd0ffa6ad8 100644 --- a/packages/e2e/tests/unit/options.test.ts +++ b/packages/e2e/tests/unit/options.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { TestError } from '../../src/internal/errors.ts'; -import { rejectUnknownOptions } from '../../src/internal/options.ts'; +import { TestError } from '@e2e-dev/core/lib/internal/errors'; +import { rejectUnknownOptions } from '@e2e-dev/core/lib/internal/options'; const KNOWN = ['timeout', 'interval', 'maxModelCalls', 'vision']; diff --git a/packages/e2e/tests/unit/package-imports.test.ts b/packages/e2e/tests/unit/package-imports.test.ts index 80582b0985..af20de2479 100644 --- a/packages/e2e/tests/unit/package-imports.test.ts +++ b/packages/e2e/tests/unit/package-imports.test.ts @@ -3,7 +3,7 @@ * builtin, one of its `dependencies`, or a peer. A devDependency, a sibling * package, or a typo resolves on this checkout, where the workspace hoists * everything, and fails the first project to install the tarball. Optional - * peers are stricter: `ai` is loaded lazily by one module and each + * peers are stricter: `ai` is loaded lazily by one module of `@e2e-dev/core` and each * `@ai-sdk/*` provider by the `e2e/oauth/*` constructor that wraps it, so the * CLI boots (and `npx e2e init` runs) before any of them is installed, and * the mobile tool pack names `ai` in types only. `copilot()` loads @@ -40,7 +40,7 @@ const SCOPES: readonly Scope[] = [ { dir: 'e2e', optionalPeerHomes: { - ai: ['agent/ai-sdk.ts'], + ai: [], '@ai-sdk/anthropic': ['oauth/opencode-console.ts'], '@ai-sdk/google': ['oauth/opencode-console.ts'], '@ai-sdk/openai': ['oauth/chatgpt.ts', 'oauth/copilot.ts', 'oauth/opencode-console.ts'], @@ -51,6 +51,7 @@ const SCOPES: readonly Scope[] = [ { dir: 'web', optionalPeerHomes: {} }, { dir: 'mobile', optionalPeerHomes: { ai: [] } }, { dir: 'github', optionalPeerHomes: {} }, + { dir: 'core', optionalPeerHomes: { ai: ['agent/ai-sdk.ts'] } }, ]; /** A block comment, a template literal, or a line comment: where an import statement is only quoted. */ @@ -141,7 +142,7 @@ describe.each(SCOPES)('packages/$dir/src', (scope) => { describe('the ai package', () => { it('is reached at runtime only through the lazy loader', () => { - const loader = readFileSync(path.join(PACKAGES, 'e2e/src/agent/ai-sdk.ts'), 'utf8'); + const loader = readFileSync(path.join(PACKAGES, 'core/src/agent/ai-sdk.ts'), 'utf8'); const packages = valueImports(loader).filter((found) => !found.specifier.startsWith('.')); expect(packages).toEqual([{ specifier: 'ai', text: "import('ai')" }]); }); @@ -153,21 +154,35 @@ function staticImports(source: string): string[] { return [...code.matchAll(STATIC)].filter((match) => match[1] === undefined).map((match) => match[2]!); } +/** The `@e2e-dev/core` entries and its `lib/*` modules, as files under `packages/core/src`. */ +const CORE_ENTRIES: Readonly> = { '@e2e-dev/core/engine': 'engine/index.ts' }; + +/** The module under `packages//src` a specifier names, `@e2e-dev/core`'s included, or undefined for another package. */ +function sourceModule(dir: string, file: string, specifier: string): string | undefined { + if (specifier.startsWith('.')) return path.join(dir, path.normalize(path.join(path.dirname(file), specifier))); + if (specifier.startsWith('@e2e-dev/core/lib/')) return path.join('core', `${specifier.slice('@e2e-dev/core/lib/'.length)}.ts`); + const entry = CORE_ENTRIES[specifier]; + return entry === undefined ? undefined : path.join('core', entry); +} + /** * Every package the static imports reach from `entry`, each with the chain of - * files that leads to it. A dynamic import is not followed: that module loads - * when the code that asks for it runs. + * files that leads to it, through `@e2e-dev/core` too, since `e2e` runs on it. A + * dynamic import is not followed: that module loads when the code that asks + * for it runs. */ function startupPackages(dir: string, entry: string): Map { - const src = path.join(PACKAGES, dir, 'src'); - const chains = new Map([[entry, [entry]]]); + const start = path.join(dir, entry); + const chains = new Map([[start, [start]]]); const reached = new Map(); - const queue = [entry]; - for (const file of queue) { - const chain = chains.get(file)!; - for (const specifier of staticImports(readFileSync(path.join(src, file), 'utf8'))) { - if (specifier.startsWith('.')) { - const next = path.normalize(path.join(path.dirname(file), specifier)); + const queue = [start]; + for (const module of queue) { + const chain = chains.get(module)!; + const [owner, ...rest] = module.split(path.sep); + const file = rest.join(path.sep); + for (const specifier of staticImports(readFileSync(path.join(PACKAGES, owner!, 'src', file), 'utf8'))) { + const next = sourceModule(owner!, file, specifier); + if (next !== undefined) { if (chains.has(next)) continue; chains.set(next, [...chain, next]); queue.push(next); @@ -234,17 +249,22 @@ describe('the scan', () => { }); it('objects to a devDependency, a bare builtin, and an optional peer outside its home', () => { - const e2e = SCOPES[0]!; + const scope = (dir: string): Scope => SCOPES.find((candidate) => candidate.dir === dir)!; + const e2e = scope('e2e'); const manifest = manifestOf(e2e); - expect(objection(e2e, manifest, 'run/steps.ts', 'node:path')).toBeUndefined(); - expect(objection(e2e, manifest, 'run/steps.ts', '../internal/ids.ts')).toBeUndefined(); - expect(objection(e2e, manifest, 'run/steps.ts', 'commander')).toBeUndefined(); - expect(objection(e2e, manifest, 'agent/ai-sdk.ts', 'ai')).toBeUndefined(); - expect(objection(e2e, manifest, 'run/steps.ts', 'ai')).toBe('ai is an optional peer of e2e; load it from agent/ai-sdk.ts only'); - expect(objection(e2e, manifest, 'run/steps.ts', 'path')).toBe('path is a builtin; import it as node:path'); - expect(objection(e2e, manifest, 'run/steps.ts', 'playwright')).toBe('playwright is neither a dependency nor a peer of e2e'); - expect(objection(e2e, manifest, 'run/steps.ts', '@e2e-dev/web')).toBe('@e2e-dev/web is neither a dependency nor a peer of e2e'); - const mobile = SCOPES[2]!; + expect(objection(e2e, manifest, 'run/runner.ts', 'node:path')).toBeUndefined(); + expect(objection(e2e, manifest, 'run/runner.ts', '../internal/git.ts')).toBeUndefined(); + expect(objection(e2e, manifest, 'run/runner.ts', 'commander')).toBeUndefined(); + expect(objection(e2e, manifest, 'run/runner.ts', '@e2e-dev/core/lib/run/steps')).toBeUndefined(); + expect(objection(e2e, manifest, 'run/runner.ts', 'ai')).toBe('ai is an optional peer of e2e; import its types only'); + expect(objection(e2e, manifest, 'run/runner.ts', 'path')).toBe('path is a builtin; import it as node:path'); + expect(objection(e2e, manifest, 'run/runner.ts', 'playwright')).toBe('playwright is neither a dependency nor a peer of e2e'); + expect(objection(e2e, manifest, 'run/runner.ts', '@e2e-dev/web')).toBe('@e2e-dev/web is neither a dependency nor a peer of e2e'); + const core = scope('core'); + expect(objection(core, manifestOf(core), 'agent/ai-sdk.ts', 'ai')).toBeUndefined(); + expect(objection(core, manifestOf(core), 'run/steps.ts', 'ai')).toBe('ai is an optional peer of @e2e-dev/core; load it from agent/ai-sdk.ts only'); + expect(objection(core, manifestOf(core), 'run/steps.ts', 'e2e')).toBe('e2e is neither a dependency nor a peer of @e2e-dev/core'); + const mobile = scope('mobile'); expect(objection(mobile, manifestOf(mobile), 'tools.ts', 'ai')).toBe('ai is an optional peer of @e2e-dev/mobile; import its types only'); }); }); diff --git a/packages/e2e/tests/unit/package-version.test.ts b/packages/e2e/tests/unit/package-version.test.ts index 5834b32660..534703374d 100644 --- a/packages/e2e/tests/unit/package-version.test.ts +++ b/packages/e2e/tests/unit/package-version.test.ts @@ -1,6 +1,6 @@ import { createRequire } from 'node:module'; import { describe, expect, it } from 'vitest'; -import { packageVersion, readJson } from '../../src/internal/package-version.ts'; +import { packageVersion, readJson } from '@e2e-dev/core/lib/internal/package-version'; describe('packageVersion', () => { it('reads the version of a resolvable package.json (mirrors a driver manifest)', () => { diff --git a/packages/e2e/tests/unit/press-sequentially.test.ts b/packages/e2e/tests/unit/press-sequentially.test.ts index a5492399f2..edfb07d0d3 100644 --- a/packages/e2e/tests/unit/press-sequentially.test.ts +++ b/packages/e2e/tests/unit/press-sequentially.test.ts @@ -5,9 +5,9 @@ */ import { afterEach, describe, expect, it, vi } from 'vitest'; -import { LOCATOR_ACTION_KINDS, type LocatorActionKind } from '../../src/engine/index.ts'; +import { LOCATOR_ACTION_KINDS, type LocatorActionKind } from '@e2e-dev/core/lib/engine/index'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { secrets, setSecretRegistry } from '../../src/secrets.ts'; +import { secrets, setSecretRegistry } from '@e2e-dev/core/lib/secrets'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/process-output.test.ts b/packages/e2e/tests/unit/process-output.test.ts index 0c90e5bcf4..1b35a7adf3 100644 --- a/packages/e2e/tests/unit/process-output.test.ts +++ b/packages/e2e/tests/unit/process-output.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { SecretLedger } from '../../src/internal/redact.ts'; +import { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; import { RunnerOutput, type OutputStream } from '../../src/run/process-output.ts'; const TOKEN = 'runner-output-token-1'; diff --git a/packages/e2e/tests/unit/provider-failure-message.test.ts b/packages/e2e/tests/unit/provider-failure-message.test.ts index 649aab2aaf..fe7d67ebc8 100644 --- a/packages/e2e/tests/unit/provider-failure-message.test.ts +++ b/packages/e2e/tests/unit/provider-failure-message.test.ts @@ -1,15 +1,15 @@ import { createOpenAICompatible } from '@ai-sdk/openai-compatible'; import { afterEach, describe, expect, it } from 'vitest'; -import { loadAiSdk } from '../../src/agent/ai-sdk.ts'; +import { loadAiSdk } from '@e2e-dev/core/lib/agent/ai-sdk'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { providerFailureMessage, setErrorRedactor } from '../../src/internal/errors.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { providerFailureMessage, setErrorRedactor } from '@e2e-dev/core/lib/internal/errors'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import type { E2EConfig } from '../../src/run-types.ts'; import { runAgentStepsOnFakeTime } from '../helpers/agent-fake-time.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/provider-hints.test.ts b/packages/e2e/tests/unit/provider-hints.test.ts index 19c13a2a59..76807b33f7 100644 --- a/packages/e2e/tests/unit/provider-hints.test.ts +++ b/packages/e2e/tests/unit/provider-hints.test.ts @@ -3,7 +3,7 @@ import { createOpenAICompatible } from '@ai-sdk/openai-compatible'; import type { LanguageModelV4 } from '@ai-sdk/provider'; import type { ModelMessage } from 'ai'; import { describe, expect, it } from 'vitest'; -import { promptCacheKey, providerHints, type ProviderModelRef } from '../../src/agent/model/provider-hints.ts'; +import { promptCacheKey, providerHints, type ProviderModelRef } from '@e2e-dev/core/lib/agent/model/provider-hints'; const BREAKPOINT = { cacheControl: { type: 'ephemeral' } }; diff --git a/packages/e2e/tests/unit/provider-recording.test.ts b/packages/e2e/tests/unit/provider-recording.test.ts index 24ae89c895..09da44c6a6 100644 --- a/packages/e2e/tests/unit/provider-recording.test.ts +++ b/packages/e2e/tests/unit/provider-recording.test.ts @@ -4,7 +4,7 @@ import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node: import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import { isProviderRecording, stopProviderRecording, type ProviderRecording, type ProviderRecordingResult } from '../../src/engine/index.ts'; +import { isProviderRecording, stopProviderRecording, type ProviderRecording, type ProviderRecordingResult } from '@e2e-dev/core/lib/engine/index'; describe('stopProviderRecording', () => { const made: string[] = []; diff --git a/packages/e2e/tests/unit/read-cost.test.ts b/packages/e2e/tests/unit/read-cost.test.ts index dcaf2a7b18..a4eaf326f8 100644 --- a/packages/e2e/tests/unit/read-cost.test.ts +++ b/packages/e2e/tests/unit/read-cost.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { readCost } from '../../src/agent/model/sdk.ts'; +import { readCost } from '@e2e-dev/core/lib/agent/model/sdk'; describe('readCost', () => { it('reads what the Vercel AI Gateway billed, falling back to its market estimate on a BYOK route', () => { diff --git a/packages/e2e/tests/unit/realm-slot.test.ts b/packages/e2e/tests/unit/realm-slot.test.ts index b9bbb086d0..0fe3df3aa1 100644 --- a/packages/e2e/tests/unit/realm-slot.test.ts +++ b/packages/e2e/tests/unit/realm-slot.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { realmSlot } from '../../src/internal/realm-slot.ts'; +import { realmSlot } from '@e2e-dev/core/lib/internal/realm-slot'; describe('realmSlot', () => { it('shares values across slot instances created with the same key (cross-realm contract)', () => { diff --git a/packages/e2e/tests/unit/realm.test.ts b/packages/e2e/tests/unit/realm.test.ts index daabc80762..f884d26bbf 100644 --- a/packages/e2e/tests/unit/realm.test.ts +++ b/packages/e2e/tests/unit/realm.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'; import { collectModule, test } from '../../src/collect/registry.ts'; import type { TestTargetPair } from '../../src/collect/select.ts'; import { RealmManager, findRegistered, type Realm } from '../../src/run/realm.ts'; -import type { RunError } from '../../src/run/records.ts'; +import type { RunError } from '@e2e-dev/core/lib/run/records'; /** * The hook lifecycle contract, checked on the realm diff --git a/packages/e2e/tests/unit/recording-modes.test.ts b/packages/e2e/tests/unit/recording-modes.test.ts index 1d68f15eec..d551f9accf 100644 --- a/packages/e2e/tests/unit/recording-modes.test.ts +++ b/packages/e2e/tests/unit/recording-modes.test.ts @@ -1,7 +1,7 @@ /** Which attempts keep a trace or a video under each mode, how firmly the engine is asked for the video, and one keep rule for both. */ import { describe, expect, it } from 'vitest'; -import { attemptKeep, attemptVideo, keeps, recordsOnSomeAttempt } from '../../src/internal/recording-modes.ts'; +import { attemptKeep, attemptVideo, keeps, recordsOnSomeAttempt } from '@e2e-dev/core/lib/internal/recording-modes'; const set = { source: 'run' } as const; diff --git a/packages/e2e/tests/unit/regexp.test.ts b/packages/e2e/tests/unit/regexp.test.ts index fd579aa3d7..7ccd3d7972 100644 --- a/packages/e2e/tests/unit/regexp.test.ts +++ b/packages/e2e/tests/unit/regexp.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { testPattern } from '../../src/internal/regexp.ts'; +import { testPattern } from '@e2e-dev/core/lib/internal/regexp'; describe('testPattern', () => { it('never leaks lastIndex state between calls with global or sticky flags', () => { diff --git a/packages/e2e/tests/unit/registry.test.ts b/packages/e2e/tests/unit/registry.test.ts index 2c97e65e2b..6eddf87ae1 100644 --- a/packages/e2e/tests/unit/registry.test.ts +++ b/packages/e2e/tests/unit/registry.test.ts @@ -4,7 +4,7 @@ import { describe, expect, it } from 'vitest'; import { collectFromRegistration } from '../../src/collect/collect.ts'; import * as registry from '../../src/collect/registry.ts'; import { collectModule, test } from '../../src/collect/registry.ts'; -import { CollectionError } from '../../src/internal/errors.ts'; +import { CollectionError } from '@e2e-dev/core/lib/internal/errors'; const noop = async () => {}; diff --git a/packages/e2e/tests/unit/relocate-anonymous.test.ts b/packages/e2e/tests/unit/relocate-anonymous.test.ts index 4b59142bfd..cf237350b3 100644 --- a/packages/e2e/tests/unit/relocate-anonymous.test.ts +++ b/packages/e2e/tests/unit/relocate-anonymous.test.ts @@ -1,11 +1,11 @@ /** Anonymous targets: a control with only a role relocates by its place among the unnamed controls of its kind. */ import { describe, expect, it } from 'vitest'; -import { describePosition, relocateDescriptor } from '../../src/cache/relocate.ts'; -import { buildTraceEntry } from '../../src/cache/trace.ts'; -import { readTraceEntry } from '../../src/cache/trace-read.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; -import type { RedactedNode } from '../../src/agent/observation.ts'; +import { describePosition, relocateDescriptor } from '@e2e-dev/core/lib/cache/relocate'; +import { buildTraceEntry } from '@e2e-dev/core/lib/cache/trace'; +import { readTraceEntry } from '@e2e-dev/core/lib/cache/trace-read'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; import { redactedNodes } from '../helpers/redacted.ts'; function textbox(id: string, name?: string): SemanticNode { diff --git a/packages/e2e/tests/unit/relocate-minted-test-id.test.ts b/packages/e2e/tests/unit/relocate-minted-test-id.test.ts index eb5be7776a..a5a74f0aa3 100644 --- a/packages/e2e/tests/unit/relocate-minted-test-id.test.ts +++ b/packages/e2e/tests/unit/relocate-minted-test-id.test.ts @@ -1,9 +1,9 @@ /** A target only a minted test id identifies: counted among the nodes of its shape, and re-found by that shape once its own id is gone. */ import { describe, expect, it } from 'vitest'; -import { describePosition, relocateDescriptor } from '../../src/cache/relocate.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; -import type { RedactedNode } from '../../src/agent/observation.ts'; +import { describePosition, relocateDescriptor } from '@e2e-dev/core/lib/cache/relocate'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; import { redactedNodes } from '../helpers/redacted.ts'; const A = 'rf__node-3f9c2a1b-7d4e-4c1a-9b2e-0a1b2c3d4e5f'; diff --git a/packages/e2e/tests/unit/relocate-placeholder.test.ts b/packages/e2e/tests/unit/relocate-placeholder.test.ts index 42173c24d4..1b7bd52721 100644 --- a/packages/e2e/tests/unit/relocate-placeholder.test.ts +++ b/packages/e2e/tests/unit/relocate-placeholder.test.ts @@ -1,10 +1,10 @@ /** A field named only by its placeholder is recorded and relocated by it. */ import { describe, expect, it } from 'vitest'; -import type { RedactedNode } from '../../src/agent/observation.ts'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; import { redacted } from '../helpers/redacted.ts'; -import { describeTarget } from '../../src/agent/actions.ts'; -import { relocateDescriptor } from '../../src/cache/relocate.ts'; +import { describeTarget } from '@e2e-dev/core/lib/agent/actions'; +import { relocateDescriptor } from '@e2e-dev/core/lib/cache/relocate'; function textbox(id: string, placeholder: string, name?: string): RedactedNode { return redacted({ diff --git a/packages/e2e/tests/unit/relocate-position.test.ts b/packages/e2e/tests/unit/relocate-position.test.ts index 3ab6569d4b..baf7916374 100644 --- a/packages/e2e/tests/unit/relocate-position.test.ts +++ b/packages/e2e/tests/unit/relocate-position.test.ts @@ -1,12 +1,12 @@ /** Positional recording: twins the description cannot tell apart resolve by place, at the same count only. */ import { describe, expect, it } from 'vitest'; -import { describeAction } from '../../src/agent/actions.ts'; -import { describePosition, relocateDescriptor } from '../../src/cache/relocate.ts'; -import { buildTraceEntry, type ActionTrace } from '../../src/cache/trace.ts'; -import { readTraceEntry } from '../../src/cache/trace-read.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; -import type { RedactedNode } from '../../src/agent/observation.ts'; +import { describeAction } from '@e2e-dev/core/lib/agent/actions'; +import { describePosition, relocateDescriptor } from '@e2e-dev/core/lib/cache/relocate'; +import { buildTraceEntry, type ActionTrace } from '@e2e-dev/core/lib/cache/trace'; +import { readTraceEntry } from '@e2e-dev/core/lib/cache/trace-read'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; import { redactedNodes } from '../helpers/redacted.ts'; function button(id: string, name = 'Set up'): SemanticNode { diff --git a/packages/e2e/tests/unit/relocate-within.test.ts b/packages/e2e/tests/unit/relocate-within.test.ts index 8fe14ac197..fc28276f30 100644 --- a/packages/e2e/tests/unit/relocate-within.test.ts +++ b/packages/e2e/tests/unit/relocate-within.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest'; -import type { RedactedNode } from '../../src/agent/observation.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { redacted } from '../helpers/redacted.ts'; -import { containerKey, describeAction } from '../../src/agent/actions.ts'; -import { describePosition, relocateDescriptor } from '../../src/cache/relocate.ts'; +import { containerKey, describeAction } from '@e2e-dev/core/lib/agent/actions'; +import { describePosition, relocateDescriptor } from '@e2e-dev/core/lib/cache/relocate'; const identity = (text: string): string => text; diff --git a/packages/e2e/tests/unit/report-list.test.ts b/packages/e2e/tests/unit/report-list.test.ts index 1a11b4d98e..0cb318c540 100644 --- a/packages/e2e/tests/unit/report-list.test.ts +++ b/packages/e2e/tests/unit/report-list.test.ts @@ -3,13 +3,13 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { resultId } from '../../src/internal/ids.ts'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; import { visibleWidth } from '../../src/report/format.ts'; import { ListReporter } from '../../src/report/list.ts'; import { userFrame } from '../../src/report/code-frame.ts'; -import type { CacheWrite } from '../../src/cache/context.ts'; +import type { CacheWrite } from '@e2e-dev/core/lib/cache/context'; import type { RunEventFact, RunEventOf, RunEventResult } from '../../src/run/events.ts'; -import type { ResultStatus, AttemptRecord, SerialGroupRecord, SerialMemberRecord } from '../../src/run/records.ts'; +import type { ResultStatus, AttemptRecord, SerialGroupRecord, SerialMemberRecord } from '@e2e-dev/core/lib/run/records'; // eslint-disable-next-line no-control-regex const ANSI_PATTERN = /\u001b\[[0-9;?]*[a-zA-Z]/g; diff --git a/packages/e2e/tests/unit/report-status.test.ts b/packages/e2e/tests/unit/report-status.test.ts index d4a12cff3f..f300c97359 100644 --- a/packages/e2e/tests/unit/report-status.test.ts +++ b/packages/e2e/tests/unit/report-status.test.ts @@ -5,13 +5,13 @@ */ import { describe, expect, it } from 'vitest'; -import { type ResolvedConfig, type ResolvedTarget } from '../../src/config/resolve.ts'; +import { type ResolvedConfig, type ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import type { SerializedError } from '../../src/internal/errors.ts'; -import { uuidv7 } from '../../src/internal/ids.ts'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; +import { uuidv7 } from '@e2e-dev/core/lib/internal/ids'; import { buildReport, type BuildReportOptions } from '../../src/report/build.ts'; -import type { AttemptRecord, ResultRecord, SerialAttemptRecord, SerialGroupRecord } from '../../src/run/records.ts'; -import type { StepRecord } from '../../src/run/steps.ts'; +import type { AttemptRecord, ResultRecord, SerialAttemptRecord, SerialGroupRecord } from '@e2e-dev/core/lib/run/records'; +import type { StepRecord } from '@e2e-dev/core/lib/run/steps'; import { assertValidReport } from '../helpers/report-schema.ts'; const AT = '2026-01-01T00:00:00.000Z'; diff --git a/packages/e2e/tests/unit/rerun-artifacts.test.ts b/packages/e2e/tests/unit/rerun-artifacts.test.ts index 26e5f25c6f..c490596ea1 100644 --- a/packages/e2e/tests/unit/rerun-artifacts.test.ts +++ b/packages/e2e/tests/unit/rerun-artifacts.test.ts @@ -8,7 +8,7 @@ import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, import os from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { nextRerunDir, pruneArtifacts } from '../../src/run/artifacts.ts'; +import { nextRerunDir, pruneArtifacts } from '@e2e-dev/core/lib/run/artifacts'; let root: string; diff --git a/packages/e2e/tests/unit/resolve-expression.test.ts b/packages/e2e/tests/unit/resolve-expression.test.ts index a9dbb3f61b..4f6335528e 100644 --- a/packages/e2e/tests/unit/resolve-expression.test.ts +++ b/packages/e2e/tests/unit/resolve-expression.test.ts @@ -12,7 +12,7 @@ import { type SemanticNode, type SemanticQuery, type TextPattern, -} from '../../src/engine/index.ts'; +} from '@e2e-dev/core/lib/engine/index'; function node(id: string, fields: Omit): SemanticNode { return { ref: { id, revision: '' }, ...fields }; diff --git a/packages/e2e/tests/unit/retry.test.ts b/packages/e2e/tests/unit/retry.test.ts index 15e477ecc1..7b08b52dc1 100644 --- a/packages/e2e/tests/unit/retry.test.ts +++ b/packages/e2e/tests/unit/retry.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { isCutSerialRetry, isRetryEligible, retryVerdict, runWithRetries, type RetryAttempt } from '../../src/run/retry.ts'; -import type { SerializedError } from '../../src/internal/errors.ts'; +import type { SerializedError } from '@e2e-dev/core/lib/internal/errors'; function error(category: SerializedError['category']): SerializedError { return { category, code: 'X', message: 'x', retryable: false }; diff --git a/packages/e2e/tests/unit/sample-history.test.ts b/packages/e2e/tests/unit/sample-history.test.ts index 4b8d591cb3..eefabee1de 100644 --- a/packages/e2e/tests/unit/sample-history.test.ts +++ b/packages/e2e/tests/unit/sample-history.test.ts @@ -5,7 +5,7 @@ */ import { describe, expect, it } from 'vitest'; -import { SampleHistory } from '../../src/expect/samples.ts'; +import { SampleHistory } from '@e2e-dev/core/lib/expect/samples'; describe('SampleHistory', () => { it('counts the reads of a poll that passed at once and tells no readings', () => { diff --git a/packages/e2e/tests/unit/scheduler.test.ts b/packages/e2e/tests/unit/scheduler.test.ts index ce69a23292..f0f4dc4d5f 100644 --- a/packages/e2e/tests/unit/scheduler.test.ts +++ b/packages/e2e/tests/unit/scheduler.test.ts @@ -4,7 +4,7 @@ * without spawning processes or browsers. */ -import { protocolEngine } from '../../src/engine/protocol/client.ts'; +import { protocolEngine } from '@e2e-dev/core/lib/engine/protocol/client'; import { afterEach, describe, expect, it, vi } from 'vitest'; import type { CollectedFile, CollectedTest, Collection } from '../../src/collect/collect.ts'; import type { @@ -12,11 +12,11 @@ import type { Selection, TestTargetPair, } from '../../src/collect/select.ts'; -import type { SkipInfo } from '../../src/run/records.ts'; -import type { ResolvedTarget } from '../../src/config/resolve.ts'; -import { defineEngine, type EngineHandle } from '../../src/engine/index.ts'; -import { classifyError, serializeError } from '../../src/internal/errors.ts'; -import type { AttemptRecord, ResultRecord, RunError, SerialAttemptRecord, SerialGroupRecord, SerialMemberRecord } from '../../src/run/records.ts'; +import type { SkipInfo } from '@e2e-dev/core/lib/run/records'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { defineEngine, type EngineHandle } from '@e2e-dev/core/lib/engine/index'; +import { classifyError, serializeError } from '@e2e-dev/core/lib/internal/errors'; +import type { AttemptRecord, ResultRecord, RunError, SerialAttemptRecord, SerialGroupRecord, SerialMemberRecord } from '@e2e-dev/core/lib/run/records'; import { runUnits, type RunUnitsOptions, type TargetFailure } from '../../src/run/scheduler.ts'; import { serialGroupId } from '../../src/run/serial.ts'; import { buildWorkPlans, type TargetWorkPlan, type TimeLimit } from '../../src/run/units.ts'; diff --git a/packages/e2e/tests/unit/screen-tree.test.ts b/packages/e2e/tests/unit/screen-tree.test.ts index 810c3e79fe..b43cb89ed7 100644 --- a/packages/e2e/tests/unit/screen-tree.test.ts +++ b/packages/e2e/tests/unit/screen-tree.test.ts @@ -5,7 +5,7 @@ */ import { afterEach, describe, expect, it, vi } from 'vitest'; -import type { SemanticNode } from '../../src/engine/index.ts'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/index'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/scroll-until-visible.test.ts b/packages/e2e/tests/unit/scroll-until-visible.test.ts index b6f5c3fd86..c89a7ca95b 100644 --- a/packages/e2e/tests/unit/scroll-until-visible.test.ts +++ b/packages/e2e/tests/unit/scroll-until-visible.test.ts @@ -8,9 +8,9 @@ */ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { EngineError, resolveExpression, type NodeRef, type SemanticNode } from '../../src/engine/index.ts'; -import { sleep } from '../../src/internal/time.ts'; -import type { Locator, Screen } from '../../src/types.ts'; +import { EngineError, resolveExpression, type NodeRef, type SemanticNode } from '@e2e-dev/core/lib/engine/index'; +import { sleep } from '@e2e-dev/core/lib/internal/time'; +import type { Locator, Screen } from '@e2e-dev/core/lib/types'; import { invalid } from '../helpers/invalid.ts'; import { screenOver } from '../helpers/screen-over.ts'; diff --git a/packages/e2e/tests/unit/secret-ledger.test.ts b/packages/e2e/tests/unit/secret-ledger.test.ts index e7e1cf6db3..935f484e5d 100644 --- a/packages/e2e/tests/unit/secret-ledger.test.ts +++ b/packages/e2e/tests/unit/secret-ledger.test.ts @@ -1,7 +1,7 @@ /** The attempt secret ledger: live registration and rotation-safe redaction. */ import { describe, expect, it } from 'vitest'; -import { SecretLedger, StreamRedactor } from '../../src/internal/redact.ts'; +import { SecretLedger, StreamRedactor } from '@e2e-dev/core/lib/internal/redact'; import { redactResult, textResult } from '../../src/mcp/tools.ts'; describe('SecretLedger', () => { diff --git a/packages/e2e/tests/unit/secrets.test.ts b/packages/e2e/tests/unit/secrets.test.ts index 2d1bb11d14..61b9c484d1 100644 --- a/packages/e2e/tests/unit/secrets.test.ts +++ b/packages/e2e/tests/unit/secrets.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { credentials, holdSecretRegistry, isSecret, secrets, setSecretRegistry, type SecretRegistry } from '../../src/secrets.ts'; -import { ConfigurationError } from '../../src/internal/errors.ts'; -import type { ResolvedCredential, ResolvedSecret } from '../../src/config/resolve.ts'; +import { credentials, holdSecretRegistry, isSecret, secrets, setSecretRegistry, type SecretRegistry } from '@e2e-dev/core/lib/secrets'; +import { ConfigurationError } from '@e2e-dev/core/lib/internal/errors'; +import type { ResolvedCredential, ResolvedSecret } from '@e2e-dev/core/lib/config/resolve'; const adminPassword: ResolvedSecret = { name: 'admin.password', diff --git a/packages/e2e/tests/unit/select-option-shape.test.ts b/packages/e2e/tests/unit/select-option-shape.test.ts index b0585b34e7..81069b73e2 100644 --- a/packages/e2e/tests/unit/select-option-shape.test.ts +++ b/packages/e2e/tests/unit/select-option-shape.test.ts @@ -7,8 +7,8 @@ */ import { describe, expect, it } from 'vitest'; -import type { LocatorAction, SemanticNode } from '../../src/engine/index.ts'; -import type { SelectOption } from '../../src/types.ts'; +import type { LocatorAction, SemanticNode } from '@e2e-dev/core/lib/engine/index'; +import type { SelectOption } from '@e2e-dev/core/lib/types'; import { invalid } from '../helpers/invalid.ts'; import { screenOver } from '../helpers/screen-over.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/select.test.ts b/packages/e2e/tests/unit/select.test.ts index 8125a16383..f03d8a6b47 100644 --- a/packages/e2e/tests/unit/select.test.ts +++ b/packages/e2e/tests/unit/select.test.ts @@ -5,10 +5,10 @@ import { describe, expect, it } from 'vitest'; import { collectFromRegistration, type Collection } from '../../src/collect/collect.ts'; import { collectModule, test } from '../../src/collect/registry.ts'; import { pairRecordings, repeatEach, resolveOptions, select, type SelectionFilters } from '../../src/collect/select.ts'; -import { pairRecording } from '../../src/internal/recording-modes.ts'; +import { pairRecording } from '@e2e-dev/core/lib/internal/recording-modes'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { resultId } from '../../src/internal/ids.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { resultId } from '@e2e-dev/core/lib/internal/ids'; import type { E2EConfig } from '../../src/run-types.ts'; const noop = async () => {}; diff --git a/packages/e2e/tests/unit/serial-record.test.ts b/packages/e2e/tests/unit/serial-record.test.ts index c24b4df1c0..c1c179fe67 100644 --- a/packages/e2e/tests/unit/serial-record.test.ts +++ b/packages/e2e/tests/unit/serial-record.test.ts @@ -9,13 +9,13 @@ import path from 'node:path'; import { describe, expect, it, vi } from 'vitest'; import type { CollectedTest } from '../../src/collect/collect.ts'; import type { ResolvedTestOptions, TestTargetPair } from '../../src/collect/select.ts'; -import type { ResolvedTarget } from '../../src/config/resolve.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { classifyError, serializeError } from '../../src/internal/errors.ts'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { classifyError, serializeError } from '@e2e-dev/core/lib/internal/errors'; import { buildReport } from '../../src/report/build.ts'; import { outcome } from '../../src/report/outcome.ts'; import { RealmManager } from '../../src/run/realm.ts'; -import type { AttemptRecord, ResultRecord, SerialAttemptRecord, SerialGroupRecord } from '../../src/run/records.ts'; +import type { AttemptRecord, ResultRecord, SerialAttemptRecord, SerialGroupRecord } from '@e2e-dev/core/lib/run/records'; import { runSerialUnit, type SerialHost } from '../../src/run/serial.ts'; const OPTIONS: ResolvedTestOptions = { diff --git a/packages/e2e/tests/unit/session-envelope.test.ts b/packages/e2e/tests/unit/session-envelope.test.ts index 3b32d36caa..475d541503 100644 --- a/packages/e2e/tests/unit/session-envelope.test.ts +++ b/packages/e2e/tests/unit/session-envelope.test.ts @@ -4,9 +4,9 @@ import { mkdtemp, readdir, readFile, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it, vi } from 'vitest'; -import { uuidv7 } from '../../src/internal/ids.ts'; -import type { SavedSecrets } from '../../src/run/secrecy.ts'; -import { SessionStore, type SavedSession, type SessionIdentity } from '../../src/run/sessions.ts'; +import { uuidv7 } from '@e2e-dev/core/lib/internal/ids'; +import type { SavedSecrets } from '@e2e-dev/core/lib/run/secrecy'; +import { SessionStore, type SavedSession, type SessionIdentity } from '@e2e-dev/core/lib/run/sessions'; import { assertValidSessionEnvelope } from '../helpers/session-schema.ts'; const identity: SessionIdentity = { diff --git a/packages/e2e/tests/unit/session-secrecy.test.ts b/packages/e2e/tests/unit/session-secrecy.test.ts index 9779edf96f..ccfb229ea4 100644 --- a/packages/e2e/tests/unit/session-secrecy.test.ts +++ b/packages/e2e/tests/unit/session-secrecy.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from 'vitest'; -import type { ResolvedConfig } from '../../src/config/resolve.ts'; -import type { TargetSession } from '../../src/engine/surface.ts'; -import { serializeError, TestError } from '../../src/internal/errors.ts'; -import { adoptSecrets, carriedSecrets, processSecrets, redactForSession, registerStaticSecrets, redactsDownloads, sessionLedger, staticSecretLedger } from '../../src/run/secrecy.ts'; +import type { ResolvedConfig } from '@e2e-dev/core/lib/config/resolve'; +import type { TargetSession } from '@e2e-dev/core/lib/engine/surface'; +import { serializeError, TestError } from '@e2e-dev/core/lib/internal/errors'; +import { adoptSecrets, carriedSecrets, processSecrets, redactForSession, registerStaticSecrets, redactsDownloads, sessionLedger, staticSecretLedger } from '@e2e-dev/core/lib/run/secrecy'; const STATIC_VALUE = 'static-config-password-5521'; const PROVIDER_VALUE = 'provider-minted-token-8804'; diff --git a/packages/e2e/tests/unit/source-location.test.ts b/packages/e2e/tests/unit/source-location.test.ts index ea3845a234..f8349fcf43 100644 --- a/packages/e2e/tests/unit/source-location.test.ts +++ b/packages/e2e/tests/unit/source-location.test.ts @@ -6,7 +6,7 @@ */ import { describe, expect, it } from 'vitest'; -import { projectRelativePath, sourceLocation } from '../../src/internal/source.ts'; +import { projectRelativePath, sourceLocation } from '@e2e-dev/core/lib/internal/source'; function stackThrough(file: string): string { return ['Error: boom', ` at Object. (${file}:14:3)`, ' at run (/repo/app/node_modules/e2e/dist/run/steps.js:9:1)'].join('\n'); diff --git a/packages/e2e/tests/unit/step-abandon.test.ts b/packages/e2e/tests/unit/step-abandon.test.ts index 3e46100575..c87921eca0 100644 --- a/packages/e2e/tests/unit/step-abandon.test.ts +++ b/packages/e2e/tests/unit/step-abandon.test.ts @@ -2,8 +2,8 @@ import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import { isAbandonedRejection } from '../../src/internal/abandoned.ts'; -import { StepRecorder, type StepProgress } from '../../src/run/steps.ts'; +import { isAbandonedRejection } from '@e2e-dev/core/lib/internal/abandoned'; +import { StepRecorder, type StepProgress } from '@e2e-dev/core/lib/run/steps'; function recorder(): { steps: StepRecorder; heard: StepProgress[] } { const heard: StepProgress[] = []; diff --git a/packages/e2e/tests/unit/step-accounting.test.ts b/packages/e2e/tests/unit/step-accounting.test.ts index e2d56ef072..c0462c708c 100644 --- a/packages/e2e/tests/unit/step-accounting.test.ts +++ b/packages/e2e/tests/unit/step-accounting.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; -import type { OperationContext } from '../../src/engine/surface.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import type { AgentContext } from '../../src/agent/invocation.ts'; -import { StepAccounting } from '../../src/agent/step-accounting.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { MAX_REASONING_CHARS } from '../../src/agent/usage.ts'; +import type { OperationContext } from '@e2e-dev/core/lib/engine/surface'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import type { AgentContext } from '@e2e-dev/core/lib/agent/invocation'; +import { StepAccounting } from '@e2e-dev/core/lib/agent/step-accounting'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { MAX_REASONING_CHARS } from '@e2e-dev/core/lib/agent/usage'; /** The slice of a runtime accounting reads: an engine that mints operation contexts and a config with an action timeout. */ function runtime(): AgentContext & { steps: StepRecorder } { diff --git a/packages/e2e/tests/unit/step-cache.test.ts b/packages/e2e/tests/unit/step-cache.test.ts index d440e8b23d..581845b6a4 100644 --- a/packages/e2e/tests/unit/step-cache.test.ts +++ b/packages/e2e/tests/unit/step-cache.test.ts @@ -4,20 +4,20 @@ import { mkdtemp, readFile, rm, stat } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { afterEach, describe, expect, it, vi } from 'vitest'; -import { settleStagedTraces, type AgentCacheContext, type ClaimedKey } from '../../src/cache/context.ts'; -import { instructionDigest, paramsDigest } from '../../src/cache/identity.ts'; -import { StoredRecordings } from '../../src/cache/rekeyed.ts'; -import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '../../src/cache/store.ts'; -import { buildTraceEntry, type ActionTrace, type DerivedReason, type TraceEntry } from '../../src/cache/trace.ts'; -import { failedStepOutcome, recordedVerdictOf, StepTraceSession, type StepCacheHost, type StepCacheOptions } from '../../src/agent/step-cache.ts'; -import { AgentError } from '../../src/agent/error.ts'; -import type { ExecutorActions } from '../../src/agent/executor.ts'; -import type { SettleMode } from '../../src/agent/settle-policy.ts'; -import type { RedactedNode } from '../../src/agent/observation.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import { settleStagedTraces, type AgentCacheContext, type ClaimedKey } from '@e2e-dev/core/lib/cache/context'; +import { instructionDigest, paramsDigest } from '@e2e-dev/core/lib/cache/identity'; +import { StoredRecordings } from '@e2e-dev/core/lib/cache/rekeyed'; +import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '@e2e-dev/core/lib/cache/store'; +import { buildTraceEntry, type ActionTrace, type DerivedReason, type TraceEntry } from '@e2e-dev/core/lib/cache/trace'; +import { failedStepOutcome, recordedVerdictOf, StepTraceSession, type StepCacheHost, type StepCacheOptions } from '@e2e-dev/core/lib/agent/step-cache'; +import { AgentError } from '@e2e-dev/core/lib/agent/error'; +import type { ExecutorActions } from '@e2e-dev/core/lib/agent/executor'; +import type { SettleMode } from '@e2e-dev/core/lib/agent/settle-policy'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { redacted, redactedNodes } from '../helpers/redacted.ts'; -import type { JsonValue } from '../../src/types.ts'; -import { SecretLedger } from '../../src/internal/redact.ts'; +import type { JsonValue } from '@e2e-dev/core/lib/types'; +import { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; const savedMarker: SemanticNode = { ref: { id: 'm1', revision: 'r1' }, diff --git a/packages/e2e/tests/unit/step-hold.test.ts b/packages/e2e/tests/unit/step-hold.test.ts index 5a94b45f44..c379b2abd6 100644 --- a/packages/e2e/tests/unit/step-hold.test.ts +++ b/packages/e2e/tests/unit/step-hold.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; import { AttemptHolds } from '../../src/run/step-hold.ts'; describe('AttemptHolds', () => { diff --git a/packages/e2e/tests/unit/step-progress.test.ts b/packages/e2e/tests/unit/step-progress.test.ts index 9ecbfcc82f..08c04aec18 100644 --- a/packages/e2e/tests/unit/step-progress.test.ts +++ b/packages/e2e/tests/unit/step-progress.test.ts @@ -2,8 +2,8 @@ import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import { StepRecorder, type StepProgress } from '../../src/run/steps.ts'; -import { AgentError } from '../../src/agent/error.ts'; +import { StepRecorder, type StepProgress } from '@e2e-dev/core/lib/run/steps'; +import { AgentError } from '@e2e-dev/core/lib/agent/error'; function recorder(): { steps: StepRecorder; heard: StepProgress[] } { const heard: StepProgress[] = []; diff --git a/packages/e2e/tests/unit/step-screens.test.ts b/packages/e2e/tests/unit/step-screens.test.ts index bd0fcaef1d..dada84e2df 100644 --- a/packages/e2e/tests/unit/step-screens.test.ts +++ b/packages/e2e/tests/unit/step-screens.test.ts @@ -6,12 +6,12 @@ */ import { describe, expect, it } from 'vitest'; -import { createEngineSession } from '../../src/engine/session.ts'; -import type { EngineSnapshot } from '../../src/engine/index.ts'; -import type { Observation } from '../../src/engine/surface.ts'; -import type { SecretLedger } from '../../src/internal/redact.ts'; -import { compareScreens, traceScreen } from '../../src/run/step-screens.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import type { EngineSnapshot } from '@e2e-dev/core/lib/engine/index'; +import type { Observation } from '@e2e-dev/core/lib/engine/surface'; +import type { SecretLedger } from '@e2e-dev/core/lib/internal/redact'; +import { compareScreens, traceScreen } from '@e2e-dev/core/lib/run/step-screens'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; /** A screen from listing-like lines, `#id description` each; the description is what the trace compares. */ const screen = (...lines: string[]) => ({ diff --git a/packages/e2e/tests/unit/step-verification.test.ts b/packages/e2e/tests/unit/step-verification.test.ts index 55aadb15b4..5ef8295c85 100644 --- a/packages/e2e/tests/unit/step-verification.test.ts +++ b/packages/e2e/tests/unit/step-verification.test.ts @@ -4,7 +4,7 @@ */ import { describe, expect, it } from 'vitest'; -import { StepRecorder } from '../../src/run/steps.ts'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; const pass = async (): Promise => undefined; diff --git a/packages/e2e/tests/unit/suggest.test.ts b/packages/e2e/tests/unit/suggest.test.ts index 8aa45f80fa..1ed53ae490 100644 --- a/packages/e2e/tests/unit/suggest.test.ts +++ b/packages/e2e/tests/unit/suggest.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { isTypoOf, suggest } from '../../src/internal/suggest.ts'; +import { isTypoOf, suggest } from '@e2e-dev/core/lib/internal/suggest'; const KEYS = ['targets', 'tests', 'timeout', 'retries', 'workers', 'reporters', 'agent', 'cache']; diff --git a/packages/e2e/tests/unit/target-identity.test.ts b/packages/e2e/tests/unit/target-identity.test.ts index 969d98bfef..6533f0d76d 100644 --- a/packages/e2e/tests/unit/target-identity.test.ts +++ b/packages/e2e/tests/unit/target-identity.test.ts @@ -9,11 +9,11 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; -import { assignPorts } from '../../src/config/resolve.ts'; +import { assignPorts } from '@e2e-dev/core/lib/config/resolve'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { targetIdentity } from '../../src/run/sessions.ts'; -import type { Target } from '../../src/types.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { targetIdentity } from '@e2e-dev/core/lib/run/sessions'; +import type { Target } from '@e2e-dev/core/lib/types'; const ROOT = '/tmp/e2e-target-identity'; diff --git a/packages/e2e/tests/unit/telemetry-events.test.ts b/packages/e2e/tests/unit/telemetry-events.test.ts index 412f118ab4..1a550ca6ad 100644 --- a/packages/e2e/tests/unit/telemetry-events.test.ts +++ b/packages/e2e/tests/unit/telemetry-events.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; import type { McpSessionSummary } from '../../src/mcp/usage.ts'; import type { ReportExplore } from '../../src/report/build.ts'; import { @@ -16,7 +16,7 @@ import { upgradeCompletedEvent, type RunContext, } from '../../src/telemetry/events.ts'; -import type { StepEvent } from '../../src/run/steps.ts'; +import type { StepEvent } from '@e2e-dev/core/lib/run/steps'; import { REPORT_AT, reportAttempt, reportDocument, reportError, reportResult, reportStep } from '../helpers/report.ts'; import { SAMPLE_REPORT_SECRETS, sampleReport } from '../helpers/sample-report.ts'; import { snapshot } from '../helpers/snapshot.ts'; diff --git a/packages/e2e/tests/unit/telemetry-project.test.ts b/packages/e2e/tests/unit/telemetry-project.test.ts index 1a7ebc67df..6cd50130b9 100644 --- a/packages/e2e/tests/unit/telemetry-project.test.ts +++ b/packages/e2e/tests/unit/telemetry-project.test.ts @@ -5,7 +5,7 @@ import os from 'node:os'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; import { afterAll, describe, expect, it } from 'vitest'; -import { sha256Hex } from '../../src/internal/ids.ts'; +import { sha256Hex } from '@e2e-dev/core/lib/internal/ids'; import { anonymousProjectId } from '../../src/telemetry/project.ts'; import { initRepo, runGit } from '../helpers/git-repo.ts'; diff --git a/packages/e2e/tests/unit/test-filters.test.ts b/packages/e2e/tests/unit/test-filters.test.ts index 0b4a4c02b0..fe710ec70b 100644 --- a/packages/e2e/tests/unit/test-filters.test.ts +++ b/packages/e2e/tests/unit/test-filters.test.ts @@ -11,14 +11,14 @@ import { createHash } from 'node:crypto'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { describe, expect, it, vi } from 'vitest'; -import { AgentError } from '../../src/agent/error.ts'; +import { AgentError } from '@e2e-dev/core/lib/agent/error'; import { collectFromRegistration, type Collection } from '../../src/collect/collect.ts'; import { collectModule, test } from '../../src/collect/registry.ts'; import { select } from '../../src/collect/select.ts'; import type { ResolvedRunConfig as ResolvedConfig } from '../../src/config/resolve-run.ts'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { ConfigurationError, type E2EError } from '../../src/internal/errors.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { ConfigurationError, type E2EError } from '@e2e-dev/core/lib/internal/errors'; import { applyTestFilters, FILTER_TIMEOUT_MS, @@ -35,8 +35,8 @@ import { invalid } from '../helpers/invalid.ts'; /** What `leaveWorkBehind` was told: a timeout records the work it left behind, for the CLI to exit on. */ const leaveWorkBehind = vi.hoisted(() => vi.fn()); -vi.mock('../../src/internal/abandoned.ts', async (importOriginal) => ({ - ...(await importOriginal()), +vi.mock('@e2e-dev/core/lib/internal/abandoned', async (importOriginal) => ({ + ...(await importOriginal()), leaveWorkBehind, })); diff --git a/packages/e2e/tests/unit/text.test.ts b/packages/e2e/tests/unit/text.test.ts index e50575a719..bd35f890cb 100644 --- a/packages/e2e/tests/unit/text.test.ts +++ b/packages/e2e/tests/unit/text.test.ts @@ -1,6 +1,6 @@ import { runInNewContext } from 'node:vm'; import { describe, expect, it } from 'vitest'; -import { bound, compareText, matchesText, normalizeRegexpFlags, normalizeText, toTextPattern } from '../../src/internal/text.ts'; +import { bound, compareText, matchesText, normalizeRegexpFlags, normalizeText, toTextPattern } from '@e2e-dev/core/lib/internal/text'; describe('normalizeText', () => { it('trims and collapses unicode whitespace runs to one ASCII space', () => { diff --git a/packages/e2e/tests/unit/time.test.ts b/packages/e2e/tests/unit/time.test.ts index 81d670a4b4..cf008ebb98 100644 --- a/packages/e2e/tests/unit/time.test.ts +++ b/packages/e2e/tests/unit/time.test.ts @@ -12,9 +12,9 @@ import { ReadWindow, sleep, withTimeout, -} from '../../src/internal/time.ts'; -import { E2EError } from '../../src/internal/errors.ts'; -import { EngineError } from '../../src/engine/contract.ts'; +} from '@e2e-dev/core/lib/internal/time'; +import { E2EError } from '@e2e-dev/core/lib/internal/errors'; +import { EngineError } from '@e2e-dev/core/lib/engine/contract'; afterEach(() => { vi.useRealTimers(); diff --git a/packages/e2e/tests/unit/tool-loop-overflow.test.ts b/packages/e2e/tests/unit/tool-loop-overflow.test.ts index 51e6a941f8..9f2f0d0f31 100644 --- a/packages/e2e/tests/unit/tool-loop-overflow.test.ts +++ b/packages/e2e/tests/unit/tool-loop-overflow.test.ts @@ -1,16 +1,16 @@ import { describe, expect, it } from 'vitest'; import { z } from 'zod'; -import { createToolLoopExecutor } from '../../src/agent/tool-loop.ts'; -import { projectTools } from '../../src/agent/default-agent.ts'; -import { defineTool } from '../../src/agent/tool.ts'; +import { createToolLoopExecutor } from '@e2e-dev/core/lib/agent/tool-loop'; +import { projectTools } from '@e2e-dev/core/lib/agent/default-agent'; +import { defineTool } from '@e2e-dev/core/lib/agent/tool'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine, type EngineHandle } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { defineEngine, type EngineHandle } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import type { E2EConfig } from '../../src/run-types.ts'; import { runAgentStepsOnFakeTime } from '../helpers/agent-fake-time.ts'; import { installFakeLoopModel, loopCalls } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/unit/tool-loop-prefix.test.ts b/packages/e2e/tests/unit/tool-loop-prefix.test.ts index 74205aa816..be617ebbc9 100644 --- a/packages/e2e/tests/unit/tool-loop-prefix.test.ts +++ b/packages/e2e/tests/unit/tool-loop-prefix.test.ts @@ -12,16 +12,16 @@ import { createAnthropic } from '@ai-sdk/anthropic'; import { tool } from 'ai'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { z } from 'zod'; -import { createToolLoopExecutor } from '../../src/agent/tool-loop.ts'; +import { createToolLoopExecutor } from '@e2e-dev/core/lib/agent/tool-loop'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine, type EngineHandle } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; -import type { ModelInstance } from '../../src/types.ts'; +import { defineEngine, type EngineHandle } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; +import type { ModelInstance } from '@e2e-dev/core/lib/types'; import type { E2EConfig } from '../../src/run-types.ts'; import { runAgentStepsOnFakeTime } from '../helpers/agent-fake-time.ts'; import { installFakeLoopModel, loopCalls } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/unit/tool-loop-stall.test.ts b/packages/e2e/tests/unit/tool-loop-stall.test.ts index 5c2e30350c..54afc67560 100644 --- a/packages/e2e/tests/unit/tool-loop-stall.test.ts +++ b/packages/e2e/tests/unit/tool-loop-stall.test.ts @@ -2,17 +2,17 @@ import { generateText } from 'ai'; import * as ai from 'ai'; import { describe, expect, it, vi } from 'vitest'; import { z } from 'zod'; -import { withStallGuard } from '../../src/agent/model/stall.ts'; -import { asSdkLanguageModel } from '../../src/agent/ai-sdk.ts'; -import { defineTool } from '../../src/agent/tool.ts'; +import { withStallGuard } from '@e2e-dev/core/lib/agent/model/stall'; +import { asSdkLanguageModel } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { defineTool } from '@e2e-dev/core/lib/agent/tool'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import type { E2EConfig } from '../../src/run-types.ts'; import { runAgentStepsOnFakeTime } from '../helpers/agent-fake-time.ts'; import { installFakeLoopModel } from '../helpers/fake-loop-model.ts'; @@ -21,7 +21,7 @@ import { createScriptedInstance, scriptedResult } from '../helpers/scripted-mode import { snapshot } from '../helpers/snapshot.ts'; // The loop and the judgment adapter take the production bound; a test waits 50 ms for a stall, not 120 s. -vi.mock(import('../../src/agent/model/stall.ts'), async (importOriginal) => { +vi.mock(import('@e2e-dev/core/lib/agent/model/stall'), async (importOriginal) => { const stall = await importOriginal(); return { withStallGuard: (sdk, model, onStall, stallMs = 50) => stall.withStallGuard(sdk, model, onStall, stallMs) }; }); diff --git a/packages/e2e/tests/unit/tool-loop-tool-choice.test.ts b/packages/e2e/tests/unit/tool-loop-tool-choice.test.ts index 567d2cde01..3393ed838a 100644 --- a/packages/e2e/tests/unit/tool-loop-tool-choice.test.ts +++ b/packages/e2e/tests/unit/tool-loop-tool-choice.test.ts @@ -1,15 +1,15 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { z } from 'zod'; -import { isForcedToolCallSkipped, isForcedToolChoiceRejected } from '../../src/agent/model/tool-choice.ts'; -import { defineTool } from '../../src/agent/tool.ts'; +import { isForcedToolCallSkipped, isForcedToolChoiceRejected } from '@e2e-dev/core/lib/agent/model/tool-choice'; +import { defineTool } from '@e2e-dev/core/lib/agent/tool'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine } from '../../src/engine/index.ts'; -import { createEngineSession } from '../../src/engine/session.ts'; -import { Deadline } from '../../src/internal/time.ts'; -import { AttemptBudget } from '../../src/run/budget.ts'; -import { createFixtures } from '../../src/run/fixtures.ts'; -import { StepRecorder } from '../../src/run/steps.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { defineEngine } from '@e2e-dev/core/lib/engine/index'; +import { createEngineSession } from '@e2e-dev/core/lib/engine/session'; +import { Deadline } from '@e2e-dev/core/lib/internal/time'; +import { AttemptBudget } from '@e2e-dev/core/lib/run/budget'; +import { createFixtures } from '@e2e-dev/core/lib/run/fixtures'; +import { StepRecorder } from '@e2e-dev/core/lib/run/steps'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; import type { E2EConfig } from '../../src/run-types.ts'; import { runAgentStepsOnFakeTime } from '../helpers/agent-fake-time.ts'; import { installFakeLoopModel, loopCalls, type LoopResponder } from '../helpers/fake-loop-model.ts'; diff --git a/packages/e2e/tests/unit/tool-output.test.ts b/packages/e2e/tests/unit/tool-output.test.ts index 9800d73f71..754b7255c7 100644 --- a/packages/e2e/tests/unit/tool-output.test.ts +++ b/packages/e2e/tests/unit/tool-output.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { boundToolOutput, MAX_TOOL_OUTPUT_BYTES, MAX_TOOL_OUTPUT_LINES } from '../../src/agent/tool-output.ts'; +import { boundToolOutput, MAX_TOOL_OUTPUT_BYTES, MAX_TOOL_OUTPUT_LINES } from '@e2e-dev/core/lib/agent/tool-output'; /** The whole returned text, notice included, must fit the advertised limits. */ function expectWithinLimits(text: string, maxLines = MAX_TOOL_OUTPUT_LINES, maxBytes = MAX_TOOL_OUTPUT_BYTES): void { diff --git a/packages/e2e/tests/unit/tool.test.ts b/packages/e2e/tests/unit/tool.test.ts index ceedada8e0..832ce63452 100644 --- a/packages/e2e/tests/unit/tool.test.ts +++ b/packages/e2e/tests/unit/tool.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { defineTool, getToolContext, toolAppliesTo } from '../../src/agent/tool.ts'; +import { defineTool, getToolContext, toolAppliesTo } from '@e2e-dev/core/lib/agent/tool'; const tool = { description: 'noop', diff --git a/packages/e2e/tests/unit/trace-anchors.test.ts b/packages/e2e/tests/unit/trace-anchors.test.ts index a9da53a1b8..d8d741bb61 100644 --- a/packages/e2e/tests/unit/trace-anchors.test.ts +++ b/packages/e2e/tests/unit/trace-anchors.test.ts @@ -1,11 +1,11 @@ /** Anchors: the step's delta as relocatable descriptors, both what appeared and what vanished. */ import { describe, expect, it } from 'vitest'; -import { deltaEvidenced, deltaMismatch, describeDelta } from '../../src/cache/anchors.ts'; -import { MAX_TRACE_ANCHORS } from '../../src/cache/trace.ts'; -import type { RedactedNode } from '../../src/agent/observation.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; -import { createRedactor } from '../../src/internal/redact.ts'; +import { deltaEvidenced, deltaMismatch, describeDelta } from '@e2e-dev/core/lib/cache/anchors'; +import { MAX_TRACE_ANCHORS } from '@e2e-dev/core/lib/cache/trace'; +import type { RedactedNode } from '@e2e-dev/core/lib/agent/observation'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; +import { createRedactor } from '@e2e-dev/core/lib/internal/redact'; import { redactedNodes } from '../helpers/redacted.ts'; function nodes(list: SemanticNode[]): ReadonlyMap { diff --git a/packages/e2e/tests/unit/trace-cache-config.test.ts b/packages/e2e/tests/unit/trace-cache-config.test.ts index 78a940fdb1..d9bffff67a 100644 --- a/packages/e2e/tests/unit/trace-cache-config.test.ts +++ b/packages/e2e/tests/unit/trace-cache-config.test.ts @@ -5,12 +5,12 @@ import path from 'node:path'; import { chmod, mkdtemp, readFile, rm } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { describe, expect, it } from 'vitest'; -import { createAgentCacheContext, settleStagedTraces } from '../../src/cache/context.ts'; -import { FileCacheStore } from '../../src/cache/store.ts'; -import { buildTraceEntry } from '../../src/cache/trace.ts'; -import { readTraceEntry } from '../../src/cache/trace-read.ts'; +import { createAgentCacheContext, settleStagedTraces } from '@e2e-dev/core/lib/cache/context'; +import { FileCacheStore } from '@e2e-dev/core/lib/cache/store'; +import { buildTraceEntry } from '@e2e-dev/core/lib/cache/trace'; +import { readTraceEntry } from '@e2e-dev/core/lib/cache/trace-read'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import type { ActionTrace, CacheStore } from '../../src/types.ts'; +import type { ActionTrace, CacheStore } from '@e2e-dev/core/lib/types'; import type { E2EConfig } from '../../src/run-types.ts'; const ROOT = path.resolve('/tmp/e2e-cache-config-tests'); diff --git a/packages/e2e/tests/unit/trace-cache.test.ts b/packages/e2e/tests/unit/trace-cache.test.ts index fa8e71e2ec..07b33c2de6 100644 --- a/packages/e2e/tests/unit/trace-cache.test.ts +++ b/packages/e2e/tests/unit/trace-cache.test.ts @@ -1,7 +1,7 @@ /** trace-1 entry format and the replay decision. */ import { describe, expect, it } from 'vitest'; -import { decideTraceReplay } from '../../src/cache/decide.ts'; +import { decideTraceReplay } from '@e2e-dev/core/lib/cache/decide'; import { buildTraceEntry, MAX_TRACE_ACTIONS, @@ -10,8 +10,8 @@ import { type ActionTrace, type RecordedAction, type TraceEntry, -} from '../../src/cache/trace.ts'; -import { readTraceEntry } from '../../src/cache/trace-read.ts'; +} from '@e2e-dev/core/lib/cache/trace'; +import { readTraceEntry } from '@e2e-dev/core/lib/cache/trace-read'; const tap: RecordedAction = { name: 'tap', diff --git a/packages/e2e/tests/unit/trace-identity.test.ts b/packages/e2e/tests/unit/trace-identity.test.ts index ae95bc2508..4a10cea2e5 100644 --- a/packages/e2e/tests/unit/trace-identity.test.ts +++ b/packages/e2e/tests/unit/trace-identity.test.ts @@ -11,7 +11,7 @@ import { traceCacheKeyHash, traceCallSignature, type CacheTargetIdentity, -} from '../../src/cache/identity.ts'; +} from '@e2e-dev/core/lib/cache/identity'; const target: CacheTargetIdentity = { targetId: 'web', diff --git a/packages/e2e/tests/unit/trace-recorder.test.ts b/packages/e2e/tests/unit/trace-recorder.test.ts index 9133e7f7c2..50fbf2c7f5 100644 --- a/packages/e2e/tests/unit/trace-recorder.test.ts +++ b/packages/e2e/tests/unit/trace-recorder.test.ts @@ -1,11 +1,11 @@ /** Step trace recording: durable descriptors, redaction, verbatim inputs. */ import { describe, expect, it } from 'vitest'; -import { describeTarget } from '../../src/agent/actions.ts'; -import { TraceRecorder } from '../../src/cache/recorder.ts'; -import { buildTraceEntry, MAX_TRACE_INPUT_CHARS } from '../../src/cache/trace.ts'; -import { readTraceEntry } from '../../src/cache/trace-read.ts'; -import { createRedactor, SecretLedger } from '../../src/internal/redact.ts'; +import { describeTarget } from '@e2e-dev/core/lib/agent/actions'; +import { TraceRecorder } from '@e2e-dev/core/lib/cache/recorder'; +import { buildTraceEntry, MAX_TRACE_INPUT_CHARS } from '@e2e-dev/core/lib/cache/trace'; +import { readTraceEntry } from '@e2e-dev/core/lib/cache/trace-read'; +import { createRedactor, SecretLedger } from '@e2e-dev/core/lib/internal/redact'; import { redacted } from '../helpers/redacted.ts'; const upgradeButton = redacted({ diff --git a/packages/e2e/tests/unit/trace-replay.test.ts b/packages/e2e/tests/unit/trace-replay.test.ts index 9c129280fb..fcfbda026f 100644 --- a/packages/e2e/tests/unit/trace-replay.test.ts +++ b/packages/e2e/tests/unit/trace-replay.test.ts @@ -1,14 +1,14 @@ /** Zero-turn replay: typed dispatch, relocation backoff, divergence. */ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { AgentError } from '../../src/agent/error.ts'; -import type { ExecutorActions } from '../../src/agent/executor.ts'; -import { replayTrace, verifyEndState, type ObservedScreen, type ReplayHost } from '../../src/agent/replay.ts'; -import { deltaMismatch } from '../../src/cache/anchors.ts'; -import type { TraceTargetDescriptor } from '../../src/cache/trace.ts'; -import type { SettleMode } from '../../src/agent/settle-policy.ts'; -import type { ActionTrace, RecordedAction } from '../../src/cache/trace.ts'; -import type { SemanticNode } from '../../src/engine/surface.ts'; +import { AgentError } from '@e2e-dev/core/lib/agent/error'; +import type { ExecutorActions } from '@e2e-dev/core/lib/agent/executor'; +import { replayTrace, verifyEndState, type ObservedScreen, type ReplayHost } from '@e2e-dev/core/lib/agent/replay'; +import { deltaMismatch } from '@e2e-dev/core/lib/cache/anchors'; +import type { TraceTargetDescriptor } from '@e2e-dev/core/lib/cache/trace'; +import type { SettleMode } from '@e2e-dev/core/lib/agent/settle-policy'; +import type { ActionTrace, RecordedAction } from '@e2e-dev/core/lib/cache/trace'; +import type { SemanticNode } from '@e2e-dev/core/lib/engine/surface'; import { redactedNodes } from '../helpers/redacted.ts'; beforeEach(() => { diff --git a/packages/e2e/tests/unit/trace-route.test.ts b/packages/e2e/tests/unit/trace-route.test.ts index 4847ea777b..fa09b21f26 100644 --- a/packages/e2e/tests/unit/trace-route.test.ts +++ b/packages/e2e/tests/unit/trace-route.test.ts @@ -1,7 +1,7 @@ /** Routes: a location reduced to the screen it names, across the URL shapes apps use. */ import { describe, expect, it } from 'vitest'; -import { appLocation, appNavigation, sameRoute } from '../../src/cache/route.ts'; +import { appLocation, appNavigation, sameRoute } from '@e2e-dev/core/lib/cache/route'; /** Whether every location names the same screen as the first. */ const alike = (first: string, ...others: string[]) => others.every((other) => sameRoute(first, other)); diff --git a/packages/e2e/tests/unit/trace-store.test.ts b/packages/e2e/tests/unit/trace-store.test.ts index c4069c9d27..22ca60f15f 100644 --- a/packages/e2e/tests/unit/trace-store.test.ts +++ b/packages/e2e/tests/unit/trace-store.test.ts @@ -4,8 +4,8 @@ import { mkdtemp, readdir, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '../../src/cache/store.ts'; -import type { ActionTrace } from '../../src/cache/trace.ts'; +import { FileCacheStore, MAX_CACHE_WIRE_BYTES } from '@e2e-dev/core/lib/cache/store'; +import type { ActionTrace } from '@e2e-dev/core/lib/cache/trace'; const KEY = 'a'.repeat(64); diff --git a/packages/e2e/tests/unit/trace-template.test.ts b/packages/e2e/tests/unit/trace-template.test.ts index 8e6930b885..e63debafbc 100644 --- a/packages/e2e/tests/unit/trace-template.test.ts +++ b/packages/e2e/tests/unit/trace-template.test.ts @@ -1,8 +1,8 @@ /** `unique()` params: slots in the key and the recording, filled from each call. */ import { describe, expect, it } from 'vitest'; -import { validateParams } from '../../src/agent/act-validation.ts'; -import { paramsDigest } from '../../src/cache/identity.ts'; +import { validateParams } from '@e2e-dev/core/lib/agent/act-validation'; +import { paramsDigest } from '@e2e-dev/core/lib/cache/identity'; import { expandText, expandTrace, @@ -12,9 +12,9 @@ import { templateText, templateTrace, type ParamTemplate, -} from '../../src/cache/template.ts'; -import type { ActionTrace } from '../../src/cache/trace.ts'; -import { unique } from '../../src/params.ts'; +} from '@e2e-dev/core/lib/cache/template'; +import type { ActionTrace } from '@e2e-dev/core/lib/cache/trace'; +import { unique } from '@e2e-dev/core/lib/params'; const admin = { kind: 'secret', name: 'admin', purpose: 'password' } as const; diff --git a/packages/e2e/tests/unit/transcript-compaction.test.ts b/packages/e2e/tests/unit/transcript-compaction.test.ts index 9009e31721..a66d45f4d2 100644 --- a/packages/e2e/tests/unit/transcript-compaction.test.ts +++ b/packages/e2e/tests/unit/transcript-compaction.test.ts @@ -6,7 +6,7 @@ import type { ModelMessage, ToolResultPart } from 'ai'; import { describe, expect, it } from 'vitest'; -import { compactScreenHistory, compactScreenshotHistory } from '../../src/agent/transcript-compaction.ts'; +import { compactScreenHistory, compactScreenshotHistory } from '@e2e-dev/core/lib/agent/transcript-compaction'; const png = Buffer.from('not really a png').toString('base64'); const image = { type: 'file', data: { type: 'data', data: png }, mediaType: 'image/png' } as const; diff --git a/packages/e2e/tests/unit/units.test.ts b/packages/e2e/tests/unit/units.test.ts index 489a771173..4631bdee10 100644 --- a/packages/e2e/tests/unit/units.test.ts +++ b/packages/e2e/tests/unit/units.test.ts @@ -5,7 +5,7 @@ import type { Selection, TestTargetPair, } from '../../src/collect/select.ts'; -import type { ResolvedTarget } from '../../src/config/resolve.ts'; +import type { ResolvedTarget } from '@e2e-dev/core/lib/config/resolve'; import { buildWorkPlans, failureLimitSkip, @@ -17,7 +17,7 @@ import { type TargetWorkPlan, } from '../../src/run/units.ts'; import { decodeResult } from '../../src/run/worker/protocol.ts'; -import { encodeResult, type ResultRecord } from '../../src/run/records.ts'; +import { encodeResult, type ResultRecord } from '@e2e-dev/core/lib/run/records'; const EMPTY_APP: ResolvedTarget['app'] = { base: undefined, diff --git a/packages/e2e/tests/unit/unserved-model.test.ts b/packages/e2e/tests/unit/unserved-model.test.ts index 34a9658824..7ccb25af8e 100644 --- a/packages/e2e/tests/unit/unserved-model.test.ts +++ b/packages/e2e/tests/unit/unserved-model.test.ts @@ -3,9 +3,9 @@ import { APICallError } from '@ai-sdk/provider'; import { RetryError } from 'ai'; import { describe, expect, it } from 'vitest'; -import { AgentError } from '../../src/agent/error.ts'; -import { isUnservedModelError, unservedModelError } from '../../src/agent/model/sdk.ts'; -import { markUnservedModel, unservedModelExplanation } from '../../src/internal/unserved-model.ts'; +import { AgentError } from '@e2e-dev/core/lib/agent/error'; +import { isUnservedModelError, unservedModelError } from '@e2e-dev/core/lib/agent/model/sdk'; +import { markUnservedModel, unservedModelExplanation } from '@e2e-dev/core/lib/internal/unserved-model'; const EXPLANATION = 'GitHub Copilot does not serve claude-haiku-4.5 to this account'; diff --git a/packages/e2e/tests/unit/upload-paths.test.ts b/packages/e2e/tests/unit/upload-paths.test.ts index aed6e851e3..1470c098fc 100644 --- a/packages/e2e/tests/unit/upload-paths.test.ts +++ b/packages/e2e/tests/unit/upload-paths.test.ts @@ -9,7 +9,7 @@ import { mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSyn import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import { authorizeUploadPaths } from '../../src/agent/upload-paths.ts'; +import { authorizeUploadPaths } from '@e2e-dev/core/lib/agent/upload-paths'; let root: string; let outside: string; diff --git a/packages/e2e/tests/unit/urls.test.ts b/packages/e2e/tests/unit/urls.test.ts index 7a8c2be4ec..ae35600476 100644 --- a/packages/e2e/tests/unit/urls.test.ts +++ b/packages/e2e/tests/unit/urls.test.ts @@ -9,7 +9,7 @@ import { sameSite, siteOf, urlMatches, -} from '../../src/internal/urls.ts'; +} from '@e2e-dev/core/lib/internal/urls'; describe('base URL ports', () => { it('tells a free-port request from a fixed or default port', () => { diff --git a/packages/e2e/tests/unit/worker-handle.test.ts b/packages/e2e/tests/unit/worker-handle.test.ts index 0908f6cae6..4857b3fc2d 100644 --- a/packages/e2e/tests/unit/worker-handle.test.ts +++ b/packages/e2e/tests/unit/worker-handle.test.ts @@ -10,8 +10,8 @@ import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import { afterAll, describe, expect, it, vi } from 'vitest'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { defineEngine, type EngineCleanupContext, type EngineHandle } from '../../src/engine/index.ts'; -import { SessionStore } from '../../src/run/sessions.ts'; +import { defineEngine, type EngineCleanupContext, type EngineHandle } from '@e2e-dev/core/lib/engine/index'; +import { SessionStore } from '@e2e-dev/core/lib/run/sessions'; import { TargetWorker } from '../../src/run/worker/session.ts'; import { childProcessSpawner } from '../../src/run/worker/handle.ts'; diff --git a/packages/e2e/tests/unit/worker-models.test.ts b/packages/e2e/tests/unit/worker-models.test.ts index 94a257e425..7c55fd890a 100644 --- a/packages/e2e/tests/unit/worker-models.test.ts +++ b/packages/e2e/tests/unit/worker-models.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from 'vitest'; -import type { SdkLanguageModel } from '../../src/agent/ai-sdk.ts'; -import { AgentError } from '../../src/agent/error.ts'; +import type { SdkLanguageModel } from '@e2e-dev/core/lib/agent/ai-sdk'; +import { AgentError } from '@e2e-dev/core/lib/agent/error'; import { resolveConfig } from '../../src/config/resolve-run.ts'; -import { WorkerModels } from '../../src/run/worker-models.ts'; +import { WorkerModels } from '@e2e-dev/core/lib/run/worker-models'; const ENV = { APP_URL: 'http://localhost:3000' } as NodeJS.ProcessEnv; diff --git a/packages/e2e/vitest.config.ts b/packages/e2e/vitest.config.ts index 80e2d0b43d..b0552e0f37 100644 --- a/packages/e2e/vitest.config.ts +++ b/packages/e2e/vitest.config.ts @@ -38,6 +38,9 @@ export default defineConfig({ test: { name: 'integration', include: ['tests/integration/**/*.test.ts'], + // @e2e-dev/core's too, so the runner and a test reach one copy of its module state. + // Unit tests load it through Vite's runner instead, where `vi.mock` reaches its modules. + server: { deps: { external: [/[\\/]packages[\\/](?:core|e2e|web|mobile|github|kernel|eas)[\\/]dist[\\/]/] } }, testTimeout: 30_000, hookTimeout: 30_000, pool: 'forks', diff --git a/packages/mobile/README.md b/packages/mobile/README.md index ddc3cb12d5..fcd92baa7b 100644 --- a/packages/mobile/README.md +++ b/packages/mobile/README.md @@ -2,9 +2,9 @@ The mobile engine for [`e2e`](https://www.npmjs.com/package/e2e), built on [agent-device](https://github.com/callstack/agent-device): iOS simulators, -Android emulators, and connected phones through the same `e2e/engine` contract the browser engine +Android emulators, and connected phones through the same `@e2e-dev/core/engine` contract the browser engine implements. A test written against `screen`, `expect`, `app`, and `agent` runs -on a device target unchanged; nothing in `e2e` core knows this package exists. +on a device target unchanged; nothing in `e2e` or `@e2e-dev/core` knows this package exists. ## Install diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 0becf105a2..72599f2e2c 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -68,8 +68,9 @@ "zod": "4.6.7" }, "peerDependencies": { + "@e2e-dev/core": ">=0.23.2 <1", "ai": "^7.0.0", - "e2e": ">=0.22.1 <1" + "e2e": ">=0.23.2 <1" }, "peerDependenciesMeta": { "ai": { @@ -77,6 +78,7 @@ } }, "devDependencies": { + "@e2e-dev/core": "workspace:*", "@types/node": "26.6.6", "ai": "7.0.173", "e2e": "workspace:*", diff --git a/packages/mobile/src/actions.ts b/packages/mobile/src/actions.ts index 8903b07263..082da65c78 100644 --- a/packages/mobile/src/actions.ts +++ b/packages/mobile/src/actions.ts @@ -1,6 +1,6 @@ /** The action kinds a device surface declares, and the pointer dispatch that agrees with them. */ -import type { LocatorActionKind, PointerAction, PointerActionKind, ViewportPoint } from 'e2e/engine'; +import type { LocatorActionKind, PointerAction, PointerActionKind, ViewportPoint } from '@e2e-dev/core/engine'; import type { AgentDeviceClient } from './options.ts'; import { unsupported, type InputBudget } from './support.ts'; diff --git a/packages/mobile/src/bindings.ts b/packages/mobile/src/bindings.ts index 71b2e53b11..727ffcea57 100644 --- a/packages/mobile/src/bindings.ts +++ b/packages/mobile/src/bindings.ts @@ -8,7 +8,7 @@ import { createHash } from 'node:crypto'; import type { createAgentDeviceClient } from 'agent-device'; -import { EngineError, obj, type EngineAppInfo, type EngineFinishInfo, type EnginePrepareInfo } from 'e2e/engine'; +import { EngineError, obj, type EngineAppInfo, type EngineFinishInfo, type EnginePrepareInfo } from '@e2e-dev/core/engine'; type AgentDeviceClientConfig = NonNullable[0]>; diff --git a/packages/mobile/src/device.ts b/packages/mobile/src/device.ts index 805b74769f..d5a0d5a6f0 100644 --- a/packages/mobile/src/device.ts +++ b/packages/mobile/src/device.ts @@ -6,7 +6,7 @@ */ import type { AgentDeviceClient as DeviceSessionClient } from 'agent-device'; -import type { EngineFixtureContext, Locator } from 'e2e/engine'; +import type { EngineFixtureContext, Locator } from '@e2e-dev/core/engine'; import { appLabel, linkLabel, linkTarget } from './links.ts'; import type { DevicePermission, MobilePlatform, PermissionState } from './options.ts'; import type { DeviceSelection } from './pool.ts'; diff --git a/packages/mobile/src/doctor.ts b/packages/mobile/src/doctor.ts index 99615a9066..71fc39f42e 100644 --- a/packages/mobile/src/doctor.ts +++ b/packages/mobile/src/doctor.ts @@ -6,7 +6,7 @@ import { stat } from 'node:fs/promises'; import path from 'node:path'; -import { obj, type EngineDoctorCheck, type EngineDoctorInfo } from 'e2e/engine'; +import { obj, type EngineDoctorCheck, type EngineDoctorInfo } from '@e2e-dev/core/engine'; import { runCommand } from './errors.ts'; import type { ClientFactory, MobileOptions } from './options.ts'; import { deviceSelection, isDeviceList } from './pool.ts'; diff --git a/packages/mobile/src/engine.ts b/packages/mobile/src/engine.ts index eb4892bf21..ab3f46c3c7 100644 --- a/packages/mobile/src/engine.ts +++ b/packages/mobile/src/engine.ts @@ -8,7 +8,7 @@ import { createRequire } from 'node:module'; import { createAgentDeviceClient } from 'agent-device'; -import { ConfigurationError, defineEngine, obj, type EngineAppCheckInfo, type EngineAppDeclaration, type EngineHandle } from 'e2e/engine'; +import { ConfigurationError, defineEngine, obj, type EngineAppCheckInfo, type EngineAppDeclaration, type EngineHandle } from '@e2e-dev/core/engine'; import { createDeviceFixture } from './device.ts'; import type { ClientFactory, MobileOptions, MobilePlatform } from './options.ts'; import { isLink } from './links.ts'; diff --git a/packages/mobile/src/errors.ts b/packages/mobile/src/errors.ts index 15c565c011..cc37936d2a 100644 --- a/packages/mobile/src/errors.ts +++ b/packages/mobile/src/errors.ts @@ -27,7 +27,7 @@ import { isAgentDeviceError, normalizeAgentDeviceError } from 'agent-device'; import { defaultHintForCode } from 'agent-device/contracts'; -import { EngineError, ConfigurationError, InfrastructureError, TestError, raceAbort } from 'e2e/engine'; +import { EngineError, ConfigurationError, InfrastructureError, TestError, raceAbort } from '@e2e-dev/core/engine'; import { cancelled } from './support.ts'; /** diff --git a/packages/mobile/src/keyboard.ts b/packages/mobile/src/keyboard.ts index 6a0e2e1546..8f028787f0 100644 --- a/packages/mobile/src/keyboard.ts +++ b/packages/mobile/src/keyboard.ts @@ -1,6 +1,6 @@ /** Where the keyboard-dismissing drag may start on a screen without pressing anything. */ -import type { ViewportSize } from 'e2e/engine'; +import type { ViewportSize } from '@e2e-dev/core/engine'; import { SCREEN_KINDS, type ProjectedSnapshot } from './nodes.ts'; import type { Point, Rect } from './support.ts'; diff --git a/packages/mobile/src/links.ts b/packages/mobile/src/links.ts index 2b87d47ed0..a7746b5fcf 100644 --- a/packages/mobile/src/links.ts +++ b/packages/mobile/src/links.ts @@ -11,7 +11,7 @@ * (`view-source:file:...`, `blob:`, `filesystem:`) that carry one inside. */ -import { ConfigurationError, TestError } from 'e2e/engine'; +import { ConfigurationError, TestError } from '@e2e-dev/core/engine'; const FORBIDDEN_PROTOCOLS = new Set(['file:', 'data:', 'javascript:', 'view-source:', 'blob:', 'filesystem:']); diff --git a/packages/mobile/src/locate.ts b/packages/mobile/src/locate.ts index 7f677b6697..f0e63b6b24 100644 --- a/packages/mobile/src/locate.ts +++ b/packages/mobile/src/locate.ts @@ -5,7 +5,7 @@ * polling, strictness, and staleness stay with the runner. */ -import { EngineError, matchesText, type LocatorExpression, type SemanticQuery, type TextPattern } from 'e2e/engine'; +import { EngineError, matchesText, type LocatorExpression, type SemanticQuery, type TextPattern } from '@e2e-dev/core/engine'; import { isWithin, type ProjectedNode } from './nodes.ts'; import type { MobilePlatform } from './options.ts'; import { compileSelector } from './selector.ts'; diff --git a/packages/mobile/src/nodes.ts b/packages/mobile/src/nodes.ts index 116712a44f..fb3fd67cb3 100644 --- a/packages/mobile/src/nodes.ts +++ b/packages/mobile/src/nodes.ts @@ -8,7 +8,7 @@ */ import type { CaptureSnapshotResult, SnapshotNode } from 'agent-device'; -import type { SemanticNode, ViewportSize } from 'e2e/engine'; +import type { SemanticNode, ViewportSize } from '@e2e-dev/core/engine'; import type { Rect } from './support.ts'; /** diff --git a/packages/mobile/src/pool.ts b/packages/mobile/src/pool.ts index 55c31a936e..5d185f08d2 100644 --- a/packages/mobile/src/pool.ts +++ b/packages/mobile/src/pool.ts @@ -20,7 +20,7 @@ import { type EngineFinishInfo, type EnginePrepareInfo, type EnginePrepareResult, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { bindingsVariable, decodeBindings, deviceLabel, encodeBindings, pinnedApp, type DeviceSource, type SlotBinding } from './bindings.ts'; import { isRunnerFailure, message, runCommand } from './errors.ts'; import type { AgentDeviceClient, MobileOptions, MobilePlatform, ClientFactory } from './options.ts'; diff --git a/packages/mobile/src/provider.ts b/packages/mobile/src/provider.ts index 3d674409dc..a9d7e5d7cb 100644 --- a/packages/mobile/src/provider.ts +++ b/packages/mobile/src/provider.ts @@ -20,7 +20,7 @@ import { type EnginePrepareInfo, type ProviderRecordContext, type ProviderRecording, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { isSlotBinding, type DeviceClientConfig, type DeviceDaemon, type DeviceSource, type SlotBinding } from './bindings.ts'; import { message } from './errors.ts'; import { isLink } from './links.ts'; diff --git a/packages/mobile/src/selector.ts b/packages/mobile/src/selector.ts index b6a9e0137c..d89220ea38 100644 --- a/packages/mobile/src/selector.ts +++ b/packages/mobile/src/selector.ts @@ -9,7 +9,7 @@ import type { SnapshotNode } from 'agent-device'; import { listSelectorChainMatches, parseSelectorChain } from 'agent-device/selectors'; -import { EngineError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; import type { ProjectedNode } from './nodes.ts'; import type { MobilePlatform } from './options.ts'; import { message } from './errors.ts'; diff --git a/packages/mobile/src/support.ts b/packages/mobile/src/support.ts index 87697ff80e..6936fde5e8 100644 --- a/packages/mobile/src/support.ts +++ b/packages/mobile/src/support.ts @@ -1,7 +1,7 @@ /** Shared helpers for the agent-device engine: error constructors, filenames, PNG headers, gestures, the screen location and size. */ import type { CaptureScreenshotResult, PressOptions } from 'agent-device'; -import { EngineError, withTimeout, type Momentum, type ScrollDirection, type ViewportSize } from 'e2e/engine'; +import { EngineError, withTimeout, type Momentum, type ScrollDirection, type ViewportSize } from '@e2e-dev/core/engine'; import type { AgentDeviceClient } from './options.ts'; export interface Point { diff --git a/packages/mobile/src/surface.ts b/packages/mobile/src/surface.ts index 6a2079727f..1a36fe7bd5 100644 --- a/packages/mobile/src/surface.ts +++ b/packages/mobile/src/surface.ts @@ -45,7 +45,7 @@ import { type ViewportSize, ConfigurationError, TestError, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { isAppNotRunning, isSnapshotPresentationFailure, isUnreadableCapture, runCommand, staleOr } from './errors.ts'; import { pointerInteraction, DEFAULT_LONG_PRESS_MS } from './actions.ts'; import { resolveExpression } from './locate.ts'; diff --git a/packages/mobile/src/tools.ts b/packages/mobile/src/tools.ts index b501a30682..5f7a054a36 100644 --- a/packages/mobile/src/tools.ts +++ b/packages/mobile/src/tools.ts @@ -10,7 +10,7 @@ import type { Tool } from 'ai'; import { z } from 'zod'; import { defineTool, type DefinedTool, type ToolAnnotations } from 'e2e/agent'; -import { EngineError, TestError, type EngineHandle } from 'e2e/engine'; +import { EngineError, TestError, type EngineHandle } from '@e2e-dev/core/engine'; import { rawSession, type DeviceSession } from './device.ts'; import { surfaceOf } from './engine.ts'; import { isAppNotInstalled } from './errors.ts'; diff --git a/packages/mobile/tests/helpers/harness.ts b/packages/mobile/tests/helpers/harness.ts index 22ad55210f..07237bf870 100644 --- a/packages/mobile/tests/helpers/harness.ts +++ b/packages/mobile/tests/helpers/harness.ts @@ -5,7 +5,7 @@ * `init` for one worker slot. */ -import { obj, type EngineAppInfo, type EngineHandle, type EnginePrepareInfo, type EnginePrepareResult } from 'e2e/engine'; +import { obj, type EngineAppInfo, type EngineHandle, type EnginePrepareInfo, type EnginePrepareResult } from '@e2e-dev/core/engine'; import { buildEngine } from '../../src/engine.ts'; import type { MobileOptions } from '../../src/options.ts'; import type { DeviceConnection } from '../../src/bindings.ts'; diff --git a/packages/mobile/tests/unit/captured-snapshots.test.ts b/packages/mobile/tests/unit/captured-snapshots.test.ts index 2b3b870013..38df595e2e 100644 --- a/packages/mobile/tests/unit/captured-snapshots.test.ts +++ b/packages/mobile/tests/unit/captured-snapshots.test.ts @@ -11,7 +11,7 @@ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { describe, expect, it } from 'vitest'; import type { CaptureSnapshotResult } from 'agent-device'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { keyboardBand, projectSnapshot, screenRoot, screenTitle } from '../../src/nodes.ts'; const ROOT = path.join(import.meta.dirname, '../fixtures/snapshots'); diff --git a/packages/mobile/tests/unit/doctor.test.ts b/packages/mobile/tests/unit/doctor.test.ts index e3476c4a46..2a9ad62122 100644 --- a/packages/mobile/tests/unit/doctor.test.ts +++ b/packages/mobile/tests/unit/doctor.test.ts @@ -7,7 +7,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import type { EngineDoctorInfo } from 'e2e/engine'; +import type { EngineDoctorInfo } from '@e2e-dev/core/engine'; import { harness, PROJECT_ROOT, type Harness, type HarnessOptions } from '../helpers/harness.ts'; const MACHINE = [ diff --git a/packages/mobile/tests/unit/engine.test.ts b/packages/mobile/tests/unit/engine.test.ts index 80184bf537..faf577ac38 100644 --- a/packages/mobile/tests/unit/engine.test.ts +++ b/packages/mobile/tests/unit/engine.test.ts @@ -12,7 +12,7 @@ import path from 'node:path'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { AppError } from 'agent-device'; import { decodePng, encodePng } from '../helpers/png.ts'; -import type { EngineFixtureContext, EngineSnapshot, FixtureOperations, LocatorExpression, OperationContext, SemanticNode } from 'e2e/engine'; +import type { EngineFixtureContext, EngineSnapshot, FixtureOperations, LocatorExpression, OperationContext, SemanticNode } from '@e2e-dev/core/engine'; import type { Device } from '../../src/device.ts'; import type { RawNode } from '../../src/nodes.ts'; import { mobile } from '../../src/engine.ts'; diff --git a/packages/mobile/tests/unit/errors.test.ts b/packages/mobile/tests/unit/errors.test.ts index 873990da54..1e5fb9c1fd 100644 --- a/packages/mobile/tests/unit/errors.test.ts +++ b/packages/mobile/tests/unit/errors.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; import { AppError } from 'agent-device'; -import { EngineError, TestError, type OperationContext, type SemanticNode } from 'e2e/engine'; +import { EngineError, TestError, type OperationContext, type SemanticNode } from '@e2e-dev/core/engine'; import { isAppNotInstalled, isRunnerFailure, isSnapshotPresentationFailure, staleOr, translateError } from '../../src/errors.ts'; import { SETTINGS_SNAPSHOT } from '../helpers/fake-client.ts'; import { boot, harness, PROJECT_ROOT, type Harness } from '../helpers/harness.ts'; diff --git a/packages/mobile/tests/unit/input-cancellation.test.ts b/packages/mobile/tests/unit/input-cancellation.test.ts index 134341b860..13a9864687 100644 --- a/packages/mobile/tests/unit/input-cancellation.test.ts +++ b/packages/mobile/tests/unit/input-cancellation.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { createAgentDeviceClient } from 'agent-device'; import { expect, it } from 'vitest'; -import type { EngineFixtureContext, OperationContext } from 'e2e/engine'; +import type { EngineFixtureContext, OperationContext } from '@e2e-dev/core/engine'; import type { Device } from '../../src/device.ts'; import { buildEngine } from '../../src/engine.ts'; import { AgentDeviceSurface } from '../../src/surface.ts'; diff --git a/packages/mobile/tests/unit/locate.test.ts b/packages/mobile/tests/unit/locate.test.ts index ed65c4453f..4f6798458e 100644 --- a/packages/mobile/tests/unit/locate.test.ts +++ b/packages/mobile/tests/unit/locate.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import type { LocatorExpression, TextPattern } from 'e2e/engine'; +import type { LocatorExpression, TextPattern } from '@e2e-dev/core/engine'; import { resolveExpression } from '../../src/locate.ts'; import { projectSnapshot, type RawNode } from '../../src/nodes.ts'; import type { MobilePlatform } from '../../src/options.ts'; diff --git a/packages/mobile/tests/unit/provider.test.ts b/packages/mobile/tests/unit/provider.test.ts index 3c8ec2bedd..6c253acec4 100644 --- a/packages/mobile/tests/unit/provider.test.ts +++ b/packages/mobile/tests/unit/provider.test.ts @@ -9,7 +9,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import type { OperationContext, ProviderRecordContext, ProviderRecording, ProviderRecordingResult, ProviderRecordingStopContext } from 'e2e/engine'; +import type { OperationContext, ProviderRecordContext, ProviderRecording, ProviderRecordingResult, ProviderRecordingStopContext } from '@e2e-dev/core/engine'; import type { DeviceLease, DeviceProvider, DeviceRequest } from '../../src/provider.ts'; import { boot, harness, poolVariableIn, PROJECT_ROOT, type Harness } from '../helpers/harness.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/mobile/tests/unit/tools.test.ts b/packages/mobile/tests/unit/tools.test.ts index 2a3f9ed64c..1761e3dfe8 100644 --- a/packages/mobile/tests/unit/tools.test.ts +++ b/packages/mobile/tests/unit/tools.test.ts @@ -1,6 +1,6 @@ import { AppError } from 'agent-device'; import { describe, expect, it } from 'vitest'; -import { defineEngine } from 'e2e/engine'; +import { defineEngine } from '@e2e-dev/core/engine'; import { buildEngine } from '../../src/engine.ts'; import { AgentDeviceSurface } from '../../src/surface.ts'; import { unstable_deviceSession, mobileTools } from '../../src/tools.ts'; diff --git a/packages/web/README.md b/packages/web/README.md index f36909b7cb..354cea423a 100644 --- a/packages/web/README.md +++ b/packages/web/README.md @@ -5,8 +5,8 @@ The browser engine for [`e2e`](https://www.npmjs.com/package/e2e), built on `e2e` ships no engine of its own: every target names the engine that drives it, and this package is the one for browsers. It implements the public -`e2e/engine` contract, so a device or desktop engine plugs into the same -seam with no privilege either way. +`@e2e-dev/core/engine` contract (`e2e/engine` to the runner), so a device or +desktop engine plugs into the same seam with no privilege either way. ## Install diff --git a/packages/web/package.json b/packages/web/package.json index ade8cd88bd..6021b4703c 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -58,9 +58,11 @@ "playwright-core": "1.65.1" }, "peerDependencies": { + "@e2e-dev/core": ">=0.23.2 <1", "e2e": ">=0.23.2 <1" }, "devDependencies": { + "@e2e-dev/core": "workspace:*", "@napi-rs/image": "1.16.0", "@types/node": "26.6.6", "e2e": "workspace:*", diff --git a/packages/web/src/actions.ts b/packages/web/src/actions.ts index 1985317ef4..2d6090c88c 100644 --- a/packages/web/src/actions.ts +++ b/packages/web/src/actions.ts @@ -1,7 +1,7 @@ /** Locator action dispatch for the Playwright engine. */ import type { ElementHandle, Page } from 'playwright-core'; -import { Deadline, EngineError, pollCondition, type KeyModifier, type LocatorAction, type NodeRef, type PointerAction, type ViewportPoint } from 'e2e/engine'; +import { Deadline, EngineError, pollCondition, type KeyModifier, type LocatorAction, type NodeRef, type PointerAction, type ViewportPoint } from '@e2e-dev/core/engine'; import { asActionable, isClassified, diff --git a/packages/web/src/app-log.ts b/packages/web/src/app-log.ts index 383772fb2b..c20c0e321d 100644 --- a/packages/web/src/app-log.ts +++ b/packages/web/src/app-log.ts @@ -7,7 +7,7 @@ */ import type { BrowserContext, ConsoleMessage, Frame, Page, Request, Response } from 'playwright-core'; -import type { AppLogEntry } from 'e2e/engine'; +import type { AppLogEntry } from '@e2e-dev/core/engine'; /** Console message types worth a line; `debug` and the rest are the app talking to itself. */ const CONSOLE_LEVELS: Readonly> = { diff --git a/packages/web/src/attempt-session.ts b/packages/web/src/attempt-session.ts index 0629910cfa..32a462b74e 100644 --- a/packages/web/src/attempt-session.ts +++ b/packages/web/src/attempt-session.ts @@ -1,6 +1,6 @@ /** Owns one attempt's live binding, its tabs, recovery, references, and recordings. */ import type { Browser, BrowserContext, BrowserContextOptions, Page, Request } from 'playwright-core'; -import { EngineError, raceAbort, TestError, withinCleanupBudget, type EngineCleanupContext, type OperationContext, type VideoSegment, type ViewportSize } from 'e2e/engine'; +import { EngineError, raceAbort, TestError, withinCleanupBudget, type EngineCleanupContext, type OperationContext, type VideoSegment, type ViewportSize } from '@e2e-dev/core/engine'; import { attachPersistent, recoveryFailed, targetIdentity, type CdpEndpointResolver, type SessionBinding, type TargetIdentity } from './cdp-recovery.ts'; import { connectionAbort, withConnectionBudget, withOperationDeadline, type ConnectionBudget, type OperationBound } from './operation-budget.ts'; import { RefRegistry } from './refs.ts'; diff --git a/packages/web/src/browser.ts b/packages/web/src/browser.ts index 46205a52b2..3315cf1fdf 100644 --- a/packages/web/src/browser.ts +++ b/packages/web/src/browser.ts @@ -36,7 +36,7 @@ import { type LocatorExpression, type OperationContext, type TextPattern, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { classifyInputError } from './actions.ts'; import type { AttemptTab } from './attempt-session.ts'; import type { DialogHandler } from './dialogs.ts'; diff --git a/packages/web/src/capture-scope.ts b/packages/web/src/capture-scope.ts index 9f6665360a..978c1cb1d3 100644 --- a/packages/web/src/capture-scope.ts +++ b/packages/web/src/capture-scope.ts @@ -1,7 +1,7 @@ /** Deadline and handle ownership for one observation capture operation. */ import type { JSHandle } from 'playwright-core'; -import { EngineError, raceAbort, withTimeout } from 'e2e/engine'; +import { EngineError, raceAbort, withTimeout } from '@e2e-dev/core/engine'; import { cancelled } from './support.ts'; /** Releases acquired and late-arriving handles without waiting on the transport. */ diff --git a/packages/web/src/cdp-recovery.ts b/packages/web/src/cdp-recovery.ts index a9eafb8be4..89779a1dff 100644 --- a/packages/web/src/cdp-recovery.ts +++ b/packages/web/src/cdp-recovery.ts @@ -1,6 +1,6 @@ /** Validates a persistent CDP binding without publishing or retaining it. */ import type { Browser, BrowserContext, Page } from 'playwright-core'; -import { EngineError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; import { connectCdp, type CdpTarget } from './browser-connection.ts'; import { registerCdpSelectors, requireCdpShadowTracking } from './cdp-selectors.ts'; import { connectionAbort, type ConnectionBudget } from './operation-budget.ts'; diff --git a/packages/web/src/cdp-selectors.ts b/packages/web/src/cdp-selectors.ts index 875fcbcd65..d4987bcf23 100644 --- a/packages/web/src/cdp-selectors.ts +++ b/packages/web/src/cdp-selectors.ts @@ -1,7 +1,7 @@ /** Registers the engine's selector engines in a CDP default context; every locator and secure-field mask needs them. */ import type { BrowserContext, Page } from 'playwright-core'; -import { EngineError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; import { connectionAbort, type ConnectionBudget } from './operation-budget.ts'; import { CLOSED_SHADOW_ROOTS_KEY } from './closed-shadow.ts'; import { SELECTOR_ENGINES } from './selector-engines.ts'; diff --git a/packages/web/src/dialogs.ts b/packages/web/src/dialogs.ts index 65a38b44b0..f913b092d0 100644 --- a/packages/web/src/dialogs.ts +++ b/packages/web/src/dialogs.ts @@ -5,7 +5,7 @@ */ import type { Dialog as PwDialog } from 'playwright-core'; -import { EngineError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; import { ErrorLatch, isClassified, message } from './support.ts'; /** A native dialog as a test's handler sees it. */ diff --git a/packages/web/src/downloads.ts b/packages/web/src/downloads.ts index 72386ca4ac..4a7433317a 100644 --- a/packages/web/src/downloads.ts +++ b/packages/web/src/downloads.ts @@ -9,7 +9,7 @@ import { writeFile } from 'node:fs/promises'; import path from 'node:path'; import type { Browser, CDPSession, Download, Page } from 'playwright-core'; -import { EngineError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; import type { LeaseDownloads } from './provider.ts'; import { invalidState, message } from './support.ts'; diff --git a/packages/web/src/element-list.ts b/packages/web/src/element-list.ts index 387d0319d8..f1bdbf91bb 100644 --- a/packages/web/src/element-list.ts +++ b/packages/web/src/element-list.ts @@ -1,7 +1,7 @@ /** The elements one document's observation walk read, kept behind a single in-page array. */ import type { ElementHandle, JSHandle } from 'playwright-core'; -import { EngineError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; import { navigationStaleOr } from './support.ts'; /** diff --git a/packages/web/src/engine.ts b/packages/web/src/engine.ts index 1952b9bfe8..66e7d152a7 100644 --- a/packages/web/src/engine.ts +++ b/packages/web/src/engine.ts @@ -17,7 +17,7 @@ import { type EngineAppCheckInfo, type EngineAppDeclaration, type EngineHandle, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { createRequire } from 'node:module'; import { asBrowserProvider } from './provider.ts'; import { PlaywrightSurface, type WebOptions } from './surface.ts'; diff --git a/packages/web/src/evaluation.ts b/packages/web/src/evaluation.ts index 822ba16a1a..bb9e31ee19 100644 --- a/packages/web/src/evaluation.ts +++ b/packages/web/src/evaluation.ts @@ -1,6 +1,6 @@ /** Separates exceptions thrown by trusted page code from failures of the evaluation transport. */ import type { JsonValue } from 'e2e'; -import { TestError } from 'e2e/engine'; +import { TestError } from '@e2e-dev/core/engine'; import { message } from './support.ts'; /** The `__name` helper tsx's `keepNames` output calls, declared beside test code serialized into the page; it takes `defineProperty` before that code runs. */ diff --git a/packages/web/src/init-scripts.ts b/packages/web/src/init-scripts.ts index 7aeeda8f80..a051618083 100644 --- a/packages/web/src/init-scripts.ts +++ b/packages/web/src/init-scripts.ts @@ -6,7 +6,7 @@ */ import { readFile } from 'node:fs/promises'; import path from 'node:path'; -import { ConfigurationError, TestError, validateJsonValue, type EngineDoctorCheck, type JsonValue } from 'e2e/engine'; +import { ConfigurationError, TestError, validateJsonValue, type EngineDoctorCheck, type JsonValue } from '@e2e-dev/core/engine'; import { KEEP_NAMES_HELPER, pageFunctionSource } from './evaluation.ts'; import { message } from './support.ts'; diff --git a/packages/web/src/install.ts b/packages/web/src/install.ts index 9a4c1d0c3b..3b0889e73e 100644 --- a/packages/web/src/install.ts +++ b/packages/web/src/install.ts @@ -5,7 +5,7 @@ import { existsSync, readdirSync } from 'node:fs'; import { createRequire } from 'node:module'; import os from 'node:os'; import path from 'node:path'; -import { EngineError, InfrastructureError, type EngineDoctorCheck } from 'e2e/engine'; +import { EngineError, InfrastructureError, type EngineDoctorCheck } from '@e2e-dev/core/engine'; import { browserType, type BrowserName } from './browser-connection.ts'; /** Whether `chromium_headless_shell-` under `browsersPath` finished installing and holds its executable. */ diff --git a/packages/web/src/locators.ts b/packages/web/src/locators.ts index b3dbe3f764..3e1035d443 100644 --- a/packages/web/src/locators.ts +++ b/packages/web/src/locators.ts @@ -1,7 +1,7 @@ /** LocatorExpression -> Playwright locator projection. */ import type { FrameLocator, Locator as PwLocator, Page } from 'playwright-core'; -import { EngineError, type LocatorExpression, type SemanticQuery, type TextPattern } from 'e2e/engine'; +import { EngineError, type LocatorExpression, type SemanticQuery, type TextPattern } from '@e2e-dev/core/engine'; import { SEARCH_ROOTS_SELECTOR_ENGINE } from './closed-shadow.ts'; import { exactLabelSelector } from './label-selector.ts'; import { SECURE_FIELD_SELECTOR } from './read-node.ts'; diff --git a/packages/web/src/observation-capture.ts b/packages/web/src/observation-capture.ts index c8fa3347ec..33f6ccdf98 100644 --- a/packages/web/src/observation-capture.ts +++ b/packages/web/src/observation-capture.ts @@ -1,7 +1,7 @@ /** One observation transaction: settling, semantic capture, masked pixels, and staged refs. */ import type { Page } from 'playwright-core'; -import { EngineError, type EngineObserveOptions, type EngineSnapshot, type OperationContext } from 'e2e/engine'; +import { EngineError, type EngineObserveOptions, type EngineSnapshot, type OperationContext } from '@e2e-dev/core/engine'; import { CaptureScope } from './capture-scope.ts'; import { captureDocument, ROOT_NODE_ID } from './observation.ts'; import { capturePixels } from './observe.ts'; diff --git a/packages/web/src/observation.ts b/packages/web/src/observation.ts index 7b5aef68d8..67ad7be8da 100644 --- a/packages/web/src/observation.ts +++ b/packages/web/src/observation.ts @@ -12,7 +12,7 @@ import { type NodeRef, type SemanticNode, type ViewportPoint, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { readDocumentSemanticsFunction, SECURE_FIELD_SELECTOR, diff --git a/packages/web/src/observe.ts b/packages/web/src/observe.ts index efc1167a0a..b174ad774e 100644 --- a/packages/web/src/observe.ts +++ b/packages/web/src/observe.ts @@ -1,7 +1,7 @@ /** Masked pixel capture for an observation. */ import type { Locator, Page } from 'playwright-core'; -import type { ObservationPixels, OperationContext, ViewportSize } from 'e2e/engine'; +import type { ObservationPixels, OperationContext, ViewportSize } from '@e2e-dev/core/engine'; import { CaptureScope } from './capture-scope.ts'; import { CLOSED_SHADOW_SELECTOR_ENGINE } from './closed-shadow.ts'; import { readableFrames } from './frame-document.ts'; diff --git a/packages/web/src/operation-budget.ts b/packages/web/src/operation-budget.ts index f86c2e03b2..401a1427dd 100644 --- a/packages/web/src/operation-budget.ts +++ b/packages/web/src/operation-budget.ts @@ -1,5 +1,5 @@ /** One deadline for connection recovery and the operation it precedes. */ -import { EngineError, raceAbort } from 'e2e/engine'; +import { EngineError, raceAbort } from '@e2e-dev/core/engine'; export interface ConnectionBudget { readonly timeoutMs: number; diff --git a/packages/web/src/permissions.ts b/packages/web/src/permissions.ts index d47d079fd5..f50e42ed62 100644 --- a/packages/web/src/permissions.ts +++ b/packages/web/src/permissions.ts @@ -3,7 +3,7 @@ * attempt holds. The surface grants them on each context the attempt opens. */ -import { ConfigurationError, rejectUnknownKeys, type AppPermissionState } from 'e2e/engine'; +import { ConfigurationError, rejectUnknownKeys, type AppPermissionState } from '@e2e-dev/core/engine'; import type { BrowserName } from './browser-connection.ts'; /** The permission names Playwright grants on each browser (playwright-core 1.65). */ diff --git a/packages/web/src/protected-app.ts b/packages/web/src/protected-app.ts index c35cf2efbb..4d09a6a09e 100644 --- a/packages/web/src/protected-app.ts +++ b/packages/web/src/protected-app.ts @@ -7,7 +7,7 @@ */ import type { BrowserContext } from 'playwright-core'; -import type { ResolveSecretOptions, Secret } from 'e2e/engine'; +import type { ResolveSecretOptions, Secret } from '@e2e-dev/core/engine'; import type { BrowserName } from './browser-connection.ts'; import type { WebBasicAuth } from './surface.ts'; diff --git a/packages/web/src/provider-video.ts b/packages/web/src/provider-video.ts index 1758e4a933..be1b408858 100644 --- a/packages/web/src/provider-video.ts +++ b/packages/web/src/provider-video.ts @@ -6,7 +6,7 @@ */ import type { Page } from 'playwright-core'; -import { stopProviderRecording, type VideoSegment } from 'e2e/engine'; +import { stopProviderRecording, type VideoSegment } from '@e2e-dev/core/engine'; import { connectionAbort } from './operation-budget.ts'; import type { LeaseRecording } from './provider.ts'; import type { AttemptVideo } from './video.ts'; diff --git a/packages/web/src/provider.ts b/packages/web/src/provider.ts index 7a124a5d5f..0c210a0b9b 100644 --- a/packages/web/src/provider.ts +++ b/packages/web/src/provider.ts @@ -24,7 +24,7 @@ import { type EnginePrepareResult, type ProviderRecordContext, type ProviderRecording, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import type { CdpTarget } from './browser-connection.ts'; import { connectionAbort } from './operation-budget.ts'; import { invalidState, message } from './support.ts'; diff --git a/packages/web/src/refs.ts b/packages/web/src/refs.ts index 9bdbec3697..71cdc41c94 100644 --- a/packages/web/src/refs.ts +++ b/packages/web/src/refs.ts @@ -10,7 +10,7 @@ * an in-flight observation still references. */ -import { EngineError, type EngineSnapshot, type NodeRef } from 'e2e/engine'; +import { EngineError, type EngineSnapshot, type NodeRef } from '@e2e-dev/core/engine'; import type { ElementList } from './element-list.ts'; import type { ActionTarget } from './support.ts'; diff --git a/packages/web/src/route-options.ts b/packages/web/src/route-options.ts index f09cf823be..c59de3d595 100644 --- a/packages/web/src/route-options.ts +++ b/packages/web/src/route-options.ts @@ -9,7 +9,7 @@ import { statSync } from 'node:fs'; import { types } from 'node:util'; -import { rejectUnknownOptions, TestError, validateJsonValue, type JsonValue } from 'e2e/engine'; +import { rejectUnknownOptions, TestError, validateJsonValue, type JsonValue } from '@e2e-dev/core/engine'; import { headerProblem } from './protected-app.ts'; /** What `route.fulfill` hands Playwright once the response is validated. */ diff --git a/packages/web/src/route-pattern.ts b/packages/web/src/route-pattern.ts index 19ab9d9fa5..756600045f 100644 --- a/packages/web/src/route-pattern.ts +++ b/packages/web/src/route-pattern.ts @@ -1,6 +1,6 @@ /** Route URL pattern grammar. */ -import type { TextPattern } from 'e2e/engine'; +import type { TextPattern } from '@e2e-dev/core/engine'; /** Escapes one character for literal use inside a regexp source. */ function escapeRegexpChar(ch: string): string { diff --git a/packages/web/src/screenshot-caret.ts b/packages/web/src/screenshot-caret.ts index 3e9123d810..69cf388658 100644 --- a/packages/web/src/screenshot-caret.ts +++ b/packages/web/src/screenshot-caret.ts @@ -9,7 +9,7 @@ * not blocked by a `style-src` policy. */ -import { withTimeout } from 'e2e/engine'; +import { withTimeout } from '@e2e-dev/core/engine'; import type { Frame, JSHandle, Page } from 'playwright-core'; /** The most one frame may hold the capture while taking or giving back the sheet. */ diff --git a/packages/web/src/support.ts b/packages/web/src/support.ts index 4a1c6c09f3..339bd9e399 100644 --- a/packages/web/src/support.ts +++ b/packages/web/src/support.ts @@ -2,8 +2,8 @@ import { setTimeout } from 'node:timers/promises'; import type { ElementHandle, FrameLocator, Locator as PwLocator, Mouse, Page } from 'playwright-core'; -import { EngineError, withinCleanupBudget, type EngineCleanupContext, type Momentum, type ScrollDirection, type ViewportPoint, type ViewportSize } from 'e2e/engine'; -import { ConfigurationError, InfrastructureError, TestError } from 'e2e/engine'; +import { EngineError, withinCleanupBudget, type EngineCleanupContext, type Momentum, type ScrollDirection, type ViewportPoint, type ViewportSize } from '@e2e-dev/core/engine'; +import { ConfigurationError, InfrastructureError, TestError } from '@e2e-dev/core/engine'; export const DEFAULT_VIEWPORT = { width: 1280, height: 720 } as const; diff --git a/packages/web/src/surface.ts b/packages/web/src/surface.ts index 2c993ad2b5..614f3674cb 100644 --- a/packages/web/src/surface.ts +++ b/packages/web/src/surface.ts @@ -43,8 +43,8 @@ import { type VideoSegment, type ViewportPoint, type ViewportSize, -} from 'e2e/engine'; -import { matchesText } from 'e2e/engine'; +} from '@e2e-dev/core/engine'; +import { matchesText } from '@e2e-dev/core/engine'; import { classifyActionError, classifyInputError, dispatchLocatorAction, dispatchPointerAction } from './actions.ts'; import { BrowserConnection, connectCdp, type BrowserName } from './browser-connection.ts'; import { AttemptSession, type AttemptTab, type StorageState } from './attempt-session.ts'; diff --git a/packages/web/src/trace-feed.ts b/packages/web/src/trace-feed.ts index 8f5e9bbad5..c85acb6aeb 100644 --- a/packages/web/src/trace-feed.ts +++ b/packages/web/src/trace-feed.ts @@ -6,7 +6,7 @@ */ import type { Page } from 'playwright-core'; -import type { EngineAttemptContext, OperationContext } from 'e2e/engine'; +import type { EngineAttemptContext, OperationContext } from '@e2e-dev/core/engine'; import { captureObservation, type CaptureSettings } from './observation-capture.ts'; import { withOperationDeadline } from './operation-budget.ts'; import { RefRegistry } from './refs.ts'; diff --git a/packages/web/src/video.ts b/packages/web/src/video.ts index 2cea973844..3385238fd0 100644 --- a/packages/web/src/video.ts +++ b/packages/web/src/video.ts @@ -21,7 +21,7 @@ import { existsSync, mkdirSync } from 'node:fs'; import path from 'node:path'; import type { Page } from 'playwright-core'; -import { EngineError, type VideoFile, type VideoSegment } from 'e2e/engine'; +import { EngineError, type VideoFile, type VideoSegment } from '@e2e-dev/core/engine'; import type { WebScreencastOptions } from './surface.ts'; import { currentViewport, message } from './support.ts'; diff --git a/packages/web/tests/crosscheck/crosscheck.ts b/packages/web/tests/crosscheck/crosscheck.ts index 604a5a8e63..ed36f7a10b 100644 --- a/packages/web/tests/crosscheck/crosscheck.ts +++ b/packages/web/tests/crosscheck/crosscheck.ts @@ -11,7 +11,7 @@ */ import type { Browser, Page } from 'playwright-core'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { CLOSED_SHADOW_ROOTS_INIT_SCRIPT } from '../../src/closed-shadow.ts'; import { captureDocument } from '../../src/observation.ts'; import { Published } from '../helpers/published.ts'; diff --git a/packages/web/tests/integration/app-log.test.ts b/packages/web/tests/integration/app-log.test.ts index 5727205844..3013cf156a 100644 --- a/packages/web/tests/integration/app-log.test.ts +++ b/packages/web/tests/integration/app-log.test.ts @@ -14,7 +14,7 @@ import type { AddressInfo } from 'node:net'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { AppLogEntry, EngineCleanupContext, EngineFixtureContext, EngineSnapshot, OperationContext } from 'e2e/engine'; +import type { AppLogEntry, EngineCleanupContext, EngineFixtureContext, EngineSnapshot, OperationContext } from '@e2e-dev/core/engine'; import { createBrowserFixture } from '../../src/browser.ts'; import { PlaywrightSurface } from '../../src/surface.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/cdp-attach.test.ts b/packages/web/tests/integration/cdp-attach.test.ts index c88417b4a7..ca5bd10cbd 100644 --- a/packages/web/tests/integration/cdp-attach.test.ts +++ b/packages/web/tests/integration/cdp-attach.test.ts @@ -10,7 +10,7 @@ import { existsSync, mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { EngineCleanupContext, EngineHandle, OperationContext } from 'e2e/engine'; +import type { EngineCleanupContext, EngineHandle, OperationContext } from '@e2e-dev/core/engine'; import { web } from '../../src/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { closeRemoteChrome, launchRemoteChrome, type RemoteChrome } from '../helpers/cdp-host.ts'; diff --git a/packages/web/tests/integration/cdp-recovery.test.ts b/packages/web/tests/integration/cdp-recovery.test.ts index 9311c80188..df60683ae3 100644 --- a/packages/web/tests/integration/cdp-recovery.test.ts +++ b/packages/web/tests/integration/cdp-recovery.test.ts @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest'; import { chromium } from 'playwright-core'; -import type { EngineFixtureContext, EngineHandle, OperationContext } from 'e2e/engine'; +import type { EngineFixtureContext, EngineHandle, OperationContext } from '@e2e-dev/core/engine'; import { web as webEngine, surfaceOf, type WebConnectOptions, type WebOptions, type Browser } from '../../src/index.ts'; import { closeRemoteChrome, launchRemoteChrome, type RemoteChrome } from '../helpers/cdp-host.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; diff --git a/packages/web/tests/integration/check-actions.test.ts b/packages/web/tests/integration/check-actions.test.ts index f792defbdc..569d6e138e 100644 --- a/packages/web/tests/integration/check-actions.test.ts +++ b/packages/web/tests/integration/check-actions.test.ts @@ -11,7 +11,7 @@ import { createServer, type Server } from 'node:http'; import type { AddressInfo } from 'node:net'; import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import type { LocatorAction, SemanticNode } from 'e2e/engine'; +import type { LocatorAction, SemanticNode } from '@e2e-dev/core/engine'; import { classifyActionError, dispatchLocatorAction } from '../../src/actions.ts'; import { ElementList } from '../../src/element-list.ts'; import { captureDocument } from '../../src/observation.ts'; diff --git a/packages/web/tests/integration/clear-cookies.test.ts b/packages/web/tests/integration/clear-cookies.test.ts index 899e84e664..6b99e806a9 100644 --- a/packages/web/tests/integration/clear-cookies.test.ts +++ b/packages/web/tests/integration/clear-cookies.test.ts @@ -11,7 +11,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'; import type { Page } from 'playwright-core'; -import type { EngineFixtureContext } from 'e2e/engine'; +import type { EngineFixtureContext } from '@e2e-dev/core/engine'; import { PlaywrightSurface } from '../../src/surface.ts'; import { createBrowserFixture, type Browser, type CookieFilter } from '../../src/browser.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/closed-shadow-locators.test.ts b/packages/web/tests/integration/closed-shadow-locators.test.ts index 860cdbd52b..db389a9267 100644 --- a/packages/web/tests/integration/closed-shadow-locators.test.ts +++ b/packages/web/tests/integration/closed-shadow-locators.test.ts @@ -18,7 +18,7 @@ import type { SemanticNode, SemanticQuery, TextPattern, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { web } from '../../src/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/computed-style.test.ts b/packages/web/tests/integration/computed-style.test.ts index db7563b6d9..2f19aa66e5 100644 --- a/packages/web/tests/integration/computed-style.test.ts +++ b/packages/web/tests/integration/computed-style.test.ts @@ -3,7 +3,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; -import type { ComputedStyleProperty, EngineHandle, OperationContext, SemanticNode } from 'e2e/engine'; +import type { ComputedStyleProperty, EngineHandle, OperationContext, SemanticNode } from '@e2e-dev/core/engine'; import { web, surfaceOf } from '../../src/index.ts'; import { RefRegistry } from '../../src/refs.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/concurrent-observe.test.ts b/packages/web/tests/integration/concurrent-observe.test.ts index aa8b284bcc..ab7ad8c2ae 100644 --- a/packages/web/tests/integration/concurrent-observe.test.ts +++ b/packages/web/tests/integration/concurrent-observe.test.ts @@ -4,7 +4,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { web, surfaceOf } from '../../src/index.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/evaluate.test.ts b/packages/web/tests/integration/evaluate.test.ts index 9af1386e1e..f7dac5a95c 100644 --- a/packages/web/tests/integration/evaluate.test.ts +++ b/packages/web/tests/integration/evaluate.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import type { Page } from 'playwright-core'; -import type { EngineFixtureContext } from 'e2e/engine'; +import type { EngineFixtureContext } from '@e2e-dev/core/engine'; import { PlaywrightSurface } from '../../src/surface.ts'; import { createBrowserFixture, type Browser } from '../../src/browser.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/hidden-frames.test.ts b/packages/web/tests/integration/hidden-frames.test.ts index bac8305bc9..a1ba4a0a42 100644 --- a/packages/web/tests/integration/hidden-frames.test.ts +++ b/packages/web/tests/integration/hidden-frames.test.ts @@ -10,7 +10,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import type { Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { LocatorExpression } from 'e2e/engine'; +import type { LocatorExpression } from '@e2e-dev/core/engine'; import { surfaceOf, web } from '../../src/index.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/hung-page.test.ts b/packages/web/tests/integration/hung-page.test.ts index 4be92d97bd..f7f5f79c4d 100644 --- a/packages/web/tests/integration/hung-page.test.ts +++ b/packages/web/tests/integration/hung-page.test.ts @@ -14,7 +14,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'; import type { Locator } from 'e2e'; -import type { EngineFixtureContext, EngineHandle, LocatorExpression, NodeRef, OperationContext } from 'e2e/engine'; +import type { EngineFixtureContext, EngineHandle, LocatorExpression, NodeRef, OperationContext } from '@e2e-dev/core/engine'; import { web, type BrowserExpectation } from '../../src/index.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/icon-glyph-names.test.ts b/packages/web/tests/integration/icon-glyph-names.test.ts index b63fbe2df6..6fac530f6b 100644 --- a/packages/web/tests/integration/icon-glyph-names.test.ts +++ b/packages/web/tests/integration/icon-glyph-names.test.ts @@ -11,7 +11,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { EngineCleanupContext, EngineHandle, LocatorExpression, OperationContext, SemanticNode } from 'e2e/engine'; +import type { EngineCleanupContext, EngineHandle, LocatorExpression, OperationContext, SemanticNode } from '@e2e-dev/core/engine'; import { surfaceOf, web } from '../../src/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/init-scripts.test.ts b/packages/web/tests/integration/init-scripts.test.ts index 4ea43b72d1..7128ac9894 100644 --- a/packages/web/tests/integration/init-scripts.test.ts +++ b/packages/web/tests/integration/init-scripts.test.ts @@ -12,7 +12,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { secrets } from 'e2e'; -import type { EngineCleanupContext, EngineFixtureContext, OperationContext } from 'e2e/engine'; +import type { EngineCleanupContext, EngineFixtureContext, OperationContext } from '@e2e-dev/core/engine'; import { createBrowserFixture, type Browser } from '../../src/browser.ts'; import { PlaywrightSurface, type WebOptions } from '../../src/surface.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/keyboard.test.ts b/packages/web/tests/integration/keyboard.test.ts index 6b69f0a63e..31d6f6d841 100644 --- a/packages/web/tests/integration/keyboard.test.ts +++ b/packages/web/tests/integration/keyboard.test.ts @@ -3,7 +3,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import type { EngineFixtureContext } from 'e2e/engine'; +import type { EngineFixtureContext } from '@e2e-dev/core/engine'; import { PlaywrightSurface } from '../../src/surface.ts'; import { createBrowserFixture, type Browser } from '../../src/browser.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/label-composition.test.ts b/packages/web/tests/integration/label-composition.test.ts index 1932349fdb..fcbbd26cfb 100644 --- a/packages/web/tests/integration/label-composition.test.ts +++ b/packages/web/tests/integration/label-composition.test.ts @@ -10,7 +10,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { EngineCleanupContext, EngineHandle, LocatorExpression, OperationContext, TextPattern } from 'e2e/engine'; +import type { EngineCleanupContext, EngineHandle, LocatorExpression, OperationContext, TextPattern } from '@e2e-dev/core/engine'; import { web } from '../../src/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/lifecycle.test.ts b/packages/web/tests/integration/lifecycle.test.ts index 177969f885..748a933aa8 100644 --- a/packages/web/tests/integration/lifecycle.test.ts +++ b/packages/web/tests/integration/lifecycle.test.ts @@ -18,7 +18,7 @@ import type { LocatorExpression, OperationContext, SemanticNode, -} from 'e2e/engine'; +} from '@e2e-dev/core/engine'; import { web, surfaceOf } from '../../src/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { decodePng } from '../helpers/png.ts'; diff --git a/packages/web/tests/integration/line-text.test.ts b/packages/web/tests/integration/line-text.test.ts index cbaa2260f2..2faf30733a 100644 --- a/packages/web/tests/integration/line-text.test.ts +++ b/packages/web/tests/integration/line-text.test.ts @@ -7,7 +7,7 @@ import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { CLOSED_SHADOW_ROOTS_INIT_SCRIPT } from '../../src/closed-shadow.ts'; import { captureDocument } from '../../src/observation.ts'; diff --git a/packages/web/tests/integration/media.test.ts b/packages/web/tests/integration/media.test.ts index 98fbd04a58..7a7bacb5bd 100644 --- a/packages/web/tests/integration/media.test.ts +++ b/packages/web/tests/integration/media.test.ts @@ -10,7 +10,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { EngineCleanupContext, EngineFixtureContext, EngineHandle, OperationContext } from 'e2e/engine'; +import type { EngineCleanupContext, EngineFixtureContext, EngineHandle, OperationContext } from '@e2e-dev/core/engine'; import { web, surfaceOf, type Browser, type WebMedia, type WebOptions } from '../../src/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/nested-frames.test.ts b/packages/web/tests/integration/nested-frames.test.ts index 040b533a3f..e752b234f1 100644 --- a/packages/web/tests/integration/nested-frames.test.ts +++ b/packages/web/tests/integration/nested-frames.test.ts @@ -10,7 +10,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import type { Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { LocatorExpression } from 'e2e/engine'; +import type { LocatorExpression } from '@e2e-dev/core/engine'; import { surfaceOf, web } from '../../src/index.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/permissions.test.ts b/packages/web/tests/integration/permissions.test.ts index c5097de88e..2768c9560b 100644 --- a/packages/web/tests/integration/permissions.test.ts +++ b/packages/web/tests/integration/permissions.test.ts @@ -9,7 +9,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { AppPermissionState, EngineCleanupContext, EngineHandle, OperationContext } from 'e2e/engine'; +import type { AppPermissionState, EngineCleanupContext, EngineHandle, OperationContext } from '@e2e-dev/core/engine'; import { web, surfaceOf } from '../../src/index.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/protected-app.test.ts b/packages/web/tests/integration/protected-app.test.ts index ee6400a655..c3cc446f0f 100644 --- a/packages/web/tests/integration/protected-app.test.ts +++ b/packages/web/tests/integration/protected-app.test.ts @@ -14,7 +14,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { secrets } from 'e2e'; -import type { EngineCleanupContext, EngineHandle, OperationContext, Secret } from 'e2e/engine'; +import type { EngineCleanupContext, EngineHandle, OperationContext, Secret } from '@e2e-dev/core/engine'; import { web, surfaceOf } from '../../src/index.ts'; import { PROTECTED_CREDENTIAL, startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/provider-downloads.test.ts b/packages/web/tests/integration/provider-downloads.test.ts index 7cfdde18dd..f4c9f8e54a 100644 --- a/packages/web/tests/integration/provider-downloads.test.ts +++ b/packages/web/tests/integration/provider-downloads.test.ts @@ -12,7 +12,7 @@ import { readFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, beforeAll, afterAll, describe, expect, it } from 'vitest'; -import type { EngineFixtureContext, EngineHandle, OperationContext } from 'e2e/engine'; +import type { EngineFixtureContext, EngineHandle, OperationContext } from '@e2e-dev/core/engine'; import { web as webEngine, surfaceOf, type BrowserProvider, type BrowserProviderScope, type Browser } from '../../src/index.ts'; import { closeRemoteChrome, launchRemoteChrome, type RemoteChrome } from '../helpers/cdp-host.ts'; import { startFixtureApp, type FixtureApp } from '../helpers/fixture-app.ts'; diff --git a/packages/web/tests/integration/read-node-checked.test.ts b/packages/web/tests/integration/read-node-checked.test.ts index cc279b73cc..765a878266 100644 --- a/packages/web/tests/integration/read-node-checked.test.ts +++ b/packages/web/tests/integration/read-node-checked.test.ts @@ -6,7 +6,7 @@ import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { captureDocument } from '../../src/observation.ts'; import { readSemanticsFunction } from '../../src/in-page/read-semantics.ts'; import { SECURE_FIELD_SELECTOR } from '../../src/read-node.ts'; diff --git a/packages/web/tests/integration/read-node-names.test.ts b/packages/web/tests/integration/read-node-names.test.ts index 93ee506766..07da5f40e1 100644 --- a/packages/web/tests/integration/read-node-names.test.ts +++ b/packages/web/tests/integration/read-node-names.test.ts @@ -2,7 +2,7 @@ import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { CLOSED_SHADOW_ROOTS_INIT_SCRIPT } from '../../src/closed-shadow.ts'; import { captureDocument } from '../../src/observation.ts'; import { readSemanticsFunction } from '../../src/in-page/read-semantics.ts'; diff --git a/packages/web/tests/integration/read-node-roles.test.ts b/packages/web/tests/integration/read-node-roles.test.ts index 3a2b7dc267..48614c87e6 100644 --- a/packages/web/tests/integration/read-node-roles.test.ts +++ b/packages/web/tests/integration/read-node-roles.test.ts @@ -2,7 +2,7 @@ import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { captureDocument } from '../../src/observation.ts'; import { CLOSED_SHADOW_ROOTS_INIT_SCRIPT } from '../../src/closed-shadow.ts'; import { Published } from '../helpers/published.ts'; diff --git a/packages/web/tests/integration/read-node-selection.test.ts b/packages/web/tests/integration/read-node-selection.test.ts index dee8cb6fd2..bff0d45acc 100644 --- a/packages/web/tests/integration/read-node-selection.test.ts +++ b/packages/web/tests/integration/read-node-selection.test.ts @@ -2,7 +2,7 @@ import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { captureDocument } from '../../src/observation.ts'; import { Published } from '../helpers/published.ts'; diff --git a/packages/web/tests/integration/read-node-states.test.ts b/packages/web/tests/integration/read-node-states.test.ts index 9e725f93f1..a19701b0b0 100644 --- a/packages/web/tests/integration/read-node-states.test.ts +++ b/packages/web/tests/integration/read-node-states.test.ts @@ -2,7 +2,7 @@ import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { captureDocument } from '../../src/observation.ts'; import { Published } from '../helpers/published.ts'; diff --git a/packages/web/tests/integration/routes.test.ts b/packages/web/tests/integration/routes.test.ts index fe18b9066b..ca0c536018 100644 --- a/packages/web/tests/integration/routes.test.ts +++ b/packages/web/tests/integration/routes.test.ts @@ -17,7 +17,7 @@ import path from 'node:path'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import type { EventEmitter } from 'node:events'; import type { Download, Page } from 'playwright-core'; -import { TestError, type EngineFixtureContext } from 'e2e/engine'; +import { TestError, type EngineFixtureContext } from '@e2e-dev/core/engine'; import { PlaywrightSurface } from '../../src/surface.ts'; import { createBrowserFixture, type Browser, type WebRoute } from '../../src/browser.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/screenshot-caret.test.ts b/packages/web/tests/integration/screenshot-caret.test.ts index 309a7d1786..74c78a8330 100644 --- a/packages/web/tests/integration/screenshot-caret.test.ts +++ b/packages/web/tests/integration/screenshot-caret.test.ts @@ -2,7 +2,7 @@ import type { Browser, BrowserContext, Page } from 'playwright-core'; import { afterAll, beforeAll, expect, it, vi } from 'vitest'; -import type { OperationContext } from 'e2e/engine'; +import type { OperationContext } from '@e2e-dev/core/engine'; import { BrowserConnection } from '../../src/browser-connection.ts'; import { CLOSED_SHADOW_ROOTS_INIT_SCRIPT } from '../../src/closed-shadow.ts'; import { capturePixels } from '../../src/observe.ts'; diff --git a/packages/web/tests/integration/screenshot-navigation.test.ts b/packages/web/tests/integration/screenshot-navigation.test.ts index fb6716d7c8..e110966e51 100644 --- a/packages/web/tests/integration/screenshot-navigation.test.ts +++ b/packages/web/tests/integration/screenshot-navigation.test.ts @@ -12,7 +12,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import type { Page } from 'playwright-core'; -import type { OperationContext } from 'e2e/engine'; +import type { OperationContext } from '@e2e-dev/core/engine'; import { PlaywrightSurface } from '../../src/surface.ts'; import { decodePng } from '../helpers/png.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/semantic-fallback.test.ts b/packages/web/tests/integration/semantic-fallback.test.ts index 384504d79d..800045cb12 100644 --- a/packages/web/tests/integration/semantic-fallback.test.ts +++ b/packages/web/tests/integration/semantic-fallback.test.ts @@ -2,7 +2,7 @@ import { mkdtempSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { describe, expect, it, vi } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { web, surfaceOf } from '../../src/index.ts'; import { decodePng } from '../helpers/png.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/stalled-frame.test.ts b/packages/web/tests/integration/stalled-frame.test.ts index 3966fd9326..2a1a9ad64e 100644 --- a/packages/web/tests/integration/stalled-frame.test.ts +++ b/packages/web/tests/integration/stalled-frame.test.ts @@ -6,7 +6,7 @@ import type { Browser, BrowserContext, Page, Route } from 'playwright-core'; import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'; -import type { OperationContext } from 'e2e/engine'; +import type { OperationContext } from '@e2e-dev/core/engine'; import { BrowserConnection } from '../../src/browser-connection.ts'; import { CLOSED_SHADOW_ROOTS_INIT_SCRIPT } from '../../src/closed-shadow.ts'; import { captureObservation } from '../../src/observation-capture.ts'; diff --git a/packages/web/tests/integration/tabs.test.ts b/packages/web/tests/integration/tabs.test.ts index 11806c9225..3b3fde7fda 100644 --- a/packages/web/tests/integration/tabs.test.ts +++ b/packages/web/tests/integration/tabs.test.ts @@ -11,7 +11,7 @@ import type { AddressInfo } from 'node:net'; import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { EngineCleanupContext, EngineFixtureContext, EngineHandle, EngineSnapshot, OperationContext, SemanticNode } from 'e2e/engine'; +import type { EngineCleanupContext, EngineFixtureContext, EngineHandle, EngineSnapshot, OperationContext, SemanticNode } from '@e2e-dev/core/engine'; import { web, type Browser } from '../../src/index.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/integration/visibility.test.ts b/packages/web/tests/integration/visibility.test.ts index bef716364b..7a4639da0e 100644 --- a/packages/web/tests/integration/visibility.test.ts +++ b/packages/web/tests/integration/visibility.test.ts @@ -10,7 +10,7 @@ import { chromium, type Browser, type Page } from 'playwright-core'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { SemanticNode } from 'e2e/engine'; +import type { SemanticNode } from '@e2e-dev/core/engine'; import { captureDocument } from '../../src/observation.ts'; import { readSemanticsFunction } from '../../src/in-page/read-semantics.ts'; import { SECURE_FIELD_SELECTOR } from '../../src/read-node.ts'; diff --git a/packages/web/tests/integration/wait-for-response.test.ts b/packages/web/tests/integration/wait-for-response.test.ts index df3b415ece..866d24d153 100644 --- a/packages/web/tests/integration/wait-for-response.test.ts +++ b/packages/web/tests/integration/wait-for-response.test.ts @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'; import type { Page } from 'playwright-core'; -import { withTimeout, type EngineFixtureContext } from 'e2e/engine'; +import { withTimeout, type EngineFixtureContext } from '@e2e-dev/core/engine'; import { PlaywrightSurface } from '../../src/surface.ts'; import { createBrowserFixture, type Browser } from '../../src/browser.ts'; import { ignoreTrace, noSecrets } from '../helpers/secrets.ts'; diff --git a/packages/web/tests/unit/actions.test.ts b/packages/web/tests/unit/actions.test.ts index d4d81f0ad4..64705db1c3 100644 --- a/packages/web/tests/unit/actions.test.ts +++ b/packages/web/tests/unit/actions.test.ts @@ -7,7 +7,7 @@ import type { Locator as PwLocator, Page } from 'playwright-core'; import { describe, expect, it, vi } from 'vitest'; -import { EngineError, TestError, type LocatorAction } from 'e2e/engine'; +import { EngineError, TestError, type LocatorAction } from '@e2e-dev/core/engine'; import { classifyActionError, dispatchLocatorAction, dispatchPointerAction } from '../../src/actions.ts'; import { dispatchedInput, type ActionTarget } from '../../src/support.ts'; diff --git a/packages/web/tests/unit/browser-provider.test.ts b/packages/web/tests/unit/browser-provider.test.ts index 03f8ff9776..07bf12add6 100644 --- a/packages/web/tests/unit/browser-provider.test.ts +++ b/packages/web/tests/unit/browser-provider.test.ts @@ -10,7 +10,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import type { Browser, Page } from 'playwright-core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import type { EngineAttemptContext, EngineCleanupContext, EngineFinishInfo, EngineInitInfo, EnginePrepareInfo, OperationContext, ProviderRecordContext, ProviderRecording } from 'e2e/engine'; +import type { EngineAttemptContext, EngineCleanupContext, EngineFinishInfo, EngineInitInfo, EnginePrepareInfo, OperationContext, ProviderRecordContext, ProviderRecording } from '@e2e-dev/core/engine'; import { connectCdp } from '../../src/browser-connection.ts'; import { web } from '../../src/index.ts'; import { LeasedBrowsers, type BrowserLease, type BrowserProvider, type BrowserReleaseContext, type BrowserRequest } from '../../src/provider.ts'; diff --git a/packages/web/tests/unit/cdp-connect.test.ts b/packages/web/tests/unit/cdp-connect.test.ts index 73ad1f1375..7b487e9d72 100644 --- a/packages/web/tests/unit/cdp-connect.test.ts +++ b/packages/web/tests/unit/cdp-connect.test.ts @@ -5,7 +5,7 @@ */ import { describe, expect, it, vi } from 'vitest'; -import type { EngineInitInfo } from 'e2e/engine'; +import type { EngineInitInfo } from '@e2e-dev/core/engine'; import { web, type WebConnectOptions } from '../../src/index.ts'; import { PlaywrightSurface } from '../../src/surface.ts'; diff --git a/packages/web/tests/unit/dialogs.test.ts b/packages/web/tests/unit/dialogs.test.ts index 47b9784f3a..678a540bb1 100644 --- a/packages/web/tests/unit/dialogs.test.ts +++ b/packages/web/tests/unit/dialogs.test.ts @@ -4,7 +4,7 @@ */ import type { Dialog as PwDialog } from 'playwright-core'; -import { TestError } from 'e2e/engine'; +import { TestError } from '@e2e-dev/core/engine'; import { describe, expect, it, vi } from 'vitest'; import { DialogRouter } from '../../src/dialogs.ts'; import { ErrorLatch } from '../../src/support.ts'; diff --git a/packages/web/tests/unit/doctor.test.ts b/packages/web/tests/unit/doctor.test.ts index fca27107da..7c8f1f5228 100644 --- a/packages/web/tests/unit/doctor.test.ts +++ b/packages/web/tests/unit/doctor.test.ts @@ -3,7 +3,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'; import { tmpdir } from 'node:os'; import path from 'node:path'; -import type { EngineDoctorInfo } from 'e2e/engine'; +import type { EngineDoctorInfo } from '@e2e-dev/core/engine'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { web, type BrowserProvider } from '../../src/index.ts'; diff --git a/packages/web/tests/unit/errors.test.ts b/packages/web/tests/unit/errors.test.ts index bb826e9974..fa62029839 100644 --- a/packages/web/tests/unit/errors.test.ts +++ b/packages/web/tests/unit/errors.test.ts @@ -5,8 +5,8 @@ */ import { describe, expect, it } from 'vitest'; -import { EngineError } from 'e2e/engine'; -import { ConfigurationError, TestError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; +import { ConfigurationError, TestError } from '@e2e-dev/core/engine'; import type { Page } from 'playwright-core'; import { isTestErrorCode, navigationStaleOr, pageScriptFailure, staleOr, translatePwError } from '../../src/support.ts'; diff --git a/packages/web/tests/unit/frame-screen.test.ts b/packages/web/tests/unit/frame-screen.test.ts index 1080ed04ec..a712c92ca2 100644 --- a/packages/web/tests/unit/frame-screen.test.ts +++ b/packages/web/tests/unit/frame-screen.test.ts @@ -6,7 +6,7 @@ */ import { describe, expect, it } from 'vitest'; -import type { EngineFixtureContext, LocatorExpression } from 'e2e/engine'; +import type { EngineFixtureContext, LocatorExpression } from '@e2e-dev/core/engine'; import type { Locator, Screen } from 'e2e'; import type { PlaywrightSurface } from '../../src/surface.ts'; import { createBrowserFixture } from '../../src/browser.ts'; diff --git a/packages/web/tests/unit/locators.test.ts b/packages/web/tests/unit/locators.test.ts index 85132a9439..e29deba20b 100644 --- a/packages/web/tests/unit/locators.test.ts +++ b/packages/web/tests/unit/locators.test.ts @@ -6,7 +6,7 @@ import type { Locator as PwLocator, Page } from 'playwright-core'; import { describe, expect, it } from 'vitest'; -import type { LocatorExpression, TextPattern } from 'e2e/engine'; +import type { LocatorExpression, TextPattern } from '@e2e-dev/core/engine'; import { applyPostSteps, frameSelectors, projectExpression as projectWith, type PostStep } from '../../src/locators.ts'; /** A chain-recording stand-in for a Playwright locator. */ diff --git a/packages/web/tests/unit/observation-capture.test.ts b/packages/web/tests/unit/observation-capture.test.ts index dc5829632e..58b0a37bfe 100644 --- a/packages/web/tests/unit/observation-capture.test.ts +++ b/packages/web/tests/unit/observation-capture.test.ts @@ -1,7 +1,7 @@ import { tmpdir } from 'node:os'; import type { Browser, Page } from 'playwright-core'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import type { OperationContext } from 'e2e/engine'; +import type { OperationContext } from '@e2e-dev/core/engine'; import type { RawObservedNode } from '../../src/read-node.ts'; import { PlaywrightSurface } from '../../src/surface.ts'; import { BrowserConnection } from '../../src/browser-connection.ts'; diff --git a/packages/web/tests/unit/provider-video.test.ts b/packages/web/tests/unit/provider-video.test.ts index 9c8bd47499..cd70468899 100644 --- a/packages/web/tests/unit/provider-video.test.ts +++ b/packages/web/tests/unit/provider-video.test.ts @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import type { Page } from 'playwright-core'; import { afterEach, describe, expect, it } from 'vitest'; -import type { ProviderRecording } from 'e2e/engine'; +import type { ProviderRecording } from '@e2e-dev/core/engine'; import { ProviderVideo } from '../../src/provider-video.ts'; import type { LeaseRecording } from '../../src/provider.ts'; diff --git a/packages/web/tests/unit/route-pattern.test.ts b/packages/web/tests/unit/route-pattern.test.ts index b871f44d23..ff74aefa9c 100644 --- a/packages/web/tests/unit/route-pattern.test.ts +++ b/packages/web/tests/unit/route-pattern.test.ts @@ -1,4 +1,4 @@ -import { toTextPattern } from 'e2e/engine'; +import { toTextPattern } from '@e2e-dev/core/engine'; import { describe, expect, it } from 'vitest'; import { compileRoutePattern, routePatternMatches, routePatternsEqual } from '../../src/route-pattern.ts'; diff --git a/packages/web/tests/unit/semantic-fallback.test.ts b/packages/web/tests/unit/semantic-fallback.test.ts index 478b0a5935..5429de1547 100644 --- a/packages/web/tests/unit/semantic-fallback.test.ts +++ b/packages/web/tests/unit/semantic-fallback.test.ts @@ -1,7 +1,7 @@ import { tmpdir } from 'node:os'; import { afterEach, describe, expect, it, vi } from 'vitest'; import type { Browser, JSHandle, Page } from 'playwright-core'; -import { EngineError, TestError, type OperationContext } from 'e2e/engine'; +import { EngineError, TestError, type OperationContext } from '@e2e-dev/core/engine'; import { ElementList } from '../../src/element-list.ts'; import { captureDocument, ROOT_NODE_ID } from '../../src/observation.ts'; import { PlaywrightSurface } from '../../src/surface.ts'; diff --git a/packages/web/tests/unit/surface-guard.test.ts b/packages/web/tests/unit/surface-guard.test.ts index b530630617..4e7ccd9fca 100644 --- a/packages/web/tests/unit/surface-guard.test.ts +++ b/packages/web/tests/unit/surface-guard.test.ts @@ -5,8 +5,8 @@ */ import { describe, expect, it } from 'vitest'; -import type { OperationContext } from 'e2e/engine'; -import { TestError } from 'e2e/engine'; +import type { OperationContext } from '@e2e-dev/core/engine'; +import { TestError } from '@e2e-dev/core/engine'; import { PlaywrightSurface } from '../../src/surface.ts'; function operation(signal = new AbortController().signal): OperationContext { diff --git a/packages/web/tests/unit/surface-lifecycle.test.ts b/packages/web/tests/unit/surface-lifecycle.test.ts index 60d6297d7e..ed4570df42 100644 --- a/packages/web/tests/unit/surface-lifecycle.test.ts +++ b/packages/web/tests/unit/surface-lifecycle.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import type { Browser, Dialog, Route } from 'playwright-core'; import { secrets } from 'e2e'; -import type { EngineFixtureContext, OperationContext } from 'e2e/engine'; +import type { EngineFixtureContext, OperationContext } from '@e2e-dev/core/engine'; import { afterEach, beforeEach, expect, it, vi } from 'vitest'; import { PlaywrightSurface } from '../../src/surface.ts'; import { createBrowserFixture } from '../../src/browser.ts'; diff --git a/packages/web/tests/unit/surface-of.test.ts b/packages/web/tests/unit/surface-of.test.ts index ffd24418a6..80a4a2e084 100644 --- a/packages/web/tests/unit/surface-of.test.ts +++ b/packages/web/tests/unit/surface-of.test.ts @@ -5,7 +5,7 @@ */ import { describe, expect, it } from 'vitest'; -import { EngineError, defineEngine } from 'e2e/engine'; +import { EngineError, defineEngine } from '@e2e-dev/core/engine'; import { web, surfaceOf } from '../../src/index.ts'; describe('surfaceOf', () => { diff --git a/packages/web/tests/unit/video.test.ts b/packages/web/tests/unit/video.test.ts index 58c4abbc7c..012d5c69c9 100644 --- a/packages/web/tests/unit/video.test.ts +++ b/packages/web/tests/unit/video.test.ts @@ -10,7 +10,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import type { Page } from 'playwright-core'; import { afterEach, describe, expect, it } from 'vitest'; -import { EngineError } from 'e2e/engine'; +import { EngineError } from '@e2e-dev/core/engine'; import { VideoRecorder } from '../../src/video.ts'; const VIEWPORT = { width: 320, height: 200 }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 548ddd02c8..c161c1ef13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -429,6 +429,31 @@ importers: specifier: 5.1.0 version: 5.1.0(@types/node@26.6.6)(vite@8.3.8(@types/node@26.6.6)(esbuild@0.28.2)(jiti@1.21.7)(terser@5.51.2)(tsx@4.23.14)(yaml@2.9.0)) + packages/core: + dependencies: + '@napi-rs/image': + specifier: 1.16.0 + version: 1.16.0 + pixelmatch: + specifier: 8.0.0 + version: 8.0.0 + zod: + specifier: 4.6.7 + version: 4.6.7 + devDependencies: + '@types/node': + specifier: 26.6.6 + version: 26.6.6 + ai: + specifier: 7.0.173 + version: 7.0.173(zod@4.6.7) + typescript: + specifier: 7.0.2 + version: 7.0.2 + vitest: + specifier: 5.1.0 + version: 5.1.0(@types/node@26.6.6)(vite@8.3.8(@types/node@26.6.6)(esbuild@0.28.2)(jiti@1.21.7)(terser@5.51.2)(tsx@4.23.14)(yaml@2.9.0)) + packages/decision: dependencies: '@napi-rs/image': @@ -505,15 +530,15 @@ importers: '@clack/prompts': specifier: 1.9.0 version: 1.9.0 + '@e2e-dev/core': + specifier: workspace:* + version: link:../core '@jridgewell/remapping': specifier: 2.3.5 version: 2.3.5 '@modelcontextprotocol/server': specifier: 2.4.0 version: 2.4.0 - '@napi-rs/image': - specifier: 1.16.0 - version: 1.16.0 '@oxc-project/runtime': specifier: 0.158.0 version: 0.158.0 @@ -535,9 +560,6 @@ importers: picocolors: specifier: 1.1.1 version: 1.1.1 - pixelmatch: - specifier: 8.0.0 - version: 8.0.0 toml-eslint-parser: specifier: 1.0.3 version: 1.0.3 @@ -566,6 +588,9 @@ importers: '@modelcontextprotocol/client': specifier: 2.4.0 version: 2.4.0 + '@napi-rs/image': + specifier: 1.16.0 + version: 1.16.0 '@openrouter/ai-sdk-provider': specifier: 3.1.0 version: 3.1.0(ai@7.0.173(zod@4.6.7))(zod@4.6.7) @@ -742,6 +767,9 @@ importers: specifier: 4.6.7 version: 4.6.7 devDependencies: + '@e2e-dev/core': + specifier: workspace:* + version: link:../core '@types/node': specifier: 26.6.6 version: 26.6.6 @@ -810,6 +838,9 @@ importers: specifier: 1.65.1 version: 1.65.1 devDependencies: + '@e2e-dev/core': + specifier: workspace:* + version: link:../core '@napi-rs/image': specifier: 1.16.0 version: 1.16.0 diff --git a/scripts/check-error-codes.ts b/scripts/check-error-codes.ts index 8ec92b0fc6..7e8a0f43d1 100644 --- a/scripts/check-error-codes.ts +++ b/scripts/check-error-codes.ts @@ -18,8 +18,8 @@ import { fileURLToPath } from 'node:url'; import { sourceRoots } from './error-codes.ts'; const ROOT = fileURLToPath(new URL('..', import.meta.url)); -const TYPES_FILE = 'packages/e2e/src/types.ts'; -const CONTRACT_FILE = 'packages/e2e/src/engine/contract.ts'; +const TYPES_FILE = 'packages/core/src/types.ts'; +const CONTRACT_FILE = 'packages/core/src/engine/contract.ts'; const ERRORS_PAGE = 'docs/reference/errors.mdx'; const ENGINE_PAGE = 'docs/reference/engine.mdx'; diff --git a/scripts/install-smoke.ts b/scripts/install-smoke.ts index 8bcc083249..d8f90d5eab 100644 --- a/scripts/install-smoke.ts +++ b/scripts/install-smoke.ts @@ -3,7 +3,10 @@ * `@e2e-dev/web`, and `@e2e-dev/mobile`, installs them with a given pnpm * into a fresh project outside this repository, installs again from the * lockfile, typechecks a custom mobile tool, and runs a TypeScript test - * through the installed CLI. + * through the installed CLI. `@e2e-dev/core` is packed too and reaches the + * project only through `e2e`'s dependency and the engines' peer, as it does + * for a user, and the install must hold one copy of it: two would split the + * error classes and the engine registry between the runner and the engines. * * pnpm 11 and later fail an install on any dependency build script the * project has not decided on (`ERR_PNPM_IGNORED_BUILDS`), and write a @@ -28,8 +31,8 @@ if (pnpmVersion === undefined) { process.exit(2); } -/** The packages a new user installs: the runner and its engines. */ -const PACKAGES = ['e2e', 'web', 'mobile'] as const; +/** The packages a new user installs: the runner and its engines, and the core both build on. */ +const PACKAGES = ['core', 'e2e', 'web', 'mobile'] as const; const root = mkdtempSync(join(tmpdir(), 'e2e-install-smoke-')); const tarballs = join(root, 'tarballs'); @@ -53,8 +56,7 @@ const mobileManifest = JSON.parse(readFileSync(join(REPO_ROOT, 'packages/mobile/ devDependencies: Record; }; const problems: string[] = []; -const driverWorkspace = driverVersion ? `overrides:\n agent-device: ${JSON.stringify(driverVersion)}\n` : undefined; -if (driverWorkspace) writeFileSync(join(project, 'pnpm-workspace.yaml'), driverWorkspace); +let workspaceYaml: string | undefined; try { for (const name of PACKAGES) { const packed = run(join(REPO_ROOT, 'packages', name), 'pnpm', ['pack', '--pack-destination', tarballs]); @@ -62,6 +64,9 @@ try { } const files = readdirSync(tarballs); const tarball = (prefix: string): string => `file:${join(tarballs, files.find((file) => file.startsWith(prefix))!)}`; + // `e2e` names its exact `@e2e-dev/core`, which the registry has not published yet: the override serves the tarball. + workspaceYaml = `overrides:\n '@e2e-dev/core': ${JSON.stringify(tarball('e2e-dev-core-'))}\n${driverVersion ? ` agent-device: ${JSON.stringify(driverVersion)}\n` : ''}`; + writeFileSync(join(project, 'pnpm-workspace.yaml'), workspaceYaml); writeFileSync( join(project, 'package.json'), JSON.stringify({ @@ -130,10 +135,14 @@ export async function checkFixture(device: Device) { process.stdout.write(`$ ${step}: exit ${status}\n`); if (status !== 0) problems.push(`${step} exited ${status}:\n${output}`); if (output.includes('ERR_PNPM_IGNORED_BUILDS')) problems.push(`${step} reported ERR_PNPM_IGNORED_BUILDS:\n${output}`); - if (existsSync(join(project, 'pnpm-workspace.yaml')) && readFileSync(join(project, 'pnpm-workspace.yaml'), 'utf8') !== driverWorkspace) { + if (existsSync(join(project, 'pnpm-workspace.yaml')) && readFileSync(join(project, 'pnpm-workspace.yaml'), 'utf8') !== workspaceYaml) { problems.push(`${step} wrote or changed pnpm-workspace.yaml`); } if (problems.length > 0) break; + if (args[0] === 'install') { + const copies = readdirSync(join(project, 'node_modules', '.pnpm')).filter((dir) => dir.startsWith('@e2e-dev+core@')); + if (copies.length !== 1) problems.push(`${step} installed ${copies.length} copies of @e2e-dev/core: ${copies.join(', ')}`); + } if (driverVersion && args[0] === 'install') { const graph = pnpm(['list', 'agent-device', '--depth', 'Infinity', '--json']); const versions: string[] = []; From d387981f56e59972d9ab801fbf33282410f3a8d5 Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Fri, 13 Nov 2026 14:05:25 +0900 Subject: [PATCH 2/4] ci: build and pack @e2e-dev/core where e2e is built or packed alone The Bun job built e2e before the @e2e-dev/core it compiles against, and the examples nightly installs e2e from a tarball whose exact @e2e-dev/core is not on npm; it now packs @e2e-dev/core and overrides it in each example. Co-Authored-By: Claude Opus 5.5 --- .github/actions/example-packages/action.yml | 4 +++- .github/filters.yml | 1 + .github/workflows/examples.yml | 1 + .github/workflows/spec.yml | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/example-packages/action.yml b/.github/actions/example-packages/action.yml index e15276a85e..29fd299bfd 100644 --- a/.github/actions/example-packages/action.yml +++ b/.github/actions/example-packages/action.yml @@ -3,7 +3,8 @@ description: >- Installs an example's dependencies with e2e, @e2e-dev/web, and @e2e-dev/mobile swapped for the tarballs the examples workflow packed from main, so the example runs this checkout's packages instead of the npm - releases its package.json names. + releases its package.json names. @e2e-dev/core, which they all build on, comes + from its tarball through an override, since e2e names its exact snapshot. inputs: agent-device-version: @@ -45,6 +46,7 @@ runs: console.log(`${name}: ${manifest[field][name]}`); } } + manifest.overrides = { ...manifest.overrides, "@e2e-dev/core": `file:${process.env.PACKED}/core.tgz` }; fs.writeFileSync("package.json", `${JSON.stringify(manifest, null, 2)}\n`); ' if [ -n "$AGENT_DEVICE_VERSION" ]; then diff --git a/.github/filters.yml b/.github/filters.yml index 7eb226de7b..31bfdc184e 100644 --- a/.github/filters.yml +++ b/.github/filters.yml @@ -13,6 +13,7 @@ runner: &runner - '.github/actions/workspace-install/**' - '.github/scripts/agent-device.cjs' - 'packages/e2e/**' + - 'packages/core/**' - '!packages/*/tests/**' - '!**/*.md' - 'package.json' diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 760a0dbcd8..7039e68018 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -90,6 +90,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Pack run: | + pnpm --filter @e2e-dev/core pack --out "$RUNNER_TEMP/packed/core.tgz" pnpm --filter e2e pack --out "$RUNNER_TEMP/packed/e2e.tgz" pnpm --filter @e2e-dev/web pack --out "$RUNNER_TEMP/packed/web.tgz" pnpm --filter @e2e-dev/mobile pack --out "$RUNNER_TEMP/packed/mobile.tgz" diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index b6285d43ef..ebda7af760 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -144,7 +144,7 @@ jobs: - uses: ./.github/actions/workspace-install with: agent-device-version: ${{ inputs.agent-device-version }} - - run: pnpm --filter e2e run build + - run: pnpm --filter @e2e-dev/core run build && pnpm --filter e2e run build - name: The CLI on Bun ${{ matrix.bun }} run: pnpm --filter e2e exec vitest run tests/integration/bun-runtime.test.ts env: From abef87704eaeda1661cc225fd3fa1a2092bc7b4e Mon Sep 17 00:00:00 2001 From: DongYun Kang Date: Fri, 13 Nov 2026 16:05:41 +0900 Subject: [PATCH 3/4] docs(engines): name @e2e-dev/core/engine as the contract's source Co-Authored-By: Claude Opus 5.5 --- packages/mobile/README.md | 2 +- packages/mobile/src/engine.ts | 2 +- packages/mobile/src/provider.ts | 2 +- packages/web/src/engine.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/mobile/README.md b/packages/mobile/README.md index fcd92baa7b..9e9ebbdc83 100644 --- a/packages/mobile/README.md +++ b/packages/mobile/README.md @@ -4,7 +4,7 @@ The mobile engine for [`e2e`](https://www.npmjs.com/package/e2e), built on [agent-device](https://github.com/callstack/agent-device): iOS simulators, Android emulators, and connected phones through the same `@e2e-dev/core/engine` contract the browser engine implements. A test written against `screen`, `expect`, `app`, and `agent` runs -on a device target unchanged; nothing in `e2e` or `@e2e-dev/core` knows this package exists. +on a device target unchanged; neither `e2e` nor `@e2e-dev/core` imports this package. ## Install diff --git a/packages/mobile/src/engine.ts b/packages/mobile/src/engine.ts index ab3f46c3c7..b6404b1ac9 100644 --- a/packages/mobile/src/engine.ts +++ b/packages/mobile/src/engine.ts @@ -2,7 +2,7 @@ * The agent-device engine for e2e: a mobile body built with the * public `defineEngine`, validated by the same rules and graded by the same * capabilities as any other engine. Core imports nothing from here; this - * package imports the contract from `e2e/engine` and contributes the + * package imports the contract from `@e2e-dev/core/engine` and contributes the * `device` fixture the way the browser engine contributes `browser`. */ diff --git a/packages/mobile/src/provider.ts b/packages/mobile/src/provider.ts index a9d7e5d7cb..fa46237f27 100644 --- a/packages/mobile/src/provider.ts +++ b/packages/mobile/src/provider.ts @@ -136,7 +136,7 @@ export interface DeviceProvider { * records with agent-device. `lease` is the lease as it traveled to the * worker: its `id` and the other fields declared on `DeviceLease`, never * what else the provider kept on the object `acquire` returned. - * `ProviderRecording` comes from `e2e/engine`: its `stop` writes a file + * `ProviderRecording` comes from `@e2e-dev/core/engine`: its `stop` writes a file * into the directory it is given, or names a recording the service keeps * by URL. */ diff --git a/packages/web/src/engine.ts b/packages/web/src/engine.ts index 66e7d152a7..e087f35a4c 100644 --- a/packages/web/src/engine.ts +++ b/packages/web/src/engine.ts @@ -2,7 +2,7 @@ * The Playwright engine for e2e: a browser body built with the * public `defineEngine`, validated by the same rules and graded by the same * capabilities as any other engine. Core imports nothing from here; this - * package imports the contract from `e2e/engine` and contributes the `browser` + * package imports the contract from `@e2e-dev/core/engine` and contributes the `browser` * fixture the way a device engine contributes `device`. */ From e8dd1627a991c03d1a57ec36130b24be7ff2de28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Sun, 15 Nov 2026 19:18:13 +0100 Subject: [PATCH 4/4] fix(e2e): list @e2e-dev/core beside an engine in init and upgrade Engines peer on @e2e-dev/core. Yarn installs no peer the project does not list, and under Plug'n'Play the engine then fails to load. - init adds @e2e-dev/core with any engine - upgrade adds a required @e2e-dev peer the project lacks, and keeps a package e2e depends on at the version e2e names --- .changeset/e2e-core-package.md | 2 +- AGENTS.md | 2 +- docs/reference/cli.mdx | 4 + .../e2e/scripts/write-sibling-versions.ts | 5 +- packages/e2e/src/cli/init/scaffold.ts | 4 +- packages/e2e/src/cli/upgrade.ts | 73 ++++++++++++++++-- .../e2e/tests/integration/cli-init.test.ts | 6 +- packages/e2e/tests/unit/cli-init.test.ts | 11 +-- packages/e2e/tests/unit/cli-upgrade.test.ts | 74 ++++++++++++++++--- 9 files changed, 153 insertions(+), 28 deletions(-) diff --git a/.changeset/e2e-core-package.md b/.changeset/e2e-core-package.md index fcb3bd1238..599d298b3a 100644 --- a/.changeset/e2e-core-package.md +++ b/.changeset/e2e-core-package.md @@ -5,4 +5,4 @@ '@e2e-dev/mobile': patch --- -New package `@e2e-dev/core`: the engine contract, locators, agent, replay cache, and engine sessions that `e2e` is built on. `e2e` depends on it at the same version, and `e2e/engine` and `e2e/agent` re-export it unchanged. `@e2e-dev/web` and `@e2e-dev/mobile` peer on `@e2e-dev/core` beside `e2e`, and import the contract from `@e2e-dev/core/engine`, which a third-party engine can now import too. +New package `@e2e-dev/core`: the engine contract, locators, agent, replay cache, and engine sessions that `e2e` is built on. `e2e` depends on it at the same version, and `e2e/engine` and `e2e/agent` re-export it unchanged. `@e2e-dev/web` and `@e2e-dev/mobile` peer on `@e2e-dev/core` beside `e2e`, and import the contract from `@e2e-dev/core/engine`, which a third-party engine can now import too. npm, pnpm and Bun install the new peer themselves. A Yarn project lists `@e2e-dev/core` beside the engine; `e2e init` and `e2e upgrade` add it. diff --git a/AGENTS.md b/AGENTS.md index 7c0ada0b45..e1d50d8519 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -116,7 +116,7 @@ suites that consume the built packages the way a user would. device-cloud providers (`testmu`, `browserstack`) share: one daemon per slot, heartbeat, and a release that fails unless the session end is confirmed. -- `packages/e2e/src/engine/protocol/` - the engine protocol: the engine +- `packages/core/src/engine/protocol/` - the engine protocol: the engine contract as LSP-style JSON-RPC (`connectEngine` client, `serveEngine` server, spawn/socket/loopback transports), so an engine can run in another process, machine, or language. The harness holds only protocol diff --git a/docs/reference/cli.mdx b/docs/reference/cli.mdx index b0296b3dde..2dae31d5c9 100644 --- a/docs/reference/cli.mdx +++ b/docs/reference/cli.mdx @@ -1146,6 +1146,10 @@ Updated the agent skill in .agents/skills/e2e/ (12 files) does. When none does, the command exits 2. A deprecated release is never picked, and a prerelease only when `e2e` gets one. An integration follows the engine it plugs into. +- **An added peer.** An `@e2e-dev/*` package those releases peer on, such as + `@e2e-dev/core` for an engine, is added beside the package that needs it + when `package.json` doesn't list it. Yarn installs no peer the project + doesn't list. It gets the version the new `e2e` depends on. - **The package manager.** The one the project's lockfile or `packageManager` field names, or pnpm at a pnpm workspace root. A workspace member with neither uses its workspace root's. A lockfile above diff --git a/packages/e2e/scripts/write-sibling-versions.ts b/packages/e2e/scripts/write-sibling-versions.ts index 939d717bc9..eb03d0725f 100644 --- a/packages/e2e/scripts/write-sibling-versions.ts +++ b/packages/e2e/scripts/write-sibling-versions.ts @@ -1,6 +1,6 @@ /** - * Records the engine versions `e2e init` installs, read from - * the sibling packages' manifests at build time. + * Records the engine versions `e2e init` installs, and the `@e2e-dev/core` + * they peer on, read from the sibling packages' manifests at build time. * * Usage: `node scripts/write-sibling-versions.ts`, from the package directory, * after `tsc` emitted `dist`. @@ -13,6 +13,7 @@ type Manifest = { version: string }; const read = (dir: string) => JSON.parse(readFileSync(`../${dir}/package.json`, 'utf8')) as Manifest; const versions = { + '@e2e-dev/core': read('core').version, '@e2e-dev/web': read('web').version, '@e2e-dev/mobile': read('mobile').version, }; diff --git a/packages/e2e/src/cli/init/scaffold.ts b/packages/e2e/src/cli/init/scaffold.ts index 38cf6423ed..9e9ea0ac6e 100644 --- a/packages/e2e/src/cli/init/scaffold.ts +++ b/packages/e2e/src/cli/init/scaffold.ts @@ -1,6 +1,6 @@ import { packageVersion } from '@e2e-dev/core/lib/internal/package-version'; import { getEnginePreset, type EngineId, type EnginePreset } from './engines.ts'; -import { dependencyRange } from './versions.ts'; +import { dependencyRange, siblingDependency } from './versions.ts'; import { getGatewayPreset, type GatewayId } from './gateways.ts'; /** The model choice `init` writes: which gateway, and for an OpenAI-compatible one, where. */ @@ -108,6 +108,8 @@ export function createScaffold(engineIds: readonly EngineId[], model: ScaffoldMo dependencies: { 'e2e': dependencyRange(packageVersion(import.meta.url, '../../../package.json', '0.0.0')), ...Object.fromEntries(engines.flatMap((engine) => Object.entries(engine.dependencies))), + // Every engine peers on `@e2e-dev/core`; npm and pnpm install peers, Yarn does not, and Plug'n'Play then cannot load the engine. + ...(engines.length === 0 ? {} : siblingDependency('@e2e-dev/core')), // zod is a peer of `ai` and every provider; npm and pnpm install peers, Yarn does not. ...(gateway === undefined ? {} : { ai: '^7.0.0', zod: '^4.1.8', ...gateway.dependencies }), }, diff --git a/packages/e2e/src/cli/upgrade.ts b/packages/e2e/src/cli/upgrade.ts index c6b4722af6..5d73275c03 100644 --- a/packages/e2e/src/cli/upgrade.ts +++ b/packages/e2e/src/cli/upgrade.ts @@ -2,9 +2,11 @@ * `e2e upgrade` (alias `update`): moves the project's `e2e` to the latest * release, a dist-tag, or one version, and every `@e2e-dev/*` package the * project declares along with it, each to the newest release whose peer - * ranges accept the new versions. The new specs go into package.json, each - * in the section it was in, and one install with the project's package - * manager resolves them, so its lockfile and its workspace stay its own. + * ranges accept the new versions. An `@e2e-dev/*` package those releases peer + * on and the project does not declare is added beside the one that needs it. + * The new specs go into package.json, each in the section it was in, and one + * install with the project's package manager resolves them, so its lockfile + * and its workspace stay its own. */ import { spawnSync } from 'node:child_process'; @@ -55,7 +57,9 @@ const packumentSchema = z.looseObject({ versions: z.record( z.string(), z.looseObject({ + dependencies: z.record(z.string(), z.string()).optional(), peerDependencies: z.record(z.string(), z.string()).optional(), + peerDependenciesMeta: z.record(z.string(), z.looseObject({ optional: z.boolean().optional() })).optional(), deprecated: z.string().optional(), }), ), @@ -76,6 +80,8 @@ interface Planned extends Declared { readonly version: string; /** The spec written to package.json: the version, with the range operator the old spec had. */ readonly request: string; + /** The declared package whose peer this is, for one the project did not declare and the upgrade adds. */ + readonly peerOf?: string; } /** A failure that ends the command: what to print, how telemetry names it, and the exit code. */ @@ -147,10 +153,12 @@ async function upgradeOrThrow(options: UpgradeOptions, facts: UpgradeFacts): Pro const target = resolveRunner(options.target, packuments.get(RUNNER)); facts.toVersion = target; const versions = resolveSiblings(options.target, target, declared, packuments, (name) => out(picocolors.dim(`Skipping ${name}: the registry has no such package`))); - const plan = declared.flatMap((entry): Planned[] => { + const listed = declared.flatMap((entry): Planned[] => { const version = versions.get(entry.name); return version === undefined ? [] : [{ ...entry, version, request: requestFor(entry.spec, version, options.target) }]; }); + const known = new Set([...declared, ...linked].map((entry) => entry.name)); + const plan = [...listed, ...(await undeclaredPeers(options.target, listed, known, packuments, (name) => fetchPackument(registry, name, fetchImpl)))]; facts.siblings = plan.filter((entry) => entry.name !== RUNNER).map((entry) => entry.name); const { manager, root } = detectWorkspacePackageManager(project.dir, env); @@ -338,7 +346,8 @@ function resolveSiblings( // Peers that wait on each other: resolve them against what is chosen so far. const batch = ready.length > 0 ? ready : pending; for (const entry of batch) { - chosen.set(entry.name, pickSibling(entry.name, packuments.get(entry.name)!, target, chosen, allowPrerelease)); + const packument = packuments.get(entry.name)!; + chosen.set(entry.name, runnerPin(entry.name, packument, packuments.get(RUNNER), runner) ?? pickSibling(entry.name, packument, target, chosen, allowPrerelease)); } pending = pending.filter((entry) => !batch.includes(entry)); } @@ -352,6 +361,52 @@ function resolveSiblings( return chosen; } +/** + * The version of a sibling the runner release itself depends on, when it + * names one release: the project then installs that one, and one copy serves + * the runner and whatever peers on it. + */ +function runnerPin(name: string, packument: Packument, runnerPackument: Packument | undefined, runner: string): string | undefined { + const pinned = runnerPackument?.versions[runner]?.dependencies?.[name]; + return pinned !== undefined && packument.versions[pinned] !== undefined ? pinned : undefined; +} + +/** + * The `@e2e-dev/*` packages the planned releases peer on that the project + * does not declare, each in the section of the first package that needs it. + * npm and pnpm install a missing peer themselves; Yarn does not, and under + * Plug'n'Play the package that peers on it then fails to load. + */ +async function undeclaredPeers( + target: UpgradeTarget, + plan: readonly Planned[], + known: Set, + packuments: ReadonlyMap, + fetchPeer: (name: string) => Promise, +): Promise { + const chosen = new Map(plan.map((entry) => [entry.name, entry.version])); + const runner = chosen.get(RUNNER)!; + const allowPrerelease = (parseVersion(runner)?.prerelease.length ?? 0) > 0; + const added: Planned[] = []; + for (const entry of plan) { + const manifest = packuments.get(entry.name)?.versions[entry.version]; + for (const [peer, range] of Object.entries(manifest?.peerDependencies ?? {})) { + if (!peer.startsWith(SCOPE) || known.has(peer) || manifest?.peerDependenciesMeta?.[peer]?.optional === true) continue; + known.add(peer); + const packument = await fetchPeer(peer); + if (packument === undefined) continue; + const version = runnerPin(peer, packument, packuments.get(RUNNER), runner) ?? pickSibling(peer, packument, target, chosen, allowPrerelease); + const parsed = parseVersion(version); + if (parsed === undefined || !satisfies(parsed, range)) { + throw new UpgradeError(`no ${peer} release fits the rest of the upgrade: ${entry.name} ${entry.version} needs ${peer} ${range}, and the upgrade picks ${peer} ${version}`, 'incompatible', 2); + } + chosen.set(peer, version); + added.push({ name: peer, section: entry.section, spec: '', installed: undefined, version, request: requestFor('', version, target), peerOf: entry.name }); + } + } + return added; +} + /** The first peer range of `manifest` that a version in `chosen` misses; peers outside the plan are not checked. */ function unmetPeer( manifest: Packument['versions'][string] | undefined, @@ -418,6 +473,7 @@ function moves(entry: Planned): boolean { } function describeChange(entry: Planned): string { + if (entry.peerOf !== undefined) return `${picocolors.bold(entry.version)} ${picocolors.dim(`(added: ${entry.peerOf} peers on it)`)}`; const from = entry.installed ?? entry.spec; if (!moves(entry)) return `${entry.version} ${picocolors.dim('(up to date)')}`; const before = entry.installed === undefined ? undefined : parseVersion(entry.installed); @@ -429,13 +485,16 @@ function describeChange(entry: Planned): string { /** * The manifest with each moving package's spec set to its request in every * section that lists it: a package in both `dependencies` and - * `optionalDependencies` is installed from the one its manager prefers. + * `optionalDependencies` is installed from the one its manager prefers. An + * added peer goes into the section of the package that needs it. */ function withRequests(manifest: Manifest, entries: readonly Planned[]): Manifest { const sections = SECTIONS.flatMap((section) => { const block = manifest[section]; if (block === undefined) return []; - const moved = entries.filter((entry) => block[entry.name] !== undefined).map((entry) => [entry.name, entry.request] as const); + const moved = entries + .filter((entry) => (entry.peerOf === undefined ? block[entry.name] !== undefined : entry.section === section)) + .map((entry) => [entry.name, entry.request] as const); return [[section, { ...block, ...Object.fromEntries(moved) }] as const]; }); return { ...manifest, ...Object.fromEntries(sections) }; diff --git a/packages/e2e/tests/integration/cli-init.test.ts b/packages/e2e/tests/integration/cli-init.test.ts index 2ecfa3e9a4..5960b1e986 100644 --- a/packages/e2e/tests/integration/cli-init.test.ts +++ b/packages/e2e/tests/integration/cli-init.test.ts @@ -134,6 +134,7 @@ describe('initializing standalone projects', () => { const collection = await collect(config); expect(scaffold.dependencies).not.toHaveProperty('@e2e-dev/web'); + expect(scaffold.dependencies).not.toHaveProperty('@e2e-dev/core'); expect(scaffold.dependencies).toMatchObject({ ai: '^7.0.0', '@openrouter/ai-sdk-provider': '^3.0.0' }); expect(config.agent.model).toMatchObject({ provider: expect.stringMatching(/^openrouter/), id: 'openai/gpt-6-luna-fast' }); expect(config.targets[0]!.app.base).toBeUndefined(); @@ -221,8 +222,11 @@ describe('initializing standalone projects', () => { const manifest = JSON.parse(readFileSync(path.join(dir, 'package.json'), 'utf8')); const webVersion = (JSON.parse(readFileSync(path.resolve(PACKAGE_ROOT, '..', 'web', 'package.json'), 'utf8')) as { version: string }).version; expect(manifest.devDependencies['@e2e-dev/web']).toBe(dependencyRange(webVersion)); + // The engine peers on core, and Yarn installs no peer the project does not list. + const coreVersion = (JSON.parse(readFileSync(path.resolve(PACKAGE_ROOT, '..', 'core', 'package.json'), 'utf8')) as { version: string }).version; + expect(manifest.devDependencies['@e2e-dev/core']).toBe(dependencyRange(coreVersion)); const recorded = JSON.parse(readFileSync(path.join(PACKAGE_ROOT, 'dist', 'cli', 'init', 'sibling-versions.json'), 'utf8')) as Record; - expect(Object.keys(recorded).toSorted()).toEqual(['@e2e-dev/mobile', '@e2e-dev/web']); + expect(Object.keys(recorded).toSorted()).toEqual(['@e2e-dev/core', '@e2e-dev/mobile', '@e2e-dev/web']); expect(manifest.devDependencies).not.toHaveProperty('playwright'); expect(manifest.devDependencies.ai).toBe('^7.0.0'); expect(manifest.scripts).toEqual({ 'test:e2e': 'e2e run' }); diff --git a/packages/e2e/tests/unit/cli-init.test.ts b/packages/e2e/tests/unit/cli-init.test.ts index 925826d6b4..14b5f9c6a9 100644 --- a/packages/e2e/tests/unit/cli-init.test.ts +++ b/packages/e2e/tests/unit/cli-init.test.ts @@ -100,7 +100,7 @@ describe('e2e init', () => { expect(JSON.parse(read('package.json'))).toEqual({ private: true, type: 'module', - devDependencies: { 'e2e': dependencyRange(runnerVersion), '@e2e-dev/web': '0.x', ai: '^7.0.0', zod: '^4.1.8' }, + devDependencies: { 'e2e': dependencyRange(runnerVersion), '@e2e-dev/web': '0.x', '@e2e-dev/core': '0.x', ai: '^7.0.0', zod: '^4.1.8' }, scripts: { 'test:e2e': 'e2e run' }, }); expect(read('e2e.config.ts')).toContain('agents: {\n default: {\n model: '); @@ -223,6 +223,7 @@ describe('e2e init', () => { 'e2e', ...(engine === 'web' ? ['@e2e-dev/web'] : []), ...(device ? ['@e2e-dev/mobile'] : []), + ...(engine === 'web' || device ? ['@e2e-dev/core'] : []), ...(ai ? ['ai', 'zod', '@openrouter/ai-sdk-provider'] : []), ]); expect(manifest.devDependencies.ai).toBe(ai ? '^7.0.0' : undefined); @@ -273,7 +274,7 @@ describe('e2e init', () => { vi.mocked(clack.confirm).mockResolvedValueOnce(true).mockResolvedValueOnce(false); expect(await init(dir)).toMatchObject({ exitCode: 0, engine: 'web,mobile' }); - expect(Object.keys(JSON.parse(read('package.json')).devDependencies)).toEqual(['e2e', '@e2e-dev/web', '@e2e-dev/mobile', 'ai', 'zod']); + expect(Object.keys(JSON.parse(read('package.json')).devDependencies)).toEqual(['e2e', '@e2e-dev/web', '@e2e-dev/mobile', '@e2e-dev/core', 'ai', 'zod']); expect(read('e2e.config.ts')).toContain("import { web } from '@e2e-dev/web';\nimport { mobile } from '@e2e-dev/mobile';\n"); expect(read('e2e.config.ts')).toContain(` targets: [ { @@ -578,7 +579,7 @@ describe('e2e init', () => { async (type) => { const manifest = `${JSON.stringify({ name: 'existing-app', type, scripts: { 'test:e2e': 'e2e run --workers 1' }, - dependencies: { 'e2e': 'workspace:*', '@e2e-dev/web': 'workspace:*', ai: '^7.0.12', zod: '^4.0.0' }, + dependencies: { 'e2e': 'workspace:*', '@e2e-dev/web': 'workspace:*', '@e2e-dev/core': 'workspace:*', ai: '^7.0.12', zod: '^4.0.0' }, }, null, 4)}\n`; writeFileSync(path.join(dir, 'package.json'), manifest); for (let run = 0; run < 2; run += 1) { @@ -618,12 +619,12 @@ describe('e2e init', () => { expect(JSON.parse(read('package.json'))).toEqual({ ...manifest, scripts: { dev: 'vite', 'test:e2e': 'e2e run' }, - devDependencies: { ...manifest.devDependencies, 'e2e': expect.any(String), zod: '^4.1.8' }, + devDependencies: { ...manifest.devDependencies, 'e2e': expect.any(String), '@e2e-dev/core': '0.x', zod: '^4.1.8' }, }); expect(read('package.json')).toContain('\r\n "name"'); const written = JSON.parse(read('package.json')); expect(Object.keys(written)).toEqual(Object.keys(manifest)); - expect(Object.keys(written.devDependencies)).toEqual(['@e2e-dev/web', 'e2e', 'vite', 'zod']); + expect(Object.keys(written.devDependencies)).toEqual(['@e2e-dev/core', '@e2e-dev/web', 'e2e', 'vite', 'zod']); expect(Object.keys(written.scripts)).toEqual(['dev', 'test:e2e']); }); diff --git a/packages/e2e/tests/unit/cli-upgrade.test.ts b/packages/e2e/tests/unit/cli-upgrade.test.ts index c54e4a7646..582f8988cd 100644 --- a/packages/e2e/tests/unit/cli-upgrade.test.ts +++ b/packages/e2e/tests/unit/cli-upgrade.test.ts @@ -6,22 +6,36 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { upgrade, type UpgradeOptions } from '../../src/cli/upgrade.ts'; import { parseUpgradeTarget, type UpgradeTarget } from '../../src/cli/upgrade-target.ts'; -type Releases = Record | { peers: Record; deprecated: string }>; +/** One release: its peer ranges, or those with what else the registry lists for it. */ +type Release = Record | { peers: Record; deprecated?: string; dependencies?: Record; optionalPeers?: readonly string[] }; +type Releases = Record; /** A registry of `e2e` and a few siblings, each version with its peer ranges. */ const REGISTRY: Record; versions: Releases }> = { e2e: { - tags: { latest: '0.21.2', nightly: '0.21.3-nightly-20261019081103' }, - versions: { '0.15.0': {}, '0.18.0': {}, '0.20.0': {}, '0.21.2': {}, '0.21.3-nightly-20261019081103': {} }, + tags: { latest: '0.21.2', nightly: '0.21.3-nightly-20261019081103', next: '0.23.2' }, + versions: { + '0.15.0': {}, + '0.18.0': {}, + '0.20.0': {}, + '0.21.2': {}, + '0.21.3-nightly-20261019081103': {}, + '0.23.2': { peers: {}, dependencies: { '@e2e-dev/core': '0.23.2' } }, + }, + }, + '@e2e-dev/core': { + tags: { latest: '0.24.0', next: '0.24.0' }, + versions: { '0.23.2': {}, '0.24.0': {} }, }, '@e2e-dev/web': { - tags: { latest: '0.15.2', nightly: '0.15.3-nightly-20261019081103' }, + tags: { latest: '0.15.2', nightly: '0.15.3-nightly-20261019081103', next: '0.17.0' }, versions: { '0.12.0': { e2e: '>=0.15.0 <1' }, '0.14.0': { e2e: '>=0.18.0 <1' }, '0.15.1': { peers: { e2e: '>=0.18.0 <1' }, deprecated: 'broken' }, '0.15.2': { e2e: '>=0.18.0 <1' }, '0.15.3-nightly-20261019081103': { e2e: '0.21.3-nightly-20261019081103' }, + '0.17.0': { peers: { e2e: '>=0.23.2 <1', '@e2e-dev/core': '>=0.23.2 <1', '@e2e-dev/decision': '>=0.1.0 <1' }, optionalPeers: ['@e2e-dev/decision'] }, }, }, '@e2e-dev/kernel': { @@ -43,6 +57,21 @@ function written(spy: ReturnType): string { return stripVTControlCharacters(spy.mock.calls.map((call: readonly unknown[]) => String(call[0])).join('')); } +/** The fields the registry lists for one release. */ +function manifestOf(release: Release): Record { + if (!isDetailed(release)) return { peerDependencies: release }; + return { + peerDependencies: release.peers, + ...(release.deprecated === undefined ? {} : { deprecated: release.deprecated }), + ...(release.dependencies === undefined ? {} : { dependencies: release.dependencies }), + ...(release.optionalPeers === undefined ? {} : { peerDependenciesMeta: Object.fromEntries(release.optionalPeers.map((name) => [name, { optional: true }])) }), + }; +} + +function isDetailed(release: Release): release is Exclude> { + return typeof release['peers'] === 'object'; +} + /** Writes `package.json` into the project, and `node_modules/` for each installed version. */ function project(manifest: Record, installed: Record = {}, at = dir): void { mkdirSync(at, { recursive: true }); @@ -80,11 +109,7 @@ beforeEach(() => { const entry = REGISTRY[name]; if (entry === undefined) return new Response('{"error":"Not found"}', { status: 404 }); const versions = Object.fromEntries( - Object.entries(entry.versions).map(([version, release]) => - 'deprecated' in release - ? [version, { version, peerDependencies: release.peers, deprecated: release.deprecated }] - : [version, { version, peerDependencies: release }], - ), + Object.entries(entry.versions).map(([version, release]) => [version, { version, ...manifestOf(release) }]), ); return Response.json({ name, 'dist-tags': entry.tags, versions }); }); @@ -242,7 +267,7 @@ describe('e2e upgrade', () => { it.each([ [{ kind: 'version', version: '9.9.9' }, 'e2e 9.9.9 was never published; the latest release is 0.21.2'], - [{ kind: 'tag', tag: 'beta' }, 'e2e has no "beta" release; its dist-tags are latest, nightly'], + [{ kind: 'tag', tag: 'beta' }, 'e2e has no "beta" release; its dist-tags are latest, nightly, next'], ] as const)('exits 2 for %j', async (target, message) => { project({ devDependencies: { e2e: '^0.20.0' } }); expect((await run(target)).exitCode).toBe(2); @@ -376,6 +401,35 @@ describe('e2e upgrade', () => { expect(written(stderrSpy)).toBe('e2e upgrade: no @e2e-dev/left release fits the rest of the upgrade: @e2e-dev/left 1.0.0 needs @e2e-dev/right >=2.0.0 <3, and the upgrade picks @e2e-dev/right 1.0.0\n'); }); + it('adds a required @e2e-dev peer the project does not declare, at the version e2e itself depends on', async () => { + project({ dependencies: { '@e2e-dev/web': '^0.15.2' }, devDependencies: { e2e: '^0.21.2' } }, { e2e: '0.21.2', '@e2e-dev/web': '0.15.2' }); + expect(await run({ kind: 'tag', tag: 'next' })).toMatchObject({ exitCode: 0, result: 'upgraded', siblings: ['@e2e-dev/web', '@e2e-dev/core'], moved: 3 }); + // Beside the engine that peers on it; the optional peer is left to the project. + expect(sections()).toEqual({ + dependencies: { '@e2e-dev/web': '^0.17.0', '@e2e-dev/core': '^0.23.2' }, + devDependencies: { e2e: '^0.23.2' }, + optionalDependencies: undefined, + }); + expect(written(stdoutSpy)).toContain('@e2e-dev/core 0.23.2 (added: @e2e-dev/web peers on it)'); + expect(commands()).toEqual(['npm install']); + }); + + it('adds a missing peer when everything else is already at the target', async () => { + project({ devDependencies: { e2e: '0.23.2', '@e2e-dev/web': '0.17.0' } }, { e2e: '0.23.2', '@e2e-dev/web': '0.17.0' }); + expect(await run({ kind: 'tag', tag: 'next' })).toMatchObject({ result: 'upgraded', moved: 1 }); + expect(sections()['devDependencies']).toEqual({ e2e: '0.23.2', '@e2e-dev/web': '0.17.0', '@e2e-dev/core': '^0.23.2' }); + }); + + it('keeps a declared package e2e depends on at the version e2e names, whatever its newest release', async () => { + project( + { devDependencies: { e2e: '^0.21.2', '@e2e-dev/web': '^0.15.2', '@e2e-dev/core': '^0.24.0' } }, + { e2e: '0.21.2', '@e2e-dev/web': '0.15.2', '@e2e-dev/core': '0.24.0' }, + ); + expect((await run({ kind: 'tag', tag: 'next' })).result).toBe('upgraded'); + expect(sections()['devDependencies']).toEqual({ e2e: '^0.23.2', '@e2e-dev/web': '^0.17.0', '@e2e-dev/core': '^0.23.2' }); + expect(written(stdoutSpy)).toContain('(downgrade)'); + }); + it("compares specs where node_modules holds nothing, as under Yarn Plug'n'Play", async () => { project({ devDependencies: { e2e: '^0.21.2', '@e2e-dev/web': '^0.14.0' } }); expect((await run()).exitCode).toBe(0);