Commit Graph

8347 Commits

Author SHA1 Message Date
Adrià Arrufat
04345a5149 fix: resolve agent init crash and mcp stream recovery
- Track initialized providers in Agent.zig to avoid freeing garbage
  memory on error.
- Discard the rest of the line in mcp router on StreamTooLong to
  allow processing subsequent requests.
2026-06-08 10:35:42 +02:00
Pierre Tachoire
530a9e0765 deinit FormData to release files 2026-06-08 10:26:02 +02:00
Adrià Arrufat
bf7992f904 browser: clear session slot when Session.init fails
newSession set self.session to undefined, but left it non-null if
Session.init failed. closeSession() then ran deinit() on garbage:

- double-released the arena
- read undefined fields on the never-assigned path

Add an errdefer to null the slot on failure.
2026-06-08 10:18:48 +02:00
Karl Seguin
e64aa70c34 Improve ArenaPool release debug reporting
Cherry-picked from https://github.com/lightpanda-io/browser/pull/2623 since the
main issue in that PR was directly solved by https://github.com/lightpanda-io/browser/pull/2625
but the ArenaPool change is still worth keeping. The change is: that we
check for a double-release BEFORE resetting the arena, which would cause the
invalid flow to appear in a harder-to-debug spot.
2026-06-08 15:24:27 +08:00
Karl Seguin
d11d7fdbd4 zig fmt 2026-06-08 15:10:54 +08:00
Pierre Tachoire
845dac86ba FormData: fix file leak on deletion 2026-06-08 09:10:01 +02:00
Adrià Arrufat
2a7bda3608 string: add string.isOneOf and deduplicate helpers 2026-06-08 09:04:36 +02:00
Pierre Tachoire
6aa4ef074f call the ref count release after releasing coupled data 2026-06-08 08:51:01 +02:00
Pierre Tachoire
4c06cfb17c use u8 for reference counter
Co-authored-by: Karl Seguin <karlseguin@users.noreply.github.com>
2026-06-08 08:49:07 +02:00
Matt Van Horn
e7cce250d3 fix: map password inputs to textbox accessibility role 2026-06-07 23:45:20 -07:00
Pierre Tachoire
fdf6276f39 cdp: use Frame.mouse_button consts from cdp.input.zig 2026-06-08 08:42:54 +02:00
Karl Seguin
b7c3814ece WPT /WebCryptoAPI/
I threw Claude at WPT's /WebCryptoAPI/ which represents a significant number of
failing cases.

There were a few very low-hanging fruit, like enabling CryptoKey on Worker and
supporting `{name: string}` in addition to just `string` for some functions.

Some of these "fixes" just handle the error case / validation, which tends to
represent a greater number of WPT cases, e.g. some of the importKey algorithms
aren't fully supported, but they still validate the input and return the correct
errors.

To that end, while there should be considerably more passing cases (~42K), some
of these changes merely unlocked more failing cases, so our total case count
should go up.

Claude's summary:

  1. digest {name} object fix (16→80)
  2. Symmetric importKey/exportKey/generateKey (AES, HMAC; raw + jwk) + CryptoKey
  accessors + DataError
  3. EC/OKP importKey usage validation (failure-path)
  4. PBKDF2 + HKDF deriveBits, then deriveKey
  5. ECDH generateKey + import (spki/pkcs8) + deriveBits/deriveKey
  6. AES encrypt/decrypt (CBC/CTR/GCM)
