The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(chat): render the welcome suggestion chips on an empty thread
M3gA-Mind0c1d98ea65f4
diff --git a/app/src/features/conversations/components/AssistantUiChat.welcomeSuggestions.test.tsx b/app/src/features/conversations/components/AssistantUiChat.welcomeSuggestions.test.tsxnew file mode 100644index 0000000000..1698bee77f--- /dev/null+++ b/app/src/features/conversations/components/AssistantUiChat.welcomeSuggestions.test.tsx@@ -0,0 +1,178 @@+/**+ * Welcome suggestion chips on the assistant-ui chat surface.+ *+ * The chips and the follow-up chips read the SAME runtime field+ * (`s.thread.suggestions`), and their render gates are complementary rather+ * than overlapping — welcome is `isNewChatView && composer.isEmpty`, follow-up+ * is `!isEmpty && !isRunning && length > 0`. Between them they partition every+ * state, so a suggestion list supplied unconditionally renders correctly on the+ * empty thread and then reappears as follow-up chips under every settled turn,+ * forever.+ *+ * The second test here is that bleed guard, and it is the one that matters:+ * the adapter gates the list on the runtime's message count, and if that gate+ * is ever lifted this suite is what catches it. See openhuman#6465, which also+ * records the constraint; the follow-up producer itself does not exist yet.+ */+import { combineReducers, configureStore } from '@reduxjs/toolkit';+import { render, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { Provider } from 'react-redux';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { registerChatSurface } from '../../../providers/chatSurfaceHandlers';+import chatRuntimeReducer from '../../../store/chatRuntimeSlice';+import mascotReducer from '../../../store/mascotSlice';+import threadReducer from '../../../store/threadSlice';+import type { ThreadMessage } from '../../../types/thread';+import { AssistantUiChat } from './AssistantUiChat';++const THREAD_ID = 't-welcome';++/** The six approved starter prompts, as the user sees them (en). */+const CHIPS = [+ "What's on my calendar today?",+ 'Summarize my unread email.',+ 'Draft a reply to my last message.',+ "What did I say I'd follow up on this week?",+ 'Connect a new integration.',+ 'Build a flow that emails me a daily summary.',+];++function agentMessage(): ThreadMessage {+ return {+ id: 'm-1',+ content: 'An answer that has already landed.',+ type: 'text',+ extraMetadata: {},+ sender: 'agent',+ createdAt: '2026-01-01T00:00:00.000Z',+ };+}++function buildStore(messages: ThreadMessage[]) {+ return configureStore({+ reducer: combineReducers({+ thread: threadReducer,+ chatRuntime: chatRuntimeReducer,+ mascot: mascotReducer,+ }),+ preloadedState: {+ thread: {+ threads: [+ {+ id: THREAD_ID,+ title: 'Welcome thread',+ chatId: null,+ isActive: false,+ messageCount: messages.length,+ lastMessageAt: '2026-01-01T00:00:00.000Z',+ createdAt: '2026-01-01T00:00:00.000Z',+ labels: [],+ },+ ],+ selectedThreadId: THREAD_ID,+ activeThreadIds: {},+ welcomeThreadId: null,+ messagesByThreadId: { [THREAD_ID]: messages },+ messages,+ isLoadingThreads: false,+ isLoadingMessages: false,+ messagesError: null,+ },+ } as never,+ });+}++function chat() {+ return (+ <AssistantUiChat+ model={null}+ onModelChange={vi.fn()}+ inputValue=""+ onInputValueChange={vi.fn()}+ attachments={[]}+ onAttachFiles={vi.fn()}+ onRemoveAttachment={vi.fn()}+ maxAttachments={5}+ attachmentsEnabled={false}+ attachmentInteractionBlocked={false}+ onAttachmentOnlySend={vi.fn()}+ />+ );+}++function renderChat(messages: ThreadMessage[]) {+ return render(<Provider store={buildStore(messages)}>{chat()}</Provider>);+}++/** Welcome chips currently on screen, by visible text, in render order. */+function welcomeChips(): string[] {+ return Array.from(document.querySelectorAll('.aui-thread-welcome-suggestion-display')).map(+ node => node.textContent?.trim() ?? ''+ );+}++/**+ * Every suggestion chip on screen, from BOTH surfaces.+ *+ * Asserting only on `.aui-thread-welcome-suggestion-display` is not enough and+ * was wrong in the first draft of this file: with the adapter's gate removed,+ * the leaked chips render through the *follow-up* row+ * (`.aui-thread-followup-suggestion`, different markup entirely), so a+ * welcome-only selector reports "no chips" while six of them are on screen and+ * the bleed guard passes vacuously. Query both, so the guard fails for the+ * reason it claims to.+ */+function allSuggestionChips(): string[] {+ return Array.from(+ document.querySelectorAll(+ '.aui-thread-welcome-suggestion-display, .aui-thread-followup-suggestion'+ )+ ).map(node => node.textContent?.trim() ?? '');+}++afterEach(() => {+ vi.restoreAllMocks();+});++describe('welcome suggestion chips', () => {+ it('renders the six starter prompts on an empty thread', () => {+ renderChat([]);++ // Against the rendered DOM, not the adapter's return value: the point is+ // that the chips reach the screen, not that a key exists on an object.+ expect(welcomeChips()).toEqual(CHIPS);+ });++ it('renders NO chips on either surface once the thread has a message', () => {+ renderChat([agentMessage()]);++ // Guard the absence so it cannot pass vacuously on an empty render: prove+ // the transcript actually rendered first. Without this, a crash or a blank+ // tree would satisfy the assertion below and the bleed would ship.+ expect(screen.getByText('An answer that has already landed.')).toBeTruthy();++ // BOTH surfaces. The leak shows up as follow-up chips, not welcome ones —+ // see `allSuggestionChips`. Revert-proved: with the adapter's emptiness+ // gate removed this returns all six prompts and the assertion fails.+ expect(allSuggestionChips()).toEqual([]);+ });++ it('sends the chip text as a user turn when clicked', async () => {+ const send = vi.fn().mockResolvedValue(undefined);+ const unregister = registerChatSurface(THREAD_ID, { send });+ try {+ renderChat([]);++ await userEvent.click(screen.getByText(CHIPS[0] as string));++ await waitFor(() => expect(send).toHaveBeenCalledTimes(1));+ // The chip's own text is the prompt: `ThreadSuggestion.title` falls back+ // to `prompt` upstream, so one string is both, and they cannot drift.+ expect(send).toHaveBeenCalledWith(CHIPS[0]);+ } finally {+ unregister();+ }+ });+});diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.tsindex 4662f94f66..4156ea2086 100644--- a/app/src/lib/i18n/ar.ts+++ b/app/src/lib/i18n/ar.ts@@ -694,6 +694,12 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'لنبدأ العمل، {name} 🧑🍳.','chat.newWindowWelcome3': 'حان وقت التركيز 🧘🏻','chat.newWindowPrompt': 'كيف يمكنني مساعدتك اليوم؟',+ 'chat.welcomeSuggestion.calendarToday': 'ما هي مواعيدي اليوم؟',+ 'chat.welcomeSuggestion.unreadEmail': 'لخّص رسائلي غير المقروءة.',+ 'chat.welcomeSuggestion.draftReply': 'اكتب ردًا على آخر رسالة وصلتني.',+ 'chat.welcomeSuggestion.followUps': 'ما الذي قلت إنني سأتابعه هذا الأسبوع؟',+ 'chat.welcomeSuggestion.connectIntegration': 'اربط تكاملًا جديدًا.',+ 'chat.welcomeSuggestion.dailySummaryFlow': 'أنشئ تدفقًا يرسل لي ملخصًا يوميًا بالبريد.','chat.typeMessage': 'أرسل رسالة...','chat.send': 'إرسال الرسالة','chat.stopGeneration': 'إيقاف التوليد',diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.tsindex 5ce8e81d23..1db8dee9c8 100644--- a/app/src/lib/i18n/bn.ts+++ b/app/src/lib/i18n/bn.ts@@ -712,6 +712,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'চলুন শুরু করি, {name} 🧑🍳.','chat.newWindowWelcome3': 'মনোযোগ দেওয়ার সময় 🧘🏻','chat.newWindowPrompt': 'আজ আমি আপনাকে কীভাবে সাহায্য করতে পারি?',+ 'chat.welcomeSuggestion.calendarToday': 'আজ আমার ক্যালেন্ডারে কী আছে?',+ 'chat.welcomeSuggestion.unreadEmail': 'আমার না পড়া ইমেলগুলোর সারসংক্ষেপ দাও।',+ 'chat.welcomeSuggestion.draftReply': 'আমার শেষ বার্তাটির উত্তর খসড়া করো।',+ 'chat.welcomeSuggestion.followUps': 'এই সপ্তাহে আমি কী কী অনুসরণ করব বলেছিলাম?',+ 'chat.welcomeSuggestion.connectIntegration': 'একটি নতুন ইন্টিগ্রেশন যুক্ত করো।',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'এমন একটি ফ্লো তৈরি করো যা আমাকে প্রতিদিন সারসংক্ষেপ ইমেল করে।','chat.typeMessage': 'একটি বার্তা পাঠান...','chat.send': 'বার্তা পাঠান','chat.stopGeneration': 'জেনারেশন বন্ধ করুন',diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.tsindex 479383e77f..0b78a07437 100644--- a/app/src/lib/i18n/de.ts+++ b/app/src/lib/i18n/de.ts@@ -744,6 +744,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'Legen wir los, {name} 🧑🍳.','chat.newWindowWelcome3': 'Zeit zum Fokussieren 🧘🏻','chat.newWindowPrompt': 'Wie kann ich dir heute helfen?',+ 'chat.welcomeSuggestion.calendarToday': 'Was steht heute in meinem Kalender?',+ 'chat.welcomeSuggestion.unreadEmail': 'Fasse meine ungelesenen E-Mails zusammen.',+ 'chat.welcomeSuggestion.draftReply': 'Entwirf eine Antwort auf meine letzte Nachricht.',+ 'chat.welcomeSuggestion.followUps': 'Was wollte ich diese Woche nachverfolgen?',+ 'chat.welcomeSuggestion.connectIntegration': 'Verbinde eine neue Integration.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'Erstelle einen Flow, der mir täglich eine Zusammenfassung per E-Mail schickt.','chat.typeMessage': 'Nachricht senden...','chat.send': 'Nachricht senden','chat.stopGeneration': 'Generierung stoppen',diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.tsindex 1d111b6cdc..778cb6a243 100644--- a/app/src/lib/i18n/en.ts+++ b/app/src/lib/i18n/en.ts@@ -533,6 +533,12 @@ const en: TranslationMap = {'chat.newWindowWelcome2': "Let's cook, {name} 🧑🍳.",'chat.newWindowWelcome3': 'Time to Zone In 🧘🏻','chat.newWindowPrompt': 'How can I help you today?',+ 'chat.welcomeSuggestion.calendarToday': "What's on my calendar today?",+ 'chat.welcomeSuggestion.unreadEmail': 'Summarize my unread email.',+ 'chat.welcomeSuggestion.draftReply': 'Draft a reply to my last message.',+ 'chat.welcomeSuggestion.followUps': "What did I say I'd follow up on this week?",+ 'chat.welcomeSuggestion.connectIntegration': 'Connect a new integration.',+ 'chat.welcomeSuggestion.dailySummaryFlow': 'Build a flow that emails me a daily summary.','chat.typeMessage': 'Send a message...','chat.send': 'Send message','chat.stopGeneration': 'Stop generating',diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.tsindex 5d8a60d5e4..68d8042015 100644--- a/app/src/lib/i18n/es.ts+++ b/app/src/lib/i18n/es.ts@@ -732,6 +732,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'Manos a la obra, {name} 🧑🍳.','chat.newWindowWelcome3': 'Hora de concentrarse 🧘🏻','chat.newWindowPrompt': '¿En qué puedo ayudarte hoy?',+ 'chat.welcomeSuggestion.calendarToday': '¿Qué tengo hoy en el calendario?',+ 'chat.welcomeSuggestion.unreadEmail': 'Resume mis correos sin leer.',+ 'chat.welcomeSuggestion.draftReply': 'Redacta una respuesta a mi último mensaje.',+ 'chat.welcomeSuggestion.followUps': '¿Qué dije que haría de seguimiento esta semana?',+ 'chat.welcomeSuggestion.connectIntegration': 'Conecta una nueva integración.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'Crea un flujo que me envíe un resumen diario por correo.','chat.typeMessage': 'Envía un mensaje...','chat.send': 'Enviar mensaje','chat.stopGeneration': 'Detener generación',diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.tsindex 005b13790b..919754b852 100644--- a/app/src/lib/i18n/fr.ts+++ b/app/src/lib/i18n/fr.ts@@ -744,6 +744,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'On y va, {name} 🧑🍳.','chat.newWindowWelcome3': 'Place à la concentration 🧘🏻','chat.newWindowPrompt': "Comment puis-je t'aider aujourd'hui ?",+ 'chat.welcomeSuggestion.calendarToday': "Qu'est-ce que j'ai à mon agenda aujourd'hui ?",+ 'chat.welcomeSuggestion.unreadEmail': 'Résume mes e-mails non lus.',+ 'chat.welcomeSuggestion.draftReply': 'Rédige une réponse à mon dernier message.',+ 'chat.welcomeSuggestion.followUps': "Qu'ai-je dit que je suivrais cette semaine ?",+ 'chat.welcomeSuggestion.connectIntegration': 'Connecte une nouvelle intégration.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ "Crée un flux qui m'envoie un résumé quotidien par e-mail.",'chat.typeMessage': 'Envoie un message...','chat.send': 'Envoyer le message','chat.stopGeneration': 'Arrêter la génération',diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.tsindex d03cabddc9..3969d45f38 100644--- a/app/src/lib/i18n/hi.ts+++ b/app/src/lib/i18n/hi.ts@@ -713,6 +713,12 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'चलिए शुरू करें, {name} 🧑🍳.','chat.newWindowWelcome3': 'ध्यान लगाने का समय 🧘🏻','chat.newWindowPrompt': 'आज मैं आपकी कैसे मदद कर सकता हूँ?',+ 'chat.welcomeSuggestion.calendarToday': 'आज मेरे कैलेंडर में क्या है?',+ 'chat.welcomeSuggestion.unreadEmail': 'मेरे बिना पढ़े ईमेल का सारांश दो।',+ 'chat.welcomeSuggestion.draftReply': 'मेरे पिछले संदेश का जवाब तैयार करो।',+ 'chat.welcomeSuggestion.followUps': 'मैंने इस हफ़्ते किन चीज़ों पर आगे बढ़ने को कहा था?',+ 'chat.welcomeSuggestion.connectIntegration': 'एक नया इंटीग्रेशन कनेक्ट करो।',+ 'chat.welcomeSuggestion.dailySummaryFlow': 'एक ऐसा फ़्लो बनाओ जो मुझे रोज़ाना सारांश ईमेल करे।','chat.typeMessage': 'कोई संदेश भेजें...','chat.send': 'मैसेज भेजें','chat.stopGeneration': 'जेनरेशन रोकें',diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.tsindex 3fcfa65fe8..eb1a154fec 100644--- a/app/src/lib/i18n/id.ts+++ b/app/src/lib/i18n/id.ts@@ -722,6 +722,14 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'Ayo mulai, {name} 🧑🍳.','chat.newWindowWelcome3': 'Waktunya fokus 🧘🏻','chat.newWindowPrompt': 'Apa yang bisa saya bantu hari ini?',+ 'chat.welcomeSuggestion.calendarToday': 'Ada apa saja di kalender saya hari ini?',+ 'chat.welcomeSuggestion.unreadEmail': 'Ringkas email saya yang belum dibaca.',+ 'chat.welcomeSuggestion.draftReply': 'Buat draf balasan untuk pesan terakhir saya.',+ 'chat.welcomeSuggestion.followUps':+ 'Apa saja yang saya katakan akan saya tindak lanjuti minggu ini?',+ 'chat.welcomeSuggestion.connectIntegration': 'Hubungkan integrasi baru.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'Buat alur yang mengirimi saya ringkasan harian lewat email.','chat.typeMessage': 'Kirim pesan...','chat.send': 'Kirim pesan','chat.stopGeneration': 'Hentikan pembuatan',diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.tsindex 1af7feb339..d565248865 100644--- a/app/src/lib/i18n/it.ts+++ b/app/src/lib/i18n/it.ts@@ -733,6 +733,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'Mettiamoci al lavoro, {name} 🧑🍳.','chat.newWindowWelcome3': 'È ora di concentrarsi 🧘🏻','chat.newWindowPrompt': 'Come posso aiutarti oggi?',+ 'chat.welcomeSuggestion.calendarToday': 'Che cosa ho in calendario oggi?',+ 'chat.welcomeSuggestion.unreadEmail': 'Riassumi le mie email non lette.',+ 'chat.welcomeSuggestion.draftReply': 'Scrivi una bozza di risposta al mio ultimo messaggio.',+ 'chat.welcomeSuggestion.followUps': 'Che cosa avevo detto di voler seguire questa settimana?',+ 'chat.welcomeSuggestion.connectIntegration': 'Collega una nuova integrazione.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'Crea un flusso che mi invii un riepilogo giornaliero via email.','chat.typeMessage': 'Invia un messaggio...','chat.send': 'Invia messaggio','chat.stopGeneration': 'Interrompi generazione',diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.tsindex f50143db1b..9f28df27ca 100644--- a/app/src/lib/i18n/ko.ts+++ b/app/src/lib/i18n/ko.ts@@ -706,6 +706,12 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': '시작해 볼까요, {name} 🧑🍳.','chat.newWindowWelcome3': '집중할 시간이에요 🧘🏻','chat.newWindowPrompt': '오늘 무엇을 도와드릴까요?',+ 'chat.welcomeSuggestion.calendarToday': '오늘 내 일정은 뭐야?',+ 'chat.welcomeSuggestion.unreadEmail': '읽지 않은 이메일을 요약해 줘.',+ 'chat.welcomeSuggestion.draftReply': '마지막 메시지에 대한 답장 초안을 써 줘.',+ 'chat.welcomeSuggestion.followUps': '이번 주에 후속 조치하겠다고 한 일이 뭐야?',+ 'chat.welcomeSuggestion.connectIntegration': '새 통합을 연결해 줘.',+ 'chat.welcomeSuggestion.dailySummaryFlow': '매일 요약을 이메일로 보내주는 플로우를 만들어 줘.','chat.typeMessage': '메시지를 보내세요...','chat.send': '메시지 보내기','chat.stopGeneration': '생성 중지',diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.tsindex 1a5c08809e..2fca56aa1c 100644--- a/app/src/lib/i18n/pl.ts+++ b/app/src/lib/i18n/pl.ts@@ -728,6 +728,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'Do dzieła, {name} 🧑🍳.','chat.newWindowWelcome3': 'Czas się skupić 🧘🏻','chat.newWindowPrompt': 'Jak mogę ci dziś pomóc?',+ 'chat.welcomeSuggestion.calendarToday': 'Co mam dzisiaj w kalendarzu?',+ 'chat.welcomeSuggestion.unreadEmail': 'Podsumuj moje nieprzeczytane e-maile.',+ 'chat.welcomeSuggestion.draftReply': 'Przygotuj odpowiedź na moją ostatnią wiadomość.',+ 'chat.welcomeSuggestion.followUps': 'Co miałem w tym tygodniu doprowadzić do końca?',+ 'chat.welcomeSuggestion.connectIntegration': 'Połącz nową integrację.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'Zbuduj przepływ, który codziennie wyśle mi podsumowanie e-mailem.','chat.typeMessage': 'Wyślij wiadomość...','chat.send': 'Wyślij wiadomość','chat.stopGeneration': 'Zatrzymaj generowanie',diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.tsindex c9e81dc00e..6e4767d304 100644--- a/app/src/lib/i18n/pt.ts+++ b/app/src/lib/i18n/pt.ts@@ -730,6 +730,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'Mãos à obra, {name} 🧑🍳.','chat.newWindowWelcome3': 'Hora de focar 🧘🏻','chat.newWindowPrompt': 'Como posso ajudá-lo hoje?',+ 'chat.welcomeSuggestion.calendarToday': 'O que tenho hoje na agenda?',+ 'chat.welcomeSuggestion.unreadEmail': 'Resume os meus e-mails não lidos.',+ 'chat.welcomeSuggestion.draftReply': 'Redige uma resposta à minha última mensagem.',+ 'chat.welcomeSuggestion.followUps': 'O que eu disse que ia acompanhar esta semana?',+ 'chat.welcomeSuggestion.connectIntegration': 'Liga uma nova integração.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'Cria um fluxo que me envie um resumo diário por e-mail.','chat.typeMessage': 'Envie uma mensagem...','chat.send': 'Enviar mensagem','chat.stopGeneration': 'Parar geração',diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.tsindex 93f01f8384..ce6acde0b5 100644--- a/app/src/lib/i18n/ru.ts+++ b/app/src/lib/i18n/ru.ts@@ -723,6 +723,13 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': 'Поехали, {name} 🧑🍳.','chat.newWindowWelcome3': 'Время сосредоточиться 🧘🏻','chat.newWindowPrompt': 'Чем я могу помочь тебе сегодня?',+ 'chat.welcomeSuggestion.calendarToday': 'Что у меня сегодня в календаре?',+ 'chat.welcomeSuggestion.unreadEmail': 'Сделай сводку моих непрочитанных писем.',+ 'chat.welcomeSuggestion.draftReply': 'Подготовь ответ на моё последнее сообщение.',+ 'chat.welcomeSuggestion.followUps': 'Что я обещал сделать на этой неделе?',+ 'chat.welcomeSuggestion.connectIntegration': 'Подключи новую интеграцию.',+ 'chat.welcomeSuggestion.dailySummaryFlow':+ 'Создай поток, который будет присылать мне ежедневную сводку на почту.','chat.typeMessage': 'Отправьте сообщение...','chat.send': 'Отправить сообщение','chat.stopGeneration': 'Остановить генерацию',diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.tsindex 5190f52395..002c43ebae 100644--- a/app/src/lib/i18n/zh-CN.ts+++ b/app/src/lib/i18n/zh-CN.ts@@ -661,6 +661,12 @@ const messages: TranslationMap = {'chat.newWindowWelcome2': '开干吧,{name} 🧑🍳。','chat.newWindowWelcome3': '是时候专注了 🧘🏻','chat.newWindowPrompt': '今天我能帮您做什么?',+ 'chat.welcomeSuggestion.calendarToday': '我今天的日程有什么?',+ 'chat.welcomeSuggestion.unreadEmail': '总结我的未读邮件。',+ 'chat.welcomeSuggestion.draftReply': '为我最近收到的消息起草一条回复。',+ 'chat.welcomeSuggestion.followUps': '我这周说过要跟进什么?',+ 'chat.welcomeSuggestion.connectIntegration': '连接一个新的集成。',+ 'chat.welcomeSuggestion.dailySummaryFlow': '创建一个每天给我发送摘要邮件的流程。','chat.typeMessage': '发送消息...','chat.send': '发送','chat.stopGeneration': '停止生成',diff --git a/app/src/providers/useOpenHumanExternalStore.ts b/app/src/providers/useOpenHumanExternalStore.tsindex 4426b880f2..2e7913ca91 100644--- a/app/src/providers/useOpenHumanExternalStore.ts+++ b/app/src/providers/useOpenHumanExternalStore.ts@@ -1,7 +1,12 @@-import type { AppendMessage, RespondToToolApprovalOptions } from '@assistant-ui/react';+import type {+ AppendMessage,+ RespondToToolApprovalOptions,+ ThreadSuggestion,+} from '@assistant-ui/react';import { useCallback, useEffect, useMemo, useState } from 'react';import { mapDisplayItems } from '../features/conversations/derived/mapDisplayItems';+import { useT } from '../lib/i18n/I18nContext';import { type ApprovalDecision, decideApproval } from '../services/api/approvalApi';import { threadApi } from '../services/api/threadApi';import {@@ -17,6 +22,7 @@ import { buildRuntimeMessages } from './assistantUiMessages';import { getChatSurface } from './chatSurfaceHandlers';const EMPTY_MESSAGES: ThreadMessage[] = [];+const EMPTY_SUGGESTIONS: readonly ThreadSuggestion[] = [];const EMPTY_TIMELINE: never[] = [];const EMPTY_TRANSCRIPT: never[] = [];const EMPTY_TURN_MAP = {};@@ -167,6 +173,61 @@ function appendMessageText(message: AppendMessage): string {.trim();}+/**+ * The starter prompts offered on an empty thread, in display order.+ *+ * Each key's translation is used as BOTH the chip's text and the message the+ * chip sends: `ThreadSuggestion.title` falls back to `prompt` upstream+ * (`@assistant-ui/core`'s suggestions client, `title: s.title ?? s.prompt`), so+ * one string per suggestion keeps the chip and the sent turn from ever drifting+ * apart — and keeps this at six translated strings rather than twelve.+ */+const WELCOME_SUGGESTION_KEYS = [+ 'chat.welcomeSuggestion.calendarToday',+ 'chat.welcomeSuggestion.unreadEmail',+ 'chat.welcomeSuggestion.draftReply',+ 'chat.welcomeSuggestion.followUps',+ 'chat.welcomeSuggestion.connectIntegration',+ 'chat.welcomeSuggestion.dailySummaryFlow',+] as const;++/**+ * Starter chips for an empty thread — and nothing once the thread has content.+ *+ * **The emptiness gate is the whole point of this hook, not an optimisation.**+ * The welcome chips and the follow-up chips read the *same* field+ * (`s.thread.suggestions`) and their render gates are complementary rather than+ * overlapping, so between them they partition every state:+ *+ * - welcome — `isNewChatView && composer.isEmpty` (`thread.tsx`)+ * - follow-up — `!isEmpty && !isRunning && length > 0` (`follow-up-suggestions.tsx`)+ *+ * They therefore never render at the same time, which is exactly what makes an+ * ungated list dangerous: a constant set shows correctly on the empty thread and+ * then *reappears as follow-up chips under every settled turn, forever*. Static+ * starter prompts hanging under turn 30 are worse than no chips at all.+ *+ * Gating here — at the only inlet — keeps the follow-up surface empty until a+ * real per-turn producer exists. There is none today; see openhuman#6465, which+ * also records this constraint. Do not lift the gate to the renderer: the+ * renderer cannot distinguish the two surfaces, because they read one field.+ *+ * `messageCount` is the *runtime's* message count (settled turns plus any live+ * tail), which is precisely what `isNewChatView` tests upstream — not the+ * Redux row count, which excludes the in-flight turn and would leave the chips+ * up for the first streaming answer.+ */+function useWelcomeSuggestions(messageCount: number): readonly ThreadSuggestion[] {+ const { t } = useT();+ return useMemo(+ () =>+ messageCount === 0+ ? WELCOME_SUGGESTION_KEYS.map(key => ({ prompt: t(key) }))+ : EMPTY_SUGGESTIONS,+ [messageCount, t]+ );+}+/*** Build the `ExternalStoreAdapter` that backs `useExternalStoreRuntime`.*@@ -235,6 +296,8 @@ export function useOpenHumanExternalStore(threadId: string | null) {[messages, streaming, isRunning, liveTimeline, liveTranscript, pendingApproval, coreTranscript]);+ const suggestions = useWelcomeSuggestions(runtimeMessages.length);+// The status line titles its `tool_use` / `subagent` phases from the matching// running timeline row (the same rows the surface renders as tool parts), so// "Running command: npm test..." reads like the row rather than the raw tool@@ -306,12 +369,23 @@ export function useOpenHumanExternalStore(threadId: string | null) {isRunning,isLoading,extras,+ // Empty on any thread that has content — see `useWelcomeSuggestions`.+ suggestions,// Already `ThreadMessageLike`; the runtime's converter is the identity.convertMessage: (m: (typeof runtimeMessages)[number]) => m,onNew,onCancel,onRespondToToolApproval,}),- [runtimeMessages, isRunning, isLoading, extras, onNew, onCancel, onRespondToToolApproval]+ [+ runtimeMessages,+ isRunning,+ isLoading,+ extras,+ suggestions,+ onNew,+ onCancel,+ onRespondToToolApproval,+ ]);}