Skip to content

Commit aa56e4e

Browse files
connor4312Copilot
andauthored
remote tunnels: unify agent window access (#333886)
* remote tunnels: unify agent window access Use one Remote Tunnel Access state for the editor and Agents window. - Route the Agents window toggle through the Remote Tunnel commands. - Use GitHub authentication without extra pickers or service installation. - Keep tunnel rename UI and synchronize tunnel status across both surfaces. - Remove separate Agent Host tunnel hosting services and process modes. - Preserve web discovery with a browser-safe Remote Tunnel service. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * remote tunnels: fix agent window initialization Prevent early command execution and false connection notifications in the Agents window. - Register the titlebar action after Remote Tunnel commands are available. - Seed the initial sharing state before enabling transition notifications. - Add tests for initial snapshots and status events during initialization. (Commit message generated by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 93c1915 commit aa56e4e

28 files changed

Lines changed: 1196 additions & 1519 deletions

src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ import { DEV_CONTAINER_AGENT_HOST_CHANNEL, IDevContainerAgentHostMainService } f
9393
import { DevContainerAgentHostMainService } from '../../../platform/agentHost/node/devContainerAgentHostService.js';
9494
import { IWSLRemoteAgentHostMainService, WSL_REMOTE_AGENT_HOST_CHANNEL } from '../../../platform/agentHost/common/wslRemoteAgentHost.js';
9595
import { WSLRemoteAgentHostMainService } from '../../../platform/agentHost/node/wslRemoteAgentHostService.js';
96-
import { ITunnelAgentHostMainService, ITunnelAgentHostHostingService, TUNNEL_AGENT_HOST_CHANNEL, TUNNEL_HOST_CHANNEL } from '../../../platform/agentHost/common/tunnelAgentHost.js';
96+
import { ITunnelAgentHostMainService, TUNNEL_AGENT_HOST_CHANNEL } from '../../../platform/agentHost/common/tunnelAgentHost.js';
9797
import { TunnelAgentHostMainService } from '../../../platform/agentHost/node/tunnelAgentHostService.js';
98-
import { TunnelHostMainService } from '../../../platform/agentHost/node/tunnelHostMainService.js';
9998
import { IUserDataProfilesService } from '../../../platform/userDataProfile/common/userDataProfile.js';
10099
import { IExtensionsProfileScannerService } from '../../../platform/extensionManagement/common/extensionsProfileScannerService.js';
101100
import { PolicyChannelClient } from '../../../platform/policy/common/policyIpc.js';
@@ -434,9 +433,6 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
434433
// Tunnel Agent Host
435434
services.set(ITunnelAgentHostMainService, new SyncDescriptor(TunnelAgentHostMainService, undefined, true));
436435

437-
// Tunnel Host (hosting local agent host for remote connections)
438-
services.set(ITunnelAgentHostHostingService, new SyncDescriptor(TunnelHostMainService, undefined, true));
439-
440436
return new InstantiationService(services);
441437
}
442438

@@ -529,9 +525,6 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
529525
const tunnelAgentHostChannel = ProxyChannel.fromService(accessor.get(ITunnelAgentHostMainService), this._store);
530526
this.server.registerChannel(TUNNEL_AGENT_HOST_CHANNEL, tunnelAgentHostChannel);
531527

532-
// Tunnel Host
533-
const tunnelHostChannel = ProxyChannel.fromService(accessor.get(ITunnelAgentHostHostingService), this._store);
534-
this.server.registerChannel(TUNNEL_HOST_CHANNEL, tunnelHostChannel);
535528
}
536529

537530
private registerErrorHandler(logService: ILogService): void {

src/vs/platform/agentHost/common/tunnelAgentHost.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -534,14 +534,6 @@ export interface ITunnelAgentHostService {
534534
getAuthProvider(options?: { silent?: boolean }): Promise<'github' | 'microsoft' | undefined>;
535535
}
536536

537-
// ---- Tunnel hosting (exposing the local agent host to remote clients) --------
538-
539-
/** IPC channel name for the tunnel host service. */
540-
export const TUNNEL_HOST_CHANNEL = 'tunnelHost';
541-
542-
/** Output channel ID for the tunnel host logs. */
543-
export const TUNNEL_HOST_LOG_ID = 'tunnelHostService';
544-
545537
/** Information about an actively hosted tunnel. */
546538
export interface ITunnelHostInfo {
547539
readonly tunnelName: string;
@@ -560,34 +552,3 @@ export function isTunnelHosted(sharingInfo: ITunnelHostInfo | undefined, tunnel:
560552
? sharingInfo.tunnelId === tunnel.tunnelId
561553
: sharingInfo.tunnelName === tunnel.name;
562554
}
563-
564-
/** Status of the tunnel host. */
565-
export type TunnelHostStatus =
566-
| { readonly active: false }
567-
| { readonly active: true; readonly info: ITunnelHostInfo };
568-
569-
/**
570-
* Shared-process service that hosts a dev tunnel using the code CLI.
571-
*/
572-
export const ITunnelAgentHostHostingService = createDecorator<ITunnelAgentHostHostingService>('tunnelAgentHostHostingService');
573-
574-
export interface ITunnelAgentHostHostingService {
575-
readonly _serviceBrand: undefined;
576-
577-
/** Fires when the hosting status changes. */
578-
readonly onDidChangeStatus: Event<TunnelHostStatus>;
579-
580-
/**
581-
* Start hosting a dev tunnel that exposes the local agent host.
582-
*
583-
* @param token The user's access token.
584-
* @param authProvider The auth provider that issued the token.
585-
*/
586-
startHosting(token: string, authProvider: 'github' | 'microsoft'): Promise<ITunnelHostInfo>;
587-
588-
/** Stop hosting and clean up the tunnel. */
589-
stopHosting(): Promise<void>;
590-
591-
/** Get the current hosting status. */
592-
getStatus(): Promise<TunnelHostStatus>;
593-
}

src/vs/platform/agentHost/node/tunnelHostMainService.ts

Lines changed: 0 additions & 169 deletions
This file was deleted.

0 commit comments

Comments
 (0)