Commit Graph

6321 Commits

Author SHA1 Message Date
Adrià Arrufat
a5e7ec16be agent: unify interactive prompts and tool execution 2026-05-09 20:40:38 +02:00
Adrià Arrufat
1de98efbc4 agent: simplify model string ownership 2026-05-09 20:27:16 +02:00
Adrià Arrufat
5284abc3e7 agent: consolidate listModels logic into Agent.zig 2026-05-09 20:18:27 +02:00
Adrià Arrufat
938795ec8d agent: add --pick-model for interactive selection 2026-05-09 20:11:52 +02:00
Adrià Arrufat
16b83f5093 agent: add provider auto-detection and --no-llm flag 2026-05-09 19:52:42 +02:00
Adrià Arrufat
357033eb0c agent: add --list-models flag 2026-05-09 19:16:48 +02:00
Adrià Arrufat
5f2a46b311 browser: use explicit switch cases for tool actions 2026-05-09 18:27:51 +02:00
Adrià Arrufat
2b4e69b517 refactor: improve recorder and spinner state management
Moves recording state into Recorder and uses a tagged union for Spinner
state. Introduces TurnInput to simplify Agent turn processing.
2026-05-09 18:05:52 +02:00
Adrià Arrufat
7726ad4623 agent: avoid JSON round-trips in tool calls
Use `std.json.Value` directly for tool arguments instead of
stringifying and reparsing. This optimizes the hot replay path
in the agent and MCP server.
2026-05-09 17:53:41 +02:00
Adrià Arrufat
5b5e42cbaa refactor: optimize string building and unify text extraction 2026-05-09 17:47:28 +02:00
Adrià Arrufat
372c0a12a2 agent: simplify logic and cleanup comments 2026-05-08 08:23:19 +02:00
Adrià Arrufat
8e1bf69b57 Merge branch 'main' into agent 2026-05-08 08:08:39 +02:00
Karl Seguin
6e9156a86f Merge pull request #2389 from lightpanda-io/interception-layer-on-serve
InterceptionLayer only on `.serve` mode
2026-05-08 06:51:03 +08:00
Karl Seguin
97f95a992e Merge pull request #2388 from lightpanda-io/cache-clear
Add Clear to Cache and FsCache
2026-05-08 06:50:35 +08:00
Karl Seguin
ffee9e67ce Merge pull request #2377 from lightpanda-io/page_dom_version
Track DOM version on the page
2026-05-08 06:45:16 +08:00
Karl Seguin
b8674cd252 Merge pull request #2379 from lightpanda-io/setter_and_static_arity
Give setters an arity of 1
2026-05-08 06:45:00 +08:00
Adrià Arrufat
77fc818976 refactor: optimize tool calls and improve script healing 2026-05-07 20:30:49 +02:00
Adrià Arrufat
622d408d03 mcp: add verification to script_step 2026-05-07 20:18:37 +02:00
Adrià Arrufat
c6ccd83ac4 mcp: add pandascript recording and self-healing tools
Adds tools to record sessions and heal scripts over MCP. Refactors
shared logic to `script.zig` and adds a TTY spinner for the agent.
2026-05-07 20:11:40 +02:00
Muki Kiboigo
66293ebc99 only enable InterceptionLayer on .serve mode 2026-05-07 09:03:40 -07:00
Muki Kiboigo
14e1f1bcf6 add clear fn to Cache and FsCache 2026-05-07 09:00:33 -07:00
Pierre Tachoire
1131cb09ff Merge pull request #2387 from lightpanda-io/zig-fmt-ci
Fix zig fmt step in CI
2026-05-07 17:49:15 +02:00
Adrià Arrufat
7bf69a9a34 agent: remove integrated mcp server
Removes the `--mcp` flag and the internal `task` tool from the agent.
Users should use `lightpanda mcp` for external agent integrations.
2026-05-07 17:12:46 +02:00
Muki Kiboigo
e5e5f78928 fix formatting on EventTarget.zig 2026-05-07 08:10:43 -07:00
Muki Kiboigo
f54ee13b32 fix zig fmt step in CI 2026-05-07 08:09:33 -07:00
Karl Seguin
fbb8126cc4 Merge pull request #2378 from lightpanda-io/blank_navigation
Protect assertion when reload from about:blank
2026-05-07 23:00:33 +08:00
Karl Seguin
823a7c480d Merge pull request #2380 from lightpanda-io/illegal_instructor_capture_name
On Illegal Constructor, try to capture name (for logs)
2026-05-07 23:00:13 +08:00
Adrià Arrufat
16e61e342e terminal: simplify spinner access and organize ansi codes 2026-05-07 16:38:11 +02:00
Adrià Arrufat
855ab768fa terminal: show tool execution trace in spinner mode 2026-05-07 16:28:16 +02:00
Karl Seguin
d4a210c5f1 Merge pull request #2385 from lightpanda-io/avoid_script_error_double_free
On error, don't free headers
2026-05-07 22:11:58 +08:00
Adrià Arrufat
a254e4041a agent: refine verbosity levels and tool output UI 2026-05-07 16:11:28 +02:00
Adrià Arrufat
54d873e007 agent: add proactive login and silence tool errors 2026-05-07 15:51:18 +02:00
Adrià Arrufat
598a3b984b agent: add status spinner for AI turns
Adds a visual spinner to the REPL to indicate agent activity (thinking
or tool execution). Refactors terminal output to prevent interleaving
with spinner frames.
2026-05-07 15:25:26 +02:00
Adrià Arrufat
b716bfe1bc browser: improve getUrl tool description 2026-05-07 14:38:44 +02:00
Karl Seguin
61497ffe3a Merge pull request #2383 from lightpanda-io/css_static_binding
Fix binding for static (in general) and specifically for CSS.escape
2026-05-07 20:30:40 +08:00
Adrià Arrufat
8e9e82b478 cli: support short flags and hide tool results in REPL 2026-05-07 14:22:26 +02:00
Karl Seguin
a4cf214040 Merge pull request #2382 from lightpanda-io/xhr_fix_teardown_order
Fix the XHR teardown order
2026-05-07 20:05:55 +08:00
Karl Seguin
87b0c33344 Merge pull request #2384 from lightpanda-io/silence_test_warns
Silence test warnings
2026-05-07 19:50:57 +08:00
Karl Seguin
a74c5cc54c On error, don't free headers
There's ambiguity in the http_client.request() call on whether or not the caller
is responsible for freeing the header. It depends how request() fails, and it's
impossible for the caller to know. This needs a fundamental fix, but, in the
meantime, we get to pick between: a possible leak or a double free.

