import { Event } from "../../../../../base/common/event.js"; import { Disposable } from "../../../../../base/common/lifecycle.js"; import { AgentHostClientConnectionKind } from "../../../../../platform/agentHost/common/agentHostTelemetry.js"; import { IRemoteAgentHostLocationPreferenceService } from "../../../../../platform/agentHost/common/remoteAgentHostLocationPreference.service.js"; import { IRemoteAgentHostService } from "../../../../../platform/agentHost/common/remoteAgentHostService.service.js"; import type { AhpServerNotification, JsonRpcResponse, ProtocolMessage } from "../../../../../platform/agentHost/common/state/sessionProtocol.js"; import { type IProtocolTransport } from "../../../../../platform/agentHost/common/state/sessionTransport.js"; import { type ITunnelRelayClientFactory, type ITunnelRelayClientSession, type ITunnelSocketFactory } from "../../../../../platform/agentHost/common/tunnelAgentHostConnector.js"; import { type ICachedTunnel, type ITunnelConnectResult, type ITunnelGatewaySelection, type ITunnelGatewaySelectionSession, type ITunnelInfo, type ITunnelDiscoveryOptions, type ITunnelVisibility, type TunnelAutoConnectMode } from "../../../../../platform/agentHost/common/tunnelAgentHost.js"; import { ITunnelAgentHostService } from "../../../../../platform/agentHost/common/tunnelAgentHost.service.js"; import type { ITunnelDuplexStream, ITunnelMessageSocket } from "../../../../../platform/agentHost/common/tunnelMessageSocket.js"; import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js"; import { IDialogService } from "../../../../../platform/dialogs/common/dialogs.service.js"; import { IInstantiationService } from "../../../../../platform/instantiation/common/instantiation.js"; import { ILogService } from "../../../../../platform/log/common/log.service.js"; import { IProductService } from "../../../../../platform/product/common/productService.service.js"; import { IStorageService } from "../../../../../platform/storage/common/storage.service.js"; import { IAuthenticationService } from "../../../../../workbench/services/authentication/common/authentication.service.js"; import { resolveGatewaySelection } from "../../../../../platform/agentHost/common/tunnelGatewaySelection.js"; import { type IDevTunnelsWeb, type IDevTunnelsWebTunnel } from "../../../../../../../../override/vs/sessions/contrib/providers/remoteAgentHost/browser/devTunnelsWebLoader.js"; import { type ConnectionDiagnosticObserver } from "../../../../../platform/agentHost/common/connectionDiagnostics.js"; import { ITelemetryService } from "../../../../../platform/telemetry/common/telemetry.service.js"; /** Creates relay clients directly from the lazily-loaded Dev Tunnels browser SDK. */ export declare class BrowserTunnelRelayClientFactory implements ITunnelRelayClientFactory { private readonly _loadDevTunnelsWeb; private readonly _createHeaders; constructor(_loadDevTunnelsWeb: () => Promise, _createHeaders: () => Record); getTunnel(tunnelId: string, clusterId: string, authProvider: "github" | "microsoft", token: string): Promise; } /** Opens framed WebSockets directly over browser tunnel relay streams. */ export declare class BrowserTunnelSocketFactory implements ITunnelSocketFactory { open(stream: ITunnelDuplexStream, path: string): Promise; } /** Browser service view of the transport-agnostic tunnel connector. */ export interface ITunnelAgentHostConnector { readonly onDidRelayMessage: Event<{ readonly connectionId: string; readonly data: string; }>; /** Fires with a connection ID while that relay receives part of a message. */ readonly onDidRelayActivity: Event; readonly onDidRelayClose: Event; connect(token: string, authProvider: "github" | "microsoft", tunnelId: string, clusterId: string, onDiagnostic?: ConnectionDiagnosticObserver): Promise; prepareSelection(token: string, authProvider: "github" | "microsoft", tunnelId: string, clusterId: string, onDiagnostic?: ConnectionDiagnosticObserver): Promise; completeSelection(selectionId: string, selection: ITunnelGatewaySelection): Promise; cancelSelection(selectionId: string): Promise; relaySend(connectionId: string, message: string): Promise; disconnect(connectionId: string): Promise; } /** Construction options for injecting browser tunnel transports. */ export interface IBrowserTunnelAgentHostServiceOptions { readonly connector?: ITunnelAgentHostConnector; readonly loadDevTunnelsWeb?: () => Promise; readonly resolveGatewaySelection?: typeof resolveGatewaySelection; } /** * Connects browser Agents windows to Dev Tunnels without an embedder proxy. */ export declare class BrowserTunnelAgentHostService extends Disposable implements ITunnelAgentHostService { private readonly _remoteAgentHostService; private readonly _logService; private readonly _instantiationService; private readonly _configurationService; private readonly _authenticationService; private readonly _productService; private readonly _storageService; private readonly _locationPreferenceService; private readonly _dialogService; private readonly _telemetryService; readonly _serviceBrand: undefined; private readonly _storage; private readonly _connectionFactory; readonly onDidChangeTunnels: Event; private readonly _connector; private readonly _resolveGatewaySelection; private readonly _loadDevTunnelsWeb; private _lastAuthProvider; constructor(_remoteAgentHostService: IRemoteAgentHostService, _logService: ILogService, _instantiationService: IInstantiationService, _configurationService: IConfigurationService, _authenticationService: IAuthenticationService, _productService: IProductService, _storageService: IStorageService, _locationPreferenceService: IRemoteAgentHostLocationPreferenceService, _dialogService: IDialogService, _telemetryService: ITelemetryService, options?: IBrowserTunnelAgentHostServiceOptions); listTunnels(options?: ITunnelDiscoveryOptions): Promise; getAutoConnectMode(tunnel: ITunnelInfo): TunnelAutoConnectMode; connect(tunnel: ITunnelInfo, authProvider?: "github" | "microsoft", options?: { readonly userInitiated?: boolean; }): Promise; private _createConnection; readonly canDeleteTunnels = true; deleteTunnel(tunnel: ITunnelInfo, authProvider?: "github" | "microsoft"): Promise; disconnect(address: string): Promise; getAuthProvider(options?: { silent?: boolean; }): Promise<"github" | "microsoft" | undefined>; getCachedTunnels(): ICachedTunnel[]; cacheTunnel(tunnel: ITunnelInfo, authProvider?: "github" | "microsoft"): void; removeCachedTunnel(tunnelId: string): void; isTunnelDismissed(tunnelId: string): boolean; getTunnelVisibility(): ITunnelVisibility; dismissTunnel(tunnelId: string): void; clearTunnelDismissal(tunnelId: string): void; isAutoConnectSuppressed(tunnelId: string): boolean; suppressAutoConnect(tunnelId: string): void; clearAutoConnectSuppression(tunnelId: string): void; private _getToken; private _getTokenForProvider; } /** Connects through the versioned gateway when a tunnel advertises one. */ export declare function connectThroughTunnelGateway(connector: ITunnelAgentHostConnector, resolveSelection: typeof resolveGatewaySelection, locationPreferenceService: IRemoteAgentHostLocationPreferenceService, dialogService: IDialogService, productName: string, auth: { readonly token: string; readonly provider: "github" | "microsoft"; }, tunnel: ITunnelInfo, userInitiated: boolean, onDiagnostic?: ConnectionDiagnosticObserver): Promise; /** Maps Dev Tunnels SDK descriptors to supported agent-host tunnels. */ export declare function filterBrowserTunnelInfos(tunnels: readonly IDevTunnelsWebTunnel[]): ITunnelInfo[]; /** Adapts one connector relay connection to the protocol client. Exported for tests. */ export declare class BrowserTunnelConnectionTransport extends Disposable implements IProtocolTransport { private readonly _connectionId; private readonly _connector; private readonly _logService; readonly clientConnectionKind = AgentHostClientConnectionKind.DevTunnel; private readonly _onMessage; readonly onMessage: Event; private readonly _onDidReceiveData; readonly onDidReceiveData: Event; private readonly _onClose; readonly onClose: Event; private _malformedFrames; constructor(_connectionId: string, _connector: ITunnelAgentHostConnector, _logService: ILogService); send(message: ProtocolMessage | AhpServerNotification | JsonRpcResponse): void; dispose(): void; }