Commit Graph
8883 Commits
Author SHA1 Message Date
Adrià Arrufat e46964e261 markdown: reuse dump's shouldStripElement 2026-08-26 15:32:25 +02:00
Adrià ArrufatandKarl Seguin c78c1d3823 fetch: namespace dump flags
Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
2026-08-26 15:28:18 +02:00
Adrià Arrufat d3bad960c3 fetch: add --selector and --max-bytes, honor --strip-mode for markdown
--strip-mode was silently ignored for --dump markdown, and fetch had no
way to scope a dump to one element or cap its size although the markdown
and html tools have both.

--selector dumps the first matching element in any dump mode, --max-bytes
caps html and markdown with the tools' truncation marker, and markdown
now honors strip ui (images; scripts, styles and hidden elements are
never rendered, so the other groups don't apply).
2026-08-26 13:23:18 +02:00
Pierre Tachoire 2013249a2a Merge pull request #3267 from lightpanda-io/strip-auth-cross-origin-redirect
http: strip Authorization on cross-origin redirects
2026-08-26 10:16:52 +02:00
Pierre Tachoire 467167d6e6 http: strip Authorization on cross-origin redirects 2026-08-26 10:00:11 +02:00
Adrià Arrufat 5f8eb43867 Merge pull request #3276 from lightpanda-io/mcp-tool-annotations
mcp: add title and annotations to tools/list
2026-08-26 09:46:48 +02:00
Pierre Tachoire f2169836e5 Merge pull request #3256 from lightpanda-io/mcp-origin
mcp: enforce HTTP conditions
2026-08-26 09:42:29 +02:00
Adrià Arrufat 48551d241a mcp: navigation and waits are not read-only; consoleLogs is not idempotent
Review feedback: navigation writes cookies and storage and a wait lets page
scripts mutate state, so neither can be auto-approved as read-only.
consoleLogs drains its buffer, so repeated calls differ.
2026-08-26 08:44:57 +02:00
Adrià Arrufat 8f2d1de266 Merge pull request #3279 from lightpanda-io/interactive-visibility
interactive: skip hidden elements
2026-08-26 08:42:56 +02:00
Karl Seguin 8c5b684760 Optimize visibility check
Since all children of an invisible element are skipped, the visibility cache
serves no purpose AND we can assume that any element we do visit has a visible
parent and thus just need to check the element's own visibility.
2026-08-26 14:14:03 +08:00
Adrià Arrufat b814af122d interactive: skip hidden elements
interactiveElements and findElement returned elements under display:none
or [hidden], so agents were offered controls no user could reach and the
list disagreed with tree, which already filters on visibility. Reuse the
same cached check and skip the hidden subtree.
2026-08-26 14:02:56 +08:00
Karl Seguin 2fbfbea955 Merge pull request #3269 from lightpanda-io/markdown-hidden-content
markdown: skip hidden elements
2026-08-26 13:54:49 +08:00
Karl Seguin fc7b53b59c Merge pull request #3275 from lightpanda-io/interactive-role-tokens
interactive: read the role attribute as a token list
2026-08-26 13:54:29 +08:00
Karl Seguin 51279b80c2 Merge pull request #3274 from lightpanda-io/mcp-protocol-version
mcp: negotiate the protocol version on initialize
2026-08-26 13:41:40 +08:00
Karl Seguin ff9adc4202 Merge pull request #3277 from lightpanda-io/html-tool-maxbytes
tools: add maxBytes and strip to the html tool
2026-08-26 13:38:13 +08:00
Karl Seguin 66ac8d33e3 zig fmt -_- 2026-08-26 13:23:38 +08:00
Karl Seguin 29d1ae8f0f fix build, sorry 2026-08-26 13:23:37 +08:00
Karl Seguin e4a36552b8 mem: Optional CSSStyleDeclaration materialization
StyleManager ultimately ends up calling el.getOrCreateStyle() which either
returns the element's CSSStyleProperties OR (creates it AND stores it in the
Frame._element_styles for future lookups).

The goal behind this caching is twofold:
1 - Performance of not having to reparse the "style" attribute
2 - Identity: two calls from JS to get the properties should return the same
    value

(2) is non-negotiable, so the 'getOrCreate' _has_ to exist for JS-facing APIs.

