Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.
TypeScript agent-skillsai-agentsautomationcopilotcopilot-clicopilot-coworkcopilot-studioelectronmicrosoft-scoutscreen-recording
Merge master into multilingual narration
Giorgio Ughiniaad4e6d67140
diff --cc README.mdindex b867f31,68b42fa..7401b7f--- a/README.md+++ b/README.md@@@ -42,14 -42,12 +42,16 @@@ activity" panel shows exactly what's coit and retained only when the screen changes or a heartbeat is due.- **Clipboard** — copy/paste content that ties steps together.- **Narration** *(optional)* — turn on **Narrate** before capture or toggle the- microphone from the floating recording bar. Each microphone-on interval is- timestamped on the video timeline, saved locally, and can be transcribed- **on-device** in any of Whisper's 99 supported languages (via- transformers.js), preserving the selected language. The first transcription- uses an explicit, one-time ~252 MB model download. The multilingual q8- checkpoint is only about 0.6 MB larger than the previous English-only model- and uses the same `small` architecture, so runtime memory and transcription- speed are expected to remain effectively unchanged.+ microphone from the floating recording bar. Narrate shows the active input and+ remembers a selected microphone, with an explicit **System default** fallback.+ During capture, the bar can switch inputs without interrupting screen recording;+ each microphone-on interval is timestamped on the video timeline, saved locally,- and can be transcribed **on-device** (Whisper via transformers.js). The first- transcription uses an explicit, one-time ~250 MB model download.++ and can be transcribed **on-device** in any of Whisper's 99 supported languages++ (via transformers.js), preserving the selected language. The first transcription++ uses an explicit, one-time ~252 MB model download. The multilingual q8 checkpoint++ is only about 0.6 MB larger than the previous English-only model and uses the same++ `small` architecture, so runtime memory and transcription speed are expected to++ remain effectively unchanged.## Requirementsdiff --cc common/ipc.tsindex 62ac20d,368c041..4542e1d--- a/common/ipc.ts+++ b/common/ipc.ts@@@ -1,6 -1,6 +1,7 @@@import type { Analysis, AnalysisFeedback, AnalysisStep, Confidence } from "./analysis";import type { AutomationPlan, BuiltAutomation } from "./automation";+ import type { MicrophoneDevice } from "./microphone";+import type { NarrationLanguage } from "./narration";import type { BuiltSkill, SkillArchitecture, SkillPlan } from "./skill";import type { RecorderState } from "./types";@@@ -195,8 -192,8 +197,10 @@@ export interface StartResultexport interface StartOptions {/** Capture microphone narration for this session (opt-in, off by default). */narration?: boolean;+ /** Source language to preserve in the transcript. Defaults to English. */+ narrationLanguage?: NarrationLanguage;+ /** Device selected for the initial narration segment; defaults to the OS input. */+ microphoneDeviceId?: string;}export interface StopResult {@@@ -218,12 -215,30 +222,36 @@@ export interface MicrophoneResulterror?: string;}+export interface NarrationLanguageResult {+ ok: boolean;+ language?: NarrationLanguage;+ error?: string;+}++ export type MicrophonePermissionState = "unknown" | "granted" | "denied";++ /** Shared pre-recording microphone preference and current device catalog. */+ export interface MicrophoneSettingsStatus {+ narrationEnabled: boolean;+ permission: MicrophonePermissionState;+ devices: MicrophoneDevice[];+ /** The preferred device, retained even while it is disconnected. */+ preferredDeviceId: string;+ preferredDeviceLabel: string;+ /** The device that will actually be requested for the next microphone segment. */+ selectedDeviceId: string;+ selectedDeviceLabel: string;+ preferredDeviceUnavailable: boolean;+ fallback: string | null;+ error: string | null;+ }++ export interface MicrophoneSettingsResult {+ ok: boolean;+ status: MicrophoneSettingsStatus;+ error?: string;+ }+export interface MarkerResult {ok: boolean;error?: string;@@@ -280,7 -295,10 +308,11 @@@ export const IPC =stop: "recorder:stop",discard: "recorder:discard",microphone: "recorder:microphone",+ narrationLanguage: "recorder:narration-language",+ microphoneSettings: "microphone:settings",+ microphoneNarration: "microphone:narration",+ microphoneDevice: "microphone:device",+ microphoneSettingsChanged: "microphone:settings-changed",status: "recorder:status",marker: "recorder:marker",doctor: "doctor:check",@@@ -320,7 -338,12 +352,13 @@@ export interface SkillRecorderApistop(): Promise<StopResult>;discard(): Promise<DiscardResult>;setMicrophoneEnabled(enabled: boolean): Promise<MicrophoneResult>;+ setNarrationLanguage(language: NarrationLanguage): Promise<NarrationLanguageResult>;+ microphoneSettings(): Promise<MicrophoneSettingsStatus>;+ setNarrationEnabled(enabled: boolean): Promise<MicrophoneSettingsResult>;+ selectMicrophone(deviceId: string): Promise<MicrophoneSettingsResult>;+ onMicrophoneSettingsChanged(+ cb: (status: MicrophoneSettingsStatus) => void,+ ): () => void;status(): Promise<RecorderStatus>;marker(note: string): Promise<MarkerResult>;doctor(): Promise<DoctorReport>;diff --cc docs/windows-capture.mdindex bf3c028,490173a..f1e6b43--- a/docs/windows-capture.md+++ b/docs/windows-capture.md@@@ -59,25 -59,24 +59,27 @@@ Run a real recording on Windows and verpreview and hash.5. **Video.** Confirm `video.webm`, `video-frames.json`, snapshots under`video-frames/`, and retained images under `frames/`.- 6. **Voice narration.** Turn on the **Narrate** switch before starting or use the- microphone control in the floating recording bar. Confirm the selector lists- all 99 supported languages alphabetically and defaults to English. Select a- language before recording, then toggle the microphone off and on around two- spoken sentences. After Stop, confirm `audio.json` contains a- version-2 segment manifest with `narrationLanguage` and that the referenced- `audio/segment-*.webm` files exist. Their session/video offsets should- preserve the silent gap while the microphone was off. If the model is not- installed, use **Download & transcribe** in Sessions (or the actionable HUD- readiness row) to approve the one-time ~252 MB Whisper download. Confirm- `narration.json` records the chosen language and contains the- original-language words with `atMs` offsets. Exercise representative- languages, including English and a non-Latin script. Later runs are offline.- On Windows the mic grant is requested by the OS on first use.-6. **Voice narration.** Turn on **Narrate**, grant microphone access, and select a- named input or **System default** before starting. During capture, use the main- microphone button to mute/unmute and its adjacent menu to switch inputs. Speak- before and after a switch, then confirm `audio.json` contains separate version-2- segments whose session/video offsets preserve the boundary. Disconnecting the- active device must stop microphone capture with a visible error rather than- silently recording from another input; reconnecting it should restore the saved- preference when Chromium can identify it. If the model is not installed, use **Download &- transcribe** in Sessions (or the actionable HUD readiness row) to approve the- one-time ~250 MB Whisper download. Confirm `narration.json` then contains your- words with `atMs` offsets. Later runs are offline. On Windows the mic grant is- requested by the OS on first use.++6. **Voice narration.** Turn on **Narrate**, open its settings, and confirm the++ language selector lists all 99 supported languages alphabetically and defaults++ to English. Grant microphone access and select a named input or **System default**.++ During capture, use the main microphone button to mute/unmute and its adjacent++ menu to switch inputs. Speak before and after a switch, then confirm `audio.json`++ contains separate version-2 segments with `narrationLanguage`; their++ session/video offsets should preserve the boundary. Disconnecting the active++ device must stop microphone capture with a visible error rather than silently++ recording from another input; reconnecting it should restore the saved preference++ when Chromium can identify it. If the model is not installed, starting analysis++ approves the one-time ~252 MB Whisper download. Confirm `narration.json` records++ the chosen language and contains the original-language words with `atMs` offsets.++ Exercise representative languages, including English and a non-Latin script.++ Later runs are offline. On Windows the mic grant is requested by the OS on first++ use.7. **Recording controls.** Confirm the floating bar stays above the active app,- can be dragged without making its buttons unclickable, and does not appear in+ its microphone menu and discard confirmation expand above the fixed bar, it can+ be dragged without making its buttons unclickable, and it does not appear incaptured frames where Windows capture protection is supported. Canceling the- discard confirmation must continue the same recording; confirming it must- leave no saved session.+ discard confirmation must continue the same recording; confirming it must leave+ no saved session.8. **Stop.** The recording should show up in the library as `recorded`, andanalysis should produce a coherent intent + ordered steps.diff --cc electron/audio/recorder.tsindex 49114ce,0dc8383..b7a1c2c--- a/electron/audio/recorder.ts+++ b/electron/audio/recorder.ts@@@ -12,9 -13,25 +13,26 @@@ importtype AudioSegment,type LegacyAudioMetadata,} from "../../common/audio";+ import type {+ MicrophonePermissionState,+ MicrophoneSettingsResult,+ MicrophoneSettingsStatus,+ StartOptions,+ } from "../../common/ipc";+ import {+ microphonePreference,+ resolveMicrophonePreference,+ SYSTEM_DEFAULT_MICROPHONE,+ SYSTEM_DEFAULT_MICROPHONE_ID,+ type MicrophoneDevice,+ type MicrophonePreference,+ } from "../../common/microphone";+import type { NarrationLanguage } from "../../common/narration";import { createLogger } from "../logger";- import type { AudioCaptureEnded } from "../recorder/controller";+ import type {+ AudioCaptureEnded,+ SessionAudioRecorder,+ } from "../recorder/controller";const log = createLogger("Narration/audio");const dirname = path.dirname(fileURLToPath(import.meta.url));@@@ -53,111 -89,219 +90,227 @@@ interface PendingProbe*/export class AudioRecorder {private win: BrowserWindow | null = null;+ private readyTask: Promise<void> | null = null;+ private disposed = false;+ private ipcRegistered = false;+ private preferencesLoaded = false;+ private preferencesFile = "";+ private preferenceWrites: Promise<void> = Promise.resolve();+ private preferences: StoredPreferences = {+ narrationEnabled: false,+ microphone: microphonePreference(SYSTEM_DEFAULT_MICROPHONE),+ };+ private permission: MicrophonePermissionState = "unknown";+ private devices: MicrophoneDevice[] = [SYSTEM_DEFAULT_MICROPHONE];+ private settingsError: string | null = null;+ private readonly probes = new Map<string, PendingProbe>();+ private readonly settingsOperations = new Set<Promise<unknown>>();+private dir = "";private sessionStartedAt = 0;+ private narrationLanguage: NarrationLanguage = "en";private sequence = 0;private active: PendingSegment | null = null;private disableTask: Promise<AudioSegment | null> | null = null;private readonly segments: AudioSegment[] = [];+ private onCaptureEnded: (event: AudioCaptureEnded) => void = () => undefined;constructor(- private readonly onCaptureEnded: (event: AudioCaptureEnded) => void = () => undefined,+ private readonly onSettingsChanged: (+ status: MicrophoneSettingsStatus,+ ) => void = () => undefined,) {}- private readonly onChunk = (event: IpcMainEvent, id: string, chunk: Uint8Array) => {- const active = this.ownedSegment(event, id);- if (!active || !(chunk instanceof Uint8Array) || chunk.byteLength === 0) return;- const buffer = Buffer.from(chunk);- active.bytes += buffer.byteLength;- active.stream.write(buffer);- };+ createSession(+ onCaptureEnded: (event: AudioCaptureEnded) => void,+ ): SessionAudioRecorder {+ return {- start: (sessionDir, sessionStartedAt) =>- this.startSession(sessionDir, sessionStartedAt, onCaptureEnded),++ start: (sessionDir, sessionStartedAt, narrationLanguage) =>++ this.startSession(++ sessionDir,++ sessionStartedAt,++ narrationLanguage,++ onCaptureEnded,++ ),+ enable: (deviceId) => this.enable(deviceId),+ disable: () => this.disable(),+ finish: (videoStartEpoch) => this.finishSession(videoStartEpoch),+ };+ }- private readonly onStarted = (event: IpcMainEvent, id: string, epoch: number) => {- const active = this.ownedSegment(event, id);- if (!active || !Number.isFinite(epoch)) return;- active.startEpoch = epoch;- active.startedResolve?.();- active.startedResolve = null;- active.startedReject = null;- log.info("microphone segment started; anchor epoch", epoch);- };+ async initialize(): Promise<void> {+ if (this.disposed) throw new Error("The microphone service has been disposed.");+ await this.loadPreferences();+ await this.ensureWindow();+ this.emitSettings();+ }- private readonly onStopped = (event: IpcMainEvent, id: string, epoch: number) => {- const active = this.ownedSegment(event, id);- if (!active) return;- const unexpected = !active.stopRequested && active.startEpoch != null;- active.stopEpoch = Number.isFinite(epoch) ? epoch : Date.now();- active.ended = true;- active.stoppedResolve?.();- active.stoppedResolve = null;- if (unexpected) {- this.finishUnexpected(active, "The microphone stopped unexpectedly.", false);+ dispose(): void {+ if (this.disposed) return;+ this.disposed = true;+ for (const probe of this.probes.values()) {+ clearTimeout(probe.timeout);+ probe.resolve({ ok: false, error: "Skill Recorder is shutting down." });}- };+ this.probes.clear();+ if (this.ipcRegistered) {+ ipcMain.removeListener("audio:chunk", this.onChunk);+ ipcMain.removeListener("audio:started", this.onStarted);+ ipcMain.removeListener("audio:stopped", this.onStopped);+ ipcMain.removeListener("audio:error", this.onError);+ ipcMain.removeListener("audio:devices", this.onDevices);+ ipcMain.removeListener("audio:device-error", this.onDeviceError);+ ipcMain.removeListener("audio:probe-result", this.onProbeResult);+ this.ipcRegistered = false;+ }+ if (this.win && !this.win.isDestroyed()) this.win.destroy();+ this.win = null;+ this.readyTask = null;+ }- private readonly onError = (event: IpcMainEvent, id: string, error: string) => {- const active = this.ownedSegment(event, id);- if (!active) return;- const reason = error || "Microphone capture failed.";- active.error = reason;- log.warn("microphone unavailable:", reason);- if (active.startEpoch == null) {- active.failed = true;- active.startedReject?.(new Error(reason));- active.startedResolve = null;- active.startedReject = null;- return;+ settings(): MicrophoneSettingsStatus {+ const resolved = resolveMicrophonePreference(+ this.preferences.microphone,+ this.devices,+ );+ const preferredLabel =+ this.preferences.microphone.label || "Selected microphone";+ return {+ narrationEnabled: this.preferences.narrationEnabled,+ permission: this.permission,+ devices: this.devices.map((device) => ({ ...device })),+ preferredDeviceId: this.preferences.microphone.id,+ preferredDeviceLabel: preferredLabel,+ selectedDeviceId: resolved.device.id,+ selectedDeviceLabel: resolved.device.label,+ preferredDeviceUnavailable: resolved.unavailable,+ fallback: resolved.unavailable+ ? `${preferredLabel} is unavailable. System default will be used.`+ : null,+ error: this.settingsError,+ };+ }++ startOptions(): StartOptions {+ return {+ narration: this.preferences.narrationEnabled,+ microphoneDeviceId: this.effectiveDeviceId(),+ };+ }++ effectiveDeviceId(): string {+ return resolveMicrophonePreference(+ this.preferences.microphone,+ this.devices,+ ).device.id;+ }++ async setNarrationEnabled(+ enabled: boolean,+ ): Promise<MicrophoneSettingsResult> {+ return this.trackSettingsOperation(+ this.setNarrationEnabledInternal(enabled),+ );+ }++ selectDevice(deviceId: string): Promise<MicrophoneSettingsResult> {+ return this.trackSettingsOperation(this.selectDeviceInternal(deviceId));+ }++ async whenSettingsSettled(): Promise<void> {+ while (this.settingsOperations.size > 0) {+ await Promise.allSettled([...this.settingsOperations]);}- this.finishUnexpected(active, reason, true);- };+ }++ private async setNarrationEnabledInternal(+ enabled: boolean,+ ): Promise<MicrophoneSettingsResult> {+ try {+ await this.loadPreferences();+ if (enabled) await this.ensureWindow();+ } catch (error) {+ return this.settingsFailure(error);+ }++ if (enabled && !this.preferences.narrationEnabled) {+ const probe = await this.requestPermission();+ if (!probe.ok) {+ return {+ ok: false,+ status: this.settings(),+ error: probe.error ?? "Microphone permission was not granted.",+ };+ }+ }++ const previous = this.preferences.narrationEnabled;+ this.preferences.narrationEnabled = enabled;+ this.settingsError = null;+ try {+ await this.persistPreferences();+ } catch (error) {+ this.preferences.narrationEnabled = previous;+ return this.settingsFailure(error, "Could not save the narration preference");+ }+ this.emitSettings();+ return { ok: true, status: this.settings() };+ }++ private async selectDeviceInternal(+ deviceId: string,+ ): Promise<MicrophoneSettingsResult> {+ try {+ await this.initialize();+ } catch (error) {+ return this.settingsFailure(error);+ }++ const device = this.devices.find((candidate) => candidate.id === deviceId);+ if (!device) {+ const error = "That microphone is no longer available.";+ this.settingsError = error;+ this.emitSettings();+ return { ok: false, status: this.settings(), error };+ }++ const previous = this.preferences.microphone;+ this.preferences.microphone = microphonePreference(device);+ this.settingsError = null;+ try {+ await this.persistPreferences();+ } catch (error) {+ this.preferences.microphone = previous;+ return this.settingsFailure(error, "Could not save the microphone selection");+ }+ this.emitSettings();+ return { ok: true, status: this.settings() };+ }- /** Prepare the session's hidden audio utility window without touching the mic. */- async start(+ private trackSettingsOperation<T>(operation: Promise<T>): Promise<T> {+ this.settingsOperations.add(operation);+ void operation.then(+ () => this.settingsOperations.delete(operation),+ () => this.settingsOperations.delete(operation),+ );+ return operation;+ }++ private async startSession(sessionDir: string,sessionStartedAt: number,+ narrationLanguage: NarrationLanguage,+ onCaptureEnded: (event: AudioCaptureEnded) => void,): Promise<void> {- if (this.win) throw new Error("Microphone recorder is already initialized.");+ if (this.dir) throw new Error("Microphone recorder is already initialized.");+ await this.initialize();+ await mkdir(path.join(sessionDir, AUDIO_DIR), { recursive: true });this.dir = sessionDir;this.sessionStartedAt = sessionStartedAt;+ this.narrationLanguage = narrationLanguage;this.sequence = 0;this.segments.length = 0;- await mkdir(path.join(this.dir, AUDIO_DIR), { recursive: true });-- ipcMain.on("audio:chunk", this.onChunk);- ipcMain.on("audio:started", this.onStarted);- ipcMain.on("audio:stopped", this.onStopped);- ipcMain.on("audio:error", this.onError);-- this.win = new BrowserWindow({- show: false,- webPreferences: {- preload: path.join(dirname, "audio", "capture-preload.cjs"),- contextIsolation: true,- nodeIntegration: false,- sandbox: false,- backgroundThrottling: false,- },- });- this.win.once("closed", () => {- const active = this.active;- if (!active || active.ended) return;- active.failed = true;- active.error = "Microphone capture window closed unexpectedly.";- active.startedReject?.(new Error(active.error));- active.ended = true;- active.stoppedResolve?.();- this.finishUnexpected(active, active.error, true);- });-- try {- await this.win.loadFile(path.join(dirname, "audio", "capture.html"));- } catch (error) {- await this.teardown();- throw error;- }+ this.onCaptureEnded = onCaptureEnded;}/** Request microphone access and begin a new independently timestamped segment. */diff --cc electron/ipc.tsindex b515ca4,0258659..aea2bff--- a/electron/ipc.ts+++ b/electron/ipc.ts@@@ -42,11 -46,61 +47,64 @@@ export function registerIpcipcMain.handle(IPC.stop, () => recorder.stop());ipcMain.handle(IPC.discard, () => recorder.discard());ipcMain.handle(IPC.microphone, (_event, enabled: boolean) =>- recorder.setMicrophoneEnabled(enabled),+ recorder.setMicrophoneEnabled(enabled, microphones.effectiveDeviceId()),+ );+ ipcMain.handle(IPC.microphoneSettings, () => microphones.settings());+ ipcMain.handle(+ IPC.microphoneNarration,+ async (_event, enabled: boolean): Promise<MicrophoneSettingsResult> => {+ if (typeof enabled !== "boolean") {+ return {+ ok: false,+ status: microphones.settings(),+ error: "Invalid narration preference.",+ };+ }+ if (recorder.state === "recording") {+ return {+ ok: false,+ status: microphones.settings(),+ error: "Choose the next recording's narration state after this recording ends.",+ };+ }+ return microphones.setNarrationEnabled(enabled);+ },+ );+ ipcMain.handle(+ IPC.microphoneDevice,+ async (_event, deviceId: string): Promise<MicrophoneSettingsResult> => {+ if (typeof deviceId !== "string" || !deviceId) {+ return {+ ok: false,+ status: microphones.settings(),+ error: "Invalid microphone selection.",+ };+ }+ const previousDeviceId = microphones.effectiveDeviceId();+ const selected = await microphones.selectDevice(deviceId);+ if (+ !selected.ok ||+ recorder.status().microphone.state !== "on" ||+ microphones.effectiveDeviceId() === previousDeviceId+ ) {+ return selected;+ }+ const switched = await recorder.setMicrophoneDevice(+ microphones.effectiveDeviceId(),+ );+ if (!switched.ok) {+ return {+ ok: false,+ status: microphones.settings(),+ error: switched.error ?? "Could not switch microphones.",+ };+ }+ return { ok: true, status: microphones.settings() };+ },);+ ipcMain.handle(IPC.narrationLanguage, (_event, language: NarrationLanguage) =>+ recorder.setNarrationLanguage(language),+ );ipcMain.handle(IPC.status, () => recorder.status());ipcMain.handle(IPC.marker, (_event, note: string) => recorder.marker(note));ipcMain.handle(IPC.doctor, () => runDoctor());diff --cc electron/narration/transcribe.test.tsindex 9805667,b8c7b19..c192d4c--- a/electron/narration/transcribe.test.ts+++ b/electron/narration/transcribe.test.ts@@@ -1,29 -1,44 +1,70 @@@import assert from "node:assert/strict";import test from "node:test";+ import type { SilenceSpan } from "./audio-analysis";-import { isMostlySilent } from "./transcribe";+import {+ isMeaningfulNarrationText,++ isMostlySilent,+ narrationTranscriptionOptions,+} from "./transcribe";++test("multilingual transcription preserves the explicitly selected source language", () => {+ assert.deepEqual(narrationTranscriptionOptions("fr"), {+ return_timestamps: true,+ chunk_length_s: 30,+ stride_length_s: 5,+ language: "fr",+ task: "transcribe",+ });+});++test("narration filtering accepts Unicode letters", () => {+ assert.equal(isMeaningfulNarrationText("È già pronto"), true);+ assert.equal(isMeaningfulNarrationText("日本語の説明"), true);+ assert.equal(isMeaningfulNarrationText("123 ..."), false);+});++test("narration filtering removes localized Whisper boilerplate", () => {+ assert.equal(isMeaningfulNarrationText("Merci d'avoir regardé !"), false);+ assert.equal(isMeaningfulNarrationText("Gracias por ver."), false);+ assert.equal(isMeaningfulNarrationText("Grazie per aver guardato"), false);+});++ test("keeps a long real-speech chunk that is only ~44% silent", () => {+ // Regression: the old midpoint test dropped this 16.18s chunk purely because its+ // center (8.09s) landed inside the 7.14-9.44s mid-sentence pause. Natural pauses+ // add up to ~44% of the span, but the majority is speech, so it must be kept.+ const silences: SilenceSpan[] = [+ { start: 1.0, end: 2.4 },+ { start: 7.14, end: 9.44 },+ { start: 11.0, end: 12.5 },+ { start: 14.0, end: 16.0 },+ ];+ assert.equal(isMostlySilent(0, 16.18, silences), false);+ });++ test("drops a chunk whose span is essentially all silence", () => {+ // A silence span that fully covers (and overruns) the chunk: clipped coverage+ // is 100%, so it's a hallucination over silence and gets dropped.+ assert.equal(isMostlySilent(10, 20, [{ start: 9, end: 21 }]), true);+ });++ test("uses 0.85 as the drop threshold", () => {+ assert.equal(isMostlySilent(0, 10, [{ start: 0, end: 9 }]), true); // 0.90 -> drop+ assert.equal(isMostlySilent(0, 10, [{ start: 0, end: 8 }]), false); // 0.80 -> keep+ });++ test("degenerates to a point-in-silence test for a zero-length span", () => {+ assert.equal(isMostlySilent(5, 5, [{ start: 4, end: 6 }]), true);+ assert.equal(isMostlySilent(5, 5, [{ start: 10, end: 12 }]), false);+ });++ test("treats a negative span defensively via the start point", () => {+ assert.equal(isMostlySilent(8, 5, [{ start: 7, end: 9 }]), true);+ assert.equal(isMostlySilent(8, 5, [{ start: 1, end: 2 }]), false);+ });++ test("keeps a chunk with no overlapping silence", () => {+ assert.equal(isMostlySilent(0, 10, [{ start: 20, end: 25 }, { start: 30, end: 35 }]), false);+ assert.equal(isMostlySilent(0, 10, []), false);+ });diff --cc electron/preload.cjsindex 28bbe49,634e8f1..285f4c2--- a/electron/preload.cjs+++ b/electron/preload.cjs@@@ -7,7 -7,10 +7,11 @@@ const IPC =stop: "recorder:stop",discard: "recorder:discard",microphone: "recorder:microphone",+ narrationLanguage: "recorder:narration-language",+ microphoneSettings: "microphone:settings",+ microphoneNarration: "microphone:narration",+ microphoneDevice: "microphone:device",+ microphoneSettingsChanged: "microphone:settings-changed",status: "recorder:status",marker: "recorder:marker",doctor: "doctor:check",@@@ -46,7 -49,14 +50,15 @@@ contextBridge.exposeInMainWorld("skillRstop: () => ipcRenderer.invoke(IPC.stop),discard: () => ipcRenderer.invoke(IPC.discard),setMicrophoneEnabled: (enabled) => ipcRenderer.invoke(IPC.microphone, enabled),+ setNarrationLanguage: (language) => ipcRenderer.invoke(IPC.narrationLanguage, language),+ microphoneSettings: () => ipcRenderer.invoke(IPC.microphoneSettings),+ setNarrationEnabled: (enabled) => ipcRenderer.invoke(IPC.microphoneNarration, enabled),+ selectMicrophone: (deviceId) => ipcRenderer.invoke(IPC.microphoneDevice, deviceId),+ onMicrophoneSettingsChanged: (cb) => {+ const listener = (_event, status) => cb(status);+ ipcRenderer.on(IPC.microphoneSettingsChanged, listener);+ return () => ipcRenderer.removeListener(IPC.microphoneSettingsChanged, listener);+ },status: () => ipcRenderer.invoke(IPC.status),marker: (note) => ipcRenderer.invoke(IPC.marker, note),doctor: () => ipcRenderer.invoke(IPC.doctor),diff --cc electron/recorder/controller.test.tsindex e20bb2b,e942479..fef1c2e--- a/electron/recorder/controller.test.ts+++ b/electron/recorder/controller.test.ts@@@ -5,27 -5,28 +5,35 @@@ import path from "node:path"import test from "node:test";import { FULL_CAPTURE } from "../../common/config";+import type { NarrationLanguage } from "../../common/narration";+ import type { MicrophoneDevice } from "../../common/microphone";import { RecorderController, type SessionAudioRecorder } from "./controller";class FakeAudioRecorder implements SessionAudioRecorder {readonly calls: string[] = [];+ readonly deviceIds: string[] = [];finishVideoStartEpoch: number | null | undefined;+ narrationLanguage: NarrationLanguage | null = null;failEnable = false;- async start(): Promise<void> {+ async start(+ _sessionDir: string,+ _sessionStartedAt: number,+ narrationLanguage: NarrationLanguage,+ ): Promise<void> {this.calls.push("start");+ this.narrationLanguage = narrationLanguage;}- async enable(): Promise<void> {+ async enable(deviceId = "default"): Promise<MicrophoneDevice> {this.calls.push("enable");+ this.deviceIds.push(deviceId);if (this.failEnable) throw new Error("Microphone permission denied.");+ return {+ id: deviceId,+ label: deviceId === "default" ? "System microphone" : `Microphone ${deviceId}`,+ groupId: "",+ };}async disable(): Promise<void> {diff --cc electron/recorder/controller.tsindex ce827d7,88df385..2490558--- a/electron/recorder/controller.ts+++ b/electron/recorder/controller.ts@@@ -14,12 -13,11 +14,16 @@@ import typeStartResult,StopResult,} from "../../common/ipc";+import {+ DEFAULT_NARRATION_LANGUAGE,+ isNarrationLanguage,+ type NarrationLanguage,+} from "../../common/narration";import type { RecorderState, SessionMeta } from "../../common/types";+ import {+ SYSTEM_DEFAULT_MICROPHONE_ID,+ type MicrophoneDevice,+ } from "../../common/microphone";import { createLogger } from "../logger";import type { Collector } from "./collector";import { CollectorHost } from "./collector";@@@ -44,12 -42,8 +48,12 @@@ export interface SessionVideoRecorder/** Microphone sidecar that can create multiple capture intervals per session. */export interface SessionAudioRecorder {- start(sessionDir: string, sessionStartedAt: number): Promise<void>;+ start(+ sessionDir: string,+ sessionStartedAt: number,+ narrationLanguage: NarrationLanguage,+ ): Promise<void>;- enable(): Promise<void>;+ enable(deviceId?: string): Promise<MicrophoneDevice | void>;disable(): Promise<unknown>;finish(videoStartEpoch: number | null): Promise<unknown>;}@@@ -91,8 -85,11 +95,12 @@@ export class RecorderControllerprivate video: SessionVideoRecorder | null = null;private audio: SessionAudioRecorder | null = null;private transition: RecorderStatus["transition"] = "none";- private microphone: RecorderStatus["microphone"] = { state: "off", error: null };+ private narrationLanguage = DEFAULT_NARRATION_LANGUAGE;+ private microphone: RecorderStatus["microphone"] = {+ state: "off",+ error: null,+ activeDevice: null,+ };private lastFinish: RecorderStatus["lastFinish"] = null;private shuttingDown = false;private operations: Promise<void> = Promise.resolve();@@@ -133,10 -130,14 +141,15 @@@state: this.state,sessionId: this.store?.meta.id ?? null,startedAt: this.store?.meta.startedAt ?? null,+ narrationLanguage: this.narrationLanguage,eventCount: this.store?.eventCount ?? 0,transition: this.transition,- microphone: { ...this.microphone },+ microphone: {+ ...this.microphone,+ activeDevice: this.microphone.activeDevice+ ? { ...this.microphone.activeDevice }+ : null,+ },lastFinish: this.lastFinish ? { ...this.lastFinish } : null,lastSession: this.lastCompleted? { id: this.lastCompleted.id, processed: this.lastProcessed }@@@ -215,18 -252,9 +281,18 @@@private async startInternal(options?: StartOptions): Promise<StartResult> {if (this.store) return { ok: false, error: "Already recording" };+ if (+ options?.narrationLanguage !== undefined &&+ !isNarrationLanguage(options.narrationLanguage)+ ) {+ return { ok: false, error: "Unsupported narration language." };+ }+ if (options?.narrationLanguage !== undefined) {+ this.narrationLanguage = options.narrationLanguage;+ }this.transition = "starting";- this.microphone = { state: "off", error: null };+ this.microphone = { state: "off", error: null, activeDevice: null };this.lastFinish = null;this.emit();diff --cc package.jsonindex d06eecd,64a4667..9f826e1--- a/package.json+++ b/package.json@@@ -14,7 -14,7 +14,7 @@@"build": "tsc --noEmit && vite build","typecheck": "tsc --noEmit","typecheck:evals": "tsc --noEmit -p evals/tsconfig.json",- "test": "node --experimental-transform-types --no-warnings --import ./evals/register.mjs --test common/audio.test.ts common/narration.test.ts electron/recording-controls-bounds.test.ts electron/recorder/controller.test.ts electron/frames/extractor.test.ts electron/narration/audio-analysis.test.ts electron/narration/transcribe.test.ts electron/narration/whisper.test.ts electron/sessions.test.ts",- "test": "node --experimental-transform-types --no-warnings --import ./evals/register.mjs --test common/audio.test.ts common/microphone.test.ts electron/recording-controls-bounds.test.ts electron/recorder/controller.test.ts electron/frames/extractor.test.ts electron/narration/audio-analysis.test.ts electron/narration/analyze-gate.test.ts electron/narration/transcribe.test.ts electron/sessions.test.ts",++ "test": "node --experimental-transform-types --no-warnings --import ./evals/register.mjs --test common/audio.test.ts common/microphone.test.ts common/narration.test.ts electron/recording-controls-bounds.test.ts electron/recorder/controller.test.ts electron/frames/extractor.test.ts electron/narration/audio-analysis.test.ts electron/narration/analyze-gate.test.ts electron/narration/transcribe.test.ts electron/narration/whisper.test.ts electron/sessions.test.ts","eval": "node --experimental-transform-types --no-warnings --import ./evals/register.mjs evals/run.ts","eval:builder": "node --experimental-transform-types --no-warnings --import ./evals/register.mjs evals/builder/run.ts","eval:skill": "node --experimental-transform-types --no-warnings --import ./evals/register.mjs evals/skillbuilder/run.ts",diff --cc src/App.cssindex d0cb09d,619eb1b..375f11f--- a/src/App.css+++ b/src/App.css@@@ -443,28 -443,29 +443,35 @@@ button:focus-visiblemin-height: 15px;}- .narration-row {+ .narrate {++ position: relative;+ flex: none;+ width: 100%;+ background: transparent;+ border: 1px solid var(--line);+ color: var(--text);+ border-radius: 12px;- overflow: hidden;+ transition: border-color 0.15s ease, background 0.15s ease;+ }+++.narrate-head {+ display: flex;+ align-items: stretch;- gap: 8px;+}+- .narrate {+ .narrate-toggle {display: flex;align-items: center;- gap: 12px;- width: 100%;- padding: 11px 13px;+ gap: 10px;+ flex: 1;+ min-width: 0;++ padding: 11px;text-align: left;background: transparent;- border: 1px solid var(--line);- color: var(--text);- border-radius: 12px;- padding: 11px;- transition: border-color 0.15s ease, background 0.15s ease;+ color: inherit;}- .narrate:not(:disabled):hover {+ .narrate-toggle:not(:disabled):hover {border-color: var(--line-strong);background: var(--surface);}@@@ -479,6 -480,6 +486,27 @@@cursor: default;}++.narrate-settings-toggle {++ display: grid;++ place-items: center;++ flex: none;++ width: 42px;++ border-left: 1px solid var(--line);++ color: var(--muted);++ background: transparent;++ transition: color 0.15s ease, background 0.15s ease;++}++++.narrate-settings-toggle:not(:disabled):hover,++.narrate-settings-toggle.open {++ color: var(--brand-ink);++ background: rgba(var(--brand-rgb), 0.08);++}++++.narrate-settings-toggle:disabled {++ opacity: 0.65;++}++.narrate-icon {display: flex;flex: none;@@@ -543,45 -544,69 +571,77 @@@transform: translateX(14px);}- .narration-language {- display: flex;- flex: none;- flex-direction: column;- justify-content: center;- gap: 2px;- width: 116px;- padding: 7px 9px;- border: 1px solid var(--line);-.narrate-device {++.narrate-settings {++ position: absolute;++ z-index: 20;++ top: calc(100% + 6px);++ left: 0;++ right: 0;+ display: grid;+ grid-template-columns: auto minmax(0, 1fr);+ align-items: center;+ gap: 6px 10px;- padding: 6px 13px 6px 43px;- border-top: 1px solid rgba(var(--brand-rgb), 0.14);++ padding: 10px 13px;++ border: 1px solid rgba(var(--brand-rgb), 0.3);+ border-radius: 12px;+ background: var(--surface);++ box-shadow: 0 16px 32px -18px rgba(0, 0, 0, 0.45);}- .narration-language > span {- font-size: 9px;-.narrate-device label {++.narrate-settings label {+ font-size: 10.5px;font-weight: 600;- color: var(--muted);- letter-spacing: 0.06em;- text-transform: uppercase;+ color: var(--brand-ink);}- .narration-language select {+ .narrate-select-wrap {+ position: relative;+ min-width: 0;+ }++ .narrate-select-wrap select {width: 100%;- padding: 0;- border: 0;- outline: 0;- background: transparent;+ height: 30px;+ padding: 0 27px 0 9px;+ appearance: none;+ border: 1px solid rgba(var(--brand-rgb), 0.34);+ border-radius: 8px;+ background: var(--surface);color: var(--text);font: inherit;font-size: 11px;- font-weight: 600;+ text-overflow: ellipsis;}- .narration-language:focus-within {- border-color: var(--brand);+ .narrate-select-wrap select:focus-visible {+ outline: 2px solid rgba(var(--brand-rgb), 0.5);+ outline-offset: 1px;}- .narration-language:has(select:disabled) {- opacity: 0.75;+ .narrate-select-chevron {+ position: absolute;+ top: 50%;+ right: 9px;+ color: var(--muted);+ font-size: 10px;+ pointer-events: none;+ transform: translateY(-52%);+ }+-.narrate-device-note {++.narrate-settings-note {+ grid-column: 1 / -1;+ margin: 0;+ color: var(--muted);+ font-size: 10px;+ line-height: 1.35;+ }+-.narrate-device-note.warn {++.narrate-settings-note.warn {+ color: #8a5d00;+ }+-.narrate-device-note.error {++.narrate-settings-note.error {+ color: var(--rec);}.privacy-note {diff --cc src/Library.tsxindex a31e250,70c1af8..88be94f--- a/src/Library.tsx+++ b/src/Library.tsx@@@ -459,39 -442,11 +450,11 @@@ function AnalysisWorkspace(</div><div className="ws-body">- {voicePending && (- <div className="voice-card">- <div className="voice-card-copy">- <strong>Voice not transcribed yet</strong>- <span>- {voiceBusy- ? narrationWorkLabel(narrationStatus)- : `Your audio is saved. Transcription runs locally in ${voiceLanguage} and keeps that language.`}- </span>- {!voiceBusy && narrationStatus?.model !== "ready" && (- <span>- The first use requires a one-time {NARRATION_MODEL_DOWNLOAD_LABEL} multilingual- model download.- </span>- )}- {!voiceBusy && voiceError && (- <span className="voice-card-error">{voiceError}</span>- )}- </div>- <button- className="secondary"- disabled={voiceBusy || modelBusy}- onClick={() => void transcribeVoice()}- >- {voiceBusy || modelBusy- ? narrationWorkLabel(narrationStatus)- : narrationStatus?.model === "ready"- ? "Transcribe voice"- : narrationStatus?.model === "error"- ? "Try again"- : "Download & transcribe"}- </button>- </div>+ {voicePending && voiceError && !analyzing && (+ <p className="voice-analysis-note">- Couldn't transcribe your voice, so this analysis doesn't include it. Your audio is saved —- analyzing again will retry.++ Couldn't transcribe your {voiceLanguage} voice, so this analysis doesn't include it.++ Your audio is saved — analyzing again will retry.+ </p>)}{voiceEmpty && (@@@ -541,7 -496,9 +504,9 @@@<p>See what you did in this recording, step by step.</p>{voicePending && (<p className="voice-analysis-note">- Voice is not transcribed yet. Analyzing now will not include it, but your audio will be kept.+ {narrationStatus?.model === "ready"- ? "Your voice is transcribed first, then analyzed."- : "Your voice is transcribed first, then analyzed. The first run downloads a ~250 MB voice model once."}++ ? `Your ${voiceLanguage} voice is transcribed in the same language first, then analyzed.`++ : `Your ${voiceLanguage} voice is transcribed in the same language first, then analyzed. The first run downloads a ${NARRATION_MODEL_DOWNLOAD_LABEL} voice model once.`}</p>)}<button className="record-cta" onClick={run}>diff --cc src/Recorder.tsxindex c911478,b0c7e69..42ba490--- a/src/Recorder.tsx+++ b/src/Recorder.tsx@@@ -1,14 -1,11 +1,19 @@@--import { useCallback, useEffect, useState } from "react";++import { useCallback, useEffect, useRef, useState } from "react";- import type { DoctorReport, NarrationStatus, RecorderStatus } from "../common/ipc";+ import type {+ DoctorReport,+ MicrophoneSettingsStatus,+ NarrationStatus,+ RecorderStatus,+ } from "../common/ipc";+import {+ DEFAULT_NARRATION_LANGUAGE,+ isNarrationLanguage,+ NARRATION_LANGUAGES,+ NARRATION_MODEL_DOWNLOAD_LABEL,+ narrationLanguageLabel,+ type NarrationLanguage,+} from "../common/narration";import { formatMs } from "./format";import { WhatsRecorded } from "./WhatsRecorded";@@@ -20,13 -17,14 +25,18 @@@ export function Recorder()const [status, setStatus] = useState<RecorderStatus | null>(null);const [doctor, setDoctor] = useState<DoctorReport | null>(null);const [narrationStatus, setNarrationStatus] = useState<NarrationStatus | null>(null);+ const [microphoneSettings, setMicrophoneSettings] =+ useState<MicrophoneSettingsStatus | null>(null);const [showPrivacy, setShowPrivacy] = useState(false);- const [narrate, setNarrate] = useState(false);++ const [showNarrationSettings, setShowNarrationSettings] = useState(false);+ const [narrationLanguage, setSelectedNarrationLanguage] =+ useState<NarrationLanguage>(DEFAULT_NARRATION_LANGUAGE);+ const [microphonePending, setMicrophonePending] = useState(false);+ const [microphoneActionError, setMicrophoneActionError] = useState<string | null>(null);const [elapsed, setElapsed] = useState(0);const [sessionCount, setSessionCount] = useState(0);const [pendingCount, setPendingCount] = useState(0);++ const narrationSettingsRef = useRef<HTMLElement>(null);const refreshCount = useCallback(async () => {const list = await window.skillRecorder.listSessions();@@@ -34,23 -32,22 +44,27 @@@setPendingCount(list.filter((s) => !s.analysis).length);}, []);+ const applyRecorderStatus = useCallback((next: RecorderStatus) => {+ setStatus(next);+ setSelectedNarrationLanguage(next.narrationLanguage);+ }, []);+useEffect(() => {- void window.skillRecorder.status().then(setStatus);+ void window.skillRecorder.status().then(applyRecorderStatus);void window.skillRecorder.doctor().then(setDoctor);void window.skillRecorder.narrationStatus().then(setNarrationStatus);+ void window.skillRecorder.microphoneSettings().then(setMicrophoneSettings);void refreshCount();- const offRecorder = window.skillRecorder.onStatusChanged(setStatus);+ const offRecorder = window.skillRecorder.onStatusChanged(applyRecorderStatus);const offNarration = window.skillRecorder.onNarrationStatusChanged(setNarrationStatus);+ const offMicrophones =+ window.skillRecorder.onMicrophoneSettingsChanged(setMicrophoneSettings);return () => {offRecorder();offNarration();+ offMicrophones();};- }, [refreshCount]);+ }, [applyRecorderStatus, refreshCount]);// The analyze step happens in the library window, so re-check how many// recordings still need analysis whenever the recorder regains focus.@@@ -65,6 -62,7 +79,30 @@@const startedAt = status?.startedAt ?? null;const justSaved = !recording && status?.lastFinish?.outcome === "saved";const justDiscarded = !recording && status?.lastFinish?.outcome === "discarded";+ const narrate = microphoneSettings?.narrationEnabled ?? false;++ const narrationLanguageName = narrationLanguageLabel(narrationLanguage);++++ useEffect(() => {++ if (recording) setShowNarrationSettings(false);++ }, [recording]);++++ useEffect(() => {++ if (!showNarrationSettings) return;++ const onKeyDown = (event: KeyboardEvent) => {++ if (event.key === "Escape") setShowNarrationSettings(false);++ };++ const onMouseDown = (event: MouseEvent) => {++ const target = event.target;++ if (!(target instanceof Node) || narrationSettingsRef.current?.contains(target)) return;++ setShowNarrationSettings(false);++ };++ window.addEventListener("keydown", onKeyDown);++ window.addEventListener("mousedown", onMouseDown);++ return () => {++ window.removeEventListener("keydown", onKeyDown);++ window.removeEventListener("mousedown", onMouseDown);++ };++ }, [showNarrationSettings]);// Refresh the library count whenever a recording finishes.useEffect(() => {@@@ -83,25 -81,40 +121,55 @@@const toggle = useCallback(async () => {const res = recording? await window.skillRecorder.stop()- : await window.skillRecorder.start({ narration: narrate, narrationLanguage });+ : await window.skillRecorder.start();if (!res.ok) window.alert(res.error ?? "Action failed");- setStatus(await window.skillRecorder.status());- }, [recording]);+ applyRecorderStatus(await window.skillRecorder.status());- }, [applyRecorderStatus, recording, narrate, narrationLanguage]);++ }, [applyRecorderStatus, recording]);++ const selectNarrationLanguage = useCallback(+ async (value: string) => {+ if (!isNarrationLanguage(value)) {+ window.alert("Unsupported narration language.");+ return;+ }+ setSelectedNarrationLanguage(value);+ const result = await window.skillRecorder.setNarrationLanguage(value);+ if (!result.ok) window.alert(result.error ?? "Could not change the narration language.");+ applyRecorderStatus(await window.skillRecorder.status());+ },+ [applyRecorderStatus],+ );+ const toggleNarration = useCallback(async () => {+ if (!microphoneSettings) return;+ setMicrophonePending(true);+ setMicrophoneActionError(null);+ const result = await window.skillRecorder.setNarrationEnabled(+ !microphoneSettings.narrationEnabled,+ );+ setMicrophoneSettings(result.status);+ if (!result.ok) {+ setMicrophoneActionError(+ result.error ?? "Could not update the narration preference.",+ );++ setShowNarrationSettings(true);+ }+ setMicrophonePending(false);+ }, [microphoneSettings]);++ const selectMicrophone = useCallback(async (deviceId: string) => {+ setMicrophonePending(true);+ setMicrophoneActionError(null);+ const result = await window.skillRecorder.selectMicrophone(deviceId);+ setMicrophoneSettings(result.status);+ if (!result.ok) {+ setMicrophoneActionError(+ result.error ?? "Could not select that microphone.",+ );+ }+ setMicrophonePending(false);+ }, []);+const openLibrary = useCallback(() => {void window.skillRecorder.openLibrary();}, []);@@@ -147,74 -160,109 +215,158 @@@</div></div>- <div className="narration-row">- <section className={`narrate ${narrate ? "on" : ""}`}>-- <button- className={`narrate ${narrate ? "on" : ""}`}- className="narrate-toggle"-- role="switch"-- aria-checked={narrate}- onClick={() => setNarrate((v) => !v)}- disabled={recording || transitioning}- aria-busy={microphonePending}- onClick={() => void toggleNarration()}- disabled={- !microphoneSettings ||- microphonePending ||- recording ||- transitioning- }-- >-- <span className="narrate-icon" aria-hidden>-- <svg width="18" height="18" viewBox="0 0 20 20" fill="none">-- <rect-- x="7.5"-- y="2.5"-- width="5"-- height="9"-- rx="2.5"-- stroke="currentColor"-- strokeWidth="1.4"-- />-- <path-- d="M5 9.2a5 5 0 0 0 10 0"-- stroke="currentColor"-- strokeWidth="1.4"-- strokeLinecap="round"-- />++ <section ref={narrationSettingsRef} className={`narrate ${narrate ? "on" : ""}`}>++ <div className="narrate-head">++ <button++ className="narrate-toggle"++ role="switch"++ aria-checked={narrate}++ aria-busy={microphonePending}++ onClick={() => void toggleNarration()}++ disabled={++ !microphoneSettings ||++ microphonePending ||++ recording ||++ transitioning++ }++ >++ <span className="narrate-icon" aria-hidden>++ <svg width="18" height="18" viewBox="0 0 20 20" fill="none">++ <rect++ x="7.5"++ y="2.5"++ width="5"++ height="9"++ rx="2.5"++ stroke="currentColor"++ strokeWidth="1.4"++ />++ <path++ d="M5 9.2a5 5 0 0 0 10 0"++ stroke="currentColor"++ strokeWidth="1.4"++ strokeLinecap="round"++ />++ <path++ d="M10 14.2v3"++ stroke="currentColor"++ strokeWidth="1.4"++ strokeLinecap="round"++ />++ </svg>++ </span>++ <span className="narrate-text">++ <span className="narrate-label">Narrate</span>++ <span className="narrate-sub">++ {microphonePending++ ? "Requesting microphone access..."++ : microphoneActionError || microphoneSettings?.error++ ? "Microphone needs attention"++ : recording++ ? narrate++ ? `Listening · ${narrationLanguageName}`++ : "Voice off for this recording"++ : narrate++ ? narrationStatus?.model === "ready"++ ? `${narrationLanguageName} transcript · local`++ : `${narrationLanguageName} transcript · ${NARRATION_MODEL_DOWNLOAD_LABEL} later`++ : "Explain out loud (optional)"}++ </span>++ </span>++ <span className={`narrate-switch ${narrate ? "on" : ""}`} aria-hidden>++ <span className="narrate-knob" />++ </span>++ </button>++ <button++ className={`narrate-settings-toggle ${showNarrationSettings ? "open" : ""}`}++ aria-label="Narration settings"++ aria-controls="narration-settings"++ aria-expanded={showNarrationSettings}++ title="Narration settings"++ disabled={microphonePending || recording || transitioning}++ onClick={() => {++ setMicrophoneActionError(null);++ setShowNarrationSettings((open) => !open);++ }}++ >++ <svg width="18" height="18" viewBox="0 0 24 24" aria-hidden><path-- d="M10 14.2v3"-- stroke="currentColor"-- strokeWidth="1.4"-- strokeLinecap="round"++ fill="currentColor"++ d="M19.43 12.98c.04-.32.07-.65.07-.98s-.03-.66-.07-.98l2.11-1.65a.5.5 0 0 0 .12-.64l-2-3.46a.5.5 0 0 0-.6-.22l-2.49 1a7.2 7.2 0 0 0-1.69-.98l-.38-2.65A.5.5 0 0 0 14 2h-4a.5.5 0 0 0-.5.42l-.38 2.65c-.61.25-1.17.58-1.69.98l-2.49-1a.5.5 0 0 0-.6.22l-2 3.46a.5.5 0 0 0 .12.64l2.11 1.65a7.7 7.7 0 0 0 0 1.96l-2.11 1.65a.5.5 0 0 0-.12.64l2 3.46a.5.5 0 0 0 .6.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65A.5.5 0 0 0 10 22h4a.5.5 0 0 0 .5-.42l.38-2.65c.61-.25 1.17-.58 1.69-.98l2.49 1a.5.5 0 0 0 .6-.22l2-3.46a.5.5 0 0 0-.12-.64zM12 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7Z"/></svg>-- </span>-- <span className="narrate-text">-- <span className="narrate-label">Narrate</span>-- <span className="narrate-sub">- {recording- ? narrate- ? `Listening · ${narrationLanguageLabel(narrationLanguage)}`- : "Voice off for this recording"- : narrate- ? narrationStatus?.model === "ready"- ? "Voice saved · local transcript"- : `Voice saved · ${NARRATION_MODEL_DOWNLOAD_LABEL} later`- : "Explain out loud (optional)"}- {microphonePending- ? "Requesting microphone access..."- : microphoneActionError || microphoneSettings?.error- ? "Microphone needs attention"- : recording- ? narrate- ? "Listening to your voice"- : "Voice off for this recording"- : narrate- ? `Will use ${microphoneSettings?.selectedDeviceLabel ?? "System default"}`- : "Explain out loud (optional)"}-- </span>-- </span>-- <span className={`narrate-switch ${narrate ? "on" : ""}`} aria-hidden>-- <span className="narrate-knob" />-- </span>-- </button>++ </button>++ </div>+- <label className="narration-language">- <span>Language</span>- <select- value={narrationLanguage}- disabled={recording || transitioning}- onChange={(event) => void selectNarrationLanguage(event.currentTarget.value)}- title="The transcript stays in this language"- >- {NARRATION_LANGUAGES.map(({ code, label }) => (- <option key={code} value={code}>- {label}- </option>- ))}- </select>- </label>- </div>++ {showNarrationSettings && (++ <div id="narration-settings" className="narrate-settings">++ <label htmlFor="narrate-language">Language</label>++ <div className="narrate-select-wrap">++ <select++ id="narrate-language"++ value={narrationLanguage}++ disabled={microphonePending || recording || transitioning}++ onChange={(event) =>++ void selectNarrationLanguage(event.currentTarget.value)++ }++ title="The transcript stays in this language"++ >++ {NARRATION_LANGUAGES.map(({ code, label }) => (++ <option key={code} value={code}>++ {label}++ </option>++ ))}++ </select>++ <span className="narrate-select-chevron" aria-hidden>++ ▾++ </span>++ </div>+- {narrate && microphoneSettings && (- <div className="narrate-device">+ <label htmlFor="narrate-microphone">Microphone</label>+ <div className="narrate-select-wrap">+ <select+ id="narrate-microphone"- value={microphoneSettings.selectedDeviceId}++ value={microphoneSettings?.selectedDeviceId ?? ""}+ disabled={microphonePending || recording || transitioning}+ onChange={(event) => void selectMicrophone(event.target.value)}+ >- {microphoneSettings.devices.map((device) => (- <option key={device.id} value={device.id}>- {device.label}- </option>- ))}++ {microphoneSettings ? (++ microphoneSettings.devices.map((device) => (++ <option key={device.id} value={device.id}>++ {device.label}++ </option>++ ))++ ) : (++ <option value="">Loading microphones...</option>++ )}+ </select>+ <span className="narrate-select-chevron" aria-hidden>+ ▾+ </span>+ </div>+ {(microphoneActionError ||- microphoneSettings.error ||- microphoneSettings.fallback) && (++ microphoneSettings?.error ||++ microphoneSettings?.fallback) && (+ <p- className={`narrate-device-note ${- microphoneActionError || microphoneSettings.error++ className={`narrate-settings-note ${++ microphoneActionError || microphoneSettings?.error+ ? "error"+ : "warn"+ }`}+ role={- microphoneActionError || microphoneSettings.error++ microphoneActionError || microphoneSettings?.error+ ? "alert"+ : undefined+ }+ >+ {microphoneActionError ??- microphoneSettings.error ??- microphoneSettings.fallback}++ microphoneSettings?.error ??++ microphoneSettings?.fallback}+ </p>+ )}+ </div>+ )}+ </section><button className="privacy-note" onClick={() => setShowPrivacy(true)}><span className="privacy-note-icon" aria-hidden>diff --cc src/RecordingControls.tsxindex 85900a4,85c9953..c134987--- a/src/RecordingControls.tsx+++ b/src/RecordingControls.tsx@@@ -1,10 -1,9 +1,13 @@@import { useCallback, useEffect, useRef, useState } from "react";- import type { RecorderStatus } from "../common/ipc";+ import type {+ MicrophoneSettingsStatus,+ RecorderStatus,+ } from "../common/ipc";+import {+ DEFAULT_NARRATION_LANGUAGE,+ narrationLanguageLabel,+} from "../common/narration";import { formatMs } from "./format";export function RecordingControls() {@@@ -95,9 -167,10 +171,13 @@@const lifecycleBusy = finishPending !== null || transitionBusy || !recording;const microphoneOn = status?.microphone.state === "on";const microphoneError = status?.microphone.state === "error";+ const narrationLanguage = narrationLanguageLabel(+ status?.narrationLanguage ?? DEFAULT_NARRATION_LANGUAGE,+ );+ const activeMicrophoneLabel =+ status?.microphone.activeDevice?.label ??+ microphoneSettings?.selectedDeviceLabel ??+ "System default";const microphoneLabel =status?.microphone.state === "starting"? "Starting"@@@ -171,25 -314,49 +321,49 @@@<span className="recording-divider" aria-hidden />- <button- className={`recording-microphone ${microphoneOn ? "on" : ""} ${- microphoneError ? "error" : ""- }`}- disabled={lifecycleBusy || microphoneBusy}- aria-label={- microphoneOn- ? `Turn microphone off. Narration is transcribed in ${narrationLanguage}.`- : microphoneError- ? `Retry microphone. ${status?.microphone.error ?? ""}`- : `Turn microphone on for ${narrationLanguage} narration`- }- aria-pressed={microphoneOn}- title={`Microphone ${microphoneOn ? "on" : "off"} · ${narrationLanguage} transcript`}- onClick={() => void toggleMicrophone()}+ <div+ ref={microphoneControlRef}+ className={`recording-microphone-split ${+ microphoneOn ? "on" : ""+ } ${microphoneError ? "error" : ""}`}>- <MicrophoneIcon off={!microphoneOn} />- <span>{microphoneLabel}</span>- </button>+ <button+ className="recording-microphone"+ disabled={lifecycleBusy || microphoneBusy}+ aria-label={+ microphoneOn- ? `Mute ${activeMicrophoneLabel}`++ ? `Mute ${activeMicrophoneLabel}. Narration is transcribed in ${narrationLanguage}.`+ : microphoneError+ ? `Retry microphone. ${status?.microphone.error ?? ""}`- : `Unmute ${microphoneSettings?.selectedDeviceLabel ?? "System default"}`++ : `Unmute ${microphoneSettings?.selectedDeviceLabel ?? "System default"} for ${narrationLanguage} narration`+ }+ aria-pressed={microphoneOn}+ title={+ microphoneOn- ? `Mute ${activeMicrophoneLabel}`- : `Unmute ${microphoneSettings?.selectedDeviceLabel ?? "System default"}`++ ? `Mute ${activeMicrophoneLabel} · ${narrationLanguage} transcript`++ : `Unmute ${microphoneSettings?.selectedDeviceLabel ?? "System default"} · ${narrationLanguage} transcript`+ }+ onClick={() => void toggleMicrophone()}+ >+ <MicrophoneIcon off={!microphoneOn} />+ <span>{microphoneLabel}</span>+ </button>+ <button+ className="recording-microphone-menu-toggle"+ disabled={lifecycleBusy || microphoneBusy}+ aria-label="Choose microphone"+ aria-haspopup="dialog"+ aria-expanded={showMicrophoneMenu}+ title="Choose microphone"+ onClick={() => {+ setActionError(null);+ setConfirmDiscard(false);+ setShowMicrophoneMenu((open) => !open);+ }}+ >+ <ChevronIcon open={showMicrophoneMenu} />+ </button>+ </div><buttonclassName="recording-discard"diff --cc src/WhatsRecorded.tsxindex aec03a4,60b1790..7d61266--- a/src/WhatsRecorded.tsx+++ b/src/WhatsRecorded.tsx@@@ -82,10 -88,9 +88,10 @@@ export function WhatsRecorded({ onClos</li><li>The recording can be turned into text on this computer using an offline model. The- first transcription needs a one-time ~250 MB download that you choose when to start.+ transcript stays in the language you select from Whisper's 99 supported choices. The+ first transcription needs a one-time ~252 MB download that you choose when to start.</li>- <li>Leave the microphone off and it is never touched.</li>+ <li>Leave Narrate and the recording-bar microphone off and no microphone is opened.</li></ul></section>