diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-06 02:27:06 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-06 02:27:06 +0300 |
| commit | 9e9bc8a144667a6b7debfd4f0c7a31ff0e11493a (patch) | |
| tree | 03f1259f91fd9edeacfd4b904f2e84d4acf25232 /docs | |
| parent | 35b0dff96579f099e0436290085024424ffb289c (diff) | |
feat: manage multiple ssh machines from one client (#3670)
Diffstat (limited to 'docs')
11 files changed, 238 insertions, 9 deletions
diff --git a/docs/next/api/herdr-api.schema.json b/docs/next/api/herdr-api.schema.json index b625e276..b3990e96 100644 --- a/docs/next/api/herdr-api.schema.json +++ b/docs/next/api/herdr-api.schema.json @@ -1689,6 +1689,18 @@ ], "type": "object" }, + "ClientShellSurfaceSetParams": { + "description": "Updates whether the requesting client shell receives and controls pane presentation.", + "properties": { + "active": { + "type": "boolean" + } + }, + "required": [ + "active" + ], + "type": "object" + }, "ClientWindowTitleSetParams": { "properties": { "title": { @@ -4930,6 +4942,22 @@ { "properties": { "method": { + "const": "client_shell.surface.set", + "type": "string" + }, + "params": { + "$ref": "#/schemas/request/$defs/ClientShellSurfaceSetParams" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + { + "properties": { + "method": { "const": "session.snapshot", "type": "string" }, @@ -10459,6 +10487,29 @@ "type": "object" }, { + "description": "Acknowledgement for the client-shell surface interest lease. This method is new on the\nendpoint protocol, so its revision-bearing result can establish an activation floor.", + "properties": { + "active": { + "type": "boolean" + }, + "projection_revision": { + "format": "uint64", + "minimum": 0, + "type": "integer" + }, + "type": { + "const": "client_shell_surface_set", + "type": "string" + } + }, + "required": [ + "type", + "active", + "projection_revision" + ], + "type": "object" + }, + { "properties": { "type": { "const": "ok", @@ -10487,8 +10538,18 @@ "null" ] }, + "health_check": { + "default": false, + "description": "Whether this server supports endpoint health probes.", + "type": "boolean" + }, "live_handoff": { "type": "boolean" + }, + "surface_interest": { + "default": false, + "description": "Whether this server supports explicit client-shell surface interest.", + "type": "boolean" } }, "required": [ diff --git a/docs/next/website/src/content/docs/cli-reference.mdx b/docs/next/website/src/content/docs/cli-reference.mdx index 0e147934..d82a550a 100644 --- a/docs/next/website/src/content/docs/cli-reference.mdx +++ b/docs/next/website/src/content/docs/cli-reference.mdx @@ -45,6 +45,23 @@ herdr api schema --output herdr-api.schema.json with the installed binary. Use `--json` for the full JSON Schema document, or `--output PATH` to write that document to a file. +## Saved SSH machines + +```bash +herdr machine list [--json] +herdr machine add workbox --label "Build machine" [--remote-session agents] +herdr machine rename <profile-id> --label "New name" +herdr machine disable <profile-id> +herdr machine enable <profile-id> +herdr machine remove <profile-id> +``` + +`machine add` checks the remote installation's capabilities, installs or updates with approval only when needed, and starts the requested session's background server before saving. Compatible release versions do not need to match. Run setup in an interactive terminal when installation or restart approval is required; failed or cancelled setup does not save a profile. + +Changes apply automatically to open local Herdr clients, normally within a second. Added or enabled machines connect in the background; renaming does not reconnect. Removing or disabling disconnects only that machine and leaves its remote sessions running. Removing the machine you are viewing returns to Local, or shows Local as unavailable until it reconnects. Each profile stores an opaque ID, label, SSH target, explicit remote session, and enabled state in client state. Herdr does not store passwords, private keys, or other SSH credentials. + +Automatic connections and reconnects are non-interactive. If a host key, password, key passphrase, MFA step, install, update, or restart needs approval, the machine shows Attention instead of opening a hidden prompt. Run the standalone command printed by Herdr, such as `herdr --remote workbox --session agents --handoff`, to complete that setup in the foreground, then restart the client. + ## Shell completions ```bash diff --git a/docs/next/website/src/content/docs/configuration.mdx b/docs/next/website/src/content/docs/configuration.mdx index 84eaedbc..63ce3186 100644 --- a/docs/next/website/src/content/docs/configuration.mdx +++ b/docs/next/website/src/content/docs/configuration.mdx @@ -352,7 +352,7 @@ The expanded desktop sidebar renders each inner array in `rows` as one line. The [ui.sidebar.agents] row_gap = 0 rows = [ - ["state_icon", "workspace", "tab"], + ["state_icon", "machine", "workspace", "tab"], ["agent"], ] @@ -368,6 +368,7 @@ Agent rows accept these built-in tokens: - `state_icon` — colored icon for the agent's semantic state. - `state_text` — `idle`, `working`, `blocked`, `done`, or `unknown`, including a reported display label when present. +- `machine` — machine label when the client has multiple machines; omitted for a single local machine. - `workspace` — workspace name. - `tab` — tab name when available. - `pane` — pane name when available. @@ -385,7 +386,7 @@ Space rows accept these built-in tokens: - `git_status` — Git ahead and behind counts when nonzero. - `$name` — custom workspace metadata named `name`. -Tokens render in their configured order. Herdr normally separates adjacent values with ` · ` and uses a single space after `state_icon`. Missing values and their separators disappear; a row disappears when none of its tokens have a value. Each layout may contain at most 16 rows, with at most 16 tokens in each row. +Tokens render in their configured order. Herdr normally separates adjacent values with ` · ` and uses a single space after `state_icon`. Missing values and their separators disappear; a row disappears when none of its tokens have a value. Existing custom rows remain unchanged, so add `machine` explicitly if you want machine identity in a custom multi-machine layout. Each layout may contain at most 16 rows, with at most 16 tokens in each row. A token entry can also be an inline style table: diff --git a/docs/next/website/src/content/docs/ja/cli-reference.mdx b/docs/next/website/src/content/docs/ja/cli-reference.mdx index b5930e1a..7448297a 100644 --- a/docs/next/website/src/content/docs/ja/cli-reference.mdx +++ b/docs/next/website/src/content/docs/ja/cli-reference.mdx @@ -43,6 +43,23 @@ herdr api schema --output herdr-api.schema.json `herdr api schema` は、インストール済みバイナリに同梱されたソケットプロトコルスキーマの短い概要を表示します。完全な JSON Schema ドキュメントが欲しいときは `--json` を使い、ファイルに書き出すには `--output PATH` を使ってください。 +## 保存済み SSH マシン + +```bash +herdr machine list [--json] +herdr machine add workbox --label "Build machine" [--remote-session agents] +herdr machine rename <profile-id> --label "New name" +herdr machine disable <profile-id> +herdr machine enable <profile-id> +herdr machine remove <profile-id> +``` + +`machine add` はリモート側の Herdr が必要な機能を備えているか確認し、必要な場合だけ承認を得てインストールまたは更新します。指定したセッションのバックグラウンドサーバーを起動してからプロファイルを保存します。互換性があればリリースバージョンは一致しなくてもかまいません。インストールや再起動の承認が必要な場合は、対話型ターミナルで実行してください。セットアップが失敗またはキャンセルされた場合、プロファイルは保存されません。 + +変更は、開いているローカルの Herdr クライアントに通常 1 秒以内に自動反映されます。追加または有効化したマシンにはバックグラウンドで接続し、名前の変更では再接続しません。削除または無効化すると、そのマシンだけが切断され、リモートセッションは動き続けます。表示中のマシンを削除すると Local に戻ります。Local に接続できない場合は、再接続するまで利用不可と表示します。各プロファイルは、不透明な ID、ラベル、SSH 接続先、明示的なリモートセッション名、有効状態をクライアントの状態ファイルに保存します。パスワード、秘密鍵、その他の SSH 認証情報は保存しません。 + +自動接続と再接続は非対話型です。ホスト鍵、パスワード、鍵のパスフレーズ、MFA、インストール、更新、再起動に承認が必要な場合、隠れたプロンプトを開くのではなく Attention と表示します。`herdr --remote workbox --session agents --handoff` など、Herdr が表示する単独接続用のコマンドを実行してフォアグラウンドでセットアップを完了し、クライアントを再起動してください。 + ## シェル補完 ```bash diff --git a/docs/next/website/src/content/docs/ja/configuration.mdx b/docs/next/website/src/content/docs/ja/configuration.mdx index 82248d4d..8377d56c 100644 --- a/docs/next/website/src/content/docs/ja/configuration.mdx +++ b/docs/next/website/src/content/docs/ja/configuration.mdx @@ -348,7 +348,7 @@ status_indicators = "symbols" [ui.sidebar.agents] row_gap = 0 rows = [ - ["state_icon", "workspace", "tab"], + ["state_icon", "machine", "workspace", "tab"], ["agent"], ] @@ -364,6 +364,7 @@ Agent の行では、次の組み込みトークンを使えます: - `state_icon` — エージェントの意味的な状態を示す色付きアイコン。 - `state_text` — `idle`、`working`、`blocked`、`done`、`unknown`。報告された表示ラベルがある場合はそれも含みます。 +- `machine` — クライアントに複数のマシンがある場合のマシンラベル。ローカルマシン 1 台だけの場合は省略されます。 - `workspace` — ワークスペース名。 - `tab` — 利用可能な場合はタブ名。 - `pane` — 利用可能な場合はペイン名。 @@ -381,7 +382,7 @@ Space の行では、次の組み込みトークンを使えます: - `git_status` — 0 でない場合は Git の ahead と behind の件数。 - `$name` — `name` という名前のカスタムワークスペースメタデータ。 -トークンは設定された順序で描画されます。Herdr は通常、隣接する値を ` · ` で区切り、`state_icon` の後には空白を 1 つ入れます。値がない場合、その値と区切りは表示されません。すべてのトークンに値がない行は表示されません。各レイアウトは最大 16 行、各行は最大 16 トークンです。 +トークンは設定された順序で描画されます。Herdr は通常、隣接する値を ` · ` で区切り、`state_icon` の後には空白を 1 つ入れます。値がない場合、その値と区切りは表示されません。すべてのトークンに値がない行は表示されません。既存のカスタム行は変更されません。カスタムの複数マシンレイアウトでマシンを識別したい場合は、`machine` を明示的に追加してください。各レイアウトは最大 16 行、各行は最大 16 トークンです。 トークンエントリにはインラインのスタイルテーブルも使えます: diff --git a/docs/next/website/src/content/docs/ja/persistence-remote.mdx b/docs/next/website/src/content/docs/ja/persistence-remote.mdx index 23c6e817..b83c3b89 100644 --- a/docs/next/website/src/content/docs/ja/persistence-remote.mdx +++ b/docs/next/website/src/content/docs/ja/persistence-remote.mdx @@ -35,6 +35,43 @@ herdr session stop work --json herdr session delete side-project --json ``` +## 保存済み SSH マシン + +よく使う接続先を保存すると、1 つの Herdr クライアントから複数のマシンで作業できます: + +```bash +herdr machine add workbox --label "Build machine" --remote-session agents +herdr machine add ssh://you@server:2222 --label "Production" --remote-session operations +herdr machine list +``` + +`machine add` はリモートマシンに Herdr を準備し、指定したセッションのバックグラウンドサーバーを起動してからプロファイルを保存します。インストール済みバイナリとは別に実行中のサーバーを確認し、クライアントとリリースバージョンが異なっていても、互換性があればそのまま使用します。実行中のサーバーに更新が必要な場合、対応していればライブハンドオフでペインのプロセスを維持します。対応していなければ、サーバーを停止する前に確認します。Herdr が未インストールまたは非互換の場合は、`--remote` と同じ承認付きのセットアップを行います。承認が必要な場合は対話型ターミナルで実行してください。キャンセルするとプロファイルは保存されません。セットアップ終了後もリモートサーバーは動き続けます。 + +保存済みマシンの変更は、開いているローカルの Herdr クライアントに通常 1 秒以内に自動反映されます。マシンの切り替え中の場合は、切り替えが完了してから反映します。追加または有効化した SSH マシンはサイドバーに Local と並んで表示され、選択を変えずにバックグラウンドで接続します。マシンまたはそのワークスペースを選ぶと切り替わります。接続中のマシンのメタデータ、エージェント状態、通知は引き続き利用できますが、ペイン画面、入力、表示領域、グラフィックスのやり取りは選択中のマシンだけに限定されます。2 つのサーバーが同じ内部 ID を使っていても、ワークスペース、タブ、ペイン、エージェント、グラフィックスの識別情報はマシンごとに分離されます。 + +起動時は保存済み SSH マシンを待たず、接続バッジも表示せずに Local を開きます。有効な保存済みマシンがあれば、Local への接続に失敗してもクライアントを開けます。Local の停止や再起動で正常な SSH 接続が閉じることはありません。Local のサーバーが戻ると、使用中のマシンから選択を奪わずに再接続します。応答しないマシンが、別のマシンへの入力や接続処理を妨げることはありません。 + +Herdr は接続中の SSH マシンのアプリケーションレベルの通信を監視し、通信がない間は軽量なヘルスチェックを行います。Local ではリモート用のヘルスチェックを使わず、接続の終了や失敗で切断を検知します。スリープ、ネットワークの中断、SSH の障害などで接続が不健全になると Reconnecting と表示し、上限のある待機間隔で再試行します。最後のワークスペース、エージェント、選択中のペインの状態は暗く表示されたまま固定され、新しい接続と整合した画面が届くまで入力やその状態への移動は無効になります。再接続がプロンプトに回答したり、リモートサーバーのインストール、更新、再起動、ハンドオフを行ったりすることはありません。ホスト鍵の承認、認証、互換性のある Herdr のインストールが必要な接続先は Attention と表示され、Local とほかのマシンはそのまま使えます。プロファイルに対応する単独接続用のコマンドをターミナルで実行してセットアップを完了してください。例: + +```bash +herdr --remote workbox --session agents --handoff +``` + +Attention と表示されている場合は、セットアップ後にクライアントを再起動して接続を再試行してください。名前の変更、無効化、削除にはプロファイルの不透明な ID を使います: + +```bash +herdr machine rename <profile-id> --label "New name" +herdr machine disable <profile-id> +herdr machine enable <profile-id> +herdr machine remove <profile-id> +``` + +名前の変更はラベルだけを更新し、再接続しません。削除または無効化すると、クライアントからそのマシンだけを切断します。マシンに到達できなくても削除でき、リモートセッションは動き続けます。表示中のマシンを削除または無効化すると Local に戻ります。Local が利用できない場合は、別のリモートを選ぶのではなく、利用不可と表示して再接続します。保存済みマシンのファイルが読めない、または不正な場合は、現在の接続を変更せずに通知を表示し、自動で読み込みを再試行します。 + +保存するのは、不透明な ID、ラベル、SSH 接続先、明示的なリモートセッション名、有効状態だけです。パスワード、秘密鍵、エージェントのチケット、SSH 制御ソケットをマシンカタログに保存することはありません。 + +クライアントはデフォルトでローカルのキーバインドを使います。選択中のマシンが公開するカスタムコマンドは、そのマシンで実行されます。Herdr はローカルのコマンドプラグイン、設定、実行ファイル、シークレットを SSH ホストにコピーしません。リモートに必要なコマンドやプラグインがなければ、エラーを表示します。 + ## SSH 越しのリモートアタッチ リモートモードは 2 つあり、[Herdr での作業の進め方](/ja/docs/how-to-work/)で比較しています。tmux スタイルの方法では、サーバーに SSH してそこで `herdr` を実行します。もうひとつは、ローカルマシンから SSH 越しにアタッチする方法です: diff --git a/docs/next/website/src/content/docs/persistence-remote.mdx b/docs/next/website/src/content/docs/persistence-remote.mdx index db9af01a..e5cec116 100644 --- a/docs/next/website/src/content/docs/persistence-remote.mdx +++ b/docs/next/website/src/content/docs/persistence-remote.mdx @@ -35,9 +35,46 @@ herdr session stop work --json herdr session delete side-project --json ``` +## Saved SSH machines + +Save repeat targets to work across several machines from one Herdr client: + +```bash +herdr machine add workbox --label "Build machine" --remote-session agents +herdr machine add ssh://you@server:2222 --label "Production" --remote-session operations +herdr machine list +``` + +`machine add` prepares Herdr on the remote machine and starts the requested session's background server before saving the profile. It checks the running server separately from the installed binary and keeps compatible servers, even when their release versions differ from your client. If the running server needs an upgrade, setup uses live handoff when supported to preserve pane processes; otherwise it asks before stopping the server. Missing or incompatible installations use the same approval-based setup as `--remote`; run the command in an interactive terminal when approval is needed. Cancelling setup leaves the profile unsaved. The remote server keeps running after setup exits. + +Saved-machine changes apply to open local Herdr clients automatically, normally within a second. An in-progress machine switch finishes before the change is applied. Added or enabled SSH machines appear with Local in the machine sidebar and connect in the background without changing your selection. Select a machine or one of its workspaces to switch to it. Herdr keeps metadata, agent state, and notifications from connected machines available, but streams pane surfaces, input, geometry, and graphics only for the selected machine. Workspace, tab, pane, agent, and graphics identities stay scoped to their machine even when two servers happen to use the same internal ID. + +Local opens directly on startup, without waiting for saved SSH machines or showing a connection badge. With enabled saved machines, the client can also open if Local actually fails, and stopping or restarting Local does not close healthy SSH connections. Local reconnects when its server returns, without taking selection away from the machine you are using. A stalled machine cannot block another machine's input or connection handling. + +Herdr checks connected SSH machines for application-level activity and uses a lightweight health probe while they are quiet. Local relies on its native connection closing or failing, not remote health probes. After sleep, a network interruption, or SSH failure, an unhealthy machine changes to Reconnecting and retries with bounded backoff. Its last workspace, agent, and selected pane state remains visible but dimmed and frozen; input and navigation into that cached state stay disabled until a fresh connection and coherent surface arrive. Reconnects never answer prompts or install, update, restart, or hand off a remote server. A target that needs host-key approval, authentication, or a compatible Herdr install shows Attention while Local and other machines keep working. Run the profile's explicit standalone command in a terminal to finish setup, for example: + +```bash +herdr --remote workbox --session agents --handoff +``` + +If the machine shows Attention, restart the client after setup to retry its connection. Rename, disable, or remove profiles by their opaque ID: + +```bash +herdr machine rename <profile-id> --label "New name" +herdr machine disable <profile-id> +herdr machine enable <profile-id> +herdr machine remove <profile-id> +``` + +Renaming updates the label without reconnecting. Removing or disabling a machine disconnects only that machine from the client; its remote sessions keep running, even if the machine is unreachable. If you remove or disable the machine you are viewing, the client returns to Local. If Local is unavailable, it shows that and reconnects rather than selecting another remote. An unreadable or invalid saved-machine file leaves current connections unchanged and shows a notice; the client retries reading it automatically. + +Saved profiles contain only the opaque ID, label, SSH target, explicit remote session, and enabled state. Passwords, private keys, agent tickets, and SSH control sockets are never stored in the machine catalog. + +The client uses local keybindings by default. Custom commands advertised by the selected machine still execute on that machine. Herdr does not copy local command plugins, configuration, executables, or secrets to SSH hosts; a missing remote command or plugin fails visibly. + ## Remote attach over SSH -Herdr supports two remote modes. [How to work with Herdr](/docs/how-to-work/) compares them. SSH to the server and run `herdr` there for the tmux-style path, or attach through SSH from your local machine: +Herdr supports two remote modes. [How to work with Herdr](/docs/how-to-work/) compares them. SSH to the server and run `herdr` there for the tmux-style path, use saved SSH machines for persistent multi-machine work, or attach through SSH from your local machine: ```bash herdr --remote workbox diff --git a/docs/next/website/src/content/docs/socket-api.mdx b/docs/next/website/src/content/docs/socket-api.mdx index eb61b532..13a71abb 100644 --- a/docs/next/website/src/content/docs/socket-api.mdx +++ b/docs/next/website/src/content/docs/socket-api.mdx @@ -938,8 +938,11 @@ Errors look like this: The client-rendered Herdr UI uses a stable endpoint generation for local and SSH servers. Client and server builds do not need to match. During connection setup, they agree on the core snapshot, screen, input, and blob codecs, and the server advertises -the API methods it supports. A missing method disables only that action on that -server and shows a client-local notice; it does not disconnect the UI. Rejected +the API methods and optional capabilities it supports. Saved SSH federation requires the +`surface_interest` capability so only the selected machine streams a pane surface and the +`health_check` capability so a quiet broken connection cannot remain Online indefinitely. A server +without this lifecycle support stays at Attention until it is explicitly updated. Other missing methods disable +only those actions and show a client-local notice; they do not disconnect the UI. Rejected or timed-out actions are also reported without ending the connection. Servers from before endpoint generation 1 need one final update. diff --git a/docs/next/website/src/content/docs/zh-cn/cli-reference.mdx b/docs/next/website/src/content/docs/zh-cn/cli-reference.mdx index f6ec3b6a..874143d8 100644 --- a/docs/next/website/src/content/docs/zh-cn/cli-reference.mdx +++ b/docs/next/website/src/content/docs/zh-cn/cli-reference.mdx @@ -43,6 +43,23 @@ herdr api schema --output herdr-api.schema.json `herdr api schema` 会打印安装的二进制中包含的 socket 协议 schema 简短摘要。需要完整 JSON Schema 文档时使用 `--json`;要写入文件则使用 `--output PATH`。 +## 已保存的 SSH 机器 + +```bash +herdr machine list [--json] +herdr machine add workbox --label "Build machine" [--remote-session agents] +herdr machine rename <profile-id> --label "New name" +herdr machine disable <profile-id> +herdr machine enable <profile-id> +herdr machine remove <profile-id> +``` + +`machine add` 会检查远程 Herdr 是否具备所需能力,仅在必要时征得批准后安装或更新,并在保存配置前启动指定会话的后台服务器。只要兼容,发行版本不必一致。需要批准安装或重启时,请在交互式终端中运行;设置失败或取消时不会保存配置。 + +更改会自动应用到已打开的本地 Herdr 客户端,通常在一秒内生效。新增或启用的机器在后台连接;重命名不会重新连接。移除或禁用只会断开该机器,远程会话仍会继续运行。移除正在查看的机器会返回 Local;如果 Local 不可用,则显示不可用状态,直到重新连接。每份配置在客户端状态文件中保存一个不透明 ID、标签、SSH 目标、明确的远程会话名和启用状态。Herdr 不保存密码、私钥或其他 SSH 凭据。 + +自动连接和重连均为非交互式。如果主机密钥、密码、密钥口令、MFA、安装、更新或重启需要批准,机器会显示 Attention,而不会打开隐藏的提示。请运行 Herdr 显示的独立连接命令,例如 `herdr --remote workbox --session agents --handoff`,在前台完成设置后重启客户端。 + ## Shell 补全 ```bash diff --git a/docs/next/website/src/content/docs/zh-cn/configuration.mdx b/docs/next/website/src/content/docs/zh-cn/configuration.mdx index 3943815f..a4c1a338 100644 --- a/docs/next/website/src/content/docs/zh-cn/configuration.mdx +++ b/docs/next/website/src/content/docs/zh-cn/configuration.mdx @@ -348,7 +348,7 @@ status_indicators = "symbols" [ui.sidebar.agents] row_gap = 0 rows = [ - ["state_icon", "workspace", "tab"], + ["state_icon", "machine", "workspace", "tab"], ["agent"], ] @@ -364,6 +364,7 @@ Agent 行支持以下内置 token: - `state_icon` — 智能体语义状态的彩色图标。 - `state_text` — `idle`、`working`、`blocked`、`done` 或 `unknown`;如果报告中包含显示标签,也会一并显示。 +- `machine` — 客户端连接多台机器时显示机器标签;只有一台本地机器时省略。 - `workspace` — 工作区名称。 - `tab` — 标签页名称(如有)。 - `pane` — 窗格名称(如有)。 @@ -381,7 +382,7 @@ Space 行支持以下内置 token: - `git_status` — 非零时显示 Git ahead 和 behind 数量。 - `$name` — 名为 `name` 的自定义工作区元数据。 -token 会按配置顺序渲染。Herdr 通常使用 ` · ` 分隔相邻值,并在 `state_icon` 后使用一个空格。缺失值及其分隔符会消失;当一行中的所有 token 都没有值时,该行会消失。每个布局最多可包含 16 行,每行最多可包含 16 个 token。 +token 会按配置顺序渲染。Herdr 通常使用 ` · ` 分隔相邻值,并在 `state_icon` 后使用一个空格。缺失值及其分隔符会消失;当一行中的所有 token 都没有值时,该行会消失。已有的自定义行不会改变;如果希望在自定义的多机器布局中显示机器标识,请显式添加 `machine`。每个布局最多可包含 16 行,每行最多可包含 16 个 token。 也可以用内联样式表定义 token: diff --git a/docs/next/website/src/content/docs/zh-cn/persistence-remote.mdx b/docs/next/website/src/content/docs/zh-cn/persistence-remote.mdx index 3f142547..a89a8ea3 100644 --- a/docs/next/website/src/content/docs/zh-cn/persistence-remote.mdx +++ b/docs/next/website/src/content/docs/zh-cn/persistence-remote.mdx @@ -35,6 +35,43 @@ herdr session stop work --json herdr session delete side-project --json ``` +## 已保存的 SSH 机器 + +保存常用目标后,即可从一个 Herdr 客户端跨多台机器工作: + +```bash +herdr machine add workbox --label "Build machine" --remote-session agents +herdr machine add ssh://you@server:2222 --label "Production" --remote-session operations +herdr machine list +``` + +`machine add` 会在远程机器上准备 Herdr,并在保存配置前启动指定会话的后台服务器。它会分别检查运行中的服务器和已安装的二进制文件;即使服务器的发行版本与客户端不同,只要兼容就会保留。如果运行中的服务器需要升级,设置过程会在支持时使用实时交接来保留窗格进程,否则会在停止服务器前询问。未安装或不兼容时,使用与 `--remote` 相同的批准流程;需要批准时请在交互式终端中运行。取消设置不会保存配置。设置退出后,远程服务器会继续运行。 + +已保存机器的更改会自动应用到已打开的本地 Herdr 客户端,通常在一秒内生效。如果正在切换机器,会等待切换完成再应用更改。新增或启用的 SSH 机器会与 Local 一起显示在机器侧边栏中,并在后台连接,不会改变当前选择。选择机器或其工作区即可切换。Herdr 保留已连接机器的元数据、agent 状态和通知,但只为选中的机器传输窗格画面、输入、显示区域和图形。即使两个服务器碰巧使用相同的内部 ID,工作区、标签页、窗格、agent 和图形的身份也始终按机器隔离。 + +启动时会直接打开 Local,不等待已保存的 SSH 机器,也不显示连接标记。有已启用的保存机器时,即使 Local 连接失败,客户端仍能打开。停止或重启 Local 不会关闭正常的 SSH 连接。Local 服务器恢复后会自动重连,不会从正在使用的机器抢走选择。无响应的机器不会阻塞其他机器的输入或连接处理。 + +Herdr 会监测已连接 SSH 机器的应用层活动,并在空闲时使用轻量健康探测。Local 依靠本地连接关闭或失败来判断断开,不使用远程健康探测。睡眠、网络中断或 SSH 故障后,不健康的机器会显示 Reconnecting,并以有上限的退避间隔重试。最后的工作区、agent 和选中窗格状态会保留,但变暗并冻结;在新连接和一致的画面到达前,无法输入或导航到这些缓存状态。重连不会回答提示,也不会安装、更新、重启或交接远程服务器。需要批准主机密钥、完成认证或安装兼容 Herdr 的目标会显示 Attention,Local 和其他机器仍可正常使用。请在终端中运行该配置对应的独立连接命令来完成设置,例如: + +```bash +herdr --remote workbox --session agents --handoff +``` + +如果机器显示 Attention,请在设置完成后重启客户端以重试连接。使用配置的不透明 ID 来重命名、禁用或移除: + +```bash +herdr machine rename <profile-id> --label "New name" +herdr machine disable <profile-id> +herdr machine enable <profile-id> +herdr machine remove <profile-id> +``` + +重命名只更新标签,不会重新连接。移除或禁用只会将该机器从客户端断开;即使机器无法访问也可操作,其远程会话仍会继续运行。如果移除或禁用正在查看的机器,客户端会返回 Local。如果 Local 不可用,会显示该状态并尝试重连,而不是选择另一台远程机器。保存机器的文件无法读取或内容无效时,当前连接保持不变,客户端会显示通知并自动重试读取。 + +保存的配置仅包含不透明 ID、标签、SSH 目标、明确的远程会话名和启用状态。密码、私钥、agent 票据和 SSH 控制套接字绝不会存入机器目录。 + +客户端默认使用本地按键绑定。选中机器公布的自定义命令仍在该机器上执行。Herdr 不会将本地命令插件、配置、可执行文件或机密复制到 SSH 主机;远程缺少命令或插件时会明确报错。 + ## 通过 SSH 远程连接 远程模式有两种;[使用 Herdr 的工作方式](/zh-cn/docs/how-to-work/)对它们做了比较。tmux 风格的路径是 SSH 到服务器并在那里运行 `herdr`。另一种是从本地机器通过 SSH 连接: |
