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.

fix: unify chat input with new home style (#6519)

Eric Hayes3e151f312e8c
diff --git a/apps/web/src/features/agents-view/views/AgentsView.tsx b/apps/web/src/features/agents-view/views/AgentsView.tsx
index 9a55f64a94..3f8d4af728 100644
--- a/apps/web/src/features/agents-view/views/AgentsView.tsx
+++ b/apps/web/src/features/agents-view/views/AgentsView.tsx
@@ -1,11 +1,8 @@
import { ViewShell } from '@app/components/view-shell';
-import { startPendingSession } from '@app/features/block-agent/context/pending-session';
-import { AgentInput } from '@app/features/block-agent/ui';
-import { HomeChatInput } from '@app/features/home/home';
+import { HomeChatInput } from '@app/features/home/home-chat-input';
import { QUERY_FILTERS_BASE } from '@app/features/next-soup/filters/query-filters';
import { Agents } from '@app/features/settings/Agents';
import { McpConnections } from '@app/features/settings/McpConnections';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useGlobalBlockOrchestrator } from '@components/app/GlobalAppState';
import { PreviewPanel } from '@components/app/PreviewPanel';
import { useSplitLayout } from '@components/app/split-layout/layout';
@@ -13,7 +10,6 @@ import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { SplitPanel } from '@components/app/split-panel';
import { ChatInputProvider } from '@core/component/AI/context';
import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
-import { enableChatV3Agents } from '@core/constant/featureFlags';
import { useUserId } from '@core/context/user';
import { ListEntityMetadataQueryProvider } from '@entity';
import SpinnerIcon from '@phosphor/spinner.svg';
@@ -59,8 +55,6 @@ function AgentsWorkspace() {
const orchestrator = useGlobalBlockOrchestrator();
const userId = useUserId();
- const agentsFlag = useFeatureFlag(enableChatV3Agents);
-
const [page, setPage] = createSignal<AgentsPage>('new');
const [selected, setSelected] = createSignal<SelectedConversation>();
const [search, setSearch] = createSignal('');
@@ -119,11 +113,6 @@ function AgentsWorkspace() {
});
};
- const startSession = (prompt: string) => {
- const id = startPendingSession({ prompt });
- openConversation({ id, type: 'agent_session' });
- };
-
const adoptSessionId = (placeholderId: string, sessionId: string) => {
setSelected((current) => {
if (
@@ -186,25 +175,17 @@ function AgentsWorkspace() {
<Suspense fallback={<LoadingComposer />}>
<Switch>
<Match when={page() === 'new'}>
- <div class="flex size-full items-center justify-center px-6 pb-16">
- <div class="w-full max-w-2xl">
- <Switch>
- <Match when={agentsFlag().loading}>
- <LoadingComposer />
- </Match>
- <Match when={agentsFlag().enabled}>
- <AgentInput
- autofocus
- placeholder="Message the agent, @mention anything"
- onSend={startSession}
- />
- </Match>
- <Match when={true}>
- <ChatInputProvider>
- <HomeChatInput />
- </ChatInputProvider>
- </Match>
- </Switch>
+ {/* The home composer, at home's width, so the box
+ matches the chat that opens once you send. */}
+ <div class="flex size-full items-center justify-center px-4 pb-16">
+ <div class="w-full max-w-3xl">
+ <ChatInputProvider>
+ <HomeChatInput
+ openChat={(id) =>
+ openConversation({ id, type: 'chat' })
+ }
+ />
+ </ChatInputProvider>
</div>
</div>
</Match>
diff --git a/apps/web/src/features/block-chat/component/Chat.tsx b/apps/web/src/features/block-chat/component/Chat.tsx
index 0bbed89afb..ee27c1fd9f 100644
--- a/apps/web/src/features/block-chat/component/Chat.tsx
+++ b/apps/web/src/features/block-chat/component/Chat.tsx
@@ -363,20 +363,19 @@ function ChatInner(props: {
</div>
<Show when={!disabled()}>
<FloatRegionOrInline region="accessory">
- <div class="flex w-full justify-center pb-2.5 px-2 touch:pb-0 touch:px-(--mobile-chrome-gutter) touch:pointer-events-auto">
- <div class="w-3xl">
- <ChatInput
- editor={editor}
- initialValue={props.loadedInputText}
- onChange={setMarkdownText}
- chatId={chat.chatId()}
- onSend={onSend}
- onStop={onStop}
- autoFocusOnMount={
- canAutofocusSplitContent && !navigatedFromJK()
- }
- />
- </div>
+ {/* Same wrapper as the home composer, so the box is the same width
+ and sits at the same offset whether a chat is being started or
+ continued. */}
+ <div class="mx-auto w-full max-w-3xl shrink-0 px-4 pb-3 pointer-events-auto touch:px-(--mobile-chrome-gutter) touch:pb-0">
+ <ChatInput
+ editor={editor}
+ initialValue={props.loadedInputText}
+ onChange={setMarkdownText}
+ chatId={chat.chatId()}
+ onSend={onSend}
+ onStop={onStop}
+ autoFocusOnMount={canAutofocusSplitContent && !navigatedFromJK()}
+ />
</div>
</FloatRegionOrInline>
</Show>
diff --git a/apps/web/src/features/home/home-chat-input.tsx b/apps/web/src/features/home/home-chat-input.tsx
index af289abdf2..a66d8b5fa2 100644
--- a/apps/web/src/features/home/home-chat-input.tsx
+++ b/apps/web/src/features/home/home-chat-input.tsx
@@ -23,6 +23,12 @@ export const HomeChatInput = (props: {
class?: string;
placeholder?: string;
autoFocusOnMount?: boolean;
+ /**
+ * Where a newly created chat opens. By default the composer's split is
+ * replaced with the chat block; a host that keeps its own chrome around
+ * the conversation (the Agents view and its sidebar) opens it in place.
+ */
+ openChat?: (chatId: string) => void;
}) => {
const splitPanelContext = useSplitPanelOrThrow();
const input = useChatInputContext();
@@ -117,10 +123,14 @@ export const HomeChatInput = (props: {
model: request.model,
});
- // Replace the soup split with the chat split
- splitPanelContext.handle.replace({
- next: { type: 'chat', id: chatId },
- });
+ if (props.openChat) {
+ props.openChat(chatId);
+ } else {
+ // Replace the soup split with the chat split
+ splitPanelContext.handle.replace({
+ next: { type: 'chat', id: chatId },
+ });
+ }
}
};