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.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
Call names (Meet): a talking mark that stays on a tile while others come and go (my own tile, a pinned or presenting one) no longer counts as talking, so the one other person marked is named; "(You)" after a name marks my own tile, and the log pictures the window again once someone is marked talking, deep enough to show the tiles (#112)
christianmat723e8674d19a
diff --git a/app/src/main/callNames/attribute.ts b/app/src/main/callNames/attribute.tsindex 54c074bf..c7039606 100644--- a/app/src/main/callNames/attribute.ts+++ b/app/src/main/callNames/attribute.ts@@ -33,8 +33,36 @@ const isMe = (name: string, s: CallSample, o: Opts) => {return (s.me != null && norm(s.me) === n) || (o.myNames ?? []).some((m) => m && norm(m) === n)}+// A talking mark that stays on a tile while others come and go is not talking (#112: an 8-person Meet read "2 of 8"+// or "3 of 8" for the whole call and named none of 370 lines). Meet left its mark on two tiles all along (my own, a+// pinned or presenting one) and the third came and went with whoever spoke. Over the readings around a line, a name+// marked in nearly all of them, in a stretch where two or more are marked most of the time, is dropped. One person+// marked alone for minutes is someone giving a talk, and stays.+/** the readings around a line that tell a steady mark: two and a half minutes each side */+const STEADY_SPAN_MS = 150_000+/** fewer readings than this (about 20 s) can't tell a mark that stays from one that hasn't moved yet */+const STEADY_MIN = 40+/** marked in this share of the readings, or more */+const STEADY_SHARE = 0.8+/** and two or more marked at once in this share of them */+const CROWDED_SHARE = 0.5++function steadyMarks(sorted: CallSample[], atMs: number, o: Opts): Set<string> {+ const seen = sorted.filter((s) => s.ok !== false && s.participants.length && Math.abs(s.ms - atMs) <= STEADY_SPAN_MS)+ if (seen.length < STEADY_MIN) return new Set()+ const marked = new Map<string, number>()+ let crowded = 0+ for (const s of seen) {+ const others = new Set(s.speaking.filter((p) => !isMe(p, s, o)).map(norm))+ if (others.size >= 2) crowded+++ for (const p of others) marked.set(p, (marked.get(p) ?? 0) + 1)+ }+ if (crowded < CROWDED_SHARE * seen.length) return new Set()+ return new Set([...marked].filter(([, n]) => n >= STEADY_SHARE * seen.length).map(([p]) => p))+}+/** who the other side was at one reading, or null when it can't be told */-function whoAt(s: CallSample, o: Opts): string | null {+function whoAt(s: CallSample, o: Opts, steady: Set<string> = new Set()): string | null {if (s.ok === false) return nullconst people = [...new Map(s.participants.map((p) => [norm(p), p])).values()]const roster = new Set(people.map(norm))@@ -46,7 +74,7 @@ function whoAt(s: CallSample, o: Opts): string | null {const mine = people.filter((p) => isMe(p, s, o))if (mine.length === 1) return people.find((p) => !isMe(p, s, o))!}- const others = [...new Set(s.speaking.filter((p) => !isMe(p, s, o)))]+ const others = [...new Set(s.speaking.filter((p) => !isMe(p, s, o) && !steady.has(norm(p))))]return others.length === 1 ? others[0] : null}@@ -55,9 +83,10 @@ export function nameFor(span: { startMs: number; endMs: number }, samples: CallSif (!samples.length) return nullconst sorted = [...samples].sort((a, b) => a.ms - b.ms)const at = (i: number) => [sorted[i].ms, Math.min(sorted[i + 1]?.ms ?? Infinity, sorted[i].ms + HOLD_MS)] as const+ const steady = steadyMarks(sorted, (span.startMs + span.endMs) / 2, o)// a line too short to measure: whoever it was the moment it startedif (span.endMs <= span.startMs) {- for (let i = sorted.length - 1; i >= 0; i--) { const [a, b] = at(i); if (a <= span.startMs) return span.startMs < b ? whoAt(sorted[i], o) : null }+ for (let i = sorted.length - 1; i >= 0; i--) { const [a, b] = at(i); if (a <= span.startMs) return span.startMs < b ? whoAt(sorted[i], o, steady) : null }return null}const time = new Map<string, number>()@@ -65,7 +94,7 @@ export function nameFor(span: { startMs: number; endMs: number }, samples: CallSconst [a, b] = at(i)const overlap = Math.min(b, span.endMs) - Math.max(a, span.startMs)if (overlap <= 0) continue- const who = whoAt(sorted[i], o)+ const who = whoAt(sorted[i], o, steady)if (who) time.set(who, (time.get(who) ?? 0) + overlap)}const [best] = [...time].sort((x, y) => y[1] - x[1])diff --git a/app/src/main/callNames/index.ts b/app/src/main/callNames/index.tsindex 2dec4464..e423d89c 100644--- a/app/src/main/callNames/index.ts+++ b/app/src/main/callNames/index.ts@@ -65,7 +65,7 @@ const MAX_RESTARTS = 20const LOGGED_CHANGES = 30type Sample = Omit<CallSample, 'ms'> & { t: number }-type Session = { app: string | null; ids: string[]; pids?: number[]; heardAt: number; quietMs: number; restarts: number; samples: Sample[]; priorLines: Set<number>; watch?: { stop(): void }; everyApp: boolean; offset?: number; startedAt: number; pictured: boolean; missPictured?: boolean; picturedPeople?: boolean; errors: Set<string>; last: string; logged: number; /** a call window with people was read (Zoom, Teams) */ windowSeen?: CallKind; /** since when the readings say that window is gone, and the last one that said so */ goneSince?: number; goneAt?: number }+type Session = { app: string | null; ids: string[]; pids?: number[]; heardAt: number; quietMs: number; restarts: number; samples: Sample[]; priorLines: Set<number>; watch?: { stop(): void }; everyApp: boolean; offset?: number; startedAt: number; pictured: boolean; missPictured?: boolean; picturedPeople?: boolean; picturedTalking?: boolean; errors: Set<string>; last: string; logged: number; /** a call window with people was read (Zoom, Teams) */ windowSeen?: CallKind; /** since when the readings say that window is gone, and the last one that said so */ goneSince?: number; goneAt?: number }export function hookCallNames(p: {store: Pick<Store, 'meeting' | 'segments' | 'setSegmentSpeakers' | 'updateMeeting'>@@ -137,10 +137,14 @@ export function hookCallNames(p: {const { byMute, ...r } = readCall(kind, l.windows)// The first reading of each meeting goes to the log in short, so a real call shows what its app gives. Teams opens// the mic on its join screen, minutes before the call (#138), so the first reading with people in it goes there too.+ // Meet's lobby shows people too (#112), so the first reading with someone marked talking goes there as well, long+ // enough to reach the tiles past the browser's own buttons: it shows where the marks sit.const people = r.participants.length > 0- if (!s.pictured || (people && !s.picturedPeople)) {- s.pictured = true; s.picturedPeople = people- log(`call names: reading ${l.app} (${kind}), its window in short:\n${summarize(l.windows)}`)+ const talking = r.speaking.length > 0+ if (!s.pictured || (people && !s.picturedPeople) || (talking && !s.picturedTalking)) {+ s.pictured = true; s.picturedPeople ||= people+ if (talking) s.picturedTalking = true+ log(`call names: reading ${l.app} (${kind}), its window in short:\n${summarize(l.windows, talking ? 200 : 60)}`)}// A stage can show fewer people than are in the call (a screen share, another layout: #83 went "0 of 13", "0 of 2").// The most seen in the last minute stands for the call, so me and one other is no call of two, and who is muted@@ -191,7 +195,7 @@ export function hookCallNames(p: {log(`call names: the call is in ${m.app}, reading only it`)if (!ids.length) return// the log says again what the call's own app shows, even when it reads as what the last app did (#83)- s.pictured = false; s.picturedPeople = false; s.last = ''+ s.pictured = false; s.picturedPeople = false; s.picturedTalking = false; s.last = ''begin(m.id, s)})@@ -237,7 +241,7 @@ export function hookCallNames(p: {if (s.watch && s.app && !s.pids && p.micPids?.(s.app).length) {log(`call names: ${s.app} is on the mic now, reading only its process`)s.watch.stop(); s.watch = undefined- s.samples = []; s.heardAt = now(); s.pictured = false; s.picturedPeople = false+ s.samples = []; s.heardAt = now(); s.pictured = false; s.picturedPeople = false; s.picturedTalking = falses.windowSeen = undefined; s.goneSince = undefined; s.goneAt = undefinedbegin(id, s)continuediff --git a/app/src/main/callNames/parse.ts b/app/src/main/callNames/parse.tsindex eb865b8a..1472157f 100644--- a/app/src/main/callNames/parse.ts+++ b/app/src/main/callNames/parse.ts@@ -195,6 +195,8 @@ const isLive = (n: AxNode) => LIVE.has(n.r) || (!!n.s && LIVE.has(n.s))function readMeet(windows: AxWindow[], o: { talkingClasses?: string[] }): CallReading {const marks = new Set(o.talkingClasses ?? MEET_TALKING_CLASSES)const groups = new Map<AxNode, string[]>()+ /** names Meet wrote with "(You)" after them: the person's own tile or People row (#112) */+ const mine = new Set<string>()for (const w of windows) {if (w.title && !/\bMeet\b/.test(w.title)) continueconst skip = new Set((w.title ?? '').split(/\s+[-–—]\s+/).map(low))@@ -204,6 +206,7 @@ function readMeet(windows: AxWindow[], o: { talkingClasses?: string[] }): CallReif (!text) returnconst name = meetName(text)if (!name || skip.has(low(name))) return+ if (/\(you\)\s*$/i.test(text)) mine.add(low(name))const root = up[up.length - TILE_UP]groups.set(root, [...(groups.get(root) ?? []), name])})@@ -214,8 +217,8 @@ function readMeet(windows: AxWindow[], o: { talkingClasses?: string[] }): CallReconst one = uniq(names)if (one.length !== 1) continueparticipants.push(one[0])- // Meet labels the person's own tile "You"- if (low(one[0]) === 'you') me = one[0]+ // Meet labels the person's own tile "You", or their name with "(You)" after it+ if (low(one[0]) === 'you' || mine.has(low(one[0]))) me = one[0]let talking = falsewalk(root, (x) => { if (x.c?.some((c) => marks.has(c))) talking = true })if (talking) speaking.push(one[0])@@ -471,6 +474,7 @@ export function redact(text: string): string {* A short picture of the call window for main.log: role counts, then each element's role, id, classes and words.* main.log is pasted into public issues, so names, captions and titles never go in: only the app's own words do.*/+const MARKS = new Set([...MEET_TALKING_CLASSES, TEAMS_TALKING_CLASS])export function summarize(windows: AxWindow[], max = 60): string {const roles = new Map<string, number>()const lines: string[] = []@@ -479,7 +483,11 @@ export function summarize(windows: AxWindow[], max = 60): string {walk(w.tree, (n, up) => {roles.set(n.r, (roles.get(n.r) ?? 0) + 1)const said = texts(n).map(redact)- if ((said.length || n.i) && lines.length < max) lines.push(`${' '.repeat(Math.min(up.length, 12))}${n.r}${n.i ? `#${n.i}` : ''} ${said.map((x) => JSON.stringify(x)).join(' ')}${n.c?.length ? ` .${n.c.slice(0, 6).join('.')}` : ''}`)+ // an element carrying a talking mark shows too, words or not, so the log says where the marks sit (#112)+ const mark = n.c?.some((c) => MARKS.has(c))+ // past the indent cap the depth is written out, since a Meet tile is told from the page by how deep its name is+ const indent = `${' '.repeat(Math.min(up.length, 12))}${up.length > 12 ? `@${up.length} ` : ''}`+ if ((said.length || n.i || mark) && lines.length < max) lines.push(`${indent}${n.r}${n.i ? `#${n.i}` : ''}${said.map((x) => ` ${JSON.stringify(x)}`).join('')}${n.c?.length ? ` .${n.c.slice(0, 6).join('.')}` : ''}`)})}return [`roles: ${[...roles].sort((a, b) => b[1] - a[1]).map(([r, n]) => `${r}=${n}`).join(' ')}`, ...lines].join('\n')diff --git a/app/test/callAttribute.test.ts b/app/test/callAttribute.test.tsindex c678fa71..9a22e059 100644--- a/app/test/callAttribute.test.ts+++ b/app/test/callAttribute.test.ts@@ -82,6 +82,44 @@ describe('nameFor: who the other side was, from what the call app showed', () =>})})+// ---- #112: an 8-person Meet in Chrome read "talking 2 of 8" or "3 of 8" for the whole call, never 1, and named none+// of 370 lines. Two tiles kept Meet's talking mark all along (my own tile, a pinned or presenting one); the third mark+// came and went with whoever spoke. Me was never known. Made-up names, the log's shape. ----+describe('nameFor: a mark that never leaves a tile is not talking (#112)', () => {+ const room = ['Theo Lane', 'Pia Stone', 'Dana Smith', 'Ann Lee', 'Bo Park', 'Cy Diaz', 'Eve Ruiz', 'Gus Hart']+ const steady = ['Theo Lane', 'Pia Stone']+ /** five minutes of the call: the two steady marks always on, Dana speaking 60-90 s and Ann 200-230 s */+ const call = [...run(0, 60_000, { participants: room, speaking: steady }), ...run(60_000, 90_000, { participants: room, speaking: [...steady, 'Dana Smith'] }),+ ...run(90_000, 200_000, { participants: room, speaking: steady }), ...run(200_000, 230_000, { participants: room, speaking: ['Ann Lee', ...steady] }),+ ...run(230_000, 300_000, { participants: room, speaking: steady })]++ it('names the one person marked besides the marks that stay all call', () => {+ expect(nameFor({ startMs: 62_000, endMs: 70_000 }, call)).toBe('Dana Smith')+ expect(nameFor({ startMs: 205_000, endMs: 215_000 }, call)).toBe('Ann Lee')+ })++ it('with only the steady marks on, the line is Them, even when one of them drops for a moment', () => {+ expect(nameFor({ startMs: 120_000, endMs: 130_000 }, call)).toBeNull()+ const blip = call.map((x) => (x.ms >= 140_000 && x.ms < 146_000 ? { ...x, speaking: ['Pia Stone'] } : x))+ expect(nameFor({ startMs: 140_000, endMs: 146_000 }, blip)).toBeNull()+ })++ it('two people marked at once besides the steady ones is still Them', () => {+ const both = call.map((x) => (x.ms >= 60_000 && x.ms < 90_000 ? { ...x, speaking: [...steady, 'Dana Smith', 'Bo Park'] } : x))+ expect(nameFor({ startMs: 62_000, endMs: 70_000 }, both)).toBeNull()+ })++ it('one person talking at length with nobody else marked is still named (a talk, not a stuck mark)', () => {+ const talk = run(0, 300_000, { participants: room, speaking: ['Dana Smith'] })+ expect(nameFor({ startMs: 100_000, endMs: 110_000 }, talk)).toBe('Dana Smith')+ })++ it('a few seconds of two marks together are not enough to call either steady', () => {+ const tl = [...run(0, 4000, { ...meetingOf3, speaking: ['Ann Lee', 'Dana Smith'] }), ...run(4000, 8000, { ...meetingOf3, speaking: ['Dana Smith'] })]+ expect(nameFor({ startMs: 4000, endMs: 8000 }, tl)).toBe('Dana Smith')+ })+})+describe('othersIn: everyone seen in the call but the person using Yogurt', () => {it('lists each other name once, in the order first seen', () => {const tl = [...run(0, 1000, meetingOf3), ...run(1000, 2000, { participants: ['Alex Morgan', 'Bo Park', 'Dana Smith'], me: 'Alex Morgan', speaking: ['Bo Park'] })]diff --git a/app/test/callNames.test.ts b/app/test/callNames.test.tsindex 1f4d2ed4..16c6765c 100644--- a/app/test/callNames.test.ts+++ b/app/test/callNames.test.ts@@ -411,6 +411,26 @@ describe('hookCallNames', () => {expect(s.logs.join('\n')).not.toContain('Dana Smith')})+ it('pictures a Meet window again the first time someone is marked talking, deep enough to show the tiles: the lobby shows people too (#112)', () => {+ const s = setup({ app: 'Chrome' })+ s.start()+ const tile = (name: string, talking: boolean): AxNode => {+ let n: AxNode = { r: 'AXStaticText', v: name }+ for (let i = 0; i < 6; i++) n = { r: 'AXGroup', k: [n] }+ return { r: 'AXGroup', c: talking ? ['v5h6Xc'] : [], k: [n] }+ }+ const page = (tiles: AxNode[]): WatchLine['windows'] => [{ title: 'Meet - abc-defg-hij', tree: { r: 'AXWindow', k: [{ r: 'AXWebArea', k: [{ r: 'AXGroup', k: [+ ...Array.from({ length: 70 }, (_, i): AxNode => ({ r: 'AXButton', d: `Button ${i}` })), ...tiles] }] }] } }]+ s.emit({ t: 1_000_000, app: 'com.google.Chrome', windows: page([tile('Dana Smith', false), tile('Ann Lee', false)]) })+ s.emit({ t: 1_000_500, app: 'com.google.Chrome', windows: page([tile('Dana Smith', true), tile('Ann Lee', false)]) })+ s.emit({ t: 1_001_000, app: 'com.google.Chrome', windows: page([tile('Dana Smith', false), tile('Ann Lee', true)]) })+ const pictures = s.logs.filter((l) => l.startsWith('call names: reading com.google.Chrome (meet), its window in short'))+ expect(pictures).toHaveLength(2)+ expect(pictures[1]).toContain('.v5h6Xc')+ expect(pictures[1]).toContain('AXStaticText "‹10›"')+ expect(s.logs.join('\n')).not.toContain('Dana Smith')+ })+it('a meeting in an app it can\'t read starts no watch', async () => {const s = setup({ app: 'FaceTime' })s.start()diff --git a/app/test/callParse.test.ts b/app/test/callParse.test.tsindex 3cf35343..3a1779d2 100644--- a/app/test/callParse.test.ts+++ b/app/test/callParse.test.ts@@ -150,6 +150,11 @@ describe('Google Meet', () => {.toEqual(['Dana Smith', 'Ana María de la Cruz', 'Mary-Jane O\'Neil', 'J. R. Smith', 'Ludwig van Beethoven', '李雷', 'jiwon', 'Ann Lee'])})+ it('"(You)" after a name marks my own tile, so it never counts as the other side (#112)', () => {+ const r = readCall('meet', [meetWindow([meetTile('Theo Lane (You)', ['v5h6Xc']), meetTile('Dana Smith', ['v5h6Xc'])])])+ expect(r).toEqual({ speaking: ['Theo Lane', 'Dana Smith'], participants: ['Theo Lane', 'Dana Smith'], me: 'Theo Lane' })+ })+it('only windows showing a Meet call are read', () => {expect(readCall('meet', [meetWindow([meetTile('Dana Smith', ['v5h6Xc'])], 'Inbox - Gmail')]).participants).toEqual([])})@@ -486,6 +491,13 @@ describe('summarize: a short picture of the tree for the log', () => {expect(s).toContain('window "Meet - ‹12›"')expect(s).not.toContain('abc-defg-hij')})+ it('shows how deep a line is past the indent cap, so a Meet tile can be told from the page around it (#112)', () => {+ let n: AxNode = node('AXStaticText', { v: 'Dana Smith' })+ for (let i = 0; i < 20; i++) n = node('AXGroup', i === 5 ? { c: ['v5h6Xc'] } : {}, n)+ const s = summarize([win(node('AXWindow', {}, n), 'Meet - abc-defg-hij')])+ expect(s).toContain('@21 AXStaticText "‹10›"')+ expect(s).toContain('@15 AXGroup .v5h6Xc')+ })it('says which windows are minimised, so a call hidden in one shows in the log (#138)', () => {const s = summarize([{ ...win(node('AXWindow', {}), 'Microsoft Teams'), minimized: true }, win(node('AXWindow', {}), 'Microsoft Teams')])expect(s).toContain('window "Microsoft Teams" minimized')