English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Español · Français · Deutsch · Русский
Clickable file paths and URLs in pi transcripts.
- Path → opens the containing folder in your file manager with the file selected (never guesses which application should open it).
- URL → opens in your default browser.
Nothing is sent anywhere; the extension only rewrites Markdown for display, so the session and the model context stay untouched.
see /home/you/projects/api/src/server.ts:42 ← click: file manager at src/, server.ts selected
docs: https://example.com/guide ← click: default browser
A terminal can only "click" URLs that pi emits as OSC 8 hyperlinks, and the terminal hands those URIs to the desktop's default handler. So there are two halves:
| Half | File | Job |
|---|---|---|
| pi extension | src/open-links.ts |
rewrites [text](url) links into the transcript: local paths become pi-open://open?p=…, URLs stay http(s) |
| URI handler | bin/pi-open |
receives the click, resolves the path, reveals it in the file manager (nautilus --select), or calls xdg-open for URLs |
- pi 1.7 or newer
- A terminal with OSC 8 hyperlink support (GNOME Terminal / VTE, kitty, foot, WezTerm, iTerm2, …)
python3(the handler is a small stdlib-only script)- Linux desktop with
xdg-mime; Nautilus is used when present, otherwisexdg-open
# from GitHub
pi install git:github.com/bbjson/pi-clickable-links
# or from npm
pi install npm:pi-clickable-links
# or from a local checkout
git clone https://github.com/bbjson/pi-clickable-links
cd pi-clickable-links
./install.sh --link-extensionOn the first session after installing, the extension installs the handler and the desktop entry itself and tells you in the status area — no manual step needed. Run the installer yourself to do it up front (or to redo it after moving files):
./install.shIt will:
- copy
bin/pi-opento~/.local/bin/pi-open - write
~/.local/share/applications/pi-open.desktopand register thepi-open://scheme withxdg-mime - set
terminal.hyperlinks: truein~/.pi/agent/settings.json(a timestamped backup is written first; skip with--no-settings)
Doing the same steps by hand is fine too:
install -m 0755 bin/pi-open ~/.local/bin/pi-open
sed "s|@PI_OPEN_BIN@|$HOME/.local/bin/pi-open|" share/pi-open.desktop.in \
> ~/.local/share/applications/pi-open.desktop
update-desktop-database ~/.local/share/applications
xdg-mime default pi-open.desktop x-scheme-handler/pi-openExtensions and settings are read at startup. Run /reload or restart pi.
pi decides whether it may emit OSC 8 links from
TERM_PROGRAM. GNOME Terminal (VTE) does not set that variable, so pi disables hyperlinks by default and the transcript contains no links at all — even for plainhttps://URLs. Forcing the setting on fixes both. If your terminal setsTERM_PROGRAM(kitty, WezTerm, iTerm2, …), the setting is redundant but harmless.
Click any path or URL in the transcript.
Also available from the keyboard, which works even without OSC 8 support:
/open /home/you/projects/api/src/server.ts
/open https://example.com/guide
/open ~/Downloads
| Input in a transcript | Result |
|---|---|
/home/you/app/main.py |
clickable → file manager opens app/, main.py selected |
~/Downloads |
clickable → file manager opens ~/Downloads |
/home/you/app/main.py:42 |
clickable, :42 kept in the label, file selected |
/home/you/My Documents/notes.md |
clickable (spaces handled) |
/home/you/视频/第八集.mp4 |
clickable (non-ASCII percent-encoded in the URI) |
https://example.com |
clickable by pi itself, pointing at the URL |
`cat /home/you/file` / fenced code |
left as code, not linked |
[docs](/home/you/file.md) (already a link) |
left alone |
/home/you/does-not-exist.txt |
not linked, stays plain text |
src/app.ts (relative) |
not linked — a relative path cannot be resolved at click time |
| Variable | Effect |
|---|---|
PI_OPEN_DRY=1 |
make the handler print what it would run instead of opening anything |
PI_OPEN_BIN |
path to the handler, if you did not install it under ~/.local/bin |
The file manager is chosen at the top of bin/pi-open (nautilus is used when
present, otherwise xdg-open). Change FM there for Thunar, Nemo, Dolphin, …
| Symptom | Cause / fix |
|---|---|
No link styling at all, not even on https:// URLs |
terminal.hyperlinks is off: rerun ./install.sh, restart pi |
| Link is styled but clicking does nothing | the terminal cannot open the scheme: check xdg-mime query default x-scheme-handler/pi-open |
| Clicking opens a text editor instead of the folder | pi rendered its own file:// link (tool output paths), which bypasses this handler; click the path in the assistant text instead |
| Nothing happens on paths with spaces | the path must exist at render time — the extension only links existing absolute paths |
pi-open: command not found |
run ./install.sh (step 2) |
| Fullscreen mode swallows clicks | hold Ctrl+Shift while clicking to use the terminal's native link handling |
Run the handler directly to debug:
PI_OPEN_DRY=1 ~/.local/bin/pi-open 'pi-open://open?p=/home/you/Desktop'npm test # node >= 22: TypeScript is stripped nativelytest/linkify.mjs— Markdown transformer (paths, code fences, spaces, CJK,:linesuffixes)test/setup.mjs— self-install path, in a throwaway$HOME
./uninstall.sh
pi remove git:github.com/bbjson/pi-clickable-links
# optionally revert terminal.hyperlinks in ~/.pi/agent/settings.jsonMIT — see LICENSE.