Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

Merge remote-tracking branch 'origin/main' into feat/workspaces-and-sharing-v1

Chadpiha9a7ba424fdb1
diff --cc main.js
index 119a3887e,1a8904adf..e795ba2e9
--- a/main.js
+++ b/main.js
@@@ -535,18 -539,79 +539,91 @@@ function isInvitationDeepLink(url)
return url.slice(`${OAUTH_PROTOCOL}://`.length).startsWith("invitations/");
}
+// Deep links can arrive before windowManager exists (cold start) or before the
+// renderer has mounted its listener. The token is stashed here and the renderer
+// pulls it via `get-pending-invitation-token` on mount; the push below is a
+// best-effort fast path for an already-running app.
+let pendingInvitationDeepLinkToken = null;
+
+ipcMain.handle("get-pending-invitation-token", () => {
+ const token = pendingInvitationDeepLinkToken;
+ pendingInvitationDeepLinkToken = null;
+ return token;
+});
+
+ function isNoteDeepLink(url) {
+ return url.slice(`${OAUTH_PROTOCOL}://`.length).startsWith("notes/");
+ }
+
+ function parseNoteCloudId(deepLinkUrl) {
+ try {
+ const match = deepLinkUrl.match(/notes\/([^/?#]+)/);
+ const cloudId = match?.[1] ? decodeURIComponent(match[1]) : "";
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(cloudId)
+ ? cloudId
+ : null;
+ } catch {
+ return null;
+ }
+ }
+
+ function clearPendingNoteDeepLink() {
+ clearTimeout(pendingNoteRetryTimer);
+ pendingNoteRetryTimer = null;
+ pendingNoteCloudId = null;
+ pendingNoteRetryCount = 0;
+ }
+
+ async function flushPendingNoteDeepLink() {
+ if (!pendingNoteCloudId || !windowManager || !databaseManager) return;
+
+ try {
+ // Surface the panel on the first attempt only; retries just poll the
+ // database so they can't repeatedly steal focus.
+ if (pendingNoteRetryCount === 0) {
+ await windowManager.createControlPanelWindow();
+ }
+
+ const note = databaseManager.getNoteByCloudId(pendingNoteCloudId);
+ if (!note) {
+ // Cloud sync may still be hydrating during a cold launch. Retry briefly so
+ // the handoff can resolve a note pulled after the protocol event arrived.
+ pendingNoteRetryCount += 1;
+ if (pendingNoteRetryCount <= 10) {
+ clearTimeout(pendingNoteRetryTimer);
+ pendingNoteRetryTimer = setTimeout(() => {
+ void flushPendingNoteDeepLink();
+ }, 1000);
+ } else {
+ console.warn("Note deep link could not resolve a local note", {
+ cloudId: pendingNoteCloudId,
+ });
+ clearPendingNoteDeepLink();
+ }
+ return;
+ }
+
+ const payload = { noteId: note.id, folderId: note.folder_id ?? null };
+ clearPendingNoteDeepLink();
+ await windowManager.queueNoteNavigation(payload);
+ } catch (error) {
+ console.error("Note deep link failed:", error);
+ clearPendingNoteDeepLink();
+ }
+ }
+
+ async function handleNoteDeepLink(deepLinkUrl) {
+ const cloudId = parseNoteCloudId(deepLinkUrl);
+ if (!cloudId) {
+ console.warn("Invalid note deep link");
+ return;
+ }
+
+ clearPendingNoteDeepLink();
+ pendingNoteCloudId = cloudId;
+ await flushPendingNoteDeepLink();
+ }
+
function handleInvitationDeepLink(deepLinkUrl) {
try {
const match = deepLinkUrl.match(/invitations\/([^/?#]+)/);
@@@ -871,19 -920,11 +928,22 @@@ async function startApp()
await windowManager.createControlPanelWindow();
}
+ // Windows/Linux cold start delivers protocol URLs via argv (macOS uses
+ // open-url); without this scan a deep link that launches the app is lost.
- if (process.platform !== "darwin") {
- const protocolArg = process.argv.find((arg) => arg.startsWith(`${OAUTH_PROTOCOL}://`));
- if (protocolArg) {
- if (protocolArg.includes("upgrade-success")) {
+ const initialProtocolUrl = process.argv.find((arg) => arg.startsWith(`${OAUTH_PROTOCOL}://`));
+ if (initialProtocolUrl && isNoteDeepLink(initialProtocolUrl)) {
+ await handleNoteDeepLink(initialProtocolUrl);
+ } else {
++ if (initialProtocolUrl && process.platform !== "darwin") {
++ if (initialProtocolUrl.includes("upgrade-success")) {
+ handleUpgradeDeepLink();
- } else if (protocolArg.includes("/invitations/")) {
- handleInvitationDeepLink(protocolArg);
++ } else if (initialProtocolUrl.includes("/invitations/")) {
++ handleInvitationDeepLink(initialProtocolUrl);
+ } else {
- void handleOAuthDeepLink(protocolArg);
++ void handleOAuthDeepLink(initialProtocolUrl);
+ }
+ }
+ await flushPendingNoteDeepLink();
}
// Create agent window (hidden) and set up agent hotkey
diff --cc src/components/SettingsPage.tsx
index 3ae4192d3,46e7663a6..39a4ecb22
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@@ -100,12 -100,13 +100,12 @@@ import { Popover, PopoverContent, Popov
import { startMigration, useMigration } from "../stores/noteStore.js";
import { syncService } from "../services/SyncService.js";
import { formatBytes } from "../utils/formatBytes";
- import { useSettingsStore } from "../stores/settingsStore";
+ import { clearMissingLocalModelSelections, useSettingsStore } from "../stores/settingsStore";
+import { useWorkspaceStore } from "../stores/workspaceStore";
import { canManageSystemAudioInApp } from "../utils/systemAudioAccess";
import WorkspaceSection from "./settings/WorkspaceSection";
-import { WORKSPACES_ENABLED } from "../lib/features";
-
-const formatAmount = (cents: number, currency: string) =>
- (cents / 100).toLocaleString(undefined, { style: "currency", currency });
+import WorkspaceBillingOverview from "./settings/WorkspaceBillingOverview";
+import { formatAmount } from "../utils/formatAmount";
export type SettingsSectionType =
| "account"
diff --cc src/helpers/database.js
index 7d61b5c8c,237ad42e4..03eb2dcf2
--- a/src/helpers/database.js
+++ b/src/helpers/database.js
@@@ -1663,7 -1584,22 +1783,22 @@@ class DatabaseManager
}
}
+ getNoteByCloudId(cloudId) {
+ try {
+ if (!this.db) {
+ throw new Error("Database not initialized");
+ }
+ const stmt = this.db.prepare(
+ "SELECT * FROM notes WHERE cloud_id = ? AND deleted_at IS NULL LIMIT 1"
+ );
+ return stmt.get(cloudId) || null;
+ } catch (error) {
+ debugLogger.error("Error getting note by cloud_id", { error: error.message }, "notes");
+ throw error;
+ }
+ }
+
- getNotes(noteType = null, limit = 100, folderId = null) {
+ getNotes(noteType = null, limit = 100, folderId = null, spaceId = null) {
try {
if (!this.db) {
throw new Error("Database not initialized");
@@@ -3417,9 -2831,12 +3552,12 @@@
}
}
- upsertNoteFromCloud(cloudNote, localFolderId) {
+ upsertNoteFromCloud(cloudNote, localFolderId, localSpaceId = null) {
try {
if (!this.db) throw new Error("Database not initialized");
+ // Sync must never replace non-empty local content/enhanced_content/
+ // transcript with an empty cloud value (#1290, the #938 invariant).
+ // The enhancement prompt/hash travel with enhanced_content.
const stmt = this.db.prepare(`
INSERT INTO notes (client_note_id, cloud_id, title, content, enhanced_content,
enhancement_prompt, enhanced_at_content_hash, note_type, source_file,
@@@ -3429,13 -2846,22 +3567,23 @@@
ON CONFLICT(client_note_id) DO UPDATE SET
cloud_id = excluded.cloud_id,
title = excluded.title,
- content = excluded.content,
- enhanced_content = excluded.enhanced_content,
- enhancement_prompt = excluded.enhancement_prompt,
- enhanced_at_content_hash = excluded.enhanced_at_content_hash,
- transcript = excluded.transcript,
+ content = CASE
+ WHEN COALESCE(excluded.content, '') = '' AND COALESCE(content, '') <> ''
+ THEN content ELSE excluded.content END,
+ enhanced_content = CASE
+ WHEN COALESCE(excluded.enhanced_content, '') = '' AND COALESCE(enhanced_content, '') <> ''
+ THEN enhanced_content ELSE excluded.enhanced_content END,
+ enhancement_prompt = CASE
+ WHEN COALESCE(excluded.enhanced_content, '') = '' AND COALESCE(enhanced_content, '') <> ''
+ THEN enhancement_prompt ELSE excluded.enhancement_prompt END,
+ enhanced_at_content_hash = CASE
+ WHEN COALESCE(excluded.enhanced_content, '') = '' AND COALESCE(enhanced_content, '') <> ''
+ THEN enhanced_at_content_hash ELSE excluded.enhanced_at_content_hash END,
+ transcript = CASE
+ WHEN COALESCE(excluded.transcript, '') = '' AND COALESCE(transcript, '') <> ''
+ THEN transcript ELSE excluded.transcript END,
folder_id = excluded.folder_id,
+ space_id = excluded.space_id,
participants = COALESCE(excluded.participants, participants),
calendar_event_id = COALESCE(excluded.calendar_event_id, calendar_event_id),
diarization_enabled = COALESCE(excluded.diarization_enabled, diarization_enabled),
diff --cc src/locales/de/translation.json
index 9a4f945b3,2c96fc675..3bd169c50
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@@ -367,7 -366,20 +367,8 @@@
"today": "Heute",
"yesterday": "Gestern"
},
- "transcriptionFailed": "Transkription fehlgeschlagen",
- "failedCtaSettings": "Richten Sie Ihren Transkriptionsanbieter ein",
- "failedCtaAndRetry": "und klicken Sie dann auf Wiederholen",
- "failedCtaSettingsOnly": "Richten Sie Ihren Transkriptionsanbieter in den Einstellungen ein",
- "failedLimitReached": "Tageslimit erreicht",
- "failedOffline": "Offline",
- "clearAll": "Alle löschen",
- "clearAllTitle": "Alle Transkriptionen löschen",
- "clearAllDescription": "Alle Transkriptionen und Audiodateien werden dauerhaft entfernt.",
- "clearAllSuccess": "Verlauf gelöscht",
- "clearAllErrorTitle": "Verlauf konnte nicht gelöscht werden",
- "clearAllErrorDescription": "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",
"copyText": "Text kopieren",
+ "copyRawTranscript": "Rohtranskript kopieren",
"deleteItem": "Löschen",
"viewRawTranscript": "Rohtranskript anzeigen",
"showInFolder": "Im Finder anzeigen",
@@@ -1130,10 -1054,9 +1140,11 @@@
"run": "Test ausführen",
"customEndpoint": "Benutzerdefinierter Endpoint",
"apiKeyMissing": "{{provider}} API-Schlüssel nicht konfiguriert. Fügen Sie ihn in den KI-Modelle-Einstellungen hinzu.",
+ "translateHint": "Der Text wird in {{language}} übersetzt",
+ "translation": "Übersetzung",
"translationDisabled": "Aktiviere die Diktatübersetzung, um diesen Prompt zu testen",
- "noTargetLanguage": "Wähle zuerst eine Zielsprache"
+ "noTargetLanguage": "Wähle zuerst eine Zielsprache",
+ "agentDisabled": "Aktiviere den Sprachagenten, um diesen Prompt zu testen"
},
"view": {
"customPrompt": "Benutzerdefinierter Prompt",
@@@ -1960,17 -1675,11 +1972,20 @@@
"audioStorageEmpty": "Keine Audiodateien gespeichert",
"clearAllAudio": "Alle Audiodateien löschen",
"clearAllAudioConfirm": "Alle gespeicherten Audiodateien löschen? Dies kann nicht rückgängig gemacht werden.",
- "saveDiscarded": "Verworfene Diktate speichern",
- "saveDiscardedDescription": "Wenn Sie ein Diktat mit Escape abbrechen, bleibt das Audio im Verlauf, damit Sie es wiederherstellen können. Erfordert aktive Daten- und Audio-Aufbewahrung."
- },
- "prompts": {
- "description": "Den einheitlichen System-Prompt anzeigen, anpassen und testen, der Textbereinigung und Anweisungserkennung steuert",
+ "dataRetention": "Datenaufbewahrung",
+ "dataRetentionDescription": "Transkriptionen und Audio lokal im Verlauf speichern. Wenn deaktiviert, werden Transkriptionen eingefügt, aber nicht gespeichert.",
++ "transcriptRetention": "Transkript-Aufbewahrung",
++ "transcriptRetentionDescription": "Gespeicherte Transkriptionen und deren Audio nach diesem Zeitraum automatisch löschen.",
++ "transcriptRetentionForever": "Unbegrenzt",
+ "hoursAgo": "vor {{count}} Std.",
+ "justNow": "gerade eben",
+ "lastSynced": "Zuletzt synchronisiert {{time}}",
+ "minutesAgo": "vor {{count}} Min.",
+ "saveDiscarded": "Verworfene Diktate speichern",
+ "saveDiscardedDescription": "Wenn Sie ein Diktat mit Escape abbrechen, bleibt das Audio im Verlauf, damit Sie es wiederherstellen können. Erfordert aktive Daten- und Audio-Aufbewahrung."
+ },
+ "prompts": {
+ "description": "Den einheitlichen System-Prompt anzeigen, anpassen und testen, der Textbereinigung und Anweisungserkennung steuert",
"title": "Prompt-Studio"
},
"speechToText": {
@@@ -2689,24 -2246,9 +2708,25 @@@
"back": "Zurück"
},
"meetingPill": {
- "returnToNote": "Zurück zur Aufnahme"
+ "returnToNote": "Zurück zur Aufnahme",
+ "waitingForMicrophone": "Warte auf Mikrofon"
},
+ "empty": {
+ "title": "Noch keine Notizen hier",
+ "description": "Erstelle deine erste Notiz, um loszuschreiben",
+ "selectTitle": "Notiz auswählen",
+ "selectDescription": "Wähle eine Notiz aus der Seitenleiste",
+ "createNote": "Notiz erstellen",
+ "emptyFolder": "Keine Notizen in diesem Ordner"
+ },
+ "addToFolder": {
+ "title": "Notizen hinzufügen",
+ "searchPlaceholder": "Notizen zum Hinzufügen suchen...",
+ "addExisting": "Vorhandene hinzufügen",
+ "addCount": "{{count}} Notizen hinzufügen",
+ "noResults": "Keine passenden Notizen",
+ "noNotesAvailable": "Keine weiteren Notizen verfügbar"
+ },
"context": {
"moveToFolder": "In Ordner verschieben",
"delete": "Löschen",
@@@ -2858,16 -2378,16 +2878,16 @@@
}
},
"dictionary": {
- "addWord": "Wort hinzufügen",
- "removeWord": "{{word}} entfernen",
- "clearAll": "Alle löschen",
"clearTitle": "Wörterbuch leeren?",
"clearDescription": "Dadurch werden alle Wörter aus deinem benutzerdefinierten Wörterbuch entfernt. Diese Aktion kann nicht rückgängig gemacht werden.",
+ "addWord": "Wort hinzufügen",
"addPlaceholder": "Wörter durch Kommas getrennt hinzufügen – OpenWhispr, Supabase, John Snow, ARR",
+ "removeWord": "{{word}} entfernen",
+ "clearAll": "Alle löschen",
"add": "Hinzufügen",
"importWords": "Wörter importieren",
- "importPlaceholder": "Wörter durch Kommas getrennt einfügen...",
- "separateWithCommas": "Mit Kommas trennen",
+ "importPlaceholder": "Wörter durch Kommas oder Zeilenumbrüche getrennt einfügen...",
+ "separateWithCommas": "Ein Wort pro Zeile oder durch Kommas getrennt",
"wordsReady_one": "{{count}} Wort bereit",
"wordsReady_other": "{{count}} Wörter bereit",
"import": "Importieren",
diff --cc src/locales/en/translation.json
index d85fe13ec,c2694df21..1743e0260
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@@ -1130,10 -1142,9 +1140,11 @@@
"run": "Run Test",
"customEndpoint": "Custom endpoint",
"apiKeyMissing": "{{provider}} API key not configured. Add it in AI Models settings.",
+ "translateHint": "The text will be translated to {{language}}",
+ "translation": "Translation",
"translationDisabled": "Enable Dictation Translation to test this prompt",
- "noTargetLanguage": "Pick a target language first"
+ "noTargetLanguage": "Pick a target language first",
+ "agentDisabled": "Enable the voice agent to test this prompt"
},
"view": {
"customPrompt": "Custom prompt",
diff --cc src/locales/es/translation.json
index 19a21e917,680fd395f..42b6d400e
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@@ -1090,10 -1102,9 +1100,11 @@@
"run": "Ejecutar prueba",
"customEndpoint": "Endpoint personalizado",
"apiKeyMissing": "La clave API de {{provider}} no está configurada. Agrégala en la configuración de Modelos de IA.",
+ "translateHint": "El texto se traducirá al {{language}}",
+ "translation": "Traducción",
"translationDisabled": "Activa la traducción de dictado para probar este prompt",
- "noTargetLanguage": "Elige primero un idioma de destino"
+ "noTargetLanguage": "Elige primero un idioma de destino",
+ "agentDisabled": "Activa el agente de voz para probar este prompt"
},
"view": {
"customPrompt": "Prompt personalizado",
diff --cc src/locales/fr/translation.json
index 0aedf0fac,1895c0d4d..74c07f205
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@@ -367,7 -366,20 +367,8 @@@
"today": "Aujourd'hui",
"yesterday": "Hier"
},
- "transcriptionFailed": "La transcription a échoué",
- "failedCtaSettings": "Configurez votre fournisseur de transcription",
- "failedCtaAndRetry": "puis cliquez sur réessayer",
- "failedCtaSettingsOnly": "Configurez votre fournisseur de transcription dans les Paramètres",
- "failedLimitReached": "Limite quotidienne atteinte",
- "failedOffline": "Hors ligne",
- "clearAll": "Tout effacer",
- "clearAllTitle": "Effacer toutes les transcriptions",
- "clearAllDescription": "Toutes les transcriptions et fichiers audio seront définitivement supprimés.",
- "clearAllSuccess": "Historique effacé",
- "clearAllErrorTitle": "Impossible d'effacer l'historique",
- "clearAllErrorDescription": "Une erreur est survenue. Veuillez réessayer.",
"copyText": "Copier le texte",
+ "copyRawTranscript": "Copier la transcription brute",
"deleteItem": "Supprimer",
"viewRawTranscript": "Voir la transcription brute",
"showInFolder": "Afficher dans le Finder",
@@@ -1130,10 -1102,9 +1140,11 @@@
"run": "Lancer le test",
"customEndpoint": "Endpoint personnalisé",
"apiKeyMissing": "Clé API {{provider}} non configurée. Ajoutez-la dans les paramètres Modèles IA.",
+ "translateHint": "Le texte sera traduit en {{language}}",
+ "translation": "Traduction",
"translationDisabled": "Activez la traduction de dictée pour tester ce prompt",
- "noTargetLanguage": "Choisissez d’abord une langue cible"
+ "noTargetLanguage": "Choisissez d’abord une langue cible",
+ "agentDisabled": "Activez l'agent vocal pour tester ce prompt"
},
"view": {
"customPrompt": "Prompt personnalisé",
@@@ -1960,12 -1723,6 +1972,15 @@@
"audioStorageEmpty": "Aucun fichier audio stocké",
"clearAllAudio": "Supprimer tous les fichiers audio",
"clearAllAudioConfirm": "Supprimer tous les fichiers audio stockés ? Cette action est irréversible.",
+ "dataRetention": "Conservation des données",
+ "dataRetentionDescription": "Stocker les transcriptions et l'audio localement dans votre historique. Lorsque désactivé, les transcriptions sont collées mais pas enregistrées.",
++ "transcriptRetention": "Conservation des transcriptions",
++ "transcriptRetentionDescription": "Supprimer automatiquement les transcriptions enregistrées et leur audio après cette période.",
++ "transcriptRetentionForever": "Toujours",
+ "hoursAgo": "il y a {{count}}h",
+ "justNow": "à l'instant",
+ "lastSynced": "Dernière synchronisation {{time}}",
+ "minutesAgo": "il y a {{count}}min",
"saveDiscarded": "Enregistrer les dictées abandonnées",
"saveDiscardedDescription": "Quand vous annulez une dictée avec Échap, conserve son audio dans l'historique pour pouvoir la récupérer. Nécessite la conservation des données et de l'audio."
},
diff --cc src/locales/it/translation.json
index 8743acd84,3401cb500..98390cbe7
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@@ -1042,10 -1054,9 +1052,11 @@@
"run": "Esegui test",
"customEndpoint": "Endpoint personalizzato",
"apiKeyMissing": "Chiave API di {{provider}} non configurata. Aggiungila nelle impostazioni Modelli IA.",
+ "translateHint": "Il testo verrà tradotto in {{language}}",
+ "translation": "Traduzione",
"translationDisabled": "Attiva la traduzione della dettatura per testare questo prompt",
- "noTargetLanguage": "Scegli prima una lingua di destinazione"
+ "noTargetLanguage": "Scegli prima una lingua di destinazione",
+ "agentDisabled": "Abilita l'agente vocale per testare questo prompt"
},
"view": {
"customPrompt": "Prompt personalizzato",
diff --cc src/locales/ja/translation.json
index 07e269504,c8e3d3d44..e19b3eef6
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@@ -1042,10 -1054,9 +1052,11 @@@
"run": "テスト実行",
"customEndpoint": "カスタムエンドポイント",
"apiKeyMissing": "{{provider}} の API キーが未設定です。AI モデル設定で追加してください。",
+ "translateHint": "テキストは{{language}}に翻訳されます",
+ "translation": "翻訳",
"translationDisabled": "このプロンプトをテストするには音声入力翻訳を有効にしてください",
- "noTargetLanguage": "先に翻訳先の言語を選択してください"
+ "noTargetLanguage": "先に翻訳先の言語を選択してください",
+ "agentDisabled": "このプロンプトをテストするには音声エージェントを有効にしてください"
},
"view": {
"customPrompt": "カスタムプロンプト",
diff --cc src/locales/pt/translation.json
index 21fa1a66c,86f0551c6..9da37f9e8
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@@ -1021,10 -1033,9 +1031,11 @@@
"run": "Executar teste",
"customEndpoint": "Endpoint personalizado",
"apiKeyMissing": "Chave API do {{provider}} não configurada. Adicione nas configurações de Modelos de IA.",
+ "translateHint": "O texto será traduzido para {{language}}",
+ "translation": "Tradução",
"translationDisabled": "Ative a tradução de ditado para testar este prompt",
- "noTargetLanguage": "Escolha primeiro um idioma de destino"
+ "noTargetLanguage": "Escolha primeiro um idioma de destino",
+ "agentDisabled": "Ative o agente de voz para testar este prompt"
},
"view": {
"customPrompt": "Prompt personalizado",
diff --cc src/locales/ru/translation.json
index 011fcac39,a1b30320a..61840cd66
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@@ -1042,10 -1054,9 +1052,11 @@@
"run": "Запустить тест",
"customEndpoint": "Пользовательская конечная точка",
"apiKeyMissing": "API-ключ {{provider}} не настроен. Добавьте его в настройках ИИ-моделей.",
+ "translateHint": "Текст будет переведён на {{language}}",
+ "translation": "Перевод",
"translationDisabled": "Включите перевод диктовки, чтобы протестировать этот промпт",
- "noTargetLanguage": "Сначала выберите язык перевода"
+ "noTargetLanguage": "Сначала выберите язык перевода",
+ "agentDisabled": "Включите голосового агента, чтобы протестировать этот промпт"
},
"view": {
"customPrompt": "Пользовательский промпт",
diff --cc src/locales/zh-CN/translation.json
index c2854e8c0,2c112a0bf..52bdd889f
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@@ -1042,10 -1054,9 +1052,11 @@@
"run": "运行测试",
"customEndpoint": "自定义端点",
"apiKeyMissing": "未配置 {{provider}} API 密钥,请在 AI 模型设置中添加。",
+ "translateHint": "文本将翻译为{{language}}",
+ "translation": "翻译",
"translationDisabled": "启用听写翻译以测试此提示词",
- "noTargetLanguage": "请先选择目标语言"
+ "noTargetLanguage": "请先选择目标语言",
+ "agentDisabled": "启用语音助手以测试此提示词"
},
"view": {
"customPrompt": "自定义提示词",
diff --cc src/locales/zh-TW/translation.json
index d4e7ad3e6,ec0344bad..c4031eadb
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@@ -1042,10 -1054,9 +1052,11 @@@
"run": "執行測試",
"customEndpoint": "自訂端點",
"apiKeyMissing": "未設定 {{provider}} API 金鑰。請在 AI 模型設定中新增。",
+ "translateHint": "文字將翻譯為{{language}}",
+ "translation": "翻譯",
"translationDisabled": "啟用聽寫翻譯以測試此提示詞",
- "noTargetLanguage": "請先選擇目標語言"
+ "noTargetLanguage": "請先選擇目標語言",
+ "agentDisabled": "啟用語音助理以測試此提示詞"
},
"view": {
"customPrompt": "自訂提示詞",
diff --cc src/services/SyncService.ts
index ebd67bef2,965707d7d..e3fe38a1c
--- a/src/services/SyncService.ts
+++ b/src/services/SyncService.ts
@@@ -13,9 -11,11 +13,10 @@@ import { TranscriptionsService } from "
import { DictionaryService } from "./DictionaryService.js";
import { SnippetService, type CloudSnippetEntry } from "./SnippetService.js";
import { CloudApiError } from "./cloudApi.js";
-import {
- normalizeTimestamp,
- isCloudEntryNewer,
- buildNoteUpdatePayload,
-} from "../helpers/cloudSyncGuards.js";
+import { notifyTeamSpacesCapabilityChanged } from "../lib/teamSpacesCapability";
+import { subscribeIsSubscribed } from "../lib/subscriptionFlag";
+import { readNoteConflictIds } from "../lib/noteConflictRegistry";
++import { normalizeTimestamp } from "../helpers/cloudSyncGuards.js";
function isHttpStatus(err: unknown, status: number): boolean {
return err instanceof CloudApiError && err.status === status;
@@@ -69,64 -37,6 +70,53 @@@ const SYNC_ALL_LOCK = "openwhispr-sync-
// may have just become possible (sign-in, subscription, backup enabled).
const CAN_SYNC_KEYS = ["isSignedIn", "cloudBackupEnabled", "isSubscribed"];
- // SQLite `datetime('now')` yields "YYYY-MM-DD HH:MM:SS" (no T, no millis, no Z);
- // the cloud sends ISO 8601 "YYYY-MM-DDTHH:MM:SS.sssZ". Normalize both to
- // millis-precision ISO so the pull loop's lexical greater-than compares
- // correctly — without the ".000" pad a whole-second local value sorts after a
- // sub-second cloud value at the same instant ('Z' > '.').
- function normalizeTimestamp(value: string | null | undefined): string {
- if (!value) return "";
- const iso = value.replace(" ", "T").replace(/Z$/, "");
- return (/\.\d+$/.test(iso) ? iso : `${iso}.000`) + "Z";
- }
-
+// Cross-window guard against a space purge racing an in-flight pull: every
+// purge initiator records the cloud space id here, and pull/upsert paths park
+// rows for recently purged spaces instead of resurrecting them as orphaned
+// local rows nothing can ever clean up. Entries are pruned once a spaces pass
+// confirms the space is gone from /api/me/spaces, or after a TTL so a failed
+// delete cannot hide a still-live space forever. Never marked on TEAM delete:
+// a space still accessible via other teams survives the team's archival.
+const PURGED_SPACE_GUARD_KEY = "purgedSpaceIds";
+const PURGED_SPACE_GUARD_TTL_MS = 15 * 60 * 1000;
+// Serializes the guard's read-modify-write across windows: a prune inside a
+// sync pass racing a delete in another window must not drop the just-written
+// entry.
+const PURGED_SPACE_GUARD_LOCK = "openwhispr-purged-spaces";
+
+export function readPurgedSpaceIds(): Record<string, number> {
+ try {
+ const raw = localStorage.getItem(PURGED_SPACE_GUARD_KEY);
+ const parsed = raw ? (JSON.parse(raw) as Record<string, number>) : {};
+ const now = Date.now();
+ return Object.fromEntries(
+ Object.entries(parsed).filter(([, at]) => now - at < PURGED_SPACE_GUARD_TTL_MS)
+ );
+ } catch {
+ return {};
+ }
+}
+
+// Call BEFORE purgeSpace, from every purge path (sync revocation, sign-out,
+// and the UI's delete-space flow).
+export async function markSpacePurged(cloudSpaceId: string): Promise<void> {
+ await navigator.locks.request(PURGED_SPACE_GUARD_LOCK, () => {
+ localStorage.setItem(
+ PURGED_SPACE_GUARD_KEY,
+ JSON.stringify({ ...readPurgedSpaceIds(), [cloudSpaceId]: Date.now() })
+ );
+ });
+}
+
+async function prunePurgedSpaceIds(liveCloudSpaceIds: Set<string>): Promise<void> {
+ await navigator.locks.request(PURGED_SPACE_GUARD_LOCK, () => {
+ const kept = Object.fromEntries(
+ Object.entries(readPurgedSpaceIds()).filter(([id]) => liveCloudSpaceIds.has(id))
+ );
+ localStorage.setItem(PURGED_SPACE_GUARD_KEY, JSON.stringify(kept));
+ });
+}
+
class SyncService {
private syncing = false;
private syncAllPending = false;