Commit Graph
9542 Commits
Author SHA1 Message Date
Adrià Arrufat 718c79049d agent: update callEval API and standardize initialization
- Update `ToolExecutor.callEval` to return `EvalResult` for better error handling.
- Swap `ScriptIterator.init` arguments to follow the allocator-first convention.
- Use explicit type syntax for `.init` calls across the agent package.
- Remove redundant `isKnownTool` helper in favor of direct enum conversion.
2026-04-26 08:49:51 +02:00
Adrià Arrufat c7ff308eed Merge branch 'main' into agent 2026-04-26 08:33:39 +02:00
Karl Seguin 7819ee50fa Add and default to Blackhole storage
Tweak sqlite build to omit more features, hoping to shrink the size when sqlite
is used.
2026-04-26 09:04:33 +08:00
Karl Seguin b3257754e0 Merge pull request #2245 from lightpanda-io/navigate_load_arena
Use an arena from the ArenaPool for the main page
2026-04-26 08:25:55 +08:00
Karl Seguin fc636d4e36 Merge pull request #2247 from lightpanda-io/small_fixes
Various small fixes
2026-04-26 08:25:41 +08:00
Adrià Arrufat d31bc17a39 Merge branch 'main' into agent 2026-04-25 09:49:47 +02:00
Karl Seguin ed5bc09951 Merge pull request #2241 from lightpanda-io/fix/bound-memory-growth-long-waits-main
browser: bound per-tick memory growth on JS-heavy pages
2026-04-25 14:53:10 +08:00
Adrià Arrufat 093555b374 browser: hint v8 gc during long waits
Runner._wait can iterate for the full opts.ms budget (up to 30s in
fetch, longer in agent tool-use loops). V8 was only nudged to GC on
session/page teardown (Browser.deinit, Page.deinit), so a page that
stays alive while running heavy JS accumulates wrappers and
external-ref'd Zig allocations V8 has no reason to drop. Fire
memoryPressureNotification(.moderate) once per second from the wait
loop.
2026-04-25 08:19:49 +02:00
Karl Seguin 8509b112b8 Various small fixes
Extracted from https://github.com/lightpanda-io/browser/pull/2242
2026-04-25 13:22:41 +08:00
Karl Seguin 12c2efb811 Adds --terminate-ms command line argument + ctrl-c improvements in fetch
The main.zig path for `fetch` now captures the *Browser so that
browser.env.terminate() can be called. This is a bit more complex than the serve
path because the Browser owns the Isolate and can't be moved from one thread to
another.

With main having access to the browser, two things are now possible:
1 - We can support a --terminate-ms flag (https://github.com/lightpanda-io/browser/issues/2206)
2 - ctrl-c can correctly stop blocked JavaScript processes

1 is implemented via setitimer to set a timer for SIGALRM, avoiding the need to
add another "watcher" thread, or putting a timer in Network.run.
2026-04-25 12:34:06 +08:00
Karl Seguin d02674f365 Use an arena from the ArenaPool for the main page
Was previously using page.arena, but there's no reason to hold this beyond the
point where the page is parsed, and the page can live for quite some time after
the initial load.
2026-04-25 10:49:27 +08:00
Karl Seguin 25cec9bd82 Merge pull request #2233 from lightpanda-io/custom_elements
Custom elements
2026-04-25 10:12:09 +08:00
Navid EMAD 3761d2a32f Fix querySelector('#id') vs getElementById('id') disagreement
Frame.getElementByIdFromNode is the selector engine's fast path for
`#id` queries. It only consulted `_elements_by_id`, while
Document.getElementById and ShadowRoot.getElementById both fall back
to `_removed_ids` + TreeWalker to recover a surviving duplicate after
the first has been removed.

The two APIs could disagree after DOM manipulation that removes a
duplicate-ID element (e.g. Turbo Drive's PageRenderer.replaceBody
doing innerHTML + replaceWith):

  document.querySelector('#page-title')  => null
  document.getElementById('page-title')  => <h1>

Dispatch to the existing canonical getElementById on the scope
(ShadowRoot or Document) instead of keeping a third, map-only copy
of the lookup. The two APIs now agree by construction.
2026-04-25 04:04:14 +02:00
Karl Seguin 5ec7c660da update v8 dep 2026-04-25 09:51:58 +08:00
Karl Seguin 3cdb7ee91c Merge pull request #2239 from lightpanda-io/test_only_use_after_free
Fix a test-only use-after-free
2026-04-25 07:41:17 +08:00
Karl Seguin 8a08d1b407 Fix a test-only use-after-free
Only surfaced if an individual test was ran. When running multiple tests, the
bucket reuse of the underlying arena hides the issue.
2026-04-24 21:51:50 +08:00
Pierre Tachoire 8767127308 ci: split package release into sub files 2026-04-24 15:37:02 +02:00
Karl Seguin 8ba960ecbc window.open
Adds limited support for window.open. This leverages the new page container and
behaves similarly to an iframe. There are many things not implemented, but the
most significant are:

1- target=window_name or target=_blank don't work (but this could be added
   pretty easily I think)

