Expand description
IDE-protocol I4: the openDiff tool — open an interactive diff and BLOCK
until the user Keeps or Rejects it.
Unlike the I3 write tools (which send an Effect on the generic handler bus
and return an optimistic ack), openDiff is blocking and opens a diff
whose host-side machinery is irreducibly &mut Editor + lattice-diff types.
So it rides a SECOND, host-drained bus
([lattice_diff::ProgrammaticDiffBus], built via boot.inbound_raw and
registered as a service): this tool delegates to
[lattice_agent::review_diff], which builds a
[lattice_diff::ProgrammaticDiffRequest], sends it (which wakes the
editor), and awaits the request’s completion oneshot — with no
timeout (the user reviews at their own pace). The host opens a
side-by-side diff, binds the oneshot to the session, and fires the
DiffOutcome on
:diff-accept / :diff-reject (or a close-tab cancel, which drops the
sender → a graceful reject here).
Reply shape (PROVISIONAL until validated against a live claude CLI): the
MCP CallToolResult content carries a FILE_SAVED marker on Accept (the
host already wrote the proposed content to old_file_path — the review IS
the save) or DIFF_REJECTED on Reject. The agent branches on these markers.
Functions§
- open_
diff openDiff: open an interactive diff betweenold_file_path’s on-disk content andnew_file_contents, blocking until the user resolves it.