Commit Graph

6430 Commits

Author SHA1 Message Date
Adrià Arrufat
cd830a7152 agent: add end-to-end tutorial 2026-05-12 10:20:50 +02:00
Adrià Arrufat
13fc1ee044 refactor: optimize agent tool handling and browser helpers
- Omit tool definitions when tool_choice is none to reduce request size.
- Skip tool argument stringification in low-verbosity modes.
- Optimize capToolOutput to avoid large memory copies during truncation.
- Introduce requireFrame and renderJson helpers in browser tools.
- Use a pre-computed tool names array for faster lookups.
2026-05-12 09:59:26 +02:00
Adrià Arrufat
19f8a1a2e5 config: handle agent mode in disableSubframes 2026-05-12 09:00:07 +02:00
Adrià Arrufat
7d312ce5e9 Merge branch 'main' into agent 2026-05-12 08:56:29 +02:00
Karl Seguin
e9b2aa4946 Merge pull request #2426 from lightpanda-io/feat/cdp-disable-iframes
Feat/cdp disable iframes
2026-05-12 13:16:16 +08:00
Karl Seguin
cdfabf7953 Minor tweaks
Remove repeating description/comment of flag.

Change CDP lp command to be a general configuration endpoint.
2026-05-12 12:56:33 +08:00
Karl Seguin
353cf45b38 Merge pull request #2425 from lightpanda-io/subcommand_help
Add per-subcommand help via `help` or `--help` argument
2026-05-12 10:52:44 +08:00
Karl Seguin
5c7097b6a0 Merge pull request #2394 from lightpanda-io/custom_element_reactions
CustomElement Reactions
2026-05-12 10:49:46 +08:00
Karl Seguin
235f1cd9bc Merge pull request #2386 from lightpanda-io/improve_elementFromPoint
optimize elementFromPoint
2026-05-12 10:49:30 +08:00
Karl Seguin
58e7e72459 Merge pull request #2409 from lightpanda-io/abortsignal_any
add AbortSignal.any static + AbortSignal reason can be a DOMException
2026-05-12 10:49:09 +08:00
Karl Seguin
f705d8b8e9 Merge pull request #2412 from lightpanda-io/events
Improve events
2026-05-12 10:48:56 +08:00
Karl Seguin
45b1cc4762 Merge pull request #2411 from lightpanda-io/htmlcollection_string_indexer
Fix HTMLCollection
2026-05-12 10:48:44 +08:00
Adrià Arrufat
21e2ddfb88 browser: add filtered interactive element search
Optimizes element lookup by filtering during the DOM walk and skipping
expensive name resolution. Also avoids redundant page navigation.
2026-05-11 22:31:31 +02:00
Francis Bouvier
31ef5246bc Add per-subcommand help via help or --help argument
`lightpanda <subcommand> help`, `lightpanda <subcommand> --help`
now print only the relevant subcommand options plus common options,
instead of the full text.

