Commit Graph

7145 Commits

Author SHA1 Message Date
Francis Bouvier
a97f64e084 agent: improve wording of the welcome message 2026-06-05 12:36:41 +02:00
Adrià Arrufat
157aa30bdc agent: clarify script primitives and save behavior
Updates documentation to clarify that script primitives use CSS
selectors instead of backendNodeIds. Explains how to use `/nodeDetails`
to get selectors. Clarifies the difference in `/save` behavior
between `--no-llm` and LLM modes.
2026-06-05 11:26:24 +02:00
Adrià Arrufat
d18297f204 agent: update docs for recent features and fixes
Updates documentation to reflect the new REPL status bar, JS mode,
corrected `press` syntax, and updated error messages.
2026-06-05 10:43:41 +02:00
Adrià Arrufat
3044f620b9 docs(agent): update docs for recent features and CLI flags
Updates agent-related documentation to reflect recent changes:
- Removes obsolete `follow` option from `extract` schema.
- Documents automatic printing of the script's final expression.
- Adds details on Ollama auto-detection and new CLI flags.
- Documents the `/logout` command and updated tool list.
2026-06-05 10:23:50 +02:00
Adrià Arrufat
6c9c6df3af build: update isocline dependency 2026-06-05 09:11:24 +02:00
Adrià Arrufat
19485f8640 agent: validate models for all providers
Generalizes model reconciliation to support all providers, not just
Ollama. Also updates the zenai dependency.
2026-06-04 20:01:12 +02:00
Adrià Arrufat
7eccdeed72 build: update zenai dependency 2026-06-04 19:35:03 +02:00
Adrià Arrufat
7dae410270 build: update zenai dependency 2026-06-04 19:33:11 +02:00
Adrià Arrufat
ab540e9bdf agent: auto-detect Ollama and fallback models
Probes local Ollama as a fallback provider when no API keys are set.
Swaps to an installed Ollama model if the default model is missing.
2026-06-04 18:29:29 +02:00
Adrià Arrufat
f2a7367e6d agent: verify Ollama model is installed upfront
Queries Ollama's local catalog during initialization to ensure the
requested model is installed. Aborts one-shot runs if missing, or
warns during interactive sessions.
2026-06-04 18:09:43 +02:00
Adrià Arrufat
d184327376 agent: validate model selection
Check if the selected model exists in the completion models list
before setting it, preventing invalid model configurations.
2026-06-04 18:01:25 +02:00
Adrià Arrufat
760059c085 build: update zenai dependency 2026-06-04 17:54:28 +02:00
Adrià Arrufat
3575e1f238 agent: use remembered model when provider matches
Use the remembered model whenever it matches the chosen provider,
instead of only when the provider source is `.remembered`.
2026-06-04 17:30:37 +02:00
Adrià Arrufat
e3d05aeaca browser: add CSS selector to nodeDetails
Introduces `SelectorPath` to generate a unique, minimal CSS selector
for a given element. This selector is now returned in `nodeDetails`
to simplify element targeting for drivers.
2026-06-04 16:34:56 +02:00
Adrià Arrufat
b7e3a57294 script: generalize tool argument marshalling
Replaces manual tool-by-tool argument parsing in the runtime with a
schema-driven `marshalArgs` function. This supports merging trailing
options objects with leading positional arguments (e.g., `goto(url,
options)`). Also unifies positional definitions in `Schema` for both
the runtime and the recorder.
2026-06-04 14:35:03 +02:00
Adrià Arrufat
0bb87330a7 agent: abort in-flight LLM requests on cancel
Updates the zenai dependency and integrates `zenai.http.Interrupt`
to immediately abort active LLM requests when cancellation is triggered.
2026-06-04 13:07:06 +02:00
Adrià Arrufat
a24a949028 extract: tolerate empty list selectors
An empty array is a valid result (e.g., zero comments). Only throw
an error if all schema selectors resolve to null.
2026-06-04 11:36:33 +02:00
Adrià Arrufat
05e815225d script: print completion value automatically
Automatically prints the script's final top-level expression (objects
and arrays as JSON, others coerced). Updates docs and prompts to match.
2026-06-04 10:38:02 +02:00
Adrià Arrufat
b35691bc2f script: unwrap only __root sentinel in extract
Only unwrap the `__root` sentinel injected for array schemas, ensuring
single-field object schemas retain their shape. Also update synthesis
prompt instructions for modern JS and tool fidelity.
2026-06-04 09:45:54 +02:00
Adrià Arrufat
b29f68ce82 build: bump zenai dependency 2026-06-04 08:34:32 +02:00
Adrià Arrufat
f7c2e0b886 Merge branch 'main' into agent 2026-06-04 08:34:10 +02:00
Karl Seguin
ccd201a085 Merge pull request #2602 from lightpanda-io/wait_script_cache
Add Script cache to Runner.waitForScript
2026-06-04 13:21:05 +08:00
Karl Seguin
80bf294e1c update v8 dep 2026-06-04 12:49:51 +08:00
Karl Seguin
6a0855bb41 Add Script cache to Runner.waitForScript
This adds script compilation to the Runner.waitForScript loop. The goal here
isn't really to improve waitForScript - we generally expect these scripts to
be very simple. The goal is to introduce script caching so that it could be
used in more important places (e.g. ScriptManager).

