opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: add granular message part undo/redo with `<leader>U` and `<leader>R`

Open spoons-and-mirrors opened this issue 4 months ago • 2 comments

Summary

This draft PR implement a more granular undo/redo, because sometime, you've been waiting 15 minutes for a message with 80 tool calls to end, and everything was fine until tool call 64... so you can now get back to tool call 64 by undoing message parts.

This reuses opencode snapshot ability

Before part undo : image

After part undo image

Side effect bug (FIXED as of 3rd commit)

Currently, pressing <leader>R pops an "New Version installed" toast for no reason, which I couldn't resolve yet. This bug is the reason the PR is marked as draft, although the bug isn't breaking anything, it's annoying image

spoons-and-mirrors avatar Aug 18 '25 17:08 spoons-and-mirrors

the existing /session/:id/revert endpoint already takes an optional partID, you don't need to introduce anything server side for this feature!

adamdotdevin avatar Aug 19 '25 10:08 adamdotdevin

Oh I missed that @adamdotdevin , thanks !

The feature now uses the existing endpoints, and the "New version installed" bug was fixed on the 3rd commit

spoons-and-mirrors avatar Aug 19 '25 12:08 spoons-and-mirrors