Add Herdr update and live handoff menu actions

The Ctrl+A h command menu gains two host-scoped actions: a plain
`herdr update` that streams updater output into the popup, and an
experimental update-and-hot-restart flow that verifies a live server
handoff and reconnects the originating Hub tab once the popup closes.

Remote updates use the remote host's own proxy settings. A standalone
helper reads literal proxy assignments from shell profiles and running
Clash/Mihomo listeners without executing startup files; Windows reads
process, user and machine proxy variables through PowerShell.
This commit is contained in:
2026-10-03 02:51:44 +00:00
parent a5e8e32f1e
commit 6f933e1c80
10 changed files with 1130 additions and 38 deletions
+11 -1
View File
@@ -1452,7 +1452,17 @@ def command_control(arguments: argparse.Namespace) -> int:
# Endpoint metadata is authoritative; popup environment may belong to another server.
binary = resolve_herdr() if window.endpoint.kind == "local" else "herdr"
control = HerdrControl(window.endpoint, binary, hub.ssh_bin)
return curses.wrapper(ControlMenu(control).run)
menu = ControlMenu(control)
result = curses.wrapper(menu.run)
if menu.reconnect_requested:
# Close curses first; respawning the client must not destroy its popup.
current = next((item for item in hub.managed_windows() if item.window_id == window.window_id), None)
if current is None or current.endpoint != window.endpoint:
raise HubError("服务器已更新,但原 Hub Tab 已改变;请手动连接目标 Session")
hub.reconnect(window.window_id)
hub.wait_for_window_startup(window.window_id)
hub.display_message("Herdr 服务器已更新,当前 Tab 已重新连接")
return result
def command_keys(arguments: argparse.Namespace) -> int: