Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(ui): place voice caret after transcript (#2216)
Call Whiteb6871ff9daae
diff --git a/ui/src/components/workbench/Composer.tsx b/ui/src/components/workbench/Composer.tsxindex eb7e2908e..56eedb491 100644--- a/ui/src/components/workbench/Composer.tsx+++ b/ui/src/components/workbench/Composer.tsx@@ -793,9 +793,9 @@ export const Composer = forwardRef<ComposerHandle, ComposerProps>(function Compoconst inserted = mentionRef.current?.commitVoicePreview(session.insertion,session.transcript ?? '',- ) ?? false;- if (inserted) setRealtimeAnnouncement('');- return inserted;+ ) ?? null;+ if (inserted !== null) setRealtimeAnnouncement('');+ return inserted !== null;}const current = valueRef.current;const result = applyVoiceInsertionWithSnapshot(diff --git a/ui/src/components/workbench/MentionEditor.tsx b/ui/src/components/workbench/MentionEditor.tsxindex a34b9dac9..ab5f9101a 100644--- a/ui/src/components/workbench/MentionEditor.tsx+++ b/ui/src/components/workbench/MentionEditor.tsx@@ -80,8 +80,12 @@ export interface MentionEditorHandle {* previews replace one another without persisting as draft edits. */showVoicePreview: (snapshot: VoiceInsertionSnapshot, text: string) => boolean;/** Replace the active preview, or the original captured range, with the final- * cleaned transcript as one ordinary draft edit. */- commitVoicePreview: (snapshot: VoiceInsertionSnapshot, text: string) => boolean;+ * cleaned transcript as one ordinary draft edit. Returns the committed+ * insertion so callers can preserve the caret at its end. */+ commitVoicePreview: (+ snapshot: VoiceInsertionSnapshot,+ text: string,+ ) => VoiceInsertionSnapshot | null;/** Restore the rich editor state captured before the first voice preview.* Refuses to restore if the user has changed the draft since that preview. */restoreVoicePreview: () => boolean;@@ -491,6 +495,17 @@ function BootstrapPlugin({selection.focus.set(end.key, end.offset, end.type);$setSelection(selection);selection.insertText(result.insertion);+ // Lexical normally collapses an inserted range to its end, but the+ // editor may be blurred while voice transcription is finishing.+ // Rebuild the caret from the serialized insertion boundary so the+ // later focus return cannot restore the pre-voice selection.+ const caret = serializedPointAtOffset(result.snapshot.end);+ if (caret) {+ const caretSelection = $createRangeSelection();+ caretSelection.anchor.set(caret.key, caret.offset, caret.type);+ caretSelection.focus.set(caret.key, caret.offset, caret.type);+ $setSelection(caretSelection);+ }inserted = result.snapshot;}, {tag,@@ -575,7 +590,7 @@ function BootstrapPlugin({true,);if (inserted !== null) voicePreviewRef.current = null;- return inserted !== null;+ return inserted;},restoreVoicePreview: () => {const active = voicePreviewRef.current;diff --git a/ui/src/components/workbench/MentionEditor.voicePreview.test.tsx b/ui/src/components/workbench/MentionEditor.voicePreview.test.tsxindex d58247079..9c990400e 100644--- a/ui/src/components/workbench/MentionEditor.voicePreview.test.tsx+++ b/ui/src/components/workbench/MentionEditor.voicePreview.test.tsx@@ -57,10 +57,11 @@ describe('MentionEditor voice preview', () => {expect(onChange.mock.calls.at(-1)?.[3]).toBe(true);act(() => {- expect(ref.current?.commitVoicePreview(+ const inserted = ref.current?.commitVoicePreview(voiceInsertionSnapshot('Plan today', 5, 5),'The launch is tomorrow.',- )).toBe(true);+ );+ expect(inserted).toMatchObject({ start: 5, end: 29 });});await waitFor(() => expect(editor.textContent).toBe('Plan The launch is tomorrow. today'));expect(onChange.mock.calls.at(-1)?.[3]).toBe(false);