move dom processing to the actual DOM via built scripts

Merged
JE
2y ago
+358-50

why

  1. Playwright has a massive overhead to spin up a lot of evaluation promises in the target dom
  2. We needed more beef here, specifically to rule out hidden but DOM included elements (cough google)

what changed

  1. We borrow from tarsier here. Build scripts with esbuild
  2. we load them via playwright
  3. we execute them in stagehand land
  4. added more utilities to better filter the dom
  5. small prompt cleanup
  6. make sure we build before running examples or evals

test plan

example lets you search google or bing!
evals still pass