Commit Graph

8486 Commits

Author SHA1 Message Date
Adrià Arrufat
39924dcd8e Agent: record navigating read tools as goto commands 2026-06-16 00:03:12 +02:00
Adrià Arrufat
7e5777b3e7 Merge branch 'agent' into agent-page-syntax 2026-06-15 23:16:36 +02:00
Adrià Arrufat
78dfc03007 agent: probe Ollama reachability for completions
Lazily probes and caches Ollama server reachability for `/provider`
autocomplete. Validates Ollama availability when manually setting
the provider. Updates zenai dependency.
2026-06-15 23:13:56 +02:00
Adrià Arrufat
e7cfc2f72a agent: avoid double Ollama probe at startup
Renames `wouldResolve` to `hasDetectableKey` and removes the Ollama
probe from it. Defers printing the welcome banner for Ollama-only
paths to prevent probing the local server twice. Also bumps zenai.
2026-06-15 22:56:20 +02:00
Adrià Arrufat
21477b39c9 script: introduce Page API with async goto
Replaces global blocking functions with a `Page` class. `page.goto` is
now asynchronous and must be awaited, while other methods remain
synchronous. Scripts are wrapped in an async IIFE to support top-level
await, and output is returned via `return <value>`.
2026-06-15 22:48:12 +02:00
Adrià Arrufat
7a9924ab22 Agent: support HF_BILL_TO for Hugging Face
Passes the `HF_BILL_TO` environment variable to the ZenAI client
to route Hugging Face billing to an organization. Also updates
the `zenai` dependency.
2026-06-15 19:27:58 +02:00
Adrià Arrufat
3e5294318c Agent: add support for Huggingface inference
Updates the zenai dependency to the latest commit and adds HF_TOKEN to
the API keys hint.
2026-06-15 19:12:05 +02:00
Muki Kiboigo
515ae12ab4 free cached response data on eviction 2026-06-15 07:31:30 -07:00
Muki Kiboigo
f4db7c7e94 send both etag and last modified if present on revalidation 2026-06-15 07:20:21 -07:00
Muki Kiboigo
be3aadf739 clean stale entry on error or shutdown if present 2026-06-15 07:20:21 -07:00
Muki Kiboigo
83a690cdf9 fix max-age tracking on no-cache directive 2026-06-15 07:20:18 -07:00
Karl Seguin
01cda6d80e Merge pull request #2698 from lightpanda-io/remove_snapshot_create_fallback
bridge: Remove snapshot create fallback
2026-06-15 22:05:43 +08:00
Pierre Tachoire
21a2c2c800 Merge pull request #2697 from lightpanda-io/ci_snapshot_cache_bust
ci: Include v8 version in Snapshot cache key
2026-06-15 15:59:17 +02:00
Adrià Arrufat
2c35d760d8 Merge branch 'main' into agent 2026-06-15 15:21:54 +02:00
Adrià Arrufat
cf3cae8aa3 Merge pull request #2747 from lightpanda-io/agent-fix-save-path-reset
agent: reset save destination on /clear and /reset
2026-06-15 15:18:05 +02:00
Adrià Arrufat
e35c66c2a6 agent: reset save destination on /clear and /reset
clearConversation reset the recorded action buffer but left save_path
set, so after /clear or /reset a /save <newfile> was rejected with
"already saving to <oldfile>". Free and clear save_path alongside the
buffer so a cleared session can save to a fresh file.
2026-06-15 14:54:26 +02:00
Karl Seguin
15d4968cc8 Merge pull request #2745 from lightpanda-io/silence_a_test_log
dev: silence a test that uses/needs console
2026-06-15 17:16:08 +08:00
Karl Seguin
78d7793327 dev: silence a test that uses/needs console 2026-06-15 16:59:04 +08:00
Karl Seguin
7edf6f5eb9 webapi: Use document._frame rather than executing frame
This continues some previous fixes aimed at iframe/popup scenarios where the DOM
is manipulated from a different frame. The simplest example is:

iframe.contentDocument.domain

should return the domain of the iframe, not the domain of the context this is
being run in. For a case like this, it's easy, use self._frame rather than
the calling context's frame.

