an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
feat(realtime): microphone device picker in Settings (rt-8, Realtime Michael P1)
Chaitanya Giric76a09be7e40
diff --git a/src/renderer/src/components/SettingsModal.tsx b/src/renderer/src/components/SettingsModal.tsxindex 31c8c077..1182c6e8 100644--- a/src/renderer/src/components/SettingsModal.tsx+++ b/src/renderer/src/components/SettingsModal.tsx@@ -8,6 +8,7 @@ import { OfficeThemePicker } from './OfficeThemePicker';import { McpDefaultsSettings } from './McpDefaultsSettings';import { IntegrationsRegistry } from './IntegrationsRegistry';import { AiEnginesSettings } from './AiEnginesSettings';+import { RealtimeDevicePicker } from '@/realtime/DevicePicker';export interface SettingsModalProps {config: HarnessConfig;@@ -1184,6 +1185,28 @@ export function SettingsModal({ config, onClose }: SettingsModalProps) {</div>)}</div>++ <div style={{ height: 2, background: 'var(--cth-ink-300)' }} />++ {/* Realtime Michael — voice device selection (rt-8) */}+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>+ <div style={{+ fontFamily: 'var(--cth-font-display)', fontSize: 8, lineHeight: '12px',+ color: 'var(--cth-ink-500)', textTransform: 'uppercase', marginBottom: 2+ }}>+ Realtime Michael+ </div>+ <div style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>+ <span style={{ fontSize: 14, lineHeight: '20px', color: 'var(--cth-ink-900)' }}>+ Voice chat with Michael+ </span>+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>+ Talk to the orchestrator in real time. Toggle it on from Michael's tab; pick which+ microphone the voice loop uses here.+ </span>+ </div>+ <RealtimeDevicePicker />+ </div></>)}diff --git a/src/renderer/src/realtime/DevicePicker.tsx b/src/renderer/src/realtime/DevicePicker.tsxnew file mode 100644index 00000000..1008ed77--- /dev/null+++ b/src/renderer/src/realtime/DevicePicker.tsx@@ -0,0 +1,99 @@+/**+ * Realtime Michael — microphone device picker (card rt-8, Phase 1).+ *+ * Lets the user choose WHICH microphone the voice loop captures. The selection is+ * held in the realtime session store via `setDeviceId()` (see session.ts) and+ * applied on the next connect() — rt-2's getUserMedia passes it as+ * `{ deviceId: { exact } }`, falling back to the system default if it's stale.+ *+ * `enumerateDevices()` only returns device LABELS once the page has been granted+ * mic access at least once (our main-process gate opens while a voice session or+ * Free Flow is live — see src/main/index.ts). Before that we show generic+ * "Microphone N" names and a hint, so the picker is still usable cold.+ *+ * Speaker/output selection is a fast-follow: it needs the session to expose an+ * output setter that calls `audioEl.setSinkId()` (rt-2). Until that lands this+ * picker covers the input side, which is what getUserMedia consumes.+ *+ * Branch feat/realtime-michael. See board.md "🎙 REALTIME MICHAEL".+ */+import { useCallback, useEffect, useState } from 'react';+import { useRealtimeMichael } from './session';++interface AudioInput {+ deviceId: string;+ label: string;+}++/** Enumerate audio-input devices, with a generic fallback label when the real+ * label is hidden (no mic permission granted yet this session). */+async function listMicrophones(): Promise<AudioInput[]> {+ if (typeof navigator === 'undefined' || !navigator.mediaDevices?.enumerateDevices) return [];+ const devices = await navigator.mediaDevices.enumerateDevices();+ return devices+ .filter((d) => d.kind === 'audioinput')+ .map((d, i) => ({ deviceId: d.deviceId, label: d.label || `Microphone ${i + 1}` }));+}++const labelStyle: React.CSSProperties = {+ fontFamily: 'var(--cth-font-display)',+ fontSize: 8,+ lineHeight: '12px',+ color: 'var(--cth-ink-500)',+ textTransform: 'uppercase'+};+const selectStyle: React.CSSProperties = {+ fontFamily: 'var(--cth-font-mono)',+ fontSize: 13,+ padding: '6px 8px',+ border: '2px solid var(--cth-ink-300)',+ background: 'var(--cth-paper-100)',+ color: 'var(--cth-ink-900)'+};++export function RealtimeDevicePicker(): React.ReactElement {+ const { deviceId, setDeviceId } = useRealtimeMichael();+ const [mics, setMics] = useState<AudioInput[]>([]);+ /** True once at least one device exposes a real label ⇒ mic permission granted. */+ const [labelled, setLabelled] = useState(false);++ const refresh = useCallback(async () => {+ const list = await listMicrophones();+ setMics(list);+ setLabelled(list.some((m) => m.label && !/^Microphone \d+$/.test(m.label)));+ }, []);++ useEffect(() => {+ void refresh();+ // Hot-plug / unplug a mic, or a permission grant that reveals labels → re-list.+ const md = typeof navigator !== 'undefined' ? navigator.mediaDevices : undefined;+ if (!md) return;+ const onChange = (): void => void refresh();+ md.addEventListener?.('devicechange', onChange);+ return () => md.removeEventListener?.('devicechange', onChange);+ }, [refresh]);++ return (+ <div style={{ display: 'flex', flexDirection: 'column', gap: 6, width: 280 }}>+ <span style={labelStyle}>Microphone</span>+ <select+ value={deviceId ?? ''}+ onChange={(e) => setDeviceId(e.target.value || null)}+ style={selectStyle}+ >+ <option value="">System default</option>+ {mics.map((m) => (+ <option key={m.deviceId} value={m.deviceId}>+ {m.label}+ </option>+ ))}+ </select>+ {!labelled && (+ <span style={{ fontSize: 12, lineHeight: '16px', color: 'var(--cth-ink-500)' }}>+ Microphone names appear after you first start a voice session and grant mic access.+ The choice applies the next time Michael connects. Speaker selection is coming soon.+ </span>+ )}+ </div>+ );+}