opencode
opencode copied to clipboard
feat(session): add undo functionality to session messages and context menu
What does this PR do?
- Adds a "Revert to here" (Undo) functionality to individual session messages.
- Introduces a Desktop-friendly Context Menu (right-click) on user messages for quick actions.
- Implements an intelligent revert logic:
- Reverting from an older message keeps that message but removes all subsequent turns.
- Reverting from the latest message acts as a classic "Undo" (removes the message itself).
- Automatically restores the deleted message's content back into the prompt input for easy editing.
- Enhances the UI by replacing cluttered hover buttons with a clean, native-feeling context menu.
- Fixes a critical desktop startup issue by switching from interactive (-il) to login (-l) shell mode to prevent shell-config blocking. How did you verify your code works?
- Verified the desktop app starts correctly without hanging during the sidecar spawn process.
- Tested the context menu on various messages (both old and latest).
- Confirmed that the "Undo" correctly clears the session state and restores the prompt in the input field.
- Verified that right-clicking opens the menu at the correct location and "Copy message" works as expected.
- Ran typechecks and linting to ensure no regressions were introduced.