import React from 'react'; import type { MarkdownEditorInstance } from '../../MarkdownEditor'; /** * 输入历史单条记录 */ export interface InputHistoryEntry { /** 用户输入的文本内容 */ value: string; /** 发送时间戳 */ timestamp: number; } interface UseInputHistoryParams { markdownEditorRef: React.MutableRefObject; /** 同步外部受控值 */ setValue: (value: string) => void; /** 历史记录上限,超过后移除最旧一条 */ maxLength?: number; } /** * 输入历史导航 Hook(对齐 dtcoder-ide 的 ChatHistoryNavigator)。 * * 行为约定: * - 发送成功后自动 push 当前文本; * - 光标在文本起点时按 ↑ 回溯历史、按 ↓ 前进; * - 回溯前将当前未发送的编辑内容覆盖到"overlay"槽位,按 ↓ 可找回; * - 历史仅保存在内存(组件实例级),不跨会话持久化。 */ export declare const useInputHistory: ({ markdownEditorRef, setValue, maxLength, }: UseInputHistoryParams) => { push: (value: string) => void; previous: () => string | undefined; next: () => string | undefined; reset: () => void; restore: (value: string) => void; clear: () => void; isAtEnd: () => boolean; }; export {};