Unblocks some WPT tests, but more generally, adds correctness so that the onload
on an iframe doesn't fire before subsequent scripts. Imagine something like:
<iframe src=blah onload=done>
<script>
function done() {
//...
}
</script>
(Which is an approximation of what some WPT tests do)...kind of important that
we don't fire the onload while we're still parsing.
Updates the synthesis prompts and rules for the `save` tool to reflect
the new `Page` class API. Scripts now instantiate `Page`, use async
`await page.goto()`, call other builtins as synchronous methods on
`page`, and use `return` to output results.
Lazily probes and caches Ollama server reachability for `/provider`
autocomplete. Validates Ollama availability when manually setting
the provider. Updates zenai dependency.
Renames `wouldResolve` to `hasDetectableKey` and removes the Ollama
probe from it. Defers printing the welcome banner for Ollama-only
paths to prevent probing the local server twice. Also bumps zenai.
Replaces global blocking functions with a `Page` class. `page.goto` is
now asynchronous and must be awaited, while other methods remain
synchronous. Scripts are wrapped in an async IIFE to support top-level
await, and output is returned via `return <value>`.
Passes the `HF_BILL_TO` environment variable to the ZenAI client
to route Hugging Face billing to an organization. Also updates
the `zenai` dependency.
clearConversation reset the recorded action buffer but left save_path
set, so after /clear or /reset a /save <newfile> was rejected with
"already saving to <oldfile>". Free and clear save_path alongside the
buffer so a cleared session can save to a fresh file.
This continues some previous fixes aimed at iframe/popup scenarios where the DOM
is manipulated from a different frame. The simplest example is:
iframe.contentDocument.domain
should return the domain of the iframe, not the domain of the context this is
being run in. For a case like this, it's easy, use self._frame rather than
the calling context's frame.
Besides these easy cases, there are two other changes here:
1 - ResolveURL has to get an Element's owning document's frame
2 - getElementById has to get the lookup from the element's document
As part of #2, `Frame.getElementByIdFromNode` was optimized to avoid the
double document lookup. Rather than calling isConnected() then finding the root
node, we can just call getRootNode().