export interface IRemoteTunnelSession { readonly providerId: string; readonly sessionId: string; readonly accountLabel: string; readonly token?: string; } export interface ActiveTunnelMode { readonly active: true; readonly session: IRemoteTunnelSession; readonly asService: boolean; } export interface InactiveTunnelMode { readonly active: false; } export declare const INACTIVE_TUNNEL_MODE: InactiveTunnelMode; /** Saved mode for the tunnel. */ export type TunnelMode = ActiveTunnelMode | InactiveTunnelMode; export type TunnelStatus = TunnelStates.Connected | TunnelStates.Disconnected | TunnelStates.Connecting | TunnelStates.Uninitialized; export declare namespace TunnelStates { interface Uninitialized { readonly type: "uninitialized"; } interface Connecting { readonly type: "connecting"; readonly progress?: string; } interface Connected { readonly type: "connected"; readonly info: ConnectionInfo; readonly serviceInstallFailed: boolean; } interface Disconnected { readonly type: "disconnected"; readonly onTokenFailed?: IRemoteTunnelSession; } const disconnected: (onTokenFailed?: IRemoteTunnelSession) => Disconnected; const connected: (info: ConnectionInfo, serviceInstallFailed: boolean) => Connected; const connecting: (progress?: string) => Connecting; const uninitialized: Uninitialized; } export interface ConnectionInfo { link?: string; domain?: string; tunnelName: string; tunnelId?: string; isAttached: boolean; } export declare const CONFIGURATION_KEY_PREFIX = "remote.tunnels.access"; export declare const CONFIGURATION_KEY_HOST_NAME: string; export declare const CONFIGURATION_KEY_PREVENT_SLEEP: string; /** Maximum length of a dev tunnel name, matching `MAX_TUNNEL_NAME_LENGTH` in the CLI's `cli/src/tunnels/dev_tunnels.rs`. */ export declare const MAX_TUNNEL_NAME_LENGTH = 20; /** * Derive a dev tunnel name from a machine's host name, mirroring * `clean_hostname_for_tunnel` and `get_placeholder_name` in the CLI's * `cli/src/tunnels/dev_tunnels.rs`: `-`, `_` and spaces all collapse to `-`, * anything non-alphanumeric is dropped, and dashes are trimmed from both ends. * * `code tunnel` and in-editor remote session hosting must derive the same name * for a machine, otherwise each registers its own dev tunnel for it. */ export declare function tunnelNameFromHostname(hostname: string): string; /** * Normalize an explicitly configured tunnel name. The CLI only lowercases and * validates a name the user supplied rather than rewriting it (`is_valid_name`), * so the sanitization here stays minimal; host names go through * {@link tunnelNameFromHostname} instead. */ export declare function normalizeTunnelName(name: string): string; export declare const LOG_ID = "remoteTunnelService"; export declare const LOGGER_NAME: string;