Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
fix(web): start each recording with the microphone on
muterC068d098249dd
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 123017bd..47fb6774 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -109,6 +109,10 @@ build:assets` to check the initial JS budget.Recording moves one portal host between documents so paused state, Askdrafts and transcript scroll survive the move. Hide it while classifying anative close, and ignore a late result after unmount or a replacement window.+- Pausing a recording mutes the shared microphone for that recording only:+ the microphone track can outlive it, so a new recording turns the+ microphone back on before it starts, and Start on a running paused+ recording keeps it paused.- Gmail and Outlook message approvals show the subject and recipients once.The subject row toggles the preview and owns its hover highlight; therecipient line stays outside the control. The shared AutoHeight transitiondiff --git a/apps/web/src/features/rooms/voice-control/use-voice-capture-commands.ts b/apps/web/src/features/rooms/voice-control/use-voice-capture-commands.tsindex e4312cc7..af64ce5e 100644--- a/apps/web/src/features/rooms/voice-control/use-voice-capture-commands.ts+++ b/apps/web/src/features/rooms/voice-control/use-voice-capture-commands.ts@@ -30,6 +30,7 @@ interface VoiceCaptureCommandsInput {navigate: NavigateFunction;enable: (automatic?: boolean) => Promise<void>;ensureTarget: (activeRoomOverride?: string) => Promise<VoiceTarget>;+ setMicrophoneMuted: (muted: boolean) => Promise<void>;}/** Starts, restarts and stops hardware Captures. */@@ -40,6 +41,7 @@ export function useVoiceCaptureCommands({navigate,enable,ensureTarget,+ setMicrophoneMuted,}: VoiceCaptureCommandsInput) {const {refs,@@ -71,6 +73,10 @@ export function useVoiceCaptureCommands({if (!session) throw new Error("VoiceSession is unavailable");if (refs.captureRef.current && isActiveCapture(refs.captureRef.current))return refs.captureRef.current;+ // Pausing mutes the shared microphone, and that outlives the Capture it+ // paused; a new Capture starts with the microphone on, as its window shows.+ if (refs.microphoneMutedRef.current) await setMicrophoneMuted(false);+ controller.signal.throwIfAborted();const generation = refs.voiceSessionGenerationRef.current;const previousCaptureId = refs.captureRef.current?.id;const isCurrent = () =>@@ -125,6 +131,7 @@ export function useVoiceCaptureCommands({runtime.client,setCapture,setCaptureSyncStatus,+ setMicrophoneMuted,tenantId,]);diff --git a/apps/web/src/features/rooms/voice-control/voice-control-provider.test.tsx b/apps/web/src/features/rooms/voice-control/voice-control-provider.test.tsxindex 15dbf28e..d1c94cf6 100644--- a/apps/web/src/features/rooms/voice-control/voice-control-provider.test.tsx+++ b/apps/web/src/features/rooms/voice-control/voice-control-provider.test.tsx@@ -42,6 +42,8 @@ const media = vi.hoisted(() => ({listeners: new Map<string, () => void>(),publish: vi.fn(async () => undefined),stop: vi.fn(),+ mute: vi.fn(async () => undefined),+ unmute: vi.fn(async () => undefined),disconnect: vi.fn(async () => undefined),unpublish: vi.fn<() => Promise<void>>(async () => undefined),tracks: [] as EventTarget[],@@ -75,6 +77,8 @@ vi.mock("livekit-client", () => ({media.tracks.push(track);return {stop: media.stop,+ mute: media.mute,+ unmute: media.unmute,mediaStreamTrack: track,setDeviceId: async () => undefined,};@@ -126,6 +130,10 @@ function ListenerState({ autoEnable = true }: { autoEnable?: boolean }) {<button onClick={() => void voice.startCapture()}>Start</button><button onClick={() => void voice.startNewCapture()}>Start new</button><button onClick={() => void voice.stopCapture()}>Stop</button>+ <button onClick={() => void voice.setMicrophoneMuted(true)}>Pause</button>+ <div aria-label="microphone">+ {voice.microphoneMuted ? "muted" : "on"}+ </div><div aria-label="transcript">{voice.transcriptItems.map((item) => (<p key={item.id}>{item.text}</p>@@ -1172,6 +1180,61 @@ describe("LiveKit voice input lifecycle", () => {view.unmount();});+ it("starts a new Capture with the microphone on after the previous one ended paused", async () => {+ const runtime = createTestTeamHubRuntime();+ const accepted = acceptVoice(runtime);++ const start = spyVoiceRoute(+ runtime,+ accepted,+ "POST",+ "/v0/voice-sessions/{voiceSessionId}/captures",+ );+ const view = render(+ <TeamHubRuntimeProvider runtime={runtime}>+ <MemoryRouter>+ <LiveKitVoiceControlProvider tenantId="tenant-northstar">+ <ListenerState />+ </LiveKitVoiceControlProvider>+ </MemoryRouter>+ </TeamHubRuntimeProvider>,+ );+ await waitFor(() =>+ expect(screen.getByRole("status")).toHaveTextContent("listening"),+ );+ fireEvent.click(screen.getByRole("button", { name: "Start" }));+ await waitFor(() =>+ expect(screen.getByLabelText("capture")).toHaveTextContent("recording:"),+ );+ fireEvent.click(screen.getByRole("button", { name: "Pause" }));+ await waitFor(() =>+ expect(screen.getByLabelText("microphone")).toHaveTextContent("muted"),+ );+ expect(media.mute).toHaveBeenCalledOnce();+ // Start on the Capture that is still running keeps its pause.+ fireEvent.click(screen.getByRole("button", { name: "Start" }));+ await waitFor(() => expect(start).toHaveBeenCalledOnce());+ expect(media.unmute).not.toHaveBeenCalled();++ fireEvent.click(screen.getByRole("button", { name: "Stop" }));+ await waitFor(() =>+ expect(screen.getByLabelText("capture")).toHaveTextContent("completed:"),+ );+ expect(media.unmute).not.toHaveBeenCalled();+ fireEvent.click(screen.getByRole("button", { name: "Start new" }));+ await waitFor(() => expect(start).toHaveBeenCalledTimes(2));+ await waitFor(() =>+ expect(screen.getByLabelText("capture")).toHaveTextContent("recording:"),+ );+ expect(screen.getByLabelText("microphone")).toHaveTextContent("on");+ expect(media.unmute).toHaveBeenCalledOnce();+ // The recorder and transcription hear the new Capture from its first moment.+ expect(media.unmute.mock.invocationCallOrder[0]).toBeLessThan(+ start.mock.invocationCallOrder[1]!,+ );+ view.unmount();+ });+it("ignores a delayed Human Stop acknowledgement after polling finishes it and a new Capture starts", async () => {const runtime = createTestTeamHubRuntime();const accepted = acceptVoice(runtime);diff --git a/apps/web/src/features/rooms/voice-control/voice-control-provider.tsx b/apps/web/src/features/rooms/voice-control/voice-control-provider.tsxindex 5e88b934..0680dd4a 100644--- a/apps/web/src/features/rooms/voice-control/voice-control-provider.tsx+++ b/apps/web/src/features/rooms/voice-control/voice-control-provider.tsx@@ -81,6 +81,13 @@ function useVoiceControlProviderValue(restoreActiveCapture,});useVoiceCapturePolling(state, runtime, cleanupMedia);+ const {+ discoverDevices,+ selectDevice,+ connectDevice,+ setMicrophoneMuted,+ disable,+ } = useVoiceDevices(state, tenantId, enable, cleanupMedia);const { startCapture, startNewCapture, stopCapture } =useVoiceCaptureCommands({state,@@ -89,14 +96,8 @@ function useVoiceControlProviderValue(navigate,enable,ensureTarget,+ setMicrophoneMuted,});- const {- discoverDevices,- selectDevice,- connectDevice,- setMicrophoneMuted,- disable,- } = useVoiceDevices(state, tenantId, enable, cleanupMedia);const { leavePage, disconnectDevice } = useVoiceSessionLifecycle(state,runtime,