Skip to content

[feat]: Add contextual actions to user messages#473

Merged
sudo-tee merged 2 commits into
sudo-tee:mainfrom
jensenojs:feat/message-actions
Jul 20, 2026
Merged

[feat]: Add contextual actions to user messages#473
sudo-tee merged 2 commits into
sudo-tee:mainfrom
jensenojs:feat/message-actions

Conversation

@jensenojs

Copy link
Copy Markdown
Collaborator

Summary

  • expose Revert, Copy, and Fork through the existing contextual actions UI
  • keep one action set across the full rendered user message range
  • restore overwritten buffer-local mappings when contextual actions become inactive
  • copy original non-synthetic user text through the existing API command axis

Model

state.messages                         RenderState
├── message id ──> undo / fork         └── user message range
└── original text ──> copy                 └── R / C / F

cursor line ──> actions in range ──> temporary mappings ──> opencode.api
                       │
                       └── leave range ──> restore previous mappings

Testing

  • ./run_tests.sh
  • 138 replay cases
  • contextual action mapping, persistent-buffer, range-shift, and Copy contract coverage

Closes the interaction gap discussed in #439 by reusing contextual actions instead of adding another dialog or mouse-specific surface.

state.messages                         RenderState
├── message id ──> undo / fork         └── user message range
└── original text ──> copy                 └── R / C / F

cursor line ──> actions in range ──> temporary mappings ──> opencode.api
                       │
                       └── leave range ──> restore previous mappings

Reuse the existing contextual action rendering and API dispatch paths to
expose Revert, Copy, and Fork across the full user message range. Copy uses
the original non-synthetic text parts, and temporary mappings restore the
buffer mappings they replace.
@jensenojs
jensenojs force-pushed the feat/message-actions branch from 96e86f2 to 8928094 Compare July 20, 2026 12:15
@jensenojs

jensenojs commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

test for copy

iShot_2026-07-20_19 13 11

test for revert

iShot_2026-07-20_19 13 50

I also tested the fork(but I'm too lazy to record another GIF); this feature might make you more inclined to try adjusting your prompts by reverting the previous message @sudo-tee

Derive attachment from the per-buffer lifecycle record and use the current action set to reject stale callbacks. Keep refresh and cleanup as the only state transitions while preserving mapping restoration and buffer isolation.
@jensenojs
jensenojs marked this pull request as ready for review July 20, 2026 12:33
@sudo-tee

Copy link
Copy Markdown
Owner

This is great.

I much prefer this version with contextual actions on the user message than the previous one :)

Thanks

@sudo-tee
sudo-tee merged commit 33a6629 into sudo-tee:main Jul 20, 2026
5 checks passed
@jensenojs
jensenojs deleted the feat/message-actions branch July 20, 2026 13:14
disrupted pushed a commit to disrupted/opencode-native.nvim that referenced this pull request Jul 23, 2026
* feat(ui): add contextual actions to user messages

state.messages                         RenderState
├── message id ──> undo / fork         └── user message range
└── original text ──> copy                 └── R / C / F

cursor line ──> actions in range ──> temporary mappings ──> opencode.api
                       │
                       └── leave range ──> restore previous mappings

Reuse the existing contextual action rendering and API dispatch paths to
expose Revert, Copy, and Fork across the full user message range. Copy uses
the original non-synthetic text parts, and temporary mappings restore the
buffer mappings they replace.

* refactor(ui): simplify contextual action lifecycle

Derive attachment from the per-buffer lifecycle record and use the current action set to reject stale callbacks. Keep refresh and cleanup as the only state transitions while preserving mapping restoration and buffer isolation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants