import { Disposable, IDisposable } from "../../../../base/common/lifecycle.js"; import { IObservable } from "../../../../base/common/observable.js"; import { URI } from "../../../../base/common/uri.js"; import { IEditSessionEntryDiff } from "../common/editing/chatEditingService.js"; import { IChatResponseFileChangesService } from "./chatResponseFileChangesService.service.js"; export interface IChatResponseFileEdit extends IEditSessionEntryDiff { readonly isOutsideWorkspace: boolean; } /** An authoritative result saying valid edits produced no net file changes. */ export declare const AUTHORITATIVE_EMPTY_CHAT_RESPONSE_FILE_CHANGES: readonly IEditSessionEntryDiff[]; /** * Supplies the per-response (per-request) file-change diffs rendered by the * "Changed N files" summary under a completed chat response. * * Most chat sessions derive these diffs from their {@link IChatEditingSession}. * Some session types (notably agent host sessions) own an authoritative, * server-computed view of a turn's changes and provide it here instead, so the * summary reflects the same source of truth as the rest of that session's * change UI. */ export interface IChatResponseFileChangesProvider { /** * Returns an observable of the file-change diffs produced by `requestId` * within `sessionResource`, or `undefined` when this provider cannot * supply changes for that request (in which case the caller falls back to * the chat editing session). Return * {@link AUTHORITATIVE_EMPTY_CHAT_RESPONSE_FILE_CHANGES} when valid edits * cancel to no net change and consumers must clear previously cached diffs. */ getChangesForRequest(sessionResource: URI, requestId: string): IObservable | undefined; /** * Returns the file edits produced by `requestId` from the response output * stream, or `undefined` when unavailable. Unlike {@link getChangesForRequest}, * this is not limited to a changeset and can include files outside the * workspace. Each edit is classified against its owning session. */ getFileEditsForRequest?(sessionResource: URI, requestId: string): IObservable | undefined; } export interface IChatResponseFileChangesOpenContext { readonly isLastTurn: boolean; } export interface IChatResponseFileChangesStats { readonly files: number; readonly insertions: number; readonly deletions: number; } export declare abstract class AbstractChatResponseFileChangesService extends Disposable implements IChatResponseFileChangesService { readonly _serviceBrand: undefined; private readonly _providers; registerProvider(chatSessionType: string, provider: IChatResponseFileChangesProvider): IDisposable; getChangesForRequest(sessionResource: URI, requestId: string): IObservable | undefined; getFileEditsForRequest(sessionResource: URI, requestId: string): IObservable | undefined; getChangeStatsForRequest(_sessionResource: URI, _requestId: string, _context: IChatResponseFileChangesOpenContext): IObservable | undefined; abstract openChangesForRequest(sessionResource: URI, requestId: string | undefined, context: IChatResponseFileChangesOpenContext): void; }