import { CancellationToken } from "../../../../../base/common/cancellation.js";
import { Event } from "../../../../../base/common/event.js";
import { IDisposable } from "../../../../../base/common/lifecycle.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, IChatQuestionAnswers } from "./chatService.js";
export declare const IChatService: import("../../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier<IChatService>;
export interface IChatService {
    _serviceBrand: undefined;
    transferredSessionResource: URI | undefined;
    readonly onDidSubmitRequest: Event<{
        readonly chatSessionResource: URI;
        readonly message?: IParsedChatRequest;
    }>;
    readonly onDidCreateModel: Event<IChatModel>;
    /**
    * An observable containing all live chat models.
    */
    readonly chatModels: IObservable<Iterable<IChatModel>>;
    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<IChatModelReference | undefined>;
    /**
    * 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<ChatSendResult>;
    getSessionTitle(sessionResource: URI): string | undefined;
    setSessionTitle(sessionResource: URI, title: string): void;
    appendProgress(request: IChatRequestModel, progress: IChatProgress): void;
    resendRequest(request: IChatRequestModel, options?: IChatSendRequestOptions): Promise<void>;
    adoptRequest(sessionResource: URI, request: IChatRequestModel): Promise<void>;
    removeRequest(sessionResource: URI, requestId: string): Promise<void>;
    cancelCurrentRequestForSession(sessionResource: URI, source?: string): Promise<void>;
    /**
    * Migrates all in-flight and queued pending requests from one session to another.
    * Cancels the in-flight request on the original session, removes queued requests,
    * and re-sends them all on the target session preserving their original send options.
    */
    migrateRequests(originalResource: URI, targetResource: URI): 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<IChatDetail[]>;
    clearAllHistoryEntries(): Promise<void>;
    removeHistoryEntry(sessionResource: URI): Promise<void>;
    getChatStorageFolder(): URI;
    logChatIndex(): void;
    getLiveSessionItems(): Promise<IChatDetail[]>;
    getHistorySessionItems(): Promise<IChatDetail[]>;
    getMetadataForSession(sessionResource: URI): Promise<IChatDetail | undefined>;
    readonly onDidPerformUserAction: Event<IChatUserActionEvent>;
    notifyUserAction(event: IChatUserActionEvent): void;
    readonly onDidReceiveQuestionCarouselAnswer: Event<{
        requestId: string;
        resolveId: string;
        answers: IChatQuestionAnswers | undefined;
    }>;
    notifyQuestionCarouselAnswer(requestId: string, resolveId: string, answers: IChatQuestionAnswers | undefined): void;
    readonly onDidDisposeSession: Event<{
        readonly sessionResource: readonly URI[];
        readonly reason: "cleared";
    }>;
    transferChatSession(transferredSessionResource: URI, toWorkspace: URI): Promise<void>;
    activateDefaultAgent(location: ChatAgentLocation): Promise<void>;
    readonly requestInProgressObs: IObservable<boolean>;
    /**
    * @deprecated
    */
    registerChatModelChangeListeners(chatSessionType: string, onChange: (chatSessionResource: URI) => void): IDisposable;
    /**
    * For tests only!
    */
    setSaveModelsEnabled(enabled: boolean): void;
    /**
    * For tests only!
    */
    waitForModelDisposals(): Promise<void>;
}
