diff --git a/frontend/src/components/message/TextPart.tsx b/frontend/src/components/message/TextPart.tsx index bc13285d..c37e44f0 100644 --- a/frontend/src/components/message/TextPart.tsx +++ b/frontend/src/components/message/TextPart.tsx @@ -49,7 +49,7 @@ function CodeBlock({ children, className, ...props }: CodeBlockProps) { return (
-
+      
         {children}
       
-
+
$ {typeof part.state.input?.command === 'string' ? part.state.input.command : ''}
@@ -270,7 +295,7 @@ export function ToolCallPart({ part, onFileClick, onChildSessionClick }: ToolCal {part.state.status === 'error' && (
Error:
-
+              
                 {part.state.error}
               
diff --git a/frontend/src/hooks/useSSE.ts b/frontend/src/hooks/useSSE.ts index 1e9d37aa..e3402ba3 100644 --- a/frontend/src/hooks/useSSE.ts +++ b/frontend/src/hooks/useSSE.ts @@ -272,13 +272,36 @@ export const useSSE = (opcodeUrl: string | null | undefined, directory?: string) const now = Date.now() const updated = currentData.map(msg => { if (msg.info.role !== 'assistant') return msg - if ('completed' in msg.info.time && msg.info.time.completed) return msg + + const updatedParts = msg.parts.map(part => { + if (part.type !== 'tool') return part + if (part.state.status !== 'running' && part.state.status !== 'pending') return part + return { + ...part, + state: { + ...part.state, + status: 'completed' as const, + output: part.state.status === 'running' ? '[Session ended - output not captured]' : '[Tool was pending when session ended]', + title: part.state.status === 'running' ? (part.state as { title?: string }).title || '' : '', + metadata: (part.state as { metadata?: Record }).metadata || {}, + time: { + start: (part.state as { time?: { start: number } }).time?.start || now, + end: now + } + } + } + }) + + const msgUpdated = updatedParts !== msg.parts + if ('completed' in msg.info.time && msg.info.time.completed && !msgUpdated) return msg + return { ...msg, info: { ...msg.info, time: { ...msg.info.time, completed: now } - } + }, + parts: updatedParts } }) diff --git a/frontend/src/index.css b/frontend/src/index.css index eda914cc..87445b35 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -217,6 +217,23 @@ body { .prose-enhanced pre { margin-top: 1.5em; margin-bottom: 1.5em; + white-space: pre-wrap; + word-break: break-word; +} + +.prose-enhanced code { + word-break: break-all; +} + +@media (max-width: 640px) { + .prose-enhanced pre { + padding: 0.5rem; + font-size: 0.75rem; + } + + .prose-enhanced code { + font-size: 0.75rem; + } } .prose-enhanced :first-child {