import { GetAgentLogLevels } from '@finos/fdc3'; import { AppDirectory } from '../app-directory/index.js'; import { ChannelFactory } from '../channel/index.js'; import { DesktopAgentNext, DesktopAgentStrategies, FullyQualifiedAppIdentifier } from '../contracts.js'; import { RootMessagePublisher } from '../messaging/index.js'; import { DesktopAgentProxy } from './desktop-agent-proxy.js'; type RootDesktopAgentParams = { appIdentifier: FullyQualifiedAppIdentifier; rootMessagePublisher: RootMessagePublisher; directory: AppDirectory; channelFactory: ChannelFactory; applicationStrategies?: DesktopAgentStrategies[]; window?: Window; logLevels?: GetAgentLogLevels; }; /** * DesktopAgentImpl is the root agent that all Proxy agents talk to * DesktopAgentImpl extends DesktopAgentProxy so that all function calls are handled in the same way - with request and response messages * request messages are handled by the onMessage function */ export declare class DesktopAgentImpl extends DesktopAgentProxy implements DesktopAgentNext { private connectionLog; private proxyLog; private readonly intentListeners; private readonly intentListenerCallbacks; private readonly eventListeners; readonly directory: AppDirectory; private channelMessageHandler; private applicationStrategies; private rootMessagePublisher; private readonly heartbeatTimers; private readonly heartbeatRetries; private readonly heartbeatTimeouts; private readonly connectedProxies; constructor(params: RootDesktopAgentParams); private onRequestMessage; private onRaiseIntentRequest; private awaitIntentListener; private onRaiseIntentForContext; private onIntentResultRequest; /** * Sends IntentEvent to app chosen to resolve intent with intent to be resolved and context to be handled * Intent is then resolved by chosen app and any result is sent to originating app in RaiseIntentResultResponse message */ private publishIntentEvent; /** * Registers an app as an intent listener and publishes an AddIntentListenerResponse message */ private onAddIntentListenerRequest; /** * Returns array of AppIdentifiers for all available instances of the given app */ private onFindInstancesRequest; private onGetInfoRequest; private onGetAppMetadataRequest; /** * Return AppIntent containing details of apps which handle given intent */ private onFindIntentRequest; /** * Add an event listener for a given event and app, and respond with the listenerUUID */ private onAddEventListenerRequest; /** * Remove event listener which source app has unsubscribed from */ private onEventListenerUnsubscribeRequest; /** * Remove intent listener which source app has unsubscribed from */ private onIntentListenerUnsubscribeRequest; private onFindIntentsByContextRequest; private onOpenRequest; private openAppWithStrategy; /** * Returns strategy if given strategy can open given application. Rejects Promise otherwise */ private canStrategyOpenApp; private passContextToOpenedApp; private publishOpenAppContextBroadcast; /** * Handle heartbeat acknowledgment from a proxy agent * @param requestMessage The heartbeat acknowledgment request * @param sourceApp The proxy agent that sent the acknowledgment */ private onHeartbeatAcknowledgementRequest; /** * Start heartbeat monitoring for a proxy * @param appId The app ID of the proxy to monitor */ private startHeartbeat; /** * Send a heartbeat to a proxy and wait for acknowledgment * @param appId The app ID of the proxy to send heartbeat to */ private sendHeartbeat; /** * Handles cleanup when a proxy disconnects, including timers, listeners, and channel subscriptions. * @param appId The app ID of the disconnected proxy */ private handleProxyDisconnect; /** * Clears heartbeat and timeout timers for a given proxy app. * @param appId The app ID of the proxy */ private clearHeartbeatTimers; /** * Removes all intent listeners associated with a given proxy app. * @param appId The app ID of the proxy */ private cleanupIntentListeners; /** * Removes all event listeners associated with a given proxy app. * @param appId The app ID of the proxy */ private cleanupEventListeners; /** * Removes all intent listener callbacks associated with a given proxy app. * @param appId The app ID of the proxy */ private cleanupIntentListenerCallbacks; /** * Uses registered strategies to select an app. * An app will only be selected if selection strategies have been provided and at least one returns true for canSelect() * This will typically be done if the user raises an intent and selects an existing app. * In this case we may want to restore a browser window, bring the window to the front or even switch to a div that contains an iframe that contains the app * THe selection mechanism is implemented by the strategy, all we do is look for the first strategy that can select the app then invoke the selectApp function * @param appIdentifier * @returns */ private tryToSelectApp; private canStrategySelectApp; private selectAppWithStrategy; /** * Ensures an AppIdentifier is fully qualified (has an instanceId). * If the app already has an instanceId, it is returned as-is. * If not, a new instance is opened. */ private returnOrLaunchAppInstance; } export {};