/******************************************************************************** * Copyright (c) 2026 CrossBreeze, EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the MIT License which is available in the project root. * * SPDX-License-Identifier: MIT ********************************************************************************/ import { MessageService, type Progress } from '@theia/core'; import { type interfaces } from '@theia/core/shared/inversify'; /** What a head connects to, as the whole sentences reported about it. */ export interface ConnectionTarget { readonly connectingMessage: string; readonly connectedMessage: string; } /** One connection attempt; it reports exactly one end. */ export interface ConnectionAttempt { connected(): void; /** Ends the attempt with nothing to report, as when its head is disposed * or a newer attempt takes over. */ cancelled(): void; /** * `message` is the whole sentence to report. `retry`, when given, starts a * fresh attempt at once; a head without one keeps retrying on its own. */ failed(message: string, retry?: () => void): void; } /** * How a head's connection attempts reach the user. A head calls * {@link connecting} for every attempt, a reconnect included, and keeps the * attempt's retries and bounds itself; this decides only what is shown. Rebind * the slot to show nothing, or something other than notifications. */ export interface ConnectionReporter { connecting(target: ConnectionTarget): ConnectionAttempt; } export declare const ConnectionReporter: unique symbol; /** * Reports through Theia notifications: an attempt still running after * {@link connectingNoticeDelayMs} shows its progress, and an attempt ends in at * most one notification. A failure is shown once per target until it connects * again, so a head that keeps retrying does not raise one per attempt. */ export declare class DefaultConnectionReporter implements ConnectionReporter { protected readonly messageService: MessageService; protected readonly connectingNoticeDelayMs: number; /** Targets whose last reported attempt failed. */ protected readonly failing: Set; connecting(target: ConnectionTarget): ConnectionAttempt; protected showConnecting(target: ConnectionTarget): Promise; protected showConnected(target: ConnectionTarget): void; protected showFailed(target: ConnectionTarget, message: string, retry?: () => void): Promise; protected retryLabel(): string; } /** Bind {@link DefaultConnectionReporter} unless the slot is bound already; every head calls this. */ export declare function bindConnectionReporter(bind: interfaces.Bind, isBound: interfaces.IsBound): void; //# sourceMappingURL=connection-reporter.d.ts.map