2026-06-08 14:04:15 +08:00
Karl Seguin
8b16a5a650 Merge pull request #2661 from lightpanda-io/async_action_sequence
Fire actionSequence on the next tick
2026-06-08 06:39:31 +08:00
Karl Seguin
c8df32b98a Merge pull request #2659 from rohitsux/feat/element-scroll-into-view
feat(webapi): implement Element.scrollIntoView
2026-06-07 13:55:56 +08:00
Karl Seguin
6522615e21 zig fmt 2026-06-07 12:34:30 +08:00
Karl Seguin
1ffc84d947 implement the IfNeeded part of scrollIntoViewIfNeeded 2026-06-07 12:32:39 +08:00
Rohit
e68def97b3 refactor(cdp): use named constants for mouse button values
Address review: replace the bare 0/1/2 button values in the
mousedown/release switch (Frame.zig) and the CDP button mapping
(input.zig) with named constants so the code self-documents.
2026-06-06 19:03:45 +05:30
Karl Seguin
802163308e zig fmt 2026-06-06 19:04:15 +08:00
Karl Seguin
c55dcf0484 Fire actionSequence on the next tick
Apparently, that's what's expected and not doing this can break some tests
2026-06-06 19:01:16 +08:00
Adrià Arrufat
7bcab1d840 terminal: separate normal and JS REPL history
Store normal and JS history in separate files and swap them
dynamically when toggling modes.
2026-06-06 12:44:59 +02:00
Adrià Arrufat
adec4d45f5 Merge branch 'main' into agent 2026-06-06 11:42:53 +02:00
Adrià Arrufat
c2e2717170 deps: update isocline dependency
Updates the isocline dependency to a newer commit and cleans up
redundant comments in Terminal.zig.
2026-06-06 11:07:05 +02:00
Adrià Arrufat
eb118bb1de terminal: highlight $LP_* vars inside strings
Extracts `highlightDollarVarsIn` to support highlighting within a
specific range, then applies it to JavaScript string literals.
2026-06-06 11:02:54 +02:00
Adrià Arrufat
2d574a92b1 terminal: add javascript syntax highlighting in JS mode 2026-06-06 10:53:53 +02:00
Adrià Arrufat
b009e416a6 terminal: add Ctrl-D exit confirmation
Updates the isocline dependency and implements a confirmation prompt
when pressing Ctrl-D to exit the terminal.
2026-06-06 10:42:36 +02:00
Adrià Arrufat
828abda838 terminal: support double Esc clear confirmation
Updates isocline and adds a status bar indicator when a clear
is pending after the first Esc press.
2026-06-06 09:47:00 +02:00
Pierre Tachoire
29b407bc30 Merge pull request #2653 from lightpanda-io/element_set_style
add Element.style setter
2026-06-06 09:24:13 +02:00
Adrià Arrufat
a771597caa terminal: support Backspace to exit JS mode
Updates the isocline dependency and the status bar exit hint.
2026-06-06 09:18:20 +02:00
Karl Seguin
a68598fa5d Merge pull request #2650 from lightpanda-io/fix_arena_leaks
Fix two arena leaks
2026-06-06 07:21:39 +08:00
Karl Seguin
0406451750 Merge pull request #2596 from lightpanda-io/robots-next-tick-on-sync-deny
Robots Deny on Next Tick
2026-06-06 07:21:10 +08:00
Karl Seguin
b82af40453 Merge pull request #2655 from lightpanda-io/improve_import_fail_error
Better import error return
2026-06-06 07:20:23 +08:00
Karl Seguin
50e1003be5 Merge pull request #2651 from lightpanda-io/extend_cdp_test_timeout
Extend the TCP read/write timeout from 2 second to 10.
2026-06-06 07:20:09 +08:00
Karl Seguin
c7d8cb4bb9 Merge pull request #2656 from lightpanda-io/atob_btoa
Fix atob/btoa
2026-06-06 07:19:50 +08:00
Adrià Arrufat
3342813012 build: update isocline dependency 2026-06-05 19:21:22 +02:00
Pierre Tachoire
8c1c3c93f8 couple FormData and its Files lifetime 2026-06-05 18:13:01 +02:00
Adrià Arrufat
e024c1b83b config: share enum tag helpers and add tagJsonArray
Moves `tagNames` and `tagHint` from `SlashCommand` to `Config` for reuse.
Adds `tagJsonArray` to dynamically generate JSON enum schemas, and
uses it in `tools.zig` for the `WaitUntil` enum.
2026-06-05 18:06:50 +02:00
Adrià Arrufat
30725175c1 agent: derive slash command values from enums
Use comptime reflection to generate hints and allowed values for
`/verbosity` and `/effort` commands directly from their config enums.
2026-06-05 17:36:00 +02:00
Adrià Arrufat
3f0c6f6c09 terminal: autocomplete and hint enum values
Parses `enum` constraints from the schema and uses them to provide
tab-completions and ghost hints for enum fields in the REPL.
2026-06-05 16:58:19 +02:00
Rohit
b77d0f8ed1 feat(webapi): implement Element.scrollIntoView
Element.scrollIntoView and scrollIntoViewIfNeeded were no-op stubs.
Implement them to scroll the window so the element's position is
brought into the viewport, using the element's document position (the
same source getBoundingClientRect uses) and Window.scrollTo.

This lets automation reach below-the-fold elements before interacting
with them.
2026-06-05 20:22:34 +05:30
Rohit
1776d0ea71 feat(cdp): support mouse button and clickCount in Input.dispatchMouseEvent
Input.dispatchMouseEvent ignored the button and clickCount params, and
mousePressed only fired a click event (never mousedown). Add them:

- mousePressed now fires mousedown carrying the pressed button.
- mouseReleased fires mouseup, then the button-appropriate activation
  event: click for the main button, auxclick for the auxiliary button,
  and contextmenu for the secondary (right) button.
- a clickCount of 2 additionally fires dblclick.

This unblocks right-click, middle-click and double-click interactions
for Playwright/Puppeteer scripts. Follows the mouse event work in
#2636, #2640 and #2641.
2026-06-05 20:08:46 +05:30
Adrià Arrufat
200cbe623f agent: skip network requests during initialization
Avoids network round trips during agent startup to keep it snappy.
Skips model reconciliation in REPL mode and loads the model-list
cache lazily instead of pre-warming it.
2026-06-05 16:34:29 +02:00
Muki Kiboigo
22410510db Synthetic runNextTick takes null as ctx 2026-06-05 07:26:40 -07:00
Adrià Arrufat
9d4f284c73 browser: add waitForState and default goto to load
Removes the `waitUntil` option from `goto` and other navigation tools,
making them default to the fast `load` event. Introduces a dedicated
`waitForState` tool to wait for specific load states on demand.
2026-06-05 16:26:19 +02:00
Muki Kiboigo
572267802d fire RobotsBlocked in nextTickRun 2026-06-05 07:25:32 -07:00
Muki Kiboigo
ffcdcc6e09 add optional ctx to runNextTick 2026-06-05 07:25:29 -07:00
Pierre Tachoire
6ae3233f0e form: fix no file selection case 2026-06-05 15:55:56 +02:00
Karl Seguin
c4e859d735 fix tests 2026-06-05 21:19:46 +08:00
Adrià Arrufat
97dc807810 repl: improve startup help messages 2026-06-05 15:16:41 +02:00
Adrià Arrufat
5ad664a63a agent: allow disabling LLM via /provider null
Adds support for `/provider null` to disable the LLM and persist this
preference in `.lp-agent.zon`. Subsequent REPL launches will start
in basic mode without prompting for API keys. Transient `--no-llm`
runs do not clobber the saved provider.
2026-06-05 15:12:04 +02:00
Karl Seguin
b0ebbf7b35 zig fmt 2026-06-05 20:46:48 +08:00