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 meetings): with nobody marked as talking, the one other person not muted is named, my own tile ("Name, Ich") and names with a company in brackets are read, and a stage that shows fewer people than a minute ago is never taken for a call of two (#83)
christianmat7430d45347e9
diff --git a/app/src/main/callNames/attribute.ts b/app/src/main/callNames/attribute.tsindex 85f55eac..54c074bf 100644--- a/app/src/main/callNames/attribute.ts+++ b/app/src/main/callNames/attribute.ts@@ -15,6 +15,8 @@ export type CallSample = {me: string | null/** false: the app could not be read at this moment (no window, no permission) */ok?: boolean+ /** the most people the app showed in the last minute: a stage showing two of a bigger call is no call of two */+ most?: number}/** a reading stands until the next one, but never longer than this: a stuck app never keeps naming someone */@@ -40,7 +42,7 @@ function whoAt(s: CallSample, o: Opts): string | null {// evidence of a two-person call, so do not assign their speech to the one other roster entry.const speakerOutsideRoster = s.speaking.some((p) => !isMe(p, s, o) && !roster.has(norm(p)))// one other person in the call: the call's sound can only be them, whoever the app marks- if (people.length === 2 && !speakerOutsideRoster) {+ if (people.length === 2 && (s.most ?? 2) <= 2 && !speakerOutsideRoster) {const mine = people.filter((p) => isMe(p, s, o))if (mine.length === 1) return people.find((p) => !isMe(p, s, o))!}diff --git a/app/src/main/callNames/index.ts b/app/src/main/callNames/index.tsindex aeeb8ee3..865fd9e7 100644--- a/app/src/main/callNames/index.ts+++ b/app/src/main/callNames/index.ts@@ -54,6 +54,8 @@ const APP_LAG_MS = 750* waits as long as a reading took and a fresh one killed at 5 s never sends one (#83: a Teams reading took 10 s). */export const QUIET_MS = 5000const MAX_QUIET_MS = 60_000+/** how far back the people seen count for the call's size (see onLine) */+const RECENT_MS = 60_000/** at most this many fresh starts per meeting, so an app that never answers can't start readers forever */const MAX_RESTARTS = 20/** changes of who talks written to the log, per meeting (enough to check a real call, never a flood) */@@ -114,8 +116,13 @@ export function hookCallNames(p: {}// the first reading of each meeting goes to the log in short, so a real call shows what its app givesif (!s.pictured) { s.pictured = true; log(`call names: reading ${l.app} (${kind}), its window in short:\n${summarize(l.windows)}`) }- const r = readCall(kind, l.windows)- s.samples.push({ t: l.t, ...r })+ const { byMute, ...r } = readCall(kind, l.windows)+ // 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+ // names nobody while someone may be hidden.+ const most = Math.max(r.participants.length, ...s.samples.filter((x) => x.ok !== false && l.t - x.t <= RECENT_MS).map((x) => x.participants.length))+ if (byMute && most > r.participants.length) r.speaking = []+ s.samples.push({ t: l.t, ...r, most })// counts only: main.log is pasted into public issues, and names belong to the people in the callconst said = `${r.speaking.length} of ${r.participants.length}${r.me ? ', me known' : ''}`if (said !== s.last && s.logged < LOGGED_CHANGES) { s.logged++; log(`call names: ${kind} talking ${said}`) }diff --git a/app/src/main/callNames/parse.ts b/app/src/main/callNames/parse.tsindex 1cbc40a4..bd218959 100644--- a/app/src/main/callNames/parse.ts+++ b/app/src/main/callNames/parse.ts@@ -9,7 +9,8 @@export type AxNode = { r: string; s?: string; d?: string; t?: string; v?: string; i?: string; c?: string[]; w?: number; h?: number; k?: AxNode[] }export type AxWindow = { title?: string; id?: string; tree: AxNode }export type CallKind = 'zoom' | 'teams' | 'meet' | 'webex'-export type CallReading = { speaking: string[]; participants: string[]; me: string | null }+/** byMute: `speaking` is only the one other person not muted (Teams meetings mark nobody), not a mark of the app */+export type CallReading = { speaking: string[]; participants: string[]; me: string | null; byMute?: boolean }// A role has two names: macOS Accessibility says AXTabGroup, AXStaticText, AXRow, AXOutline; AT-SPI (Linux) says// page tab, label/static/text, table row/list item, tree table/table/list. The rules below know both. Windows's helper@@ -290,8 +291,13 @@ const titleName = (title: string | undefined): string | null => {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, alone: boolean): { name: string; speaking: boolean; me: boolean } | null {+/** the mute word a meeting tile carries (#83: "Name, <meeting title>, stummgeschaltet, Kontextmenü ist verfügbar") */+const TEAMS_MUTED = /^(?:muted|stummgeschaltet|mic(?:rophone)? (?:is )?off|mikrofon (?:ist )?aus)$/i+/** my own tile's label adds a short word after the name: "Christa, Ich" */+const OWN_LABEL = /^(.+?),\s*(\p{L}{1,5})$/u++/** a video tile's person, or null when the menu item isn't one. muted: null when the tile says nothing either way */+function teamsTile(n: AxNode, alone: boolean): { name: string; speaking: boolean; me: boolean; muted: boolean | null } | null {const label = (n.t ?? n.d ?? '').normalize('NFKC').trim()const inner: string[] = [], heads: string[] = []walk(n, (x) => {@@ -300,29 +306,39 @@ function teamsTile(n: AxNode, alone: boolean): { name: string; speaking: booleaninner.push(...said)if (STATIC_TEXT.has(x.r)) heads.push(...said)})- for (const head of heads) {+ for (const raw of heads) {+ // my own tile: its label is "Name, Ich" and the tile reads "Name, ..."+ const own = OWN_LABEL.exec(raw)+ const head = own && !label.startsWith(raw) && label.startsWith(`${own[1]},`) ? own[1] : rawif (!head || !label.startsWith(head) || (head === label && !alone)) continue- const rest = label.slice(head.length)+ // what Teams puts after a name in brackets ("Jonas Weber (Contoso GmbH), ...") is not part of the label+ let rest = label.slice(head.length)+ rest = rest.replace(/^\s*\([^()]*\)(?=\s*,)/, '')// the rest is Teams' words after a comma, or another text of the tile run together with the name, or nothingif (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)) continue- return { name, speaking: rest.split(/\s*,\s*/).some((f) => TEAMS_SAYS.test(f)), me: TEAMS_ME.test(head) }+ const fields = rest.split(/\s*,\s*/).filter(Boolean)+ return { name, speaking: fields.some((f) => TEAMS_SAYS.test(f)), me: head !== raw || TEAMS_ME.test(head), muted: fields.length ? fields.some((f) => TEAMS_MUTED.test(f)) : null }}return null}function readTeams(windows: AxWindow[]): CallReading {const speaking: string[] = [], participants: string[] = []- let me: string | null = null+ let me: string | null = null, byMute = falsefor (const w of windows) {- let call = false, oneToOne = false+ let call = false, oneToOne = false, unread = false+ const states: Array<{ name: string; muted: boolean | null; me: boolean }> = []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, 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 inStage = call && !up.some((a) => TEAMS_BARS.has(a.r))+ const tile = TEAMS_TILE.has(n.r) ? teamsTile(n, inStage) : null+ if (tile) { participants.push(tile.name); tiles.push(tile.name); states.push(tile); if (tile.speaking) speaking.push(tile.name); if (tile.me) me = tile.name }+ // a tile-shaped menu item ("..., ..., ...") whose person couldn't be read: who is muted can't be told+ else if (inStage && TEAMS_TILE.has(n.r) && (n.t ?? '').split(',').length >= 3) unread = trueconst 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) } }@@ -340,8 +356,16 @@ function readTeams(windows: AxWindow[]): CallReading {const other = titled ? (!others.length || others.some((t) => low(t) === low(titled)) ? titled : null) : others.length === 1 ? others[0] : nullif (other) { speaking.push(other); participants.push(other) }}+ // A meeting marks nobody as talking, only who is muted (#83). A muted person can't be heard, so with exactly one other+ // person not muted, and at least one other muted, the sound is theirs. My own tile never counts; two or more not+ // muted, a tile that couldn't be read, or a tile that says nothing either way name nobody.+ if (call && !oneToOne && !speaking.length && !unread) {+ const others = states.filter((t) => !t.me && (!me || low(t.name) !== low(me)))+ const open = others.filter((t) => t.muted === false)+ if (others.length >= 2 && others.every((t) => t.muted !== null) && open.length === 1) { speaking.push(open[0].name); byMute = true }+ }}- return { speaking: uniq(speaking), participants: uniq(participants.filter((p) => p.length >= 2)), me }+ return { speaking: uniq(speaking), participants: uniq(participants.filter((p) => p.length >= 2)), me, ...(byMute ? { byMute } : {}) }}// ---- Webex desktop app ----diff --git a/app/test/callNames.test.ts b/app/test/callNames.test.tsindex 7e0095fe..2ee66a80 100644--- a/app/test/callNames.test.ts+++ b/app/test/callNames.test.ts@@ -278,6 +278,32 @@ describe('hookCallNames', () => {expect(s.store.segments(s.m.id).map((x) => x.speaker)).toEqual(['Anna Becker', 'Anna Becker'])})+ it('a reading that shows fewer people than a moment ago (the stage changed) names nobody from who is muted (#83)', () => {+ const s = setup({ app: 'Teams' })+ s.start()+ s.audio(0, 1_000_100)+ const tile = (name: string, muted: boolean): AxNode => ({ r: 'menu item', t: `${name}, Weekly, ${muted ? 'stummgeschaltet, ' : ''}Kontextmenü ist verfügbar`, k: [{ r: 'label', t: name }] })+ const line = (t: number, tiles: AxNode[]): WatchLine => ({ t, app: 'ms-teams.exe', windows: [{ title: 'Weekly | Microsoft Teams', tree: { r: 'frame', k: [{ r: 'push button', i: 'hangup-button', t: 'Verlassen' }, ...tiles] } }] })+ for (let t = 1_000_000; t < 1_005_000; t += 500) s.emit(line(t, [tile('Anna Becker', true), tile('Jonas Weber', true), tile('Lena Hoffmann', false)]))+ for (let t = 1_005_000; t < 1_010_000; t += 500) s.emit(line(t, [tile('Anna Becker', true), tile('Jonas Weber', false)]))+ expect(s.hook.nameFor(s.m.id, 1000, 3000)).toBe('Lena Hoffmann')+ expect(s.hook.nameFor(s.m.id, 6000, 8000)).toBeNull()+ })++ it('a meeting whose stage shrinks to me and one other is not taken for a call of two (#83: "0 of 13", then "0 of 2")', () => {+ const s = setup()+ s.start()+ s.audio(0, 1_000_100)+ for (let t = 1_000_000; t < 1_005_000; t += 500) s.emit(zoomLine(t, ['Alex Morgan', 'Dana Smith', 'Ann Lee', 'Bo Park'], undefined, 'Alex Morgan'))+ for (let t = 1_005_000; t < 1_010_000; t += 500) s.emit(zoomLine(t, ['Alex Morgan', 'Dana Smith'], undefined, 'Alex Morgan'))+ expect(s.hook.nameFor(s.m.id, 6000, 8000)).toBeNull()+ // a real call of two still is one+ const two = setup()+ two.start(); two.audio(0, 1_000_100)+ for (let t = 1_000_000; t < 1_010_000; t += 500) two.emit(zoomLine(t, ['Alex Morgan', 'Dana Smith'], undefined, 'Alex Morgan'))+ expect(two.hook.nameFor(two.m.id, 6000, 8000)).toBe('Dana Smith')+ })+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 7b42ac83..66f125ad 100644--- a/app/test/callParse.test.ts+++ b/app/test/callParse.test.ts@@ -313,6 +313,35 @@ describe('a 1:1 Teams call (#83)', () => {})})+// ---- a German Teams meeting on Windows (#83): "Name, <meeting title>, stummgeschaltet, Kontextmenü ist verfügbar" ----+// Teams marks nobody as talking here; only who is muted. My own tile's label is "Name, Ich". Names made up.+const TITLE = 'Abstimmung Projekt Nordlicht mit Partnern'+const meetingTile = (name: string, label: string, muted: boolean) =>+ node('menu item', { t: `${name}, ${TITLE}, ${muted ? 'stummgeschaltet, ' : ''}Kontextmenü ist verfügbar` }, node('label', { t: label }))+const meeting = (tiles: AxNode[]) => win(node('frame', { t: `${TITLE} | Microsoft Teams` },+ node('panel', { i: 'app' },+ node('push button', { i: 'microphone-button', t: 'Stummschalten (Strg+Umschalt+M)' }),+ node('panel', { i: 'horizontalEnd' }, node('push button', { i: 'hangup-button', t: 'Verlassen' })),+ node('menu item', { t: `Christa, Kamera ist deaktiviert, ${TITLE}, Kontextmenü ist verfügbar` }, node('label', { t: 'Christa, Ich' })),+ ...tiles)), `${TITLE} | Microsoft Teams`)++describe('a Teams meeting where nobody is marked as talking (#83)', () => {+ const anna = meetingTile('Anna Becker', 'Anna Becker', true)+ const jonas = meetingTile('Jonas Weber (Contoso GmbH)', 'Jonas Weber', true)+ const lena = meetingTile('Lena Hoffmann (Extern)', 'Lena Hoffmann', false)+ it("the only other person not muted is the one talking; my tile (\"Name, Ich\") is me, and the meeting's title is no one", () => {+ expect(readCall('teams', [meeting([anna, jonas, lena])])).toEqual({ speaking: ['Lena Hoffmann'], participants: ['Christa', 'Anna Becker', 'Jonas Weber', 'Lena Hoffmann'], me: 'Christa', byMute: true })+ })+ it('names nobody with two others not muted, with everyone muted, with only one other shown, or with a tile it could not read', () => {+ const tom = meetingTile('Tom Krause', 'Tom Krause', false)+ expect(readCall('teams', [meeting([anna, lena, tom])]).speaking).toEqual([])+ expect(readCall('teams', [meeting([anna, jonas])]).speaking).toEqual([])+ expect(readCall('teams', [meeting([lena])]).speaking).toEqual([])+ const odd = node('menu item', { t: `Paul Klein Contoso, ${TITLE}, stummgeschaltet, Kontextmenü ist verfügbar` }, node('label', { t: 'Paul Klein' }))+ expect(readCall('teams', [meeting([anna, lena, odd])]).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' }))