## Why The original server-v4 stacked PRs merged into each other after `STG-1614` had already merged into `main`, so the env/test-harness work, Drizzle foundation, and Drizzle schema/controller flow never actually reached `main`. This PR recovers that full stack onto current `main` in one branch. ## What Changed - cherry-picked the three stacked squash-merge commits from `#1896`, `#1897`, and `#1898` onto fresh `main` - preserved the full `server-v4` env/test harness cleanup, Drizzle foundation, DB smoke tests, schema/migration work, and `/v4/llms` controller/service/repo flow - added one small follow-up commit to normalize `pnpm-lock.yaml` against current `main` after applying the recovered stack ## Test Plan - `pnpm install` - `pnpm --filter @browserbasehq/stagehand-server-v4 run lint` - `pnpm --filter @browserbasehq/stagehand-server-v4 run test:unit` - `pnpm --filter @browserbasehq/stagehand-server-v4 run build` - `pnpm --filter @browserbasehq/stagehand-server-v4 run gen:openapi` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Recovers the server‑v4 Drizzle stack onto `main`, restoring DB‑backed `/v4/llms` and switching the public `LLMId` to UUID. Adds a typed env, clean app bootstrap, and a local `pglite`/Postgres runtime with migrations, tests, and a simpler source‑based test harness. - **New Features** - Drizzle foundation with `pglite` default and Postgres option; new `db:*` scripts via `drizzle-kit`. - Fastify `databasePlugin` and unified DB client; `app.ts` bootstrap with health/readiness and Swagger/OpenAPI; env via `@t3-oss/env-core`. - Tables/relations for LLMs and Stagehand; DB‑derived Zod schemas; first migration; OpenAPI updated for UUID `LLMId` with strict format and pattern. - LLM module (repo/service/controller) backing `/v4/llms`; routes now delegate to the controller; browser session create uses the service and auto‑creates a system default LLM when `llmId` is missing. - Tests run from source via `tsx`; test server script simplified; `turbo` tasks cleaned up; schema cleanup (`z.url()`). - **Migration** - Run: `pnpm --filter @browserbasehq/stagehand-server-v4 db:migrate`. - Local dev uses `pglite` at `~/.stagehand/db/stagehand-v4`. For Postgres set `STAGEHAND_DB_MODE=postgres` and `DATABASE_URL`. - Update clients to treat `LLMId` as a UUID and regenerate from `openapi.v4.yaml` if needed. <sup>Written for commit 1fb861ed27739ad2330a4a0a6daf6e2c4951a575. Summary will update on new commits. <a href="https://cubic.dev/pr/browserbase/stagehand/pull/1917">Review in cubic</a></sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by: Nick Sweeting <github@sweeting.me> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
576 lines
13 KiB
JSON
576 lines
13 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-v3#build": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": [
|
|
"dist/**",
|
|
"openapi.v3.yaml"
|
|
],
|
|
"inputs": [
|
|
"**/*.ts",
|
|
"**/*.js",
|
|
"package.json",
|
|
"tsconfig.json",
|
|
"tsconfig.*.json",
|
|
"!dist/**",
|
|
"!openapi.v3.yaml"
|
|
]
|
|
},
|
|
"@browserbasehq/stagehand-server-v3#build:esm-tests": {
|
|
"dependsOn": ["^build:esm"],
|
|
"outputs": ["dist/tests/**", "dist/src/**"],
|
|
"inputs": [
|
|
"tests/**/*.ts",
|
|
"src/**/*.ts",
|
|
"package.json",
|
|
"tsconfig.tests.json",
|
|
"!dist/tests/**"
|
|
]
|
|
},
|
|
"@browserbasehq/stagehand-server-v4#build": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": [
|
|
"dist/**",
|
|
"openapi.v4.yaml"
|
|
],
|
|
"inputs": [
|
|
"**/*.ts",
|
|
"**/*.js",
|
|
"package.json",
|
|
"tsconfig.json",
|
|
"tsconfig.*.json",
|
|
"!dist/**",
|
|
"!openapi.v4.yaml"
|
|
]
|
|
},
|
|
"@browserbasehq/browse-cli#build": {
|
|
"dependsOn": ["^build"],
|
|
"outputs": [
|
|
"dist/**"
|
|
],
|
|
"inputs": [
|
|
"**/*.ts",
|
|
"**/*.js",
|
|
"package.json",
|
|
"tsconfig.json",
|
|
"tsup.config.ts",
|
|
"!dist/**"
|
|
]
|
|
},
|
|
"@browserbasehq/stagehand-server-v4#gen:openapi": {
|
|
"dependsOn": ["^build:esm"],
|
|
"outputs": ["openapi.v4.yaml"],
|
|
"inputs": [
|
|
"src/**/*.ts",
|
|
"scripts/gen-openapi.ts",
|
|
"package.json",
|
|
"tsconfig.json",
|
|
"tsconfig.*.json",
|
|
"!openapi.v4.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: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": [
|
|
"BROWSERBASE_FLOW_LOGS",
|
|
"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:server:dist", "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"
|
|
]
|
|
},
|
|
"test:cli": {
|
|
"dependsOn": ["build"],
|
|
"outputs": [],
|
|
"cache": false,
|
|
"inputs": [
|
|
"tests/**/*.ts",
|
|
"src/**/*.ts",
|
|
"package.json",
|
|
"tsconfig.json",
|
|
"vitest.config.ts"
|
|
]
|
|
},
|
|
"docs": {
|
|
"persistent": true,
|
|
"cache": false
|
|
},
|
|
"dev": {
|
|
"persistent": true,
|
|
"cache": false
|
|
}
|
|
}
|
|
}
|