Skip to content

Commit 4fab160

Browse files
committed
feat(windows): support remote attach to unix hosts
1 parent d57cefb commit 4fab160

25 files changed

Lines changed: 1653 additions & 484 deletions

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,15 @@ schemars = { version = "1.2.1", features = ["derive"] }
4949
portable-pty = { path = "vendor/portable-pty" }
5050

5151
[target.'cfg(windows)'.dependencies]
52+
# UTF-16 SDDL input for interprocess security descriptors.
53+
widestring = "1.2"
5254
wmi = { version = "0.18.4", default-features = false }
5355
windows-sys = { version = "0.61.2", features = [
5456
"Wdk_System_Threading",
5557
"Win32_Foundation",
5658
"Win32_Globalization",
59+
"Win32_Security",
60+
"Win32_Storage_FileSystem",
5761
"Win32_System_DataExchange",
5862
"Win32_System_Diagnostics_Debug",
5963
"Win32_System_Diagnostics_ToolHelp",

‎docs/next/website/src/content/docs/configuration.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ Deleting a worktree checkout is explicit. Use `Delete worktree checkout...` on a
9898

9999
## Remote attach
100100

101-
Remote attach manages its SSH connection with a temporary keepalive and connection-reuse fallback by default.
101+
Remote attach manages its SSH connection with temporary keepalives and, where supported, connection reuse by default.
102102

103103
```toml
104104
[remote]
105105
manage_ssh_config = true
106106
```
107107

108-
When enabled, `herdr --remote` writes a private temporary SSH config that includes your `~/.ssh/config` and `/etc/ssh/ssh_config` first, then adds fallback `ServerAliveInterval` and `ServerAliveCountMax` values. Your own keepalive settings win. Herdr also uses a private per-attach OpenSSH control socket to reuse the first authenticated connection. Set `manage_ssh_config = false` to run remote attach through plain `ssh` without Herdr's generated config or control socket.
108+
When enabled, `herdr --remote` writes a private temporary SSH config that includes your user and system SSH configs first, then adds fallback `ServerAliveInterval` and `ServerAliveCountMax` values. Your own keepalive settings win. Linux and macOS clients also use a private per-attach OpenSSH control socket to reuse the first authenticated connection; Windows OpenSSH does not. Set `manage_ssh_config = false` to run remote attach through plain `ssh` without Herdr's generated config or control socket.
109109

110110
## Keybindings
111111

‎docs/next/website/src/content/docs/ja/configuration.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ worktree チェックアウトの削除は明示的に行います。グルー
9898

9999
## リモートアタッチ
100100

101-
リモートアタッチは、デフォルトで一時的なキープアライブと接続再利用のフォールバックを使って SSH 接続を管理します。
101+
リモートアタッチは、デフォルトで一時的なキープアライブと、対応する環境では接続再利用を使って SSH 接続を管理します。
102102

103103
```toml
104104
[remote]
105105
manage_ssh_config = true
106106
```
107107

108-
有効な場合、`herdr --remote` は最初に `~/.ssh/config` と `/etc/ssh/ssh_config` を取り込み、その後にフォールバックの `ServerAliveInterval` と `ServerAliveCountMax` の値を加えた、プライベートな一時 SSH 設定を書き込みます。ユーザー自身のキープアライブ設定が優先されます。Herdr は、最初に認証した接続を再利用するため、アタッチごとにプライベートな OpenSSH コントロールソケットも使います。Herdr が生成した設定やコントロールソケットを使わず、通常の `ssh` でリモートアタッチを実行するには `manage_ssh_config = false` を設定してください。
108+
有効な場合、`herdr --remote` は最初にユーザーとシステムの SSH 設定を取り込み、その後にフォールバックの `ServerAliveInterval` と `ServerAliveCountMax` の値を加えた、プライベートな一時 SSH 設定を書き込みます。ユーザー自身のキープアライブ設定が優先されます。Linux と macOS クライアントは、最初に認証した接続を再利用するため、アタッチごとにプライベートな OpenSSH コントロールソケットも使います。Windows OpenSSH ではこの接続再利用を使いません。Herdr が生成した設定やコントロールソケットを使わず、通常の `ssh` でリモートアタッチを実行するには `manage_ssh_config = false` を設定してください。
109109

110110
## キーバインド
111111

‎docs/next/website/src/content/docs/ja/persistence-remote.mdx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ Host workbox
6363
herdr --remote workbox
6464
```
6565

66-
リモートアタッチは x86_64 と aarch64 の Linux および macOS ホストをサポートします。Herdr はリモートのプラットフォームを確認し、リモートの `PATH` 上にある一致する `herdr` を優先し、次に `~/.local/bin/herdr` を確認します。一致するバイナリがない場合、対話的な実行では `~/.local/bin/herdr` へのインストールを提案します。非対話的な実行はホストを変更せずに失敗します。`~/.local/bin` がリモートの `PATH` にない場合、Herdr はインストール後に警告します。
66+
リモートアタッチは、Linux、macOS、Windows のローカルクライアントから、x86_64 と aarch64 の Linux および macOS ホストへの接続をサポートします。Herdr はリモートのプラットフォームを確認し、リモートの `PATH` 上にある一致する `herdr` を優先してから、一般的な直接インストール、Homebrew、mise、Nix プロファイルのパスを確認します。一致するバイナリがない場合、対話的な実行では `~/.local/bin/herdr` へのインストールを提案します。非対話的な実行はホストを変更せずに失敗します。`~/.local/bin` がリモートの `PATH` にない場合、Herdr はインストール後に警告します。Windows をリモートホストとして使うことはできません。
6767

68-
ネイティブ Windows の `herdr --remote` は Windows ベータの範囲外です。Windows からはサーバーに SSH してそこで `herdr` を実行してください。
69-
70-
デフォルトでは、`herdr --remote` はあなたの SSH config を最初に include し、その後にフォールバックのキープアライブ設定を加えた一時的な SSH config を通してブリッジを実行します。既存のユーザーのキープアライブ設定が優先されます。Herdr が生成するブリッジ設定を使わず素の `ssh` を使うには `[remote].manage_ssh_config = false` を設定してください。
68+
デフォルトでは、`herdr --remote` はユーザーの SSH config を最初に include し、その後にフォールバックのキープアライブ設定を加えた一時的な SSH config を通してリモートセットアップとブリッジを実行します。既存のユーザーのキープアライブ設定が優先されます。Linux と macOS クライアントは接続再利用用のプライベートなアタッチ単位コントロールソケットも使いますが、Windows OpenSSH では使いません。Herdr が生成する設定やコントロールソケットを使わず通常の `ssh` を使うには `[remote].manage_ssh_config = false` を設定してください。
7169

7270
デフォルトでは、実行中のリモートサーバーの置き換えや再起動が必要な場合、リモートアタッチは通常の再起動/停止フローを使います。対応する実行中リモートサーバーで実験的なライブハンドオフにオプトインするには `--handoff` を渡します:
7371

‎docs/next/website/src/content/docs/ja/windows-beta.mdx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Windows ベータビルドはプレビューチャンネルでのみ提供され
2626
| ローカル永続セッション | ベータ |
2727
| ConPTY によるネイティブペイン | ベータ |
2828
| Windows Terminal / PowerShell アプリからのアタッチ | ベータ |
29+
| Linux/macOS ホストへの `herdr --remote` | ベータ |
30+
| リモートクリップボード画像と画像ファイルのドロップ | ベータ |
2931
| `cmd.exe` ペイン | ベータ |
3032
| 起動時 cwd とワークスペースラベル | ベータ |
3133
| ペイン起動時の cwd | ベータ |
@@ -47,14 +49,14 @@ Windows のエージェントプロセス検出は、ペインのシェルの子
4749
| --- | --- |
4850
| シェルで `cd` した後のライブ cwd | 部分的 |
4951
| シェルインテグレーション/OSC7 によるライブ cwd | ベータ |
50-
| エージェントへのクリップボード画像貼り付け | 未検証 |
52+
| ローカルペインのエージェントへのクリップボード画像貼り付け | 未検証 |
5153
| CJK IME の変換候補位置 | 部分的 |
5254
| Kitty graphics のレンダリング | 未検証 |
5355
| ホストカーソル描画 | 部分的 |
5456

5557
Herdr はペインを正しいディレクトリで起動でき、Herdr を起動したディレクトリから最初のワークスペースを作成できます。起動後の PowerShell のディレクトリ変更は別問題です: Herdr が調べられるプロセスのフィールドは、その後の論理的な `cd` の変化を確実には追跡しません。ライブ cwd の報告には Herdr インテグレーションかプロンプトのシェルインテグレーションを使ってください。
5658

57-
Windows Terminal は特定のエージェント向けに画像貼り付け経路をサポートしているかもしれませんが、Herdr 自身のクリップボード画像リーダーはまだ Windows に配線されていません。Windows のクリップボードブリッジが実装・テストされるまで、`alt+v` の画像貼り付けは未検証として扱ってください。リモートクリップボードの画像ブリッジは別機能で、引き続き Unix/macOS の `herdr --remote` に紐づいています。
59+
`herdr --remote` では、設定されたリモート画像貼り付けキーが Windows のクリップボード画像を読み取り、リモートホストへ転送します。Windows Terminal にローカル画像ファイルをひとつドロップした場合も、そのファイルを転送してリモート側のパスを貼り付けます。ローカルのネイティブ Windows ペインへのクリップボード画像貼り付けは、引き続き未検証です。
5860

5961
Kitty graphics は実験的なままで、まだ Windows でのサポートを謳っていません。Windows Terminal での画像レンダリングを特にテストしているのでない限り、`experimental.kitty_graphics = false` のままにしてください。
6062

@@ -92,22 +94,20 @@ Herdr のペインテキストコピーは Windows ベータで動作します
9294
| 機能 | 状況 |
9395
| --- | --- |
9496
| ダイレクトターミナルアタッチ | 未サポート |
95-
| Windows バイナリからの `herdr --remote` | 未サポート |
97+
| `herdr --remote` の接続先としての Windows | 未サポート |
9698
| ライブサーバーハンドオフ | 未サポート |
9799
| Unix ファイルディスクリプタのハンドオフ | 未サポート |
98100
| Unix フォアグラウンドプロセスグループ | 未サポート |
99-
| リモートクリップボード画像ブリッジ | 未サポート |
100101
| プレフィックスによる入力ソース切り替え | 未サポート |
101102
| 署名済みバイナリ / SmartScreen 回避 | 未サポート |
102103

103-
Windows からのリモート作業は、サーバーに SSH してそこで `herdr` を実行してください:
104+
Windows Terminal からは、Linux や macOS と同じリモートコマンドを使います:
104105

105106
```powershell
106-
ssh you@server
107-
herdr
107+
herdr --remote workbox
108108
```
109109

110-
このモードでは Herdr はリモートホスト上で動きます。ネイティブ Windows の `herdr --remote` はベータの範囲外です。
110+
接続先ホストは Linux または macOS である必要があります。Herdr はインストール済みの Windows OpenSSH クライアントと SSH 設定を使います。Windows OpenSSH では Herdr の Unix コントロールソケットによる接続再利用を使わないため、セットアップ中の繰り返しプロンプトを避けるには Windows の `ssh-agent` による鍵認証を推奨します。
111111

112112
Windows のアップデートは Windows インストーラー経由で行われ、バージョン付きインストールジャンクションを更新します。アップデート後は実行中の Herdr セッションを再起動してください。ライブハンドオフは Unix 専用です。
113113

‎docs/next/website/src/content/docs/persistence-remote.mdx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ Then attach with:
6363
herdr --remote workbox
6464
```
6565

66-
Remote attach supports Linux and macOS hosts on x86_64 and aarch64. Herdr checks the remote platform, prefers a matching `herdr` already on the remote `PATH`, then checks common direct, Homebrew, mise, and Nix profile install paths. If no matching binary exists, interactive runs prompt to install one to `~/.local/bin/herdr`; non-interactive runs fail instead of modifying the host. If `~/.local/bin` is not on the remote `PATH`, Herdr warns after install.
66+
Remote attach supports Linux, macOS, and Windows local clients connecting to Linux or macOS hosts on x86_64 and aarch64. Herdr checks the remote platform, prefers a matching `herdr` already on the remote `PATH`, then checks common direct, Homebrew, mise, and Nix profile install paths. If no matching binary exists, interactive runs prompt to install one to `~/.local/bin/herdr`; non-interactive runs fail instead of modifying the host. If `~/.local/bin` is not on the remote `PATH`, Herdr warns after install. Windows is not supported as the remote host.
6767

68-
Native Windows `herdr --remote` is not part of the Windows beta. From Windows, SSH into the server and run `herdr` there.
69-
70-
By default, `herdr --remote` runs remote setup and the bridge through a temporary SSH config that includes your SSH config first, then adds fallback keepalive settings and a private per-attach control socket for connection reuse. Existing user keepalive settings win. Set `[remote].manage_ssh_config = false` to use plain `ssh` without Herdr's generated config or control socket.
68+
By default, `herdr --remote` runs remote setup and the bridge through a temporary SSH config that includes your SSH config first, then adds fallback keepalive settings. Existing user keepalive settings win. Linux and macOS clients also use a private per-attach control socket for connection reuse; Windows OpenSSH does not. Set `[remote].manage_ssh_config = false` to use plain `ssh` without Herdr's generated config or control socket.
7169

7270
Remote attach uses your normal OpenSSH authentication. If the target uses a passphrase-protected key in a non-interactive shell, script, CI job, or mobile terminal that cannot show the passphrase prompt, load the key into ssh-agent first:
7371

‎docs/next/website/src/content/docs/windows-beta.mdx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ For internal beta testing, `HERDR_MANIFEST_URL` can point the installer at a cus
2626
| Local persistent sessions | beta |
2727
| Native panes through ConPTY | beta |
2828
| Windows Terminal / PowerShell app attach | beta |
29+
| `herdr --remote` to Linux/macOS hosts | beta |
30+
| Remote clipboard images and image-file drops | beta |
2931
| `cmd.exe` panes | beta |
3032
| Startup cwd and workspace labels | beta |
3133
| Pane launch cwd | beta |
@@ -47,14 +49,14 @@ Plugins support `windows` as a manifest platform in preview. GitHub install, loc
4749
| --- | --- |
4850
| Live cwd after shell `cd` | partial |
4951
| Live cwd via shell integration/OSC7 | beta |
50-
| Clipboard image paste to agents | unverified |
52+
| Clipboard image paste to agents in local panes | unverified |
5153
| CJK IME composition anchoring | partial |
5254
| Kitty graphics rendering | unverified |
5355
| Host cursor rendering | partial |
5456

5557
Herdr can launch panes in the right directory and can create the initial workspace from the directory where you started Herdr. PowerShell directory changes after startup are different: the process field Herdr can inspect does not reliably track later logical `cd` changes. Use Herdr integrations or prompt shell integration for live cwd reporting.
5658

57-
Windows Terminal may support image paste paths for specific agents, but Herdr's own clipboard-image reader is not wired on Windows yet. Treat `alt+v` image paste as unverified until the Windows clipboard bridge is implemented and tested. Remote clipboard image bridging is separate and remains tied to Unix/macOS `herdr --remote`.
59+
During `herdr --remote`, the configured remote image paste key reads a Windows clipboard image and transfers it to the remote host. Dropping one local image file into Windows Terminal also transfers that file and pastes its remote path. Clipboard image paste into a local native Windows pane remains unverified.
5860

5961
Kitty graphics remains experimental and is not claimed as Windows-supported yet. Leave `experimental.kitty_graphics = false` unless you are specifically testing image rendering in Windows Terminal.
6062

@@ -92,22 +94,20 @@ For text paste, use `ctrl+shift+v` in Windows Terminal. Multiline text paste is
9294
| Capability | Status |
9395
| --- | --- |
9496
| Direct terminal attach | unsupported |
95-
| `herdr --remote` from the Windows binary | unsupported |
97+
| Windows as a `herdr --remote` target host | unsupported |
9698
| Live server handoff | unsupported |
9799
| Unix file-descriptor handoff | unsupported |
98100
| Unix foreground process groups | unsupported |
99-
| Remote clipboard image bridge | unsupported |
100101
| Prefix input-source switching | unsupported |
101102
| Signed binary / SmartScreen avoidance | unsupported |
102103

103-
For remote work from Windows, SSH into the server and run `herdr` there:
104+
From Windows Terminal, use the same remote command as Linux and macOS:
104105

105106
```powershell
106-
ssh you@server
107-
herdr
107+
herdr --remote workbox
108108
```
109109

110-
That mode runs Herdr on the remote host. Native Windows `herdr --remote` is not part of the beta.
110+
The target host must run Linux or macOS. Herdr uses the installed Windows OpenSSH client and your SSH configuration. Windows OpenSSH does not use Herdr's Unix control-socket reuse, so key authentication through Windows `ssh-agent` is recommended to avoid repeated prompts during remote setup.
111111

112112
Windows updates run through the Windows installer and update the versioned install junction. Restart running Herdr sessions after updating. Live handoff is Unix-only.
113113

‎docs/next/website/src/content/docs/zh-cn/configuration.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ Git 工作区行提供 worktree 操作。`New worktree` 会创建检出:如果
9898

9999
## 远程连接
100100

101-
远程连接默认使用临时保活设置和连接复用兜底来管理 SSH 连接。
101+
远程连接默认使用临时保活设置,并在支持时复用连接,以管理 SSH 连接。
102102

103103
```toml
104104
[remote]
105105
manage_ssh_config = true
106106
```
107107

108-
启用后,`herdr --remote` 会写入一份私有的临时 SSH 配置:先包含你的 `~/.ssh/config` 和 `/etc/ssh/ssh_config`,再添加兜底的 `ServerAliveInterval` 和 `ServerAliveCountMax` 值。你自己的保活设置优先。Herdr 还会为每次远程连接使用私有的 OpenSSH control socket,以复用首次通过身份验证的连接。设置 `manage_ssh_config = false` 可通过普通 `ssh` 进行远程连接,不使用 Herdr 生成的配置或 control socket。
108+
启用后,`herdr --remote` 会写入一份私有的临时 SSH 配置:先包含用户和系统 SSH 配置,再添加兜底的 `ServerAliveInterval` 和 `ServerAliveCountMax` 值。你自己的保活设置优先。Linux 和 macOS 客户端还会为每次远程连接使用私有的 OpenSSH control socket,以复用首次通过身份验证的连接;Windows OpenSSH 不使用此复用方式。设置 `manage_ssh_config = false` 可通过普通 `ssh` 进行远程连接,不使用 Herdr 生成的配置或 control socket。
109109

110110
## 按键绑定
111111

0 commit comments

Comments
 (0)