Skip to content

Inline worklet source#7128

Merged
katzdave merged 3 commits intomainfrom
inline-worklet-source
Feb 10, 2026
Merged

Inline worklet source#7128
katzdave merged 3 commits intomainfrom
inline-worklet-source

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Feb 10, 2026

Summary

Makes the worklet, eh, work. also adds a rule to the justfile to adhoc sign the packaged version so we can test this locally

Douwe Osinga added 3 commits February 10, 2026 18:00
AudioWorklet.addModule() fetches the script independently, and Vite was
inlining the small JS file as a data: URI which gets blocked by the
Content-Security-Policy (script-src 'self'). Moving the worklet to
public/ ensures it is served as a same-origin static asset, no CSP
changes needed.
Move the worklet file to public/ so Vite copies it to the build output
root next to index.html. Resolve its URL at runtime using
window.location.href (stripping the hash from HashRouter) so it works
both on the dev server (http://localhost) and under file:// in packaged
Electron builds.

The previous approach used Vite's new URL(path, import.meta.url) which
gets transformed at build time into a data: URI that CSP blocks.
Copilot AI review requested due to automatic review settings February 10, 2026 21:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes AudioWorklet loading for the desktop UI across both dev-server and packaged (file://) builds by switching to a public worklet file and resolving its URL at runtime, and includes small supporting tweaks for local packaging and dictation error handling.

Changes:

  • Resolve the AudioWorklet module URL from window.location to support http:// (dev) and file:// (packaged) origins.
  • Add a new public/audio-capture-worklet.js AudioWorklet processor used by the recorder.
  • Treat provider “too short” transcription errors as an empty transcription, and add a Justfile helper target to package + ad-hoc sign the macOS app locally.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
ui/desktop/src/hooks/useAudioRecorder.ts Adjusts how the worklet module URL is computed so it loads in packaged builds.
ui/desktop/public/audio-capture-worklet.js Introduces the AudioWorkletProcessor module used to stream audio samples to the UI thread.
crates/goose/src/dictation/providers.rs Adds special handling to return an empty transcription when the provider reports audio is too short.
Justfile Adds a package-ui target to package and ad-hoc sign the macOS desktop app for local testing.

Comment on lines +172 to +173
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"
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package-ui hard-codes the output path to out/Goose-darwin-arm64/Goose.app, which will fail on Intel Macs (and if electron-forge output naming changes); consider deriving the directory from uname -m/an env var or using a glob to locate the packaged .app.

Suggested change
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"
APP_PATH=$(printf '%s\n' ui/desktop/out/Goose-darwin-*/Goose.app | head -n 1) && \
if [ ! -d "$APP_PATH" ]; then echo "Error: packaged app not found under ui/desktop/out"; exit 1; fi && \
codesign --force --deep --sign - --entitlements ui/desktop/entitlements.plist "$APP_PATH"
@echo "Done! Launch with: open $(printf '%s\n' ui/desktop/out/Goose-darwin-*/Goose.app | head -n 1)"

Copilot uses AI. Check for mistakes.
@katzdave katzdave added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit 426f8e0 Feb 10, 2026
28 checks passed
@katzdave katzdave deleted the inline-worklet-source branch February 10, 2026 22:37
katzdave pushed a commit that referenced this pull request Feb 10, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
tlongwell-block added a commit that referenced this pull request Feb 11, 2026
* origin/main: (107 commits)
  feat: Allow overriding default bat themes using environment variables (#7140)
  Make the system prompt smaller (#6991)
  Pre release script (#7145)
  Spelling (#7137)
  feat(mcp): upgrade rmcp to 0.15.0 and advertise MCP Apps UI extension capability (#6927)
  fix: ensure assistant messages with tool_calls include content field (#7076)
  fix(canonical): handle gcp_vertex_ai model mapping correctly (#6836)
  Group dependencies in root Cargo.toml (#6948)
  refactor: updated elevenLabs API module and `remove button` UX (#6781)
  fix: we were missing content from langfuse traces (#7135)
  docs: update username in authors.yml (#7132)
  fix extension selector syncing issues (#7133)
  fix(acp): per-session Agent for model isolation and load_session restore (#7115)
  fix(claude-code): defensive coding improvements for model switching (#7131)
  feat(claude-code): dynamic model listing and mid-session model switching (#7120)
  Inline worklet source (#7128)
  [docs] One shot prompting is dead - Blog Post (#7113)
  fix: correct spelling of Debbie O'Brien's name in authors.yml (#7127)
  docs: GCP Vertex AI org policy filtering & update OnboardingProviderSetup component (#7125)
  feat: replace subagent and skills with unified summon extension (#6964)
  ...

# Conflicts:
#	Cargo.lock
#	Cargo.toml
zanesq added a commit to Abhijay007/goose that referenced this pull request Feb 11, 2026
* upstream/main: (109 commits)
  [docs] Skills Marketplace UI Improvements (block#7158)
  More no-window flags (block#7122)
  feat: Allow overriding default bat themes using environment variables (block#7140)
  Make the system prompt smaller (block#6991)
  Pre release script (block#7145)
  Spelling (block#7137)
  feat(mcp): upgrade rmcp to 0.15.0 and advertise MCP Apps UI extension capability (block#6927)
  fix: ensure assistant messages with tool_calls include content field (block#7076)
  fix(canonical): handle gcp_vertex_ai model mapping correctly (block#6836)
  Group dependencies in root Cargo.toml (block#6948)
  refactor: updated elevenLabs API module and `remove button` UX (block#6781)
  fix: we were missing content from langfuse traces (block#7135)
  docs: update username in authors.yml (block#7132)
  fix extension selector syncing issues (block#7133)
  fix(acp): per-session Agent for model isolation and load_session restore (block#7115)
  fix(claude-code): defensive coding improvements for model switching (block#7131)
  feat(claude-code): dynamic model listing and mid-session model switching (block#7120)
  Inline worklet source (block#7128)
  [docs] One shot prompting is dead - Blog Post (block#7113)
  fix: correct spelling of Debbie O'Brien's name in authors.yml (block#7127)
  ...
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Tyler-Hardin pushed a commit to Tyler-Hardin/goose that referenced this pull request Feb 11, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants