Repository navigation
fix(tui): expand pasted image and PDF paths on click - #57305
maharshi365 wants to merge 10 commits into
Conversation
Retain pasted local paths in prompt attachment metadata and reuse the placeholder click handler to restore editable path text. Remove the expanded attachment through existing extmark synchronization. Add a regression test that clicks a quoted image path and verifies submission contains only text. Clipboard images without a source path remain attachments. Fixes anomalyco#57298
Replace the nested expansion ternary with simple if statements. Reuse existing session, agent, and model fixtures to shorten the image-path regression test.
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
Looks good. I reproduced it in the TUI with opencode-drive. On the base, a pasted quoted image path becomes [Image 1] and clicking the label does nothing. With this change, the click puts back the original quoted path as editable text. With the change I also sent an image without expanding it, and the server accepted the prompt even with the extra pastedPath field on the file. The new and existing prompt tests in packages/tui pass, and the type check is clean.
Public API: unchanged. pastedPath is a TUI-only field on the local prompt/history type (it is also saved in prompt-history.jsonl). It is sent along with file parts in requests, but the server accepts it. No SDK, schema, config or CLI changes.
No blocking concerns. When several paths are pasted at once, each expands to its plain file path rather than the exact pasted text. That seems fine.
There was a problem hiding this comment.
The new commits only merge dev into the branch. The PR's own changes are unchanged since my last review, and I have no open points from it. On the new head the prompt tests in packages/tui still pass and tsc -b is clean. I also checked the newly linked PDF case in the TUI: on the base, a pasted quoted .pdf path stays [PDF 1] when clicked. With this change, the click puts the original quoted path back as text.
Public API: unchanged.
No new concerns.
There was a problem hiding this comment.
The new commit only merges dev into the branch. The PR's own changes are unchanged since my last review, and I have no open points from it. On the new head the prompt tests in packages/tui still pass and tsc -b is clean.
Public API: unchanged.
No new concerns.
There was a problem hiding this comment.
The new commit only merges dev into the branch. The PR's own changes are unchanged since my last review, and I have no open points from it. On the new head the prompt tests in packages/tui still pass and tsc -b is clean.
Public API: unchanged.
No new concerns.
There was a problem hiding this comment.
The new commit only merges dev into the branch. The PR's own changes are unchanged since my last review, and I have no open points from it. On the new head the prompt tests in packages/tui still pass and tsc -b is clean.
Public API: unchanged.
No new concerns.




Issue for this PR
Closes #57298
Closes #57698
Type of change
What does this PR do?
Clicking a pasted image or PDF attachment label now replaces it with the original editable path and removes the attachment. This reuses the existing pasted-text expansion handler. Quotes and spaces are preserved for single-path pastes; clipboard screenshots without a source path stay attachments. No new shortcut or duplicate-paste behavior. This also addresses #57698: PDF paths can be restored as text before sending to a model that does not support PDF input. PDF auto-attachment behavior is unchanged.
How did you verify your code works?
Screenshots / recordings
Recording.2026-10-20.014436.mp4
Checklist
Added by the opencode bot (AI-generated).
Related: #57162, #48190