Remove no-longer needed setTimeouts in test now that messages are queued.
Runner also checks ready_queue when determining doneness.
Co-authored-by: Navid EMAD <design.navid@gmail.com>
At some point recently, we started to process scripts that fail to load (e.g.
404). This stops such scripts from [trying] to be evaluated, and executes the
onerror handler in all script loading paths.
Routes the eval tool through callEval instead of callValue. This
ensures JavaScript execution errors are flagged with is_error=true,
allowing the model to self-correct.
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.
- Derives the `Action` enum in `src/browser/tools.zig` from `tool_defs` to prevent manual maintenance and potential drift.
- Refactors `verifyElementValue` in `src/script/Verifier.zig` to use a `Check` struct for its parameters.
- Reorganizes and cleans up imports in `src/agent/Agent.zig`.
- Replace `unreachable` with explicit error returns in Agent and Executor.
- Add `EvalResult.err` helper in `tools.zig` to simplify error paths.
- Improve error propagation in `SlashCommand` and `Recorder`.
- Rename `Self` to `Agent` for better clarity in function signatures.
Introduces an `ActionTarget` union to handle selectors and backend node
IDs consistently. This simplifies the `formatActionResult` function and
ensures the identification method is preserved within `NodeAndPage`
during element resolution.
- Add `beginTool` and `endTool` to `Terminal` to encapsulate spinner logic.
- Consolidate navigation awaiting and context tagging in browser tools
via a new `finalizeAction` helper.
Client.tick drains self.queue (assigning conns to queued transfers) only
at the start. When perform / processMessages releases a batch of conns
back to the pool, those conns sit idle until the next tick — a queued
transfer that could have run this tick waits one Runner iteration
(~20 ms in the test runner) for no reason. Adds a second drainQueue
call after perform so newly-freed conns get picked up immediately.
In practice this matters whenever httpMaxHostOpen / httpMaxConcurrent
is exceeded — pages with N > limit subresources had each "wave" of
queue overflow paying one extra tick of latency.
cache=true is problematic for a few reasons
1 - The current cache implementation is known to cause timing issues; i.e. it
executes callbacks synchronously.
2 - Unlike something like robots.txt or proxy, cache tests need to be explicitly
tested. The response has to include cache headers and the resource loaded
again.
Moves page URL and title formatting into a separate `appendPageContext`
function and removes the page parameter from `formatActionResult`.
This simplifies tool execution logic and decouples action descriptions
from page metadata.
- 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`.
Client.makeRequest used to call self.perform(0) after handing the transfer
to libcurl. That perform() does two things: drives curl_multi_perform (so
bytes hit the wire) AND drains curl_multi_info_read messages, which is
what fires the user-facing header/data/done callbacks.
The issue is that, even in non-cache cases, a request could be immediately
resolved in libcurl, and thus callbacks executed synchronously.
By only calling `curl_multi_perform` on a new request, we prevent this from
happening.