import { IHistoryNavigationWidget } from "../../../../../../base/browser/history.js"; import { IActionViewItem } from "../../../../../../base/browser/ui/actionbar/actionbar.js"; import { IActionViewItemOptions } from "../../../../../../base/browser/ui/actionbar/actionViewItems.js"; import { IAction } from "../../../../../../base/common/actions.js"; import { IStringDictionary } from "../../../../../../base/common/collections.js"; import { Event } from "../../../../../../base/common/event.js"; import { Disposable, IDisposable } from "../../../../../../base/common/lifecycle.js"; import { IObservable, ISettableObservable } from "../../../../../../base/common/observable.js"; import { IRemoteAgentService } from "../../../../../services/remote/common/remoteAgentService.service.js"; import { URI } from "../../../../../../base/common/uri.js"; import { CodeEditorWidget } from "../../../../../../editor/browser/widget/codeEditor/codeEditorWidget.js"; import { IEditorOptions } from "../../../../../../editor/common/config/editorOptions.js"; import { IRange } from "../../../../../../editor/common/core/range.js"; import { IModelService } from "../../../../../../editor/common/services/model.service.js"; import { ITextModelService } from "../../../../../../editor/common/services/resolverService.service.js"; import { IAccessibilityService } from "../../../../../../platform/accessibility/common/accessibility.service.js"; import { IActionViewItemService } from "../../../../../../platform/actions/browser/actionViewItemService.service.js"; import { MenuWorkbenchToolBar } from "../../../../../../platform/actions/browser/toolbar.js"; import { MenuId } from "../../../../../../platform/actions/common/actions.js"; import { IMenuService } from "../../../../../../platform/actions/common/actions.service.js"; import { IConfigurationService } from "../../../../../../platform/configuration/common/configuration.service.js"; import { IContextKeyService } from "../../../../../../platform/contextkey/common/contextkey.service.js"; import { IDialogService } from "../../../../../../platform/dialogs/common/dialogs.service.js"; import { IFileService } from "../../../../../../platform/files/common/files.service.js"; import { IInstantiationService } from "../../../../../../platform/instantiation/common/instantiation.js"; import { IKeybindingService } from "../../../../../../platform/keybinding/common/keybinding.service.js"; import { ILogService } from "../../../../../../platform/log/common/log.service.js"; import { SessionConfigKey } from "../../../../../../platform/agentHost/common/sessionConfigKeys.js"; import { IManagedSettingsService } from "../../../../../../platform/policy/common/copilotManagedSettings.service.js"; import { IVoiceModeOnboardingService } from "../../../../agentsVoice/browser/voiceModeOnboarding.service.js"; import { IStorageService } from "../../../../../../platform/storage/common/storage.service.js"; import { ITelemetryService } from "../../../../../../platform/telemetry/common/telemetry.service.js"; import { IThemeService } from "../../../../../../platform/theme/common/themeService.service.js"; import { ISharedWebContentExtractorService } from "../../../../../../platform/webContentExtractor/common/webContentExtractor.service.js"; import { IWorkspaceContextService } from "../../../../../../platform/workspace/common/workspace.service.js"; import { ISCMService } from "../../../../scm/common/scm.service.js"; import { IWorkbenchLayoutService } from "../../../../../services/layout/browser/layoutService.service.js"; import { IViewDescriptorService } from "../../../../../common/views.service.js"; import { IChatEntitlementService } from "../../../../../services/chat/common/chatEntitlementService.service.js"; import { IAccountPolicyGateService } from "../../../../../services/policies/common/accountPolicyService.service.js"; import { IEditorService } from "../../../../../services/editor/common/editorService.service.js"; import { IWorkbenchEnvironmentService } from "../../../../../services/environment/common/environmentService.service.js"; import { ChatContextKeys } from "../../../common/actions/chatContextKeys.js"; import { ChatRequestVariableSet, IChatRequestVariableEntry } from "../../../common/attachments/chatVariableEntries.js"; import { IChatMode, IChatModes } from "../../../common/chatModes.js"; import { IChatModeService } from "../../../common/chatModes.service.js"; import { IChatFollowup, IChatPlanReview, IChatQuestionCarousel, IChatToolInvocation } from "../../../common/chatService/chatService.js"; import { IChatService } from "../../../common/chatService/chatService.service.js"; import { IChatSessionsService } from "../../../common/chatSessionsService.service.js"; import { ChatAgentLocation, ChatModeKind, ChatPermissionLevel } from "../../../common/constants.js"; import { IChatEditingSession, IEditSessionEntryDiff } from "../../../common/editing/chatEditingService.js"; import { ILanguageModelChatMetadata, ILanguageModelChatMetadataAndIdentifier } from "../../../common/languageModels.js"; import { ILanguageModelsService } from "../../../common/languageModels.service.js"; import { ChatSessionWorkingSet, IChatSessionWorkingSetKeep, IChatSessionWorkingSetUndo } from "./chatSessionWorkingSet.js"; import { IChatModelInputState, IChatRequestModeInfo, IInputModel } from "../../../common/model/chatModel.js"; import { IChatResponseViewModel } from "../../../common/model/chatViewModel.js"; import { IChatAgentService } from "../../../common/participants/chatAgents.service.js"; import { ILanguageModelToolsService } from "../../../common/tools/languageModelToolsService.service.js"; import { IChatSpeechToTextService } from "../../speechToText/chatSpeechToTextService.service.js"; import { IDictationOnboardingService } from "../../speechToText/dictationOnboarding.service.js"; import { IVoiceSessionController } from "../../voiceClient/voiceSessionController.service.js"; import { AgentSessionTarget } from "../../agentSessions/agentSessions.js"; import { IAgentSessionsService } from "../../agentSessions/agentSessionsService.service.js"; import { ChatAttachmentModel } from "../../attachments/chatAttachmentModel.js"; import { IChatAttachmentWidgetInstance } from "@codingame/monaco-vscode-chat-service-override/vscode/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgetRegistry"; import { IChatAttachmentWidgetRegistry } from "../../attachments/chatAttachmentWidgetRegistry.service.js"; import { ChatImplicitContexts } from "../../attachments/chatImplicitContext.js"; import { IChatWidget, ISessionTypePickerDelegate, IWorkspacePickerDelegate } from "../../chat.js"; import { IChatWidgetService } from "../../chat.service.js"; import { AgentHostChatInputPicker } from "../../agentSessions/agentHost/agentHostChatInputPicker.js"; import { IChatPhoneInputPresenter } from "./chatPhoneInputPresenter.service.js"; import { IChatContextService } from "../../contextContrib/chatContextService.service.js"; import { ChatPlanReviewPart, IChatPlanReviewPartOptions } from "../chatContentParts/chatPlanReviewPart.js"; import { ChatQuestionCarouselPart, IChatQuestionCarouselOptions } from "../chatContentParts/chatQuestionCarouselPart.js"; import { ChatToolConfirmationCarouselPart, RevealSubagentCallback, ToolInvocationPartFactory } from "../chatContentParts/toolInvocationParts/chatToolConfirmationCarouselPart.js"; import { ChatToolInvocationPart } from "@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart"; import { IChatContentPartRenderContext } from "../chatContentParts/chatContentParts.js"; import { ChatInlineAttachments } from "./editor/chatInlineAttachments.js"; import { ChatDragAndDrop } from "../chatDragAndDrop.js"; import { IChatPetPlatform } from "../chatPetWidget.js"; import { IChatInputNotificationService } from "./chatInputNotificationService.service.js"; import { IChatInputNotificationModelSelection } from "./chatInputNotificationWidget.js"; import { ChatInputNoticeHost } from "./chatInputNoticeHost.js"; import { IChatInputNoticeHubService } from "./chatInputNoticeHub.service.js"; import { IChatInputPickerResponsiveLayoutItem } from "./chatInputPickerResponsiveLayout.js"; import { IChatSessionArchiveNudgeOptions } from "./chatSessionArchiveNudge.js"; import { ChatSelectedTools } from "./chatSelectedTools.js"; import { IChatPetService } from "../../chatPetService.service.js"; import { ModelPickerActionItem } from "./modelPicker/modelPickerActionItem.js"; import { IAgentHostConnectionsService } from "../../../../../../platform/agentHost/common/agentHostConnectionsService.service.js"; export declare function getToolbarPickerResponsiveItems(toolbar: MenuWorkbenchToolBar, compactStates: ReadonlyMap>, minimalStates?: ReadonlyMap>, excludedActionId?: string): IChatInputPickerResponsiveLayoutItem[]; export interface IChatInputStyles { overlayBackground: string; listForeground: string; listBackground: string; listShadow?: string; } /** Raised pet surfaces and an optional container whose edge replaces its inset controls. */ export interface IChatPetHorizontalPlatformProvider { readonly onDidChange: Event; getElements(): readonly HTMLElement[]; getBaseElement?(): HTMLElement | undefined; getJumpGameElement?(): HTMLElement | undefined; } export interface IChatInputPartOptions { defaultMode?: IChatMode; renderFollowups: boolean; /** Whether to host input requests, including those routed by another widget. Defaults to true. */ renderInputRequests?: boolean; renderStyle?: "compact"; renderInputToolbarBelowInput: boolean; renderSecondaryToolbar?: boolean; /** Whether to create the toolbar backed by {@link MenuId.ChatInputStatus}. A host can render its own. */ renderStatusToolbar?: boolean; menus: { executeToolbar: MenuId; telemetrySource: string; inputToolbar?: MenuId; inputSideToolbar?: MenuId; }; editorOverflowWidgetsDomNode?: HTMLElement; renderWorkingSet: boolean; enableImplicitContext?: boolean; supportsChangingModes?: boolean; dndContainer?: HTMLElement; inputEditorMinLines?: number; /** Vertical padding of the input editor. Defaults to the render style's padding. */ inputEditorPadding?: { readonly top: number; readonly bottom: number; }; /** Quick-suggestion behavior for the input editor. Defaults to disabled. */ inputEditorQuickSuggestions?: IEditorOptions["quickSuggestions"]; /** * Whether deferred notifications, such as promotions, may show. Defaults to * this input's own rule, which holds them back during a first chat session. */ deferredNotificationsEnabled?: IObservable; /** Whether this input owns a Voice Mode session that targets a draft. Defaults to never. */ ownsDraftVoiceSession?: IObservable; /** Whether this input's view is the active one when several are shown side by side. Defaults to true. */ isActiveView?: IObservable; /** Whether this input is a transient surface (inline, terminal, or quick chat). */ isTransientChat?: boolean; widgetViewKindTag: string; /** * Optional delegate for the session target picker. * When provided, allows the input part to maintain independent state for the selected session type. */ sessionTypePickerDelegate?: ISessionTypePickerDelegate; /** * Optional delegate for the workspace picker. * When provided, shows a workspace picker allowing users to select a target workspace * for their chat request. This is useful for empty window contexts. */ workspacePickerDelegate?: IWorkspacePickerDelegate; /** * Optional action view item provider for host-owned secondary toolbar * chips registered on {@link MenuId.ChatInputSecondary}. Used by the * automations dialog so per-instance state can stay outside the shared * chat input part while still using menu-driven rendering. */ secondaryToolbarActionViewItemProvider?: (action: IAction, options?: IActionViewItemOptions) => IActionViewItem | undefined; /** * Opens a host-owned secondary picker when its toolbar action moves into overflow. * Returns true when the action was handled. */ secondaryToolbarOverflowActionHandler?: (actionId: string, anchor: HTMLElement) => boolean; /** * When true, suppress the autorun that switches the current language * model to a mode's declared preferred model (`IChatMode.model`). * Used by the automations dialog so opening "New Automation" always * defaults to the picker's default (auto) regardless of which mode * the dialog opens with. * * User-initiated model picks (clicking the model picker, cycle * keybindings, etc.) are unaffected. */ suppressModePreferredModel?: boolean; /** * When true, model picks via the picker do not write to global storage. * Note: `switchToNextModel` keybindings still persist globally. */ suppressModelPersistence?: boolean; /** * Whether we are running in the sessions window. * When true, the secondary toolbar (permissions picker) is hidden. */ isSessionsWindow?: boolean; /** * Total horizontal gutter (in pixels) reserved outside the input box when * computing the editor width. Defaults account for the `.interactive-input-part` * margin used by the panel/sessions chat. Hosts that override that margin (e.g. * the automations dialog, which renders the composer flush with its form column) * can pass `0` so the editor fills the box and its scrollbar sits at the edge. */ inputPartHorizontalPadding?: number; /** Model selection owned by the host instead of this input; see {@link IChatInputHostModelSelection}. */ hostModelSelection?: IChatInputHostModelSelection; /** Submitting that the host takes part in; see {@link IChatInputHostSubmit}. */ hostSubmit?: IChatInputHostSubmit; } /** * Model selection that a host owns instead of the chat input, such as a composer * whose models come from a session provider. The host's current model is the * input's model, and the input's model commands, keybindings and notifications * act on the host's selection. The input does not apply a mode's preferred * model or remember picks for other inputs. */ export interface IChatInputHostModelSelection extends IChatInputNotificationModelSelection { switchToNextModel(): void; switchToNextPinnedModel(): void; switchModel(model: Pick): void; } /** * How a host that sends requests itself, such as a composer that sends to a * session provider, takes part in submitting the input. */ export interface IChatInputHostSubmit { /** * Whether the host currently allows submitting, in addition to the input's own * checks. The host also decides whether its session's options are valid, so * the input does not check them. */ readonly canSubmit: IObservable; /** Whether the host has content to send even when the input is empty, such as feedback it sends along. */ readonly hasContent?: IObservable; /** Label shown on the submit button, for sends that do more than send one request. */ readonly label?: IObservable; } export interface IWorkingSetEntry { uri: URI; } export declare enum ChatWidgetLocation { SidebarLeft = "sidebarLeft", SidebarRight = "sidebarRight", Panel = "panel", Editor = "editor" } export interface IChatWidgetLocationInfo { readonly location: ChatWidgetLocation; readonly isMaximized: boolean; } export interface IChatModeChangeEvent { readonly isUserInitiated: boolean; } export declare class ChatInputPart extends Disposable implements IHistoryNavigationWidget { private readonly location; private readonly options; private readonly inline; 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 dialogService; private readonly agentService; private readonly sharedWebExtracterService; private readonly entitlementService; private readonly chatModeService; private readonly toolService; private readonly chatSessionsService; private readonly chatContextService; private readonly agentSessionsService; private readonly speechToTextService; private readonly dictationOnboardingService; private readonly chatInputNoticeHubService; private readonly workspaceContextService; private readonly scmService; private readonly layoutService; private readonly viewDescriptorService; private readonly _chatAttachmentWidgetRegistry; private readonly chatInputNotificationService; private readonly chatPhoneInputPresenter; private readonly voiceModeOnboardingService; private readonly chatWidgetService; private readonly voiceSessionController; private readonly chatService; private readonly environmentService; private readonly chatPetService; private readonly actionViewItemService; private readonly accountPolicyGateService; private readonly agentHostConnectionsService; private readonly menuService; private readonly telemetryService; private static _counter; private _workingSetCollapsed; private readonly _chatInputTodoListWidget; private readonly _chatArtifactsWidget; private readonly _chatQuestionCarouselWidgets; private readonly _questionCarouselResponseIds; private readonly _questionCarouselSessionResources; private _hasQuestionCarouselContextKey; private readonly _chatPlanReviewWidgets; private readonly _planReviewResponseIds; private readonly _planReviewSessionResources; private readonly _chatToolConfirmationCarousels; private readonly _onDidChangeActiveConfirmationSubagent; readonly onDidChangeActiveConfirmationSubagent: Event; private readonly _chatEditingTodosDisposables; private _lastEditingSessionResource; private _onDidLoadInputState; readonly onDidLoadInputState: Event; private readonly _onDidChangeDraft; readonly onDidChangeDraft: Event; private readonly _toolbarRelayoutScheduler; 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(): ChatRequestVariableSet; getAttachedAndImplicitContext(): ChatRequestVariableSet; private _indexOfLastAttachedContextDeletedWithKeyboard; private _indexOfLastOpenedContext; private _implicitContext; get implicitContext(): ChatImplicitContexts | undefined; private _hasFileAttachmentContextKey; private readonly _onDidChangeVisibility; private readonly _notificationHostVisible; private readonly _contextResourceLabels; private readonly inputEditorMaxHeight; private readonly inputEditorMinHeight; private readonly singleLineInputEditorHeight; private inputEditorHeight; private ignoreInputEditorContentSizeChanges; private _maxHeight; private container; private inputSideToolbarContainer?; private secondaryToolbarContainer; private secondaryToolbar; private statusToolbarContainer; private followupsContainer; private readonly followupsDisposables; private attachmentsContainer; private chatInputOverlay; private readonly overlayClickListener; private attachedContextContainer; private readonly attachedContextDisposables; private chatEditingSessionWidgetContainer; private chatInputTodoListWidgetContainer; private chatArtifactsWidgetContainer; private chatGettingStartedTipContainer; private chatQuestionCarouselContainer; private chatPlanReviewContainer; private chatToolConfirmationCarouselContainer; private chatInputNotificationContainer; private chatGoalBannerContainer; private chatCustomizationMigrationNoticeContainer; private persistentContentContainer; private sessionArchiveNudgeContainer; private sessionArchiveNudgeOptions; private readonly sessionArchiveNudgeWidget; private readonly _chatPetHorizontalPlatformProviders; private readonly _onDidChangeChatPetHorizontalPlatforms; readonly onDidChangeChatPetHorizontalPlatforms: Event; private inputContainer; private inputEnabled; private inputAndSideToolbar; private readonly _notificationWidget; private readonly _goalBannerWidget; private readonly _onDidDismissGoalBanner; /** Fired when the user dismisses the autopilot goal banner. */ readonly onDidDismissGoalBanner: Event; private contextUsageWidget?; private contextUsageWidgetContainer; private contextUsageWidgetHome; private inputEditorTrailingSpace; private readonly _contextUsageDisposables; get inputContainerElement(): HTMLElement | undefined; get attachmentsContainerElement(): HTMLElement; placeContextUsageWidget(container?: HTMLElement): void; /** Reserves horizontal space at the trailing edge of the input editor. */ setInputEditorTrailingSpace(width: number): void; get customizationMigrationNoticeContainerElement(): HTMLElement; setCustomizationMigrationNoticeVisible(visible: boolean): void; get inputToolbarElement(): HTMLElement; get attachContextButtonElement(): HTMLElement | undefined; setInputToolbarAriaLabel(label: string): void; get inputRowHeight(): number; get persistentContentContainerElement(): HTMLElement; get hasSessionArchiveNudge(): boolean; setSessionArchiveNudge(options: IChatSessionArchiveNudgeOptions | undefined): void; get gettingStartedTipContainerElement(): HTMLElement; /** Arbitrates which notice occupies the area above this input. */ readonly noticeHost: ChatInputNoticeHost; /** Registers raised platforms associated with this input. */ registerChatPetHorizontalPlatformProvider(provider: IChatPetHorizontalPlatformProvider): IDisposable; getChatPetPlatformTop(petCenterX?: number): number; getChatPetPlatforms(): readonly IChatPetPlatform[]; readonly height: ISettableObservable; private _inputEditor; private _inputEditorElement; private _forceVisibleScrollbarUntilAccept; private _inputModel; private _inputModelSessionResource; /** * Speaks for the intended model while no conversation is bound — the inline request-edit input * part never binds one. Keeping it off the conversation is what makes that editor * self-contained: picking a model there to resubmit one request leaves the chat's own model * alone. */ private readonly _unboundIntent; /** * Whether the session being switched to should restore the model remembered for its type. * Latched while the switch is in flight because the decision is made before the view model * arrives and acted on after. Held here rather than in the shared selection controller: it * describes this widget's handshake, not what a conversation runs on. */ private _restorePerTypeModel; /** Whoever speaks for the intended model right now: the bound conversation, else this input part. */ private get _intentHolder(); /** * Whether a model arriving from the conversation's draft state is that conversation's own * choice. * * The draft state records which model, never who chose it — it is shared content, synced to * peers and the agent host. The conversation's intended model does record the authority, and it * is local to this client and outlives `clearState`, so a draft model matching an intent this * conversation established by choice is a restored choice rather than carried over. Anything else * stays provisional, which is what lets `chat.defaultModel` seed a new session that merely * inherited the previous one's model. */ private _restoreReasonFor; private readonly _modelSyncDisposables; private readonly _currentChatModes; private _isSyncingToOrFromInputModel; private _isRestoringAttachments; private readonly _syncTextDebounced; private executeToolbar; private inputActionsToolbar; private _inputPickerResponsiveLayout; private readonly _pickerFocusListeners; private readonly _workingBorderAnimations; private readonly _workingBorderAnimationRestart; private _secondaryPickerResponsiveLayout; get inputEditor(): CodeEditorWidget; private _inlineAttachments; /** The attachments shown as pills inline with the prompt, once the input is rendered. */ get inlineAttachments(): ChatInlineAttachments | undefined; /** * The prompt the input represents. It differs from the input editor's text * when inline attachment pills stand for text, see {@link ChatInlineAttachments}. */ getPromptText(): string; setHistoryKey(historyKey: string | undefined): void; readonly dnd: ChatDragAndDrop; private history; private historyNavigationBackwardsEnablement; private historyNavigationForewardsEnablement; private inputModel; private inputEditorHasText; private inputEditorHasSendableContent; private chatCursorAtTop; private inputEditorHasFocus; private currentlyEditingInputKey; private editingSentRequestKey; private chatModeKindKey; private chatModeNameKey; private chatModelIdKey; private withinEditSessionKey; private filePartOfEditSessionKey; private chatSessionHasOptions; private chatSessionOptionsValid; private agentSessionTypeKey; private chatSessionSupportsDelegationKey; private chatHasPendingDelegationTargetKey; private chatSessionHasCustomAgentTarget; private chatSessionHasTargetedModels; private modelWidget; private modeWidget; private readonly _agentPickerInAttachContext; private modePickerMenu; private attachContextActionViewItem; private permissionWidget; private _localSandboxSupported; private readonly permissionWidgetDisposeListener; private readonly agentHostPickers; private readonly overflowPickerWidget; private sessionTargetWidget; private delegationWidget; private readonly chatSessionPickerWidgets; private chatSessionPickerContainer; private _lastSessionPickerAction; private _lastSessionPickerOptions; private readonly _chatSessionOptionEmitters; /** * Scoped context key service for this chat input part. * Used to isolate option group context keys to this specific chat input instance. */ private _scopedContextKeyService; /** * Map of option group ID to its context key. * Keys follow the pattern `chatSessionOption.` and hold the currently selected option item ID. */ private readonly _optionContextKeys; private readonly _modelSelectionDiagnostics; private readonly _modelSelectionController; private readonly _currentLanguageModel; private readonly _modelSelectionRuntime; /** * The last result of {@link getAllMergedModels}, with the contributed vendors it was merged for. * Cleared when the models or the persisted cache change. */ private _mergedModels; /** * Per-editor store of each model's configuration (e.g. context size, thinking * effort), persisted to a `(location, sessionType)`-scoped storage bucket. * Cleared on session-type change so the next read re-seeds from the new * bucket. See issue #320393. */ private readonly _modelConfigStore; get currentLanguageModel(): string | undefined; get selectedLanguageModel(): IObservable; get onDidChangeUserSelectedModel(): Event<{ readonly fromModelId: string; readonly toModelId: string; }>; /** Models the current input can select. */ get availableLanguageModels(): readonly ILanguageModelChatMetadataAndIdentifier[]; private _onDidChangeCurrentChatMode; readonly onDidChangeCurrentChatMode: Event; private readonly _currentModeObservable; private readonly _currentChatModesObservable; private readonly _currentPermissionLevel; private permissionLevelKey; get currentModeKind(): ChatModeKind; get currentModeObs(): IObservable; get currentChatModesObs(): IObservable; get currentPermissionLevelObs(): IObservable; get currentModeInfo(): IChatRequestModeInfo; private cachedWidth; private cachedExecuteToolbarWidth; private cachedInputToolbarWidth; readonly inputUri: URI; private _workingSetLinesAddedSpan; private _workingSetLinesRemovedSpan; private readonly _chatEditsActionsDisposables; private readonly _chatEditsDisposables; private readonly _renderingChatEdits; private readonly _sessionFileChanges; private readonly _sessionWorkingSetView; private _sessionWorkingSet; private readonly _sessionWorkingSetDiffs; private readonly _sessionWorkingSetCollapsed; private readonly _sessionWorkingSetKeptChanges; private _lastSessionWorkingSetResource; 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; /** * Gets the pending delegation target if one is set. * This is used when the user changes the session target picker to a different provider * but hasn't submitted yet, so the delegation will happen on submit. */ get pendingDelegationTarget(): AgentSessionTarget | undefined; /** * Number consumers holding the 'generating' lock. */ private _generating?; private _emptyInputState; private _emptyInputAttachments; private _chatSessionIsEmpty; private readonly _pendingDelegationTargetObservable; private get _pendingDelegationTarget(); private set _pendingDelegationTarget(value); private readonly _currentSessionTypeObservable; private get _currentSessionType(); /** * The session type whose models the bound chat selects from when it differs from its resource's * (a chat answered by another agent of its session). Scoped to that chat so a rebound input drops it. */ private readonly _modelSessionTypeOverride; private set _currentSessionType(value); /** The session type (harness) whose models this input selects from. */ get modelTargetSessionType(): string | undefined; private readonly _currentSessionResourceObservable; private readonly _currentSessionModelObservable; private readonly _deferredNotificationsEnabled; private readonly _notificationAvailableLanguageModels; private readonly _notificationModelState; private _isFirstWorkbenchSession; /** Whether the session this input is bound to already has a request. */ private readonly _sessionStarted; private readonly _notificationModelTargetChatSessionType; constructor(location: ChatAgentLocation, options: IChatInputPartOptions, styles: IChatInputStyles, inline: boolean, modelService: IModelService, instantiationService: IInstantiationService, contextKeyService: IContextKeyService, configurationService: IConfigurationService, keybindingService: IKeybindingService, accessibilityService: IAccessibilityService, languageModelsService: ILanguageModelsService, logService: ILogService, managedSettingsService: IManagedSettingsService, fileService: IFileService, editorService: IEditorService, themeService: IThemeService, textModelResolverService: ITextModelService, storageService: IStorageService, dialogService: IDialogService, agentService: IChatAgentService, sharedWebExtracterService: ISharedWebContentExtractorService, entitlementService: IChatEntitlementService, chatModeService: IChatModeService, toolService: ILanguageModelToolsService, chatSessionsService: IChatSessionsService, chatContextService: IChatContextService, agentSessionsService: IAgentSessionsService, speechToTextService: IChatSpeechToTextService, dictationOnboardingService: IDictationOnboardingService, chatInputNoticeHubService: IChatInputNoticeHubService, workspaceContextService: IWorkspaceContextService, scmService: ISCMService, layoutService: IWorkbenchLayoutService, viewDescriptorService: IViewDescriptorService, _chatAttachmentWidgetRegistry: IChatAttachmentWidgetRegistry, chatInputNotificationService: IChatInputNotificationService, chatPhoneInputPresenter: IChatPhoneInputPresenter, voiceModeOnboardingService: IVoiceModeOnboardingService, chatWidgetService: IChatWidgetService, voiceSessionController: IVoiceSessionController, chatService: IChatService, environmentService: IWorkbenchEnvironmentService, chatPetService: IChatPetService, actionViewItemService: IActionViewItemService, accountPolicyGateService: IAccountPolicyGateService, remoteAgentService: IRemoteAgentService, agentHostConnectionsService: IAgentHostConnectionsService, menuService: IMenuService, telemetryService: ITelemetryService); private setImplicitContextEnablement; setIsWithinEditSession(inInsideDiff: boolean, isFilePartOfEditSession: boolean): void; private getSelectedModelTarget; /** * True when the session type owns its own model pool (either declared via `requiresCustomModels`, * or some registered model already targets it). Keeps storage keys stable before targeted models are published. */ private sessionTypeHasOwnModelPool; private initSelectedModel; setEditing(enabled: boolean, editingSentRequest: ChatContextKeys.EditingRequestType | undefined): void; switchModel(modelMetadata: Pick): void; /** * Switch to a model by its identifier. Returns true if a matching model * was found and applied. * * The remembered profile preference is updated only when both * `isUserAction` and `storeSelection` are true. */ switchModelByIdentifier(identifier: string, storeSelection?: boolean, isUserAction?: boolean): boolean; switchModelByQualifiedName(qualifiedModelNames: readonly string[]): boolean; requestModelByIdentifier(identifier: string, configuration?: IStringDictionary): Promise; requestModelByQualifiedName(qualifiedModelNames: readonly string[]): Promise; get hasPendingProgrammaticModelSelection(): boolean; switchToNextModel(): void; switchToNextPinnedModel(): void; /** Exact desktop picker owned by this input; combined phone sheets have no search contract. */ getModelPickerControl(): ReturnType; openModelPicker(): void; /** The Agent Host mode or permissions picker in the input toolbar, if it is rendered. */ getAgentHostPicker(property: SessionConfigKey.Mode | SessionConfigKey.AutoApprove): Pick | undefined; get isAgentPickerInAttachContextMenu(): boolean; private getModePickerAction; private bindAgentPickerPlacement; openModePicker(anchor?: HTMLElement): void; private _showCombinedPhonePickerSheet; private _createModelPickerDelegate; private _getModelPickerPresentationOptions; private _usesHarnessProviderIcon; /** * Returns this editor's snapshot of the given model's configuration (e.g. * context size, thinking effort), scoped to this editor rather than the * profile-global value. Delegates to {@link ChatModelConfigurationStore}. * See issue #320393. */ getModelConfiguration(modelId: string): IStringDictionary | undefined; /** * Restores a model's configuration captured in a session's persisted input * state. Called when the selected model is restored from session history so * the configuration follows the model through the same resolution hierarchy. * No-op for sessions that pre-date configuration capture (no value stored). */ private restoreModelConfiguration; private getModelConfigurationStorageKey; private _createModePickerDelegate; openPermissionPicker(): void; setPermissionLevel(level: ChatPermissionLevel): void; private getDefaultPermissionLevel; private getPermittedPermissionLevel; openSessionTargetPicker(): void; openDelegationPicker(): void; openChatSessionPicker(): void; /** * Create picker widgets for all option groups available for the current session type. */ private createChatSessionPickerWidgets; /** * Set the input model reference for syncing input state * * Note: We have a cyclic ref between ChatInputPart and ChatWidget, * When we invoke setInputModel, the property _widget is not set. Hence we don't have the SessionResource. * As a result, in this method when syncFromModel is called, the model state is not applied to the UI. * Instead, the defaults are computed and the model is updated with default values. Thereby blowing away model information. * Setting Widget and then calling this doesn't work either because the widget also relies on ChatInputPart (hence cyclic ref). * Solution is to pass the SessionResource as an argument to this method. */ setInputModel(model: IInputModel, chatSessionIsEmpty: boolean, forSessionResource: URI): void; private _getPersistedEmptyInputState; private _setEmptyModelState; /** * Sync from model to view (when model state changes) */ private _syncFromModel; /** * Sync current input state to the input model */ private _syncInputStateToModel; /** * Flush the current input state to the bound input model. Use this before * the host releases its model reference (e.g. on session switch) to ensure * an unsent draft is captured by `willDisposeModel` persistence. */ flushInputStateToModel(): void; setCurrentLanguageModel(model: ILanguageModelChatMetadataAndIdentifier, isUserAction?: boolean, storeSelection?: boolean): void; private _applyProgrammaticLanguageModel; private _requestProgrammaticLanguageModel; /** * By ID- prefer this method */ setChatMode(mode: ChatModeKind | string, storeSelection?: boolean, isUserInitiated?: boolean): void; private setChatMode2; /** * Get all models merged from live and cache, without session/mode filtering. * This is the canonical source for the full model pool, including cached models * that bridge startup races when live models haven't loaded yet. * * Read for every row of the model picker, so the merge is kept until one of its inputs * changes. Returns a fresh array, which callers may sort or filter in place. */ private getAllMergedModels; private computeMergedModels; private getModels; /** * True when the current session type can fall back to the synthetic "Auto" * model. Defaults to `true` when no session type is set. See * {@link hasNoAvailableModel} for the "nothing to send with" state, which * additionally requires an empty model list. */ private _showAutoModel; /** * True when the current session type cannot fall back to the Auto model * and no models are available to it — e.g. the Claude agent host for a * Copilot Free / Student user. In this state there is no model to send a * request with, so sending is blocked. */ private hasNoAvailableModel; private getModelsForSessionType; /** * Get the chat session type for the current session, if any. * * Once a real session exists, the session resource is the authoritative * source for which models are valid. The picker delegate only describes the * welcome/new-session selection, which may not match the session that was * ultimately created (e.g. an agent-host pick that fell back to an * in-process `local` session). Preferring the delegate in that case lets an * agent-host model leak into a local session's pool, so we only consult the * delegate when there is no session yet (the welcome view has no view model). */ private getCurrentSessionType; private _boundModelResource; private _readBoundModelPoolOverride; private _readModelSessionTypeOverride; /** * Selects models for the chat at `resource` (the bound one by default) from another session type's * pool than its resource's, for a chat answered by another agent than its session type serves. * `{ sessionType: undefined }` means that agent's pool is not known yet, so nothing is selectable; * `undefined` restores the resource's own pool. Another pool's models are never offered. * Set for a chat before it binds, the pool applies from its first model validation. */ setModelSessionTypeOverride(override: { readonly sessionType: string | undefined; } | undefined, resource?: URI | undefined, options?: { readonly revalidate?: boolean; }): void; /** * Reset the current mode when it is not valid for the current session type. */ private checkModeInSessionPool; private setCurrentLanguageModelToDefault; /** * The raw configured default-model value from the * {@link ChatConfiguration.DefaultModel} setting (which may * be forced by enterprise policy). Returns `undefined` when nothing is * configured. */ private getConfiguredModelValue; /** * The model a draft should open on: the draft's own, unless it belongs to another session's * pool, and always superseded by a configured default. */ private resolveDraftModel; /** * Re-seeds from storage when the current model is absent from the destination session's pool, * restoring the preference remembered for that pool. */ private reinitializeIfOutsidePool; /** Resets the language model to the location default, forgetting what was preferred before. */ resetLanguageModelToDefault(): void; private _createDraftChangeListeners; /** * Get the current input state for history */ getCurrentInputState(): IChatModelInputState; private _getAriaLabel; private registerChatModeValidation; get isManagedSettingsRefreshBlocked(): boolean; private validateCurrentChatMode; /** * Re-apply the session's own persisted custom agent once its mode becomes available. * * A restored agent-host session persists its selected custom agent in `mode`, but the agent * host's custom modes only register after the backend connects. Until then `setChatMode` falls * back to the builtin Agent, so when the custom modes arrive (`modes.onDidChange`) re-apply the * persisted custom agent. Builtin/default modes are handled by {@link validateCurrentChatMode}. */ private _restorePersistedCustomModeIfAvailable; 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; /** * Restores attachments to the input, re-fetching image binary data as needed. */ restoreAttachments(attachments: readonly IChatRequestVariableEntry[]): Promise; private navigateHistory; setValue(value: string, transient: boolean): void; focus(): void; /** Disable draft editing without disabling Stop; in-place composers can retain focus in the read-only editor. */ setInputEnabled(enabled: boolean, preserveFocus?: boolean): void; hasFocus(): boolean; focusTodoList(): boolean; isTodoListFocused(): boolean; hasVisibleTodos(): 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, preserveFocus?: boolean, preserveInput?: boolean): Promise; validateAgentMode(): void; private _getFilteredEntry; private _acceptInputForVoiceover; private _handleAttachedContextChange; private _updateInputContentContextKeys; private getOrCreateOptionEmitter; /** * Get or create a context key for an option group. * Context keys follow the pattern `chatSessionOption.`. */ private getOrCreateOptionContextKey; /** * Update the context key for an option group with the current selection. * This enables `when` expressions on other option groups to react to changes. */ private updateOptionContextKey; /** * Evaluate whether an option group should be visible based on its `when` expression. * Returns true if the option group should be visible, false otherwise. */ private evaluateOptionGroupVisibility; /** * Computes which option groups should be visible for the current session. * * A picker should show if and only if: * 1. We can determine a session type (from session context OR delegate) * 2. That session type has option groups registered * 3. At least one option group has items AND passes its `when` clause * * This method also updates the `chatSessionHasOptions` context key, which controls * whether the picker action is shown in the toolbar via its `when` clause. */ private getVisibleOptionGroupsModeAndUpdateContextKeys; private getCurrentSessionResource; private getTerminalCommandPrefix; isTerminalCommandPaste(pastedText: string, range: IRange): boolean; private updateInputEditorFontFamily; private handleTerminalCommandPaste; private areAllOptionsValid; private getAllOptionsGroups; private getVisibleOptionGroups; /** * Returns the permissions-kind option group contributed by the active session provider, if any. * Items from this group are surfaced inside the chat permission picker, replacing the * built-in `ChatPermissionLevel` items. Honors the same visibility predicates as * {@link getVisibleOptionGroups} so that `when` clauses are respected. * * If the provider declares more than one permissions-kind group (which the API forbids), * the first one wins. */ private getActiveExtensionPermissionGroup; private registerChatSessionPickerListeners; /** * Refresh all registered option groups for the current chat session. * Fires events for each option group with their current selection. */ private refreshChatSessionPickers; private hideAllSessionPickerWidgets; /** * Get the current option for a specific option group. * Returns undefined if the session doesn't have this option configured. */ private getCurrentOptionForGroup; private hasWorkspaceScmRepository; private getEffectiveSessionType; /** * Updates the agentSessionType context key based on delegate or actual session. */ private updateAgentSessionTypeContextKey; /** * Updates the widget lock state based on a session type. * Local sessions unlock from coding agent mode, while remote/cloud sessions lock to coding agent mode. */ private updateWidgetLockStateFromSessionType; /** * Resolves the session type of the active chat session for the delegation picker. */ private getActiveSessionTypeForDelegation; /** * Selects (or clears) the pending delegation target. While a target is pending, the widget * locks to the target agent and the `hasPendingDelegationTarget` context key hides the * agent and model pickers. Re-selecting the active session clears the pending target and * restores the pickers. */ continueInSession(provider: AgentSessionTarget): void; private setPendingDelegationTarget; /** * Ensures the notification widget is instantiated and appended to the notification container. */ private ensureNotificationWidget; private getNotificationContext; private selectNotificationModel; /** * The store is scoped to the active session, so while a delegation is pending the write * would land on the source session rather than the target the models belong to. */ private applyNotificationModelConfiguration; /** * Lazy-instantiate the goal banner widget on first use. */ private ensureGoalBannerWidget; /** Shows the autopilot goal banner with a loading state. */ showGoalBannerLoading(): void; /** Updates the goal banner with the given summary text. */ setGoalBanner(summary: string): void; /** Hides the goal banner. */ clearGoalBanner(): void; /** * Shows the context usage details popup and focuses it. * @returns Whether the details were successfully shown. */ showContextUsageDetails(): boolean; /** * Updates the context usage widget based on the current model. */ private updateContextUsageWidget; private handleViewModelChange; private updateDeferredNotificationsEligibility; private resetPendingDelegationForViewModelChange; private refreshViewModelScopedState; private clearQuestionCarouselIfSessionChanged; private clearPlanReviewIfSessionChanged; private reconcileSessionTypeForViewModelChange; private restorePerTypeModelAfterViewModelAssignment; render(container: HTMLElement, initialValue: string, widget: IChatWidget): void; toggleChatInputOverlay(editing: boolean): void; renderAttachedContext(): void; /** * Creates the pill for an attachment, using the widget that matches its kind. * Used for the attachments above the input and for inline attachment pills. */ createAttachmentWidget(attachment: IChatRequestVariableEntry, container: HTMLElement, options: { shouldFocusClearButton: boolean; supportsDeletion: boolean; }): IChatAttachmentWidgetInstance; /** * Removes the inline reference bound to a deleted attachment, including one * trailing space, so the input is not left with a token that resolves to * nothing. The dynamic variable model drops the reference once its text goes. */ private removeInlineReferenceText; private handleAttachmentDeletion; /** * Removes the attachments of inline attachment pills that were removed from * the input, see {@link ChatInlineAttachments}. * * @param explicit Whether the user removed the pills, rather than undoing their addition. */ private removeInlineAttachments; /** Stops sending the file of a removed attachment as implicit context, as it was removed on purpose. */ private disableImplicitContextOf; /** * The attachments that are rendered as pills in the input. Agent-host * completion entries (skills/commands) live in the model so their `_meta` * reaches the outgoing message, but they are shown as inline decorations * rather than pills, so they are excluded here. */ private getRenderableAttachments; /** * Whether an attachment is shown as a pill inline with the prompt, see * {@link ChatInlineAttachments}. */ private isAttachmentShownInline; private handleAttachmentOpen; private handleAttachmentNavigation; renderChatTodoListWidget(chatSessionResource: URI): Promise; clearTodoListWidget(sessionResource: URI | undefined, force: boolean): void; renderArtifactsWidget(chatSessionResource: URI): void; clearArtifactsWidget(): void; renderQuestionCarousel(carousel: IChatQuestionCarousel, context: IChatContentPartRenderContext | undefined, options: IChatQuestionCarouselOptions): ChatQuestionCarouselPart | undefined; clearQuestionCarousel(responseId?: string, resolveId?: string): void; get questionCarousel(): ChatQuestionCarouselPart | undefined; focusQuestionCarousel(): boolean; isQuestionCarouselFocused(): boolean; navigateToPreviousQuestion(): boolean; navigateToNextQuestion(): boolean; focusQuestionCarouselTerminal(): boolean; renderPlanReview(review: IChatPlanReview, context: IChatContentPartRenderContext, options: IChatPlanReviewPartOptions): ChatPlanReviewPart | undefined; clearPlanReview(responseId?: string, resolveId?: string): void; get planReview(): ChatPlanReviewPart | undefined; private get _currentSessionKey(); private get _currentToolConfirmationCarousel(); renderToolConfirmationCarousel(tool: IChatToolInvocation, factory: ToolInvocationPartFactory, subAgentInvocationId?: string, subagentTitle?: string, revealSubagent?: RevealSubagentCallback, revealSubagentLabel?: string, toolPart?: ChatToolInvocationPart): ChatToolConfirmationCarouselPart | undefined; addToolToConfirmationCarousel(tool: IChatToolInvocation, factory: ToolInvocationPartFactory, subAgentInvocationId?: string, subagentTitle?: string, revealSubagent?: RevealSubagentCallback, revealSubagentLabel?: string, toolPart?: ChatToolInvocationPart): void; removeToolFromConfirmationCarousel(tool: IChatToolInvocation, sessionResource: URI): void; get activeConfirmationSubagentId(): string | undefined; get activeToolConfirmation(): IChatToolInvocation | undefined; acceptActiveToolConfirmation(): void; /** * Navigates the carousel to the first pending tool from the given subagent. */ activateCarouselForSubagent(subAgentInvocationId: string): void; hasToolInConfirmationCarousel(toolCallId: string): boolean; get hasActiveToolConfirmationCarousel(): boolean; clearToolConfirmationCarousel(): void; /** * Swaps the visible tool confirmation carousel when switching sessions. */ private _syncToolConfirmationCarouselForSession; setWorkingSetCollapsed(collapsed: boolean): void; /** * Provides the session's file changes to the session working set, `undo` * when the session can undo its changes to single files, and `keep` when * the session keeps changes itself. */ registerSessionFileChanges(changes: IObservable, undo?: IObservable, keep?: IObservable): IDisposable; get hasSessionWorkingSet(): boolean; /** * The session working set this input shows in place of the editing * session's, which the editing session's working set commands run on. */ get sessionWorkingSet(): ChatSessionWorkingSet | undefined; /** Whether the session working set offers Undo for the session's changes. */ get hasSessionWorkingSetUndo(): boolean; /** * Whether this input can show the session working set. Only the editor * window offers it; the Agents window doesn't, even in a chat editor. */ get supportsSessionWorkingSet(): boolean; renderChatEditingSessionState(chatEditingSession: IChatEditingSession | null): void; /** Show or hide the working set, and report the same to the stack. */ private setChatEditingSessionVisible; private renderChatEditingSessionWithEntries; renderFollowups(items: IChatFollowup[] | undefined, response: IChatResponseViewModel | undefined): Promise; /** * Sets the maximum height budget for the input part. The editor height will be * clamped so it does not grow beyond what this budget allows after accounting * for non-editor chrome such as attachments, toolbars, and widgets. */ setMaxHeight(maxHeight: number | undefined): void; private updateToolConfirmationCarouselMaxHeight; /** * Layout the input part with the given width. Height is intrinsic - determined by content * and detected via ResizeObserver, which updates `inputPartHeight` for the parent to observe. */ layout(width: number): void; private layoutForToolbarChange; /** * Scale the working/progress border comet animation duration with * the input width so the comet's perceived linear travel speed (the * rate it sweeps along the perimeter in px/sec) stays roughly * constant. A fixed cycle time made wide inputs feel sluggish, but * an aggressive inverse curve made narrow inputs feel slow because * their cycle was clamped while the comet had little distance to * cover. Sub-linear scaling with width (`sqrt(width)`) plus tight * clamps keeps both extremes looking lively. */ private _lastAnimDurationS; private _updateWorkingProgressAnimationDuration; private get _effectiveInputEditorMaxHeight(); private previousInputEditorDimension; private _layout; private _getInputEditorPadding; private getLayoutData; /** * Gets the location of the chat widget and whether that location is maximized. */ private getWidgetLocationInfo; private getDefaultScrollbarOptions; private getVisibleScrollbarOptions; private updateInputEditorScrollbarOptions; showScrollbarUntilAccept(): void; private resetScrollbarVisibilityAfterAccept; }