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(pet): keep IME Enter and Escape out of the mini input (#2759)
Max8d5afb2705b7
diff --git a/ui/src/pet/PetPage.test.tsx b/ui/src/pet/PetPage.test.tsxindex 46e540c08..923c9f769 100644--- a/ui/src/pet/PetPage.test.tsx+++ b/ui/src/pet/PetPage.test.tsx@@ -2397,3 +2397,42 @@ describe('Personal Agent breaker: readiness and turn generations', () => {expect(api.getTurnState).not.toHaveBeenCalledWith('im', expect.anything());});});++describe('PetPage IME composition', () => {+ // WebKit (the macOS pet webview) fires compositionend before the Enter that+ // commits the candidate, so that keydown reads isComposing false with the+ // legacy keyCode 229.+ it('keeps the draft through IME Enters and sends once on a plain Enter', async () => {+ mainSession('S');+ render(<PetPage />);+ summon('listen');+ const input = await screen.findByLabelText('pet.inputPlaceholder') as HTMLTextAreaElement;+ fireEvent.change(input, { target: { value: 'hello' } });+ fireEvent.keyDown(input, { key: 'Enter', keyCode: 229, isComposing: false });+ fireEvent.keyDown(input, { key: 'Enter', keyCode: 13, isComposing: true });+ await act(async () => new Promise((resolve) => setTimeout(resolve, 15)));+ expect(api.sendSessionMessage).not.toHaveBeenCalled();+ expect(input.value).toBe('hello');+ fireEvent.keyDown(input, { key: 'Enter', keyCode: 13 });+ await waitFor(() => expect(api.sendSessionMessage).toHaveBeenCalledTimes(1));+ expect(api.sendSessionMessage).toHaveBeenCalledWith('S', { text: 'hello' });+ });++ it('leaves the composer and its draft open when Escape dismisses an IME candidate', async () => {+ mainSession('S');+ render(<PetPage />);+ summon('listen');+ const input = await screen.findByLabelText('pet.inputPlaceholder') as HTMLTextAreaElement;+ fireEvent.change(input, { target: { value: 'hello' } });+ act(() => {+ window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', keyCode: 229 }));+ window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', isComposing: true }));+ });+ expect(screen.getByLabelText('pet.inputPlaceholder')).toBe(input);+ expect(input.value).toBe('hello');+ act(() => {+ window.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));+ });+ await waitFor(() => expect(screen.queryByLabelText('pet.inputPlaceholder')).toBeNull());+ });+});diff --git a/ui/src/pet/PetPage.tsx b/ui/src/pet/PetPage.tsxindex 01e214a8b..6ec20bfa2 100644--- a/ui/src/pet/PetPage.tsx+++ b/ui/src/pet/PetPage.tsx@@ -9,6 +9,7 @@ import { useWorkbenchInbox } from '@/context/WorkbenchInboxContext';import { Button } from '@/components/ui/button';import { Markdown } from '@/components/ui/markdown';import { QuickReplies } from '@/components/workbench/QuickReplies';+import { isComposingKey } from '@/lib/imeComposition';import { usePageActive } from '@/lib/pageActivity';import { usePendingVaultRequests } from '@/lib/usePendingVaultRequests';import { useVaultRequestRefresh } from '@/lib/useVaultRequestRefresh';@@ -578,7 +579,8 @@ const PetSurface: React.FC = () => {}, [voice.listening, draft, setPanel]);useEffect(() => {const onKey = (event: KeyboardEvent) => {- if (event.key !== 'Escape') return;+ // Escape also dismisses an IME candidate list; that one is not ours.+ if (event.key !== 'Escape' || isComposingKey(event)) return;if (voice.listening) voice.cancel();else if (composing) closeComposer();else if (detailOpen) { setDetailOpen(false); void setPanel(false); }@@ -735,7 +737,7 @@ const PetSurface: React.FC = () => {value={inputDraft}onChange={(event) => setDraft([...draftMarkers, event.target.value].join(' '))}onKeyDown={(event) => {- if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {+ if (event.key === 'Enter' && !event.shiftKey && !isComposingKey(event)) {event.preventDefault();void submit();}