import { IDisposable } from "../../../../../base/common/lifecycle.js"; import { IRemoteAgentHostSSHConnection, RemoteAgentHostConnectionStatus } from "../../../../../platform/agentHost/common/remoteAgentHostService.js"; import { IRemoteAgentHostService } from "../../../../../platform/agentHost/common/remoteAgentHostService.service.js"; import { IConfigurationService } from "../../../../../platform/configuration/common/configuration.service.js"; import { IRemoteAgentHostLocationPreferenceService } from "../../../../../platform/agentHost/common/remoteAgentHostLocationPreference.service.js"; import { IDialogService } from "../../../../../platform/dialogs/common/dialogs.service.js"; import { IInstantiationService, ServicesAccessor } from "../../../../../platform/instantiation/common/instantiation.js"; import { IQuickPickItem } from "../../../../../platform/quickinput/common/quickInput.js"; import { IQuickInputService } from "../../../../../platform/quickinput/common/quickInput.service.js"; import { ISSHRemoteAgentHostService } from "../../../../../platform/agentHost/common/sshRemoteAgentHost.service.js"; import { IAgentHostSessionsProvider } from "../../../../common/agentHostSessionsProvider.js"; import { INotificationService } from "../../../../../platform/notification/common/notification.service.js"; import { IProgressService } from "../../../../../platform/progress/common/progress.service.js"; export declare function reconnectRemoteHost(provider: IAgentHostSessionsProvider, remoteAgentHostService: IRemoteAgentHostService): Promise; export declare function removeRemoteHost(provider: IAgentHostSessionsProvider, remoteAgentHostService: IRemoteAgentHostService, configurationService: IConfigurationService): Promise; export declare function sshConnectionKey(connection: IRemoteAgentHostSSHConnection): string; /** Drop the persisted SSH entry before teardown so reconciliation cannot immediately reconnect it. */ export declare function disconnectSSHEntry(connection: IRemoteAgentHostSSHConnection, remoteAgentHostService: Pick, sshService: Pick): Promise; export declare function confirmTunnelDeletion(dialogService: IDialogService, name: string): Promise; export declare function renameRemoteHost(provider: Pick, quickInputService: IQuickInputService, remoteAgentHostService: IRemoteAgentHostService): Promise; export declare function hasUpgradeReconnectStarted(status: RemoteAgentHostConnectionStatus): boolean; /** * Run the CLI-managed server upgrade flow for `provider`. Used by both * the per-host quickpick and the proactive `incompatible` notification. * * Shows progress in a notification, counts down through the CLI's * deliberately-staggered restart delay, and either reconnects when the * countdown completes or steps aside if some other code path beat it. * * Returns when the flow finishes (success, "already up to date", or * surfaced error). All user-facing errors are reported via the * notification service. */ export declare function upgradeRemoteHost(provider: IAgentHostSessionsProvider, upgradeMethod: string, remoteAgentHostService: IRemoteAgentHostService, notificationService: INotificationService, progressService: IProgressService): Promise; export declare function runServerUpgrade(accessor: ServicesAccessor, provider: IAgentHostSessionsProvider, upgradeMethod: string): Promise; /** * Surface a transient notification each time a provider transitions into * the `incompatible` state. Fires once per transition (not on every * status update while incompatible). When the host advertises an upgrade * method, the notification's primary action runs the upgrade flow * directly; otherwise it just opens the same picker that the manage flow * uses so the user can read the full message and pick a recovery action. * * Returns a disposable that stops the watcher. */ export declare function watchForIncompatibleNotifications(provider: IAgentHostSessionsProvider, instantiationService: IInstantiationService, notificationService: INotificationService): IDisposable; export declare function getStatusLabel(status: RemoteAgentHostConnectionStatus): string; export declare function getStatusHover(status: RemoteAgentHostConnectionStatus, address?: string, lastConnectionError?: string): string; export interface IShowRemoteHostOptionsOptions { /** When true, show a Back button in the picker title bar. The promise resolves to `'back'` if pressed. */ readonly showBackButton?: boolean; } /** * Whether `preferenceKey` identifies a host that can have a preferred agent * run location. Only SSH and tunnel preference keys are supported today — * WebSocket, WSL, and cloud-sandbox addresses are not stable/dedicated-host-capable * targets for {@link IRemoteAgentHostLocationPreferenceService}. * * `preferenceKey` must be the host's *stable* preference key (e.g. an SSH * host's `ssh:` from `computeSSHConnectionKey`, or `tunnel:`), * NOT its live connection address — a real SSH provider's `remoteAddress` * is a forwarded local endpoint (e.g. `localhost:4321`) that never starts * with `ssh:`, so passing it here would wrongly suppress this feature for * every SSH host. * * The preference service and its shared modal are desktop-only (registered * in `sessions.desktop.main.ts`; the web tunnel service does not consult a * preference at all), so this always reports `false` on web regardless of * key shape. `isWebPlatform` defaults to the ambient {@link isWeb} * constant but can be passed explicitly so tests can cover both the * desktop and web branches without depending on ambient platform state. */ export declare function supportsRemoteAgentHostLocationPreference(preferenceKey: string, isWebPlatform?: boolean): boolean; /** * Whether a host's connection details are authored in the user's SSH config * file rather than in VS Code settings. * * True only for SSH hosts identified by an `~/.ssh/config` alias: * `computeSSHConnectionKey` keys those as `ssh:`, while an SSH host * connected with explicit credentials keys as `user@host:port` and has no * file to open. Other kinds keep their entries in settings or in runtime-only * storage. Always `false` on web, where SSH hosts cannot exist. */ export declare function usesSSHConfigFile(preferenceKey: string, isWebPlatform?: boolean): boolean; export type RemoteOptionPickItem = IQuickPickItem & { id: string; }; export interface IBuildRemoteHostOptionItemsOptions { /** The host's live connection address, used for Copy Address etc. */ readonly address: string; /** * The host's stable preference key (see * {@link supportsRemoteAgentHostLocationPreference}), when it differs * from {@link address} - e.g. an SSH host's `ssh:` key versus its * live forwarded address. Defaults to {@link address} for hosts with no * separate stable identity (tunnels, WSL, cloud sandbox). */ readonly preferenceKey?: string; readonly isConnected: boolean; readonly removeLabel?: string; readonly canRemove?: boolean; readonly disconnectLabel?: string; readonly upgradeMethod?: string; /** Defaults to the ambient {@link isWeb} constant; overridable for tests. See {@link supportsRemoteAgentHostLocationPreference}. */ readonly isWebPlatform?: boolean; } /** * Build the management options for a remote host from its resolved status. */ export declare function buildRemoteHostOptionItems(options: IBuildRemoteHostOptionItemsOptions): RemoteOptionPickItem[]; export interface IChangeRemoteAgentHostLocationPreferenceOptions { /** * Stable preference key persisted via * {@link IRemoteAgentHostLocationPreferenceService} (e.g. an SSH host's * `ssh:` key, or `tunnel:`). NOT the live connection * address - {@link provider}, when present, already carries its own * live address for reconnection. */ readonly preferenceKey: string; readonly hostLabel: string; readonly productName: string; /** * The live provider for this host, when one can be resolved. Reconnected * immediately after the preference is persisted. `undefined` only for the * exceptional race where the target host is known (e.g. from configured * SSH entries or cached tunnels) but has no corresponding provider right * now - the preference is still saved, but nothing is reconnected. */ readonly provider: IAgentHostSessionsProvider | undefined; readonly dialogService: IDialogService; readonly locationPreferenceService: IRemoteAgentHostLocationPreferenceService; readonly notificationService: INotificationService; readonly remoteAgentHostService: IRemoteAgentHostService; readonly progressService: IProgressService; } /** * Prompt for, persist, and immediately apply a new preferred agent run * location for `preferenceKey`. Shared by both the per-host "Options for {0}" * item and the F1 "Change Preferred Remote Agent Location" command so * they present identical prompt/persist/reconnect/notification behavior. * * Does nothing if the user cancels the modal. Otherwise persists the * preference first, then reconnects the matching host via * {@link reconnectRemoteHost} (respecting provider-specific SSH/tunnel * connect callbacks) under a progress notification, reporting success or * failure. If no {@link IChangeRemoteAgentHostLocationPreferenceOptions.provider} * can be resolved, the preference is still saved and a warning explains it * will apply the next time that host connects. */ export declare function changeRemoteAgentHostLocationPreference(options: IChangeRemoteAgentHostLocationPreferenceOptions): Promise; /** * Show the per-remote management options quickpick for the given provider. * * Used by both the Workspace Picker's Manage submenu and the F1 * "Manage Remote Agent Hosts..." command, so both surfaces drive the * same actions. Callers that don't have a {@link ServicesAccessor} should * use `instantiationService.invokeFunction(accessor => showRemoteHostOptions(accessor, provider))`. * * Returns `'back'` if the user clicked the back button (only possible when * `options.showBackButton` is true), otherwise `undefined`. */ export declare function showRemoteHostOptions(accessor: ServicesAccessor, provider: IAgentHostSessionsProvider, options?: IShowRemoteHostOptionsOptions): Promise<"back" | undefined>;