diff --git a/frontend/src/components/message/MessagePart.tsx b/frontend/src/components/message/MessagePart.tsx index 0534d1fd..223fc0f4 100644 --- a/frontend/src/components/message/MessagePart.tsx +++ b/frontend/src/components/message/MessagePart.tsx @@ -177,7 +177,7 @@ export const MessagePart = memo(function MessagePart({ part, role, allParts, par case 'subtask': { const label = part.description || part.prompt || 'Sub-agent task' return ( -
+
{label} sub-agent diff --git a/frontend/src/components/message/PromptInput.tsx b/frontend/src/components/message/PromptInput.tsx index 3faeac4d..a64d4190 100644 --- a/frontend/src/components/message/PromptInput.tsx +++ b/frontend/src/components/message/PromptInput.tsx @@ -429,9 +429,13 @@ export const PromptInput = memo(forwardRef( setMentionRange(null) } - const handleAgentChange = (agent: string) => { - setLocalMode(agent) - setStoredAgent(sessionID, agent) + const handleAgentChange = (agentName: string) => { + setLocalMode(agentName) + setStoredAgent(sessionID, agentName) + const agent = agents.find(a => a.name === agentName) + if (agent?.model) { + setStoredModel({ providerID: agent.model.providerID, modelID: agent.model.modelID }) + } } const startVoiceRecording = async () => { diff --git a/frontend/src/components/message/ToolCallPart.tsx b/frontend/src/components/message/ToolCallPart.tsx index 0b2a7111..77ceae93 100644 --- a/frontend/src/components/message/ToolCallPart.tsx +++ b/frontend/src/components/message/ToolCallPart.tsx @@ -2,6 +2,7 @@ import { useState, useRef, useEffect } from 'react' import type { components } from '@/api/opencode-types' import { useSettings } from '@/hooks/useSettings' import { useUserBash } from '@/stores/userBashStore' +import { useSessionStatusForSession } from '@/stores/sessionStatusStore' import { usePermissions, useQuestions } from '@/contexts/EventContext' import { detectFileReferences } from '@/lib/fileReferences' import { ExternalLink, Loader2 } from 'lucide-react' @@ -68,6 +69,8 @@ function ClickableJson({ json, onFileClick }: { json: unknown; onFileClick?: (fi export function ToolCallPart({ part, onFileClick, onChildSessionClick }: ToolCallPartProps) { const { preferences } = useSettings() const { userBashCommands } = useUserBash() + const taskSessionId = part.tool === 'task' ? getTaskSessionId(part) : undefined + const taskSessionStatus = useSessionStatusForSession(taskSessionId) const { getForCallID: getPermissionForCallID } = usePermissions() const { getForCallID: getQuestionForCallID } = useQuestions() const outputRef = useRef(null) @@ -152,17 +155,36 @@ export function ToolCallPart({ part, onFileClick, onChildSessionClick }: ToolCal const isFileTool = ['read', 'write', 'edit'].includes(part.tool) if (part.tool === 'task') { - const sessionId = getTaskSessionId(part) + const sessionId = taskSessionId const description = previewText || 'Sub-agent task' - const isRunning = part.state.status === 'running' || part.state.status === 'pending' + const status = part.state.status + + const isPending = status === 'pending' + const isRunning = status === 'running' && taskSessionStatus.type !== 'idle' + const isCompleted = status === 'completed' || (status === 'running' && !!sessionId && taskSessionStatus.type === 'idle') + const isError = status === 'error' + const content = (
- {isRunning ? ( - - ) : null} + {isPending && ( +
+ + + +
+ )} + {isRunning && ( +
+ + + +
+ )} + {isCompleted && } + {isError && } {description} - sub-agent - {sessionId && } + sub-agent + {sessionId && }
) @@ -170,7 +192,7 @@ export function ToolCallPart({ part, onFileClick, onChildSessionClick }: ToolCal return (