Besides these easy cases, there are two other changes here:

1 - ResolveURL has to get an Element's owning document's frame
2 - getElementById has to get the lookup from the element's document

As part of #2, `Frame.getElementByIdFromNode` was optimized to avoid the
double document lookup. Rather than calling isConnected() then finding the root
node, we can just call getRootNode().
2026-06-15 16:47:21 +08:00
Karl Seguin
98dcd12a82 Merge pull request #2735 from lightpanda-io/cdp_setExtraHTTPHeaders
Cdp set extra http headers
2026-06-15 16:21:20 +08:00
Karl Seguin
3984082c3b Merge pull request #2700 from navidemad/fix-b14-sequential-focus
webapi: run sequential focus navigation on Tab
2026-06-15 06:34:52 +08:00
Muki Kiboigo
2414a67d28 header callback returns a HeaderResult 2026-06-14 09:17:26 -07:00
Muki Kiboigo
38c2fcdf7b working cache revalid 2026-06-14 09:17:26 -07:00
Muki Kiboigo
2fd9e5231b better handling of stale entry 2026-06-14 09:17:26 -07:00
Muki Kiboigo
fff8ec8a8a send served from cache notification in one place 2026-06-14 09:17:26 -07:00
Muki Kiboigo
b99521c738 simplify CacheLayer request logic 2026-06-14 09:17:26 -07:00
Muki Kiboigo
65c8d6fe21 update CacheControl test 2026-06-14 09:17:26 -07:00
Muki Kiboigo
dd6dbd27da etag and last_modified null by default 2026-06-14 09:17:26 -07:00
Muki Kiboigo
2728cfc65e Cache.revalidate -> Cache.renew 2026-06-14 09:17:25 -07:00
Muki Kiboigo
17f3bf557b properly notify and serve from cache on revalidation 2026-06-14 09:17:25 -07:00
Muki Kiboigo
feefcd4650 Cache Revalidation 2026-06-14 09:16:33 -07:00
Muki Kiboigo
a6c8a28977 add Cache.revalidate + supporting logic 2026-06-14 09:16:31 -07:00
Karl Seguin
9ace686d1e perf: avoid excessive tabIndex lookup/parse
Store tab index for current, edge, chosen in a local, and only get/parse it
once per candidate (vs twice).
2026-06-14 21:57:03 +08:00
Karl Seguin
02115bef72 Merge pull request #2682 from navidemad/agent-discovery-signals
Surface server-side agent-discovery signals: Link response header (RFC 8288) + robots.txt Content-Signal
2026-06-14 20:31:47 +08:00
Adrià Arrufat
4147274fa8 Merge branch 'main' into agent 2026-06-14 10:28:21 +02:00
Karl Seguin
a4c5d09075 Merge pull request #2729 from navidemad/fix-a47-page-navigate-failed-response
cdp: answer Page.navigate with errorText when navigation fails
2026-06-14 13:39:43 +08:00
Karl Seguin
ed5d9213fb Merge pull request #2736 from lightpanda-io/debug_assert
debug: Use normal crash report assertion in debug
2026-06-14 13:38:53 +08:00
Karl Seguin
3dcdea77eb Merge pull request #2739 from navidemad/fix-select-type-option-label
webapi: implement HTMLSelectElement.type and HTMLOptionElement.label
2026-06-14 13:38:38 +08:00
Karl Seguin
eec06238d0 nits: just personalizing the code as a means to understand it. 2026-06-14 10:17:39 +08:00
Navid EMAD
a66c13ecf3 webapi: implement HTMLSelectElement.type and HTMLOptionElement.label
Both IDL attributes were unimplemented and evaluated to `undefined`.
`select.type` reflects the element's mode: "select-multiple" when the
`multiple` attribute is present, "select-one" otherwise (derived from the
existing `getMultiple()`). `option.label` returns the `label` content
attribute when present and non-empty, otherwise the value of the `text`
IDL attribute. Both match the HTML Living Standard.

Select-enhancement libraries branch on `select.type` to choose single- vs
multi-select code paths; reading `undefined` there made them take a dead
path and throw during initialization.

