import { RunOnceScheduler } from "@codingame/monaco-vscode-api/vscode/vs/base/common/async"; import { Emitter } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { IObservable, ITransaction } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { TextEdit } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { IUndoRedoElement } from "@codingame/monaco-vscode-api/vscode/vs/platform/undoRedo/common/undoRedo"; import { IUndoRedoService } from "@codingame/monaco-vscode-api/vscode/vs/platform/undoRedo/common/undoRedo.service"; import { IEditorPane } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor"; import { IFilesConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service"; import { IAiEditTelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryService.service"; import { ICellEditOperation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon"; import { ChatUserAction } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService"; import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service"; import { ChatEditKind, IModifiedEntryTelemetryInfo, IModifiedFileEntry, IModifiedFileEntryEditorIntegration, ISnapshotEntry, ModifiedFileEntryState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatEditingService"; import { IChatResponseModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel"; declare class AutoAcceptControl { readonly total: number; readonly remaining: number; readonly cancel: () => void; constructor(total: number, remaining: number, cancel: () => void); } export declare const pendingRewriteMinimap: string; export declare abstract class AbstractChatEditingModifiedFileEntry extends Disposable implements IModifiedFileEntry { readonly modifiedURI: URI; protected _telemetryInfo: IModifiedEntryTelemetryInfo; protected _fileConfigService: IFilesConfigurationService; protected readonly _chatService: IChatService; protected readonly _fileService: IFileService; private readonly _undoRedoService; protected readonly _instantiationService: IInstantiationService; private readonly _aiEditTelemetryService; static readonly scheme = "modified-file-entry"; private static lastEntryId; readonly entryId: string; protected readonly _onDidDelete: Emitter; readonly onDidDelete: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event; protected readonly _stateObs: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable; readonly state: IObservable; protected readonly _waitsForLastEdits: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable; readonly waitsForLastEdits: IObservable; protected readonly _isCurrentlyBeingModifiedByObs: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable<{ responseModel: IChatResponseModel; undoStopId: string | undefined; } | undefined, void>; readonly isCurrentlyBeingModifiedBy: IObservable<{ responseModel: IChatResponseModel; undoStopId: string | undefined; } | undefined>; /** * Flag to track if we're currently in an external edit operation. * When true, file system changes should be treated as agent edits, not user edits. */ protected _isExternalEditInProgress: boolean; protected readonly _lastModifyingResponseObs: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable; readonly lastModifyingResponse: IObservable; protected readonly _lastModifyingResponseInProgressObs: IObservable; protected readonly _rewriteRatioObs: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable; readonly rewriteRatio: IObservable; private readonly _reviewModeTempObs; readonly reviewMode: IObservable; private readonly _autoAcceptCtrl; readonly autoAcceptController: IObservable; protected readonly _autoAcceptTimeout: IObservable; get telemetryInfo(): IModifiedEntryTelemetryInfo; readonly createdInRequestId: string | undefined; get lastModifyingRequestId(): string; private _refCounter; readonly abstract originalURI: URI; protected readonly _userEditScheduler: RunOnceScheduler<() => void>; constructor(modifiedURI: URI, _telemetryInfo: IModifiedEntryTelemetryInfo, kind: ChatEditKind, configService: IConfigurationService, _fileConfigService: IFilesConfigurationService, _chatService: IChatService, _fileService: IFileService, _undoRedoService: IUndoRedoService, _instantiationService: IInstantiationService, _aiEditTelemetryService: IAiEditTelemetryService); dispose(): void; acquire(): this; enableReviewModeUntilSettled(): void; updateTelemetryInfo(telemetryInfo: IModifiedEntryTelemetryInfo): void; accept(): Promise; /** Accepts and returns a function used to transition the state. This MUST be called by the consumer. */ acceptDeferred(): Promise<((tx: ITransaction) => void) | undefined>; protected abstract _doAccept(): Promise; reject(): Promise; /** Rejects and returns a function used to transition the state. This MUST be called by the consumer. */ rejectDeferred(): Promise<((tx: ITransaction) => void) | undefined>; protected abstract _doReject(): Promise; protected _notifySessionAction(outcome: "accepted" | "rejected" | "userModified"): void; protected _notifyAction(action: ChatUserAction): void; private readonly _editorIntegrations; getEditorIntegration(pane: IEditorPane): IModifiedFileEntryEditorIntegration; /** * Create the editor integration for this entry and the given editor pane. This will only be called * once (and cached) per pane. The integration is meant to be scoped to this entry only and when the * passed pane/editor changes input, then the editor integration must handle that, e.g use default/null * values */ protected abstract _createEditorIntegration(editor: IEditorPane): IModifiedFileEntryEditorIntegration; abstract readonly changesCount: IObservable; acceptStreamingEditsStart(responseModel: IChatResponseModel, undoStopId: string | undefined, tx: ITransaction | undefined): void; protected abstract _createUndoRedoElement(response: IChatResponseModel): IUndoRedoElement | undefined; abstract acceptAgentEdits(uri: URI, edits: (TextEdit | ICellEditOperation)[], isLastEdits: boolean, responseModel: IChatResponseModel | undefined): Promise; acceptStreamingEditsEnd(): Promise; protected abstract _areOriginalAndModifiedIdentical(): Promise; protected _resetEditsState(tx: ITransaction | undefined): void; abstract createSnapshot(chatSessionResource: URI, requestId: string | undefined, undoStop: string | undefined): ISnapshotEntry; abstract equalsSnapshot(snapshot: ISnapshotEntry | undefined): boolean; abstract restoreFromSnapshot(snapshot: ISnapshotEntry, restoreToDisk?: boolean): Promise; abstract resetToInitialContent(): Promise; abstract resetEditTrackerToInitialContent(): Promise; abstract initialContent: string; /** * Computes the edits between two snapshots of the file content. * @param beforeSnapshot The content before the changes * @param afterSnapshot The content after the changes * @returns Array of text edits or cell edit operations */ abstract computeEditsFromSnapshots(beforeSnapshot: string, afterSnapshot: string): Promise<(TextEdit | ICellEditOperation)[]>; /** * Marks the start of an external edit operation. * File system changes will be treated as agent edits until stopExternalEdit is called. */ startExternalEdit(): void; /** * Marks the end of an external edit operation. */ stopExternalEdit(): void; /** * Saves the current model state to disk. */ abstract save(): Promise; /** * Reloads the model from disk to ensure it's in sync with file system changes. */ abstract revertToDisk(): Promise; } export {};