Skip to content

feat(api): Probe for @ mentions in TUI append to prompt API - #3996

Closed
ewired wants to merge 2 commits into
anomalyco:devfrom
ewired:tui-append-stuff
Closed

ewired wants to merge 2 commits into
anomalyco:devfrom
ewired:tui-append-stuff

Conversation

@ewired

@ewired ewired commented Nov 6, 2025 •

Copy link
Copy Markdown
Contributor

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.

Fixes #2129

@ewired
ewired marked this pull request as draft November 6, 2025 18:29
@ewired

ewired commented Nov 6, 2025

Copy link
Copy Markdown
Contributor Author

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

@ewired
ewired marked this pull request as ready for review November 6, 2025 18:35
@ewired
ewired marked this pull request as draft November 12, 2025 14:27
@ewired

ewired commented Nov 12, 2025

Copy link
Copy Markdown
Contributor Author

The original approach of this PR is incompatible with opencode after 4bb7ea9 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
ewired marked this pull request as ready for review November 13, 2025 19:48
@ewired

ewired commented Nov 13, 2025

Copy link
Copy Markdown
Contributor Author

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
ewired force-pushed the tui-append-stuff branch 4 times, most recently from 030d134 to 8770aaa Compare November 18, 2025 02:14
@github-actions
github-actions Bot force-pushed the dev branch 3 times, most recently from f1dc981 to 3e15a39 Compare November 22, 2025 18:07
@github-actions
github-actions Bot force-pushed the dev branch 2 times, most recently from df8bdf9 to 0dd5039 Compare November 22, 2025 18:21
@ewired
ewired force-pushed the tui-append-stuff branch 2 times, most recently from e947abb to 07f200c Compare November 26, 2025 18:04
@ewired
ewired force-pushed the tui-append-stuff branch 3 times, most recently from f28deb9 to c8e214a Compare December 11, 2025 02:00
@ewired ewired changed the title Probe for @ mentions in TUI append to prompt command feat(api): Probe for @ mentions in TUI append to prompt API Jan 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@thdxr
thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@ewired
ewired force-pushed the tui-append-stuff branch 6 times, most recently from f026eb8 to 3fdb6c6 Compare February 13, 2026 08:51
@ewired
ewired force-pushed the tui-append-stuff branch 2 times, most recently from ca4d99d to 4e3274d Compare February 17, 2026 11:24
@ewired
ewired force-pushed the tui-append-stuff branch 4 times, most recently from 5e7a4b6 to 8578c54 Compare March 1, 2026 02:59
@ewired
ewired force-pushed the tui-append-stuff branch from 8578c54 to ab8f9c1 Compare April 7, 2026 19:57
@ewired
ewired force-pushed the tui-append-stuff branch from ab8f9c1 to a385fd6 Compare April 11, 2026 03:58
@ewired

ewired commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor Author

I am retiring from this PR as the linked issue is now stale and there is an alternative way to achieve this by creating a session and posting messages to it. If you look at the network logs of the web UI you can create an equivalent solution, but you have to resolve the mentions to file URLs externally like the web UI does. The neglected /tui/prompt-append route will languish with no restored mention support (and no line ranges in the mention support, the work I stacked on this) for the foreseeable future. Anyone can feel free to pick my commits up in a new PR.

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.

Support for line range with file tagging?

1 participant