Commit Graph

6809 Commits

Author SHA1 Message Date
Adrià Arrufat
aed5bbf1b6 schema: reject backslash escapes in quoted values
Explicitly reject backslash-escaped quotes with a clear error
message, suggesting alternative quote styles or triple quotes.
Bare backslashes (e.g. in Windows paths) remain supported.
2026-05-24 11:35:07 +02:00
Adrià Arrufat
4a58a9043e tools: reject invalid backendNodeId in tree tool 2026-05-24 11:25:41 +02:00
Adrià Arrufat
d469fdc88c tools: normalize PascalCase argument keys from LLMs 2026-05-24 11:22:42 +02:00
Adrià Arrufat
bd861f5ac0 mcp: rename tools to camelCase 2026-05-24 11:13:56 +02:00
Adrià Arrufat
1151e03181 mcp: index multi-line blocks as single spans
Detects multi-line block openers (e.g., `/eval '''`) and indexes the
entire block up to its closing fence as a single span. This prevents
body lines from being indexed individually and orphaned during splicing.
Falls back to single-line indexing if the block is unterminated.
2026-05-24 10:31:08 +02:00
Adrià Arrufat
3381f64ad9 mcp: handle CRLF line endings in indexLines
Strip carriage returns from CRLF line endings before indexing so that
LLM-supplied keys (using plain LF) match files saved with Windows
line endings. The span still covers the full CRLF sequence.
2026-05-24 09:00:31 +02:00
Adrià Arrufat
09698045c6 tools: refuse getCookies without active page
Return an error message instead of dumping all cookies when no page
is loaded and no filter is provided.
2026-05-24 09:00:19 +02:00
Adrià Arrufat
0c58184137 Cookie: make host matching case-insensitive 2026-05-24 08:46:55 +02:00
Adrià Arrufat
525c3e467c input: centralize password value redaction
Introduces `Input.getRedactedValue` to mask password values in
LLM-facing dumps (semantic tree, forms, AXNode) instead of
exposing raw values or using ad-hoc checks.
2026-05-24 08:36:23 +02:00
Adrià Arrufat
ddd9c84195 agent: update zenai and tune agent settings 2026-05-23 23:36:07 +02:00
Adrià Arrufat
8721bfb69e Spinner: prevent line wrapping and multi-line breaks
Strips control characters from tool arguments to avoid breaking the
carriage-return redraw. Queries the terminal width and truncates
arguments to fit on a single row, appending an ellipsis if needed.
2026-05-23 17:22:47 +02:00
Adrià Arrufat
6a0801a6f6 agent: add user turn before slash tool call
Gemini requires that a function call follow a user or function-response
turn. Record the user input before the synthetic assistant tool call.
2026-05-23 14:46:32 +02:00
Adrià Arrufat
4c06fe482f agent: record slash commands as tool calls
Mirrors user-typed slash commands into the message history as synthetic
tool calls. This ensures the LLM conversation remains in sync and the
next prompt can see the action's result.
2026-05-23 11:54:48 +02:00
Adrià Arrufat
0670823905 script: rename mcp_driver_guidance to driver_guidance
Rename the system prompt constant to reflect its broader usage.
Also add instructions to guide the agent on handling follow-up
questions after navigation.
2026-05-23 11:24:36 +02:00
Adrià Arrufat
424f315f27 browser: fix premature timeouts and handle eval navigation
- In Runner, sleep and poll on idle tick instead of failing early.
- In tools, await queued navigations after eval and report the new page.
2026-05-23 10:52:24 +02:00
Adrià Arrufat
70b9b6f958 Merge branch 'main' into agent 2026-05-22 23:34:36 +02:00
Adrià Arrufat
f8d12cf4b5 schema: test parseValue with embedded single quotes 2026-05-22 22:38:48 +02:00
Adrià Arrufat
1bb506761c tools: support selector and backendNodeId in html tool
Allows dumping a specific element's outerHTML instead of the full
document when a selector or backendNodeId is provided.
2026-05-22 22:35:54 +02:00
Adrià Arrufat
2defc0e829 tools: add html tool to dump raw page HTML
Adds a new `html` tool to dump the full raw HTML of the current page.
This is useful for debugging and capturing fixtures.
2026-05-22 22:31:34 +02:00
Adrià Arrufat
056912bbee browser: add waitForScript tool
Adds a new `waitForScript` tool to wait for a JS expression to
evaluate to truthy. This allows synchronization beyond what CSS
selectors can express.
2026-05-22 22:23:50 +02:00
Adrià Arrufat
312276f968 browser: normalize keys and support form submit in press
- Map common key shorthand aliases to canonical KeyboardEvent keys.
- Trigger implicit form submission when pressing Enter on inputs.
- Add CSS selector support to the press tool.
2026-05-22 22:16:56 +02:00
Adrià Arrufat
4e69be8543 tools: add filtering options to getCookies
Allows filtering cookies by URL or dumping all cookies. Defaults to
cookies matching the current page's host.
2026-05-22 22:05:36 +02:00
Adrià Arrufat
f917a7adfc terminal: simplify print API and add printDimmed
Unifies printInfo/printInfoFmt and printError/printErrorFmt into
single functions accepting format arguments. Adds printDimmed for
dimmed output and supports highlighting quoted slash arguments.
2026-05-22 21:49:41 +02:00
Adrià Arrufat
5454f2b2c2 terminal: disable completions inside triple quotes 2026-05-22 21:15:14 +02:00
Adrià Arrufat
4d283ae21c terminal: improve colors and help formatting
- Remove automatic dimming from `printInfoFmt`
- Add explicit ANSI formatting to slash command help
- Adjust syntax highlighting colors for terminal output
2026-05-22 20:56:35 +02:00
Adrià Arrufat
005e489870 schema: make argument keys case-insensitive
Normalizes parsed keys to their canonical casing defined in the schema
for both KV and JSON inputs.
2026-05-22 20:29:45 +02:00
Adrià Arrufat
d4f4be704d repl: categorize help and centralize LLM checks
- Group `/help` output into Browser, LLM, and Meta commands.
- Only show LLM commands in help if an LLM client is configured.
- Centralize the check for commands requiring an LLM in the REPL loop.
- Add descriptions to meta and LLM commands.
2026-05-22 20:24:24 +02:00
Adrià Arrufat
0049480f04 Merge pull request #2528 from lightpanda-io/parseargs-error-detail
terminal: better error diagnostics
2026-05-22 20:10:07 +02:00
Adrià Arrufat
91916b7aae repl: sort slash commands alphabetically in help 2026-05-22 20:09:56 +02:00
Adrià Arrufat
c30ccae5fb terminal: improve log routing and navigation error reporting
- Route logs through a terminal sink to avoid trampling the spinner.
- Track and format the last navigation error in browser tools.
2026-05-22 19:58:02 +02:00
Adrià Arrufat
0219ee66b7 tools: add argument diagnostics
Validate tool arguments like `waitUntil` before parsing to provide
clearer error messages with expected enum values.
2026-05-22 19:33:53 +02:00
Adrià Arrufat
2669e3223f browser: add cooperative cancellation support
Allows SIGINT to abort in-flight browser operations and V8 execution.
2026-05-22 19:22:46 +02:00
Adrià Arrufat
aef2c1326d Merge pull request #2527 from lightpanda-io/waitforselector-notfound
tools: map waitForSelector timeout to NodeNotFound
2026-05-22 19:13:17 +02:00
Adrià Arrufat
f7a4d1f6e2 terminal: unify tool and action result printing
Replaces `printActionResult` and `printToolResult` with a single
`printToolOutcome` function. This unifies the output path and adds
red/green color coding for tool failures and successes.
2026-05-22 19:05:46 +02:00
Adrià Arrufat
db14d0be1b tools: map waitForSelector timeout to NodeNotFound
When a selector times out without matching, the outcome is the same as
/hover or /click against a missing node. Returning InternalError instead
gave inconsistent feedback to the agent.

