Add server-v4 stubs

Merged
MO
8mo ago
+16039-8253

why

The intent is we just want the v4 stubs - and the openapi spec (and a few useless tests for now). This isn't all of of the v4 stubs yet (missing /logs etc), but we'll add in the rest of the stubs in parallel.

what changed

  • Removes all "copied over" v3 functionality and /sessions routes etc.
  • Adds v4 stubs like /browsersession which return simple JSON objects

test plan

Lint + (pretty useless) tests pass, checked /documentation accessible locally and included screenshot.
Screenshot 2026-03-18 at 10 36 59 AM


Summary by cubic

Adds @browserbasehq/stagehand-server-v4, a schema‑first, stubbed v4 API for BrowserSession and Page, with a regenerated OpenAPI v4 spec. Replaces the legacy v4 sessions runtime with simple stubs and a minimal server boot, leaving packages/server unchanged.

  • New Features

    • Full v4 routes: /v4/browsersession (create/get/end + actions) and /v4/page (navigation, frames, input, CDP, screenshots, etc.), plus /healthz and /readyz.
    • Zod v4 schemas for BrowserSession/Page expose OpenAPI components; generator builds from route registries (browserSessionRoutes, pageRoutes); openapi.v4.yaml updated.
    • Integration tests for v4 BrowserSession and Page; test utils updated for v4 shapes and a default x-model-api-key.
  • Refactors

    • Removed legacy v4 runtime and infra (old sessions/* routes, session store, SSE, auth/env/logging/response, CORS/metrics, SEA fuse) and legacy tests; server registers only v4 routes/components.
    • Simplified health/readiness handlers and error handling with a lightweight AppError in src/types/error.ts.
    • Fixed query parameter handling in stub GET handlers and OpenAPI so GET endpoints use the correct querystring shapes.