Use `std.json.Value` directly for tool arguments instead of
stringifying and reparsing. This optimizes the hot replay path
in the agent and MCP server.
Adds a visual spinner to the REPL to indicate agent activity (thinking
or tool execution). Refactors terminal output to prevent interleaving
with spinner frames.
There's ambiguity in the http_client.request() call on whether or not the caller
is responsible for freeing the header. It depends how request() fails, and it's
impossible for the caller to know. This needs a fundamental fix, but, in the
meantime, we get to pick between: a possible leak or a double free.
This commit opts for a possible leak. Why? Because overwhelmingly, if request
fails, it'll fail at a point where it will handle the free. In those cases
where it doesn't then the system is probably in trouble anyways (OOM).
(Also, as I was debugging, I noticed that the function.src() debug helper
wasn't working, so I fixed it).
`releaseRef` can free the XHR instance, so anything we want to set, has to
happen before then. (It might seem like the set is meaningful if we're just
going to destroy the instance, but `releaseRef` might also _not_ destroy the
instance, and the guard is for those cases).
- Rename `Command.buildJson` to `stringifyJson` for clarity.
- Flatten tool call recording loop in `Agent.zig` to reduce nesting.
- Extract `parseValue` helper in `tools.zig` to reduce duplication.
- Optimize `substituteEnvVars` by skipping redundant string scans.
- Extract `modeNeedsHttp` helper in `Config.zig`.
- Move `CallParams` to `protocol.zig` to deduplicate MCP code.
- Extract `lookupLpEnv` in `browser/tools.zig` for environment lookups.
Removes pre-state tracking and click verification from the agent.
Consolidates provider requirement validation logic and optimizes
`applyReplacements` by pre-calculating memory capacity.
- Extract `awaitQueuedNavigation` and `mapActionError` in `tools.zig`.
- Optimize `substituteEnvVars` using `indexOfScalarPos` to reduce copies.
- Switch to `parseFromSliceLeaky` for tool arguments parsing.
- Improve error handling in `Agent.zig` self-healing and `Recorder.zig`.
- Simplify `callEval` by adding `evalScript` helper.
- Skip JSON parsing in Terminal for non-JSON tool results to avoid unnecessary allocations.
- Simplify `$LP_` environment variable detection in tools.
- Update documentation comments in Agent for clarity.
- Reorder `arena` and `session` arguments in tool functions.
- Optimize `substituteEnvVars` to only process `$LP_` prefixes.
- Use stack buffer for backup paths in `Agent.zig`.
- Clean up `formatActionResult` implementation.