Map error.Timeout to NodeNotFound and leave the catch-all log +
InternalError for genuinely unexpected errors. Tighten the existing
MCP - waitForSelector: timeout test to pin the specific error name.
2026-05-22 18:47:46 +02:00
Adrià Arrufat
033df65c53 Merge pull request #2526 from lightpanda-io/reset-node-registry
browser: reset node registry on navigation
2026-05-22 18:18:58 +02:00
Adrià Arrufat
3b285df432 browser: reset node registry on navigation
When an action triggers a navigation that swaps the root frame, the
previous page is torn down, leaving dangling DOMNode pointers in the
registry.

Reset the registry in `finalizeAction` if the frame changes to prevent
subsequent actions from dereferencing freed memory.
2026-05-22 17:32:17 +02:00
Adrià Arrufat
9c3d470ad2 Merge pull request #2520 from lightpanda-io/unify-pandascript-repl
script: unify PandaScript to slash commands
2026-05-22 17:05:58 +02:00
Adrià Arrufat
96c16defdd refactor: apply minor cleanups and improvements
- Add `/.lp-history` to `.gitignore`.
- Make `SlashCommand.MetaCommand.Tag` private.
- Simplify loop in `tools.zig` using `while ... else`.
- Use `trimStart` instead of `trim` in `Schema.splitNameRest`.
2026-05-22 16:38:46 +02:00
Adrià Arrufat
1309407e01 script: unify heal formatting and move TTY helpers
- Merge `formatHealReplacement` and `formatHealReplacementLines` using
  a new `HealBody` union.
