/** * Spoken-command grammar for voice dictation. * * The transcription model already auto-punctuates and capitalizes, so spoken * punctuation ("comma", "period") is deliberately NOT converted — saying * punctuation aloud is optional and the words stay literal unless they form a * standalone command sentence. What IS recognized (Dragon-style) are * structural and control commands spoken as their own utterance: * * "new line" → line break * "new paragraph" → paragraph break * "bullet point"/"next item" → start a list item ("- …") * "scratch that"/"delete that"→ remove the previous sentence * "stop dictation"/"stop listening" → end the session * "send message"/"send it" → end the session and submit (composers) * * Precision guards: * - A phrase only counts as a command when the model rendered it as its own * sentence: preceded by start-of-text or sentence-ending punctuation, and * FOLLOWED by punctuation (the model punctuates a spoken pause — the pause * IS the signal, exactly like Dragon). ". Send it to the team" never fires. * - A completed phrase at stream end with no punctuation yet stays PENDING * until the next delta disambiguates it — except in `final` mode (the user * stopped: stopping is the pause, so the phrase resolves as a command). * - Command phrases are scoped to English + the session's UI language, so an * Italian speaker's ordinary "Cancella." can't fire scratch-that in an * English session and vice versa. */ export type DictationControlAction = 'stop' | 'send'; export interface ProcessedDictation { /** Text ready for insertion, with commands applied. */ text: string; /** * Trailing raw characters withheld from insertion because they could still * grow into a command phrase ("New paragr…"), or ARE a completed phrase * awaiting its terminator ("Send it"). Empty in `final` mode. */ pendingTail: string; /** Control command encountered (processing stops at that point). */ control: DictationControlAction | null; } export interface ProcessOptions { /** ISO language hint (same value sent to the transcription session). */ language?: string | undefined; /** * End-of-stream semantics: the user stopped, so a completed command phrase * at the very end fires without waiting for punctuation, and no text is * withheld — partial phrases are released as literal words. */ final?: boolean; } export declare class DictationCommandUtils { /** * Process the full raw transcript accumulated so far into insertable text. * Pure and deterministic: always called with the entire raw string so the * result never depends on delta chunking. */ static process(raw: string, options?: ProcessOptions): ProcessedDictation; /** * Longest suffix of `raw` that could still become a command — a proper * prefix of a phrase ("New paragr…") OR a COMPLETED phrase with no * terminator yet ("…Send it"). Both are withheld from insertion: the next * delta either brings punctuation (the phrase was a spoken command) or more * words ("Send it to the team" — released as ordinary text). Firing a * control command from an intermediate delta would stop or submit * mid-sentence. */ static commandPrefixTail(raw: string, language?: string | undefined): string; /** * True when the current pending tail is a COMPLETED phrase (not a partial * prefix) — i.e. a silence pause would resolve it into a command. Used by * the manager's silence timer. */ static pendingTailIsCompletePhrase(raw: string, language?: string | undefined): boolean; } //# sourceMappingURL=dictation-commands.utils.d.ts.map