2- Windows (which are is just a Frame) are shutdown when the Page is shutdown.
   They would need to be owned by the Session (rather than the Page), but I'm
   not really confident in that right now.

3- No CDP testing. There are maybe CDP-specific messages we need to emit (or
   maybe messages that we shouldn't emit).

As-is, this should help with common cases where:
1. window.open is called but doesn't matter (won't give a JS error)
2. window.open is short-lived, or, more specifically, lives only for the
   duration of the page that opened it (e.g. a login popup).
3. WPT tests! (because most of these fit in #2).
2026-04-24 21:29:41 +08:00
Pierre Tachoire 233d08cd6e ci: generate a .deb package on tag 2026-04-24 15:23:25 +02:00
Pierre Tachoire b2b1302fa2 Merge pull request #2234 from lightpanda-io/empty_redirect_user_after_free
Fix a use-after-free on an empty (and invalid) location
0.2.9
2026-04-24 14:52:07 +02:00
Pierre Tachoire d2fc963640 Merge pull request #2231 from lightpanda-io/pkg
ci: refacto release workflow and add Arch linux package build
2026-04-24 14:50:55 +02:00
Nikolay Govorov 8b2b5ddff4 Merge pull request #2226 from lightpanda-io/wp/mrdimidium/fix-timeout
Setup timeout via tcp keepalive
2026-04-24 13:21:13 +01:00
Adrià Arrufat af4d76c168 Merge branch 'main' into agent 2026-04-24 14:03:21 +02:00
Nikolay Govorov 999f57b729 Remove timeout flag 2026-04-24 12:40:25 +01:00
Karl Seguin 87a99749b7 Use TCP_KEEPALIVE instead of TCP_KEEPIDLE on MacOS
See: https://github.com/nginx/nginx/issues/336
2026-04-24 12:40:24 +01:00
Nikolay Govorov c7d004fefb Setup timeout via tcp keepalive 2026-04-24 12:40:21 +01:00
Adrià Arrufat 46f8fc5a13 Merge pull request #2236 from lightpanda-io/fix/optional-positional-args
cli: allow optional positional arguments in command builder
2026-04-24 13:36:38 +02:00
Pierre Tachoire 5b9c05753c Merge pull request #2232 from lightpanda-io/axtree-nodeid-string 2026-04-24 13:22:37 +02:00
Adrià Arrufat 9847c07cb1 Merge branch 'main' into agent 2026-04-24 13:13:05 +02:00
Adrià Arrufat 6a65801527 cli: allow optional positional arguments in command builder 2026-04-24 13:08:40 +02:00
Adrià Arrufat 5fb6c2b6b5 agent: refine system prompt and add safety limits 2026-04-24 13:04:53 +02:00
Karl Seguin 7b50dff956 Fix a user-after-free on an empty (and invalid) empty location
Improves WPT: /fetch/api/redirect/redirect-empty-location.any.html
2026-04-24 18:31:45 +08:00
Karl Seguin 957f2d9c92 Merge pull request #2229 from lightpanda-io/wpt_extensions_action
Update WebDriver to use Page
2026-04-24 18:21:57 +08:00
Pierre Tachoire 368bbc75e0 ci: refacto build step into 1 job per os + CPU matrix 2026-04-24 11:43:48 +02:00
Pierre Tachoire ce541fbc63 ci: add arch linux package generation 2026-04-24 11:43:47 +02:00
Karl Seguin 802ae55cc1 Update WebDriver to use Page
Don't use pre-built snapshot for wpt action (the snapshot needs the WebDriver
added, which is not normally added). Instead, rely on runtime snapshot creation
(this just adds a bit of startup time and peak memory, neither or which should
be an issue for WPT runs).
2026-04-24 17:33:16 +08:00
Karl Seguin 757c70b6db Add adoptedCallback for CustomElements
Fired when elements are moved from one document to another. I don't think this
is really used much, but it helps pass a number of WPT cases.

