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/promptTypes.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; /** * 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.`. * 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; readonly isReadOnly?: 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; readonly requiresCustomModels?: boolean; } 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; modelId?: string; } | { 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; readonly sessionResource: URI; readonly title?: string; 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; readonly progressObs?: IObservable; readonly isCompleteObs?: IObservable; readonly interruptActiveResponseCallback?: () => Promise; /** * 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; } export interface IChatSessionContentProvider { provideChatSessionContent(sessionResource: URI, token: CancellationToken): Promise; } export interface IChatSessionItemController { readonly onDidChangeChatSessionItems: Event; get items(): readonly IChatSessionItem[]; refresh(token: CancellationToken): Promise; newChatSessionItem?(request: IChatAgentRequest, token: CancellationToken): Promise; } /** * 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;