Commit Graph

18 Commits

Author SHA1 Message Date
Adrià Arrufat
cbe81e150b agent: condense prompts and tool descriptions 2026-05-14 14:59:58 +02:00
Adrià Arrufat
2862feb7c4 agent: improve recording quality and tool guidance
- Filter redundant `extract` calls in recordings to reduce noise.
- Scrub literal `LP_*` secrets from recorded commands for portability.
- Throw a descriptive error in `extract` when no selectors match.
- Update tool descriptions and guidance to favor a `tree` ->
  `nodeDetails` -> `extract` workflow for more robust selectors.
2026-05-14 13:36:36 +02:00
Adrià Arrufat
9ac2c03a7e tools: unify eval and extract tool dispatching
- Add `callEvalLike` to consolidate tools returning `EvalResult`.
- Update `Agent` and `MCP` to use the new helper.
- Route failed data commands to stderr in `CommandExecutor`.
- Update CSS selector guidance in `script.zig`.
2026-05-14 11:14:11 +02:00
Adrià Arrufat
faba86cf82 docs(browser.tools): clarify extract tool schema and examples 2026-05-14 10:48:13 +02:00
Adrià Arrufat
3d8621561a tools: add extract tool for structured data
Adds the `extract` tool for lifting structured data via JSON schemas.
Updates the command system to support recording and replaying
extraction steps in PandaScript.
2026-05-14 10:32:59 +02:00
Adrià Arrufat
48b8c4fb8c script: simplify formatHealReplacement 2026-05-13 14:34:12 +02:00
Adrià Arrufat
6538a34f56 browser: separate operational and JS errors in eval
Changes `EvalResult` to a union and uses Zig errors for operational
failures, distinguishing them from JavaScript execution errors.
Also removes redundant `stringifyJson` in favor of standard library.
2026-05-13 14:27:28 +02:00
Adrià Arrufat
b2454a9190 chore: add license headers to source files 2026-05-13 13:20:36 +02:00
Adrià Arrufat
cc59dd64b9 script: make ScriptIterator.next fallible 2026-05-13 12:40:07 +02:00
Adrià Arrufat
f624077218 refactor: propagate OOM in substituteEnvVars and inline heal header
- Update `substituteEnvVars` to return `OutOfMemory` error instead of
  silently returning the original string on failure.
- Simplify `execFill` to always use the original text for display.
- Inline the `writeHealHeader` helper in `src/script.zig`.
2026-05-13 10:31:16 +02:00
Adrià Arrufat
947e9be5fc script: add test for healing multi-line EVAL blocks 2026-05-13 10:03:32 +02:00
Adrià Arrufat
c41955ade3 script: move script module to root src directory 2026-05-11 19:56:36 +02:00
Adrià Arrufat
1a84f56160 refactor: relocate PandaScript and improve agent reliability
Moves script logic to `browser/script/` for shared use. Implements
message rollback on API failure, caches environment variables, and
fixes a potential panic in the spinner.

- Relocate Command, Recorder, and Verifier to `src/browser/script/`
- Implement message rollback on API and synthesis failures in Agent
- Cache `LP_*` environment variables process-wide with mutex protection
- Fix potential panic in Spinner during backward clock jumps
- Improve Recorder to handle write failures and multi-line comments
- Update documentation regarding attachments and path safety
2026-05-11 19:49:15 +02:00
Adrià Arrufat
b5777ce35c agent: support listing LP_* variables in getEnv 2026-05-11 12:34:36 +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
77fc818976 refactor: optimize tool calls and improve script healing 2026-05-07 20:30:49 +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