Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(voice): remove retired PTT and dictation hotkey commands

Steven Enamakel130fa4d5092a
diff --git a/app/src/store/__tests__/userScopedStorage.test.ts b/app/src/store/__tests__/userScopedStorage.test.ts
index 9eb52e6139..b9b528cca6 100644
--- a/app/src/store/__tests__/userScopedStorage.test.ts
+++ b/app/src/store/__tests__/userScopedStorage.test.ts
@@ -91,6 +91,22 @@ describe('userScopedStorage', () => {
}
});
+ test('boot purges a legacy PTT blob and initializes the store without it', async () => {
+ localStorage.setItem(ACTIVE_USER_KEY, 'user-123');
+ localStorage.setItem('persist:ptt', JSON.stringify({ shortcut: 'F13' }));
+ localStorage.setItem('user-123:persist:ptt', JSON.stringify({ shortcut: 'F14' }));
+
+ const storage = await importModule();
+ storage.primeActiveUserId('user-123');
+
+ expect(localStorage.getItem('persist:ptt')).toBeNull();
+ expect(localStorage.getItem('user-123:persist:ptt')).toBeNull();
+ expect(await storage.userScopedStorage.getItem('persist:ptt')).toBeNull();
+
+ const { store } = await import('../index');
+ expect(store.getState()).not.toHaveProperty('ptt');
+ });
+
test('userScopedStorage redacts auth/session tokens before persisting redux blobs (#1938)', async () => {
const mod = await importModule();
mod.primeActiveUserId('user-123');
diff --git a/app/src/store/userScopedStorage.ts b/app/src/store/userScopedStorage.ts
index b4368e5a93..6522f7c469 100644
--- a/app/src/store/userScopedStorage.ts
+++ b/app/src/store/userScopedStorage.ts
@@ -31,6 +31,17 @@ function safeGetActiveUserIdSync(): string | null {
let activeUserId: string | null = safeGetActiveUserIdSync();
+function purgeRetiredPttPersistKey(userId: string | null): void {
+ try {
+ localStorage.removeItem('persist:ptt');
+ if (userId) localStorage.removeItem(`${userId}:persist:ptt`);
+ } catch {
+ // best-effort cleanup for a preference that no longer has a consumer
+ }
+}
+
+purgeRetiredPttPersistKey(activeUserId);
+
// Recover from a prior buggy build that moved `persist:coreMode` into the
// user-scoped namespace via `migrateLegacyPersistKeys`. The unscoped key is
// authoritative; if it's missing but a scoped copy exists, copy it back so
@@ -89,6 +100,7 @@ export function primeActiveUserId(id: string | null): void {
primed = true;
if (id) {
activeUserId = id;
+ purgeRetiredPttPersistKey(id);
try {
localStorage.setItem(ACTIVE_USER_KEY, id);
} catch {
@@ -97,6 +109,7 @@ export function primeActiveUserId(id: string | null): void {
} else {
// Don't wipe — keep whatever a prior session wrote.
activeUserId = safeGetActiveUserIdSync();
+ purgeRetiredPttPersistKey(activeUserId);
}
activeUserIdResolve();
}
@@ -120,6 +133,7 @@ export function getActiveUserId(): string | null {
export function setActiveUserId(id: string | null): void {
const previous = activeUserId;
activeUserId = id;
+ purgeRetiredPttPersistKey(id);
try {
if (id) {
localStorage.setItem(ACTIVE_USER_KEY, id);
diff --git a/app/src/utils/tauriCommands/voice.ts b/app/src/utils/tauriCommands/voice.ts
index 1f199aa459..e23a183f1b 100644
--- a/app/src/utils/tauriCommands/voice.ts
+++ b/app/src/utils/tauriCommands/voice.ts
@@ -1,10 +1,8 @@
/**
* Voice and dictation commands.
*/
-import { invoke } from '@tauri-apps/api/core';
-
import { callCoreRpc } from '../../services/coreRpcClient';
-import { CommandResponse, isTauri } from './common';
+import { CommandResponse } from './common';
import { ConfigSnapshot } from './config';
export interface VoiceSpeechResult {
@@ -38,18 +36,7 @@ export interface VoiceStatus {
tts_provider: string;
}
-export interface VoiceServerStatus {
- state: 'stopped' | 'idle' | 'recording' | 'transcribing';
- hotkey: string;
- activation_mode: 'tap' | 'push';
- transcription_count: number;
- last_error: string | null;
-}
-
export interface VoiceServerSettings {
- auto_start: boolean;
- hotkey: string;
- activation_mode: 'tap' | 'push';
skip_cleanup: boolean;
min_duration_secs: number;
/** RMS energy threshold for silence detection. Recordings below this are
@@ -71,31 +58,6 @@ export async function openhumanVoiceStatus(): Promise<VoiceStatus> {
return await callCoreRpc<VoiceStatus>({ method: 'openhuman.voice_status', params: {} });
}
-export async function openhumanVoiceServerStatus(): Promise<VoiceServerStatus> {
- return await callCoreRpc<VoiceServerStatus>({
- method: 'openhuman.voice_server_status',
- params: {},
- });
-}
-
-export async function openhumanVoiceServerStart(params?: {
- hotkey?: string;
- activation_mode?: 'tap' | 'push';
- skip_cleanup?: boolean;
-}): Promise<VoiceServerStatus> {
- return await callCoreRpc<VoiceServerStatus>({
- method: 'openhuman.voice_server_start',
- params: params ?? {},
- });
-}
-
-export async function openhumanVoiceServerStop(): Promise<VoiceServerStatus> {
- return await callCoreRpc<VoiceServerStatus>({
- method: 'openhuman.voice_server_stop',
- params: {},
- });
-}
-
export async function openhumanGetVoiceServerSettings(): Promise<
CommandResponse<VoiceServerSettings>
> {
@@ -106,9 +68,6 @@ export async function openhumanGetVoiceServerSettings(): Promise<
}
export async function openhumanUpdateVoiceServerSettings(update: {
- auto_start?: boolean;
- hotkey?: string;
- activation_mode?: 'tap' | 'push';
skip_cleanup?: boolean;
min_duration_secs?: number;
silence_threshold?: number;
@@ -185,61 +144,3 @@ export async function openhumanVoiceTts(
});
}
-/**
- * Register (or re-register) the global dictation toggle hotkey.
- */
-export async function registerDictationHotkey(shortcut: string): Promise<void> {
- if (!isTauri()) {
- console.debug('[dictation] registerDictationHotkey: skipped — not running in Tauri');
- return;
- }
- const normalizedShortcut = shortcut
- .trim()
- .replace(/\bCommandOrControl\b/gi, 'CmdOrCtrl')
- .replace(/\bCommand\b/gi, 'Cmd')
- .replace(/\bControl\b/gi, 'Ctrl')
- .replace(/\bOption\b/gi, 'Alt');
-
- console.debug(
- '[dictation] registerDictationHotkey: shortcut=%s normalized=%s',
- shortcut,
- normalizedShortcut
- );
- try {
- await invoke<void>('register_dictation_hotkey', { shortcut: normalizedShortcut });
- } catch (err) {
- console.warn('[dictation] registerDictationHotkey normalized registration failed', err);
- throw err;
- }
- console.debug('[dictation] registerDictationHotkey: done');
-}
-
-/**
- * Notify the overlay of a voice/STT state change from the chat prompt button.
- * Fire-and-forget — errors are logged but never propagated.
- */
-export const notifyOverlaySttState = (
- state: 'recording_started' | 'transcription_done' | 'cancelled' | 'error',
- text?: string
-): void => {
- void (async () => {
- try {
- await callCoreRpc({ method: 'openhuman.overlay_stt_notify', params: { state, text } });
- } catch (err: unknown) {
- console.debug('[overlay_stt_notify] fire-and-forget error:', err);
- }
- })();
-};
-
-/**
- * Unregister the global dictation hotkey if one is active.
- */
-export async function unregisterDictationHotkey(): Promise<void> {
- if (!isTauri()) {
- console.debug('[dictation] unregisterDictationHotkey: skipped — not running in Tauri');
- return;
- }
- console.debug('[dictation] unregisterDictationHotkey: invoking');
- await invoke<void>('unregister_dictation_hotkey');
- console.debug('[dictation] unregisterDictationHotkey: done');
-}