import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service"; import { IEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service"; import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service"; import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service"; import { IUserDataProfilesService } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile.service"; import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service"; import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service"; import { IWorkspaceEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workspaces/common/workspaceEditing.service"; import { IChatSessionStats, IChatSessionTiming, ResponseModelState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService"; import { ChatAgentLocation, ChatPermissionLevel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants"; import { ChatModel, ISerializableChatData, ISerializableChatModelInputState, ISerializableChatsData, ISerializedChatDataReference } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel"; export declare class ChatSessionStore extends Disposable { private readonly fileService; private readonly environmentService; private readonly logService; private readonly workspaceContextService; private readonly telemetryService; private readonly storageService; private readonly lifecycleService; private readonly userDataProfilesService; private readonly configurationService; private readonly workspaceEditingService; private readonly dialogService; private readonly openerService; private storageRoot; private readonly previousEmptyWindowStorageRoot; private readonly transferredSessionStorageRoot; private readonly storeQueue; private storeTask; private shuttingDown; constructor(fileService: IFileService, environmentService: IEnvironmentService, logService: ILogService, workspaceContextService: IWorkspaceContextService, telemetryService: ITelemetryService, storageService: IStorageService, lifecycleService: ILifecycleService, userDataProfilesService: IUserDataProfilesService, configurationService: IConfigurationService, workspaceEditingService: IWorkspaceEditingService, dialogService: IDialogService, openerService: IOpenerService); private handleWorkspaceTransition; private migrateSessionsToNewWorkspace; storeSessions(sessions: ChatModel[]): Promise; storeSessionsMetadataOnly(sessions: ChatModel[]): Promise; storeTransferSession(transferData: IChatTransfer, session: ChatModel): Promise; private getTransferredSessionIndex; private static readonly TRANSFER_EXPIRATION_MS; getTransferredSessionData(): URI | undefined; readTransferredSession(sessionResource: URI): Promise; private cleanupTransferredSession; private _didReportIssue; private writeSession; private writeSessionMetadataOnly; private flushIndex; private getIndexStorageScope; private trimEntries; private internalDeleteSession; hasSessions(): boolean; isSessionEmpty(sessionId: string): boolean; deleteSession(sessionId: string): Promise; clearAllSessions(): Promise; setSessionTitle(sessionId: string, title: string): Promise; private reportError; private indexCache; private internalGetIndex; getIndex(): Promise; getMetadataForSessionSync(sessionResource: URI): IChatSessionEntryMetadata | undefined; private getIndexKey; logIndex(): void; migrateDataIfNeeded(getInitialData: () => ISerializableChatsData | undefined): Promise; private migrate; readSession(sessionId: string): Promise; private readSessionFromLocation; private readSessionFromPreviousLocation; private getStorageLocation; private getTransferredSessionStorageLocation; /** * Synchronously update the in-memory index entries for the given sessions * and flush the index to storage. This ensures the index is persisted * even when called from a synchronous `onWillSaveState` handler where * async file-write work would complete after the storage service has * already flushed. */ updateAndFlushIndexSync(localSessions: ChatModel[], externalSessions: ChatModel[]): void; getChatStorageFolder(): URI; } export interface IChatSessionEntryMetadata { sessionId: string; title: string; lastMessageDate: number; timing: IChatSessionTiming; initialLocation?: ChatAgentLocation; hasPendingEdits?: boolean; stats?: IChatSessionStats; lastResponseState: ResponseModelState; /** * The working directory URI string associated with this session. * Persisted so it survives window reload in the agents/sessions window. */ workingDirectory?: string; /** * This only exists because the migrated data from the storage service had empty sessions persisted, and it's impossible to know which ones are * currently in use. Now, `clearSession` deletes empty sessions, so old ones shouldn't take up space in the store anymore, but we still need to * filter the old ones out of history. */ isEmpty?: boolean; /** * Whether this session was loaded from an external provider (eg background/cloud sessions). */ isExternal?: boolean; /** * The permission level for tool auto-approval, if not default. */ permissionLevel?: ChatPermissionLevel; /** * Serialized draft input state (text, attachments, mode, selected model, ...) for * external sessions, so that unsent input is preserved when switching away and * back. Local sessions instead persist their full state via storeSessions. */ inputState?: ISerializableChatModelInputState; } export type IChatSessionIndex = Record; export interface IChatTransfer { toWorkspace: URI; sessionResource: URI; timestampInMilliseconds: number; } export interface IChatTransfer2 extends IChatTransfer { chat: ISerializableChatData; }