OSC 8 hyperlinks file paths in tool titles#5189
Merged
Merged
Conversation
Wrap the path shown in read/write/edit/ls tool titles in an OSC 8 file:// hyperlink when the terminal advertises hyperlink support. The link target is always the absolute path, while the visible text stays relative/home-shortened and line annotations (e.g. :120-140) are kept out of the target.
…s them
detectCapabilities previously disabled hyperlinks under tmux unconditionally. tmux re-emits OSC 8 to the outer terminal only when the attached client advertises the 'hyperlinks' feature in client_termfeatures, and strips them otherwise.
Probe the running server with 'tmux display-message -p #{client_termfeatures}' and enable hyperlinks only when the feature is listed. The probe fails closed: any error (no tmux/server, timeout, old tmux) yields false. images stays null; only the hyperlink decision changed. The probe is injected into detectCapabilities so it stays testable without spawning a process.
Collaborator
|
cheers! |
Collaborator
|
the tmux process spawn for capability detection isn't ideal, but i guess we can live with it. some visual artifact in ghostty when i cmd + hover -> underline extends to end of line. investigating and possibly fixing. |
Contributor
Author
|
Thanks! Regarding that issue with the underline extending. I belive it is a ghostty problem. I saw it multiple time, not sure what is related too. But there was PR for better link matching ghostty-org/ghostty#11200 I managed to reproduce it on the old version
But let me know if you have any doubts, happy to double check it. |
Contributor
Author
|
In my case the underline issue, happens only in tmux select mode (but not allways). Same issue happens for paths in Let me know if it is a similar case, or something different. |
wincent
added a commit
to wincent/wincent-agent-plugins
that referenced
this pull request
Jun 1, 2026
The pi-update prompt instructed the agent to patch `@earendil-works/pi-tui`'s `dist/terminal-image.js` after every upgrade, flipping the tmux/screen branch of `detectCapabilities` so OSC 8 hyperlinks would report as enabled inside tmux. That workaround is no longer needed because Pi 0.78.0 includes autodetection: - earendil-works/pi#5189 Remove the entire Step 8 patching section, the intro sentence that promised to apply the patch, and the Step 7 wording that branched into Step 8. Step 7 now simply reports install success or failure. Agent prompts used in preparing this commit: > read @pi/prompts/pi-update.md which defines a pi prompt. > > note that the latest Pi release makes the patching of the tmux > hyperlink code unnecessary: earendil-works/pi#5189 > > so, update the prompt to remove all the content about patching. > commit this > try signing again Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
wincent
added a commit
to wincent/wincent
that referenced
this pull request
Jun 1, 2026
As of: - earendil-works/pi#5189 We no longer need to run a patched version in order to get hyperlinks working in tmux. Change-Id: kvuxuxnrmmtznvpxnropsotpqstnmkxl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Implements #5168.
It wraps the path in
read/write/edit/lstool titles in an OSC 8file://hyperlink when the terminal advertises hyperlink support.Most of the diff is refactoring: switching to a proper
import type { Theme }and a newrenderToolPathutil that now handles the hyperlink.Unchanged:
grep,findshow patterns in their titles, not paths. Their result lines are paths, but that is the same text returned to the model, so I left them as they are.tmux hyperlink forwarding (pi-tui)
While testing I noticed the links don't work under tmux, so I added a separate commit for
packages/tui/src/terminal-image.ts.This commit is riskier because it executes
tmux display-messageto read the client's reported features.I tried to be defensive about it: it runs only under tmux and has a short timeout. If that is not an option we can revert it and instead rely on config or a custom environment variable as a manual workaround.
To see the links under tmux (3.4+), tmux must know the outer terminal supports hyperlinks. It detects this automatically when the terminal's terminfo announces the
Hlscapability.For terminals that don't (e.g. Ghostty), it needs to be set manually:
Extensions
I considered providing an API for extensions, but I droped the idea as custom tools can already support hyperlinks with the existing API fairly easily: