[FEATURE] Mods: play $.audio.play clips on the attached desktop app, for remote sessions
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
$.audio.play plays a clip on the machine where Claude Code runs (afplay on macOS). When I use Claude Code from the desktop app with the session running somewhere else (an SSH host, a dev box, a cloud session), any sound a mod plays comes out of the remote machine, or nowhere, and never out of the device I'm sitting at. Client surface modules do run inside the desktop app, but they have no audio API, so a mod has no way to make sound where the user is.
Proposed Solution
Let a mod play a clip on the attached surface. For example, a surface: "desktop" option for $.audio.play (or a "play on every attached client" default when the host has no player), with the engine sending the clip to the desktop app over the existing ui_* channel and the app playing it. The same four-clip limit and asset rules could apply.
Alternative Solutions
- An audio call in
ClientSurface(for examplesurface.play({ asset })), so aClientmodule drawn in the desktop app can play the plugin's own files. - Forwarding audio over SSH, which isn't practical, and doesn't cover cloud sessions.
Priority
Low - Nice to have
Feature Category
Developer tools/SDK
Use Case Example
I maintain Claude Orchestra, a mod that plays typing, tool and "done" sounds while Claude works, so parallel sessions sound like an orchestra. It works locally on macOS, but anyone running Claude Code on a remote host and watching it in the desktop app hears nothing on their own machine.
Additional Context
Built and tested on Claude Code 2.1.296. In index.d.ts, a surface module's environment "has the same globals" as a hooks module, so there's no Web Audio in a Client either.