import { IMouseWheelEvent } from "../../../../base/browser/mouseEvent.js"; import { Event } from "../../../../base/common/event.js"; import { URI } from "../../../../base/common/uri.js"; import { ICodeEditor } from "../../../../editor/browser/editorBrowser.js"; import { Selection } from "../../../../editor/common/core/selection.js"; import { EditDeltaInfo } from "../../../../editor/common/textModelEditSource.js"; import { MenuId } from "../../../../platform/actions/common/actions.js"; import { IContextKeyService } from "../../../../platform/contextkey/common/contextkey.service.js"; import { IChatAgentAttachmentCapabilities, IChatAgentCommand, IChatAgentData } from "../common/participants/chatAgents.js"; import { IChatResponseModel, IChatModelInputState } from "../common/model/chatModel.js"; import { IChatMode } from "../common/chatModes.js"; import { IParsedChatRequest } from "../common/requestParser/chatParserTypes.js"; import { ChatRequestQueueKind, IChatLocationData, IChatSendRequestOptions } from "../common/chatService/chatService.js"; import { IChatRequestViewModel, IChatResponseViewModel, IChatViewModel, IChatPendingDividerViewModel } from "../common/model/chatViewModel.js"; import { ChatAgentLocation, ChatModeKind } from "../common/constants.js"; import { ChatAttachmentModel } from "@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/attachments/chatAttachmentModel"; import { ChatInputPart } from "@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/widget/input/chatInputPart"; import { IChatWidgetContrib } from "@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/widget/chatWidget"; import { ICodeBlockActionContext } from "@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart"; import { AgentSessionProviders } from "./agentSessions/agentSessions.js"; /** * A workspace item that can be selected in the workspace picker. */ export interface IWorkspacePickerItem { readonly uri: URI; readonly label: string; readonly isFolder: boolean; } /** * Delegate interface for the workspace picker. * Allows consumers to get and set the target workspace for chat submissions in empty window contexts. */ export interface IWorkspacePickerDelegate { /** * Returns the list of available workspaces to select from. */ getWorkspaces(): IWorkspacePickerItem[]; /** * Returns the currently selected workspace, if any. */ getSelectedWorkspace(): IWorkspacePickerItem | undefined; /** * Sets the currently selected workspace. */ setSelectedWorkspace(workspace: IWorkspacePickerItem | undefined): void; /** * Event that fires when the selected workspace changes. */ onDidChangeSelectedWorkspace: Event; /** * Event that fires when the available workspaces change. */ onDidChangeWorkspaces: Event; /** * Command ID to execute when user wants to open a new folder. */ openFolderCommand: string; } /** * Delegate interface for the session target picker. * Allows consumers to get and optionally set the active session provider. */ export interface ISessionTypePickerDelegate { getActiveSessionProvider(): AgentSessionProviders | undefined; /** * Optional setter for the active session provider. * When provided, the picker will call this instead of executing the openNewChatSessionInPlace command. * This allows the welcome view to maintain independent state from the main chat panel. */ setActiveSessionProvider?(provider: AgentSessionProviders): void; /** * Optional getter for the pending delegation target - the target that will be used when submit is pressed. */ getPendingDelegationTarget?(): AgentSessionProviders | undefined; /** * Optional setter for the pending delegation target. * When a user selects a different session provider in a non-empty chat, * this stores the target for delegation on the next submit instead of immediately creating a new session. */ setPendingDelegationTarget?(provider: AgentSessionProviders): void; /** * Optional event that fires when the active session provider changes. * When provided, listeners (like chatInputPart) can react to session type changes * and update pickers accordingly. */ onDidChangeActiveSessionProvider?: Event; } export declare const ChatViewPaneTarget: unique symbol; export interface IQuickChatOpenOptions { /** * The query for quick chat. */ query: string; /** * Whether the query is partial and will await more input from the user. */ isPartialQuery?: boolean; /** * An optional selection range to apply to the query text box. */ selection?: Selection; } export interface IChatCodeBlockInfo { readonly ownerMarkdownPartId: string; readonly codeBlockIndex: number; readonly elementId: string; readonly uri: URI | undefined; readonly uriPromise: Promise; codemapperUri: URI | undefined; readonly chatSessionResource: URI | undefined; focus(): void; readonly languageId?: string | undefined; readonly editDeltaInfo?: EditDeltaInfo | undefined; } export interface IChatFileTreeInfo { treeDataId: string; treeIndex: number; focus(): void; } export type ChatTreeItem = IChatRequestViewModel | IChatResponseViewModel | IChatPendingDividerViewModel; export interface IChatListItemRendererOptions { readonly renderStyle?: "compact" | "minimal"; readonly noHeader?: boolean; readonly noFooter?: boolean; readonly renderDetectedCommandsWithRequest?: boolean; readonly restorable?: boolean; readonly editable?: boolean; readonly renderTextEditsAsSummary?: (uri: URI) => boolean; readonly referencesExpandedWhenEmptyResponse?: boolean | ((mode: ChatModeKind) => boolean); readonly progressMessageAtBottomOfResponse?: boolean | ((mode: ChatModeKind) => boolean); } export interface IChatWidgetViewOptions { autoScroll?: boolean | ((mode: ChatModeKind) => boolean); renderInputOnTop?: boolean; renderFollowups?: boolean; renderStyle?: "compact" | "minimal"; renderInputToolbarBelowInput?: boolean; supportsFileReferences?: boolean; filter?: (item: ChatTreeItem) => boolean; /** Action triggered when 'clear' is called on the widget. */ clear?: () => Promise; rendererOptions?: IChatListItemRendererOptions; menus?: { /** * The menu that is inside the input editor, use for send, dictation */ executeToolbar?: MenuId; /** * The menu that next to the input editor, use for close, config etc */ inputSideToolbar?: MenuId; /** * The telemetry source for all commands of this widget */ telemetrySource?: string; }; defaultElementHeight?: number; editorOverflowWidgetsDomNode?: HTMLElement; enableImplicitContext?: boolean; enableWorkingSet?: "explicit" | "implicit"; supportsChangingModes?: boolean; dndContainer?: HTMLElement; inputEditorMinLines?: number; defaultMode?: IChatMode; /** * Optional delegate for the session target picker. * When provided, allows the widget to maintain independent state for the selected session type. * This is useful for contexts like the welcome view where target selection should not * immediately open a new session. */ sessionTypePickerDelegate?: ISessionTypePickerDelegate; /** * Optional delegate for the workspace picker. * When provided, shows a workspace picker in the chat input allowing users to select * a target workspace for their request. This is useful for empty window contexts where * the user wants to send a request to a specific workspace. */ workspacePickerDelegate?: IWorkspacePickerDelegate; /** * Optional handler for chat submission. * When provided, this handler is called before the normal input acceptance flow. * If it returns true (handled), the normal submission is skipped. * This is useful for contexts like the welcome view where submission should * redirect to a different workspace rather than executing locally. */ submitHandler?: (query: string, mode: ChatModeKind) => Promise; /** * Whether we are running in the sessions window. * When true, the secondary toolbar (permissions picker) is hidden. */ isSessionsWindow?: boolean; } export interface IChatViewViewContext { viewId: string; } export declare function isIChatViewViewContext(context: IChatWidgetViewContext): context is IChatViewViewContext; export interface IChatResourceViewContext { isQuickChat?: boolean; isInlineChat?: boolean; } export declare function isIChatResourceViewContext(context: IChatWidgetViewContext): context is IChatResourceViewContext; export type IChatWidgetViewContext = IChatViewViewContext | IChatResourceViewContext | {}; export interface IChatAcceptInputOptions { noCommandDetection?: boolean; isVoiceInput?: boolean; enableImplicitContext?: boolean; storeToHistory?: boolean; /** * When set, queues this message to be sent after the current request completes. * If Steering, also sets yieldRequested on any active request to signal it should wrap up. */ queue?: ChatRequestQueueKind; /** * When true, always queues the request regardless of whether a request is currently in progress. * The request stays in the pending queue until explicitly processed. */ alwaysQueue?: boolean; } export interface IChatWidgetViewModelChangeEvent { readonly previousSessionResource: URI | undefined; readonly currentSessionResource: URI | undefined; } export interface IChatWidget { readonly domNode: HTMLElement; readonly onDidChangeViewModel: Event; readonly onDidAcceptInput: Event; readonly onDidHide: Event; readonly onDidShow: Event; readonly onDidSubmitAgent: Event<{ agent: IChatAgentData; slashCommand?: IChatAgentCommand; }>; readonly onDidChangeAgent: Event<{ agent: IChatAgentData; slashCommand?: IChatAgentCommand; }>; readonly onDidChangeParsedInput: Event; readonly onDidChangeActiveInputEditor: Event; readonly onDidFocus: Event; readonly location: ChatAgentLocation; readonly viewContext: IChatWidgetViewContext; readonly viewModel: IChatViewModel | undefined; readonly inputEditor: ICodeEditor; readonly supportsFileReferences: boolean; readonly attachmentCapabilities: IChatAgentAttachmentCapabilities; readonly parsedInput: IParsedChatRequest; readonly lockedAgentId: string | undefined; lastSelectedAgent: IChatAgentData | undefined; readonly scopedContextKeyService: IContextKeyService; readonly input: ChatInputPart; readonly attachmentModel: ChatAttachmentModel; readonly locationData?: IChatLocationData; readonly contribs: readonly IChatWidgetContrib[]; readonly supportsChangingModes: boolean; getContrib(id: string): T | undefined; reveal(item: ChatTreeItem): void; focus(item: ChatTreeItem): void; getSibling(item: ChatTreeItem, type: "next" | "previous"): ChatTreeItem | undefined; getFocus(): ChatTreeItem | undefined; setInput(query?: string): void; getInput(): string; refreshParsedInput(): void; logInputHistory(): void; acceptInput(query?: string, options?: IChatAcceptInputOptions): Promise; startEditing(requestId: string): void; finishedEditing(completedEdit?: boolean): void; rerunLastRequest(): Promise; setInputPlaceholder(placeholder: string): void; resetInputPlaceholder(): void; /** * Focuses the response item in the list. * @param lastFocused Focuses the most recently focused response. Otherwise, focuses the last response. */ focusResponseItem(lastFocused?: boolean): void; focusInput(): void; /** * Focuses the Todos view in the chat widget. * @returns Whether the operation succeeded (i.e., the Todos view was focused). */ focusTodosView(): boolean; /** * Toggles focus between the Todos view and the previous focus target in the chat widget. * @returns Whether the operation succeeded (i.e., the focus was toggled). */ toggleTodosViewFocus(): boolean; /** * Focuses the question carousel in the chat widget. * @returns Whether the operation succeeded (i.e., the question carousel was focused). */ focusQuestionCarousel(): boolean; /** * Toggles focus between the question carousel and the chat input. * @returns Whether the operation succeeded (i.e., the focus was toggled). */ toggleQuestionCarouselFocus(): boolean; /** * Navigates to the previous question in the question carousel. * @returns Whether the operation succeeded (i.e., a previous question exists). */ navigateToPreviousQuestion(): boolean; /** * Navigates to the next question in the question carousel. * @returns Whether the operation succeeded (i.e., a next question exists). */ navigateToNextQuestion(): boolean; /** * Toggles focus between the tip widget and the chat input. * Returns false if no tip is visible. * @returns Whether the operation succeeded (i.e., the focus was toggled). */ toggleTipFocus(): boolean; hasInputFocus(): boolean; getModeRequestOptions(): Partial; getCodeBlockInfoForEditor(uri: URI): IChatCodeBlockInfo | undefined; getCodeBlockInfosForResponse(response: IChatResponseViewModel): IChatCodeBlockInfo[]; getFileTreeInfosForResponse(response: IChatResponseViewModel): IChatFileTreeInfo[]; getLastFocusedFileTreeForResponse(response: IChatResponseViewModel): IChatFileTreeInfo | undefined; clear(): Promise; getViewState(): IChatModelInputState | undefined; lockToCodingAgent(name: string, displayName: string, agentId?: string): void; unlockFromCodingAgent(): void; handleDelegationExitIfNeeded(sourceAgent: Pick | undefined, targetAgent: IChatAgentData | undefined): Promise; delegateScrollFromMouseWheelEvent(event: IMouseWheelEvent): void; } export interface ICodeBlockActionContextProvider { getCodeBlockContext(editor?: ICodeEditor): ICodeBlockActionContext | undefined; } export declare const ChatViewId = "workbench.panel.chat.view.copilot"; export declare const ChatViewContainerId = "workbench.panel.chat";