diff --git a/Justfile b/Justfile index a0ea8397dfe2..c4a71219a4b6 100644 --- a/Justfile +++ b/Justfile @@ -162,6 +162,16 @@ debug-ui-main-process: npm install && \ npm run start-gui-debug +# Package the desktop app locally for testing (macOS) +# Applies ad-hoc code signing with entitlements (needed for mic access, etc.) +package-ui: + @just release-binary + @echo "Packaging desktop app..." + cd ui/desktop && npm install && npm run package + @echo "Signing with entitlements..." + codesign --force --deep --sign - --entitlements ui/desktop/entitlements.plist ui/desktop/out/Goose-darwin-arm64/Goose.app + @echo "Done! Launch with: open ui/desktop/out/Goose-darwin-arm64/Goose.app" + # Run UI with alpha changes run-ui-alpha: @just release-binary diff --git a/crates/goose/src/dictation/providers.rs b/crates/goose/src/dictation/providers.rs index 356c1f61d755..37d864107c8f 100644 --- a/crates/goose/src/dictation/providers.rs +++ b/crates/goose/src/dictation/providers.rs @@ -222,6 +222,8 @@ pub async fn transcribe_with_provider( anyhow::bail!("Invalid API key"); } else if status == 429 || error_text.contains("quota") { anyhow::bail!("Rate limit exceeded"); + } else if error_text.contains("too short") { + return Ok(String::new()); } else { anyhow::bail!("API error: {}", error_text); } diff --git a/ui/desktop/src/audio-capture-worklet.js b/ui/desktop/public/audio-capture-worklet.js similarity index 100% rename from ui/desktop/src/audio-capture-worklet.js rename to ui/desktop/public/audio-capture-worklet.js diff --git a/ui/desktop/src/hooks/useAudioRecorder.ts b/ui/desktop/src/hooks/useAudioRecorder.ts index ef218e063f27..5e53cac17713 100644 --- a/ui/desktop/src/hooks/useAudioRecorder.ts +++ b/ui/desktop/src/hooks/useAudioRecorder.ts @@ -16,8 +16,9 @@ const MIN_SPEECH_MS = 200; // without clipping early speech onsets. Determined empirically for 16kHz mono input. const RMS_THRESHOLD = 0.015; -// Import the worklet module - Vite will handle this correctly -const WORKLET_URL = new URL('../audio-capture-worklet.js', import.meta.url).href; +// Resolve worklet URL at runtime from window.location so it works under both +// the dev server (http://localhost) and packaged builds (file://). +const WORKLET_URL = new URL('audio-capture-worklet.js', window.location.href.split('#')[0]).href; function encodeWav(samples: Float32Array, sampleRate: number): ArrayBuffer { const buf = new ArrayBuffer(44 + samples.length * 2);