`lightpanda help <subcommand>` is also supported
(and that's what use internally).
2026-05-11 22:16:52 +02:00
Adrià Arrufat
77decef889 mcp: optimize line matching in script heal 2026-05-11 20:34:28 +02:00
Adrià Arrufat
2078d332c2 agent: update zenai and tool call handling 2026-05-11 20:28:34 +02:00
Adrià Arrufat
45da2c8196 refactor: localize keyword check and simplify command tests 2026-05-11 20:08:38 +02:00
Adrià Arrufat
c41955ade3 script: move script module to root src directory 2026-05-11 19:56:36 +02:00
Adrià Arrufat
1a84f56160 refactor: relocate PandaScript and improve agent reliability
Moves script logic to `browser/script/` for shared use. Implements
message rollback on API failure, caches environment variables, and
fixes a potential panic in the spinner.

- Relocate Command, Recorder, and Verifier to `src/browser/script/`
- Implement message rollback on API and synthesis failures in Agent
- Cache `LP_*` environment variables process-wide with mutex protection
- Fix potential panic in Spinner during backward clock jumps
- Improve Recorder to handle write failures and multi-line comments
- Update documentation regarding attachments and path safety
2026-05-11 19:49:15 +02:00
Adrià Arrufat
c1b4c0e52e agent: report recording status and refine verification 2026-05-11 18:56:34 +02:00
Adrià Arrufat
5ef6afbd06 Merge pull request #2422 from lightpanda-io/isocline
agent.terminal: replace linenoise with isocline
2026-05-11 18:35:12 +02:00
Pierre Tachoire
0171a111a7 Merge pull request #2421 from lightpanda-io/agent-nightly
ci: add agent pre-release nightly build
2026-05-11 18:34:16 +02:00
Pierre Tachoire
6a12ce7d0f ci: invalidate cloudfront cache after build 2026-05-11 18:18:39 +02:00
Pierre Tachoire
f33f35d158 ci: add agent pre-release nightly build
This ci would be deleted once agent branch is merged.
2026-05-11 18:08:54 +02:00
Adrià Arrufat
08dde25923 terminal: simplify slash command argument analysis 2026-05-11 17:52:49 +02:00
Adrià Arrufat
aa9304f150 terminal: add inline hints for commands 2026-05-11 17:52:49 +02:00
Adrià Arrufat
30af107e04 terminal: improve tab-completion with starters and arg hints 2026-05-11 17:52:49 +02:00
Adrià Arrufat
9050bd06d7 agent: add help text for /help and /quit commands 2026-05-11 17:52:49 +02:00
Adrià Arrufat
5df501f419 agent: improve command syntax error handling in REPL 2026-05-11 17:52:49 +02:00
Adrià Arrufat
729de62012 test: add keywordSyntax and isAllUpper tests
Adds unit tests for command keyword parsing and string casing. Also removes the unused `history_path` field from the `Terminal` struct.
2026-05-11 17:52:49 +02:00
Adrià Arrufat
82f6b4c002 terminal: improve repl completion and highlighting 2026-05-11 17:52:49 +02:00
Adrià Arrufat
98b082ddc1 terminal: improve REPL prompt, completion, and highlighting
- Cache environment variable names to improve completion performance.
- Refactor terminal styles into constants.
- Move `isAllUpper` to `string.zig` and `meta_names` to `SlashCommand.zig`.
- Align quoted string scanning logic with the slash command parser.
2026-05-11 17:52:49 +02:00
Adrià Arrufat
1abf05aec7 agent: unify command keywords and simplify env listing
Centralizes PandaScript keywords in Command.zig as a single source of
truth for the parser and REPL. Simplifies environment variable listing
and formatting in tools.zig.
2026-05-11 17:52:49 +02:00
Adrià Arrufat
e962ba9575 refactor: simplify terminal prompt and enable brace insertion
- Simplify prompt handling by relying on default markers.
- Enable brace insertion in the terminal.
- Optimize `lpEnvNames` by pre-allocating capacity.
- Clean up and trim verbose comments across `Terminal.zig`.
2026-05-11 17:52:49 +02:00
Adrià Arrufat
6da9497fda repl: add syntax highlighting and completions 2026-05-11 17:52:49 +02:00
Adrià Arrufat
5d70174288 terminal: replace linenoise with isocline
Replaces the linenoise library with isocline for improved REPL
functionality. Updates build scripts and moves completion state from
global variables into the Terminal struct.
2026-05-11 17:52:49 +02:00
Adrià Arrufat
75b7a8ec6d Merge branch 'main' into agent 2026-05-11 17:52:35 +02:00
Karl Seguin
e56bd0862a Merge pull request #2419 from lightpanda-io/nix-flake-update
Update Nix Flake
2026-05-11 22:59:00 +08:00
Karl Seguin
3733abbf8a Merge pull request #2413 from lightpanda-io/small_dom_fixes
Various small DOM fixes, WPT driven
2026-05-11 21:58:01 +08:00
Karl Seguin
fe729f8b1f CustomElement Reactions
While this PR touches a lot of files, and isn't trivial, many of the changes
are either:
1 - removing guards added in previous PRs, e.g.
    https://github.com/lightpanda-io/browser/pull/1969
    https://github.com/lightpanda-io/browser/pull/2172
    https://github.com/lightpanda-io/browser/pull/2313
    https://github.com/lightpanda-io/browser/pull/2366

2 - Adding the `.ce_reactions = true` flag to various WebAPIs

CustomElements have callbacks, e.g. connectedCallback. Also, many WebAPI calls
are implemented as a series of mutations, e.g. appendChild = remove from current
+ append to new.

These two things interact in an important way: when should callbacks execute?
Before this PR, we were invoking callbacks at each individual step. This is
(a) technically wrong and (b) breaks a lot of assumptions (the reason the above
4 PRs were needed to fix bugs).

This PR adds a `_ce_reactions` queue to the frame. And, instead of invoking
callbacks, we "enqueue" the reaction. At various boundaries, a scope is created
the DOM manipulation is done, and then we pop the scope, invoking all queued
reactions.
2026-05-11 21:50:24 +08:00
Muki Kiboigo
105f5028c8 update nix flake 2026-05-11 06:50:03 -07:00
Karl Seguin
b79870e07a Merge pull request #2414 from lightpanda-io/test_timeout_config
Allow HTML Tests to set a timeout
2026-05-11 21:49:57 +08:00
Karl Seguin
082994c331 Allow HTML Tests to set a timeout
Change worker timeout to 8seconds. This test can be slow on a slow CI with
TSAN enabled.
2026-05-11 21:30:25 +08:00
Karl Seguin
6fa1fe12a5 Merge pull request #2235 from lightpanda-io/nikneym/cli-script-eval
`fetch`: add support for `--inject-script` and `--inject-script-file` options
2026-05-11 21:24:50 +08:00
Karl Seguin
8bea867e5f Merge pull request #2406 from navidemad/parser-defer-rawtext-merge
parser: defer raw-text merge to bound memory growth
2026-05-11 21:05:39 +08:00
Karl Seguin
258003ca90 ArrayListUnmanaged (deprecated name) -> ArrayList 2026-05-11 20:42:11 +08:00
Navid EMAD
a470f6b686 parser: lift merge buffer onto Parser and lazy-buffer single-chunk runs
Addresses follow-up review from karlseguin on #2406.

The pending-text merge buffer is now a single ArrayList on the Parser,
reused across runs via clearRetainingCapacity. In the streaming-parser
case (Document.write), parser.arena is the page-lifetime frame.arena, so
the previous per-PendingText buf.deinit was a no-op and growth artifacts
accumulated. With one shared buffer, total dead memory is bounded to one
peak-run-sized allocation regardless of how many text runs the parse
contains.

Single-chunk text runs no longer touch the buffer. The first chunk lives
only on CData._data via createTextNode; the buffer is seeded from
text_node.getData().str() only when a second chunk arrives at the same
parent and last_child. flushPendingText is a no-op when the buffer is
empty. Restores the common-case allocation count to 1 (matching main),
vs 3 in the previous PR head.

Benchmark deltas (ReleaseFast, peak RSS, 5-run median):
- 10K-paragraph synthetic page: 39 MB -> 37 MB
- 20K single-chunk script synthetic: 56 MB -> 54 MB
- 100 x 48 KB multi-chunk scripts: within noise (~46 MB)
- apple.com US iPhone live page: within JS-driven noise (~92 MB)

Refs #2397
2026-05-11 14:36:40 +02:00
Karl Seguin
cfcfe4ee29 Merge pull request #2417 from lightpanda-io/nikneym/dummy-set-resource-timing-buffer-size
`Performance`: add dummy `setResourceTimingBufferSize`
2026-05-11 20:31:17 +08:00
Halil Durak
5faaf3dc15 --inject-script: testable injected scripts 2026-05-11 15:24:28 +03:00
Halil Durak
3c7c08f822 --inject-script: don't error out if script execution fails 2026-05-11 15:24:08 +03:00