diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 6d608595848ee..8bf2ab68558ca 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -86,7 +86,10 @@ import { resolveWorkflowOpening, workflowOpeningParentThreadId, } from "@t3tools/client-runtime/state/subagentRuntime"; -import { threadSupportsProviderHandoff } from "@t3tools/client-runtime/state/thread-workflows"; +import { + getUserQueuedThreadRuns, + threadSupportsProviderHandoff, +} from "@t3tools/client-runtime/state/thread-workflows"; import { resolvePendingHandoff } from "@t3tools/client-runtime/handoff"; import { HandoffRow } from "./chat/V2LifecycleRow"; import { @@ -126,8 +129,6 @@ import { useActiveThreadRef } from "../hooks/useActiveThreadRef"; import { composerRequiresModifier } from "../composer-logic"; import { derivePhase, - deriveActivePlanState, - selectComposerTasksPlan, deriveActiveWorkStartedAt, deriveCanInterruptRunningThread, findLatestProposedPlan, @@ -352,6 +353,8 @@ import { ChatTerminalDrawers } from "./chat/ChatTerminalDrawers"; import { ChatRightPanel } from "./chat/ChatRightPanel"; import { useDraftEnvironmentRouting } from "./chat/useDraftEnvironmentRouting"; import { branchMismatchBannerItem } from "./chat/ThreadActivityBanners"; +import { ThreadNow } from "./chat/ThreadNow"; +import { useDelayedStatus } from "../hooks/useDelayedStatus"; import { useTimelineFollow } from "./chat/useTimelineFollow"; import { type EnvironmentUnavailableState, @@ -512,6 +515,8 @@ export default function ChatView(props: ChatViewProps) { status: threadStatus, }); const threadDetailLoading = threadSyncPhase === "loading"; + // Held back briefly, so a quick sync does not flash a status line at the end of the timeline. + const delayedThreadSyncPhase = useDelayedStatus(routeThreadKey, threadSyncPhase); const activeProviderThread = serverProjection?.providerThreads.find( (thread) => thread.id === serverProjection.thread.activeProviderThreadId, ); @@ -989,30 +994,6 @@ export default function ChatView(props: ChatViewProps) { ); const latestRunSettled = isLatestRunSettled(activeLatestRun, activeRuntime); - const activePlan = deriveActivePlanState(serverProjection, activeActivityRun?.runId); - const activeActivityRunSettled = isLatestRunSettled(activeActivityRun, activeRuntime); - const composerTasksPlan = selectComposerTasksPlan( - serverProjection, - activePlan, - activeActivityRun?.runId ?? null, - activeActivityRunSettled, - ); - const activeComposerTasksProgress = (() => { - if (!composerTasksPlan) return null; - const live = !activeActivityRunSettled && composerTasksPlan.runId === activeActivityRun?.runId; - const totalSteps = composerTasksPlan.steps.length; - if (totalSteps === 0) return null; - const completedSteps = composerTasksPlan.steps.filter( - (step) => step.status === "completed", - ).length; - const step = - composerTasksPlan.steps.find((candidate) => candidate.status === "inProgress")?.step ?? - composerTasksPlan.steps.find((candidate) => candidate.status === "pending")?.step ?? - composerTasksPlan.steps.at(-1)!.step; - return { step, completedSteps, totalSteps, live }; - })(); - const activeComposerTaskSteps = - activeComposerTasksProgress && composerTasksPlan ? composerTasksPlan.steps : null; const activeThreadEnvironmentId = activeThread?.environmentId; const activeThreadProjectId = activeThread?.projectId; const activeProjectRef = @@ -2007,6 +1988,7 @@ export default function ChatView(props: ChatViewProps) { onTimelineAnchorReadyStable, onTimelineAnchorSizeChangedStable, onToolOutputCollapsedAtEndStable, + onTimelineFooterGrowStable, onIsAtEndChangeStable, anchorNewTurn, attachTimelineViewport, @@ -2185,22 +2167,11 @@ export default function ChatView(props: ChatViewProps) { modelStrip.offsetHeight + Number.parseFloat(getComputedStyle(modelStrip).marginTop), ) : 0; - const noticeStack = composerOverlayElement?.querySelector( - '[data-composer-banner-stack="true"]', - ); - const expandedNoticesHeight = noticeStack - ? Math.max( - 0, - noticeStack.getBoundingClientRect().height - - Number.parseFloat(getComputedStyle(noticeStack).minHeight), - ) - : 0; const nextInset = resolveComposerTimelineInset({ currentInset: composerTimelineInsetRef.current, overlayHeight: height, isResting, restingOnlyHeight, - expandedNoticesHeight, }); if (composerTimelineInsetRef.current !== nextInset) { composerTimelineInsetRef.current = nextInset; @@ -2226,9 +2197,8 @@ export default function ChatView(props: ChatViewProps) { const mainSurface = composerOverlayElement?.querySelector( '[data-chat-composer-main-surface="true"]', ); - const button = composerOverlayElement?.parentElement?.querySelector( - 'button[aria-label="Scroll to end"]', - ); + const button = + composerOverlayElement?.parentElement?.querySelector("[data-scroll-to-end]"); const clearance = composerOverlayElement && mainSurface && button ? resolveScrollToEndClearance({ @@ -2383,9 +2353,9 @@ export default function ChatView(props: ChatViewProps) { const { acknowledgeActiveThreadWoke, activeBranchMismatchKey, - backgroundWorkBanner, - childInputBanner, - goalBanner, + backgroundWorkNow, + childInputNow, + goalNow, handleSwitchCheckoutToThread, handleSwitchCheckoutToThreadStable, isRestoringThreadBranch, @@ -2550,9 +2520,6 @@ export default function ChatView(props: ChatViewProps) { : null; const composerBannerItems = (() => { const limitRecoveryItems = limitRecoveryBanner === null ? [] : [limitRecoveryBanner]; - const backgroundWorkItems = [childInputBanner, goalBanner, backgroundWorkBanner].filter( - (item) => item !== null, - ); const usageLimitsItems = usageLimitsBanner === null ? [] : [usageLimitsBanner]; const projectCloneItems = projectCloneBannerItem === null ? [] : [projectCloneBannerItem]; if (!localCheckoutBranchMismatch || !showBranchMismatchBanner || !activeBranchMismatchKey) { @@ -2562,7 +2529,6 @@ export default function ChatView(props: ChatViewProps) { ...usageLimitsItems, ...projectCloneItems, ...systemComposerBannerItems, - ...backgroundWorkItems, ]; } return [ @@ -2571,7 +2537,6 @@ export default function ChatView(props: ChatViewProps) { ...usageLimitsItems, ...projectCloneItems, ...systemComposerBannerItems, - ...backgroundWorkItems, branchMismatchBannerItem({ mismatchKey: activeBranchMismatchKey, mismatch: localCheckoutBranchMismatch, @@ -2979,6 +2944,66 @@ export default function ChatView(props: ChatViewProps) { openExpandedImagePreview(routeThreadKey, preview); }; const onExpandTimelineImageStable = useStableCallback(onExpandTimelineImage); + const shownThreadSyncPhase = activeEnvironmentUnavailable ? null : delayedThreadSyncPhase; + const hasThreadNow = + childInputNow !== null || + backgroundWorkNow !== null || + goalNow !== null || + shownThreadSyncPhase !== null; + const queuedRunCount = serverProjection ? getUserQueuedThreadRuns(serverProjection).length : 0; + // The queue control is mounted for every server thread but joins the footer only while it shows + // something, by its own rule: an optimistic message stops counting once the server has it. + const hasQueuedTurns = + queuedRunCount > 0 || + optimisticUserMessages.some( + (message) => + message.inputIntent === "queued_turn" && + !serverProjection?.messages.some((committed) => committed.id === message.id), + ); + const scrollToEndSummary = + [ + childInputNow === null ? null : "Subagent waiting", + queuedRunCount === 0 ? null : `${queuedRunCount} queued`, + ] + .filter((part) => part !== null) + .join(" · ") || null; + // The end of the timeline holds the thread's present and next turns: what it is doing now, + // its lifecycle status, guest messages awaiting you, then your queued messages. + const timelineFooter = + pendingHandoff === null && + !hasThreadNow && + threadStatusLine === null && + pendingGuestMessageCount === 0 && + !hasQueuedTurns ? null : ( + <> + {pendingHandoff === null ? null : ( +
+ +
+ )} + + {threadStatusLine} + {pendingGuestMessageCount > 0 && isServerThread && activeThread ? ( + + ) : null} + {hasQueuedTurns ? queuedRunsControl : null} + + ); const pendingSidebarFileDrops = useSidebarPendingFileDropStore((state) => state.pending); const consumePendingFileDrop = useSidebarPendingFileDropStore( @@ -3265,33 +3290,7 @@ export default function ChatView(props: ChatViewProps) { : {})} {...(onOpenWorktreeSetupTerminal ? { onOpenWorktreeSetupTerminal } : {})} isPreparingWorktree={!paintOnlyDisplayedTimeline && isPreparingWorktree} - footer={ - paintOnlyDisplayedTimeline || - (pendingHandoff === null && - pendingGuestMessageCount === 0 && - threadStatusLine === null) ? null : ( - <> - {pendingHandoff === null ? null : ( -
- -
- )} - {pendingGuestMessageCount > 0 && isServerThread && activeThread ? ( - - ) : null} - {threadStatusLine} - - ) - } + footer={paintOnlyDisplayedTimeline ? null : timelineFooter} listRef={legendListRef} runs={paintOnlyDisplayedTimeline ? [] : (serverProjection?.runs ?? [])} latestRun={paintOnlyDisplayedTimeline ? null : activeActivityRun} @@ -3367,6 +3366,7 @@ export default function ChatView(props: ChatViewProps) { onContentOverflowChange={setTimelineOverflows} onToolOutputCollapsedAtEnd={onToolOutputCollapsedAtEndStable} onViewportAttach={attachTimelineViewport} + onFooterGrow={onTimelineFooterGrowStable} hideEmptyPlaceholder={isDraftHeroState || threadDetailLoading} emptyPlaceholderInset={composerReservedHeight} topFadeEnabled={!hasTimelineTopBanner} @@ -3378,6 +3378,7 @@ export default function ChatView(props: ChatViewProps) { {showScrollToBottom && !isThreadFindActive && ( { composerRef.current?.restoreAfterTimelineReachedEnd(); scrollToEnd(true); @@ -3521,7 +3522,6 @@ export default function ChatView(props: ChatViewProps) { : projectCloneSendBlockReason } isPreparingWorktree={isPreparingWorktree && !sendQueuesBehindSetup} - queuedRunsControl={queuedRunsControl} bannerItems={composerBannerItems} resumeCompactionTokens={resumeCompactionTokens} keepFullHistory={keepFullHistory} @@ -3559,8 +3559,6 @@ export default function ChatView(props: ChatViewProps) { activeThreadModelSelection={activeThread?.modelSelection} activeProjectId={activeProject?.id ?? null} activeContextWindow={activeContextWindow} - activeTasksProgress={activeComposerTasksProgress} - activeTaskSteps={activeComposerTaskSteps} compactThreadUnavailable={compactThreadUnavailable} compactDisabled={compactDisabled} compactDisabledReason={compactDisabledReason} diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index caae00048fc9e..d7b46eea0abc0 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -48,7 +48,6 @@ import { createModelSelection, normalizeModelSlug } from "@t3tools/shared/model" import { USAGE_LIMITS_COMMAND } from "@t3tools/shared/usageLimits"; import { memo, - type ReactNode, useEffect, useEffectEvent, useId, @@ -105,14 +104,6 @@ import { useComposerTriggerState } from "./useComposerTriggerState"; import { useComposerMenuItems } from "./useComposerMenuItems"; import { useComposerFocusState } from "./useComposerFocusState"; import { useComposerMultilinePrompt } from "./useComposerMultilinePrompt"; -import { - ComposerTasksBadge, - ComposerTasksContent, - ComposerTasksDrawer, - type ComposerTaskStep, - type ComposerTasksProgress, -} from "./ComposerTasksBadge"; -import { ComposerActivityRow } from "./ComposerActivityStatus"; import { reconcileAttachmentContextReferences, useRetainedContextPayloads, @@ -120,11 +111,7 @@ import { import type { ThreadSyncPhase } from "../../threadSync"; import { ComposerBanner } from "./ComposerBanner"; import { ComposerSurface } from "./ComposerSurface"; -import { - ComposerBannerStack, - type ComposerBannerStackContent, - type ComposerBannerStackItem, -} from "./ComposerBannerStack"; +import { ComposerBannerStack, type ComposerBannerStackItem } from "./ComposerBannerStack"; import { attachmentsToReleaseOnUploadCapabilityLoss, composerOtherFilesForPresentation, @@ -274,7 +261,6 @@ import { resolveProviderSkillsForCwd, resolveProviderSlashCommandsForCwd, } from "@t3tools/client-runtime/providerSkills"; -import { useDelayedStatus } from "../../hooks/useDelayedStatus"; import { useMediaQuery } from "../../hooks/useMediaQuery"; import { useSoftwareKeyboardOpen } from "../../hooks/useSoftwareKeyboardOpen"; import { useStableCallback } from "../../hooks/useStableCallback"; @@ -435,8 +421,6 @@ export interface ChatComposerProps { showPlanFollowUpPrompt: boolean; activeProposedPlan: LatestProposedPlanState | null; - activeTasksProgress: ComposerTasksProgress | null; - activeTaskSteps: readonly ComposerTaskStep[] | null; threadSyncPhase: ThreadSyncPhase | null; runtimeMode: RuntimeMode; @@ -481,7 +465,6 @@ export interface ChatComposerProps { onPageScrollKeyUp: (key: string) => void; onPageScrollRelease: () => void; - queuedRunsControl?: ReactNode; editingQueuedAttachments: ReadonlyArray<{ readonly attachment: ContractChatAttachment; readonly url: string | null; @@ -663,9 +646,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) const activePendingProgress = holdingUserInput ? null : incomingPendingProgress; const activePendingIsResponding = !holdingUserInput && incomingPendingIsResponding; const isLiteralPendingAnswer = activePendingProgress?.activeQuestion?.initialAnswer !== undefined; - const shownSyncPhase = useDelayedStatus(composerDraftTargetKey, props.threadSyncPhase); - const activeTasksProgress = shownSyncPhase === null ? props.activeTasksProgress : null; - const activeTaskSteps = shownSyncPhase === null ? props.activeTaskSteps : null; const isEditingQueuedMessage = editingQueuedAttachments !== null; const composerDraft = useComposerThreadDraft(composerDraftTarget); const composerDraftTargetKeyRef = useRef(""); @@ -1097,7 +1077,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) const [composerMenuAnchor, setComposerMenuAnchor] = useState(null); const [hasWrappedPrompt, observeWrappedPrompt] = useComposerMultilinePrompt(); const hasMultilinePrompt = prompt.includes("\n") || hasWrappedPrompt; - const [isTasksDrawerOpen, setIsTasksDrawerOpen] = useState(false); // A pending question stays expanded: its card moves into the banner dock, // so collapsing would leave the surface empty and squashed beneath it. const isComposerCollapsedMobile = @@ -2309,28 +2288,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) importContextRecords, expandMobileComposer: expandMobileComposerStable, }); - const toggleTasksDrawer = () => { - setIsTasksDrawerOpen((open) => !open); - }; - const toggleTasksDrawerStable = useStableCallback(toggleTasksDrawer); - const hasBannerItems = props.bannerItems.length > 0; const hasBlockingComposerTopDrawer = activePendingApproval !== null || pendingUserInputs.length > 0; - const showInlineTasksBadge = - activeTasksProgress !== null && - activeTaskSteps !== null && - !isTasksDrawerOpen && - !hasBlockingComposerTopDrawer && - (hasBannerItems || showComposerTopDrawer || isComposerCollapsedMobile); - const inlineTasksBadge = showInlineTasksBadge ? ( - - ) : null; const hasImageAttachmentAttention = standaloneComposerImages.some((image) => { const upload = uploadsByImageId[image.id]; const failedInCurrentEnvironment = @@ -2341,7 +2300,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) }); const composerHasExpandedChrome = showComposerTopDrawer || - isTasksDrawerOpen || composerMenuOpen || isStashMenuOpen || isDragOverComposer || @@ -2421,8 +2379,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) canTrackComposerScrollGesture && settings.composerCollapseOnScroll && !hasMultilinePrompt && - !composerHasExpandedChrome && - !showInlineTasksBadge; + !composerHasExpandedChrome; const composerScrollCollapseEligible = canScrollCollapseComposer && !isComposerResting; useLayoutEffect(() => { composerScrollCollapseEligibleRef.current = composerScrollCollapseEligible; @@ -2586,48 +2543,14 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) getModelDisabledReason={getModelDisabledReason} /> ); - const showTasksTab = - !hasBannerItems && - !showComposerTopDrawer && - !isTasksDrawerOpen && - !isComposerCollapsedMobile && - activeTasksProgress !== null && - activeTaskSteps !== null && - activeTasksProgress.totalSteps > 0; - const activityStackContent = hasBannerItems ? ( - shownSyncPhase ? ( - - ) : !hasBlockingComposerTopDrawer && activeTasksProgress && activeTaskSteps ? ( - - ) : null - ) : null; - const activityStackItem: ComposerBannerStackContent | null = activityStackContent - ? { - id: "composer-activity", - variant: "default", - priority: "activity", - content: activityStackContent, - } - : null; - const bannerStackItems = activityStackItem - ? [activityStackItem, ...props.bannerItems] + // An open approval or question owns the space above the composer. Only a machine problem, + // which is why an answer could not go through, stays beside it. + const shelfItems = hasBlockingComposerTopDrawer + ? props.bannerItems.filter( + (item) => + item.group === "environment" && (item.variant === "error" || item.variant === "warning"), + ) : props.bannerItems; - const [tasksDrawerThreadId, setTasksDrawerThreadId] = useState(activeThreadId); - if ( - isTasksDrawerOpen && - (activeTasksProgress === null || - activeTaskSteps === null || - hasBlockingComposerTopDrawer || - tasksDrawerThreadId !== activeThreadId) - ) { - setIsTasksDrawerOpen(false); - } - if (tasksDrawerThreadId !== activeThreadId) setTasksDrawerThreadId(activeThreadId); const insertComposerText = ( text: string, @@ -3478,20 +3401,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) : null} - - {!activityStackItem && (shownSyncPhase || inlineTasksBadge) ? ( - - - {shownSyncPhase ? : inlineTasksBadge} - - - ) : null} - {showComposerTopDrawer && (!isTasksDrawerOpen || hasBlockingComposerTopDrawer) ? ( + + {showComposerTopDrawer ? ( ) : null} - {!activityStackItem && - isTasksDrawerOpen && - !hasBlockingComposerTopDrawer && - activeTasksProgress && - activeTaskSteps ? ( - - ) : null} - {showTasksTab ? ( - - - - ) : null} - - - - - - {threadSyncLabel(phase)} - - - - ); -} diff --git a/apps/web/src/components/chat/ComposerBanner.tsx b/apps/web/src/components/chat/ComposerBanner.tsx index be7e268ccb48d..ef07497171ee2 100644 --- a/apps/web/src/components/chat/ComposerBanner.tsx +++ b/apps/web/src/components/chat/ComposerBanner.tsx @@ -34,26 +34,22 @@ const variantColors: Record = { }; function Surface({ - placement = "attached", variant = "default", className, ...props }: ComponentProps<"div"> & { - placement?: "attached" | "floating"; variant?: ComposerBannerVariant; }) { return (
= { - default: "border-(--chat-composer-attached-outline)", - error: "border-destructive/24", - info: "border-(--chat-composer-attached-outline)", - success: "border-(--chat-composer-attached-outline)", - warning: "border-warning/24", -}; - -function Peek({ - className, - variant = "default", - ...props -}: ComponentProps<"button"> & { variant?: ComposerBannerVariant }) { - return ( - - ) : null} - - - {isEditing ? Editing queued message: : null} - {item.pending ? ( - - ) : null} - {item.thumbnails.length > 0 ? ( - - {item.thumbnails.map((thumbnail) => ( + {thumbnail.url ? ( + {thumbnail.name} + ) : ( - {thumbnail.url ? ( - {thumbnail.name} - ) : ( - - )} - - ))} + aria-label={thumbnail.name} + className="block size-full bg-muted/60" + /> + )} - ) : null} + ))} + + ) : null} + {/* In full, like a sent turn: a queued message is read before it is sent. */} + {previewText ? ( +

{item.guestName === undefined ? null : ( - {item.guestName} + {item.guestName} )} + {previewText} +

+ ) : null} +
+
+ {items.length > 1 && canReorder && rowRunId !== null && rowServerIndex !== null ? ( + + ) : items.length > 1 ? ( + {position + 1} + ) : null} + {item.pending ? ( + + + Saving + + ) : null} + {isEditing ? ( + <> + Editing in the composer + + + ) : ( + <> - }> - {previewText} + {/* The span keeps the tooltip, and its reason, on a disabled button. */} + }> + - - {previewText} + + {props.editBlockedReason ?? + `Edit in the composer${item.serverIndex === queued.length - 1 && props.editShortcutLabel ? ` (${props.editShortcutLabel})` : ""}`} - - - {isEditing ? ( - - ) : ( - <> - - {/* The span keeps the tooltip, and its reason, on a disabled button. */} - }> - - - - {props.editBlockedReason ?? - `Edit in the composer${item.serverIndex === queued.length - 1 && props.editShortcutLabel ? ` (${props.editShortcutLabel})` : ""}`} - - - - }> - - - - {`${workflow?.canSendNow ? "Start a turn with this message" : "Send as a steer instead"}${item.serverIndex === 0 && props.steerShortcutLabel ? ` (${props.steerShortcutLabel})` : ""}`} - - - - { - if (item.runId !== null) void remove(item.runId); - }} - /> + + }> + + + + {`${workflow?.canSendNow ? "Start a turn with this message" : "Send as a steer instead"}${item.serverIndex === 0 && props.steerShortcutLabel ? ` (${props.steerShortcutLabel})` : ""}`} + + + + { + if (item.runId !== null) void remove(item.runId); + }} /> - Remove from queue - - - )} - - - ); - })} - - - - + } + > + + + Remove from queue + + + )} +
+ + ); + })} + + {collapsible ? ( +
+ event.preventDefault()} + onClick={() => setShowAll((value) => !value)} + > + {showAll ? "Show fewer" : `Show all ${items.length} queued`} + + +
+ ) : null} + ); } diff --git a/apps/web/src/components/chat/ThreadActivityBanners.tsx b/apps/web/src/components/chat/ThreadActivityBanners.tsx index 39a60ed27ce3e..e132587a75951 100644 --- a/apps/web/src/components/chat/ThreadActivityBanners.tsx +++ b/apps/web/src/components/chat/ThreadActivityBanners.tsx @@ -15,21 +15,25 @@ import { cn } from "~/lib/utils"; import { Button, InlineButton } from "../ui/button"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import type { ComposerBannerStackItem } from "./ComposerBannerStack"; +import type { ThreadNowItem } from "./ThreadNow"; /** Subagents waiting on the user, unless the parent is itself waiting on them. */ -export function childInputBannerItem(input: { +export function childInputNowItem(input: { readonly childThreadInputs: ReadonlyArray; readonly parentAwaitingUser: boolean; readonly onOpenThread: (threadId: ThreadId) => void; -}): ComposerBannerStackItem | null { +}): ThreadNowItem | null { const { childThreadInputs, onOpenThread } = input; const first = childThreadInputs[0]; if (!first || input.parentAwaitingUser) return null; return { id: `child-input:${first.id}`, - variant: "info", - priority: "activity", - icon: first.hasPendingApprovals ? : , + // The only line at the end of the timeline that needs you gets the info color. + icon: first.hasPendingApprovals ? ( + + ) : ( + + ), title: childThreadInputsTitle(childThreadInputs), description: childThreadInputs.map((child, index) => ( @@ -43,25 +47,24 @@ export function childInputBannerItem(input: { )), actions: ( - + ), }; } -export function goalBannerItem(input: { +/** The thread's goal, for the end of the timeline. */ +export function goalNowItem(input: { readonly threadId: ThreadId; readonly goal: OrchestrationV2ProviderGoal; readonly isWorking: boolean; readonly onSendCommand: (text: string, failureMessage: string) => Promise; -}): ComposerBannerStackItem { +}): ThreadNowItem { const { isWorking, onSendCommand } = input; const presentation = presentProviderGoal(input.goal, isWorking); return { id: `goal:${input.threadId}`, - variant: "default", - priority: "activity", icon: , title: presentation.usage === null @@ -72,46 +75,45 @@ export function goalBannerItem(input: { actions: ( <> {presentation.canResume && !isWorking ? ( - + <> + void onSendCommand("/goal resume", "Failed to resume goal.")} + > + Resume + + · + ) : null} - + ), }; } -export function backgroundWorkBannerItem(input: { +/** Background commands and subagents, for the end of the timeline. */ +export function backgroundWorkNowItem(input: { readonly threadId: ThreadId; readonly tasks: ReadonlyArray; readonly stopDisabled: boolean; readonly stopping: boolean; readonly onStop: () => Promise; readonly onOpenThread: (threadId: ThreadId) => void; -}): ComposerBannerStackItem | null { +}): ThreadNowItem | null { const { onOpenThread } = input; const presentation = presentPendingBackgroundWork(input.tasks); if (presentation === null) return null; return { id: `background-work:${input.threadId}`, - variant: "default", - priority: "activity", icon: (