Depends on https://github.com/lightpanda-io/zig-v8-fork/pull/181
2026-06-04 12:49:51 +08:00
Karl Seguin
4426b91588 Merge pull request #2630 from rohitsux/feat/node-lookup-prefix
feat(webapi): implement Node.lookupPrefix
2026-06-04 08:26:37 +08:00
Karl Seguin
cfc3fe1443 Merge pull request #2629 from lightpanda-io/cdp-cookie-path
Cookie.PreparedUri: Use only URL.getPathname for target url
2026-06-04 07:01:18 +08:00
Adrià Arrufat
4bdc7862be browser: warn against top-level await in prompt
Updates the synthesis prompt to explicitly state that the output is
executed as a classic script, making top-level `await` a syntax error.
2026-06-03 20:14:24 +02:00
Adrià Arrufat
d06bf747f4 agent: clarify synchronous nature of primitives
Update agent.md and the LLM synthesis prompt to explicitly state
that agent primitives are synchronous and blocking, and should not
use async/await or Promises.
2026-06-03 20:11:55 +02:00
Adrià Arrufat
fded77b3a8 terminal: implement responsive status bar segments
Replaces static left/right status strings with ranked segments.
When the terminal is too narrow, segments are dropped lowest-rank
first to prevent wrapping and layout corruption.
2026-06-03 20:03:11 +02:00
Adrià Arrufat
3514a59236 extract: remove follow option from schema 2026-06-03 19:34:32 +02:00
Adrià Arrufat
585ab9f766 agent: update repl evaluation error message 2026-06-03 17:33:55 +02:00
Rohit
e830d1da4e feat(webapi): implement Node.lookupPrefix
Implement the Node.lookupPrefix(namespace) method per the WHATWG DOM
"locate a namespace prefix" algorithm: match the element's own
namespace and prefix, then scan its xmlns: attribute declarations for
one whose value is the namespace, then recurse to the parent element.

