Commit Graph

5421 Commits

Author SHA1 Message Date
Adrià Arrufat
693db15281 browser: support markdown scoping and truncation
Adds `selector`, `backendNodeId`, and `maxBytes` options to the
`markdown` tool. This allows rendering specific subtrees and capping
large outputs. Also updates the agent guidance to prefer scoped reads.
2026-05-26 16:06:42 +02:00
Adrià Arrufat
7149bf3f5f Schema: reject duplicate fields in buildValue 2026-05-25 20:22:44 +02:00
Adrià Arrufat
c59872bfb9 eval: isolate scripts and support top-level return
Wrap eval scripts in block scope to prevent let/const leaks. If a
top-level return error occurs, retry execution inside an IIFE.
2026-05-25 19:49:43 +02:00
Adrià Arrufat
8abbd6d9c0 Script: handle duplicate argument keys and URL query params 2026-05-25 19:25:58 +02:00
Adrià Arrufat
9b4a48e07f Merge branch 'main' into agent 2026-05-25 18:18:55 +02:00
Adrià Arrufat
6e7a4420e3 terminal: deduplicate error and warning printing
Extracts the common printing logic from `printError` and `printWarning`
into a new `printSeverity` helper function.
2026-05-25 18:18:20 +02:00
Adrià Arrufat
fbec560292 Ref: #123
fix: address various stability and reliability issues

- Cache stderr TTY check in Config to optimize log hot path.
- Cap signal handler attempts during no-hard-exit.
- Always duplicate URL segments to prevent invalid frees.
- Write live file before backup in atomic writes.
- Settle microtasks before verifying DOM elements.
2026-05-25 18:05:11 +02:00
Adrià Arrufat
4bc5baf7ee agent: improve command diagnostics and fix various bugs
- Add diagnostics to command parsing to report invalid field values.
- Fix UTF-8 truncation in spinner to avoid splitting codepoints.
- Fix swapped arguments in log error formatting.
- Distinguish "null" values from missing elements in verifier.
- Handle MCP tool cancellation and timeouts with specific error codes.
2026-05-25 17:51:46 +02:00
Adrià Arrufat
4ad59b07b3 console: use warn severity for console.warn 2026-05-25 17:40:06 +02:00
Adrià Arrufat
7532cd1df4 session: cap console message size to remaining budget 2026-05-25 17:39:49 +02:00
Adrià Arrufat
8ca2975b1d browser: catch implicit form submit error on Enter
Prevents form submission failures from blocking the subsequent keyup
event, which could cause UIs waiting on keyup to hang.
2026-05-25 17:37:15 +02:00
Adrià Arrufat
e519d84318 tools: default checked to true in execSetChecked 2026-05-25 17:36:06 +02:00
Adrià Arrufat
df5fbf4bc3 command: require locator for null args in isRecorded
Tool calls like click or hover with null arguments are unreplayable
and should not be considered recorded, even if they have zero
required fields.
2026-05-25 17:33:08 +02:00
Karl Seguin
9dc81f129c Merge pull request #2538 from lightpanda-io/feat-implement-file-api
Feat implement file api
2026-05-25 12:10:41 +08:00
Karl Seguin
d3c5c31a93 deduplicate File and Blob init 2026-05-25 11:36:17 +08:00
Karl Seguin
dc4218159a Merge pull request #2523 from navidemad/fix/2363-about-blank-replaces-document
Replace active page on synthetic root navigation (about:blank, blob:)
2026-05-25 09:19:30 +08:00
Karl Seguin
43a592d2fc small dedupe for arena release 2026-05-25 09:05:37 +08:00
Adrià Arrufat
adc76d2cc1 agent: fix tool output capping and tokenizer escape handling
- Limit UTF-8 walkback in `capToolOutput` to 3 bytes to prevent
  excessive scanning on malformed input.
- Track consecutive backslashes in `tokenize` to correctly handle
  even-count backslashes before a closing quote.
2026-05-24 12:18:05 +02:00
Adrià Arrufat
634566f4b8 agent: truncate tool output at UTF-8 boundary 2026-05-24 11:48:22 +02:00
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
Karl Seguin
43102317aa Merge pull request #2524 from willmafh/auth_challenge_parse_bugfix
bugfix: get scheme correctly when there is any leading whitespace
2026-05-24 16:44:00 +08: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
Armaan Sandhu
a7e3bea672 feat(webapi): implement W3C File API 2026-05-24 13:04:33 +05:30
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
willmafh
2d48926f1e bugfix: get scheme correctly when there is any leading whitespace 2026-05-23 12:39:34 +08: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