/** * ChatInput - Robust single-line input with slash command support and history * * Displays a `›` prompt character followed by a text input. * Shows command dropdown when typing `/`. * Supports ↑/↓ arrow keys for command history navigation. * * Features: * - Robust paste handling: Multi-line text is flattened to single line * - Large paste support: Handles 2-4KB pastes without lag * - Full editing: Backspace, delete, left/right arrow navigation * - Word navigation: Option+left/right (macOS) for word-by-word cursor movement * - History preservation: Draft text preserved when navigating history */ import React from 'react'; import { type Command } from './CommandDropdown.js'; /** * Props for the ChatInput component */ export interface ChatInputProps { /** Called when user presses Enter with the current input value */ onSubmit: (value: string) => void; /** Placeholder text when empty */ placeholder?: string; /** Whether input is disabled (e.g., during AI processing) */ disabled?: boolean; /** Allow empty submissions (e.g., to continue/skip phases) */ allowEmpty?: boolean; /** Available slash commands (uses defaults if not provided) */ commands?: Command[]; /** Called when a slash command is selected */ onCommand?: (command: string) => void; /** Spec suggestions for /run argument autocomplete */ specSuggestions?: Command[]; } /** * ChatInput component * * Provides a robust single-line text input with `›` prompt for chat-style interactions. * Shows command dropdown when input starts with `/`. * * **Keyboard shortcuts:** * - Enter: Submit input * - Backspace: Delete character before cursor * - Delete: Delete character after cursor * - ←/→: Move cursor left/right * - ↑/↓: Navigate command history * - Option+←/→ (macOS): Move cursor by word * - Cmd+←/→ (macOS): Move cursor to start/end * * **Paste behavior:** * - Multi-line text is automatically flattened to a single line * - Large pastes (up to 4KB) are handled efficiently * - Consecutive whitespace is collapsed to single spaces * * @example * ```tsx * console.log('User said:', value)} * placeholder="Type your message..." * disabled={isProcessing} * /> * // Renders: › Type your message... * ``` */ export declare function ChatInput({ onSubmit, placeholder, disabled, allowEmpty, commands, onCommand, specSuggestions, }: ChatInputProps): React.ReactElement;