Skip to content

Commit 2eba181

Browse files
committed
fix(desktop): gate success chime on turn outcome
1 parent e9bd6f5 commit 2eba181

3 files changed

Lines changed: 2 additions & 20 deletions

File tree

desktop/frontend/src/App.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { useToast } from "./lib/toast";
2525
import { asArray } from "./lib/array";
2626
import { clearLegacyLangPref, normalizeLangPref, readLegacyLangPref, useI18n, useT, type Translator } from "./lib/i18n";
2727
import { useController, type Item, type LiveStream } from "./lib/useController";
28-
import { app, onEvent, onProjectTreeChanged, onTurnDone } from "./lib/bridge";
28+
import { app, onEvent, onProjectTreeChanged } from "./lib/bridge";
2929
import { playSuccessChime } from "./lib/sound";
3030
import { Transcript } from "./components/Transcript";
3131
import { Composer } from "./components/Composer";
@@ -709,19 +709,12 @@ export default function App() {
709709
const unsub = onEvent((e) => {
710710
if (e.kind === "turn_done") {
711711
setDockRefreshKey((v) => v + 1);
712+
if (!e.err) playSuccessChime();
712713
}
713714
});
714715
return unsub;
715716
}, []);
716717

717-
// Play a success chime when any turn finishes.
718-
useEffect(() => {
719-
const unsub = onTurnDone(() => {
720-
playSuccessChime();
721-
});
722-
return unsub;
723-
}, []);
724-
725718
const [workspacePanelResizing, setWorkspacePanelResizing] = useState(false);
726719
const [workspacePanelMaximized, setWorkspacePanelMaximized] = useState(false);
727720
const [rightDockMode, setRightDockMode] = useState<RightDockMode>("context");

desktop/frontend/src/lib/bridge.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,6 @@ export function onProjectTreeChanged(cb: () => void): () => void {
393393
return () => {};
394394
}
395395

396-
/** Fires when any topic's generation finishes (TurnDone). Used for sound. */
397-
export function onTurnDone(cb: () => void): () => void {
398-
if (realApp() && typeof window !== "undefined" && window.runtime) {
399-
return window.runtime.EventsOn("agent:turn-done", () => cb());
400-
}
401-
return () => {};
402-
}
403-
404396
// app proxies each call to the live binding (or the dev mock only when truly
405397
// outside the shell), so a late-injected window.go is picked up transparently.
406398
export const app: AppBindings = new Proxy({} as AppBindings, {

desktop/tabs.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ func (s *tabEventSink) Emit(e event.Event) {
226226
}
227227
if s.ctx != nil {
228228
runtime.EventsEmit(s.ctx, eventChannel, toWireTab(e, s.tabID))
229-
if e.Kind == event.TurnDone {
230-
runtime.EventsEmit(s.ctx, "agent:turn-done")
231-
}
232229
}
233230
if s.app != nil {
234231
if status, update := topicActivityStatusFromEvent(e); update && s.app.setTabActivityStatus(s.tabID, status) {

0 commit comments

Comments
 (0)