/** * Streaming request wrapper for auto-complete plugin * * Manages abort controllers per view and handles streaming API requests. */ import { EditorView } from "prosemirror-view"; import { PluginKey } from "prosemirror-state"; import { AutoCompleteState } from "./types"; /** * Cancel any active streaming request for the given view */ export declare function cancelActiveRequest(view: EditorView): void; /** * Check if there's an active request for the given view */ export declare function hasActiveRequest(view: EditorView): boolean; interface AutoCompleteStreamingParams { view: EditorView; pluginKey: PluginKey; apiKey: string; context: string; apiEndpoint?: string; model?: string; systemPrompt?: string; } /** * Ensure proper spacing between existing text and suggestion. * * If the last character before cursor is not a space/hyphen, and the first * character of the suggestion is not a space/hyphen, prepend a space. */ export declare function ensureLeadingSpace(view: EditorView, suggestion: string): string; /** * Make a streaming request to the AI API for auto-completion */ export declare function streamingRequest({ view, pluginKey, apiKey, context, apiEndpoint, model, systemPrompt, }: AutoCompleteStreamingParams): Promise; /** * Extract context text before cursor (up to maxLength) */ export declare function extractContext(view: EditorView, maxLength: number): string; /** * Check if autoComplete should trigger based on sentence state and cursor position. * * Returns true only when: * 1. The cursor is at the end of the current node * 2. The text before cursor does NOT end with sentence-ending punctuation (. ! ?) */ export declare function shouldTriggerAutoComplete(view: EditorView): boolean; export {}; //# sourceMappingURL=streaming.d.ts.map