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 (Teams): a 1:1 call names the other side after its one other person, from the window title or their tile, with nobody marked as talking and no own name set, and a tile whose text is just the name counts (#83)
christianmat38553448f908
diff --git a/app/src/main/callNames/parse.ts b/app/src/main/callNames/parse.tsindex 0d182958..1cbc40a4 100644--- a/app/src/main/callNames/parse.ts+++ b/app/src/main/callNames/parse.ts@@ -274,12 +274,24 @@ function teamsPersona(label: string): { name: string; speaking: boolean } | null// The call window's video tiles (new Teams on Windows, #83: a German call): each tile is a menu item whose label starts// with the person's name, then Teams' words ("Name, Video ist aus, Kontextmenü ist verfügbar"), and it holds a label// with just the name. That shape is the same in every language, so the name comes from it and not from words. A menu-// that opens (settings, a person's card) is drawn in Fluent's layer host and never read.+// that opens (settings, a person's card) is drawn in Fluent's layer host and never read. In a 1:1 call (0.3.68) the tile's+// text is the name alone; such a tile counts only in the call window (it has the hang-up button) and outside toolbars,+// where a menu item that is just its label is a command.const TEAMS_TILE = new Set(['menu item', 'AXMenuItem'])const TEAMS_POPUPS = 'fluent-default-layer-host'+const TEAMS_BARS = new Set(['tool bar', 'menu bar', 'title bar', 'AXToolbar', 'AXMenuBar'])+/** only a 1:1 call has hold and transfer (a meeting or group call has neither), so it has exactly one other person */+const TEAMS_ONE_TO_ONE = new Set(['hold-button', 'transfer-button', 'consultative-transfer-button'])+/** "Anna Becker | Microsoft Teams": a 1:1 call's window is titled with the other person's name */+const TEAMS_TITLE = /^([^|]+?)\s*\|\s*Microsoft Teams(?:\s+[-–—].*)?$/+const titleName = (title: string | undefined): string | null => {+ const m = TEAMS_TITLE.exec((title ?? '').normalize('NFKC').trim())+ const name = m ? cleanTeams(m[1]) : ''+ return name.length >= 2 && name.length <= 60 && /\p{L}/u.test(name) && !/[\d+:/@]/.test(name) && name.split(/\s+/).length <= 5 ? name : null+}/** a video tile's person, or null when the menu item isn't one */-function teamsTile(n: AxNode): { name: string; speaking: boolean; me: boolean } | null {+function teamsTile(n: AxNode, alone: boolean): { name: string; speaking: boolean; me: boolean } | null {const label = (n.t ?? n.d ?? '').normalize('NFKC').trim()const inner: string[] = [], heads: string[] = []walk(n, (x) => {@@ -289,10 +301,10 @@ function teamsTile(n: AxNode): { name: string; speaking: boolean; me: boolean }if (STATIC_TEXT.has(x.r)) heads.push(...said)})for (const head of heads) {- if (!head || head === label || !label.startsWith(head)) continue+ if (!head || !label.startsWith(head) || (head === label && !alone)) continueconst rest = label.slice(head.length)- // the rest is Teams' words after a comma, or another text of the tile run together with the name- if (!/^\s*,/.test(rest) && !inner.includes(rest.trim())) continue+ // the rest is Teams' words after a comma, or another text of the tile run together with the name, or nothing+ if (rest && !/^\s*,/.test(rest) && !inner.includes(rest.trim())) continueconst name = cleanTeams(head)if (name.length < 2 || name.length > 60 || !/\p{L}/u.test(name) || /[+\d]/.test(name)) continuereturn { name, speaking: rest.split(/\s*,\s*/).some((f) => TEAMS_SAYS.test(f)), me: TEAMS_ME.test(head) }@@ -304,10 +316,13 @@ function readTeams(windows: AxWindow[]): CallReading {const speaking: string[] = [], participants: string[] = []let me: string | null = nullfor (const w of windows) {+ let call = false, oneToOne = false+ walk(w.tree, (n) => { if (n.i === 'hangup-button') call = true; if (n.i && TEAMS_ONE_TO_ONE.has(n.i)) oneToOne = true })+ const tiles: string[] = []walk(w.tree, (n, up) => {if (n.i === TEAMS_POPUPS || up.some((a) => a.i === TEAMS_POPUPS)) return- const tile = TEAMS_TILE.has(n.r) ? teamsTile(n) : null- if (tile) { participants.push(tile.name); if (tile.speaking) speaking.push(tile.name); if (tile.me) me = tile.name }+ const tile = TEAMS_TILE.has(n.r) ? teamsTile(n, call && !up.some((a) => TEAMS_BARS.has(a.r))) : null+ if (tile) { participants.push(tile.name); tiles.push(tile.name); if (tile.speaking) speaking.push(tile.name); if (tile.me) me = tile.name }const roster = inTeamsRoster(n, up)for (const label of texts(n)) {for (const re of TEAMS_SPEAKING) { const m = re.exec(label); if (m) { const name = cleanTeams(m[1]); if (name.length >= 2 && !/^(you|me|sie|du|ich)\b/i.test(name)) speaking.push(name) } }@@ -317,6 +332,14 @@ function readTeams(windows: AxWindow[]): CallReading {if (mine) { me = cleanTeams(mine[1]); participants.push(me) }}})+ // A 1:1 call has one other person, so the call's sound is theirs, marked or not. The title says who; a tile alone+ // does when the title can't. A tile and a title that disagree name nobody.+ if (call && oneToOne && !speaking.length) {+ const others = uniq(tiles).filter((t) => !me || low(t) !== low(me))+ const titled = titleName(w.title)+ const other = titled ? (!others.length || others.some((t) => low(t) === low(titled)) ? titled : null) : others.length === 1 ? others[0] : null+ if (other) { speaking.push(other); participants.push(other) }+ }}return { speaking: uniq(speaking), participants: uniq(participants.filter((p) => p.length >= 2)), me }}diff --git a/app/test/callNames.test.ts b/app/test/callNames.test.tsindex 5c3380d3..7e0095fe 100644--- a/app/test/callNames.test.ts+++ b/app/test/callNames.test.ts@@ -40,7 +40,7 @@ const webexCurrentWindows = (): WatchLine['windows'] => [{ title: 'Webex meeting] }] } }]const webexLine = (t: number): WatchLine => ({ t, app: 'Cisco-Systems.Spark', windows: webexWindows() })-function setup(o: { app?: string | null; attendees?: Meeting['attendees']; micPids?: Record<string, number[]> } = {}) {+function setup(o: { app?: string | null; attendees?: Meeting['attendees']; micPids?: Record<string, number[]>; myNames?: string[] } = {}) {const root = mkdtempSync(join(tmpdir(), 'yogurt-callnames-')); dirs.push(root)const store = openStore(join(root, 'yogurt.db')); stores.push(store)const m = store.createMeeting({ title: 'Sync', startedAt: 1_000_000, endedAt: null, eventId: null, app: o.app === undefined ? 'Zoom' : o.app, attendees: o.attendees ?? [], state: 'recording' })@@ -55,7 +55,7 @@ function setup(o: { app?: string | null; attendees?: Meeting['attendees']; micPilet transcribed!: () => voidconst done = new Promise<void>((r) => { transcribed = r })const hook = hookCallNames({- store, myNames: () => ['Alex Morgan'], transcribed: () => done, changed: (id) => changed.push(id), log: (s) => logs.push(s), now: () => clock, every: () => {},+ store, myNames: () => o.myNames ?? ['Alex Morgan'], transcribed: () => done, changed: (id) => changed.push(id), log: (s) => logs.push(s), now: () => clock, every: () => {},watch: (ids, onLine, pids) => { watched.push(ids); watchedPids.push(pids); emit = onLine; return { stop: () => { stopped++ } } },micPids: (app) => micPids[app] ?? [],onStart: (fn) => starts.push(fn), onStop: (fn) => stops.push(fn), onCapture: (fn) => captures.push(fn), onBind: (fn) => binds.push(fn),@@ -260,6 +260,24 @@ describe('hookCallNames', () => {expect(s.watchedPids).toHaveLength(2)})+ it('a 1:1 Teams call names every line of the other side after that person, with my own name not set (#83)', async () => {+ const s = setup({ app: 'Teams', myNames: [] })+ s.start()+ s.audio(0, 1_000_100)+ s.store.addSegments([+ { meetingId: s.m.id, track: 'them', startMs: 1000, endMs: 3000, text: 'Hallo.', speaker: null },+ { meetingId: s.m.id, track: 'them', startMs: 6000, endMs: 9000, text: 'Bis dann.', speaker: null },+ ])+ const tree: AxNode = { r: 'frame', k: [+ { r: 'push button', i: 'hold-button', t: 'Halten' }, { r: 'push button', i: 'hangup-button', t: 'Auflegen' },+ { r: 'menu item', t: 'Anna Becker', k: [{ r: 'label', t: 'Anna Becker' }] },+ ] }+ for (let t = 1_000_000; t < 1_011_000; t += 500) s.emit({ t, app: 'ms-teams.exe', windows: [{ title: 'Anna Becker | Microsoft Teams', tree }] })+ s.stop(); s.transcribed()+ await s.hook.finished(s.m.id)+ expect(s.store.segments(s.m.id).map((x) => x.speaker)).toEqual(['Anna Becker', 'Anna Becker'])+ })+it('reads Webex roster names during a call', () => {const s = setup({ app: 'Webex' })s.start()diff --git a/app/test/callParse.test.ts b/app/test/callParse.test.tsindex d16d0ae9..7b42ac83 100644--- a/app/test/callParse.test.ts+++ b/app/test/callParse.test.ts@@ -253,9 +253,14 @@ describe('Microsoft Teams on Windows, in any language (#83)', () => {it('never takes a menu that opened (settings, a shortcut) or a shared screen for a person', () => {const r = readCall('teams', [germanTeams()])for (const not of ['Einstellungen', 'Kamera einschalten', 'Bildschirmfreigabe']) expect(r.participants).not.toContain(not)- // a lone menu item whose label is all of it is a command, not a tile+ // a menu item whose label is all of it is a tile only in the call window, outside toolbars and opened menusconst plain = win(node('frame', {}, node('menu item', { t: 'Bericht' }, node('label', { t: 'Bericht' }))))expect(readCall('teams', [plain]).participants).toEqual([])+ const menus = germanTeams([node('tool bar', { i: 'horizontalMiddleEnd' }, node('menu item', { t: 'Bericht' }, node('label', { t: 'Bericht' })))])+ expect(readCall('teams', [menus]).participants).not.toContain('Bericht')+ const popup = win(node('frame', {}, node('push button', { i: 'hangup-button', t: 'Verlassen' }),+ node('panel', { i: 'fluent-default-layer-host' }, node('menu', {}, node('menu item', { t: 'Bericht' }, node('label', { t: 'Bericht' }))))))+ expect(readCall('teams', [popup]).participants).toEqual([])})it('a call of two: the tiles give both people, so the other one is named', () => {const two = win(node('frame', {}, node('push button', { i: 'hangup-button', t: 'Verlassen' }),@@ -274,6 +279,40 @@ describe('Microsoft Teams on Windows, in any language (#83)', () => {})})+// ---- a 1:1 Teams call on Windows (#83, 0.3.68): hold, transfer and dial pad, one tile whose text is just the name ----+const oneToOne = (title: string | undefined, tiles: string[]) => win(node('frame', { t: title },+ node('document web', { i: 'RootWebArea' },+ node('panel', { i: 'app' },+ node('tool bar', { i: 'horizontalMiddleEnd' },+ node('push button', { i: 'microphone-button', t: 'Stummschalten (Strg+Umschalt+M)' }),+ node('push button', { i: 'dialpad-button', t: 'Wähltastatur' }),+ node('push button', { i: 'hold-button', t: 'Halten' }),+ node('push button', { i: 'transfer-button', t: 'Weiterleiten' })),+ node('panel', { i: 'horizontalEnd' }, node('push button', { i: 'hangup-button', t: 'Auflegen' })),+ node('panel', { t: 'Besprechungsansicht' },+ node('image', { i: 'menurp0g', c: ['fui-Primitive', 'vdi-dynamic-occlusion'], t: 'Profilbild anzeigen, Kamera ist deaktiviert, Stummschaltung aufgehoben, Videokachel' }),+ ...tiles.map((t) => node('menu item', { t }, node('label', { t }))))))), title)++describe('a 1:1 Teams call (#83)', () => {+ it("the only other person's tile names the call's sound, with nobody marked as talking and no name of mine known", () => {+ expect(readCall('teams', [oneToOne('Anna Becker | Microsoft Teams', ['Anna Becker'])])).toEqual({ speaking: ['Anna Becker'], participants: ['Anna Becker'], me: null })+ })+ it('the window title names the other person when no tile is read, and picks them when I have a tile too', () => {+ expect(readCall('teams', [oneToOne('Anna Becker | Microsoft Teams', [])])).toEqual({ speaking: ['Anna Becker'], participants: ['Anna Becker'], me: null })+ expect(readCall('teams', [oneToOne('Anna Becker | Microsoft Teams', ['Alex Morgan', 'Anna Becker'])]).speaking).toEqual(['Anna Becker'])+ // one tile and no usable title: that tile+ expect(readCall('teams', [oneToOne(undefined, ['Anna Becker'])]).speaking).toEqual(['Anna Becker'])+ })+ it('a tile and a title that disagree, a title that is no name, or a group call: nobody is taken as talking', () => {+ expect(readCall('teams', [oneToOne('Anna Becker | Microsoft Teams', ['Jonas Weber'])]).speaking).toEqual([])+ expect(readCall('teams', [oneToOne('Chat | Anna Becker | Microsoft Teams', [])]).speaking).toEqual([])+ expect(readCall('teams', [oneToOne('Planung Q3 2027 | Microsoft Teams', [])]).speaking).toEqual([])+ expect(readCall('teams', [oneToOne(undefined, ['Anna Becker', 'Jonas Weber'])]).speaking).toEqual([])+ // the same tile in a meeting (no hold or transfer) is someone there, not the one talking+ expect(readCall('teams', [germanTeams()]).speaking).toEqual([])+ })+})+describe('summarize: a short picture of the tree for the log', () => {it("counts roles and shows ids, classes and the app's own words, never a name or anything said", () => {const captions = node('AXGroup', { i: 'captions' }, node('AXStaticText', { v: 'we can sign the renewal with Acme on Friday' }))