import { IHistoryNavigationWidget } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/history"; 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 { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable"; import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { CodeEditorWidget } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget"; import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service"; import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service"; import { IAccessibilityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service"; import { MenuId } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions"; 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 { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service"; import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service"; import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service"; import { ISharedWebContentExtractorService } from "@codingame/monaco-vscode-api/vscode/vs/platform/webContentExtractor/common/webContentExtractor.service"; import { IWorkbenchAssignmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/assignment/common/assignmentService.service"; import { IChatEntitlementService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service"; import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service"; import { IChatAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service"; import { IChatEditingSession } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService"; import { IChatRequestModeInfo } from "@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatModel"; import { IChatMode } from "@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/common/chatModes"; import { IChatModeService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service"; import { IChatFollowup } 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 { ChatRequestVariableSet, IChatRequestVariableEntry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatVariableEntries"; import { 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 { IChatWidgetHistoryService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatWidgetHistoryService.service"; import { ChatAgentLocation, ChatModeKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants"; import { ILanguageModelChatMetadata, ILanguageModelChatMetadataAndIdentifier } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels"; import { ILanguageModelsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service"; 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 { IChatWidget } from "@codingame/monaco-vscode-2339d6ac-d6bb-53cd-95ee-81911735d1c7-common/vscode/vs/workbench/contrib/chat/browser/chat"; import { ChatAttachmentModel } from "./chatAttachmentModel.js"; import { ChatDragAndDrop } from "./chatDragAndDrop.js"; import { ChatSelectedTools } from "./chatSelectedTools.js"; import { IChatViewState } from "./chatWidget.js"; import { ChatImplicitContext } from "./contrib/chatImplicitContext.js"; import { ChatRelatedFiles } from "./contrib/chatInputRelatedFilesContrib.js"; export interface IChatInputStyles { overlayBackground: string; listForeground: string; listBackground: string; } export interface IChatInputPartOptions { defaultMode?: IChatMode; renderFollowups: boolean; renderStyle?: "compact"; renderInputToolbarBelowInput: boolean; menus: { executeToolbar: MenuId; telemetrySource: string; inputSideToolbar?: MenuId; }; editorOverflowWidgetsDomNode?: HTMLElement; renderWorkingSet: boolean; enableImplicitContext?: boolean; supportsChangingModes?: boolean; dndContainer?: HTMLElement; widgetViewKindTag: string; } export interface IWorkingSetEntry { uri: URI; } export declare class ChatInputPart extends Disposable implements IHistoryNavigationWidget { private readonly location; private readonly options; private readonly inline; private readonly historyService; private readonly modelService; private readonly instantiationService; private readonly contextKeyService; private readonly configurationService; private readonly keybindingService; private readonly accessibilityService; private readonly languageModelsService; private readonly logService; private readonly fileService; private readonly editorService; private readonly themeService; private readonly textModelResolverService; private readonly storageService; private readonly labelService; private readonly agentService; private readonly sharedWebExtracterService; private readonly experimentService; private readonly entitlementService; private readonly chatModeService; private readonly promptsService; private readonly toolService; private readonly chatService; private readonly chatSessionsService; private static _counter; private _workingSetCollapsed; private readonly _chatInputTodoListWidget; private readonly _chatEditingTodosDisposables; private _lastEditingSessionId; private _onDidLoadInputState; readonly onDidLoadInputState: Event; private _onDidChangeHeight; readonly onDidChangeHeight: Event; private _onDidFocus; readonly onDidFocus: Event; private _onDidBlur; readonly onDidBlur: Event; private _onDidChangeContext; readonly onDidChangeContext: Event<{ removed?: IChatRequestVariableEntry[]; added?: IChatRequestVariableEntry[]; }>; private _onDidAcceptFollowup; readonly onDidAcceptFollowup: Event<{ followup: IChatFollowup; response: IChatResponseViewModel | undefined; }>; private _onDidClickOverlay; readonly onDidClickOverlay: Event; private readonly _attachmentModel; private _widget?; get attachmentModel(): ChatAttachmentModel; readonly selectedToolsModel: ChatSelectedTools; getAttachedContext(sessionResource: URI): ChatRequestVariableSet; getAttachedAndImplicitContext(sessionResource: URI): ChatRequestVariableSet; /** * Check if the chat input part has any prompt file attachments. */ get hasPromptFileAttachments(): boolean; private _indexOfLastAttachedContextDeletedWithKeyboard; private _indexOfLastOpenedContext; private _implicitContext; get implicitContext(): ChatImplicitContext | undefined; private _relatedFiles; get relatedFiles(): ChatRelatedFiles | undefined; private _hasFileAttachmentContextKey; private readonly _onDidChangeVisibility; private readonly _contextResourceLabels; private readonly inputEditorMaxHeight; private inputEditorHeight; private container; private inputSideToolbarContainer?; private followupsContainer; private readonly followupsDisposables; private attachmentsContainer; private chatInputOverlay; private readonly overlayClickListener; private attachedContextContainer; private readonly attachedContextDisposables; private relatedFilesContainer; private chatEditingSessionWidgetContainer; private chatInputTodoListWidgetContainer; private _inputPartHeight; get inputPartHeight(): number; private _followupsHeight; get followupsHeight(): number; private _editSessionWidgetHeight; get editSessionWidgetHeight(): number; get todoListWidgetHeight(): number; get attachmentsHeight(): number; private _inputEditor; private _inputEditorElement; private executeToolbar; private inputActionsToolbar; private addFilesToolbar; private addFilesButton; get inputEditor(): CodeEditorWidget; readonly dnd: ChatDragAndDrop; private history; private historyNavigationBackwardsEnablement; private historyNavigationForewardsEnablement; private inputModel; private inputEditorHasText; private chatCursorAtTop; private inputEditorHasFocus; private currentlyEditingInputKey; /** * Context key is set when prompt instructions are attached. */ private promptFileAttached; private chatModeKindKey; private withinEditSessionKey; private filePartOfEditSessionKey; private chatSessionHasOptions; private modelWidget; private modeWidget; private chatSessionPickerWidgets; private chatSessionPickerContainer; private _lastSessionPickerAction; private readonly _waitForPersistedLanguageModel; private _onDidChangeCurrentLanguageModel; private readonly _chatSessionOptionEmitters; private _currentLanguageModel; get currentLanguageModel(): string | undefined; get selectedLanguageModel(): ILanguageModelChatMetadataAndIdentifier | undefined; private _onDidChangeCurrentChatMode; readonly onDidChangeCurrentChatMode: Event; private readonly _currentModeObservable; get currentModeKind(): ChatModeKind; get currentModeObs(): IObservable; get currentModeInfo(): IChatRequestModeInfo; private cachedDimensions; private cachedExecuteToolbarWidth; private cachedInputToolbarWidth; readonly inputUri: URI; private _workingSetLinesAddedSpan; private _workingSetLinesRemovedSpan; private readonly _chatEditsActionsDisposables; private readonly _chatEditsDisposables; private readonly _renderingChatEdits; private _chatEditsListPool; private _chatEditList; get selectedElements(): URI[]; private _attemptedWorkingSetEntriesCount; /** * The number of working set entries that the user actually wanted to attach. * This is less than or equal to {@link ChatInputPart.chatEditWorkingSetFiles}. */ get attemptedWorkingSetEntriesCount(): number; private readonly getInputState; /** * Number consumers holding the 'generating' lock. */ private _generating?; constructor(location: ChatAgentLocation, options: IChatInputPartOptions, styles: IChatInputStyles, getContribsInputState: () => any, inline: boolean, historyService: IChatWidgetHistoryService, modelService: IModelService, instantiationService: IInstantiationService, contextKeyService: IContextKeyService, configurationService: IConfigurationService, keybindingService: IKeybindingService, accessibilityService: IAccessibilityService, languageModelsService: ILanguageModelsService, logService: ILogService, fileService: IFileService, editorService: IEditorService, themeService: IThemeService, textModelResolverService: ITextModelService, storageService: IStorageService, labelService: ILabelService, agentService: IChatAgentService, sharedWebExtracterService: ISharedWebContentExtractorService, experimentService: IWorkbenchAssignmentService, entitlementService: IChatEntitlementService, chatModeService: IChatModeService, promptsService: IPromptsService, toolService: ILanguageModelToolsService, chatService: IChatService, chatSessionsService: IChatSessionsService); setIsWithinEditSession(inInsideDiff: boolean, isFilePartOfEditSession: boolean): void; private getSelectedModelStorageKey; private getSelectedModelIsDefaultStorageKey; private initSelectedModel; setEditing(enabled: boolean): void; switchModel(modelMetadata: Pick): void; switchModelByQualifiedName(qualifiedModelName: string): boolean; switchToNextModel(): void; openModelPicker(): void; openModePicker(): void; openChatSessionPicker(): void; /** * Create picker widgets for all option groups available for the current session type. */ private createChatSessionPickerWidgets; setCurrentLanguageModel(model: ILanguageModelChatMetadataAndIdentifier): void; private checkModelSupported; /** * By ID- prefer this method */ setChatMode(mode: ChatModeKind | string, storeSelection?: boolean): void; private setChatMode2; private modelSupportedForDefaultAgent; private getModels; private setCurrentLanguageModelToDefault; private loadHistory; private _getAriaLabel; private validateCurrentChatMode; initForNewChatModel(state: IChatViewState, chatSessionIsEmpty: boolean): void; private getDefaultModeExperimentStorageKey; logInputHistory(): void; setVisible(visible: boolean): void; /** If consumers are busy generating the chat input, returns the promise resolved when they finish */ get generating(): Promise | undefined; /** Disables the input submissions buttons until the disposable is disposed. */ startGenerating(): IDisposable; get element(): HTMLElement; showPreviousValue(): Promise; showNextValue(): Promise; private navigateHistory; setValue(value: string, transient: boolean): void; private saveCurrentValue; focus(): void; hasFocus(): boolean; /** * Reset the input and update history. * @param userQuery If provided, this will be added to the history. Followups and programmatic queries should not be passed. */ acceptInput(isUserQuery?: boolean): Promise; validateAgentMode(): void; private getFilteredEntry; private _acceptInputForVoiceover; private _handleAttachedContextChange; private getOrCreateOptionEmitter; /** * Refresh all registered option groups for the current chat session. * Fires events for each option group with their current selection. */ private refreshChatSessionPickers; private hideAllSessionPickerWidgets; private disposeSessionPickerWidgets; /** * Get the current option for a specific option group. * If no option is currently set, initializes with the first item as default. */ private getCurrentOptionForGroup; render(container: HTMLElement, initialValue: string, widget: IChatWidget): void; toggleChatInputOverlay(editing: boolean): void; renderAttachedContext(): void; private hasImplicitContextBlock; private handleAttachmentDeletion; private handleAttachmentOpen; private handleAttachmentNavigation; renderChatTodoListWidget(chatSessionResource: URI): Promise; clearTodoListWidget(sessionResource: URI | undefined, force: boolean): void; renderChatEditingSessionState(chatEditingSession: IChatEditingSession | null): void; private renderChatEditingSessionWithEntries; renderChatRelatedFiles(): Promise; renderFollowups(items: IChatFollowup[] | undefined, response: IChatResponseViewModel | undefined): Promise; get contentHeight(): number; layout(height: number, width: number): void; private previousInputEditorDimension; private _layout; private getLayoutData; getViewState(): IChatInputState; saveState(): void; }