stagehand/turbo.json
Nick Sweeting 4f8d2d5d85
Fix Windows SEA build (#1734)
# why

# what changed

# test plan

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes the Windows SEA build and cross‑platform path resolution
(including when run via tsx). CI builds, launches, and smoke‑tests
Linux, macOS, and Windows binaries (x64/arm64); CJS/ESM outputs are
stable.

- Bug Fixes
- Reusable SEA build workflow with a full OS/arch matrix (incl. Ubuntu
24.04 ARM and Windows 11 ARM), same‑arch launch check against /healthz,
selective artifact upload, and an include_sourcemaps toggle (dev/test
only; releases exclude sourcemaps).
- Centralized runtimePaths helpers across core/server/evals/docs to
replace import.meta/fileURLToPath, fix tsx path resolution, normalize
absolute paths, and correct supervisorClient CLI resolution and Windows
spawning.
- Tooling: split DOM script builds into four Turbo tasks for Windows;
switch to in‑process esbuild and Node‑invoked turbo/postject; stabilize
CJS/ESM via tsc emits plus small CJS wrappers; refine tsconfig includes;
add default NODE_ENV/BB_ENV in server env.

<sup>Written for commit b0b191f7b0411b6590a79ce3f10b3fba9435b4d7.
Summary will update on new commits. <a
href="https://cubic.dev/pr/browserbase/stagehand/pull/1734">Review in
cubic</a></sup>

<!-- End of auto-generated description by cubic. -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches build/CI and packaging code (SEA generation, path resolution)
across multiple packages, so failures could break releases or CI on
specific platforms despite being largely tooling-focused.
> 
> **Overview**
> Fixes cross-platform SEA building by moving `build-server-sea` to a
reusable workflow with a multi-OS/arch matrix (including ARM runners),
optional artifact/caching inputs, selective artifact upload, and a
same-arch smoke test that boots each binary and hits `/healthz`.
> 
> Standardizes path/root resolution via new `runtimePaths` helpers
(core/server/evals/docs) and replaces ad-hoc
`fileURLToPath(import.meta.url)`/`__dirname` usage across scripts,
tests, and `supervisorClient` (also tightening CLI resolution and SEA
detection).
> 
> Simplifies build/tooling: core CJS/ESM builds now rely on `tsc` emits
plus small CJS wrapper entrypoints (dropping esbuild bundling of
core/tests), DOM script generation is split into separate Turbo tasks,
server SEA build switches to in-process `esbuild` and Node-invoked
`turbo`/`postject`, and server env config now provides default
`NODE_ENV`/`BB_ENV` values.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2e4a07a6d0b54eddb7fea10d079c8062ecba1d6b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-02-24 10:39:45 -08:00

521 lines
12 KiB
JSON

{
"$schema": "https://v2-8-10.turborepo.dev/schema.json",
"globalEnv": [
"CI"
],
"globalDependencies": [
".github/workflows/ci.yml",
"package.json",
"packages/*/package.json",
"tsconfig.json",
"tsconfig.base.json",
"eslint.config.mjs",
".prettierrc",
".prettierignore"
],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [
"dist/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/**"
]
},
"@browserbasehq/stagehand#build": {
"dependsOn": [
"^build",
"gen-version",
"build-dom-scripts:dom",
"build-dom-scripts:locator",
"build-dom-scripts:screenshot",
"build-dom-scripts:a11y"
],
"outputs": [
"dist/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts",
"!lib/dom/build/**",
"!lib/v3/dom/build/**",
"!dist/**"
]
},
"@browserbasehq/stagehand-server#build": {
"dependsOn": ["^build"],
"outputs": [
"dist/**",
"openapi.v3.yaml"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/**",
"!openapi.v3.yaml"
]
},
"@browserbasehq/stagehand#build:esm": {
"dependsOn": [
"^build:esm",
"gen-version",
"build-dom-scripts:dom",
"build-dom-scripts:locator",
"build-dom-scripts:screenshot",
"build-dom-scripts:a11y"
],
"outputs": [
"dist/esm/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts",
"!lib/dom/build/**",
"!lib/v3/dom/build/**",
"!dist/**"
]
},
"@browserbasehq/stagehand#build:cjs": {
"dependsOn": [
"^build:cjs",
"gen-version",
"build-dom-scripts:dom",
"build-dom-scripts:locator",
"build-dom-scripts:screenshot",
"build-dom-scripts:a11y"
],
"outputs": [
"dist/cjs/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts",
"!lib/dom/build/**",
"!lib/v3/dom/build/**",
"!dist/**"
]
},
"gen-version": {
"outputs": ["lib/version.ts"],
"inputs": [
"scripts/gen-version.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!lib/version.ts"
]
},
"build-dom-scripts:dom": {
"outputs": [
"lib/v3/dom/build/v3-index.js",
"lib/v3/dom/build/scriptV3Content.ts",
"lib/v3/dom/build/rerender-index.js",
"lib/v3/dom/build/reRenderScriptContent.ts"
],
"inputs": [
"lib/v3/dom/genDomScripts.ts",
"lib/v3/dom/**/*.ts",
"!lib/v3/dom/build/**",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"build-dom-scripts:locator": {
"outputs": [
"lib/v3/dom/build/locatorScripts.generated.ts"
],
"inputs": [
"lib/v3/dom/genLocatorScripts.ts",
"lib/v3/dom/locatorScripts/**/*.ts",
"!lib/v3/dom/build/**",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"build-dom-scripts:screenshot": {
"outputs": [
"lib/v3/dom/build/screenshotScripts.generated.ts"
],
"inputs": [
"lib/v3/dom/genScreenshotScripts.ts",
"lib/v3/dom/screenshotScripts/**/*.ts",
"!lib/v3/dom/build/**",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"build-dom-scripts:a11y": {
"outputs": [
"lib/v3/dom/build/a11yScripts.generated.ts"
],
"inputs": [
"lib/v3/dom/genA11yScripts.ts",
"lib/v3/dom/a11yScripts/**/*.ts",
"!lib/v3/dom/build/**",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"build:esm": {
"dependsOn": ["^build:esm"],
"outputs": [
"dist/esm/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/esm/**"
]
},
"build:esm-tests": {
"dependsOn": ["^build:esm"],
"outputs": ["dist/tests/**"],
"inputs": [
"test/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/tests/**"
]
},
"build:server:dist": {
"dependsOn": ["^build:esm"],
"outputs": [
"dist/lib/**",
"dist/routes/**",
"dist/types/**",
"dist/*.js",
"dist/*.js.map",
"dist/*.d.ts"
],
"inputs": [
"src/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/lib/**",
"!dist/routes/**",
"!dist/types/**",
"!dist/*.js",
"!dist/*.js.map",
"!dist/*.d.ts"
]
},
"gen:openapi": {
"dependsOn": ["^build:esm"],
"outputs": ["openapi.v3.yaml"],
"inputs": [
"src/**/*.ts",
"scripts/gen-openapi.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!openapi.v3.yaml"
]
},
"build:sea:esm": {
"dependsOn": ["^build:esm"],
"outputs": [
"dist/sea/**",
"dist/app.mjs"
],
"env": [
"SEA_BUILD_MODE",
"SEA_TARGET_PLATFORM",
"SEA_TARGET_ARCH",
"SEA_BINARY_NAME"
],
"inputs": [
"src/**/*.ts",
"scripts/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/sea/**",
"!dist/app.mjs"
]
},
"build:sea:cjs": {
"dependsOn": ["^build:cjs"],
"outputs": ["dist/sea/**"],
"env": [
"SEA_BUILD_MODE",
"SEA_TARGET_PLATFORM",
"SEA_TARGET_ARCH",
"SEA_BINARY_NAME"
],
"inputs": [
"src/**/*.ts",
"scripts/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/sea/**"
]
},
"build:cjs": {
"dependsOn": ["^build:cjs"],
"outputs": [
"dist/cjs/**"
],
"inputs": [
"**/*.ts",
"**/*.js",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/cjs/**"
]
},
"build:cli": {
"dependsOn": ["^build:esm"],
"outputs": ["dist/cli/**"],
"inputs": [
"cli.ts",
"evals.config.json",
"scripts/**",
"!dist/cli/**"
]
},
"lint": {
"dependsOn": ["^build"],
"outputs": [],
"inputs": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"**/*.mjs",
"**/*.cjs",
"**/*.mts",
"**/*.cts",
"**/*.md",
"**/*.mdx",
"**/*.yml",
"**/*.yaml",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!dist/**",
"!node_modules/**",
"!.turbo/**"
]
},
"format": {
"outputs": [],
"cache": false
},
"test": {
"dependsOn": [],
"outputs": [],
"inputs": [
"**/*.spec.ts",
"**/*.test.ts"
]
},
"test:core": {
"dependsOn": ["build:esm"],
"outputs": [],
"cache": false,
"env": [
"VITEST_CONSOLE_REPORTER"
],
"inputs": [
"tests/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"test:e2e": {
"dependsOn": ["build:esm"],
"outputs": [
"playwright-report/**",
"test-results/**"
],
"cache": false,
"env": [
"BB_API_KEY",
"BB_PROJECT_ID",
"BROWSERBASE_REGION",
"BROWSERBASE_SESSION_LIMIT_PER_E2E_TEST",
"IFRAME_CHILD_FRAME_TIMEOUT_MS",
"IFRAME_DEBUG",
"IFRAME_POPUP_TIMEOUT_MS",
"IFRAME_POPUP_URL_TIMEOUT_MS",
"KEEP_ALIVE_ACTION_EXIT_TIMEOUT_MS",
"KEEP_ALIVE_BB_INFO_TIMEOUT_MS",
"KEEP_ALIVE_BB_TIMEOUT_MS",
"KEEP_ALIVE_DEBUG",
"KEEP_ALIVE_LOCAL_INFO_TIMEOUT_MS",
"KEEP_ALIVE_LOCAL_TIMEOUT_MS",
"KEEP_ALIVE_STAY_OPEN_MS",
"KEEP_ALIVE_VIEW_MS",
"LOCAL_SESSION_LIMIT_PER_E2E_TEST",
"PLAYWRIGHT_CONSOLE_REPORTER",
"STAGEHAND_BROWSER_TARGET",
"STAGEHAND_API_URL"
],
"passThroughEnv": [
"ANTHROPIC_API_KEY",
"BROWSERBASE_API_KEY",
"BROWSERBASE_CDP_CONNECT_MAX_MS",
"BROWSERBASE_PROJECT_ID",
"BROWSERBASE_SESSION_CREATE_MAX_MS",
"CHROME_PATH",
"CTRF_JUNIT_PATH",
"GEMINI_API_KEY",
"GOOGLE_GENERATIVE_AI_API_KEY",
"HEADLESS",
"LLM_MAX_MS",
"NODE_OPTIONS",
"NODE_V8_COVERAGE",
"OPENAI_API_KEY",
"STAGEHAND_SERVER_TARGET"
],
"inputs": [
"lib/v3/tests/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json",
"!playwright-report/**",
"!test-results/**"
]
},
"test:evals": {
"dependsOn": ["build:esm", "build:cli"],
"outputs": [],
"cache": false,
"env": [
"AGENT_EVAL_MAX_STEPS",
"BRAINTRUST_API_KEY",
"EVAL_AGENT_MODELS",
"EVAL_AGENT_MODELS_CUA",
"EVAL_CATEGORIES",
"EVAL_DATASET",
"EVAL_ENV",
"EVAL_GAIA_FILE",
"EVAL_GAIA_LEVEL",
"EVAL_GAIA_LIMIT",
"EVAL_GAIA_SAMPLE",
"EVAL_MAX_CONCURRENCY",
"EVAL_MAX_K",
"EVAL_MODELS",
"EVAL_ONLINEMIND2WEB_LIMIT",
"EVAL_ONLINEMIND2WEB_SAMPLE",
"EVAL_PROVIDER",
"EVAL_TRIAL_COUNT",
"EVAL_WEBVOYAGER_LIMIT",
"EVAL_WEBVOYAGER_SAMPLE",
"OP_AUTO_ENV_DISABLE",
"OP_ENV_FILE",
"STAGEHAND_BROWSER_TARGET",
"USE_API"
],
"passThroughEnv": [
"ANTHROPIC_API_KEY",
"BROWSERBASE_API_KEY",
"BROWSERBASE_CDP_CONNECT_MAX_MS",
"BROWSERBASE_PROJECT_ID",
"BROWSERBASE_SESSION_CREATE_MAX_MS",
"CHROME_PATH",
"CTRF_JUNIT_PATH",
"GEMINI_API_KEY",
"GOOGLE_GENERATIVE_AI_API_KEY",
"HEADLESS",
"LLM_MAX_MS",
"NODE_OPTIONS",
"NODE_V8_COVERAGE",
"OPENAI_API_KEY",
"STAGEHAND_SERVER_TARGET"
],
"inputs": [
"scripts/**",
"cli.ts",
"evals.config.json",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"test:server": {
"dependsOn": ["build:sea:esm", "build:esm-tests"],
"outputs": [],
"cache": false,
"env": [
"BB_ENV",
"NODE_ENV",
"NODE_TEST_CONSOLE_REPORTER",
"NODE_TEST_REPORTER",
"NODE_TEST_REPORTER_DESTINATION",
"SEA_BINARY_NAME",
"STAGEHAND_BASE_URL",
"STAGEHAND_SEA_CACHE_DIR",
"STAGEHAND_TEST_LOCAL_CONNECT_TIMEOUT_MS"
],
"passThroughEnv": [
"ANTHROPIC_API_KEY",
"BROWSERBASE_API_KEY",
"BROWSERBASE_CDP_CONNECT_MAX_MS",
"BROWSERBASE_PROJECT_ID",
"BROWSERBASE_SESSION_CREATE_MAX_MS",
"CHROME_PATH",
"CTRF_JUNIT_PATH",
"GEMINI_API_KEY",
"GOOGLE_GENERATIVE_AI_API_KEY",
"HEADLESS",
"LLM_MAX_MS",
"NODE_OPTIONS",
"NODE_V8_COVERAGE",
"OPENAI_API_KEY",
"STAGEHAND_BROWSER_TARGET",
"STAGEHAND_SERVER_TARGET"
],
"inputs": [
"test/**/*.ts",
"scripts/**",
"src/**/*.ts",
"package.json",
"tsconfig.json",
"tsconfig.*.json"
]
},
"docs": {
"persistent": true,
"cache": false
},
"dev": {
"persistent": true,
"cache": false
}
}
}