This required tweaking insertAdjacentHTML as it was creating a full document
and trigger spurious callbacks in the new code. A DocumentFragment is now used
instead.
2026-04-24 17:26:39 +08:00
Pierre Tachoire f63b8ae004 cdp: AXNodeId is a string per spec
AXNodeId is defined as string in CDP spec.
This this a difference with DOM.NodeId which is an int.

https://chromedevtools.github.io/devtools-protocol/tot/Accessibility/#type-AXNodeId
https://chromedevtools.github.io/devtools-protocol/tot/DOM/#type-NodeId
2026-04-24 11:24:16 +02:00
Pierre Tachoire 9bb6c3ca32 rename nightly.yml into release.yml 2026-04-24 10:59:16 +02:00
Karl Seguin 2c4179f1ad Support direct instantiation of custom element
Support `new MyElement()` syntax to create custom element. The implementation
for this is pretty straightforward, but it depends on:
https://github.com/lightpanda-io/zig-v8-fork/pull/173.

Also modify the `attributeChangedCallback` and pass a missing parameter: the
namespace. Currently, we pass `null`, but this is less likely to cause issues
than not passing anything.
2026-04-24 16:48:24 +08:00
Karl Seguin 3f0cc7a0df Merge pull request #2227 from lightpanda-io/better_errdefer_cleanups
Improve various errdefer flows
2026-04-24 16:37:28 +08:00
Karl Seguin ae24343dce Merge pull request #2220 from lightpanda-io/performance_observer_functions
Add getEntriesByType and getEntriesByName to PerformanceObserver entr…
2026-04-24 16:35:32 +08:00
Karl Seguin b15a40adc4 Merge pull request #2224 from lightpanda-io/console_own_properties
Define v8 functions directly on console instance.
2026-04-24 16:34:46 +08:00
Adrià Arrufat 919d07c832 agent: update zenai and tool call error handling 2026-04-24 10:14:44 +02:00
Karl Seguin 308a9a8ccd Merge pull request #2230 from lightpanda-io/update_ws_main
Update go run ws/main.go to new go run runner/main.go -serve
2026-04-24 16:08:40 +08:00
Karl Seguin a9e4ee41e3 Update go run ws/main.go to new go run runner/main.go -serve 2026-04-24 15:56:46 +08:00
Adrià Arrufat 7d74e9f7e6 agent: simplify logic in Agent and browser tools 2026-04-24 08:07:47 +02:00
Adrià Arrufat 45dd2ba655 browser.tools: swap arena and registry argument order 2026-04-24 07:53:06 +02:00
Adrià Arrufat 658079e7ae browser: deduplicate element resolution and result formatting 2026-04-24 07:37:03 +02:00
Adrià Arrufat 04bc7a4add agent: cleanup resource management and simplify logic
- Use `atomicFile` for script updates in `Agent.zig`.
- Ensure `ai_client` is properly deinitialized on `init` failure.
- Consolidate JSON quoting into `Command.buildJson`.
- Simplify `Recorder` and `ToolExecutor` implementations.
- Fix page scope access in `mcp/tools.zig`.
2026-04-24 07:33:02 +02:00