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.

Log: main.log says what stopped each recording and how long after it started, and when Yogurt quits (#127)

christianmatf4e453b7d064
diff --git a/app/src/main/index.ts b/app/src/main/index.ts
index aa971574..c27f8a94 100644
--- a/app/src/main/index.ts
+++ b/app/src/main/index.ts
@@ -328,7 +328,7 @@ function startDetection() {
read: async (at) => (lastReading = await signals.read(at)), now, active: activeMeeting, bindApp: bindMeetingApp,
offer: (p) => prompts.offer(p), askStop: (m) => prompts.askStop(m), hide: () => prompts.hide(),
// the call ended: the same stop as the widget's Stop button, then say so
- autoStop: (m) => { widget.callEnded(m.id); stopMeeting(m.id); prompts.stopped(m) },
+ autoStop: (m) => { widget.callEnded(m.id); stopMeeting(m.id, 'call-ended'); prompts.stopped(m) },
silentMs: () => { if (isFake() && fakeSilence !== undefined) return fakeSilence; const m = activeMeeting(); return m ? liveSilentMs(m.id) : 0 },
autoStopOn: () => stopsWhenCallEnds(loadSettings(join(userDataDir(), 'settings.json'))),
// no "Take notes?" while onboarding is still on screen
@@ -340,7 +340,7 @@ function startDetection() {
const prompts = createPrompts({
windowVisible: () => !!win && win.isVisible() && !win.isMinimized(),
takeNotes: (p) => begin({ title: p.title || t('{app} call', { app: p.app ?? '' }).trim(), event: p.event, app: p.app }),
- stop: (id) => { stopMeeting(id) },
+ stop: (id) => { stopMeeting(id, 'card') },
dismissed: (key) => watcher.dismiss(key),
keepGoing: () => watcher.keepGoing(),
dismissStop: () => watcher.dismissStop(),
@@ -354,7 +354,7 @@ function startDetection() {
showRecordingPill: () => showRecordingPill,
os: platform, windowOs: process.platform,
open: (id) => goTo(`/note/${id}`),
- stop: (id) => { stopMeeting(id) },
+ stop: (id) => { stopMeeting(id, 'widget') },
foreground: () => !!win && !win.isDestroyed() && win.isVisible() && !win.isMinimized() && win.isFocused(),
})
onMeetingStart(() => { prompts.hide(); watcher.cleared() })
@@ -431,7 +431,7 @@ function startDetection() {
}
})
// the note's own Stop button: the same stop as the widget and the menu bar
- ipcMain.on('meetings:stop', (_e, id: unknown) => { if (isId(id) && activeMeeting()?.id === id) stopMeeting(id) })
+ ipcMain.on('meetings:stop', (_e, id: unknown) => { if (isId(id) && activeMeeting()?.id === id) stopMeeting(id, 'note') })
const pauseRecording = (id: unknown, paused: unknown) => {
if (!isId(id) || typeof paused !== 'boolean' || activeMeeting()?.id !== id) return false
const changed = setRecordingPaused(id, paused)
@@ -447,7 +447,7 @@ function startDetection() {
showRecordingPill: () => showRecordingPill,
open: () => { presented++; showMain() },
newNote: () => { if (!activeMeeting()) begin({ title: '', event: null, app: null }) },
- stop: (id) => { stopMeeting(id) },
+ stop: (id) => { stopMeeting(id, 'menu') },
pause: pauseRecording,
ask: askFromMenu, settings: () => goTo('/settings'),
openNote: (id) => { const note = storeRef?.meeting(id); if (note && note.trashedAt == null) goTo(`/note/${id}`) },
@@ -657,7 +657,7 @@ app.whenReady().then(() => {
hookCapture({ dirOf: (id) => join(userDataDir(), 'meetings', id), onStart: onMeetingStart, onStop: onMeetingStop, speech: (id) => speechLocaleFor(id),
mic: () => loadSettings(settingsFile).mic ?? null,
// recording that can't go on ends the meeting, with the notes kept
- stopMeeting: (id) => { stopMeeting(id) } })
+ stopMeeting: (id) => { stopMeeting(id, 'recorder') } })
// 32 GB and up: the notes model reads each meeting in as it happens (notes/readAhead.ts)
const readsAhead = !isFake() && readAheadAllowed(os.totalmem())
// the notes model: one job at a time, recording first; loaded when needed, the best one downloaded
@@ -893,7 +893,7 @@ app.whenReady().then(() => {
notesReady: () => !!setup.notesPath(),
startRecording: (o) => recordingControls?.start(o) ?? Promise.resolve({ error: 'failed' as const }),
pauseRecording: (id, paused) => recordingControls?.pause(id, paused) ?? false,
- stopRecording: (id) => { if (activeMeeting()?.id !== id) return false; stopMeeting(id); return true },
+ stopRecording: (id) => { if (activeMeeting()?.id !== id) return false; stopMeeting(id, 'ai-app'); return true },
recording: () => activeMeeting(),
setJargon: (terms) => preferences.setJargon(terms),
setSpoken: (v) => preferences.setSpoken(v),
@@ -983,6 +983,8 @@ app.whenReady().then(() => {
e.preventDefault()
if (finishing) return
finishing = true
+ // #127: a quit left no line of its own, so what it stopped (whisper-server loading) looked like a crash
+ console.info('APP quitting')
savedTranscriptions.shutdown()
void (async () => {
const flushed = await flushRenderer()
@@ -1001,7 +1003,7 @@ app.whenReady().then(() => {
}
// If final unload is vetoed, the resumed UI must describe the same stopped capture.
const recording = activeMeeting()
- if (recording) stopMeeting(recording.id)
+ if (recording) stopMeeting(recording.id, 'quit')
// Music, recorder files and transcription still receive the same bounded graceful shutdown.
await Promise.all([media.resume(), settleRecording().then(() => settleTranscription())])
allowQuit = true
diff --git a/app/src/main/meeting.ts b/app/src/main/meeting.ts
index 8f1d206a..767c133e 100644
--- a/app/src/main/meeting.ts
+++ b/app/src/main/meeting.ts
@@ -144,7 +144,10 @@ export function pauseMeetingClock(id: string, paused: boolean) {
else if (!paused && clock.pausedAt !== null) { clock.pausedMs += Math.max(0, now - clock.pausedAt); clock.pausedAt = null }
}
-export function stopMeeting(id: string): MeetingView | undefined {
+/** What ended a recording, for main.log: a Stop button (the note, the widget, the menu bar, the stop card), the call
+ * ending, the recorder giving up, quitting, or an AI app */
+export type StopBy = 'note' | 'widget' | 'menu' | 'card' | 'call-ended' | 'recorder' | 'quit' | 'ai-app'
+export function stopMeeting(id: string, by?: StopBy): MeetingView | undefined {
if (!store) return undefined
const pending = pendingStops.get(id)
if (pending) return { ...pending, stopSavePending: true }
@@ -154,6 +157,8 @@ export function stopMeeting(id: string): MeetingView | undefined {
const endedAt = Date.now()
const durationMs = active?.id === id && clock?.measured ? Math.max(0, clock.before + (clock.pausedAt ?? endedAt) - clock.startedAt - clock.pausedMs) : undefined
const m: Meeting = { ...cur, state: 'stopped', endedAt, ...(durationMs == null ? {} : { durationMs }) }
+ // #127: a recording that ended a second in left no trace of what ended it
+ console.info(`CALL stop meeting=${id} app=${cur.app ?? 'none'} by=${by ?? 'unknown'} after_ms=${Math.max(0, endedAt - cur.startedAt)}`)
pendingStops.set(id, m)
if (active?.id === id) { active = null; clock = null }
run(stops, m)
diff --git a/app/test/meeting.test.ts b/app/test/meeting.test.ts
index 70db8dcf..b938bc22 100644
--- a/app/test/meeting.test.ts
+++ b/app/test/meeting.test.ts
@@ -11,6 +11,18 @@ beforeEach(() => { store = openStore(':memory:'); initMeetings(store) })
const event = { id: 'e1', title: 'Design review', start: 1000, end: 2000, attendees: [{ name: 'Ann', email: '[email protected]' }], url: null }
describe('meeting lifecycle', () => {
+ // #127: a recording ended a second after it started, and nothing in main.log said what ended it
+ it('says in the log what stopped a recording, and how long after it started', () => {
+ const info = vi.spyOn(console, 'info').mockImplementation(() => {})
+ try {
+ const m = startMeeting({ title: '', event: null, app: 'Teams' })
+ stopMeeting(m.id, 'note')
+ expect(info.mock.calls.map((c) => c.join(' ')).join('\n')).toMatch(new RegExp(`CALL stop meeting=${m.id} app=Teams by=note after_ms=\\d+`))
+ info.mockClear()
+ stopMeeting(m.id, 'menu')
+ expect(info).not.toHaveBeenCalled()
+ } finally { info.mockRestore() }
+ })
it('files new notes and recordings before their first change, and reuses a written note when recording', () => {
const folder = store.createFolder('Reviews')
const firstRead: string[][] = []