import { CancellationToken } from "../../../../base/common/cancellation.js";
import { Event, IWaitUntil } from "../../../../base/common/event.js";
import { IMarkdownString } from "../../../../base/common/htmlContent.js";
import { IDisposable } from "../../../../base/common/lifecycle.js";
import { IObservable } from "../../../../base/common/observable.js";
import { ThemeIcon } from "../../../../base/common/themables.js";
import { URI } from "../../../../base/common/uri.js";
import { IChatAgentAttachmentCapabilities, IChatAgentRequest } from "./participants/chatAgents.js";
import { IChatEditingSession } from "./editing/chatEditingService.js";
import { IChatRequestVariableData, ISerializableChatModelInputState } from "./model/chatModel.js";
import { IChatProgress, IChatSessionTiming } from "./chatService/chatService.js";
import { Target } from "./promptSyntax/service/promptsService.js";
export declare enum ChatSessionStatus {
    Failed = 0,
    Completed = 1,
    InProgress = 2,
    NeedsInput = 3
}
export interface IChatSessionCommandContribution {
    name: string;
    description: string;
    when?: string;
}
export interface IChatSessionProviderOptionItem {
    id: string;
    name: string;
    description?: string;
    locked?: boolean;
    icon?: ThemeIcon;
    default?: boolean;
}
export interface IChatSessionProviderOptionGroupCommand {
    command: string;
    title: string;
    tooltip?: string;
    arguments?: unknown[];
}
export interface IChatSessionProviderOptionGroup {
    id: string;
    name: string;
    description?: string;
    items: IChatSessionProviderOptionItem[];
    searchable?: boolean;
    onSearch?: (query: string, token: CancellationToken) => Thenable<IChatSessionProviderOptionItem[]>;
    /**
     * A context key expression that controls visibility of this option group picker.
     * When specified, the picker is only visible when the expression evaluates to true.
     * The expression can reference other option group values via `chatSessionOption.<groupId>`.
     * Example: `"chatSessionOption.models == 'gpt-4'"`
     */
    when?: string;
    icon?: ThemeIcon;
    /**
     * Custom commands to show in the option group's picker UI.
     * These will be shown in a separate section at the end of the picker.
     */
    commands?: IChatSessionProviderOptionGroupCommand[];
}
export interface IChatSessionsExtensionPoint {
    readonly type: string;
    readonly name: string;
    readonly displayName: string;
    readonly description: string;
    readonly when?: string;
    readonly icon?: string | {
        light: string;
        dark: string;
    };
    readonly order?: number;
    readonly alternativeIds?: string[];
    readonly welcomeTitle?: string;
    readonly welcomeMessage?: string;
    readonly welcomeTips?: string;
    readonly inputPlaceholder?: string;
    readonly capabilities?: IChatAgentAttachmentCapabilities;
    readonly commands?: IChatSessionCommandContribution[];
    readonly canDelegate?: boolean;
    /**
     * When set, the chat session will show a filtered mode picker with custom agents
     * that have a matching `target` property. This enables contributed chat sessions
     * to reuse the standard agent/mode dropdown with filtered custom agents.
     * Custom agents without a `target` property are also shown in all filtered lists
     */
    readonly customAgentTarget?: Target;
}
export interface IChatSessionItem {
    resource: URI;
    label: string;
    iconPath?: ThemeIcon;
    badge?: string | IMarkdownString;
    description?: string | IMarkdownString;
    status?: ChatSessionStatus;
    tooltip?: string | IMarkdownString;
    timing: IChatSessionTiming;
    changes?: {
        files: number;
        insertions: number;
        deletions: number;
    } | readonly IChatSessionFileChange[] | readonly IChatSessionFileChange2[];
    archived?: boolean;
    metadata?: {
        readonly [key: string]: unknown;
    };
}
export interface IChatSessionFileChange {
    modifiedUri: URI;
    originalUri?: URI;
    insertions: number;
    deletions: number;
}
export interface IChatSessionFileChange2 {
    readonly uri: URI;
    readonly originalUri?: URI;
    readonly modifiedUri?: URI;
    readonly insertions: number;
    readonly deletions: number;
}
export type IChatSessionHistoryItem = {
    id?: string;
    type: "request";
    prompt: string;
    participant: string;
    command?: string;
    variableData?: IChatRequestVariableData;
} | {
    type: "response";
    parts: IChatProgress[];
    participant: string;
};
/**
 * The session type used for local agent chat sessions.
 */
export declare const localChatSessionType = "local";
/**
 * The option ID used for selecting the agent in chat sessions.
 */
export declare const agentOptionId = "agent";
export interface IChatSession extends IDisposable {
    readonly onWillDispose: Event<void>;
    readonly sessionResource: URI;
    readonly history: readonly IChatSessionHistoryItem[];
    /**
     * Session options as key-value pairs. Keys correspond to option group IDs (e.g., 'models', 'subagents')
     * and values are either the selected option item IDs (string) or full option items (for locked state).
     */
    readonly options?: Record<string, string | IChatSessionProviderOptionItem>;
    readonly progressObs?: IObservable<IChatProgress[]>;
    readonly isCompleteObs?: IObservable<boolean>;
    readonly interruptActiveResponseCallback?: () => Promise<boolean>;
    /**
     * Editing session transferred from a previously-untitled chat session in `onDidCommitChatSessionItem`.
     */
    transferredState?: {
        editingSession: IChatEditingSession | undefined;
        inputState: ISerializableChatModelInputState | undefined;
    };
    requestHandler?: (request: IChatAgentRequest, progress: (progress: IChatProgress[]) => void, history: any[], // TODO: Nail down types
    token: CancellationToken) => Promise<void>;
}
export interface IChatSessionItemProvider {
    readonly chatSessionType: string;
    readonly onDidChangeChatSessionItems: Event<void>;
    provideChatSessionItems(token: CancellationToken): Promise<IChatSessionItem[]>;
}
export interface IChatSessionContentProvider {
    provideChatSessionContent(sessionResource: URI, token: CancellationToken): Promise<IChatSession>;
}
/**
 * Event fired when session options need to be sent to the extension.
 * Extends IWaitUntil to allow listeners to register async work that will be awaited.
 */
export interface IChatSessionOptionsWillNotifyExtensionEvent extends IWaitUntil {
    readonly sessionResource: URI;
    readonly updates: ReadonlyArray<{
        optionId: string;
        value: string | IChatSessionProviderOptionItem;
    }>;
}
export declare function isSessionInProgressStatus(state: ChatSessionStatus): boolean;
export declare function isIChatSessionFileChange2(obj: unknown): obj is IChatSessionFileChange2;
