/*! * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import { ExtendedHTMLElement } from '../../helper/dom'; import { DetailedList, PromptAttachmentType } from '../../static'; import { TopBarButtonOverlayProps } from './prompt-input/prompt-top-bar/top-bar-button'; export declare const MAX_USER_INPUT_THRESHOLD = 96; export declare const MAX_USER_INPUT: () => number; export declare const INPUT_LENGTH_WARNING_THRESHOLD: () => number; export interface ChatPromptInputProps { tabId: string; onStopChatResponse?: (tabId: string) => void; } export declare class ChatPromptInput { render: ExtendedHTMLElement; private readonly props; private readonly attachmentWrapper; private readonly promptTextInput; private readonly contextSelectorButton; private readonly promptTextInputCommand; private readonly sendButton; private readonly stopButton; private readonly progressIndicator; private readonly promptAttachment; private readonly promptOptions; private readonly promptTopBar; private readonly chatPrompt; private quickPickItemsSelectorContainer; private promptTextInputLabel; private remainingCharsOverlay; /** * Preserves cursor position when `@` key is pressed */ private quickPickTriggerIndex; /** * Preserves selection range when `@` key is pressed */ private quickPickTriggerRange?; private quickPickType; private quickPickItemGroups; /** * Snapshot of contextCommands taken when the picker opens. * Used for sub-menu navigation so that server-side filter responses * (which update the store's contextCommands) don't overwrite the * base set the user is browsing. */ private baseContextCommands; /** * When the user clicks into a sub-menu (e.g. @Folders), this holds the * `command` string of the parent. The contextCommands store listener * uses it to refresh the visible sub-menu's children in place when a * fresh fetch returns, instead of snapping back to the top-level menu. */ private activeSubMenuCommand; private topBarTitleClicked; private filteredQuickPickItemGroups; private searchTerm; private quickPick; private quickPickOpen; private selectedCommand; private readonly userPromptHistory; private userPromptHistoryIndex; private lastUnsentUserPrompt; private readonly markerRemovalRegex; private quickPickFilterDebounceTimer; constructor(props: ChatPromptInputProps); private readonly onContextSelectorButtonClick; private readonly updateAvailableCharactersIndicator; private readonly handleInputKeydown; private readonly tabBarTitleOverlayKeyPressHandler; private readonly openQuickPick; private readonly handleInputFocus; /** * Build a top-level skeleton from a previously-rendered context structure: * keep all top-level commands (Files / Folders / Code / Prompts / Image, ...) * with their metadata (icon, description, command name) so the picker shows * the categories immediately, but strip the children to an empty group so * stale items from a previous search session don't leak through. * * Note: this only preserves the FIRST child group of each command. Top-level * context commands always ship a single child group, so this is fine in * practice. If a command has no children (e.g. @workspace, @image), it is * passed through unchanged. */ private readonly buildContextSkeleton; private readonly getQuickPickItemGroups; private readonly handleQuickActionCommandSelection; private readonly handleContextCommandSelection; private readonly sendPrompt; private readonly getPromptInputTextLabel; readonly clearTextArea: (keepAttachment?: boolean) => void; readonly getCursorPosition: () => number; readonly addAttachment: (attachmentContent: string, type?: PromptAttachmentType) => void; readonly openTopBarButtonItemOverlay: (data: TopBarButtonOverlayProps) => void; readonly updateTopBarButtonItemOverlay: (data: DetailedList) => void; readonly closeTopBarButtonItemOverlay: () => void; readonly destroy: () => void; readonly getCurrentTriggerSource: () => 'top-bar' | 'prompt-input'; }