The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(voice): preserve existing TUI drafts
Teknium0ca78e5f329d
diff --git a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts b/ui-tui/src/__tests__/createGatewayEventHandler.test.tsindex f44cb9246c8..a49a7cec49b 100644--- a/ui-tui/src/__tests__/createGatewayEventHandler.test.ts+++ b/ui-tui/src/__tests__/createGatewayEventHandler.test.ts@@ -895,15 +895,19 @@ describe('createGatewayEventHandler', () => {it('leaves voice transcripts editable when voice.submit_mode is draft', async () => {const ctx = buildCtx([])+ let composerInput = 'existing draft'ctx.gateway.rpc = vi.fn(async (method: string) =>method === 'config.get' ? { config: { voice: { submit_mode: 'draft' } } } : null)+ ctx.composer.setInput = vi.fn((next: string | ((current: string) => string)) => {+ composerInput = typeof next === 'function' ? next(composerInput) : next+ })const onEvent = createGatewayEventHandler(ctx)onEvent({ payload: { text: ' edit this first ' }, type: 'voice.transcript' } as any)- await vi.waitFor(() => expect(ctx.composer.setInput).toHaveBeenCalledWith('edit this first'))+ await vi.waitFor(() => expect(composerInput).toBe('existing draft edit this first'))expect(ctx.submission.submitRef.current).not.toHaveBeenCalled()expect(ctx.gateway.rpc).toHaveBeenCalledWith('config.get', { key: 'full' })})diff --git a/ui-tui/src/__tests__/voiceSubmitModeRenderer.test.tsx b/ui-tui/src/__tests__/voiceSubmitModeRenderer.test.tsxindex 6ceb9eb7900..1bab8ffb701 100644--- a/ui-tui/src/__tests__/voiceSubmitModeRenderer.test.tsx+++ b/ui-tui/src/__tests__/voiceSubmitModeRenderer.test.tsx@@ -15,7 +15,7 @@ describe('voice.submit_mode live composer rendering', () => {const submit = vi.fn()function Harness() {- const [input, setInput] = useState('')+ const [input, setInput] = useState('existing draft')const handler = useMemo(() =>@@ -87,7 +87,7 @@ describe('voice.submit_mode live composer rendering', () => {await delay(10)}- expect(output).toContain('editable voice draft')+ expect(output).toContain('existing draft editable voice draft')expect(submit).not.toHaveBeenCalled()} finally {instance.unmount()diff --git a/ui-tui/src/app/createGatewayEventHandler.ts b/ui-tui/src/app/createGatewayEventHandler.tsindex 070178ccd08..0161de8e9ec 100644--- a/ui-tui/src/app/createGatewayEventHandler.ts+++ b/ui-tui/src/app/createGatewayEventHandler.ts@@ -953,7 +953,7 @@ export function createGatewayEventHandler(ctx: GatewayEventHandlerContext): (ev:const submitMode = normalizeVoiceSubmitMode(cfg?.config?.voice?.submit_mode)if (submitMode === 'draft') {- setInput(text)+ setInput(current => (current.trim() ? `${current.trimEnd()} ${text}` : text))return}