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(tone-style): write dictation cleanup in your tone for each kind of app (#2654)
void626acf75e997
diff --git a/CLAUDE.md b/CLAUDE.mdindex fc77c5245..bba483520 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -164,6 +164,7 @@ OpenWhispr is an Electron-based desktop dictation application that uses whisper.- **oauthLoopbackFlow.js**: Shared PKCE auth-code flow over an ephemeral 127.0.0.1 server, used by both calendar OAuth helpers- Events from all providers land in the shared `calendar_events` table with a `provider` column; queries suppress the Apple copy of a meeting when a REST row occupies the same time slot + title (Calendar.app mirrors the same accounts)- **menuManager.js**: Application menu management+- **toneAppCategories.js**: Tone & Style's app classifier (pure, `test/helpers/toneAppCategories.test.js`): an app identity, window title and page host map to `personal`, `work`, `email` or `other` (see Tone & Style)- **tray.js**: System tray icon and menu- **whisper.js**: Local whisper.cpp integration and model management- **parakeet.js**: NVIDIA Parakeet model management via sherpa-onnx@@ -394,6 +395,7 @@ Settings stored in localStorage with these keys:- `hasCompletedOnboarding`: Onboarding completion flag- `customDictionary`: JSON array of words/phrases for improved transcription accuracy- `keepLocalModelLoaded`: Keeps the shared llama-server loaded instead of unloading it after 5 idle minutes (#1207; default off). Synced to main with `sync-startup-preferences`, outside its policy gate; `LlamaServerManager.setKeepResident` acts only on a change, since every window resyncs on load+- `toneStyleEnabled`, `toneStyles`: whether Tone & Style is on (the setup dialog's Finish, or Settings' Tones & voices switch) and the tone picked per kind of app (JSON, normalized by `normalizeToneStyles`)- `emailDraftTarget`: Where email drafts open (`auto`, `gmail`, `gmailSend`, `outlookWork`, `outlookPersonal`, `mailto`); `gmailSend` sends through the Gmail connector's approval card ("Send from chat (Gmail)"); an unknown value reads as `auto`Secret env vars (12 total: 7 BYOK API keys + 5 enterprise cloud creds — see `SECRET_KEYS` in `environment.js`) are encrypted at rest via Electron `safeStorage` and stored as per-key files under `userData/secure-keys/`. They are loaded into `process.env` at startup by `EnvironmentManager.init()`. Renderer reads them via IPC (`get-*-key`) and writes via debounced IPC (`save-*-key`). On Linux without a keyring, secrets fall back to plaintext.@@ -784,6 +786,14 @@ Rows in the `actions` table (built-ins seeded from `src/helpers/builtinActions.j- For material with nothing substantive (only greetings, filler or recording checks), sectioned templates, AI Summary and a summary action writing a first summary ask the model to answer `NOTHING_TO_SUMMARIZE`; custom context-only templates and flat built-ins edited before this rule keep their own rules. A reply that is the marker (bare, fenced, emphasised or after a short sentence) outside a thinking block writes nothing; a summary that merely contains it is saved, and the runner shows `notes.actions.errors.nothingToSummarize` as a neutral notice (`notice` on the error event) instead of saving a placeholder summary- UI: `TemplatePicker` opens from the chevron in the AI Summary tab, which names the note's template; the "Generate AI Summary" callout (runs the note's template, else the default), `ActionPicker` in the collapsed ask bar (runs the last action picked from it, in place of the send button), `ActionChips` once the in-view chat opens and in the docked chat (the first five actions in docked chat; the centered row omits Make notes longer without backfilling another chip; each has its action's icon, and All actions keeps every action; hovering a chip shows its icon, title and description without a destination badge; the in-view chat pins All actions at the end, and the docked chat shows them as filled pills in one tray with its composer: All actions, then the actions, scrolling together), a `/` menu in the note composers (`slashCommands` on `ChatInput`, each row with its action's icon, or a "/" for an icon this build doesn't know; it fills the chat above the composer until a command runs, the "/" is deleted, nothing matches or the composer loses focus), and `ActionManagerDialog` (Templates | Actions). The notes list and the docked chat widen or narrow from their edge facing the note (`useResizableWidth`, `PanelResizeHandle`), and keep their width across launches (localStorage `notesSidebarWidth`, `noteChatWidth`). Anything the ask bar sends (a message, or a chat action from the picker, a chip or the `/` menu) starts a new conversation in the docked chat, which holds the conversation and its history; the in-view chat is only the chips and the composer. Destinations are fixed and described in the editor; saving never asks a model to choose one. Legacy custom summary destinations read as chat (`toActionItem`), keeping the existing IPC fields, IDs and prompts. Summary generation stays in the AI Summary tab and callout. A run that writes the summary is undoable for 6 s instead of asking first: the runner queues the fields it overwrote (`appliedEvents`) and `BackgroundActionToastListener` shows the Undo toast+### 20. Tone & Style++Dictation cleanup writes in the tone the user picked for the kind of app they are dictating into: personal messages (formal, casual, very casual), work messages, email and everything else (formal, casual, excited). Off by default (cleanup keeps the speaker's own tone, the standard tone); turned on by finishing the setup dialog or the Tones & voices switch in Settings > Tone & Style. Only the cleanup route uses it: wake-word agent, voice assistant and translation dictations write in their own voice.++- **Detection** (main, at dictation start): `capture-dictation-app-category` reads the captured target through `selectionManager.getTargetAppContext()` and classifies it with `toneAppCategories.js`. macOS: `macos-text-monitor --app-context <pid>` prints the app name, bundle id, focused window title (accessibility, no Screen Recording needed) and, for a browser page, the URL host. Windows: `windows-fast-paste --detect-only` also prints `WINDOW_TITLE` (an older helper without it classifies by exe only). Linux: the window title is read on demand (`xdotool`/`kdotool getwindowname`) or taken from Hyprland's active window; an AT-SPI target's comes from `linux-fast-paste --atspi-target` (`WINDOW_TITLE_B64`, the active window's accessible name; an older helper prints none). Titles are kept beside the captured target (`_targetTitles`), never on it, since capture results reach the renderer. A browser (and a Windows UWP frame) is judged by its page or app title (its host, else the site name the title ends with; on a host not listed, only a site name the host carries, so a Notion page titled "Hey" stays `other`); native apps by whole-token app identity. Titles and hosts never leave the main process or reach the logs; only the category does+- **Cleanup**: `useAudioRecording` starts `audioManager.beginToneStyleCapture()` for plain dictation while Tone & Style and cleanup are on; the cleanup route's `consumeToneStyle()` (1.5 s guard, unknown app reads as `other`) puts `toneStyle` on the reasoning config. Cloud cleanup sends `tone` + `appCategory` on `/api/reason`, and in the combined Orukeet cleanup's `pipelineOptions`: its prompt is fixed when the session is minted, so `startStreamingRecording` waits for the classification until 250 ms after the capture began (overlapping the mic opening, so the start cue isn't held back after it) before minting, returns without minting if the start was cancelled meanwhile, and holds the audio captured meanwhile until the session has started. An app still unknown then (a Wayland AT-SPI target takes about a second) gets no combined cleanup, and `/api/reason` cleans up in its tone at stop. Warmup mints for the app the last start learned in time (`lastToneAppCategory`), and without combined cleanup while none is known; BYOK and local append `appendToneStyleSuffix` (`src/config/prompts/toneStyle.ts`) after the dictionary suffix. Its sentences are verbatim copies of openwhispr-api's `lib/prompts.ts` (English in every locale, as on the server); the mobile app's `composerPrompt.ts` copies the tone and priority sentences too, so change all three together+- **UI**: Home banner (`ToneStyleBanner`, cleanup-off copy turns cleanup on) and the setup dialog (`ToneStyleSetupDialog`: intro plus one step per category), offered once the user has dictated `TONE_STYLE_PROMPT_MIN_WORDS` (70, `src/config/toneStyle.ts`) words of local history; the dialog opens by itself once, the banner stays until set up or "Not now" (`useToneStylePrompt`). Settings > Tone & Style (`settings/ToneStyleSection.tsx`) has a Tones & voices switch (`toneStyleEnabled`); while it's off, the picks and Save Changes are grayed out. App badges live in `src/assets/icons/apps/`+## Development Guidelines### Internationalization (i18n) — REQUIREDdiff --git a/openwhispr-mobile/src/services/agent/__tests__/composerPrompt.test.ts b/openwhispr-mobile/src/services/agent/__tests__/composerPrompt.test.tsindex 20323ec01..84d68cb4f 100644--- a/openwhispr-mobile/src/services/agent/__tests__/composerPrompt.test.ts+++ b/openwhispr-mobile/src/services/agent/__tests__/composerPrompt.test.ts@@ -137,13 +137,13 @@ describe('context block', () => {// that the plan requires us to reuse verbatim.const EXPECTED_TONE_SENTENCES: Record<string, string> = {formal:- 'Apply this tone: render the text in a formal, professional tone; use complete sentences, no slang or contractions, and keep it courteous and precise. Restyle only; do not add or remove information.',+ "Apply this tone: formal and polished. Use complete sentences with standard capitalization and full punctuation, spell out informal contractions (in English: I will, do not) but keep any the language's grammar requires, and leave out slang, filler, texting shorthand, emoji and em dashes. Restyle only; do not add or remove information.",casual:- 'Apply this tone: render the text in a casual, conversational tone; natural contractions, friendly and relaxed, as if texting a colleague. Restyle only; do not add or remove information.',+ "Apply this tone: casual and friendly, like a quick note to a colleague. Use the language's everyday contractions (in English: I'll, it's, don't) and everyday wording, standard capitalization and light punctuation with no semicolons or em dashes; a final period can be dropped. Restyle only; do not add or remove information.",very_casual:- 'Apply this tone: render the text in a very casual, informal tone; contractions, light slang, and relaxed phrasing are welcome, while keeping it brief and breezy. Restyle only; do not add or remove information.',+ 'Apply this tone: very casual, like texting a friend. Write in all lowercase and keep punctuation light: a question still ends with a question mark, but drop the final period and never use em dashes. Use texting shorthand common in the output language only where it stands for the exact words (in English: "u" for you, "lmk" for let me know). Restyle only; do not add or remove information.',excited:- 'Apply this tone: render the text in an enthusiastic, upbeat, energetic tone; emphatic phrasing is welcome and exclamation marks may be used sparingly and naturally. Restyle only; do not add or remove information.',+ 'Apply this tone: upbeat and enthusiastic. Use standard capitalization and warm, energetic wording, and end positive or friendly sentences with an exclamation mark, without overdoing it. Use commas or periods, never semicolons or em dashes, and no emoji. Restyle only; do not add or remove information.',};describe('tone block', () => {diff --git a/openwhispr-mobile/src/services/agent/composerPrompt.ts b/openwhispr-mobile/src/services/agent/composerPrompt.tsindex d24a693f8..b23c8d34b 100644--- a/openwhispr-mobile/src/services/agent/composerPrompt.ts+++ b/openwhispr-mobile/src/services/agent/composerPrompt.ts@@ -4,15 +4,19 @@ import type { KeyboardTone } from '@/types';// Any change here must stay in sync with the server-side source.export const TONE_INSTRUCTIONS: Partial<Record<KeyboardTone, string>> = {formal:- 'Apply this tone: render the text in a formal, professional tone; use complete sentences, no slang or contractions, and keep it courteous and precise. Restyle only; do not add or remove information.',+ "Apply this tone: formal and polished. Use complete sentences with standard capitalization and full punctuation, spell out informal contractions (in English: I will, do not) but keep any the language's grammar requires, and leave out slang, filler, texting shorthand, emoji and em dashes. Restyle only; do not add or remove information.",casual:- 'Apply this tone: render the text in a casual, conversational tone; natural contractions, friendly and relaxed, as if texting a colleague. Restyle only; do not add or remove information.',+ "Apply this tone: casual and friendly, like a quick note to a colleague. Use the language's everyday contractions (in English: I'll, it's, don't) and everyday wording, standard capitalization and light punctuation with no semicolons or em dashes; a final period can be dropped. Restyle only; do not add or remove information.",very_casual:- 'Apply this tone: render the text in a very casual, informal tone; contractions, light slang, and relaxed phrasing are welcome, while keeping it brief and breezy. Restyle only; do not add or remove information.',+ 'Apply this tone: very casual, like texting a friend. Write in all lowercase and keep punctuation light: a question still ends with a question mark, but drop the final period and never use em dashes. Use texting shorthand common in the output language only where it stands for the exact words (in English: "u" for you, "lmk" for let me know). Restyle only; do not add or remove information.',excited:- 'Apply this tone: render the text in an enthusiastic, upbeat, energetic tone; emphatic phrasing is welcome and exclamation marks may be used sparingly and naturally. Restyle only; do not add or remove information.',+ 'Apply this tone: upbeat and enthusiastic. Use standard capitalization and warm, energetic wording, and end positive or friendly sentences with an exclamation mark, without overdoing it. Use commas or periods, never semicolons or em dashes, and no emoji. Restyle only; do not add or remove information.',};+// The server's TONE_PRIORITY_INSTRUCTION, which cleanup appends after the tone.+export const TONE_PRIORITY_INSTRUCTION =+ "This tone overrides any instruction to keep the speaker's tone, voice, style, wording or formality, and it sets capitalization and punctuation; names, acronyms and dictionary terms keep their exact spelling and capitalization. It never changes meaning or intent. Every other cleanup rule still applies.";+const BASE_PROMPT = `You are a text composition assistant embedded in a keyboard. The user's message is always an INSTRUCTION describing what to write — never text to transcribe and never a question for you to answer.OUTPUT RULES:diff --git a/openwhispr-mobile/src/services/reasoning/__tests__/buildProviderPrompt.test.ts b/openwhispr-mobile/src/services/reasoning/__tests__/buildProviderPrompt.test.tsindex 3c8bfefbb..f63ba2687 100644--- a/openwhispr-mobile/src/services/reasoning/__tests__/buildProviderPrompt.test.ts+++ b/openwhispr-mobile/src/services/reasoning/__tests__/buildProviderPrompt.test.ts@@ -15,8 +15,11 @@ it('builds cleanup prompts locally with language, dictionary, tone and agent-namexpect(prompt.systemPrompt).toContain('Custom Dictionary (use these exact spellings when they appear in the text): OpenWhispr',);- expect(prompt.systemPrompt).toContain('formal, professional tone');+ expect(prompt.systemPrompt).toContain('Apply this tone: formal and polished.');expect(prompt.systemPrompt).toContain('Restyle only; do not add or remove information.');+ expect(prompt.systemPrompt).toContain(+ "This tone overrides any instruction to keep the speaker's tone, voice, style, wording or formality, and it sets capitalization and punctuation;",+ );expect(prompt.text).toBe('<transcript>\num hello\n</transcript>\n\nOutput only the cleaned transcript.',);@@ -32,7 +35,7 @@ it('keeps custom cleanup prompts as cleanup transforms with contextual instructi});expect(prompt.systemPrompt).toContain('Be concise, Aria.');expect(prompt.systemPrompt).toContain('You MUST write your entire output in German');- expect(prompt.systemPrompt).toContain('casual, conversational tone');+ expect(prompt.systemPrompt).toContain('Apply this tone: casual and friendly');expect(prompt.text).toContain('<transcript>');});diff --git a/openwhispr-mobile/src/services/reasoning/buildProviderPrompt.ts b/openwhispr-mobile/src/services/reasoning/buildProviderPrompt.tsindex 64b6eb4e7..abc1b6b0a 100644--- a/openwhispr-mobile/src/services/reasoning/buildProviderPrompt.ts+++ b/openwhispr-mobile/src/services/reasoning/buildProviderPrompt.ts@@ -1,6 +1,6 @@import { DEFAULT_CLEANUP_PROMPT } from '@/config/prompts/registry';import languageRegistry from '@/config/languageRegistry.json';-import { TONE_INSTRUCTIONS } from '@/services/agent/composerPrompt';+import { TONE_INSTRUCTIONS, TONE_PRIORITY_INSTRUCTION } from '@/services/agent/composerPrompt';import type { ReasoningRequest } from '@/types';export interface ProviderPrompt {@@ -39,7 +39,7 @@ export function buildProviderPrompt(request: ReasoningRequest): ProviderPrompt {const words = request.customDictionary?.map((word) => word.trim()).filter(Boolean) ?? [];if (words.length) parts.push(DICTIONARY_PREFIX + words.join(', '));const tone = request.tone ? TONE_INSTRUCTIONS[request.tone] : undefined;- if (tone) parts.push(tone);+ if (tone) parts.push(`${tone} ${TONE_PRIORITY_INSTRUCTION}`);return {systemPrompt: parts.join('\n\n'),text: `<transcript>\n${request.text}\n</transcript>\n\nOutput only the cleaned transcript.`,diff --git a/preload.js b/preload.jsindex 40ca4ced8..2371be9c2 100644--- a/preload.js+++ b/preload.js@@ -101,6 +101,7 @@ contextBridge.exposeInMainWorld("electronAPI", {showDictationPanel: () => ipcRenderer.invoke("show-dictation-panel"),openSettingsSection: (section) => ipcRenderer.invoke("open-settings-section", section),captureDictationTarget: () => ipcRenderer.invoke("capture-dictation-target"),+ captureDictationAppCategory: () => ipcRenderer.invoke("capture-dictation-app-category"),onToggleDictation: registerListener("toggle-dictation", (callback) => () => callback()),onToggleVoiceAgent: registerListener("toggle-voice-agent", (callback) => () => callback()),onToggleTranslation: registerListener("toggle-translation", (callback) => () => callback()),diff --git a/resources/linux-fast-paste.c b/resources/linux-fast-paste.cindex c9e666413..1d528ef70 100644--- a/resources/linux-fast-paste.c+++ b/resources/linux-fast-paste.c@@ -526,10 +526,20 @@ static int print_atspi_target(void) {AtspiAccessible *app = NULL;AtspiAccessible *win = find_active_atspi_window(&app);int pid = app ? atspi_active_pid(app) : 0;+ char *title = pid && win ? atspi_accessible_get_name(win, NULL) : NULL;if (win) g_object_unref(win);if (app) g_object_unref(app);if (!pid) return 1;printf("TARGET ATSPI %d\n", pid);+ /* The window's name is its title ("Inbox - Gmail - Google Chrome"), which+ * Tone & Style reads to tell a browser's sites apart. Base64 keeps a title+ * from forging a line. */+ if (title && *title) {+ gchar *encoded = g_base64_encode((const guchar *)title, strlen(title));+ printf("WINDOW_TITLE_B64 %s\n", encoded);+ g_free(encoded);+ }+ g_free(title);return 0;}diff --git a/resources/macos-text-monitor.swift b/resources/macos-text-monitor.swiftindex bec23d687..0a7b2885b 100644--- a/resources/macos-text-monitor.swift+++ b/resources/macos-text-monitor.swift@@ -119,18 +119,24 @@ func observerCallback(// macos-text-monitor --selected-text <pid>// macos-text-monitor --editable-target <pid>// macos-text-monitor --window-bounds <pid>+// macos-text-monitor --app-context <pid>let selectionReadMode = CommandLine.arguments.count >= 3 &&CommandLine.arguments[1] == "--selected-text"let editableTargetMode = CommandLine.arguments.count >= 3 &&CommandLine.arguments[1] == "--editable-target"let windowBoundsMode = CommandLine.arguments.count >= 3 &&CommandLine.arguments[1] == "--window-bounds"-let pidArgumentIndex = selectionReadMode || editableTargetMode || windowBoundsMode ? 2 : 1+let appContextMode = CommandLine.arguments.count >= 3 &&+ CommandLine.arguments[1] == "--app-context"+let pidArgumentIndex =+ selectionReadMode || editableTargetMode || windowBoundsMode || appContextMode ? 2 : 1guard CommandLine.arguments.count > pidArgumentIndex,let targetPid = Int32(CommandLine.arguments[pidArgumentIndex]),targetPid > 0 else {- writeError("Usage: macos-text-monitor [--selected-text|--editable-target|--window-bounds] <pid>")+ writeError(+ "Usage: macos-text-monitor [--selected-text|--editable-target|--window-bounds|--app-context] <pid>"+ )writeOutput("NO_ELEMENT")exit(1)}@@ -170,6 +176,48 @@ if windowBoundsMode {exit(0)}+// Names the target app and the page a browser shows, so dictation cleanup can+// match the tone to where the text goes. The window title comes from+// accessibility, which needs no Screen Recording permission (only window+// server titles do); the page URL comes from the focused element's web area,+// which Safari exposes and Chromium exposes once its tree is awake. Only the+// URL's host is printed. Anything unreadable is left out.+if appContextMode {+ if let app = NSRunningApplication(processIdentifier: targetPid) {+ if let name = app.localizedName { writeTextOutput("APP_NAME", name) }+ if let bundleId = app.bundleIdentifier { writeTextOutput("BUNDLE_ID", bundleId) }+ }++ // Set on the system-wide element, the timeout covers every element read+ // below, so a busy app can't hold the dictation for the 6 s default.+ AXUIElementSetMessagingTimeout(AXUIElementCreateSystemWide(), 0.5)+ let app = AXUIElementCreateApplication(targetPid)+ func attribute(_ element: AXUIElement, _ name: String) -> AnyObject? {+ var value: AnyObject?+ return AXUIElementCopyAttributeValue(element, name as CFString, &value) == .success+ ? value : nil+ }++ if let window = attribute(app, kAXFocusedWindowAttribute),+ let title = attribute(window as! AXUIElement, kAXTitleAttribute) as? String,+ !title.isEmpty {+ writeTextOutput("WINDOW_TITLE", title)+ }++ var element = attribute(app, kAXFocusedUIElementAttribute).map { $0 as! AXUIElement }+ for _ in 0..<40 {+ guard let current = element else { break }+ if elementRole(current) == "AXWebArea" {+ if let host = (attribute(current, "AXURL") as? URL)?.host {+ writeOutput("URL_HOST:\(host)")+ }+ break+ }+ element = attribute(current, kAXParentAttribute).map { $0 as! AXUIElement }+ }+ exit(0)+}+// Read original text from stdin (monitoring mode only). Selection reads are// spawned via execFile, which keeps stdin open without writing — blocking on// readLine there would hang until the caller's timeout kills the process.diff --git a/resources/windows-fast-paste.c b/resources/windows-fast-paste.cindex 4aeb6b714..e542c1229 100644--- a/resources/windows-fast-paste.c+++ b/resources/windows-fast-paste.c@@ -84,6 +84,26 @@ static BOOL GetExeName(HWND hwnd, char* exeName, DWORD exeNameSize) {return TRUE;}+/* The window title as one UTF-8 line, for the Tone & Style app classifier: a+ browser's title names the site it shows. Control characters and the+ Unicode line separators become spaces, so a title can't start a line of+ its own in this output. */+static BOOL GetWindowTitleUtf8(HWND hwnd, char* title, int titleSize) {+ wchar_t wideTitle[512];+ int wideLen = GetWindowTextW(hwnd, wideTitle, 512);+ if (wideLen <= 0) return FALSE;+ for (int i = 0; i < wideLen; i++) {+ if (wideTitle[i] < 0x20 || wideTitle[i] == 0x2028 || wideTitle[i] == 0x2029) {+ wideTitle[i] = L' ';+ }+ }++ int len = WideCharToMultiByte(CP_UTF8, 0, wideTitle, wideLen, title, titleSize - 1, NULL, NULL);+ if (len <= 0) return FALSE;+ title[len] = '\0';+ return TRUE;+}+static BOOL IsTerminalExe(const char* exeName) {for (int i = 0; TERMINAL_EXES[i] != NULL; i++) {if (_stricmp(exeName, TERMINAL_EXES[i]) == 0) {@@ -296,6 +316,11 @@ int main(int argc, char* argv[]) {if (gotExeName) {printf("EXE_NAME %s\n", exeName);}+ /* 511 UTF-16 units take at most 1533 UTF-8 bytes. */+ char title[1536];+ if (GetWindowTitleUtf8(hwnd, title, sizeof(title))) {+ printf("WINDOW_TITLE %s\n", title);+ }printf("IS_TERMINAL %s\n", isTerminal ? "true" : "false");fflush(stdout);return 0;diff --git a/scripts/sync-nucleo-icons.js b/scripts/sync-nucleo-icons.jsindex 894832ff5..5e8040167 100644--- a/scripts/sync-nucleo-icons.js+++ b/scripts/sync-nucleo-icons.js@@ -101,6 +101,7 @@ export {Quote,Square,SquareSlash,+ SquareSparkle,Strikethrough,Table,} from "./primitives";diff --git a/src/assets/icons/apps/apple-mail.svg b/src/assets/icons/apps/apple-mail.svgnew file mode 100644index 000000000..86507f3d2--- /dev/null+++ b/src/assets/icons/apps/apple-mail.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><defs><linearGradient id="g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5BC8FF"/><stop offset="1" stop-color="#1A75F0"/></linearGradient></defs><circle cx="24" cy="24" r="24" fill="url(#g)"/><g transform="translate(10.8 10.8) scale(1.1)"><rect x="3" y="6" width="18" height="12.5" rx="1.8" fill="#fff"/><path fill="none" stroke="#6FB4F5" stroke-width="1.1" stroke-linejoin="round" d="M3.6 6.8 12 13.2 20.4 6.8M3.6 17.8l6.2-5.5M20.4 17.8l-6.2-5.5"/></g></svg>diff --git a/src/assets/icons/apps/chatgpt.svg b/src/assets/icons/apps/chatgpt.svgnew file mode 100644index 000000000..cd7455d93--- /dev/null+++ b/src/assets/icons/apps/chatgpt.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#FFFFFF"/><g transform="translate(10.2 10.2) scale(1.15)"><path fill="#0D0D0D" d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"/></g></svg>diff --git a/src/assets/icons/apps/claude.svg b/src/assets/icons/apps/claude.svgnew file mode 100644index 000000000..ebef5e62e--- /dev/null+++ b/src/assets/icons/apps/claude.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#D97757"/><g transform="translate(10.8 10.8) scale(1.1)"><path fill="#fff" d="m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"/></g></svg>diff --git a/src/assets/icons/apps/gmail.svg b/src/assets/icons/apps/gmail.svgnew file mode 100644index 000000000..39584c7e4--- /dev/null+++ b/src/assets/icons/apps/gmail.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#FFFFFF"/><g transform="translate(12 12) scale(1)"><g transform="translate(0 3) scale(0.5)"><path fill="#4285f4" d="M3.273 36h7.636V17.455L0 9.273v23.454A3.273 3.273 0 0 0 3.273 36"/><path fill="#34a853" d="M37.09 36h7.637A3.273 3.273 0 0 0 48 32.727V9.273l-10.91 8.182"/><path fill="#fbbc04" d="M37.09 3.273v14.182L48 9.273V4.909c0-4.047-4.618-6.356-7.854-3.927"/><path fill="#ea4335" d="M10.91 17.455V3.273L24 13.09 37.09 3.273v14.182L24 27.273"/><path fill="#c5221f" d="M0 4.91v4.363l10.91 8.182V3.273L7.854.982C4.618-1.446 0 .862 0 4.909"/></g></g></svg>diff --git a/src/assets/icons/apps/google-chat.svg b/src/assets/icons/apps/google-chat.svgnew file mode 100644index 000000000..04254493b--- /dev/null+++ b/src/assets/icons/apps/google-chat.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#FFFFFF"/><g transform="translate(12 12) scale(1)"><path fill="#34A853" d="M1.637 0C.733 0 0 .733 0 1.637v16.5c0 .904.733 1.636 1.637 1.636h3.955v3.323c0 .804.97 1.207 1.539.638l3.963-3.96h11.27c.903 0 1.636-.733 1.636-1.637V5.592L18.408 0Zm3.955 5.592h12.816v8.59H8.455l-2.863 2.863Z"/></g></svg>diff --git a/src/assets/icons/apps/instagram.svg b/src/assets/icons/apps/instagram.svgnew file mode 100644index 000000000..1b96cc732--- /dev/null+++ b/src/assets/icons/apps/instagram.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><defs><radialGradient id="g" cx="0.3" cy="1.07" r="1.2"><stop offset="0" stop-color="#FFD776"/><stop offset="0.25" stop-color="#F3A554"/><stop offset="0.5" stop-color="#E13C64"/><stop offset="0.8" stop-color="#BB2DA9"/><stop offset="1" stop-color="#6A3BD0"/></radialGradient></defs><circle cx="24" cy="24" r="24" fill="url(#g)"/><g transform="translate(12 12) scale(1)"><path fill="#fff" d="M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077"/></g></svg>diff --git a/src/assets/icons/apps/linear.svg b/src/assets/icons/apps/linear.svgnew file mode 100644index 000000000..ab506eb6a--- /dev/null+++ b/src/assets/icons/apps/linear.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#5E6AD2"/><g transform="translate(12.6 12.6) scale(0.95)"><path fill="#fff" d="M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"/></g></svg>diff --git a/src/assets/icons/apps/linkedin.svg b/src/assets/icons/apps/linkedin.svgnew file mode 100644index 000000000..755050fa0--- /dev/null+++ b/src/assets/icons/apps/linkedin.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#0A66C2"/><g transform="translate(12 12) scale(1)"><path fill="#fff" d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zM7.119 20.452H3.555V9h3.564v11.452z"/></g></svg>diff --git a/src/assets/icons/apps/messages.svg b/src/assets/icons/apps/messages.svgnew file mode 100644index 000000000..1e71b2f5b--- /dev/null+++ b/src/assets/icons/apps/messages.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#34C759"/><g transform="translate(9 9) scale(1.25)"><path fill="#fff" d="M12 4.154a8.809 7.337 0 0 1 8.809 7.338A8.809 7.337 0 0 1 12 18.828a8.809 7.337 0 0 1-2.492-.303A8.656 7.337 0 0 1 5.93 19.93a9.929 7.337 0 0 0 1.54-2.155 8.809 7.337 0 0 1-4.279-6.283A8.809 7.337 0 0 1 12 4.154"/></g></svg>diff --git a/src/assets/icons/apps/notion-glyph.svg b/src/assets/icons/apps/notion-glyph.svgnew file mode 100644index 000000000..92d142481--- /dev/null+++ b/src/assets/icons/apps/notion-glyph.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#FFFFFF" d="M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"/></svg>diff --git a/src/assets/icons/apps/notion.svg b/src/assets/icons/apps/notion.svgnew file mode 100644index 000000000..aeb8004bb--- /dev/null+++ b/src/assets/icons/apps/notion.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#FFFFFF"/><g transform="translate(10.8 10.8) scale(1.1)"><path fill="#000" d="M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"/></g></svg>diff --git a/src/assets/icons/apps/outlook.svg b/src/assets/icons/apps/outlook.svgnew file mode 100644index 000000000..f9e0dd567--- /dev/null+++ b/src/assets/icons/apps/outlook.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#0F6CBD"/><g transform="translate(12 12) scale(1)"><path fill="#fff" d="M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V10.85l1.24.72h.01q.1.07.18.18.07.12.07.25zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.8v-2.73zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z"/></g></svg>diff --git a/src/assets/icons/apps/slack.svg b/src/assets/icons/apps/slack.svgnew file mode 100644index 000000000..2894dce90--- /dev/null+++ b/src/assets/icons/apps/slack.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#4A154B"/><g transform="translate(11.4 11.4) scale(1.05)"><g transform="scale(0.444444)"><path d="M11.379 33.9993C11.379 37.1358 8.84512 39.6507 5.7276 39.6507C2.61008 39.6507 0.0572205 37.1168 0.0572205 33.9993C0.0572205 30.8817 2.5911 28.3479 5.70862 28.3479H11.36V33.9993H11.379Z" fill="#E3066A"/><path d="M14.1962 33.9997C14.1962 30.8632 16.7301 28.3483 19.8476 28.3483C22.9651 28.3483 25.499 30.8822 25.499 33.9997V48.1353C25.499 51.2718 22.9651 53.7867 19.8476 53.7867C16.7301 53.7867 14.1962 51.2718 14.1962 48.1353V33.9997Z" fill="#E3066A"/><path d="M19.8662 11.2673C16.7296 11.2673 14.2148 8.73347 14.2148 5.61594C14.2148 2.49842 16.7486 -0.0354538 19.8662 -0.0354538C22.9837 -0.0354538 25.5175 2.49842 25.5175 5.61594V11.2673H19.8662Z" fill="#00B3FF"/><path d="M19.8682 14.1334C23.0047 14.1334 25.5196 16.6673 25.5196 19.7848C25.5196 22.9023 22.9857 25.4362 19.8682 25.4362H5.67566C2.53916 25.4362 0.0242615 22.9023 0.0242615 19.7848C0.0242615 16.6673 2.55814 14.1334 5.67566 14.1334H19.8682Z" fill="#00B3FF"/><path d="M42.5323 19.7853C42.5323 16.6488 45.0662 14.1339 48.1837 14.1339C51.3012 14.1339 53.8351 16.6678 53.8351 19.7853C53.8351 22.9028 51.3012 25.4367 48.1837 25.4367H42.5323V19.7853Z" fill="#41B658"/><path d="M39.7126 19.7934C39.7126 22.9299 37.1787 25.4448 34.0612 25.4448C30.9436 25.4448 28.4098 22.911 28.4098 19.7934V5.61986C28.4098 2.48336 30.9436 -0.0315399 34.0612 -0.0315399C37.1787 -0.0315399 39.7126 2.48336 39.7126 5.61986V19.7934Z" fill="#41B658"/><path d="M34.0376 42.482C37.1741 42.482 39.689 45.0158 39.689 48.1334C39.689 51.2509 37.1552 53.7848 34.0376 53.7848C30.9201 53.7848 28.3862 51.2509 28.3862 48.1334V42.482H34.0376Z" fill="#FCC003"/><path d="M34.0381 39.6507C30.9016 39.6507 28.3867 37.1168 28.3867 33.9993C28.3867 30.8818 30.9206 28.3479 34.0381 28.3479H48.2306C51.3671 28.3479 53.882 30.8818 53.882 33.9993C53.882 37.1168 51.3482 39.6507 48.2306 39.6507H34.0381Z" fill="#FCC003"/></g></g></svg>diff --git a/src/assets/icons/apps/superhuman.svg b/src/assets/icons/apps/superhuman.svgnew file mode 100644index 000000000..8a3aa1c8e--- /dev/null+++ b/src/assets/icons/apps/superhuman.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#141414"/><g transform="translate(12.6 12.6) scale(0.95)"><path fill="none" stroke="#fff" stroke-width="1.8" stroke-linejoin="round" d="M12 3.5 19.5 8 12 12.5 4.5 8Z"/><path fill="none" stroke="#B9A6FF" stroke-width="1.8" stroke-linejoin="round" d="M7.5 13.8 12 16.5 19.5 12M4.5 16 12 20.5 19.5 16"/></g></svg>diff --git a/src/assets/icons/apps/teams.svg b/src/assets/icons/apps/teams.svgnew file mode 100644index 000000000..d85e5ebda--- /dev/null+++ b/src/assets/icons/apps/teams.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#E8E9F8"/><g transform="translate(11.4 11.4) scale(1.05)"><path fill="#5059C9" d="M20.625 8.127q-.55 0-1.025-.205-.475-.205-.832-.563-.358-.357-.563-.832Q18 6.053 18 5.502q0-.54.205-1.02t.563-.837q.357-.358.832-.563.474-.205 1.025-.205.54 0 1.02.205t.837.563q.358.357.563.837.205.48.205 1.02 0 .55-.205 1.025-.205.475-.563.832-.357.358-.837.563-.48.205-1.02.205zm0-3.75q-.469 0-.797.328-.328.328-.328.797 0 .469.328.797.328.328.797.328.469 0 .797-.328.328-.328.328-.797 0-.469-.328-.797-.328-.328-.797-.328zM24 10.002v5.578q0 .774-.293 1.46-.293.685-.803 1.194-.51.51-1.195.803-.686.293-1.459.293-.445 0-.908-.105-.463-.106-.85-.329-.293.95-.855 1.729-.563.78-1.319 1.336-.756.557-1.67.861-.914.305-1.898.305-1.148 0-2.162-.398-1.014-.399-1.805-1.102-.79-.703-1.312-1.664t-.674-2.086h-5.8q-.411 0-.704-.293T0 16.881V6.873q0-.41.293-.703t.703-.293h8.59q-.34-.715-.34-1.5 0-.727.275-1.365.276-.639.75-1.114.475-.474 1.114-.75.638-.275 1.365-.275t1.365.275q.639.276 1.114.75.474.475.75 1.114.275.638.275 1.365t-.275 1.365q-.276.639-.75 1.113-.475.475-1.114.75-.638.276-1.365.276-.188 0-.375-.024-.188-.023-.375-.058v1.078h10.875q.469 0 .797.328.328.328.328.797zM12.75 2.373q-.41 0-.78.158-.368.158-.638.434-.27.275-.428.639-.158.363-.158.773 0 .41.158.78.159.368.428.638.27.27.639.428.369.158.779.158.41 0 .773-.158.364-.159.64-.428.274-.27.433-.639.158-.369.158-.779 0-.41-.158-.773-.159-.364-.434-.64-.275-.275-.639-.433-.363-.158-.773-.158zM6.937 9.814h2.25V7.94H2.814v1.875h2.25v6h1.875zm10.313 7.313v-6.75H12v6.504q0 .41-.293.703t-.703.293H8.309q.152.809.556 1.5.405.691.985 1.19.58.497 1.318.779.738.281 1.582.281.926 0 1.746-.352.82-.351 1.436-.966.615-.616.966-1.43.352-.815.352-1.752zm5.25-1.547v-5.203h-3.75v6.855q.305.305.691.452.387.146.809.146.469 0 .879-.176.41-.175.715-.48.304-.305.48-.715t.176-.879Z"/></g></svg>diff --git a/src/assets/icons/apps/telegram.svg b/src/assets/icons/apps/telegram.svgnew file mode 100644index 000000000..1f76bb6f6--- /dev/null+++ b/src/assets/icons/apps/telegram.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#26A5E4"/><g transform="translate(6 6) scale(1.5)"><g transform="translate(0.4 -1)"><path fill="#fff" d="M16.906 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></g></g></svg>diff --git a/src/assets/icons/apps/whatsapp.svg b/src/assets/icons/apps/whatsapp.svgnew file mode 100644index 000000000..cb3677670--- /dev/null+++ b/src/assets/icons/apps/whatsapp.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><circle cx="24" cy="24" r="24" fill="#25D366"/><g transform="translate(10.8 10.8) scale(1.1)"><path fill="#fff" d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"/></g></svg>diff --git a/src/components/HistoryView.tsx b/src/components/HistoryView.tsxindex 0261e8ca1..24b304f4a 100644--- a/src/components/HistoryView.tsx+++ b/src/components/HistoryView.tsx@@ -18,6 +18,10 @@ import UpcomingMeetings from "./UpcomingMeetings";import { useSettingsStore } from "../stores/settingsStore";import { effectiveLocalHistoryEnabled } from "../stores/policyRules";import { usePolicyStore } from "../stores/policyStore";+import { useToneStylePrompt } from "../hooks/useToneStylePrompt";+import ToneStyleBanner from "./toneStyle/ToneStyleBanner";+import ToneStyleSetupDialog from "./toneStyle/ToneStyleSetupDialog";+import { turnOnDictationCleanup } from "./toneStyle/dictationCleanup";interface HistoryViewProps {history: TranscriptionItemType[];@@ -63,6 +67,7 @@ export default function HistoryView({effectiveLocalHistoryEnabled(policyState, personalDataRetentionEnabled));const { events, isLoading: eventsLoading, isConnected } = useUpcomingEvents();+ const toneStylePrompt = useToneStylePrompt();const firstName = userName?.trim().split(/\s+/)[0];const hasHistory = history.length > 0;@@ -119,7 +124,23 @@ export default function HistoryView({t(hasHistory ? "controlPanel.history.welcomeBack" : "controlPanel.history.welcome"))}</h2>- {!useCleanupModel && !aiCTADismissed && (+ {toneStylePrompt.showBanner && (+ <ToneStyleBanner+ cleanupEnabled={useCleanupModel}+ onStart={() => {+ if (!useCleanupModel) turnOnDictationCleanup();+ toneStylePrompt.setDialogOpen(true);+ }}+ onDismiss={toneStylePrompt.dismissBanner}+ />+ )}+ <ToneStyleSetupDialog+ open={toneStylePrompt.dialogOpen}+ onOpenChange={toneStylePrompt.setDialogOpen}+ onOpenSettings={onOpenSettings}+ />+ {/* The Tone & Style banner offers to turn cleanup on itself. */}+ {!useCleanupModel && !aiCTADismissed && !toneStylePrompt.showBanner && (<div className="mb-3 relative rounded-lg border border-primary/20 bg-primary/5 dark:bg-primary/10 p-3"><buttononClick={() => {diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsxindex e51317c5e..cf290fd9e 100644--- a/src/components/SettingsModal.tsx+++ b/src/components/SettingsModal.tsx@@ -12,6 +12,7 @@ import {Shield,ShieldCheck,Users,+ SquareSparkle,} from "./icons";import SidebarModal, { type SidebarItem } from "./ui/SidebarModal";import SettingsPage, { AccountAvatar, SettingsSectionType } from "./SettingsPage";@@ -98,6 +99,13 @@ export default function SettingsModal({ open, onOpenChange, initialSection }: Sedescription: t("settingsModal.sections.hotkeys.description"),group: t("settingsModal.groups.app"),},+ {+ id: "toneStyle",+ label: t("settingsModal.sections.toneStyle.label"),+ icon: SquareSparkle,+ description: t("settingsModal.sections.toneStyle.description"),+ group: t("settingsModal.groups.app"),+ },{id: "speechToText",label: t("settingsModal.sections.speechToText.label"),@@ -152,9 +160,9 @@ export default function SettingsModal({ open, onOpenChange, initialSection }: Seif (!open) setInitialSubTab(undefined);}- const handleSectionChange = (section: SettingsSectionType) => {+ const handleSectionChange = (section: SettingsSectionType, subTab?: string) => {setActiveSection(section);- setInitialSubTab(undefined);+ setInitialSubTab(subTab);};return (diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex cba6ded1b..521b53509 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -159,6 +159,7 @@ import WorkspaceBillingOverview from "./settings/WorkspaceBillingOverview";import EnterpriseCheckoutDialog from "./settings/EnterpriseCheckoutDialog";import CreateWorkspaceDialog from "./CreateWorkspaceDialog";import ProfileSection from "./settings/ProfileSection";+import ToneStyleSection from "./settings/ToneStyleSection";import { formatAmount } from "../utils/formatAmount";import { enterpriseProviderName, getTranscriptionProvider } from "../models/ModelRegistry";import { useManagedScopeResolution } from "../stores/enterpriseIdentityStore";@@ -170,6 +171,7 @@ export type SettingsSectionType =| "workspace"| "general"| "hotkeys"+ | "toneStyle"| "speechToText"| "llms"| "privacyData"@@ -177,7 +179,7 @@ export type SettingsSectionType =interface SettingsPageProps {activeSection?: SettingsSectionType;- onNavigateToSection?: (section: SettingsSectionType) => void;+ onNavigateToSection?: (section: SettingsSectionType, subTab?: string) => void;/** When a legacy section ID was used (e.g. `meetings`), land on the matching sub-tab. */initialSubTab?: string;}@@ -3056,6 +3058,13 @@ export default function SettingsPage({case "workspace":return <WorkspaceSection initialSubTab={initialSubTab} />;+ case "toneStyle":+ return (+ <ToneStyleSection+ onOpenCleanupSettings={() => onNavigateToSection?.("llms", "dictationCleanup")}+ />+ );+case "general":return (<div className="space-y-6">diff --git a/src/components/icons/index.ts b/src/components/icons/index.tsindex d282d4438..57de21cc5 100644--- a/src/components/icons/index.ts+++ b/src/components/icons/index.ts@@ -17,6 +17,7 @@ export {Quote,Square,SquareSlash,+ SquareSparkle,Strikethrough,Table,} from "./primitives";diff --git a/src/components/icons/primitives.tsx b/src/components/icons/primitives.tsxindex 89747ec18..a71e5bbe7 100644--- a/src/components/icons/primitives.tsx+++ b/src/components/icons/primitives.tsx@@ -176,6 +176,16 @@ const TableMark = glyph(</>);+// Settings > Tone & Style, as drawn in the design: a square with a plus and a+// sparkle at its corner.+const SquareSparkleMark = glyph(+ <>+ <path d="M14 4H7a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3v-7" />+ <path d="M12 9.5v5M9.5 12h5" />+ <path d="M19 2.5v5M16.5 5h5" />+ </>+);+export const Circle = createIcon("circle", CircleMark);export const Square = createIcon("square", SquareMark);export const SquareSlash = createIcon("square-slash", SquareSlashMark);@@ -191,3 +201,4 @@ export const ListOrdered = createIcon("list-ordered", ListOrderedMark);export const Quote = createIcon("quote", QuoteMark);export const Strikethrough = createIcon("strikethrough", StrikethroughMark);export const Table = createIcon("table", TableMark);+export const SquareSparkle = createIcon("square-sparkle", SquareSparkleMark);diff --git a/src/components/settings/ToneStyleSection.tsx b/src/components/settings/ToneStyleSection.tsxnew file mode 100644index 000000000..16d2740df--- /dev/null+++ b/src/components/settings/ToneStyleSection.tsx@@ -0,0 +1,146 @@+import { useState } from "react";+import { useTranslation } from "react-i18next";+import { Button } from "../ui/button";+import { InfoBox } from "../ui/InfoBox";+import { SettingsPanel, SettingsPanelRow, SettingsRow } from "../ui/SettingsSection";+import { Toggle } from "../ui/toggle";+import { useToast } from "../ui/useToast";+import { cn } from "../lib/utils";+import { useSettingsStore } from "../../stores/settingsStore";+import { dismissToneStyleBanner } from "../../hooks/useToneStylePrompt";+import { TONE_APP_CATEGORIES, TONE_OPTIONS, type ToneStyles } from "../../config/toneStyle";+import { AppMarkStack } from "../toneStyle/toneStyleVisuals";+import { CATEGORY_APP_MARKS } from "../toneStyle/appMarks";+import { dictationCleanupHasModel, turnOnDictationCleanup } from "../toneStyle/dictationCleanup";++interface ToneStyleSectionProps {+ onOpenCleanupSettings: () => void;+}++export default function ToneStyleSection({ onOpenCleanupSettings }: ToneStyleSectionProps) {+ const { t } = useTranslation();+ const { toast } = useToast();+ const savedStyles = useSettingsStore((s) => s.toneStyles);+ const toneStyleEnabled = useSettingsStore((s) => s.toneStyleEnabled);+ const useCleanupModel = useSettingsStore((s) => s.useCleanupModel);+ const [draft, setDraft] = useState<ToneStyles>(savedStyles);+ const canSave =+ toneStyleEnabled &&+ TONE_APP_CATEGORIES.some((category) => draft[category] !== savedStyles[category]);++ const save = () => {+ useSettingsStore.getState().setToneStyles(draft);+ toast({ title: t("toneStyle.settings.saved") });+ };++ // As in the setup dialog: cleanup without a usable model goes on to pick one.+ const turnOnCleanup = () => {+ turnOnDictationCleanup();+ if (!dictationCleanupHasModel()) onOpenCleanupSettings();+ };++ return (+ <div>+ <div className="mb-5">+ <h3 className="text-base font-normal! tracking-normal! text-foreground">+ {t("toneStyle.title")}+ </h3>+ <p className="mt-1 text-[13px] text-muted-foreground">{t("toneStyle.description")}</p>+ </div>++ {/* Off, cleanup keeps the speaker's own tone (the standard tone). */}+ <SettingsPanel className="mb-6">+ <SettingsPanelRow>+ <SettingsRow+ label={t("toneStyle.settings.enabled")}+ description={t("toneStyle.settings.enabledDescription")}+ >+ <Toggle+ checked={toneStyleEnabled}+ onChange={(enabled) => {+ useSettingsStore.getState().setToneStyleEnabled(enabled);+ if (enabled) dismissToneStyleBanner();+ }}+ ariaLabel={t("toneStyle.settings.enabled")}+ />+ </SettingsRow>+ </SettingsPanelRow>+ </SettingsPanel>++ {/* Tones only shape what cleanup writes. */}+ {toneStyleEnabled && !useCleanupModel && (+ <InfoBox variant="warning" className="mb-6 flex items-center justify-between gap-4 p-3">+ <p className="text-[13px] text-foreground">{t("toneStyle.settings.cleanupOff")}</p>+ <Button variant="outline" size="sm" className="shrink-0" onClick={turnOnCleanup}>+ {t("toneStyle.settings.turnOnCleanup")}+ </Button>+ </InfoBox>+ )}++ <div className={cn(!toneStyleEnabled && "pointer-events-none opacity-50")}>+ <div className="space-y-6">+ {TONE_APP_CATEGORIES.map((category) => {+ const title = t(`toneStyle.categories.${category}.title`);+ return (+ <section key={category}>+ <div className="mb-4 flex items-center gap-3">+ <AppMarkStack marks={CATEGORY_APP_MARKS[category].settings} size={22} />+ <h4 className="text-[15px] font-normal! tracking-normal! text-foreground">+ {title}+ </h4>+ </div>+ <div role="group" aria-label={title} className="grid grid-cols-3 gap-4">+ {TONE_OPTIONS[category].map((tone) => {+ const selected = draft[category] === tone;+ return (+ <button+ key={tone}+ type="button"+ aria-pressed={selected}+ disabled={!toneStyleEnabled}+ onClick={() => setDraft((current) => ({ ...current, [category]: tone }))}+ className={cn(+ "flex h-[34px] items-center gap-2.5 rounded-[9px] border px-3 text-start text-[13px] text-foreground transition-colors",+ "outline-none focus-visible:ring-2 focus-visible:ring-ring/30",+ selected+ ? "border-transparent bg-primary/12 dark:bg-primary/15"+ : "border-border hover:bg-muted/50 dark:border-white/10 dark:hover:bg-white/5"+ )}+ >+ <span+ aria-hidden="true"+ className={cn(+ "flex size-3.5 shrink-0 items-center justify-center rounded-full border",+ selected+ ? "border-primary bg-primary"+ : "border-border-hover dark:border-white/25"+ )}+ >+ {selected && (+ <span className="size-1.5 rounded-full bg-primary-foreground" />+ )}+ </span>+ {t(`toneStyle.tones.${tone}`)}+ </button>+ );+ })}+ </div>+ </section>+ );+ })}+ </div>++ <div className="mt-6 flex justify-end">+ <Button+ variant={canSave ? "default" : "secondary"}+ className="h-8 border-transparent px-4 text-[13px] disabled:opacity-100 disabled:text-muted-foreground/60"+ disabled={!canSave}+ onClick={save}+ >+ {t("toneStyle.settings.saveChanges")}+ </Button>+ </div>+ </div>+ </div>+ );+}diff --git a/src/components/toneStyle/ToneStyleBanner.tsx b/src/components/toneStyle/ToneStyleBanner.tsxnew file mode 100644index 000000000..98ade143a--- /dev/null+++ b/src/components/toneStyle/ToneStyleBanner.tsx@@ -0,0 +1,119 @@+import { useEffect, useId, useRef, useState } from "react";+import { useTranslation } from "react-i18next";+import { Button } from "../ui/button";++interface ToneStyleBannerProps {+ cleanupEnabled: boolean;+ onStart: () => void;+ onDismiss: () => void;+}++// The curved line reaches the description's height about 410px before the+// banner's end, so the description has to end this far from it for the line to show.+const LINE_CLEARANCE_PX = 425;++// The design's decoration: two soft brand glows rising from the bottom edge and+// a line of text curving between them, drawn from the banner's end. In RTL the+// glows mirror; the line keeps reading left to right.+function BannerDecoration({ showLine }: { showLine: boolean }) {+ const { t } = useTranslation();+ const id = useId();+ return (+ <svg+ aria-hidden="true"+ className="pointer-events-none absolute inset-y-0 end-0 h-full w-[700px] [mask-image:linear-gradient(to_right,transparent,black_25%)] rtl:[mask-image:linear-gradient(to_left,transparent,black_25%)]"+ viewBox="0 0 700 100"+ preserveAspectRatio="xMaxYMax meet"+ >+ <defs>+ <radialGradient id={`${id}-glow`}>+ <stop offset="0" stopColor="var(--color-primary)" stopOpacity="0.4" />+ <stop offset="1" stopColor="var(--color-primary)" stopOpacity="0" />+ </radialGradient>+ <path+ id={`${id}-curve`}+ d="M228 190 C255 110 300 42 345 42 C420 42 500 100 570 106 S680 95 720 62"+ />+ </defs>+ <g className="origin-center [transform-box:view-box] rtl:-scale-x-100">+ <ellipse cx="225" cy="108" rx="230" ry="95" fill={`url(#${id}-glow)`} />+ <ellipse cx="690" cy="110" rx="240" ry="100" fill={`url(#${id}-glow)`} />+ <ellipse cx="450" cy="112" rx="170" ry="55" fill={`url(#${id}-glow)`} opacity="0.45" />+ </g>+ {showLine && (+ <text className="fill-primary/22 text-[11px] [direction:ltr]">+ <textPath href={`#${id}-curve`} startOffset="47">+ {t("toneStyle.banner.decoration")}+ </textPath>+ </text>+ )}+ </svg>+ );+}++export default function ToneStyleBanner({+ cleanupEnabled,+ onStart,+ onDismiss,+}: ToneStyleBannerProps) {+ const { t } = useTranslation();+ const bannerRef = useRef<HTMLDivElement>(null);+ const descriptionRef = useRef<HTMLParagraphElement>(null);+ const [showLine, setShowLine] = useState(false);++ // The description keeps to one line, so the line is dropped rather than the+ // description wrapped when the two would meet.+ useEffect(() => {+ const banner = bannerRef.current;+ const description = descriptionRef.current;+ if (!banner || !description) return;+ const measure = () => {+ const outer = banner.getBoundingClientRect();+ const text = description.getBoundingClientRect();+ const room =+ getComputedStyle(banner).direction === "rtl"+ ? text.left - outer.left+ : outer.right - text.right;+ setShowLine(room >= LINE_CLEARANCE_PX);+ };+ measure();+ const observer = new ResizeObserver(measure);+ observer.observe(banner);+ observer.observe(description);+ return () => observer.disconnect();+ }, []);++ return (+ <div+ ref={bannerRef}+ className="relative mb-3 flex items-center gap-4 overflow-hidden rounded-2xl border border-border/70 bg-card px-5 py-5 dark:border-white/10 dark:bg-surface-2"+ >+ <BannerDecoration showLine={showLine} />+ <div className="relative min-w-0 flex-1">+ <p className="brand-heading text-[19px] font-medium! tracking-normal! text-foreground">+ {cleanupEnabled ? t("toneStyle.banner.title") : t("toneStyle.banner.cleanupOffTitle")}+ </p>+ <p+ ref={descriptionRef}+ className="mt-1.5 w-fit max-w-full text-[15px] text-muted-foreground/90"+ >+ {cleanupEnabled+ ? t("toneStyle.banner.description")+ : t("toneStyle.banner.cleanupOffDescription")}+ </p>+ </div>+ <div className="relative flex shrink-0 items-center gap-3">+ <Button className="h-10 px-6 text-sm" onClick={onStart}>+ {cleanupEnabled ? t("toneStyle.banner.start") : t("toneStyle.turnOnAndSetUp")}+ </Button>+ <Button+ variant="secondary"+ className="h-10 border-transparent bg-[color-mix(in_srgb,var(--color-foreground)_10%,var(--color-card))] px-6 text-sm text-muted-foreground/70 hover:bg-[color-mix(in_srgb,var(--color-foreground)_14%,var(--color-card))]"+ onClick={onDismiss}+ >+ {t("toneStyle.banner.notNow")}+ </Button>+ </div>+ </div>+ );+}diff --git a/src/components/toneStyle/ToneStyleSetupDialog.tsx b/src/components/toneStyle/ToneStyleSetupDialog.tsxnew file mode 100644index 000000000..01dfae038--- /dev/null+++ b/src/components/toneStyle/ToneStyleSetupDialog.tsx@@ -0,0 +1,247 @@+import { useEffect, useState } from "react";+import { useTranslation } from "react-i18next";+import { Dialog, DialogContent, DialogDescription, DialogTitle } from "../ui/dialog";+import { Button } from "../ui/button";+import { BidiInterpolatedText, BIDI_VALUE_TOKEN } from "../ui/BidiInterpolatedText";+import { cn } from "../lib/utils";+import { useSettingsStore } from "../../stores/settingsStore";+import {+ TONE_APP_CATEGORIES,+ TONE_OPTIONS,+ type ToneAppCategory,+ type ToneStyles,+} from "../../config/toneStyle";+import { AppMarkStack, ToneSample } from "./toneStyleVisuals";+import { CATEGORY_APP_MARKS } from "./appMarks";+import { dictationCleanupHasModel, turnOnDictationCleanup } from "./dictationCleanup";+import logo from "../../assets/logo.svg";+import notion from "../../assets/icons/apps/notion-glyph.svg";+import slack from "../../assets/icons/slack.svg";+import openai from "../../assets/icons/providers/openai.svg";++interface ToneStyleSetupDialogProps {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ /** Opens Settings at a section, for cleanup that still needs a model after setup. */+ onOpenSettings: (section: string) => void;+}++// The global h1–h6 rule (Yowza Soft 600, tight tracking) outranks utilities, so+// these titles force the design's medium weight, spacing and line height.+const TITLE_TYPE = "whitespace-pre-line font-medium! leading-[31px]! tracking-normal!";++// The intro art: OpenWhispr among the apps it writes into, fading out at the+// edges. Notion is its own gray app tile with the mark in white, as designed.+type IntroTile = { src: string; size: number; className: string; tileClassName?: string };+const INTRO_TILES: (IntroTile | "logo" | null)[] = [+ {+ src: notion,+ size: 36,+ className: "opacity-95",+ tileClassName:+ "border-transparent bg-gradient-to-br from-[#d4d4d4] to-[#a8a8a8] dark:from-[#4a4a4a] dark:to-[#2e2e2e]",+ },+ null,+ { src: slack, size: 40, className: "opacity-45 grayscale-[40%]" },+ null,+ "logo",+ null,+ null,+ { src: openai, size: 50, className: "opacity-25 dark:invert dark:opacity-30" },+ null,+];++function IntroArt() {+ return (+ <div+ aria-hidden="true"+ className="grid grid-cols-3 gap-2.5 [mask-image:radial-gradient(circle_at_50%_42%,black_38%,transparent_74%)]"+ >+ {INTRO_TILES.map((tile, index) =>+ tile === "logo" ? (+ <img+ key={index}+ src={logo}+ alt=""+ width={68}+ height={68}+ decoding="async"+ draggable={false}+ className="size-[68px] rounded-[18px] shadow-[0_0_0_3px_white,0_6px_16px_rgba(32,86,223,0.25)] dark:shadow-[0_0_0_3px_var(--color-surface-2),0_6px_16px_rgba(0,0,0,0.4)]"+ />+ ) : (+ <div+ key={index}+ className={cn(+ "flex size-[68px] items-center justify-center rounded-[18px] border border-primary/15 bg-card dark:bg-surface-2",+ tile?.tileClassName+ )}+ >+ {tile && (+ <img+ src={tile.src}+ alt=""+ width={tile.size}+ height={tile.size}+ decoding="async"+ draggable={false}+ className={tile.className}+ />+ )}+ </div>+ )+ )}+ </div>+ );+}++function Pager({ step, total }: { step: number; total: number }) {+ const { t } = useTranslation();+ return (+ <div+ role="img"+ aria-label={t("toneStyle.setup.progress", { current: step, total })}+ className="flex items-center justify-center gap-2"+ >+ {Array.from({ length: total }, (_, index) => (+ <span+ key={index}+ className={cn(+ "h-2 rounded-full transition-all duration-300",+ index + 1 === step ? "w-6 bg-primary" : "w-2 bg-border dark:bg-white/15"+ )}+ />+ ))}+ </div>+ );+}++export default function ToneStyleSetupDialog({+ open,+ onOpenChange,+ onOpenSettings,+}: ToneStyleSetupDialogProps) {+ const { t } = useTranslation();+ const useCleanupModel = useSettingsStore((s) => s.useCleanupModel);+ const [step, setStep] = useState(0);+ const [draft, setDraft] = useState<ToneStyles>(() => useSettingsStore.getState().toneStyles);++ // Every opening starts at the intro with the saved picks.+ useEffect(() => {+ if (!open) return;+ setStep(0);+ setDraft(useSettingsStore.getState().toneStyles);+ }, [open]);++ const start = () => {+ if (!useCleanupModel) turnOnDictationCleanup();+ setStep(1);+ };++ const finish = () => {+ const { setToneStyles, setToneStyleEnabled } = useSettingsStore.getState();+ setToneStyles(draft);+ setToneStyleEnabled(true);+ onOpenChange(false);+ if (!dictationCleanupHasModel()) onOpenSettings("intelligence");+ };++ const category: ToneAppCategory | null = step > 0 ? TONE_APP_CATEGORIES[step - 1] : null;+ const total = TONE_APP_CATEGORIES.length;++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent className="max-w-[838px] gap-0 px-8.5 pb-10 pt-10">+ {category === null ? (+ <div className="flex flex-col items-center text-center">+ <IntroArt />+ <DialogTitle className={cn("mt-[86px] text-[25px]", TITLE_TYPE)}>+ {useCleanupModel+ ? t("toneStyle.setup.introTitle")+ : t("toneStyle.setup.cleanupOffTitle")}+ </DialogTitle>+ <DialogDescription className="mt-4 text-[15px]">+ {useCleanupModel+ ? t("toneStyle.setup.introDescription")+ : t("toneStyle.setup.cleanupOffDescription")}+ </DialogDescription>+ <Button className="mt-[38px] h-[41px] px-7 text-[15px]" onClick={start}>+ {useCleanupModel ? t("toneStyle.setup.personalize") : t("toneStyle.turnOnAndSetUp")}+ </Button>+ </div>+ ) : (+ <div className="flex flex-col items-center">+ <AppMarkStack marks={CATEGORY_APP_MARKS[category].dialog} size={40} />+ <DialogTitle className={cn("mt-4 text-center text-2xl", TITLE_TYPE)}>+ <BidiInterpolatedText+ text={t(`toneStyle.categories.${category}.question`, {+ category: BIDI_VALUE_TOKEN,+ })}+ value={+ <span className="text-primary">+ {t(`toneStyle.categories.${category}.inline`)}+ </span>+ }+ dir="auto"+ />+ </DialogTitle>+ <DialogDescription className="sr-only">+ {t("toneStyle.setup.stepDescription")}+ </DialogDescription>+ <div+ role="group"+ aria-label={t(`toneStyle.categories.${category}.title`)}+ className="mt-6 grid w-full grid-cols-3 gap-2.5"+ >+ {TONE_OPTIONS[category].map((tone) => {+ const selected = draft[category] === tone;+ return (+ <button+ key={tone}+ type="button"+ aria-pressed={selected}+ onClick={() => setDraft((current) => ({ ...current, [category]: tone }))}+ className={cn(+ "flex h-[250px] flex-col gap-3 rounded-2xl border bg-muted/60 px-4.5 pb-4 text-start transition-colors",+ category === "email" ? "pt-3.5" : "pt-7",+ "outline-none focus-visible:ring-2 focus-visible:ring-ring/30 dark:bg-white/5",+ selected+ ? "border-primary"+ : "border-transparent shadow-[0_1px_3px_rgba(0,0,0,0.06)] hover:border-border"+ )}+ >+ {/* A long translation is cut off above the label, fading out. */}+ <div className="min-h-0 flex-1 overflow-hidden [mask-image:linear-gradient(to_bottom,black_calc(100%-12px),transparent)]">+ <ToneSample category={category} tone={tone} selected={selected} />+ </div>+ <span className="self-center text-[15px] font-medium text-foreground">+ {t(`toneStyle.tones.${tone}`)}+ </span>+ </button>+ );+ })}+ </div>+ <div className="mt-7.5">+ <Pager step={step} total={total} />+ </div>+ <div className="mt-7.5 flex items-center gap-3">+ <Button+ variant="secondary"+ className="h-10 min-w-[84px] border-transparent text-muted-foreground"+ onClick={() => setStep(step - 1)}+ >+ {t("common.back")}+ </Button>+ <Button+ className="h-10 min-w-[80px]"+ onClick={step === total ? finish : () => setStep(step + 1)}+ >+ {step === total ? t("toneStyle.setup.finish") : t("common.next")}+ </Button>+ </div>+ </div>+ )}+ </DialogContent>+ </Dialog>+ );+}diff --git a/src/components/toneStyle/appMarks.ts b/src/components/toneStyle/appMarks.tsnew file mode 100644index 000000000..45b48f04e--- /dev/null+++ b/src/components/toneStyle/appMarks.ts@@ -0,0 +1,33 @@+import type { ToneAppCategory } from "../../config/toneStyle";+import appleMail from "../../assets/icons/apps/apple-mail.svg";+import chatgpt from "../../assets/icons/apps/chatgpt.svg";+import claude from "../../assets/icons/apps/claude.svg";+import gmail from "../../assets/icons/apps/gmail.svg";+import googleChat from "../../assets/icons/apps/google-chat.svg";+import instagram from "../../assets/icons/apps/instagram.svg";+import linear from "../../assets/icons/apps/linear.svg";+import linkedin from "../../assets/icons/apps/linkedin.svg";+import messages from "../../assets/icons/apps/messages.svg";+import notion from "../../assets/icons/apps/notion.svg";+import outlook from "../../assets/icons/apps/outlook.svg";+import slack from "../../assets/icons/apps/slack.svg";+import superhuman from "../../assets/icons/apps/superhuman.svg";+import teams from "../../assets/icons/apps/teams.svg";+import telegram from "../../assets/icons/apps/telegram.svg";+import whatsapp from "../../assets/icons/apps/whatsapp.svg";++// The apps that stand for each kind of writing: four in the setup dialog,+// three in Settings, as in the design.+export const CATEGORY_APP_MARKS: Record<ToneAppCategory, { dialog: string[]; settings: string[] }> =+ {+ personal: {+ dialog: [whatsapp, instagram, messages, telegram],+ settings: [whatsapp, instagram, messages],+ },+ work: { dialog: [slack, teams, googleChat, linkedin], settings: [slack, googleChat, linkedin] },+ email: {+ dialog: [superhuman, appleMail, outlook, gmail],+ settings: [superhuman, appleMail, gmail],+ },+ other: { dialog: [linear, chatgpt, claude, notion], settings: [linear, chatgpt, notion] },+ };diff --git a/src/components/toneStyle/dictationCleanup.ts b/src/components/toneStyle/dictationCleanup.tsnew file mode 100644index 000000000..edb4c2b1b--- /dev/null+++ b/src/components/toneStyle/dictationCleanup.ts@@ -0,0 +1,16 @@+import {+ getEffectiveCleanupModel,+ isCloudCleanupMode,+ useSettingsStore,+} from "../../stores/settingsStore";++// Tone & Style only changes what cleanup writes, so its entry points turn+// cleanup on and check that it can run.+export function turnOnDictationCleanup() {+ useSettingsStore.getState().updateCleanupSettings({ useCleanupModel: true });+}++// Turning cleanup on doesn't give it a model; Cloud needs none.+export function dictationCleanupHasModel() {+ return !!getEffectiveCleanupModel() || isCloudCleanupMode();+}diff --git a/src/components/toneStyle/toneStyleVisuals.tsx b/src/components/toneStyle/toneStyleVisuals.tsxnew file mode 100644index 000000000..af8929549--- /dev/null+++ b/src/components/toneStyle/toneStyleVisuals.tsx@@ -0,0 +1,98 @@+import { useTranslation } from "react-i18next";+import { cn } from "../lib/utils";+import type { DictationTone, ToneAppCategory } from "../../config/toneStyle";++/** Overlapping round app badges; `size` is each badge's width in pixels. */+export function AppMarkStack({ marks, size }: { marks: string[]; size: number }) {+ return (+ <div className="flex shrink-0" aria-hidden="true">+ {marks.map((src, index) => (+ <img+ key={src}+ src={src}+ alt=""+ width={size}+ height={size}+ decoding="async"+ draggable={false}+ className="select-none rounded-full ring-2 ring-card dark:ring-surface-2"+ style={{ marginInlineStart: index === 0 ? 0 : -size * 0.24 }}+ />+ ))}+ </div>+ );+}++function Bubble({ text, selected }: { text: string; selected: boolean }) {+ return (+ <div+ className={cn(+ "relative max-w-[92%] rounded-2xl px-2.5 py-2 text-[15px] leading-[21px] text-white",+ selected ? "bg-primary" : "bg-[#2f8cf7]"+ )}+ >+ {text}+ {/* The tail flares out of the bubble's side just above its rounded corner. */}+ <svg+ aria-hidden="true"+ viewBox="0 0 13 9"+ className={cn(+ "absolute -end-[9px] bottom-[5px] h-[9px] w-[13px] rtl:-scale-x-100",+ selected ? "fill-primary" : "fill-[#2f8cf7]"+ )}+ >+ <path d="M0 0H4C4 4 7 7 13 8C9 8.6 4 8.4 0 7.8Z" />+ </svg>+ </div>+ );+}++function WorkMessage({ text }: { text: string }) {+ const { t } = useTranslation();+ return (+ <div className="flex items-start gap-2">+ <div className="flex size-7 shrink-0 items-center justify-center rounded-md bg-[#b3613a] text-[13px] font-semibold text-white">+ {t("toneStyle.samples.work.sender").slice(0, 1)}+ </div>+ <div className="min-w-0">+ <p className="text-[13px] leading-[18px]">+ <span className="font-semibold text-foreground">+ {t("toneStyle.samples.work.sender")}+ </span>{" "}+ <span className="text-muted-foreground">{t("toneStyle.samples.work.time")}</span>+ </p>+ <p className="mt-0.5 text-[15px] leading-[21px] text-foreground">{text}</p>+ </div>+ </div>+ );+}++function EmailMessage({ text }: { text: string }) {+ const { t } = useTranslation();+ return (+ <div className="text-[13px] leading-[18px]">+ <p className="border-b border-border/80 pb-2.5 text-muted-foreground dark:border-white/10">+ {t("toneStyle.samples.email.to")}+ </p>+ <p className="mt-2 whitespace-pre-line text-foreground">{text}</p>+ </div>+ );+}++/** How a message reads in one tone, drawn like the app it would be sent from. */+export function ToneSample({+ category,+ tone,+ selected,+}: {+ category: ToneAppCategory;+ tone: DictationTone;+ selected: boolean;+}) {+ const { t } = useTranslation();+ const text = t(`toneStyle.samples.${category}.${tone}`);+ if (category === "personal") return <Bubble text={text} selected={selected} />;+ if (category === "work") return <WorkMessage text={text} />;+ if (category === "email") return <EmailMessage text={text} />;+ return <p className="text-[15px] leading-[21px] text-foreground">{text}</p>;+}diff --git a/src/config/prompts.ts b/src/config/prompts.tsindex 58f79405a..ef639f0a1 100644--- a/src/config/prompts.ts+++ b/src/config/prompts.ts@@ -1,4 +1,6 @@import { resolvePrompt } from "./prompts/index";+import { appendToneStyleSuffix } from "./prompts/toneStyle";+import type { DictationToneStyle } from "./toneStyle";import { SOURCE_FIDELITY_RULE } from "../helpers/sourceFidelity.js";import {CONNECTOR_NAMES,@@ -22,9 +24,13 @@ export function getCleanupSystemPrompt(agentName: string | null,customDictionary?: string[],language?: string,- uiLanguage?: string+ uiLanguage?: string,+ toneStyle?: DictationToneStyle | null): string {- return resolvePrompt("cleanup", { agentName, language, customDictionary, uiLanguage });+ return appendToneStyleSuffix(+ resolvePrompt("cleanup", { agentName, language, customDictionary, uiLanguage }),+ toneStyle+ );}export function getWordBoost(customDictionary?: string[]): string[] {diff --git a/src/config/prompts/toneStyle.ts b/src/config/prompts/toneStyle.tsnew file mode 100644index 000000000..5f30e8b72--- /dev/null+++ b/src/config/prompts/toneStyle.ts@@ -0,0 +1,39 @@+import type { DictationTone, DictationToneStyle, ToneAppCategory } from "../toneStyle";++// Verbatim copies of TONE_INSTRUCTIONS, APP_CATEGORY_INSTRUCTIONS and+// TONE_PRIORITY_INSTRUCTION in openwhispr-api's lib/prompts.ts, which Cloud+// cleanup appends for the same `tone` and `appCategory`; change both together.+// English in every locale, as on the server.+const TONE_INSTRUCTIONS: Record<DictationTone, string> = {+ formal:+ "Apply this tone: formal and polished. Use complete sentences with standard capitalization and full punctuation, spell out informal contractions (in English: I will, do not) but keep any the language's grammar requires, and leave out slang, filler, texting shorthand, emoji and em dashes. Restyle only; do not add or remove information.",+ casual:+ "Apply this tone: casual and friendly, like a quick note to a colleague. Use the language's everyday contractions (in English: I'll, it's, don't) and everyday wording, standard capitalization and light punctuation with no semicolons or em dashes; a final period can be dropped. Restyle only; do not add or remove information.",+ very_casual:+ 'Apply this tone: very casual, like texting a friend. Write in all lowercase and keep punctuation light: a question still ends with a question mark, but drop the final period and never use em dashes. Use texting shorthand common in the output language only where it stands for the exact words (in English: "u" for you, "lmk" for let me know). Restyle only; do not add or remove information.',+ excited:+ "Apply this tone: upbeat and enthusiastic. Use standard capitalization and warm, energetic wording, and end positive or friendly sentences with an exclamation mark, without overdoing it. Use commas or periods, never semicolons or em dashes, and no emoji. Restyle only; do not add or remove information.",+};++const APP_CATEGORY_INSTRUCTIONS: Partial<Record<ToneAppCategory, string>> = {+ personal: "The text is a personal chat message.",+ work: "The text is a work chat message.",+ email:+ "The text is an email. Keep a dictated greeting, paragraphs and sign-off on their own lines, and never add a greeting or sign-off that was not dictated.",+};++const TONE_PRIORITY_INSTRUCTION =+ "This tone overrides any instruction to keep the speaker's tone, voice, style, wording or formality, and it sets capitalization and punctuation; names, acronyms and dictionary terms keep their exact spelling and capitalization. It never changes meaning or intent. Every other cleanup rule still applies.";++// Appended last, after the language and dictionary suffixes, as the server does.+export function appendToneStyleSuffix(prompt: string, toneStyle?: DictationToneStyle | null) {+ if (!toneStyle) return prompt;+ const instruction = [+ APP_CATEGORY_INSTRUCTIONS[toneStyle.appCategory],+ TONE_INSTRUCTIONS[toneStyle.tone],+ TONE_PRIORITY_INSTRUCTION,+ ]+ .filter(Boolean)+ .join(" ");+ return `${prompt}\n\n${instruction}`;+}diff --git a/src/config/toneStyle.ts b/src/config/toneStyle.tsnew file mode 100644index 000000000..1652a848d--- /dev/null+++ b/src/config/toneStyle.ts@@ -0,0 +1,64 @@+// Tone & Style: the tone dictation cleanup writes in, picked per kind of app.+// Category and tone values are the ones openwhispr-api's /api/reason accepts+// (`appCategory`, `tone`); main's toneAppCategories.js returns the same categories.++export const TONE_APP_CATEGORIES = ["personal", "work", "email", "other"] as const;+export type ToneAppCategory = (typeof TONE_APP_CATEGORIES)[number];++export type DictationTone = "formal" | "casual" | "very_casual" | "excited";++export const TONE_OPTIONS: Record<ToneAppCategory, readonly DictationTone[]> = {+ personal: ["formal", "casual", "very_casual"],+ work: ["formal", "casual", "excited"],+ email: ["formal", "casual", "excited"],+ other: ["formal", "casual", "excited"],+};++export type ToneStyles = Record<ToneAppCategory, DictationTone>;++// The design's preselected picks.+export const DEFAULT_TONE_STYLES: ToneStyles = {+ personal: "casual",+ work: "formal",+ email: "formal",+ other: "formal",+};++// Words dictated before the setup dialog opens by itself on Home.+export const TONE_STYLE_PROMPT_MIN_WORDS = 70;++/** What one dictation's cleanup is told: the app's category and the tone picked for it. */+export interface DictationToneStyle {+ appCategory: ToneAppCategory;+ tone: DictationTone;+}++/** Reads the stored JSON, keeping only tones offered for each category. */+export function normalizeToneStyles(value: string): ToneStyles {+ let parsed: unknown;+ try {+ parsed = JSON.parse(value);+ } catch {+ parsed = null;+ }+ const stored = (parsed && typeof parsed === "object" ? parsed : {}) as Record<string, unknown>;+ return Object.fromEntries(+ TONE_APP_CATEGORIES.map((category) => {+ const tone = stored[category];+ return [+ category,+ TONE_OPTIONS[category].includes(tone as DictationTone)+ ? tone+ : DEFAULT_TONE_STYLES[category],+ ];+ })+ ) as ToneStyles;+}++export function resolveDictationToneStyle(+ toneStyles: ToneStyles,+ appCategory: ToneAppCategory | null+): DictationToneStyle {+ const category = appCategory ?? "other";+ return { appCategory: category, tone: toneStyles[category] };+}diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 74641c762..cdeb95180 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -127,6 +127,7 @@ import {import { providerSupportsImages } from "../services/ai/inferenceProviders";import { resolveDictationTranslationInference } from "./dictationTranslationInference";import { resolvePrompt, appendScreenContextSuffix } from "../config/prompts";+import { resolveDictationToneStyle } from "../config/toneStyle";import { syncService } from "../services/SyncService.js";import { evaluateFinishedRecording, withSalvageWarning } from "./recordingValidation";import { isEmptyRecording } from "./recordingGuard";@@ -722,6 +723,9 @@ class AudioManager {this._activeProcessingPipeline = null;this.assistantSelectionContext = null;this.screenContextPromise = null;+ this.toneStylePromise = null;+ this.lastToneAppCategory = null;+ this.toneStyleStartDeadline = 0;this.selectionCapturePromise = null;this.sttConfig = null;this.sttConfigFetchedAt = null;@@ -991,6 +995,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);// cancelled voice-agent recording, even after the setting was turned// off). A live voice-agent start re-captures right after this call.this.screenContextPromise = null;+ this.toneStylePromise = null;// Same for a prefetched selection: bounded to one recording, so a read taken// in an earlier app can never be edited in place by this command.this.selectionCapturePromise = null;@@ -1071,6 +1076,36 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);}}+ // Kicked off at dictation start while Tone & Style is on, so the target app+ // is classified while the user speaks. Only a dictation that captured its+ // app gets a tone: a retried or re-run transcription has no target.+ beginToneStyleCapture() {+ this.toneStylePromise =+ window.electronAPI?.captureDictationAppCategory?.()?.catch(() => null) ?? null;+ // An Orukeet start waits at most 250 ms from here for the app, so the wait+ // overlaps the mic opening instead of delaying the start cue after it.+ this.toneStyleStartDeadline = performance.now() + 250;+ }++ // Consumed by the cleanup route only; the agent and translation routes+ // write in their own voice.+ async consumeToneStyle() {+ const pending = this.toneStylePromise;+ this.toneStylePromise = null;+ const settings = getSettings();+ if (!pending || !settings.toneStyleEnabled) return null;+ // Classification lands while the user speaks (a Wayland AT-SPI target takes+ // about a second); the race only guards the paste path if the IPC ever+ // hangs, and an unknown app reads as other.+ const appCategory = await Promise.race([+ pending,+ new Promise((resolve) => setTimeout(() => resolve(null), 1500)),+ ]);+ const toneStyle = resolveDictationToneStyle(settings.toneStyles, appCategory);+ logger.logReasoning("TONE_STYLE", toneStyle);+ return toneStyle;+ }+// An agent-route failure pastes the spoken command verbatim into the focused// app — surface that. Cleanup failures stay quiet; raw text is a fine result._notifyAgentReasoningFailed() {@@ -3381,7 +3416,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);}const targetModel = route.kind === "agent" ? route.model : cleanupModel;- const reasoningConfig = route.config;+ const reasoningConfig =+ route.kind === "cleanup"+ ? { ...route.config, toneStyle: await this.consumeToneStyle() }+ : route.config;logger.logReasoning("SENDING_TO_REASONING", {preparedTextLength: normalizedText.length,@@ -3682,6 +3720,11 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);this.notifyTranslationFallback("unreachable");}this._noteCleanupRoute(settings, route);+ // A cancelled upload can still resolve after the next dictation started;+ // reading the tone then would take that dictation's app.+ const toneStyle =+ route.kind === "cleanup" && !wasCancelled() ? await this.consumeToneStyle() : null;+try {if (route.kind === "agent") {const reasoned = await this.processAgentCommand(@@ -3704,6 +3747,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);purpose: "cleanup",customDictionary: getDictionaryHintWords(settings),customPrompt,+ ...toneStyle,language: this.getCleanupLanguage(settings),locale: settings.uiLanguage || "en",streamingFallbackReason,@@ -3739,7 +3783,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);processedText,effectiveModel,agentName,- route.config+ { ...route.config, toneStyle });if (hasTextContent(reasoned)) processedText = reasoned;}@@ -4774,6 +4818,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);{voiceAgentRequested = this.voiceAgentRequested,translationRequested = this.translationRequested,+ appCategory = null,} = {}) {if (@@ -4791,6 +4836,9 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);agentName: getAgentName() || "",customDictionary: getDictionaryHintWords(settings),customPrompt: this.getCustomPrompt(),+ ...(settings.toneStyleEnabled+ ? resolveDictationToneStyle(settings.toneStyles, appCategory)+ : {}),language: this.getCleanupLanguage(settings) || undefined,locale: settings.uiLanguage || "en",};@@ -4820,11 +4868,18 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);language: settings.preferredLanguage,keyterms: this.getKeyterms(),voiceAgentRequested: this.voiceAgentRequested,- // Warmup runs while idle, so the socket is for an ordinary dictation.- pipelineOptions: this.getPipelineCleanupOptions(settings, {- voiceAgentRequested: false,- translationRequested: false,- }),+ // Warmup runs while idle, so the socket is for an ordinary+ // dictation into the app the last start learned in time (Tone &+ // Style). With no app known, a start mints no combined cleanup,+ // so neither does warmup.+ pipelineOptions:+ settings.toneStyleEnabled && !this.lastToneAppCategory+ ? undefined+ : this.getPipelineCleanupOptions(settings, {+ voiceAgentRequested: false,+ translationRequested: false,+ appCategory: this.lastToneAppCategory,+ }),}));// Throw error to trigger retry if AUTH_EXPIRED@@ -5087,7 +5142,6 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);providerName = this.getStreamingProviderName();this._activeStreamingProviderName = providerName;this._activeStreamingConfig = { ...this.sttConfig };- this._activePipelineOptions = this.getPipelineCleanupOptions(getSettings());const ownsSession = () => this._activeStreamingSessionId === sessionId;const cancellationGeneration = this._streamingCancellationGeneration;startWasCancelled = () => cancellationGeneration !== this._streamingCancellationGeneration;@@ -5162,6 +5216,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);providerName,cloudTranscriptionMode: getSettings().cloudTranscriptionMode,});+ let heldFrames = null;this.streamingProcessor.port.onmessage = (event) => {// The worklet posts its remaining PCM followed by a "flushed" sentinel@@ -5175,7 +5230,9 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);// Measured from the first chunk: a recording that fails over later// still has its opening words in the gate.recordPcm16SpeechWindow(this._streamingSpeechGateState, event.data);- if (!this._streamingFailoverReason) provider.send(event.data);+ if (this._streamingFailoverReason) return;+ if (heldFrames) heldFrames.push(event.data);+ else provider.send(event.data);};this.isStreaming = true;@@ -5261,8 +5318,40 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);this.onStateChange?.({ isRecording: true, isProcessing: false, isStreaming: true });await this.beginMicRecovery(stream);- // 4. Connect WebSocket — audio is already flowing from the pipeline above,- // so Deepgram receives data immediately (no idle timeout).+ // A combined cleanup's prompt is fixed when its session is minted, so with+ // Tone & Style on the start waits briefly for the app being dictated into+ // before minting. Audio from the wait is held until the session has+ // started: with no warm socket main has nowhere to buffer it, and a warm+ // one minted for another app is replaced. An app not known by then (a+ // Wayland AT-SPI target takes about a second) gets no combined cleanup:+ // /api/reason cleans up in its tone at stop.+ const pipelineSettings = getSettings();+ if (+ providerName === "orukeet" &&+ pipelineSettings.toneStyleEnabled &&+ this.getPipelineCleanupOptions(pipelineSettings)+ ) {+ heldFrames = [];+ const waitMs = Math.max(0, this.toneStyleStartDeadline - performance.now());+ this.lastToneAppCategory = await Promise.race([+ this.toneStylePromise,+ new Promise((resolve) => setTimeout(() => resolve(null), waitMs)),+ ]);+ if (startWasCancelled()) {+ // cancelStreamingRecording waits for this settlement before it+ // releases the capture; minting a session now would only waste one.+ this._settleStreamingStart();+ return false;+ }+ }+ this._activePipelineOptions =+ pipelineSettings.toneStyleEnabled && !this.lastToneAppCategory+ ? undefined+ : this.getPipelineCleanupOptions(pipelineSettings, {+ appCategory: this.lastToneAppCategory,+ });++ // 4. Connect WebSocket.const result = await withSessionRefresh(async () => {const streamingSettings = getSettings();const { useLocalWhisper } = streamingSettings;@@ -5313,6 +5402,9 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);return this.startRecording();}+ if (!this._streamingFailoverReason) heldFrames?.forEach((frame) => provider.send(frame));+ heldFrames = null;+logger.info("Streaming start timing",{@@ -5493,6 +5585,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);this.pendingCleanupFailure = null;this.assistantSelectionContext = null;this.screenContextPromise = null;+ this.toneStylePromise = null;this.selectionCapturePromise = null;}@@ -5916,6 +6009,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);}this._noteCleanupRoute(stSettings, route);const isCloudCleanup = isCloudCleanupMode();+ const toneStyle = route.kind === "cleanup" ? await this.consumeToneStyle() : null;try {if (route.kind === "agent") {@@ -5960,6 +6054,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);purpose: "cleanup",customDictionary: getDictionaryHintWords(stSettings),customPrompt,+ ...toneStyle,language: this.getCleanupLanguage(stSettings),locale: stSettings.uiLanguage || "en",sttProvider: providerName,@@ -6002,7 +6097,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);finalText,effectiveModel,agentName,- route.config+ { ...route.config, toneStyle });if (hasTextContent(reasoned)) finalText = reasoned;logger.info(diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 2aaa6cd3e..402230809 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -183,6 +183,7 @@ const {const { downsample24kTo16k, pcm16ToWav } = require("../utils/audioUtils");const postMigrationDetector = require("./postMigrationDetector");const screenContextCapture = require("./screenContextCapture");+const { classifyToneAppCategory } = require("./toneAppCategories");const {DEFAULT_EXPECTED_SPEAKER_COUNT,MAX_SPEAKER_COUNT,@@ -1740,6 +1741,19 @@ class IPCHandlers {return { success: true, pid };});+ // Tone & Style: which kind of app the dictation is going into. Runs while+ // the user speaks; only the category reaches the renderer.+ ipcMain.handle("capture-dictation-app-category", async () => {+ const context = await this.selectionManager?.getTargetAppContext?.();+ const category = classifyToneAppCategory(context);+ debugLogger.debug("Dictation app category", {+ category,+ hasWindowTitle: !!context?.windowTitle,+ hasUrlHost: !!context?.urlHost,+ });+ return category;+ });+ipcMain.handle("force-stop-dictation", () => {if (this.windowManager?.forceStopMacCompoundPush) {this.windowManager.forceStopMacCompoundPush("manual");@@ -10091,6 +10105,8 @@ class IPCHandlers {promptMode: opts.promptMode,purpose: opts.purpose,screenContext: opts.screenContext,+ tone: opts.tone,+ appCategory: opts.appCategory,language: opts.language,locale: opts.locale,sessionId: this.sessionId,diff --git a/src/helpers/selectionManager.js b/src/helpers/selectionManager.jsindex 09b9f56bf..087436246 100644--- a/src/helpers/selectionManager.js+++ b/src/helpers/selectionManager.js@@ -118,6 +118,9 @@ class SelectionManager {this.now = now;this.sessions = new Map();this.lastTarget = null;+ // Window titles sit beside their target, never on it, so a capture+ // result handed to the renderer can't carry one.+ this._targetTitles = new WeakMap();this._captureTargetPromise = null;this._lastTargetCaptureAt = 0;this._atspiCooldownUntil = 0;@@ -154,15 +157,17 @@ class SelectionManager {if (!binary) return null;const result = await runSpawn(binary, ["--detect-only"], { timeout: 700 });const match = result.stdout.match(/TARGET\s+(\S+)/);- return result.success && match- ? {- kind: "win-hwnd",- id: match[1],- windowClass: result.stdout.match(/^WINDOW_CLASS (.+)$/m)?.[1]?.trim() || null,- exeName: result.stdout.match(/^EXE_NAME (.+)$/m)?.[1]?.trim() || null,- isTerminal: /^IS_TERMINAL true$/m.test(result.stdout),- }- : null;+ if (!result.success || !match) return null;+ const target = {+ kind: "win-hwnd",+ id: match[1],+ windowClass: result.stdout.match(/^WINDOW_CLASS (.+)$/m)?.[1]?.trim() || null,+ exeName: result.stdout.match(/^EXE_NAME (.+)$/m)?.[1]?.trim() || null,+ isTerminal: /^IS_TERMINAL true$/m.test(result.stdout),+ };+ const title = result.stdout.match(/^WINDOW_TITLE (.+)$/m)?.[1]?.trim();+ if (title) this._targetTitles.set(target, title);+ return target;}if (this.platform === "linux") {return this._getLinuxTarget();@@ -182,6 +187,43 @@ class SelectionManager {return this.lastTarget?.kind === "win-hwnd" ? this.lastTarget : null;}+ // The dictation target as the Tone & Style classifier reads it: the app's+ // identity, its window title and, for a macOS browser page, the URL's host.+ // Titles stay in the main process; only the resulting category leaves it.+ async getTargetAppContext() {+ if (this.platform === "darwin") {+ const pid = this.textEditMonitor?.lastTargetPid;+ const context = pid ? await this.textEditMonitor.getAppContext(pid) : null;+ if (!context) return null;+ return {+ appSignature: `${context.appName || ""} ${context.bundleId || ""}`.trim(),+ windowTitle: context.windowTitle,+ urlHost: context.urlHost,+ };+ }+ while (this._captureTargetPromise) {+ await this._captureTargetPromise;+ }+ const target = this.lastTarget;+ if (!target) return null;+ return {+ appSignature:+ target.kind === "atspi-pid"+ ? await this._readTargetNames(target.id)+ : this._targetSignature(target),+ windowTitle: this._targetTitles.get(target) ?? (await this._readWindowTitle(target)),+ };+ }++ // X11 and KDE titles are read on demand rather than at capture, which also+ // runs before every paste.+ async _readWindowTitle(target) {+ const command = { "x11-window": "xdotool", "kde-window": "kdotool" }[target.kind];+ if (!command) return null;+ const result = await runFile(command, ["getwindowname", target.id], { timeout: 500 });+ return (result.success && result.stdout.trim()) || null;+ }+async captureSelectedText(options = {}) {// The caller knows whether a caret capture could ever be used (auto-paste// on); without it the probe's binary spawn would be pure waste.@@ -743,12 +785,14 @@ class SelectionManager {try {const active = JSON.parse(result.stdout);if (active.address) {- return {+ const target = {kind: "hyprland-window",id: active.address,windowClass: typeof active.class === "string" ? active.class.toLowerCase() : null,pid: Number.isInteger(active.pid) && active.pid > 0 ? active.pid : null,};+ if (typeof active.title === "string") this._targetTitles.set(target, active.title);+ return target;}} catch {}}@@ -770,7 +814,11 @@ class SelectionManager {debugLogger.warn("AT-SPI target probe timed out", { cooldownMs: ATSPI_COOLDOWN_MS });}const match = result.stdout.match(/^TARGET\s+ATSPI\s+(\d+)$/m);- return result.success && match ? { kind: "atspi-pid", id: match[1] } : null;+ if (!result.success || !match) return null;+ const target = { kind: "atspi-pid", id: match[1] };+ const title = result.stdout.match(/^WINDOW_TITLE_B64 ([A-Za-z0-9+/=]+)$/m)?.[1];+ if (title) this._targetTitles.set(target, Buffer.from(title, "base64").toString("utf8"));+ return target;}async _captureViaClipboard(sendCopy, expectedTarget) {diff --git a/src/helpers/textEditMonitor.js b/src/helpers/textEditMonitor.jsindex dc30b5bc5..a3e1dbebd 100644--- a/src/helpers/textEditMonitor.js+++ b/src/helpers/textEditMonitor.js@@ -19,6 +19,13 @@ const TARGET_CAPTURE_FRESHNESS_MS = 250;// killed run's verdict is discarded, so a tighter timeout means the app below is// never learned and every read pays the full ladder.const SELECTED_TEXT_TIMEOUT_MS = 1600;+// `--app-context` output keys and the context field each one fills.+const APP_CONTEXT_FIELDS = {+ APP_NAME: "appName",+ BUNDLE_ID: "bundleId",+ WINDOW_TITLE: "windowTitle",+ URL_HOST: "urlHost",+};// AXError -25212 (kAXErrorNoValue) on the focused-element read is how// Chromium/Electron apps respond while their AX tree is dormant, making the// native binary's 5-attempt retry (~1.2s) dead time on every read. A single@@ -403,6 +410,38 @@ class TextEditMonitor extends EventEmitter {return bounds;}+ /**+ * macOS: the target app's name and bundle id, its focused window's title and,+ * for a browser page, the URL's host. Feeds the Tone & Style classifier; any+ * part the helper can't read is missing, and nothing read resolves to null.+ * The name comes first, so a run killed while accessibility hangs still+ * names the app.+ */+ async getAppContext(pid, timeoutMs = 1000) {+ if (process.platform !== "darwin" || !pid) return null;+ const resolved = this.resolveBinary();+ if (!resolved) return null;++ return new Promise((resolve) => {+ execFile(+ resolved.command,+ [...resolved.args, "--app-context", String(pid)],+ { timeout: timeoutMs },+ (_error, stdout) => {+ const context = {};+ for (const line of (stdout || "").split("\n")) {+ const match = line.match(/^([A-Z_]+?)(_B64)?:(.*)$/);+ const field = match && APP_CONTEXT_FIELDS[match[1]];+ if (!field) continue;+ const value = match[2] ? this._decodeBase64Payload(match[3]) : match[3];+ if (value) context[field] = value;+ }+ resolve(Object.keys(context).length ? context : null);+ }+ );+ });+ }+/*** Start monitoring the focused text field for edits after a paste.* Kills any existing monitor before starting a new one.diff --git a/src/helpers/toneAppCategories.js b/src/helpers/toneAppCategories.jsnew file mode 100644index 000000000..743ef52c9--- /dev/null+++ b/src/helpers/toneAppCategories.js@@ -0,0 +1,296 @@+// What kind of writing a dictation is, judged from the app it goes into, so+// Tone & Style can apply the tone the user picked for it: "personal" messages,+// "work" messages, "email", or "other" for every app not listed here.+//+// App identities match by whole token or phrase, never bare substring, as in+// markdownTargets.js. The identity per platform:+// macOS: the app's name + bundle id ("Mail com.apple.mail"); the name is+// localized (WeChat is 微信 on a Chinese system), so apps that+// translate it are listed by their bundle id's token too+// Windows: the exe name + window class ("OUTLOOK.EXE rctrl_renwnd32")+// Linux: the WM_CLASS or app id ("org.telegram.desktop")+// A browser is judged by its page instead: the host when macOS accessibility+// exposes the page URL and it's a listed site, otherwise the site name its+// window title ends with ("Inbox (3) - [email protected] - Gmail - Google Chrome").++const APP_SIGNATURES = {+ personal: [+ "whatsapp",+ "telegram",+ "telegramdesktop",+ "keepcoder",+ "messages",+ "mobilesms",+ "phoneexperiencehost",+ "signal",+ "messenger",+ "instagram",+ "facebook",+ "wechat",+ "weixin",+ "xinwechat",+ "naver.line",+ "line.exe",+ "viber",+ "kakaotalk",+ "kakaotalkmac",+ "discord",+ "beeper",+ "threema",+ "zalo",+ ],+ work: [+ "slack",+ "teams",+ "msteams",+ "teams-for-linux",+ "google chat",+ "linkedin",+ "mattermost",+ "rocket.chat",+ "rocketchat",+ "zulip",+ "webex",+ "zoom",+ "zoom.us",+ "lark",+ "feishu",+ "dingtalk",+ "dingtalkmac",+ "wxwork",+ "wecom",+ "weworkmac",+ "chanty",+ "flock",+ "pumble",+ "ringcentral",+ ],+ email: [+ "mail",+ "outlook",+ "olk",+ "hxoutlook",+ "gmail",+ "superhuman",+ "spark",+ "airmail",+ "thunderbird",+ "betterbird",+ "mimestream",+ "hey",+ "protonmail",+ "canarymail",+ "postbox",+ "em client",+ "mailclient",+ "mailspring",+ "evolution",+ "geary",+ "kmail",+ "kmail2",+ "bluemail",+ "missive",+ "shortwave",+ "tutanota",+ ],+};++const BROWSER_SIGNATURES = [+ "chrome",+ "chromium",+ "safari",+ "firefox",+ "msedge",+ "microsoft edge",+ "microsoft-edge",+ "arc",+ "brave",+ "opera",+ "vivaldi",+ "zen",+ "orion",+ "dia",+ "comet",+ "librewolf",+ "waterfox",+ "floorp",+ "thorium",+ "yandex",+ "duckduckgo",+ "sidekick",+];++// Hosts match exactly or as a parent domain ("app.slack.com" ends in "slack.com").+const SITE_HOSTS = {+ personal: [+ "whatsapp.com",+ "telegram.org",+ "instagram.com",+ "messenger.com",+ "facebook.com",+ "x.com",+ "twitter.com",+ "discord.com",+ "messages.google.com",+ "snapchat.com",+ ],+ work: [+ "slack.com",+ "teams.microsoft.com",+ "teams.live.com",+ "teams.cloud.microsoft",+ "chat.google.com",+ "linkedin.com",+ "zoom.us",+ ],+ email: [+ "mail.google.com",+ "outlook.live.com",+ "outlook.office.com",+ "outlook.office365.com",+ "outlook.cloud.microsoft",+ "mail.yahoo.com",+ "mail.proton.me",+ "app.fastmail.com",+ "mail.superhuman.com",+ "app.hey.com",+ "mail.zoho.com",+ "mail.aol.com",+ "app.tuta.com",+ ],+};++// The site name a page title ends with, compared whole after normalizing.+const SITE_TITLES = {+ personal: [+ "whatsapp",+ "whatsapp business",+ "telegram",+ "telegram web",+ "instagram",+ "messenger",+ "facebook",+ "x",+ "discord",+ "google messages",+ "messages for web",+ "phone link",+ ],+ work: ["slack", "microsoft teams", "google chat", "linkedin", "zoom"],+ email: [+ "gmail",+ "outlook",+ "yahoo mail",+ "proton mail",+ "fastmail",+ "superhuman",+ "hey",+ "zoho mail",+ "icloud mail",+ ],+};++const CATEGORIES = ["email", "work", "personal"];++const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");++const tokenPattern = (entry) => new RegExp(`(?:^|[^a-z0-9])${escapeRegExp(entry)}(?:$|[^a-z0-9])`);++const APP_PATTERNS = Object.fromEntries(+ CATEGORIES.map((category) => [category, APP_SIGNATURES[category].map(tokenPattern)])+);+// Apps judged by their window title rather than their own identity: browsers,+// and on Windows the frame host every UWP app (WhatsApp, Phone Link) runs in,+// whose title is the app's name.+const TITLE_JUDGED_PATTERNS = [...BROWSER_SIGNATURES, "applicationframehost"].map(tokenPattern);++// Every Chromium and Electron window on Windows has this class, so "chrome"+// inside it says nothing about the app.+const CHROMIUM_WINDOW_CLASS = /chrome_widgetwin_\d+/g;++// A title segment that is the browser's own name, as a whole segment, so a+// page such as "gmail - Brave Search" keeps its words.+const BROWSER_TITLE_NAME =+ /^(?:google chrome|chromium|microsoft edge|mozilla firefox|firefox|librewolf|waterfox|floorp|zen browser|brave|opera|vivaldi|thorium|yandex)(?: private browsing| \(.*\))?$/;+const TITLE_SEPARATOR = /\s[-\u2013\u2014|\u00b7\u2022/]\s/;+const ZERO_WIDTH = /[\u200b-\u200d\ufeff]/g;++function normalizeSignature(appSignature) {+ return String(appSignature || "")+ .toLowerCase()+ .replace(CHROMIUM_WINDOW_CLASS, " ");+}++function matchApp(signature) {+ return CATEGORIES.find((category) =>+ APP_PATTERNS[category].some((pattern) => pattern.test(signature))+ );+}++// The browser's name ends the title, or comes just before the profile Chrome+// on macOS appends after it.+function withoutBrowserName(segments) {+ const last = segments.length - 1;+ if (BROWSER_TITLE_NAME.test(segments[last])) return segments.slice(0, last);+ if (last > 0 && BROWSER_TITLE_NAME.test(segments[last - 1])) return segments.slice(0, last - 1);+ return segments;+}++function matchHost(urlHost) {+ const host = urlHost.toLowerCase().replace(/^www\./, "");+ return CATEGORIES.find((category) =>+ SITE_HOSTS[category].some((site) => host === site || host.endsWith(`.${site}`))+ );+}++// Whether a host carries a site name's brand, its first word, as a label:+// "icloud mail" on www.icloud.com, "yahoo mail" on mail.yahoo.co.uk.+function hostCarriesSite(urlHost, siteName) {+ return urlHost.toLowerCase().split(/[.-]/).includes(siteName.split(" ")[0]);+}++// The site name is the last segment of the page title; Edge may put a profile+// name after it, so there the segment before counts too. Whole-segment+// equality keeps a page that merely mentions a site name out.+function matchTitle(windowTitle, accepts = () => true) {+ const title = windowTitle.toLowerCase().replace(ZERO_WIDTH, "");+ const candidates = withoutBrowserName(+ title.split(TITLE_SEPARATOR).map((segment) => segment.trim())+ )+ .slice(title.endsWith("microsoft edge") ? -2 : -1)+ .map((segment) =>+ segment+ .replace(/^\(\d+\+?\)\s*/, "")+ .replace(/\sand \d+ more (?:pages?|tabs?)$/, "")+ .trim()+ );+ return (+ CATEGORIES.find((category) =>+ candidates.some((segment) => SITE_TITLES[category].includes(segment) && accepts(segment))+ ) ?? "other"+ );+}++/**+ * @param {{ appSignature?: string, windowTitle?: string, urlHost?: string } | null} context+ * @returns {"personal" | "work" | "email" | "other"}+ */+function classifyToneAppCategory(context) {+ if (!context) return "other";+ const signature = normalizeSignature(context.appSignature);+ const app = matchApp(signature);+ if (app) return app;+ if (!TITLE_JUDGED_PATTERNS.some((pattern) => pattern.test(signature))) return "other";+ const byHost = context.urlHost && matchHost(context.urlHost);+ if (byHost) return byHost;+ if (!context.windowTitle) return "other";+ // A host not listed here (iCloud Mail is www.icloud.com) leaves it to the+ // title, but only to a site name the host itself carries: a Notion page+ // titled "Hey" or "Outlook" stays other.+ return matchTitle(+ context.windowTitle,+ (siteName) => !context.urlHost || hostCarriesSite(context.urlHost, siteName)+ );+}++module.exports = { classifyToneAppCategory };diff --git a/src/hooks/useAudioRecording.js b/src/hooks/useAudioRecording.jsindex efcb7f7dd..dcf343d0e 100644--- a/src/hooks/useAudioRecording.js+++ b/src/hooks/useAudioRecording.js@@ -222,6 +222,13 @@ export const useAudioRecording = (toast, options = {}) => {audioManagerRef.current.beginSelectionCapture();}+ // Tone & Style names the app being dictated into while the user speaks;+ // only plain dictation cleanup uses it.+ const { toneStyleEnabled, useCleanupModel } = getSettings();+ if (toneStyleEnabled && useCleanupModel && !voiceAgentRequested && !translationRequested) {+ audioManagerRef.current.beginToneStyleCapture();+ }+// Retry STT config fetch if it wasn't loaded on mount (e.g. auth wasn't ready),// and refresh a copy older than its TTL so a server-side rollout change// reaches a long-running app. Await it only when it can change the startdiff --git a/src/hooks/useToneStylePrompt.ts b/src/hooks/useToneStylePrompt.tsnew file mode 100644index 000000000..fcb2a12ce--- /dev/null+++ b/src/hooks/useToneStylePrompt.ts@@ -0,0 +1,53 @@+import { useCallback, useEffect, useState } from "react";+import { useSettingsStore } from "../stores/settingsStore";+import { subscribeToAnalyticsRefresh } from "../services/AnalyticsService";+import { TONE_STYLE_PROMPT_MIN_WORDS } from "../config/toneStyle";++const BANNER_DISMISSED_KEY = "toneStyleBannerDismissed";+const SETUP_PROMPTED_KEY = "toneStyleSetupPrompted";++const readFlag = (key: string) => localStorage.getItem(key) === "true";++export const dismissToneStyleBanner = () => localStorage.setItem(BANNER_DISMISSED_KEY, "true");++/**+ * Tone & Style's Home entry points, offered once the user has dictated+ * TONE_STYLE_PROMPT_MIN_WORDS words: the banner until it is set up or+ * dismissed, and the setup dialog, opened by itself the first time. The word+ * count is local history's, so with history off only Settings offers it.+ */+export function useToneStylePrompt() {+ const toneStyleEnabled = useSettingsStore((s) => s.toneStyleEnabled);+ const [bannerDismissed, setBannerDismissed] = useState(() => readFlag(BANNER_DISMISSED_KEY));+ const [totalWords, setTotalWords] = useState(0);+ const [dialogOpen, setDialogOpen] = useState(false);+ const pending = !toneStyleEnabled && !bannerDismissed;++ useEffect(() => {+ if (!pending || !window.electronAPI?.getAnalyticsSummary) return;+ return subscribeToAnalyticsRefresh(async () => {+ const summary = await window.electronAPI.getAnalyticsSummary();+ setTotalWords(summary.totalWords);+ }, false);+ }, [pending]);++ const eligible = pending && totalWords >= TONE_STYLE_PROMPT_MIN_WORDS;++ useEffect(() => {+ if (!eligible || readFlag(SETUP_PROMPTED_KEY)) return;+ localStorage.setItem(SETUP_PROMPTED_KEY, "true");+ setDialogOpen(true);+ }, [eligible]);++ const dismissBanner = useCallback(() => {+ dismissToneStyleBanner();+ setBannerDismissed(true);+ }, []);++ // Once Tone & Style is set up, Home stops offering it.+ useEffect(() => {+ if (toneStyleEnabled) dismissBanner();+ }, [toneStyleEnabled, dismissBanner]);++ return { showBanner: eligible, dialogOpen, setDialogOpen, dismissBanner };+}diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.jsonindex d95debf67..e38d0daac 100644--- a/src/locales/ar/translation.json+++ b/src/locales/ar/translation.json@@ -4558,6 +4558,10 @@"description": "اختصارات الإملاء والتفعيل","label": "اختصارات لوحة المفاتيح"},+ "toneStyle": {+ "label": "النبرة والأسلوب",+ "description": "كيف يكتب التنظيف في كل تطبيق"+ },"speechToText": {"description": "محركات الإملاء وتسجيل الملاحظات","label": "تحويل الكلام إلى نص"@@ -5048,6 +5052,91 @@"requestId": "معرّف الطلب"}},+ "toneStyle": {+ "title": "النبرة والأسلوب",+ "description": "اضبط نبرتك وأسلوبك في التطبيقات المختلفة.",+ "turnOnAndSetUp": "تشغيل وإعداد",+ "categories": {+ "personal": {+ "title": "الرسائل الشخصية",+ "inline": "رسائلك الشخصية",+ "question": "كيف تكتب\n{{category}}؟"+ },+ "work": {+ "title": "رسائل العمل",+ "inline": "رسائل العمل",+ "question": "كيف تكتب\n{{category}}؟"+ },+ "email": {+ "title": "البريد الإلكتروني",+ "inline": "رسائل بريدك الإلكتروني",+ "question": "كيف تكتب\n{{category}}؟"+ },+ "other": {+ "title": "تطبيقات أخرى",+ "inline": "في التطبيقات الأخرى",+ "question": "كيف تكتب\n{{category}}؟"+ }+ },+ "tones": {+ "formal": "رسمي",+ "casual": "عفوي",+ "very_casual": "عفوي جدًا",+ "excited": "متحمس!"+ },+ "samples": {+ "personal": {+ "formal": "مرحبًا، هل أنت متاح هذا المساء؟ كنت أفكر أن نحتسي القهوة نحو السادسة. أخبرني.",+ "casual": "مرحبًا، فاضي الليلة؟ أفكر بقهوة على الساعة 6 تقريبًا، قلّي",+ "very_casual": "هلا فاضي الليلة؟ قهوة ع 6؟ قلي"+ },+ "work": {+ "sender": "جيمي",+ "time": "6:20 م",+ "formal": "مرحبًا، هل يمكنك إرسال العرض التقديمي قبل المكالمة؟ يبدو أن أرقام الشريحة 3 قديمة. لا داعي للعجلة.",+ "casual": "مرحبًا، ممكن ترسل العرض قبل المكالمة؟ أظن أرقام الشريحة 3 قديمة، مش مستعجل.",+ "excited": "مرحبًا! ممكن ترسل لي العرض قبل المكالمة؟ متأكد تقريبًا أن أرقام الشريحة 3 قديمة، بدون عجلة!"+ },+ "email": {+ "to": "إلى سارة",+ "formal": "مرحبًا سارة،\n\nشكرًا لوقتك اليوم. سأرسل العرض المحدَّث بحلول يوم الخميس. يُرجى إعلامي إن احتجتِ إلى أي شيء قبل ذلك.\n\nمع خالص التحية",+ "casual": "أهلًا سارة،\n\nشكرًا على اليوم. سأرسل العرض المحدَّث يوم الخميس، أخبريني إن احتجتِ شيئًا قبلها.\n\nشكرًا",+ "excited": "أهلًا سارة،\n\nشكرًا جزيلًا على وقتك اليوم! سأرسل العرض المحدَّث بحلول الخميس. أخبريني إن احتجتِ أي شيء قبلها!\n\nشكرًا"+ },+ "other": {+ "formal": "ملاحظات المكالمة: أعجبتهم صفحة الأسعار ويرغبون في تهيئة أقصر. المتابعة معهم الأسبوع القادم.",+ "casual": "ملاحظات المكالمة: صفحة الأسعار عجبتهم، يبغون تهيئة أقصر. متابعة الأسبوع الجاي",+ "excited": "ملاحظات المكالمة: صفحة الأسعار عجبتهم جدًا! يبغون تهيئة أقصر. متابعة الأسبوع الجاي!"+ }+ },+ "setup": {+ "introTitle": "اجعل OpenWhispr\nيكتب كما تتحدث",+ "introDescription": "اضبط نبرتك وأسلوبك في التطبيقات المختلفة.",+ "personalize": "لنبدأ التخصيص",+ "cleanupOffTitle": "علّم OpenWhispr\nأسلوبك",+ "cleanupOffDescription": "شغّل تنظيف النص، ثم اضبط نبرتك وأسلوبك في التطبيقات المختلفة.",+ "stepDescription": "اختر المثال الأقرب إلى أسلوبك.",+ "progress": "الخطوة {{current}} من {{total}}",+ "finish": "إنهاء"+ },+ "banner": {+ "title": "علّم OpenWhispr كيف تكتب",+ "description": "اضبط النبرة التي تفضلها للعمل والأصدقاء وكل ما بينهما.",+ "start": "ابدأ الآن",+ "cleanupOffTitle": "علّم OpenWhispr أسلوبك",+ "cleanupOffDescription": "شغّل تنظيف النص واختر نبرة للرسائل والبريد الإلكتروني وكل ما عداها.",+ "notNow": "ليس الآن",+ "decoration": "كلماتك يجب أن تشبهك، مهما كان ما تكتبه ولمن تكتبه."+ },+ "settings": {+ "saveChanges": "حفظ التغييرات",+ "saved": "تم حفظ النبرة والأسلوب",+ "cleanupOff": "تنظيف النص متوقف، لذلك لا تُطبَّق هذه النبرات على إملائك.",+ "turnOnCleanup": "تشغيل تنظيف النص",+ "enabled": "النبرات والأصوات مفعّلة",+ "enabledDescription": "يستخدم تنظيف النص نبرتك لكل نوع من التطبيقات. عند الإيقاف، تُستخدم النبرة القياسية."+ }+ },"productHelp": {"sources": "الوثائق الرسمية","settings": "إعدادات التطبيق الحالية",diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex d355b4f2f..a9a11e3f1 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -1651,6 +1651,10 @@"description": "Diktat-Hotkey & Aktivierung","label": "Hotkeys"},+ "toneStyle": {+ "label": "Ton & Stil",+ "description": "Wie die Bereinigung in jeder App schreibt"+ },"speechToText": {"description": "Engines für Diktat & Notizaufnahme","label": "Spracherkennung"@@ -4926,6 +4930,91 @@"requestId": "Anfrage-ID"}},+ "toneStyle": {+ "title": "Ton & Stil",+ "description": "Legen Sie Ton und Stil für verschiedene Apps fest.",+ "turnOnAndSetUp": "Aktivieren und einrichten",+ "categories": {+ "personal": {+ "title": "Persönliche Nachrichten",+ "inline": "Ihre persönlichen Nachrichten",+ "question": "Wie schreiben Sie\n{{category}}?"+ },+ "work": {+ "title": "Arbeitsnachrichten",+ "inline": "Ihre Arbeitsnachrichten",+ "question": "Wie schreiben Sie\n{{category}}?"+ },+ "email": {+ "title": "E-Mails",+ "inline": "Ihre E-Mails",+ "question": "Wie schreiben Sie\n{{category}}?"+ },+ "other": {+ "title": "Andere Apps",+ "inline": "in anderen Apps",+ "question": "Wie schreiben Sie\n{{category}}?"+ }+ },+ "tones": {+ "formal": "Formell",+ "casual": "Locker",+ "very_casual": "Sehr locker",+ "excited": "Begeistert!"+ },+ "samples": {+ "personal": {+ "formal": "Hallo, hast du heute Abend Zeit? Ich dachte, wir könnten gegen 18 Uhr einen Kaffee trinken gehen. Gib mir Bescheid.",+ "casual": "Hey, hast du heute Abend Zeit? Dachte an Kaffee so gegen 6, sag Bescheid",+ "very_casual": "hey heut abend zeit? kaffee so um 6 rum? sag bescheid"+ },+ "work": {+ "sender": "Jimmy",+ "time": "18:20",+ "formal": "Hallo, könntest du mir die Präsentation vor dem Call schicken? Die Zahlen auf Folie 3 sind wohl nicht mehr aktuell. Keine Eile.",+ "casual": "Hey, kannst du mir die Präsi vor dem Call schicken? Glaube, die Zahlen auf Folie 3 sind alt, keine Eile.",+ "excited": "Hey! Kannst du mir die Präsentation vor dem Call schicken? Die Zahlen auf Folie 3 sind bestimmt alt, keine Eile!"+ },+ "email": {+ "to": "An Sarah",+ "formal": "Hallo Sarah,\n\nvielen Dank für Ihre Zeit heute. Das neue Angebot sende ich Ihnen bis Donnerstag. Melden Sie sich gern bei Fragen.\n\nMit freundlichen Grüßen",+ "casual": "Hallo Sarah,\n\ndanke für heute. Ich schicke dir das überarbeitete Angebot bis Donnerstag, sag Bescheid, wenn du vorher noch was brauchst.\n\nDanke",+ "excited": "Hallo Sarah,\n\nvielen Dank für deine Zeit heute! Das neue Angebot schicke ich dir bis Donnerstag. Sag Bescheid, wenn du vorher noch was brauchst!\n\nDanke"+ },+ "other": {+ "formal": "Notizen zum Gespräch: Die Preisseite kam gut an, und sie wünschen sich ein kürzeres Onboarding. Nächste Woche nachfassen.",+ "casual": "Call-Notizen: Preisseite kam gut an, Onboarding soll kürzer. Nächste Woche nachfassen",+ "excited": "Call-Notizen: Sie lieben die Preisseite! Onboarding soll kürzer werden. Nächste Woche nachfassen!"+ }+ },+ "setup": {+ "introTitle": "Lassen Sie OpenWhispr\nso schreiben, wie Sie sprechen",+ "introDescription": "Legen Sie Ton und Stil für verschiedene Apps fest.",+ "personalize": "Jetzt anpassen",+ "cleanupOffTitle": "Bringen Sie OpenWhispr\nIhren Stil bei",+ "cleanupOffDescription": "Aktivieren Sie die Textbereinigung und legen Sie dann Ton und Stil für verschiedene Apps fest.",+ "stepDescription": "Wählen Sie das Beispiel, das am meisten nach Ihnen klingt.",+ "progress": "Schritt {{current}} von {{total}}",+ "finish": "Fertig"+ },+ "banner": {+ "title": "Bringen Sie OpenWhispr bei, wie Sie schreiben",+ "description": "Legen Sie Ihren bevorzugten Ton für Arbeit, Freunde und alles dazwischen fest.",+ "start": "Jetzt starten",+ "cleanupOffTitle": "Bringen Sie OpenWhispr Ihren Stil bei",+ "cleanupOffDescription": "Aktivieren Sie die Textbereinigung und wählen Sie Ihren Ton für jede App.",+ "notNow": "Nicht jetzt",+ "decoration": "Ihre Worte sollten nach Ihnen klingen. Egal, was Sie schreiben und für wen."+ },+ "settings": {+ "saveChanges": "Änderungen speichern",+ "saved": "Ton & Stil gespeichert",+ "cleanupOff": "Die Textbereinigung ist deaktiviert, daher werden diese Einstellungen nicht auf Ihre Diktate angewendet.",+ "turnOnCleanup": "Textbereinigung aktivieren",+ "enabled": "Ton & Stimme aktiviert",+ "enabledDescription": "Die Textbereinigung verwendet Ihren Ton für jede Art von App. Wenn deaktiviert, gilt der Standardton."+ }+ },"productHelp": {"sources": "Offizielle Dokumentation","settings": "Aktuelle Einstellungen",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex f64d686b8..e353cf99f 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1651,6 +1651,10 @@"description": "Dictation hotkey & activation","label": "Hotkeys"},+ "toneStyle": {+ "label": "Tone & Style",+ "description": "How cleanup writes in each app"+ },"speechToText": {"description": "Engines for dictation & note recording","label": "Speech-to-Text"@@ -4926,6 +4930,91 @@"requestId": "Request ID"}},+ "toneStyle": {+ "title": "Tone & Style",+ "description": "Set your tone and style across different apps.",+ "turnOnAndSetUp": "Turn on and set up",+ "categories": {+ "personal": {+ "title": "Personal messages",+ "inline": "personal messages",+ "question": "How do you write\nyour {{category}}"+ },+ "work": {+ "title": "Work messages",+ "inline": "work messages",+ "question": "How do you write\nyour {{category}}"+ },+ "email": {+ "title": "Emails",+ "inline": "emails",+ "question": "How do you write\nyour {{category}}"+ },+ "other": {+ "title": "Other apps",+ "inline": "other apps",+ "question": "How do you write\nin {{category}}"+ }+ },+ "tones": {+ "formal": "Formal",+ "casual": "Casual",+ "very_casual": "Very Casual",+ "excited": "Excited!"+ },+ "samples": {+ "personal": {+ "formal": "Hey, are you around this evening? I was thinking we could grab a coffee around 6. Let me know.",+ "casual": "Hey are you around this evening? Thinking coffee around 6ish, let me know",+ "very_casual": "hey u around this evening? thinking coffee 6ish lmk"+ },+ "work": {+ "sender": "Jimmy",+ "time": "6:20 PM",+ "formal": "Hey, could you send me the deck before the call? The numbers on slide 3 look out of date. No rush.",+ "casual": "Hey can you send the deck before the call? Think slide 3 numbers are old, no rush.",+ "excited": "Hey! Can you send me the deck before the call? Pretty sure slide 3 numbers are old, no rush!"+ },+ "email": {+ "to": "To Sarah",+ "formal": "Hi Sarah,\n\nThank you for your time today. I will send the updated proposal by Thursday. Please let me know if you need anything before then.\n\nBest regards",+ "casual": "Hi Sarah,\n\nThanks for today. I'll send the updated proposal over by Thursday, let me know if you need anything before that.\n\nThanks",+ "excited": "Hi Sarah,\n\nThanks so much for your time today! I'll send the updated proposal by Thursday. Let me know if you need anything before then!\n\nThanks"+ },+ "other": {+ "formal": "Notes from the call: they liked the pricing page and would like a shorter onboarding. Follow up with them next week.",+ "casual": "Call notes: liked the pricing page, want onboarding shorter. Follow up next week",+ "excited": "Call notes: they loved the pricing page! Want onboarding shorter. Follow up next week!"+ }+ },+ "setup": {+ "introTitle": "Make OpenWhispr\ntype the way you talk",+ "introDescription": "Set your tone and style across different apps.",+ "personalize": "Let's Personalize",+ "cleanupOffTitle": "Teach OpenWhispr\nyour voice",+ "cleanupOffDescription": "Turn on AI cleanup, then set your tone and style across different apps.",+ "stepDescription": "Pick the example that sounds most like you.",+ "progress": "Step {{current}} of {{total}}",+ "finish": "Finish"+ },+ "banner": {+ "title": "Teach OpenWhispr how you write",+ "description": "Set your preferred tone for work, friends, and everything in between.",+ "start": "Start Now",+ "cleanupOffTitle": "Teach OpenWhispr your voice",+ "cleanupOffDescription": "Turn on AI cleanup and pick a tone for messages, email, and more.",+ "notNow": "Not now",+ "decoration": "Your words should sound like you. Whatever you're writing, whoever it's for."+ },+ "settings": {+ "saveChanges": "Save Changes",+ "saved": "Tone & Style saved",+ "cleanupOff": "AI cleanup is off, so these tones aren't applied to your dictation.",+ "turnOnCleanup": "Turn on AI cleanup",+ "enabled": "Tones & voices enabled",+ "enabledDescription": "AI cleanup uses your tone for each kind of app. When this is off, it uses the standard tone."+ }+ },"productHelp": {"sources": "Official documentation","settings": "Current app settings",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex c971dbbd8..98662ac91 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -1605,6 +1605,10 @@"description": "Atajo de dictado y activación","label": "Atajos"},+ "toneStyle": {+ "label": "Tono y estilo",+ "description": "Cómo escribe la corrección en cada app"+ },"speechToText": {"description": "Motores para dictado y grabación de notas","label": "Conversión de voz a texto"@@ -4926,6 +4930,91 @@"requestId": "ID de solicitud"}},+ "toneStyle": {+ "title": "Tono y estilo",+ "description": "Define tu tono y estilo en distintas apps.",+ "turnOnAndSetUp": "Activar y configurar",+ "categories": {+ "personal": {+ "title": "Mensajes personales",+ "inline": "tus mensajes personales",+ "question": "¿Cómo escribes\n{{category}}?"+ },+ "work": {+ "title": "Mensajes de trabajo",+ "inline": "tus mensajes de trabajo",+ "question": "¿Cómo escribes\n{{category}}?"+ },+ "email": {+ "title": "Correos",+ "inline": "tus correos",+ "question": "¿Cómo escribes\n{{category}}?"+ },+ "other": {+ "title": "Otras apps",+ "inline": "en otras apps",+ "question": "¿Cómo escribes\n{{category}}?"+ }+ },+ "tones": {+ "formal": "Formal",+ "casual": "Casual",+ "very_casual": "Muy casual",+ "excited": "¡Entusiasta!"+ },+ "samples": {+ "personal": {+ "formal": "Hola, ¿estás disponible esta tarde? Había pensado que podríamos tomar un café sobre las 6. Avísame.",+ "casual": "Hola, ¿estás libre esta tarde? Pensaba en un café sobre las 6, avísame",+ "very_casual": "ey estas libre esta tarde? cafe sobre las 6? avisa"+ },+ "work": {+ "sender": "Jimmy",+ "time": "18:20",+ "formal": "Hola, ¿podrías enviarme la presentación antes de la llamada? Las cifras de la diapositiva 3 parecen desactualizadas. Sin prisa.",+ "casual": "Hola, ¿me pasas la presentación antes de la llamada? Creo que las cifras de la diapo 3 están viejas, sin prisa.",+ "excited": "¡Hola! ¿Me pasas la presentación antes de la llamada? ¡Seguro que las cifras de la diapo 3 están viejas, sin prisa!"+ },+ "email": {+ "to": "Para Sarah",+ "formal": "Hola, Sarah:\n\nGracias por tu tiempo hoy. Te enviaré la propuesta actualizada antes del jueves. Por favor, avísame si necesitas algo antes.\n\nUn cordial saludo",+ "casual": "Hola, Sarah:\n\nGracias por lo de hoy. Te mando la propuesta actualizada el jueves, avísame si necesitas algo antes.\n\nGracias",+ "excited": "Hola, Sarah:\n\n¡Muchas gracias por tu tiempo hoy! Te mando la propuesta actualizada antes del jueves. ¡Avísame si necesitas algo antes!\n\nGracias"+ },+ "other": {+ "formal": "Notas de la llamada: les gustó la página de precios y quieren un onboarding más corto. Hacer seguimiento la próxima semana.",+ "casual": "Notas de la llamada: les gustó la página de precios, quieren el onboarding más corto. Seguimiento la próxima semana",+ "excited": "Notas de la llamada: ¡les encantó la página de precios! Quieren el onboarding más corto. ¡Seguimiento la próxima semana!"+ }+ },+ "setup": {+ "introTitle": "Haz que OpenWhispr\nescriba como hablas",+ "introDescription": "Define tu tono y estilo en distintas apps.",+ "personalize": "Personalizar",+ "cleanupOffTitle": "Enséñale a OpenWhispr\ntu estilo",+ "cleanupOffDescription": "Activa la corrección de texto y define tu tono y estilo en distintas apps.",+ "stepDescription": "Elige el ejemplo que más se parece a ti.",+ "progress": "Paso {{current}} de {{total}}",+ "finish": "Terminar"+ },+ "banner": {+ "title": "Enséñale a OpenWhispr cómo escribes",+ "description": "Elige tu tono preferido para el trabajo, los amigos y todo lo que hay en medio.",+ "start": "Empezar",+ "cleanupOffTitle": "Enséñale a OpenWhispr tu estilo",+ "cleanupOffDescription": "Activa la corrección de texto y elige un tono para mensajes, correos y más.",+ "notNow": "Ahora no",+ "decoration": "Tus palabras deberían sonar como tú. Escribas lo que escribas, sea para quien sea."+ },+ "settings": {+ "saveChanges": "Guardar cambios",+ "saved": "Tono y estilo guardados",+ "cleanupOff": "La corrección de texto está desactivada, así que estos tonos no se aplican a tu dictado.",+ "turnOnCleanup": "Activar corrección de texto",+ "enabled": "Tonos y voces activados",+ "enabledDescription": "La corrección de texto usa tu tono para cada tipo de app. Si está desactivado, usa el tono estándar."+ }+ },"productHelp": {"sources": "Documentación oficial","settings": "Ajustes actuales",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex d3283966c..393a6cf67 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -1651,6 +1651,10 @@"description": "Raccourci de dictée et activation","label": "Raccourcis"},+ "toneStyle": {+ "label": "Ton et style",+ "description": "Comment la correction écrit dans chaque app"+ },"speechToText": {"description": "Moteurs pour dictée et enregistrement de notes","label": "Reconnaissance vocale"@@ -4926,6 +4930,91 @@"requestId": "ID de requête"}},+ "toneStyle": {+ "title": "Ton et style",+ "description": "Définissez votre ton et votre style selon les apps.",+ "turnOnAndSetUp": "Activer et configurer",+ "categories": {+ "personal": {+ "title": "Messages personnels",+ "inline": "vos messages personnels",+ "question": "Comment écrivez-vous\n{{category}} ?"+ },+ "work": {+ "title": "Messages pro",+ "inline": "vos messages pro",+ "question": "Comment écrivez-vous\n{{category}} ?"+ },+ "email": {+ "title": "E-mails",+ "inline": "vos e-mails",+ "question": "Comment écrivez-vous\n{{category}} ?"+ },+ "other": {+ "title": "Autres apps",+ "inline": "dans les autres apps",+ "question": "Comment écrivez-vous\n{{category}} ?"+ }+ },+ "tones": {+ "formal": "Formel",+ "casual": "Décontracté",+ "very_casual": "Très décontracté",+ "excited": "Enthousiaste !"+ },+ "samples": {+ "personal": {+ "formal": "Bonsoir, es-tu disponible ce soir ? Je pensais que nous pourrions prendre un café vers 18 h. Tiens-moi au courant.",+ "casual": "Salut, t'es dispo ce soir ? Je pensais à un café vers 18 h, dis-moi",+ "very_casual": "slt t dispo ce soir ? café vers 18h ? dis moi"+ },+ "work": {+ "sender": "Jimmy",+ "time": "18:20",+ "formal": "Bonjour, pourrais-tu m'envoyer la présentation avant l'appel ? Les chiffres de la diapo 3 semblent obsolètes. Rien d'urgent.",+ "casual": "Hello, tu peux m'envoyer la présentation avant l'appel ? Je crois que les chiffres de la diapo 3 sont vieux, rien d'urgent.",+ "excited": "Hello ! Tu peux m'envoyer la présentation avant l'appel ? Les chiffres de la diapo 3 sont sûrement anciens, rien d'urgent !"+ },+ "email": {+ "to": "À Sarah",+ "formal": "Bonjour Sarah,\n\nMerci pour votre temps aujourd'hui. Je vous enverrai la proposition révisée d'ici jeudi. N'hésitez pas à me solliciter d'ici là.\n\nBien cordialement",+ "casual": "Bonjour Sarah,\n\nMerci pour aujourd'hui. Je t'envoie la proposition mise à jour d'ici jeudi, dis-moi si tu as besoin de quelque chose avant.\n\nMerci",+ "excited": "Bonjour Sarah,\n\nMerci beaucoup pour aujourd'hui ! Je t'envoie la proposition révisée d'ici jeudi. Dis-moi si tu as besoin de quelque chose !\n\nMerci"+ },+ "other": {+ "formal": "Notes de l'appel : ils ont apprécié la page des tarifs et souhaitent un onboarding plus court. Les relancer la semaine prochaine.",+ "casual": "Notes d'appel : page des tarifs appréciée, onboarding à raccourcir. Relancer la semaine pro",+ "excited": "Notes d'appel : ils ont adoré la page des tarifs ! Onboarding à raccourcir. Relancer la semaine prochaine !"+ }+ },+ "setup": {+ "introTitle": "Faites écrire OpenWhispr\ncomme vous parlez",+ "introDescription": "Définissez votre ton et votre style selon les apps.",+ "personalize": "Personnaliser",+ "cleanupOffTitle": "Apprenez votre style\nà OpenWhispr",+ "cleanupOffDescription": "Activez la correction de texte, puis définissez votre ton et votre style selon les apps.",+ "stepDescription": "Choisissez l'exemple qui vous ressemble le plus.",+ "progress": "Étape {{current}} sur {{total}}",+ "finish": "Terminer"+ },+ "banner": {+ "title": "Apprenez à OpenWhispr comment vous écrivez",+ "description": "Choisissez votre ton préféré pour le travail, les amis et tout ce qu'il y a entre les deux.",+ "start": "Commencer",+ "cleanupOffTitle": "Apprenez votre style à OpenWhispr",+ "cleanupOffDescription": "Activez la correction de texte et choisissez un ton pour chaque app.",+ "notNow": "Pas maintenant",+ "decoration": "Vos mots devraient vous ressembler. Quoi que vous écriviez, pour qui que ce soit."+ },+ "settings": {+ "saveChanges": "Enregistrer les modifications",+ "saved": "Ton et style enregistrés",+ "cleanupOff": "La correction de texte est désactivée, donc ces tons ne s'appliquent pas à votre dictée.",+ "turnOnCleanup": "Activer la correction de texte",+ "enabled": "Tons et voix activés",+ "enabledDescription": "La correction de texte utilise votre ton pour chaque type d'app. Si c'est désactivé, le ton standard s'applique."+ }+ },"productHelp": {"sources": "Documentation officielle","settings": "Réglages actuels",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 83982cda9..47d0a47f7 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -1553,6 +1553,10 @@"description": "Scorciatoia di dettatura e attivazione","label": "Scorciatoie"},+ "toneStyle": {+ "label": "Tono e stile",+ "description": "Come scrive la correzione in ogni app"+ },"speechToText": {"description": "Motori per dettatura e registrazione di note","label": "Riconoscimento vocale"@@ -4926,6 +4930,91 @@"requestId": "ID richiesta"}},+ "toneStyle": {+ "title": "Tono e stile",+ "description": "Imposta tono e stile per app diverse.",+ "turnOnAndSetUp": "Attiva e configura",+ "categories": {+ "personal": {+ "title": "Messaggi personali",+ "inline": "i tuoi messaggi personali",+ "question": "Come scrivi\n{{category}}?"+ },+ "work": {+ "title": "Messaggi di lavoro",+ "inline": "i tuoi messaggi di lavoro",+ "question": "Come scrivi\n{{category}}?"+ },+ "email": {+ "title": "Email",+ "inline": "le tue email",+ "question": "Come scrivi\n{{category}}?"+ },+ "other": {+ "title": "Altre app",+ "inline": "nelle altre app",+ "question": "Come scrivi\n{{category}}?"+ }+ },+ "tones": {+ "formal": "Formale",+ "casual": "Informale",+ "very_casual": "Molto informale",+ "excited": "Entusiasta!"+ },+ "samples": {+ "personal": {+ "formal": "Ciao, sei disponibile stasera? Pensavo potessimo prendere un caffè verso le 18. Fammi sapere.",+ "casual": "Ciao, ci sei stasera? Pensavo a un caffè verso le 6, fammi sapere",+ "very_casual": "ehi ci sei stasera? caffè verso le 6? fammi sapere"+ },+ "work": {+ "sender": "Jimmy",+ "time": "18:20",+ "formal": "Ciao, potresti mandarmi la presentazione prima della call? I numeri della slide 3 sembrano superati. Nessuna fretta.",+ "casual": "Ciao, mi mandi la presentazione prima della call? Mi sa che i numeri della slide 3 sono vecchi, nessuna fretta.",+ "excited": "Ciao! Mi mandi la presentazione prima della call? Sono quasi sicuro che i numeri della slide 3 siano vecchi, nessuna fretta!"+ },+ "email": {+ "to": "A Sarah",+ "formal": "Ciao Sarah,\n\ngrazie per il tempo dedicatomi oggi. Ti invierò la proposta aggiornata entro giovedì. Fammi sapere se ti serve altro.\n\nCordiali saluti",+ "casual": "Ciao Sarah,\n\ngrazie per oggi. Ti mando la proposta aggiornata entro giovedì, dimmi se ti serve qualcosa prima.\n\nGrazie",+ "excited": "Ciao Sarah,\n\ngrazie mille per il tuo tempo oggi! Ti mando la proposta aggiornata entro giovedì. Fammi sapere se ti serve qualcosa prima!\n\nGrazie"+ },+ "other": {+ "formal": "Note della call: hanno apprezzato la pagina dei prezzi e vorrebbero un onboarding più breve. Ricontattarli la prossima settimana.",+ "casual": "Note call: piaciuta la pagina prezzi, vogliono onboarding più corto. Ricontattare settimana prossima",+ "excited": "Note call: hanno adorato la pagina prezzi! Vogliono un onboarding più corto. Ricontattare la settimana prossima!"+ }+ },+ "setup": {+ "introTitle": "Fai scrivere OpenWhispr\ncome parli tu",+ "introDescription": "Imposta tono e stile per app diverse.",+ "personalize": "Personalizza",+ "cleanupOffTitle": "Insegna a OpenWhispr\nil tuo stile",+ "cleanupOffDescription": "Attiva la correzione testo, poi imposta tono e stile per app diverse.",+ "stepDescription": "Scegli l'esempio che ti somiglia di più.",+ "progress": "Passo {{current}} di {{total}}",+ "finish": "Fine"+ },+ "banner": {+ "title": "Insegna a OpenWhispr come scrivi",+ "description": "Imposta il tuo tono preferito per lavoro, amici e tutto ciò che sta in mezzo.",+ "start": "Inizia ora",+ "cleanupOffTitle": "Insegna a OpenWhispr il tuo stile",+ "cleanupOffDescription": "Attiva la correzione testo e scegli un tono per messaggi, email e altro.",+ "notNow": "Non ora",+ "decoration": "Le tue parole dovrebbero somigliarti. Qualunque cosa tu scriva, per chiunque sia."+ },+ "settings": {+ "saveChanges": "Salva modifiche",+ "saved": "Tono e stile salvati",+ "cleanupOff": "La correzione testo è disattivata, quindi questi toni non vengono applicati alla dettatura.",+ "turnOnCleanup": "Attiva correzione testo",+ "enabled": "Toni e voci attivi",+ "enabledDescription": "La correzione testo usa il tuo tono per ogni tipo di app. Se disattivato, usa il tono standard."+ }+ },"productHelp": {"sources": "Documentazione ufficiale","settings": "Impostazioni attuali",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex a1f9ad9fc..c91487818 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -1553,6 +1553,10 @@"description": "ディクテーションホットキーと起動モード","label": "ホットキー"},+ "toneStyle": {+ "label": "トーンとスタイル",+ "description": "アプリごとの補正の書き方"+ },"speechToText": {"description": "ディクテーションとノート録音用エンジン","label": "音声認識"@@ -4926,6 +4930,91 @@"requestId": "リクエストID"}},+ "toneStyle": {+ "title": "トーンとスタイル",+ "description": "アプリごとにトーンとスタイルを設定します。",+ "turnOnAndSetUp": "オンにして設定",+ "categories": {+ "personal": {+ "title": "個人のメッセージ",+ "inline": "個人のメッセージ",+ "question": "{{category}}、\nどう書きますか?"+ },+ "work": {+ "title": "仕事のメッセージ",+ "inline": "仕事のメッセージ",+ "question": "{{category}}、\nどう書きますか?"+ },+ "email": {+ "title": "メール",+ "inline": "メール",+ "question": "{{category}}、\nどう書きますか?"+ },+ "other": {+ "title": "その他のアプリ",+ "inline": "その他のアプリ",+ "question": "{{category}}、\nどう書きますか?"+ }+ },+ "tones": {+ "formal": "フォーマル",+ "casual": "カジュアル",+ "very_casual": "とてもカジュアル",+ "excited": "元気に!"+ },+ "samples": {+ "personal": {+ "formal": "こんばんは。今夜はお時間ありますか?6時ごろにコーヒーでもいかがでしょうか。ご都合を教えてください。",+ "casual": "今夜ひま?6時ごろコーヒーどうかなって思ってる、教えて",+ "very_casual": "今夜ひま?6時くらいにカフェいこ 連絡して"+ },+ "work": {+ "sender": "ジミー",+ "time": "18:20",+ "formal": "お疲れさまです。打ち合わせの前に資料を送っていただけますか?3枚目の数字が古いようです。急ぎではありません。",+ "casual": "打ち合わせ前に資料送ってもらえる?3枚目の数字、古いかも。急ぎじゃないです。",+ "excited": "お疲れさまです!打ち合わせ前に資料を送ってもらえますか?3枚目の数字、たぶん古いです。急ぎではないです!"+ },+ "email": {+ "to": "宛先: サラ",+ "formal": "サラ様\n\n本日はありがとうございました。木曜日までに提案書の更新版をお送りします。何かあればお知らせください。\n\nよろしくお願いいたします",+ "casual": "サラさん\n\n今日はありがとうございました。更新した提案書は木曜までに送りますね。その前に何か必要なら言ってください。\n\nよろしく",+ "excited": "サラさん\n\n今日は本当にありがとうございました!木曜までに更新した提案書を送ります。その前に何か必要なら、いつでも言ってください!\n\nよろしくお願いします"+ },+ "other": {+ "formal": "通話メモ:料金ページは好評で、オンボーディングを短くしてほしいとのこと。来週フォローアップする。",+ "casual": "通話メモ:料金ページ好評、オンボーディングは短めがいい。来週フォロー",+ "excited": "通話メモ:料金ページがすごく好評!オンボーディングは短めがいいとのこと。来週フォロー!"+ }+ },+ "setup": {+ "introTitle": "OpenWhispr を\nあなたの話し方に",+ "introDescription": "アプリごとにトーンとスタイルを設定します。",+ "personalize": "パーソナライズする",+ "cleanupOffTitle": "あなたの書き方を\nOpenWhispr に",+ "cleanupOffDescription": "テキスト補正をオンにして、アプリごとにトーンとスタイルを設定します。",+ "stepDescription": "いちばん自分らしい例を選んでください。",+ "progress": "ステップ {{current}}/{{total}}",+ "finish": "完了"+ },+ "banner": {+ "title": "あなたの書き方を OpenWhispr に教えましょう",+ "description": "仕事にも、友だちにも、その間のすべてにも、好みのトーンを設定できます。",+ "start": "始める",+ "cleanupOffTitle": "あなたの書き方を OpenWhispr に",+ "cleanupOffDescription": "テキスト補正をオンにして、メッセージやメールなどのトーンを選びましょう。",+ "notNow": "後で",+ "decoration": "言葉は、あなたらしく。何を書くときも、誰に書くときも。"+ },+ "settings": {+ "saveChanges": "変更を保存",+ "saved": "トーンとスタイルを保存しました",+ "cleanupOff": "テキスト補正がオフのため、これらのトーンは音声入力に反映されません。",+ "turnOnCleanup": "テキスト補正をオンにする",+ "enabled": "トーンとボイスを有効化",+ "enabledDescription": "テキスト補正がアプリの種類ごとにあなたのトーンを使います。オフのときは標準のトーンになります。"+ }+ },"productHelp": {"sources": "公式ドキュメント","settings": "現在のアプリ設定",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 2aaeb8063..65088eb63 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -1532,6 +1532,10 @@"description": "Atalho de ditado e ativação","label": "Atalhos"},+ "toneStyle": {+ "label": "Tom e estilo",+ "description": "Como a limpeza escreve em cada app"+ },"speechToText": {"description": "Motores para ditado e gravação de notas","label": "Voz para texto"@@ -4926,6 +4930,91 @@"requestId": "ID da solicitação"}},+ "toneStyle": {+ "title": "Tom e estilo",+ "description": "Defina seu tom e estilo em diferentes apps.",+ "turnOnAndSetUp": "Ativar e configurar",+ "categories": {+ "personal": {+ "title": "Mensagens pessoais",+ "inline": "suas mensagens pessoais",+ "question": "Como você escreve\n{{category}}?"+ },+ "work": {+ "title": "Mensagens de trabalho",+ "inline": "suas mensagens de trabalho",+ "question": "Como você escreve\n{{category}}?"+ },+ "email": {+ "title": "E-mails",+ "inline": "seus e-mails",+ "question": "Como você escreve\n{{category}}?"+ },+ "other": {+ "title": "Outros apps",+ "inline": "em outros apps",+ "question": "Como você escreve\n{{category}}?"+ }+ },+ "tones": {+ "formal": "Formal",+ "casual": "Casual",+ "very_casual": "Muito casual",+ "excited": "Animado!"+ },+ "samples": {+ "personal": {+ "formal": "Oi, você está livre hoje à noite? Pensei que poderíamos tomar um café por volta das 18h. Me avise.",+ "casual": "Oi, tá livre hoje à noite? Pensei num café lá pelas 6, me avisa",+ "very_casual": "oi vc ta livre hj a noite? cafe la pelas 6? me avisa"+ },+ "work": {+ "sender": "Jimmy",+ "time": "18:20",+ "formal": "Oi, você poderia me enviar a apresentação antes da call? Os números do slide 3 parecem desatualizados. Sem pressa.",+ "casual": "Oi, consegue me mandar a apresentação antes da call? Acho que os números do slide 3 tão velhos, sem pressa.",+ "excited": "Oi! Consegue me mandar a apresentação antes da call? Tenho quase certeza que os números do slide 3 estão velhos, sem pressa!"+ },+ "email": {+ "to": "Para Sarah",+ "formal": "Olá, Sarah,\n\nObrigado pelo seu tempo hoje. Enviarei a proposta atualizada até quinta-feira. Por favor, me avise se precisar de algo antes disso.\n\nAtenciosamente",+ "casual": "Oi, Sarah,\n\nValeu por hoje. Mando a proposta atualizada até quinta, me avisa se precisar de algo antes.\n\nValeu",+ "excited": "Oi, Sarah,\n\nMuito obrigado pelo seu tempo hoje! Mando a proposta atualizada até quinta. Me avise se precisar de algo antes!\n\nObrigado"+ },+ "other": {+ "formal": "Notas da call: gostaram da página de preços e gostariam de um onboarding mais curto. Retomar o contato na próxima semana.",+ "casual": "Notas da call: curtiram a página de preços, querem onboarding mais curto. Retomar semana que vem",+ "excited": "Notas da call: amaram a página de preços! Querem um onboarding mais curto. Retomar semana que vem!"+ }+ },+ "setup": {+ "introTitle": "Faça o OpenWhispr\nescrever como você fala",+ "introDescription": "Defina seu tom e estilo em diferentes apps.",+ "personalize": "Personalizar",+ "cleanupOffTitle": "Ensine ao OpenWhispr\no seu estilo",+ "cleanupOffDescription": "Ative a limpeza de texto e defina seu tom e estilo em diferentes apps.",+ "stepDescription": "Escolha o exemplo que mais se parece com você.",+ "progress": "Etapa {{current}} de {{total}}",+ "finish": "Concluir"+ },+ "banner": {+ "title": "Ensine ao OpenWhispr como você escreve",+ "description": "Defina seu tom preferido para o trabalho, os amigos e tudo o que fica no meio.",+ "start": "Começar",+ "cleanupOffTitle": "Ensine ao OpenWhispr o seu estilo",+ "cleanupOffDescription": "Ative a limpeza de texto e escolha um tom para mensagens, e-mails e mais.",+ "notNow": "Agora não",+ "decoration": "Suas palavras devem soar como você. Não importa o que você escreva, nem para quem."+ },+ "settings": {+ "saveChanges": "Salvar alterações",+ "saved": "Tom e estilo salvos",+ "cleanupOff": "A limpeza de texto está desativada, então esses tons não são aplicados ao seu ditado.",+ "turnOnCleanup": "Ativar limpeza de texto",+ "enabled": "Tons e vozes ativados",+ "enabledDescription": "A limpeza de texto usa seu tom para cada tipo de app. Desativado, usa o tom padrão."+ }+ },"productHelp": {"sources": "Documentação oficial","settings": "Configurações atuais",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 2dd10f2b3..b20260bdb 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -1553,6 +1553,10 @@"description": "Горячая клавиша диктовки и активация","label": "Горячие клавиши"},+ "toneStyle": {+ "label": "Тон и стиль",+ "description": "Как очистка пишет в каждом приложении"+ },"speechToText": {"description": "Движки для диктовки и записи заметок","label": "Речь в текст"@@ -4972,6 +4976,91 @@"requestId": "ID запроса"}},+ "toneStyle": {+ "title": "Тон и стиль",+ "description": "Настройте тон и стиль для разных приложений.",+ "turnOnAndSetUp": "Включить и настроить",+ "categories": {+ "personal": {+ "title": "Личные сообщения",+ "inline": "личные сообщения",+ "question": "Как вы пишете\n{{category}}?"+ },+ "work": {+ "title": "Рабочие сообщения",+ "inline": "рабочие сообщения",+ "question": "Как вы пишете\n{{category}}?"+ },+ "email": {+ "title": "Письма",+ "inline": "письма",+ "question": "Как вы пишете\n{{category}}?"+ },+ "other": {+ "title": "Другие приложения",+ "inline": "в других приложениях",+ "question": "Как вы пишете\n{{category}}?"+ }+ },+ "tones": {+ "formal": "Официально",+ "casual": "Непринуждённо",+ "very_casual": "Совсем неформально",+ "excited": "С энтузиазмом!"+ },+ "samples": {+ "personal": {+ "formal": "Привет, ты свободен сегодня вечером? Я подумал, что мы могли бы выпить кофе около шести. Дай знать.",+ "casual": "Привет, ты сегодня вечером свободен? Думаю, кофе часов в 6, дай знать",+ "very_casual": "прив ты свободен вечером? кофе в 6? напиши"+ },+ "work": {+ "sender": "Джимми",+ "time": "18:20",+ "formal": "Привет, не могли бы вы прислать презентацию до созвона? Цифры на третьем слайде, кажется, устарели. Не к спеху.",+ "casual": "Привет, скинешь презентацию до созвона? Кажется, цифры на 3-м слайде старые, не к спеху.",+ "excited": "Привет! Скинешь презентацию до созвона? Почти уверен, что цифры на 3-м слайде старые, не к спеху!"+ },+ "email": {+ "to": "Кому: Сара",+ "formal": "Здравствуйте, Сара!\n\nСпасибо за уделённое время. Обновлённое предложение пришлю до четверга. Если что-то понадобится, дайте знать.\n\nС уважением",+ "casual": "Привет, Сара!\n\nСпасибо за сегодня. Пришлю обновлённое предложение до четверга, напиши, если что-то понадобится раньше.\n\nСпасибо",+ "excited": "Привет, Сара!\n\nОгромное спасибо за встречу! Обновлённое предложение пришлю до четверга. Пиши, если что-то понадобится!\n\nСпасибо"+ },+ "other": {+ "formal": "Заметки по звонку: им понравилась страница с ценами, они хотели бы более короткий онбординг. Связаться с ними на следующей неделе.",+ "casual": "Заметки по звонку: страница с ценами зашла, онбординг хотят короче. Связаться на следующей неделе",+ "excited": "Заметки по звонку: страница с ценами им очень понравилась! Онбординг хотят короче. Связаться на следующей неделе!"+ }+ },+ "setup": {+ "introTitle": "Пусть OpenWhispr пишет\nтак, как вы говорите",+ "introDescription": "Настройте тон и стиль для разных приложений.",+ "personalize": "Настроить",+ "cleanupOffTitle": "Научите OpenWhispr\nсвоему стилю",+ "cleanupOffDescription": "Включите очистку текста и настройте тон и стиль для разных приложений.",+ "stepDescription": "Выберите пример, который больше всего похож на вас.",+ "progress": "Шаг {{current}} из {{total}}",+ "finish": "Готово"+ },+ "banner": {+ "title": "Научите OpenWhispr писать как вы",+ "description": "Выберите предпочтительный тон для работы, друзей и всего, что между ними.",+ "start": "Начать",+ "cleanupOffTitle": "Научите OpenWhispr своему стилю",+ "cleanupOffDescription": "Включите очистку текста и выберите тон для сообщений, писем и не только.",+ "notNow": "Не сейчас",+ "decoration": "Ваши слова должны звучать как вы, что бы вы ни писали и кому бы ни писали."+ },+ "settings": {+ "saveChanges": "Сохранить изменения",+ "saved": "Тон и стиль сохранены",+ "cleanupOff": "Очистка текста выключена, поэтому эти тоны не применяются к диктовке.",+ "turnOnCleanup": "Включить очистку текста",+ "enabled": "Тон и голос включены",+ "enabledDescription": "Очистка текста использует ваш тон для каждого типа приложений. Если выключено, используется стандартный тон."+ }+ },"productHelp": {"sources": "Официальная документация","settings": "Текущие настройки",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex 53a2f5a8f..135168572 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -1553,6 +1553,10 @@"description": "听写快捷键与激活模式","label": "快捷键"},+ "toneStyle": {+ "label": "语气与风格",+ "description": "整理在各个应用里的写法"+ },"speechToText": {"description": "听写与笔记录音引擎","label": "语音转文字"@@ -4926,6 +4930,91 @@"requestId": "请求 ID"}},+ "toneStyle": {+ "title": "语气与风格",+ "description": "为不同的应用设置你的语气和风格。",+ "turnOnAndSetUp": "开启并设置",+ "categories": {+ "personal": {+ "title": "私人消息",+ "inline": "私人消息",+ "question": "{{category}}\n你会怎么写?"+ },+ "work": {+ "title": "工作消息",+ "inline": "工作消息",+ "question": "{{category}}\n你会怎么写?"+ },+ "email": {+ "title": "电子邮件",+ "inline": "电子邮件",+ "question": "{{category}}\n你会怎么写?"+ },+ "other": {+ "title": "其他应用",+ "inline": "其他应用里的文字",+ "question": "{{category}}\n你会怎么写?"+ }+ },+ "tones": {+ "formal": "正式",+ "casual": "随意",+ "very_casual": "非常随意",+ "excited": "热情!"+ },+ "samples": {+ "personal": {+ "formal": "你好,今晚有空吗?我想我们可以在六点左右一起喝杯咖啡。请告诉我。",+ "casual": "今晚有空吗?想六点左右去喝个咖啡,告诉我一声",+ "very_casual": "今晚有空不 6点喝咖啡?回我"+ },+ "work": {+ "sender": "吉米",+ "time": "18:20",+ "formal": "你好,能否在通话前把演示文稿发给我?第 3 页的数据似乎已经过时了。不着急。",+ "casual": "能在通话前把演示文稿发我吗?第 3 页的数据好像旧了,不急。",+ "excited": "嗨!能在通话前把演示文稿发我吗?第 3 页的数据应该是旧的,不着急!"+ },+ "email": {+ "to": "收件人:莎拉",+ "formal": "莎拉,您好:\n\n感谢您今天抽出时间。我会在周四前发送更新后的方案。在此之前如有任何需要,请随时告诉我。\n\n此致\n敬礼",+ "casual": "莎拉,你好:\n\n今天谢谢啦。周四前我把更新后的方案发你,之前有什么需要跟我说。\n\n谢谢",+ "excited": "莎拉,你好:\n\n非常感谢你今天抽空!周四前我会把更新后的方案发给你。之前有任何需要都可以告诉我!\n\n谢谢"+ },+ "other": {+ "formal": "通话记录:他们很喜欢定价页面,希望缩短新手引导流程。下周跟进。",+ "casual": "通话记录:定价页反馈不错,想要更短的引导。下周跟进",+ "excited": "通话记录:他们超喜欢定价页面!想要更短的引导。下周跟进!"+ }+ },+ "setup": {+ "introTitle": "让 OpenWhispr\n照你说话的方式写",+ "introDescription": "为不同的应用设置你的语气和风格。",+ "personalize": "开始个性化",+ "cleanupOffTitle": "让 OpenWhispr\n学会你的风格",+ "cleanupOffDescription": "开启文本整理,然后为不同的应用设置你的语气和风格。",+ "stepDescription": "选出最像你的示例。",+ "progress": "第 {{current}} 步,共 {{total}} 步",+ "finish": "完成"+ },+ "banner": {+ "title": "教 OpenWhispr 学会你的写法",+ "description": "为工作、朋友以及两者之间的一切设置你偏好的语气。",+ "start": "立即开始",+ "cleanupOffTitle": "让 OpenWhispr 学会你的风格",+ "cleanupOffDescription": "开启文本整理,为消息、邮件和其他地方选一种语气。",+ "notNow": "暂不",+ "decoration": "你的文字应该听起来就像你。无论你写什么,写给谁。"+ },+ "settings": {+ "saveChanges": "保存更改",+ "saved": "语气与风格已保存",+ "cleanupOff": "文本整理已关闭,因此这些语气不会应用到你的听写中。",+ "turnOnCleanup": "开启文本整理",+ "enabled": "启用语气与声音",+ "enabledDescription": "文本整理会为每类应用使用你的语气。关闭时使用标准语气。"+ }+ },"productHelp": {"sources": "官方文档","settings": "当前应用设置",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 711237bdd..2c7887add 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -1553,6 +1553,10 @@"description": "聽寫快捷鍵與啟用模式","label": "快捷鍵"},+ "toneStyle": {+ "label": "語氣與風格",+ "description": "整理在各個應用程式中的寫法"+ },"speechToText": {"description": "聽寫與筆記錄音引擎","label": "語音轉文字"@@ -4926,6 +4930,91 @@"requestId": "請求 ID"}},+ "toneStyle": {+ "title": "語氣與風格",+ "description": "為不同的應用程式設定你的語氣和風格。",+ "turnOnAndSetUp": "開啟並設定",+ "categories": {+ "personal": {+ "title": "私人訊息",+ "inline": "私人訊息",+ "question": "{{category}}\n你會怎麼寫?"+ },+ "work": {+ "title": "工作訊息",+ "inline": "工作訊息",+ "question": "{{category}}\n你會怎麼寫?"+ },+ "email": {+ "title": "電子郵件",+ "inline": "電子郵件",+ "question": "{{category}}\n你會怎麼寫?"+ },+ "other": {+ "title": "其他應用程式",+ "inline": "其他應用程式中的文字",+ "question": "{{category}}\n你會怎麼寫?"+ }+ },+ "tones": {+ "formal": "正式",+ "casual": "隨性",+ "very_casual": "非常隨性",+ "excited": "熱情!"+ },+ "samples": {+ "personal": {+ "formal": "你好,今晚有空嗎?我在想我們可以六點左右一起喝杯咖啡。請告訴我。",+ "casual": "今晚有空嗎?想六點左右去喝咖啡,跟我說一聲",+ "very_casual": "今晚有空嗎 6點喝咖啡?回我"+ },+ "work": {+ "sender": "吉米",+ "time": "18:20",+ "formal": "你好,可以在通話前把簡報寄給我嗎?第 3 頁的數字似乎已經過時了。不急。",+ "casual": "通話前可以把簡報傳給我嗎?第 3 頁的數字好像舊了,不急。",+ "excited": "嗨!通話前可以把簡報傳給我嗎?第 3 頁的數字應該是舊的,不急喔!"+ },+ "email": {+ "to": "收件者:莎拉",+ "formal": "莎拉您好:\n\n感謝您今天撥冗。我會在週四前寄出更新後的提案。在那之前若有任何需要,請隨時告訴我。\n\n敬祝 順心",+ "casual": "莎拉你好:\n\n今天謝啦。週四前我把更新後的提案寄給你,之前有需要再跟我說。\n\n謝謝",+ "excited": "莎拉你好:\n\n非常感謝你今天抽空!週四前我會寄出更新後的提案。之前有任何需要都可以跟我說!\n\n謝謝"+ },+ "other": {+ "formal": "通話紀錄:他們很喜歡定價頁面,希望縮短新手引導流程。下週追蹤。",+ "casual": "通話紀錄:定價頁反應不錯,想要更短的引導。下週追蹤",+ "excited": "通話紀錄:他們超喜歡定價頁面!想要更短的引導。下週追蹤!"+ }+ },+ "setup": {+ "introTitle": "讓 OpenWhispr\n照你說話的方式寫",+ "introDescription": "為不同的應用程式設定你的語氣和風格。",+ "personalize": "開始個人化",+ "cleanupOffTitle": "讓 OpenWhispr\n學會你的風格",+ "cleanupOffDescription": "開啟文字整理,再為不同的應用程式設定你的語氣和風格。",+ "stepDescription": "選出最像你的範例。",+ "progress": "第 {{current}} 步,共 {{total}} 步",+ "finish": "完成"+ },+ "banner": {+ "title": "教 OpenWhispr 學會你的寫法",+ "description": "為工作、朋友以及兩者之間的一切設定你偏好的語氣。",+ "start": "立即開始",+ "cleanupOffTitle": "讓 OpenWhispr 學會你的風格",+ "cleanupOffDescription": "開啟文字整理,為訊息、郵件和其他地方選一種語氣。",+ "notNow": "暫時不要",+ "decoration": "你的文字應該聽起來就像你。無論你寫什麼,寫給誰。"+ },+ "settings": {+ "saveChanges": "儲存變更",+ "saved": "語氣與風格已儲存",+ "cleanupOff": "文字整理已關閉,因此這些語氣不會套用到你的聽寫。",+ "turnOnCleanup": "開啟文字整理",+ "enabled": "啟用語氣與聲音",+ "enabledDescription": "文字整理會為每類應用程式使用你的語氣。關閉時使用標準語氣。"+ }+ },"productHelp": {"sources": "官方文件","settings": "目前應用程式設定",diff --git a/src/services/BaseReasoningService.ts b/src/services/BaseReasoningService.tsindex 0320066ab..c2bb6df71 100644--- a/src/services/BaseReasoningService.ts+++ b/src/services/BaseReasoningService.ts@@ -3,6 +3,7 @@ import { getSettings } from "../stores/settingsStore";import { resolveCleanupLanguage } from "../utils/chineseScript";import { getDictionaryHintWords } from "../utils/snippets";import type { InferenceScope } from "../config/inferenceScopes";+import type { DictationToneStyle } from "../config/toneStyle";import type { ScreenContextImage } from "../types/electron";export interface ReasoningConfig {@@ -18,6 +19,8 @@ export interface ReasoningConfig {reasoningEffort?: string;/** Screenshot attached to voice-agent requests when screen context is on. */screenContext?: ScreenContextImage;+ /** Dictation cleanup only: the Tone & Style tone for the app being dictated into. */+ toneStyle?: DictationToneStyle | null;/** Suffix-free prompt used when a screenshot-carrying request is retried text-only. */textOnlySystemPrompt?: string;language?: string;@@ -55,12 +58,16 @@ export abstract class BaseReasoningService {return getSettings().uiLanguage || "en";}- protected getSystemPrompt(agentName: string | null): string {+ protected getSystemPrompt(+ agentName: string | null,+ toneStyle?: DictationToneStyle | null+ ): string {return getCleanupSystemPrompt(agentName,this.getCustomDictionary(),this.getPreferredLanguage(),- this.getUiLanguage()+ this.getUiLanguage(),+ toneStyle);}diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.tsindex baa44c356..6b262930a 100644--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@ -302,7 +302,7 @@ class ReasoningService extends BaseReasoningService {// No systemPrompt override means the default cleanup path: a deterministic// transform, so zero temperature and a delimited transcript.const isCleanup = !config.systemPrompt;- const systemPrompt = config.systemPrompt || this.getSystemPrompt(agentName);+ const systemPrompt = config.systemPrompt || this.getSystemPrompt(agentName, config.toneStyle);const userPrompt = isCleanup ? wrapCleanupTranscript(text) : text;const messages = [diff --git a/src/services/ai/inferenceProviders/anthropic.ts b/src/services/ai/inferenceProviders/anthropic.tsindex 8d5342b0a..ed2cbd661 100644--- a/src/services/ai/inferenceProviders/anthropic.ts+++ b/src/services/ai/inferenceProviders/anthropic.ts@@ -17,7 +17,7 @@ export const anthropicProvider: InferenceProvider = {logger.logReasoning("ANTHROPIC_IPC_CALL", { model, textLength: text.length });- const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName);+ const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName, config.toneStyle);const userContent = config.systemPrompt ? text : wrapCleanupTranscript(text);// Claude models from Opus 4.7 onward reject `temperature` with a 400, so// unknown models default to omitting it, which every model accepts.diff --git a/src/services/ai/inferenceProviders/enterprise.ts b/src/services/ai/inferenceProviders/enterprise.tsindex 25bd0a4cb..e4903e417 100644--- a/src/services/ai/inferenceProviders/enterprise.ts+++ b/src/services/ai/inferenceProviders/enterprise.ts@@ -25,7 +25,7 @@ export const enterpriseProvider: InferenceProvider = {logger.logReasoning("ENTERPRISE_START", { provider: enterpriseId, model, agentName });- const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName);+ const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName, config.toneStyle);const userContent = config.systemPrompt ? text : wrapCleanupTranscript(text);const { supportsTemperature } = getOpenAiApiConfig(model);diff --git a/src/services/ai/inferenceProviders/gemini.ts b/src/services/ai/inferenceProviders/gemini.tsindex fbe5f8e88..7da8259e0 100644--- a/src/services/ai/inferenceProviders/gemini.ts+++ b/src/services/ai/inferenceProviders/gemini.ts@@ -57,7 +57,7 @@ export const geminiProvider: InferenceProvider = {const apiKey = await ctx.getApiKey("gemini");logger.logReasoning("GEMINI_API_KEY", { hasApiKey: !!apiKey, keyLength: apiKey?.length || 0 });- const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName);+ const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName, config.toneStyle);const userContent = config.systemPrompt ? text : wrapCleanupTranscript(text);const isGemini = model.startsWith("gemini-");diff --git a/src/services/ai/inferenceProviders/local.ts b/src/services/ai/inferenceProviders/local.tsindex 49a0184ec..c56ddb6be 100644--- a/src/services/ai/inferenceProviders/local.ts+++ b/src/services/ai/inferenceProviders/local.ts@@ -15,7 +15,7 @@ export const localProvider: InferenceProvider = {logger.logReasoning("LOCAL_IPC_CALL", { model, textLength: text.length });- const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName);+ const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName, config.toneStyle);const userContent = config.systemPrompt ? text : wrapCleanupTranscript(text);const result = await window.electronAPI.processLocalReasoning(userContent, model, agentName, {...config,diff --git a/src/services/ai/inferenceProviders/openai.ts b/src/services/ai/inferenceProviders/openai.tsindex 5b592a19e..e961f7d64 100644--- a/src/services/ai/inferenceProviders/openai.ts+++ b/src/services/ai/inferenceProviders/openai.ts@@ -168,7 +168,7 @@ export const openaiProvider: InferenceProvider = {keyLength: apiKey?.length || 0,});- const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName);+ const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName, config.toneStyle);const userContent = config.systemPrompt ? text : wrapCleanupTranscript(text);const imageDataUrl = config.screenContext? `data:${config.screenContext.mediaType};base64,${config.screenContext.data}`diff --git a/src/services/ai/inferenceProviders/openwhispr.ts b/src/services/ai/inferenceProviders/openwhispr.tsindex a4cc0d56c..df7b0c04c 100644--- a/src/services/ai/inferenceProviders/openwhispr.ts+++ b/src/services/ai/inferenceProviders/openwhispr.ts@@ -41,6 +41,7 @@ export const openwhisprProvider: InferenceProvider = {? INFERENCE_SCOPES[config.inferenceScope].cloudPurpose: undefined,screenContext: config.screenContext,+ ...config.toneStyle,language: config.language || ctx.getPreferredLanguage(),locale: ctx.getUiLanguage(),});diff --git a/src/services/ai/inferenceProviders/tinfoil.ts b/src/services/ai/inferenceProviders/tinfoil.tsindex 8c82589fa..dcffe755c 100644--- a/src/services/ai/inferenceProviders/tinfoil.ts+++ b/src/services/ai/inferenceProviders/tinfoil.ts@@ -25,7 +25,7 @@ export const tinfoilProvider: InferenceProvider = {// refuses to send anything over an unverified transport.const client = await getTinfoilChatClient(apiKey);- const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName);+ const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName, config.toneStyle);const userContent = config.systemPrompt ? text : wrapCleanupTranscript(text);const messages = [{ role: "system", content: systemPrompt },diff --git a/src/services/ai/inferenceProviders/types.ts b/src/services/ai/inferenceProviders/types.tsindex 4836924a7..4275ff6bd 100644--- a/src/services/ai/inferenceProviders/types.ts+++ b/src/services/ai/inferenceProviders/types.ts@@ -1,8 +1,9 @@import type { ReasoningConfig } from "../../BaseReasoningService";+import type { DictationToneStyle } from "../../../config/toneStyle";export interface ProviderContext {getApiKey(provider: string): Promise<string>;- getSystemPrompt(agentName: string | null): string;+ getSystemPrompt(agentName: string | null, toneStyle?: DictationToneStyle | null): string;getCustomDictionary(): string[];getPreferredLanguage(): string;getUiLanguage(): string;diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex b3660104c..44dd16ee8 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -14,6 +14,7 @@ import type {} from "../types/electron";import type { CalendarAccount, MicrosoftCalendarAccount } from "../types/calendar";import { normalizeEmailDraftTarget, type EmailDraftTargetSetting } from "../utils/emailDraftTarget";+import { normalizeToneStyles, type ToneStyles } from "../config/toneStyle";import { PROMPT_KIND_LIST, type PromptKind } from "../config/prompts/registry";import { sweepRetiredPromptOverrides } from "../config/retiredPrompts";import {@@ -279,6 +280,7 @@ const BOOLEAN_SETTINGS = new Set(["assemblyAiStreaming","autoGenerateNoteTitle","useCleanupModel",+ "toneStyleEnabled","useDictationAgent","keepLocalModelLoaded","voiceAgentScreenContext",@@ -1014,6 +1016,8 @@ export interface SettingsState// dedicated model used only when a screenshot is attached.voiceAgentScreenContext: boolean;emailDraftTarget: EmailDraftTargetSetting;+ toneStyleEnabled: boolean;+ toneStyles: ToneStyles;useDictationAgentVisionModel: boolean;dictationAgentVisionMode: InferenceMode;dictationAgentVisionProvider: string;@@ -1045,6 +1049,8 @@ export interface SettingsStatesetDictationAgentCustomApiKey: (key: string) => void;setVoiceAgentScreenContext: (value: boolean) => void;+ setToneStyleEnabled: (value: boolean) => void;+ setToneStyles: (styles: ToneStyles) => void;setEmailDraftTarget: (value: EmailDraftTargetSetting) => void;setUseDictationAgentVisionModel: (value: boolean) => void;setDictationAgentVisionProvider: (value: string) => void;@@ -1965,6 +1971,8 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({voiceAgentScreenContext: readBoolean("voiceAgentScreenContext", false),emailDraftTarget: normalizeEmailDraftTarget(readString("emailDraftTarget", "auto")),+ toneStyleEnabled: readBoolean("toneStyleEnabled", false),+ toneStyles: normalizeToneStyles(readString("toneStyles", "")),useDictationAgentVisionModel: readBoolean("useDictationAgentVisionModel", false),// Cloud already vision-routes screenshot commands, so the override is BYOK-only.dictationAgentVisionMode: "providers" as InferenceMode,@@ -2010,6 +2018,11 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({setVoiceAgentScreenContext: createBooleanSetter("voiceAgentScreenContext"),setEmailDraftTarget: createStringSetter("emailDraftTarget"),+ setToneStyleEnabled: createBooleanSetter("toneStyleEnabled"),+ setToneStyles: (styles) => {+ if (isBrowser) localStorage.setItem("toneStyles", JSON.stringify(styles));+ useSettingsStore.setState({ toneStyles: styles });+ },setUseDictationAgentVisionModel: createBooleanSetter("useDictationAgentVisionModel"),setDictationAgentVisionProvider: createStringSetter("dictationAgentVisionProvider"),setDictationAgentVisionModel: createStringSetter("dictationAgentVisionModel"),@@ -3821,6 +3834,8 @@ export async function initializeSettings(): Promise<void> {}} else if (key === "emailDraftTarget") {value = normalizeEmailDraftTarget(newValue);+ } else if (key === "toneStyles") {+ value = normalizeToneStyles(newValue);} else {value = newValue;}diff --git a/src/types/electron.ts b/src/types/electron.tsindex 44d7d480d..e57eaedc9 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -3,6 +3,7 @@ import type { ReasoningConfig } from "../services/BaseReasoningService";import type { PermissionGuideState, PermissionGuideAction } from "./permissionGuide";import type { TinfoilCatalogModel } from "../models/tinfoilModels";import type { UsageResponse } from "../lib/usageStore";+import type { DictationTone, ToneAppCategory } from "../config/toneStyle";import type { OrgPolicy } from "./policy";import type { TechnicalErrorDetailsData } from "../components/ui/useToast";import type { ProviderSettingsTarget } from "../utils/describeProviderError";@@ -101,6 +102,8 @@ export interface DictationRealtimeSessionOptions {agentName?: string;customDictionary?: string[];customPrompt?: string;+ tone?: DictationTone;+ appCategory?: ToneAppCategory;language?: string;locale?: string;};@@ -1441,6 +1444,7 @@ declare global {showDictationPanel: () => Promise<void>;openSettingsSection?: (section: ProviderSettingsTarget) => Promise<{ success: boolean }>;captureDictationTarget?: () => Promise<{ success: boolean; pid: number | null }>;+ captureDictationAppCategory?: () => Promise<ToneAppCategory>;onToggleDictation: (callback: () => void) => () => void;onToggleVoiceAgent?: (callback: () => void) => () => void;onToggleTranslation?: (callback: () => void) => () => void;@@ -2667,6 +2671,8 @@ declare global {promptMode?: "cleanup" | "agent";purpose?: CloudReasonPurpose;screenContext?: ScreenContextImage;+ tone?: DictationTone;+ appCategory?: ToneAppCategory;language?: string;locale?: string;streamingFallbackReason?: string;diff --git a/test/components/toneStyleSection.test.js b/test/components/toneStyleSection.test.jsnew file mode 100644index 000000000..da5d8a30b--- /dev/null+++ b/test/components/toneStyleSection.test.js@@ -0,0 +1,171 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const React = require("react");+const { createRoot } = require("react-dom/client");+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");+const { installInteractiveDom, findElement } = require("../lib/interactiveDom");++const MOCKS = {+ "react-i18next": `+ const t = (key) => key;+ export const useTranslation = () => ({ t, i18n: { language: "en" } });+ export const initReactI18next = { type: "3rdParty", init() {} };+ `,+ "/ui/useToast": `+ export const useToast = () => ({ toast() {} });+ `,+};++const click = (element) =>+ element.dispatchEvent({+ type: "click",+ bubbles: true,+ button: 0,+ defaultPrevented: false,+ cancelBubble: false,+ preventDefault() {+ this.defaultPrevented = true;+ },+ stopPropagation() {+ this.cancelBubble = true;+ },+ });++// No i18next instance is initialized, so labels render as their keys.+function button(root, label) {+ const found = findElement(+ root,+ (element) => element.tagName === "BUTTON" && element.textContent === label+ );+ assert.ok(found, `button ${label} is rendered`);+ return found;+}++const isDisabled = (element) => element.getAttribute("disabled") !== null;++async function renderSection(t, settings, props = {}) {+ let root = null;+ t.after(async () => {+ if (root) await React.act(async () => root.unmount());+ });+ installBrowserGlobals(t, { window: { electronAPI: {} } });+ const container = installInteractiveDom(t);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-tone-style-section-test-",+ noExternal: ["react-i18next"],+ mockModules: MOCKS,+ });+ const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");+ useSettingsStore.setState(settings);+ const { default: ToneStyleSection } = await vite.ssrLoadModule(+ "/components/settings/ToneStyleSection.tsx"+ );+ root = createRoot(container);+ await React.act(async () =>+ root.render(React.createElement(ToneStyleSection, { onOpenCleanupSettings() {}, ...props }))+ );+ return { container, store: useSettingsStore };+}++const DEFAULTS = { personal: "casual", work: "formal", email: "formal", other: "formal" };++const hasText = (root, text) => !!findElement(root, (element) => element.textContent === text);+const enabledToggle = (root) =>+ findElement(root, (element) => element.getAttribute?.("role") === "switch");+// Off, the picks stay on screen but can't be changed.+const picksEnabled = (root) =>+ !isDisabled(+ button(+ findElement(root, (e) => e.getAttribute?.("role") === "group"),+ "toneStyle.tones.formal"+ )+ );++test("Tones & voices stays off until it is turned on, which applies the saved picks", async (t) => {+ const { container, store } = await renderSection(t, {+ useCleanupModel: true,+ toneStyleEnabled: false,+ toneStyles: DEFAULTS,+ });+ assert.equal(enabledToggle(container).getAttribute("aria-checked"), "false");+ assert.equal(picksEnabled(container), false);+ assert.equal(isDisabled(button(container, "toneStyle.settings.saveChanges")), true);++ await React.act(async () => click(enabledToggle(container)));+ assert.equal(store.getState().toneStyleEnabled, true);+ assert.deepEqual(store.getState().toneStyles, DEFAULTS);+ // Home stops offering it, even after a switch back.+ assert.equal(localStorage.getItem("toneStyleBannerDismissed"), "true");+ assert.equal(enabledToggle(container).getAttribute("aria-checked"), "true");+ assert.equal(picksEnabled(container), true);+ assert.equal(isDisabled(button(container, "toneStyle.settings.saveChanges")), true);++ await React.act(async () => click(enabledToggle(container)));+ assert.equal(store.getState().toneStyleEnabled, false);+ assert.equal(picksEnabled(container), false);+});++test("once set up, Save waits for a changed pick and saves it", async (t) => {+ const { container, store } = await renderSection(t, {+ useCleanupModel: true,+ toneStyleEnabled: true,+ toneStyles: DEFAULTS,+ });+ const save = button(container, "toneStyle.settings.saveChanges");+ assert.equal(isDisabled(save), true);++ const work = findElement(+ container,+ (element) => element.getAttribute?.("aria-label") === "toneStyle.categories.work.title"+ );+ await React.act(async () => click(button(work, "toneStyle.tones.casual")));+ assert.equal(isDisabled(save), false);++ await React.act(async () => click(save));+ assert.equal(store.getState().toneStyles.work, "casual");+ assert.equal(store.getState().toneStyleEnabled, true);+});++test("with cleanup off, the section says so and turns it on", async (t) => {+ let opened = 0;+ const { container, store } = await renderSection(+ t,+ {+ useCleanupModel: false,+ toneStyleEnabled: true,+ toneStyles: DEFAULTS,+ isSignedIn: true,+ cleanupMode: "openwhispr",+ cleanupCloudMode: "openwhispr",+ },+ { onOpenCleanupSettings: () => opened++ }+ );+ assert.ok(hasText(container, "toneStyle.settings.cleanupOff"));++ await React.act(async () => click(button(container, "toneStyle.settings.turnOnCleanup")));+ assert.equal(store.getState().useCleanupModel, true);+ assert.equal(hasText(container, "toneStyle.settings.cleanupOff"), false);+ // Cloud cleanup needs no model, so the user stays here.+ assert.equal(opened, 0);+});++test("turning cleanup on without a usable model opens its settings", async (t) => {+ let opened = 0;+ const { container, store } = await renderSection(+ t,+ {+ useCleanupModel: false,+ toneStyleEnabled: true,+ toneStyles: DEFAULTS,+ isSignedIn: false,+ cleanupMode: "providers",+ cleanupProvider: "openai",+ cleanupModel: "",+ },+ { onOpenCleanupSettings: () => opened++ }+ );++ await React.act(async () => click(button(container, "toneStyle.settings.turnOnCleanup")));+ assert.equal(store.getState().useCleanupModel, true);+ assert.equal(opened, 1);+});diff --git a/test/helpers/audioManagerPipelineOptions.test.js b/test/helpers/audioManagerPipelineOptions.test.jsindex d97bc92f9..9c39b6b92 100644--- a/test/helpers/audioManagerPipelineOptions.test.js+++ b/test/helpers/audioManagerPipelineOptions.test.js@@ -2,10 +2,25 @@ const test = require("node:test");const assert = require("node:assert/strict");const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");-test("combined cleanup options honor every eligibility guard and use the actual prompt/dictionary", async (t) => {+const good = {+ useLocalWhisper: false,+ cloudTranscriptionMode: "openwhispr",+ isSignedIn: true,+ useCleanupModel: true,+ cleanupMode: "openwhispr",+ cleanupCloudMode: "openwhispr",+ customPrompts: { cleanup: "Keep product names exactly." },+ customDictionary: ["Orukeet"],+ uiLanguage: "en",+ preferredLanguage: "en",+ toneStyleEnabled: false,+ toneStyles: { personal: "very_casual", work: "casual", email: "excited", other: "formal" },+};++async function load(t, cachePrefix) {const { window } = installBrowserGlobals(t, { window: { dispatchEvent() {} } });const vite = await createRendererServer(t, {- cachePrefix: "orukeet-pipeline-guards-",+ cachePrefix,mockModules: {"/utils/logger":"export default { debug() {}, info() {}, warn() {}, error() {}, logReasoning() {} };",@@ -16,23 +31,22 @@ test("combined cleanup options honor every eligibility guard and use the actualt.after(() => service.destroy());const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");const { usePolicyStore } = await vite.ssrLoadModule("/stores/policyStore.ts");- const good = {- useLocalWhisper: false,- cloudTranscriptionMode: "openwhispr",- isSignedIn: true,- useCleanupModel: true,- cleanupMode: "openwhispr",- cleanupCloudMode: "openwhispr",- customPrompts: { cleanup: "Keep product names exactly." },- customDictionary: ["Orukeet"],- uiLanguage: "en",- preferredLanguage: "en",- };- const manager = Object.assign(Object.create(AudioManager.prototype), {- sttConfig: { orukeetPipeline: "gemma12" },- getCleanupLanguage: () => "en",- });usePolicyStore.setState({ status: "unmanaged", policy: null });+ const createManager = (fields) =>+ Object.assign(Object.create(AudioManager.prototype), {+ sttConfig: { orukeetPipeline: "gemma12" },+ getCleanupLanguage: () => "en",+ ...fields,+ });+ return { window, useSettingsStore, usePolicyStore, createManager };+}++test("combined cleanup options honor every eligibility guard and use the actual prompt/dictionary", async (t) => {+ const { window, useSettingsStore, usePolicyStore, createManager } = await load(+ t,+ "orukeet-pipeline-guards-"+ );+ const manager = createManager();useSettingsStore.setState(good);assert.deepEqual(manager.getPipelineCleanupOptions(useSettingsStore.getState()), {agentName: "OpenWhispr",@@ -41,6 +55,20 @@ test("combined cleanup options honor every eligibility guard and use the actuallanguage: "en",locale: "en",});+ // Tone & Style: the tone picked for the app being dictated into.+ useSettingsStore.setState({ ...good, toneStyleEnabled: true });+ assert.deepEqual(+ manager.getPipelineCleanupOptions(useSettingsStore.getState(), { appCategory: "email" }),+ {+ agentName: "OpenWhispr",+ customDictionary: ["Orukeet"],+ customPrompt: good.customPrompts.cleanup,+ tone: "excited",+ appCategory: "email",+ language: "en",+ locale: "en",+ }+ );const blocked = [{ settings: { useLocalWhisper: true } },{ settings: { cloudTranscriptionMode: "byok" } },@@ -116,3 +144,134 @@ test("combined cleanup options honor every eligibility guard and use the actual);assert.ok(calls[0].pipelineOptions);});++// An Orukeet streaming start with Tone & Style on, its app classified only+// when the test calls classify().+async function loadTonedOrukeetStart(t, cachePrefix) {+ const { window, useSettingsStore, createManager } = await load(t, cachePrefix);+ useSettingsStore.setState({ ...good, toneStyleEnabled: true });+ const classifier = {};+ window.electronAPI.captureDictationAppCategory = () =>+ new Promise((resolve) => (classifier.classify = resolve));+ const workletPort = {};+ globalThis.AudioWorkletNode = class {+ constructor() {+ this.port = workletPort;+ }+ };+ t.after(() => delete globalThis.AudioWorkletNode);+ const audioNode = { connect() {} };+ const minted = [];+ const sent = [];+ const manager = createManager({+ _streamingCancellationGeneration: 0,+ _streamingStartSettlementWaiters: [],+ workletModuleLoaded: true,+ preparedMicCapture: { take: async () => null },+ isRecordingAllowedByPolicy: () => true,+ _beginActivationCapture: async () => true,+ getAudioConstraints: async () => ({}),+ _acquireCaptureStream: async () => ({ getAudioTracks: () => [] }),+ _startRecordingSpool: () => null,+ startStreamingFallbackRecorder() {},+ getOrCreateAudioContext: async () => ({+ createMediaStreamSource: () => audioNode,+ createAnalyser: () => audioNode,+ }),+ getStreamingProviderName: () => "orukeet",+ getStreamingProvider: () => ({+ onPartial: () => () => {},+ onFinal: () => () => {},+ onError: () => () => {},+ onSessionEnd: () => () => {},+ send: (frame) => sent.push(frame),+ start: async (options) => {+ minted.push(options.pipelineOptions);+ return { success: true };+ },+ }),+ beginMicRecovery: async () => {},+ getEffectiveSttLanguage: () => "en",+ getKeyterms: () => [],+ onStateChange() {},+ });+ return { window, manager, minted, sent, workletPort, classify: (app) => classifier.classify(app) };+}++const tick = (ms) => new Promise((resolve) => setTimeout(resolve, ms));++test("with Tone & Style on, a streaming start holds audio while it waits to mint combined cleanup for the app it learns in time, and the next warmup expects the same", async (t) => {+ const { window, manager, minted, sent, workletPort, classify } = await loadTonedOrukeetStart(+ t,+ "orukeet-pipeline-tone-"+ );++ manager.beginToneStyleCapture();+ const starting = manager.startStreamingRecording();+ await tick(20);+ assert.equal(minted.length, 0);+ // Audio from the wait reaches the session only once it has started: with no+ // warm socket, main has nowhere to buffer it before then.+ const frame = new Int16Array(160).buffer;+ workletPort.onmessage({ data: frame });+ assert.equal(sent.length, 0);+ classify("email");+ assert.equal(await starting, true);+ assert.deepEqual(sent, [frame]);+ assert.equal(minted[0].tone, "excited");+ assert.equal(minted[0].appCategory, "email");+ // A fallback cleanup at stop gets the same tone.+ assert.deepEqual(await manager.consumeToneStyle(), { appCategory: "email", tone: "excited" });++ const warmed = [];+ window.electronAPI.dictationRealtimeWarmup = async (options) => {+ warmed.push(options.pipelineOptions);+ return { success: true };+ };+ Object.assign(manager, {+ shouldUseStreaming: () => true,+ cacheMicrophoneDeviceId: async () => {},+ });+ await manager.warmupStreamingConnection({ warmMic: false });+ assert.deepEqual(warmed, minted);++ // An app still unknown after the start's short wait (a Wayland AT-SPI target+ // takes about a second) gets no combined cleanup, and neither does the next+ // warmup.+ Object.assign(manager, { isRecording: false, isStreaming: false });+ manager.beginToneStyleCapture();+ assert.equal(await manager.startStreamingRecording(), true);+ assert.equal(minted.length, 2);+ assert.equal(minted[1], undefined);+ await manager.warmupStreamingConnection({ warmMic: false });+ assert.equal(warmed.length, 2);+ assert.equal(warmed[1], undefined);+});++test("the start's wait for the app counts from the capture, so it overlaps the mic opening", async (t) => {+ const { manager, minted } = await loadTonedOrukeetStart(t, "orukeet-pipeline-tone-deadline-");+ manager.beginToneStyleCapture();+ // The mic took the whole 250 ms to open: the start mints at once.+ await tick(260);+ const starting = manager.startStreamingRecording();+ await tick(20);+ assert.equal(minted.length, 1);+ assert.equal(minted[0], undefined);+ assert.equal(await starting, true);+});++test("a start cancelled while it waits for the app mints no session", async (t) => {+ const { manager, minted, classify } = await loadTonedOrukeetStart(+ t,+ "orukeet-pipeline-tone-cancel-"+ );+ manager.beginToneStyleCapture();+ const starting = manager.startStreamingRecording();+ await tick(20);+ manager._streamingCancellationGeneration += 1;+ classify("email");+ assert.equal(await starting, false);+ assert.equal(minted.length, 0);+ // cancelStreamingRecording waits on this settlement.+ assert.equal(manager.streamingStartInProgress, false);+});diff --git a/test/helpers/audioManagerToneStyle.test.js b/test/helpers/audioManagerToneStyle.test.jsnew file mode 100644index 000000000..3f3c92405--- /dev/null+++ b/test/helpers/audioManagerToneStyle.test.js@@ -0,0 +1,156 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");++const RAW = "hey are you around this evening thinking coffee around six";++// Tone & Style classifies the dictation's app at recording start and the+// cleanup request carries the tone picked for that kind of app.+test("dictation cleanup carries the tone for the app it was captured in", async (t) => {+ const { window } = installBrowserGlobals(t, { window: { dispatchEvent() {} } });+ Object.defineProperty(navigator, "onLine", { configurable: true, value: true });+ t.after(() => delete navigator.onLine);+ const vite = await createRendererServer(t, {+ cachePrefix: "openwhispr-audio-tone-style-",+ mockModules: {+ "/utils/logger":+ "export default { debug() {}, info() {}, warn() {}, error() {}, logReasoning() {} };",+ },+ });+ const AudioManager = (await vite.ssrLoadModule("/helpers/audioManager.js")).default;+ const service = (await vite.ssrLoadModule("/services/ReasoningService.ts")).default;+ t.after(() => service.destroy());+ const { useSettingsStore } = await vite.ssrLoadModule("/stores/settingsStore.ts");+ const { usePolicyStore } = await vite.ssrLoadModule("/stores/policyStore.ts");+ usePolicyStore.setState({ status: "unmanaged", policy: null });+ useSettingsStore.setState({+ isSignedIn: true,+ useCleanupModel: true,+ cleanupMode: "openwhispr",+ cleanupCloudMode: "openwhispr",+ useDictationAgent: false,+ customPrompts: { cleanup: "" },+ preferredLanguage: "en",+ dataRetentionEnabled: true,+ toneStyleEnabled: true,+ toneStyles: { personal: "very_casual", work: "casual", email: "excited", other: "formal" },+ });+ window.electronAPI.cloudTranscribe = async () => ({ success: true, text: RAW });+ let capturedCategory;+ window.electronAPI.captureDictationAppCategory = async () => capturedCategory;+ const reasonRequests = [];+ window.electronAPI.cloudReason = async (_text, options) => {+ reasonRequests.push(options);+ return { success: true, text: "hey u around this evening? thinking coffee around 6 lmk" };+ };+ const createManager = () =>+ Object.assign(Object.create(AudioManager.prototype), {+ voiceAgentRequested: false,+ translationRequested: false,+ pendingCleanupFailure: null,+ getEffectiveSttLanguage: () => "en",+ getWhisperPrompt: () => null,+ isDictionaryEcho: () => false,+ isReasoningAvailable: async () => true,+ finalizeChineseScript: async (text) => text,+ });+ const lastRequest = () => reasonRequests[reasonRequests.length - 1];++ await t.test("Cloud batch cleanup sends the captured app's tone", async () => {+ capturedCategory = "personal";+ const manager = createManager();+ manager.beginToneStyleCapture();+ await manager.processWithOpenWhisprCloud(new Blob(["synthetic audio"]));+ assert.equal(lastRequest().tone, "very_casual");+ assert.equal(lastRequest().appCategory, "personal");+ });++ await t.test("streaming Cloud cleanup sends the captured app's tone", async () => {+ capturedCategory = "email";+ window.electronAPI.cloudStreamingUsage = async () => ({ success: true });+ const manager = Object.assign(createManager(), {+ streamingFinalText: RAW,+ streamingCleanupFns: [],+ micRecovery: { stop() {} },+ finishStreamingFallbackSegment: async () => {},+ mergeRecordedSegments: async () => null,+ awaitStreamingTextSettled: async () => {},+ getStreamingProvider: () => ({+ awaitsFinalTranscript: true,+ stop: async () => ({ success: true }),+ }),+ getStreamingProviderName: () => "openwhispr",+ shouldUseStreaming: () => false,+ onTranscriptionComplete: () => {},+ });+ manager.beginToneStyleCapture();+ await manager._finalizeStreamingRecording(null);+ assert.equal(lastRequest().tone, "excited");+ assert.equal(lastRequest().appCategory, "email");+ });++ await t.test("an app the classifier can't place gets the other-apps tone", async () => {+ capturedCategory = null;+ const manager = createManager();+ manager.beginToneStyleCapture();+ await manager.processWithOpenWhisprCloud(new Blob(["synthetic audio"]));+ assert.equal(lastRequest().tone, "formal");+ assert.equal(lastRequest().appCategory, "other");+ });++ await t.test("no tone without a capture, or once Tone & Style is off", async () => {+ capturedCategory = "email";+ await createManager().processWithOpenWhisprCloud(new Blob(["synthetic audio"]));+ assert.equal("tone" in lastRequest(), false);++ const manager = createManager();+ manager.beginToneStyleCapture();+ useSettingsStore.setState({ toneStyleEnabled: false });+ await manager.processWithOpenWhisprCloud(new Blob(["synthetic audio"]));+ useSettingsStore.setState({ toneStyleEnabled: true });+ assert.equal("tone" in lastRequest(), false);+ });++ await t.test("an app classified after 1.5 s of speech still gets its tone", async (st) => {+ st.mock.timers.enable({ apis: ["setTimeout"] });+ let classify;+ capturedCategory = new Promise((resolve) => (classify = resolve));+ const manager = createManager();+ manager.beginToneStyleCapture();+ st.mock.timers.tick(1600);+ classify("email");+ assert.deepEqual(await manager.consumeToneStyle(), { appCategory: "email", tone: "excited" });+ });++ await t.test("a cancelled upload that still resolves leaves the next dictation's tone alone", async () => {+ capturedCategory = "work";+ const manager = createManager();+ // The next dictation started while the cancelled one's upload was in flight.+ manager.beginToneStyleCapture();+ await manager.processWithOpenWhisprCloud(new Blob(["synthetic audio"]), {}, () => true);+ assert.equal("tone" in lastRequest(), false);+ assert.deepEqual(await manager.consumeToneStyle(), { appCategory: "work", tone: "casual" });+ });++ await t.test("a new recording drops the previous recording's capture", async () => {+ capturedCategory = "work";+ const manager = createManager();+ manager.beginToneStyleCapture();+ manager.setVoiceAgentRequested(false);+ assert.equal(await manager.consumeToneStyle(), null);+ });++ await t.test("local and BYOK cleanup get the tone through the reasoning config", async () => {+ capturedCategory = "email";+ const configs = [];+ const manager = createManager();+ manager.processWithReasoningModel = async (_text, _model, _agentName, config) => {+ configs.push(config);+ return "Thanks so much for today!";+ };+ manager.beginToneStyleCapture();+ await manager.processTranscription(RAW, "local");+ assert.deepEqual(configs[0].toneStyle, { appCategory: "email", tone: "excited" });+ assert.equal(configs[0].inferenceScope, "dictationCleanup");+ });+});diff --git a/test/helpers/selectionManager.test.js b/test/helpers/selectionManager.test.jsindex 1d0cf0320..beb8b9496 100644--- a/test/helpers/selectionManager.test.js+++ b/test/helpers/selectionManager.test.js@@ -860,6 +860,131 @@ test("getWinTarget returns the hex HWND a win32 probe captured (#859)", async ()assert.equal((await manager.getWinTarget())?.id, "00001A2B");});+test("the app context of a win32 target carries its exe, class and window title", async () => {+ const SpawningSelectionManager = loadSelectionManager({+ spawn: () => {+ const probe = new EventEmitter();+ probe.stdout = new EventEmitter();+ probe.stderr = new EventEmitter();+ process.nextTick(() => {+ probe.stdout.emit(+ "data",+ "TARGET 00001A2B\nWINDOW_CLASS Chrome_WidgetWin_1\nEXE_NAME chrome.exe\n" ++ "WINDOW_TITLE Inbox - Gmail - Google Chrome\nIS_TERMINAL false\n"+ );+ probe.emit("close", 0);+ });+ return probe;+ },+ });+ const manager = new SpawningSelectionManager({+ clipboardManager: { resolveWindowsFastPasteBinary: () => "/tmp/windows-fast-paste.exe" },+ textEditMonitor: {},+ platform: "win32",+ now: () => 1000,+ });++ const capture = manager.captureTarget();+ const context = manager.getTargetAppContext();+ await capture;++ assert.deepEqual(await context, {+ appSignature: "chrome.exe Chrome_WidgetWin_1",+ windowTitle: "Inbox - Gmail - Google Chrome",+ });+ // The title stays in the main process: the target itself never carries it.+ assert.equal(JSON.stringify(manager.lastTarget).includes("Inbox"), false);+});++test("the app context of a macOS target names the app from its pid", async () => {+ const manager = new SelectionManager({+ clipboardManager: {},+ textEditMonitor: {+ lastTargetPid: 42,+ getAppContext: async (pid) =>+ pid === 42+ ? { appName: "Google Chrome", bundleId: "com.google.Chrome", urlHost: "mail.google.com" }+ : null,+ },+ platform: "darwin",+ now: () => 1000,+ });++ assert.deepEqual(await manager.getTargetAppContext(), {+ appSignature: "Google Chrome com.google.Chrome",+ windowTitle: undefined,+ urlHost: "mail.google.com",+ });+});++test("an X11 target's window title is read only when the app context is asked for", async () => {+ const calls = [];+ const ExecSelectionManager = loadSelectionManager({+ execFile: (command, args, _options, callback) => {+ calls.push([command, ...args]);+ callback(null, "Inbox - Gmail - Mozilla Firefox\n", "");+ },+ });+ const manager = new ExecSelectionManager({+ clipboardManager: {},+ textEditMonitor: {},+ platform: "linux",+ now: () => 1000,+ });+ manager.lastTarget = { kind: "x11-window", id: "7", windowClass: "firefox" };++ assert.deepEqual(await manager.getTargetAppContext(), {+ appSignature: "firefox",+ windowTitle: "Inbox - Gmail - Mozilla Firefox",+ });+ assert.deepEqual(calls, [["xdotool", "getwindowname", "7"]]);+});++test("an AT-SPI target is named from its pid and titled from its window", async () => {+ let stdout = "";+ const SpawningSelectionManager = loadSelectionManager({+ spawn: () => {+ const child = new EventEmitter();+ child.stdout = new EventEmitter();+ child.stderr = new EventEmitter();+ child.kill = () => {};+ process.nextTick(() => {+ child.stdout.emit("data", stdout);+ child.emit("close", 0);+ });+ return child;+ },+ });+ const manager = new SpawningSelectionManager({+ clipboardManager: { resolveLinuxFastPasteBinary: () => "/tmp/linux-fast-paste" },+ textEditMonitor: {},+ platform: "linux",+ now: () => 1000,+ });+ manager._readTargetNames = async (pid) => (pid === "42" ? "chrome" : "");+ const title = "Inbox - Gmail - Google Chrome";++ stdout = `TARGET ATSPI 42\nWINDOW_TITLE_B64 ${Buffer.from(title).toString("base64")}\n`;+ manager.lastTarget = await manager._getLinuxAtspiTarget();+ assert.deepEqual(manager.lastTarget, { kind: "atspi-pid", id: "42" });+ assert.deepEqual(await manager.getTargetAppContext(), {+ appSignature: "chrome",+ windowTitle: title,+ });++ // An older helper prints no title.+ stdout = "TARGET ATSPI 42\n";+ manager.lastTarget = await manager._getLinuxAtspiTarget();+ assert.deepEqual(await manager.getTargetAppContext(), {+ appSignature: "chrome",+ windowTitle: null,+ });+ assert.equal(+ await new SelectionManager({ platform: "linux", textEditMonitor: {} }).getTargetAppContext(),+ null+ );+});+// captureTarget() nulls lastTarget while its probe runs; a paste racing the// stop-press probe must wait for the answer instead of restoring nothing.test("getWinTarget waits for an in-flight probe before answering", async () => {diff --git a/test/helpers/textEditMonitorAppContext.test.js b/test/helpers/textEditMonitorAppContext.test.jsnew file mode 100644index 000000000..a4bef930a--- /dev/null+++ b/test/helpers/textEditMonitorAppContext.test.js@@ -0,0 +1,54 @@+const test = require("node:test");+const assert = require("node:assert/strict");++const TextEditMonitor = require("../../src/helpers/textEditMonitor");++const darwinOnly = { skip: process.platform !== "darwin" };++// Stands in for the native helper: a Node process that prints the given output.+function monitorPrinting(output, exitCode = 0) {+ const monitor = new TextEditMonitor();+ monitor.resolveBinary = () => ({+ command: process.execPath,+ // "--" keeps the helper's own flags ("--app-context <pid>") away from Node.+ args: [+ "-e",+ `process.stdout.write(${JSON.stringify(output)}); process.exit(${exitCode});`,+ "--",+ ],+ });+ return monitor;+}++test(+ "--app-context output becomes the app's name, bundle id, title and host",+ darwinOnly,+ async () => {+ const title = "Re: launch plan\nInbox - Gmail";+ const monitor = monitorPrinting(+ [+ "APP_NAME:Google Chrome",+ "BUNDLE_ID:com.google.Chrome",+ `WINDOW_TITLE_B64:${Buffer.from(title).toString("base64")}`,+ "URL_HOST:mail.google.com",+ "UNRELATED:ignored",+ "",+ ].join("\n")+ );++ assert.deepEqual(await monitor.getAppContext(4242), {+ appName: "Google Chrome",+ bundleId: "com.google.Chrome",+ windowTitle: title,+ urlHost: "mail.google.com",+ });+ }+);++test("a failed --app-context run keeps what it printed before failing", darwinOnly, async () => {+ assert.deepEqual(await monitorPrinting("APP_NAME:Slack\n", 1).getAppContext(4242), {+ appName: "Slack",+ });+ assert.equal(await monitorPrinting("NO_ELEMENT\n", 1).getAppContext(4242), null);+ assert.equal(await new TextEditMonitor().getAppContext(null), null);+});diff --git a/test/helpers/toneAppCategories.test.js b/test/helpers/toneAppCategories.test.jsnew file mode 100644index 000000000..3ae7e4701--- /dev/null+++ b/test/helpers/toneAppCategories.test.js@@ -0,0 +1,180 @@+const test = require("node:test");+const assert = require("node:assert/strict");++const { classifyToneAppCategory } = require("../../src/helpers/toneAppCategories");++const categoryOf = (appSignature, extra = {}) =>+ classifyToneAppCategory({ appSignature, ...extra });++// Each signature is the shape one platform hands the classifier: macOS+// "<app name> <bundle id>", Windows "<exe> <window class>", Linux "<WM_CLASS>".+test("desktop apps map to their category on every platform", () => {+ const expectations = {+ personal: [+ "WhatsApp net.whatsapp.WhatsApp",+ "Telegram ru.keepcoder.Telegram",+ "Messages com.apple.MobileSMS",+ "Signal org.whispersystems.signal-desktop",+ "Discord com.hnc.Discord",+ "LINE jp.naver.line.mac",+ // macOS names translate; the bundle id still names the app.+ "微信 com.tencent.xinWeChat",+ "카카오톡 com.kakao.KakaoTalkMac",+ "WhatsApp.exe ApplicationFrameWindow",+ "Telegram.exe Qt51517QWindowIcon",+ "LINE.exe",+ "PhoneExperienceHost.exe",+ "org.telegram.desktop",+ "signal",+ ],+ work: [+ "Slack com.tinyspeck.slackmacgap",+ "Microsoft Teams com.microsoft.teams2",+ "zoom.us us.zoom.xos",+ "slack.exe Chrome_WidgetWin_1",+ "ms-teams.exe TeamsWebView",+ "Zoom.exe ZPContentViewWndClass",+ "teams-for-linux",+ "mattermost",+ "钉钉 com.alibaba.DingTalkMac",+ "企业微信 com.tencent.WeWorkMac",+ ],+ email: [+ "Mail com.apple.mail",+ "Microsoft Outlook com.microsoft.Outlook",+ "Superhuman com.superhuman.electron",+ "Spark Desktop com.readdle.SparkDesktop",+ "Mimestream com.mimestream.Mimestream",+ "Canary Mail io.canarymail.mac",+ "Proton Mail ch.protonmail.desktop",+ "OUTLOOK.EXE rctrl_renwnd32",+ "olk.exe",+ "MailClient.exe",+ "thunderbird",+ "org.gnome.Evolution",+ "geary",+ "org.kde.kmail2",+ ],+ };+ for (const [category, signatures] of Object.entries(expectations)) {+ for (const signature of signatures) {+ assert.equal(categoryOf(signature), category, signature);+ }+ }+});++test("unlisted apps and look-alike names are other", () => {+ for (const signature of [+ "Notion notion.id",+ "Visual Studio Code com.microsoft.VSCode",+ "Google Chrome Canary com.google.Chrome.canary", // a browser with no page known+ "Notion.exe Chrome_WidgetWin_1", // the Chromium class alone isn't a browser+ "Mailchimp", // "mail" only as a whole token+ "Slackware Installer",+ "Teamspeak",+ "",+ ]) {+ assert.equal(categoryOf(signature), "other", signature);+ }+ assert.equal(classifyToneAppCategory(null), "other");+});++test("a browser is judged by the page's host", () => {+ const chrome = "Google Chrome com.google.Chrome";+ assert.equal(categoryOf(chrome, { urlHost: "mail.google.com" }), "email");+ assert.equal(categoryOf(chrome, { urlHost: "outlook.office.com" }), "email");+ assert.equal(categoryOf(chrome, { urlHost: "app.slack.com" }), "work");+ assert.equal(categoryOf(chrome, { urlHost: "openwhispr.slack.com" }), "work");+ assert.equal(categoryOf(chrome, { urlHost: "www.linkedin.com" }), "work");+ assert.equal(categoryOf(chrome, { urlHost: "web.whatsapp.com" }), "personal");+ assert.equal(categoryOf(chrome, { urlHost: "x.com" }), "personal");+ assert.equal(categoryOf(chrome, { urlHost: "github.com" }), "other");+ assert.equal(categoryOf(chrome, { urlHost: "notslack.com" }), "other");+});++test("a host that names no app leaves it to a site name the host carries", () => {+ const safari = "Safari com.apple.Safari";+ assert.equal(+ categoryOf(safari, { urlHost: "www.icloud.com", windowTitle: "iCloud Mail" }),+ "email"+ );+ assert.equal(+ categoryOf(safari, { urlHost: "mail.yahoo.co.uk", windowTitle: "Inbox - Yahoo Mail" }),+ "email"+ );+ assert.equal(+ categoryOf(safari, { urlHost: "app.slack-gov.com", windowTitle: "general - Slack" }),+ "work"+ );+ // A page whose own title is a site name doesn't make its host that site.+ assert.equal(categoryOf(safari, { urlHost: "www.notion.so", windowTitle: "Hey" }), "other");+ assert.equal(categoryOf(safari, { urlHost: "www.notion.so", windowTitle: "Outlook" }), "other");+ assert.equal(+ categoryOf(safari, { urlHost: "mail.google.com", windowTitle: "Weekly report - Notion" }),+ "email"+ );+ assert.equal(+ categoryOf(safari, { urlHost: "docs.google.com", windowTitle: "Plan - Google Docs" }),+ "other"+ );+});++test("without a host, a browser is judged by the site name its title ends with", () => {+ const cases = [+ ["Google Chrome com.google.Chrome", "Inbox (3) - [email protected] - Gmail", "email"],+ [+ "Google Chrome com.google.Chrome",+ "Inbox - [email protected] - Gmail - Google Chrome – Saket (work.com)",+ "email",+ ],+ ["chrome.exe Chrome_WidgetWin_1", "Mail - Saket Sharma - Outlook - Google Chrome", "email"],+ [+ "msedge.exe Chrome_WidgetWin_1",+ "Gmail and 4 more pages - Work - Microsoft\u200b Edge",+ "email",+ ],+ ["firefox", "engineering (Channel) - OpenWhispr - Slack — Mozilla Firefox", "work"],+ ["Arc company.thebrowser.Browser", "(5) Feed | LinkedIn", "work"],+ ["Safari com.apple.Safari", "Chat | Saket | Microsoft Teams", "work"],+ ["brave.exe Chrome_WidgetWin_1", "(3) WhatsApp - Brave", "personal"],+ ["Safari com.apple.Safari", "Home / X", "personal"],+ ["msedge.exe Chrome_WidgetWin_1", "Inbox - [email protected] - Gmail - Microsoft Edge", "email"],+ ["microsoft-edge", "Inbox - Gmail - Microsoft Edge", "email"],+ ["librewolf", "Inbox - Gmail \u2014 LibreWolf", "email"],+ ["Google Chrome com.google.Chrome", "Slack pricing - Google Search", "other"],+ [+ "Google Chrome com.google.Chrome",+ "Outlook paste bug · Issue #12 · org/app - Google Chrome",+ "other",+ ],+ // A page whose own title is a bare site name is still that page.+ ["Google Chrome com.google.Chrome", "outlook - Google Search - Google Chrome", "other"],+ ["Google Chrome com.google.Chrome", "Slack - Google Docs - Google Chrome", "other"],+ ["Safari com.apple.Safari", "Pixies - Hey - YouTube", "other"],+ ["firefox", "Zoom - YouTube \u2014 Mozilla Firefox", "other"],+ // A browser's name inside the page title is part of the page, not its suffix.+ ["Google Chrome com.google.Chrome", "gmail - Brave Search - Google Chrome", "other"],+ ["brave.exe Chrome_WidgetWin_1", "slack - Brave Search - Brave", "other"],+ ["Safari com.apple.Safari", "slack - Brave Search", "other"],+ ["Google Chrome com.google.Chrome", "Discord - Opera forums - Google Chrome", "other"],+ ["firefox", "Inbox - Gmail \u2014 Mozilla Firefox Private Browsing", "email"],+ ];+ for (const [appSignature, windowTitle, category] of cases) {+ assert.equal(classifyToneAppCategory({ appSignature, windowTitle }), category, windowTitle);+ }+});++test("a Windows UWP app is named by its frame's title", () => {+ const frame = "ApplicationFrameHost.exe ApplicationFrameWindow";+ assert.equal(categoryOf(frame, { windowTitle: "WhatsApp" }), "personal");+ assert.equal(categoryOf(frame, { windowTitle: "Phone Link" }), "personal");+ assert.equal(categoryOf(frame, { windowTitle: "Calculator" }), "other");+});++test("a native app's title never changes its category", () => {+ assert.equal(+ categoryOf("Visual Studio Code com.microsoft.VSCode", { windowTitle: "notes - Gmail" }),+ "other"+ );+ assert.equal(categoryOf("Slack com.tinyspeck.slackmacgap", { windowTitle: "Gmail" }), "work");+});diff --git a/test/services/toneStyleCleanup.test.js b/test/services/toneStyleCleanup.test.jsnew file mode 100644index 000000000..c6b983ba3--- /dev/null+++ b/test/services/toneStyleCleanup.test.js@@ -0,0 +1,81 @@+const test = require("node:test");+const assert = require("node:assert/strict");+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");++async function loadModules(t) {+ const { window } = installBrowserGlobals(t);+ const vite = await createRendererServer(t, { cachePrefix: "openwhispr-tone-style-test-" });+ return {+ window,+ prompts: await vite.ssrLoadModule("/config/prompts.ts"),+ toneStyle: await vite.ssrLoadModule("/config/toneStyle.ts"),+ openwhispr: (await vite.ssrLoadModule("/services/ai/inferenceProviders/openwhispr.ts"))+ .openwhisprProvider,+ };+}++test("the cleanup prompt ends with the app's medium, the tone and its priority", async (t) => {+ const { prompts } = await loadModules(t);+ const base = prompts.getCleanupSystemPrompt(null, ["OpenWhispr"], "en", "en");++ assert.equal(prompts.getCleanupSystemPrompt(null, ["OpenWhispr"], "en", "en", null), base);++ const email = prompts.getCleanupSystemPrompt(null, ["OpenWhispr"], "en", "en", {+ appCategory: "email",+ tone: "excited",+ });+ assert.ok(email.startsWith(base), "the tone comes after the dictionary suffix");+ const suffix = email.slice(base.length);+ assert.match(suffix, /^\n\nThe text is an email\. /);+ assert.match(suffix, /Apply this tone: upbeat and enthusiastic\./);+ assert.match(suffix, /overrides any instruction to keep the speaker's tone, voice, style/);++ const other = prompts.getCleanupSystemPrompt(null, [], "en", "en", {+ appCategory: "other",+ tone: "formal",+ });+ assert.match(other, /\n\nApply this tone: formal and polished\./);+ assert.doesNotMatch(other, /The text is/);+});++test("Cloud cleanup sends the tone and category only for a toned dictation", async (t) => {+ const { window, openwhispr } = await loadModules(t);+ const requests = [];+ window.electronAPI.cloudReason = async (_text, options) => {+ requests.push(options);+ return { success: true, text: "ok" };+ };+ const ctx = {+ getCustomDictionary: () => [],+ getPreferredLanguage: () => "en",+ getUiLanguage: () => "en",+ };+ const call = (config) =>+ openwhispr.call({ text: "hey", model: "", agentName: null, config, ctx });++ await call({+ inferenceScope: "dictationCleanup",+ toneStyle: { appCategory: "personal", tone: "very_casual" },+ });+ await call({ inferenceScope: "dictationCleanup" });++ assert.equal(requests[0].tone, "very_casual");+ assert.equal(requests[0].appCategory, "personal");+ assert.equal(requests[0].promptMode, "cleanup");+ assert.equal("tone" in requests[1], false);+ assert.equal("appCategory" in requests[1], false);+});++test("stored tones keep only the options each category offers", async (t) => {+ const { toneStyle } = await loadModules(t);+ const { normalizeToneStyles, DEFAULT_TONE_STYLES } = toneStyle;++ assert.deepEqual(normalizeToneStyles(""), DEFAULT_TONE_STYLES);+ assert.deepEqual(normalizeToneStyles("not json"), DEFAULT_TONE_STYLES);+ assert.deepEqual(+ normalizeToneStyles(+ JSON.stringify({ personal: "very_casual", work: "very_casual", email: "excited" })+ ),+ { ...DEFAULT_TONE_STYLES, personal: "very_casual", email: "excited" }+ );+});