Extract migration init service and fix browser test type errors
Split migrations into a dedicated `migrate` service that runs once
before web/workers start, replacing the inline shell command in web.
Workers now depend on migrate instead of web, so they can start as
soon as migrations complete.
Add /// <reference lib="dom" /> to dark_mode browser test to fix
TS2584 errors from document references inside page.evaluate().
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>