Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(dictation): put Whisper dictation behind a PostHog flag (#6814)
Wolf Mermelstein313495f7b32c
diff --git a/apps/web/src/features/dictation/components/dictation-controls.tsx b/apps/web/src/features/dictation/components/dictation-controls.tsxindex ddba6e7fed..6f14cdb5aa 100644--- a/apps/web/src/features/dictation/components/dictation-controls.tsx+++ b/apps/web/src/features/dictation/components/dictation-controls.tsx@@ -1,3 +1,4 @@+import { enableDictation, isFeatureEnabled } from '@core/constant/featureFlags';import CheckIcon from '@phosphor-icons/core/regular/check.svg?component-solid';import MicrophoneIcon from '@phosphor-icons/core/regular/microphone.svg?component-solid';import XIcon from '@phosphor-icons/core/regular/x.svg?component-solid';@@ -12,17 +13,19 @@ export function DictationButton(props: {disabled?: boolean;}) {return (- <Button- variant="ghost"- size="icon-composer"- class="rounded-full text-ink not-touch:text-composer-ink"- label={props.dictation.label()}- tooltip={props.dictation.label()}- disabled={props.disabled || props.dictation.disabled()}- onClick={() => void props.dictation.start()}- >- <MicrophoneIcon />- </Button>+ <Show when={isFeatureEnabled(enableDictation)}>+ <Button+ variant="ghost"+ size="icon-composer"+ class="rounded-full text-ink not-touch:text-composer-ink"+ label={props.dictation.label()}+ tooltip={props.dictation.label()}+ disabled={props.disabled || props.dictation.disabled()}+ onClick={() => void props.dictation.start()}+ >+ <MicrophoneIcon />+ </Button>+ </Show>);}diff --git a/apps/web/src/features/dictation/composer-dictation.ts b/apps/web/src/features/dictation/composer-dictation.tsindex 27bdf53dbc..15eaea7f7a 100644--- a/apps/web/src/features/dictation/composer-dictation.ts+++ b/apps/web/src/features/dictation/composer-dictation.ts@@ -1,3 +1,4 @@+import { enableDictation, isFeatureEnabled } from '@core/constant/featureFlags';import { Telemetry } from '@macro-inc/observability';import { transcribeAudio } from '@queries/dictation/transcribe';import type { LexicalEditor } from 'lexical';@@ -9,7 +10,9 @@ import { createRecordedDictation } from './primitives/create-recorded-dictation'export function createComposerDictation(editor: () => LexicalEditor) {const language = navigator.language || 'en-US';return createRecordedDictation({- supported: AudioRecorder.isSupported(),+ // Off means the recorder is never created: no microphone prompt, no audio+ // in memory, and no transcription request.+ supported: isFeatureEnabled(enableDictation) && AudioRecorder.isSupported(),startTrace: () => Telemetry.span('dictation.session'),createRecorder: (callbacks) => audioRecorder.createSession(callbacks),transcribe: (audio, signal, trace) =>diff --git a/apps/web/src/lib/core/constant/featureFlags.ts b/apps/web/src/lib/core/constant/featureFlags.tsindex 54129426bd..b4b9733598 100644--- a/apps/web/src/lib/core/constant/featureFlags.ts+++ b/apps/web/src/lib/core/constant/featureFlags.ts@@ -707,6 +707,19 @@ export const enableSpreadsheets = defineFlag({env: 'ENABLE_SPREADSHEETS',});+/**+ * Speech-to-text in the channel, agent, and AI chat composers. Recordings go+ * to OpenAI Whisper through DSS and are billed per audio minute, so this+ * carries a remote kill switch rather than an env-only one. Off hides the+ * microphone everywhere and never opens the recorder, so no audio is captured+ * and no request is made. On in dev; production follows PostHog.+ */+export const enableDictation = defineFlag({+ key: 'enable-dictation',+ env: 'ENABLE_DICTATION',+ default: onInDev,+});+/*** Document comments read and write through the shared message API and render* with the channel message components; the legacy annotation comment storesdiff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.tsindex 07fe9a7ddd..5c8cd1bf8b 100644--- a/apps/web/vitest.config.ts+++ b/apps/web/vitest.config.ts@@ -5,6 +5,11 @@ import tsconfigPaths from 'vite-tsconfig-paths';import { configDefaults, defineConfig } from 'vitest/config';export default defineConfig({+ // Feature-flagged surfaces are exercised enabled; a flag's own off-state is+ // the rollout switch, not something every composer suite should assert.+ define: {+ 'import.meta.env.VITE_ENABLE_DICTATION': JSON.stringify('true'),+ },plugins: [tsconfigPaths(),solidPlugin(),