This is the inverse of the existing lookupNamespaceURI and completes
the namespace-introspection trio alongside isDefaultNamespace.
2026-06-03 21:03:27 +05:30
Adrià Arrufat
5dd37af123 tools: rename eval tool to evaluate 2026-06-03 17:30:25 +02:00
Adrià Arrufat
1f85cdf31c Terminal: enable path completions for /save
Enables filesystem path completions and ghost hints for the `/save`
command, matching the behavior of `/load`.
2026-06-03 17:19:12 +02:00
Adrià Arrufat
560897ea89 agent: clean up save mode and terminal prompts
- Use `std.meta.fieldNames` for the save mode prompt.
- Update terminal prompt functions to accept null-terminated strings.
- Respect the resolved save mode in `synthesizeSave`.
2026-06-03 17:13:52 +02:00
Pierre Tachoire
a0ecf9cb7c cookies: use an init for Cookie.PreparedUri 2026-06-03 16:48:55 +02:00
Adrià Arrufat
efb0041c83 Merge pull request #2628 from lightpanda-io/agent-replace-interactive-load
agent: replace -i flag with /save and /load commands
2026-06-03 16:43:54 +02:00
Pierre Tachoire
00a91c7dac cdp: fix network.getCookies url build
When getting cookies from CDP, we musn't apply specific cookies's
path/host extraction for the target URL, but use the simple URL rules.
2026-06-03 16:37:03 +02:00
Adrià Arrufat
ac82551e66 agent: replace -i flag with /save and /load commands
Removes the `-i`/`--interactive` CLI flag and live file-based
recording. Instead, the REPL now supports a `/load <path>` command
to run scripts from disk, and `/save` to export the in-memory
session recording.

The `Recorder` is simplified to be purely in-memory, and the script
runtime is moved to `src/script/Runtime.zig`.

BREAKING CHANGE: The `-i`/`--interactive` flag has been removed. Use
the `/save` and `/load` commands within the REPL instead.
2026-06-03 16:21:10 +02:00
Adrià Arrufat
6bb912716d Merge pull request #2627 from lightpanda-io/agent-repl-improvements
repl: add dynamic status bar
2026-06-03 15:44:26 +02:00
Adrià Arrufat
e208b4b638 repl: add dynamic status bar
Integrates isocline's top and bottom bar APIs to display the active
provider, model, and shortcut hints. Updates the status bar on
terminal resize and mode switches.
2026-06-03 15:09:09 +02:00
Karl Seguin
720e610542 Merge pull request #2625 from lightpanda-io/deferring_layer_error_handling
DeferringLayer correctly handle header stop/errors
2026-06-03 20:57:36 +08:00
Karl Seguin
96548fd8e5 Merge pull request #2624 from lightpanda-io/deferring_layer_fixes
Fix two issues with DeferringLayer
2026-06-03 18:41:44 +08:00
Karl Seguin
205865f96c DeferringLayer correctly handle header stop/errors
When forwardHeader signals not to proceed, fire() should stop.

This is the direct fix to https://github.com/lightpanda-io/browser/issues/2622
2026-06-03 18:13:32 +08:00
Karl Seguin
20555150dd Fix two issues with DeferringLayer
The first is that it can outlive the Transfer and thus has to dupe anything
it'll use (e.g. the frame_id off the request).

The second is that flushFrame is reentrant (flushFrame -> fire -> flushFrame)
and that results in the active list and list pointers becoming invalid.
2026-06-03 17:31:40 +08:00
Adrià Arrufat
8f9175104d agent: enforce recorded tool marshalling at compile time 2026-06-03 10:15:02 +02:00
Adrià Arrufat
393d26cd11 Merge branch 'main' into agent 2026-06-03 10:09:33 +02:00
Adrià Arrufat
df4fb046cd ScriptRuntime: replace Primitive enum with BrowserTool
Removes the redundant `Primitive` enum and uses `BrowserTool` directly,
filtering by `isRecorded()`. This reduces duplication and simplifies
the mapping between JS primitives and browser tools.
2026-06-03 10:09:16 +02:00
Adrià Arrufat
4139252feb mcp: replace recording and healing tools with save
Removes recordStart, recordStop, recordComment, scriptStep, and
scriptHeal MCP tools. Introduces a single 'save' tool that lets
the client synthesize and persist the script directly.
2026-06-03 10:01:38 +02:00
Karl Seguin
85d5e47ffc Merge pull request #2620 from lightpanda-io/better_css_name_parser
Better CSS name selector parser
2026-06-03 15:58:40 +08:00