Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed app/src/providers/AssistantUiRuntimeProvider.tsx,app/src/providers/useOpenHuman

Steven Enamakeld3a7102a2e50
diff --git a/app/src/providers/AssistantUiRuntimeProvider.tsx b/app/src/providers/AssistantUiRuntimeProvider.tsx
index 1718fb6eac..52d8bc190d 100644
--- a/app/src/providers/AssistantUiRuntimeProvider.tsx
+++ b/app/src/providers/AssistantUiRuntimeProvider.tsx
@@ -37,11 +37,9 @@ export function useAuiThreadId(): string | null {
* It used to read `state.thread.selectedThreadId` itself. That is wrong for any
* surface whose thread is NOT the selected one, and there is exactly such a
* surface: the Workflow Copilot (`WorkflowCopilotPanel`) renders the shared
- * `ChatThreadView` against its own dedicated builder thread, which is never
- * equal to `selectedThreadId`. While nothing inside `ChatThreadView` read
- * assistant-ui context the mismatch was invisible; the moment the transcript
- * renders from `ThreadPrimitive`/`MessagePrimitive` it would paint the HOME
- * chat's messages inside the copilot. So the thread is chosen by whoever mounts
+ * assistant-ui `Thread` against its own dedicated builder thread, which is
+ * never equal to `selectedThreadId`. Reading the selection here would paint
+ * the HOME chat's messages inside the copilot. So the thread is chosen by whoever mounts
* the runtime, and two instances with different thread ids can coexist —
* assistant-ui's `AssistantRuntimeProvider` is ordinary React context, so the
* nearest one wins for each subtree.
@@ -57,6 +55,7 @@ export function useAuiThreadId(): string | null {
*/
export function AssistantUiRuntimeProvider({
threadId,
+ welcomeSuggestions = true,
children,
}: {
/**
@@ -65,6 +64,8 @@ export function AssistantUiRuntimeProvider({
* created it yet.
*/
threadId?: string | null;
+ /** Offer the home chat's starter prompts on an empty thread; see the store. */
+ welcomeSuggestions?: boolean;
children: ReactNode;
}) {
const selectedThreadId = useAppSelector(state => state.thread.selectedThreadId);
@@ -74,7 +75,7 @@ export function AssistantUiRuntimeProvider({
effectiveThreadId ?? '(none)',
threadId === undefined ? 'selection' : 'explicit'
);
- const adapter = useOpenHumanExternalStore(effectiveThreadId);
+ const adapter = useOpenHumanExternalStore(effectiveThreadId, { welcomeSuggestions });
const runtime = useExternalStoreRuntime(adapter);
return (
<AssistantRuntimeProvider runtime={runtime}>
diff --git a/app/src/providers/useOpenHumanExternalStore.ts b/app/src/providers/useOpenHumanExternalStore.ts
index dac07346db..fb5e01b75b 100644
--- a/app/src/providers/useOpenHumanExternalStore.ts
+++ b/app/src/providers/useOpenHumanExternalStore.ts
@@ -220,14 +220,17 @@ const WELCOME_SUGGESTION_KEYS = [
* 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[] {
+function useWelcomeSuggestions(
+ messageCount: number,
+ enabled: boolean
+): readonly ThreadSuggestion[] {
const { t } = useT();
return useMemo(
() =>
- messageCount === 0
+ enabled && messageCount === 0
? WELCOME_SUGGESTION_KEYS.map(key => ({ prompt: t(key) }))
: EMPTY_SUGGESTIONS,
- [messageCount, t]
+ [enabled, messageCount, t]
);
}
@@ -267,7 +270,19 @@ function appendMessageQuote(message: AppendMessage): string {
* reasoning/tool/sub-agent history comes directly from the core transcript
* projection. Redux is not a second transcript database.
*/
-export function useOpenHumanExternalStore(threadId: string | null) {
+export function useOpenHumanExternalStore(
+ threadId: string | null,
+ {
+ welcomeSuggestions = true,
+ }: {
+ /**
+ * Offer the home chat's starter prompts on an empty thread. Off for a
+ * surface whose agent is not the general assistant (the workflow copilot):
+ * a click SENDS the prompt, and those prompts are not builder requests.
+ */
+ welcomeSuggestions?: boolean;
+ } = {}
+) {
const dispatch = useAppDispatch();
const messages = useAppSelector(state =>
threadId ? (state.thread.messagesByThreadId[threadId] ?? EMPTY_MESSAGES) : EMPTY_MESSAGES
@@ -328,7 +343,7 @@ export function useOpenHumanExternalStore(threadId: string | null) {
[messages, streaming, isRunning, liveTimeline, liveTranscript, pendingApproval, coreTranscript]
);
- const suggestions = useWelcomeSuggestions(runtimeMessages.length);
+ const suggestions = useWelcomeSuggestions(runtimeMessages.length, welcomeSuggestions);
// 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