import { IMouseWheelEvent } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/mouseEvent"; import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser"; import { ICodeEditorService } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service"; import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service"; import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service"; import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service"; import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service"; import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service"; import { IChatEntitlementService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service"; import { IChatAgentAttachmentCapabilities, IChatAgentCommand, IChatAgentData } from "@codingame/monaco-vscode-aac7027b-326c-513a-95a9-e4eedd151b38-common/vscode/vs/workbench/contrib/chat/common/chatAgents"; import { IChatAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service"; import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service"; import { IChatLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatLayoutService.service"; import { IChatTodoListService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatTodoListService.service"; import { IChatModel, IChatResponseModel } from "@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatModel"; import { IChatModeService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service"; import { IParsedChatRequest } from "@codingame/monaco-vscode-aac7027b-326c-513a-95a9-e4eedd151b38-common/vscode/vs/workbench/contrib/chat/common/chatParserTypes"; import { IChatLocationData, IChatSendRequestOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService"; import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service"; import { IChatSessionsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service"; import { IChatSlashCommandService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSlashCommands.service"; import { ChatViewModel, IChatResponseViewModel } from "@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatViewModel"; import { IChatInputState } from "../common/chatWidgetHistoryService.js"; import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants"; import { ILanguageModelToolsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModelToolsService.service"; import { IPromptsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service"; import { ChatTreeItem, IChatAcceptInputOptions, IChatCodeBlockInfo, IChatFileTreeInfo, IChatWidget, IChatWidgetViewContext, IChatWidgetViewOptions } from "@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/browser/chat"; import { IChatAccessibilityService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service"; import { IChatWidgetService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service"; import { ChatAttachmentModel } from "./chatAttachmentModel.js"; import { ChatInputPart, IChatInputStyles } from "./chatInputPart.js"; import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service"; import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service"; export interface IChatViewState { inputValue?: string; inputState?: IChatInputState; } export interface IChatWidgetStyles extends IChatInputStyles { inputEditorBackground: string; resultEditorBackground: string; } export interface IChatWidgetContrib extends IDisposable { readonly id: string; /** * A piece of state which is related to the input editor of the chat widget */ getInputState?(): any; /** * Called with the result of getInputState when navigating input history. */ setInputState?(s: any): void; } export interface IChatWidgetLocationOptions { location: ChatAgentLocation; resolveData?(): IChatLocationData | undefined; } export declare function isQuickChat(widget: IChatWidget): boolean; export declare function isInlineChat(widget: IChatWidget): boolean; export declare class ChatWidget extends Disposable implements IChatWidget { private readonly viewOptions; private readonly styles; private readonly codeEditorService; private readonly editorService; private readonly configurationService; private readonly contextKeyService; private readonly instantiationService; private readonly chatService; private readonly chatAgentService; private readonly chatWidgetService; private readonly contextMenuService; private readonly chatAccessibilityService; private readonly logService; private readonly themeService; private readonly chatSlashCommandService; private readonly telemetryService; private readonly promptsService; private readonly toolsService; private readonly chatModeService; private readonly chatLayoutService; private readonly chatEntitlementService; private readonly commandService; private readonly hoverService; private readonly chatSessionsService; private readonly chatTodoListService; private readonly contextService; private readonly lifecycleService; static readonly CONTRIBS: { new (...args: [ IChatWidget, ...any ]): IChatWidgetContrib; }[]; private readonly _onDidSubmitAgent; readonly onDidSubmitAgent: Event<{ agent: IChatAgentData; slashCommand?: IChatAgentCommand; }>; private _onDidChangeAgent; readonly onDidChangeAgent: Event<{ agent: IChatAgentData; slashCommand?: IChatAgentCommand; }>; private _onDidFocus; readonly onDidFocus: Event; private _onDidChangeViewModel; readonly onDidChangeViewModel: Event; private _onDidScroll; readonly onDidScroll: Event; private _onDidClear; readonly onDidClear: Event; private _onDidAcceptInput; readonly onDidAcceptInput: Event; private _onDidHide; readonly onDidHide: Event; private _onDidShow; readonly onDidShow: Event; private _onDidChangeParsedInput; readonly onDidChangeParsedInput: Event; private readonly _onWillMaybeChangeHeight; readonly onWillMaybeChangeHeight: Event; private _onDidChangeHeight; readonly onDidChangeHeight: Event; private readonly _onDidChangeContentHeight; readonly onDidChangeContentHeight: Event; private contribs; private tree; private renderer; private readonly _codeBlockModelCollection; private lastItem; private readonly inputPartDisposable; private readonly inlineInputPartDisposable; private readonly timeoutDisposable; private inputContainer; private focusedInputDOM; private editorOptions; private recentlyRestoredCheckpoint; private settingChangeCounter; private listContainer; private container; private historyListContainer; get domNode(): HTMLElement; private welcomeMessageContainer; private readonly welcomePart; private readonly welcomeContextMenuDisposable; private readonly historyViewStore; private readonly chatSuggestNextWidget; private historyList; private bodyDimension; private visibleChangeCount; private requestInProgress; private agentInInput; private inEmptyStateWithHistoryEnabledKey; private currentRequest; private _visible; get visible(): boolean; private previousTreeScrollHeight; /** * Whether the list is scroll-locked to the bottom. Initialize to true so that we can scroll to the bottom on first render. * The initial render leads to a lot of `onDidChangeTreeContentHeight` as the renderer works out the real heights of rows. */ private scrollLock; private _isReady; private _instructionFilesCheckPromise; private _instructionFilesExist; private _onDidBecomeReady; private readonly viewModelDisposables; private _viewModel; private _welcomeRenderScheduler; private _lockedAgent?; private readonly _lockedToCodingAgentContextKey; private readonly _agentSupportsAttachmentsContextKey; private _attachmentCapabilities; private readonly promptDescriptionsCache; private readonly promptUriCache; private _isLoadingPromptDescriptions; private _mostRecentlyFocusedItemIndex; private set viewModel(value); get viewModel(): ChatViewModel | undefined; private readonly _editingSession; private parsedChatRequest; get parsedInput(): IParsedChatRequest; get scopedContextKeyService(): IContextKeyService; private readonly _location; get location(): ChatAgentLocation; readonly viewContext: IChatWidgetViewContext; get supportsChangingModes(): boolean; get chatDisclaimer(): string; get locationData(): IChatLocationData | undefined; constructor(location: ChatAgentLocation | IChatWidgetLocationOptions, _viewContext: IChatWidgetViewContext | undefined, viewOptions: IChatWidgetViewOptions, styles: IChatWidgetStyles, codeEditorService: ICodeEditorService, editorService: IEditorService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, instantiationService: IInstantiationService, chatService: IChatService, chatAgentService: IChatAgentService, chatWidgetService: IChatWidgetService, contextMenuService: IContextMenuService, chatAccessibilityService: IChatAccessibilityService, logService: ILogService, themeService: IThemeService, chatSlashCommandService: IChatSlashCommandService, chatEditingService: IChatEditingService, telemetryService: ITelemetryService, promptsService: IPromptsService, toolsService: ILanguageModelToolsService, chatModeService: IChatModeService, chatLayoutService: IChatLayoutService, chatEntitlementService: IChatEntitlementService, commandService: ICommandService, hoverService: IHoverService, chatSessionsService: IChatSessionsService, chatTodoListService: IChatTodoListService, contextService: IWorkspaceContextService, lifecycleService: ILifecycleService); private _lastSelectedAgent; set lastSelectedAgent(agent: IChatAgentData | undefined); get lastSelectedAgent(): IChatAgentData | undefined; private _updateAgentCapabilitiesContextKeys; get supportsFileReferences(): boolean; get attachmentCapabilities(): IChatAgentAttachmentCapabilities; get input(): ChatInputPart; private get inputPart(); private get inlineInputPart(); get inputEditor(): ICodeEditor; get inputUri(): URI; get contentHeight(): number; get attachmentModel(): ChatAttachmentModel; waitForReady(): Promise; render(parent: HTMLElement): void; private scrollToEnd; getContrib(id: string): T | undefined; focusInput(): void; hasInputFocus(): boolean; refreshParsedInput(): void; getSibling(item: ChatTreeItem, type: "next" | "previous"): ChatTreeItem | undefined; clear(): void; private onDidChangeItems; /** * Updates the DOM visibility of welcome view and chat list immediately * @internal */ private updateChatViewVisibility; /** * Renders the welcome view content when needed. * * Note: Do not call this method directly. Instead, use `this._welcomeRenderScheduler.schedule()` * to ensure proper debouncing and avoid potential cyclic calls * @internal */ private renderWelcomeViewContentIfNeeded; private updateEmptyStateWithHistoryContext; private renderWelcomeHistorySection; private computeHistoryItems; private renderHistoryItems; private formatHistoryTimestamp; private openHistorySession; private refreshHistoryList; private _getGenerateInstructionsMessage; /** * Checks if any agent instruction files (.github/copilot-instructions.md or AGENTS.md) exist in the workspace. * Used to determine whether to show the "Generate Agent Instructions" hint. * * @returns true if instruction files exist OR if instruction features are disabled (to hide the hint) */ private _checkForAgentInstructionFiles; private getWelcomeViewContent; private getPromptFileSuggestions; private loadPromptDescriptions; private renderChatEditingSessionState; private renderFollowups; private renderChatSuggestNextWidget; private handleNextPromptSelection; setVisible(visible: boolean): void; private createList; startEditing(requestId: string): void; private clickedRequest; finishedEditing(completedEdit?: boolean): void; private scrollToCurrentItem; private onContextMenu; private onDidChangeTreeContentHeight; private getWidgetViewKindTag; private createInput; private onDidStyleChange; setModel(model: IChatModel, viewState: IChatViewState): void; getFocus(): ChatTreeItem | undefined; reveal(item: ChatTreeItem, relativeTop?: number): void; focus(item: ChatTreeItem): void; refilter(): void; setInputPlaceholder(placeholder: string): void; resetInputPlaceholder(): void; setInput(value?: string): void; getInput(): string; lockToCodingAgent(name: string, displayName: string, agentId: string): void; unlockFromCodingAgent(): void; get isLockedToCodingAgent(): boolean; get lockedAgentId(): string | undefined; logInputHistory(): void; acceptInput(query?: string, options?: IChatAcceptInputOptions): Promise; rerunLastRequest(): Promise; private collectInputState; private _findPromptFileInContext; private _applyPromptFileIfSet; private _acceptInput; getModeRequestOptions(): Partial; getCodeBlockInfosForResponse(response: IChatResponseViewModel): IChatCodeBlockInfo[]; getCodeBlockInfoForEditor(uri: URI): IChatCodeBlockInfo | undefined; getFileTreeInfosForResponse(response: IChatResponseViewModel): IChatFileTreeInfo[]; getLastFocusedFileTreeForResponse(response: IChatResponseViewModel): IChatFileTreeInfo | undefined; focusResponseItem(lastFocused?: boolean): void; layout(height: number, width: number): void; private _dynamicMessageLayoutData?; setDynamicChatTreeItemLayout(numOfChatTreeItems: number, maxHeight: number): void; updateDynamicChatTreeItemLayout(numOfChatTreeItems: number, maxHeight: number): void; get isDynamicChatTreeItemLayoutEnabled(): boolean; set isDynamicChatTreeItemLayoutEnabled(value: boolean); layoutDynamicChatTreeItemMode(): void; saveState(): void; getViewState(): IChatViewState; private updateChatInputContext; private _switchToAgentByName; private _applyPromptMetadata; /** * Adds additional instructions to the context * - instructions that have a 'applyTo' pattern that matches the current input * - instructions referenced in the copilot settings 'copilot-instructions' * - instructions referenced in an already included instruction file */ private _autoAttachInstructions; private _getReadTool; delegateScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent): void; } export declare class ChatWidgetService extends Disposable implements IChatWidgetService { readonly _serviceBrand: undefined; private _widgets; private _lastFocusedWidget; private readonly _onDidAddWidget; readonly onDidAddWidget: Event; get lastFocusedWidget(): IChatWidget | undefined; getAllWidgets(): ReadonlyArray; getWidgetsByLocations(location: ChatAgentLocation): ReadonlyArray; getWidgetByInputUri(uri: URI): ChatWidget | undefined; getWidgetBySessionId(sessionId: string): ChatWidget | undefined; getWidgetBySessionResource(sessionResource: URI): ChatWidget | undefined; private setLastFocusedWidget; register(newWidget: ChatWidget): IDisposable; }