Skip to content

The agent that grows with you

fix(tui): /voice tts refuses by name on the shared gateway

Tekniumf7eb415f464f
diff --git a/ui-tui/src/__tests__/canonicalSidecarSessionVerbs.test.tsx b/ui-tui/src/__tests__/canonicalSidecarSessionVerbs.test.tsx
index 1f6308a57d7..88744ae1ef1 100644
--- a/ui-tui/src/__tests__/canonicalSidecarSessionVerbs.test.tsx
+++ b/ui-tui/src/__tests__/canonicalSidecarSessionVerbs.test.tsx
@@ -5,6 +5,7 @@ import React from 'react'
import { afterEach, expect, it, vi } from 'vitest'
import { applyAgentSnapshot } from '../app/agentRoster.js'
+import { createSlashHandler } from '../app/createSlashHandler.js'
import { requestLiveSessions } from '../app/liveSessions.js'
import { patchUiState, resetUiState } from '../app/uiStore.js'
import { sendAgentSteer } from '../components/agentControls.js'
@@ -69,6 +70,26 @@ async function overlayKey(gw: GatewayClient, key: string) {
}
const SITES: [string, () => Promise<void>][] = [
+ [
+ 'session.ts::/voice tts (read-aloud runs only in a sidecar turn)',
+ async () => {
+ patchUiState({ sid: 'owner' })
+ const { gw, request } = owner()
+ const sys = vi.fn()
+
+ createSlashHandler({
+ gateway: { gw, rpc: request },
+ local: { getHistoryItems: () => [], getLastUserMsg: () => '', maybeWarn: vi.fn() },
+ session: {},
+ slashFlightRef: { current: 0 },
+ transcript: { page: vi.fn(), panel: vi.fn(), send: vi.fn(), setHistoryItems: vi.fn(), sys },
+ voice: { setVoiceEnabled: vi.fn(), setVoiceRecordKey: vi.fn(), setVoiceTts: vi.fn() }
+ } as never)('/voice tts')
+ await new Promise(resolve => setImmediate(resolve))
+ expect(sys).toHaveBeenCalledWith('/voice tts is not available on the shared gateway yet')
+ expect(request.mock.calls.some(([method]) => method === 'voice.toggle')).toBe(false)
+ }
+ ],
[
'agentControls::sendAgentSteer',
async () => {
diff --git a/ui-tui/src/app/slash/commands/session.ts b/ui-tui/src/app/slash/commands/session.ts
index a572d94521a..1151e93f327 100644
--- a/ui-tui/src/app/slash/commands/session.ts
+++ b/ui-tui/src/app/slash/commands/session.ts
@@ -399,6 +399,12 @@ export const sessionCommands: SlashCommand[] = [
? normalized
: 'status'
+ // Read-aloud ran in the sidecar's own turn; a shared-gateway turn runs on the owner, which
+ // never speaks a TUI reply, so the toggle would say "on" and stay silent.
+ if (action === 'tts' && ctx.gateway.gw?.isCanonical) {
+ return ctx.transcript.sys(t('canonical.controls.notAvailable', 'voice tts'))
+ }
+
ctx.gateway.rpc<VoiceToggleResponse>('voice.toggle', { action }).then(
ctx.guarded<VoiceToggleResponse>(r => {
ctx.voice.setVoiceEnabled(!!r.enabled)