READMESource: main@6b07be90
dsh-yazi

Screenshots
The Yazi tab in a DSH session, and a file opened from Yazi in Neovim:
| Yazi panel | File opened in Neovim |
|---|---|
![]() |
![]() |
Adds a Yazi tab to the session's view tab row — beside 对话 and 轨迹 —
via the conversation.view slot. Selecting it renders the real local yazi
file manager in a genuine PTY, rooted at the workspace the session belongs to.
How it works
browser / desktop page Host (this package)
┌────────────────────┐ ws ┌──────────────────────────────┐
│ conversation.view │ │ webServer.registerUpgrade │
│ tab: Yazi (order 12) │ /dsh-yazi/pty (required) │
├────────────────────┤ ───────► │ ├ attach(socket, {sid}) │
│ yazi view │ ◄─────── │ └ YaziSessions.obtain(sid) │
│ xterm.js + fit │ binary │ └ subprocess │
│ │ frames │ .spawnTerminal(yazi)│
└────────────────────┘ └──────────────────────────────┘
- Binary frames carry raw PTY bytes. xterm.js decodes them, so no byte of a UTF-8 sequence is ever split by the plugin.
- Text frames carry control messages: keystrokes, resize, quit, ping.
- One PTY per session keyed by session id. A WebSocket socket is only an
attachment: closing or switching the panel detaches without killing yazi, so
the directory and selection survive a trip to the conversation and back.
A reconnected socket triggers one ±1 column resize round trip, which fires
SIGWINCHand makes yazi repaint the whole screen. - Unattached sessions are reclaimed after
idleMinutes(default 30,0disables the reaper). The toolbar can quit yazi explicitly, and unloading the plugin terminates every session.
Refresh vs quit vs unload
| Action | Effect |
|---|---|
| Switch to another view tab | Socket detaches; yazi keeps running |
| Come back to the Yazi tab | Reattach, yazi repaints, same directory |
| Toolbar Reopen | Kill this session's PTY and start a fresh one |
| Toolbar Quit yazi | Terminate the PTY; the panel offers Reopen |
Idle past idleMinutes |
PTY terminated, next visit starts fresh |
| Disable/uninstall plugin | Every PTY terminated, route unregistered |
Configuration
cordis.patch.yml sets the defaults; override them in the plugin row.
| Key | Default | Meaning |
|---|---|---|
yaziPath |
yazi |
Executable name on PATH, or an absolute path |
extraArgs |
[] |
Extra argv passed to yazi |
cols / rows |
100 / 30 |
Initial PTY size before the panel fits itself |
idleMinutes |
30 |
Reclaim an unattached PTY after this long; 0 disables |
maxSessions |
8 |
Cap on live PTYs; the least recently used unattached one is evicted |
editor |
unset | Value exported as EDITOR inside yazi |
telemetryLevel |
daily |
Anonymous install + DAU statistics: daily (on, default), install (first run only), off (never) |
Requirements and limits
- yazi must be installed (
brew install yazi) and on the Host'sPATH, oryaziPathmust point at it. Without it the panel reportsyazi was not found on the host. - The page must reach the Host directly. The terminal socket needs the
same-origin session cookie and a Host origin; the HTTP GUI at
http://127.0.0.1:<port>is the verified path. The packaged desktop page is served fromdsh-app://app, which only works if the shell forwards the socket with a rewritten Origin — untested here, so treat the browser GUI as the supported surface. - yazi runs as you, outside the DSH file sandbox. That is deliberate: a file manager confined to one workspace cannot do its job. The route requires authentication before it allocates anything.
- yazi reads your own
~/.config/yazi. If that configuration has an error, yazi's own error dialog appears inside the panel — that text comes from yazi, not from this plugin. - The panel toolbar shows the directory it actually opened, so a silently substituted directory is visible rather than assumed. It never shows the live working directory, which can differ when a worktree is checked out.
Development
make build # regenerate vendor.js + client.js
make test # node --test
make check # build + test
Design notes live in DECISIONS.md; hard-won traps in LESSONS.md.


No comments yet. Be the first to write one.