opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Probe for @ mentions in TUI append to prompt command

Open ewired opened this issue 2 months ago • 4 comments

1.0 removed the ability for POST /tui/append-prompt to include @ mentioned files and agents. This patch extracts and uses the mention resolution for files and agents used by command templates, marking the mentions as if they were added from Autocomplete. The behavior of the append prompt TUI command is also changed to move the cursor to the end before inserting, and I don't know if pre-1.0 versions did this. Unlike Autocomplete, it can resolve files relative to the home directory mentioned with ~/, which might be undesired.

ewired avatar Nov 06 '25 17:11 ewired

The only failing test is failing on other recent PRs and pertains to the patch tool which is apparently dead code.

ewired avatar Nov 06 '25 18:11 ewired

The original approach of this PR is incompatible with opencode after https://github.com/sst/opencode/commit/4bb7ea91271e85621a1394c70867ddc26be45631 because an Instance instance is apparently no longer provided to the TUI renderer or TUI command handlers. This can be based on the new SessionPrompt.resolvePromptParts method added from #4221 but it also uses Instance.

ewired avatar Nov 12 '25 14:11 ewired

The new approach adds the ability to specify parts on TuiEvent.PromptAppend and must extract the mentions using the Instance information during the response to /tui/append-prompt. This means /tui/append-prompt has different capabilities than TuiEvent.PromptAppend and couldn't be a direct pass-through anymore.

ewired avatar Nov 13 '25 19:11 ewired