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.

Calls: back-to-back meetings each get a Take notes offer again. A recording ending closes its call, and a different calendar meeting starting on the same app is a new call

christianmatdebd32d50005
diff --git a/app/src/main/watch.ts b/app/src/main/watch.ts
index 4b4ca1d3..9736019c 100644
--- a/app/src/main/watch.ts
+++ b/app/src/main/watch.ts
@@ -48,7 +48,7 @@ export class Watcher {
* headset changes or someone toggles mute, and the calendar event can end while the call goes on: none of that is a
* new call. A call is over only after NEW_CALL_MS off the mic, so each call gets one offer, never a stream of them.
*/
- private calls = new Map<string, number>()
+ private calls = new Map<string, { last: number; key: string; at: number }>()
private shownApp: string | null = null
constructor(private d: WatchDeps) {}
@@ -86,20 +86,24 @@ export class Watcher {
this.rec = null
// the recording just ended while its call app still holds the mic (Finish in Yogurt, then Zoom closes a few seconds
// later): that call is done, as if its card were closed. It is forgiven once the app lets go of the mic, as below.
- if (justStopped) for (let p = decide(s, now, this.dismissed); p; p = decide(s, now, this.dismissed)) { this.dismissed.add(p.key); this.calls.set(p.app ?? p.key, now) }
+ // A recording ending closes its call: once the app lets go of the mic, the next call is new (back-to-back meetings)
+ if (justStopped) this.calls.clear()
+ if (justStopped) for (let p = decide(s, now, this.dismissed); p; p = decide(s, now, this.dismissed)) this.dismissed.add(p.key)
this.idleMic = new Set(s.micApps.flatMap((m) => callAppName(m.bundleId, s.runningApps) ?? []))
const call = decide(s, now, new Set())
this.idleCall = call?.app ? { app: call.app, at: now } : null
- for (const a of this.idleMic) if (this.calls.has(a)) this.calls.set(a, now)
- for (const [a, last] of this.calls) if (now - last >= NEW_CALL_MS) this.calls.delete(a)
+ for (const a of this.idleMic) { const c = this.calls.get(a); if (c) c.last = now }
+ for (const [a, c] of this.calls) if (now - c.last >= NEW_CALL_MS) this.calls.delete(a)
// a call app whose call is over (off the mic long enough) is a new call next time
for (const k of [...this.dismissed]) {
const app = k.startsWith('app:') ? callAppName(k.slice(4)) : undefined
if (app !== undefined && !this.idleMic.has(app ?? '') && !this.calls.has(app ?? '')) this.dismissed.delete(k)
}
let p = this.d.ready && !this.d.ready() ? null : decide(s, now, this.dismissed)
- // this call was offered already: under another key (its event ended) or after a moment off the mic
- if (p && this.calls.has(p.app ?? p.key) && this.shown !== p.key) p = null
+ // this call was offered already: under another key (its event ended) or after a moment off the mic. A different
+ // calendar meeting that starts after that offer is the next meeting, though: it gets its own.
+ const before = p && this.calls.get(p.app ?? p.key)
+ if (p && before && this.shown !== p.key && !(p.event && p.key !== before.key && p.event.start > before.at)) p = null
if (!p) {
// a card stays up through a blip; it goes when its call is over
if (this.shown && !(this.shownApp && this.calls.has(this.shownApp))) { this.shown = null; this.shownApp = null; this.d.hide() }
@@ -108,7 +112,7 @@ export class Watcher {
if (this.shown === p.key) return
this.shown = p.key
this.shownApp = p.app ?? p.key
- this.calls.set(p.app ?? p.key, now)
+ this.calls.set(p.app ?? p.key, { last: now, key: p.key, at: now })
console.info(`CALL offer app=${p.app} mic=${s.micApps.filter(m => callAppName(m.bundleId, s.runningApps) === p.app).map(m => m.bundleId).join(',')}`)
this.d.offer(p)
}
diff --git a/app/test/watch.test.ts b/app/test/watch.test.ts
index b5769a35..11af410a 100644
--- a/app/test/watch.test.ts
+++ b/app/test/watch.test.ts
@@ -66,6 +66,26 @@ describe('start cards', () => {
await w.tick(); clock += 3_000; await w.tick()
expect(log.filter((l) => l.startsWith('offer'))).toEqual([`offer:event:e1:${e.start}`])
})
+ it('after a recording ends, the call app coming back is a new call: back-to-back meetings each get an offer', async () => {
+ reading = { micApps: [zoom], events: [] }
+ await w.tick()
+ active = meeting(); await w.tick()
+ active = null; w.cleared(); await w.tick()
+ reading = { micApps: [], events: [] }; clock += 3_000; await w.tick()
+ reading = { micApps: [zoom], events: [] }; clock += 3_000; await w.tick()
+ expect(log.filter((l) => l.startsWith('offer'))).toEqual(['offer:app:us.zoom.xos', 'offer:app:us.zoom.xos'])
+ })
+ it('a different calendar meeting starting on the same app is a new call', async () => {
+ const first = ev({ id: 'e1', start: clock, end: clock + 30 * MIN })
+ reading = { micApps: [zoom], events: [first] }
+ await w.tick()
+ w.dismiss(`event:e1:${first.start}`)
+ clock += 31 * MIN
+ const next = ev({ id: 'e2', title: 'Next', start: clock - MIN, end: clock + 30 * MIN })
+ reading = { micApps: [zoom], events: [next] }
+ await w.tick()
+ expect(log.filter((l) => l.startsWith('offer'))).toEqual([`offer:event:e1:${first.start}`, `offer:event:e2:${next.start}`])
+ })
it('two minutes off the mic ends the call: the next one gets its own offer', async () => {
reading = { micApps: [zoom], events: [] }
await w.tick()