import { type EditorState, type LexicalEditor, type SerializedEditorState, type SerializedLexicalNode, type SerializedRootNode } from 'lexical'; import type { ChatMessage } from '../chat/transcript/messages'; import type { PromptString } from '../prompt/prompt-string'; import { type SerializedContextItem } from './nodes'; export interface SerializedPromptEditorValue { /** The editor's value as plain text. */ text: string; /** The context items mentioned in the value. */ contextItems: SerializedContextItem[]; /** The internal state of the editor that can be used to restore the editor. */ editorState: SerializedPromptEditorState; } export declare function toSerializedPromptEditorValue(editor: LexicalEditor): SerializedPromptEditorValue; /** * This type encodes all known versions of serialized editor state. */ type StateVersion = 'lexical-v0' | 'lexical-v1'; /** * The representation of a user's prompt input in the chat view. */ export interface SerializedPromptEditorState { /** * Version identifier for this type. If this type changes, the version identifier must change, * and callers must check this value to ensure they are working with the correct type. */ v: StateVersion; /** * The minimum version of reader that can read this value. If STATE_VERSION_CURRENT >= * minReaderV, then this version of the code can read this value. If undefined, its value is * {@link DEFAULT_MIN_READER_V}, */ minReaderV?: StateVersion; /** * The [Lexical editor state](https://lexical.dev/docs/concepts/editor-state). */ lexicalEditorState: SerializedEditorState; } /** * This treats the entire text as plain text and does not parse it for any @-mentions. */ export declare function serializedPromptEditorStateFromText(text: string): SerializedPromptEditorState; export declare function serializedPromptEditorStateFromChatMessage(chatMessage: ChatMessage): SerializedPromptEditorState; export declare function contextItemsFromPromptEditorValue(state: SerializedPromptEditorState): SerializedContextItem[]; export declare function inputTextWithoutContextChipsFromPromptEditorState(state: SerializedPromptEditorState): string; export declare function filterContextItemsFromPromptEditorValue(value: SerializedPromptEditorValue, keep: (item: SerializedContextItem) => boolean): SerializedPromptEditorValue; export declare function textContentFromSerializedLexicalNode(root: SerializedLexicalNode | SerializedRootNode, __testing_wrapText?: (text: string) => string | undefined): string; export declare function editorStateToText(editorState: EditorState): string; interface EditorStateFromPromptStringOptions { /** * Experimental support for template values. These are placeholder values between "{{" and "}}". */ parseTemplates: boolean; } export declare function editorStateFromPromptString(input: PromptString, opts?: EditorStateFromPromptStringOptions): SerializedPromptEditorState; export {}; //# sourceMappingURL=editorState.d.ts.map