feat(remote-dev): forward ports of the remote host (#1131)

Remote windows get a Ports tool window: forward localhost:<port> of the remote host to this machine (same port when free here), with Open in Browser / Copy / Stop. Forwarded ports are remembered per host and folder and forwarded again on reconnect. Tunnels reuse the window's SSH session (ide_ssh::Tunnel can prefer a local port) and close with the connection.

Closes #819
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-04 08:50:25 +08:00
1 джерело a3bbbf90a4
коміт 53b8cdeb51
11 files changed
+469 -7

No files matched your search

+15
Переглянути файл
@@ -1116,6 +1116,15 @@ export const commands = {
commands: string[],
} | null>("remote_current"),
remoteDisconnect: () => __TAURI_INVOKE<void>("remote_disconnect"),
/** The remote ports this window forwards to this machine. */
remoteForwardedPorts: () => __TAURI_INVOKE<ForwardedPort[]>("remote_forwarded_ports"),
/**
* Forwards `localhost:<remote_port>` of the remote host to the same port here when it is free,
* else to a free one. Nothing needs to listen there yet; connections are opened per use.
*/
remoteForwardPort: (remotePort: number) => typedError<ForwardedPort, IdeError>(__TAURI_INVOKE("remote_forward_port", { remotePort })),
/** Stops forwarding `remote_port`. */
remoteStopForwarding: (remotePort: number) => typedError<null, IdeError>(__TAURI_INVOKE("remote_stop_forwarding", { remotePort })),
/**
* Runs a command on the window's remote server; `args` and the result are JSON
* text. Streaming arguments are `{ "$channel": id }`; their values arrive on
@@ -3464,6 +3473,12 @@ export type FormatOptions = {
tool?: ExternalFormatter | null,
};
/** A port of the remote host reachable on this machine at `localhost:local_port`. */
export type ForwardedPort = {
remotePort: number,
localPort: number,
};
/** One occurrence of a duplicated code fragment. */
export type Fragment = {
path: IpcPath,