From 806a1c8552126f4279572c3df8d0bd089b352d9f Mon Sep 17 00:00:00 2001
From: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Date: Thu, 5 Nov 2026 17:57:22 -0800
Subject: [PATCH 1/9] feat(voice): opt into cloud dictation with OpenAI or Grok
---
apps/mobile/app.config.ts | 3 +
.../features/settings/CloudVoiceSection.tsx | 260 ++++++++++++++++
.../settings/SettingsVoiceRouteScreen.tsx | 28 +-
.../voice-input/voiceDestination.test.ts | 46 ++-
.../features/voice-input/voiceDestination.ts | 82 +++--
.../src/environment/ServerEnvironment.ts | 1 +
apps/server/src/server.ts | 2 +
apps/server/src/serverSettings.test.ts | 14 +
apps/server/src/settingsSecrets.ts | 7 +
.../sourceControlHostSecrets.test.ts | 3 +
.../sourceControl/sourceControlHostSecrets.ts | 7 +-
apps/server/src/speech/CloudSpeech.test.ts | 106 +++++++
apps/server/src/speech/CloudSpeech.ts | 187 +++++++++++
apps/server/src/speech/http.test.ts | 124 ++++++--
apps/server/src/speech/http.ts | 37 +++
.../CloudVoiceConfiguration.browser.test.tsx | 132 ++++++++
.../settings/CloudVoiceConfiguration.tsx | 272 ++++++++++++++++
.../settings/SecretsSettings.logic.test.ts | 2 +
.../settings/SecretsSettings.logic.ts | 14 +-
.../VoiceSettingsPanel.browser.test.tsx | 4 +-
.../settings/VoiceSettingsPanel.tsx | 294 ++++++++++++++----
.../src/components/settings/settingsSearch.ts | 6 +-
apps/web/src/speech/browserVoiceInput.ts | 73 +++--
.../src/speech/useEnvironmentSpeechInput.ts | 33 +-
docs/internals/voice-input.md | 9 +-
docs/user/composer.md | 2 +
docs/user/voice-input.md | 20 +-
packages/client-runtime/src/secretRequest.ts | 6 +
.../src/voice-input/environment.ts | 82 ++++-
.../client-runtime/src/voice-input/index.ts | 4 +
packages/contracts/src/environment.ts | 1 +
packages/contracts/src/environmentHttp.ts | 40 +++
packages/contracts/src/settings.ts | 30 +-
packages/contracts/src/speech.ts | 47 +++
packages/shared/src/speech.ts | 9 +
35 files changed, 1834 insertions(+), 153 deletions(-)
create mode 100644 apps/mobile/src/features/settings/CloudVoiceSection.tsx
create mode 100644 apps/server/src/speech/CloudSpeech.test.ts
create mode 100644 apps/server/src/speech/CloudSpeech.ts
create mode 100644 apps/web/src/components/settings/CloudVoiceConfiguration.browser.test.tsx
create mode 100644 apps/web/src/components/settings/CloudVoiceConfiguration.tsx
diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts
index 784668082bb6f..97eb9b0cadcab 100644
--- a/apps/mobile/app.config.ts
+++ b/apps/mobile/app.config.ts
@@ -458,6 +458,9 @@ const config: ExpoConfig = {
],
extra: {
appVariant: APP_VARIANT,
+ secretsFeatureEnabled: ["1", "true"].includes(
+ process.env.T3CODE_FEATURE_SECRETS?.trim().toLowerCase() ?? "",
+ ),
iosPersonalTeamBuild: isIosPersonalTeamBuild,
relay: {
url: repoEnv.T3CODE_RELAY_URL ?? null,
diff --git a/apps/mobile/src/features/settings/CloudVoiceSection.tsx b/apps/mobile/src/features/settings/CloudVoiceSection.tsx
new file mode 100644
index 0000000000000..89f0967268380
--- /dev/null
+++ b/apps/mobile/src/features/settings/CloudVoiceSection.tsx
@@ -0,0 +1,260 @@
+import { useAtomRefresh, useAtomValue } from "@effect/atom-react";
+import { setCloudSpeechKey } from "@t3tools/client-runtime/voice-input";
+import {
+ configuredSecretSources,
+ secretRequestReference,
+} from "@t3tools/client-runtime/secret-request";
+import {
+ AuthSettingsWriteScope,
+ CLOUD_SPEECH_LABELS,
+ CLOUD_SPEECH_PROVIDER_NAMES,
+ CloudSpeechProvider,
+ CloudSpeechApiKey,
+ isSecretReference,
+ type SecretProviderId,
+ type SettingsSecretValue,
+} from "@t3tools/contracts";
+import * as Schema from "effect/Schema";
+import Constants from "expo-constants";
+import { AsyncResult } from "effect/reactivity";
+import { useState } from "react";
+import { TextInput, View } from "react-native";
+import * as Dialog from "../../components/ui/Dialog";
+import { ProviderIcon } from "../../components/ProviderIcon";
+import { ListActionRow } from "../../components/ui/ListActionRow";
+import { ListChoiceRow } from "../../components/ui/ListChoiceRow";
+import { Chip } from "../../components/ui/Chip";
+import type { EnvironmentPresentation } from "../../state/environments";
+import { useEnvironmentScope } from "../../state/session";
+import {
+ chooseVoiceDestination,
+ cloudVoiceConnectionAtom,
+ cloudVoiceKeysAtom,
+ runSpeech,
+} from "../voice-input/voiceDestination";
+import { SettingsSection } from "./components/SettingsSection";
+
+type Props = { environment: EnvironmentPresentation; active: CloudSpeechProvider | null };
+const isApiKey = Schema.is(CloudSpeechApiKey);
+
+export function CloudVoiceSection({ environment, active }: Props) {
+ const [open, setOpen] = useState(active !== null);
+ return (
+
- {chosenEnvironment.label} can’t transcribe audio. Pick an environment that can to use
- voice input.
+ {chosenEnvironment.label} can’t transcribe audio locally. Choose a different
+ destination.
+ OpenRouter no longer lists {current}. Dictation stays off until you choose another model.
+ {selected.id}
+ {draft.trim() && !credential
+ ? (source?.invalidReferenceMessage ?? "Enter an API key, not a URL or secret reference.")
+ : active && !routed
+ ? "Updating the key keeps dictation enabled."
+ : routed && saved
+ ? "Leave blank to keep the saved key."
+ : `Anyone with dictation access to ${environment.label} can bill this key.`}
+
+ Transcribe with
+ Use
+
+