Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

test(dictation): scope the flag override; dictation in the agents-view composer (#6816)

Wolf Mermelstein43016953ea0a
diff --git a/apps/web/src/features/agents-view/components/ChatComposer.tsx b/apps/web/src/features/agents-view/components/ChatComposer.tsx
index cb2686a996..b669385cc7 100644
--- a/apps/web/src/features/agents-view/components/ChatComposer.tsx
+++ b/apps/web/src/features/agents-view/components/ChatComposer.tsx
@@ -1,4 +1,10 @@
import type { AgentInputProps } from '@app/features/block-agent/ui';
+import {
+ DictationButton,
+ DictationFeedback,
+ DictationPanel,
+} from '@app/features/dictation/components/dictation-controls';
+import { createComposerDictation } from '@app/features/dictation/composer-dictation';
import { InputProvider } from '@channel/Input/context';
import { Input } from '@channel/Input/Input';
import type { InputAttachmentData, InputCommands } from '@channel/Input/types';
@@ -112,6 +118,8 @@ export function ChatComposer(props: {
editor.withSkills();
}
+ const dictation = createComposerDictation(() => editor.lexical);
+
const { isCompact } = createComposerLayout(editor.buildHandle().lexical, {
container: layout,
});
@@ -142,6 +150,7 @@ export function ChatComposer(props: {
if (
(!prompt && attachments().length === 0) ||
hasPendingAttachments() ||
+ dictation.active() ||
disabled()
)
return;
@@ -200,7 +209,12 @@ export function ChatComposer(props: {
hint="Drop files here to send them to the agent"
/>
</Show>
- <div ref={setContent} data-composer-content>
+ <div
+ ref={setContent}
+ data-composer-content
+ inert={dictation.active()}
+ classList={{ invisible: dictation.active() }}
+ >
<Input.Attachments kind="media" class="pb-0" />
<Input.Attachments kind="document" class="pb-0" />
{/* Expanded text keeps the compact row's vertical inset:
@@ -247,6 +261,10 @@ export function ChatComposer(props: {
>
<div class="ml-auto flex min-w-0 max-w-full items-center gap-2 [&_.menu]:right-0 [&_.menu]:left-auto [&_.menu-anchor]:min-w-0 [&_.pill]:max-w-full">
{props.selector}
+ <DictationButton
+ dictation={dictation}
+ disabled={disabled()}
+ />
<Show
when={
(props.session?.busy || canSendNext()) &&
@@ -295,7 +313,9 @@ export function ChatComposer(props: {
</div>
</div>
</Input.DropZone>
+ <DictationPanel dictation={dictation} />
</ComposerSurface>
+ <DictationFeedback dictation={dictation} />
<Show when={props.drawer}>
<div
class="composer-drawer"
diff --git a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx b/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
index 13a8a3093f..db5da996c6 100644
--- a/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
+++ b/apps/web/src/features/channel/Input/tests/input-slots.test.tsx
@@ -20,6 +20,17 @@ const editorMocks = vi.hoisted(() => ({
onEnter: undefined as (() => boolean) | undefined,
}));
+// These slots render the microphone, so they run with dictation rolled out.
+// Other flags keep their real values.
+vi.mock('@core/constant/featureFlags', async (original) => {
+ const actual = await original<typeof import('@core/constant/featureFlags')>();
+ return {
+ ...actual,
+ isFeatureEnabled: (flag: Parameters<typeof actual.isFeatureEnabled>[0]) =>
+ flag === actual.enableDictation || actual.isFeatureEnabled(flag),
+ };
+});
+
vi.mock('../../../dictation/composer-dictation', () => ({
createComposerDictation: () => {
const [active, setActive] = createSignal(false);
diff --git a/apps/web/src/features/dictation/primitives/create-recorded-dictation.ts b/apps/web/src/features/dictation/primitives/create-recorded-dictation.ts
index 52e71fb5ca..eec6ef6215 100644
--- a/apps/web/src/features/dictation/primitives/create-recorded-dictation.ts
+++ b/apps/web/src/features/dictation/primitives/create-recorded-dictation.ts
@@ -133,7 +133,7 @@ export function createRecordedDictation(options: {
attempt = 0;
setVolumeHistory([]);
setPhase('starting');
- setMessage('Audio is sent to OpenAI Whisper only when you confirm.');
+ setMessage('');
const current = options.createRecorder({
onLevel: (level) => {
if (recorder === current && phase() === 'listening')
diff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.ts
index 5c8cd1bf8b..07fe9a7ddd 100644
--- a/apps/web/vitest.config.ts
+++ b/apps/web/vitest.config.ts
@@ -5,11 +5,6 @@ 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(),