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): configurable voice idle-disconnect, default 45s→3min (rt-9 follow-up; voice-Michael request)
Chaitanya Giriea45e12db58b
diff --git a/src/main/config.ts b/src/main/config.tsindex 445222df..b0890f00 100644--- a/src/main/config.ts+++ b/src/main/config.ts@@ -264,6 +264,11 @@ export interface HarnessConfig {* because an OpenAI key exists (that key is shared with the CLI engines).* Default off; absence ⇒ mic denied, mirroring `freeflowEnabled`. */realtimeVoiceEnabled?: boolean;+ /** How long (ms) a realtime voice session may sit with no voice activity before+ * it auto-disconnects (the rt-9 idle guard). Default 180000 (3 min). 0 = never+ * auto-disconnect on idle — the spend cap remains the runaway guard. The user+ * tunes this in Settings → Realtime Michael. */+ realtimeIdleDisconnectMs?: number;// ─── Generic inbound webhook + status API ──────────────────────────────────/** Master toggle for the generic webhook HTTP API (POST → work, GET → status). */@@ -324,6 +329,7 @@ const DEFAULTS: HarnessConfig = {groqApiKey: undefined,freeflowModel: 'whisper-large-v3-turbo',realtimeVoiceEnabled: false,+ realtimeIdleDisconnectMs: 180_000,webhookEnabled: false,webhookSecret: undefined,webhookPort: undefined,diff --git a/src/preload/index.ts b/src/preload/index.tsindex b3747d17..808fb498 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -206,6 +206,9 @@ export interface HarnessConfig {* (renderer session sets it at start()/stop()); the main mic permission gate* reads it. Default off. */realtimeVoiceEnabled?: boolean;+ /** Realtime voice idle auto-disconnect (ms); default 180000 (3 min), 0 = never.+ * Tuned in Settings → Realtime Michael; the cost cap stays the runaway guard. */+ realtimeIdleDisconnectMs?: number;costCapUsd?: number;costCapTokens?: number;agentTokenCaps?: Record<string, number>;diff --git a/src/renderer/src/realtime/session.ts b/src/renderer/src/realtime/session.tsindex ac3e6e2e..eea1d89a 100644--- a/src/renderer/src/realtime/session.ts+++ b/src/renderer/src/realtime/session.ts@@ -101,8 +101,10 @@ let offCompletion: (() => void) | null = null;/** rt-9 cost guard: periodic tick that auto-disconnects on hard cost cap or after an* idle open mic (curbs runaway audio spend on a forgotten session). */let costGuardTimer: ReturnType<typeof setInterval> | null = null;-/** Auto-disconnect after this long with no voice activity (Oscar's rt-9 guidance). */-const IDLE_DISCONNECT_MS = 45_000;+/** Default idle auto-disconnect window (ms) when config has none. Raised from the+ * original 45s to 3 min so a normal thinking/reading pause no longer drops the+ * call; the user tunes it (or turns it off) via config.realtimeIdleDisconnectMs. */+const DEFAULT_IDLE_DISCONNECT_MS = 180_000;const COST_GUARD_TICK_MS = 10_000;/** N3-seam (rt-10 hardening): a completion summary carries dispatch objective text.@@ -360,12 +362,15 @@ export async function connect(): Promise<void> {}});// rt-9 cost guard: periodically stop the session if the hard cap is hit, or after an- // idle open mic, so a forgotten session doesn't bleed audio cost. disconnect() clears- // this timer + tears everything down.+ // idle open mic, so a forgotten session doesn't bleed audio cost. The idle window is+ // user-configurable (config.realtimeIdleDisconnectMs; default 3 min; 0 = never — the+ // cost cap stays the runaway guard). disconnect() clears this timer + tears down.+ const idleCfg = (await window.cth.getConfig()).realtimeIdleDisconnectMs;+ const idleMs = typeof idleCfg === 'number' ? idleCfg : DEFAULT_IDLE_DISCONNECT_MS;costGuardTimer = setInterval(() => {if (!session) return;- if (getRealtimeCostSnapshot().overCap) { disconnect(); return; }- if (isRealtimeIdle(IDLE_DISCONNECT_MS, Date.now())) disconnect();+ if (getRealtimeCostSnapshot().overCap) { disconnect('cost-cap'); return; }+ if (idleMs > 0 && isRealtimeIdle(idleMs, Date.now())) disconnect('idle');}, COST_GUARD_TICK_MS);setState({status: 'listening',@@ -375,6 +380,7 @@ export async function connect(): Promise<void> {});} catch (e) {// Mic permission denied, WebRTC handshake failure, network, etc.+ console.log('[realtime] voice session disconnect (error)');try {session?.close();} catch {@@ -390,8 +396,11 @@ export async function connect(): Promise<void> {}}-/** Tear down the voice loop and return to `off`. Safe to call when already off. */-export function disconnect(): void {+/** Tear down the voice loop and return to `off`. Safe to call when already off.+ * `reason` (idle | cost-cap | error | user) is logged so an idle auto-off can be+ * told apart from a spend-cap stop or a user toggle. */+export function disconnect(reason: string = 'user'): void {+ console.log(`[realtime] voice session disconnect (${reason})`);try {session?.close();} catch {