- Move `interactiveTty` and `promptNumberedChoice` to `Terminal.zig`.
- Relocate and consolidate tests for `canHeal` and `isRecorded`.
- Make internal `Schema` functions private.
2026-05-22 16:19:46 +02:00
Pierre Tachoire
9619738111 Merge pull request #2517 from navidemad/makefile/download-v8
Add `make download-v8` to fetch prebuilt V8 and skip the source build
2026-05-22 15:53:48 +02:00
Adrià Arrufat
486d0d53a9 agent: inline CommandRunner and simplify Command union 2026-05-22 15:50:36 +02:00
Adrià Arrufat
3a792c7c1c command: centralize slash command parsing and retry logic 2026-05-22 15:17:59 +02:00
Navid EMAD
47bebded55 Point download-v8 at the cache directly, drop the v8/ symlink
The prebuilt archive already lives at .lp-cache/prebuilt-v8/<version>.a;
the v8/libc_v8.a symlink was redundant indirection. build.zig has no
implicit lookup, so the Makefile passes -Dprebuilt_v8_path explicitly
anyway. Point it straight at the cached file, dropping the symlink step,
the v8/ dir, and its .gitignore entry. Keep the version-keyed filename so
bumping the V8 pin fetches a new file instead of clobbering.
2026-05-22 15:16:57 +02:00
Karl Seguin
9d6dcb71ab Merge pull request #2521 from lightpanda-io/multi_remove_assert_attributes
Add more attributes to multi_remove assertion failure
2026-05-22 20:12:53 +08:00
Adrià Arrufat
8fb3c7baed tools: restructure browser tools and script schemas
- Replace `Action` enum with `Tool` enum using exhaustive switches
- Extract `ScriptIterator` to `Iterator.zig`
- Refactor `schema.zig` into `Schema.zig`
- Move string substitution logic into `tools.zig`
- Clean up `SlashCommand.zig` to only handle REPL meta-commands
2026-05-22 13:41:04 +02:00
Pierre Tachoire
8b2a79d93a Merge pull request #2515 from lightpanda-io/cdp_watchdog 2026-05-22 13:19:48 +02:00
Karl Seguin
38a4a334fd Add more attributes to multi_remove assertion failure
Saw this assertion catch for the first time today. Hoping the extra data will
help identity the issue. No URL or other identifiable data is logged.
2026-05-22 16:10:11 +08:00
Adrià Arrufat
6cd75c454e script: optimize hint allocation and inline helper
Calculate the exact size needed for hint slots in schema.zig to avoid
overallocating. Also inline the single-use helper isDefaultTrueBool in
command.zig.
2026-05-22 09:23:52 +02:00
Adrià Arrufat
fec1909aa1 script: strip backendNodeId and fix error line reporting
- Allow recording commands with backendNodeId if they also have a
  selector, stripping backendNodeId during formatting.
- Point UnterminatedQuote errors to the opening line instead of EOF.
- Fix buildHints allocation when fields is empty but required is not.
- Update docs to clarify positional argument rules.
2026-05-22 09:18:32 +02:00