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
feat(sync): cross-device delete propagation (#646)
Gabriel Stein3b20bde89a3e
diff --git a/preload.js b/preload.jsindex a231471e9..7698eeee8 100644--- a/preload.js+++ b/preload.js@@ -104,8 +104,8 @@ contextBridge.exposeInMainWorld("electronAPI", {getFolderNoteCounts: () => ipcRenderer.invoke("db-get-folder-note-counts"),// Note files (markdown mirror) functions- noteFilesSetEnabled: (enabled, customPath) =>- ipcRenderer.invoke("note-files-set-enabled", enabled, customPath),+ noteFilesSetEnabled: (enabled, customPath, options) =>+ ipcRenderer.invoke("note-files-set-enabled", enabled, customPath, options),noteFilesSetPath: (path) => ipcRenderer.invoke("note-files-set-path", path),noteFilesRebuild: () => ipcRenderer.invoke("note-files-rebuild"),noteFilesGetDefaultPath: () => ipcRenderer.invoke("note-files-get-default-path"),@@ -547,6 +547,7 @@ contextBridge.exposeInMainWorld("electronAPI", {meetingTranscriptionSend: (buffer, source) =>ipcRenderer.send("meeting-transcription-send", buffer, source),meetingTranscriptionStop: () => ipcRenderer.invoke("meeting-transcription-stop"),+ meetingTranscriptionCancel: () => ipcRenderer.invoke("meeting-transcription-cancel"),onMeetingTranscriptionSegment: registerListener("meeting-transcription-segment",(callback) => (_event, data) => callback(data)diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex f42d6a4f9..a7a5598a9 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -118,6 +118,14 @@ export default function ControlPanel() {})();}, [showAlertDialog, t]);+ useEffect(() => {+ const { noteFilesEnabled, noteFilesPath } = useSettingsStore.getState();+ if (!noteFilesEnabled) return;+ window.electronAPI?.noteFilesSetEnabled?.(true, noteFilesPath || undefined, {+ skipRebuild: true,+ });+ }, []);+useEffect(() => {const handleKeyDown = (e: KeyboardEvent) => {const mod = platform === "darwin" ? e.metaKey : e.ctrlKey;diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 4afbf6ce5..b758569cb 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -895,6 +895,7 @@ export default function SettingsPage({installUpdate: installUpdateAction,getAppVersion,error: updateError,+ clearError: clearUpdateError,} = useUpdater();const isUpdateAvailable =@@ -1150,11 +1151,18 @@ export default function SettingsPage({const handleNoteFilesRebuild = useCallback(async () => {setNoteFilesRebuilding(true);try {- await window.electronAPI?.noteFilesRebuild?.();+ const result = await window.electronAPI?.noteFilesRebuild?.();+ if (result && !result.success) {+ toast({+ title: t("settings.noteFiles.rebuildError.title"),+ description: result.error || t("settings.noteFiles.rebuildError.description"),+ variant: "destructive",+ });+ }} finally {setNoteFilesRebuilding(false);}- }, []);+ }, [toast, t]);useEffect(() => {let mounted = true;@@ -1219,8 +1227,9 @@ export default function SettingsPage({title: t("settingsPage.general.updates.dialogs.updateError.title"),description: t("settingsPage.general.updates.dialogs.updateError.description"),});+ clearUpdateError();}- }, [updateError, showAlertDialog, t]);+ }, [updateError, showAlertDialog, clearUpdateError, t]);useEffect(() => {if (installInitiated) {diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsxindex 9a0300df5..53443793b 100644--- a/src/components/notes/PersonalNotesView.tsx+++ b/src/components/notes/PersonalNotesView.tsx@@ -512,10 +512,12 @@ export default function PersonalNotesView({// Pre-warm WebSocket when entering meeting mode (before user hits record)useEffect(() => {- if (isMeetingMode) {- prepareTranscription();- }- }, [isMeetingMode, prepareTranscription]);+ if (!isMeetingMode) return;+ prepareTranscription();+ return () => {+ window.electronAPI?.meetingTranscriptionCancel?.();+ };+ }, [isMeetingMode, activeNoteId, prepareTranscription]);useEffect(() => {if (!meetingRecordingRequest || activeNoteId !== meetingRecordingRequest.noteId) return;diff --git a/src/helpers/database.js b/src/helpers/database.jsindex 45992a006..d0399e1ff 100644--- a/src/helpers/database.js+++ b/src/helpers/database.js@@ -2093,8 +2093,16 @@ class DatabaseManager {hardDeleteFolder(id) {try {if (!this.db) throw new Error("Database not initialized");- const result = this.db.prepare("DELETE FROM folders WHERE id = ?").run(id);- return { success: result.changes > 0, id };+ const folder = this.db.prepare("SELECT name FROM folders WHERE id = ?").get(id);+ const noteIds = this.db+ .prepare("SELECT id FROM notes WHERE folder_id = ?")+ .all(id)+ .map((row) => row.id);+ const result = this.db.transaction(() => {+ this.db.prepare("DELETE FROM notes WHERE folder_id = ?").run(id);+ return this.db.prepare("DELETE FROM folders WHERE id = ?").run(id);+ })();+ return { success: result.changes > 0, id, noteIds, name: folder?.name ?? null };} catch (error) {debugLogger.error("Error hard deleting folder", { error: error.message }, "database");throw error;diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 18a372cd7..3b286d827 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -333,7 +333,14 @@ class IPCHandlers {}_asyncMirrorWrite(note) {- if (!this._noteFilesEnabled) return;+ if (!this._noteFilesEnabled) {+ debugLogger.debug(+ "Mirror write skipped: note files disabled",+ { noteId: note.id },+ "note-files"+ );+ return;+ }setImmediate(() => {const markdownMirror = require("./markdownMirror");const folderName = this._getFolderName(note.folder_id);@@ -345,7 +352,10 @@ class IPCHandlers {}_asyncMirrorDelete(noteId) {- if (!this._noteFilesEnabled) return;+ if (!this._noteFilesEnabled) {+ debugLogger.debug("Mirror delete skipped: note files disabled", { noteId }, "note-files");+ return;+ }setImmediate(() => {const markdownMirror = require("./markdownMirror");markdownMirror.deleteNote(noteId);@@ -1164,7 +1174,15 @@ class IPCHandlers {ipcMain.handle("db-mark-note-sync-error", (_, id) =>this.databaseManager.markNoteSyncError(id));- ipcMain.handle("db-hard-delete-note", (_, id) => this.databaseManager.hardDeleteNote(id));+ ipcMain.handle("db-hard-delete-note", (_, id) => {+ const result = this.databaseManager.hardDeleteNote(id);+ if (result?.success) {+ this._asyncVectorDelete(id);+ this._asyncMirrorDelete(id);+ setImmediate(() => this.broadcastToWindows("note-deleted", { id }));+ }+ return result;+ });// Folders syncipcMain.handle("db-get-pending-folders", () => this.databaseManager.getPendingFolders());@@ -1181,7 +1199,22 @@ class IPCHandlers {ipcMain.handle("db-get-pending-folder-deletes", () =>this.databaseManager.getPendingFolderDeletes());- ipcMain.handle("db-hard-delete-folder", (_, id) => this.databaseManager.hardDeleteFolder(id));+ ipcMain.handle("db-hard-delete-folder", (_, id) => {+ const result = this.databaseManager.hardDeleteFolder(id);+ if (result?.success) {+ for (const noteId of result.noteIds ?? []) {+ this._asyncVectorDelete(noteId);+ }+ setImmediate(() => {+ this.broadcastToWindows("folder-deleted", { id });+ if (this._noteFilesEnabled && result.name) {+ const markdownMirror = require("./markdownMirror");+ markdownMirror.deleteFolder(result.name);+ }+ });+ }+ return result;+ });// Conversations syncipcMain.handle("db-get-pending-conversations", () =>@@ -1199,9 +1232,13 @@ class IPCHandlers {ipcMain.handle("db-mark-conversation-synced", (_, id, cloudId) =>this.databaseManager.markConversationSynced(id, cloudId));- ipcMain.handle("db-hard-delete-conversation", (_, id) =>- this.databaseManager.hardDeleteConversation(id)- );+ ipcMain.handle("db-hard-delete-conversation", (_, id) => {+ const result = this.databaseManager.hardDeleteConversation(id);+ if (result?.success) {+ setImmediate(() => this.broadcastToWindows("conversation-deleted", { id }));+ }+ return result;+ });// Transcriptions syncipcMain.handle("db-get-pending-transcriptions", () =>@@ -1219,9 +1256,13 @@ class IPCHandlers {ipcMain.handle("db-get-pending-transcription-deletes", () =>this.databaseManager.getPendingTranscriptionDeletes());- ipcMain.handle("db-hard-delete-transcription", (_, id) =>- this.databaseManager.hardDeleteTranscription(id)- );+ ipcMain.handle("db-hard-delete-transcription", (_, id) => {+ const result = this.databaseManager.hardDeleteTranscription(id);+ if (result?.success) {+ setImmediate(() => this.broadcastToWindows("transcription-deleted", { id }));+ }+ return result;+ });ipcMain.handle("export-note", async (event, noteId, format) => {try {@@ -4755,14 +4796,21 @@ class IPCHandlers {meetingTranscriptionPrepareInProgress = true;meetingTranscriptionPreparePromise = (async () => {+ let timeoutHandle;try {- await connectRealtimeStreaming(event, options);+ await Promise.race([+ connectRealtimeStreaming(event, options),+ new Promise((_, reject) => {+ timeoutHandle = setTimeout(() => reject(new Error("Prepare timed out")), 15000);+ }),+ ]);debugLogger.debug("Meeting transcription prepared (meeting streams warm)");return { success: true };} catch (error) {debugLogger.error("Meeting transcription prepare error", { error: error.message });return { success: false, error: error.message };} finally {+ if (timeoutHandle) clearTimeout(timeoutHandle);meetingTranscriptionPrepareInProgress = false;meetingTranscriptionPreparePromise = null;}@@ -4771,6 +4819,16 @@ class IPCHandlers {return meetingTranscriptionPreparePromise;});+ ipcMain.handle("meeting-transcription-cancel", async () => {+ if (isMeetingStreamingConnected() || meetingLocalTimer) {+ return { success: false, reason: "recording-active" };+ }+ meetingTranscriptionPrepareInProgress = false;+ meetingTranscriptionStartInProgress = false;+ meetingTranscriptionPreparePromise = null;+ return { success: true };+ });+ipcMain.handle("meeting-transcription-start", async (event, options = {}) => {// Wait for any in-flight prepare to finish before startingif (meetingTranscriptionPreparePromise) {@@ -6812,11 +6870,15 @@ class IPCHandlers {});// Note files (markdown mirror) handlers- ipcMain.handle("note-files-set-enabled", async (_event, enabled, customPath) => {+ ipcMain.handle("note-files-set-enabled", async (_event, enabled, customPath, options) => {try {this._noteFilesEnabled = !!enabled;- if (enabled) {- this._rebuildMirror(customPath || path.join(app.getPath("userData"), "notes"));+ if (!enabled) return { success: true };+ const basePath = customPath || path.join(app.getPath("userData"), "notes");+ if (options?.skipRebuild) {+ require("./markdownMirror").init(basePath);+ } else {+ this._rebuildMirror(basePath);}return { success: true };} catch (error) {diff --git a/src/hooks/useUpdater.ts b/src/hooks/useUpdater.tsindex be3ca94b8..bc31c8a5a 100644--- a/src/hooks/useUpdater.ts+++ b/src/hooks/useUpdater.ts@@ -237,6 +237,12 @@ export function useUpdater() {}}, []);+ const clearError = useCallback(() => {+ if (globalState.error) {+ updateGlobalState({ error: null });+ }+ }, []);+return {status: state.status,info: state.info,@@ -249,5 +255,6 @@ export function useUpdater() {downloadUpdate,installUpdate,getAppVersion,+ clearError,};}diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 7bbb74e59..1576a71d3 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -14,7 +14,11 @@"path": "Speicherort","changePath": "Speicherort ändern","rebuild": "Alle Dateien neu erstellen",- "rebuildDescription": "Alle Notizen und Transkripte erneut auf die Festplatte synchronisieren"+ "rebuildDescription": "Alle Notizen und Transkripte erneut auf die Festplatte synchronisieren",+ "rebuildError": {+ "title": "Neuerstellung fehlgeschlagen",+ "description": "Die Notizdateien konnten nicht neu erstellt werden. Stellen Sie sicher, dass die Funktion aktiviert ist und der Ordner beschreibbar ist."+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 6305cb0eb..735efe07c 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -14,7 +14,11 @@"path": "Save location","changePath": "Change location","rebuild": "Rebuild all files",- "rebuildDescription": "Re-sync all notes and transcripts to disk"+ "rebuildDescription": "Re-sync all notes and transcripts to disk",+ "rebuildError": {+ "title": "Rebuild failed",+ "description": "Could not rebuild note files. Make sure the feature is enabled and the folder is writable."+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex a864e4648..23b6e56cb 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -14,7 +14,11 @@"path": "Ubicación de guardado","changePath": "Cambiar ubicación","rebuild": "Reconstruir todos los archivos",- "rebuildDescription": "Resincronizar todas las notas y transcripciones al disco"+ "rebuildDescription": "Resincronizar todas las notas y transcripciones al disco",+ "rebuildError": {+ "title": "Error al reconstruir",+ "description": "No se pudieron reconstruir los archivos de notas. Asegúrate de que la función esté habilitada y la carpeta tenga permisos de escritura."+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex c37f735e0..c72d27cc4 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -14,7 +14,11 @@"path": "Emplacement de sauvegarde","changePath": "Changer l'emplacement","rebuild": "Reconstruire tous les fichiers",- "rebuildDescription": "Resynchroniser toutes les notes et transcriptions sur le disque"+ "rebuildDescription": "Resynchroniser toutes les notes et transcriptions sur le disque",+ "rebuildError": {+ "title": "Échec de la reconstruction",+ "description": "Impossible de reconstruire les fichiers de notes. Assurez-vous que la fonctionnalité est activée et que le dossier est accessible en écriture."+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 2be44e591..5a5869298 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -14,7 +14,11 @@"path": "Percorso di salvataggio","changePath": "Cambia percorso","rebuild": "Ricostruisci tutti i file",- "rebuildDescription": "Risincronizza tutte le note e trascrizioni su disco"+ "rebuildDescription": "Risincronizza tutte le note e trascrizioni su disco",+ "rebuildError": {+ "title": "Ricostruzione non riuscita",+ "description": "Impossibile ricostruire i file delle note. Assicurati che la funzione sia abilitata e che la cartella sia scrivibile."+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 7f8609551..f98b02822 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -14,7 +14,11 @@"path": "保存先","changePath": "保存先を変更","rebuild": "すべてのファイルを再構築",- "rebuildDescription": "すべてのノートと文字起こしをディスクに再同期"+ "rebuildDescription": "すべてのノートと文字起こしをディスクに再同期",+ "rebuildError": {+ "title": "再構築に失敗しました",+ "description": "ノートファイルを再構築できませんでした。機能が有効になっており、フォルダーに書き込み可能であることを確認してください。"+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 39f0475b5..475033f04 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -14,7 +14,11 @@"path": "Local de salvamento","changePath": "Alterar local","rebuild": "Reconstruir todos os arquivos",- "rebuildDescription": "Ressincronizar todas as notas e transcrições no disco"+ "rebuildDescription": "Ressincronizar todas as notas e transcrições no disco",+ "rebuildError": {+ "title": "Falha na reconstrução",+ "description": "Não foi possível reconstruir os arquivos de notas. Verifique se o recurso está ativado e se a pasta permite gravação."+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex c19bbced0..35adc1029 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -14,7 +14,11 @@"path": "Расположение","changePath": "Изменить расположение","rebuild": "Пересоздать все файлы",- "rebuildDescription": "Повторно синхронизировать все заметки и транскрипции на диск"+ "rebuildDescription": "Повторно синхронизировать все заметки и транскрипции на диск",+ "rebuildError": {+ "title": "Не удалось пересоздать",+ "description": "Не удалось пересоздать файлы заметок. Убедитесь, что функция включена и в папку можно записывать."+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 8ddba7635..e6f6970f3 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -14,7 +14,11 @@"path": "保存位置","changePath": "更改位置","rebuild": "重建所有文件",- "rebuildDescription": "将所有笔记和转录重新同步到磁盘"+ "rebuildDescription": "将所有笔记和转录重新同步到磁盘",+ "rebuildError": {+ "title": "重建失败",+ "description": "无法重建笔记文件。请确保已启用该功能,并且文件夹可写。"+ }},"meeting": {"speakerDetection": {diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 592c03f52..e1d5e90ef 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -14,7 +14,11 @@"path": "儲存位置","changePath": "變更位置","rebuild": "重建所有檔案",- "rebuildDescription": "將所有筆記和逐字稿重新同步到磁碟"+ "rebuildDescription": "將所有筆記和逐字稿重新同步到磁碟",+ "rebuildError": {+ "title": "重建失敗",+ "description": "無法重建筆記檔案。請確認功能已啟用,且資料夾可寫入。"+ }},"meeting": {"speakerDetection": {diff --git a/src/services/ConversationsService.ts b/src/services/ConversationsService.tsindex 94e4f650e..fdb66fd98 100644--- a/src/services/ConversationsService.ts+++ b/src/services/ConversationsService.ts@@ -54,13 +54,15 @@ async function list(limit?: number,before?: string,archived?: boolean,- include?: string+ include?: string,+ since?: string): Promise<{ conversations: CloudConversationWithMessages[] }> {const params = new URLSearchParams();if (limit !== undefined) params.set("limit", String(limit));if (before !== undefined) params.set("before", before);if (archived) params.set("archived", "true");if (include !== undefined) params.set("include", include);+ if (since !== undefined) params.set("since", since);const query = params.toString();return cloudGet<{ conversations: CloudConversationWithMessages[] }>(`/api/conversations/list${query ? `?${query}` : ""}`diff --git a/src/services/FoldersService.ts b/src/services/FoldersService.tsindex 5ff9c95b1..11cb98b9c 100644--- a/src/services/FoldersService.ts+++ b/src/services/FoldersService.ts@@ -13,6 +13,7 @@ interface CloudFolder {name: string;is_default: boolean;sort_order: number;+ deleted_at: string | null;created_at: string;updated_at: string;}@@ -33,8 +34,9 @@ async function deleteFolder(id: string): Promise<void> {await cloudDelete("/api/folders/delete", { id });}-async function list(): Promise<{ folders: CloudFolder[] }> {- return cloudGet<{ folders: CloudFolder[] }>("/api/folders/list");+async function list(since?: string): Promise<{ folders: CloudFolder[] }> {+ const query = since ? `?since=${encodeURIComponent(since)}` : "";+ return cloudGet<{ folders: CloudFolder[] }>(`/api/folders/list${query}`);}export { create, batchCreate, update, deleteFolder, list };diff --git a/src/services/NotesService.ts b/src/services/NotesService.tsindex 249d5a62a..e2c214a97 100644--- a/src/services/NotesService.ts+++ b/src/services/NotesService.ts@@ -60,10 +60,15 @@ async function deleteNote(id: string): Promise<void> {await cloudDelete("/api/notes/delete", { id });}-async function list(limit?: number, before?: string): Promise<{ notes: CloudNote[] }> {+async function list(+ limit?: number,+ before?: string,+ since?: string+): Promise<{ notes: CloudNote[] }> {const params = new URLSearchParams();if (limit !== undefined) params.set("limit", String(limit));if (before !== undefined) params.set("before", before);+ if (since !== undefined) params.set("since", since);const query = params.toString();return cloudGet<{ notes: CloudNote[] }>(`/api/notes/list${query ? `?${query}` : ""}`);}diff --git a/src/services/SyncService.ts b/src/services/SyncService.tsindex 78d431e50..7758e5d2f 100644--- a/src/services/SyncService.ts+++ b/src/services/SyncService.ts@@ -230,11 +230,20 @@ class SyncService {private async pullFolders(): Promise<void> {try {- const { folders: cloudFolders } = await FoldersService.list();+ const since = localStorage.getItem("lastSyncedAt.folders") ?? undefined;+ const syncStartedAt = new Date().toISOString();+ const { folders: cloudFolders } = await FoldersService.list(since);+for (const cloudFolder of cloudFolders) {const local = await window.electronAPI.getFolderByClientId?.(cloudFolder.client_folder_id ?? "");++ if (cloudFolder.deleted_at) {+ if (local) await window.electronAPI.hardDeleteFolder?.(local.id);+ continue;+ }+if (local?.deleted_at) continue;if (!local || cloudFolder.updated_at > local.created_at) {await window.electronAPI.upsertFolderFromCloud?.(@@ -242,6 +251,8 @@ class SyncService {);}}++ localStorage.setItem("lastSyncedAt.folders", syncStartedAt);} catch (err) {console.error("Folder pull failed:", err);}@@ -316,33 +327,46 @@ class SyncService {private async pullNotes(): Promise<void> {try {+ const since = localStorage.getItem("lastSyncedAt.notes") ?? undefined;+ const syncStartedAt = new Date().toISOString();const { cloudToLocal, defaultFolderId } = await this.buildCloudToLocalFolderMap();- let before: string | undefined;- let hasMore = true;- while (hasMore) {- const { notes: cloudNotes } = await NotesService.list(BATCH_SIZE, before);+ let cursor: string | undefined = since;+ while (true) {+ const { notes: cloudNotes } = since+ ? await NotesService.list(BATCH_SIZE, undefined, cursor)+ : await NotesService.list(BATCH_SIZE, cursor);if (cloudNotes.length === 0) break;- hasMore = cloudNotes.length === BATCH_SIZE;- before = cloudNotes[cloudNotes.length - 1].created_at;for (const cloudNote of cloudNotes) {- if (cloudNote.deleted_at) continue;const local = await window.electronAPI.getNoteByClientId?.(cloudNote.client_note_id ?? "");- const localFolderId = cloudNote.folder_id- ? (cloudToLocal.get(cloudNote.folder_id) ?? defaultFolderId)- : defaultFolderId;++ if (cloudNote.deleted_at) {+ if (local) await window.electronAPI.hardDeleteNote?.(local.id);+ continue;+ }if (!local || cloudNote.updated_at > local.updated_at) {+ const localFolderId = cloudNote.folder_id+ ? (cloudToLocal.get(cloudNote.folder_id) ?? defaultFolderId)+ : defaultFolderId;await window.electronAPI.upsertNoteFromCloud?.(cloudNote as unknown as Record<string, unknown>,localFolderId);}}++ if (cloudNotes.length < BATCH_SIZE) break;+ const last = cloudNotes[cloudNotes.length - 1];+ const next = since ? last.updated_at : last.created_at;+ if (next === cursor) break;+ cursor = next;}++ localStorage.setItem("lastSyncedAt.notes", syncStartedAt);} catch (err) {console.error("Note pull failed:", err);}@@ -410,25 +434,26 @@ class SyncService {private async pullConversations(): Promise<void> {try {- let before: string | undefined;- let hasMore = true;-- while (hasMore) {- const { conversations: cloudConvs } = await ConversationsService.list(- BATCH_SIZE,- before,- false,- "messages"- );+ const since = localStorage.getItem("lastSyncedAt.conversations") ?? undefined;+ const syncStartedAt = new Date().toISOString();++ let cursor: string | undefined = since;+ while (true) {+ const { conversations: cloudConvs } = since+ ? await ConversationsService.list(BATCH_SIZE, undefined, false, "messages", cursor)+ : await ConversationsService.list(BATCH_SIZE, cursor, false, "messages");if (cloudConvs.length === 0) break;- hasMore = cloudConvs.length === BATCH_SIZE;- before = cloudConvs[cloudConvs.length - 1].created_at;for (const cloudConv of cloudConvs) {- if (cloudConv.deleted_at) continue;const local = await window.electronAPI.getConversationByClientId?.(cloudConv.client_conversation_id ?? "");++ if (cloudConv.deleted_at) {+ if (local) await window.electronAPI.hardDeleteConversation?.(local.id);+ continue;+ }+if (!local || cloudConv.updated_at > local.updated_at) {await window.electronAPI.upsertConversationFromCloud?.(cloudConv as unknown as Record<string, unknown>,@@ -436,7 +461,15 @@ class SyncService {);}}++ if (cloudConvs.length < BATCH_SIZE) break;+ const last = cloudConvs[cloudConvs.length - 1];+ const next = since ? last.updated_at : last.created_at;+ if (next === cursor) break;+ cursor = next;}++ localStorage.setItem("lastSyncedAt.conversations", syncStartedAt);} catch (err) {console.error("Conversation pull failed:", err);}@@ -500,30 +533,41 @@ class SyncService {private async pullTranscriptions(): Promise<void> {try {- let before: string | undefined;- let hasMore = true;-- while (hasMore) {- const { transcriptions: cloudTs } = await TranscriptionsService.list(- TRANSCRIPTION_BATCH_SIZE,- before- );+ const since = localStorage.getItem("lastSyncedAt.transcriptions") ?? undefined;+ const syncStartedAt = new Date().toISOString();++ let cursor: string | undefined = since;+ while (true) {+ const { transcriptions: cloudTs } = since+ ? await TranscriptionsService.list(TRANSCRIPTION_BATCH_SIZE, undefined, cursor)+ : await TranscriptionsService.list(TRANSCRIPTION_BATCH_SIZE, cursor);if (cloudTs.length === 0) break;- hasMore = cloudTs.length === TRANSCRIPTION_BATCH_SIZE;- before = cloudTs[cloudTs.length - 1].created_at;for (const cloudT of cloudTs) {- if (cloudT.deleted_at) continue;const local = await window.electronAPI.getTranscriptionByClientId?.(cloudT.client_transcription_id ?? "");++ if (cloudT.deleted_at) {+ if (local) await window.electronAPI.hardDeleteTranscription?.(local.id);+ continue;+ }+if (!local) {await window.electronAPI.upsertTranscriptionFromCloud?.(cloudT as unknown as Record<string, unknown>);}}++ if (cloudTs.length < TRANSCRIPTION_BATCH_SIZE) break;+ const last = cloudTs[cloudTs.length - 1];+ const next = since ? last.updated_at : last.created_at;+ if (next === cursor) break;+ cursor = next;}++ localStorage.setItem("lastSyncedAt.transcriptions", syncStartedAt);} catch (err) {console.error("Transcription pull failed:", err);}diff --git a/src/services/TranscriptionsService.ts b/src/services/TranscriptionsService.tsindex 589fb1d86..80d9b02b5 100644--- a/src/services/TranscriptionsService.ts+++ b/src/services/TranscriptionsService.ts@@ -26,6 +26,7 @@ interface CloudTranscription {status: string;deleted_at: string | null;created_at: string;+ updated_at: string;}async function create(transcription: TranscriptionInput): Promise<CloudTranscription> {@@ -42,11 +43,13 @@ async function batchCreate(async function list(limit?: number,- before?: string+ before?: string,+ since?: string): Promise<{ transcriptions: CloudTranscription[] }> {const params = new URLSearchParams();if (limit !== undefined) params.set("limit", String(limit));if (before !== undefined) params.set("before", before);+ if (since !== undefined) params.set("since", since);const query = params.toString();return cloudGet<{ transcriptions: CloudTranscription[] }>(`/api/transcriptions/list${query ? `?${query}` : ""}`diff --git a/src/types/electron.ts b/src/types/electron.tsindex 8f28a9493..ea2b2c4f6 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -494,7 +494,8 @@ declare global {// Note files (markdown mirror)noteFilesSetEnabled?: (enabled: boolean,- customPath?: string+ customPath?: string,+ options?: { skipRebuild?: boolean }) => Promise<{ success: boolean; error?: string }>;noteFilesSetPath?: (path: string) => Promise<{ success: boolean; error?: string }>;noteFilesRebuild?: () => Promise<{ success: boolean; error?: string }>;@@ -1408,6 +1409,10 @@ declare global {diarizationSessionId?: string;error?: string;}>;+ meetingTranscriptionCancel?: () => Promise<{+ success: boolean;+ reason?: "recording-active";+ }>;onMeetingTranscriptionSegment?: (callback: (data: {text: string;