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
Notes: another app can replace either side without moving the editor's revisions, and never over an unsaved edit or a summary being written
christianmat8b6e426fcd9b
diff --git a/app/src/main/notes/index.ts b/app/src/main/notes/index.tsindex 3329f8ed..6c75791a 100644--- a/app/src/main/notes/index.ts+++ b/app/src/main/notes/index.ts@@ -315,6 +315,19 @@ export function hookNotes(p: {stampBefore.delete(id)p.send(view(id))},+ /**+ * Another app (MCP) replaces a side. It leaves the editor's revisions alone, so the next keystroke still saves, and+ * never overwrites an edit not saved yet or a summary being written.+ */+ replace(id: string, side: NoteSide, md: string): 'saved' | 'busy' | 'too-long' | 'failed' {+ if (!p.store.meeting(id)) return 'failed'+ if (md.length > NOTES_MAX) return 'too-long'+ const status = live.get(id)?.status+ if (edits.get(id)?.[side]?.text !== undefined || (side === 'enhanced' && (status === 'waiting' || status === 'writing'))) return 'busy'+ try { p.store.setNotes(id, side === 'mine' ? { mine: md } : { enhanced: md, edited: true }) } catch (e) { console.error('notes from another app were not saved', id, side, e); return 'failed' }+ p.send(view(id))+ return 'saved'+ },setMine: (id: string, md: string, revision?: number) => saveEdit(id, 'mine', md, revision),setEnhanced: (id: string, md: string, revision?: number) => saveEdit(id, 'enhanced', md, revision),retryDrafts,diff --git a/app/test/notes.test.ts b/app/test/notes.test.tsindex a892e048..7ef9cf8b 100644--- a/app/test/notes.test.ts+++ b/app/test/notes.test.ts@@ -628,3 +628,28 @@ it('combines the current summary language with a one-time rewrite note', async (expect(s.prompts.at(-1)).toContain('By default, write in French')expect(s.prompts.at(-1)).not.toContain('"in Spanish"')})++describe('notes replaced from another app (MCP)', () => {+ it("replaces either side without moving the editor's revisions, and the window hears it", () => {+ const s = setup()+ expect(s.notes.setMine(s.m.id, 'typed here', 4).status).toBe('saved')+ expect(s.notes.replace(s.m.id, 'mine', 'from Claude')).toBe('saved')+ expect(s.notes.replace(s.m.id, 'enhanced', '## From Claude')).toBe('saved')+ expect(s.store.notes(s.m.id)).toEqual({ mine: 'from Claude', enhanced: '## From Claude', edited: true })+ expect(s.sent.at(-1)).toMatchObject({ mine: 'from Claude', enhanced: '## From Claude' })+ // the editor's next revision still saves+ expect(s.notes.setMine(s.m.id, 'typed again', 5).status).toBe('saved')+ expect(s.store.notes(s.m.id).mine).toBe('typed again')+ })+ it('waits for an unsaved edit or a summary being written, and refuses one too long', async () => {+ const s = setup({ load: new Promise(() => {}) })+ vi.spyOn(s.store, 'setNotes').mockImplementationOnce(() => { throw new Error('SQLITE_BUSY') })+ s.notes.setMine(s.m.id, 'unsaved', 1)+ expect(s.notes.replace(s.m.id, 'mine', 'x')).toBe('busy')+ void s.notes.writeAgain(s.m.id)+ await new Promise((r) => setTimeout(r, 10))+ expect(s.notes.replace(s.m.id, 'enhanced', 'x')).toBe('busy')+ expect(s.notes.replace(s.m.id, 'enhanced', 'x'.repeat(NOTES_MAX + 1))).toBe('too-long')+ expect(s.notes.replace('nope', 'mine', 'x')).toBe('failed')+ })+})