Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Ask: on smaller Macs it waits for the recording to end, and says so

Eric Brownroutb833bffd826c
diff --git a/app/e2e/chat.spec.ts b/app/e2e/chat.spec.ts
index 167cf25b..4adaee11 100644
--- a/app/e2e/chat.spec.ts
+++ b/app/e2e/chat.spec.ts
@@ -24,6 +24,40 @@ const windowOf = async (app: ElectronApplication, hash: string): Promise<Page> =
throw new Error(`no ${hash} window`)
}
+test('recording on a small Mac leaves Ask readable and explains when typing resumes', async () => {
+ const { app, page } = await launch({ YOGURT_FAKE_PLATFORM: 'darwin', YOGURT_FAKE_SMALL_MAC: '1' })
+ try {
+ await page.getByTestId('new-note').click()
+ await expect(page.getByTestId('note-state')).toHaveAttribute('data-state', 'recording')
+ const id = await page.evaluate(async () => (await window.yogurt.nav.current()).slice('/note/'.length))
+ await page.keyboard.press('Meta+j')
+ const noteInput = page.getByTestId('chat-input')
+ await expect(noteInput).toBeFocused()
+ await expect(noteInput).toHaveAccessibleDescription('Available after recording')
+ await expect(noteInput).not.toBeEditable()
+ await expect(page.getByRole('tooltip')).toHaveText('Available after recording')
+ await page.getByTestId('chat-close').focus()
+ await noteInput.hover()
+ await expect(page.getByRole('tooltip')).toBeVisible()
+ await page.getByTestId('chat-close').click()
+ await page.getByTestId('nav-chat').click()
+ const homeInput = page.getByTestId('chat-page-input')
+ await expect(homeInput).toHaveAttribute('aria-disabled', 'true')
+ await page.keyboard.press('Meta+k')
+ await page.getByTestId('search-input').fill('What did we decide?')
+ await page.keyboard.press('Meta+Enter')
+ await expect(homeInput).toHaveValue('What did we decide?')
+ await expect(homeInput).not.toBeEditable()
+ await homeInput.press('Enter')
+ await expect(page.getByTestId('chat-page-turn')).toHaveCount(0)
+ await page.evaluate(id => window.yogurt.meetings.stop(id), id)
+ await expect(homeInput).toBeEditable()
+ await expect(homeInput).toHaveValue('What did we decide?')
+ await expect(page.getByTestId('chat-page-send')).toBeEnabled()
+ await expect(page.getByTestId('chat-page-turn')).toHaveCount(0)
+ } finally { await app.close() }
+})
+
test('Ask opens one contained panel, keeps the note usable, and restores focus when closed', async () => {
const { app, page } = await launch()
try {
diff --git a/app/src/main/index.ts b/app/src/main/index.ts
index adf66cfa..d12a24d1 100644
--- a/app/src/main/index.ts
+++ b/app/src/main/index.ts
@@ -730,6 +730,14 @@ app.whenReady().then(() => {
clearTimeout(timer); resumingId = null; analysis.release(!started)
}
})
+ const waitsForMeeting = () => smallMac && !!activeMeeting()
+ const askUnavailable = () => platform === 'darwin' && waitsForMeeting()
+ ipcMain.handle('conversations:waits-for-meeting', askUnavailable)
+ if (platform === 'darwin' && smallMac) {
+ const changed = () => win?.webContents.send('conversations:recording-wait', askUnavailable())
+ onMeetingStart(changed)
+ onMeetingStop(changed)
+ }
// Both Ask surfaces share saved conversations and the same recording-first model queue.
const conversations = hookConversations({
store, library, indexer, embedder, queue, model,
@@ -737,7 +745,7 @@ app.whenReady().then(() => {
win?.webContents.send('conversations:changed', v)
if (v.chips.length === 1 && v.chips[0].kind === 'meeting') win?.webContents.send('chat:changed', { ...v, meetingId: v.chips[0].id })
}, sendList: (l) => win?.webContents.send('conversations:list', l),
- waitsForMeeting: () => smallMac && !!activeMeeting(), waitsForModel: () => !setup.notesPath(),
+ waitsForMeeting, waitsForModel: () => !setup.notesPath(),
// a meeting read in ahead during a recording only where reading ahead is allowed (32 GB and up; the fake Mac is big)
warmAllowed: () => !activeMeeting() || (isFake() ? !smallMac : readAheadAllowed(os.totalmem())),
})
@@ -766,7 +774,7 @@ app.whenReady().then(() => {
// Compatibility bridge for older renderer clients; all storage and answers now use conversations.
const meetingChat = (id: string) => library.current([{ kind: 'meeting', id }])
ipcMain.handle('chat:get', (_e, id: unknown) => isId(id) && store.meeting(id) ? { ...conversations.view(meetingChat(id)), meetingId: id } : undefined)
- ipcMain.handle('chat:ask', (_e, id: unknown, q: unknown) => { if (isId(id) && store.meeting(id) && typeof q === 'string') conversations.ask(meetingChat(id), q) })
+ ipcMain.handle('chat:ask', (_e, id: unknown, q: unknown) => { if (!askUnavailable() && isId(id) && store.meeting(id) && typeof q === 'string') conversations.ask(meetingChat(id), q) })
ipcMain.on('chat:stop', (_e, id: unknown) => { if (isId(id) && store.meeting(id)) conversations.stop(meetingChat(id)) })
ipcMain.handle('chat:clear', (_e, id: unknown) => { if (isId(id) && store.meeting(id)) {
conversations.stop(meetingChat(id))
@@ -774,7 +782,11 @@ app.whenReady().then(() => {
} })
ipcMain.handle('conversations:list', () => conversations.list())
ipcMain.handle('conversations:get', (_e, id: unknown) => (isId(id) ? conversations.view(id) ?? null : null))
- ipcMain.handle('conversations:ask', (_e, id: unknown, q: unknown) => ((id === null || isId(id)) && typeof q === 'string' && q.trim() ? conversations.ask(id, q).id : null))
+ ipcMain.handle('conversations:ask', (_e, id: unknown, q: unknown) => {
+ if ((id !== null && !isId(id)) || typeof q !== 'string' || !q.trim()) return null
+ if (askUnavailable()) return { waitsForMeeting: true }
+ return conversations.ask(id, q).id
+ })
ipcMain.on('conversations:stop', (_e, id: unknown) => { if (isId(id)) conversations.stop(id) })
ipcMain.on('conversations:warm', (_e, id: unknown) => { if (isId(id)) conversations.warm(id) })
ipcMain.handle('conversations:rename', (_e, id: unknown, title: unknown) => { if (isId(id) && typeof title === 'string') conversations.rename(id, title) })
diff --git a/app/src/preload/index.ts b/app/src/preload/index.ts
index 7421d32f..85832ee4 100644
--- a/app/src/preload/index.ts
+++ b/app/src/preload/index.ts
@@ -167,6 +167,12 @@ const api: YogurtApi = {
},
},
conversations: {
+ waitsForMeeting: () => ipcRenderer.invoke('conversations:waits-for-meeting'),
+ onRecordingWait: cb => {
+ const on = (_e: unknown, waiting: boolean) => cb(waiting)
+ ipcRenderer.on('conversations:recording-wait', on)
+ return () => { ipcRenderer.removeListener('conversations:recording-wait', on) }
+ },
current: (chips, fresh) => ipcRenderer.invoke('conversations:current', chips, fresh),
context: (id, chips) => ipcRenderer.invoke('conversations:context', id, chips),
removeContext: (id, chip) => ipcRenderer.invoke('conversations:remove-context', id, chip),
diff --git a/app/src/renderer/src/App.tsx b/app/src/renderer/src/App.tsx
index e1228f1d..0f380421 100644
--- a/app/src/renderer/src/App.tsx
+++ b/app/src/renderer/src/App.tsx
@@ -18,12 +18,15 @@ import { ChatPage } from './screens/ChatPage'
import { BootScreen } from './components/BootScreen'
import { bootHoldMs } from '../../shared/onboarding'
import { Folder } from './screens/Folder'
+import { AskRecordingWait, watchRecordingWait } from './askAvailability'
import { useFolderRead } from './folders'
import type { LibrarySource, MeetingView, OnboardingPlan, SetupState } from '../../shared/types'
export function App() {
const [setupFailed, setSetupFailed] = useState(false)
const [setupAttempt, setSetupAttempt] = useState(0)
+ const [recordingWait, setRecordingWait] = useState<boolean>()
+ useEffect(() => watchRecordingWait(window.yogurt.conversations, setRecordingWait), [])
const [setup, setSetup] = useState<SetupState>()
// where the app was told to go, e.g. /note/<id>
const [route, setRouteNow] = useState('')
@@ -191,13 +194,13 @@ export function App() {
: chatId !== undefined ? <ChatPage id={chatId} go={go} openSource={openSource} />
: trash ? <Trash open={open} /> : folderScreen || <Home open={open} openFolder={(id) => go(`/folder/${id}`)} agendaJump={agendaJump} />
return (
- <div data-testid="app-shell" className={`h-full text-ink ${ready ? 'bg-transparent' : 'bg-bg'}`}>
+ <AskRecordingWait value={recordingWait}><div data-testid="app-shell" className={`h-full text-ink ${ready ? 'bg-transparent' : 'bg-bg'}`}>
{ready ? <Workspace route={route} meeting={meeting} folders={folders} go={go} back={history.current.length ? back : undefined} forward={future.current.length ? forward : undefined} search={() => setSearching(true)} collapsed={sidebarCollapsed} sidebarMotion={sidebarMotion} toggleSidebar={toggleSidebar}>{screen}</Workspace>
: <><TitleBar />{setup.phase === 'checking' && firstRunDone ? <BootScreen /> : <Onboarding state={setup} plan={plan} onDone={() => setPlan({ intro: false, steps: [] })} />}</>}
{ready && searching && <Search folder={folder} folders={folders} onOpen={open} onNavigate={go} onShortcuts={openShortcuts} onSettingsChange={() => setSettingsRevision((v) => v + 1)} onClose={() => setSearching(false)} sidebarCollapsed={sidebarCollapsed} onToggleSidebar={() => toggleSidebar()} />}
{ready && shortcuts && <Shortcuts onClose={() => setShortcuts(false)} />}
{ready && <TrashToast go={go} />}
- </div>
+ </div></AskRecordingWait>
)
}
diff --git a/app/src/renderer/src/askAvailability.ts b/app/src/renderer/src/askAvailability.ts
new file mode 100644
index 00000000..08bb85fe
--- /dev/null
+++ b/app/src/renderer/src/askAvailability.ts
@@ -0,0 +1,12 @@
+import { createContext } from 'react'
+import type { YogurtApi } from '../../shared/types'
+
+export const AskRecordingWait = createContext<boolean | undefined>(undefined)
+
+/** A recording can start or stop while the initial state is in flight. */
+export function watchRecordingWait(api: Pick<YogurtApi['conversations'], 'onRecordingWait' | 'waitsForMeeting'>, update: (waiting: boolean) => void) {
+ let acceptInitial = true
+ const off = api.onRecordingWait(waiting => { acceptInitial = false; update(waiting) })
+ void api.waitsForMeeting().then(waiting => { if (acceptInitial) update(waiting) }, () => {})
+ return () => { acceptInitial = false; off() }
+}
diff --git a/app/src/renderer/src/components/AskConversation.tsx b/app/src/renderer/src/components/AskConversation.tsx
index fc43deac..e50e11ff 100644
--- a/app/src/renderer/src/components/AskConversation.tsx
+++ b/app/src/renderer/src/components/AskConversation.tsx
@@ -1,5 +1,5 @@
import { InlineError } from './InlineError'
-import { useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent } from 'react'
+import { useContext, useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent } from 'react'
import { createPortal } from 'react-dom'
import { Popover } from '@base-ui/react/popover'
import { ArrowDown, ArrowUp, Check, Ellipsis, Maximize2, Square, X } from 'lucide-react'
@@ -22,6 +22,9 @@ import { AnswerScope, AskContext, chipTitle, ContextIcon } from './AskContext'
import { useFollowLatest } from '../useFollowLatest'
import { Swap, SwapText } from './Swap'
import { attachAskTracer } from '../askTracer'
+import { AskRecordingWait } from '../askAvailability'
+import { onMac } from '../keys'
+import { Tooltip } from '@base-ui/react/tooltip'
import { mentionPosition, textareaMentionRect } from '../mentionPlacement'
const drafts = new Map<string, string>()
@@ -36,6 +39,8 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
id: string; pendingDraftKey?: string; initial?: ConversationView; loadError?: boolean; home?: boolean; panel?: boolean; recording?: boolean; onDeleted: () => void; onClose?: () => void; onExpand?: () => void; onSelect: (id: string) => void; onSource: (source: LibrarySource, match?: string) => void
}) {
const [chat, setChat] = useState(initial)
+ const recordingWait = useContext(AskRecordingWait) ?? (onMac() && !!chat?.waitsForMeeting)
+ const waitReason = recordingWait ? t('Available after recording') : undefined
const [text, setText] = useState((pendingDraftKey ? drafts.get(pendingDraftKey) : undefined) ?? drafts.get(id) ?? initial?.draft ?? '')
const edited = useRef(false)
const [error, setError] = useState(false)
@@ -75,10 +80,10 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
// the page's composer mounts once the conversation loads; the panel's is there from the start
const composerReady = panel || !!chat || !!error
useEffect(() => {
- if (!composerReady || !composer.current) return
+ if (recordingWait || !composerReady || !composer.current) return
tracer.current = attachAskTracer(composer.current)
return () => { tracer.current?.dispose(); tracer.current = undefined }
- }, [composerReady])
+ }, [composerReady, recordingWait])
useEffect(() => { tracer.current?.update() }, [text])
const search = useRef<HTMLInputElement>(null)
const mentionMenu = useRef<HTMLDivElement>(null)
@@ -140,8 +145,8 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
}, [query, !!selector, chat?.chips, chat?.draftChips])
// about exactly one meeting: main reads it in now, so the first question only reads itself
const single = chips.length === 1 && chips[0].kind === 'meeting' ? chips[0].id : undefined
- const warm = () => { if (single) window.yogurt.conversations.warm(id) }
- useEffect(warm, [id, single])
+ const warm = () => { if (single && !recordingWait) window.yogurt.conversations.warm(id) }
+ useEffect(warm, [id, single, recordingWait])
useEffect(() => { document.getElementById(`${prefix}-context-${selected}`)?.scrollIntoView({ block: 'nearest' }) }, [selected, targets])
useLayoutEffect(() => {
const field = input.current, menu = mentionMenu.current
@@ -167,7 +172,7 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
}, [mention, text, targetResults, expanded, chat])
const turns = chat?.turns ?? [], last = turns.at(-1)
const answering = last?.status === 'waiting' || last?.status === 'answering'
- const busy = !chat || sending || changing || answering
+ const busy = recordingWait || !chat || sending || changing || answering
const unsent = (chat ? chat.firstChips === null : home || panel) && !turns.length
const landing = home || (!panel && unsent)
const saveText = (value: string) => {
@@ -178,11 +183,15 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
void window.yogurt.conversations.draft(id, value).then(() => { if (drafts.get(id) === value) drafts.delete(id) }).catch(() => setError(true))
}
const detectMention = (value: string, caret: number) => {
+ if (recordingWait) return
const typed = value.slice(0, caret) !== text.slice(0, caret)
if (typed && value[caret - 1] === '@') dismissedMention.current = false
if (typed && value[caret - 1] === ' ' && mention && targetResults?.query === mention.query && !targets.length) dismissedMention.current = true
setMention(dismissedMention.current ? undefined : mentionAt(value, caret))
}
+ useEffect(() => {
+ if (recordingWait) { setMention(undefined); setSelector(undefined) }
+ }, [recordingWait])
const context = async (chips: ContextTarget[]) => {
setChanging(true); setError(false)
try { await window.yogurt.conversations.context(id, chips) }
@@ -216,12 +225,13 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
const submit = (q: string) => {
void window.yogurt.conversations.ask(id, q).then(made => {
if (!made) throw new Error('Question was not saved')
+ if (typeof made !== 'string') return
setText(''); drafts.delete(id)
if (home) onSelect(made)
}).catch(() => { saveText(q); setError(true) }).finally(() => setSending(false))
}
const send = (q: string) => {
- if (!q.trim() || sending || changing || answering || loadError || readFailed || (!chat && (!panel || error))) return
+ if (recordingWait || !q.trim() || sending || changing || answering || loadError || readFailed || (!chat && (!panel || error))) return
keepTyping()
follow.resume(); setSending(true); setError(false); setMention(undefined); setSelector(undefined)
// Typing is available before the conversation loads; Enter must survive that handoff too.
@@ -229,12 +239,13 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
submit(q)
}
useEffect(() => {
- if (loadError) { pendingQuestion.current = undefined; setSending(false); return }
- if (!chat || pendingQuestion.current === undefined) return
+ if (pendingQuestion.current === undefined) return
+ if (loadError || recordingWait) { pendingQuestion.current = undefined; setSending(false); return }
+ if (!chat) return
const question = pendingQuestion.current
pendingQuestion.current = undefined
submit(question)
- }, [chat, loadError])
+ }, [chat, loadError, recordingWait])
const expand = () => {
setSelected(offset + allTargets.findIndex(c => !targets.includes(c)))
setExpanded(true)
@@ -301,7 +312,7 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
<ScrollFade><div className={`ask-thread${panel ? " chat-history" : ""}${unsent ? ' ask-thread-empty' : ''}`} ref={scroll}>
<div ref={content} className="ask-thread-content">
<LoadingContent pending={loadingChat} skeleton={<Loading layout="chat" testId="chat-thread-loading" />}>
- {!landing && turns.map(turn => <Turn key={turn.id} showCopy={turn === last} turn={turn} chat={chat!} panel={panel} onSource={onSource} onRetry={() => send(turn.question)} />)}
+ {!landing && turns.map(turn => <Turn key={turn.id} showCopy={turn === last} turn={turn} chat={chat!} panel={panel} onSource={onSource} retryDisabled={recordingWait} onRetry={() => send(turn.question)} />)}
{panel && suggestions}</LoadingContent>
</div>
</div></ScrollFade>
@@ -314,13 +325,23 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
{error && <p data-testid={panel ? "chat-send-error" : "chat-page-error"} role="alert" className="chat-error">{t("Couldn't save your changes")}</p>}
<LoadingContent pending={!panel && loadingChat} onReady={() => { if (chat) input.current?.focus({ preventScroll: true }) }} testId={landing ? "chat-loading" : undefined}><form ref={composer} className="ask-box" data-busy={busy || undefined} data-testid={`${prefix}-box`} onSubmit={e => { e.preventDefault(); send(text) }} onBlur={e => { if (!e.currentTarget.contains(e.relatedTarget)) setMention(undefined) }}>
<div className="ask-field">
- <textarea autoFocus={panel} ref={input} id={panel ? 'meeting-question' : 'library-question'} data-testid={`${prefix}-input`} rows={1} maxLength={4000}
- placeholder={landing ? undefined : panel ? t('Ask anything') : t('Ask about your meetings')} aria-label={panel ? t('Ask anything') : t('Ask about your meetings')} value={text} disabled={!panel && !chat} readOnly={sending || changing}
- role="combobox" aria-autocomplete="list" aria-expanded={!!mention} aria-controls={mention ? `${prefix}-contexts` : undefined}
- aria-activedescendant={mention && selected < rowCount ? `${prefix}-context-${selected}` : undefined}
- onChange={e => { saveText(e.target.value); detectMention(e.target.value, e.target.selectionStart) }}
- onClick={e => detectMention(e.currentTarget.value, e.currentTarget.selectionStart)}
- onSelect={e => detectMention(e.currentTarget.value, e.currentTarget.selectionStart)} onFocus={warm} onKeyDown={key} />
+ <Tooltip.Root disabled={!recordingWait}>
+ <Tooltip.Trigger render={<div />} delay={180} closeOnClick={false}>
+ <textarea autoFocus={panel} ref={input} id={panel ? 'meeting-question' : 'library-question'} data-testid={`${prefix}-input`} rows={1} maxLength={4000}
+ placeholder={landing ? undefined : panel ? t('Ask anything') : t('Ask about your meetings')} aria-label={panel ? t('Ask anything') : t('Ask about your meetings')} value={text} disabled={!panel && !chat} readOnly={recordingWait || sending || changing}
+ aria-disabled={recordingWait || undefined} aria-description={waitReason}
+ role="combobox" aria-autocomplete="list" aria-expanded={!!mention} aria-controls={mention ? `${prefix}-contexts` : undefined}
+ aria-activedescendant={mention && selected < rowCount ? `${prefix}-context-${selected}` : undefined}
+ onChange={e => { if (recordingWait) return; saveText(e.target.value); detectMention(e.target.value, e.target.selectionStart) }}
+ onClick={e => detectMention(e.currentTarget.value, e.currentTarget.selectionStart)}
+ onSelect={e => detectMention(e.currentTarget.value, e.currentTarget.selectionStart)} onFocus={warm} onKeyDown={key} />
+ </Tooltip.Trigger>
+ {recordingWait && <Tooltip.Portal container={panel ? composer : undefined}>
+ <Tooltip.Positioner positionMethod="fixed" side="top" sideOffset={6} collisionPadding={12} className="z-[80]">
+ <Tooltip.Popup role="tooltip" className="rounded-md border border-line bg-float px-2 py-1 text-xs text-ink shadow-[var(--shadow)]">{waitReason}</Tooltip.Popup>
+ </Tooltip.Positioner>
+ </Tooltip.Portal>}
+ </Tooltip.Root>
<div className="ask-box-actions">
<Popover.Root open={!!selector} onOpenChange={open => {
setMention(undefined)
@@ -358,7 +379,7 @@ export function AskConversation({ id, pendingDraftKey, initial, loadError = fals
<p data-testid={`${prefix}-announce`} className="sr-only" aria-live="polite">{last?.status === 'done' ? last.answer : ''}</p>
</div>
}
-function Turn({ turn, chat, panel, showCopy, onSource, onRetry }: { showCopy: boolean; turn: ConversationTurn; chat: ConversationView; panel: boolean; onSource: (s: LibrarySource, match?: string) => void; onRetry: () => void }) {
+function Turn({ turn, chat, panel, showCopy, onSource, onRetry, retryDisabled }: { showCopy: boolean; turn: ConversationTurn; chat: ConversationView; panel: boolean; onSource: (s: LibrarySource, match?: string) => void; onRetry: () => void; retryDisabled: boolean }) {
const live = turn.status === 'answering', answer = useSmoothText(turn.answer, live)
const [copied, setCopied] = useState(false), [failed, setFailed] = useState(false)
const prefix = panel ? 'chat' : 'chat-page'
@@ -373,7 +394,7 @@ function Turn({ turn, chat, panel, showCopy, onSource, onRetry }: { showCopy: bo
void navigator.clipboard.writeText(turn.answer).then(() => { setCopied(true); setFailed(false) }).catch(() => setFailed(true))
}}><Swap show={copied ? 'done' : 'copy'} options={{ copy: <Copy size={13} />, done: <Check size={13} /> }} /><SwapText text={copied ? t('Copied') : t('Copy')} widest={t('Copied')} /></button>{turn.scope && <AnswerScope chips={turn.scope} />}<span role="status" className={failed ? 'text-danger' : 'sr-only'}>{failed ? t("Yogurt couldn't copy.") : copied ? t('Copied') : ''}</span></div>}
{turn.status === 'stopped' && <p className="text-xs text-muted">{answer ? t('Stopped') : t('Stopped before answering')}</p>}
- {turn.status === 'failed' && <InlineError testId="chat-answer-error"><span>{t("Yogurt couldn't answer that.")}</span><button type="button" className="workspace-button" onClick={onRetry}>{t('Try again')}</button></InlineError>}
+ {turn.status === 'failed' && <InlineError testId="chat-answer-error"><span>{t("Yogurt couldn't answer that.")}</span><button type="button" className="workspace-button" disabled={retryDisabled} onClick={onRetry}>{t('Try again')}</button></InlineError>}
</div>
}
diff --git a/app/src/renderer/src/components/Search.tsx b/app/src/renderer/src/components/Search.tsx
index ee442a5a..96fbdf04 100644
--- a/app/src/renderer/src/components/Search.tsx
+++ b/app/src/renderer/src/components/Search.tsx
@@ -166,7 +166,8 @@ export function Search({ folder, folders, onOpen, onNavigate, onSettingsChange,
const id = await window.yogurt.conversations.current(scope ? [{ kind: 'folder', id: scope.id }] : [], true)
const sent = await window.yogurt.conversations.ask(id, query)
if (!sent) throw new Error('Question was not saved')
- onNavigate(`/chat/${sent}`); setOpen(false)
+ if (typeof sent !== 'string') await window.yogurt.conversations.draft(id, query)
+ onNavigate(`/chat/${typeof sent === 'string' ? sent : id}`); setOpen(false)
} catch { setError(true); setRunning(false) }
}
const onKeyDown = (e: React.KeyboardEvent) => {
diff --git a/app/src/renderer/src/workspace.css b/app/src/renderer/src/workspace.css
index c8acc6c9..4550b9f1 100644
--- a/app/src/renderer/src/workspace.css
+++ b/app/src/renderer/src/workspace.css
@@ -471,6 +471,9 @@ body:has(.chat-panel[open]) .app-toast-viewport:dir(rtl) { --toast-x:440px; }
.ask-box textarea::placeholder { color:var(--muted); }
.ask-box-actions { display:flex;align-items:center;justify-content:space-between;margin-top:8px; }
.ask-toolbar-button { display:grid;place-items:center;width:28px;height:28px;flex:none;border:1px solid transparent;border-radius:50%;color:var(--muted);transition:background-color var(--dur-micro) ease,color var(--dur-micro) ease; }
+.ask-box:has(textarea[aria-disabled=true]) { background:var(--card); }
+.ask-box textarea[aria-disabled=true] { cursor:not-allowed;color:var(--muted); }
+.ask-box textarea[aria-disabled=true]:focus-visible { outline:2px solid var(--focus);outline-offset:2px;border-radius:3px; }
.ask-toolbar-button:hover:not(:disabled) { background:var(--control);color:var(--ink); }
.ask-toolbar-button:active:not(:disabled) { background:var(--control-hover); }
.ask-toolbar-button:disabled { color:var(--muted);opacity:.45; }
diff --git a/app/src/shared/types.ts b/app/src/shared/types.ts
index 369eb9c5..942ae3f9 100644
--- a/app/src/shared/types.ts
+++ b/app/src/shared/types.ts
@@ -216,6 +216,8 @@ export type YogurtApi = {
}
/** questions across every meeting, in saved conversations (the Chat page) */
conversations: {
+ waitsForMeeting(): Promise<boolean>
+ onRecordingWait(cb: (waiting: boolean) => void): () => void
/** newest first */
list(): Promise<ConversationSummary[]>
current(chips: ContextChip[], fresh?: boolean): Promise<string>
@@ -224,8 +226,8 @@ export type YogurtApi = {
draft(id: string, text: string): Promise<void>
targets(query: string): Promise<ContextTarget[]>
get(id: string): Promise<ConversationView | null>
- /** id null starts a new conversation; resolves to its id once the question is saved (null: nothing asked). The answer streams in through onChange */
- ask(id: string | null, question: string): Promise<string | null>
+ /** id null starts a new conversation; resolves to its id once the question is saved (null for an invalid request), or the active recording wait. The answer streams in through onChange */
+ ask(id: string | null, question: string): Promise<string | null | { waitsForMeeting: true }>
/** a conversation about one meeting opened: its meeting is read into the model ahead of a question */
warm(id: string): void
stop(id: string): void
diff --git a/app/test/askComposer.test.ts b/app/test/askComposer.test.ts
index cec7aeb2..6fe32c48 100644
--- a/app/test/askComposer.test.ts
+++ b/app/test/askComposer.test.ts
@@ -2,6 +2,7 @@ import { afterEach, expect, it, vi } from 'vitest'
import { createElement, useEffect, type ChangeEvent, type ComponentProps } from 'react'
import { jsxDEV } from 'react/jsx-dev-runtime'
import { renderToStaticMarkup } from 'react-dom/server'
+import { AskRecordingWait, watchRecordingWait } from '../src/renderer/src/askAvailability'
import { AskConversation } from '../src/renderer/src/components/AskConversation'
import type { ConversationTurn, ConversationView } from '../src/shared/types'
@@ -78,3 +79,53 @@ it('keeps the landing input labeled without repeating its heading as a placehold
expect(input).toContain('aria-label="Ask about your meetings"')
expect(input).not.toContain('placeholder=')
})
+
+it('keeps the latest recording event when a slower initial read arrives', async () => {
+ let snapshot!: (waiting: boolean) => void, publish!: (waiting: boolean) => void
+ const update = vi.fn(), off = vi.fn()
+ const stop = watchRecordingWait({
+ onRecordingWait(cb) { publish = cb; return off },
+ waitsForMeeting: () => new Promise(resolve => { snapshot = resolve }),
+ }, update)
+ publish(true)
+ publish(false)
+ snapshot(true)
+ await Promise.resolve()
+ expect(update.mock.calls).toEqual([[true], [false]])
+ stop()
+ expect(off).toHaveBeenCalledOnce()
+})
+
+it.each([true, false])('keeps a blocked field focusable and preserves the draft through recording stop (panel %s)', panel => {
+ const ask = vi.fn(), draft = vi.fn()
+ vi.stubGlobal('window', { matchMedia: () => ({ matches: false }), yogurt: { os: 'darwin', conversations: { ask, draft } } })
+ const initial: ConversationView = { id: 'draft', title: '', chips: [], draft: 'Keep this question', draftChips: [], firstChips: null,
+ turns: [], waitsForMeeting: true, waitsForModel: false }
+ const ui = createElement(AskConversation, { id: initial.id, initial, panel, home: !panel, onSelect() {}, onDeleted() {}, onSource() {} })
+ const locked = renderToStaticMarkup(createElement(AskRecordingWait.Provider, { value: true }, ui))
+ const input = locked.match(/<textarea[^>]*>/)![0]
+ expect(input).toContain('aria-disabled="true"')
+ expect(input).toContain('aria-description="Available after recording"')
+ expect(input).toContain('readOnly=""')
+ expect(input).not.toContain(' disabled=')
+ expect(locked).toMatch(/data-testid="chat(?:-page)?-send"[^>]*disabled=/)
+ const form = vi.mocked(jsxDEV).mock.calls.filter(([type]) => type === 'form').at(-1)![1] as ComponentProps<'form'>
+ form.onSubmit!({ preventDefault() {} } as Parameters<NonNullable<typeof form.onSubmit>>[0])
+ expect(ask).not.toHaveBeenCalled()
+ expect(draft).not.toHaveBeenCalled()
+ const unlocked = renderToStaticMarkup(createElement(AskRecordingWait.Provider, { value: false }, ui))
+ expect(unlocked).toContain('Keep this question')
+ expect(unlocked.match(/<textarea[^>]*>/)![0]).not.toMatch(/aria-disabled|readOnly|aria-description/)
+ expect(unlocked).not.toMatch(/data-testid="chat(?:-page)?-send"[^>]*disabled=/)
+})
+
+it.each([['darwin', true, true], ['darwin', false, false], ['win32', true, false], ['linux', true, false]] as const)(
+ 'uses the conversation wait while the first recording snapshot is pending (%s, wait %s)', (os, waitsForMeeting, locked) => {
+ vi.stubGlobal('window', { matchMedia: () => ({ matches: false }), yogurt: { os } })
+ const initial: ConversationView = { id: 'call', title: '', chips: [], draft: '', draftChips: [], firstChips: null,
+ turns: [], waitsForMeeting, waitsForModel: false }
+ const ui = createElement(AskConversation, { id: initial.id, initial, panel: true, recording: true, onSelect() {}, onDeleted() {}, onSource() {} })
+ const input = renderToStaticMarkup(ui).match(/<textarea[^>]*>/)![0]
+ expect(input.includes('aria-disabled="true"')).toBe(locked)
+ expect(input.includes('readOnly=""')).toBe(locked)
+ })
diff --git a/app/test/motionInteractions.test.ts b/app/test/motionInteractions.test.ts
index 0cb4b9ce..bf231892 100644
--- a/app/test/motionInteractions.test.ts
+++ b/app/test/motionInteractions.test.ts
@@ -14,7 +14,7 @@ import { Agenda } from '../src/renderer/src/components/Agenda'
vi.mock('react', async original => ({
...await original<typeof import('react')>(), useState: vi.fn(), useRef: vi.fn(), useEffect: vi.fn(), useLayoutEffect: vi.fn(),
- useCallback: (callback: unknown) => callback,
+ useCallback: (callback: unknown) => callback, useContext: vi.fn(),
}))
vi.mock('motion/react', async original => ({ ...await original<typeof import('motion/react')>(), useDragControls: () => ({ start: vi.fn() }) }))
vi.mock('react-dom', async original => ({ ...await original<typeof import('react-dom')>(), createPortal: (children: ReactNode) => children }))
@@ -207,6 +207,19 @@ it.each([false, true])('retries the last requested AI access setting (reopen Set
} finally { view.unmount() }
})
+it('opens a command-search question as a draft when recording prevents an answer', async () => {
+ vi.stubGlobal('document', { activeElement: null })
+ vi.stubGlobal('HTMLButtonElement', class {})
+ const draft = vi.fn().mockResolvedValue(undefined), onNavigate = vi.fn()
+ const conversations = { current: async () => 'draft-id', ask: async () => ({ waitsForMeeting: true }), draft }
+ vi.stubGlobal('window', { yogurt: { capabilities: { calendar: false }, conversations } })
+ const render = renderer(() => Search({ onOpen() {}, onNavigate, onSettingsChange() {}, onShortcuts() {}, onClose() {}, sidebarCollapsed: false, onToggleSidebar() {} }))
+ find(render(), 'search-input').props.onChange({ target: { value: 'What did we decide?' } })
+ find(render(), 'search').props.onKeyDown({ key: 'Enter', metaKey: true, nativeEvent: {}, preventDefault() {} })
+ await vi.waitFor(() => expect(onNavigate).toHaveBeenCalledExactlyOnceWith('/chat/draft-id'))
+ expect(draft).toHaveBeenCalledExactlyOnceWith('draft-id', 'What did we decide?')
+})
+
it.each([true, false])('offers and runs the date command only with an agenda (calendar: %s)', async calendar => {
vi.useFakeTimers()
vi.stubGlobal('document', { activeElement: null })
@@ -537,7 +550,7 @@ it.each(['send', 'load', 'resolve'] as const)('keeps an early Enter through load
} })
const render = renderer(() => AskConversation({ id, loadError, pendingDraftKey: `meeting/early-${failure}`, panel: true, onSelect() {}, onDeleted() {}, onSource() {} }))
const flush = async () => { for (let i = 0; i < 5; i++) await Promise.resolve() }
- const drain = () => vi.mocked(useEffect).mock.calls.find(([, deps]) => deps?.length === 2 && deps[1] === loadError)![0]()
+ const drain = () => vi.mocked(useEffect).mock.calls.find(([, deps]) => deps?.length === 3 && deps[1] === loadError && deps[2] === false)![0]()
const enter = (tree: ReactNode) => find(tree, 'chat-input').props.onKeyDown({ key: 'Enter', nativeEvent: {}, preventDefault() {} })
let tree = render()
const focus = vi.fn()