Commit Graph

16 Commits

Author SHA1 Message Date
Adrià Arrufat
3cc652776b agent: simplify command execution and REPL logic
- Use `std.json.Stringify` for safer JS escaping in `execExtract`.
- Streamline `CommandExecutor` and remove redundant helpers.
- Add "QUIT" as an alias for the "EXIT" command.
- Clean up REPL loop control flow and error reporting in `Agent`.
- Simplify `Recorder` file operations and logging.
2026-04-11 15:33:06 +02:00
Adrià Arrufat
b606d28454 agent: improve command quoting and parsing
Implement content-aware quoting and robust quote stripping to ensure
better round-tripping of Pandascript commands.
2026-04-11 15:13:24 +02:00
Adrià Arrufat
c4cfd5e363 agent: make AI provider optional for "dumb" REPL mode
Allows starting the agent without a provider to use Pandascript
commands without an API key. Commands requiring an LLM and
--self-heal now explicitly require a provider.
2026-04-11 12:34:32 +02:00
Adrià Arrufat
3a9573e1ae agent: route data to stdout and actions to stderr 2026-04-10 18:03:57 +02:00
Adrià Arrufat
a5fd70f5dd refactor: improve tool execution and terminal formatting
- Standardize `fill` tool to use `value` instead of `text`.
- Add formatted output methods (`printInfoFmt`, `printErrorFmt`) to `Terminal`.
- Improve error handling in `ToolExecutor` and `browser/tools` by using error unions.
- Deduplicate `minify` utility and remove redundant code comments.
- Refactor tool dispatch to use `Action` enum tags instead of hardcoded strings.
2026-04-10 14:54:51 +02:00
Adrià Arrufat
d1b429655f tools: add selector support for hover, select, and check actions 2026-04-10 14:15:55 +02:00
Adrià Arrufat
81413d9291 agent: add scroll command and improve script reliability
Adds the SCROLL command and ensures WAIT actions are recorded.
Refactors TYPE to use the fill tool, adds self-heal retries, and
propagates agent failures to the process exit code.
2026-04-10 11:45:14 +02:00
Adrià Arrufat
7aa11c7006 agent: update CLI args and refactor code 2026-04-09 17:51:56 +02:00
Adrià Arrufat
8d3d3a2c67 agent: improve command parsing and selector reliability
- Support single quotes in commands for nested CSS selectors.
- Mask password values in interactive element output.
- Update system prompt and recorder for better reproducibility.
- Try CSS selectors first in click actions.
2026-04-08 18:10:04 +02:00
Adrià Arrufat
1aca921327 agent: use Command union for recording 2026-04-08 08:20:06 +02:00
Adrià Arrufat
048cb46950 Refactor: extract shared tool execution layer from MCP and agent
Both MCP tools.zig and agent ToolExecutor.zig duplicated the same 20 tool
handlers. This extracts the shared logic into src/browser/tools.zig so new
tools only need to be added once. Reduces total code by ~620 lines while
keeping all 465 tests passing.
2026-04-07 08:05:36 +02:00
Adrià Arrufat
1f75ce1778 agent: add unit tests for Command, CommandExecutor, and Recorder 2026-04-04 08:28:56 +02:00
Adrià Arrufat
7aabda9392 agent: add recorder, self-healing, env substitution, and security fixes
- Add Recorder for recording REPL sessions to .panda files, with
  --no-record flag and positional file arg support. Skips read-only
  commands (WAIT, TREE, MARKDOWN) per spec.
- Record resolved LLM tool calls as Pandascript commands so the
  generated artifact is deterministic.
- Add self-healing in --run mode: on command failure, prompt the LLM
  with the # INTENT context to resolve an alternative.
- Add LOGIN and ACCEPT_COOKIES high-level commands (LLM-resolved).
- Add multi-line EVAL """...""" support via ScriptIterator.
- Add $VAR_NAME environment variable substitution in command arguments.
- Escape JS strings in execType/execExtract to prevent injection.
- Sanitize output file paths in EXTRACT to prevent path traversal.
2026-04-04 08:14:48 +02:00
Adrià Arrufat
e29f33642c agent: add --run command for deterministic script replay 2026-04-04 07:56:10 +02:00
Adrià Arrufat
3b1ef66b51 agent: add markdown command 2026-04-04 07:56:10 +02:00
Adrià Arrufat
15c0a7be83 agent: add manual command support to REPL
Adds a parser and executor for manual commands like GOTO and CLICK.
Unrecognized input continues to be processed by the AI.
2026-04-04 07:56:10 +02:00