Path: blob/main/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimeline.ts
4780 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { VSBuffer } from '../../../../../base/common/buffer.js';6import { IDisposable } from '../../../../../base/common/lifecycle.js';7import { IObservable, IReader, ITransaction } from '../../../../../base/common/observable.js';8import { URI } from '../../../../../base/common/uri.js';9import { IEditSessionDiffStats, IEditSessionEntryDiff } from '../../common/editing/chatEditingService.js';10import { IChatRequestDisablement } from '../../common/model/chatModel.js';11import { FileOperation, IChatEditingTimelineState, IFileBaseline } from './chatEditingOperations.js';1213/**14* Interface for the new checkpoint-based timeline system15*/16export interface IChatEditingCheckpointTimeline {17readonly requestDisablement: IObservable<IChatRequestDisablement[]>;18readonly canUndo: IObservable<boolean>;19readonly canRedo: IObservable<boolean>;2021// Checkpoint management22createCheckpoint(requestId: string | undefined, undoStopId: string | undefined, label: string, description?: string): void;23navigateToCheckpoint(checkpointId: string): Promise<void>;24undoToLastCheckpoint(): Promise<void>;25redoToNextCheckpoint(): Promise<void>;26getCheckpointIdForRequest(requestId: string, undoStopId?: string): string | undefined;2728// Operation tracking29recordFileOperation(operation: FileOperation): void;30incrementEpoch(): number;3132// File baselines33recordFileBaseline(baseline: IFileBaseline): void;34hasFileBaseline(uri: URI, requestId: string): boolean;3536// State reconstruction37getContentURIAtStop(requestId: string, fileURI: URI, stopId: string | undefined): URI;38getContentAtStop(requestId: string, contentURI: URI, stopId: string | undefined): Promise<string | VSBuffer | undefined>;39onDidChangeContentsAtStop(requestId: string, contentURI: URI, stopId: string | undefined, callback: (data: string) => void): IDisposable;4041// Persistence42getStateForPersistence(): IChatEditingTimelineState;43restoreFromState(state: IChatEditingTimelineState, tx: ITransaction): void;4445// Diffing46getEntryDiffBetweenStops(uri: URI, requestId: string | undefined, stopId: string | undefined): IObservable<IEditSessionEntryDiff | undefined> | undefined;47getEntryDiffBetweenRequests(uri: URI, startRequestId: string, stopRequestId: string): IObservable<IEditSessionEntryDiff | undefined>;48getDiffsForFilesInRequest(requestId: string): IObservable<readonly IEditSessionEntryDiff[]>;49getDiffsForFilesInSession(): IObservable<readonly IEditSessionEntryDiff[]>;50getDiffForSession(): IObservable<IEditSessionDiffStats>;51hasEditsInRequest(requestId: string, reader?: IReader): boolean;52}535455