Add experimental.agentHmrBatching: hold HMR during an agent's multi-step edit
An AI coding agent edits in many small steps, so the dev server compiles and
pushes an HMR update per step and the browser preview walks through every
half-finished intermediate state. The compile errors from those states land in
the browser's error overlay, in front of a person, instead of going back to the
agent that can still fix them.
This adds an agent-scoped batch. While one is open, every HMR message that would
change what the browser renders is held instead of delivered, so the preview
stays on the last output that compiled. Closing the batch waits for the
compilation to settle and then either flushes the held messages as one coalesced
update, or — when the code does not compile — leaves the preview alone and
returns the errors to the caller, keeping the queue so the next clean compile
releases it.
Batches are opened and closed with three new MCP tools (begin_hmr_batch,
end_hmr_batch, get_hmr_batch_status), registered only when the flag is set. With
no batch open, every message takes exactly the path it took before.
Co-Authored-By:
Jude Gao <32973745+gaojude@users.noreply.github.com>
Showing
This diff is collapsed.
This diff is collapsed.
Please
register
or
sign in
to comment