This commit opts for a possible leak. Why? Because overwhelmingly, if request
fails, it'll fail at a point where it will handle the free. In those cases
where it doesn't then the system is probably in trouble anyways (OOM).

(Also, as I was debugging, I noticed that the function.src() debug helper
wasn't working, so I fixed it).
2026-05-07 19:47:29 +08:00
Karl Seguin
459c7a532a Silence test warnings
https://github.com/lightpanda-io/browser/pull/2368  added more warnings on JS
callback failure. The test for these naturally trigger the logging. Silence them
during testing.
2026-05-07 18:59:46 +08:00
Karl Seguin
dd49e51f7a Fix binding for static (in general) and specifically for CSS.escape
Fixes rendering issue on:
https://jobs.gem.com/inception/am9icG9zdDpZ-UzWsyEeC6ZVEZ8l0t4s
2026-05-07 18:49:28 +08:00
Karl Seguin
783bfd3813 Fix the XHR teardown order
`releaseRef` can free the XHR instance, so anything we want to set, has to
happen before then. (It might seem like the set is meaningful if we're just
going to destroy the instance, but `releaseRef` might also _not_ destroy the
instance, and the guard is for those cases).
2026-05-07 17:48:34 +08:00
Adrià Arrufat
0de602695f refactor: rename buildJson to stringifyJson and clean up logic
- Rename `Command.buildJson` to `stringifyJson` for clarity.
- Flatten tool call recording loop in `Agent.zig` to reduce nesting.
- Extract `parseValue` helper in `tools.zig` to reduce duplication.
- Optimize `substituteEnvVars` by skipping redundant string scans.
2026-05-07 11:00:33 +02:00
Adrià Arrufat
02ae92d619 agent: remove unused code and add recorder guard 2026-05-07 10:34:14 +02:00
Adrià Arrufat
25f8dfcab3 refactor: consolidate common logic and structs
- Extract `modeNeedsHttp` helper in `Config.zig`.
- Move `CallParams` to `protocol.zig` to deduplicate MCP code.
- Extract `lookupLpEnv` in `browser/tools.zig` for environment lookups.
2026-05-07 10:11:25 +02:00
Adrià Arrufat
7fb0251fff agent: simplify verification and provider checks
Removes pre-state tracking and click verification from the agent.
Consolidates provider requirement validation logic and optimizes
`applyReplacements` by pre-calculating memory capacity.
2026-05-07 10:04:35 +02:00
Adrià Arrufat
bf172bd811 refactor: consolidate browser tool helpers and optimize logic
- Extract `awaitQueuedNavigation` and `mapActionError` in `tools.zig`.
- Optimize `substituteEnvVars` using `indexOfScalarPos` to reduce copies.
- Switch to `parseFromSliceLeaky` for tool arguments parsing.
- Improve error handling in `Agent.zig` self-healing and `Recorder.zig`.
- Simplify `callEval` by adding `evalScript` helper.
2026-05-07 09:52:43 +02:00
Adrià Arrufat
5bcf90a8f9 perf: optimize terminal json parsing and env var substitution
- Skip JSON parsing in Terminal for non-JSON tool results to avoid unnecessary allocations.
- Simplify `$LP_` environment variable detection in tools.
- Update documentation comments in Agent for clarity.
2026-05-07 09:41:47 +02:00
Adrià Arrufat
87d0bc95dc agent: modularize script runner and simplify terminal state 2026-05-07 09:35:08 +02:00
Adrià Arrufat
92a0f0e290 refactor: reorder tool arguments and optimize env substitution
- Reorder `arena` and `session` arguments in tool functions.
- Optimize `substituteEnvVars` to only process `$LP_` prefixes.
- Use stack buffer for backup paths in `Agent.zig`.
- Clean up `formatActionResult` implementation.
2026-05-07 09:25:36 +02:00