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.

People: suggestions as you add an attendee, this meeting's invitees first, and auto titles that leave you out

Eric Brownroutcc6c34aeec1f
diff --git a/app/e2e/attendeeSuggestions.spec.ts b/app/e2e/attendeeSuggestions.spec.ts
new file mode 100644
index 00000000..224f6887
--- /dev/null
+++ b/app/e2e/attendeeSuggestions.spec.ts
@@ -0,0 +1,98 @@
+import { _electron as electron, expect, test } from '@playwright/test'
+import { mkdtempSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+
+test('attendee suggestions rank invitees, keep distinct email identities, and support keyboard and pointer selection', async () => {
+ const app = await electron.launch({ args: [join(import.meta.dirname, '../out/main/index.js')], env: {
+ ...process.env, YOGURT_FAKE: '1', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), 'attendee-suggestions-')),
+ } })
+ try {
+ const page = await app.firstWindow()
+ await expect(page.getByTestId('home')).toBeVisible()
+ await app.evaluate(() => (globalThis as any).__fake__.manyMeetings({ n: 3, clean: true }))
+ const [target, recent, older] = await page.evaluate(() => window.yogurt.meetings.cards({ limit: 3 }))
+ await page.evaluate(async ({ recent, older }) => {
+ await window.yogurt.settings.setName('Owner Example')
+ await window.yogurt.meetings.setAttendees(recent, [{ name: 'Guest Recent', email: '[email protected]' }, { name: 'Guest Shared', email: null }])
+ await window.yogurt.meetings.setAttendees(older, [{ name: 'Guest Older', email: '[email protected]' }, { name: 'Guest Shared', email: '[email protected]' }])
+ }, { recent: recent.id, older: older.id })
+ const at = target.startedAt + 86_400_000
+ await app.evaluate((_e, at) => (globalThis as any).__fake__.calendarEvents([
+ { id: 'current', title: 'Planning', start: new Date(at).toISOString(), end: new Date(at + 1_800_000).toISOString(), attendees: [
+ { name: 'Guest Invitee', email: '[email protected]' }, { name: 'Guest Shared', email: '[email protected]' },
+ ] },
+ { id: 'other', title: 'Other event', start: new Date(at + 1_800_000).toISOString(), end: new Date(at + 3_600_000).toISOString(), attendees: [{ name: 'Guest Calendar', email: '[email protected]' }] },
+ ]), at)
+ await page.evaluate(async ({ id, at }) => {
+ await window.yogurt.meetings.linkEvent(id, 'current', at)
+ await window.yogurt.meetings.setAttendees(id, [])
+ window.yogurt.nav.go(`/note/${id}`)
+ }, { id: target.id, at })
+ await page.getByTestId('note-attendees').click()
+ const input = page.getByTestId('people-add'), options = page.getByRole('option')
+ await input.fill('Guest')
+ await expect(options).toHaveCount(5)
+ await expect(options.nth(0)).toContainText('Guest Invitee')
+ await expect(options.nth(1)).toContainText('[email protected]')
+ await expect(options.nth(2)).toContainText('Guest Recent')
+ await input.press('ArrowDown')
+ await expect(options.first()).toHaveAttribute('aria-selected', 'true')
+ await expect(input).toHaveAttribute('aria-activedescendant', await options.first().getAttribute('id') as string)
+ await input.press('Enter')
+ await expect(input).toHaveValue('')
+ await expect(page.getByTestId('people-list')).toContainText('[email protected]')
+ await input.fill('Guest Shared')
+ await expect(options).toHaveCount(2)
+ await options.filter({ hasText: '[email protected]' }).click()
+ await expect(input).toBeFocused()
+ await expect(input).toHaveValue('')
+ await input.fill('Guest Shared')
+ await expect(options).toHaveCount(1)
+ await expect(options).toContainText('[email protected]')
+ await input.press('ArrowUp')
+ await input.press('Enter')
+ await expect(page.getByTestId('people-list')).toContainText('[email protected]')
+ await input.fill('Guest Calendar')
+ await expect(options).toHaveCount(1)
+ await page.keyboard.press('Escape')
+ await expect(page.getByTestId('people-card')).toHaveCount(0)
+ await expect(page.getByTestId('note-attendees')).toBeFocused()
+ } finally { await app.close() }
+})
+
+test('auto titles use current attendees after edits while an edited summary stays intact', async () => {
+ test.setTimeout(90_000)
+ const app = await electron.launch({ args: [join(import.meta.dirname, '../out/main/index.js')], env: {
+ ...process.env, YOGURT_FAKE: '1', YOGURT_FAKE_LLM_MS: '1', YOGURT_USER_DATA: mkdtempSync(join(tmpdir(), 'attendee-titles-')),
+ } })
+ try {
+ const page = await app.firstWindow()
+ await expect(page.getByTestId('home')).toBeVisible()
+ await page.evaluate(() => window.yogurt.settings.setName('Owner Example'))
+ await app.evaluate(() => (globalThis as any).__fake__.calendarEvents([]))
+ await page.reload()
+ 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 expect.poll(() => page.evaluate(id => window.yogurt.transcript.get(id).then(lines => lines.length), id), { timeout: 20_000 }).toBeGreaterThan(0)
+ await page.getByTestId('note-stop').click()
+ await expect.poll(() => page.evaluate(id => window.yogurt.meetings.get(id).then(m => m?.titleSource), id), { timeout: 30_000 }).toBe('auto')
+ await page.getByTestId('note-summary-tab').click()
+ await page.getByRole('textbox', { name: 'Summary', exact: true }).fill('Keep this edited summary.')
+ await expect.poll(() => page.evaluate(id => window.yogurt.notes.get(id).then(n => n.enhanced), id)).toContain('Keep this edited summary.')
+ await app.evaluate(() => { (globalThis as any).__fake__.prompts().notes.length = 0 })
+ await page.evaluate(async id => {
+ await window.yogurt.meetings.setAttendees(id, [{ name: 'Guest Previous', email: null }])
+ await window.yogurt.meetings.setAttendees(id, [{ name: 'Guest Current', email: '[email protected]' }])
+ }, id)
+ const titles = () => app.evaluate(() => ((globalThis as any).__fake__.prompts().notes as string[]).filter(p => p.startsWith('Now give this meeting a title')))
+ await expect.poll(async () => (await titles()).length, { timeout: 20_000 }).toBe(1)
+ const [prompt] = await titles()
+ expect(prompt).toContain('Owner Example')
+ expect(prompt).toContain('["Guest Current"]')
+ expect(prompt).not.toContain('Guest Previous')
+ expect(await page.evaluate(id => window.yogurt.notes.get(id).then(n => n.enhanced), id)).toContain('Keep this edited summary.')
+ await expect(page.getByTestId('note-title')).not.toContainText('Owner')
+ } finally { await app.close() }
+})
diff --git a/app/src/main/notes/enhance.ts b/app/src/main/notes/enhance.ts
index dfc9156a..f43b1be2 100644
--- a/app/src/main/notes/enhance.ts
+++ b/app/src/main/notes/enhance.ts
@@ -299,15 +299,18 @@ export type EnhanceInput = {
export const TITLE_CHARS = 80
/** asked after the notes, following on from them: the model has read the meeting already, so this costs a few words */
-export const titlePrompt = (language: string) =>
- `Now give this meeting a title, in ${language || 'the same language as the notes'}: short and specific, saying what it was about, and with whom when a name is known, like "Q3 hiring plan with Maya" or "Fixing the checkout bug". Under 70 characters, no quotes, no period at the end. Answer with the title only.`
+export const titlePrompt = (language: string, me = '', attendees?: Person[]) =>
+ `Now give this meeting a title, in ${language || 'the same language as the notes'}: short and specific, saying what it was about, and with whom when a name is known, like "Q3 hiring plan with a colleague" or "Fixing the checkout bug". Under 70 characters, no quotes, no period at the end. Answer with the title only. Never name the person these notes are for ("me" or "You")${me.trim() ? `: ${JSON.stringify(me.trim())}, including their first name` : ''}.${attendees ? ` The current attendees other than the owner are: ${JSON.stringify(attendees.filter(p => p.name.trim().toLowerCase() !== me.trim().toLowerCase()).map(p => p.name))}. Use only these names, even if the old notes or title mention others; if none, title only the topic.` : ''}`
/** the title as the model wrote it, without quotes, a "Title:" label, heading or bold marks, or a closing period */
-export function cleanTitle(raw: string): string {
+export function cleanTitle(raw: string, me = ''): string {
let s = raw.replace(/\r/g, '').split('\n').map((l) => l.trim()).find(Boolean) ?? ''
s = s.replace(/^#+\s*/, '').replace(/^(?:\*\*)?title(?:\*\*)?\s*:\s*/i, '').replace(/\*\*|__/g, '').trim()
s = s.replace(/^["'“”‘’«»「」『』]+|["'“”‘’«»「」『』]+$/g, '').trim().replace(/[.。]+$/, '').trim()
if (/^none$/i.test(s)) return ''
+ // Reject owner names even when the model ignores the prompt, before shortening can hide a match.
+ const owner = me.trim().normalize('NFKC').split(/\s+/).filter(Boolean)
+ if (owner.some(name => new RegExp(`(?<![\\p{L}\\p{N}])${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?![\\p{L}\\p{N}])`, 'iu').test(s.normalize('NFKC')))) return ''
if (s.length > TITLE_CHARS) s = s.slice(0, TITLE_CHARS + 1).replace(/\s+\S*$/, '').replace(/[,;:\s-]+$/, '')
return s
}
@@ -402,7 +405,7 @@ export async function enhance(input: EnhanceInput, llm: Llm, onToken: (text: str
if (OWNER.test(more)) md = `${md}\n${more}`
}
// a title is nice to have: one that fails or comes out empty leaves the meeting's as it is
- if (written) input.titleLater?.((model) => model.chat(titlePrompt(language), () => {}, { maxTokens: 40, before: [prompt, written], temperature: 0.3 })
- .then((raw) => cleanTitle(raw), (e) => { console.error('a title from the notes failed', e); return '' }))
+ if (written) input.titleLater?.((model) => model.chat(titlePrompt(language, input.me, input.meeting.attendees), () => {}, { maxTokens: 40, before: [prompt, written], temperature: 0.3 })
+ .then((raw) => cleanTitle(raw, input.me), (e) => { console.error('a title from the notes failed', e); return '' }))
return markMine(withoutCopies(md, input.mine), input.mine)
}
diff --git a/app/src/main/notes/index.ts b/app/src/main/notes/index.ts
index bdabfd53..dc5f4cbd 100644
--- a/app/src/main/notes/index.ts
+++ b/app/src/main/notes/index.ts
@@ -2,7 +2,7 @@ import { attendeeMembership as stamp } from '../../shared/people'
import type { Meeting, Store } from '../store'
import type { NotesModel } from './model'
import type { NoteSaveResult, NoteSide, NoteStatus, NoteView } from '../../shared/types'
-import { enhance, type Llm, type PartSummary } from './enhance'
+import { cleanTitle, enhance, languageName, titlePrompt, type Llm, type PartSummary } from './enhance'
import { meetingWords } from '../vocab'
import type { Queue } from './queue'
@@ -148,12 +148,13 @@ export function hookNotes(p: {
if (quiet) {
// stopped for a recording: the queue runs it again. Edited (or written again by hand) meanwhile: theirs stands
const now = currentNotes(id)
- if (signal.aborted || now.edited || now.enhanced !== was.enhanced || live.has(id)) return
+ if (signal.aborted || live.has(id)) return
+ if (now.edited || now.enhanced !== was.enhanced) { queueTitle(id); return }
stampBefore.set(id, p.store.writtenWith(id))
p.store.setNotes(id, { enhanced: md, edited: false })
p.store.setWrittenWith(id, used.stamp)
p.send({ ...view(id), rewrittenFrom: was.enhanced ?? '' })
- queueTitle(id, askTitle)
+ queueTitle(id, askTitle, m.attendees)
p.summarized?.(id)
return
}
@@ -162,7 +163,7 @@ export function hookNotes(p: {
p.store.setNotes(id, { enhanced: md, edited: false })
p.store.setWrittenWith(id, used.stamp)
finish(m, 'done')
- queueTitle(id, askTitle)
+ queueTitle(id, askTitle, m.attendees)
p.summarized?.(id)
} catch (e) {
if (timer) clearTimeout(timer)
@@ -179,13 +180,24 @@ export function hookNotes(p: {
* A title from the notes just saved, for a meeting whose title is generic (or was made from earlier notes): a job of
* its own, so one stopped for a recording asks again later and never writes the notes again.
*/
- const queueTitle = (id: string, ask?: (llm: Llm) => Promise<string>) => {
- if (!ask) return
+ const queueTitle = (id: string, ask?: (llm: Llm) => Promise<string>, people = p.store.meeting(id)?.attendees) => {
+ const current = () => {
+ const m = p.store.meeting(id)
+ return m && !resuming.has(id) && m.state !== 'recording' && (m.titleSource === 'auto' || (ask && m.titleSource === 'generic'))
+ && JSON.stringify(m.attendees) === JSON.stringify(people) ? m : undefined
+ }
void p.queue.enqueue(async (signal) => {
- const t = await ask(await p.model.llm(signal))
- // renamed while it was asked for: theirs stands
- const now = p.store.meeting(id)
- if (!t || signal.aborted || !(now?.titleSource === 'generic' || now?.titleSource === 'auto')) return
+ if (!current()) return
+ const llm = await p.model.llm(signal), m = current()
+ if (!m || signal.aborted) return
+ const me = p.me?.() ?? ''
+ const n = currentNotes(id)
+ // shortcut: title-only refreshes read the first 6000 characters; expand if long notes need later context.
+ const context = (n.enhanced ?? n.mine).slice(0, 6000)
+ const t = cleanTitle(await (ask ? ask(llm) : llm.chat(`${titlePrompt(languageName(m.language ?? p.language(id)), me, m.attendees)}\n\nNotes:\n${context}`,
+ () => {}, { maxTokens: 40, temperature: 0.3 })), me)
+ // renamed or people changed while it was asked for: discard the obsolete answer.
+ if (!t || signal.aborted || !current()) return
p.store.updateMeeting(id, { title: t, titleSource: 'auto' })
p.changed(id)
}, 'enhance', id).catch(() => {})
@@ -250,23 +262,26 @@ export function hookNotes(p: {
renamed(id: string, before: Meeting['attendees'], after: Meeting['attendees']) {
const used = writingPeople.get(id)
if (used?.stamp === stamp(before)) used.stamp = stamp(after)
+ notes.applyPeople(id)
},
written: (id: string): Promise<void> | undefined => afterStop.get(id),
/**
* People added or removed after the notes were written (by hand, or seen in the call): unedited notes are written
* again on their own, once the changes settle, out of sight. Edited notes keep the "People changed" hint instead.
*/
- applyPeople(id: string) {
+ applyPeople(id: string, retitle = true) {
+ const refreshTitle = retitle || rewriteTimers.has(id)
clearTimeout(rewriteTimers.get(id)); rewriteTimers.delete(id)
const due = () => { const n = currentNotes(id); return !resuming.has(id) && p.store.meeting(id)?.state !== 'recording' && n.enhanced != null && !n.edited && !live.has(id) && !rewriting.has(id) && peopleChanged(id, true) }
- if (!due()) { p.send(view(id)); return }
+ const titleDue = () => refreshTitle && !resuming.has(id) && p.store.meeting(id)?.state !== 'recording' && p.store.meeting(id)?.titleSource === 'auto'
+ if (!due() && !titleDue()) { p.send(view(id)); return }
rewriteTimers.set(id, setTimeout(() => {
rewriteTimers.delete(id)
// edited meanwhile: the hint shows instead
- if (!due()) { p.send(view(id)); return }
+ if (!due()) { if (titleDue()) queueTitle(id); p.send(view(id)); return }
rewriting.add(id)
// people that changed while it was written get one more go
- p.queue.enqueue((signal) => write(id, signal, true), 'enhance', id).catch(() => {}).finally(() => { rewriting.delete(id); notes.applyPeople(id) })
+ p.queue.enqueue((signal) => write(id, signal, true), 'enhance', id).catch(() => {}).finally(() => { rewriting.delete(id); notes.applyPeople(id, false) })
}, p.peopleRewriteMs ?? PEOPLE_REWRITE_MS))
p.send(view(id))
},
diff --git a/app/src/main/store.ts b/app/src/main/store.ts
index 6f0b00c4..4f720f6f 100644
--- a/app/src/main/store.ts
+++ b/app/src/main/store.ts
@@ -507,7 +507,7 @@ export class Store {
const rows = this.db.prepare('SELECT attendees FROM meetings WHERE trashed_at IS NULL ORDER BY started_at DESC, id DESC').all()
const attendees = uniqueSearchPeople(rows.flatMap(r => JSON.parse(String(r.attendees)) as Person[]))
return resolvePeople(this.db, attendees)
- .filter(p => p.name.trim() || p.email?.trim()).sort((a, b) => a.name.localeCompare(b.name))
+ .filter(p => p.name.trim() || p.email?.trim())
}
/** Each word can match a different field; dates and folder scope always filter the meeting itself. */
diff --git a/app/src/renderer/src/components/People.tsx b/app/src/renderer/src/components/People.tsx
index 6fd203fc..b8239916 100644
--- a/app/src/renderer/src/components/People.tsx
+++ b/app/src/renderer/src/components/People.tsx
@@ -1,10 +1,11 @@
+import { attendeeSuggestions, searchPersonKey } from '../../../shared/searchPeople'
import { usePopoverPresence } from '../motion'
import { attendeePrivacy, emailName } from '../../../shared/people'
import { toasts } from './TrashToast'
-import { useCallback, useEffect, useRef, useState, type KeyboardEvent, type RefObject } from 'react'
+import { useCallback, useEffect, useId, useRef, useState, type KeyboardEvent, type RefObject } from 'react'
import { useNotePopover } from '../useNotePopover'
import { Lock, Pencil, Plus, Users, X } from 'lucide-react'
-import type { Meeting, Person } from '../../../shared/types'
+import type { CalEvent, Meeting, Person } from '../../../shared/types'
import { t } from '../../../shared/i18n'
const same = (a: string, b: string) => a.trim().toLowerCase() === b.trim().toLowerCase()
@@ -71,20 +72,38 @@ function Card({ m, me, motionProps, chip, onClose }: { m: Meeting; me: string; m
const [text, setText] = useState('')
const [adding, setAdding] = useState(() => !m.attendees.some(p => !same(p.name, me)))
const [focused, setFocused] = useState(false)
+ const [known, setKnown] = useState<Person[]>([]), [events, setEvents] = useState<CalEvent[]>([])
+ const [active, setActive] = useState<string | null>(null)
+ const listId = useId()
+ const suggestions = attendeeSuggestions(text, known, m.attendees, me, events, m.eventId)
+ const activeIndex = suggestions.findIndex(p => searchPersonKey(p) === active)
+ useEffect(() => {
+ let sequence = 0
+ const load = () => {
+ const current = ++sequence
+ void window.yogurt.search.people().then(p => { if (current === sequence) setKnown(p) }, () => {})
+ void window.yogurt.calendar.day(m.eventStartedAt ?? m.startedAt).then(day => {
+ if (current === sequence) setEvents(day.status === 'granted' ? day.events : [])
+ }, () => { if (current === sequence) setEvents([]) })
+ }
+ load()
+ const offPeople = window.yogurt.meetings.onChange(load), offCalendar = window.yogurt.calendar.onChange(load)
+ return () => { sequence++; offPeople(); offCalendar() }
+ }, [m.id, m.startedAt, m.eventStartedAt, m.eventId])
const input = useRef<HTMLInputElement>(null)
const card = useRef<HTMLDivElement>(null)
useNotePopover(card, chip, onClose, !motionProps.inert)
+ useEffect(() => { card.current?.querySelector('[role="option"][aria-selected="true"]')?.scrollIntoView({ block: 'nearest' }) }, [active])
useEffect(() => { if (adding) input.current?.focus({ preventScroll: true }) }, [adding])
const save = async (people: Person[]) => {
try { await window.yogurt.meetings.setAttendees(m.id, people); return true }
catch { toasts.add({ title: t("Yogurt couldn't make that change. Try again.") }); return false }
}
- const add = async () => {
- const p = parsePerson(text)
+ const add = async (p = parsePerson(text)) => {
if (!p) return
// already there: nothing to add
- if (m.attendees.some((a) => same(a.name, p.name) || (p.email && a.email && same(a.email, p.email)))) return
- if (await save([...m.attendees, p])) setText('')
+ if (m.attendees.some((a) => p.email?.trim() && a.email?.trim() ? same(a.email, p.email) : same(a.name, p.name))) return
+ if (await save([...m.attendees, p])) { setText(''); setActive(null); input.current?.focus() }
}
const key = (e: KeyboardEvent) => {
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); onClose() }
@@ -104,11 +123,30 @@ function Card({ m, me, motionProps, chip, onClose }: { m: Meeting; me: string; m
<div className={`border-t border-line ${adding ? 'p-3' : ''}`}>
<button data-testid="people-add-open" onClick={() => { setAdding(true); input.current?.focus() }} className={`flex w-full items-center gap-2 text-start text-[13px] text-muted ${adding ? 'mb-2' : 'h-11 px-4 hover:bg-card'}`}><Plus size={14} aria-hidden="true" />{t('Add an attendee')}</button>
{adding && <div className="people-add-field flex h-9 items-center rounded-md border border-line bg-card px-2.5">
- <input ref={input} data-testid="people-add" value={text} onChange={(e) => setText(e.target.value)} maxLength={200}
- onKeyDown={(e) => { if (e.key === 'Enter') { e.preventDefault(); void add() } }}
+ <input ref={input} data-testid="people-add" value={text} onChange={(e) => { setText(e.target.value); setActive(null) }} maxLength={200}
+ role="combobox" aria-autocomplete="list" aria-expanded={focused && suggestions.length > 0} aria-controls={focused && suggestions.length > 0 ? listId : undefined}
+ aria-activedescendant={focused && activeIndex >= 0 ? `${listId}-${activeIndex}` : undefined}
+ onKeyDown={(e) => {
+ if (e.nativeEvent.isComposing) return
+ if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && suggestions.length) {
+ e.preventDefault()
+ const next = activeIndex < 0 ? (e.key === 'ArrowDown' ? 0 : suggestions.length - 1)
+ : (activeIndex + (e.key === 'ArrowDown' ? 1 : -1) + suggestions.length) % suggestions.length
+ setActive(searchPersonKey(suggestions[next]))
+ } else if (e.key === 'Enter') { e.preventDefault(); void add(suggestions[activeIndex] ?? parsePerson(text)) }
+ }}
placeholder={t('Name or email')} aria-label={t('Add an attendee')} onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
className="h-full min-w-0 flex-1 bg-transparent text-[13px] outline-none placeholder:text-muted" />
</div>}
+ {adding && focused && suggestions.length > 0 && <ul id={listId} role="listbox" aria-label={t('People')} className="mt-1">
+ {suggestions.map((p, i) => <li key={searchPersonKey(p)} id={`${listId}-${i}`} role="option" aria-selected={i === activeIndex}
+ onMouseDown={e => e.preventDefault()} onMouseMove={() => setActive(searchPersonKey(p))} onClick={() => void add(p)}
+ className={`person-row flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-[13px] hover:bg-[var(--line)] ${i === activeIndex ? 'bg-[var(--line)]' : ''}`}>
+ <Users size={14} aria-hidden="true" className="shrink-0 text-muted" />
+ <span className="min-w-0"><span className="block truncate">{personName(p.name)}</span>
+ {p.email && <span className="block truncate text-xs text-muted">{p.email}</span>}</span>
+ </li>)}
+ </ul>}
{attendeePrivacy(focused, text) && <p data-testid="people-private" className="mt-2 flex items-start gap-2 text-xs leading-relaxed text-muted">
<Lock size={12} strokeWidth={1.75} aria-hidden="true" className="mt-0.5 shrink-0" />
<span>{t('Nothing is sent. This is only for your notes.')}</span>
diff --git a/app/src/shared/searchPeople.ts b/app/src/shared/searchPeople.ts
index eab26a3b..b492e698 100644
--- a/app/src/shared/searchPeople.ts
+++ b/app/src/shared/searchPeople.ts
@@ -1,4 +1,4 @@
-import type { Person } from './types'
+import type { CalEvent, Person } from './types'
import { personEmail } from './people'
import { parseSearchQuery, searchWords, type SearchOptions } from './searchQuery'
@@ -60,3 +60,16 @@ export function matchSearchPeople(query: string, people: Person[], chosen: Perso
}
return { text, matches, suggestions }
}
+
+/** This event's invitees lead, then recently met people, then other invitees that day. */
+export function attendeeSuggestions(query: string, known: Person[], attendees: Person[], me: string, events: CalEvent[] = [], eventId?: string | null): Person[] {
+ const event = events.find(e => e.id === eventId || e.aliases?.includes(eventId!))
+ const people = [...(event?.attendees ?? []), ...known, ...events.filter(e => e !== event).flatMap(e => e.attendees)]
+ const namedEmails = new Set(people.filter(p => p.email?.trim()).map(p => nameKey(p.name)))
+ const excluded = [...attendees, { name: me, email: null }, ...people.filter(p => nameKey(p.name) === nameKey(me))]
+ const candidates = uniqueSearchPeople(people).filter(p => (p.email?.trim() || !namedEmails.has(nameKey(p.name))) && !excluded.some(a =>
+ a.email?.trim() && p.email?.trim() ? personEmail(a.email) === personEmail(p.email) : nameKey(a.name) === nameKey(p.name)))
+ const { matches, suggestions } = matchSearchPeople(query, candidates)
+ const keys = new Set([...matches, ...suggestions].filter(m => !removeSearchSpan(query, m)).map(m => searchPersonKey(m.person)))
+ return candidates.filter(p => keys.has(searchPersonKey(p))).slice(0, 5)
+}
diff --git a/app/test/attendeeSuggestions.test.ts b/app/test/attendeeSuggestions.test.ts
new file mode 100644
index 00000000..36ba9a46
--- /dev/null
+++ b/app/test/attendeeSuggestions.test.ts
@@ -0,0 +1,93 @@
+import { expect, it } from 'vitest'
+import { openStore } from '../src/main/store'
+import { attendeeSuggestions } from '../src/shared/searchPeople'
+
+it('ranks saved attendees by most recent meeting and resolves remembered names', () => {
+ const store = openStore(':memory:')
+ try {
+ const older = { name: 'Guest Alpha', email: '[email protected]' }
+ const newer = { name: 'Guest Beta', email: '[email protected]' }
+ const create = (startedAt: number, attendees: typeof older[]) => store.createMeeting({ title: 'Planning', startedAt,
+ endedAt: startedAt + 1, eventId: null, app: null, attendees, state: 'done' })
+ create(1, [older]); create(2, [newer]); create(3, [newer])
+ const known = store.searchPeople()
+ expect(attendeeSuggestions('Gue', known, [], '')).toEqual([newer, older])
+ expect(attendeeSuggestions('Guest Beta', known, [], '')).toEqual([newer])
+ expect(attendeeSuggestions('beta@', known, [], '')).toEqual([newer])
+ } finally { store.close() }
+})
+
+it('excludes the owner and existing attendees by normalized name or email, deduplicates, and caps at five', () => {
+ const people = Array.from({ length: 9 }, (_, i) => ({ name: `Guest Person${i}`, email: `person${i}@example.test` }))
+ const selected = [{ name: 'Renamed person', email: ' [email protected] ' }, { name: ' GUEST PERSON2 ', email: null }]
+ expect(attendeeSuggestions('Gue', [...people, people[3]], selected, ' guest person0 ')).toEqual(people.slice(3, 8))
+ expect(attendeeSuggestions('', people, [], '')).toEqual([])
+ expect(attendeeSuggestions('Unlisted attendee', people, [], '')).toEqual([])
+})
+
+it('includes calendar-only invitees after saved people and keeps an email when choosing an exact name', () => {
+ const known = { name: 'Guest Beta', email: '[email protected]' }
+ const invitee = { name: 'Guest Alpha', email: '[email protected]' }
+ expect(attendeeSuggestions('Guest', [known, invitee, known], [], '')).toEqual([known, invitee])
+ expect(attendeeSuggestions('Guest Alpha', [known, invitee], [], '')).toEqual([invitee])
+})
+
+
+it('excludes calendar aliases of the owner by their remembered email identity', () => {
+ const owner = { name: 'Guest Example', email: '[email protected]' }
+ const alias = { name: 'Guest', email: '[email protected]' }
+ expect(attendeeSuggestions('Guest', [owner, alias], [], 'Guest Example')).toEqual([])
+})
+
+it('prioritizes this occurrence and its aliases, then recency, then other invitees, before the cap', () => {
+ const people = Array.from({ length: 7 }, (_, i) => ({ name: `Guest ${i}`, email: `guest${i}@example.test` }))
+ const [recent, older, own, other] = people
+ const events = [
+ { id: 'other', title: 'Other event', start: 1, end: 2, url: null, attendees: [other] },
+ { id: 'current', aliases: ['alias'], title: 'Current event', start: 3, end: 4, url: null, attendees: [own, older] },
+ ]
+ for (const id of ['current', 'alias']) {
+ expect(attendeeSuggestions('Guest', [recent, older], [], '', events, id)).toEqual([own, older, recent, other])
+ expect(attendeeSuggestions('Guest', people, [], '', events, id)).toEqual([own, older, recent, other, people[4]])
+ }
+ expect(attendeeSuggestions('Guest', [recent, older], [], '', events, null)).toEqual([recent, older, other, own])
+})
+
+it('hides normalized name-only duplicates in favor of email entries before taking five', () => {
+ const bare = { name: ' Guest Example ', email: null }
+ const first = { name: 'guest example', email: '[email protected]' }
+ const second = { name: 'Guest Example', email: '[email protected]' }
+ for (const people of [[bare, first, second], [first, second, bare]]) {
+ expect(attendeeSuggestions('Guest', people, [], '')).toEqual([first, second])
+ expect(attendeeSuggestions('Guest Example', people, [], '')).toEqual([first, second])
+ expect(attendeeSuggestions('Guest', people, [first], '')).toEqual([second])
+ }
+ expect(attendeeSuggestions('Guest', [bare], [], '')).toEqual([bare])
+ expect(attendeeSuggestions('Guest', [{ ...bare, email: ' ' }, first], [], '')).toEqual([first])
+ const others = Array.from({ length: 5 }, (_, i) => ({ name: `Guest ${i}`, email: null }))
+ expect(attendeeSuggestions('Guest', [bare, first, ...others], [], '')).toEqual([first, ...others.slice(0, 4)])
+})
+
+it('uses the email identity even when its name-only duplicate is an invitee', () => {
+ const bare = { name: 'Guest Example', email: null }
+ const rich = { ...bare, email: '[email protected]' }
+ const event = { id: 'current', title: 'Event', start: 1, end: 2, url: null, attendees: [bare] }
+ expect(attendeeSuggestions('Guest', [rich], [], '', [event], event.id)).toEqual([rich])
+})
+
+it('matches the whole attendee input while preserving distinct identities and invitee order', () => {
+ const first = { name: 'Guest Shared', email: '[email protected]' }
+ const second = { ...first, email: '[email protected]' }
+ const recent = { name: 'Guest Recent', email: '[email protected]' }
+ const known = [recent, { ...first, email: null }, second]
+ const event = { id: 'current', title: 'Event', start: 1, end: 2, url: null, attendees: [first] }
+ for (const query of ['Guest Shared', 'Guest Sha', ' GUEST SHARED ', 'Shared']) {
+ expect(attendeeSuggestions(query, known, [], '', [event], event.id)).toEqual([first, second])
+ expect(attendeeSuggestions(query, known, [first], '', [event], event.id)).toEqual([second])
+ }
+ for (const query of ['Guest Unknown', 'Guest Shared extra', 'extra Guest Shared', 'recent@ invalid']) {
+ expect(attendeeSuggestions(query, known, [], '', [event], event.id)).toEqual([])
+ }
+ expect(attendeeSuggestions('Guest', known, [], '', [event], event.id)).toEqual([first, recent, second])
+ expect(attendeeSuggestions('first@', known, [], '', [event], event.id)).toEqual([first])
+})
diff --git a/app/test/enhance.test.ts b/app/test/enhance.test.ts
index 397745bb..fb990c09 100644
--- a/app/test/enhance.test.ts
+++ b/app/test/enhance.test.ts
@@ -369,3 +369,20 @@ describe('fix round 1', () => {
expect(guessLanguage('ok', 'French')).toBe('French')
})
})
+
+
+it('excludes the owner in the shared title prompt and rejects names despite model instructions', async () => {
+ const me = 'Owner Example'
+ expect(titlePrompt('English', me, [{ name: me, email: null }, { name: 'Guest', email: null }])).toContain('["Guest"]')
+ for (const raw of ['Plan with Owner Example', 'Plan with OWNER', "Example’s plan", 'Plan with Owner Example ' + 'word '.repeat(40)]) {
+ expect(cleanTitle(raw, me)).toBe('')
+ }
+ expect(cleanTitle('Plan with Guest', me)).toBe('Plan with Guest')
+ expect(cleanTitle('Ownerrama plan', me)).toBe('Ownerrama plan')
+ let ask!: (model: Llm) => Promise<string>
+ const llm: Llm = { contextSize: 32000, count: async xs => xs.map(x => x.length), chat: async p =>
+ p.startsWith('Now give this meeting a title') ? 'Plan with Owner Example' : '## Plan\n- **You:** Send the plan.' }
+ await enhance({ meeting: { title: 'Call', attendees: [{ name: me, email: null }] }, me, mine: '',
+ segments: [seg('me', 0, 'Plan the release')], language: 'en', titleLater: a => { ask = a } }, llm, () => {})
+ expect(await ask(llm)).toBe('')
+})
diff --git a/app/test/notes.test.ts b/app/test/notes.test.ts
index 22751fee..e73d002b 100644
--- a/app/test/notes.test.ts
+++ b/app/test/notes.test.ts
@@ -16,7 +16,7 @@ afterEach(() => {
})
const wait = (ms = 5) => new Promise((r) => setTimeout(r, ms))
-function setup(o: { named?: () => Promise<void>; namesWaitMs?: number; reply?: string | ((prompt: string) => string); during?: () => void; load?: Promise<void>; title?: string; recording?: () => boolean; smallMac?: boolean; showLoading?: boolean } = {}) {
+function setup(o: { me?: string; named?: () => Promise<void>; namesWaitMs?: number; reply?: string | ((prompt: string) => string); during?: () => void; load?: Promise<void>; title?: string; recording?: () => boolean; smallMac?: boolean; showLoading?: boolean } = {}) {
const d = mkdtempSync(join(tmpdir(), 'yogurt-notes-'))
dirs.push(d)
const store = openStore(join(d, 'yogurt.db'))
@@ -38,7 +38,7 @@ function setup(o: { named?: () => Promise<void>; namesWaitMs?: number; reply?: s
const notes = hookNotes({
store, queue, model: { llm: async () => { await o.load; return llm }, needsLoad: () => true }, showLoading: o.showLoading,
transcribed: () => transcript, named: o.named, namesWaitMs: o.namesWaitMs, language: () => 'spanish',
- onStop: (fn) => stops.push(fn), send: (v) => sent.push(v), changed: (id) => changed.push(id), peopleRewriteMs: 30,
+ onStop: (fn) => stops.push(fn), send: (v) => sent.push(v), changed: (id) => changed.push(id), peopleRewriteMs: 30, me: () => o.me ?? '',
})
return { store, m, notes, sent, prompts, changed, queue, stop: () => stops.forEach((f) => f(m)), transcribed }
}
@@ -376,3 +376,102 @@ it('inline renaming never rewrites a Summary, even while it is being generated',
expect(s.prompts).toHaveLength(1)
}
})
+
+
+describe('titles after attendee edits', () => {
+ const isTitle = (prompt: string) => prompt.startsWith('Now give this meeting a title')
+ const reply = (prompt: string) => isTitle(prompt) ? 'Planning with Guest' : '## Plan\n- **You:** Send the plan.'
+ it.each(['auto', 'user', 'calendar', 'imported', 'generic'] as const)('debounces edits and refreshes only an auto title: %s', async titleSource => {
+ const s = setup({ reply, me: 'Owner Example' })
+ s.store.updateMeeting(s.m.id, { titleSource, state: 'done' })
+ s.notes.setEnhanced(s.m.id, 'Keep my exact summary.')
+ for (const name of ['Colleague', 'Guest']) {
+ s.store.updateMeeting(s.m.id, { attendees: [{ name, email: null }] })
+ s.notes.applyPeople(s.m.id)
+ await wait(10)
+ }
+ expect(s.prompts).toEqual([])
+ await wait(90)
+ expect(s.prompts).toHaveLength(titleSource === 'auto' ? 1 : 0)
+ expect(s.store.notes(s.m.id).enhanced).toBe('Keep my exact summary.')
+ if (titleSource === 'auto') {
+ expect(s.prompts[0]).toContain('["Guest"]')
+ expect(s.prompts[0]).toContain('Owner Example')
+ expect(s.store.meeting(s.m.id)!.title).toBe('Planning with Guest')
+ } else expect(s.store.meeting(s.m.id)!.title).toBe(s.m.title)
+ })
+ it('an unedited summary refresh asks for only one title', async () => {
+ const s = setup({ reply })
+ s.store.updateMeeting(s.m.id, { titleSource: 'auto', state: 'done' })
+ s.store.setNotes(s.m.id, { enhanced: 'Old summary', edited: false })
+ s.store.setWrittenWith(s.m.id, 'members:[]')
+ s.store.updateMeeting(s.m.id, { attendees: [{ name: 'Guest', email: null }] })
+ s.notes.applyPeople(s.m.id)
+ await wait(120)
+ expect(s.prompts.filter(isTitle)).toHaveLength(1)
+ expect(s.prompts.filter(p => !isTitle(p))).toHaveLength(1)
+ expect(s.store.meeting(s.m.id)!.title).toBe('Planning with Guest')
+ })
+ it('an inline rename refreshes the auto title without rewriting the summary', async () => {
+ const s = setup({ reply })
+ const before = [{ name: 'Colleague', email: null }], after = [{ name: 'Guest', email: null }]
+ s.store.updateMeeting(s.m.id, { titleSource: 'auto', state: 'done', attendees: before })
+ s.store.setNotes(s.m.id, { enhanced: 'Keep this summary' })
+ s.store.renameAttendee(s.m.id, 0, 'Guest')
+ s.notes.renamed(s.m.id, before, after)
+ await wait(100)
+ expect(s.prompts).toHaveLength(1)
+ expect(s.store.notes(s.m.id).enhanced).toBe('Keep this summary')
+ })
+ it('does not overwrite a title renamed while the model answers', async () => {
+ const s = setup({ reply, during: () => s.store.updateMeeting(s.m.id, { title: 'My heading', titleSource: 'user' }) })
+ s.store.updateMeeting(s.m.id, { titleSource: 'auto' })
+ s.notes.setEnhanced(s.m.id, 'Keep the summary')
+ s.notes.applyPeople(s.m.id)
+ await wait(100)
+ expect(s.store.meeting(s.m.id)!.title).toBe('My heading')
+ })
+ it('discards a stale attendee answer and asks with the latest people', async () => {
+ let changed = false
+ const s = setup({ reply, during: () => {
+ if (changed) return
+ changed = true
+ s.store.updateMeeting(s.m.id, { attendees: [{ name: 'Guest', email: null }] })
+ s.notes.applyPeople(s.m.id)
+ } })
+ s.store.updateMeeting(s.m.id, { titleSource: 'auto' })
+ s.notes.setEnhanced(s.m.id, 'Keep the summary')
+ s.notes.applyPeople(s.m.id)
+ await wait(160)
+ expect(s.prompts).toHaveLength(2)
+ expect(s.changed).toHaveLength(1)
+ expect(s.prompts[1]).toContain('["Guest"]')
+ })
+ it('rejects an owner name from the title-only path', async () => {
+ const s = setup({ me: 'Owner Example', reply: 'Planning with Owner' })
+ s.store.updateMeeting(s.m.id, { titleSource: 'auto' })
+ s.notes.setEnhanced(s.m.id, 'Keep the summary')
+ s.notes.applyPeople(s.m.id)
+ await wait(100)
+ expect(s.store.meeting(s.m.id)!.title).toBe(s.m.title)
+ })
+})
+
+
+it('still refreshes the auto title when an editor keeps changes over an attendee summary rewrite', async () => {
+ let edited = false
+ const s = setup({ reply: p => p.startsWith('Now give this meeting a title') ? 'Planning with Guest' : '## Plan\n- **You:** Send it.', during: () => {
+ if (edited) return
+ edited = true
+ s.notes.setEnhanced(s.m.id, 'My retained edit')
+ } })
+ s.store.updateMeeting(s.m.id, { titleSource: 'auto', state: 'done' })
+ s.store.setNotes(s.m.id, { enhanced: 'Old summary', edited: false })
+ s.store.setWrittenWith(s.m.id, 'members:[]')
+ s.store.updateMeeting(s.m.id, { attendees: [{ name: 'Guest', email: null }] })
+ s.notes.applyPeople(s.m.id)
+ await wait(120)
+ expect(s.store.notes(s.m.id).enhanced).toBe('My retained edit')
+ expect(s.store.meeting(s.m.id)!.title).toBe('Planning with Guest')
+ expect(s.prompts.filter(p => p.startsWith('Now give this meeting a title'))).toHaveLength(1)
+})