import { CancellationToken } from "../../../../../base/common/cancellation.js"; import { Event } from "../../../../../base/common/event.js"; import { IObservable } from "../../../../../base/common/observable.js"; import { URI } from "../../../../../base/common/uri.js"; import { ChatAgentLocation } from "../constants.js"; import { IChatEditingSession } from "../editing/chatEditingService.js"; import { IChatModel, IExportableChatData, ISerializableChatData, IChatRequestModel, IChatRequestVariableData } from "../model/chatModel.js"; import { IParsedChatRequest } from "../requestParser/chatParserTypes.js"; import { IChatSessionStartOptions, IChatModelReference, IChatSessionContext, IChatSendRequestOptions, ChatSendResult, IChatProgress, ChatRequestQueueKind, IChatCompleteResponse, IChatDetail, IChatUserActionEvent } from "./chatService.js"; export declare const IChatService: import("../../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; export interface IChatService { _serviceBrand: undefined; transferredSessionResource: URI | undefined; readonly onDidSubmitRequest: Event<{ readonly chatSessionResource: URI; readonly message?: IParsedChatRequest; }>; readonly onDidCreateModel: Event; /** * An observable containing all live chat models. */ readonly chatModels: IObservable>; readonly editingSessions: readonly IChatEditingSession[]; isEnabled(location: ChatAgentLocation): boolean; hasSessions(): boolean; /** * Starts a new chat session at the given location. * * @returns A reference to the session's model. */ startNewLocalSession(location: ChatAgentLocation, options?: IChatSessionStartOptions): IChatModelReference; /** * Get an active session without holding a reference to it. * * @returns The session's model, or undefined if no active session exists. */ getSession(sessionResource: URI): IChatModel | undefined; /** * Acquire a reference to an active session. * * @returns A reference to the session's model or undefined if there is no active session for the given resource. */ acquireExistingSession(sessionResource: URI): IChatModelReference | undefined; /** * Tries to acquire an existing a chat session for the resource. If no session exists, tries to load one for the given * session resource and location. This may load the session from an external provider. * * @returns A reference to the session's model, or undefined if the session could not be loaded */ acquireOrLoadSession(sessionResource: URI, location: ChatAgentLocation, token: CancellationToken): Promise; /** * Loads a session from exported chat data */ loadSessionFromData(data: IExportableChatData | ISerializableChatData): IChatModelReference; getChatSessionFromInternalUri(sessionResource: URI): IChatSessionContext | undefined; /** * Sends a chat request for the given session. * @returns A result indicating whether the request was sent, queued, or rejected. */ sendRequest(sessionResource: URI, message: string, options?: IChatSendRequestOptions): Promise; getSessionTitle(sessionResource: URI): string | undefined; setSessionTitle(sessionResource: URI, title: string): void; appendProgress(request: IChatRequestModel, progress: IChatProgress): void; resendRequest(request: IChatRequestModel, options?: IChatSendRequestOptions): Promise; adoptRequest(sessionResource: URI, request: IChatRequestModel): Promise; removeRequest(sessionResource: URI, requestId: string): Promise; cancelCurrentRequestForSession(sessionResource: URI, source?: string): void; /** * Sets yieldRequested on the active request for the given session. */ setYieldRequested(sessionResource: URI): void; /** * Removes a pending request from the session's queue. */ removePendingRequest(sessionResource: URI, requestId: string): void; /** * Sets the pending requests for a session, allowing for deletions/reordering. * Adding new requests should go through sendRequest with the queue option. */ setPendingRequests(sessionResource: URI, requests: readonly { requestId: string; kind: ChatRequestQueueKind; }[]): void; /** * Ensures pending requests for the session are processing. If restoring from * storage or after an error, pending requests may be present without an * active chat message 'loop' happening. THis triggers the loop to happen * as needed. Idempotent, safe to call at any time. */ processPendingRequests(sessionResource: URI): void; addCompleteRequest(sessionResource: URI, message: IParsedChatRequest | string, variableData: IChatRequestVariableData | undefined, attempt: number | undefined, response: IChatCompleteResponse): void; setChatSessionTitle(sessionResource: URI, title: string): void; getLocalSessionHistory(): Promise; clearAllHistoryEntries(): Promise; removeHistoryEntry(sessionResource: URI): Promise; getChatStorageFolder(): URI; logChatIndex(): void; getLiveSessionItems(): Promise; getHistorySessionItems(): Promise; getMetadataForSession(sessionResource: URI): Promise; readonly onDidPerformUserAction: Event; notifyUserAction(event: IChatUserActionEvent): void; readonly onDidReceiveQuestionCarouselAnswer: Event<{ requestId: string; resolveId: string; answers: Record | undefined; }>; notifyQuestionCarouselAnswer(requestId: string, resolveId: string, answers: Record | undefined): void; readonly onDidDisposeSession: Event<{ readonly sessionResource: URI[]; readonly reason: "cleared"; }>; transferChatSession(transferredSessionResource: URI, toWorkspace: URI): Promise; activateDefaultAgent(location: ChatAgentLocation): Promise; readonly requestInProgressObs: IObservable; /** * For tests only! */ setSaveModelsEnabled(enabled: boolean): void; /** * For tests only! */ waitForModelDisposals(): Promise; }