Live: diff view
live_diff_viewVisualize changes made by a live mutation with an annotated before/after diff overlay, highlighting the changed region and current selection.
Instructions
Produce a FOCUSED, annotated before/after visual diff of a live operation.
When to use: visualizing what one live mutation changed. To produce a mutation to diff use
live_apply_to_selection / live_insert_svg / live_set_selected_text (or
live_session_step, which calls this internally).
Key params: operation_id names the Live Operation Record. The tool REUSES the before/after
frames the mutation already captured (run_live_mutation persists preview_before /
preview_after), pixel-diffs them to a CHANGED-REGION bbox, and emits ONE annotated overlay
highlighting it plus the current selection outline (best-effort when a session is connected).
Frames are resolved VIA the operation_id (never a raw client path) and sandbox-validated under
the live artifacts dir before any bytes are read. Identical-dimension frames required; a size
mismatch is a stable error. ARTIFACT-ONLY — no mutation, no Operation Record routing, no
approval, no network.
Return shape: LiveDiffResult — a workspace-relative overlay PNG path, the operation_id, the
pixel-space changed_bbox (null when the frames are identical), and highlighted_ids; the diff
path is linked back onto the record's diff_artifacts.
Example: live_diff_view(operation_id)
Risk class: low (artifact-only; reads + annotates two existing frames, no mutation, no record).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| width | Yes | Frame width in pixels. | |
| height | Yes | Frame height in pixels. | |
| changed_bbox | No | Changed-region bbox in PIXELS (null when frames are identical). | |
| operation_id | Yes | Live Operation Record id this diff was computed for. | |
| artifact_path | Yes | Workspace-relative annotated overlay PNG path. | |
| highlighted_ids | No | Selection ids whose outline was drawn on the overlay. |