Repository navigation
Commit a237c77
authored
feat(eve): publish native Browserbase extension with session cleanup (#2821)
# why
Eve agents need an installable Browserbase extension with persistent
browser state and predictable cleanup. This adds the native Stagehand V4
integration as `@browserbasehq/eve` 0.2.
# what changed
- Add `browserbase__run`, `browserbase__snapshot`, and
`browserbase__screenshot` through Eve's native extension API.
- Share one Browserbase session across calls, recover unhealthy
sessions, and release owned resources on explicit close. The next call
can start a fresh session.
- Bundle the shared browser facade, including the cleanup hook and
sanitized errors used by Eve's session owner, and add package build,
release, and Changeset configuration.
- Support Eve 0.68.x, resolve environment credentials when the browser
starts, and inherit Browserbase proxy defaults unless explicitly
overridden.
The [build
script](https://github.com/browserbase/stagehand/blob/ab25295e96476ee3c13c19a8e936348491da0e04/packages/integrations/eve/scripts/stage-facade.mjs)
copies four shared Core files byte-for-byte into Eve's generated,
gitignored source directory. `runtime.ts`, `contract.ts`, and
`redact.ts` are unchanged from the PR base. `tools.ts` adds the host
cleanup hook and error handling; the Eve tool wrappers adapt the
existing Stagehand example.
The [previous implementation in
browserbase/integrations](https://github.com/browserbase/integrations/tree/b7bc81c6fd4e089ab0c0df2b82529b200739e458/packages/eve-browserbase)
already uses Stagehand V4. This PR keeps its npm package identity but
changes the tool API and session lifecycle; none of the 17 tracked Eve
package files is byte-identical to that implementation. The main
implementation review areas are session ownership/recovery, the shared
cleanup/error changes, and packaging/release wiring. Eve's built-in
`web_search` and `web_fetch` remain available;
[#2822](#2822) adds
optional Browserbase replacements. The separate MCP lifecycle change is
in [#3078](#3078); this
native extension does not depend on it. Documentation is in
[#3079](#3079). Merge that
PR before publishing 0.2 so the npm package includes the updated README.
# test plan
Checked after the `main` update at
[`ab25295e9`](ab25295).
Refreshed against current `main`, preserving upstream dependencies and
Eve’s named catalog. The URL-matching test now resolves Playwright Core
through its declared Playwright dependency, so the new examples’ MCP
dependency cannot change which version it tests.
| Command / flow | Observed output | Coverage |
| --- | --- | --- |
| Shared facade build, typecheck and unit tests; Pi
build/typecheck/tests | 136 facade tests and 3 Pi tests passed | Shared
hook/error changes and existing native consumer |
| `CHROME_PATH=<Chrome binary> pnpm --filter
@browserbasehq/stagehand-integrations test:browser` | 6 tests passed |
Browser compatibility against local fixtures |
| Eve package typecheck and `test:unit` | Typecheck passed; 39 tests
passed | Native session ownership, credentials and tool behavior |
| Fresh tarball, strict `publint`, external Eve 0.68.0 consumer | All
passed; `eve build` passed with `BROWSERBASE_API_KEY` unset |
Installable package and credential-free builds |
| Installed SDK and browser extension compared with fresh local build |
Byte-identical; Eve resolves the same SDK | Smoke tests cover the SDK
and browser extension from this branch |
| Packed lifecycle probe and real `eve eval --strict --skip-report
--timeout 300000` | 8/8 gates passed; persistent state, error recovery,
snapshot-ID navigation, 193,444-byte PNG and close/reopen passed |
Native tools with real Browserbase sessions on public Example
Domain/IANA pages |
| Independent session audit | All 5 sessions `COMPLETED`, including the
preliminary harness run; no fallback release needed | Owned-session
cleanup |1 parent 5788121 commit a237c77
34 files changed
Lines changed: 2075 additions & 639 deletions
File tree
- .changeset
- packages/integrations
- core
- src/facade
- tests
- eve
- agent
- tools
- extension
- instructions
- lib
- tools
- scripts
- src
- tests
- scripts/release
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
38 | 65 | | |
| 66 | + | |
| 67 | + | |
39 | 68 | | |
40 | 69 | | |
41 | 70 | | |
| |||
142 | 171 | | |
143 | 172 | | |
144 | 173 | | |
145 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
146 | 183 | | |
147 | 184 | | |
148 | 185 | | |
149 | | - | |
150 | | - | |
| 186 | + | |
| 187 | + | |
151 | 188 | | |
152 | 189 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 190 | + | |
158 | 191 | | |
159 | 192 | | |
160 | 193 | | |
| |||
211 | 244 | | |
212 | 245 | | |
213 | 246 | | |
214 | | - | |
| 247 | + | |
215 | 248 | | |
216 | 249 | | |
217 | 250 | | |
218 | | - | |
| 251 | + | |
219 | 252 | | |
220 | 253 | | |
221 | 254 | | |
222 | 255 | | |
223 | | - | |
| 256 | + | |
224 | 257 | | |
225 | 258 | | |
226 | 259 | | |
| |||
242 | 275 | | |
243 | 276 | | |
244 | 277 | | |
| 278 | + | |
| 279 | + | |
245 | 280 | | |
246 | 281 | | |
247 | 282 | | |
| |||
253 | 288 | | |
254 | 289 | | |
255 | 290 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
263 | 307 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | 308 | | |
| 309 | + | |
| 310 | + | |
270 | 311 | | |
271 | 312 | | |
272 | 313 | | |
| |||
311 | 352 | | |
312 | 353 | | |
313 | 354 | | |
314 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
315 | 358 | | |
316 | 359 | | |
317 | 360 | | |
| |||
323 | 366 | | |
324 | 367 | | |
325 | 368 | | |
326 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
327 | 372 | | |
328 | 373 | | |
329 | 374 | | |
| |||
384 | 429 | | |
385 | 430 | | |
386 | 431 | | |
387 | | - | |
| 432 | + | |
388 | 433 | | |
389 | 434 | | |
390 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
259 | 264 | | |
260 | 265 | | |
261 | 266 | | |
| |||
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
272 | 297 | | |
273 | 298 | | |
274 | 299 | | |
| |||
640 | 665 | | |
641 | 666 | | |
642 | 667 | | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments