import { Event } from "../../../../../../base/common/event.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { IReader } from "../../../../../../base/common/observable.js"; import { URI } from "../../../../../../base/common/uri.js"; /** One end of a chat move: the session and the chat's resource in it. */ export interface IAgentHostChatMoveEnd { readonly session: T; readonly chat: URI; } /** A chat that moved from one session to another, or became the main chat of a new session. */ export interface IAgentHostChatMove { readonly from: IAgentHostChatMoveEnd; readonly to: IAgentHostChatMoveEnd; } /** * Recognizes chat moves from the catalogs of the sessions it is told about. A * host moves a chat by removing it from one session and adding it to another * (or making it a new session's main chat); a client may learn of the two * catalogs in either order. A backend chat that leaves one session and appears * in another moved; one that only leaves was deleted. The ends are paired by * the backend chat, never by parsing its URI. * * A session's catalog maps each backend chat it lists to the chat's resource * in that session. */ export declare class AgentHostChatMoveTracker extends Disposable { /** How long a chat that left a session waits for another session to list it, and vice versa. */ static readonly PAIRING_WINDOW_MS = 10000; private readonly _onDidMoveChat; readonly onDidMoveChat: Event>; private readonly _catalogs; private readonly _tracked; private readonly _pending; private readonly _pendingTimeouts; /** Follows `session`'s catalog as `readChats` reports it, until {@link untrack}. */ track(session: T, readChats: (reader: IReader) => ReadonlyMap): void; /** Stops following `session`; the chats it listed leave it. */ untrack(session: T): void; /** `session` now lists `chats`. */ update(session: T, chats: ReadonlyMap): void; /** `session` is gone; the chats it listed leave it (a session that ends after its only chat moved). */ remove(session: T): void; private _onRemoved; private _onAdded; private _await; private _settle; private _isSameSession; }