Closes #2738
2026-06-13 15:12:17 +02:00
Karl Seguin
4dbec74dfc debug: Use normal crash report assertion in debug
I don't know why I thought debug should `unreahcable` while release should
generate a crash report. The crash report always contains more info and whenever
I encounter a failed assertion in debug, the first thing I do is remove the
unreachable to get the more complete crash report.

(The crash report path skips sending the crash report in debug builds already)
2026-06-13 17:59:54 +08:00
Karl Seguin
b957ad74c4 cdp, bot: Apply user-agent validation to CDP's setExtraHTTPHeaders
This is a change to https://github.com/lightpanda-io/browser/pull/2706 which
applies the Config.validateUserAgent to CDP's network.setExtraHTTPHeaders. This
makes the CDP method consistent with all other forms of user-agent setting, i.e
not allowing 'mozilla'-container values.
2026-06-13 15:43:38 +08:00
Adrià Arrufat
48025a371f Merge branch 'main' into agent 2026-06-13 08:17:31 +02:00
Karl Seguin
ab53f92a11 Merge pull request #2731 from navidemad/fix-a48-console-log-warning-types
cdp: report console.log/console.warn with their own consoleAPICalled types
2026-06-13 12:22:34 +08:00
Karl Seguin
ead5000048 Merge pull request #2726 from navidemad/fix-navigator-gpc-default
webapi: default navigator.globalPrivacyControl to false
2026-06-13 11:42:34 +08:00
Navid EMAD
b136b3a84d cdp: report console.log/console.warn with their own consoleAPICalled types
console.log and console.warn were both dispatched as .info, so
Runtime.consoleAPICalled (and Console.messageAdded) reported type
"info" for all three of log/info/warn — clients filtering console
output by severity saw them collapsed into one bucket.

Add log/warning members to ConsoleMessageType (the protocol's wire
values — "warning", not "warn") and map console.log -> log,
console.warn -> warning. info/error/debug/trace already matched.

Closes #2730
2026-06-12 19:22:24 +02:00
Navid EMAD
c3afcc51dc cdp: answer Page.navigate with errorText when navigation fails
A root navigation that fails before any response headers arrive
(connection refused, DNS failure, TLS error) never answered the
Page.navigate command: the success reply is only sent from the
response-header path (frame_navigated), and frameErrorCallback dropped
the stored cdp_id along with the pending Page. The CDP client awaiting
the response was left hanging forever.

Dispatch a frame_navigate_failed notification from frameErrorCallback
when no response headers were processed (_http_status == null guards
against double-answering mid-body failures), and answer the pending
command with {frameId, loaderId, errorText} — matching Chrome, where
errorText is "present if and only if navigation has failed".

Closes #2728
2026-06-12 19:13:10 +02:00
Scott Taylor
723e7eb9d5 fix(cdp): validate User-Agent in Network.setExtraHTTPHeaders
A caller-supplied User-Agent overrides the built-in default and goes out
on the wire, so reject non-printable values the same way
Emulation.setUserAgentOverride and the --user-agent flag do.

We deliberately do NOT apply validateUserAgent's reserved (Mozilla)
check here: unlike the Emulation override (kept Lightpanda-branded to
keep go-rod working), setExtraHTTPHeaders is the intended,
Chrome-compatible escape hatch for setting a real browser-like
User-Agent, which by definition contains Mozilla.

Refs #2704
2026-06-12 12:28:19 -04:00
Navid EMAD
66bbce21e0 webapi: default navigator.globalPrivacyControl to false
Per https://w3c.github.io/gpc/#javascript-property the GPC signal
reflects an explicit user preference to opt out of tracking, and no
such preference is configured anywhere. Firefox defaults the property
to false; Chrome doesn't expose it at all. Returning true made
GPC-compliant consent managers treat every page load as an automated
reject-all and skip their consent UI entirely, diverging from every
default-config real browser.

Adds a value assertion next to the existing doNotTrack check in the
navigator fixture (the accessor-shape walk already covered the
property, but not its value).

Closes #2725
2026-06-12 17:46:18 +02:00
Adrià Arrufat
a1bd1a4834 Merge pull request #2702 from lightpanda-io/save_system_prompt
agent: improve save system prompt
2026-06-12 16:01:37 +02:00