Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix(meetings): keep the recording timer across note switches and offer the AI summary when a meeting auto-ends (#2162)
void941c7fb95600
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex 74ca937af..c94ecda35 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -418,9 +418,15 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelProif (data.folderId) {setActiveFolderId(data.folderId);initializeNotes(null, 50, data.folderId);+ } else if (data.generateSummary) {+ // The editor mounts only for a loaded note, and one that sits outside any+ // folder belongs to no container this panel has fetched. Without this the+ // summary request would arm and never reach an editor.+ initializeNotes(null, 50, null);}setActiveNoteId(data.noteId);setActiveView("personal-notes");+ if (data.generateSummary) setSummaryRequest({ noteId: data.noteId });};drain();const cleanup = window.electronAPI?.onNoteNavigationPending?.(drain);@@ -460,6 +466,22 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro[]);+ // Set by the auto-end card's summary action, which routes through the note+ // navigation queue so the panel is surfaced and the note opened first.+ const [summaryRequest, setSummaryRequest] = useState<{ noteId: number } | null>(null);+ const handleSummaryRequestHandled = useCallback(() => setSummaryRequest(null), []);+ // A request the editor never consumed must not stay armed: once the user is+ // looking at another note, or has left Notes altogether, generating a summary+ // for the auto-ended one would be a surprise they no longer asked for.+ // Cancelling needs an already-armed request, so the drain's own updates+ // (note, view and request together) never trip it.+ useEffect(() => {+ if (!summaryRequest) return;+ if (activeNoteId !== summaryRequest.noteId || activeView !== "personal-notes") {+ setSummaryRequest(null);+ }+ }, [activeNoteId, activeView, summaryRequest]);+// The side-panel layout is shared by meeting mode and by a note opened in a// narrow window, so leaving it means different things in each case.const handleExitSidePanel = useCallback(() => {@@ -1201,6 +1223,8 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro}}meetingRecordingRequest={meetingRecordingRequest}onMeetingRecordingRequestHandled={handleMeetingRecordingRequestHandled}+ summaryRequest={summaryRequest}+ onSummaryRequestHandled={handleSummaryRequestHandled}invitationEntry={invitationNotesEntry}onInvitationEntryHandled={() => setInvitationNotesEntry(null)}topBarActions={topBarActions}diff --git a/src/components/MeetingNotificationCard.tsx b/src/components/MeetingNotificationCard.tsxindex b6d1ec1ab..5395585f0 100644--- a/src/components/MeetingNotificationCard.tsx+++ b/src/components/MeetingNotificationCard.tsx@@ -7,6 +7,9 @@ interface MeetingNotificationCardProps {body: string;startLabel: string;onStart?: () => void;+ /** Optional second action, stacked under the primary one. Omitted by the detection card. */+ secondaryLabel?: string;+ onSecondary?: () => void;onDismiss?: () => void;/** Controls the close button's hover fade. Ignored when `onDismiss` is absent. */closeVisible?: boolean;@@ -27,6 +30,8 @@ export function MeetingNotificationCard({body,startLabel,onStart,+ secondaryLabel,+ onSecondary,onDismiss,closeVisible = true,allowTitleWrap = false,@@ -87,15 +92,29 @@ export function MeetingNotificationCard({</p></div>- <button- onClick={onStart}- className={cn(- BRAND_GLASS_SURFACE,- "shrink-0 whitespace-nowrap rounded-full px-2.5 py-1 text-[11px] font-medium transition-[filter] hover:brightness-110 active:brightness-95"+ <div className="flex shrink-0 flex-col gap-1">+ <button+ onClick={onStart}+ className={cn(+ BRAND_GLASS_SURFACE,+ "whitespace-nowrap rounded-full px-2.5 py-1 text-[11px] font-medium transition-[filter] hover:brightness-110 active:brightness-95"+ )}+ >+ {startLabel}+ </button>+ {secondaryLabel && (+ <button+ onClick={onSecondary}+ className={cn(+ "whitespace-nowrap rounded-full px-2.5 py-1 text-[11px] font-medium",+ "border border-border/70 bg-card/70 text-foreground/80 dark:border-border-subtle/60 dark:bg-surface-3/70",+ "transition-colors duration-150 hover:bg-muted hover:text-foreground"+ )}+ >+ {secondaryLabel}+ </button>)}- >- {startLabel}- </button>+ </div></div></div>);diff --git a/src/components/MeetingNotificationOverlay.tsx b/src/components/MeetingNotificationOverlay.tsxindex 9ae981c29..53de64fea 100644--- a/src/components/MeetingNotificationOverlay.tsx+++ b/src/components/MeetingNotificationOverlay.tsx@@ -175,6 +175,7 @@ export default function MeetingNotificationOverlay(): ReactElement {presentation.action === "restart"? () => void respondToAutoEnd("restart"): () => respond(presentation.action);+ const secondary = presentation.action === "restart" ? presentation.secondary : undefined;const isDragging = dragX !== null;const motionStyle: CSSProperties = isDragging@@ -210,6 +211,8 @@ export default function MeetingNotificationOverlay(): ReactElement {body={body}startLabel={t(presentation.actionKey)}onStart={handleAction}+ secondaryLabel={secondary ? t(secondary.key) : undefined}+ onSecondary={secondary ? () => void respondToAutoEnd(secondary.action) : undefined}onDismiss={presentation.dismissible ? dismiss : undefined}closeVisible={isHovered}allowTitleWrap={presentation.allowTitleWrap}diff --git a/src/components/MeetingRecordingMount.tsx b/src/components/MeetingRecordingMount.tsxindex f4581ad92..077e676ab 100644--- a/src/components/MeetingRecordingMount.tsx+++ b/src/components/MeetingRecordingMount.tsx@@ -84,7 +84,8 @@ export default function MeetingRecordingMount(): null {stopRecording,(sessionId, stopped) => {// Every path that ends the recording without offering a restart card- // has to say so, or the recording just disappears.+ // has to say so: the note's own summary offer only reaches a user who+ // is looking at that note.const abandonRestart = () => {if (pendingAutoEndRestart.current?.sessionId === sessionId) {pendingAutoEndRestart.current = null;diff --git a/src/components/meetingNotificationModel.ts b/src/components/meetingNotificationModel.tsindex d9fa3ec1c..5a1314748 100644--- a/src/components/meetingNotificationModel.ts+++ b/src/components/meetingNotificationModel.ts@@ -17,6 +17,10 @@ interface AutoEndPresentation {bodyValues: { seconds: number };actionKey: "meetingNotification.autoEnd.restart";action: "restart";+ /** Only present when the auto-ended note has something to summarize. The label+ * and the response travel together, so the card can never show an offer it+ * cannot answer. */+ secondary?: { key: "meetingNotification.autoEnd.summary"; action: "summary" };dismissible: true;allowTitleWrap: true;}@@ -57,6 +61,14 @@ export function getMeetingNotificationPresentation(bodyValues: { seconds: secondsRemaining },actionKey: "meetingNotification.autoEnd.restart",action: "restart",+ ...(data.canSummarize+ ? {+ secondary: {+ key: "meetingNotification.autoEnd.summary" as const,+ action: "summary" as const,+ },+ }+ : {}),dismissible: true,allowTitleWrap: true,};diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsxindex 1386805ea..84e021e65 100644--- a/src/components/notes/NoteEditor.tsx+++ b/src/components/notes/NoteEditor.tsx@@ -79,7 +79,12 @@ import {import NoteParticipants from "./NoteParticipants";import type { CalendarAttendee } from "../../types/calendar";import { observeFloatingChatLayout } from "./floatingChatLayout";-import { NOTE_META_CHIP_CLASS, defaultFolderDisplayName, folderMatchesQuery } from "./shared";+import {+ NOTE_META_CHIP_CLASS,+ defaultFolderDisplayName,+ folderMatchesQuery,+ shouldOfferMeetingSummary,+} from "./shared";const SEGMENT_BUTTON_CLASS ="relative z-1 flex h-[26px] items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors duration-150";@@ -399,15 +404,15 @@ export default function NoteEditor({}, [diarizedSegments, note.transcript]);const hasChatSegments = displaySegments.length > 0;- // A finished recording with no AI summary yet offers one from the transcript view.const showSummaryCallout =- viewMode === "transcript" &&- !isRecording &&- hasChatSegments &&- !enhancement &&- canEditNote &&!!onGenerateSummary &&- actionProcessingState !== "processing";+ shouldOfferMeetingSummary({+ isRecording,+ hasTranscriptSegments: hasChatSegments,+ hasSummary: !!enhancement,+ canEdit: canEditNote,+ isProcessingAction: actionProcessingState === "processing",+ });const knownSpeakers = useMemo(() => buildKnownSpeakers(speakerProfiles, displaySegments, speakerMappings),diff --git a/src/components/notes/NoteRecordControl.tsx b/src/components/notes/NoteRecordControl.tsxindex ea4f9294f..b35c5a308 100644--- a/src/components/notes/NoteRecordControl.tsx+++ b/src/components/notes/NoteRecordControl.tsx@@ -54,17 +54,21 @@ export default function NoteRecordControl({onStop,}: NoteRecordControlProps) {const { t } = useTranslation();- const [elapsed, setElapsed] = useState(0);+ // Elapsed time comes from the session's start timestamp rather than a tick+ // count: this control remounts whenever the user switches notes, and counted+ // ticks would restart at zero (and drift while the window is throttled).+ const startedAt = useMeetingRecordingStore((s) => s.recordingStartedAt);+ const [now, setNow] = useState(() => Date.now());useEffect(() => {- if (!isRecording) {- setElapsed(0);- return;- }- const id = setInterval(() => setElapsed((s) => s + 1), 1000);+ if (!isRecording) return;+ setNow(Date.now());+ const id = setInterval(() => setNow(Date.now()), 1000);return () => clearInterval(id);}, [isRecording]);+ const elapsed = isRecording && startedAt != null ? Math.floor((now - startedAt) / 1000) : 0;+return (<divclassName={cn(diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsxindex cf50cda5a..7a8345949 100644--- a/src/components/notes/PersonalNotesView.tsx+++ b/src/components/notes/PersonalNotesView.tsx@@ -125,6 +125,9 @@ interface PersonalNotesViewProps {event: any;} | null;onMeetingRecordingRequestHandled?: () => void;+ /** Set by the auto-end card's summary action, routed through note navigation. */+ summaryRequest?: { noteId: number } | null;+ onSummaryRequestHandled?: () => void;invitationEntry?: { workspaceId: string; teamIds: string[] } | null;onInvitationEntryHandled?: () => void;/** The topbar slot the New note button portals into; null while the topbar hides it. */@@ -137,6 +140,8 @@ export default function PersonalNotesView({onOpenSettings,meetingRecordingRequest,onMeetingRecordingRequestHandled,+ summaryRequest,+ onSummaryRequestHandled,invitationEntry,onInvitationEntryHandled,topBarActions,@@ -697,18 +702,6 @@ export default function PersonalNotesView({// the store — this view can be unmounted when an auto-end stop fires.const isActiveNoteRecording = isTranscribing && recordingNoteId === activeNote?.id;- if (!isOnboardingComplete) {- return (- <>- <NotesOnboarding onComplete={completeOnboarding} />- <NotesStructureIntroDialog- open={showStructureIntro}- onOpenChange={handleStructureIntroOpenChange}- />- </>- );- }-const runNoteAction = async (action: ActionItem) => {if (!editorNote) return;const { recordingNoteId: liveNoteId, transcript: liveTranscript } =@@ -766,10 +759,39 @@ export default function PersonalNotesView({),});};+ const summaryAction = actions.find((a) => a.translation_key === DETAILED_NOTES_KEY);const generateSummary = () => {- const action = actions.find((a) => a.translation_key === DETAILED_NOTES_KEY);- if (action) void runNoteAction(action);+ if (summaryAction) void runNoteAction(summaryAction);};+ // The auto-end card's summary action arrives through note navigation, so it+ // waits for its note to be the one on screen and for the built-in action to+ // have loaded: actions load asynchronously (ActionPicker's initializeActions),+ // and a control panel opened by the card boots from cold.+ const summaryRequestReady =+ !!summaryRequest && !!summaryAction && summaryRequest.noteId === editorNote?.id;+ // Held in a ref, like MeetingRecordingMount does with its notifiers, so the+ // effect fires on readiness alone rather than on every render.+ const generateSummaryRef = useRef(generateSummary);+ useEffect(() => {+ generateSummaryRef.current = generateSummary;+ });+ useEffect(() => {+ if (!summaryRequestReady) return;+ generateSummaryRef.current();+ onSummaryRequestHandled?.();+ }, [summaryRequestReady, onSummaryRequestHandled]);++ if (!isOnboardingComplete) {+ return (+ <>+ <NotesOnboarding onComplete={completeOnboarding} />+ <NotesStructureIntroDialog+ open={showStructureIntro}+ onOpenChange={handleStructureIntroOpenChange}+ />+ </>+ );+ }return (<div className="flex h-full">diff --git a/src/components/notes/shared.ts b/src/components/notes/shared.tsindex 3b0476f08..a559a027c 100644--- a/src/components/notes/shared.ts+++ b/src/components/notes/shared.ts@@ -73,6 +73,27 @@ export function transcriptionErrorKey(failure: unknown): string | undefined {return code ? TRANSCRIPTION_ERROR_KEYS[code] : undefined;}+// A finished recording that has a transcript but no AI summary yet offers to+// generate one. Deliberately independent of the open view tab: the callout lives+// in the bottom bar shared by Notes and Transcript, and every detected or+// quick-action meeting starts on the Notes tab, so gating it on the transcript+// view hid the offer exactly when a meeting ended on its own.+export function shouldOfferMeetingSummary({+ isRecording,+ hasTranscriptSegments,+ hasSummary,+ canEdit,+ isProcessingAction,+}: {+ isRecording: boolean;+ hasTranscriptSegments: boolean;+ hasSummary: boolean;+ canEdit: boolean;+ isProcessingAction: boolean;+}): boolean {+ return !isRecording && hasTranscriptSegments && !hasSummary && canEdit && !isProcessingAction;+}+// Folder scopes get the folder-specific empty title; space roots keep the generic one.export function notesEmptyTitleKey(inFolder: boolean): string {return inFolder ? "notes.empty.emptyFolder" : "notes.empty.title";diff --git a/src/helpers/meetingAutoEndLifecycle.js b/src/helpers/meetingAutoEndLifecycle.jsindex ee220f86c..a825c80fa 100644--- a/src/helpers/meetingAutoEndLifecycle.js+++ b/src/helpers/meetingAutoEndLifecycle.js@@ -1,6 +1,8 @@const isValidSessionId = (sessionId) =>typeof sessionId === "string" && sessionId.trim().length > 0;+const MEETING_AUTO_END_ACTIONS = new Set(["restart", "summary", "dismiss"]);+async function completeMeetingAutoEndSession(engine, sessionId, sender) {if (!isValidSessionId(sessionId)) {return { success: false, reason: "invalid-session" };@@ -15,7 +17,7 @@ function respondToMeetingAutoEndNotification(engine, sessionId, action, sender)if (!isValidSessionId(sessionId)) {return { success: false, reason: "invalid-session" };}- if (action !== "restart" && action !== "dismiss") {+ if (!MEETING_AUTO_END_ACTIONS.has(action)) {return { success: false, reason: "invalid-action" };}if (engine?.respondToAutoEndNotification(sessionId, action, sender) !== true) {@@ -56,6 +58,7 @@ function registerMeetingAutoEndLifecycleHandlers(ipcMain, getMeetingDetectionEng}module.exports = {+ MEETING_AUTO_END_ACTIONS,completeMeetingAutoEndSession,respondToMeetingAutoEndNotification,registerMeetingAutoEndLifecycleHandlers,diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.jsindex 169f357b5..77cd4a8b5 100644--- a/src/helpers/meetingDetectionEngine.js+++ b/src/helpers/meetingDetectionEngine.js@@ -2,6 +2,7 @@ const debugLogger = require("./debugLogger");const { openExternalUrl } = require("./externalUrlOpener");const { getMeetingJoinUrl } = require("./meetingJoinUrl");const createMeetingAutoEndController = require("./meetingAutoEndController");+const { MEETING_AUTO_END_ACTIONS } = require("./meetingAutoEndLifecycle");const { createMeetingAudioActivityMonitor } = require("./meetingAudioActivityMonitor");const { broadcastToWindows } = require("./windowBroadcast");@@ -155,6 +156,8 @@ class MeetingDetectionEngine {sessionId,reason,ownerWebContents,+ // Carried so the recovery card can offer this note's AI summary.+ noteId: session.noteId ?? null,expiresAt: null,};try {@@ -207,6 +210,7 @@ class MeetingDetectionEngine {sessionId,reason: pending.reason,expiresAt,+ canSummarize: this._canSummarizeNote(pending.noteId),});if (this._pendingAutoEnd !== pending) return false;// Only an explicit success offers the restart: anything else (a missing@@ -235,9 +239,46 @@ class MeetingDetectionEngine {}}+ // The renderer persists the final transcript before it acknowledges the stop,+ // so the database is the authority on whether there is anything to summarize.+ _canSummarizeNote(noteId) {+ if (noteId == null) return false;+ try {+ const note = this.databaseManager?.getNote?.(noteId);+ return !!note?.transcript && !note?.enhanced_content;+ } catch (error) {+ debugLogger.error(+ "Could not check whether the auto-ended note can be summarized",+ { error: error?.message, noteId },+ "meeting"+ );+ return false;+ }+ }++ // Routed through the note-navigation queue so the control panel is created,+ // surfaced and pointed at the note before the notes view runs the action.+ async _openNoteForSummary(noteId) {+ if (noteId == null) return;+ try {+ const note = this.databaseManager?.getNote?.(noteId);+ await this.windowManager.queueNoteNavigation?.({+ noteId,+ folderId: note?.folder_id ?? null,+ generateSummary: true,+ });+ } catch (error) {+ debugLogger.error(+ "Failed to open the auto-ended note for its AI summary",+ { error: error?.message, noteId },+ "meeting"+ );+ }+ }+respondToAutoEndNotification(sessionId, action, responderWebContents) {if (- (action !== "restart" && action !== "dismiss") ||+ !MEETING_AUTO_END_ACTIONS.has(action) ||!this.windowManager.isMeetingNotificationSender?.(responderWebContents)) {return false;@@ -258,6 +299,14 @@ class MeetingDetectionEngine {return true;}+ // Summary ends the offer like a dismissal — the recording is staying+ // stopped — and additionally opens the note to generate its summary.+ if (action === "summary") {+ this._flushNotificationQueue();+ void this._openNoteForSummary(pending.noteId);+ return true;+ }+// A delivered restart deliberately does not flush: the user chose the old// meeting, and the recording about to start gates the queue again anyway.// One that cannot be delivered starts nothing, so the detections helddiff --git a/src/helpers/windowConfig.js b/src/helpers/windowConfig.jsindex 1bb7eb62f..b0d6c5892 100644--- a/src/helpers/windowConfig.js+++ b/src/helpers/windowConfig.js@@ -287,7 +287,9 @@ const NOTIFICATION_WINDOW_CONFIG = {const AUTO_END_NOTIFICATION_WINDOW_SIZE = {width: 480,- height: 128,+ // Taller than the countdown copy alone needs: the card stacks a second action+ // (the note's AI summary) beside a body that wraps further in some locales.+ height: 144,};function getMeetingNotificationWindowSize(promptData) {diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex 1398d37f2..5d9d1e323 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -2190,9 +2190,11 @@ class WindowManager {}}- showMeetingAutoEndNotification({ sessionId, expiresAt, reason }) {+ showMeetingAutoEndNotification({ sessionId, expiresAt, reason, canSummarize }) {return this.showMeetingNotification(- { kind: "auto-end", sessionId, expiresAt, reason },+ // This object is the payload the overlay fetches verbatim, so a field left+ // out here is a field the card can never render.+ { kind: "auto-end", sessionId, expiresAt, reason, ...(canSummarize ? { canSummarize } : {}) },{ autoDismissAt: expiresAt });}diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.jsonindex a94aca908..4566f3f53 100644--- a/src/locales/ar/translation.json+++ b/src/locales/ar/translation.json@@ -1711,7 +1711,6 @@"description": "نصوص مفرَّغة وملخصات مهيكلة","back": "رجوع","restrictedByOrg": "تفريغ الاجتماعات مقيد بواسطة مؤسستك.",- "autoEnded": "توقف التسجيل تلقائيًا بعد انتهاء اجتماعك.","restartFailed": "تعذرت إعادة تشغيل تسجيل الاجتماع.","systemAudioSilent": {"title": "لم يتم اكتشاف صوت الاجتماع بعد",@@ -1720,6 +1719,7 @@"unsupportedSelfHosted": "لا يمكن لتسجيل الملاحظات استخدام نقطة نهاية مستضافة ذاتيًا بعد. افتح الإعدادات واختر «محلي» أو مزودًا يدعم البث.","unsupportedProvider": "لا يمكن لتسجيل الملاحظات استخدام {{provider}} للتفريغ المباشر. افتح الإعدادات واختر «محلي» أو مزودًا يدعم البث.","noProviderSelected": "لم يتم اختيار أي مزود لتسجيل الملاحظات. افتح الإعدادات واختر «محلي» أو مزودًا يدعم البث.",+ "autoEnded": "توقف التسجيل تلقائيًا بعد انتهاء اجتماعك.","systemAudioInterrupted": {"title": "انقطع صوت الاجتماع","description": "توقف التقاط صوت النظام وتجري إعادة تشغيله. قد تفقد بضع ثوانٍ من المكالمة في النص المفرَّغ."@@ -4230,7 +4230,8 @@"silence": "لم يُكتشف أي صوت، لذا توقف التسجيل تلقائيًا. أعد تشغيل التسجيل خلال {{seconds}} ث.","processExit": "أُغلق تطبيق الاجتماع، لذا توقف التسجيل تلقائيًا. أعد تشغيل التسجيل خلال {{seconds}} ث."},- "restart": "إعادة تشغيل التسجيل"+ "restart": "إعادة تشغيل التسجيل",+ "summary": "إنشاء ملخص بالذكاء الاصطناعي"}}}diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 7fce22374..e55f0edc6 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -4104,7 +4104,8 @@"silence": "Es wurde kein Ton erkannt, daher wurde die Aufnahme automatisch beendet. Neustart innerhalb von {{seconds}} s.","processExit": "Ihre Meeting-App wurde geschlossen, daher wurde die Aufnahme automatisch beendet. Neustart innerhalb von {{seconds}} s."},- "restart": "Aufnahme neu starten"+ "restart": "Aufnahme neu starten",+ "summary": "KI-Zusammenfassung erstellen"}}}diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex bb275fbf9..998df6d32 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -4104,7 +4104,8 @@"silence": "No audio was detected, so recording stopped automatically. Restart within {{seconds}}s.","processExit": "Your meeting app closed, so recording stopped automatically. Restart within {{seconds}}s."},- "restart": "Restart recording"+ "restart": "Restart recording",+ "summary": "Generate AI Summary"}}}diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex 921e3288d..e6b3bb796 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -4104,7 +4104,8 @@"silence": "No se detectó audio, así que la grabación se detuvo automáticamente. Reiníciala en {{seconds}} s.","processExit": "La app de reuniones se cerró, así que la grabación se detuvo automáticamente. Reiníciala en {{seconds}} s."},- "restart": "Reiniciar grabación"+ "restart": "Reiniciar grabación",+ "summary": "Generar resumen con IA"}}}diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex d2564cf6a..8930c778a 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -4104,7 +4104,8 @@"silence": "Aucun son n’a été détecté, donc l’enregistrement s’est arrêté automatiquement. Redémarrez-le dans les {{seconds}} s.","processExit": "Votre app de réunion s’est fermée, donc l’enregistrement s’est arrêté automatiquement. Redémarrez-le dans les {{seconds}} s."},- "restart": "Redémarrer l’enregistrement"+ "restart": "Redémarrer l’enregistrement",+ "summary": "Générer un résumé IA"}}}diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 18eb91c2e..eb14d7e7e 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -4104,7 +4104,8 @@"silence": "Non è stato rilevato audio, quindi la registrazione si è interrotta automaticamente. Riavviala entro {{seconds}} s.","processExit": "L’app della riunione è stata chiusa, quindi la registrazione si è interrotta automaticamente. Riavviala entro {{seconds}} s."},- "restart": "Riavvia registrazione"+ "restart": "Riavvia registrazione",+ "summary": "Genera riepilogo AI"}}}diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex f42fd095b..1f949dfa2 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -4104,7 +4104,8 @@"silence": "音声が検出されなかったため、録音を自動停止しました。{{seconds}}秒以内に再開できます。","processExit": "会議アプリが終了したため、録音を自動停止しました。{{seconds}}秒以内に再開できます。"},- "restart": "録音を再開"+ "restart": "録音を再開",+ "summary": "AI要約を生成"}}}diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 7de3582c6..6aebd03dc 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -4104,7 +4104,8 @@"silence": "Nenhum áudio foi detectado, então a gravação parou automaticamente. Reinicie em até {{seconds}} s.","processExit": "Seu app de reunião foi fechado, então a gravação parou automaticamente. Reinicie em até {{seconds}} s."},- "restart": "Reiniciar gravação"+ "restart": "Reiniciar gravação",+ "summary": "Gerar resumo com IA"}}}diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 4cf5b95f8..bd9c1f441 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -4152,7 +4152,8 @@"silence": "Звук не обнаружен, поэтому запись остановлена автоматически. Перезапустите её в течение {{seconds}} с.","processExit": "Приложение для встреч закрыто, поэтому запись остановлена автоматически. Перезапустите её в течение {{seconds}} с."},- "restart": "Перезапустить запись"+ "restart": "Перезапустить запись",+ "summary": "Создать ИИ-сводку"}}}diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 683e7b6ff..0c82d244e 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -4104,7 +4104,8 @@"silence": "未检测到音频,因此录音已自动停止。请在 {{seconds}} 秒内重新开始录音。","processExit": "会议应用已关闭,因此录音已自动停止。请在 {{seconds}} 秒内重新开始录音。"},- "restart": "重新开始录音"+ "restart": "重新开始录音",+ "summary": "生成 AI 摘要"}}}diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 6a7eacf71..1fe6ab2ce 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -4104,7 +4104,8 @@"silence": "未偵測到音訊,因此錄音已自動停止。請在 {{seconds}} 秒內重新開始錄音。","processExit": "會議應用程式已關閉,因此錄音已自動停止。請在 {{seconds}} 秒內重新開始錄音。"},- "restart": "重新開始錄音"+ "restart": "重新開始錄音",+ "summary": "產生 AI 摘要"}}}diff --git a/src/stores/meetingRecordingStore.ts b/src/stores/meetingRecordingStore.tsindex 5984d1553..8226d1f4f 100644--- a/src/stores/meetingRecordingStore.ts+++ b/src/stores/meetingRecordingStore.ts@@ -89,6 +89,10 @@ interface MeetingRecordingState {recordingNoteId: number | null;recordingNoteTitle: string | null;recordingFolderId: number | null;+ /** Wall-clock start of the live recording. The note header's timer derives its+ * elapsed seconds from this, so switching notes — which remounts the editor —+ * keeps the real duration. Meaningful only while `isRecording`. */+ recordingStartedAt: number | null;segments: TranscriptSegment[];transcript: string;micPartial: string;@@ -433,6 +437,7 @@ export const useMeetingRecordingStore = create<MeetingRecordingState>()(() => ({recordingNoteId: null,recordingNoteTitle: null,recordingFolderId: null,+ recordingStartedAt: null,segments: [],transcript: "",micPartial: "",@@ -815,6 +820,7 @@ export async function startRecording(args: StartRecordingArgs): Promise<boolean>recordingNoteId: args.noteId,recordingNoteTitle: args.noteTitle,recordingFolderId: args.folderId,+ recordingStartedAt: Date.now(),sessionDiarizationEnabled: initialEnabled,sessionExpectedCount: initialCount,userTouchedStepper: resolveInitialSpeakerCountOverride(@@ -1554,6 +1560,7 @@ export async function stopRecording(expectedSessionId?: string): Promise<StopRecsystemAudioSilentWarning: false,systemAudioInterrupted: null,currentMicLevel: 0,+ recordingStartedAt: null,});return { diarizationSessionId: null, stopped: false };}@@ -1641,6 +1648,7 @@ export async function stopRecording(expectedSessionId?: string): Promise<StopRecsystemAudioSilentWarning: false,systemAudioInterrupted: null,currentMicLevel: 0,+ recordingStartedAt: null,});logger.info("Meeting transcription stopped", {}, "meeting");diff --git a/src/types/electron.ts b/src/types/electron.tsindex 88e8f0b96..06f814bff 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -96,6 +96,9 @@ export interface MeetingAutoEndNotificationData {sessionId: string;expiresAt: number;reason?: MeetingAutoEndReason;+ /** True when the auto-ended note has a transcript and no AI summary yet, which+ * is when the card also offers to generate one. */+ canSummarize?: boolean;}export type MeetingNotificationData =@@ -106,7 +109,7 @@ export interface MeetingAutoEndRequest {reason?: MeetingAutoEndReason;}-export type MeetingAutoEndAction = "restart" | "dismiss";+export type MeetingAutoEndAction = "restart" | "summary" | "dismiss";export interface MeetingAutoEndRestartRequest {sessionId: string;@@ -3172,6 +3175,8 @@ declare global {getPendingNoteNavigation?: () => Promise<{noteId: number;folderId: number | null;+ /** Set by the auto-end card's summary action: open the note and run its AI summary. */+ generateSummary?: boolean;} | null>;onNoteNavigationPending?: (callback: () => void) => () => void;onPreviewText?: (callback: (text: string) => void) => () => void;diff --git a/test/components/meetingSummaryOffer.test.js b/test/components/meetingSummaryOffer.test.jsnew file mode 100644index 000000000..1ea95adcb--- /dev/null+++ b/test/components/meetingSummaryOffer.test.js@@ -0,0 +1,42 @@+const test = require("node:test");+const assert = require("node:assert/strict");++const load = () => import("../../src/components/notes/shared.ts");++const FINISHED_RECORDING = {+ isRecording: false,+ hasTranscriptSegments: true,+ hasSummary: false,+ canEdit: true,+ isProcessingAction: false,+};++// #2159 follow-up: the offer used to be gated on the transcript tab, so a meeting+// that auto-ended while the user sat on the Notes tab (where every detected and+// quick-action meeting starts) never offered its summary.+test("a finished recording with a transcript and no summary offers one", async () => {+ const { shouldOfferMeetingSummary } = await load();++ assert.equal(shouldOfferMeetingSummary(FINISHED_RECORDING), true);+});++test("a live recording, an existing summary, or nothing transcribed offers nothing", async () => {+ const { shouldOfferMeetingSummary } = await load();++ assert.equal(shouldOfferMeetingSummary({ ...FINISHED_RECORDING, isRecording: true }), false);+ assert.equal(shouldOfferMeetingSummary({ ...FINISHED_RECORDING, hasSummary: true }), false);+ assert.equal(+ shouldOfferMeetingSummary({ ...FINISHED_RECORDING, hasTranscriptSegments: false }),+ false+ );+});++test("a read-only note and an action already running offer nothing", async () => {+ const { shouldOfferMeetingSummary } = await load();++ assert.equal(shouldOfferMeetingSummary({ ...FINISHED_RECORDING, canEdit: false }), false);+ assert.equal(+ shouldOfferMeetingSummary({ ...FINISHED_RECORDING, isProcessingAction: true }),+ false+ );+});diff --git a/test/components/noteRecordControlTimer.test.js b/test/components/noteRecordControlTimer.test.jsnew file mode 100644index 000000000..523a80da9--- /dev/null+++ b/test/components/noteRecordControlTimer.test.js@@ -0,0 +1,65 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const { createElement } = require("react");+const { renderToStaticMarkup } = require("react-dom/server");+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");++// A fresh mount *is* the note switch: PersonalNotesView keys NoteEditor by note+// id, so leaving a recording note and coming back remounts this control. While+// the elapsed seconds were counted interval ticks, that restarted the timer at+// 00:00; deriving them from the session's start timestamp does not.+async function renderRecordControl(t, { elapsedMs, isRecording = true }) {+ installBrowserGlobals(t);+ // The store's stamp is resolved when the component reads it, not when this+ // harness is built: standing up the renderer server takes seconds, and a+ // timestamp fixed here would drift the expected elapsed value.+ globalThis.__recordingElapsedMs = elapsedMs;+ t.after(() => {+ delete globalThis.__recordingElapsedMs;+ });+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-note-record-control-timer-test-",+ mockModules: {+ "/stores/meetingRecordingStore": `+ const state = {+ currentMicLevel: 0,+ get recordingStartedAt() {+ const elapsed = globalThis.__recordingElapsedMs;+ return elapsed == null ? null : Date.now() - elapsed;+ },+ };+ export const getMicAnalyser = () => null;+ export const useMeetingRecordingStore = (selector) => selector(state);+ useMeetingRecordingStore.getState = () => state;+ `,+ },+ });+ const mod = await vite.ssrLoadModule("/components/notes/NoteRecordControl.tsx");+ return renderToStaticMarkup(+ createElement(mod.default, {+ isRecording,+ isProcessing: false,+ onStart: () => {},+ onStop: () => {},+ })+ );+}++test("a remounted control shows the running session's real elapsed time", async (t) => {+ const html = await renderRecordControl(t, { elapsedMs: 65_000 });++ assert.match(html, />01:05</, "a remount keeps the session's elapsed time");+ assert.doesNotMatch(html, />00:00</, "a remount must not restart the timer at zero");+});++test("a session that has just started shows no elapsed time yet", async (t) => {+ const html = await renderRecordControl(t, { elapsedMs: 0 });++ assert.match(html, />00:00</);+});++test("an idle control renders no timer at all", async (t) => {+ const html = await renderRecordControl(t, { elapsedMs: null, isRecording: false });++ assert.ok(!html.includes("tabular-nums"), "the idle button is a mic, not a timer pill");+});diff --git a/test/helpers/meetingAutoEndLifecycle.test.js b/test/helpers/meetingAutoEndLifecycle.test.jsindex 276d53898..274888013 100644--- a/test/helpers/meetingAutoEndLifecycle.test.js+++ b/test/helpers/meetingAutoEndLifecycle.test.js@@ -39,13 +39,17 @@ test("stop-completion validation rejects invalid, stale, and non-owning sessions]);});-test("overlay response validation accepts only restart or dismiss for a live offer", () => {+test("overlay response validation accepts restart, summary or dismiss for a live offer", () => {const overlay = { id: "overlay" };const calls = [];const engine = {respondToAutoEndNotification: (sessionId, action, sender) => {calls.push({ sessionId, action, sender });- return sessionId === "meeting-2" && action === "restart" && sender === overlay;+ return (+ sessionId === "meeting-2" &&+ (action === "restart" || action === "summary") &&+ sender === overlay+ );},};@@ -64,9 +68,13 @@ test("overlay response validation accepts only restart or dismiss for a live offassert.deepEqual(respondToMeetingAutoEndNotification(engine, "meeting-2", "restart", overlay), {success: true,});+ assert.deepEqual(respondToMeetingAutoEndNotification(engine, "meeting-2", "summary", overlay), {+ success: true,+ });assert.deepEqual(calls, [{ sessionId: "meeting-1", action: "dismiss", sender: overlay },{ sessionId: "meeting-2", action: "restart", sender: overlay },+ { sessionId: "meeting-2", action: "summary", sender: overlay },]);});diff --git a/test/helpers/meetingDetectionEngineAutoEnd.test.js b/test/helpers/meetingDetectionEngineAutoEnd.test.jsindex 3538eb0f0..dde32f1d9 100644--- a/test/helpers/meetingDetectionEngineAutoEnd.test.js+++ b/test/helpers/meetingDetectionEngineAutoEnd.test.js@@ -115,7 +115,7 @@ class FakeMeetingProcessDetector extends EventEmitter {}}-function createEngine(windowManagerOverrides = {}) {+function createEngine(windowManagerOverrides = {}, { databaseManager = {} } = {}) {const clock = createClock();const audioActivityDetector = new FakeAudioActivityDetector();const meetingProcessDetector = new FakeMeetingProcessDetector();@@ -140,7 +140,7 @@ function createEngine(windowManagerOverrides = {}) {meetingProcessDetector,audioActivityDetector,windowManager,- {},+ databaseManager,{now: clock.now,setInterval: clock.setInterval,@@ -170,11 +170,12 @@ function createEngine(windowManagerOverrides = {}) {};}-async function triggerOwnershipStop(engineHarness, ownerWebContents) {+async function triggerOwnershipStop(engineHarness, ownerWebContents, { noteId = null } = {}) {await engineHarness.engine.beginRecordingSession({sessionId: "meeting-1",autoEndEligible: true,ownerWebContents,+ noteId,systemAudioAvailable: true,});engineHarness.clock.advance(OWNERSHIP_MIN_ACTIVE_MS);@@ -389,6 +390,8 @@ test("the recovery notice appears only after the owning renderer confirms stop csessionId: "meeting-1",reason: "mic-released",expiresAt: harness.clock.now() + RESTART_WINDOW_MS,+ // This harness has no database, so the card cannot offer a summary.+ canSummarize: false,},]);harness.engine.stop();@@ -464,6 +467,77 @@ test("dismiss response clears the recovery offer without restarting", async () =harness.engine.stop();});+// The card's summary offer follows the note, not the auto-end reason: a note with+// nothing transcribed, or one that already has a summary, must not be offered one.+test("the auto-end card offers a summary only for an unsummarized transcript", async () => {+ const summarizable = createEngine(+ {},+ { databaseManager: { getNote: () => ({ id: 7, transcript: "SPEAKER_00: hi", folder_id: 3 }) } }+ );+ const owner = summarizable.owner([]);+ await triggerOwnershipStop(summarizable, owner, { noteId: 7 });+ summarizable.engine.endRecordingSession("meeting-1");+ await summarizable.engine.completeAutoEndSession("meeting-1", owner);++ assert.equal(summarizable.autoEndNotifications.at(-1).canSummarize, true);+ summarizable.engine.stop();++ const alreadySummarized = createEngine(+ {},+ {+ databaseManager: {+ getNote: () => ({ id: 7, transcript: "SPEAKER_00: hi", enhanced_content: "# Notes" }),+ },+ }+ );+ const secondOwner = alreadySummarized.owner([]);+ await triggerOwnershipStop(alreadySummarized, secondOwner, { noteId: 7 });+ alreadySummarized.engine.endRecordingSession("meeting-1");+ await alreadySummarized.engine.completeAutoEndSession("meeting-1", secondOwner);++ assert.equal(alreadySummarized.autoEndNotifications.at(-1).canSummarize, false);+ alreadySummarized.engine.stop();+});++test("the summary response opens the note for its summary and ends the offer", async () => {+ const navigations = [];+ const harness = createEngine(+ { queueNoteNavigation: async (payload) => navigations.push(payload) },+ { databaseManager: { getNote: () => ({ id: 7, transcript: "SPEAKER_00: hi", folder_id: 3 }) } }+ );+ const messages = [];+ const ownerWebContents = harness.owner(messages);+ await triggerOwnershipStop(harness, ownerWebContents, { noteId: 7 });+ harness.engine.endRecordingSession("meeting-1");+ await harness.engine.completeAutoEndSession("meeting-1", ownerWebContents);++ assert.equal(+ harness.engine.respondToAutoEndNotification(+ "meeting-1",+ "summary",+ harness.overlayWebContents+ ),+ true+ );+ assert.deepEqual(navigations, [{ noteId: 7, folderId: 3, generateSummary: true }]);+ // A summary leaves the recording stopped, so nothing restarts.+ assert.equal(+ messages.some(({ channel }) => channel === "meeting-auto-end-restart-requested"),+ false+ );+ assert.deepEqual(harness.dismissedAutoEndNotifications, ["meeting-1"]);+ // Single-use, like the restart and dismiss responses.+ assert.equal(+ harness.engine.respondToAutoEndNotification(+ "meeting-1",+ "summary",+ harness.overlayWebContents+ ),+ false+ );+ harness.engine.stop();+});+test("expired, wrong-sender, and invalid auto-end responses are rejected", async () => {const harness = createEngine();const messages = [];diff --git a/test/helpers/meetingNotificationModel.test.js b/test/helpers/meetingNotificationModel.test.jsindex 99958e4a9..56037d1cb 100644--- a/test/helpers/meetingNotificationModel.test.js+++ b/test/helpers/meetingNotificationModel.test.js@@ -23,6 +23,26 @@ test("auto-end presentation has countdown copy, Restart action, and dismissal",);});+// Main sets canSummarize from the note itself, so the card only offers a summary+// when there is a transcript to summarize and no summary already.+test("auto-end presentation offers the AI summary only when the note can be summarized", async () => {+ const { getMeetingNotificationPresentation } = await load();+ const presentationFor = (canSummarize) =>+ getMeetingNotificationPresentation(+ { kind: "auto-end", sessionId: "meeting-2", expiresAt: 40_001, canSummarize },+ 12+ );++ assert.deepEqual(presentationFor(true).secondary, {+ key: "meetingNotification.autoEnd.summary",+ action: "summary",+ });+ // The restart offer is unchanged by the addition.+ assert.equal(presentationFor(true).action, "restart");+ assert.equal("secondary" in presentationFor(false), false);+ assert.equal("secondary" in presentationFor(undefined), false);+});+test("auto-end presentation picks body copy by reason and defaults to mic-released", async () => {const { getMeetingNotificationPresentation } = await load();const bodyFor = (reason) =>diff --git a/test/helpers/windowConfigMeetingNotification.test.js b/test/helpers/windowConfigMeetingNotification.test.jsindex e1a842636..46e1af3bd 100644--- a/test/helpers/windowConfigMeetingNotification.test.js+++ b/test/helpers/windowConfigMeetingNotification.test.js@@ -33,7 +33,7 @@ test("auto-end uses a larger positioned window while detection keeps its existin});test("auto-end dimensions fit every supported localized title, body, and action", () => {- const locales = ["en", "es", "fr", "de", "pt", "it", "ru", "ja", "zh-CN", "zh-TW"];+ const locales = ["en", "es", "fr", "de", "pt", "it", "ru", "ja", "zh-CN", "zh-TW", "ar"];const translations = locales.map((locale) => require(`../../src/locales/${locale}/translation.json`).meetingNotification.autoEnd);@@ -44,8 +44,13 @@ test("auto-end dimensions fit every supported localized title, body, and action"(/\p{Script=Han}|\p{Script=Hiragana}|\p{Script=Katakana}/u.test(character) ? 2 : 1),0);+ // Restart and the summary offer stack vertically, so the wider label is what+ // narrows the text column.const longestActionColumns = Math.max(- ...translations.map(({ restart }) => displayColumns(restart))+ ...translations.flatMap(({ restart, summary }) => [+ displayColumns(restart),+ displayColumns(summary),+ ]));// Reserve the card's outer padding, icon/gaps, and the full non-wrapping action.diff --git a/test/helpers/windowManagerMeetingNotification.test.js b/test/helpers/windowManagerMeetingNotification.test.jsindex 1716e1803..62dcad7cf 100644--- a/test/helpers/windowManagerMeetingNotification.test.js+++ b/test/helpers/windowManagerMeetingNotification.test.js@@ -365,6 +365,7 @@ test("window creation uses the auto-end dimensions and variant-aware position",sessionId: "meeting-1",expiresAt: 70_000,reason: "silence",+ canSummarize: true,});const notificationWindow = createdWindows[0];@@ -378,12 +379,14 @@ test("window creation uses the auto-end dimensions and variant-aware position",},{ acceptFirstMouse: true, width: 620, height: 116, x: 380, y: 16 });- // The reason rides along in the pending payload the overlay will fetch.+ // The reason and the summary offer both ride along in the pending payload the+ // overlay will fetch: dropping either here leaves the card unable to render it.assert.deepEqual(manager._pendingNotificationData, {kind: "auto-end",sessionId: "meeting-1",expiresAt: 70_000,reason: "silence",+ canSummarize: true,});notificationWindow.loadDeferred.resolve();diff --git a/test/stores/meetingRecordingStoreAutoEndStop.test.js b/test/stores/meetingRecordingStoreAutoEndStop.test.jsindex 30c2c2630..ea58a3a4b 100644--- a/test/stores/meetingRecordingStoreAutoEndStop.test.js+++ b/test/stores/meetingRecordingStoreAutoEndStop.test.js@@ -74,6 +74,24 @@ test("a completed stop reports that it ended the recording", async (t) => {assert.equal(store.useMeetingRecordingStore.getState().isRecording, false);});+// The note header's timer derives its elapsed seconds from this stamp instead of+// counting ticks, so a note switch (which remounts the editor) keeps the real+// duration rather than restarting at 00:00.+test("a session stamps its start time and clears it on stop", async (t) => {+ const { api } = createElectronAPI({ stopResult: () => ({ success: true }) });+ const store = await loadStore(t, api);+ const beforeStart = Date.now();++ assert.equal(await store.startRecording(START_ARGS), true);+ const startedAt = store.useMeetingRecordingStore.getState().recordingStartedAt;+ assert.equal(typeof startedAt, "number");+ assert.ok(startedAt >= beforeStart, "the stamp is the moment recording began");++ await store.stopRecording();++ assert.equal(store.useMeetingRecordingStore.getState().recordingStartedAt, null);+});+// The renderer has already run cleanup and written the transcript by the time// main's result is read, so a teardown failure must not cost the user their// restart offer.