import { Disposable, IReference } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants"; import { IChatEditingSession } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatEditingService"; import { ChatModel, ISerializableChatModelInputState, ISerializedChatDataReference } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel"; export interface IStartSessionProps { readonly initialData?: ISerializedChatDataReference; readonly location: ChatAgentLocation; readonly sessionResource: URI; readonly canUseTools: boolean; readonly transferEditingSession?: IChatEditingSession; readonly disableBackgroundKeepAlive?: boolean; readonly inputState?: ISerializableChatModelInputState; } export interface ChatModelStoreDelegate { createModel: (props: IStartSessionProps) => ChatModel; willDisposeModel: (model: ChatModel) => Promise; } export interface IChatModelReferenceDebugHolder { readonly holder: string; readonly count: number; } export interface IChatModelReferenceDebugInfo { readonly sessionResource: URI; readonly title: string; readonly createdBy: string; readonly initialLocation: ChatAgentLocation; readonly isImported: boolean; readonly willKeepAlive: boolean; readonly hasPendingEdits: boolean; readonly pendingDisposal: boolean; readonly referenceCount: number; readonly holders: readonly IChatModelReferenceDebugHolder[]; } export interface IChatModelReferenceDebugSnapshot { readonly totalModels: number; readonly totalReferences: number; readonly models: readonly IChatModelReferenceDebugInfo[]; } export declare class ChatModelStore extends Disposable { private readonly delegate; private readonly logService; private readonly _refCollection; private readonly _models; private readonly _modelsToDispose; private readonly _pendingDisposals; private readonly _modelCreateOwners; private readonly _referenceOwners; private _referenceOwnerIds; private readonly _onDidDisposeModel; readonly onDidDisposeModel: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; private readonly _onDidCreateModel; readonly onDidCreateModel: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; constructor(delegate: ChatModelStoreDelegate, logService: ILogService); get observable(): import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").IObservable>; values(): Iterable; /** * Get a ChatModel directly without acquiring a reference. */ get(uri: URI): ChatModel | undefined; has(uri: URI): boolean; acquireExisting(uri: URI, debugOwner?: string): IReference | undefined; acquireOrCreate(props: IStartSessionProps, debugOwner?: string): IReference; getReferenceDebugSnapshot(): IChatModelReferenceDebugSnapshot; private createReferencedObject; private destroyReferencedObject; private doDestroyReferencedObject; private wrapReference; /** * For test use only */ waitForModelDisposals(): Promise; private toKey; dispose(): void; }