But (1) is CPU vs memory optimization that we've decided should always favor the
CPU. But, in any case where we dump an entire tree, that memory cost can be
significant (# of elements with a style attribute) and the CPU gains are
questionable (it isn't like a JS loop re-checking an element's properties, it's
a one-time dump). So, the StyleManager now takes a comptime `InlineAccess` which
is either `.scan` or `.materialize`. When it's `.materialize` it behaves as
before. When it's `.scan` is will use an existing `_element_styles` if available
else it will re-parse but not store the value.
2026-08-26 13:23:11 +08:00
Adrià Arrufat e76cc816c0 markdown: skip hidden elements
The renderer's only visibility test was the tag (metadata/svg), so
display:none, [hidden], aria-hidden="true", closed <details> content and
closed <dialog>s all ended up in the output.

Check each element's own computed display:none through StyleManager plus
aria-hidden="true"; the dump root is exempt so a scoped dump of a hidden
subtree still renders it. analyzeContent/isStandaloneAnchor use the same
predicate so an anchor whose only content is hidden falls back to its label.

Also adds the missing dialog:not([open]) { display: none } UA rule.
2026-08-26 13:22:50 +08:00
Karl Seguin 67a5b23dc6 Merge pull request #3270 from lightpanda-io/css-keyword-case
css: compare visibility keyword values case-insensitively
2026-08-26 13:22:03 +08:00
Adrià Arrufat 0590bd0f80 Merge pull request #3265 from lightpanda-io/search-cleanup
search: default to Keenable's keyless endpoint, drop the DuckDuckGo scrape
2026-08-26 03:45:54 +02:00
Karl Seguin fa36fb5a69 Merge pull request #3280 from lightpanda-io/dev-fast-host-glibc
build: pin dev_fast to the host's glibc version
2026-08-26 09:40:14 +08:00
Pierre Tachoire 78fda6779f allow localhost host to connect to CDP and MCP 2026-08-26 09:24:01 +08:00
Pierre TachoireandAdrià Arrufat a0e3da6a6b Update src/mcp/HttpServer.zig
Co-authored-by: Adrià Arrufat <1671644+arrufat@users.noreply.github.com>
2026-08-26 09:24:01 +08:00
Pierre Tachoire 9db3c1bb94 mcp: enforce HTTP conditions
Apply same conditions than CDP for MCP HTTP conns:
* refuse requests including Origin header
* accept only ip as host
* ensure content-type is json for POST
2026-08-26 09:24:00 +08:00
Karl Seguin 3f155f2c4b Merge pull request #3281 from lightpanda-io/fix-orderfile-debug-build
Build: Fix linux debug build
2026-08-26 09:22:14 +08:00
Karl Seguin b8c9fa3d76 Build: Fix linux debug build
https://github.com/lightpanda-io/browser/pull/3271 broke linux debug builds
2026-08-26 09:10:49 +08:00
Karl Seguin a3ab6b0b7e glibc build version
So we're trying to limit glibc to 2.43.0 do to an issue in Zig's self-hosted
compiler. I'm on 2.44.0 and I hard-coded 2.43.0. But for anyone on a version
prior to 2.43.0, that causes issues. So this takes the host version but limits
it to 2.43.0
2026-08-26 06:47:17 +08:00
Karl Seguin 53e1db66d0 Merge pull request #3273 from lightpanda-io/driver-guidance-rendering
tools: drop the 'no rendering' claim from the driver guidance
2026-08-26 06:36:32 +08:00
Karl Seguin 64cdead237 Merge pull request #3271 from lightpanda-io/mem-vmhwm
mem: On linux CI builds, use an orderfile
2026-08-26 06:35:25 +08:00
Karl Seguin a9d93a87df Merge pull request #3264 from lightpanda-io/wpt-webdriver-keyboard
webdriver: Improve WebDriver keyboard handling
2026-08-26 06:33:59 +08:00
Karl Seguin 22e02f5070 Merge pull request #3263 from lightpanda-io/usp-invalid-escapes
webapi: URLSearchParams passes invalid percent-escapes through
2026-08-26 06:33:49 +08:00
Adrià Arrufat 5dc2535aae build: pin dev_fast to the host's glibc version, not 2.43
The explicit version only exists to force Zig's bundled CRT (zig#31272),
but it also selects symbol versions. PR #3231 added tiny-skia, which
calls acosf, and glibc 2.43 re-versioned that symbol, so the binary now
fails to load on hosts with an older glibc:

  libm.so.6: version `GLIBC_2.43' not found

Use the detected host glibc instead: still an explicit version, so the
bundled CRT is still used, but never newer than what the binary runs on.
2026-08-25 17:02:18 +02:00
Adrià Arrufat f05789353b tools: add maxBytes and strip to the html tool
An unscoped html call returned the whole document, inline scripts and
stylesheets included, with no way to cap it; markdown already had
maxBytes. The byte-capping writer moves out of markdown.zig into a shared
LimitedWriter so both tools use it, and strip reuses dump.Opts.Strip.
2026-08-25 15:53:11 +02:00
Adrià Arrufat ade731cb0b mcp: add title and annotations to tools/list
Every tool already had a short summary and a natural read-only /
destructive classification, but tools/list exposed neither, so clients
had to prompt for every call, including pure reads like getUrl.
2026-08-25 15:46:30 +02:00
Pierre Tachoire a01e148ab0 Merge pull request #3268 from lightpanda-io/mcp-http-close-after-reject
mcp: close the connection after a keep_alive=false response
2026-08-25 15:38:12 +02:00
Adrià Arrufat 4140792162 interactive: read the role attribute as a token list
ARIA `role` is a space-separated fallback list (`role="switch checkbox"`),
but interactive.zig and AXNode compared the raw attribute whole, so a
fallback list or padded value was neither interactive nor findable by
role, and the semantic tree reported the raw string as the role.

One explicitRole helper takes the first token; a blank attribute now
falls through to the implicit role.
2026-08-25 15:34:37 +02:00
Adrià Arrufat 3e8b836680 mcp: negotiate the protocol version on initialize
initialize always answered 2024-11-05 regardless of what the client asked
for. Per the spec, echo the requested version when we support it and
otherwise reply with the newest we do (2025-11-25).
2026-08-25 15:30:26 +02:00
Karl Seguin 2929660ae7 Merge pull request #3272 from lightpanda-io/fix-make-test-filter
Makefile: fix test filtering
2026-08-25 21:24:19 +08:00
Adrià Arrufat 4583066b2f tools: drop the 'no rendering' claim from the driver guidance
The engine renders PNGs since #3231. What is still true for the model is
that no tool exposes pixels, so say that instead.
2026-08-25 15:24:01 +02:00
Adrià Arrufat 04484f287f Makefile: fix test filtering
- Stop re-exporting command-line variables via MAKEFLAGS: tikv-jemalloc-sys's
  build script appends its jobserver flags after the inherited "-- F=..."
  separator, so a cold cargo cache failed with "No rule to make target '-j'"
  whenever any VAR=value was passed to make.
- `TEST_FILTER=... make test` was silently clobbered by the empty F and ran
  the full suite; fall back to the environment value when F is unset.
2026-08-25 15:16:02 +02:00
Karl Seguin ee1fd9207c mem: On linux CI builds, use an orderfile
CI build, for e2e-test and nightly now build with:
-Dorderfile/lightpanda.ld

This file informs the build on how to organize the code in the binary, grouping
hot code together so that we have to load less of the binary into memory.

lightpanda.ld will drift: we'll refactor our code, add new features, update
dependencies, update Zig, ... So it has to be re-generated. But we can do that
automatically in the CI (say, before the nightly build). That's for a follow up
PR.

This does not currently cover V8. V8 is being build with
`-no-unique-section-names`, so we don't get names that we can correctly
organize. The real win comes from doing this in V8, since a lot of V8 is cold.
This PR can land as-is, a zig-v8-fork PR will remove that flag, and then we can
have a follow up PR with an lightpanda.ld that includes the v8 symbols.

This is opt-in (via the -Dorderfile flag) because it adds ~20 seconds of
linking time.
2026-08-25 21:02:31 +08:00
Adrià Arrufat f37d96c285 css: compare visibility keyword values case-insensitively
CSS keywords are ASCII case-insensitive, but StyleManager matched
display:none / visibility:hidden|collapse / opacity:0 / pointer-events:none
with exact String.eql, so `style="DISPLAY: NONE"` or a `.x { Visibility:
Hidden }` rule left the element visible to checkVisibility,
getComputedStyle, the semantic tree and interactiveElements.

Compare at the check sites via a new String.eqlSliceIgnoreCase rather than
lowercasing declared values, which would corrupt content, url() and custom
property values that el.style must reflect verbatim.
2026-08-25 14:53:35 +02:00
Halil Durak 08219f91d6 Merge pull request #3230 from lightpanda-io/nikneym/mimic-image-fetch
Introduce `--load-resources`, supporting `image` parameter
2026-08-25 14:41:21 +03:00
Halil Durak ef7dc313e6 update tests 2026-08-25 14:20:39 +03:00
Halil Durak eb9080be16 Session: update stale comment 2026-08-25 14:20:39 +03:00
Halil Durak f07f818d2f Image: fix generation update order 2026-08-25 14:20:39 +03:00
Halil Durak 87a87ba62e HttpClient: remove pending_low_queue, separate keys for headers_only in cache, more eager connection reuse 2026-08-25 14:20:38 +03:00
Halil Durak 3265d66052 change how --load-resources are provided from CLI 2026-08-25 14:18:47 +03:00
Halil Durak 9b9ecedc7d Image: cover src changes on attributeRemove 2026-08-25 14:18:47 +03:00