AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(chat): watch task agents work in a side panel (#16170)
Hazem Adel283389e4a97e
diff --git a/packages/core/execution/src/lib/workers/agent-events.ts b/packages/core/execution/src/lib/workers/agent-events.tsindex 7f4d3fdb8ab..ce6279c6db8 100644--- a/packages/core/execution/src/lib/workers/agent-events.ts+++ b/packages/core/execution/src/lib/workers/agent-events.ts@@ -93,11 +93,14 @@ export type BuildPlanEvent = {updatedAt: string}+export type SubagentTimelineEntry = { kind: 'status', text: string }+export type SubagentActivity = {taskId?: stringtitle: stringstatus: 'running' | 'done' | 'blocked' | 'failed'statusLine?: string+ timeline?: SubagentTimelineEntry[]stepCount: numberpieces?: string[]artifacts?: { type: string, id: string, name: string }[]diff --git a/packages/server/worker/src/lib/execute/jobs/ee/agent/tools/task-subagent-tools.ts b/packages/server/worker/src/lib/execute/jobs/ee/agent/tools/task-subagent-tools.tsindex f96a55615ca..9a684a98862 100644--- a/packages/server/worker/src/lib/execute/jobs/ee/agent/tools/task-subagent-tools.ts+++ b/packages/server/worker/src/lib/execute/jobs/ee/agent/tools/task-subagent-tools.ts@@ -1,5 +1,5 @@import { isNil, isObject, omit, tryCatch } from '@activepieces/core-utils'-import { AGENT_SURFACE_TOOLS, AgentPhase, BeginAgentTaskResponse, chatBilling, FinishAgentTaskRequest, PersistedAgentPart, PersistedAgentPartType, PersistedToolCallStatus, SkillSurface, SubagentActivity, SubagentTaskArtifact, TASK_COMPLETION_TOOL_NAME } from '@activepieces/shared'+import { AGENT_SURFACE_TOOLS, AgentPhase, BeginAgentTaskResponse, chatBilling, FinishAgentTaskRequest, PersistedAgentPart, PersistedAgentPartType, PersistedToolCallStatus, SkillSurface, SubagentActivity, SubagentTaskArtifact, SubagentTimelineEntry, TASK_COMPLETION_TOOL_NAME } from '@activepieces/shared'import { hasToolCall, isLoopFinished, ModelMessage, tool, ToolSet } from 'ai'import { z } from 'zod'import { AgentTurnResult, runAgentTurn, RunAgentTurnParams } from '../run-agent-turn'@@ -20,7 +20,7 @@ export function createTaskSubagentTools({ tools, taskPrompt, ...rest }: Omit<Tas}return {[TASK_TOOL_NAME]: tool({- description: 'Hand one self-contained goal to a focused sub-agent with its own fresh context and the same tools you have (read, search, build, update, execute; risky actions still ask the user for approval). Use it when it buys something: independent goals that can run in parallel (several calls in one step run at once), or noisy preparation with a short answer (going through many records or runs, investigating a failure). Build flows yourself, even several at once, and make small edits yourself. It cannot ask the user anything: when it needs something only the user can give it finishes as blocked and says what. Pass taskId to continue a task you started earlier in this conversation (after a block, or for a follow-up on what it built).',+ description: 'Hand one self-contained goal to a focused sub-agent with its own fresh context and the same tools you have (read, search, build, update, execute; risky actions still ask the user for approval). Use it when it buys something: independent goals that can run in parallel (several calls in one step run at once), or noisy preparation with a short answer (going through many records or runs, investigating a failure). Build flows yourself, even several at once, and make small edits yourself. It cannot ask the user anything: when it needs something only the user can give it finishes as blocked and says what; ask the user for it in your own words, then pass their answer back. Pass taskId to continue a task you started earlier in this conversation (after a block, or for a follow-up on what it built).',inputSchema: taskInput,toModelOutput: ({ output }) => ({ type: 'text', value: JSON.stringify(omit(output, ['activity', 'billedToolCalls'])) }),execute: async ({ title, brief, taskId }, { toolCallId }) => runTask({ deps, title, brief, taskId, progressId: toolCallId }),@@ -220,11 +220,13 @@ function fallbackResult(turn: AgentTurnResult): TaskResult {}function runningActivity({ title, uiParts, startedAt }: { title: string, uiParts: PersistedAgentPart[], startedAt: Date }): SubagentActivity {- const statuses = statusLines(uiParts)+ const timeline = timelineFrom(uiParts)+ const statuses = timeline.flatMap((entry) => entry.kind === 'status' ? [entry.text] : [])return {title,status: 'running',- statusLine: statuses[statuses.length - 1] ?? lastToolTitle(uiParts),+ statusLine: statuses[statuses.length - 1],+ timeline,stepCount: uiParts.filter((part) => part.type === PersistedAgentPartType.TOOL_CALL).length,pieces: piecesFrom(uiParts),startedAt: startedAt.toISOString(),@@ -242,16 +244,21 @@ function finalActivity({ title, turn, result, startedAt }: { title: string, turn}}-function lastToolTitle(parts: PersistedAgentPart[]): string | undefined {- return parts.filter(isTitledToolCall).at(-1)?.title.trim()-}-function isTitledToolCall(part: PersistedAgentPart): part is Extract<PersistedAgentPart, { type: PersistedAgentPartType.TOOL_CALL }> & { title: string } {return part.type === PersistedAgentPartType.TOOL_CALL && !isNil(part.title) && part.title.trim().length > 0}-function statusLines(parts: PersistedAgentPart[]): string[] {- return parts.flatMap((part) => part.type === PersistedAgentPartType.THINKING_STATUS && part.text.trim().length > 0 ? [part.text.trim()] : [])+function timelineFrom(parts: PersistedAgentPart[]): SubagentTimelineEntry[] {+ return parts.flatMap((part): SubagentTimelineEntry[] => {+ if (isTitledToolCall(part)) {+ return [{ kind: 'status', text: part.title.trim() }]+ }+ if (part.type !== PersistedAgentPartType.THINKING_STATUS) {+ return []+ }+ const text = part.text.trim()+ return text.length > 0 ? [{ kind: 'status', text }] : []+ })}function billedToolCalls(parts: PersistedAgentPart[]): { toolName: string, output: unknown }[] {diff --git a/packages/server/worker/test/lib/execute/jobs/ee/agent/task-subagent-tools.test.ts b/packages/server/worker/test/lib/execute/jobs/ee/agent/task-subagent-tools.test.tsindex 93d8735e54c..b4088173665 100644--- a/packages/server/worker/test/lib/execute/jobs/ee/agent/task-subagent-tools.test.ts+++ b/packages/server/worker/test/lib/execute/jobs/ee/agent/task-subagent-tools.test.ts@@ -63,6 +63,65 @@ describe('createTaskSubagentTools', () => {expect(finishTask).toHaveBeenCalledWith(expect.objectContaining({ status: 'BLOCKED' }))})+ it('puts each titled tool step in the timeline, so a task without status updates still shows its steps', async () => {+ runAgentTurn.mockImplementation(async (params: { tools: ToolSet }) => {+ await params.tools[TASK_COMPLETION_TOOL_NAME].execute?.({ status: 'done', summary: 'Built.', artifacts: [] }, EXECUTION_OPTIONS)+ return {+ ...turnResult(),+ uiParts: [+ { type: PersistedAgentPartType.TOOL_CALL, toolCallId: 'b1', toolName: 'ap_build_flow', title: 'Building your intake flow', input: {}, status: PersistedToolCallStatus.COMPLETED },+ { type: PersistedAgentPartType.TOOL_CALL, toolCallId: 'v1', toolName: 'ap_validate_flow', input: {}, status: PersistedToolCallStatus.COMPLETED },+ ],+ }+ })+ const tasks = createTaskSubagentTools({ ...BASE_PARAMS, tools: toolSet(['ap_build_flow']) })++ const result = await tasks['ap_run_task'].execute?.({ title: 'Build', brief: 'Build it' }, EXECUTION_OPTIONS)++ expect(result).toMatchObject({ activity: { statusLine: 'Building your intake flow', timeline: [{ kind: 'status', text: 'Building your intake flow' }] } })+ })++ it('sends the growing timeline with every live update', async () => {+ runAgentTurn.mockImplementation(async (params: { tools: ToolSet, sinks: { onProgress: (progress: { uiParts: unknown[] }) => void } }) => {+ const first = { type: PersistedAgentPartType.THINKING_STATUS, text: 'Looking at your Leads table' }+ params.sinks.onProgress({ uiParts: [first] })+ params.sinks.onProgress({ uiParts: [first, { type: PersistedAgentPartType.THINKING_STATUS, text: 'Checking the flow works' }] })+ await params.tools[TASK_COMPLETION_TOOL_NAME].execute?.({ status: 'done', summary: 'Built.', artifacts: [] }, EXECUTION_OPTIONS)+ return turnResult()+ })+ const tasks = createTaskSubagentTools({ ...BASE_PARAMS, tools: toolSet(['ap_build_flow']) })++ await tasks['ap_run_task'].execute?.({ title: 'Build', brief: 'Build it' }, EXECUTION_OPTIONS)++ const running = emitSubagentProgress.mock.calls.map(([event]) => event.data).filter((data) => data.status === 'running' && (data.timeline ?? []).length > 0)+ expect(running.map((data) => data.timeline)).toEqual([+ [{ kind: 'status', text: 'Looking at your Leads table' }],+ [{ kind: 'status', text: 'Looking at your Leads table' }, { kind: 'status', text: 'Checking the flow works' }],+ ])+ })++ it('streams its status steps as a timeline', async () => {+ runAgentTurn.mockImplementation(async (params: { tools: ToolSet }) => {+ await params.tools[TASK_COMPLETION_TOOL_NAME].execute?.({ status: 'done', summary: 'Built.', artifacts: [] }, EXECUTION_OPTIONS)+ return {+ ...turnResult(),+ uiParts: [+ { type: PersistedAgentPartType.THINKING_STATUS, text: 'Looking at your Leads table' },+ { type: PersistedAgentPartType.THINKING_STATUS, text: ' ' },+ { type: PersistedAgentPartType.THINKING_STATUS, text: 'Checking the flow works' },+ ],+ }+ })+ const tasks = createTaskSubagentTools({ ...BASE_PARAMS, tools: toolSet(['ap_build_flow']) })++ const result = await tasks['ap_run_task'].execute?.({ title: 'Build', brief: 'Build it' }, EXECUTION_OPTIONS)++ expect(result).toMatchObject({ activity: { statusLine: 'Checking the flow works', timeline: [+ { kind: 'status', text: 'Looking at your Leads table' },+ { kind: 'status', text: 'Checking the flow works' },+ ] } })+ })+it('keeps the card details out of what the main model reads', async () => {const tasks = createTaskSubagentTools({ ...BASE_PARAMS, tools: toolSet(['ap_build_flow']) })diff --git a/packages/web/public/locales/en/translation.json b/packages/web/public/locales/en/translation.jsonindex 3b6caf66255..6981845db0e 100644--- a/packages/web/public/locales/en/translation.json+++ b/packages/web/public/locales/en/translation.json@@ -3277,7 +3277,12 @@"Getting started": "Getting started","{count, plural, =1 {Working on a task} other {Working on # tasks at once}}": "{count, plural, =1 {Working on a task} other {Working on # tasks at once}}","{count, plural, =1 {Task finished} other {# tasks finished}}": "{count, plural, =1 {Task finished} other {# tasks finished}}",- "Needs your input": "Needs your input",+ "Paused, reply in the chat": "Paused, reply in the chat","Task": "Task",- "Asked by {taskTitle}": "Asked by {taskTitle}"+ "Asked by {taskTitle}": "Asked by {taskTitle}",+ "{count} tasks": "{count} tasks",+ "Exit full screen": "Exit full screen",+ "Full screen": "Full screen",+ "Findings": "Findings",+ "Made": "Made"}diff --git a/packages/web/src/app/routes/chat-with-ai/ai-chat-box.tsx b/packages/web/src/app/routes/chat-with-ai/ai-chat-box.tsxindex 5b810660bbf..6f95ae6799c 100644--- a/packages/web/src/app/routes/chat-with-ai/ai-chat-box.tsx+++ b/packages/web/src/app/routes/chat-with-ai/ai-chat-box.tsx@@ -49,6 +49,7 @@ import {PersonalizationChipState,} from './components/personalization-chip';import { QuickReplies } from './components/quick-replies';+import { TaskPanelLayout } from './components/task-panel';import { UserMessage } from './components/user-message';import { getTextFromParts } from './lib/message-parsers';@@ -78,19 +79,21 @@ export function AIChatBox({return (<ChatStoreProvider>- <ChatBoxContent- incognito={incognito}- initialPrompt={initialPrompt}- agentId={agentId}- builder={builder}- onTurnEnd={onTurnEnd}- emptyState={emptyState}- footerNote={footerNote}- placeholder={placeholder}- conversationId={conversationId}- onTitleUpdate={onTitleUpdate}- onConversationCreated={onConversationCreated}- />+ <TaskPanelLayout>+ <ChatBoxContent+ incognito={incognito}+ initialPrompt={initialPrompt}+ agentId={agentId}+ builder={builder}+ onTurnEnd={onTurnEnd}+ emptyState={emptyState}+ footerNote={footerNote}+ placeholder={placeholder}+ conversationId={conversationId}+ onTitleUpdate={onTitleUpdate}+ onConversationCreated={onConversationCreated}+ />+ </TaskPanelLayout></ChatStoreProvider>);}diff --git a/packages/web/src/app/routes/chat-with-ai/components/previews/preview-card.tsx b/packages/web/src/app/routes/chat-with-ai/components/previews/preview-card.tsxindex ff0e6d11dca..a1a7fda5269 100644--- a/packages/web/src/app/routes/chat-with-ai/components/previews/preview-card.tsx+++ b/packages/web/src/app/routes/chat-with-ai/components/previews/preview-card.tsx@@ -21,10 +21,12 @@ export function PreviewIconButton({icon: Icon,label,onClick,+ className,}: {icon: LucideIcon;label: string;onClick: () => void;+ className?: string;}) {return (<Tooltip>@@ -35,6 +37,7 @@ export function PreviewIconButton({type="button"onClick={onClick}aria-label={label}+ className={className}><Icon className="size-4" /></Button>diff --git a/packages/web/src/app/routes/chat-with-ai/components/subagent-card.tsx b/packages/web/src/app/routes/chat-with-ai/components/subagent-card.tsxindex 4755b620b62..62bd068c773 100644--- a/packages/web/src/app/routes/chat-with-ai/components/subagent-card.tsx+++ b/packages/web/src/app/routes/chat-with-ai/components/subagent-card.tsx@@ -2,10 +2,14 @@ import { isObject } from '@activepieces/core-utils';import { SubagentActivity } from '@activepieces/shared';import { t } from 'i18next';import { motion } from 'motion/react';+import { useContext } from 'react';+import { createPortal } from 'react-dom';import { TextWithTooltip } from '@/components/custom/text-with-tooltip';import { ToolCallMeta } from '@/features/chat/lib/chat-store';+import { useChatStoreContext } from '@/features/chat/lib/chat-store-context';import { AnyToolPart, chatPartUtils } from '@/features/chat/lib/chat-types';+import { cn } from '@/lib/utils';import {AppLogos,@@ -13,6 +17,7 @@ import {LiveLine,StatusMark,} from './subagent-primitives';+import { TaskPanel, TaskPanelSlotContext } from './task-panel';export function SubagentGroup({tasks,@@ -23,6 +28,10 @@ export function SubagentGroup({toolCallMeta: Record<string, ToolCallMeta>;isStreaming: boolean;}) {+ const panelToolCallId = useChatStoreContext((s) => s.taskPanelToolCallId);+ const openTaskPanel = useChatStoreContext((s) => s.openTaskPanel);+ const closeTaskPanel = useChatStoreContext((s) => s.closeTaskPanel);+ const panelSlot = useContext(TaskPanelSlotContext);const activities = tasks.map(({ toolCallId, part }) => ({toolCallId,activity: resolveActivity({@@ -34,6 +43,9 @@ export function SubagentGroup({const working = activities.some(({ activity }) => activity.status === 'running',);+ const panelOpenHere = activities.some(+ ({ toolCallId }) => toolCallId === panelToolCallId,+ );return (<motion.div@@ -54,27 +66,61 @@ export function SubagentGroup({</div><div className="pb-1.5">{activities.map(({ toolCallId, activity }) => (- <SubagentRow key={toolCallId} activity={activity} />+ <SubagentRow+ key={toolCallId}+ activity={activity}+ selected={toolCallId === panelToolCallId}+ onOpen={() => openTaskPanel(toolCallId)}+ />))}</div>+ {panelOpenHere &&+ panelSlot &&+ panelToolCallId &&+ createPortal(+ <TaskPanel+ tasks={activities}+ selectedToolCallId={panelToolCallId}+ onSelect={openTaskPanel}+ onClose={closeTaskPanel}+ />,+ panelSlot,+ )}</motion.div>);}-function SubagentRow({ activity }: { activity: SubagentActivity }) {+function SubagentRow({+ activity,+ selected,+ onOpen,+}: {+ activity: SubagentActivity;+ selected: boolean;+ onOpen: () => void;+}) {return (- <div className="flex items-center gap-3 px-4 py-2">- <StatusMark status={activity.status} />- <div className="min-w-0 flex-1">- <TextWithTooltip tooltipMessage={activity.title}>- <p className="truncate text-sm font-medium text-gray-12">- {activity.title}- </p>- </TextWithTooltip>- <LiveLine activity={activity} />- </div>- <AppLogos pieces={activity.pieces ?? []} />- <Duration activity={activity} />+ <div className="px-1.5">+ <button+ type="button"+ className={cn(+ 'flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-gray-3',+ selected && 'bg-gray-3',+ )}+ onClick={onOpen}+ >+ <StatusMark status={activity.status} />+ <div className="min-w-0 flex-1">+ <TextWithTooltip tooltipMessage={activity.title}>+ <p className="truncate text-sm font-medium text-gray-12">+ {activity.title}+ </p>+ </TextWithTooltip>+ <LiveLine activity={activity} />+ </div>+ <AppLogos pieces={activity.pieces ?? []} />+ <Duration activity={activity} />+ </button></div>);}diff --git a/packages/web/src/app/routes/chat-with-ai/components/subagent-primitives.tsx b/packages/web/src/app/routes/chat-with-ai/components/subagent-primitives.tsxindex 63abf96ad06..e2d752e27ef 100644--- a/packages/web/src/app/routes/chat-with-ai/components/subagent-primitives.tsx+++ b/packages/web/src/app/routes/chat-with-ai/components/subagent-primitives.tsx@@ -15,7 +15,7 @@ export function LiveLine({ activity }: { activity: SubagentActivity }) {if (activity.status === 'blocked') {return (<p className="text-xs leading-4 text-accent-11">- {t('Needs your input')}+ {t('Paused, reply in the chat')}</p>);}diff --git a/packages/web/src/app/routes/chat-with-ai/components/task-panel.tsx b/packages/web/src/app/routes/chat-with-ai/components/task-panel.tsxnew file mode 100644index 00000000000..276f8cad025--- /dev/null+++ b/packages/web/src/app/routes/chat-with-ai/components/task-panel.tsx@@ -0,0 +1,245 @@+import { SubagentActivity } from '@activepieces/shared';+import { t } from 'i18next';+import { Check, Loader2, Maximize2, Minimize2, X } from 'lucide-react';+import { motion } from 'motion/react';+import { createContext, useEffect, useRef, useState } from 'react';++import {+ ChatContainerContent,+ ChatContainerRoot,+} from '@/components/prompt-kit/chat-container';+import { Markdown } from '@/components/prompt-kit/markdown';+import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog';+import { chatStoreSelectors } from '@/features/chat/lib/chat-store';+import { useChatStoreContext } from '@/features/chat/lib/chat-store-context';+import { useElementSize } from '@/hooks/use-element-size';+import { cn } from '@/lib/utils';++import { PreviewIconButton } from './previews/preview-card';+import { Duration, LiveLine, StatusMark } from './subagent-primitives';++export function TaskPanel({+ tasks,+ selectedToolCallId,+ onSelect,+ onClose,+}: {+ tasks: { toolCallId: string; activity: SubagentActivity }[];+ selectedToolCallId: string;+ onSelect: (toolCallId: string) => void;+ onClose: () => void;+}) {+ const [fullscreen, setFullscreen] = useState(false);+ const docked = useDocked();+ const selected = tasks.find(+ ({ toolCallId }) => toolCallId === selectedToolCallId,+ );+ if (!selected) return null;+ const title =+ tasks.length > 1+ ? t('{count} tasks', { count: tasks.length })+ : selected.activity.title;+ const body = (+ <>+ <div className="flex items-center gap-1 border-b px-4 py-2.5">+ <p className="flex-1 truncate text-sm font-medium text-gray-12">+ {title}+ </p>+ {docked && (+ <PreviewIconButton+ icon={fullscreen ? Minimize2 : Maximize2}+ label={fullscreen ? t('Exit full screen') : t('Full screen')}+ onClick={() => setFullscreen((value) => !value)}+ />+ )}+ <PreviewIconButton icon={X} label={t('Close')} onClick={onClose} />+ </div>++ {tasks.length > 1 && (+ <div className="flex gap-1 border-b px-3 py-2">+ {tasks.map(({ toolCallId, activity }) => (+ <button+ key={toolCallId}+ type="button"+ onClick={() => onSelect(toolCallId)}+ className={cn(+ 'flex min-w-0 flex-1 items-center gap-2 rounded-lg px-2.5 py-1.5 text-xs transition-colors hover:bg-gray-3',+ toolCallId === selected.toolCallId+ ? 'bg-gray-3 text-gray-12'+ : 'text-gray-11',+ )}+ >+ <StatusMark status={activity.status} />+ <span className="truncate">{activity.title}</span>+ </button>+ ))}+ </div>+ )}++ <TaskDetails+ key={selected.toolCallId}+ activity={selected.activity}+ wide={fullscreen}+ />+ </>+ );++ if (fullscreen || !docked) {+ return (+ <Dialog+ open+ onOpenChange={(open) => {+ if (open) return;+ if (fullscreen && docked) {+ setFullscreen(false);+ } else {+ onClose();+ }+ }}+ >+ <DialogContent+ showCloseButton={false}+ showOverlay={false}+ aria-describedby={undefined}+ className="inset-0 top-0 left-0 flex h-full w-full max-w-none translate-x-0 translate-y-0 flex-col gap-0 rounded-none border-0 p-0 data-[state=closed]:zoom-out-100 data-[state=open]:zoom-in-100 data-[state=closed]:slide-out-to-left-0 data-[state=closed]:slide-out-to-top-0 data-[state=open]:slide-in-from-left-0 data-[state=open]:slide-in-from-top-0"+ >+ <DialogTitle className="sr-only">{title}</DialogTitle>+ {body}+ </DialogContent>+ </Dialog>+ );+ }++ return (+ <motion.aside+ initial={{ opacity: 0, x: 24 }}+ animate={{ opacity: 1, x: 0 }}+ transition={{ duration: 0.25 }}+ className="flex h-full w-[460px] shrink-0 flex-col border-l bg-panel xl:w-[540px]"+ >+ {body}+ </motion.aside>+ );+}++export function TaskPanelLayout({ children }: { children: React.ReactNode }) {+ const [slot, setSlot] = useState<HTMLDivElement | null>(null);+ const roomRef = useRef<HTMLDivElement>(null);+ const room = useElementSize(roomRef);+ const setChatAreaWidth = useChatStoreContext(+ (state) => state.setChatAreaWidth,+ );+ useEffect(() => setChatAreaWidth(room.width), [room.width, setChatAreaWidth]);+ return (+ <TaskPanelSlotContext.Provider value={slot}>+ <div ref={roomRef} className="flex h-full min-w-0 flex-1">+ {children}+ <div ref={setSlot} className="contents" />+ </div>+ </TaskPanelSlotContext.Provider>+ );+}++function useDocked(): boolean {+ return useChatStoreContext(chatStoreSelectors.taskPanelDocks);+}++function TaskDetails({+ activity,+ wide,+}: {+ activity: SubagentActivity;+ wide: boolean;+}) {+ const timeline = activity.timeline ?? [];+ const artifacts = activity.artifacts ?? [];+ const running = activity.status === 'running';++ return (+ <ChatContainerRoot className="min-h-0 flex-1">+ <ChatContainerContent+ className={cn('mx-auto px-5 py-5', wide && 'max-w-3xl')}+ >+ <div className="flex items-start gap-3">+ <div className="min-w-0 flex-1">+ <p className="text-lg font-medium text-gray-12">{activity.title}</p>+ <LiveLine activity={activity} />+ </div>+ <Duration activity={activity} />+ </div>++ {timeline.length > 0 && (+ <ol className="mt-5 flex flex-col gap-3">+ {timeline.map((entry, index) => (+ <TimelineItem+ key={`${index}-${entry.text}`}+ text={entry.text}+ active={running && index === timeline.length - 1}+ />+ ))}+ </ol>+ )}++ {!running && activity.summary && (+ <Section title={t('Findings')}>+ <div className="text-sm text-gray-12">+ <Markdown>{activity.summary}</Markdown>+ </div>+ </Section>+ )}++ {artifacts.length > 0 && (+ <Section title={t('Made')}>+ <div className="flex flex-wrap gap-1.5">+ {artifacts.map((artifact) => (+ <span+ key={`${artifact.type}-${artifact.id}`}+ className="max-w-full truncate rounded-md bg-gray-3 px-2 py-0.5 text-xs text-gray-12"+ >+ {artifact.name}+ </span>+ ))}+ </div>+ </Section>+ )}+ </ChatContainerContent>+ </ChatContainerRoot>+ );+}++function TimelineItem({ text, active }: { text: string; active: boolean }) {+ return (+ <motion.li+ initial={{ opacity: 0, y: 6 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.2 }}+ className="flex gap-3"+ >+ <span className="flex size-5 shrink-0 items-center justify-center">+ {active ? (+ <Loader2 className="size-3.5 animate-spin text-accent-10 motion-reduce:animate-none" />+ ) : (+ <Check className="size-3.5 text-success-10" strokeWidth={2.5} />+ )}+ </span>+ <p className="min-w-0 flex-1 text-sm text-gray-12">{text}</p>+ </motion.li>+ );+}++function Section({+ title,+ children,+}: {+ title: string;+ children: React.ReactNode;+}) {+ return (+ <section className="mt-6">+ <p className="pb-2 text-xs font-medium text-gray-11">{title}</p>+ {children}+ </section>+ );+}++export const TaskPanelSlotContext = createContext<HTMLElement | null>(null);diff --git a/packages/web/src/features/chat/lib/chat-store.ts b/packages/web/src/features/chat/lib/chat-store.tsindex f6b4fd0e7d5..45b01a8874b 100644--- a/packages/web/src/features/chat/lib/chat-store.ts+++ b/packages/web/src/features/chat/lib/chat-store.ts@@ -63,6 +63,8 @@ export type ChatStoreState = {builds: Record<string, BuildState>;dismissedGateIds: Record<string, true>;lastDismissedFormId: string | null;+ taskPanelToolCallId: string | null;+ chatAreaWidth: number;setConversationId: (conversationId: string | null) => void;approveGate: (gateId: string, payload?: Record<string, unknown>) => void;@@ -71,6 +73,9 @@ export type ChatStoreState = {dismissForm: (messageId: string) => void;resetInteractions: () => void;resetBuilds: () => void;+ openTaskPanel: (toolCallId: string) => void;+ setChatAreaWidth: (width: number) => void;+ closeTaskPanel: () => void;};export type ChatStore = ReturnType<typeof createChatStore>;@@ -94,6 +99,8 @@ export const createChatStore = () =>builds: {},dismissedGateIds: {},lastDismissedFormId: null,+ taskPanelToolCallId: null,+ chatAreaWidth: 0,approveGate: (gateId: string, payload?: Record<string, unknown>) => {set((prev) => dismissAndCleanup(prev, gateId));@@ -119,13 +126,27 @@ export const createChatStore = () =>toolCallMeta: {},dismissedGateIds: {},lastDismissedFormId: null,+ taskPanelToolCallId: null,});},resetBuilds: () => {set({ builds: {} });},+ openTaskPanel: (toolCallId: string) => {+ set({ taskPanelToolCallId: toolCallId });+ },+ closeTaskPanel: () => {+ set({ taskPanelToolCallId: null });+ },+ setChatAreaWidth: (width: number) => {+ set({ chatAreaWidth: width });+ },}));+function selectTaskPanelDocks(state: ChatStoreState): boolean {+ return state.chatAreaWidth >= TASK_PANEL_MIN_CHAT_AREA;+}+function selectActiveDisplayTool({state,lastAssistantMessage,@@ -286,8 +307,11 @@ export const chatStoreSelectors = {hasBlockingCard: selectHasBlockingCard,batchProgress: selectBatchProgress,buildById: selectBuildById,+ taskPanelDocks: selectTaskPanelDocks,};+const TASK_PANEL_MIN_CHAT_AREA = 1024;+export const chatBuildUtils = {mergeBuildPlan,};diff --git a/packages/web/src/features/chat/lib/use-chat.ts b/packages/web/src/features/chat/lib/use-chat.tsindex 4a7b7bd64e4..7ee210c6dc3 100644--- a/packages/web/src/features/chat/lib/use-chat.ts+++ b/packages/web/src/features/chat/lib/use-chat.ts@@ -256,7 +256,7 @@ function appendTrailingPart({}function progressOf(activity: SubagentActivity): number {- return activity.stepCount;+ return activity.stepCount + (activity.timeline?.length ?? 0);}const ALLOWED_MIME_SET: ReadonlySet<string> = new Set(CHAT_ALLOWED_MIME_TYPES);